summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorabcd <qt-info@nokia.com>2010-04-08 23:08:16 +1000
committerabcd <qt-info@nokia.com>2010-04-08 23:08:16 +1000
commit12429012decdbc62e51f594f5eaee14b2019b6c6 (patch)
treec8efe92c86361ebc4b560426ec65f00bf9c49c41
parent854c0ef522d606d33d9ab7a47d360a1f126e1201 (diff)
Merge
Merge branch '1.1-mapsintegrate' of scm.dev.nokia.troll.no:qtmobility/qtm-location into 1.1-mapsintegrate modified: qgeosatelliteinfosource_s60.cpp
-rw-r--r--examples/mapviewer/images.qrc5
-rw-r--r--examples/mapviewer/images/house.png (renamed from examples/mapviewer/house.png)bin1517 -> 1517 bytes
-rw-r--r--examples/mapviewer/images/qt.pngbin0 -> 597 bytes
-rw-r--r--examples/mapviewer/mainwindow.cpp153
-rw-r--r--examples/mapviewer/mainwindow.h16
-rw-r--r--examples/qgeoapiui/mainwindow.cpp93
-rw-r--r--examples/qgeoapiui/mainwindow.h23
-rw-r--r--examples/qgeoapiui/placepresenter.cpp9
-rw-r--r--examples/qgeoapiui/routepresenter.cpp16
-rw-r--r--examples/qgeoapiui/routepresenter.h8
-rw-r--r--examples/qgeoapiui/ui_mainwindow.h11
-rw-r--r--src/location/gconfitem.cpp188
-rw-r--r--src/location/gconfitem.h6
-rw-r--r--src/location/liblocationwrapper.cpp125
-rw-r--r--src/location/liblocationwrapper.h15
-rw-r--r--src/location/location.pro152
-rw-r--r--src/location/qgeoaddress.cpp30
-rw-r--r--src/location/qgeoaddress.h4
-rw-r--r--src/location/qgeoareamonitor_maemo.cpp32
-rw-r--r--src/location/qgeoareamonitor_maemo_p.h5
-rw-r--r--src/location/qgeocodingreply.cpp99
-rw-r--r--src/location/qgeocodingreply.h57
-rw-r--r--src/location/qgeocodingreply_nokia.cpp137
-rw-r--r--src/location/qgeocodingreply_nokia_p.h79
-rw-r--r--src/location/qgeocodingreply_p.h12
-rw-r--r--src/location/qgeocodingrequest.cpp80
-rw-r--r--src/location/qgeocodingrequest.h3
-rw-r--r--src/location/qgeocodingrequest_p.h3
-rw-r--r--src/location/qgeocodingservice.cpp157
-rw-r--r--src/location/qgeocodingservice.h75
-rw-r--r--src/location/qgeocodingservice_nokia.cpp152
-rw-r--r--src/location/qgeocodingservice_nokia_p.h88
-rw-r--r--src/location/qgeocodingxmlparser.h40
-rw-r--r--src/location/qgeocodingxmlparser_nokia.cpp (renamed from src/location/qgeocodingxmlparser.cpp)76
-rw-r--r--src/location/qgeocodingxmlparser_nokia_p.h42
-rw-r--r--src/location/qgeoengine.cpp281
-rw-r--r--src/location/qgeolocation.cpp20
-rw-r--r--src/location/qgeolocation.h8
-rw-r--r--src/location/qgeolocation_p.h7
-rw-r--r--src/location/qgeomapservice.cpp122
-rw-r--r--src/location/qgeomapservice.h (renamed from src/location/qmaptilereply.h)58
-rw-r--r--src/location/qgeomapservice_nokia.cpp208
-rw-r--r--src/location/qgeomapservice_nokia_p.h (renamed from src/location/qgeoengine.h)83
-rw-r--r--src/location/qgeomaptile.h (renamed from src/location/qmaptile.h)0
-rw-r--r--src/location/qgeomaptilecache.cpp (renamed from src/location/qmaptilecache.cpp)33
-rw-r--r--src/location/qgeomaptilecache.h (renamed from src/location/qmaptilecache.h)18
-rw-r--r--src/location/qgeomaptilereply.cpp154
-rw-r--r--src/location/qgeomaptilereply.h92
-rw-r--r--src/location/qgeomaptilereply_nokia.cpp107
-rw-r--r--src/location/qgeomaptilereply_nokia_p.h (renamed from src/location/qgeoreply.h)30
-rw-r--r--src/location/qgeomaptilereply_p.h (renamed from src/location/qmaptilereply.cpp)17
-rw-r--r--src/location/qgeomaptilerequest.cpp301
-rw-r--r--src/location/qgeomaptilerequest.h (renamed from src/location/qgeonetworkmanager_p.h)78
-rw-r--r--src/location/qgeomaptilerequest_p.h29
-rwxr-xr-xsrc/location/qgeonetworkmanager.cpp603
-rw-r--r--src/location/qgeonetworkmanager.h112
-rw-r--r--src/location/qgeopositioninfosource_maemo5.cpp18
-rw-r--r--src/location/qgeopositioninfosource_maemo5_p.h4
-rw-r--r--src/location/qgeopositioninfosource_s60.cpp2
-rw-r--r--src/location/qgeoroute.cpp211
-rw-r--r--src/location/qgeoroute.h84
-rw-r--r--src/location/qgeoroute_p.h (renamed from src/location/qroute.h)37
-rw-r--r--src/location/qgeoroutereply.cpp148
-rw-r--r--src/location/qgeoroutereply.h (renamed from src/location/qroutereply.h)65
-rw-r--r--src/location/qgeoroutereply_nokia.cpp136
-rw-r--r--src/location/qgeoroutereply_nokia_p.h80
-rw-r--r--src/location/qgeoroutereply_p.h (renamed from src/location/qroutereply_p.h)13
-rw-r--r--[-rwxr-xr-x]src/location/qgeorouterequest.cpp (renamed from src/location/qrouterequest.cpp)238
-rw-r--r--[-rwxr-xr-x]src/location/qgeorouterequest.h (renamed from src/location/qrouterequest.h)16
-rw-r--r--[-rwxr-xr-x]src/location/qgeorouterequest_p.h (renamed from src/location/qrouterequest_p.h)16
-rw-r--r--src/location/qgeoroutexmlparser_nokia.cpp (renamed from src/location/qroutexmlparser.cpp)120
-rw-r--r--src/location/qgeoroutexmlparser_nokia_p.h48
-rw-r--r--src/location/qgeoroutingservice.cpp (renamed from src/location/qgeoreply.cpp)56
-rw-r--r--src/location/qgeoroutingservice.h73
-rw-r--r--src/location/qgeoroutingservice_nokia.cpp132
-rw-r--r--src/location/qgeoroutingservice_nokia_p.h87
-rw-r--r--src/location/qgeosatelliteinfosource_maemo5.cpp60
-rw-r--r--src/location/qgeosatelliteinfosource_maemo5_p.h4
-rw-r--r--src/location/qgeosatelliteinfosource_s60.cpp2
-rw-r--r--src/location/qlandmark.cpp30
-rw-r--r--src/location/qlandmark.h5
-rw-r--r--src/location/qlandmarkabstractrequest.h2
-rw-r--r--src/location/qlandmarkboxfilter.cpp10
-rw-r--r--src/location/qlandmarkcategory.cpp9
-rw-r--r--src/location/qlandmarkcategoryid.cpp6
-rw-r--r--src/location/qlandmarkcategoryid_p.h13
-rw-r--r--src/location/qlandmarkcustomfilter.h2
-rw-r--r--src/location/qlandmarkcustomsort.h2
-rw-r--r--src/location/qlandmarkfilter.cpp18
-rw-r--r--src/location/qlandmarkfilter.h11
-rw-r--r--src/location/qlandmarkid.cpp6
-rw-r--r--src/location/qlandmarkid_p.h13
-rw-r--r--src/location/qlandmarkmanager.cpp12
-rw-r--r--src/location/qlandmarkmanager.h12
-rw-r--r--src/location/qlandmarkmanagerengine.cpp88
-rw-r--r--src/location/qlandmarkmanagerengine.h50
-rw-r--r--src/location/qlandmarkmanagerenginefactory.cpp2
-rw-r--r--src/location/qlandmarkmanagerenginefactory.h4
-rw-r--r--src/location/qlandmarkproximityfilter.cpp14
-rw-r--r--src/location/qlandmarksortorder.h2
-rw-r--r--src/location/qlandmarkunionfilter.cpp8
-rw-r--r--src/location/qlocationutils_p.h1
-rw-r--r--src/location/qmaneuver.cpp293
-rw-r--r--src/location/qmaneuver.h48
-rw-r--r--src/location/qmaneuver_p.h (renamed from src/location/qmaptilerequest_p.h)39
-rw-r--r--src/location/qmapellipse.cpp30
-rw-r--r--src/location/qmapline.cpp13
-rw-r--r--src/location/qmapline.h2
-rw-r--r--src/location/qmapmarker.cpp20
-rw-r--r--src/location/qmapobject.cpp18
-rw-r--r--src/location/qmappixmap.cpp12
-rw-r--r--src/location/qmappixmap.h4
-rw-r--r--src/location/qmappolygon.cpp13
-rw-r--r--src/location/qmappolygon.h2
-rw-r--r--src/location/qmaprect.cpp18
-rw-r--r--src/location/qmaproute.cpp17
-rw-r--r--src/location/qmaproute.h6
-rw-r--r--src/location/qmaproute_p.h2
-rw-r--r--src/location/qmaptilerequest.cpp194
-rw-r--r--src/location/qmaptilerequest.h166
-rwxr-xr-xsrc/location/qmapview.cpp89
-rwxr-xr-xsrc/location/qmapview.h23
-rwxr-xr-xsrc/location/qmapview_p.cpp27
-rwxr-xr-xsrc/location/qmapview_p.h10
-rw-r--r--src/location/qmlbackendmonitorao_s60.cpp2
-rw-r--r--src/location/qreversegeocodingrequest.cpp55
-rw-r--r--src/location/qreversegeocodingrequest.h2
-rw-r--r--src/location/qreversegeocodingrequest_p.h4
-rw-r--r--src/location/qroute.cpp128
-rw-r--r--src/location/qroutereply.cpp161
-rw-r--r--src/location/qroutexmlparser.h45
131 files changed, 4659 insertions, 3106 deletions
diff --git a/examples/mapviewer/images.qrc b/examples/mapviewer/images.qrc
index ebe6fc25ba..64c0b75694 100644
--- a/examples/mapviewer/images.qrc
+++ b/examples/mapviewer/images.qrc
@@ -1,5 +1,8 @@
<RCC>
<qresource prefix="/marker">
- <file>house.png</file>
+ <file>images/house.png</file>
+ </qresource>
+ <qresource prefix="/logo">
+ <file>images/qt.png</file>
</qresource>
</RCC>
diff --git a/examples/mapviewer/house.png b/examples/mapviewer/images/house.png
index 2bc69a7466..2bc69a7466 100644
--- a/examples/mapviewer/house.png
+++ b/examples/mapviewer/images/house.png
Binary files differ
diff --git a/examples/mapviewer/images/qt.png b/examples/mapviewer/images/qt.png
new file mode 100644
index 0000000000..60c2df89e1
--- /dev/null
+++ b/examples/mapviewer/images/qt.png
Binary files differ
diff --git a/examples/mapviewer/mainwindow.cpp b/examples/mapviewer/mainwindow.cpp
index 93944c1132..73fd171c1f 100644
--- a/examples/mapviewer/mainwindow.cpp
+++ b/examples/mapviewer/mainwindow.cpp
@@ -51,28 +51,38 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
-#include "qmaptile.h"
-#include "qrouterequest.h"
+#include "qgeomaptile.h"
+#include "qgeorouterequest.h"
#include "qmapmarker.h"
#include "qmapellipse.h"
#include "qmaproute.h"
#include "qmaprect.h"
#include "qmapline.h"
#include "qmappolygon.h"
+#include "qmappixmap.h"
#include "qmapmarker.h"
+#include "qgeomapservice_nokia_p.h"
+#include "qgeoroutingservice_nokia_p.h"
+
QTM_USE_NAMESPACE
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow),
- geoNetworkManager("", "")
+ popupMenu(NULL)
{
ui->setupUi(this);
+ QGeoMapServiceNokia *mService = new QGeoMapServiceNokia();
+ QGeoRoutingServiceNokia *rService = new QGeoRoutingServiceNokia();
+
QNetworkProxy proxy(QNetworkProxy::HttpProxy, "172.16.42.41", 8080);
- geoNetworkManager.setMapProxy(proxy);
- geoNetworkManager.setMapServer("maptile.mapplayer.maps.svc.ovi.com");
+ mService->setProxy(proxy);
+ mService->setHost("maptile.mapplayer.maps.svc.ovi.com");
+
+ mapService = mService;
+ routingService = rService;
qgv = new QGraphicsView(this);
qgv->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
@@ -87,8 +97,8 @@ MainWindow::MainWindow(QWidget *parent) :
qgv->scene()->addItem(mapView);
mapView->setGeometry(0, 0, width(), height());
- QObject::connect(&geoNetworkManager, SIGNAL(finished(QRouteReply*)),
- this, SLOT(routeReplyFinished(QRouteReply*)));
+ QObject::connect(routingService, SIGNAL(finished(QGeoRouteReply*)),
+ this, SLOT(routeReplyFinished(QGeoRouteReply*)));
QObject::connect(mapView, SIGNAL(mapClicked(QGeoCoordinate, QGraphicsSceneMouseEvent*)),
this, SLOT(mapClicked(QGeoCoordinate, QGraphicsSceneMouseEvent*)));
QObject::connect(mapView, SIGNAL(zoomLevelChanged(quint16, quint16)),
@@ -107,18 +117,59 @@ MainWindow::MainWindow(QWidget *parent) :
//QGraphicsProxyWidget* proxy = qgv->scene()->addWidget(slider);
+ setContextMenuPolicy(Qt::CustomContextMenu);
+ QObject::connect(this, SIGNAL(customContextMenuRequested(const QPoint&)),
+ this, SLOT(customContextMenuRequest(const QPoint&)));
+
+ setWindowTitle(tr("Map Viewer Demo"));
+
+ QTimer::singleShot(0, this, SLOT(delayedInit()));
+}
+
+MainWindow::~MainWindow()
+{
+ delete ui;
+ delete mapService;
+ delete routingService;
+}
+
+void MainWindow::delayedInit()
+{
+#ifdef Q_OS_SYMBIAN
+ // Set Internet Access Point
+ QNetworkConfigurationManager manager;
+ const bool canStartIAP = (manager.capabilities()
+ & QNetworkConfigurationManager::CanStartAndStopInterfaces);
+ // Is there default access point, use it
+ QNetworkConfiguration cfg = manager.defaultConfiguration();
+ if (!cfg.isValid() || (!canStartIAP && cfg.state() != QNetworkConfiguration::Active)) {
+ QMessageBox::information(this, tr("MapViewer Example"), tr(
+ "Available Access Points not found."));
+ return;
+ }
+
+ session = new QNetworkSession(cfg, this);
+ session->open();
+ session->waitForOpened(-1);
+#endif
+
+ mapView->init(mapService, QGeoCoordinate(52.35, 13));
+}
+
+void MainWindow::createMenus()
+{
popupMenu = new QMenu(this);
- QAction* menuItem;
+ QAction* menuItem;
menuItem = new QAction(tr("Add marker here"), this);
popupMenu->addAction(menuItem);
QObject::connect(menuItem, SIGNAL(triggered(bool)),
this, SLOT(addMarker(bool)));
-
+
menuItem = new QAction(tr("Add icon marker here"), this);
popupMenu->addAction(menuItem);
QObject::connect(menuItem, SIGNAL(triggered(bool)),
this, SLOT(addIconMarker(bool)));
-
+
menuItem = new QAction(tr(""), this);
menuItem->setSeparator(true);
popupMenu->addAction(menuItem);
@@ -127,10 +178,10 @@ MainWindow::MainWindow(QWidget *parent) :
popupMenu->addAction(menuItem);
QObject::connect(menuItem, SIGNAL(triggered(bool)),
this, SLOT(setRtFromTo(bool)));
-
+
QMenu* subMenuItem = new QMenu(tr("Draw"), this);
popupMenu->addMenu(subMenuItem);
-
+
menuItem = new QAction(tr("Line"), this);
subMenuItem->addAction(menuItem);
QObject::connect(menuItem, SIGNAL(triggered(bool)),
@@ -151,6 +202,11 @@ MainWindow::MainWindow(QWidget *parent) :
QObject::connect(menuItem, SIGNAL(triggered(bool)),
this, SLOT(drawPolygon(bool)));
+ menuItem = new QAction(tr("Pixmap"), this);
+ subMenuItem->addAction(menuItem);
+ QObject::connect(menuItem, SIGNAL(triggered(bool)),
+ this, SLOT(drawPixmap(bool)));
+
menuItem = new QAction(tr(""), this);
menuItem->setSeparator(true);
popupMenu->addAction(menuItem);
@@ -159,61 +215,27 @@ MainWindow::MainWindow(QWidget *parent) :
popupMenu->addAction(mnDay);
QObject::connect(mnDay, SIGNAL(triggered(bool)),
this, SLOT(setScheme(bool)));
-
+
mnSat = new QAction(tr("Satellite"), this);
popupMenu->addAction(mnSat);
QObject::connect(mnSat, SIGNAL(triggered(bool)),
this, SLOT(setScheme(bool)));
-
+
mnTer = new QAction(tr("Terrain"), this);
popupMenu->addAction(mnTer);
QObject::connect(mnTer, SIGNAL(triggered(bool)),
this, SLOT(setScheme(bool)));
-
+
menuItem = new QAction(tr(""), this);
menuItem->setSeparator(true);
popupMenu->addAction(menuItem);
-
+
menuItem = new QAction(tr("Exit"), this);
popupMenu->addAction(menuItem);
QObject::connect(menuItem, SIGNAL(triggered(bool)),
this, SLOT(close()));
-
- setContextMenuPolicy(Qt::CustomContextMenu);
- QObject::connect(this, SIGNAL(customContextMenuRequested(const QPoint&)),
- this, SLOT(customContextMenuRequest(const QPoint&)));
-
- setWindowTitle(tr("Map Viewer Demo"));
-
- QTimer::singleShot(0, this, SLOT(delayedInit()));
}
-MainWindow::~MainWindow()
-{
- delete ui;
-}
-void MainWindow::delayedInit()
-{
-#ifdef Q_OS_SYMBIAN
- // Set Internet Access Point
- QNetworkConfigurationManager manager;
- const bool canStartIAP = (manager.capabilities()
- & QNetworkConfigurationManager::CanStartAndStopInterfaces);
- // Is there default access point, use it
- QNetworkConfiguration cfg = manager.defaultConfiguration();
- if (!cfg.isValid() || (!canStartIAP && cfg.state() != QNetworkConfiguration::Active)) {
- QMessageBox::information(this, tr("MapViewer Example"), tr(
- "Available Access Points not found."));
- return;
- }
-
- session = new QNetworkSession(cfg, this);
- session->open();
- session->waitForOpened(-1);
-#endif
-
- mapView->init(&geoNetworkManager, QGeoCoordinate(52.35, 13));
-}
void MainWindow::resizeEvent(QResizeEvent* event)
{
qgv->resize(event->size());
@@ -233,9 +255,9 @@ void MainWindow::changeEvent(QEvent *e)
}
}
-void MainWindow::routeReplyFinished(QRouteReply* reply)
+void MainWindow::routeReplyFinished(QGeoRouteReply* reply)
{
- QList<QRoute> routes = reply->routes();
+ QList<QGeoRoute> routes = reply->routes();
if (routes.size() > 0) {
QColor routeColor(Qt::blue);
@@ -254,8 +276,11 @@ void MainWindow::mapClicked(QGeoCoordinate geoCoord, QGraphicsSceneMouseEvent* /
void MainWindow::customContextMenuRequest(const QPoint& point)
{
- if(focusWidget()==qgv)
+ if (focusWidget() == qgv) {
+ if (!popupMenu)
+ createMenus();
popupMenu->popup(mapToGlobal(point));
+ }
}
void MainWindow::mapObjectSelected(QMapObject* /*mapObject*/)
@@ -271,15 +296,14 @@ void MainWindow::setRtFromTo(bool /*checked*/)
QGeoCoordinate from = selectedMarkers.first()->point();
QGeoCoordinate to = selectedMarkers.last()->point();
- QRouteRequest request;
+ QGeoRouteRequest request;
request.setSource(from);
request.setDestination(to);
- for (int i = 1; i < selectedMarkers.count() - 1; i++) {
+ for (int i = 1; i < selectedMarkers.count() - 1; i++)
request.addStopOver(selectedMarkers[i]->point());
- }
- geoNetworkManager.get(request);
+ routingService->getRoute(request);
selectedMarkers.clear();
}
@@ -310,8 +334,8 @@ void MainWindow::addMarker(bool /*checked*/)
void MainWindow::addIconMarker(bool /*checked*/)
{
QMapMarker* marker = new QMapMarker(lastClicked, QString::number(selectedMarkers.count() + 1),
- QFont("Arial", 6, QFont::Bold), QColor(Qt::black),
- QPixmap(":/marker/house.png"));
+ QFont("Arial", 8, QFont::Bold), QColor(Qt::black),
+ QPixmap(":/marker/images/house.png"));
mapView->addMapObject(marker);
selectedMarkers.append(marker);
}
@@ -364,9 +388,8 @@ void MainWindow::drawPolygon(bool /*checked*/)
{
QList<QGeoCoordinate> coords;
- for (int i = 0; i < selectedMarkers.count(); i++) {
+ for (int i = 0; i < selectedMarkers.count(); i++)
coords.append(selectedMarkers[i]->point());
- }
QPen pen(Qt::white);
pen.setWidth(2);
@@ -376,3 +399,11 @@ void MainWindow::drawPolygon(bool /*checked*/)
selectedMarkers.clear();
}
+void MainWindow::drawPixmap(bool /*checked*/)
+{
+ if (selectedMarkers.count())
+ mapView->addMapObject(new QMapPixmap(selectedMarkers[0]->point(),
+ QPixmap(":/logo/images/qt.png"), 1));
+
+ selectedMarkers.clear();
+}
diff --git a/examples/mapviewer/mainwindow.h b/examples/mapviewer/mainwindow.h
index 6ac75e9004..876e68b664 100644
--- a/examples/mapviewer/mainwindow.h
+++ b/examples/mapviewer/mainwindow.h
@@ -51,8 +51,9 @@
#include <QGraphicsSceneMouseEvent>
#include "qmapview.h"
-#include "qroutereply.h"
-#include "qgeonetworkmanager.h"
+#include "qgeoroutereply.h"
+#include "qgeomapservice.h"
+#include "qgeoroutingservice.h"
namespace Ui
{
@@ -77,10 +78,13 @@ protected:
void changeEvent(QEvent *e);
virtual void resizeEvent(QResizeEvent* event);
+private:
+ void createMenus();
+
private slots:
void mapClicked(QGeoCoordinate geoCoord, QGraphicsSceneMouseEvent* mouseEvent);
void mapObjectSelected(QMapObject* mapObject);
- void routeReplyFinished(QRouteReply* reply);
+ void routeReplyFinished(QGeoRouteReply* reply);
void setRtFromTo(bool checked);
void zoomLevelChanged(quint16 oldZoomLevel, quint16 newZoomLevel);
void setScheme(bool checked);
@@ -90,6 +94,7 @@ private slots:
void drawRect(bool checked);
void drawEllipse(bool checked);
void drawPolygon(bool checked);
+ void drawPixmap(bool checked);
void customContextMenuRequest(const QPoint&);
void delayedInit();
@@ -98,14 +103,15 @@ private:
private:
QGraphicsView* qgv;
- QGeoNetworkManager geoNetworkManager;
+ QGeoMapService *mapService;
+ QGeoRoutingService *routingService;
QMapView* mapView;
QSlider* slider;
QMenu* popupMenu;
QAction* mnDay;
QAction* mnSat;
QAction* mnTer;
-
+
QGeoCoordinate lastClicked;
QList<const QMapMarker*> selectedMarkers;
diff --git a/examples/qgeoapiui/mainwindow.cpp b/examples/qgeoapiui/mainwindow.cpp
index f3585a7fe3..2fde657efe 100644
--- a/examples/qgeoapiui/mainwindow.cpp
+++ b/examples/qgeoapiui/mainwindow.cpp
@@ -44,7 +44,11 @@
#include "routepresenter.h"
#include "placepresenter.h"
-#include "qmaptile.h"
+#include "qgeomaptile.h"
+
+#include "qgeocodingservice_nokia_p.h"
+#include "qgeoroutingservice_nokia_p.h"
+#include "qgeomapservice_nokia_p.h"
#include <QTimer>
#ifdef Q_OS_SYMBIAN
@@ -55,19 +59,29 @@
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
- ui(new Ui::MainWindow),
- geoNetworkManager("", "")
+ ui(new Ui::MainWindow)
{
ui->setupUi(this);
- QObject::connect(&geoNetworkManager, SIGNAL(finished(QRouteReply*)),
- this, SLOT(routeReplyFinished(QRouteReply*)));
+ geocodingService = new QGeocodingServiceNokia();
+ routingService = new QGeoRoutingServiceNokia();
+ QGeoMapServiceNokia *mService = new QGeoMapServiceNokia();
+
+ QNetworkProxy proxy(QNetworkProxy::HttpProxy, "172.16.42.41", 8080);
+ mService->setProxy(proxy);
+ mService->setHost("origin.maptile.svc.tst.s2g.gate5.de");
+
+ mapService = mService;
+
- QObject::connect(&geoNetworkManager, SIGNAL(finished(QGeocodingReply*)),
+ QObject::connect(routingService, SIGNAL(finished(QGeoRouteReply*)),
+ this, SLOT(routeReplyFinished(QGeoRouteReply*)));
+
+ QObject::connect(geocodingService, SIGNAL(finished(QGeocodingReply*)),
this, SLOT(codingReplyFinished(QGeocodingReply*)));
- QObject::connect(&geoNetworkManager, SIGNAL(finished(QMapTileReply*)),
- this, SLOT(mapTileReplyFinished(QMapTileReply*)));
+ QObject::connect(mapService, SIGNAL(finished(QGeoMapTileReply*)),
+ this, SLOT(mapTileReplyFinished(QGeoMapTileReply*)));
ui->mapTileLabel->setVisible(false);
@@ -85,6 +99,9 @@ MainWindow::MainWindow(QWidget *parent) :
MainWindow::~MainWindow()
{
delete ui;
+ delete geocodingService;
+ delete routingService;
+ delete mapService;
}
void MainWindow::delayedInit()
@@ -151,9 +168,8 @@ void MainWindow::delayedInit()
setContextMenuPolicy(Qt::CustomContextMenu);
QObject::connect(this, SIGNAL(customContextMenuRequested(const QPoint&)),
- this, SLOT(customContextMenuRequest(const QPoint&)));
+ this, SLOT(customContextMenuRequest(const QPoint&)));
#endif
-
}
void MainWindow::changeEvent(QEvent *e)
@@ -170,9 +186,9 @@ void MainWindow::changeEvent(QEvent *e)
void MainWindow::on_btnRequest_clicked()
{
- QGeoCoordinate src(ui->srcLat->toPlainText().toDouble(),ui->srcLong->toPlainText().toDouble());
+ QGeoCoordinate src(ui->srcLat->toPlainText().toDouble(), ui->srcLong->toPlainText().toDouble());
QGeoCoordinate dst(ui->dstLat->toPlainText().toDouble(), ui->dstLong->toPlainText().toDouble());
- QRouteRequest request;
+ QGeoRouteRequest request;
request.setSource(src);
request.setDestination(dst);
@@ -181,7 +197,7 @@ void MainWindow::on_btnRequest_clicked()
ui->treeWidget->setVisible(true);
ui->treeWidget->clear();
- geoNetworkManager.get(request);
+ routingService->getRoute(request);
}
void MainWindow::on_btnReverseCoding_clicked()
@@ -193,7 +209,7 @@ void MainWindow::on_btnReverseCoding_clicked()
ui->treeWidget->setVisible(true);
ui->treeWidget->clear();
- geoNetworkManager.get(request);
+ geocodingService->reverseGeocode(request);
}
void MainWindow::on_btnCoding_clicked()
@@ -203,8 +219,7 @@ void MainWindow::on_btnCoding_clicked()
if (!s.isEmpty()) {
request.setOneBoxLocation(s);
- }
- else {
+ } else {
request.setCountry(ui->country->toPlainText());
request.setState(ui->state->toPlainText());
request.setCity(ui->city->toPlainText());
@@ -217,7 +232,7 @@ void MainWindow::on_btnCoding_clicked()
ui->treeWidget->setVisible(true);
ui->treeWidget->clear();
- QGeocodingReply* reply = geoNetworkManager.get(request);
+ QGeocodingReply* reply = geocodingService->geocode(request);
QObject::connect(reply, SIGNAL(finished()), this, SLOT(testReplyFinishedSignal()));
}
@@ -225,18 +240,14 @@ void MainWindow::on_btnCoding_clicked()
void MainWindow::on_btnRequestTile_clicked()
{
QGeoCoordinate coord(ui->tileLat->toPlainText().toDouble(),
- ui->tileLong->toPlainText().toDouble()
- );
+ ui->tileLong->toPlainText().toDouble()
+ );
quint16 zoomLevel = ui->tileZoomLevel->toPlainText().toInt();
ui->mapTileLabel->setVisible(true);
ui->treeWidget->setVisible(false);
- QNetworkProxy proxy(QNetworkProxy::HttpProxy, "172.16.42.41", 8080);
- geoNetworkManager.setMapProxy(proxy);
- geoNetworkManager.setMapServer("origin.maptile.svc.tst.s2g.gate5.de");
-
- QMapTileRequest request;
+ QGeoMapTileRequest request;
request.setVersion(MapVersion(MapVersion::Newest));
request.setScheme(MapScheme(MapScheme::Normal_Day));
request.setResolution(MapResolution(MapResolution::Res_256_256));
@@ -244,34 +255,34 @@ void MainWindow::on_btnRequestTile_clicked()
quint32 col;
quint32 row;
- QGeoEngine::getMercatorTileIndex(coord, zoomLevel, &col, &row);
+ QGeoMapServiceNokia::getMercatorTileIndex(coord, zoomLevel, &col, &row);
request.setCol((quint32) col);
request.setRow((quint32) row);
request.setZoomLevel(zoomLevel);
- geoNetworkManager.get(request);
+ mapService->getMapTile(request);
}
-void MainWindow::routeReplyFinished(QRouteReply* reply)
+void MainWindow::routeReplyFinished(QGeoRouteReply* reply)
{
RoutePresenter presenter(ui->treeWidget, reply);
presenter.show();
- geoNetworkManager.release(reply);
+ reply->deleteLater();
}
void MainWindow::codingReplyFinished(QGeocodingReply* reply)
{
PlacePresenter presenter(ui->treeWidget, reply);
presenter.show();
- geoNetworkManager.release(reply);
+ reply->deleteLater();
}
-void MainWindow::mapTileReplyFinished(QMapTileReply* reply)
+void MainWindow::mapTileReplyFinished(QGeoMapTileReply* reply)
{
QPixmap pixmap;
- pixmap.loadFromData(reply->rawData());
+ pixmap.loadFromData(reply->data());
ui->mapTileLabel->setPixmap(pixmap);
- geoNetworkManager.release(reply);
+ reply->deleteLater();
}
void MainWindow::testReplyFinishedSignal()
@@ -288,51 +299,51 @@ void MainWindow::customContextMenuRequest(const QPoint& point)
void MainWindow::showRouteRequestControls(bool visible)
{
- if(visible) {
+ if (visible) {
showGeocodingControls(false);
showReverseGeocodingControls(false);
showMapTileControls(false);
}
- for(int i=0;i<ui->routeLayout->count();++i)
+ for (int i = 0;i < ui->routeLayout->count();++i)
ui->routeLayout->itemAt(i)->widget()->setVisible(visible);
}
void MainWindow::showGeocodingControls(bool visible)
{
- if(visible) {
+ if (visible) {
showRouteRequestControls(false);
showReverseGeocodingControls(false);
showMapTileControls(false);
}
- for(int i=0;i<ui->geocoding_1_Layout->count();++i)
+ for (int i = 0;i < ui->geocoding_1_Layout->count();++i)
ui->geocoding_1_Layout->itemAt(i)->widget()->setVisible(visible);
- for(int i=0;i<ui->geocodind_2_Layout->count();++i)
+ for (int i = 0;i < ui->geocodind_2_Layout->count();++i)
ui->geocodind_2_Layout->itemAt(i)->widget()->setVisible(visible);
}
void MainWindow::showReverseGeocodingControls(bool visible)
{
- if(visible) {
+ if (visible) {
showGeocodingControls(false);
showRouteRequestControls(false);
showMapTileControls(false);
}
- for(int i=0;i<ui->revGeocodingLayout->count();++i)
+ for (int i = 0;i < ui->revGeocodingLayout->count();++i)
ui->revGeocodingLayout->itemAt(i)->widget()->setVisible(visible);
}
void MainWindow::showMapTileControls(bool visible)
{
- if(visible) {
+ if (visible) {
showGeocodingControls(false);
showReverseGeocodingControls(false);
showRouteRequestControls(false);
}
- for(int i=0;i<ui->mapTileLayout->count();++i)
+ for (int i = 0;i < ui->mapTileLayout->count();++i)
ui->mapTileLayout->itemAt(i)->widget()->setVisible(visible);
}
#endif
diff --git a/examples/qgeoapiui/mainwindow.h b/examples/qgeoapiui/mainwindow.h
index b5afd94be5..e30584b20c 100644
--- a/examples/qgeoapiui/mainwindow.h
+++ b/examples/qgeoapiui/mainwindow.h
@@ -43,8 +43,10 @@
#include <QMainWindow>
-#include "qgeonetworkmanager.h"
-#include "qroutereply.h"
+#include "qgeocodingservice.h"
+#include "qgeoroutingservice.h"
+#include "qgeomapservice.h"
+#include "qgeoroutereply.h"
#include "qgeocodingreply.h"
#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5)
@@ -84,20 +86,23 @@ private slots:
void on_btnRequest_clicked();
void testReplyFinishedSignal();
- void routeReplyFinished(QRouteReply* reply);
+ void routeReplyFinished(QGeoRouteReply* reply);
void codingReplyFinished(QGeocodingReply* reply);
- void mapTileReplyFinished(QMapTileReply* reply);
+ void mapTileReplyFinished(QGeoMapTileReply* reply);
+
void delayedInit();
#ifdef QGEOAPIUI_USEPOPUPMENU
void customContextMenuRequest(const QPoint&);
- void showRouteRequestControls(bool visible=true);
- void showGeocodingControls(bool visible=true);
- void showReverseGeocodingControls(bool visible=true);
- void showMapTileControls(bool visible=true);
+ void showRouteRequestControls(bool visible = true);
+ void showGeocodingControls(bool visible = true);
+ void showReverseGeocodingControls(bool visible = true);
+ void showMapTileControls(bool visible = true);
#endif
private:
- QGeoNetworkManager geoNetworkManager;
+ QGeocodingService *geocodingService;
+ QGeoRoutingService *routingService;
+ QGeoMapService *mapService;
#ifdef Q_OS_SYMBIAN
QNetworkSession *session;
#endif
diff --git a/examples/qgeoapiui/placepresenter.cpp b/examples/qgeoapiui/placepresenter.cpp
index cfa4c7937d..3aec9e7ab5 100644
--- a/examples/qgeoapiui/placepresenter.cpp
+++ b/examples/qgeoapiui/placepresenter.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include "placepresenter.h"
+#include "qgeoaddress.h"
PlacePresenter::PlacePresenter(QTreeWidget *treeWidget, const QGeocodingReply* codingReply)
: GeoPresenter(treeWidget), codingReply(codingReply)
@@ -62,17 +63,19 @@ QTreeWidgetItem* PlacePresenter::showPlaces()
QTreeWidgetItem* top = new QTreeWidgetItem(treeWidget);
top->setText(0, "places");
+ /*
QTreeWidgetItem* prop = new QTreeWidgetItem(top);
prop->setText(0, "result");
prop->setText(1, QString().setNum((quint16) codingReply->resultCode()));
+ */
- prop = new QTreeWidgetItem(top);
+ QTreeWidgetItem* prop = new QTreeWidgetItem(top);
prop->setText(0, "description");
- prop->setText(1, codingReply->resultDescription());
+ prop->setText(1, codingReply->description());
prop = new QTreeWidgetItem(top);
prop->setText(0, "count");
- prop->setText(1, QString().setNum(codingReply->count()));
+ prop->setText(1, QString().setNum(codingReply->places().size()));
return top;
}
diff --git a/examples/qgeoapiui/routepresenter.cpp b/examples/qgeoapiui/routepresenter.cpp
index 0aa8dd49a6..8d60b3e58a 100644
--- a/examples/qgeoapiui/routepresenter.cpp
+++ b/examples/qgeoapiui/routepresenter.cpp
@@ -43,7 +43,7 @@
#include <QStringBuilder>
-RoutePresenter::RoutePresenter(QTreeWidget* treeWidget, const QRouteReply* routeReply)
+RoutePresenter::RoutePresenter(QTreeWidget* treeWidget, const QGeoRouteReply* routeReply)
: GeoPresenter(treeWidget), routeReply(routeReply)
{
}
@@ -52,7 +52,7 @@ void RoutePresenter::show()
{
treeWidget->clear();
QTreeWidgetItem* top = showRoutes();
- const QList<QRoute> routes = routeReply->routes();
+ const QList<QGeoRoute> routes = routeReply->routes();
for (int i = 0; i < routes.length(); i++) {
showRoute(top, routes[i]);
@@ -64,14 +64,17 @@ QTreeWidgetItem* RoutePresenter::showRoutes()
QTreeWidgetItem* top = new QTreeWidgetItem(treeWidget);
top->setText(0, "routes");
+ /*
QTreeWidgetItem* prop = new QTreeWidgetItem(top);
prop->setText(0, "result");
prop->setText(1, QString().setNum((quint16) routeReply->resultCode()));
+ */
- prop = new QTreeWidgetItem(top);
+ QTreeWidgetItem* prop = new QTreeWidgetItem(top);
prop->setText(0, "description");
- prop->setText(1, routeReply->resultDescription());
+ prop->setText(1, routeReply->description());
+ /*
QString lang = routeReply->language();
if (!lang.isEmpty()) {
@@ -79,15 +82,16 @@ QTreeWidgetItem* RoutePresenter::showRoutes()
prop->setText(0, "language");
prop->setText(1, lang);
}
+ */
prop = new QTreeWidgetItem(top);
prop->setText(0, "count");
- prop->setText(1, QString().setNum(routeReply->count()));
+ prop->setText(1, QString().setNum(routeReply->routes().size()));
return top;
}
-void RoutePresenter::showRoute(QTreeWidgetItem* top, const QRoute& route)
+void RoutePresenter::showRoute(QTreeWidgetItem* top, const QGeoRoute& route)
{
QTreeWidgetItem* routeItem = new QTreeWidgetItem(top);
routeItem->setText(0, "route");
diff --git a/examples/qgeoapiui/routepresenter.h b/examples/qgeoapiui/routepresenter.h
index f497e446c0..cd235c4c0f 100644
--- a/examples/qgeoapiui/routepresenter.h
+++ b/examples/qgeoapiui/routepresenter.h
@@ -45,7 +45,7 @@
#include <QTreeWidget>
#include "geopresenter.h"
-#include "qroutereply.h"
+#include "qgeoroutereply.h"
#include "qgeocoordinate.h"
QTM_USE_NAMESPACE
@@ -53,17 +53,17 @@ QTM_USE_NAMESPACE
class RoutePresenter : GeoPresenter
{
public:
- RoutePresenter(QTreeWidget* treeWidget, const QRouteReply* routeReply);
+ RoutePresenter(QTreeWidget* treeWidget, const QGeoRouteReply* routeReply);
virtual void show();
private:
QTreeWidgetItem* showRoutes();
- void showRoute(QTreeWidgetItem* top, const QRoute& route);
+ void showRoute(QTreeWidgetItem* top, const QGeoRoute& route);
void showManeuver(QTreeWidgetItem* routeItem, const QManeuver& maneuver);
void showPoints(QTreeWidgetItem* pointsItem, const QList<QGeoCoordinate>& points);
private:
- const QRouteReply* routeReply;
+ const QGeoRouteReply* routeReply;
};
#endif
diff --git a/examples/qgeoapiui/ui_mainwindow.h b/examples/qgeoapiui/ui_mainwindow.h
index 41104f60af..9f2aef1059 100644
--- a/examples/qgeoapiui/ui_mainwindow.h
+++ b/examples/qgeoapiui/ui_mainwindow.h
@@ -71,8 +71,7 @@ public:
QTreeWidget *treeWidget;
QLabel *mapTileLabel;
- void setupUi(QMainWindow *MainWindow)
- {
+ void setupUi(QMainWindow *MainWindow) {
if (MainWindow->objectName().isEmpty())
MainWindow->setObjectName(QString::fromUtf8("MainWindow"));
MainWindow->resize(437, 341);
@@ -437,8 +436,7 @@ public:
QMetaObject::connectSlotsByName(MainWindow);
} // setupUi
- void retranslateUi(QMainWindow *MainWindow)
- {
+ void retranslateUi(QMainWindow *MainWindow) {
MainWindow->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0, QApplication::UnicodeUTF8));
label->setText(QApplication::translate("MainWindow", "source", 0, QApplication::UnicodeUTF8));
label_2->setText(QApplication::translate("MainWindow", "destination", 0, QApplication::UnicodeUTF8));
@@ -459,8 +457,9 @@ public:
};
-namespace Ui {
- class MainWindow: public Ui_MainWindow {};
+namespace Ui
+{
+class MainWindow: public Ui_MainWindow {};
} // namespace Ui
QT_END_NAMESPACE
diff --git a/src/location/gconfitem.cpp b/src/location/gconfitem.cpp
index 02dc97bf36..e617f62f8a 100644
--- a/src/location/gconfitem.cpp
+++ b/src/location/gconfitem.cpp
@@ -61,12 +61,11 @@ struct GConfItemPrivate {
#define withClient(c) for(GConfClient *c = (g_type_init(), gconf_client_get_default()); c; g_object_unref(c), c=NULL)
-static QByteArray convertKey (QString key)
+static QByteArray convertKey(QString key)
{
if (key.startsWith('/'))
return key.toUtf8();
- else
- {
+ else {
qWarning() << "Using dot-separated key names with GConfItem is deprecated.";
qWarning() << "Please use" << '/' + key.replace('.', '/') << "instead of" << key;
return '/' + key.replace('.', '/').toUtf8();
@@ -84,60 +83,58 @@ static QVariant convertValue(GConfValue *src)
return QVariant();
} else {
switch (src->type) {
- case GCONF_VALUE_INVALID:
- return QVariant(QVariant::Invalid);
- case GCONF_VALUE_BOOL:
- return QVariant((bool)gconf_value_get_bool(src));
- case GCONF_VALUE_INT:
- return QVariant(gconf_value_get_int(src));
- case GCONF_VALUE_FLOAT:
- return QVariant(gconf_value_get_float(src));
- case GCONF_VALUE_STRING:
- return QVariant(QString::fromUtf8(gconf_value_get_string(src)));
- case GCONF_VALUE_LIST:
- switch (gconf_value_get_list_type(src)) {
+ case GCONF_VALUE_INVALID:
+ return QVariant(QVariant::Invalid);
+ case GCONF_VALUE_BOOL:
+ return QVariant((bool)gconf_value_get_bool(src));
+ case GCONF_VALUE_INT:
+ return QVariant(gconf_value_get_int(src));
+ case GCONF_VALUE_FLOAT:
+ return QVariant(gconf_value_get_float(src));
case GCONF_VALUE_STRING:
- {
- QStringList result;
- for (GSList *elts = gconf_value_get_list(src); elts; elts = elts->next)
- result.append(QString::fromUtf8(gconf_value_get_string((GConfValue *)elts->data)));
- return QVariant(result);
+ return QVariant(QString::fromUtf8(gconf_value_get_string(src)));
+ case GCONF_VALUE_LIST:
+ switch (gconf_value_get_list_type(src)) {
+ case GCONF_VALUE_STRING: {
+ QStringList result;
+ for (GSList *elts = gconf_value_get_list(src); elts; elts = elts->next)
+ result.append(QString::fromUtf8(gconf_value_get_string((GConfValue *)elts->data)));
+ return QVariant(result);
+ }
+ default: {
+ QList<QVariant> result;
+ for (GSList *elts = gconf_value_get_list(src); elts; elts = elts->next)
+ result.append(convertValue((GConfValue *)elts->data));
+ return QVariant(result);
+ }
}
+ case GCONF_VALUE_SCHEMA:
default:
- {
- QList<QVariant> result;
- for (GSList *elts = gconf_value_get_list(src); elts; elts = elts->next)
- result.append(convertValue((GConfValue *)elts->data));
- return QVariant(result);
- }
- }
- case GCONF_VALUE_SCHEMA:
- default:
- return QVariant();
+ return QVariant();
}
}
}
static GConfValue *convertString(const QString &str)
{
- GConfValue *v = gconf_value_new (GCONF_VALUE_STRING);
- gconf_value_set_string (v, str.toUtf8().data());
+ GConfValue *v = gconf_value_new(GCONF_VALUE_STRING);
+ gconf_value_set_string(v, str.toUtf8().data());
return v;
}
-static GConfValueType primitiveType (const QVariant &elt)
+static GConfValueType primitiveType(const QVariant &elt)
{
- switch(elt.type()) {
- case QVariant::String:
- return GCONF_VALUE_STRING;
- case QVariant::Int:
- return GCONF_VALUE_INT;
- case QVariant::Double:
- return GCONF_VALUE_FLOAT;
- case QVariant::Bool:
- return GCONF_VALUE_BOOL;
- default:
- return GCONF_VALUE_INVALID;
+ switch (elt.type()) {
+ case QVariant::String:
+ return GCONF_VALUE_STRING;
+ case QVariant::Int:
+ return GCONF_VALUE_INT;
+ case QVariant::Double:
+ return GCONF_VALUE_FLOAT;
+ case QVariant::Bool:
+ return GCONF_VALUE_BOOL;
+ default:
+ return GCONF_VALUE_INVALID;
}
}
@@ -145,8 +142,8 @@ static GConfValueType uniformType(const QList<QVariant> &list)
{
GConfValueType result = GCONF_VALUE_INVALID;
- foreach (const QVariant &elt, list) {
- GConfValueType elt_type = primitiveType (elt);
+ foreach(const QVariant &elt, list) {
+ GConfValueType elt_type = primitiveType(elt);
if (elt_type == GCONF_VALUE_INVALID)
return GCONF_VALUE_INVALID;
@@ -167,47 +164,43 @@ static int convertValue(const QVariant &src, GConfValue **valp)
{
GConfValue *v;
- switch(src.type()) {
- case QVariant::Invalid:
- v = NULL;
- break;
- case QVariant::Bool:
- v = gconf_value_new (GCONF_VALUE_BOOL);
- gconf_value_set_bool (v, src.toBool());
- break;
- case QVariant::Int:
- v = gconf_value_new (GCONF_VALUE_INT);
- gconf_value_set_int (v, src.toInt());
- break;
- case QVariant::Double:
- v = gconf_value_new (GCONF_VALUE_FLOAT);
- gconf_value_set_float (v, src.toDouble());
- break;
- case QVariant::String:
- v = convertString(src.toString());
- break;
- case QVariant::StringList:
- {
+ switch (src.type()) {
+ case QVariant::Invalid:
+ v = NULL;
+ break;
+ case QVariant::Bool:
+ v = gconf_value_new(GCONF_VALUE_BOOL);
+ gconf_value_set_bool(v, src.toBool());
+ break;
+ case QVariant::Int:
+ v = gconf_value_new(GCONF_VALUE_INT);
+ gconf_value_set_int(v, src.toInt());
+ break;
+ case QVariant::Double:
+ v = gconf_value_new(GCONF_VALUE_FLOAT);
+ gconf_value_set_float(v, src.toDouble());
+ break;
+ case QVariant::String:
+ v = convertString(src.toString());
+ break;
+ case QVariant::StringList: {
GSList *elts = NULL;
v = gconf_value_new(GCONF_VALUE_LIST);
gconf_value_set_list_type(v, GCONF_VALUE_STRING);
- foreach (const QString &str, src.toStringList())
- elts = g_slist_prepend(elts, convertString(str));
+ foreach(const QString &str, src.toStringList())
+ elts = g_slist_prepend(elts, convertString(str));
gconf_value_set_list_nocopy(v, g_slist_reverse(elts));
break;
}
- case QVariant::List:
- {
+ case QVariant::List: {
GConfValueType elt_type = uniformType(src.toList());
if (elt_type == GCONF_VALUE_INVALID)
v = NULL;
- else
- {
+ else {
GSList *elts = NULL;
v = gconf_value_new(GCONF_VALUE_LIST);
gconf_value_set_list_type(v, elt_type);
- foreach (const QVariant &elt, src.toList())
- {
+ foreach(const QVariant &elt, src.toList()) {
GConfValue *val = NULL;
convertValue(elt, &val); // guaranteed to succeed.
elts = g_slist_prepend(elts, val);
@@ -216,24 +209,24 @@ static int convertValue(const QVariant &src, GConfValue **valp)
}
break;
}
- default:
- return 0;
+ default:
+ return 0;
}
*valp = v;
return 1;
}
-void GConfItemPrivate::notify_trampoline (GConfClient*,
- guint,
- GConfEntry *,
- gpointer data)
+void GConfItemPrivate::notify_trampoline(GConfClient*,
+ guint,
+ GConfEntry *,
+ gpointer data)
{
GConfItem *item = (GConfItem *)data;
- item->update_value (true);
+ item->update_value(true);
}
-void GConfItem::update_value (bool emit_signal)
+void GConfItem::update_value(bool emit_signal)
{
QVariant new_value;
@@ -244,7 +237,7 @@ void GConfItem::update_value (bool emit_signal)
if (error) {
qWarning() << error->message;
- g_error_free (error);
+ g_error_free(error);
new_value = priv->value;
} else {
new_value = convertValue(v);
@@ -306,7 +299,8 @@ void GConfItem::set(const QVariant &val)
}
}
-void GConfItem::unset() {
+void GConfItem::unset()
+{
set(QVariant());
}
@@ -319,9 +313,9 @@ QList<QString> GConfItem::listDirs() const
GSList *dirs = gconf_client_all_dirs(client, k.data(), NULL);
for (GSList *d = dirs; d; d = d->next) {
children.append(convertKey((char *)d->data));
- g_free (d->data);
+ g_free(d->data);
}
- g_slist_free (dirs);
+ g_slist_free(dirs);
}
return children;
@@ -336,26 +330,26 @@ QList<QString> GConfItem::listEntries() const
GSList *entries = gconf_client_all_entries(client, k.data(), NULL);
for (GSList *e = entries; e; e = e->next) {
children.append(convertKey(((GConfEntry *)e->data)->key));
- gconf_entry_free ((GConfEntry *)e->data);
+ gconf_entry_free((GConfEntry *)e->data);
}
- g_slist_free (entries);
+ g_slist_free(entries);
}
return children;
}
GConfItem::GConfItem(const QString &key, QObject *parent)
- : QObject (parent)
+ : QObject(parent)
{
priv = new GConfItemPrivate;
priv->key = key;
withClient(client) {
- update_value (false);
+ update_value(false);
QByteArray k = convertKey(priv->key);
- gconf_client_add_dir (client, k.data(), GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
- priv->notify_id = gconf_client_notify_add (client, k.data(),
- GConfItemPrivate::notify_trampoline, this,
- NULL, NULL);
+ gconf_client_add_dir(client, k.data(), GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
+ priv->notify_id = gconf_client_notify_add(client, k.data(),
+ GConfItemPrivate::notify_trampoline, this,
+ NULL, NULL);
}
}
@@ -363,8 +357,8 @@ GConfItem::~GConfItem()
{
withClient(client) {
QByteArray k = convertKey(priv->key);
- gconf_client_notify_remove (client, priv->notify_id);
- gconf_client_remove_dir (client, k.data(), NULL);
+ gconf_client_notify_remove(client, priv->notify_id);
+ gconf_client_remove_dir(client, k.data(), NULL);
}
delete priv;
}
diff --git a/src/location/gconfitem.h b/src/location/gconfitem.h
index d67d187e0d..9a33cef6ab 100644
--- a/src/location/gconfitem.h
+++ b/src/location/gconfitem.h
@@ -86,7 +86,7 @@ class GConfItem : public QObject
{
Q_OBJECT
- public:
+public:
/*! Initializes a GConfItem to access the GConf key denoted by
\a key. Key names should follow the normal GConf conventions
like "/myapp/settings/first".
@@ -151,12 +151,12 @@ class GConfItem : public QObject
*/
QList<QString> listEntries() const;
- signals:
+signals:
/*! Emitted when the value of this item has changed.
*/
void valueChanged();
- private:
+private:
friend struct GConfItemPrivate;
struct GConfItemPrivate *priv;
diff --git a/src/location/liblocationwrapper.cpp b/src/location/liblocationwrapper.cpp
index c2087fe8ea..a81b8ba8bb 100644
--- a/src/location/liblocationwrapper.cpp
+++ b/src/location/liblocationwrapper.cpp
@@ -46,13 +46,13 @@ using namespace std;
QTM_BEGIN_NAMESPACE
Q_GLOBAL_STATIC(LiblocationWrapper, LocationEngine)
-
+
LiblocationWrapper *LiblocationWrapper::instance()
{
return LocationEngine();
}
-LiblocationWrapper::~LiblocationWrapper()
+LiblocationWrapper::~LiblocationWrapper()
{
if (locationDevice)
g_object_unref(locationDevice);
@@ -73,18 +73,18 @@ bool LiblocationWrapper::inited()
"preferred-method", LOCATION_METHOD_USER_SELECTED,
"preferred-interval", LOCATION_INTERVAL_1S,
NULL);
- locationDevice =
- (LocationGPSDevice*)g_object_new(LOCATION_TYPE_GPS_DEVICE,
- NULL);
-
+ locationDevice =
+ (LocationGPSDevice*)g_object_new(LOCATION_TYPE_GPS_DEVICE,
+ NULL);
+
if (locationDevice) {
errorHandlerId =
g_signal_connect(G_OBJECT(locationControl), "error-verbose",
- G_CALLBACK(&locationError),
+ G_CALLBACK(&locationError),
static_cast<void*>(this));
posChangedId =
g_signal_connect(G_OBJECT(locationDevice), "changed",
- G_CALLBACK(&locationChanged),
+ G_CALLBACK(&locationChanged),
static_cast<void*>(this));
locationState = LiblocationWrapper::Inited;
retval = true;
@@ -104,41 +104,41 @@ void LiblocationWrapper::locationError(LocationGPSDevice *device,
QString locationError;
switch (errorCode) {
- case LOCATION_ERROR_USER_REJECTED_DIALOG:
- locationError = "User didn't enable requested methods";
- break;
- case LOCATION_ERROR_USER_REJECTED_SETTINGS:
- locationError = "User changed settings, which disabled location.";
- break;
- case LOCATION_ERROR_BT_GPS_NOT_AVAILABLE:
- locationError = "Problems with BT GPS";
- break;
- case LOCATION_ERROR_METHOD_NOT_ALLOWED_IN_OFFLINE_MODE:
- locationError = "Requested method is not allowed in offline mode";
- break;
- case LOCATION_ERROR_SYSTEM:
- locationError = "System error.";
- break;
- default:
- locationError = "Unknown error.";
+ case LOCATION_ERROR_USER_REJECTED_DIALOG:
+ locationError = "User didn't enable requested methods";
+ break;
+ case LOCATION_ERROR_USER_REJECTED_SETTINGS:
+ locationError = "User changed settings, which disabled location.";
+ break;
+ case LOCATION_ERROR_BT_GPS_NOT_AVAILABLE:
+ locationError = "Problems with BT GPS";
+ break;
+ case LOCATION_ERROR_METHOD_NOT_ALLOWED_IN_OFFLINE_MODE:
+ locationError = "Requested method is not allowed in offline mode";
+ break;
+ case LOCATION_ERROR_SYSTEM:
+ locationError = "System error.";
+ break;
+ default:
+ locationError = "Unknown error.";
}
qDebug() << "Location error:" << locationError;
}
void LiblocationWrapper::locationChanged(LocationGPSDevice *device,
- gpointer data)
+ gpointer data)
{
QGeoPositionInfo posInfo;
QGeoCoordinate coordinate;
QGeoSatelliteInfo satInfo;
int satellitesInUseCount = 0;
LiblocationWrapper *object;
-
+
if (!data || !device) {
return;
}
-
+
object = (LiblocationWrapper *)data;
if (device) {
@@ -169,66 +169,67 @@ void LiblocationWrapper::locationChanged(LocationGPSDevice *device,
posInfo.setAttribute(QGeoPositionInfo::VerticalSpeed,
device->fix->climb);
}
-
+
if (device->fix->fields & LOCATION_GPS_DEVICE_TRACK_SET) {
posInfo.setAttribute(QGeoPositionInfo::Direction,
device->fix->track);
}
}
-
+
if (device->satellites_in_view) {
QList<QGeoSatelliteInfo> satsInView;
QList<QGeoSatelliteInfo> satsInUse;
unsigned int i;
- for (i=0;i<device->satellites->len;i++) {
+ for (i = 0;i < device->satellites->len;i++) {
LocationGPSDeviceSatellite *satData =
(LocationGPSDeviceSatellite *)g_ptr_array_index(device->satellites,
- i);
+ i);
satInfo.setSignalStrength(satData->signal_strength);
satInfo.setPrnNumber(satData->prn);
- satInfo.setAttribute(QGeoSatelliteInfo::Elevation,
+ satInfo.setAttribute(QGeoSatelliteInfo::Elevation,
satData->elevation);
- satInfo.setAttribute(QGeoSatelliteInfo::Azimuth,
+ satInfo.setAttribute(QGeoSatelliteInfo::Azimuth,
satData->azimuth);
-
+
satsInView.append(satInfo);
if (satData->in_use) {
satellitesInUseCount++;
satsInUse.append(satInfo);
}
}
-
+
if (!satsInView.isEmpty())
object->satellitesInViewUpdated(satsInView);
-
+
if (!satsInUse.isEmpty())
object->satellitesInUseUpdated(satsInUse);
- }
+ }
}
-
+
posInfo.setCoordinate(coordinate);
// Only position updates with time (3D) are provided.
if ((device->fix->mode == LOCATION_GPS_DEVICE_MODE_3D) ||
- ((satellitesInUseCount >= 3) &&
- (device->fix->fields & LOCATION_GPS_DEVICE_TIME_SET))){
+ ((satellitesInUseCount >= 3) &&
+ (device->fix->fields & LOCATION_GPS_DEVICE_TIME_SET))) {
object->setLocation(posInfo, true);
} else {
object->setLocation(posInfo, false);
}
}
-void LiblocationWrapper::setLocation(const QGeoPositionInfo &update,
+void LiblocationWrapper::setLocation(const QGeoPositionInfo &update,
bool location3D)
{
- if(!location3D)
+ if (!location3D)
validLastSatUpdate = false;
else
validLastSatUpdate = true;
lastSatUpdate = update;
}
-QGeoPositionInfo LiblocationWrapper::position() {
+QGeoPositionInfo LiblocationWrapper::position()
+{
return lastSatUpdate;
}
@@ -248,7 +249,7 @@ QGeoPositionInfo LiblocationWrapper::lastKnownPosition(bool fromSatellitePositio
double speed;
double track;
double climb;
-
+
GConfItem lastKnownPositionTime("/system/nokia/location/lastknown/time");
GConfItem lastKnownPositionLatitude("/system/nokia/location/lastknown/latitude");
GConfItem lastKnownPositionLongitude("/system/nokia/location/lastknown/longitude");
@@ -256,14 +257,14 @@ QGeoPositionInfo LiblocationWrapper::lastKnownPosition(bool fromSatellitePositio
GConfItem lastKnownPositionSpeed("/system/nokia/location/lastknown/speed");
GConfItem lastKnownPositionTrack("/system/nokia/location/lastknown/track");
GConfItem lastKnownPositionClimb("/system/nokia/location/lastknown/climb");
-
+
if (validLastSatUpdate)
return lastSatUpdate;
if (!fromSatellitePositioningMethodsOnly)
if (validLastUpdate)
return lastUpdate;
-
+
time = lastKnownPositionTime.value().toDouble();
latitude = lastKnownPositionLatitude.value().toDouble();
longitude = lastKnownPositionLongitude.value().toDouble();
@@ -271,7 +272,7 @@ QGeoPositionInfo LiblocationWrapper::lastKnownPosition(bool fromSatellitePositio
speed = lastKnownPositionSpeed.value().toDouble();
track = lastKnownPositionTrack.value().toDouble();
climb = lastKnownPositionClimb.value().toDouble();
-
+
if (longitude && latitude) {
coordinate.setLongitude(longitude);
coordinate.setLatitude(latitude);
@@ -280,17 +281,17 @@ QGeoPositionInfo LiblocationWrapper::lastKnownPosition(bool fromSatellitePositio
}
posInfo.setCoordinate(coordinate);
}
-
+
if (speed) {
posInfo.setAttribute(QGeoPositionInfo::GroundSpeed, speed);
}
-
+
if (track) {
posInfo.setAttribute(QGeoPositionInfo::Direction, track);
}
-
+
if (climb) {
- posInfo.setAttribute(QGeoPositionInfo::VerticalSpeed, climb);
+ posInfo.setAttribute(QGeoPositionInfo::VerticalSpeed, climb);
}
// Only positions with time (3D) are provided.
@@ -322,39 +323,41 @@ QList<QGeoSatelliteInfo> LiblocationWrapper::satellitesInUse()
return satsInUse;
}
-void LiblocationWrapper::start() {
+void LiblocationWrapper::start()
+{
if ((locationState & LiblocationWrapper::Inited) &&
- !(locationState & LiblocationWrapper::Started)) {
+ !(locationState & LiblocationWrapper::Started)) {
if (!errorHandlerId) {
errorHandlerId =
g_signal_connect(G_OBJECT(locationControl), "error-verbose",
- G_CALLBACK(&locationError),
+ G_CALLBACK(&locationError),
static_cast<void*>(this));
}
if (!posChangedId) {
posChangedId =
g_signal_connect(G_OBJECT(locationDevice), "changed",
- G_CALLBACK(&locationChanged),
+ G_CALLBACK(&locationChanged),
static_cast<void*>(this));
}
location_gpsd_control_start(locationControl);
-
+
locationState |= LiblocationWrapper::Started;
locationState &= ~LiblocationWrapper::Stopped;
}
}
-void LiblocationWrapper::stop() {
+void LiblocationWrapper::stop()
+{
if ((locationState & (LiblocationWrapper::Started |
LiblocationWrapper::Inited)) &&
- !(locationState & LiblocationWrapper::Stopped)) {
+ !(locationState & LiblocationWrapper::Stopped)) {
if (errorHandlerId)
- g_signal_handler_disconnect(G_OBJECT(locationControl),
+ g_signal_handler_disconnect(G_OBJECT(locationControl),
errorHandlerId);
if (posChangedId)
- g_signal_handler_disconnect(G_OBJECT(locationDevice),
+ g_signal_handler_disconnect(G_OBJECT(locationDevice),
posChangedId);
errorHandlerId = 0;
posChangedId = 0;
diff --git a/src/location/liblocationwrapper.h b/src/location/liblocationwrapper.h
index 6e9d52e3b7..ed11a4b75d 100644
--- a/src/location/liblocationwrapper.h
+++ b/src/location/liblocationwrapper.h
@@ -51,12 +51,13 @@
#include "gconfitem.h"
-extern "C" {
- #include <glib.h>
- #include <location/location-gpsd-control.h>
- #include <location/location-gps-device.h>
- #include <location/location-misc.h>
- #include <location/location-distance-utils.h>
+extern "C"
+{
+#include <glib.h>
+#include <location/location-gpsd-control.h>
+#include <location/location-gps-device.h>
+#include <location/location-misc.h>
+#include <location/location-distance-utils.h>
}
QTM_BEGIN_NAMESPACE
@@ -88,7 +89,7 @@ private:
int errorHandlerId;
int posChangedId;
int origUpdateInterval;
-
+
QGeoPositionInfo lastUpdate;
QGeoPositionInfo lastSatUpdate;
bool validLastUpdate;
diff --git a/src/location/location.pro b/src/location/location.pro
index 16c3f4283e..13db9f9c34 100644
--- a/src/location/location.pro
+++ b/src/location/location.pro
@@ -57,6 +57,7 @@ PUBLIC_HEADERS += qgeoaddress.h \
PRIVATE_HEADERS += qlocationutils_p.h \
qnmeapositioninfosource_p.h \
qlandmark_p.h \
+ qlandmarkfilter_p.h \
qgeolocation_p.h
symbian {
@@ -106,7 +107,7 @@ maemo6 {
qgeosatelliteinfosource_maemo.cpp \
dbuscomm_maemo.cpp \
dbusserver_maemo.cpp
- HEADERS += qgeopositioninfosource_maemo_p.h \
+ PRIVATE_HEADERS += qgeopositioninfosource_maemo_p.h \
qgeosatelliteinfosource_maemo_p.h \
dbuscomm_maemo_p.h \
dbusserver_maemo_p.h
@@ -119,7 +120,7 @@ maemo5 {
qgeopositioninfosource_maemo5.cpp \
qgeosatelliteinfosource_maemo5.cpp \
qgeoareamonitor_maemo.cpp
- HEADERS += gconfitem.h \
+ PRIVATE_HEADERS += gconfitem.h \
liblocationwrapper.h \
qgeopositioninfosource_maemo5_p.h \
qgeosatelliteinfosource_maemo5_p.h \
@@ -132,50 +133,65 @@ maemo5 {
pkgconfig.files = QtLocation.pc
}
-# maps header files - sort into public and private later
-HEADERS += qgeocodingreply.h \
- qgeocodingreply_p.h \
- qgeocodingrequest.h \
- qgeocodingrequest_p.h \
- qgeocodingxmlparser.h \
- qgeoengine.h \
- qgeonetworkmanager.h \
- qgeonetworkmanager_p.h \
- qgeoreply.h \
- qmaneuver.h \
- qmapellipse.h \
- qmapellipse_p.h \
- qmapline.h \
- qmapline_p.h \
- qmapmarker.h \
- qmapmarker_p.h \
- qmapobject.h \
- qmapobject_p.h \
- qmappixmap.h \
- qmappixmap_p.h \
- qmappolygon.h \
- qmappolygon_p.h \
- qmaprect.h \
- qmaprect_p.h\
- qmaproute.h \
- qmaproute_p.h \
- qmaptile.h \
- qmaptilecache.h \
- qmaptilereply.h \
- qmaptilerequest.h \
- qmaptilerequest_p.h \
- qmapview.h \
- qmapview_p.h \
- qreversegeocodingrequest.h \
- qreversegeocodingrequest_p.h \
- qroute.h \
- qroutereply.h \
- qroutereply_p.h \
- qrouterequest.h \
- qrouterequest_p.h \
- qroutexmlparser.h \
- qlandmarkfilter_p.h \
- qgeoaddress_p.h
+# map/routing/navigation header files
+PUBLIC_HEADERS += qgeoaddress.h \
+ qgeocodingreply.h \
+ qgeocodingrequest.h \
+ qgeocodingservice.h \
+ qgeolocation.h \
+ qgeomapservice.h \
+ qgeomaptile.h \
+ qgeomaptilecache.h \
+ qgeomaptilereply.h \
+ qgeomaptilerequest.h \
+ qgeoroute.h \
+ qgeoroutereply.h \
+ qgeorouterequest.h \
+ qgeoroutingservice.h \
+ qmaneuver.h \
+ qmapellipse.h \
+ qmapline.h \
+ qmapmarker.h \
+ qmapobject.h \
+ qmappixmap.h \
+ qmappolygon.h \
+ qmaprect.h \
+ qmaproute.h \
+ qmapview.h \
+ qreversegeocodingrequest.h
+
+PRIVATE_HEADERS += qgeoaddress_p.h \
+ qgeocodingreply_p.h \
+ qgeocodingrequest_p.h \
+ qgeolocation_p.h \
+ qgeomaptilereply_p.h \
+ qgeomaptilerequest_p.h \
+ qgeoroute_p.h \
+ qgeoroutereply_p.h \
+ qgeorouterequest_p.h \
+ qlandmarkfilter_p.h \
+ qmaneuver_p.h \
+ qmapellipse_p.h \
+ qmapline_p.h \
+ qmapmarker_p.h \
+ qmapobject_p.h \
+ qmappixmap_p.h \
+ qmappolygon_p.h \
+ qmaprect_p.h\
+ qmaproute_p.h \
+ qmapview_p.h \
+ qreversegeocodingrequest_p.h
+
+# nokia map/routing/navigation service specific header files
+PRIVATE_HEADERS += qgeocodingreply_nokia_p.h \
+ qgeocodingservice_nokia_p.h \
+ qgeocodingxmlparser_nokia_p.h \
+ qgeomapservice_nokia_p.h \
+ qgeomaptilereply_nokia_p.h \
+ qgeoroutereply_nokia_p.h \
+ qgeoroutexmlparser_nokia_p.h \
+ qgeoroutingservice_nokia_p.h
+
HEADERS += $$PUBLIC_HEADERS $$PRIVATE_HEADERS
@@ -219,34 +235,42 @@ SOURCES += qlocationutils.cpp \
qlandmarkmanagerengine.cpp \
qlandmarkmanagerenginefactory.cpp
-# maps source files
+# map/routing/navigation source files
SOURCES += qgeoaddress.cpp \
qgeocodingreply.cpp \
qgeocodingrequest.cpp \
- qgeocodingxmlparser.cpp \
- qgeoengine.cpp \
+ qgeocodingservice.cpp \
qgeolocation.cpp \
- qgeonetworkmanager.cpp \
- qgeoreply.cpp \
+ qgeomapservice.cpp \
+ qgeomaptilecache.cpp \
+ qgeomaptilereply.cpp \
+ qgeomaptilerequest.cpp \
+ qgeoroute.cpp \
+ qgeoroutereply.cpp \
+ qgeorouterequest.cpp \
+ qgeoroutingservice.cpp \
qmaneuver.cpp \
- qmapobject.cpp \
+ qmapellipse.cpp \
qmapline.cpp \
qmapmarker.cpp \
- qmaproute.cpp \
- qmaprect.cpp \
- qmappolygon.cpp \
+ qmapobject.cpp \
qmappixmap.cpp \
- qmapellipse.cpp \
- qmaptilerequest.cpp \
- qmaptilecache.cpp \
- qmaptilereply.cpp \
+ qmappolygon.cpp \
+ qmaprect.cpp \
+ qmaproute.cpp \
qmapview.cpp \
qmapview_p.cpp \
- qreversegeocodingrequest.cpp \
- qroute.cpp \
- qroutereply.cpp \
- qrouterequest.cpp \
- qroutexmlparser.cpp
+ qreversegeocodingrequest.cpp
+
+# nokia map/routing/navigation service specific source files
+SOURCES += qgeocodingreply_nokia.cpp \
+ qgeocodingservice_nokia.cpp \
+ qgeocodingxmlparser_nokia.cpp \
+ qgeomapservice_nokia.cpp \
+ qgeomaptilereply_nokia.cpp \
+ qgeoroutereply_nokia.cpp \
+ qgeoroutexmlparser_nokia.cpp \
+ qgeoroutingservice_nokia.cpp
symbian {
TARGET.CAPABILITY = ALL -TCB
diff --git a/src/location/qgeoaddress.cpp b/src/location/qgeoaddress.cpp
index 4c277a12cf..da973eb7cf 100644
--- a/src/location/qgeoaddress.cpp
+++ b/src/location/qgeoaddress.cpp
@@ -46,22 +46,22 @@
QTM_BEGIN_NAMESPACE
QGeoAddressPrivate::QGeoAddressPrivate()
- : QSharedData()
+ : QSharedData()
{
}
QGeoAddressPrivate::QGeoAddressPrivate(const QGeoAddressPrivate &other)
- : QSharedData(other),
- sCountry(other.sCountry),
- sCountryCode(other.sCountryCode),
- sState(other.sState),
- sCounty(other.sCounty),
- sCity(other.sCity),
- sDistrict(other.sDistrict),
- sThoroughfareName(other.sThoroughfareName),
- sThoroughfareNumber(other.sThoroughfareNumber),
- sPostCode(other.sPostCode),
- sPostOfficeBox(other.sPostOfficeBox)
+ : QSharedData(other),
+ sCountry(other.sCountry),
+ sCountryCode(other.sCountryCode),
+ sState(other.sState),
+ sCounty(other.sCounty),
+ sCity(other.sCity),
+ sDistrict(other.sDistrict),
+ sThoroughfareName(other.sThoroughfareName),
+ sThoroughfareNumber(other.sThoroughfareNumber),
+ sPostCode(other.sPostCode),
+ sPostOfficeBox(other.sPostOfficeBox)
{
}
@@ -83,7 +83,7 @@ QGeoAddressPrivate::~QGeoAddressPrivate()
Default constructor.
*/
QGeoAddress::QGeoAddress()
- :d(new QGeoAddressPrivate)
+ : d(new QGeoAddressPrivate)
{
}
@@ -91,7 +91,7 @@ QGeoAddress::QGeoAddress()
Constructs a copy of \a other.
*/
QGeoAddress::QGeoAddress(const QGeoAddress &other)
- :d(other.d)
+ : d(other.d)
{
}
@@ -106,7 +106,7 @@ QGeoAddress::~QGeoAddress()
Assigns the given \a address to this address and
returns a reference to this address.
*/
-QGeoAddress &QGeoAddress::operator=(const QGeoAddress &address)
+QGeoAddress &QGeoAddress::operator=(const QGeoAddress & address)
{
d = address.d;
return *this;
diff --git a/src/location/qgeoaddress.h b/src/location/qgeoaddress.h
index 172ef09fa3..dabac56693 100644
--- a/src/location/qgeoaddress.h
+++ b/src/location/qgeoaddress.h
@@ -59,7 +59,9 @@ public:
QGeoAddress &operator=(const QGeoAddress &other);
bool operator==(const QGeoAddress &other) const;
- bool operator!=(const QGeoAddress &other) const {return !(other==*this);}
+ bool operator!=(const QGeoAddress &other) const {
+ return !(other == *this);
+ }
QString country() const;
void setCountry(const QString &country);
diff --git a/src/location/qgeoareamonitor_maemo.cpp b/src/location/qgeoareamonitor_maemo.cpp
index e213f208d7..f22c0fa7a0 100644
--- a/src/location/qgeoareamonitor_maemo.cpp
+++ b/src/location/qgeoareamonitor_maemo.cpp
@@ -42,14 +42,14 @@
#include "qgeoareamonitor_maemo_p.h"
QTM_BEGIN_NAMESPACE
-
+
#define UPDATE_INTERVAL_5S 5000
-
-QGeoAreaMonitorMaemo::QGeoAreaMonitorMaemo(QObject *parent) : QGeoAreaMonitor(parent)
+
+QGeoAreaMonitorMaemo::QGeoAreaMonitorMaemo(QObject *parent) : QGeoAreaMonitor(parent)
{
insideArea = false;
location = QGeoPositionInfoSource::createDefaultSource(this);
- if(location) {
+ if (location) {
location->setUpdateInterval(UPDATE_INTERVAL_5S);
connect(location, SIGNAL(positionUpdated(QGeoPositionInfo)),
this, SLOT(positionUpdated(QGeoPositionInfo)));
@@ -59,32 +59,32 @@ QGeoAreaMonitorMaemo::QGeoAreaMonitorMaemo(QObject *parent) : QGeoAreaMonitor(pa
QGeoAreaMonitorMaemo::~QGeoAreaMonitorMaemo()
{
- if(location)
+ if (location)
location->stopUpdates();
-
+
}
-void QGeoAreaMonitorMaemo::setCenter(const QGeoCoordinate& coordinate)
+void QGeoAreaMonitorMaemo::setCenter(const QGeoCoordinate& coordinate)
{
if (coordinate.isValid())
QGeoAreaMonitor::setCenter(coordinate);
}
-void QGeoAreaMonitorMaemo::setRadius(qreal radius)
+void QGeoAreaMonitorMaemo::setRadius(qreal radius)
{
QGeoAreaMonitor::setRadius(radius);
}
-void QGeoAreaMonitorMaemo::positionUpdated(const QGeoPositionInfo &info)
+void QGeoAreaMonitorMaemo::positionUpdated(const QGeoPositionInfo &info)
{
- double distance =
- location_distance_between(info.coordinate().latitude(),
- info.coordinate().longitude(),
- QGeoAreaMonitor::center().latitude(),
- QGeoAreaMonitor::center().longitude());
-
+ double distance =
+ location_distance_between(info.coordinate().latitude(),
+ info.coordinate().longitude(),
+ QGeoAreaMonitor::center().latitude(),
+ QGeoAreaMonitor::center().longitude());
+
if (distance <= QGeoAreaMonitor::radius()) {
- if(!insideArea)
+ if (!insideArea)
emit areaEntered(info);
insideArea = true;
} else if (insideArea) {
diff --git a/src/location/qgeoareamonitor_maemo_p.h b/src/location/qgeoareamonitor_maemo_p.h
index 213f4979e7..09d8637fc9 100644
--- a/src/location/qgeoareamonitor_maemo_p.h
+++ b/src/location/qgeoareamonitor_maemo_p.h
@@ -45,8 +45,9 @@
#include "qgeoareamonitor.h"
#include "qgeopositioninfosource.h"
-extern "C" {
- #include <location/location-distance-utils.h>
+extern "C"
+{
+#include <location/location-distance-utils.h>
}
QTM_BEGIN_NAMESPACE
diff --git a/src/location/qgeocodingreply.cpp b/src/location/qgeocodingreply.cpp
index af9c88f05f..2bf1a0bf8c 100644
--- a/src/location/qgeocodingreply.cpp
+++ b/src/location/qgeocodingreply.cpp
@@ -43,96 +43,105 @@
#include "qgeocodingreply_p.h"
QTM_BEGIN_NAMESPACE
-
/*!
\class QGeocodingReply
- \brief The QGeocodingReply class represents a response to a QReverseGeocodingRequest.
+ \brief The QGeocodingReply class represents the response from a geocoding service.
\ingroup location
-
- This class represents a geododing reply in response to a
- previous (reverse) geocoding request.
- \sa QGeocodingRequest
- \sa QReverseGeocodingRequest
+ This class represents the response from a geocoding service.
+ It also takes responsibility for any errors that happen while the request is
+ in submitted to and processed by the service.
*/
/*!
- \enum QGeocodingReply::ResultCode
-
- Possible result codes as reported by the geo engine.
+ \enum ErrorCode
- \value OK Request succeeded.
- \value Failed RequestFailed.
+ \value NoError
+ No error has occurred.
+ \value NetworkError
+ A networking error occurred.
+ \value NoContentError
+ The reply contained no content.
+ \value UnknownError
+ An error occurred which does not fit into any of the other categories.
*/
-QGeocodingReply::QGeocodingReply()
- : d_ptr(new QGeocodingReplyPrivate())
+/*!
+ Constructs a QGeocodingReply with parent \a parent.
+*/
+QGeocodingReply::QGeocodingReply(QObject *parent)
+ : QObject(parent),
+ d_ptr(new QGeocodingReplyPrivate())
{
}
-QGeocodingReply::~QGeocodingReply()
+/*!
+ Destructor.
+*/
+QGeocodingReply::~QGeocodingReply()
{
Q_D(QGeocodingReply);
delete d;
}
/*!
- Returns the result code as reported by the geo engine.
+ Returns the description of the geocoding or reverse geocoding reply.
*/
-QGeocodingReply::ResultCode QGeocodingReply::resultCode() const
+QString QGeocodingReply::description() const
{
Q_D(const QGeocodingReply);
- return d->code;
+ return d->description;
}
/*!
- Sets the result code.
+ Sets the description of the geocoding or reverse geocoding reply to \a description.
*/
-void QGeocodingReply::setResultCode(QGeocodingReply::ResultCode result)
+void QGeocodingReply::setDescription(const QString &description)
{
Q_D(QGeocodingReply);
- d->code = result;
+ d->description = description;
}
/*!
- Returns a textual description of the result.
+ Returns a list of places corresponding to the request.
*/
-QString QGeocodingReply::resultDescription() const
+QList<QGeoLocation> QGeocodingReply::places() const
{
Q_D(const QGeocodingReply);
- return d->descr;
+ return d->places;
}
/*!
- Sets a textual description of the result.
+ Sets the list of places in the reply to \a places.
*/
-void QGeocodingReply::setResultDescription(QString resultDescription)
+void QGeocodingReply::setPlaces(const QList<QGeoLocation> &places)
{
Q_D(QGeocodingReply);
- d->descr = resultDescription;
+ d->places = places;
}
+
/*!
- Returns the number of places found.
+ \fn void QGeocodingReply::cancel()
+
+ Cancels the receiving of this reply if the reply hasn't been received already.
+*/
+
+/*!
+ \fn void QGeocodingReply::finished()
+
+ Indicates that the reply has been received and processed without error, and is ready to be used.
*/
-quint32 QGeocodingReply::count() const
-{
- Q_D(const QGeocodingReply);
- return d->plcs.length();
-}
/*!
- Returns a list of all places found.
+ \fn void QGeocodingReply::error(QGeocodingReply::ErrorCode errorCode, const QString &errorString = QString())
+
+ Indicates that an error occurred during the receiving or processing of the reply.
*/
-QList<QGeoLocation> QGeocodingReply::places() const
-{
- Q_D(const QGeocodingReply);
- return d->plcs;
-}
-void QGeocodingReply::addPlace(QGeoLocation place)
-{
- Q_D(QGeocodingReply);
- d->plcs.append(place);
-}
-
+
+/*******************************************************************************
+*******************************************************************************/
+
+QGeocodingReplyPrivate::QGeocodingReplyPrivate() {}
+
#include "moc_qgeocodingreply.cpp"
QTM_END_NAMESPACE
diff --git a/src/location/qgeocodingreply.h b/src/location/qgeocodingreply.h
index e92237664c..3815a32ee2 100644
--- a/src/location/qgeocodingreply.h
+++ b/src/location/qgeocodingreply.h
@@ -39,53 +39,56 @@
**
****************************************************************************/
-#ifndef QLOCATION_GEOCODINGREPLY_H
-#define QLOCATION_GEOCODINGREPLY_H
-
-#include <QString>
-#include <QObject>
+#ifndef QGEOCODINGREPLY_H
+#define QGEOCODINGREPLY_H
#include "qgeolocation.h"
-#include "qgeoaddress.h"
-#include "qgeoreply.h"
+
+#include <QObject>
+#include <QList>
QTM_BEGIN_NAMESPACE
class QGeocodingReplyPrivate;
-class Q_LOCATION_EXPORT QGeocodingReply : public QGeoReply
+
+class Q_LOCATION_EXPORT QGeocodingReply : public QObject
{
Q_OBJECT
- friend class QGeoNetworkManager;
- friend class QGeocodingXmlParser;
-
public:
- enum ResultCode {
- OK = 0,
- Failed
+ // TODO populate this some more...
+ enum ErrorCode {
+ NoError,
+ // flesh out the more common specific network errors
+ NetworkError,
+ // File errors
+ NoContentError,
+ ParsingError,
+ UnknownError
};
-public:
- ~QGeocodingReply();
- ResultCode resultCode() const;
- void setResultCode(ResultCode result);
- QString resultDescription() const;
- void setResultDescription(QString resultDescription);
- quint32 count() const;
+ QGeocodingReply(QObject *parent = 0);
+ virtual ~QGeocodingReply();
+
+ QString description() const;
+ void setDescription(const QString &description);
+
QList<QGeoLocation> places() const;
- void addPlace(QGeoLocation place);
+ void setPlaces(const QList<QGeoLocation> &places);
-private:
- Q_DISABLE_COPY(QGeocodingReply)
+public slots:
+ virtual void cancel() = 0;
- QGeocodingReply();
+signals:
+ void finished();
+ void error(QGeocodingReply::ErrorCode errorCode, const QString &errorString = QString());
+ // CHOICE: could lose the setters and make this protected
private:
QGeocodingReplyPrivate *d_ptr;
- Q_DECLARE_PRIVATE(QGeocodingReply)
+ Q_DECLARE_PRIVATE(QGeocodingReply);
};
-
QTM_END_NAMESPACE
#endif
diff --git a/src/location/qgeocodingreply_nokia.cpp b/src/location/qgeocodingreply_nokia.cpp
new file mode 100644
index 0000000000..97cb730645
--- /dev/null
+++ b/src/location/qgeocodingreply_nokia.cpp
@@ -0,0 +1,137 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qgeocodingreply_nokia_p.h"
+
+#include "qgeocodingreply.h"
+#include "qgeocodingxmlparser_nokia_p.h"
+
+QTM_BEGIN_NAMESPACE
+
+QGeocodingReplyNokia::QGeocodingReplyNokia(QNetworkReply *reply)
+ : m_reply(reply)
+{
+ connect(m_reply,
+ SIGNAL(finished()),
+ this,
+ SLOT(parse()));
+ connect(m_reply,
+ SIGNAL(error(QNetworkReply::NetworkError)),
+ this,
+ SLOT(translateError(QNetworkReply::NetworkError)));
+
+ /*
+ // not sure if we want this or not
+ // it will free some memory once the parse has gone through
+ // probably want to do it indirectly and set a flag so that we don't
+ // double delete in the constructor
+ connect(this,
+ SIGNAL(finished()),
+ m_reply,
+ SLOT(deleteLater()));
+ connect(this,
+ SIGNAL(error(QDLGeoReply::ErrorCode,QString)),
+ m_reply,
+ SLOT(deleteLater()));
+ */
+}
+
+QGeocodingReplyNokia::ResultCode QGeocodingReplyNokia::resultCode() const
+{
+ return m_code;
+}
+
+void QGeocodingReplyNokia::setResultCode(QGeocodingReplyNokia::ResultCode code)
+{
+ m_code = code;
+}
+
+QGeocodingReplyNokia::~QGeocodingReplyNokia()
+{
+ if (m_reply)
+ m_reply->abort();
+ delete m_reply;
+}
+
+/*!
+ emits finished if all went well
+ otherwise emits error
+*/
+void QGeocodingReplyNokia::parse()
+{
+ if (m_reply->size() == 0) {
+ emit error(QGeocodingReply::NoContentError, "The reply to the routing request was empty.");
+ return;
+ }
+
+ QGeocodingXmlParserNokia parser;
+ bool success = parser.parse(m_reply, this);
+
+ if (!success) {
+ // emit error based on parser error string
+ emit error(QGeocodingReply::ParsingError, QString("Parsing error: %1").arg(parser.errorString()));
+ return;
+ }
+
+ if (m_code != QGeocodingReplyNokia::OK) {
+ // emit error based on content of xml
+ emit error(QGeocodingReply::UnknownError, "The reply contained a status code that indicates that the request was not successful.");
+ return;
+ }
+
+ emit finished();
+}
+
+void QGeocodingReplyNokia::translateError(QNetworkReply::NetworkError errorCode)
+{
+ // TODO map errors across from errorCode
+ emit error(QGeocodingReply::NetworkError, QString("Network error: %1").arg(m_reply->errorString()));
+}
+
+void QGeocodingReplyNokia::cancel()
+{
+ m_reply->abort();
+}
+
+#include "moc_qgeocodingreply_nokia_p.cpp"
+
+QTM_END_NAMESPACE
+
diff --git a/src/location/qgeocodingreply_nokia_p.h b/src/location/qgeocodingreply_nokia_p.h
new file mode 100644
index 0000000000..206b4d290f
--- /dev/null
+++ b/src/location/qgeocodingreply_nokia_p.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QGEOCODINGREPLY_NOKIA_P_H
+#define QGEOCODINGREPLY_NOKIA_P_H
+
+#include "qgeocodingreply.h"
+
+#include <QNetworkReply>
+
+QTM_BEGIN_NAMESPACE
+
+class QGeocodingReplyNokia : public QGeocodingReply
+{
+ Q_OBJECT
+
+public:
+ enum ResultCode {
+ OK,
+ Failed
+ };
+
+ QGeocodingReplyNokia(QNetworkReply *reply);
+ ~QGeocodingReplyNokia();
+
+ QGeocodingReplyNokia::ResultCode resultCode() const;
+ void setResultCode(QGeocodingReplyNokia::ResultCode code);
+
+public slots:
+ virtual void parse();
+ virtual void translateError(QNetworkReply::NetworkError errorCode);
+ virtual void cancel();
+
+private:
+ QNetworkReply *m_reply;
+ QGeocodingReplyNokia::ResultCode m_code;
+};
+
+QTM_END_NAMESPACE
+
+#endif
diff --git a/src/location/qgeocodingreply_p.h b/src/location/qgeocodingreply_p.h
index bdc1dabbdb..5c79457511 100644
--- a/src/location/qgeocodingreply_p.h
+++ b/src/location/qgeocodingreply_p.h
@@ -42,17 +42,21 @@
#ifndef QLOCATION_GEOCODINGREPLY_P_H
#define QLOCATION_GEOCODINGREPLY_P_H
+#include "qmobilityglobal.h"
+
+#include "qgeolocation.h"
+
+#include <QList>
QTM_BEGIN_NAMESPACE
class QGeocodingReplyPrivate
{
public:
- QGeocodingReplyPrivate(){};
+ QGeocodingReplyPrivate();
- QGeocodingReply::ResultCode code;
- QString descr;
- QList<QGeoLocation> plcs;
+ QString description;
+ QList<QGeoLocation> places;
};
QTM_END_NAMESPACE
diff --git a/src/location/qgeocodingrequest.cpp b/src/location/qgeocodingrequest.cpp
index 8ad7d84674..f7b797f834 100644
--- a/src/location/qgeocodingrequest.cpp
+++ b/src/location/qgeocodingrequest.cpp
@@ -52,17 +52,11 @@ QTM_BEGIN_NAMESPACE
This class represents a geocoding request.
*/
-QGeocodingRequestPrivate::QGeocodingRequestPrivate()
-{
- vers = "1.0";
- languageMARC = "eng";
-}
-
/*!
Default constructor.
*/
QGeocodingRequest::QGeocodingRequest()
- : d_ptr(new QGeocodingRequestPrivate())
+ : d_ptr(new QGeocodingRequestPrivate())
{
}
/*!
@@ -96,7 +90,7 @@ QString QGeocodingRequest::language() const
/*!
Sets the language code to \a language.
-
+
This function assumes that \a language is a MARC language code.
*/
void QGeocodingRequest::setLanguage(const QString& language)
@@ -118,10 +112,10 @@ QString QGeocodingRequest::oneBoxLocation() const
}
/*!
- Sets the OneBox location description to \a obloc,
+ Sets the OneBox location description to \a obloc,
This function assumes that \a obloc is a OneBox location description.
-
+
This contains all the location information like country, state, city,
street in one string without any specific order,
that will be processed by the OneBox-Search to extract
@@ -148,8 +142,8 @@ QString QGeocodingRequest::country() const
}
/*!
- Sets the name of the country to \a country.
-
+ Sets the name of the country to \a country.
+
It is required that either this function or setOneBoxLocation() are used.
*/
void QGeocodingRequest::setCountry(const QString& country)
@@ -248,6 +242,68 @@ void QGeocodingRequest::setNumber(const QString& number)
d->num = number;
}
+/*!
+ Returns the request string for this request and the given \a host.
+*/
+QString QGeocodingRequest::requestString(const QString &host) const
+{
+ Q_D(const QGeocodingRequest);
+ return d->requestString(host);
+}
+
+/******************************************************************************
+ ****************************************************************************/
+
+QGeocodingRequestPrivate::QGeocodingRequestPrivate()
+{
+ vers = "1.0";
+ languageMARC = "eng";
+}
+
+QString QGeocodingRequestPrivate::requestString(const QString &host) const
+{
+ QString request = "http://";
+ request += host;
+ request += "/geocoder/gc/";
+ request += vers;
+ request += "?referer=localhost";
+
+ if (languageMARC != "") {
+ request += "&lg=";
+ request += languageMARC;
+ }
+
+ if (obloc.isEmpty()) {
+ request += "&country=";
+ request += cntry;
+
+ if (!st.isEmpty()) {
+ request += "&state=";
+ request += st;
+ }
+ if (!cty.isEmpty()) {
+ request += "&city=";
+ request += cty;
+ }
+ if (!pCode.isEmpty()) {
+ request += "&zip=";
+ request += pCode;
+ }
+ if (!strt.isEmpty()) {
+ request += "&street=";
+ request += strt;
+ }
+ if (!num.isEmpty()) {
+ request += "&number=";
+ request += num;
+ }
+ } else {
+ request += "&obloc=";
+ request += obloc;
+ }
+
+ return request;
+}
QTM_END_NAMESPACE
diff --git a/src/location/qgeocodingrequest.h b/src/location/qgeocodingrequest.h
index 19fa5c5101..ab0cd81022 100644
--- a/src/location/qgeocodingrequest.h
+++ b/src/location/qgeocodingrequest.h
@@ -82,10 +82,11 @@ public:
QString number() const;
void setNumber(const QString& number);
+ QString requestString(const QString &host) const;
+
private:
Q_DISABLE_COPY(QGeocodingRequest)
-private:
QGeocodingRequestPrivate *d_ptr;
Q_DECLARE_PRIVATE(QGeocodingRequest)
};
diff --git a/src/location/qgeocodingrequest_p.h b/src/location/qgeocodingrequest_p.h
index b7147a8571..7bc886500a 100644
--- a/src/location/qgeocodingrequest_p.h
+++ b/src/location/qgeocodingrequest_p.h
@@ -42,6 +42,7 @@
#ifndef QLOCATION_GEOCODINGREQUEST_P_H
#define QLOCATION_GEOCODINGREQUEST_P_H
+#include "qmobilityglobal.h"
QTM_BEGIN_NAMESPACE
@@ -50,6 +51,8 @@ class QGeocodingRequestPrivate
public:
QGeocodingRequestPrivate();
+ QString requestString(const QString &host) const;
+
QString vers;
QString languageMARC;
diff --git a/src/location/qgeocodingservice.cpp b/src/location/qgeocodingservice.cpp
new file mode 100644
index 0000000000..1fa18a72fd
--- /dev/null
+++ b/src/location/qgeocodingservice.cpp
@@ -0,0 +1,157 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qgeocodingservice.h"
+
+QTM_BEGIN_NAMESPACE
+
+
+/* TODO
+ - this doc section came from the old qgeoengine.cpp file and needs a new home
+ - should update this and merge most of it with location overview
+*/
+
+/* \mainpage
+* \section sec_brief_overview Brief Overview
+* The qlocation package provides wrapper classes for (reverse) geocoding requests/replies
+* (QGeocodingRequest, QReverseGeocodingRequest, QGeocodingReply),
+* geo routing requests/replies (QGeoRouteRequest, QGeoRouteReply), and map tile requests/replies
+* (QGeoMapTileRequest, QGeoMapTileReply). QMapView is a Qt::QGraphicsView based widget that displays
+* a tile based map.
+*
+* \section sec_geo_engine The QGeoEngine
+* All requests and replies are handled via a QGeoEngine. The design of QGeoEngine follows roughly
+* the same "look and feel" as Qt:QNetworkAccessManager. Via the QGeoEngine::get() methods,
+* asynchronous requests are submitted to the geo engine, and a pointer to the corresponding
+* QGeoReply object is returned. Once the reply is avalaible, the QGeoEngine emits a
+* QGeoEngine::finished() signal. When an error occurs, a QGeoEngine::error() signal is emitted.
+*
+* \subsection subsec_geo_network_manager The QGeoNetworkManager
+* Currently, QGeoNetworkManager is the only concrete implementation of QGeoEngine. The QGeoNetworkManager
+* forwards the geo requests to their corresponding Nokia REST servers and handles all network communication
+* that goes on "behind the scenes".
+
+* \section sec_geocoding Geocoding Requests and Replies
+* A QGeocodingRequest tries to map an address to its geographical location (longitude/latitude).
+* An address can either be specified by a "one box location" description, or by its individual
+* country, state, city, post code, street name and street number fields.<br>
+* Depending on the address input, the corresponding QGeocodingReply can contain several QGeoLocation<i></i>s, each
+* containing a QGeoCoordinate and a QGeoAddress.
+
+* \section sec_reverse_geocoding Reverse Geocoding Requests and Replies
+* A QReverseGeocodingRequests tries to map a QGeoCoordinate to an address.<br>
+* It too returns a QGeocodingReply.
+
+* \section sec_routing Routing Requests and Replies
+* A QGeoRouteRequest requests a route from a source QGeoCoordinate to a destination QGeoCoordinate.<br>
+* The return QGeoRouteReply can contain several QGeoRoute<i></i>s, each containing numerous QManeuver<i></i>s.
+* A QManeuver is defined by a collection of QManeuver::wayPoints() and QManeuver::maneuverPoints().
+*
+* \section sec_map_tile Map Tile Requests and Replies
+* A QGeoMapTileRequest is specified by a column and row index and various format parameters.
+* The returned QGeoMapTileReply contains the raw byte array of the Qt::QPixmap of the tile.
+*
+* \section sec_map_view The QMapView Widget
+* The QMapView displays a tile based map. It supports panning and zooming, different map formats,
+* and provides overlay layers for QMapObject<i></i>s and QGeoRoute<i></i>s.
+* A QMapView is always associated with a QGeoEngine, through which it handles all the required
+* map tile management.
+*/
+
+/*!
+ \class QGeocodingService
+ \brief The QGeocodingService class handles all communications to and from a geocoding service.
+ \ingroup location
+
+ This is the abstract base class for all classes that handle
+ geocoding and reverse geocoding requests/replies to and from a geocoding service.
+*/
+
+/*!
+ Default constructor.
+*/
+QGeocodingService::QGeocodingService() {}
+/*!
+ Virtual destructor.
+*/
+QGeocodingService::~QGeocodingService() {}
+
+/*!
+ \fn QGeocodingReply* QGeocodingService::geocode(const QGeocodingRequest& request)
+
+ Submits a geocoding request \a request and returns the corresponding QGeocodingReply.
+
+ \note Due to the asynchronous nature of requests, you should wait for the
+ QGeocodingService::finished(QGeocodingReply*) signal from this object or the
+ QGeocodingReply::finished() signal from the returned QGeocodingReply object before
+ working with the reply.
+*/
+
+/*!
+ \fn QGeocodingReply* QGeocodingService::reverseGeocode(const QReverseGeocodingRequest& request)
+
+ Submits a reverse geocoding request \a request and returns the corresponding QGeocodingReply.
+
+ \note Due to the asynchronous nature of requests, you should wait for the
+ QGeocodingService::finished(QGeocodingReply*) signal from this object or the
+ QGeocodingReply::finished() signal from the returned QGeocodingReply object before
+ working with the reply.
+*/
+
+/*!
+ \fn void QGeocodingService::finished(QGeocodingReply* reply)
+
+ This signal is emitted when a QGeocodingReply is available in
+ response to a previously submitted QGeocodingRequest
+ or QReverseGeocodingRequest.
+*/
+
+/*!
+ \fn void QGeocodingService::error(QGeocodingReply* reply, QGeoReply::ErrorCode code)
+
+ This signal is emitted when a QGeocodingReply encountered an error
+ in response to a previously submitted QGeocodingReques or QReverseGeocodingRequest.
+ \note For QGeoNetworkManager, the error code will be identical to QNetworkReply::NetworkError.
+*/
+
+#include "moc_qgeocodingservice.cpp"
+
+QTM_END_NAMESPACE
diff --git a/src/location/qgeocodingservice.h b/src/location/qgeocodingservice.h
new file mode 100644
index 0000000000..9b1a0e31f5
--- /dev/null
+++ b/src/location/qgeocodingservice.h
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QGEOCODINGSERVICE_H
+#define QGEOCODINGSERVICE_H
+
+#include "qmobilityglobal.h"
+
+#include "qgeocodingreply.h"
+#include "qgeocodingrequest.h"
+#include "qreversegeocodingrequest.h"
+
+#include <QObject>
+
+QTM_BEGIN_NAMESPACE
+
+class Q_LOCATION_EXPORT QGeocodingService : public QObject
+{
+ Q_OBJECT
+public:
+ QGeocodingService();
+ virtual ~QGeocodingService();
+
+ virtual QGeocodingReply* geocode(const QGeocodingRequest& request) = 0;
+ virtual QGeocodingReply* reverseGeocode(const QReverseGeocodingRequest& request) = 0;
+
+signals:
+ void finished(QGeocodingReply* reply);
+ void error(QGeocodingReply* reply, QGeocodingReply::ErrorCode errorCode, QString errorString = QString());
+
+private:
+ Q_DISABLE_COPY(QGeocodingService)
+};
+
+QTM_END_NAMESPACE
+
+#endif // QGEOCODINGSERVICE_H
diff --git a/src/location/qgeocodingservice_nokia.cpp b/src/location/qgeocodingservice_nokia.cpp
new file mode 100644
index 0000000000..c124628527
--- /dev/null
+++ b/src/location/qgeocodingservice_nokia.cpp
@@ -0,0 +1,152 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qgeocodingservice_nokia_p.h"
+#include "qgeocodingreply_nokia_p.h"
+
+QTM_BEGIN_NAMESPACE
+
+QGeocodingServiceNokia::QGeocodingServiceNokia()
+ : m_token(""),
+ m_referrer(""),
+ m_host("dev-a7.bln.gate5.de"),
+ m_proxy(QNetworkProxy(QNetworkProxy::NoProxy))
+{
+}
+
+QGeocodingServiceNokia::~QGeocodingServiceNokia()
+{
+}
+
+QString QGeocodingServiceNokia::token() const
+{
+ return m_token;
+}
+
+void QGeocodingServiceNokia::setToken(const QString &token)
+{
+ m_token = token;
+}
+
+QString QGeocodingServiceNokia::referrer() const
+{
+ return m_referrer;
+}
+
+void QGeocodingServiceNokia::setReferrer(const QString &referrer)
+{
+ m_referrer = referrer;
+}
+
+QString QGeocodingServiceNokia::host() const
+{
+ return m_host;
+}
+
+void QGeocodingServiceNokia::setHost(const QString &host)
+{
+ m_host = host;
+}
+
+QNetworkProxy QGeocodingServiceNokia::proxy() const
+{
+ return m_proxy;
+}
+
+void QGeocodingServiceNokia::setProxy(const QNetworkProxy &proxy)
+{
+ m_proxy = proxy;
+ m_nam.setProxy(m_proxy);
+}
+
+QGeocodingReply* QGeocodingServiceNokia::geocode(const QGeocodingRequest& request)
+{
+ QString rawRequest = request.requestString(m_host);
+ QNetworkRequest netRequest = QNetworkRequest(QUrl(rawRequest));
+ QNetworkReply* reply = m_nam.get(netRequest);
+
+ QGeocodingReply* codingReply = new QGeocodingReplyNokia(reply);
+
+ connect(codingReply,
+ SIGNAL(finished()),
+ this,
+ SLOT(finishedReply()));
+ connect(codingReply,
+ SIGNAL(error(QGeocodingReply::ErrorCode, QString)),
+ this,
+ SLOT(errorReply(QGeocodingReply::ErrorCode, QString)));
+
+ return codingReply;
+}
+
+QGeocodingReply* QGeocodingServiceNokia::reverseGeocode(const QReverseGeocodingRequest& request)
+{
+ QString rawRequest = request.requestString(m_host);
+ QNetworkRequest netRequest = QNetworkRequest(QUrl(rawRequest));
+ QNetworkReply* reply = m_nam.get(netRequest);
+
+ QGeocodingReply* codingReply = new QGeocodingReplyNokia(reply);
+
+ connect(codingReply,
+ SIGNAL(finished()),
+ this,
+ SLOT(finishedReply()));
+ connect(codingReply,
+ SIGNAL(error(QGeocodingReply::ErrorCode, QString)),
+ this,
+ SLOT(errorReply(QGeocodingReply::ErrorCode, QString)));
+
+ return codingReply;
+}
+
+void QGeocodingServiceNokia::finishedReply()
+{
+ emit finished(static_cast<QGeocodingReply *>(this->sender()));
+}
+
+void QGeocodingServiceNokia::errorReply(QGeocodingReply::ErrorCode errorCode, QString errorString)
+{
+ emit error(static_cast<QGeocodingReply *>(this->sender()), errorCode, errorString);
+}
+
+#include "moc_qgeocodingservice_nokia_p.cpp"
+
+QTM_END_NAMESPACE
diff --git a/src/location/qgeocodingservice_nokia_p.h b/src/location/qgeocodingservice_nokia_p.h
new file mode 100644
index 0000000000..b77718963d
--- /dev/null
+++ b/src/location/qgeocodingservice_nokia_p.h
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QGEOCODINGSERVICE_NOKIA_P_H
+#define QGEOCODINGSERVICE_NOKIA_P_H
+
+#include "qgeocodingservice.h"
+
+#include <QNetworkAccessManager>
+#include <QNetworkProxy>
+
+QTM_BEGIN_NAMESPACE
+
+class Q_LOCATION_EXPORT QGeocodingServiceNokia : public QGeocodingService
+{
+ Q_OBJECT
+public:
+ QGeocodingServiceNokia();
+ ~QGeocodingServiceNokia();
+
+ QString token() const;
+ void setToken(const QString &token);
+
+ QString referrer() const;
+ void setReferrer(const QString &referrer);
+
+ QString host() const;
+ void setHost(const QString &host);
+
+ QNetworkProxy proxy() const;
+ void setProxy(const QNetworkProxy &proxy);
+
+ virtual QGeocodingReply* geocode(const QGeocodingRequest& request);
+ virtual QGeocodingReply* reverseGeocode(const QReverseGeocodingRequest& request);
+
+private slots:
+ void finishedReply();
+ void errorReply(QGeocodingReply::ErrorCode errorCode, QString errorString);
+
+private:
+ QString m_token;
+ QString m_referrer;
+ QString m_host;
+ QNetworkProxy m_proxy;
+ QNetworkAccessManager m_nam;
+};
+
+QTM_END_NAMESPACE
+
+#endif // QGEOCODINGSERVICE_NOKIA_P_H
diff --git a/src/location/qgeocodingxmlparser.h b/src/location/qgeocodingxmlparser.h
deleted file mode 100644
index ebfd54ba2b..0000000000
--- a/src/location/qgeocodingxmlparser.h
+++ /dev/null
@@ -1,40 +0,0 @@
-#ifndef QGEOCODINGXMLPARSER_H
-#define QGEOCODINGXMLPARSER_H
-
-#include "qmobilityglobal.h"
-
-class QXmlStreamReader;
-class QIODevice;
-class QRectF;
-
-QTM_BEGIN_NAMESPACE
-
-class QGeoCoordinate;
-class QGeocodingReply;
-class QGeoLocation;
-class QGeoAddress;
-
-class QGeocodingXmlParser
-{
-
-public:
-
- QGeocodingXmlParser();
- ~QGeocodingXmlParser();
-
- bool parse(QIODevice* source, QGeocodingReply *output);
-
-private:
- bool readRootElement(QGeocodingReply *output);
- bool readPlace(QGeoLocation *location);
- bool readLocation(QGeoLocation *location);
- bool readAddress(QGeoAddress *address);
- bool readBoundingBox(QRectF *rect);
- bool readCoordinate(QGeoCoordinate *coordinate, const QString &elementName);
-
- QXmlStreamReader *m_reader;
-};
-
-QTM_END_NAMESPACE
-
-#endif
diff --git a/src/location/qgeocodingxmlparser.cpp b/src/location/qgeocodingxmlparser_nokia.cpp
index 369c0fe466..47d22e21ae 100644
--- a/src/location/qgeocodingxmlparser.cpp
+++ b/src/location/qgeocodingxmlparser_nokia.cpp
@@ -1,8 +1,8 @@
-#include "qgeocodingxmlparser.h"
+#include "qgeocodingxmlparser_nokia_p.h"
#include "qgeocoordinate.h"
-#include "qgeocodingreply.h"
+#include "qgeocodingreply_nokia_p.h"
#include "qgeolocation.h"
#include "qgeoaddress.h"
@@ -10,39 +10,42 @@
#include <QIODevice>
#include <QRectF>
-#include <QDebug>
-
QTM_BEGIN_NAMESPACE
-QGeocodingXmlParser::QGeocodingXmlParser()
+QGeocodingXmlParserNokia::QGeocodingXmlParserNokia()
: m_reader(0)
{
}
-QGeocodingXmlParser::~QGeocodingXmlParser()
+QGeocodingXmlParserNokia::~QGeocodingXmlParserNokia()
{
if (m_reader)
delete m_reader;
}
-bool QGeocodingXmlParser::parse(QIODevice* source, QGeocodingReply *output)
+bool QGeocodingXmlParserNokia::parse(QIODevice* source, QGeocodingReplyNokia *output)
{
if (m_reader)
delete m_reader;
m_reader = new QXmlStreamReader(source);
- if (!readRootElement(output)) {
- // set errors appropriately
- qWarning() << m_reader->errorString();
+ if (!parseRootElement(output)) {
+ m_errorString = m_reader->errorString();
return false;
}
+ m_errorString = "";
+
return true;
}
-bool QGeocodingXmlParser::readRootElement(QGeocodingReply *output)
+QString QGeocodingXmlParserNokia::errorString() const
+{
+ return m_errorString;
+}
+
+bool QGeocodingXmlParserNokia::parseRootElement(QGeocodingReplyNokia *output)
{
- qWarning() << "root";
/*
<xsd:element name="places">
<xsd:complexType>
@@ -68,26 +71,26 @@ bool QGeocodingXmlParser::readRootElement(QGeocodingReply *output)
if (m_reader->attributes().hasAttribute("resultCode")) {
QStringRef result = m_reader->attributes().value("resultCode");
if (result == "OK") {
- output->setResultCode(QGeocodingReply::OK);
+ output->setResultCode(QGeocodingReplyNokia::OK);
} else if (result == "FAILED") {
- output->setResultCode(QGeocodingReply::Failed);
+ output->setResultCode(QGeocodingReplyNokia::Failed);
} else {
m_reader->raiseError(QString("The attribute \"resultCode\" of the element \"places\" has an unknown value (value was %1).").arg(result.toString()));
return false;
}
}
if (m_reader->attributes().hasAttribute("resultDescription")) {
- output->setResultDescription(m_reader->attributes().value("resultDescription").toString());
+ output->setDescription(m_reader->attributes().value("resultDescription").toString());
}
while (m_reader->readNextStartElement()) {
if (m_reader->name() == "place") {
QGeoLocation location;
- if (!readPlace(&location))
+ if (!parsePlace(&location))
return false;
- output->addPlace(location);
+ output->places().append(location);
} else {
m_reader->raiseError(QString("The element \"places\" did not expect a child element named \"%1\".").arg(m_reader->name().toString()));
return false;
@@ -110,9 +113,8 @@ bool QGeocodingXmlParser::readRootElement(QGeocodingReply *output)
return true;
}
-bool QGeocodingXmlParser::readPlace(QGeoLocation *location)
+bool QGeocodingXmlParserNokia::parsePlace(QGeoLocation *location)
{
- qWarning() << "place";
/*
<xsd:complexType name="Place">
<xsd:all>
@@ -162,7 +164,7 @@ bool QGeocodingXmlParser::readPlace(QGeoLocation *location)
return false;
}
- if (!readLocation(location))
+ if (!parseLocation(location))
return false;
parsedLocation = true;
@@ -173,11 +175,13 @@ bool QGeocodingXmlParser::readPlace(QGeoLocation *location)
}
QGeoAddress address;
- if (!readAddress(&address))
+ if (!parseAddress(&address))
return false;
else
location->setAddress(address);
+ location->setAddress(address);
+
parsedAddress = true;
} else if (name == "alternatives") {
if (parsedAlternatives) {
@@ -205,9 +209,8 @@ bool QGeocodingXmlParser::readPlace(QGeoLocation *location)
return true;
}
-bool QGeocodingXmlParser::readLocation(QGeoLocation *location)
+bool QGeocodingXmlParserNokia::parseLocation(QGeoLocation *location)
{
- qWarning() << "location";
/*
<xsd:complexType name="Location">
<xsd:all>
@@ -237,11 +240,11 @@ bool QGeocodingXmlParser::readLocation(QGeoLocation *location)
return false;
}
- QGeoCoordinate coordinate;
- if (!readCoordinate(&coordinate, "position"))
+ QGeoCoordinate coord;
+ if (!parseCoordinate(&coord, "position"))
return false;
- else
- location->setCoordinate(coordinate);
+
+ location->setCoordinate(coord);
parsedPosition = true;
} else if (name == "boundingBox") {
@@ -251,10 +254,12 @@ bool QGeocodingXmlParser::readLocation(QGeoLocation *location)
}
QRectF box;
- if (!readBoundingBox(&box))
+ if (!parseBoundingBox(&box))
return false;
location->setBoundingBox(box);
+ location->setBoundingBox(box);
+
parsedBox = true;
} else {
m_reader->raiseError(QString("The element \"location\" did not expect a child element named \"%1\".").arg(m_reader->name().toString()));
@@ -270,9 +275,8 @@ bool QGeocodingXmlParser::readLocation(QGeoLocation *location)
return true;
}
-bool QGeocodingXmlParser::readAddress(QGeoAddress *address)
+bool QGeocodingXmlParserNokia::parseAddress(QGeoAddress *address)
{
- qWarning() << "address";
/*
<xsd:complexType name="Address">
<xsd:sequence>
@@ -340,7 +344,7 @@ bool QGeocodingXmlParser::readAddress(QGeoAddress *address)
}
if (m_reader->name() == "city") {
- address->setCity (m_reader->readElementText());
+ address->setCity(m_reader->readElementText());
if (!m_reader->readNextStartElement())
return true;
}
@@ -387,9 +391,8 @@ bool QGeocodingXmlParser::readAddress(QGeoAddress *address)
return false;
}
-bool QGeocodingXmlParser::readBoundingBox(QRectF *rect)
+bool QGeocodingXmlParserNokia::parseBoundingBox(QRectF *rect)
{
- qWarning() << "boundingBox";
/*
<xsd:complexType name="GeoBox">
<xsd:sequence>
@@ -409,7 +412,7 @@ bool QGeocodingXmlParser::readBoundingBox(QRectF *rect)
QGeoCoordinate nw;
if (m_reader->name() == "northWest") {
- if (!readCoordinate(&nw, "northWest"))
+ if (!parseCoordinate(&nw, "northWest"))
return false;
} else {
m_reader->raiseError(QString("The element \"boundingBox\" expected this child element to be named \"northWest\" (found an element named \"%1\")").arg(m_reader->name().toString()));
@@ -424,7 +427,7 @@ bool QGeocodingXmlParser::readBoundingBox(QRectF *rect)
QGeoCoordinate se;
if (m_reader->name() == "southEast") {
- if (!readCoordinate(&se, "southEast"))
+ if (!parseCoordinate(&se, "southEast"))
return false;
} else {
m_reader->raiseError(QString("The element \"boundingBox\" expected this child element to be named \"southEast\" (found an element named \"%1\")").arg(m_reader->name().toString()));
@@ -442,9 +445,8 @@ bool QGeocodingXmlParser::readBoundingBox(QRectF *rect)
return true;
}
-bool QGeocodingXmlParser::readCoordinate(QGeoCoordinate *coordinate, const QString &elementName)
+bool QGeocodingXmlParserNokia::parseCoordinate(QGeoCoordinate *coordinate, const QString &elementName)
{
- qWarning() << "coord";
/*
<xsd:complexType name="GeoCoord">
<xsd:sequence>
diff --git a/src/location/qgeocodingxmlparser_nokia_p.h b/src/location/qgeocodingxmlparser_nokia_p.h
new file mode 100644
index 0000000000..d8c86ac349
--- /dev/null
+++ b/src/location/qgeocodingxmlparser_nokia_p.h
@@ -0,0 +1,42 @@
+#ifndef QGEOCODINGXMLPARSER_H
+#define QGEOCODINGXMLPARSER_H
+
+#include "qmobilityglobal.h"
+
+#include <QString>
+
+class QXmlStreamReader;
+class QIODevice;
+class QRectF;
+
+QTM_BEGIN_NAMESPACE
+
+class QGeoCoordinate;
+class QGeocodingReplyNokia;
+class QGeoLocation;
+class QGeoAddress;
+
+class QGeocodingXmlParserNokia
+{
+public:
+ QGeocodingXmlParserNokia();
+ ~QGeocodingXmlParserNokia();
+
+ bool parse(QIODevice* source, QGeocodingReplyNokia *output);
+ QString errorString() const;
+
+private:
+ bool parseRootElement(QGeocodingReplyNokia *output);
+ bool parsePlace(QGeoLocation *location);
+ bool parseLocation(QGeoLocation *location);
+ bool parseAddress(QGeoAddress *address);
+ bool parseBoundingBox(QRectF *rect);
+ bool parseCoordinate(QGeoCoordinate *coordinate, const QString &elementName);
+
+ QXmlStreamReader *m_reader;
+ QString m_errorString;
+};
+
+QTM_END_NAMESPACE
+
+#endif
diff --git a/src/location/qgeoengine.cpp b/src/location/qgeoengine.cpp
deleted file mode 100644
index 41c9025310..0000000000
--- a/src/location/qgeoengine.cpp
+++ /dev/null
@@ -1,281 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgeoengine.h"
-
-#define PI 3.14159265
-#include <math.h>
-
-QTM_BEGIN_NAMESPACE
-
-// TODO: merge with location overview
-/* \mainpage
-* \section sec_brief_overview Brief Overview
-* The qlocation package provides wrapper classes for (reverse) geocoding requests/replies
-* (QGeocodingRequest, QReverseGeocodingRequest, QGeocodingReply),
-* geo routing requests/replies (QRouteRequest, QRouteReply), and map tile requests/replies
-* (QMapTileRequest, QMapTileReply). QMapView is a Qt::QGraphicsView based widget that displays
-* a tile based map.
-*
-* \section sec_geo_engine The QGeoEngine
-* All requests and replies are handled via a QGeoEngine. The design of QGeoEngine follows roughly
-* the same "look and feel" as Qt:QNetworkAccessManager. Via the QGeoEngine::get() methods,
-* asynchronous requests are submitted to the geo engine, and a pointer to the corresponding
-* QGeoReply object is returned. Once the reply is avalaible, the QGeoEngine emits a
-* QGeoEngine::finished() signal. When an error occurs, a QGeoEngine::error() signal is emitted.
-*
-* \subsection subsec_geo_network_manager The QGeoNetworkManager
-* Currently, QGeoNetworkManager is the only concrete implementation of QGeoEngine. The QGeoNetworkManager
-* forwards the geo requests to their corresponding Nokia REST servers and handles all network communication
-* that goes on "behind the scenes".
-
-* \section sec_geocoding Geocoding Requests and Replies
-* A QGeocodingRequest tries to map an address to its geographical location (longitude/latitude).
-* An address can either be specified by a "one box location" description, or by its individual
-* country, state, city, post code, street name and street number fields.<br>
-* Depending on the address input, the corresponding QGeocodingReply can contain several QGeoLocation<i></i>s, each
-* containing a QGeoCoordinate and a QGeoAddress.
-
-* \section sec_reverse_geocoding Reverse Geocoding Requests and Replies
-* A QReverseGeocodingRequests tries to map a QGeoCoordinate to an address.<br>
-* It too returns a QGeocodingReply.
-
-* \section sec_routing Routing Requests and Replies
-* A QRouteRequest requests a route from a source QGeoCoordinate to a destination QGeoCoordinate.<br>
-* The return QRouteReply can contain several QRoute<i></i>s, each containing numerous QManeuver<i></i>s.
-* A QManeuver is defined by a collection of QManeuver::wayPoints() and QManeuver::maneuverPoints().
-*
-* \section sec_map_tile Map Tile Requests and Replies
-* A QMapTileRequest is specified by a column and row index and various format parameters.
-* The returned QMapTileReply contains the raw byte array of the Qt::QPixmap of the tile.
-*
-* \section sec_map_view The QMapView Widget
-* The QMapView displays a tile based map. It supports panning and zooming, different map formats,
-* and provides overlay layers for QMapObject<i></i>s and QRoute<i></i>s.
-* A QMapView is always associated with a QGeoEngine, through which it handles all the required
-* map tile management.
-*/
-
-/*!
- \class QGeoEngine
- \brief The QGeoEngine class is the base class for all maps and navigations requests and replies.
- \ingroup location
-
- This is the abstract base class for all classes that handle
- (reverse) geocoding requests/replies, map tile requests/replies,
- and routing requests/replies. Currently, the only class that
- extends QGeoEngine is QGeoNetworkManager, that handles
- all communication with the REST servers. In the future, it is
- conceivable that another class could be implemented that handles
- all that functionality locally. That class would simply have to
- adhere to the interface defined here and could then be easily
- swapped into place for QGeoNetworkManager.
-*/
-
-/*!
- Default constructor.
-*/
-QGeoEngine::QGeoEngine() {}
-/*!
- Virtual destructor.
-*/
-QGeoEngine::~QGeoEngine() {}
-
-/*!
- \fn QRouteReply* QGeoEngine::get(const QRouteRequest& request)
-
- Submits the route request \a request and returns the corresponding QRouteReply.
-
- \note Due to the potentially asynchronous nature of requests, you should
- never directly start working with the returned reply, but instead wait for
- the finished(QRouteReply*) signal.
-*/
-
-/*!
- \fn QGeocodingReply* QGeoEngine::get(const QGeocodingRequest& request)
-
- Submits a geocoding request \a request and returns the corresponding QGeocodingReply.
-
- \note Due to the potentially asynchronous nature of requests, you should
- never directly start working with the returned reply, but instead wait for
- the finished(QGeocodingReply*) signal.
-*/
-
-/*!
- \fn QGeocodingReply* QGeoEngine::get(const QReverseGeocodingRequest& request)
-
- Submits a reverse geocoding request \a request and returns the corresponding QGeocodingReply.
-
- \note Due to the potentially asynchronous nature of requests, you should
- never directly start working with the returned reply, but instead wait for
- the finished(QGeocodingReply*) signal.
-*/
-
-/*!
- \fn QMapTileReply* QGeoEngine::get(const QMapTileRequest& request)
-
- Submits a map tile request \a request and returns the corresponding QMapTileReply.
-
- \note Due to the potentially asynchronous nature of requests, you should
- never directly start working with the returned reply, but instead wait for
- the finished(QMapTileReply*) signal.
-*/
-
-/*!
- \fn void QGeoEngine::release(QGeoReply* reply)
-
- When the QGeoReply \a reply is no longer needed, it should never be manually
- deleted. Instead this method should be used to properly remove the reply
- from corresponding internal maps.
-*/
-
-/*!
- \fn void QGeoEngine::cancel(QGeoReply* reply)
-
- Cancels the (pending) reply \a reply.
-*/
-
-/*!
- \fn quint16 QGeoEngine::maxZoomLevel() const
-
- Returns the maximum zoom level supported by this geo engine.
-*/
-
-/*!
- \fn QList<MapVersion> QGeoEngine::versions() const
-
- Returns a list of all available \l {MapVersion} {MapVersions}.
-*/
-
-/*!
- \fn QList<MapResolution> QGeoEngine::resolutions() const
-
- Returns a list of all available \l {MapResolution} {MapResolutions}.
-*/
-
-/*!
- \fn QList<MapFormat> QGeoEngine::formats() const
-
- Returns a list of all available \l {MapFormat} {MapFormats}.
-*/
-
-/*!
- \fn QList<MapScheme> QGeoEngine::schemes() const
-
- Returns a list of all available \l {MapScheme} {MapSchemes}.
-*/
-
-/*!
- \fn void QGeoEngine::finished(QRouteReply* reply)
-
- This signal is emitted when a QRouteReply is available in
- response to a previously submitted QRouteRequest.
-*/
-
-/*!
- \fn void QGeoEngine::finished(QGeocodingReply* reply)
-
- This signal is emitted when a QGeocodingReply is available in
- response to a previously submitted QGeocodingRequest
- or QReverseGeocodingRequest.
-*/
-
-/*!
- \fn void QGeoEngine::finished(QMapTileReply* reply)
-
- This signal is emitted when a QMapTileReply is available in
- response to a previously submitted QMapTileRequest.
-*/
-
-/*!
- \fn void QGeoEngine::error(QRouteReply* reply, QGeoReply::ErrorCode code)
-
- This signal is emitted when a QRouteReply encountered an error
- in response to a previously submitted QRouteRequest.
- \note For QGeoNetworkManager, the error code will be identical to QNetworkReply::NetworkError.
-*/
-
-/*!
- \fn void QGeoEngine::error(QGeocodingReply* reply, QGeoReply::ErrorCode code)
-
- This signal is emitted when a QGeocodingReply encountered an error
- in response to a previously submitted QGeocodingReques or QReverseGeocodingRequest.
- \note For QGeoNetworkManager, the error code will be identical to QNetworkReply::NetworkError.
-*/
-
-/*!
- \fn void QGeoEngine::error(QMapTileReply* reply, QGeoReply::ErrorCode code)
-
- This signal is emitted when a QMapTileReply encountered an error
- in response to a previously submitted QMapTileRequest.
- \note For QGeoNetworkManager, the error code will be identical to QNetworkReply::NetworkError.
-*/
-
-/*!
- The map tile server uses a Mercator projection to map geo coordinates into a 2D map.
- For each zoom level, that map is then split into 2^zoomLevel x 2^zoomLevel map tiles.
-
- For the given \a zoomLevel, this function determines the row and column indices of the
- map tile from the 2D map which contains the geo coordinate \a coordinate and stores
- the indices in \a row and \a col respectively.
-
- \note This does not mean that the coordinate lies in the center of the calculated tile.
-*/
-void QGeoEngine::getMercatorTileIndex(const QGeoCoordinate& coordinate, quint16 zoomLevel, quint32* col, quint32* row)
-{
- qreal p = pow((double) 2, zoomLevel);
-
- double x = coordinate.longitude() / 360 + 0.5;
- double y = 0.5 - (log(tan((PI / 4.0) + (PI / 2.0) * coordinate.latitude() / 180)) / PI) / 2;
-
- if (y < 0)
- y = 0;
-
- if (y > 1)
- y = 1;
-
- *col = (quint32)(x * p);
- *row = (quint32)(y * p);
-}
-
-#include "moc_qgeoengine.cpp"
-
-QTM_END_NAMESPACE
diff --git a/src/location/qgeolocation.cpp b/src/location/qgeolocation.cpp
index 40544faca8..8f37752b7f 100644
--- a/src/location/qgeolocation.cpp
+++ b/src/location/qgeolocation.cpp
@@ -45,15 +45,15 @@
QTM_BEGIN_NAMESPACE
QGeoLocationPrivate::QGeoLocationPrivate()
- :QSharedData()
+ : QSharedData()
{
}
QGeoLocationPrivate::QGeoLocationPrivate(const QGeoLocationPrivate &other)
- :QSharedData(other),
- box(other.box),
- coord(other.coord),
- addr(other.addr)
+ : QSharedData(other),
+ box(other.box),
+ coord(other.coord),
+ addr(other.addr)
{
}
@@ -73,7 +73,7 @@ QGeoLocationPrivate::~QGeoLocationPrivate()
Default constructor.
*/
QGeoLocation::QGeoLocation()
- :d(new QGeoLocationPrivate)
+ : d(new QGeoLocationPrivate)
{
}
@@ -81,7 +81,7 @@ QGeoLocation::QGeoLocation()
Constructs a copy of \a other.
*/
QGeoLocation::QGeoLocation(const QGeoLocation &other)
- :d(other.d)
+ : d(other.d)
{
}
@@ -96,7 +96,7 @@ QGeoLocation::~QGeoLocation()
Assigns \a other to this location and returns a reference
to this location.
*/
-QGeoLocation &QGeoLocation::operator=(const QGeoLocation &other)
+QGeoLocation &QGeoLocation::operator=(const QGeoLocation & other)
{
d = other.d;
return *this;
@@ -109,8 +109,8 @@ QGeoLocation &QGeoLocation::operator=(const QGeoLocation &other)
bool QGeoLocation::operator==(const QGeoLocation &other) const
{
return (d->box == other.boundingBox())
- && (d->coord == other.coordinate())
- && (d->addr == other.address());
+ && (d->coord == other.coordinate())
+ && (d->addr == other.address());
}
/*!
diff --git a/src/location/qgeolocation.h b/src/location/qgeolocation.h
index c97a727c5e..a98ed1e909 100644
--- a/src/location/qgeolocation.h
+++ b/src/location/qgeolocation.h
@@ -58,12 +58,14 @@ class Q_LOCATION_EXPORT QGeoLocation
{
public:
QGeoLocation();
- QGeoLocation(const QGeoLocation &other);
+ QGeoLocation(const QGeoLocation &gl);
+ QGeoLocation& operator=(const QGeoLocation &gl);
~QGeoLocation();
- QGeoLocation &operator=(const QGeoLocation &other);
bool operator==(const QGeoLocation &other) const;
- bool operator!=(const QGeoLocation &other) const{return !(*this == other);}
+ bool operator!=(const QGeoLocation &other) const {
+ return !(*this == other);
+ }
QRectF boundingBox() const;
void setBoundingBox(const QRectF &boundingBox);
diff --git a/src/location/qgeolocation_p.h b/src/location/qgeolocation_p.h
index 6d54a95c9a..c0deb54533 100644
--- a/src/location/qgeolocation_p.h
+++ b/src/location/qgeolocation_p.h
@@ -68,11 +68,12 @@ public:
QGeoLocationPrivate(const QGeoLocationPrivate &other);
~QGeoLocationPrivate();
- QRectF box;
- QGeoCoordinate coord;
- QGeoAddress addr;
+ QRectF box;
+ QGeoCoordinate coord;
+ QGeoAddress addr;
};
QTM_END_NAMESPACE
#endif
+
diff --git a/src/location/qgeomapservice.cpp b/src/location/qgeomapservice.cpp
new file mode 100644
index 0000000000..0c214b4518
--- /dev/null
+++ b/src/location/qgeomapservice.cpp
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qgeomapservice.h"
+
+QTM_BEGIN_NAMESPACE
+
+/*!
+ \class QGeoMapService
+ \brief The QGeoMapService class handles all communication to and from a geographic map service.
+ \ingroup location
+
+ This is the abstract base class for all classes that handle
+ map tile requests/replies to and from a service which provides geographic maps.
+*/
+
+/*!
+ Default constructor.
+*/
+QGeoMapService::QGeoMapService() {}
+/*!
+ Virtual destructor.
+*/
+QGeoMapService::~QGeoMapService() {}
+
+/*!
+ \fn QGeoMapTileReply* QGeoMapService::getMapTile(const QGeoMapTileRequest& request)
+
+ Submits a map tile request \a request and returns the corresponding QGeoMapTileReply.
+
+ \note Due to the asynchronous nature of requests, you should wait for the
+ QGeoMapService::finished(QGeoMapTileReply*) signal from this object or the
+ QGeoMapTileReply::finished() signal from the returned QGeoMapTileReply object before
+ working with the reply.
+*/
+
+/*!
+ \fn quint16 QGeoMapService::maxZoomLevel() const
+
+ Returns the maximum zoom level supported by this geo engine.
+*/
+
+/*!
+ \fn QList<MapVersion> QGeoMapService::versions() const
+
+ Returns a list of all available \l {MapVersion} {MapVersions}.
+*/
+
+/*!
+ \fn QList<MapResolution> QGeoMapService::resolutions() const
+
+ Returns a list of all available \l {MapResolution} {MapResolutions}.
+*/
+
+/*!
+ \fn QList<MapFormat> QGeoMapService::formats() const
+
+ Returns a list of all available \l {MapFormat} {MapFormats}.
+*/
+
+/*!
+ \fn QList<MapScheme> QGeoMapService::schemes() const
+
+ Returns a list of all available \l {MapScheme} {MapSchemes}.
+*/
+
+/*!
+ \fn void QGeoMapService::finished(QGeoMapTileReply* reply)
+
+ This signal is emitted when a QGeoMapTileReply is available in
+ response to a previously submitted QGeoMapTileRequest.
+*/
+
+/*!
+ \fn void QGeoMapService::error(QGeoMapTileReply* reply, QGeoReply::ErrorCode code)
+
+ This signal is emitted when a QGeoMapTileReply encountered an error
+ in response to a previously submitted QGeoMapTileRequest.
+ \note For QGeoNetworkManager, the error code will be identical to QNetworkReply::NetworkError.
+*/
+
+#include "moc_qgeomapservice.cpp"
+
+QTM_END_NAMESPACE
diff --git a/src/location/qmaptilereply.h b/src/location/qgeomapservice.h
index fa79c77d39..51daf870b1 100644
--- a/src/location/qmaptilereply.h
+++ b/src/location/qgeomapservice.h
@@ -39,55 +39,41 @@
**
****************************************************************************/
-#ifndef QLOCATION_MAPTILEREPLY_H
-#define QLOCATION_MAPTILEREPLY_H
+#ifndef QGEOMAPSERVICE_H
+#define QGEOMAPSERVICE_H
-#include <QObject>
-#include <QByteArray>
-#include <QPointF>
-#include <QString>
+#include "qmobilityglobal.h"
+
+#include "qgeomaptilerequest.h"
+#include "qgeomaptilereply.h"
-#include "qmaptilerequest.h"
-#include "qgeoreply.h"
+#include <QObject>
QTM_BEGIN_NAMESPACE
-/*!
-* This class contains the requested map tile.
-*/
-class QMapTileReply : public QGeoReply
+class Q_LOCATION_EXPORT QGeoMapService : public QObject
{
Q_OBJECT
+public:
+ QGeoMapService();
+ virtual ~QGeoMapService();
- friend class QGeoNetworkManager;
+ virtual QGeoMapTileReply* getMapTile(const QGeoMapTileRequest& request) = 0;
-public:
- /*!
- * Constructor.
- * @param request The associated \ref QMapTileRequest
- */
- QMapTileReply(const QMapTileRequest& request);
+ virtual quint16 maxZoomLevel() const = 0;
+ virtual QList<MapVersion> versions() const = 0;
+ virtual QList<MapResolution> resolutions() const = 0;
+ virtual QList<MapFormat> formats() const = 0;
+ virtual QList<MapScheme> schemes() const = 0;
- /*!
- * @return The raw byte array from which a QPixmap, etc. can then be constructed.
- */
- QByteArray& rawData() {
- return data;
- }
- /*!
- * @return A reference to the associated \ref QMapTileRequest.
- */
- const QMapTileRequest& request() const {
- return req;
- }
+signals:
+ void finished(QGeoMapTileReply* reply);
+ void error(QGeoMapTileReply* reply, QGeoMapTileReply::ErrorCode errorCode, QString errorString = QString());
private:
- Q_DISABLE_COPY(QMapTileReply)
-
- QByteArray data;
- QMapTileRequest req;
+ Q_DISABLE_COPY(QGeoMapService)
};
QTM_END_NAMESPACE
-#endif
+#endif // QGEOMAPSERVICE_H
diff --git a/src/location/qgeomapservice_nokia.cpp b/src/location/qgeomapservice_nokia.cpp
new file mode 100644
index 0000000000..d95e6e8654
--- /dev/null
+++ b/src/location/qgeomapservice_nokia.cpp
@@ -0,0 +1,208 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qgeomapservice_nokia_p.h"
+#include "qgeomaptilereply_nokia_p.h"
+
+#define PI 3.14159265
+#include <math.h>
+
+QTM_BEGIN_NAMESPACE
+
+QGeoMapServiceNokia::QGeoMapServiceNokia()
+ : m_token(""),
+ m_referrer(""),
+ m_host("172.24.32.155"),
+ m_proxy(QNetworkProxy(QNetworkProxy::NoProxy))
+{
+}
+
+QGeoMapServiceNokia::~QGeoMapServiceNokia()
+{
+}
+
+QString QGeoMapServiceNokia::token() const
+{
+ return m_token;
+}
+
+void QGeoMapServiceNokia::setToken(const QString &token)
+{
+ m_token = token;
+}
+
+QString QGeoMapServiceNokia::referrer() const
+{
+ return m_referrer;
+}
+
+void QGeoMapServiceNokia::setReferrer(const QString &referrer)
+{
+ m_referrer = referrer;
+}
+
+QString QGeoMapServiceNokia::host() const
+{
+ return m_host;
+}
+
+void QGeoMapServiceNokia::setHost(const QString &host)
+{
+ m_host = host;
+}
+
+QNetworkProxy QGeoMapServiceNokia::proxy() const
+{
+ return m_proxy;
+}
+
+void QGeoMapServiceNokia::setProxy(const QNetworkProxy &proxy)
+{
+ m_proxy = proxy;
+ m_nam.setProxy(m_proxy);
+}
+
+QGeoMapTileReply* QGeoMapServiceNokia::getMapTile(const QGeoMapTileRequest& request)
+{
+ //check cache first
+ QGeoMapTileReply* tileReply = NULL;
+
+ if ((tileReply = m_cache.get(request))) {
+ connect(tileReply,
+ SIGNAL(finished()),
+ this,
+ SLOT(finishedReply()));
+ connect(tileReply,
+ SIGNAL(error(QGeoMapTileReply::ErrorCode, QString)),
+ this,
+ SLOT(errorReply(QGeoMapTileReply::ErrorCode, QString)));
+ tileReply->done();
+ } else {
+ QString rawRequest = request.requestString(m_host, m_token, m_referrer);
+ QNetworkRequest netRequest = QNetworkRequest(QUrl(rawRequest));
+ QNetworkReply* netReply = m_nam.get(netRequest);
+
+ tileReply = new QGeoMapTileReplyNokia(request, netReply);
+
+ connect(tileReply,
+ SIGNAL(finished()),
+ this,
+ SLOT(finishedReply()));
+ connect(tileReply,
+ SIGNAL(error(QGeoMapTileReply::ErrorCode, QString)),
+ this,
+ SLOT(errorReply(QGeoMapTileReply::ErrorCode, QString)));
+ }
+
+ return tileReply;
+}
+
+quint16 QGeoMapServiceNokia::maxZoomLevel() const
+{
+ return m_maxZoomLevel;
+}
+
+QList<MapVersion> QGeoMapServiceNokia::versions() const
+{
+ return m_versions;
+}
+
+QList<MapResolution> QGeoMapServiceNokia::resolutions() const
+{
+ return m_resolutions;
+}
+
+QList<MapFormat> QGeoMapServiceNokia::formats() const
+{
+ return m_formats;
+}
+
+QList<MapScheme> QGeoMapServiceNokia::schemes() const
+{
+ return m_schemes;
+}
+
+void QGeoMapServiceNokia::finishedReply()
+{
+ QGeoMapTileReply *reply = static_cast<QGeoMapTileReply *>(this->sender());
+
+ if (reply->data().length() > 0)
+ m_cache.cache(reply->request(), *reply);
+
+ emit finished(reply);
+}
+
+void QGeoMapServiceNokia::errorReply(QGeoMapTileReply::ErrorCode errorCode, QString errorString)
+{
+ emit error(static_cast<QGeoMapTileReply *>(this->sender()), errorCode, errorString);
+}
+
+/*!
+ The map tile server uses a Mercator projection to map geo coordinates into a 2D map.
+ For each zoom level, that map is then split into 2^zoomLevel x 2^zoomLevel map tiles.
+
+ For the given \a zoomLevel, this function determines the row and column indices of the
+ map tile from the 2D map which contains the geo coordinate \a coordinate and stores
+ the indices in \a row and \a col respectively.
+
+ \note This does not mean that the coordinate lies in the center of the calculated tile.
+*/
+void QGeoMapServiceNokia::getMercatorTileIndex(const QGeoCoordinate& coordinate, quint16 zoomLevel, quint32* col, quint32* row)
+{
+ qreal p = pow((double) 2, zoomLevel);
+
+ double x = coordinate.longitude() / 360 + 0.5;
+ double y = 0.5 - (log(tan((PI / 4.0) + (PI / 2.0) * coordinate.latitude() / 180)) / PI) / 2;
+
+ if (y < 0)
+ y = 0;
+
+ if (y > 1)
+ y = 1;
+
+ *col = (quint32)(x * p);
+ *row = (quint32)(y * p);
+}
+
+#include "moc_qgeomapservice_nokia_p.cpp"
+
+QTM_END_NAMESPACE
+
diff --git a/src/location/qgeoengine.h b/src/location/qgeomapservice_nokia_p.h
index 54518274a9..0aa1e796c6 100644
--- a/src/location/qgeoengine.h
+++ b/src/location/qgeomapservice_nokia_p.h
@@ -39,64 +39,67 @@
**
****************************************************************************/
-#ifndef QLOCATION_GEOENGINE_H
-#define QLOCATION_GEOENGINE_H
+#ifndef QGEOMAPSERVICE_NOKIA_P_H
+#define QGEOMAPSERVICE_NOKIA_P_H
+
+#include "qgeomapservice.h"
+#include "qgeomaptilecache.h"
+#include "qgeocoordinate.h"
#include <QNetworkAccessManager>
-#include <QHash>
-#include <QNetworkReply>
#include <QNetworkProxy>
-#include "qrouterequest.h"
-#include "qroutereply.h"
-#include "qgeocodingrequest.h"
-#include "qreversegeocodingrequest.h"
-#include "qgeocodingreply.h"
-#include "qmaptilerequest.h"
-#include "qmaptilereply.h"
-#include "qmaptile.h"
-
QTM_BEGIN_NAMESPACE
-class Q_LOCATION_EXPORT QGeoEngine : public QObject
+class Q_LOCATION_EXPORT QGeoMapServiceNokia : public QGeoMapService
{
Q_OBJECT
-
public:
- QGeoEngine();
- virtual ~QGeoEngine();
+ QGeoMapServiceNokia();
+ ~QGeoMapServiceNokia();
- virtual QRouteReply* get(const QRouteRequest& request) = 0;
- virtual QGeocodingReply* get(const QGeocodingRequest& request) = 0;
- virtual QGeocodingReply* get(const QReverseGeocodingRequest& request) = 0;
- virtual QMapTileReply* get(const QMapTileRequest& request) = 0;
+ QString token() const;
+ void setToken(const QString &token);
- virtual void release(QGeoReply* reply) = 0;
- virtual void cancel(QGeoReply* reply) = 0;
+ QString referrer() const;
+ void setReferrer(const QString &referrer);
- virtual quint16 maxZoomLevel() const = 0;
+ QString host() const;
+ void setHost(const QString &host);
- virtual QList<MapVersion> versions() const = 0;
- virtual QList<MapResolution> resolutions() const = 0;
- virtual QList<MapFormat> formats() const = 0;
- virtual QList<MapScheme> schemes() const = 0;
-
-private:
- Q_DISABLE_COPY(QGeoEngine)
+ QNetworkProxy proxy() const;
+ void setProxy(const QNetworkProxy &proxy);
-signals:
- void finished(QRouteReply* reply);
- void finished(QGeocodingReply* reply);
- void finished(QMapTileReply* reply);
+ virtual QGeoMapTileReply* getMapTile(const QGeoMapTileRequest& request);
- void error(QRouteReply* reply, QGeoReply::ErrorCode code);
- void error(QGeocodingReply* reply, QGeoReply::ErrorCode code);
- void error(QMapTileReply* reply, QGeoReply::ErrorCode code);
+ virtual quint16 maxZoomLevel() const;
+ virtual QList<MapVersion> versions() const;
+ virtual QList<MapResolution> resolutions() const;
+ virtual QList<MapFormat> formats() const;
+ virtual QList<MapScheme> schemes() const;
-public:
static void getMercatorTileIndex(const QGeoCoordinate& coordinate, quint16 zoomLevel, quint32* col, quint32* row);
+
+private slots:
+ void finishedReply();
+ void errorReply(QGeoMapTileReply::ErrorCode errorCode, QString errorString);
+
+private:
+ QString m_token;
+ QString m_referrer;
+ QString m_host;
+ QNetworkProxy m_proxy;
+ QNetworkAccessManager m_nam;
+
+ QGeoMapTileCache m_cache;
+ quint16 m_maxZoomLevel;
+ QList<MapVersion> m_versions;
+ QList<MapResolution> m_resolutions;
+ QList<MapFormat> m_formats;
+ QList<MapScheme> m_schemes;
+
};
QTM_END_NAMESPACE
-#endif
+#endif // QGEOMAPSERVICE_NOKIA_P_H
diff --git a/src/location/qmaptile.h b/src/location/qgeomaptile.h
index 3ec50f77cc..3ec50f77cc 100644
--- a/src/location/qmaptile.h
+++ b/src/location/qgeomaptile.h
diff --git a/src/location/qmaptilecache.cpp b/src/location/qgeomaptilecache.cpp
index 56029c41cb..776688c754 100644
--- a/src/location/qmaptilecache.cpp
+++ b/src/location/qgeomaptilecache.cpp
@@ -43,7 +43,8 @@
#include <QDateTime>
#include <QMap>
-#include "qmaptilecache.h"
+#include "qgeomaptilecache.h"
+#include "qgeomaptilereply_nokia_p.h"
#define SECONDS_PER_DAY 86400
#define THIRTY_DAYS (30 * SECONDS_PER_DAY)
@@ -55,7 +56,7 @@ QTM_BEGIN_NAMESPACE
//TODO: thoroughly check whether LRU correctly works
-QMapTileCache::QMapTileCache()
+QGeoMapTileCache::QGeoMapTileCache()
{
cacheDir = QDir::home();
expire = THIRTY_DAYS;
@@ -65,7 +66,7 @@ QMapTileCache::QMapTileCache()
init();
}
-QMapTileCache::QMapTileCache(QDir& directory)
+QGeoMapTileCache::QGeoMapTileCache(QDir& directory)
{
cacheDir = directory;
expire = THIRTY_DAYS;
@@ -75,7 +76,7 @@ QMapTileCache::QMapTileCache(QDir& directory)
init();
}
-void QMapTileCache::init()
+void QGeoMapTileCache::init()
{
if (!cacheDir.exists(QLOCATION_CACHE_DIR)) {
cacheDir.mkdir(QLOCATION_CACHE_DIR);
@@ -101,7 +102,7 @@ void QMapTileCache::init()
}
}
-QMapTileReply* QMapTileCache::get(const QMapTileRequest& request)
+QGeoMapTileReply* QGeoMapTileCache::get(const QGeoMapTileRequest& request)
{
QString fileName = constrFileName(request);
int hashKey = constrHashKey(fileName);
@@ -125,14 +126,14 @@ QMapTileReply* QMapTileCache::get(const QMapTileRequest& request)
if (!tile.open(QIODevice::ReadOnly))
return NULL;
- QMapTileReply* reply = new QMapTileReply(request);
- reply->rawData() = tile.readAll();
+ QGeoMapTileReply* reply = new QGeoMapTileReplyNokia(request, 0);
+ reply->setData(tile.readAll());
tile.close();
return reply;
}
-bool QMapTileCache::hasExpired(const QDateTime& timestamp)
+bool QGeoMapTileCache::hasExpired(const QDateTime& timestamp)
{
uint lastAccessed = timestamp.toTime_t();
uint currTime = QDateTime::currentDateTime().toTime_t();
@@ -144,11 +145,11 @@ bool QMapTileCache::hasExpired(const QDateTime& timestamp)
return false;
}
-void QMapTileCache::cache(QMapTileReply& reply)
+void QGeoMapTileCache::cache(const QGeoMapTileRequest &request, const QGeoMapTileReply& reply)
{
quint64 oldFileSize = 0;
//construct proper file name and subfolder
- QString fileNm = constrFileName(reply.request());
+ QString fileNm = constrFileName(request);
int hashKey = constrHashKey(fileNm);
int level1 = hashKey >> 4;
int level2 = hashKey & 15;
@@ -169,7 +170,7 @@ void QMapTileCache::cache(QMapTileReply& reply)
if (!tile.open(QIODevice::WriteOnly | QIODevice::Truncate))
return;
- tile.write(reply.rawData());
+ tile.write(reply.data());
tile.close();
QFileInfo info(tile);
@@ -180,17 +181,17 @@ void QMapTileCache::cache(QMapTileReply& reply)
cleanup();
}
-void QMapTileCache::setExpireAfter(const quint32 seconds)
+void QGeoMapTileCache::setExpireAfter(const quint32 seconds)
{
expire = seconds;
}
-void QMapTileCache::setExpireAfter(const quint16 days)
+void QGeoMapTileCache::setExpireAfter(const quint16 days)
{
expire = days * SECONDS_PER_DAY;
}
-int QMapTileCache::constrHashKey(const QString& fileName)
+int QGeoMapTileCache::constrHashKey(const QString& fileName)
{
unsigned int hashKey = 0;
@@ -201,7 +202,7 @@ int QMapTileCache::constrHashKey(const QString& fileName)
return hashKey % 256;
}
-QString QMapTileCache::constrFileName(const QMapTileRequest& request)
+QString QGeoMapTileCache::constrFileName(const QGeoMapTileRequest& request)
{
return request.version().id % '_' %
request.scheme().id % '_' %
@@ -212,7 +213,7 @@ QString QMapTileCache::constrFileName(const QMapTileRequest& request)
request.format().id;
}
-void QMapTileCache::cleanup(bool force)
+void QGeoMapTileCache::cleanup(bool force)
{
//Contains all (timestamp, filename) pairs
QMap<QDateTime, QFileInfo> lru;
diff --git a/src/location/qmaptilecache.h b/src/location/qgeomaptilecache.h
index 5f396413f7..c54a8172d7 100644
--- a/src/location/qmaptilecache.h
+++ b/src/location/qgeomaptilecache.h
@@ -46,8 +46,8 @@
#include <QDir>
#include <QDateTime>
-#include "qmaptilereply.h"
-#include "qmaptilerequest.h"
+#include "qgeomaptilereply.h"
+#include "qgeomaptilerequest.h"
QTM_BEGIN_NAMESPACE
@@ -57,18 +57,18 @@ QTM_BEGIN_NAMESPACE
* be constructed in Qt::QDir::home(). When the cache becomes full,
* a LRU strategy is applied to clean up.
*/
-class QMapTileCache
+class QGeoMapTileCache
{
public:
/*!
* Constructor.
*/
- QMapTileCache();
+ QGeoMapTileCache();
/*!
* Constructor.
* @param directory The base directory of the cache.
*/
- QMapTileCache(QDir& directory);
+ QGeoMapTileCache(QDir& directory);
/*!
* Sets the limits of the cache in bytes. When the
@@ -144,16 +144,16 @@ public:
* Checks whether the map tile being requested can be served
* from the cache.
* @param request The request specifying the requested map tile.
- * @return A QMapTileReply containing the request map tile if found,
+ * @return A QGeoMapTileReply containing the request map tile if found,
NULL otherwise.
*/
- QMapTileReply* get(const QMapTileRequest& request);
+ QGeoMapTileReply* get(const QGeoMapTileRequest& request);
/*!
* Inserts the map tile contained in the <i>reply</i>
* into the cache.
* @param reply The reply containing the map tile.
*/
- void cache(QMapTileReply& reply);
+ void cache(const QGeoMapTileRequest &request, const QGeoMapTileReply& reply);
/*!
* @return The current size of the cache.
*/
@@ -186,7 +186,7 @@ private:
* @param request The request containing the map tile.
* @return The file name.
*/
- static QString constrFileName(const QMapTileRequest& request);
+ static QString constrFileName(const QGeoMapTileRequest& request);
private:
QDir cacheDir; //!< The base directory of the cache.
diff --git a/src/location/qgeomaptilereply.cpp b/src/location/qgeomaptilereply.cpp
new file mode 100644
index 0000000000..af3c39e0c4
--- /dev/null
+++ b/src/location/qgeomaptilereply.cpp
@@ -0,0 +1,154 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qgeomaptilereply.h"
+#include "qgeomaptilereply_p.h"
+
+QTM_BEGIN_NAMESPACE
+
+/*!
+ \class QGeoMapTileReply
+ \brief The QGeoMapTileReply class represents the response from a mapping service.
+ \ingroup location
+
+ This class represents the response from a mapping service.
+ It also takes responsibility for any errors that happen while the request is
+ in submitted to and processed by the service.
+*/
+
+/*!
+ \enum ErrorCode
+
+ \value NoError
+ No error has occurred.
+ \value NetworkError
+ A networking error occurred.
+ \value NoContentError
+ The reply contained no content.
+ \value UnknownError
+ An error occurred which does not fit into any of the other categories.
+*/
+
+/*!
+ Constructs a QGeoMapTileReply from a QGeoMapTileRequest \a request, and with parent \a parent.
+*/
+QGeoMapTileReply::QGeoMapTileReply(const QGeoMapTileRequest &request, QObject *parent)
+ : QObject(parent), d_ptr(new QGeoMapTileReplyPrivate())
+{
+ Q_D(QGeoMapTileReply);
+ d->request = request;
+}
+
+/*!
+ Destructor.
+*/
+QGeoMapTileReply::~QGeoMapTileReply()
+{
+ Q_D(QGeoMapTileReply);
+ delete d;
+}
+
+/*!
+ Returns the request which prompted this reply.
+*/
+QGeoMapTileRequest QGeoMapTileReply::request() const
+{
+ Q_D(const QGeoMapTileReply);
+ return d->request;
+}
+
+/*!
+ Returns the requested map data.
+*/
+QByteArray QGeoMapTileReply::data() const
+{
+ Q_D(const QGeoMapTileReply);
+ return d->data;
+}
+
+/*!
+ Sets the requested map data to \a data.
+*/
+void QGeoMapTileReply::setData(const QByteArray &data)
+{
+ Q_D(QGeoMapTileReply);
+ d->data = data;
+}
+
+/*!
+ Causes this QGeoMapTileReply to emit finished() if it has been configured properly
+ or error() if there is a problem with the configuration.
+*/
+void QGeoMapTileReply::done()
+{
+ Q_D(QGeoMapTileReply);
+ if (d->data.size() > 0) {
+ emit finished();
+ } else {
+ emit error(QGeoMapTileReply::NoContentError, "The reply to the routing request was empty.");
+ }
+}
+
+/*!
+ \fn void QGeoMapTileReply::cancel()
+
+ Cancels the receiving of this reply if the reply hasn't been received already.
+*/
+
+/*!
+ \fn void QGeoMapTileReply::finished()
+
+ Indicates that the reply has been received and processed without error, and is ready to be used.
+*/
+/*!
+ \fn void QGeoMapTileReply::error(QGeoMapTileReply::ErrorCode errorCode, const QString &errorString = QString())
+
+ Indicates that an error occurred during the receiving or processing of the reply.
+*/
+
+/*******************************************************************************
+*******************************************************************************/
+
+QGeoMapTileReplyPrivate::QGeoMapTileReplyPrivate() {}
+
+#include "moc_qgeomaptilereply.cpp"
+
+QTM_END_NAMESPACE
diff --git a/src/location/qgeomaptilereply.h b/src/location/qgeomaptilereply.h
new file mode 100644
index 0000000000..13fc8496ba
--- /dev/null
+++ b/src/location/qgeomaptilereply.h
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QMAPTILEREPLY_H
+#define QMAPTILEREPLY_H
+
+#include "qgeomaptilerequest.h"
+
+#include <QByteArray>
+
+QTM_BEGIN_NAMESPACE
+
+class QGeoMapTileReplyPrivate;
+class Q_LOCATION_EXPORT QGeoMapTileReply : public QObject
+{
+ Q_OBJECT
+
+public:
+ // TODO populate this some more...
+ enum ErrorCode {
+ NoError,
+ // flesh out the more common specific network errors
+ NetworkError,
+ NoContentError,
+ UnknownError
+ };
+
+ QGeoMapTileReply(const QGeoMapTileRequest &request, QObject *parent = 0);
+ virtual ~QGeoMapTileReply();
+
+ QGeoMapTileRequest request() const;
+
+ // TODO this should probably become a pixmap if / when we have enough
+ // metadata to convert it
+ QByteArray data() const;
+ void setData(const QByteArray &data);
+
+public slots:
+ void done();
+ virtual void cancel() = 0;
+
+signals:
+ void finished();
+ void error(QGeoMapTileReply::ErrorCode errorCode, const QString &errorString = QString());
+
+ // CHOICE: could lose the setters and make this protected
+private:
+ QGeoMapTileReplyPrivate *d_ptr;
+ Q_DECLARE_PRIVATE(QGeoMapTileReply);
+};
+
+QTM_END_NAMESPACE
+
+#endif
diff --git a/src/location/qgeomaptilereply_nokia.cpp b/src/location/qgeomaptilereply_nokia.cpp
new file mode 100644
index 0000000000..d62860b618
--- /dev/null
+++ b/src/location/qgeomaptilereply_nokia.cpp
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qgeomaptilereply_nokia_p.h"
+
+QTM_BEGIN_NAMESPACE
+
+QGeoMapTileReplyNokia::QGeoMapTileReplyNokia(const QGeoMapTileRequest &request, QNetworkReply *reply)
+ : QGeoMapTileReply(request),
+ m_reply(reply)
+{
+ if (reply) {
+ connect(m_reply,
+ SIGNAL(finished()),
+ this,
+ SLOT(parse()));
+ connect(m_reply,
+ SIGNAL(error(QNetworkReply::NetworkError)),
+ this,
+ SLOT(translateError(QNetworkReply::NetworkError)));
+ }
+ /*
+ // not sure if we want this or not
+ // it will free some memory once the parse has gone through
+ // probably want to do it indirectly and set a flag so that we don't
+ // double delete in the constructor
+ connect(this,
+ SIGNAL(finished()),
+ m_reply,
+ SLOT(deleteLater()));
+ connect(this,
+ SIGNAL(error(QDLGeoReply::ErrorCode,QString)),
+ m_reply,
+ SLOT(deleteLater()));
+ */
+}
+
+QGeoMapTileReplyNokia::~QGeoMapTileReplyNokia()
+{
+ if (m_reply)
+ m_reply->abort();
+ delete m_reply;
+}
+
+/*!
+ emits finished if all went well
+ otherwise emits error
+*/
+void QGeoMapTileReplyNokia::parse()
+{
+ setData(m_reply->readAll());
+ done();
+}
+
+void QGeoMapTileReplyNokia::translateError(QNetworkReply::NetworkError errorCode)
+{
+ // TODO map errors across from errorCode
+ emit error(QGeoMapTileReply::NetworkError, QString("Network error: %1").arg(m_reply->errorString()));
+}
+
+void QGeoMapTileReplyNokia::cancel()
+{
+ if (m_reply)
+ m_reply->abort();
+}
+
+#include "moc_qgeomaptilereply_nokia_p.cpp"
+
+QTM_END_NAMESPACE
diff --git a/src/location/qgeoreply.h b/src/location/qgeomaptilereply_nokia_p.h
index 3b6a035283..cde219f431 100644
--- a/src/location/qgeoreply.h
+++ b/src/location/qgeomaptilereply_nokia_p.h
@@ -39,38 +39,30 @@
**
****************************************************************************/
-#ifndef QLOCATION_LOCATIONREPLY_H
-#define QLOCATION_LOCATIONREPLY_H
+#ifndef QMAPTILEREPLY_NOKIA_P_H
+#define QMAPTILEREPLY_NOKIA_P_H
-#include "qmobilityglobal.h"
+#include "qgeomaptilereply.h"
#include <QNetworkReply>
-#include <QObject>
QTM_BEGIN_NAMESPACE
-class QGeoReply : public QObject
+class QGeoMapTileReplyNokia : public QGeoMapTileReply
{
Q_OBJECT
public:
- typedef quint32 ErrorCode;
+ QGeoMapTileReplyNokia(const QGeoMapTileRequest &request, QNetworkReply *reply);
+ ~QGeoMapTileReplyNokia();
-public:
- QGeoReply();
-
- virtual bool isFinished() const;
-
-signals:
- void finished();
- void error(ErrorCode code);
+public slots:
+ virtual void parse();
+ virtual void translateError(QNetworkReply::NetworkError errorCode);
+ virtual void cancel();
private:
- Q_DISABLE_COPY(QGeoReply)
-
-protected:
- bool fin;
-
+ QNetworkReply *m_reply;
};
QTM_END_NAMESPACE
diff --git a/src/location/qmaptilereply.cpp b/src/location/qgeomaptilereply_p.h
index 7ed5d3d4e4..ef2af5d20e 100644
--- a/src/location/qmaptilereply.cpp
+++ b/src/location/qgeomaptilereply_p.h
@@ -39,10 +39,23 @@
**
****************************************************************************/
-#include "qmaptilereply.h"
+#ifndef QMAPTILEREPLY_P_H
+#define QMAPTILEREPLY_P_H
+
+#include "qgeomaptilerequest.h"
+#include <QByteArray>
QTM_BEGIN_NAMESPACE
-#include "moc_qmaptilereply.cpp"
+class QGeoMapTileReplyPrivate
+{
+public:
+ QGeoMapTileReplyPrivate();
+
+ QGeoMapTileRequest request;
+ QByteArray data;
+};
QTM_END_NAMESPACE
+
+#endif // QMAPTILEREPLY_P_H
diff --git a/src/location/qgeomaptilerequest.cpp b/src/location/qgeomaptilerequest.cpp
new file mode 100644
index 0000000000..69b8d8f95a
--- /dev/null
+++ b/src/location/qgeomaptilerequest.cpp
@@ -0,0 +1,301 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qgeomaptilerequest.h"
+#include "qgeomaptilerequest_p.h"
+
+QTM_BEGIN_NAMESPACE
+
+/*!
+ \class QGeoMapTileRequeset
+ \brief The QGeoMapTileRequest class represents a request for a specific map tile.
+ \ingroup location
+
+ The maps that this class deals with are divided into 2^zoomLevel() columns
+ and 2^zoomLevel() rows of tiles.
+*/
+
+/*!
+ Constructor which sets some of the map data.
+*/
+QGeoMapTileRequest::QGeoMapTileRequest(const MapVersion& mapVersion,
+ const MapScheme& mapScheme,
+ const MapResolution& mapResolution,
+ const MapFormat& mapFormat)
+ : d_ptr(new QGeoMapTileRequestPrivate())
+{
+ setVersion(mapVersion);
+ setScheme(mapScheme);
+ setResolution(mapResolution);
+ setFormat(mapFormat);
+}
+
+/*!
+ Default constructor
+*/
+QGeoMapTileRequest::QGeoMapTileRequest()
+ : d_ptr(new QGeoMapTileRequestPrivate())
+{
+}
+
+QGeoMapTileRequest::QGeoMapTileRequest(const QGeoMapTileRequest &mtr)
+ : d_ptr(new QGeoMapTileRequestPrivate(*(mtr.d_ptr)))
+{
+}
+
+QGeoMapTileRequest& QGeoMapTileRequest::operator= (const QGeoMapTileRequest & mtr)
+{
+ *d_ptr = *(mtr.d_ptr);
+ return *this;
+}
+
+/*!
+ Destructor
+*/
+QGeoMapTileRequest::~QGeoMapTileRequest()
+{
+ Q_D(QGeoMapTileRequest);
+ delete d;
+}
+
+/*!
+ Returns the col index of the requested map tile.
+*/
+quint32 QGeoMapTileRequest::col() const
+{
+ Q_D(const QGeoMapTileRequest);
+ return d->cl;
+}
+
+/*!
+ Sets the col index of the requested map tile to \a c.
+
+ Valid values are 0 ... 2^zoomLevel() - 1.
+*/
+void QGeoMapTileRequest::setCol(quint32 c)
+{
+ Q_D(QGeoMapTileRequest);
+ d->cl = c;
+}
+
+/*!
+ Returns the row index of the requested map tile.
+*/
+quint32 QGeoMapTileRequest::row() const
+{
+ Q_D(const QGeoMapTileRequest);
+ return d->rw;
+}
+/*!
+Sets the row index of the requested map tile to \a r.
+
+Valid values are 0 ... 2^zoomLevel() - 1.
+*/
+void QGeoMapTileRequest::setRow(quint32 r)
+{
+ Q_D(QGeoMapTileRequest);
+ d->rw = r;
+}
+
+/*!
+ Returns the version of the requested map tile.
+*/
+MapVersion QGeoMapTileRequest::version() const
+{
+ Q_D(const QGeoMapTileRequest);
+ return d->ver;
+}
+
+/*!
+ Sets the version of the requested map tile to \a version.
+*/
+void QGeoMapTileRequest::setVersion(const MapVersion& version)
+{
+ Q_D(QGeoMapTileRequest);
+ d->ver = version;
+}
+
+/*!
+ Returns the resolution of the requested map tile.
+*/
+MapResolution QGeoMapTileRequest::resolution() const
+{
+ Q_D(const QGeoMapTileRequest);
+ return d->res;
+}
+
+/*!
+ Sets the resolution of the requested map tile to \a resolution.
+*/
+void QGeoMapTileRequest::setResolution(const MapResolution& resolution)
+{
+ Q_D(QGeoMapTileRequest);
+ d->res = resolution;
+}
+
+/*!
+ Returns the format of the requested map tile.
+*/
+MapFormat QGeoMapTileRequest::format() const
+{
+ Q_D(const QGeoMapTileRequest);
+ return d->frmt;
+}
+
+/*!
+ Sets the format of the requested map tile to \a format.
+*/
+void QGeoMapTileRequest::setFormat(const MapFormat& format)
+{
+ Q_D(QGeoMapTileRequest);
+ d->frmt = format;
+}
+
+/*!
+ Returns the scheme of the requested map tile.
+*/
+MapScheme QGeoMapTileRequest::scheme() const
+{
+ Q_D(const QGeoMapTileRequest);
+ return d->schm;
+}
+
+/*!
+ Sets the scheme of the requested map tile to \a scheme.
+*/
+void QGeoMapTileRequest::setScheme(const MapScheme& scheme)
+{
+ Q_D(QGeoMapTileRequest);
+ d->schm = scheme;
+}
+
+/*!
+ Returns the zoom level of the requested map tile.
+*/
+quint16 QGeoMapTileRequest::zoomLevel() const
+{
+ Q_D(const QGeoMapTileRequest);
+ return d->zoom;
+}
+
+/*!
+ Sets the zoom level of the requested map tile to \a level.
+*/
+void QGeoMapTileRequest::setZoomLevel(quint16 level)
+{
+ Q_D(QGeoMapTileRequest);
+ d->zoom = level;
+}
+
+/*!
+ Returns the request string for this request and the given \a host, \a token and \a referrer.
+*/
+QString QGeoMapTileRequest::requestString(const QString &host, const QString &token, const QString &referrer) const
+{
+ Q_D(const QGeoMapTileRequest);
+ return d->requestString(host, token, referrer);
+}
+
+/******************************************************************************
+ ****************************************************************************/
+
+QGeoMapTileRequestPrivate::QGeoMapTileRequestPrivate()
+ : cl(0), rw(0), zoom(0)
+{}
+
+QGeoMapTileRequestPrivate::QGeoMapTileRequestPrivate(const QGeoMapTileRequestPrivate &mtrp)
+ : cl(mtrp.cl),
+ rw(mtrp.rw),
+ ver(mtrp.ver),
+ zoom(mtrp.zoom),
+ schm(mtrp.schm),
+ res(mtrp.res),
+ frmt(mtrp.frmt)
+{}
+
+QGeoMapTileRequestPrivate& QGeoMapTileRequestPrivate::operator= (const QGeoMapTileRequestPrivate & mtrp)
+{
+ cl = mtrp.cl;
+ rw = mtrp.rw;
+ ver = mtrp.ver;
+ zoom = mtrp.zoom;
+ schm = mtrp.schm;
+ res = mtrp.res;
+ frmt = mtrp.frmt;
+ return *this;
+}
+
+QString QGeoMapTileRequestPrivate::requestString(const QString &host, const QString &token, const QString &referrer) const
+{
+ QString request = "http://";
+ request += host;
+ request += "/maptiler/maptile/";
+ request += ver.id;
+ request += '/';
+ request += schm.id;
+ request += '/';
+ request += QString::number(zoom);
+ request += '/';
+ request += QString::number(cl);
+ request += '/';
+ request += QString::number(rw);
+ request += '/';
+ request += res.id;
+ request += '/';
+ request += frmt.id;
+
+ if (!token.isEmpty()) {
+ request += "?token=";
+ request += token;
+
+ if (!referrer.isEmpty()) {
+ request += "&referrer=";
+ request += referrer;
+ }
+ } else if (!referrer.isEmpty()) {
+ request += "?referrer=";
+ request += referrer;
+ }
+
+ return request;
+}
+
+QTM_END_NAMESPACE
diff --git a/src/location/qgeonetworkmanager_p.h b/src/location/qgeomaptilerequest.h
index b1feecfd42..693005e4cc 100644
--- a/src/location/qgeonetworkmanager_p.h
+++ b/src/location/qgeomaptilerequest.h
@@ -39,50 +39,58 @@
**
****************************************************************************/
-#ifndef QLOCATION_GEONETWORKMANAGERPRIVATE_P_H
-#define QLOCATION_GEONETWORKMANAGERPRIVATE_P_H
+#ifndef QLOCATION_MAPTILEREQUEST_H
+#define QLOCATION_MAPTILEREQUEST_H
#include <QString>
-#include <QHash>
-#include <QNetworkProxy>
-#include <QNetworkAccessManager>
-#include "qmaptilecache.h"
+#include "qgeomaptile.h"
QTM_BEGIN_NAMESPACE
-class QGeoNetworkManagerPrivate
+class QGeoMapTileRequestPrivate;
+class Q_LOCATION_EXPORT QGeoMapTileRequest
{
public:
- QGeoNetworkManagerPrivate();
- ~QGeoNetworkManagerPrivate();
-
- bool parseRouteReply(QNetworkReply* netReply, QRouteReply* routeReply);
- bool parseCodingReply(QNetworkReply* netReply, QGeocodingReply* codingReply);
-
- static QString trimGeoCoordinate(qreal degree);
-
- QNetworkAccessManager netManager; //!< The internal network manager
- QString geocdSrv;
- QString rtSrv;
- QString mapSrv;
- QNetworkProxy geocdProx;
- QNetworkProxy rtProx;
- QNetworkProxy mapProx;
- QString token;
- QString referrer;
- QMapTileCache cache; //!< The map tile cache
-
- //! maps QNetworkReplies to their corresponding QGeoReplies
- QHash<QNetworkReply*, QGeoReply*> replyMap;
- //! maps a QGeoReply to its corresponding QNetworkReply
- QHash<QGeoReply*, QNetworkReply*> revReplyMap;
-
- QHash<QString, MapVersion> mapVersions;
- QHash<QString, MapResolution> mapResolutions;
- QHash<QString, MapFormat> mapFormats;
- QHash<QString, MapScheme> mapSchemes;
+ QGeoMapTileRequest(const MapVersion& mapVersion,
+ const MapScheme& mapScheme,
+ const MapResolution& mapResolution,
+ const MapFormat& mapFormat);
+ QGeoMapTileRequest();
+ QGeoMapTileRequest(const QGeoMapTileRequest &mtr);
+ QGeoMapTileRequest& operator= (const QGeoMapTileRequest &mtr);
+
+ ~QGeoMapTileRequest();
+
+ quint32 col() const;
+ void setCol(quint32 c);
+
+ quint32 row() const;
+ void setRow(quint32 r);
+
+ MapVersion version() const;
+ void setVersion(const MapVersion& version);
+
+ MapResolution resolution() const;
+ void setResolution(const MapResolution& resolution);
+
+ MapFormat format() const;
+ void setFormat(const MapFormat& format);
+
+ MapScheme scheme() const;
+ void setScheme(const MapScheme& scheme);
+
+ quint16 zoomLevel() const;
+ void setZoomLevel(quint16 level);
+
+ QString requestString(const QString &host, const QString &token, const QString &referrer) const;
+
+private:
+ //Q_DISABLE_COPY(QGeoMapTileRequest);
+
+ QGeoMapTileRequestPrivate *d_ptr;
+ Q_DECLARE_PRIVATE(QGeoMapTileRequest);
};
QTM_END_NAMESPACE
diff --git a/src/location/qgeomaptilerequest_p.h b/src/location/qgeomaptilerequest_p.h
new file mode 100644
index 0000000000..b19e652b8f
--- /dev/null
+++ b/src/location/qgeomaptilerequest_p.h
@@ -0,0 +1,29 @@
+#ifndef QMAPTILEREQUEST_P_H
+#define QMAPTILEREQUEST_P_H
+
+#include "qmobilityglobal.h"
+#include "qgeomaptile.h"
+
+QTM_BEGIN_NAMESPACE
+
+class QGeoMapTileRequestPrivate
+{
+public:
+ QGeoMapTileRequestPrivate();
+ QGeoMapTileRequestPrivate(const QGeoMapTileRequestPrivate &mtrp);
+ QGeoMapTileRequestPrivate& operator= (const QGeoMapTileRequestPrivate &mtrp);
+
+ QString requestString(const QString &host, const QString &token, const QString &referrer) const;
+
+ quint32 cl;
+ quint32 rw;
+ MapVersion ver;
+ quint16 zoom;
+ MapScheme schm;
+ MapResolution res;
+ MapFormat frmt;
+};
+
+QTM_END_NAMESPACE
+
+#endif // QMAPTILEREQUEST_P_H
diff --git a/src/location/qgeonetworkmanager.cpp b/src/location/qgeonetworkmanager.cpp
deleted file mode 100755
index 91cb5e7719..0000000000
--- a/src/location/qgeonetworkmanager.cpp
+++ /dev/null
@@ -1,603 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include <math.h>
-
-#include <QStringBuilder>
-#include <QNetworkReply>
-#include <QNetworkRequest>
-#include <QUrl>
-
-#include "qgeonetworkmanager.h"
-#include "qgeonetworkmanager_p.h"
-#include "qrouterequest.h"
-#include "qrouterequest_p.h"
-#include "qroutereply.h"
-#include "qroutexmlparser.h"
-#include "qgeocodingreply.h"
-#include "qgeocodingxmlparser.h"
-
-QTM_BEGIN_NAMESPACE
-
-/*!
- \class QGeoNetworkManager
- \brief The class QGeoNetworkManager is a subclass of QGeoEngine for use with Nokia maps.
- \ingroup location
-
- This class extends QGeoEngine.
- It handles all communication with the REST servers.
- Internally it uses QNetworkAccessManager for network
- communication, and it handles all mapping between
- raw network requests/replies and geo requests/replies.
-*/
-
-static const int DEGREE_DECIMALS = 10;
-
-/*!
- Constructs a QGeoNetworkManager given an authentification \a token used for server communication
- and a \a referrer (usually a URL) for the token.
-*/
-QGeoNetworkManager::QGeoNetworkManager(QString token, QString referrer)
- : d_ptr(new QGeoNetworkManagerPrivate())
-{
- Q_D(QGeoNetworkManager);
- d->token = token;
- d->referrer = referrer;
- connect(&d->netManager, SIGNAL(finished(QNetworkReply*)),
- this, SLOT(netReplyFinished(QNetworkReply*)));
-}
-
-/*!
- Destructor.
-*/
-QGeoNetworkManager::~QGeoNetworkManager()
-{
- Q_D(QGeoNetworkManager);
- delete d;
-}
-
-/*!
- Sets the server to be used for (reverse) geocoding requests \a server.
-*/
-void QGeoNetworkManager::setGeocodingServer(const QString& server)
-{
- Q_D(QGeoNetworkManager);
- d->geocdSrv = server;
-}
-/*!
- Return the server to be used for (reverse) geocoding requests.
-*/
-QString QGeoNetworkManager::geocodingServer() const
-{
- Q_D(const QGeoNetworkManager);
- return d->geocdSrv;
-}
-/*!
- Returns the proxy to be used for (reverse) geocoding requests.
-*/
-QNetworkProxy QGeoNetworkManager::geocodingProxy() const
-{
- Q_D(const QGeoNetworkManager);
- return d->geocdProx;
-}
-/*!
- Sets the proxy to be used for (reverse) geocoding requests to \a proxy.
-*/
-void QGeoNetworkManager::setGeocodingProxy(const QNetworkProxy& proxy)
-{
- Q_D(QGeoNetworkManager);
- d->geocdProx = proxy;
-}
-
-/*!
- Sets the server to be used for route requests to \a server.
-*/
-void QGeoNetworkManager::setRouteServer(const QString& server)
-{
- Q_D(QGeoNetworkManager);
- d->rtSrv = server;
-}
-/*!
- Returns the server to be used for route requests.
-*/
-QString QGeoNetworkManager::routeServer() const
-{
- Q_D(const QGeoNetworkManager);
- return d->rtSrv;
-}
-/*!
- Returns the proxy to be used for route requests.
-*/
-QNetworkProxy QGeoNetworkManager::routeProxy() const
-{
- Q_D(const QGeoNetworkManager);
- return d->rtProx;
-}
-/*!
- Sets the proxy to be used for route requests to \a proxy.
-*/
-void QGeoNetworkManager::setRouteProxy(const QNetworkProxy& proxy)
-{
- Q_D(QGeoNetworkManager);
- d->rtProx = proxy;
-}
-
-/*!
- Sets the server to be used for map tile requests to \a server.
-*/
-void QGeoNetworkManager::setMapServer(const QString& server)
-{
- Q_D(QGeoNetworkManager);
- d->mapSrv = server;
-}
-/*!
- Returns the server to be used for map tile requests.
-*/
-QString QGeoNetworkManager::mapServer() const
-{
- Q_D(const QGeoNetworkManager);
- return d->mapSrv;
-}
-/*!
- Returns the proxy to be used for map tile requests.
-*/
-QNetworkProxy QGeoNetworkManager::mapProxy() const
-{
- Q_D(const QGeoNetworkManager);
- return d->mapProx;
-}
-/*!
- Sets the proxy to be used for map tile requests to \a proxy.
-*/
-void QGeoNetworkManager::setMapProxy(const QNetworkProxy& proxy)
-{
- Q_D(QGeoNetworkManager);
- d->mapProx = proxy;
-}
-
-/*!
- Submits a route request \a request and returns the corresponding QRouteReply.
- \note Due to the asynchronous nature of requests,
- you should never directly start working with the returned
- reply, but instead wait for the finished(QRouteReply*) signal.
-*/
-QRouteReply* QGeoNetworkManager::get(const QRouteRequest& request)
-{
- Q_D(QGeoNetworkManager);
- QString rawRequest = "http://" % d->rtSrv % "/routing/rt/" % request.version() %
- "?referer=localhost" %
- "&slong=" % d->trimGeoCoordinate(request.source().longitude()) %
- "&slat=" % d->trimGeoCoordinate(request.source().latitude()) %
- "&dlong=" % d->trimGeoCoordinate(request.destination().longitude()) %
- "&dlat=" % d->trimGeoCoordinate(request.destination().latitude());
-
- if (request.totalResults() > 0)
- rawRequest += "&total=" % QString::number(request.totalResults());
- if (request.alternatives() > 0)
- rawRequest += "&alternatives=" % QString::number(request.alternatives());
- if (request.language() != "")
- rawRequest += "&lg=" % request.language();
- if (request.departureTime().isValid())
- rawRequest += "&tod=" % request.departureTime().toUTC().toString();
- if (request.arrivalTime().isValid())
- rawRequest += "&toa=" % request.arrivalTime().toUTC().toString();
-
- rawRequest += "&type=" % request.d_ptr->typeToString() %
- "&mode=" % request.d_ptr->modeToString();
-
- if (request.d_ptr->avoid.count() > 0)
- rawRequest += "&avoid=" % request.d_ptr->avoidToString();
-
- const QList<QGeoCoordinate>& stopOvers = request.stopOvers();
-
- for (int i = 0; i < stopOvers.length(); i++) {
- rawRequest += QString::number(stopOvers[i].latitude(), 'f') % "," %
- QString::number(stopOvers[i].longitude(), 'f') % " ";
- }
-
- d->netManager.setProxy(d->rtProx);
- QNetworkRequest* netRequest = new QNetworkRequest(QUrl(rawRequest));
- QNetworkReply* netReply = d->netManager.get(*netRequest);
- QRouteReply* routeReply = new QRouteReply();
- d->replyMap.insert(netReply, routeReply);
- d->revReplyMap.insert(routeReply, netReply);
-
- return routeReply;
-}
-
-/*!
- Submits a geocoding request \a request and returns the corresponding QGeocodingReply.
- \note Due to the asynchronous nature of requests,
- you should never directly start working with the returned
- reply, but instead wait for the finished(QGeocodingReply*) signal.
-*/
-QGeocodingReply* QGeoNetworkManager::get(const QGeocodingRequest& request)
-{
- Q_D(QGeoNetworkManager);
- QString rawRequest = "http://" % d->geocdSrv % "/geocoder/gc/" % request.version() %
- "?referer=localhost";
-
- if (request.language() != "")
- rawRequest += "&lg=" % request.language();
-
- if (request.oneBoxLocation().isEmpty()) {
- rawRequest += "&country=" % request.country();
-
- if (!request.state().isEmpty())
- rawRequest += "&state=" % request.state();
- if (!request.city().isEmpty())
- rawRequest += "&city=" % request.city();
- if (!request.postCode().isEmpty())
- rawRequest += "&zip=" % request.postCode();
- if (!request.street().isEmpty())
- rawRequest += "&street=" % request.street();
- if (!request.number().isEmpty())
- rawRequest += "&number=" % request.number();
- } else {
- rawRequest += "&obloc=" % request.oneBoxLocation();
- }
-
- d->netManager.setProxy(d->geocdProx);
- QNetworkRequest* netRequest = new QNetworkRequest(QUrl(rawRequest));
- QNetworkReply* reply = d->netManager.get(*netRequest);
- QGeocodingReply* codingReply = new QGeocodingReply();
- d->replyMap.insert(reply, codingReply);
- d->revReplyMap.insert(codingReply, reply);
- return codingReply;
-}
-
-/*!
- Submits a reverse geocoding request \a request and return the corresponding QGeocodingReply.
- \note Due to the asynchronous nature of requests,
- you should never directly start working with the returned
- reply, but instead wait for the finished(QGeocodingReply*) signal.
-*/
-QGeocodingReply* QGeoNetworkManager::get(const QReverseGeocodingRequest& request)
-{
- Q_D(QGeoNetworkManager);
- QString rawRequest = "http://" % d->geocdSrv % "/geocoder/rgc/" % request.version() %
- "?referer=localhost" %
- "&long=" % d->trimGeoCoordinate(request.coordinate().longitude()) %
- "&lat=" % d->trimGeoCoordinate(request.coordinate().latitude());
-
- if (request.language() != "")
- rawRequest += "&lg=" % request.language();
-
- d->netManager.setProxy(d->geocdProx);
- QNetworkRequest* netRequest = new QNetworkRequest(QUrl(rawRequest));
- QNetworkReply* reply = d->netManager.get(*netRequest);
- QGeocodingReply* codingReply = new QGeocodingReply();
- d->replyMap.insert(reply, codingReply);
- d->revReplyMap.insert(codingReply, reply);
- return codingReply;
-}
-
-/*!
- Submits a map tile request \a request and returns the corresponding QMapTileReply.
-
- \note Due to the potentially asynchronous nature of requests,
- you should never directly start working with the returned
- reply, but instead wait for the finished(QMapTileReply*) signal.
- \note If the request can be served from the tile cache,
- this method will directly emit finished(QRouteReply*).
- If you need the returned QMapTileReply object first,
- you should connect to finished(QRouteReply*) with Qt::QueuedConnection.
-*/
-QMapTileReply* QGeoNetworkManager::get(const QMapTileRequest& request)
-{
- Q_D(QGeoNetworkManager);
- //check cache first
- QMapTileReply* tileReply = NULL;
-
- if ((tileReply = d->cache.get(request))) {
- tileReply->fin = true;
- emit finished(tileReply);
- emit tileReply->finished();
- } else {
- QString rawRequest = "http://" % d->mapSrv % "/maptiler/maptile/" %
- request.version().id % '/' %
- request.scheme().id % '/' %
- QString::number(request.zoomLevel()) % '/' %
- QString::number(request.col()) % '/' %
- QString::number(request.row()) % '/' %
- request.resolution().id % '/' %
- request.format().id;
-
- if (!d->token.isEmpty()) {
- rawRequest = rawRequest % "?token=" % d->token;
-
- if (!d->referrer.isEmpty())
- rawRequest = rawRequest % "&referrer=" % d->referrer;
- } else if (!d->referrer.isEmpty())
- rawRequest = rawRequest % "?referrer=" % d->referrer;
-
- d->netManager.setProxy(d->mapProx);
- QNetworkRequest* netRequest = new QNetworkRequest(QUrl(rawRequest));
- QNetworkReply* reply = d->netManager.get(*netRequest);
- QObject::connect(reply, SIGNAL(error(QNetworkReply::NetworkError)),
- this, SLOT(netReplyError(QNetworkReply::NetworkError)));
- tileReply = new QMapTileReply(request);
- d->replyMap.insert(reply, tileReply);
- d->revReplyMap.insert(tileReply, reply);
- }
-
- return tileReply;
-}
-
-/*!
- This slot is invoked when a network reply \a reply has finished.
-*/
-void QGeoNetworkManager::netReplyFinished(QNetworkReply* reply)
-{
- Q_D(QGeoNetworkManager);
-
- //get associated geo reply
- if (!d->replyMap.contains(reply)) {
- //no associated geo reply found, bail out
- reply->deleteLater();
- return;
- }
-
- QGeoReply* rawReply = d->replyMap[reply];
- QString className = rawReply->metaObject()->className();
-
- if (className == "QRouteReply") {
- QRouteReply* routeReply = static_cast<QRouteReply*>(rawReply);
- routeReply->fin = true;
-
- if (d->parseRouteReply(reply, routeReply)) {
- if (routeReply->resultCode() == QRouteReply::Failed) {
- emit error(routeReply, (QGeoReply::ErrorCode) QNetworkReply::ContentNotFoundError);
- emit routeReply->error((QGeoReply::ErrorCode) QNetworkReply::ContentNotFoundError);
- } else {
- emit finished(routeReply);
- emit routeReply->finished();
- }
- } else {
- routeReply->setResultCode(QRouteReply::Failed);
- emit error(routeReply, (QGeoReply::ErrorCode) QNetworkReply::UnknownContentError);
- emit routeReply->error((QGeoReply::ErrorCode) QNetworkReply::UnknownContentError);
- }
-
- } else if (className == "QGeocodingReply") {
- QGeocodingReply* geoReply = static_cast<QGeocodingReply*>(rawReply);
- geoReply->fin = true;
-
- if (d->parseCodingReply(reply, geoReply)) {
- if (geoReply->resultCode() == QGeocodingReply::Failed) {
- emit error(geoReply, (QGeoReply::ErrorCode) QNetworkReply::ContentNotFoundError);
- emit geoReply->error((QGeoReply::ErrorCode) QNetworkReply::ContentNotFoundError);
- } else {
- emit finished(geoReply);
- emit geoReply->finished();
- }
- } else {
- geoReply->setResultCode(QGeocodingReply::Failed);
- emit error(geoReply, (QGeoReply::ErrorCode) QNetworkReply::UnknownContentError);
- emit geoReply->error((QGeoReply::ErrorCode) QNetworkReply::UnknownContentError);
- }
- } else if (className == "QMapTileReply") {
- QMapTileReply* tileReply = static_cast<QMapTileReply*>(rawReply);
- tileReply->fin = true;
- tileReply->rawData() = reply->readAll();
-
- if (tileReply->data.length() > 0)
- d->cache.cache(*tileReply);
-
- emit finished(tileReply);
- emit tileReply->finished();
- }
-}
-
-/*!
- This slot is invoked when a network reply has detected an error with error code \a code.
-*/
-void QGeoNetworkManager::netReplyError(QNetworkReply::NetworkError code)
-{
- QObject* sgnSender = sender();
- QString senderType = sgnSender->metaObject()->className();
-
- if (senderType == "QtMobility::QMapTileReply") {
- QMapTileReply* tileReply = static_cast<QMapTileReply*>(sgnSender);
- tileReply->fin = true;
-
- emit error(tileReply, (QGeoReply::ErrorCode) code);
- emit tileReply->error((QGeoReply::ErrorCode) code);
- } else if (senderType == "QtMobility::QRouteReply") {
- QRouteReply* routeReply = static_cast<QRouteReply*>(sgnSender);
- routeReply->fin = true;
- routeReply->setResultCode(QRouteReply::Failed);
-
- emit error(routeReply, (QGeoReply::ErrorCode) code);
- emit routeReply->error((QGeoReply::ErrorCode) code);
- } else if (senderType == "QtMobility::QGeocodingReply") {
- QGeocodingReply* geoReply = static_cast<QGeocodingReply*>(sgnSender);
- geoReply->fin = true;
- geoReply->setResultCode(QGeocodingReply::Failed);
-
- emit error(geoReply, (QGeoReply::ErrorCode) code);
- emit geoReply->error((QGeoReply::ErrorCode) code);
- }
-
-}
-
-/*!
- When a \a reply is no longer needed, it should never be manually
- deleted. Instead this method should be used to properly remove the reply
- from corresponding internal maps.
-*/
-void QGeoNetworkManager::release(QGeoReply* reply)
-{
- Q_D(QGeoNetworkManager);
-
- if (d->revReplyMap.contains(reply)) {
- QNetworkReply* netReply = d->revReplyMap[reply];
- d->revReplyMap.remove(reply);
- d->replyMap.remove(netReply);
- netReply->deleteLater();
- }
-
- reply->deleteLater();
-}
-
-/*!
- This methods aborts the (pending) reply \a reply.
-
- It essentially calls abort() on the
- * associated QNetworkReply object.
-*/
-void QGeoNetworkManager::cancel(QGeoReply* reply)
-{
- Q_D(QGeoNetworkManager);
- if (d->revReplyMap.contains(reply))
- d->revReplyMap[reply]->abort();
-}
-
-/*!
- Returns the maximum zoom level supported.
-*/
-quint16 QGeoNetworkManager::maxZoomLevel() const {
- return MAPTILE_MAX_ZOOMLEVEL;
-}
-/*!
- Returns a list of all available \l {MapVersion}{MapVersions}.
-*/
-QList<MapVersion> QGeoNetworkManager::versions() const {
- Q_D(const QGeoNetworkManager);
- return d->mapVersions.values();
-}
-/*!
- Returns a list of all available \l {MapResolution}{MapResolutions}.
-*/
-QList<MapResolution> QGeoNetworkManager::resolutions() const {
- Q_D(const QGeoNetworkManager);
- return d->mapResolutions.values();
-}
-/*!
- Returns a list of all available \l {MapFormat}{MapFormats}.
-*/
-QList<MapFormat> QGeoNetworkManager::formats() const {
- Q_D(const QGeoNetworkManager);
- return d->mapFormats.values();
-}
-/*!
- Returns a list of all available \l {MapScheme}{MapSchemes}.
-*/
-QList<MapScheme> QGeoNetworkManager::schemes() const {
- Q_D(const QGeoNetworkManager);
- return d->mapSchemes.values();
-}
-
-/*****************************************************************************
- *****************************************************************************/
-
-QGeoNetworkManagerPrivate::QGeoNetworkManagerPrivate() :
- netManager(),
- geocdProx(QNetworkProxy::NoProxy),
- rtProx(QNetworkProxy::NoProxy),
- mapProx(QNetworkProxy::NoProxy)
-{
- geocdSrv = "dev-a7.bln.gate5.de";
- mapSrv = "dev-a7.bln.gate5.de";
- //mapSrv = "maptile.mapplayer.maps.svc.ovi.com";
- rtSrv = "172.24.32.155";
-}
-
-QGeoNetworkManagerPrivate::~QGeoNetworkManagerPrivate()
-{
- QList<QNetworkReply*> keys = replyMap.keys();
-
- while (keys.length() > 0) {
- QNetworkReply* key = keys[0];
- QGeoReply* locReply = replyMap[key];
- replyMap.remove(key);
- delete locReply;
- keys.pop_front();
- delete key;
- }
-}
-
-/*!
- Parses \a netReply to populates \a routeReply.
-*/
-bool QGeoNetworkManagerPrivate::parseRouteReply(QNetworkReply* netReply, QRouteReply* routeReply)
-{
- QRouteXmlParser parser;
- return parser.parse(netReply, routeReply);
-}
-
-/*!
- * Parses \a netReply to populate \a codingReply.
-*/
-bool QGeoNetworkManagerPrivate::parseCodingReply(QNetworkReply* netReply, QGeocodingReply* codingReply)
-{
- QGeocodingXmlParser parser;
- return parser.parse(netReply, codingReply);
-}
-
-/*!
- Returns a string representation of degree value with at most DEGREE_DECIMALS decimals.
-*/
-QString QGeoNetworkManagerPrivate::trimGeoCoordinate(qreal degree)
-{
- QString sDegree = QString::number(degree, 'f', DEGREE_DECIMALS);
- int index;
- int decSepIndex = sDegree.indexOf('.');
-
- if (decSepIndex < 0)
- return sDegree;
-
- for (index = sDegree.length() - 1; index >= decSepIndex; index--) {
- if (sDegree[index] != '0')
- break;
- }
-
- if (sDegree[index] == '.')
- index--;
-
- return sDegree.left(index + 1);
-}
-
-#include "moc_qgeonetworkmanager.cpp"
-
-QTM_END_NAMESPACE
-
diff --git a/src/location/qgeonetworkmanager.h b/src/location/qgeonetworkmanager.h
deleted file mode 100644
index 4702eb8574..0000000000
--- a/src/location/qgeonetworkmanager.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QLOCATION_GEONETWORKMANAGER_H
-#define QLOCATION_GEONETWORKMANAGER_H
-
-#include <QNetworkReply>
-#include <QString>
-
-#include "qgeoengine.h"
-
-#define MAPTILE_MAX_ZOOMLEVEL 18
-
-QTM_BEGIN_NAMESPACE
-
-class QGeoNetworkManagerPrivate;
-class Q_LOCATION_EXPORT QGeoNetworkManager : public QGeoEngine
-{
- Q_OBJECT
-
-public:
- QGeoNetworkManager(QString token, QString referrer);
- virtual ~QGeoNetworkManager();
-
- void setGeocodingServer(const QString& server);
- QString geocodingServer() const;
- QNetworkProxy geocodingProxy() const;
- void setGeocodingProxy(const QNetworkProxy& proxy);
-
- void setRouteServer(const QString& server);
- QString routeServer() const;
- QNetworkProxy routeProxy() const;
- void setRouteProxy(const QNetworkProxy& proxy);
-
- void setMapServer(const QString& server);
- QString mapServer() const;
- QNetworkProxy mapProxy() const;
- void setMapProxy(const QNetworkProxy& proxy);
-
- virtual QRouteReply* get(const QRouteRequest& request);
- virtual QGeocodingReply* get(const QGeocodingRequest& request);
- virtual QGeocodingReply* get(const QReverseGeocodingRequest& request);
- virtual QMapTileReply* get(const QMapTileRequest& request);
-
- /*!
- * @param reply A QGeoReply.
- * @return The raw network reply associated with the QGeoReply.
- */
- QNetworkReply* getRawReply(const QGeoReply* reply) const;
-
- virtual void release(QGeoReply* reply);
- virtual void cancel(QGeoReply* reply);
-
- virtual quint16 maxZoomLevel() const;
- virtual QList<MapVersion> versions() const;
- virtual QList<MapResolution> resolutions() const;
- virtual QList<MapFormat> formats() const;
- virtual QList<MapScheme> schemes() const;
-
-private:
- Q_DISABLE_COPY(QGeoNetworkManager)
-
-private slots:
- void netReplyFinished(QNetworkReply* reply);
- void netReplyError(QNetworkReply::NetworkError code);
-
-private:
- QGeoNetworkManagerPrivate *d_ptr;
- Q_DECLARE_PRIVATE(QGeoNetworkManager)
-};
-
-QTM_END_NAMESPACE
-
-#endif
diff --git a/src/location/qgeopositioninfosource_maemo5.cpp b/src/location/qgeopositioninfosource_maemo5.cpp
index 9580e651ad..c427eb4428 100644
--- a/src/location/qgeopositioninfosource_maemo5.cpp
+++ b/src/location/qgeopositioninfosource_maemo5.cpp
@@ -46,8 +46,8 @@ using namespace std;
QTM_BEGIN_NAMESPACE
-QGeoPositionInfoSourceMaemo::QGeoPositionInfoSourceMaemo(QObject *parent)
- : QGeoPositionInfoSource(parent)
+QGeoPositionInfoSourceMaemo::QGeoPositionInfoSourceMaemo(QObject *parent)
+ : QGeoPositionInfoSource(parent)
{
// default values
availableMethods = SatellitePositioningMethods;
@@ -89,7 +89,7 @@ void QGeoPositionInfoSourceMaemo::setUpdateInterval(int msec)
msec = MINIMUM_UPDATE_INTERVAL;
timerInterval = msec;
QGeoPositionInfoSource::setUpdateInterval(0);
- } else {
+ } else {
msec = (msec < MINIMUM_UPDATE_INTERVAL) ? MINIMUM_UPDATE_INTERVAL : msec;
timerInterval = msec;
QGeoPositionInfoSource::setUpdateInterval(timerInterval);
@@ -138,7 +138,7 @@ void QGeoPositionInfoSourceMaemo::requestUpdate(int timeout)
timeoutRequest = MINIMUM_UPDATE_INTERVAL;
} else if (timeout < MINIMUM_UPDATE_INTERVAL) {
if (positionInfoState & (QGeoPositionInfoSourceMaemo::RequestActive |
- QGeoPositionInfoSourceMaemo::RequestSingleShot))
+ QGeoPositionInfoSourceMaemo::RequestSingleShot))
return;
else
positionInfoState &= ~(QGeoPositionInfoSourceMaemo::RequestActive |
@@ -150,7 +150,7 @@ void QGeoPositionInfoSourceMaemo::requestUpdate(int timeout)
}
if (updateTimer->isActive())
- updateTimer->stop();
+ updateTimer->stop();
if (requestTimer->isActive())
requestTimer->stop();
@@ -162,7 +162,7 @@ void QGeoPositionInfoSourceMaemo::requestUpdate(int timeout)
positionInfoState |= QGeoPositionInfoSourceMaemo::RequestActive;
if (positionInfoState & QGeoPositionInfoSourceMaemo::Stopped)
- positionInfoState |= QGeoPositionInfoSourceMaemo::RequestSingleShot;
+ positionInfoState |= QGeoPositionInfoSourceMaemo::RequestSingleShot;
}
void QGeoPositionInfoSourceMaemo::newPositionUpdate()
@@ -189,12 +189,12 @@ void QGeoPositionInfoSourceMaemo::requestTimeoutElapsed()
emit updateTimeout();
if (updateTimer->isActive())
updateTimer->stop();
-
+
if (!(positionInfoState & QGeoPositionInfoSourceMaemo::RequestSingleShot))
updateTimer->start(timerInterval);
-
+
positionInfoState &= ~(QGeoPositionInfoSourceMaemo::RequestActive |
- QGeoPositionInfoSourceMaemo::RequestSingleShot);
+ QGeoPositionInfoSourceMaemo::RequestSingleShot);
}
diff --git a/src/location/qgeopositioninfosource_maemo5_p.h b/src/location/qgeopositioninfosource_maemo5_p.h
index 83181b99de..b61da22ef3 100644
--- a/src/location/qgeopositioninfosource_maemo5_p.h
+++ b/src/location/qgeopositioninfosource_maemo5_p.h
@@ -83,10 +83,10 @@ private:
RequestSingleShot = 8
};
int positionInfoState;
-
+
signals:
void positionUpdated(const QGeoPositionInfo &update);
-
+
public slots:
void startUpdates();
void stopUpdates();
diff --git a/src/location/qgeopositioninfosource_s60.cpp b/src/location/qgeopositioninfosource_s60.cpp
index 0cb92b0972..480a30c278 100644
--- a/src/location/qgeopositioninfosource_s60.cpp
+++ b/src/location/qgeopositioninfosource_s60.cpp
@@ -688,7 +688,7 @@ void CQGeoPositionInfoSourceS60::requestUpdate(int aTimeout)
TInt index = -1;
TUint8 bits;
- CQMLBackendAO *temp= NULL;
+ CQMLBackendAO *temp = NULL;
//return if already a request update is pending
if (mReqUpdateAO && mReqUpdateAO->isRequestPending())
diff --git a/src/location/qgeoroute.cpp b/src/location/qgeoroute.cpp
new file mode 100644
index 0000000000..1b745b378a
--- /dev/null
+++ b/src/location/qgeoroute.cpp
@@ -0,0 +1,211 @@
+
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qgeoroute.h"
+#include "qgeoroute_p.h"
+
+QTM_BEGIN_NAMESPACE
+
+/*!
+ \class QGeoRoute
+ \brief The QGeoRoute class is a representation of a route.
+ \ingroup location
+
+ This class represents a route as contained in a QGeoRouteReply.
+ A QGeoRoute contains a collection of QManeuver objects.
+*/
+
+/*!
+ The default constructor.
+*/
+QGeoRoute::QGeoRoute()
+ : d_ptr(new QGeoRoutePrivate())
+{}
+
+
+/*!
+ The copy constructor.
+*/
+QGeoRoute::QGeoRoute(const QGeoRoute& route)
+ : d_ptr(new QGeoRoutePrivate(*(route.d_ptr)))
+{
+}
+
+/*!
+ The assignment operator.
+*/
+QGeoRoute& QGeoRoute::operator=(const QGeoRoute & route)
+{
+ *d_ptr = *(route.d_ptr);
+ return *this;
+}
+
+/*!
+ The destructor.
+*/
+QGeoRoute::~QGeoRoute()
+{
+ Q_D(QGeoRoute);
+ delete d;
+}
+
+/*!
+ Returns the departure time of this route.
+*/
+QDateTime QGeoRoute::timeOfDeparture() const
+{
+ Q_D(const QGeoRoute);
+ return d->timeOfDeparture;
+}
+
+/*!
+ Sets the time of departure for this route to \a timeOfDeparture
+*/
+void QGeoRoute::setTimeOfDeparture(const QDateTime &timeOfDeparture)
+{
+ Q_D(QGeoRoute);
+ d->timeOfDeparture = timeOfDeparture;
+}
+
+/*!
+ Returns the arrival time of this route.
+*/
+QDateTime QGeoRoute::timeOfArrival() const
+{
+ Q_D(const QGeoRoute);
+ return d->timeOfArrival;
+}
+
+/*!
+ Sets the time of arrival for this route to \a timeOfArrival
+*/
+void QGeoRoute::setTimeOfArrival(const QDateTime &timeOfArrival)
+{
+ Q_D(QGeoRoute);
+ d->timeOfArrival = timeOfArrival;
+}
+
+/*!
+ Returns the distance covered by this route in meters.
+*/
+quint32 QGeoRoute::distance() const
+{
+ Q_D(const QGeoRoute);
+ return d->distance;
+}
+
+/*!
+ Sets the distance covered by this route to \a distance metres.
+*/
+void QGeoRoute::setDistance(quint32 distance)
+{
+ Q_D(QGeoRoute);
+ d->distance = distance;
+}
+
+/*!
+ Returns the bounding box that completely encloses the route.
+
+ The x coordinates of the corner points represent longitudes
+ and the y coordinates represent latitudes.
+*/
+const QRectF& QGeoRoute::boundingBox() const
+{
+ Q_D(const QGeoRoute);
+ return d->boundingBox;
+}
+
+/*!
+ Sets the bounding box which completely encloses the route to \a boundingBox
+
+ The x coordinates of the corner points represent longitudes
+ and the y coordinates represent latitudes.
+*/
+void QGeoRoute::setBoundingBox(const QRectF &boundingBox)
+{
+ Q_D(QGeoRoute);
+ d->boundingBox = boundingBox;
+}
+
+/*!
+ Returns the list of all maneuvers comprising the route.
+*/
+QList<QManeuver> QGeoRoute::maneuvers() const
+{
+ Q_D(const QGeoRoute);
+ return d->maneuvers;
+}
+
+/*!
+ Sets the list of maneuvers which define the route to \a maneuvers.
+*/
+void QGeoRoute::setManeuvers(const QList<QManeuver> &maneuvers)
+{
+ Q_D(QGeoRoute);
+ d->maneuvers = maneuvers;
+}
+
+/*******************************************************************************
+*******************************************************************************/
+
+QGeoRoutePrivate::QGeoRoutePrivate() {}
+
+QGeoRoutePrivate::QGeoRoutePrivate(const QGeoRoutePrivate &rp)
+ : timeOfArrival(rp.timeOfArrival),
+ timeOfDeparture(rp.timeOfDeparture),
+ distance(rp.distance),
+ boundingBox(rp.boundingBox),
+ maneuvers(rp.maneuvers)
+{}
+
+QGeoRoutePrivate& QGeoRoutePrivate::operator= (const QGeoRoutePrivate & rp)
+{
+ timeOfArrival = rp.timeOfArrival;
+ timeOfDeparture = rp.timeOfDeparture;
+ distance = rp.distance;
+ boundingBox = rp.boundingBox;
+ maneuvers = rp.maneuvers;
+ return *this;
+}
+
+QTM_END_NAMESPACE
+
diff --git a/src/location/qgeoroute.h b/src/location/qgeoroute.h
new file mode 100644
index 0000000000..fc21dff5ff
--- /dev/null
+++ b/src/location/qgeoroute.h
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QLOCATION_ROUTE_H
+#define QLOCATION_ROUTE_H
+
+#include <QDateTime>
+#include <QList>
+#include <QRectF>
+
+#include "qmaneuver.h"
+
+QTM_BEGIN_NAMESPACE
+
+class QGeoRoutePrivate;
+class Q_LOCATION_EXPORT QGeoRoute
+{
+public:
+ QGeoRoute();
+ QGeoRoute(const QGeoRoute& route);
+ QGeoRoute& operator=(const QGeoRoute& route);
+ ~QGeoRoute();
+
+ QDateTime timeOfDeparture() const;
+ void setTimeOfDeparture(const QDateTime &timeOfDeparture);
+
+ QDateTime timeOfArrival() const;
+ void setTimeOfArrival(const QDateTime &timeOfArrival);
+
+ quint32 distance() const;
+ void setDistance(quint32 distance);
+
+ const QRectF& boundingBox() const;
+ void setBoundingBox(const QRectF &boundingBox);
+
+ QList<QManeuver> maneuvers() const;
+ void setManeuvers(const QList<QManeuver> &maneuvers);
+
+private:
+ QGeoRoutePrivate *d_ptr;
+ Q_DECLARE_PRIVATE(QGeoRoute);
+};
+
+QTM_END_NAMESPACE
+
+#endif
diff --git a/src/location/qroute.h b/src/location/qgeoroute_p.h
index a3f73b2f6a..7ad599caa3 100644
--- a/src/location/qroute.h
+++ b/src/location/qgeoroute_p.h
@@ -39,41 +39,32 @@
**
****************************************************************************/
-#ifndef QLOCATION_ROUTE_H
-#define QLOCATION_ROUTE_H
+#ifndef QROUTE_P_H
+#define QROUTE_P_H
+
+#include "qmaneuver.h"
#include <QDateTime>
#include <QList>
#include <QRectF>
-#include "qmaneuver.h"
-
QTM_BEGIN_NAMESPACE
-class Q_LOCATION_EXPORT QRoute
+class QGeoRoutePrivate
{
- friend class QRouteXmlParser;
-
public:
- QRoute();
- QRoute(const QRoute& route);
- QRoute& operator=(const QRoute& route);
-
- QDateTime departure() const;
- QDateTime arrival() const;
- quint32 distance() const;
- const QRectF& boundingBox() const;
- QList<QManeuver> maneuvers() const;
+ QGeoRoutePrivate();
+ QGeoRoutePrivate(const QGeoRoutePrivate &rp);
+ QGeoRoutePrivate& operator= (const QGeoRoutePrivate &rp);
-protected:
- quint32 dist;
- QDateTime tod;
- QDateTime toa;
+ quint32 distance;
+ QDateTime timeOfArrival;
+ QDateTime timeOfDeparture;
- QRectF box;
- QList<QManeuver> man;
+ QRectF boundingBox;
+ QList<QManeuver> maneuvers;
};
QTM_END_NAMESPACE
-#endif
+#endif // QROUTE_P_H
diff --git a/src/location/qgeoroutereply.cpp b/src/location/qgeoroutereply.cpp
new file mode 100644
index 0000000000..bab4eae4ed
--- /dev/null
+++ b/src/location/qgeoroutereply.cpp
@@ -0,0 +1,148 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qgeoroutereply.h"
+#include "qgeoroutereply_p.h"
+
+QTM_BEGIN_NAMESPACE
+
+/*!
+ \class QGeoRouteReply
+ \brief The QGeoRouteReply class represents the response from a routing service.
+ \ingroup location
+
+ This class represents the response from a routing service.
+ It also takes responsibility for any errors that happen while the request is
+ in submitted to and processed by the service.
+*/
+
+/*!
+ \enum ErrorCode
+
+ \value NoError
+ No error has occurred.
+ \value NetworkError
+ A networking error occurred.
+ \value NoContentError
+ The reply contained no content.
+ \value UnknownError
+ An error occurred which does not fit into any of the other categories.
+*/
+
+/*!
+ Constructs a QGeoRouteReply with parent \a parent.
+*/
+QGeoRouteReply::QGeoRouteReply(QObject *parent)
+ : QObject(parent),
+ d_ptr(new QGeoRouteReplyPrivate)
+{
+}
+
+/*!
+ Destructor.
+*/
+QGeoRouteReply::~QGeoRouteReply()
+{
+ Q_D(QGeoRouteReply);
+ delete d;
+}
+
+/*!
+ Returns the description of the route or routes.
+*/
+QString QGeoRouteReply::description() const
+{
+ Q_D(const QGeoRouteReply);
+ return d->description;
+}
+
+/*!
+ Sets the description of the route or routes to \a description.
+*/
+void QGeoRouteReply::setDescription(const QString &description)
+{
+ Q_D(QGeoRouteReply);
+ d->description = description;
+}
+
+/*!
+ Returns the list of routes which were requested.
+*/
+QList<QGeoRoute> QGeoRouteReply::routes() const
+{
+ Q_D(const QGeoRouteReply);
+ return d->routes;
+}
+
+/*!
+ Sets the list of routes in the reply to \a routes.
+*/
+void QGeoRouteReply::setRoutes(const QList<QGeoRoute> &routes)
+{
+ Q_D(QGeoRouteReply);
+ d->routes = routes;
+}
+
+/*!
+ \fn void QGeoRouteReply::cancel()
+
+ Cancels the receiving of this reply if the reply hasn't been received already.
+*/
+
+/*!
+ \fn void QGeoRouteReply::finished()
+
+ Indicates that the reply has been received and processed without error, and is ready to be used.
+*/
+/*!
+ \fn void QGeoRouteReply::error(QGeoRouteReply::ErrorCode errorCode, const QString &errorString = QString())
+
+ Indicates that an error occurred during the receiving or processing of the reply.
+*/
+
+/*******************************************************************************
+*******************************************************************************/
+
+QGeoRouteReplyPrivate::QGeoRouteReplyPrivate() {}
+
+#include "moc_qgeoroutereply.cpp"
+
+QTM_END_NAMESPACE
diff --git a/src/location/qroutereply.h b/src/location/qgeoroutereply.h
index e680eb7b2f..27e2a72a08 100644
--- a/src/location/qroutereply.h
+++ b/src/location/qgeoroutereply.h
@@ -39,55 +39,52 @@
**
****************************************************************************/
-#ifndef QLOCATION_ROUTEREPLY_H
-#define QLOCATION_ROUTEREPLY_H
+#ifndef QROUTEREPLY_H
+#define QROUTEREPLY_H
-#include <QString>
-#include <QDateTime>
-#include <QList>
+#include "qgeoroute.h"
-#include "qroute.h"
-#include "qgeoreply.h"
+#include <QList>
QTM_BEGIN_NAMESPACE
-class QRouteReplyPrivate;
-class Q_LOCATION_EXPORT QRouteReply : public QGeoReply
+class QGeoRouteReplyPrivate;
+class Q_LOCATION_EXPORT QGeoRouteReply : public QObject
{
Q_OBJECT
- friend class QRouteXmlParser;
- friend class QGeoNetworkManager;
-
public:
-
- enum ResultCode {
- OK = 0,
- Failed,
- FailedWithAlternative
+ // TODO populate this some more...
+ enum ErrorCode {
+ NoError,
+ // flesh out the more common specific network errors
+ NetworkError,
+ // File errors
+ NoContentError,
+ ParsingError,
+ UnknownError
};
-public:
+ QGeoRouteReply(QObject *parent = 0);
+ virtual ~QGeoRouteReply();
- ResultCode resultCode() const;
- void setResultCode(ResultCode result);
- QString resultDescription() const;
- QString language() const;
- void setResultDescription(QString description);
- void setLanguage(QString language);
- int count() const;
- const QList<QRoute>& routes() const;
- void addRoute(QRoute route);
- ~QRouteReply();
-
-private:
- Q_DISABLE_COPY(QRouteReply);
+ QString description() const;
+ void setDescription(const QString &description);
+
+ QList<QGeoRoute> routes() const;
+ void setRoutes(const QList<QGeoRoute> &routes);
+
+public slots:
+ virtual void cancel() = 0;
- QRouteReply();
+signals:
+ void finished();
+ void error(QGeoRouteReply::ErrorCode errorCode, const QString &errorString = QString());
+ // CHOICE: could lose the setters and make this protected
private:
- QRouteReplyPrivate *d_ptr;
- Q_DECLARE_PRIVATE(QRouteReply)
+ QGeoRouteReplyPrivate *d_ptr;
+ Q_DECLARE_PRIVATE(QGeoRouteReply);
};
QTM_END_NAMESPACE
diff --git a/src/location/qgeoroutereply_nokia.cpp b/src/location/qgeoroutereply_nokia.cpp
new file mode 100644
index 0000000000..0cbefe68e9
--- /dev/null
+++ b/src/location/qgeoroutereply_nokia.cpp
@@ -0,0 +1,136 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qgeoroutereply_nokia_p.h"
+
+#include "qgeoroutereply.h"
+#include "qgeoroutexmlparser_nokia_p.h"
+
+QTM_BEGIN_NAMESPACE
+
+QGeoRouteReplyNokia::QGeoRouteReplyNokia(QNetworkReply *reply)
+ : m_reply(reply)
+{
+ connect(m_reply,
+ SIGNAL(finished()),
+ this,
+ SLOT(parse()));
+ connect(m_reply,
+ SIGNAL(error(QNetworkReply::NetworkError)),
+ this,
+ SLOT(translateError(QNetworkReply::NetworkError)));
+
+ /*
+ // not sure if we want this or not
+ // it will free some memory once the parse has gone through
+ // probably want to do it indirectly and set a flag so that we don't
+ // double delete in the constructor
+ connect(this,
+ SIGNAL(finished()),
+ m_reply,
+ SLOT(deleteLater()));
+ connect(this,
+ SIGNAL(error(QDLGeoReply::ErrorCode,QString)),
+ m_reply,
+ SLOT(deleteLater()));
+ */
+}
+
+QGeoRouteReplyNokia::~QGeoRouteReplyNokia()
+{
+ if (m_reply)
+ m_reply->abort();
+ delete m_reply;
+}
+
+QGeoRouteReplyNokia::ResultCode QGeoRouteReplyNokia::resultCode() const
+{
+ return m_code;
+}
+
+void QGeoRouteReplyNokia::setResultCode(QGeoRouteReplyNokia::ResultCode code)
+{
+ m_code = code;
+}
+
+/*!
+ emits finished if all went well
+ otherwise emits error
+*/
+void QGeoRouteReplyNokia::parse()
+{
+ if (m_reply->size() == 0) {
+ emit error(QGeoRouteReply::NoContentError, "The reply to the routing request was empty.");
+ return;
+ }
+
+ QGeoRouteXmlParserNokia parser;
+ bool success = parser.parse(m_reply, this);
+
+ if (!success) {
+ // emit error based on parser error string
+ emit error(QGeoRouteReply::ParsingError, QString("Parsing error: %1").arg(parser.errorString()));
+ return;
+ }
+
+ if (m_code != QGeoRouteReplyNokia::OK) {
+ // emit error based on content of xml
+ emit error(QGeoRouteReply::UnknownError, "The reply contained a status code that indicates that the request was not successful.");
+ return;
+ }
+
+ emit finished();
+}
+
+void QGeoRouteReplyNokia::translateError(QNetworkReply::NetworkError errorCode)
+{
+ // TODO map errors across from errorCode
+ emit error(QGeoRouteReply::NetworkError, QString("Network error: %1").arg(m_reply->errorString()));
+}
+
+void QGeoRouteReplyNokia::cancel()
+{
+ m_reply->abort();
+}
+
+#include "moc_qgeoroutereply_nokia_p.cpp"
+
+QTM_END_NAMESPACE
diff --git a/src/location/qgeoroutereply_nokia_p.h b/src/location/qgeoroutereply_nokia_p.h
new file mode 100644
index 0000000000..6c5440be6f
--- /dev/null
+++ b/src/location/qgeoroutereply_nokia_p.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QROUTEREPLY_NOKIA_P_H
+#define QROUTEREPLY_NOKIA_P_H
+
+#include "qgeoroutereply.h"
+
+#include <QNetworkReply>
+
+QTM_BEGIN_NAMESPACE
+
+class QGeoRouteReplyNokia : public QGeoRouteReply
+{
+ Q_OBJECT
+
+public:
+ enum ResultCode {
+ OK,
+ Failed,
+ FailedWithAlternative
+ };
+
+ QGeoRouteReplyNokia(QNetworkReply *reply);
+ ~QGeoRouteReplyNokia();
+
+ QGeoRouteReplyNokia::ResultCode resultCode() const;
+ void setResultCode(QGeoRouteReplyNokia::ResultCode code);
+
+public slots:
+ virtual void parse();
+ virtual void translateError(QNetworkReply::NetworkError errorCode);
+ virtual void cancel();
+
+private:
+ QNetworkReply *m_reply;
+ QGeoRouteReplyNokia::ResultCode m_code;
+};
+
+QTM_END_NAMESPACE
+
+#endif
diff --git a/src/location/qroutereply_p.h b/src/location/qgeoroutereply_p.h
index f976533489..32269bb72a 100644
--- a/src/location/qroutereply_p.h
+++ b/src/location/qgeoroutereply_p.h
@@ -44,20 +44,17 @@
#include <QString>
-#include "qroute.h"
+#include "qgeoroute.h"
QTM_BEGIN_NAMESPACE
-class QRouteReplyPrivate
+class QGeoRouteReplyPrivate
{
public:
- QRouteReplyPrivate():rCode(QRouteReply::Failed){};
-
- QRouteReply::ResultCode rCode;
- QString descr;
- QString lang;
+ QGeoRouteReplyPrivate();
- QList<QRoute> rt;
+ QString description;
+ QList<QGeoRoute> routes;
};
QTM_END_NAMESPACE
diff --git a/src/location/qrouterequest.cpp b/src/location/qgeorouterequest.cpp
index dad1576566..4cca0f5fe0 100755..100644
--- a/src/location/qrouterequest.cpp
+++ b/src/location/qgeorouterequest.cpp
@@ -40,21 +40,21 @@
**
****************************************************************************/
-#include "qrouterequest.h"
-#include "qrouterequest_p.h"
+#include "qgeorouterequest.h"
+#include "qgeorouterequest_p.h"
QTM_BEGIN_NAMESPACE
/*!
- \class QRouteRequest
- \brief The QRouteRequest class represents a request for a route between two points.
+ \class QGeoRouteRequest
+ \brief The QGeoRouteRequest class represents a request for a route between two points.
\ingroup location
This is the base class representing a route request from a given source to a given destination.
*/
/*!
- \enum QRouteRequest::RouteType
+ \enum QGeoRouteRequest::RouteType
\value Fastest
fastest route (default)
@@ -65,7 +65,7 @@ QTM_BEGIN_NAMESPACE
*/
/*!
- \enum QRouteRequest::RouteMode
+ \enum QGeoRouteRequest::RouteMode
\value Car
car route (default)
@@ -76,7 +76,7 @@ QTM_BEGIN_NAMESPACE
*/
/*!
- \enum QRouteRequest::RouteAvoid
+ \enum QGeoRouteRequest::RouteAvoid
Values that specify which components the route will not contain.
@@ -97,17 +97,17 @@ QTM_BEGIN_NAMESPACE
/*!
The default constructor.
*/
-QRouteRequest::QRouteRequest()
- : d_ptr(new QRouteRequestPrivate)
+QGeoRouteRequest::QGeoRouteRequest()
+ : d_ptr(new QGeoRouteRequestPrivate)
{
}
/*!
Destroys the route request.
*/
-QRouteRequest::~QRouteRequest()
+QGeoRouteRequest::~QGeoRouteRequest()
{
- Q_D(QRouteRequest);
+ Q_D(QGeoRouteRequest);
delete d;
}
@@ -116,45 +116,45 @@ QRouteRequest::~QRouteRequest()
Currently the only supported version is 1.0.
*/
-QString QRouteRequest::version() const
+QString QGeoRouteRequest::version() const
{
- Q_D(const QRouteRequest);
+ Q_D(const QGeoRouteRequest);
return d->version;
}
/*!
Sets the source geo coordinate for this request to \a source.
*/
-void QRouteRequest::setSource(const QGeoCoordinate& source)
+void QGeoRouteRequest::setSource(const QGeoCoordinate& source)
{
- Q_D(QRouteRequest);
+ Q_D(QGeoRouteRequest);
d->src = source;
}
/*!
Returns the source geo coordinate for this request.
*/
-QGeoCoordinate QRouteRequest::source() const
+QGeoCoordinate QGeoRouteRequest::source() const
{
- Q_D(const QRouteRequest);
+ Q_D(const QGeoRouteRequest);
return d->src;
}
/*!
Sets the destination geo coordinate for this request to \a destination.
*/
-void QRouteRequest::setDestination(const QGeoCoordinate& destination)
+void QGeoRouteRequest::setDestination(const QGeoCoordinate& destination)
{
- Q_D(QRouteRequest);
+ Q_D(QGeoRouteRequest);
d->dst = destination;
}
/*!
Returns the destination geo coordinate for this request.
*/
-QGeoCoordinate QRouteRequest::destination() const
+QGeoCoordinate QGeoRouteRequest::destination() const
{
- Q_D(const QRouteRequest);
+ Q_D(const QGeoRouteRequest);
return d->dst;
}
@@ -163,18 +163,18 @@ QGeoCoordinate QRouteRequest::destination() const
If set to 0 all possible results will be returned.
*/
-void QRouteRequest::setTotalResults(quint32 totalResults)
+void QGeoRouteRequest::setTotalResults(quint32 totalResults)
{
- Q_D(QRouteRequest);
+ Q_D(QGeoRouteRequest);
d->nTotal = totalResults;
}
/*!
Returns the maximum number of response results.
*/
-quint32 QRouteRequest::totalResults() const
+quint32 QGeoRouteRequest::totalResults() const
{
- Q_D(const QRouteRequest);
+ Q_D(const QGeoRouteRequest);
return d->nTotal;
}
@@ -183,18 +183,18 @@ quint32 QRouteRequest::totalResults() const
If set to 0 the result will contain no alternative routes (only one result is returned if any).
*/
-void QRouteRequest::setAlternatives(quint16 nAlternatives)
+void QGeoRouteRequest::setAlternatives(quint16 nAlternatives)
{
- Q_D(QRouteRequest);
+ Q_D(QGeoRouteRequest);
d->nAlternatives = nAlternatives;
}
/*!
Returns the maximum number of alternatives to be returned.
*/
-quint16 QRouteRequest::alternatives() const
+quint16 QGeoRouteRequest::alternatives() const
{
- Q_D(const QRouteRequest);
+ Q_D(const QGeoRouteRequest);
return d->nAlternatives;
}
@@ -203,54 +203,54 @@ quint16 QRouteRequest::alternatives() const
The language code should look like en-US or de-DE.
*/
-void QRouteRequest::setLanguage(const QString& code)
+void QGeoRouteRequest::setLanguage(const QString& code)
{
- Q_D(QRouteRequest);
+ Q_D(QGeoRouteRequest);
d->languageCode = code;
}
/*!
Returns the RFC 3066 language code of the response.
*/
-QString QRouteRequest::language() const
+QString QGeoRouteRequest::language() const
{
- Q_D(const QRouteRequest);
+ Q_D(const QGeoRouteRequest);
return d->languageCode;
}
/*!
Sets the planned time of departure to \a tod.
*/
-void QRouteRequest::setDepartureTime(const QDateTime& departureTime)
+void QGeoRouteRequest::setDepartureTime(const QDateTime& departureTime)
{
- Q_D(QRouteRequest);
+ Q_D(QGeoRouteRequest);
d->departureTime = departureTime;
}
/*!
Returns the planned time of departure.
*/
-QDateTime QRouteRequest::departureTime() const
+QDateTime QGeoRouteRequest::departureTime() const
{
- Q_D(const QRouteRequest);
+ Q_D(const QGeoRouteRequest);
return d->departureTime;
}
/*!
Sets the planned time of arrival to \a toa.
*/
-void QRouteRequest::setArrivalTime(const QDateTime& arrivalTime)
+void QGeoRouteRequest::setArrivalTime(const QDateTime& arrivalTime)
{
- Q_D(QRouteRequest);
+ Q_D(QGeoRouteRequest);
d->arrivalTime = arrivalTime;
}
/*!
Returns the planned time of departure.
*/
-QDateTime QRouteRequest::arrivalTime() const
+QDateTime QGeoRouteRequest::arrivalTime() const
{
- Q_D(const QRouteRequest);
+ Q_D(const QGeoRouteRequest);
return d->arrivalTime;
}
@@ -259,18 +259,18 @@ QDateTime QRouteRequest::arrivalTime() const
\sa RouteType
*/
-void QRouteRequest::setType(RouteType type)
+void QGeoRouteRequest::setType(RouteType type)
{
- Q_D(QRouteRequest);
+ Q_D(QGeoRouteRequest);
d->routeType = type;
}
/*!
Returns the route type.
*/
-QRouteRequest::RouteType QRouteRequest::type() const
+QGeoRouteRequest::RouteType QGeoRouteRequest::type() const
{
- Q_D(const QRouteRequest);
+ Q_D(const QGeoRouteRequest);
return d->routeType;
}
@@ -279,18 +279,18 @@ QRouteRequest::RouteType QRouteRequest::type() const
\sa RouteMode
*/
-void QRouteRequest::setMode(RouteMode mode)
+void QGeoRouteRequest::setMode(RouteMode mode)
{
- Q_D(QRouteRequest);
+ Q_D(QGeoRouteRequest);
d->routeMode = mode;
}
/*!
Returns the route mode.
*/
-QRouteRequest::RouteMode QRouteRequest::mode() const
+QGeoRouteRequest::RouteMode QGeoRouteRequest::mode() const
{
- Q_D(const QRouteRequest);
+ Q_D(const QGeoRouteRequest);
return d->routeMode;
}
@@ -301,18 +301,18 @@ QRouteRequest::RouteMode QRouteRequest::mode() const
\sa RouteAvoid
*/
-void QRouteRequest::setAvoid(QList<RouteAvoid> avoid)
+void QGeoRouteRequest::setAvoid(QList<RouteAvoid> avoid)
{
- Q_D(QRouteRequest);
+ Q_D(QGeoRouteRequest);
d->avoid = avoid;
}
/*!
Returns a list containing all routes components to be avoided.
*/
-QList<QRouteRequest::RouteAvoid> QRouteRequest::avoid() const
+QList<QGeoRouteRequest::RouteAvoid> QGeoRouteRequest::avoid() const
{
- Q_D(const QRouteRequest);
+ Q_D(const QGeoRouteRequest);
return d->avoid;
}
@@ -322,9 +322,9 @@ QList<QRouteRequest::RouteAvoid> QRouteRequest::avoid() const
The server calculates a route that contains these waypoints (in the given order)
as part of the route. These waypoints must be between the destination and the source.
*/
-void QRouteRequest::addStopOver(const QGeoCoordinate& stopOver)
+void QGeoRouteRequest::addStopOver(const QGeoCoordinate& stopOver)
{
- Q_D(QRouteRequest);
+ Q_D(QGeoRouteRequest);
d->stopOvers += stopOver;
}
@@ -333,9 +333,9 @@ void QRouteRequest::addStopOver(const QGeoCoordinate& stopOver)
\sa addStopOver()
*/
-void QRouteRequest::removeStopOver(const QGeoCoordinate& stopOver)
+void QGeoRouteRequest::removeStopOver(const QGeoCoordinate& stopOver)
{
- Q_D(QRouteRequest);
+ Q_D(QGeoRouteRequest);
int i = 0;
while (i < d->stopOvers.length()) {
@@ -349,63 +349,71 @@ void QRouteRequest::removeStopOver(const QGeoCoordinate& stopOver)
/*!
Returns all added stop overs.
*/
-const QList<QGeoCoordinate>& QRouteRequest::stopOvers() const
+const QList<QGeoCoordinate>& QGeoRouteRequest::stopOvers() const
{
- Q_D(const QRouteRequest);
+ Q_D(const QGeoRouteRequest);
return d->stopOvers;
}
+/*!
+ Returns the request string for this request and a given \a host.
+*/
+QString QGeoRouteRequest::requestString(const QString &host) const
+{
+ Q_D(const QGeoRouteRequest);
+ return d->requestString(host);
+}
/*****************************************************************************
*****************************************************************************/
-QRouteRequestPrivate::QRouteRequestPrivate()
- : version("1.0"), nTotal(0),
- nAlternatives(0),
- languageCode(""),
- routeType(QRouteRequest::Fastest),
- routeMode(QRouteRequest::Car)
+QGeoRouteRequestPrivate::QGeoRouteRequestPrivate()
+ : version("1.0"), nTotal(0),
+ nAlternatives(0),
+ languageCode(""),
+ routeType(QGeoRouteRequest::Fastest),
+ routeMode(QGeoRouteRequest::Car)
{}
-QString QRouteRequestPrivate::typeToString() const
+QString QGeoRouteRequestPrivate::typeToString() const
{
- if (routeType == QRouteRequest::Fastest)
+ if (routeType == QGeoRouteRequest::Fastest)
return "fastest";
- else if (routeType == QRouteRequest::Shortest)
+ else if (routeType == QGeoRouteRequest::Shortest)
return "shortest";
- else if (routeType == QRouteRequest::Economic)
+ else if (routeType == QGeoRouteRequest::Economic)
return "economic";
return "";
}
-QString QRouteRequestPrivate::modeToString() const
+QString QGeoRouteRequestPrivate::modeToString() const
{
- if (routeMode == QRouteRequest::Car)
+ if (routeMode == QGeoRouteRequest::Car)
return "car";
- else if (routeMode == QRouteRequest::Pedestrian)
+ else if (routeMode == QGeoRouteRequest::Pedestrian)
return "pedestrian";
- else if (routeMode == QRouteRequest::PublicTransport)
+ else if (routeMode == QGeoRouteRequest::PublicTransport)
return "public transport";
return "";
}
-QString QRouteRequestPrivate::avoidToString() const
+QString QGeoRouteRequestPrivate::avoidToString() const
{
QString s;
for (int i = 0; i < avoid.count(); i++) {
- if (avoid[i] == QRouteRequest::Highways)
+ if (avoid[i] == QGeoRouteRequest::Highways)
s += "highways,";
- else if (avoid[i] == QRouteRequest::Tollroads)
+ else if (avoid[i] == QGeoRouteRequest::Tollroads)
s += "tollroads,";
- else if (avoid[i] == QRouteRequest::Ferries)
+ else if (avoid[i] == QGeoRouteRequest::Ferries)
s += "ferries,";
- else if (avoid[i] == QRouteRequest::Tunnels)
+ else if (avoid[i] == QGeoRouteRequest::Tunnels)
s += "tunnels,";
- else if (avoid[i] == QRouteRequest::Dirtroads)
+ else if (avoid[i] == QGeoRouteRequest::Dirtroads)
s += "dirtroads,";
- else if (avoid[i] == QRouteRequest::RailFerries)
+ else if (avoid[i] == QGeoRouteRequest::RailFerries)
s += "rail ferries,";
}
@@ -415,5 +423,75 @@ QString QRouteRequestPrivate::avoidToString() const
return "";
}
+QString QGeoRouteRequestPrivate::requestString(const QString &host) const
+{
+ QString request = "http://";
+ request += host;
+ request += "/routing/rt/";
+ request += version;
+ request += "?referer=localhost";
+ request += "&slong=";
+ request += trimDouble(src.longitude());
+ request += "&slat=";
+ request += trimDouble(src.latitude());
+ request += "&dlong=";
+ request += trimDouble(dst.longitude());
+ request += "&dlat=";
+ request += trimDouble(dst.latitude());
+
+ if (nTotal > 0) {
+ request += "&total=";
+ request += QString::number(nTotal);
+ }
+
+ if (nAlternatives > 0) {
+ request += "&alternatives=";
+ request += QString::number(nAlternatives);
+ }
+ if (languageCode != "") {
+ request += "&lg=";
+ request += languageCode;
+ }
+ if (departureTime.isValid()) {
+ request += "&tod=";
+ request += departureTime.toUTC().toString();
+ }
+ if (arrivalTime.isValid()) {
+ request += "&toa=";
+ request += arrivalTime.toUTC().toString();
+ }
+
+ request += "&type=";
+ request += typeToString();
+ request += "&mode=";
+ request += modeToString();
+
+ if (avoid.count() > 0) {
+ request += "&avoid=";
+ request += avoidToString();
+ }
+
+ for (int i = 0; i < stopOvers.length(); i++) {
+ request += QString::number(stopOvers[i].latitude(), 'f');
+ request += ",";
+ request += QString::number(stopOvers[i].longitude(), 'f');
+ request += " ";
+ }
+
+ return request;
+}
+
+QString QGeoRouteRequestPrivate::trimDouble(qreal degree, int decimalDigits) const
+{
+ QString sDegree = QString::number(degree, 'g', decimalDigits);
+
+ int index = sDegree.indexOf('.');
+
+ if (index == -1)
+ return sDegree;
+ else
+ return QString::number(degree, 'g', decimalDigits + index);
+}
+
QTM_END_NAMESPACE
diff --git a/src/location/qrouterequest.h b/src/location/qgeorouterequest.h
index 6dba189cea..98da0fa67f 100755..100644
--- a/src/location/qrouterequest.h
+++ b/src/location/qgeorouterequest.h
@@ -51,9 +51,9 @@
QTM_BEGIN_NAMESPACE
-class QRouteRequestPrivate;
+class QGeoRouteRequestPrivate;
-class Q_LOCATION_EXPORT QRouteRequest
+class Q_LOCATION_EXPORT QGeoRouteRequest
{
friend class QGeoNetworkManager;
@@ -81,8 +81,8 @@ public:
};
public:
- QRouteRequest();
- ~QRouteRequest();
+ QGeoRouteRequest();
+ ~QGeoRouteRequest();
QString version() const;
@@ -120,11 +120,13 @@ public:
void removeStopOver(const QGeoCoordinate& stopOver);
const QList<QGeoCoordinate>& stopOvers() const;
+ QString requestString(const QString &host) const;
+
private:
- QRouteRequestPrivate *d_ptr;
+ QGeoRouteRequestPrivate *d_ptr;
- Q_DECLARE_PRIVATE(QRouteRequest)
- Q_DISABLE_COPY(QRouteRequest)
+ Q_DECLARE_PRIVATE(QGeoRouteRequest)
+ Q_DISABLE_COPY(QGeoRouteRequest)
};
QTM_END_NAMESPACE
diff --git a/src/location/qrouterequest_p.h b/src/location/qgeorouterequest_p.h
index 51ced2ca14..2310698d16 100755..100644
--- a/src/location/qrouterequest_p.h
+++ b/src/location/qgeorouterequest_p.h
@@ -47,19 +47,23 @@
#include <QList>
#include "qgeocoordinate.h"
-#include "qrouterequest.h"
+#include "qgeorouterequest.h"
QTM_BEGIN_NAMESPACE
-class QRouteRequestPrivate
+class QGeoRouteRequestPrivate
{
public:
- QRouteRequestPrivate();
+ QGeoRouteRequestPrivate();
+
+ QString requestString(const QString &host) const;
QString typeToString() const;
QString modeToString() const;
QString avoidToString() const;
+ QString trimDouble(qreal degree, int decimalDigits = 10) const;
+
QString version;
QGeoCoordinate src;
QGeoCoordinate dst;
@@ -68,9 +72,9 @@ public:
QString languageCode;
QDateTime departureTime;
QDateTime arrivalTime;
- QRouteRequest::RouteType routeType;
- QRouteRequest::RouteMode routeMode;
- QList<QRouteRequest::RouteAvoid> avoid;
+ QGeoRouteRequest::RouteType routeType;
+ QGeoRouteRequest::RouteMode routeMode;
+ QList<QGeoRouteRequest::RouteAvoid> avoid;
QList<QGeoCoordinate> stopOvers;
};
diff --git a/src/location/qroutexmlparser.cpp b/src/location/qgeoroutexmlparser_nokia.cpp
index 3a9ba6e146..7fa0920990 100644
--- a/src/location/qroutexmlparser.cpp
+++ b/src/location/qgeoroutexmlparser_nokia.cpp
@@ -1,8 +1,8 @@
-#include "qroutexmlparser.h"
+#include "qgeoroutexmlparser_nokia_p.h"
-#include "qroutereply.h"
-#include "qroute.h"
+#include "qgeoroutereply_nokia_p.h"
+#include "qgeoroute.h"
#include "qmaneuver.h"
#include <QXmlStreamReader>
@@ -10,36 +10,41 @@
#include <QStringList>
#include <QString>
-#include <QDebug>
-
QTM_BEGIN_NAMESPACE
-QRouteXmlParser::QRouteXmlParser()
+QGeoRouteXmlParserNokia::QGeoRouteXmlParserNokia()
: m_reader(0)
{
}
-QRouteXmlParser::~QRouteXmlParser()
+QGeoRouteXmlParserNokia::~QGeoRouteXmlParserNokia()
{
if (m_reader)
delete m_reader;
}
-bool QRouteXmlParser::parse(QIODevice* source, QRouteReply *output)
+bool QGeoRouteXmlParserNokia::parse(QIODevice* source, QGeoRouteReplyNokia *output)
{
if (m_reader)
delete m_reader;
m_reader = new QXmlStreamReader(source);
- if (!readRootElement(output)) {
- qWarning() << m_reader->errorString();
+ if (!parseRootElement(output)) {
+ m_errorString = m_reader->errorString();
return false;
}
+ m_errorString = "";
+
return true;
}
-bool QRouteXmlParser::readRootElement(QRouteReply *output)
+QString QGeoRouteXmlParserNokia::errorString() const
+{
+ return m_errorString;
+}
+
+bool QGeoRouteXmlParserNokia::parseRootElement(QGeoRouteReplyNokia *output)
{
/*
<xsd:element name="routes">
@@ -77,11 +82,11 @@ bool QRouteXmlParser::readRootElement(QRouteReply *output)
if (m_reader->attributes().hasAttribute("resultCode")) {
QStringRef result = m_reader->attributes().value("resultCode");
if (result == "OK") {
- output->setResultCode(QRouteReply::OK);
+ output->setResultCode(QGeoRouteReplyNokia::OK);
} else if (result == "FAILED") {
- output->setResultCode(QRouteReply::Failed);
+ output->setResultCode(QGeoRouteReplyNokia::Failed);
} else if (result == "FAILED WITH ALTERNATIVE") {
- output->setResultCode(QRouteReply::FailedWithAlternative);
+ output->setResultCode(QGeoRouteReplyNokia::FailedWithAlternative);
} else {
m_reader->raiseError(QString("The attribute \"resultCode\" of the element \"routes\" has an unknown value (value was %1).").arg(result.toString()));
return false;
@@ -89,9 +94,10 @@ bool QRouteXmlParser::readRootElement(QRouteReply *output)
}
if (m_reader->attributes().hasAttribute("resultDescription")) {
- output->setResultDescription(m_reader->attributes().value("resultDescription").toString());
+ output->setDescription(m_reader->attributes().value("resultDescription").toString());
}
+ /*
if (!m_reader->attributes().hasAttribute("language")) {
//m_reader->raiseError("The element \"routes\" did not have the required attribute \"language\".");
//return false;
@@ -99,15 +105,18 @@ bool QRouteXmlParser::readRootElement(QRouteReply *output)
output->setLanguage(m_reader->attributes().value("language").toString());
// TODO - check that's in xsd:language format?
}
+ */
while (m_reader->readNextStartElement()) {
if (m_reader->name() == "route") {
- QRoute route;
+ QGeoRoute route;
- if (!readRoute(&route))
+ if (!parseRoute(&route))
return false;
- output->addRoute(route);
+ QList<QGeoRoute> routes = output->routes();
+ routes.append(route);
+ output->setRoutes(routes);
} else {
m_reader->raiseError(QString("The element \"routes\" did not expect a child element named \"%1\".").arg(m_reader->name().toString()));
return false;
@@ -122,7 +131,7 @@ bool QRouteXmlParser::readRootElement(QRouteReply *output)
return true;
}
-bool QRouteXmlParser::readRoute(QRoute *route)
+bool QGeoRouteXmlParserNokia::parseRoute(QGeoRoute *route)
{
/*
<xsd:complexType name="Route">
@@ -144,7 +153,7 @@ bool QRouteXmlParser::readRoute(QRoute *route)
} else {
bool ok = false;
QString s = m_reader->attributes().value("distance").toString();
- route->dist = s.toUInt(&ok);
+ route->setDistance(s.toUInt(&ok));
if (!ok) {
m_reader->raiseError(QString("The attribute \"distance\" was expected to have a value convertable to an unsigned int (value was \"%1\")").arg(s));
return false;
@@ -153,14 +162,18 @@ bool QRouteXmlParser::readRoute(QRoute *route)
if (m_reader->attributes().hasAttribute("timeOfDeparture")) {
QString tod = m_reader->readElementText();
- if (!readXsdDateTime(tod, &(route->tod), "timeOfDeparture"))
+ QDateTime time;
+ if (!parseXsdDateTime(tod, &time, "timeOfDeparture"))
return false;
+ route->setTimeOfDeparture(time);
}
if (m_reader->attributes().hasAttribute("timeOfArrival")) {
QString toa = m_reader->readElementText();
- if (!readXsdDateTime(toa, &(route->toa), "timeOfArrival"))
+ QDateTime time;
+ if (!parseXsdDateTime(toa, &time, "timeOfArrival"))
return false;
+ route->setTimeOfArrival(time);
}
if (!m_reader->readNextStartElement()) {
@@ -173,17 +186,23 @@ bool QRouteXmlParser::readRoute(QRoute *route)
return false;
}
- if (!readBoundingBox(&(route->box)))
+ QRectF boundingBox;
+
+ if (!parseBoundingBox(&boundingBox))
return false;
+ route->setBoundingBox(boundingBox);
+
while (m_reader->readNextStartElement()) {
if (m_reader->name() == "maneuver") {
QManeuver man;
- if (!readManeuver(&man))
+ if (!parseManeuver(&man))
return false;
- route->man.append(man);
+ QList<QManeuver> maneuvers = route->maneuvers();
+ maneuvers.append(man);
+ route->setManeuvers(maneuvers);
} else {
m_reader->raiseError(QString("The element \"route\" did not expect a child element named \"%1\".").arg(m_reader->name().toString()));
return false;
@@ -193,7 +212,7 @@ bool QRouteXmlParser::readRoute(QRoute *route)
return true;
}
-bool QRouteXmlParser::readXsdDateTime(const QString& strDateTime, QDateTime *dateTime, const QString &attributeName)
+bool QGeoRouteXmlParserNokia::parseXsdDateTime(const QString& strDateTime, QDateTime *dateTime, const QString &attributeName)
{
QTime utcDiff(0, 0, 0, 0);
QString dt;
@@ -290,7 +309,7 @@ bool QRouteXmlParser::readXsdDateTime(const QString& strDateTime, QDateTime *dat
return true;
}
-bool QRouteXmlParser::readXsdDuration(const QString& strDuration, qint32 *durationSeconds, const QString &attributeName)
+bool QGeoRouteXmlParserNokia::parseXsdDuration(const QString& strDuration, qint32 *durationSeconds, const QString &attributeName)
{
QString dur = strDuration;
QString errorString = QString("The attribute \"%1\" has a bady formatted xsd:duration string (string is \"%2\")").arg(attributeName).arg(strDuration);
@@ -421,7 +440,7 @@ bool QRouteXmlParser::readXsdDuration(const QString& strDuration, qint32 *durati
return true;
}
-bool QRouteXmlParser::readManeuver(QManeuver *maneuver)
+bool QGeoRouteXmlParserNokia::parseManeuver(QManeuver *maneuver)
{
/*
<xsd:complexType name="Maneuver">
@@ -462,14 +481,14 @@ bool QRouteXmlParser::readManeuver(QManeuver *maneuver)
m_reader->raiseError("The element \"maneuver\" did not have the required attribute \"description\".");
return false;
} else {
- maneuver->descr = m_reader->attributes().value("description").toString();
+ maneuver->setDescription(m_reader->attributes().value("description").toString());
}
if (!m_reader->attributes().hasAttribute("action")) {
m_reader->raiseError("The element \"maneuver\" did not have the required attribute \"action\".");
return false;
} else {
- maneuver->act = m_reader->attributes().value("action").toString();
+ maneuver->setAction(m_reader->attributes().value("action").toString());
}
if (!m_reader->attributes().hasAttribute("distance")) {
@@ -478,7 +497,7 @@ bool QRouteXmlParser::readManeuver(QManeuver *maneuver)
} else {
bool ok = false;
QString s = m_reader->attributes().value("distance").toString();
- maneuver->dist = s.toUInt(&ok);
+ maneuver->setDistance(s.toUInt(&ok));
if (!ok) {
m_reader->raiseError(QString("The attribute \"distance\" was expected to have a value convertable to an unsigned int (value was \"%1\")").arg(s));
@@ -491,28 +510,30 @@ bool QRouteXmlParser::readManeuver(QManeuver *maneuver)
return false;
} else {
QString duration = m_reader->attributes().value("duration").toString();
- if (!duration.isEmpty() && !readXsdDuration(duration, &(maneuver->dur), "duration"))
+ qint32 seconds;
+ if (!duration.isEmpty() && !parseXsdDuration(duration, &seconds, "duration"))
return false;
+ maneuver->setDuration(seconds);
}
if (m_reader->attributes().hasAttribute("turn")) {
- maneuver->trn = m_reader->attributes().value("turn").toString();
+ maneuver->setTurn(m_reader->attributes().value("turn").toString());
}
if (m_reader->attributes().hasAttribute("streetName")) {
- maneuver->stName = m_reader->attributes().value("streetName").toString();
+ maneuver->setStreetName(m_reader->attributes().value("streetName").toString());
}
if (m_reader->attributes().hasAttribute("routeName")) {
- maneuver->rtName = m_reader->attributes().value("routeName").toString();
+ maneuver->setRouteName(m_reader->attributes().value("routeName").toString());
}
if (m_reader->attributes().hasAttribute("nextStreetName")) {
- maneuver->nxtStreetName = m_reader->attributes().value("nextStreetName").toString();
+ maneuver->setNextStreetName(m_reader->attributes().value("nextStreetName").toString());
}
if (m_reader->attributes().hasAttribute("signPost")) {
- maneuver->sgnPost = m_reader->attributes().value("signPost").toString();
+ maneuver->setSignPost(m_reader->attributes().value("signPost").toString());
}
/*
@@ -520,7 +541,7 @@ bool QRouteXmlParser::readManeuver(QManeuver *maneuver)
if (m_reader->attributes().hasAttribute("trafficDirection")) {
bool ok = false;
QString s = m_reader->attributes().value("trafficDirection").toString();
- maneuver->traffDir = s.toLong(&ok);
+ maneuver->setTrafficDirection(s.toLong(&ok));
if (!ok) {
m_reader->raiseError(QString("The attribute \"trafficDirection\" was expected to have a value convertable to a long integer (value was \"%1\")").arg(s));
@@ -532,7 +553,7 @@ bool QRouteXmlParser::readManeuver(QManeuver *maneuver)
if (m_reader->attributes().hasAttribute("icon")) {
bool ok = false;
QString s = m_reader->attributes().value("icon").toString();
- maneuver->icn = s.toLong(&ok);
+ maneuver->setIcon(s.toLong(&ok));
if (!ok) {
m_reader->raiseError(QString("The attribute \"icon\" was expected to have a value convertable to a long integer (value was \"%1\")").arg(s));
@@ -546,9 +567,12 @@ bool QRouteXmlParser::readManeuver(QManeuver *maneuver)
}
if (m_reader->name() == "wayPoints") {
- if (!readGeoPoints(m_reader->readElementText(), &(maneuver->wPoints), "wayPoints"))
+ QList<QGeoCoordinate> wPoints;
+ if (!parseGeoPoints(m_reader->readElementText(), &wPoints, "wayPoints"))
return false;
+ maneuver->setWaypoints(wPoints);
+
if (!m_reader->readNextStartElement()) {
m_reader->raiseError(QString("The element \"maneuever\" expected this child element to be named \"maneuverPoints\"").arg(m_reader->name().toString()));
return false;
@@ -556,8 +580,12 @@ bool QRouteXmlParser::readManeuver(QManeuver *maneuver)
}
if (m_reader->name() == "maneuverPoints") {
- if (!readGeoPoints(m_reader->readElementText(), &(maneuver->mPoints), "maneuverPoints"))
+ QList<QGeoCoordinate> mPoints;
+ if (!parseGeoPoints(m_reader->readElementText(), &mPoints, "maneuverPoints"))
return false;
+
+ maneuver->setManeuverPoints(mPoints);
+
} else {
m_reader->raiseError(QString("The element \"maneuever\" was expected to have a child element named \"maneuverPoints\" (found an element named \"%1\")").arg(m_reader->name().toString()));
return false;
@@ -571,7 +599,7 @@ bool QRouteXmlParser::readManeuver(QManeuver *maneuver)
return true;
}
-bool QRouteXmlParser::readGeoPoints(const QString& strPoints, QList<QGeoCoordinate> *geoPoints, const QString &elementName)
+bool QGeoRouteXmlParserNokia::parseGeoPoints(const QString& strPoints, QList<QGeoCoordinate> *geoPoints, const QString &elementName)
{
QStringList rawPoints = strPoints.split(' ');
@@ -607,7 +635,7 @@ bool QRouteXmlParser::readGeoPoints(const QString& strPoints, QList<QGeoCoordina
return true;
}
-bool QRouteXmlParser::readBoundingBox(QRectF *rect)
+bool QGeoRouteXmlParserNokia::parseBoundingBox(QRectF *rect)
{
/*
<xsd:complexType name="GeoBox">
@@ -628,7 +656,7 @@ bool QRouteXmlParser::readBoundingBox(QRectF *rect)
QGeoCoordinate nw;
if (m_reader->name() == "northWest") {
- if (!readCoordinate(&nw, "northWest"))
+ if (!parseCoordinate(&nw, "northWest"))
return false;
} else {
m_reader->raiseError(QString("The element \"boundingBox\" expected this child element to be named \"northWest\" (found an element named \"%1\")").arg(m_reader->name().toString()));
@@ -643,7 +671,7 @@ bool QRouteXmlParser::readBoundingBox(QRectF *rect)
QGeoCoordinate se;
if (m_reader->name() == "southEast") {
- if (!readCoordinate(&se, "southEast"))
+ if (!parseCoordinate(&se, "southEast"))
return false;
} else {
m_reader->raiseError(QString("The element \"boundingBox\" expected this child element to be named \"southEast\" (found an element named \"%1\")").arg(m_reader->name().toString()));
@@ -661,7 +689,7 @@ bool QRouteXmlParser::readBoundingBox(QRectF *rect)
return true;
}
-bool QRouteXmlParser::readCoordinate(QGeoCoordinate *coordinate, const QString &elementName)
+bool QGeoRouteXmlParserNokia::parseCoordinate(QGeoCoordinate *coordinate, const QString &elementName)
{
/*
<xsd:complexType name="GeoCoord">
diff --git a/src/location/qgeoroutexmlparser_nokia_p.h b/src/location/qgeoroutexmlparser_nokia_p.h
new file mode 100644
index 0000000000..83422880ea
--- /dev/null
+++ b/src/location/qgeoroutexmlparser_nokia_p.h
@@ -0,0 +1,48 @@
+
+#ifndef QROUTEXMLPARSER_H
+#define QROUTEXMLPARSER_H
+
+#include "qmobilityglobal.h"
+#include <QList>
+#include <QString>
+
+class QXmlStreamReader;
+class QIODevice;
+class QRectF;
+class QDateTime;
+
+QTM_BEGIN_NAMESPACE
+
+class QGeoRouteReplyNokia;
+class QGeoRoute;
+class QGeoCoordinate;
+class QManeuver;
+
+class QGeoRouteXmlParserNokia
+{
+
+public:
+
+ QGeoRouteXmlParserNokia();
+ ~QGeoRouteXmlParserNokia();
+
+ bool parse(QIODevice* source, QGeoRouteReplyNokia *output);
+ QString errorString() const;
+
+private:
+ bool parseRootElement(QGeoRouteReplyNokia *output);
+ bool parseRoute(QGeoRoute *route);
+ bool parseXsdDateTime(const QString& strDateTime, QDateTime *dateTime, const QString &attributeName);
+ bool parseXsdDuration(const QString& strDuration, qint32 *durationSeconds, const QString &attributeName);
+ bool parseManeuver(QManeuver *maneuver);
+ bool parseGeoPoints(const QString& strPoints, QList<QGeoCoordinate> *geoPoints, const QString &elementName);
+ bool parseBoundingBox(QRectF *rect);
+ bool parseCoordinate(QGeoCoordinate *coordinate, const QString &elementName);
+
+ QXmlStreamReader *m_reader;
+ QString m_errorString;
+};
+
+QTM_END_NAMESPACE
+
+#endif
diff --git a/src/location/qgeoreply.cpp b/src/location/qgeoroutingservice.cpp
index 1726158bfe..7ab7d1ede4 100644
--- a/src/location/qgeoreply.cpp
+++ b/src/location/qgeoroutingservice.cpp
@@ -39,61 +39,55 @@
**
****************************************************************************/
-#include "qgeoreply.h"
+#include "qgeoroutingservice.h"
QTM_BEGIN_NAMESPACE
/*!
- \class QGeoReply
- \brief The QGeoReply class is the base class for all maps and navigation replies.
+ \class QGeoRoutingService
+ \brief The QGeoRoutingService class handles all communications to and from a geographic routing service.
\ingroup location
- This is the base class of all classes that represent replies
- to (reverse) geocoding, route, and map tile requests.
-*/
-
-/*!
- \typedef QGeoReply::ErrorCode
-
- Error codes that might occur
+ This is the abstract base class for all classes that handle
+ routing requests/replies to and from a service which provides routing
+ information.
*/
/*!
Default constructor.
*/
-QGeoReply::QGeoReply() : fin(false) {}
-
-
-
+QGeoRoutingService::QGeoRoutingService() {}
/*!
- Returns true if the reply finished and returns false if the reply has not finished yet.
+ Virtual destructor.
*/
-bool QGeoReply::isFinished() const {
- return fin;
-}
+QGeoRoutingService::~QGeoRoutingService() {}
/*!
- \fn void QGeoReply::finished()
-
+ \fn QGeoRouteReply* QGeoRoutingService::getRoute(const QGeoRouteRequest& request)
+
+ Submits the route request \a request and returns the corresponding QGeoRouteReply.
- This signal is emitted when the reply is finished. This signal will be
- emitted after its corresponding QGeoEngine::finished() signal.
+ \note Due to the asynchronous nature of requests, you should wait for the
+ QGeoRoutingService::finished(QGeoRouteReply*) signal from this object or the
+ QGeoRouteReply::finished() signal from the returned QGeoRouteReply object before
+ working with the reply.
*/
/*!
- \fn void QGeoReply::error(ErrorCode code)
+ \fn void QGeoRoutingService::finished(QGeoRouteReply* reply)
- This signal is emitted when an error occured. This signal will be
- emitted after its corresponding QGeoEngine::error() signal.
- \note When QGeoNetworkManager is used, the error code will be identical to QNetworkReply::NetworkError.
+ This signal is emitted when a QGeoRouteReply is available in
+ response to a previously submitted QGeoRouteRequest.
*/
/*!
- \variable QGeoReply::fin
- \brief finished flag;
-*/
+ \fn void QGeoRoutingService::error(QGeoRouteReply* reply, QGeoReply::ErrorCode code)
+ This signal is emitted when a QGeoRouteReply encountered an error
+ in response to a previously submitted QGeoRouteRequest.
+ \note For QGeoNetworkManager, the error code will be identical to QNetworkReply::NetworkError.
+*/
-#include "moc_qgeoreply.cpp"
+#include "moc_qgeoroutingservice.cpp"
QTM_END_NAMESPACE
diff --git a/src/location/qgeoroutingservice.h b/src/location/qgeoroutingservice.h
new file mode 100644
index 0000000000..55c56111da
--- /dev/null
+++ b/src/location/qgeoroutingservice.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QGEOROUTINGSERVICE_H
+#define QGEOROUTINGSERVICE_H
+
+#include "qmobilityglobal.h"
+
+#include "qgeorouterequest.h"
+#include "qgeoroutereply.h"
+
+#include <QObject>
+
+QTM_BEGIN_NAMESPACE
+
+class Q_LOCATION_EXPORT QGeoRoutingService : public QObject
+{
+ Q_OBJECT
+public:
+ QGeoRoutingService();
+ virtual ~QGeoRoutingService();
+
+ virtual QGeoRouteReply* getRoute(const QGeoRouteRequest& request) = 0;
+
+signals:
+ void finished(QGeoRouteReply* reply);
+ void error(QGeoRouteReply* reply, QGeoRouteReply::ErrorCode errorCode, QString errorString = QString());
+
+private:
+ Q_DISABLE_COPY(QGeoRoutingService)
+};
+
+QTM_END_NAMESPACE
+
+#endif // QGEOROUTINGSERVICE_H
diff --git a/src/location/qgeoroutingservice_nokia.cpp b/src/location/qgeoroutingservice_nokia.cpp
new file mode 100644
index 0000000000..63d0a8d96f
--- /dev/null
+++ b/src/location/qgeoroutingservice_nokia.cpp
@@ -0,0 +1,132 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qgeoroutingservice_nokia_p.h"
+#include "qgeoroutereply_nokia_p.h"
+
+QTM_BEGIN_NAMESPACE
+
+QGeoRoutingServiceNokia::QGeoRoutingServiceNokia()
+ : m_token(""),
+ m_referrer(""),
+ m_host("172.24.32.155"),
+ m_proxy(QNetworkProxy(QNetworkProxy::NoProxy))
+{
+}
+
+QGeoRoutingServiceNokia::~QGeoRoutingServiceNokia()
+{
+}
+
+QString QGeoRoutingServiceNokia::token() const
+{
+ return m_token;
+}
+
+void QGeoRoutingServiceNokia::setToken(const QString &token)
+{
+ m_token = token;
+}
+
+QString QGeoRoutingServiceNokia::referrer() const
+{
+ return m_referrer;
+}
+
+void QGeoRoutingServiceNokia::setReferrer(const QString &referrer)
+{
+ m_referrer = referrer;
+}
+
+QString QGeoRoutingServiceNokia::host() const
+{
+ return m_host;
+}
+
+void QGeoRoutingServiceNokia::setHost(const QString &host)
+{
+ m_host = host;
+}
+
+QNetworkProxy QGeoRoutingServiceNokia::proxy() const
+{
+ return m_proxy;
+}
+
+void QGeoRoutingServiceNokia::setProxy(const QNetworkProxy &proxy)
+{
+ m_proxy = proxy;
+ m_nam.setProxy(m_proxy);
+}
+
+QGeoRouteReply* QGeoRoutingServiceNokia::getRoute(const QGeoRouteRequest& request)
+{
+ QString rawRequest = request.requestString(m_host);
+ QNetworkRequest netRequest = QNetworkRequest(QUrl(rawRequest));
+ QNetworkReply* netReply = m_nam.get(netRequest);
+
+ QGeoRouteReply* routeReply = new QGeoRouteReplyNokia(netReply);
+
+ connect(routeReply,
+ SIGNAL(finished()),
+ this,
+ SLOT(finishedReply()));
+ connect(routeReply,
+ SIGNAL(error(QGeoRouteReply::ErrorCode, QString)),
+ this,
+ SLOT(errorReply(QGeoRouteReply::ErrorCode, QString)));
+
+ return routeReply;
+}
+
+void QGeoRoutingServiceNokia::finishedReply()
+{
+ emit finished(static_cast<QGeoRouteReply *>(this->sender()));
+}
+
+void QGeoRoutingServiceNokia::errorReply(QGeoRouteReply::ErrorCode errorCode, QString errorString)
+{
+ emit error(static_cast<QGeoRouteReply *>(this->sender()), errorCode, errorString);
+}
+
+#include "moc_qgeoroutingservice_nokia_p.cpp"
+
+QTM_END_NAMESPACE
diff --git a/src/location/qgeoroutingservice_nokia_p.h b/src/location/qgeoroutingservice_nokia_p.h
new file mode 100644
index 0000000000..2d810b8872
--- /dev/null
+++ b/src/location/qgeoroutingservice_nokia_p.h
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QGEOROUTINGSERVICE_NOKIA_P_H
+#define QGEOROUTINGSERVICE_NOKIA_P_H
+
+#include "qgeoroutingservice.h"
+
+#include <QNetworkAccessManager>
+#include <QNetworkProxy>
+
+QTM_BEGIN_NAMESPACE
+
+class Q_LOCATION_EXPORT QGeoRoutingServiceNokia : public QGeoRoutingService
+{
+ Q_OBJECT
+public:
+ QGeoRoutingServiceNokia();
+ ~QGeoRoutingServiceNokia();
+
+ QString token() const;
+ void setToken(const QString &token);
+
+ QString referrer() const;
+ void setReferrer(const QString &referrer);
+
+ QString host() const;
+ void setHost(const QString &host);
+
+ QNetworkProxy proxy() const;
+ void setProxy(const QNetworkProxy &proxy);
+
+ virtual QGeoRouteReply* getRoute(const QGeoRouteRequest& request);
+
+private slots:
+ void finishedReply();
+ void errorReply(QGeoRouteReply::ErrorCode errorCode, QString errorString);
+
+private:
+ QString m_token;
+ QString m_referrer;
+ QString m_host;
+ QNetworkProxy m_proxy;
+ QNetworkAccessManager m_nam;
+};
+
+QTM_END_NAMESPACE
+
+#endif // QGEOROUTINGSERVICE_NOKIA_P_H
diff --git a/src/location/qgeosatelliteinfosource_maemo5.cpp b/src/location/qgeosatelliteinfosource_maemo5.cpp
index 80732d3417..3c1209f714 100644
--- a/src/location/qgeosatelliteinfosource_maemo5.cpp
+++ b/src/location/qgeosatelliteinfosource_maemo5.cpp
@@ -46,9 +46,9 @@ QTM_BEGIN_NAMESPACE
#define MINIMUM_UPDATE_INTERVAL 1000
#define DEFAULT_UPDATE_INTERVAL 5000
-
-QGeoSatelliteInfoSourceMaemo::QGeoSatelliteInfoSourceMaemo(QObject *parent)
- : QGeoSatelliteInfoSource(parent)
+
+QGeoSatelliteInfoSourceMaemo::QGeoSatelliteInfoSourceMaemo(QObject *parent)
+ : QGeoSatelliteInfoSource(parent)
{
client_id_ = -1;
timerInterval = DEFAULT_UPDATE_INTERVAL;
@@ -65,7 +65,7 @@ QGeoSatelliteInfoSourceMaemo::QGeoSatelliteInfoSourceMaemo(QObject *parent)
int QGeoSatelliteInfoSourceMaemo::init()
{
- if(LiblocationWrapper::instance()->inited()) {
+ if (LiblocationWrapper::instance()->inited()) {
satelliteInfoState |= QGeoSatelliteInfoSourceMaemo::Stopped;
return 0;
} else {
@@ -86,13 +86,13 @@ void QGeoSatelliteInfoSourceMaemo::startUpdates()
satelliteInfoState |= QGeoSatelliteInfoSourceMaemo::Started;
satelliteInfoState &= ~(QGeoSatelliteInfoSourceMaemo::Stopped |
QGeoSatelliteInfoSourceMaemo::RequestSingleShot);
- if(!updateTimer->isActive())
+ if (!updateTimer->isActive())
updateTimer->start(timerInterval);
}
void QGeoSatelliteInfoSourceMaemo::stopUpdates()
{
- if(updateTimer->isActive())
+ if (updateTimer->isActive())
updateTimer->stop();
LiblocationWrapper::instance()->stop();
satelliteInfoState &= ~(QGeoSatelliteInfoSourceMaemo::Started |
@@ -104,14 +104,14 @@ void QGeoSatelliteInfoSourceMaemo::stopUpdates()
void QGeoSatelliteInfoSourceMaemo::requestUpdate(int timeout)
{
int timeoutRequest = 0;
-
- if(!timeout) {
+
+ if (!timeout) {
timeoutRequest = MINIMUM_UPDATE_INTERVAL;
} else if (timeout < MINIMUM_UPDATE_INTERVAL) {
- if(satelliteInfoState & (QGeoSatelliteInfoSourceMaemo::RequestActive |
+ if (satelliteInfoState & (QGeoSatelliteInfoSourceMaemo::RequestActive |
QGeoSatelliteInfoSourceMaemo::RequestSingleShot))
return;
- else
+ else
satelliteInfoState &= ~(QGeoSatelliteInfoSourceMaemo::RequestActive |
QGeoSatelliteInfoSourceMaemo::RequestSingleShot);
emit requestTimeout();
@@ -120,42 +120,42 @@ void QGeoSatelliteInfoSourceMaemo::requestUpdate(int timeout)
timeoutRequest = timeout;
}
- if(updateTimer->isActive())
+ if (updateTimer->isActive())
updateTimer->stop();
- if(requestTimer->isActive())
+ if (requestTimer->isActive())
requestTimer->stop();
LiblocationWrapper::instance()->start();
updateTimer->start(MINIMUM_UPDATE_INTERVAL);
requestTimer->start(timeoutRequest);
-
+
satelliteInfoState |= QGeoSatelliteInfoSourceMaemo::RequestActive;
-
+
if (satelliteInfoState & QGeoSatelliteInfoSourceMaemo::Stopped)
- satelliteInfoState |= QGeoSatelliteInfoSourceMaemo::RequestSingleShot;
+ satelliteInfoState |= QGeoSatelliteInfoSourceMaemo::RequestSingleShot;
}
void QGeoSatelliteInfoSourceMaemo::satelliteStatus()
{
- QList<QGeoSatelliteInfo> satellitesInView =
- LiblocationWrapper::instance()->satellitesInView();
- QList<QGeoSatelliteInfo> satellitesInUse =
- LiblocationWrapper::instance()->satellitesInUse();
+ QList<QGeoSatelliteInfo> satellitesInView =
+ LiblocationWrapper::instance()->satellitesInView();
+ QList<QGeoSatelliteInfo> satellitesInUse =
+ LiblocationWrapper::instance()->satellitesInUse();
- if(satellitesInView.length()) {
+ if (satellitesInView.length()) {
// If there are satellites in view, also in use can be emitted.
emit satellitesInViewUpdated(satellitesInView);
emit satellitesInUseUpdated(satellitesInUse);
- }
+ }
- if(satelliteInfoState & QGeoSatelliteInfoSourceMaemo::RequestActive) {
+ if (satelliteInfoState & QGeoSatelliteInfoSourceMaemo::RequestActive) {
satelliteInfoState &= ~QGeoSatelliteInfoSourceMaemo::RequestActive;
-
- if(requestTimer->isActive())
+
+ if (requestTimer->isActive())
requestTimer->stop();
-
- if(satelliteInfoState & QGeoSatelliteInfoSourceMaemo::RequestSingleShot) {
+
+ if (satelliteInfoState & QGeoSatelliteInfoSourceMaemo::RequestSingleShot) {
satelliteInfoState &= ~QGeoSatelliteInfoSourceMaemo::RequestSingleShot;
return;
}
@@ -166,12 +166,12 @@ void QGeoSatelliteInfoSourceMaemo::satelliteStatus()
void QGeoSatelliteInfoSourceMaemo::requestTimeoutElapsed()
{
emit requestTimeout();
- if(updateTimer->isActive())
+ if (updateTimer->isActive())
updateTimer->stop();
-
- if(!(satelliteInfoState & QGeoSatelliteInfoSourceMaemo::RequestSingleShot))
+
+ if (!(satelliteInfoState & QGeoSatelliteInfoSourceMaemo::RequestSingleShot))
updateTimer->start(timerInterval);
-
+
satelliteInfoState &= ~(QGeoSatelliteInfoSourceMaemo::RequestActive |
QGeoSatelliteInfoSourceMaemo::RequestSingleShot);
}
diff --git a/src/location/qgeosatelliteinfosource_maemo5_p.h b/src/location/qgeosatelliteinfosource_maemo5_p.h
index ca9d5e9230..71f49d6f0b 100644
--- a/src/location/qgeosatelliteinfosource_maemo5_p.h
+++ b/src/location/qgeosatelliteinfosource_maemo5_p.h
@@ -53,7 +53,7 @@ class LiblocationWrapper;
class QGeoSatelliteInfoSourceMaemo : public QGeoSatelliteInfoSource
{
Q_OBJECT
-
+
public:
explicit QGeoSatelliteInfoSourceMaemo(QObject *parent = 0);
@@ -80,7 +80,7 @@ public slots:
void stopUpdates();
void requestUpdate(int timeout = 5000);
void satelliteStatus();
-
+
signals:
void satellitesInViewUpdated(const QList<QGeoSatelliteInfo> &satellites);
void satellitesInUseUpdated(const QList<QGeoSatelliteInfo> &satellites);
diff --git a/src/location/qgeosatelliteinfosource_s60.cpp b/src/location/qgeosatelliteinfosource_s60.cpp
index 67f16e2065..cb82791855 100644
--- a/src/location/qgeosatelliteinfosource_s60.cpp
+++ b/src/location/qgeosatelliteinfosource_s60.cpp
@@ -328,7 +328,7 @@ void CQGeoSatelliteInfoSourceS60::updateStatus(TPositionModuleInfo aModInfo, TIn
if ((ret == KErrNone) && (temp != NULL)) {
temp->setUpdateInterval(interval);
- if (mRegUpdateAO)
+ if (mRegUpdateAO)
delete mRegUpdateAO;
mRegUpdateAO = temp;
diff --git a/src/location/qlandmark.cpp b/src/location/qlandmark.cpp
index 174c87de99..eff92e8dd6 100644
--- a/src/location/qlandmark.cpp
+++ b/src/location/qlandmark.cpp
@@ -58,22 +58,22 @@ QTM_USE_NAMESPACE
// ----- QLandmarkPrivate -----
QLandmarkPrivate::QLandmarkPrivate()
- : QSharedData()
+ : QSharedData()
{
}
QLandmarkPrivate::QLandmarkPrivate(const QLandmarkPrivate &other)
- : QSharedData(other),
- name(other.name),
- categories(other.categories),
- location(other.location),
- description(other.description),
- iconUrl(other.iconUrl),
- radius(other.radius),
- attributes(other.attributes),
- phone(other.phone),
- url(other.url),
- id(other.id)
+ : QSharedData(other),
+ name(other.name),
+ categories(other.categories),
+ location(other.location),
+ description(other.description),
+ iconUrl(other.iconUrl),
+ radius(other.radius),
+ attributes(other.attributes),
+ phone(other.phone),
+ url(other.url),
+ id(other.id)
{
}
@@ -106,7 +106,7 @@ bool QLandmarkPrivate::operator== (const QLandmarkPrivate &other) const
&& (url == other.url)
&& (categories == other.categories)
&& (attributes == other.attributes))
- && (id == other.id);
+ && (id == other.id);
}
/*!
@@ -142,7 +142,7 @@ bool QLandmarkPrivate::operator== (const QLandmarkPrivate &other) const
id() is called.
*/
QLandmark::QLandmark()
- :d(new QLandmarkPrivate)
+ : d(new QLandmarkPrivate)
{
}
@@ -150,7 +150,7 @@ QLandmark::QLandmark()
Constructs a copy of \a other.
*/
QLandmark::QLandmark(const QLandmark &other)
- :d(other.d)
+ : d(other.d)
{
}
diff --git a/src/location/qlandmark.h b/src/location/qlandmark.h
index 8888f37ae7..0bb92543fa 100644
--- a/src/location/qlandmark.h
+++ b/src/location/qlandmark.h
@@ -71,9 +71,8 @@ public:
QLandmark &operator= (const QLandmark &other);
bool operator== (const QLandmark &other) const;
- bool operator!= (const QLandmark &other) const
- {
- return !(*this==other);
+ bool operator!= (const QLandmark &other) const {
+ return !(*this == other);
}
QString name() const;
diff --git a/src/location/qlandmarkabstractrequest.h b/src/location/qlandmarkabstractrequest.h
index 875e16cd94..eb911e9537 100644
--- a/src/location/qlandmarkabstractrequest.h
+++ b/src/location/qlandmarkabstractrequest.h
@@ -52,7 +52,7 @@ class QLandmarkAbstractRequest : public QObject
{
Q_OBJECT
public:
- enum State{
+ enum State {
InactiveState = 0,
ActiveState,
CanceledState,
diff --git a/src/location/qlandmarkboxfilter.cpp b/src/location/qlandmarkboxfilter.cpp
index d759cb4c57..5083f58779 100644
--- a/src/location/qlandmarkboxfilter.cpp
+++ b/src/location/qlandmarkboxfilter.cpp
@@ -57,14 +57,14 @@ public:
};
QLandmarkBoxFilterPrivate::QLandmarkBoxFilterPrivate()
- : QLandmarkFilterPrivate()
+ : QLandmarkFilterPrivate()
{
}
QLandmarkBoxFilterPrivate::QLandmarkBoxFilterPrivate(const QLandmarkBoxFilterPrivate &other)
- : QLandmarkFilterPrivate(other),
- topLeftCoord(other.topLeftCoord),
- bottomRightCoord(other.bottomRightCoord)
+ : QLandmarkFilterPrivate(other),
+ topLeftCoord(other.topLeftCoord),
+ bottomRightCoord(other.bottomRightCoord)
{
}
@@ -84,7 +84,7 @@ QLandmarkBoxFilterPrivate::~QLandmarkBoxFilterPrivate()
*/
QLandmarkBoxFilter::QLandmarkBoxFilter(const QGeoCoordinate &topLeft,
const QGeoCoordinate &bottomRight)
- : QLandmarkFilter(*new QLandmarkBoxFilterPrivate)
+ : QLandmarkFilter(*new QLandmarkBoxFilterPrivate)
{
Q_UNUSED(topLeft);
Q_UNUSED(bottomRight);
diff --git a/src/location/qlandmarkcategory.cpp b/src/location/qlandmarkcategory.cpp
index ba2f5fb455..0c53369c1f 100644
--- a/src/location/qlandmarkcategory.cpp
+++ b/src/location/qlandmarkcategory.cpp
@@ -73,8 +73,8 @@ QLandmarkCategoryPrivate& QLandmarkCategoryPrivate::operator= (const QLandmarkCa
bool QLandmarkCategoryPrivate::operator == (const QLandmarkCategoryPrivate &other) const
{
return ((name == other.name)
- && (iconUrl == other.iconUrl)
- && (description == other.description));
+ && (iconUrl == other.iconUrl)
+ && (description == other.description));
}
/*!
@@ -156,7 +156,7 @@ bool QLandmarkCategory::operator== (const QLandmarkCategory &other) const
*/
bool QLandmarkCategory::operator!= (const QLandmarkCategory &other) const
{
- return !(*this==other);
+ return !(*this == other);
}
/*!
@@ -170,7 +170,8 @@ QString QLandmarkCategory::name() const
/*!
Sets the \a name of the category.
*/
-void QLandmarkCategory::setName(const QString &name){
+void QLandmarkCategory::setName(const QString &name)
+{
d->name = name;
}
diff --git a/src/location/qlandmarkcategoryid.cpp b/src/location/qlandmarkcategoryid.cpp
index cbb7498d74..fd4372b7b1 100644
--- a/src/location/qlandmarkcategoryid.cpp
+++ b/src/location/qlandmarkcategoryid.cpp
@@ -63,7 +63,7 @@ QTM_USE_NAMESPACE
id() and managerUri() will return null strings.
*/
QLandmarkCategoryId::QLandmarkCategoryId()
- :d(new QLandmarkCategoryIdPrivate)
+ : d(new QLandmarkCategoryIdPrivate)
{
}
@@ -71,7 +71,7 @@ QLandmarkCategoryId::QLandmarkCategoryId()
Constructs a copy of \a other.
*/
QLandmarkCategoryId::QLandmarkCategoryId(const QLandmarkCategoryId &other)
- :d(other.d)
+ : d(other.d)
{
}
@@ -131,7 +131,7 @@ void QLandmarkCategoryId::setManagerUri(const QString &uri)
Assigns \a other to this category identifier and returns a reference
to this category identifier.
*/
-QLandmarkCategoryId &QLandmarkCategoryId::operator=(const QLandmarkCategoryId &other)
+QLandmarkCategoryId &QLandmarkCategoryId::operator=(const QLandmarkCategoryId & other)
{
d = other.d;
return *this;
diff --git a/src/location/qlandmarkcategoryid_p.h b/src/location/qlandmarkcategoryid_p.h
index b9b3cbc872..4efb168672 100644
--- a/src/location/qlandmarkcategoryid_p.h
+++ b/src/location/qlandmarkcategoryid_p.h
@@ -63,19 +63,16 @@ class QLandmarkCategoryIdPrivate : public QSharedData
{
public:
QLandmarkCategoryIdPrivate()
- : QSharedData()
- {
+ : QSharedData() {
}
QLandmarkCategoryIdPrivate(const QLandmarkCategoryIdPrivate &other)
- : QSharedData(other),
- m_id(other.m_id),
- m_databaseName(other.m_databaseName)
- {
+ : QSharedData(other),
+ m_id(other.m_id),
+ m_databaseName(other.m_databaseName) {
}
- ~QLandmarkCategoryIdPrivate()
- {
+ ~QLandmarkCategoryIdPrivate() {
}
QString m_id;
diff --git a/src/location/qlandmarkcustomfilter.h b/src/location/qlandmarkcustomfilter.h
index c49d0a1b1a..f3cd0c8910 100644
--- a/src/location/qlandmarkcustomfilter.h
+++ b/src/location/qlandmarkcustomfilter.h
@@ -57,7 +57,7 @@ public:
protected:
QLandmarkCustomFilter();
- virtual bool isMatch(const QLandmark &landmark)=0;
+ virtual bool isMatch(const QLandmark &landmark) = 0;
private:
QLandmarkCustomFilterPrivate *d;
};
diff --git a/src/location/qlandmarkcustomsort.h b/src/location/qlandmarkcustomsort.h
index ad568547a4..d6f8c714b0 100644
--- a/src/location/qlandmarkcustomsort.h
+++ b/src/location/qlandmarkcustomsort.h
@@ -54,7 +54,7 @@ class Q_LOCATION_EXPORT QLandmarkCustomSort : public QLandmarkSortOrder
virtual ~QLandmarkCustomSort();
protected:
QLandmarkCustomSort();
- virtual int compare(const QLandmark &l1, const QLandmark &l2) const=0;
+ virtual int compare(const QLandmark &l1, const QLandmark &l2) const = 0;
private:
QLandmarkCustomSortPrivate *d;
};
diff --git a/src/location/qlandmarkfilter.cpp b/src/location/qlandmarkfilter.cpp
index 68c0610c6c..056d473bf4 100644
--- a/src/location/qlandmarkfilter.cpp
+++ b/src/location/qlandmarkfilter.cpp
@@ -52,16 +52,16 @@
QTM_BEGIN_NAMESPACE
QLandmarkFilterPrivate::QLandmarkFilterPrivate()
- : QSharedData(),
- type(QLandmarkFilter::DefaultFilter),
- maxMatches(-1)
+ : QSharedData(),
+ type(QLandmarkFilter::DefaultFilter),
+ maxMatches(-1)
{
}
QLandmarkFilterPrivate::QLandmarkFilterPrivate(const QLandmarkFilterPrivate &other)
- : QSharedData(other),
- type(other.type),
- maxMatches(other.maxMatches)
+ : QSharedData(other),
+ type(other.type),
+ maxMatches(other.maxMatches)
{
}
@@ -117,7 +117,7 @@ QLandmarkFilter::QLandmarkFilter()
Constructs a copy of \a other.
*/
QLandmarkFilter::QLandmarkFilter(const QLandmarkFilter &other)
- :d(other.d)
+ : d(other.d)
{
}
@@ -125,7 +125,7 @@ QLandmarkFilter::QLandmarkFilter(const QLandmarkFilter &other)
\internal
*/
QLandmarkFilter::QLandmarkFilter(QLandmarkFilterPrivate &dd)
- :d(&dd)
+ : d(&dd)
{
//TODO: implement
}
@@ -186,7 +186,7 @@ bool QLandmarkFilter::operator==(const QLandmarkFilter &other) const
/*!
Assigns \a other to this filter and returns a reference to this filter.
*/
-QLandmarkFilter &QLandmarkFilter::operator=(const QLandmarkFilter &other)
+QLandmarkFilter &QLandmarkFilter::operator=(const QLandmarkFilter & other)
{
return *this;
}
diff --git a/src/location/qlandmarkfilter.h b/src/location/qlandmarkfilter.h
index b20c56c664..1f0f25072b 100644
--- a/src/location/qlandmarkfilter.h
+++ b/src/location/qlandmarkfilter.h
@@ -53,11 +53,12 @@ class QLandmarkFilterPrivate;
class Q_LOCATION_EXPORT QLandmarkFilter
{
public:
- enum FilterType{InvalidFilter, DefaultFilter,
- NameFilter, ProximityFilter,
- NearestFilter, CategoryFilter,
- BoxFilter, IntersectionFilter,
- UnionFilter, CustomFilter =500};
+ enum FilterType {InvalidFilter, DefaultFilter,
+ NameFilter, ProximityFilter,
+ NearestFilter, CategoryFilter,
+ BoxFilter, IntersectionFilter,
+ UnionFilter, CustomFilter = 500
+ };
QLandmarkFilter();
QLandmarkFilter(const QLandmarkFilter &other);
virtual ~QLandmarkFilter();
diff --git a/src/location/qlandmarkid.cpp b/src/location/qlandmarkid.cpp
index b75a32965d..f7f1b8de35 100644
--- a/src/location/qlandmarkid.cpp
+++ b/src/location/qlandmarkid.cpp
@@ -63,7 +63,7 @@ QTM_USE_NAMESPACE
id() and managerUri() will return null strings
*/
QLandmarkId::QLandmarkId()
- :d(new QLandmarkIdPrivate)
+ : d(new QLandmarkIdPrivate)
{
}
@@ -71,7 +71,7 @@ QLandmarkId::QLandmarkId()
Constructs a copy of \a other.
*/
QLandmarkId::QLandmarkId(const QLandmarkId &other)
- :d(other.d)
+ : d(other.d)
{
}
@@ -131,7 +131,7 @@ void QLandmarkId::setManagerUri(const QString &uri)
Assigns \a other to this landmark identifier and returns a reference
to this landmark identifier.
*/
-QLandmarkId &QLandmarkId::operator=(const QLandmarkId &other)
+QLandmarkId &QLandmarkId::operator=(const QLandmarkId & other)
{
d = other.d;
return *this;
diff --git a/src/location/qlandmarkid_p.h b/src/location/qlandmarkid_p.h
index d3f15a3290..55bfbb3530 100644
--- a/src/location/qlandmarkid_p.h
+++ b/src/location/qlandmarkid_p.h
@@ -62,19 +62,16 @@ class QLandmarkIdPrivate : public QSharedData
{
public:
QLandmarkIdPrivate()
- : QSharedData()
- {
+ : QSharedData() {
}
QLandmarkIdPrivate(const QLandmarkIdPrivate &other)
- : QSharedData(other),
- m_id(other.m_id),
- m_databaseName(other.m_databaseName)
- {
+ : QSharedData(other),
+ m_id(other.m_id),
+ m_databaseName(other.m_databaseName) {
}
- ~QLandmarkIdPrivate()
- {
+ ~QLandmarkIdPrivate() {
}
QString m_id;
diff --git a/src/location/qlandmarkmanager.cpp b/src/location/qlandmarkmanager.cpp
index bf6c8b6ee6..fa68b9b325 100644
--- a/src/location/qlandmarkmanager.cpp
+++ b/src/location/qlandmarkmanager.cpp
@@ -90,7 +90,7 @@ QTM_USE_NAMESPACE
If an empty \a managerName is specified, the default implementation for the platform will be used.
*/
-QLandmarkManager::QLandmarkManager(const QString &managerName, const QMap<QString,QString> &parameters, QObject *parent)
+QLandmarkManager::QLandmarkManager(const QString &managerName, const QMap<QString, QString> &parameters, QObject *parent)
{
//TODO: implement
}
@@ -159,7 +159,7 @@ bool QLandmarkManager::saveLandmark(QLandmark *landmark)
(and become an invalid identifier).
*/
bool QLandmarkManager::saveLandmarks(QList<QLandmark> *landmarks,
- QMap<int, QLandmarkManager::Error> *errorMap )
+ QMap<int, QLandmarkManager::Error> *errorMap)
{
return false;
}
@@ -190,7 +190,7 @@ bool QLandmarkManager::removeLandmark(const QLandmarkId &landmarkId)
\sa QLandmarkManager::removeLandmark()
*/
bool QLandmarkManager::removeLandmarks(const QList<QLandmarkId> &landmarkIds,
- QMap<int, QLandmarkManager::Error> *errorMap)
+ QMap<int, QLandmarkManager::Error> *errorMap)
{
return false;
}
@@ -270,7 +270,7 @@ QLandmark QLandmarkManager::landmark(const QLandmarkId &landmarkId) const
/*!
Returns a list of landmarks which match the given \a filter and are sorted according to the \a sortOrders.
*/
-QList<QLandmark> QLandmarkManager::landmarks( const QLandmarkFilter &filter, const QList<QLandmarkSortOrder> &sortOrders) const
+QList<QLandmark> QLandmarkManager::landmarks(const QLandmarkFilter &filter, const QList<QLandmarkSortOrder> &sortOrders) const
{
return QList<QLandmark>();
}
@@ -288,8 +288,8 @@ QList<QLandmark> QLandmarkManager::landmarks(const QList<QLandmarkId> &landmarkI
Returns a list of landmark identifiers of landmarks that match the given \a filter, sorted
according to the given \a sortOrders.
*/
-QList<QLandmarkId> QLandmarkManager::landmarkIds( const QLandmarkFilter &filter,
- const QList<QLandmarkSortOrder> &sortOrders) const
+QList<QLandmarkId> QLandmarkManager::landmarkIds(const QLandmarkFilter &filter,
+ const QList<QLandmarkSortOrder> &sortOrders) const
{
return QList<QLandmarkId>(); //TODO: implement
}
diff --git a/src/location/qlandmarkmanager.h b/src/location/qlandmarkmanager.h
index b8c8e71ebf..c761583d70 100644
--- a/src/location/qlandmarkmanager.h
+++ b/src/location/qlandmarkmanager.h
@@ -67,7 +67,7 @@ class Q_LOCATION_EXPORT QLandmarkManager: public QObject
Q_OBJECT
public:
enum Error {
- NoError =0,
+ NoError = 0,
DoesNotExistError,
AlreadyExistsError,
LockedError,
@@ -77,15 +77,15 @@ public:
NotSupportedError,
BadArgumentError,
UnknownError,
- };
+ };
- enum Format{LandmarkExchange, GPSExchange, KeyholeMarkupLanguage, CommaSeparatedValues, Custom};
+ enum Format {LandmarkExchange, GPSExchange, KeyholeMarkupLanguage, CommaSeparatedValues, Custom};
#ifdef Q_QDOC
- QLandmarkManager(const QString &managerName = QString(), const QMap<QString,QString> &parameters=0, QObject *parent =0);
+ QLandmarkManager(const QString &managerName = QString(), const QMap<QString, QString> &parameters = 0, QObject *parent = 0);
QLandmarkManager(const QString& managerName, int implementationVersion, const QMap<QString, QString>& parameters = 0, QObject* parent = 0);
#else
- QLandmarkManager(const QString &managerName = QString(), const QMap<QString, QString>& parameters = (QMap<QString, QString>()), QObject *parent =0);
+ QLandmarkManager(const QString &managerName = QString(), const QMap<QString, QString>& parameters = (QMap<QString, QString>()), QObject *parent = 0);
QLandmarkManager(const QString& managerName, int implementationVersion, const QMap<QString, QString>& parameters = (QMap<QString, QString>()), QObject* parent = 0);
#endif
virtual ~QLandmarkManager();
@@ -118,7 +118,7 @@ public:
bool isFilterSupported(QLandmarkFilter::FilterType filterType) const;
QString managerName() const;
- QMap<QString,QString> managerParameters() const;
+ QMap<QString, QString> managerParameters() const;
QString managerUri() const;
int managerVersion() const;
diff --git a/src/location/qlandmarkmanagerengine.cpp b/src/location/qlandmarkmanagerengine.cpp
index a45c833308..ee1cb5c578 100644
--- a/src/location/qlandmarkmanagerengine.cpp
+++ b/src/location/qlandmarkmanagerengine.cpp
@@ -125,8 +125,8 @@ QList<QLandmarkCategoryId> QLandmarkManagerEngine::categoryIds(QLandmarkManager:
Any errors encountered are:stored in \a error and \a errorString.
*/
-QLandmark QLandmarkManagerEngine::landmark(const QLandmarkId &landmarkId,QLandmarkManager::Error *error,
- QString *errorString) const
+QLandmark QLandmarkManagerEngine::landmark(const QLandmarkId &landmarkId, QLandmarkManager::Error *error,
+ QString *errorString) const
{
return QLandmark();
}
@@ -141,8 +141,8 @@ QLandmark QLandmarkManagerEngine::landmark(const QLandmarkId &landmarkId,QLandma
Overall operation errors are stored in \a error and \a errorString.
*/
-QList<QLandmark> QLandmarkManagerEngine::landmarks(const QList<QLandmarkId> &landmarkIds,QMap<int, QLandmarkManager::Error> *errorMap, QLandmarkManager::Error *error,
- QString *errorString) const
+QList<QLandmark> QLandmarkManagerEngine::landmarks(const QList<QLandmarkId> &landmarkIds, QMap<int, QLandmarkManager::Error> *errorMap, QLandmarkManager::Error *error,
+ QString *errorString) const
{
return QList<QLandmark>();
}
@@ -152,8 +152,8 @@ QList<QLandmark> QLandmarkManagerEngine::landmarks(const QList<QLandmarkId> &lan
Overall operation errors are stored in \a error and \a errorString.
*/
-QList<QLandmark> QLandmarkManagerEngine::landmarks( const QLandmarkFilter &filter, const QList<QLandmarkSortOrder> &sortOrders,
- QLandmarkManager::Error *error, QString *errorString) const
+QList<QLandmark> QLandmarkManagerEngine::landmarks(const QLandmarkFilter &filter, const QList<QLandmarkSortOrder> &sortOrders,
+ QLandmarkManager::Error *error, QString *errorString) const
{
return QList<QLandmark>();
}
@@ -164,7 +164,7 @@ QList<QLandmark> QLandmarkManagerEngine::landmarks( const QLandmarkFilter &filte
Any errors encountered are stored in \a error and \a errorString.
*/
QLandmarkCategory QLandmarkManagerEngine::category(const QLandmarkCategoryId &categoryId,
- QLandmarkManager::Error *error, QString *errorString) const
+ QLandmarkManager::Error *error, QString *errorString) const
{
return QLandmarkCategory();
}
@@ -175,7 +175,7 @@ QLandmarkCategory QLandmarkManagerEngine::category(const QLandmarkCategoryId &ca
Overall operation errors are stored in \a error and \a errorString.
*/
QList<QLandmarkCategory> QLandmarkManagerEngine::categories(const QList<QLandmarkCategoryId> &landmarkCategoryIds,
- QLandmarkManager::Error *error, QString *errorString)
+ QLandmarkManager::Error *error, QString *errorString)
{
return QList<QLandmarkCategory>();
}
@@ -210,7 +210,7 @@ QList<QLandmarkCategory> QLandmarkManagerEngine::categories(const QList<QLandmar
\a error and \a errorString.
*/
bool QLandmarkManagerEngine::saveLandmark(QLandmark* landmark,
- QLandmarkManager::Error *error, QString *errorString)
+ QLandmarkManager::Error *error, QString *errorString)
{
return false;
}
@@ -243,7 +243,7 @@ bool QLandmarkManagerEngine::saveLandmark(QLandmark* landmark,
\sa QLandmarkManagerEngine::saveLandmark()
*/
bool QLandmarkManagerEngine::saveLandmarks(QList<QLandmark> * landmarks, QMap<int, QLandmarkManager::Error> *errorMap,
- QLandmarkManager::Error *error, QString *errorString)
+ QLandmarkManager::Error *error, QString *errorString)
{
return false;
}
@@ -284,11 +284,11 @@ bool QLandmarkManagerEngine::removeLandmark(const QLandmarkId &landmarkId, QLand
\sa QLandmarkManagerEngine::removeLandmark()
*/
- bool QLandmarkManagerEngine::removeLandmarks(QList<QLandmarkId> &landmarkIds, QMap<int, QLandmarkManager::Error> *errorMap,
- QLandmarkManager::Error *error, QString *errorString)
- {
+bool QLandmarkManagerEngine::removeLandmarks(QList<QLandmarkId> &landmarkIds, QMap<int, QLandmarkManager::Error> *errorMap,
+ QLandmarkManager::Error *error, QString *errorString)
+{
return false;
- }
+}
/*!
Adds the given \a category to the datastore if \a category has a
@@ -316,7 +316,7 @@ bool QLandmarkManagerEngine::removeLandmark(const QLandmarkId &landmarkId, QLand
\a errorString.
*/
bool QLandmarkManagerEngine::saveCategory(QLandmarkCategory* category,
- QLandmarkManager::Error *error, QString *errorString)
+ QLandmarkManager::Error *error, QString *errorString)
{
return false;
}
@@ -336,7 +336,7 @@ bool QLandmarkManagerEngine::saveCategory(QLandmarkCategory* category,
\a errorString.
*/
bool QLandmarkManagerEngine::removeCategory(const QLandmarkCategoryId &categoryId,
- QLandmarkManager::Error *error, QString *errorString)
+ QLandmarkManager::Error *error, QString *errorString)
{
return false;
}
@@ -352,7 +352,7 @@ bool QLandmarkManagerEngine::removeCategory(const QLandmarkCategoryId &categoryI
\a errorString.
*/
bool QLandmarkManagerEngine::importLandmarks(QIODevice *device, QLandmarkManager::Format format,
- QLandmarkManager::Error *error, QString *errorString)
+ QLandmarkManager::Error *error, QString *errorString)
{
return false;
}
@@ -371,7 +371,7 @@ bool QLandmarkManagerEngine::importLandmarks(QIODevice *device, QLandmarkManager
\a errorString.
*/
bool QLandmarkManagerEngine::exportLandmarks(QIODevice *device, QLandmarkManager::Format format, QList<QLandmarkId> landmarkIds,
- QLandmarkManager::Error *error, QString *errorString)
+ QLandmarkManager::Error *error, QString *errorString)
{
return false;
}
@@ -451,17 +451,17 @@ bool QLandmarkManagerEngine::waitForRequestFinished(QLandmarkAbstractRequest* re
categoriesChanged(), categoriesRemoved()
*/
- /*!
- \fn QLandmarkManagerEngine::landmarksAdded(const QList<QLandmarkId> &landmarkIds)
+/*!
+ \fn QLandmarkManagerEngine::landmarksAdded(const QList<QLandmarkId> &landmarkIds)
- This signal is emitted some time after a set of landmarks has been added
- (and where the \l dataChanged() signal was not emitted for those
- changes). As it is possible that other processes(or other devices) may
- have added the landmarks, the exact timing cannot be determined.
+ This signal is emitted some time after a set of landmarks has been added
+ (and where the \l dataChanged() signal was not emitted for those
+ changes). As it is possible that other processes(or other devices) may
+ have added the landmarks, the exact timing cannot be determined.
- There may be one or more landmark identifiers in the \a landmarkIds list.
+ There may be one or more landmark identifiers in the \a landmarkIds list.
- \sa dataChanged()
+ \sa dataChanged()
*/
/*!
@@ -491,17 +491,17 @@ bool QLandmarkManagerEngine::waitForRequestFinished(QLandmarkAbstractRequest* re
\sa dataChanged()
*/
- /*!
- \fn QLandmarkManagerEngine::categoriesAdded(const QList<QLandmarkCategoryId> &categoryIds)
+/*!
+ \fn QLandmarkManagerEngine::categoriesAdded(const QList<QLandmarkCategoryId> &categoryIds)
- This signal is emitted some time after a set of categories has been added
- (and where the \l dataChanged() signal was not emitted for those
- changes). As it is possible that other processes(or other devices) may
- have added the landmarks, the exact timing cannot be determined.
+ This signal is emitted some time after a set of categories has been added
+ (and where the \l dataChanged() signal was not emitted for those
+ changes). As it is possible that other processes(or other devices) may
+ have added the landmarks, the exact timing cannot be determined.
- There may be one or more category identifiers in the \a categoryIds list.
+ There may be one or more category identifiers in the \a categoryIds list.
- \sa dataChanged()
+ \sa dataChanged()
*/
/*!
@@ -552,8 +552,8 @@ void QLandmarkManagerEngine::updateRequestState(QLandmarkAbstractRequest *req, Q
also be emitted from the request.
*/
void QLandmarkManagerEngine::updateLandmarkIdFetchRequest(QLandmarkIdFetchRequest* req, const QList<QLandmarkId>& result,
- QLandmarkManager::Error error, const QString &errorString,
- QLandmarkAbstractRequest::State newState)
+ QLandmarkManager::Error error, const QString &errorString,
+ QLandmarkAbstractRequest::State newState)
{
}
@@ -569,7 +569,7 @@ void QLandmarkManagerEngine::updateLandmarkIdFetchRequest(QLandmarkIdFetchReques
also be emitted from the request.
*/
void QLandmarkManagerEngine::updateLandmarkRemoveRequest(QLandmarkRemoveRequest* req, QLandmarkManager::Error error, const QString &errorString,
- const QMap<int, QLandmarkManager::Error>& errorMap, QLandmarkAbstractRequest::State newState)
+ const QMap<int, QLandmarkManager::Error>& errorMap, QLandmarkAbstractRequest::State newState)
{
}
@@ -585,7 +585,7 @@ void QLandmarkManagerEngine::updateLandmarkRemoveRequest(QLandmarkRemoveRequest*
also be emitted from the request.
*/
void QLandmarkManagerEngine::updateLandmarkSaveRequest(QLandmarkSaveRequest* req, const QList<QLandmark>& result, QLandmarkManager::Error error,
- const QString &errorString, const QMap<int, QLandmarkManager::Error>& errorMap, QLandmarkAbstractRequest::State newState)
+ const QString &errorString, const QMap<int, QLandmarkManager::Error>& errorMap, QLandmarkAbstractRequest::State newState)
{
}
@@ -601,8 +601,8 @@ void QLandmarkManagerEngine::updateLandmarkSaveRequest(QLandmarkSaveRequest* req
also be emitted from the request.
*/
void QLandmarkManagerEngine::updateLandmarkCategoryIdFetchRequest(QLandmarkCategoryIdFetchRequest* req, const QList<QLandmarkCategoryId>& result,
- QLandmarkManager::Error error, const QString &errorString,
- QLandmarkAbstractRequest::State newState)
+ QLandmarkManager::Error error, const QString &errorString,
+ QLandmarkAbstractRequest::State newState)
{
}
@@ -619,7 +619,7 @@ void QLandmarkManagerEngine::updateLandmarkCategoryIdFetchRequest(QLandmarkCateg
also be emitted from the request.
*/
void QLandmarkManagerEngine::updateLandmarkCategoryRemoveRequest(QLandmarkCategoryRemoveRequest* req, QLandmarkManager::Error error, const QString &errorString,
- const QMap<int, QLandmarkManager::Error>& errorMap, QLandmarkAbstractRequest::State newState)
+ const QMap<int, QLandmarkManager::Error>& errorMap, QLandmarkAbstractRequest::State newState)
{
}
@@ -635,7 +635,7 @@ void QLandmarkManagerEngine::updateLandmarkCategoryRemoveRequest(QLandmarkCatego
also be emitted from the request.
*/
void QLandmarkManagerEngine::updateLandmarkCategorySaveRequest(QLandmarkCategorySaveRequest* req, const QList<QLandmarkCategory>& result, QLandmarkManager::Error error,
- const QString &errorString, const QMap<int, QLandmarkManager::Error>& errorMap, QLandmarkAbstractRequest::State newState)
+ const QString &errorString, const QMap<int, QLandmarkManager::Error>& errorMap, QLandmarkAbstractRequest::State newState)
{
}
@@ -650,7 +650,7 @@ void QLandmarkManagerEngine::updateLandmarkCategorySaveRequest(QLandmarkCategory
also be emitted from the request.
*/
void QLandmarkManagerEngine::updateLandmarkImportRequest(QLandmarkImportRequest *req, QLandmarkManager::Error error, const QString &errorString,
- QLandmarkAbstractRequest::State newState)
+ QLandmarkAbstractRequest::State newState)
{
}
@@ -665,7 +665,7 @@ void QLandmarkManagerEngine::updateLandmarkImportRequest(QLandmarkImportRequest
also be emitted from the request.
*/
void QLandmarkManagerEngine::updateLandmarkExportRequest(QLandmarkExportRequest *req, QLandmarkManager::Error error, const QString &errorString,
- QLandmarkAbstractRequest::State newState)
+ QLandmarkAbstractRequest::State newState)
{
}
diff --git a/src/location/qlandmarkmanagerengine.h b/src/location/qlandmarkmanagerengine.h
index d0cc161a99..6906a56902 100644
--- a/src/location/qlandmarkmanagerengine.h
+++ b/src/location/qlandmarkmanagerengine.h
@@ -75,51 +75,51 @@ public:
/* URI reporting */
virtual QString managerName() const; // e.g. "com.nokia.qt.landmarks.engines.s60"
virtual QMap<QString, QString> managerParameters() const; // e.g. "filename=private.db"
- virtual int managerVersion() const =0;
+ virtual int managerVersion() const = 0;
QString managerUri() const;
/* Filtering */
virtual QList<QLandmarkId> landmarkIds(const QLandmarkFilter& filter, const QList<QLandmarkSortOrder>& sortOrders,
- QLandmarkManager::Error *error, QString *errorString) const =0;
+ QLandmarkManager::Error *error, QString *errorString) const = 0;
virtual QList<QLandmarkCategoryId> categoryIds(QLandmarkManager::Error *error,
- QString *errorString) const =0;
+ QString *errorString) const = 0;
/* Retrieval */
- virtual QLandmark landmark(const QLandmarkId &landmarkId,QLandmarkManager::Error *error,
- QString *errorString) const;
+ virtual QLandmark landmark(const QLandmarkId &landmarkId, QLandmarkManager::Error *error,
+ QString *errorString) const;
virtual QList<QLandmark> landmarks(const QLandmarkFilter &filter, const QList<QLandmarkSortOrder>& sortOrders,
- QLandmarkManager::Error *error, QString *errorString) const = 0;
+ QLandmarkManager::Error *error, QString *errorString) const = 0;
virtual QList<QLandmark> landmarks(const QList<QLandmarkId> &landmarkIds, QMap<int, QLandmarkManager::Error> *errorMap, QLandmarkManager::Error *error,
- QString *errorString) const = 0;
- virtual QLandmarkCategory category(const QLandmarkCategoryId &landmarkCategoryId,QLandmarkManager::Error *error,
- QString *errorString ) const =0;
+ QString *errorString) const = 0;
+ virtual QLandmarkCategory category(const QLandmarkCategoryId &landmarkCategoryId, QLandmarkManager::Error *error,
+ QString *errorString) const = 0;
virtual QList<QLandmarkCategory> categories(const QList<QLandmarkCategoryId> &landmarkCategoryIds, QLandmarkManager::Error *error,
- QString *errorString);
+ QString *errorString);
/*saving and removing*/
virtual bool saveLandmark(QLandmark* landmark, QLandmarkManager::Error *error, QString *errorString);
virtual bool saveLandmarks(QList<QLandmark> * landmark, QMap<int, QLandmarkManager::Error> *errorMap,
- QLandmarkManager::Error *error, QString *errorString);
+ QLandmarkManager::Error *error, QString *errorString);
virtual bool removeLandmark(const QLandmarkId &landmarkId, QLandmarkManager::Error *error, QString *errorString);
virtual bool removeLandmarks(QList<QLandmarkId> &landmarkId, QMap<int, QLandmarkManager::Error> *errorMap, QLandmarkManager::Error *error,
- QString *errorString);
+ QString *errorString);
virtual bool saveCategory(QLandmarkCategory* category, QLandmarkManager::Error *error, QString *errorString);
virtual bool removeCategory(const QLandmarkCategoryId &categoryId, QLandmarkManager::Error *error, QString *errorString);
virtual bool importLandmarks(QIODevice *device, QLandmarkManager::Format format, QLandmarkManager::Error *error,
- QString *errorString);
+ QString *errorString);
virtual bool exportLandmarks(QIODevice *device, QLandmarkManager::Format format, QList<QLandmarkId> landmarkIds,
- QLandmarkManager::Error *error, QString *errorString);
+ QLandmarkManager::Error *error, QString *errorString);
- virtual bool isFilterSupported(QLandmarkFilter::FilterType filterType) const =0;
+ virtual bool isFilterSupported(QLandmarkFilter::FilterType filterType) const = 0;
/* Asynchronous Request Support */
- virtual void requestDestroyed(QLandmarkAbstractRequest* request)=0;
- virtual bool startRequest(QLandmarkAbstractRequest* request)=0;
- virtual bool cancelRequest(QLandmarkAbstractRequest* request)=0;
- virtual bool waitForRequestFinished(QLandmarkAbstractRequest* request, int msecs)=0;
+ virtual void requestDestroyed(QLandmarkAbstractRequest* request) = 0;
+ virtual bool startRequest(QLandmarkAbstractRequest* request) = 0;
+ virtual bool cancelRequest(QLandmarkAbstractRequest* request) = 0;
+ virtual bool waitForRequestFinished(QLandmarkAbstractRequest* request, int msecs) = 0;
Q_SIGNALS:
void dataChanged();
@@ -134,18 +134,18 @@ Q_SIGNALS:
protected:
static void updateRequestState(QLandmarkAbstractRequest *req, QLandmarkAbstractRequest::State state);
static void updateLandmarkIdFetchRequest(QLandmarkIdFetchRequest* req, const QList<QLandmarkId>& result,
- QLandmarkManager::Error error, const QString &errorString, QLandmarkAbstractRequest::State newState);
+ QLandmarkManager::Error error, const QString &errorString, QLandmarkAbstractRequest::State newState);
static void updateLandmarkRemoveRequest(QLandmarkRemoveRequest* req, QLandmarkManager::Error error, const QString &errorString,
- const QMap<int, QLandmarkManager::Error>& errorMap, QLandmarkAbstractRequest::State newState);
+ const QMap<int, QLandmarkManager::Error>& errorMap, QLandmarkAbstractRequest::State newState);
static void updateLandmarkSaveRequest(QLandmarkSaveRequest* req, const QList<QLandmark>& result, QLandmarkManager::Error error,
- const QString &errorString, const QMap<int, QLandmarkManager::Error>& errorMap, QLandmarkAbstractRequest::State newState);
+ const QString &errorString, const QMap<int, QLandmarkManager::Error>& errorMap, QLandmarkAbstractRequest::State newState);
static void updateLandmarkCategoryIdFetchRequest(QLandmarkCategoryIdFetchRequest *req, const QList<QLandmarkCategoryId>& result,
- QLandmarkManager::Error error, const QString &errorString, QLandmarkAbstractRequest::State newState);
+ QLandmarkManager::Error error, const QString &errorString, QLandmarkAbstractRequest::State newState);
static void updateLandmarkCategoryRemoveRequest(QLandmarkCategoryRemoveRequest *req, QLandmarkManager::Error error, const QString &errorString,
- const QMap<int, QLandmarkManager::Error>& errorMap, QLandmarkAbstractRequest::State newState);
+ const QMap<int, QLandmarkManager::Error>& errorMap, QLandmarkAbstractRequest::State newState);
static void updateLandmarkCategorySaveRequest(QLandmarkCategorySaveRequest *req, const QList<QLandmarkCategory>& result, QLandmarkManager::Error error,
- const QString &errorString, const QMap<int, QLandmarkManager::Error>& errorMap, QLandmarkAbstractRequest::State newState);
+ const QString &errorString, const QMap<int, QLandmarkManager::Error>& errorMap, QLandmarkAbstractRequest::State newState);
static void updateLandmarkImportRequest(QLandmarkImportRequest *req, QLandmarkManager::Error error, const QString &errorString,
QLandmarkAbstractRequest::State newState);
static void updateLandmarkExportRequest(QLandmarkExportRequest *req, QLandmarkManager::Error error, const QString &errorString,
diff --git a/src/location/qlandmarkmanagerenginefactory.cpp b/src/location/qlandmarkmanagerenginefactory.cpp
index 7fc1e52e35..a1bf65ccb6 100644
--- a/src/location/qlandmarkmanagerenginefactory.cpp
+++ b/src/location/qlandmarkmanagerenginefactory.cpp
@@ -96,6 +96,6 @@ QList<int> QLandmarkManagerEngineFactory::supportedImplementationVersions() cons
invalid QLandmarkManager in return. Errors are stored in \a error and \a errorString.
*/
- QTM_END_NAMESPACE
+QTM_END_NAMESPACE
diff --git a/src/location/qlandmarkmanagerenginefactory.h b/src/location/qlandmarkmanagerenginefactory.h
index 4700a777e7..fe5fd91bd8 100644
--- a/src/location/qlandmarkmanagerenginefactory.h
+++ b/src/location/qlandmarkmanagerenginefactory.h
@@ -54,10 +54,10 @@ class Q_LOCATION_EXPORT QLandmarkManagerEngineFactory
public:
virtual QList<int> supportedImplementationVersions() const;
virtual ~QLandmarkManagerEngineFactory();
- virtual QLandmarkManagerEngine *engine(const QMap<QString,QString> &parameters,
+ virtual QLandmarkManagerEngine *engine(const QMap<QString, QString> &parameters,
QLandmarkManager::Error *error,
QString *errorString) = 0;
- virtual QString managerName() const =0;
+ virtual QString managerName() const = 0;
};
QTM_END_NAMESPACE
diff --git a/src/location/qlandmarkproximityfilter.cpp b/src/location/qlandmarkproximityfilter.cpp
index 7e4e344ee9..389e59e4c0 100644
--- a/src/location/qlandmarkproximityfilter.cpp
+++ b/src/location/qlandmarkproximityfilter.cpp
@@ -57,16 +57,16 @@ public:
};
QLandmarkProximityFilterPrivate::QLandmarkProximityFilterPrivate()
- : QLandmarkFilterPrivate(),
- coordinate(QGeoCoordinate()),
- radius(0.0)
+ : QLandmarkFilterPrivate(),
+ coordinate(QGeoCoordinate()),
+ radius(0.0)
{
}
QLandmarkProximityFilterPrivate::QLandmarkProximityFilterPrivate(const QLandmarkProximityFilterPrivate &other)
- : QLandmarkFilterPrivate(other),
- coordinate(other.coordinate),
- radius(other.radius)
+ : QLandmarkFilterPrivate(other),
+ coordinate(other.coordinate),
+ radius(other.radius)
{
}
@@ -86,7 +86,7 @@ QLandmarkProximityFilterPrivate::~QLandmarkProximityFilterPrivate()
a central \a coordinate.
*/
QLandmarkProximityFilter::QLandmarkProximityFilter(const QGeoCoordinate &coordinate, double radius)
- : QLandmarkFilter(*new QLandmarkProximityFilterPrivate)
+ : QLandmarkFilter(*new QLandmarkProximityFilterPrivate)
{
Q_UNUSED(coordinate);
Q_UNUSED(radius);
diff --git a/src/location/qlandmarksortorder.h b/src/location/qlandmarksortorder.h
index 7498172396..01aad85150 100644
--- a/src/location/qlandmarksortorder.h
+++ b/src/location/qlandmarksortorder.h
@@ -59,7 +59,7 @@ class Q_LOCATION_EXPORT QLandmarkSortOrder
public:
QLandmarkSortOrder();
- enum SortType{InvalidSort, NameSort, DistanceSort, CustomSort=500};
+ enum SortType {InvalidSort, NameSort, DistanceSort, CustomSort = 500};
SortType type() const;
Qt::SortOrder direction() const;
diff --git a/src/location/qlandmarkunionfilter.cpp b/src/location/qlandmarkunionfilter.cpp
index eb13b3b30b..2c6f5f1010 100644
--- a/src/location/qlandmarkunionfilter.cpp
+++ b/src/location/qlandmarkunionfilter.cpp
@@ -55,13 +55,13 @@ public:
};
QLandmarkUnionFilterPrivate::QLandmarkUnionFilterPrivate()
- : QLandmarkFilterPrivate()
+ : QLandmarkFilterPrivate()
{
}
QLandmarkUnionFilterPrivate::QLandmarkUnionFilterPrivate(const QLandmarkUnionFilterPrivate &other)
- : QLandmarkFilterPrivate(other),
- filters(other.filters)
+ : QLandmarkFilterPrivate(other),
+ filters(other.filters)
{
}
@@ -83,7 +83,7 @@ QLandmarkUnionFilterPrivate::~QLandmarkUnionFilterPrivate()
Constructs a new union filter.
*/
QLandmarkUnionFilter::QLandmarkUnionFilter()
- : QLandmarkFilter(*new QLandmarkUnionFilterPrivate)
+ : QLandmarkFilter(*new QLandmarkUnionFilterPrivate)
{
}
diff --git a/src/location/qlocationutils_p.h b/src/location/qlocationutils_p.h
index f705afc9cf..48acf4d0df 100644
--- a/src/location/qlocationutils_p.h
+++ b/src/location/qlocationutils_p.h
@@ -98,7 +98,6 @@ public:
lat-long values. Fails if lat or long fail isValidLat() or isValidLong().
*/
Q_AUTOTEST_EXPORT static bool getNmeaLatLong(const QByteArray &latString, char latDirection, const QByteArray &lngString, char lngDirection, double *lat, double *lon);
-
};
QTM_END_NAMESPACE
diff --git a/src/location/qmaneuver.cpp b/src/location/qmaneuver.cpp
index 49d5649cc0..fe6d87e46c 100644
--- a/src/location/qmaneuver.cpp
+++ b/src/location/qmaneuver.cpp
@@ -1,73 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
#include "qmaneuver.h"
+#include "qmaneuver_p.h"
QTM_BEGIN_NAMESPACE
/*!
\class QManeuver
- \brief The QManeuver class represents the maneuver component of a QRouteReply.
+ \brief The QManeuver class represents the maneuver component of a QGeoRouteReply.
\ingroup location
This class represents a maneuver as part of a route reply.
- \sa QRouteReply
+ \sa QGeoRouteReply
*/
/*!
Default constructor.
*/
-QManeuver::QManeuver() : dur(0), dist(0), traffDir(0), icn(0) {}
+QManeuver::QManeuver()
+ : d_ptr(new QManeuverPrivate()) {}
/*!
Constructs a QManeuver from \a maneuver.
*/
QManeuver::QManeuver(const QManeuver& maneuver)
- : wPoints(maneuver.wPoints), mPoints(maneuver.mPoints)
-{
- descr = maneuver.descr;
- act = maneuver.act;
- dist = maneuver.dist;
- dur = maneuver.dur;
- trn = maneuver.trn;
- stName = maneuver.stName;
- rtName = maneuver.rtName;
- nxtStreetName = maneuver.nxtStreetName;
- sgnPost = maneuver.sgnPost;
- traffDir = maneuver.traffDir;
- icn = maneuver.icn;
-}
+ : d_ptr(new QManeuverPrivate(*(maneuver.d_ptr))) {}
/*!
-* Assignment operator.
-* @param maneuver The maneuver to be assigned from.
-* @return A reference to this maneuver.
+ Assignment operator.
*/
QManeuver& QManeuver::operator=(const QManeuver & maneuver)
{
- wPoints = maneuver.wPoints;
- mPoints = maneuver.mPoints;
-
- descr = maneuver.descr;
- act = maneuver.act;
- dist = maneuver.dist;
- dur = maneuver.dur;
- trn = maneuver.trn;
- stName = maneuver.stName;
- rtName = maneuver.rtName;
- nxtStreetName = maneuver.nxtStreetName;
- sgnPost = maneuver.sgnPost;
- traffDir = maneuver.traffDir;
- icn = maneuver.icn;
-
+ *d_ptr = *(maneuver.d_ptr);
return *this;
}
/*!
+ Destructor
+*/
+QManeuver::~QManeuver()
+{
+ Q_D(QManeuver);
+ delete d;
+}
+
+/*!
Returns a textual representation of the maneuver that has to be performed to follow the route.
*/
QString QManeuver::description() const
{
- return descr;
+ Q_D(const QManeuver);
+ return d->description;
+}
+
+/*!
+ Sets the textual representation of the maneuver to be performed to \a description.
+*/
+void QManeuver::setDescription(const QString &description)
+{
+ Q_D(QManeuver);
+ d->description = description;
}
/*!
@@ -76,15 +108,35 @@ QString QManeuver::description() const
QString QManeuver::action() const
{
- return act;
+ Q_D(const QManeuver);
+ return d->action;
}
+
/*!
- Returns the distance that is covered by this single maneuver in meters.
+ Sets the essential action which has to be taken to \a action.
*/
+void QManeuver::setAction(const QString &action)
+{
+ Q_D(QManeuver);
+ d->action = action;
+}
+/*!
+ Returns the distance that is covered by this single maneuver in meters.
+*/
quint32 QManeuver::distance() const
{
- return dist;
+ Q_D(const QManeuver);
+ return d->distance;
+}
+
+/*!
+ Sets the distance that is covered by this maneuver to \a distance metres.
+*/
+void QManeuver::setDistance(quint32 distance)
+{
+ Q_D(QManeuver);
+ d->distance = distance;
}
/*!
@@ -93,7 +145,17 @@ quint32 QManeuver::distance() const
*/
qint32 QManeuver::duration() const
{
- return dur;
+ Q_D(const QManeuver);
+ return d->duration;
+}
+
+/*!
+ Sets the estimated duration of the maneuver to \a duration.
+*/
+void QManeuver::setDuration(qint32 duration)
+{
+ Q_D(QManeuver);
+ d->duration = duration;
}
/*!
@@ -101,7 +163,17 @@ qint32 QManeuver::duration() const
*/
QString QManeuver::turn() const
{
- return trn;
+ Q_D(const QManeuver);
+ return d->turn;
+}
+
+/*!
+ Sets the turn to be taken to \a turn;
+*/
+void QManeuver::setTurn(const QString &turn)
+{
+ Q_D(QManeuver);
+ d->turn = turn;
}
/*!
@@ -109,7 +181,17 @@ QString QManeuver::turn() const
*/
QString QManeuver::streetName() const
{
- return stName;
+ Q_D(const QManeuver);
+ return d->streetName;
+}
+
+/*!
+ Sets the name of the street involved in this maneuver to \a streetName.
+*/
+void QManeuver::setStreetName(const QString &streetName)
+{
+ Q_D(QManeuver);
+ d->streetName = streetName;
}
/*!
@@ -117,7 +199,17 @@ QString QManeuver::streetName() const
*/
QString QManeuver::routeName() const
{
- return rtName;
+ Q_D(const QManeuver);
+ return d->routeName;
+}
+
+/*!
+ Sets the name of the route to \a routeName;
+*/
+void QManeuver::setRouteName(const QString &routeName)
+{
+ Q_D(QManeuver);
+ d->routeName = routeName;
}
/*!
@@ -125,7 +217,17 @@ QString QManeuver::routeName() const
*/
QString QManeuver::nextStreetName() const
{
- return nxtStreetName;
+ Q_D(const QManeuver);
+ return d->nextStreetName;
+}
+
+/*!
+ Sets the name of the next street to \a nextStreetName.
+*/
+void QManeuver::setNextStreetName(const QString &nextStreetName)
+{
+ Q_D(QManeuver);
+ d->nextStreetName = nextStreetName;
}
/*!
@@ -133,7 +235,17 @@ QString QManeuver::nextStreetName() const
*/
QString QManeuver::signPost() const
{
- return sgnPost;
+ Q_D(const QManeuver);
+ return d->signPost;
+}
+
+/*!
+ Sets the sign post to \a signPost.
+*/
+void QManeuver::setSignPost(const QString &signPost)
+{
+ Q_D(QManeuver);
+ d->signPost = signPost;
}
/*!
@@ -141,7 +253,17 @@ QString QManeuver::signPost() const
*/
qint64 QManeuver::trafficDirection() const
{
- return traffDir;
+ Q_D(const QManeuver);
+ return d->trafficDirection;
+}
+
+/*!
+ Sets the traffic direction to \a trafficDirection.
+*/
+void QManeuver::setTrafficDirection(qint64 trafficDirection)
+{
+ Q_D(QManeuver);
+ d->trafficDirection = trafficDirection;
}
/*!
@@ -149,7 +271,17 @@ qint64 QManeuver::trafficDirection() const
*/
qint64 QManeuver::icon() const
{
- return icn;
+ Q_D(const QManeuver);
+ return d->icon;
+}
+
+/*!
+ Sets the icon to \a icon.
+*/
+void QManeuver::setIcon(qint64 icon)
+{
+ Q_D(QManeuver);
+ d->icon = icon;
}
/*!
@@ -162,7 +294,19 @@ qint64 QManeuver::icon() const
*/
const QList<QGeoCoordinate> QManeuver::wayPoints() const
{
- return wPoints;
+ Q_D(const QManeuver);
+ return d->wayPoints;
+}
+
+/*!
+ Sets the geographical coordinates that define this part of the route in form of a 2D-polyline to \a wayPoints.
+
+ \sa wayPoints();
+*/
+void QManeuver::setWaypoints(const QList<QGeoCoordinate> &wayPoints)
+{
+ Q_D(QManeuver);
+ d->wayPoints = wayPoints;
}
/*!
@@ -174,9 +318,60 @@ const QList<QGeoCoordinate> QManeuver::wayPoints() const
*/
const QList<QGeoCoordinate> QManeuver::maneuverPoints() const
{
- return mPoints;
+ Q_D(const QManeuver);
+ return d->maneuverPoints;
}
+/*!
+ Sets the geographical coordinates that define this part of the route in form of a 2D-polyline to \a maneuverPoints.
+
+ \sa maneuverPoints()
+*/
+void QManeuver::setManeuverPoints(const QList<QGeoCoordinate> &maneuverPoints)
+{
+ Q_D(QManeuver);
+ d->maneuverPoints = maneuverPoints;
+}
+
+/*******************************************************************************
+*******************************************************************************/
+
+QManeuverPrivate::QManeuverPrivate() {}
+
+QManeuverPrivate::QManeuverPrivate(const QManeuverPrivate &mp)
+ : description(mp.description),
+ action(mp.action),
+ duration(mp.duration),
+ distance(mp.distance),
+ turn(mp.turn),
+ streetName(mp.streetName),
+ routeName(mp.routeName),
+ nextStreetName(mp.nextStreetName),
+ signPost(mp.signPost),
+ trafficDirection(mp.trafficDirection),
+ icon(mp.icon),
+ wayPoints(mp.wayPoints),
+ maneuverPoints(mp.maneuverPoints)
+{}
+
+QManeuverPrivate& QManeuverPrivate::operator =(const QManeuverPrivate & mp)
+{
+ description = mp.description;
+ action = mp.action;
+ duration = mp.duration;
+ distance = mp.distance;
+ turn = mp.turn;
+ streetName = mp.streetName;
+ routeName = mp.routeName;
+ nextStreetName = mp.nextStreetName;
+ signPost = mp.signPost;
+ trafficDirection = mp.trafficDirection;
+ icon = mp.icon;
+ wayPoints = mp.wayPoints;
+ maneuverPoints = mp.maneuverPoints;
+
+ return *this;
+}
QTM_END_NAMESPACE
diff --git a/src/location/qmaneuver.h b/src/location/qmaneuver.h
index 13eb939b9e..34f8197c02 100644
--- a/src/location/qmaneuver.h
+++ b/src/location/qmaneuver.h
@@ -49,45 +49,57 @@
QTM_BEGIN_NAMESPACE
+class QManeuverPrivate;
class Q_LOCATION_EXPORT QManeuver
{
- friend class QRouteXmlParser;
-
public:
QManeuver();
QManeuver(const QManeuver& maneuver);
QManeuver& operator=(const QManeuver& maneuver);
+ ~QManeuver();
QString description() const;
+ void setDescription(const QString &description);
+
QString action() const;
+ void setAction(const QString &action);
+
quint32 distance() const;
+ void setDistance(quint32 distance);
+
qint32 duration() const;
+ void setDuration(qint32 duration);
+
QString turn() const;
+ void setTurn(const QString &turn);
+
QString streetName() const;
+ void setStreetName(const QString &streetName);
+
QString routeName() const;
+ void setRouteName(const QString &routeName);
+
QString nextStreetName() const;
+ void setNextStreetName(const QString &nextStreetName);
+
QString signPost() const;
- qint64 trafficDirection() const;
- qint64 icon() const;
+ void setSignPost(const QString &signPost);
+
+ qint64 trafficDirection() const;
+ void setTrafficDirection(qint64 trafficDirection);
+
+ qint64 icon() const;
+ void setIcon(qint64 icon);
const QList<QGeoCoordinate> wayPoints() const;
+ void setWaypoints(const QList<QGeoCoordinate> &wayPoints);
+
const QList<QGeoCoordinate> maneuverPoints() const;
+ void setManeuverPoints(const QList<QGeoCoordinate> &maneuverPoints);
private:
- QString descr; //!< description
- QString act; //!< action
- qint32 dur; //!< duration
- quint32 dist; //!< distance
- QString trn; //!< turn
- QString stName; //!< street name
- QString rtName; //!< route name
- QString nxtStreetName; //!< next street name
- QString sgnPost; //!< sign post
- qint64 traffDir; //!< traffic directions
- qint64 icn; //!< icon
-
- QList<QGeoCoordinate> wPoints; //!< way points
- QList<QGeoCoordinate> mPoints; //!< maneuver points
+ QManeuverPrivate *d_ptr;
+ Q_DECLARE_PRIVATE(QManeuver);
};
QTM_END_NAMESPACE
diff --git a/src/location/qmaptilerequest_p.h b/src/location/qmaneuver_p.h
index a873c79629..5d0a687a90 100644
--- a/src/location/qmaptilerequest_p.h
+++ b/src/location/qmaneuver_p.h
@@ -39,32 +39,35 @@
**
****************************************************************************/
-#ifndef QLOCATION_MAPTILEREQUEST_PRIVATE_H
-#define QLOCATION_MAPTILEREQUEST_PRIVATE_H
+#ifndef QMANEUVER_P_H
+#define QMANEUVER_P_H
-#include <QString>
+#include "qgeocoordinate.h"
QTM_BEGIN_NAMESPACE
-class QMapTileRequestPrivate
+class QManeuverPrivate
{
public:
- QMapTileRequestPrivate(const MapVersion& mapVersion,
- const MapScheme& mapScheme,
- const MapResolution& mapResolution,
- const MapFormat& mapFormat);
- QMapTileRequestPrivate(const QMapTileRequestPrivate* request);
- QMapTileRequestPrivate();
+ QManeuverPrivate();
+ QManeuverPrivate(const QManeuverPrivate &mp);
+ QManeuverPrivate& operator= (const QManeuverPrivate &mp);
- quint32 cl;
- quint32 rw;
- MapVersion ver;
- quint16 zoom;
- MapScheme schm;
- MapResolution res;
- MapFormat frmt;
+ QString description;
+ QString action;
+ qint32 duration;
+ quint32 distance;
+ QString turn;
+ QString streetName;
+ QString routeName;
+ QString nextStreetName;
+ QString signPost;
+ qint64 trafficDirection;
+ qint64 icon;
+ QList<QGeoCoordinate> wayPoints;
+ QList<QGeoCoordinate> maneuverPoints;
};
QTM_END_NAMESPACE
-#endif
+#endif // QMANEUVER_P_H
diff --git a/src/location/qmapellipse.cpp b/src/location/qmapellipse.cpp
index c8a666b601..e7ac9576cb 100644
--- a/src/location/qmapellipse.cpp
+++ b/src/location/qmapellipse.cpp
@@ -46,9 +46,9 @@
QTM_BEGIN_NAMESPACE
QMapEllipsePrivate::QMapEllipsePrivate()
- :geoTopLeft(QGeoCoordinate()),
- geoBottomRight(QGeoCoordinate()),
- p(QPen()), b(QBrush())
+ : geoTopLeft(QGeoCoordinate()),
+ geoBottomRight(QGeoCoordinate()),
+ p(QPen()), b(QBrush())
{
}
@@ -66,8 +66,8 @@ QMapEllipsePrivate::QMapEllipsePrivate()
\a layerIndex.
*/
QMapEllipse::QMapEllipse(const QGeoCoordinate& topLeft, const QGeoCoordinate& bottomRight,
- const QPen& pen, const QBrush& brush, quint16 layerIndex)
- :QMapObject(*new QMapEllipsePrivate, QMapObject::EllipseObject, layerIndex)
+ const QPen& pen, const QBrush& brush, quint16 layerIndex)
+ : QMapObject(*new QMapEllipsePrivate, QMapObject::EllipseObject, layerIndex)
{
Q_D(QMapEllipse);
d->geoTopLeft = topLeft;
@@ -80,8 +80,8 @@ QMapEllipse::QMapEllipse(const QGeoCoordinate& topLeft, const QGeoCoordinate& bo
\internal
*/
QMapEllipse::QMapEllipse(QMapEllipsePrivate &dd, const QGeoCoordinate& topLeft, const QGeoCoordinate& bottomRight,
- const QPen& pen, const QBrush& brush, quint16 layerIndex)
- :QMapObject(dd, QMapObject::EllipseObject, layerIndex)
+ const QPen& pen, const QBrush& brush, quint16 layerIndex)
+ : QMapObject(dd, QMapObject::EllipseObject, layerIndex)
{
Q_D(QMapEllipse);
d->geoTopLeft = topLeft;
@@ -93,7 +93,8 @@ QMapEllipse::QMapEllipse(QMapEllipsePrivate &dd, const QGeoCoordinate& topLeft,
/*!
Returns the top left geo coordinate of the bounding box of the ellipse.
*/
-QGeoCoordinate QMapEllipse::topLeft() const {
+QGeoCoordinate QMapEllipse::topLeft() const
+{
Q_D(const QMapEllipse);
return d->geoTopLeft;
}
@@ -101,7 +102,8 @@ QGeoCoordinate QMapEllipse::topLeft() const {
/*!
Returns the bottom right geo coordinate of the bounding box of the ellipse.
*/
-QGeoCoordinate QMapEllipse::bottomRight() const {
+QGeoCoordinate QMapEllipse::bottomRight() const
+{
Q_D(const QMapEllipse);
return d->geoBottomRight;
}
@@ -109,14 +111,16 @@ QGeoCoordinate QMapEllipse::bottomRight() const {
/*!
Returns the pen used for drawing the ellipse.
*/
-QPen QMapEllipse::pen() const {
+QPen QMapEllipse::pen() const
+{
Q_D(const QMapEllipse);
return d->p;
}
/*!
* Returns the brush used for drawing the ellipse.
*/
-QBrush QMapEllipse::brush() const {
+QBrush QMapEllipse::brush() const
+{
Q_D(const QMapEllipse);
return d->b;
}
@@ -132,13 +136,13 @@ void QMapEllipse::compMapCoords()
if (p2.y() < p1.y()) {
qreal y = p2.y();
- p2.setY( p1.y() );
+ p2.setY(p1.y());
p1.setY(y);
}
//Lines will always connect points from west to east.
//If we cross the date line, we need to split.
- if ( d->geoTopLeft.longitude() > d->geoBottomRight.longitude() )
+ if (d->geoTopLeft.longitude() > d->geoBottomRight.longitude())
p2.rx() += d->mapView->mapWidth();
QRectF rect(p1, p2);
diff --git a/src/location/qmapline.cpp b/src/location/qmapline.cpp
index 4f3e307c3e..6c7fcfb9d0 100644
--- a/src/location/qmapline.cpp
+++ b/src/location/qmapline.cpp
@@ -45,8 +45,8 @@
QTM_BEGIN_NAMESPACE
QMapLinePrivate::QMapLinePrivate()
- :pt1(QGeoCoordinate()), pt2(QGeoCoordinate()),
- p(QPen()), line(QLineF())
+ : pt1(QGeoCoordinate()), pt2(QGeoCoordinate()),
+ p(QPen()), line(QLineF())
{
}
@@ -88,7 +88,8 @@ QMapLine::QMapLine(QMapLinePrivate &dd, const QGeoCoordinate& point1,
Returns the pen used for drawing this line.
*/
-QPen QMapLine::pen() const {
+QPen QMapLine::pen() const
+{
Q_D(const QMapLine);
return d->p;
}
@@ -98,7 +99,8 @@ QPen QMapLine::pen() const {
Returns the first end point (as a geo coordinate) of the line.
*/
-QGeoCoordinate QMapLine::point1() const {
+QGeoCoordinate QMapLine::point1() const
+{
Q_D(const QMapLine);
return d->pt1;
}
@@ -108,7 +110,8 @@ QGeoCoordinate QMapLine::point1() const {
Returns the second end point (as a geo coordinate) of the line.
*/
-QGeoCoordinate QMapLine::point2() const {
+QGeoCoordinate QMapLine::point2() const
+{
Q_D(const QMapLine);
return d->pt2;
}
diff --git a/src/location/qmapline.h b/src/location/qmapline.h
index 560093c081..7f99ac0da1 100644
--- a/src/location/qmapline.h
+++ b/src/location/qmapline.h
@@ -66,7 +66,7 @@ protected:
virtual void paint(QPainter* painter, const QRectF& viewPort);
QMapLine(QMapLinePrivate &dd, const QGeoCoordinate& point1,
- const QGeoCoordinate& point2, const QPen& pen = QPen(), quint16 layerIndex = 0);
+ const QGeoCoordinate& point2, const QPen& pen = QPen(), quint16 layerIndex = 0);
private:
Q_DECLARE_PRIVATE(QMapLine)
diff --git a/src/location/qmapmarker.cpp b/src/location/qmapmarker.cpp
index d4ced2f353..8da495ae67 100644
--- a/src/location/qmapmarker.cpp
+++ b/src/location/qmapmarker.cpp
@@ -50,10 +50,10 @@
QTM_BEGIN_NAMESPACE
QMapMarkerPrivate::QMapMarkerPrivate()
- : pt(QGeoCoordinate()),
- box(QRectF()), icn(QPixmap()),
- txt(QString()), txtRect(QRectF()),
- txtFont(QFont()), fColor(QColor())
+ : pt(QGeoCoordinate()),
+ box(QRectF()), icn(QPixmap()),
+ txt(QString()), txtRect(QRectF()),
+ txtFont(QFont()), fColor(QColor())
{
}
@@ -88,8 +88,7 @@ QMapMarker::QMapMarker(const QGeoCoordinate& point,
if (d->icn.isNull()) {
d->box.setHeight(MARKER_HEIGHT);
d->box.setWidth(MARKER_WIDTH);
- }
- else {
+ } else {
d->box.setHeight(d->icn.height());
d->box.setWidth(d->icn.width());
}
@@ -115,8 +114,7 @@ QMapMarker::QMapMarker(QMapMarkerPrivate &dd, const QGeoCoordinate& point,
if (d->icn.isNull()) {
d->box.setHeight(MARKER_HEIGHT);
d->box.setWidth(MARKER_WIDTH);
- }
- else {
+ } else {
d->box.setHeight(d->icn.height());
d->box.setWidth(d->icn.width());
}
@@ -175,13 +173,12 @@ void QMapMarker::compMapCoords()
d->box.moveTop(d->mapPt.y() - (MARKER_HEIGHT - 1));
d->intersectingTiles.clear();
compIntersectingTiles(d->box);
- }
- else {
+ } else {
d->mapPt = d->mapView->geoToMap(d->pt);
d->box.moveLeft(d->mapPt.x() - (d->icn.width() / 2));
d->box.moveTop(d->mapPt.y() - (d->icn.height() - 1));
d->intersectingTiles.clear();
- compIntersectingTiles(d->box);
+ compIntersectingTiles(d->box);
}
}
@@ -236,7 +233,6 @@ void QMapMarker::paint(QPainter* painter, const QRectF& viewPort)
painter->save();
if (d->icn.isNull()) {
- quint64 mapWidth = d->mapView->mapWidth();
painter->translate(-viewPort.left(), -viewPort.top());
painter->translate(d->mapPt.x(), d->mapPt.y());
constructMarker(painter);
diff --git a/src/location/qmapobject.cpp b/src/location/qmapobject.cpp
index f3b505a06a..a28336b394 100644
--- a/src/location/qmapobject.cpp
+++ b/src/location/qmapobject.cpp
@@ -44,8 +44,8 @@
QTM_BEGIN_NAMESPACE
QMapObjectPrivate::QMapObjectPrivate()
- :intersectingTiles(QList<quint64>()), mapView(NULL),
- objType(QMapObject::NullObject), z(0)
+ : intersectingTiles(QList<quint64>()), mapView(NULL),
+ objType(QMapObject::NullObject), z(0)
{
}
@@ -75,7 +75,7 @@ QMapObjectPrivate::QMapObjectPrivate()
Constructs the map object with the given \a type and layer \a z.
*/
QMapObject::QMapObject(QMapObject::MapObjectType type, quint16 z)
- :d_ptr(new QMapObjectPrivate)
+ : d_ptr(new QMapObjectPrivate)
{
Q_D(QMapObject);
d->objType = type;
@@ -86,11 +86,11 @@ QMapObject::QMapObject(QMapObject::MapObjectType type, quint16 z)
\internal
*/
QMapObject::QMapObject(QMapObjectPrivate &dd, MapObjectType type, quint16 z)
- :d_ptr(&dd)
+ : d_ptr(&dd)
{
Q_D(QMapObject);
d->objType = type;
- d->z =z;
+ d->z = z;
}
/*!
@@ -107,12 +107,14 @@ QMapObject::~QMapObject()
Objects with higher z indices are stacked on top of objects
with lower z indices.
*/
-quint16 QMapObject::zValue() const {
+quint16 QMapObject::zValue() const
+{
Q_D(const QMapObject);
return d->z;
}
-QMapObject::MapObjectType QMapObject::type() const {
+QMapObject::MapObjectType QMapObject::type() const
+{
Q_D(const QMapObject);
return d->objType;
}
@@ -152,7 +154,7 @@ void QMapObject::compIntersectingTiles(const QRectF& box)
it.next();
if (it.isValid() && intersects(it.tileRect()))
- d->intersectingTiles.append(d->mapView->getTileIndex(it.col(), it.row()));
+ d->intersectingTiles.append(it.index());
}
}
diff --git a/src/location/qmappixmap.cpp b/src/location/qmappixmap.cpp
index 8594def8d8..89d1559221 100644
--- a/src/location/qmappixmap.cpp
+++ b/src/location/qmappixmap.cpp
@@ -47,7 +47,7 @@
QTM_BEGIN_NAMESPACE
QMapPixmapPrivate::QMapPixmapPrivate()
- :pic(QPixmap()), geoTopLeft(QGeoCoordinate())
+ : pic(QPixmap()), geoTopLeft(QGeoCoordinate())
{
}
@@ -62,7 +62,7 @@ QMapPixmapPrivate::QMapPixmapPrivate()
corner. The pixmap is displayed in the layer specified by \a layerIndex.
*/
QMapPixmap::QMapPixmap(const QGeoCoordinate& topLeft, const QPixmap& pixmap, quint16 layerIndex)
- :QMapObject(*new QMapPixmapPrivate, QMapObject::PixmapObject, layerIndex)
+ : QMapObject(*new QMapPixmapPrivate, QMapObject::PixmapObject, layerIndex)
{
Q_D(QMapPixmap);
d->geoTopLeft = topLeft;
@@ -70,7 +70,7 @@ QMapPixmap::QMapPixmap(const QGeoCoordinate& topLeft, const QPixmap& pixmap, qui
}
QMapPixmap::QMapPixmap(QMapPixmapPrivate &dd, const QGeoCoordinate& topLeft, const QPixmap& pixmap, quint16 layerIndex)
- :QMapObject(dd, QMapObject::PixmapObject, layerIndex)
+ : QMapObject(dd, QMapObject::PixmapObject, layerIndex)
{
Q_D(QMapPixmap);
d->geoTopLeft = topLeft;
@@ -80,7 +80,8 @@ QMapPixmap::QMapPixmap(QMapPixmapPrivate &dd, const QGeoCoordinate& topLeft, con
/*!
Returns the pixmap.
*/
-QPixmap QMapPixmap::pixmap() const {
+QPixmap QMapPixmap::pixmap() const
+{
Q_D(const QMapPixmap);
return d->pic;
}
@@ -88,7 +89,8 @@ QPixmap QMapPixmap::pixmap() const {
/*!
Returns the top left corner (as a geo coordinate) of this pixmap.
*/
-QGeoCoordinate QMapPixmap::topLeft() const {
+QGeoCoordinate QMapPixmap::topLeft() const
+{
Q_D(const QMapPixmap);
return d->geoTopLeft;
}
diff --git a/src/location/qmappixmap.h b/src/location/qmappixmap.h
index c166ae76dd..74e8cae955 100644
--- a/src/location/qmappixmap.h
+++ b/src/location/qmappixmap.h
@@ -47,7 +47,7 @@
QTM_BEGIN_NAMESPACE
class QMapPixmapPrivate;
-class QMapPixmap : public QMapObject
+class Q_LOCATION_EXPORT QMapPixmap : public QMapObject
{
friend class QMapView;
@@ -63,7 +63,7 @@ protected:
virtual void paint(QPainter* painter, const QRectF& viewPort);
QMapPixmap(QMapPixmapPrivate &dd, const QGeoCoordinate& topLeft, const QPixmap& pixmap,
- quint16 layerIndex = 0);
+ quint16 layerIndex = 0);
private:
Q_DECLARE_PRIVATE(QMapPixmap)
diff --git a/src/location/qmappolygon.cpp b/src/location/qmappolygon.cpp
index 174829cbc1..28c9d241b1 100644
--- a/src/location/qmappolygon.cpp
+++ b/src/location/qmappolygon.cpp
@@ -46,8 +46,8 @@
QTM_BEGIN_NAMESPACE
QMapPolygonPrivate::QMapPolygonPrivate()
- :poly(QList<QGeoCoordinate>()),p(QPen()), br(QBrush()),
- path(QPainterPath())
+ : poly(QList<QGeoCoordinate>()), p(QPen()), br(QBrush()),
+ path(QPainterPath())
{
}
/*!
@@ -90,7 +90,8 @@ QMapPolygon::QMapPolygon(QMapPolygonPrivate &dd, const QList<QGeoCoordinate>& po
Returns the polygon as a list of geo coordinates.
*/
-QList<QGeoCoordinate> QMapPolygon::polygon() const {
+QList<QGeoCoordinate> QMapPolygon::polygon() const
+{
Q_D(const QMapPolygon);
return d->poly;
}
@@ -100,7 +101,8 @@ QList<QGeoCoordinate> QMapPolygon::polygon() const {
Returns the pen used for drawing the polygon outline.
*/
-QPen QMapPolygon::pen() const {
+QPen QMapPolygon::pen() const
+{
Q_D(const QMapPolygon);
return d->p;
}
@@ -110,7 +112,8 @@ QPen QMapPolygon::pen() const {
The brush used for filling in the polygon.
*/
-QBrush QMapPolygon::brush() const {
+QBrush QMapPolygon::brush() const
+{
Q_D(const QMapPolygon);
return d->br;
}
diff --git a/src/location/qmappolygon.h b/src/location/qmappolygon.h
index 1800be2064..6e760e0c57 100644
--- a/src/location/qmappolygon.h
+++ b/src/location/qmappolygon.h
@@ -65,7 +65,7 @@ protected:
virtual void paint(QPainter* painter, const QRectF& viewPort);
QMapPolygon(QMapPolygonPrivate &dd, const QList<QGeoCoordinate>& polygon,
const QPen& pen = QPen(), const QBrush& brush = QBrush(),
- quint16 layerIndex=0);
+ quint16 layerIndex = 0);
private:
Q_DECLARE_PRIVATE(QMapPolygon)
};
diff --git a/src/location/qmaprect.cpp b/src/location/qmaprect.cpp
index 0edfe38624..a86aa840c0 100644
--- a/src/location/qmaprect.cpp
+++ b/src/location/qmaprect.cpp
@@ -46,9 +46,9 @@
QTM_BEGIN_NAMESPACE
QMapRectPrivate::QMapRectPrivate()
- :geoTopLeft(QGeoCoordinate()),
- geoBottomRight(QGeoCoordinate()),
- p(QPen()), b(QBrush()), rect(QRect())
+ : geoTopLeft(QGeoCoordinate()),
+ geoBottomRight(QGeoCoordinate()),
+ p(QPen()), b(QBrush()), rect(QRect())
{
}
@@ -92,7 +92,8 @@ QMapRect::QMapRect(QMapRectPrivate &dd, const QGeoCoordinate& topLeft, const QGe
/*!
Returns the top left geo coordinate of the rectangle.
*/
-QGeoCoordinate QMapRect::topLeft() const {
+QGeoCoordinate QMapRect::topLeft() const
+{
Q_D(const QMapRect);
return d->geoTopLeft;
}
@@ -100,7 +101,8 @@ QGeoCoordinate QMapRect::topLeft() const {
/*!
Returns the bottom right geo coordinate of the left rectangle.
*/
-QGeoCoordinate QMapRect::bottomRight() const {
+QGeoCoordinate QMapRect::bottomRight() const
+{
Q_D(const QMapRect);
return d->geoBottomRight;
}
@@ -108,7 +110,8 @@ QGeoCoordinate QMapRect::bottomRight() const {
/*!
Returns the pen used for drawing the rectangle outline.
*/
-QPen QMapRect::pen() const {
+QPen QMapRect::pen() const
+{
Q_D(const QMapRect);
return d->p;
}
@@ -116,7 +119,8 @@ QPen QMapRect::pen() const {
/*!
Returns the brush used for filling the rectangle.
*/
-QBrush QMapRect::brush() const {
+QBrush QMapRect::brush() const
+{
Q_D(const QMapRect);
return d->b;
}
diff --git a/src/location/qmaproute.cpp b/src/location/qmaproute.cpp
index 094d656b04..1d0acf3a7d 100644
--- a/src/location/qmaproute.cpp
+++ b/src/location/qmaproute.cpp
@@ -47,7 +47,7 @@
QTM_BEGIN_NAMESPACE
QMapRoutePrivate::QMapRoutePrivate()
- :rt(QRoute()), rPen(QPen())
+ : rt(QGeoRoute()), rPen(QPen())
{
}
@@ -57,14 +57,14 @@ QMapRoutePrivate::QMapRoutePrivate()
\ingroup location
The representation of a route that has been added to the map.
- It keeps track of all indivdual QRouteSegments.
+ It keeps track of all indivdual QGeoRouteSegments.
*/
/*!
Constructor.
The \a route represents the route that this map route represents.
*/
-QMapRoute::QMapRoute(const QRoute& route, const QPen& pen, const QPixmap& /*endpointMarker*/, quint16 layerIndex)
+QMapRoute::QMapRoute(const QGeoRoute& route, const QPen& pen, const QPixmap& /*endpointMarker*/, quint16 layerIndex)
: QMapObject(*new QMapRoutePrivate, QMapObject::RouteObject, layerIndex)
{
Q_D(QMapRoute);
@@ -73,7 +73,7 @@ QMapRoute::QMapRoute(const QRoute& route, const QPen& pen, const QPixmap& /*endp
//TODO: endpoint marker for routes
}
-QMapRoute::QMapRoute(QMapRoutePrivate &dd, const QRoute& route, const QPen& pen, const QPixmap& /*endpointMarker*/, quint16 layerIndex)
+QMapRoute::QMapRoute(QMapRoutePrivate &dd, const QGeoRoute& route, const QPen& pen, const QPixmap& /*endpointMarker*/, quint16 layerIndex)
: QMapObject(dd, QMapObject::RouteObject, layerIndex)
{
Q_D(QMapRoute);
@@ -87,7 +87,8 @@ QMapRoute::QMapRoute(QMapRoutePrivate &dd, const QRoute& route, const QPen& pen,
Retunrs the pen used for drawing this route.
*/
-QPen QMapRoute::pen() const {
+QPen QMapRoute::pen() const
+{
Q_D(const QMapRoute);
return d->rPen;
}
@@ -154,7 +155,7 @@ void QMapRoute::addSegment(const QLineF& line)
it.next();
if (it.isValid()) {
- quint64 tileIndex = d->mapView->getTileIndex(it.col(), it.row());
+ quint64 tileIndex = it.index();
if (!d->segments.contains(tileIndex))
d->segments.insert(tileIndex, QList<QLineF>());
@@ -191,7 +192,7 @@ bool QMapRoute::intersects(const QRectF& rect) const
if (!it.isValid())
continue;
- quint64 tileIndex = d->mapView->getTileIndex(it.col(), it.row());
+ quint64 tileIndex = it.index();
if (d->segments.contains(tileIndex)) {
QRectF tile = it.tileRect();
@@ -230,7 +231,7 @@ void QMapRoute::paint(QPainter* painter, const QRectF& viewPort)
if (!it.isValid())
continue;
- quint64 tileIndex = d->mapView->getTileIndex(it.col(), it.row());
+ quint64 tileIndex = it.index();
if (d->segments.contains(tileIndex)) {
QListIterator<QLineF> lit(d->segments[tileIndex]);
diff --git a/src/location/qmaproute.h b/src/location/qmaproute.h
index 239b12aa21..ada2881ae5 100644
--- a/src/location/qmaproute.h
+++ b/src/location/qmaproute.h
@@ -48,7 +48,7 @@
#include <QPixmap>
#include <QLineF>
-#include "qroute.h"
+#include "qgeoroute.h"
#include "qmapobject.h"
QTM_BEGIN_NAMESPACE
@@ -59,7 +59,7 @@ class Q_LOCATION_EXPORT QMapRoute : public QMapObject
friend class QMapView;
public:
- QMapRoute( const QRoute& route,
+ QMapRoute(const QGeoRoute& route,
const QPen& pen = QPen(),
const QPixmap& endpointMarker = QPixmap(),
quint16 layerIndex = 0);
@@ -73,7 +73,7 @@ protected:
virtual void paint(QPainter* painter, const QRectF& viewPort);
QMapRoute(QMapRoutePrivate &dd,
- const QRoute& route,
+ const QGeoRoute& route,
const QPen& pen = QPen(),
const QPixmap& endpointMarker = QPixmap(),
quint16 layerIndex = 0);
diff --git a/src/location/qmaproute_p.h b/src/location/qmaproute_p.h
index ef690fc714..ff26de5f15 100644
--- a/src/location/qmaproute_p.h
+++ b/src/location/qmaproute_p.h
@@ -51,7 +51,7 @@ class QMapRoutePrivate : public QMapObjectPrivate
public:
QMapRoutePrivate();
- QRoute rt;
+ QGeoRoute rt;
QMap<quint64, QList<QLineF> > segments; //!< All individual route segments.
QPen rPen; //!< The pen used for drawing this route.
};
diff --git a/src/location/qmaptilerequest.cpp b/src/location/qmaptilerequest.cpp
deleted file mode 100644
index a63678485f..0000000000
--- a/src/location/qmaptilerequest.cpp
+++ /dev/null
@@ -1,194 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmaptilerequest.h"
-#include "qmaptilerequest_p.h"
-#include "qmaptilereply.h"
-
-QTM_BEGIN_NAMESPACE
-
-QMapTileRequest::QMapTileRequest()
- : d_ptr(new QMapTileRequestPrivate())
-{
-}
-
-QMapTileRequest::QMapTileRequest(const MapVersion& mapVersion,
- const MapScheme& mapScheme,
- const MapResolution& mapResolution,
- const MapFormat& mapFormat)
- : d_ptr(new QMapTileRequestPrivate(mapVersion,mapScheme,mapResolution,mapFormat))
-{
-}
-
-QMapTileRequest::QMapTileRequest(const QMapTileRequest& request)
- : d_ptr(new QMapTileRequestPrivate(request.d_ptr))
-{
-}
-
-QMapTileRequest::~QMapTileRequest()
-{
- Q_D(QMapTileRequest);
- delete d;
-}
-
-QMapTileRequest& QMapTileRequest::operator =(const QMapTileRequest& request)
-{
- Q_D(QMapTileRequest);
- d->cl = request.col();
- d->rw = request.row();
- d->ver = request.version();
- d->zoom = request.zoomLevel();
- d->schm = request.scheme();
- d->frmt = request.format();
- d->res = request.resolution();
- return *this;
-}
-
-void QMapTileRequest::setVersion(const MapVersion& version)
-{
- Q_D(QMapTileRequest);
- d->ver = version;
-}
-
-MapScheme QMapTileRequest::scheme() const
-{
- Q_D(const QMapTileRequest);
- return d->schm;
-}
-
-void QMapTileRequest::setScheme(const MapScheme& scheme)
-{
- Q_D(QMapTileRequest);
- d->schm = scheme;
-}
-
-MapResolution QMapTileRequest::resolution() const
-{
- Q_D(const QMapTileRequest);
- return d->res;
-}
-
-void QMapTileRequest::setResolution(const MapResolution& resolution)
-{
- Q_D(QMapTileRequest);
- d->res = resolution;
-}
-
-MapFormat QMapTileRequest::format() const
-{
- Q_D(const QMapTileRequest);
- return d->frmt;
-}
-
-void QMapTileRequest::setFormat(const MapFormat& format)
-{
- Q_D(QMapTileRequest);
- d->frmt = format;
-}
-
-quint16 QMapTileRequest::zoomLevel() const
-{
- Q_D(const QMapTileRequest);
- return d->zoom;
-}
-
-void QMapTileRequest::setZoomLevel(quint16 level)
-{
- Q_D(QMapTileRequest);
- d->zoom = level;
-}
-
-quint32 QMapTileRequest::col() const
-{
- Q_D(const QMapTileRequest);
- return d->cl;
-}
-
-void QMapTileRequest::setCol(quint32 c)
-{
- Q_D(QMapTileRequest);
- d->cl = c;
-}
-
-quint32 QMapTileRequest::row() const
-{
- Q_D(const QMapTileRequest);
- return d->rw;
-}
-
-void QMapTileRequest::setRow(quint32 r)
-{
- Q_D(QMapTileRequest);
- d->rw = r;
-}
-
-MapVersion QMapTileRequest::version() const
-{
- Q_D(const QMapTileRequest);
- return d->ver;
-}
-
-QMapTileRequestPrivate::QMapTileRequestPrivate()
- : cl(0), rw(0), ver(), zoom(0), schm(), res(), frmt()
-{
-}
-
-QMapTileRequestPrivate::QMapTileRequestPrivate(const MapVersion& mapVersion,
- const MapScheme& mapScheme,
- const MapResolution& mapResolution,
- const MapFormat& mapFormat)
- : cl(0), rw(0), ver(mapVersion), zoom(0), schm(mapScheme), res(mapResolution), frmt(mapFormat)
-{
-}
-
-QMapTileRequestPrivate::QMapTileRequestPrivate(const QMapTileRequestPrivate* request)
- : cl(request->cl), rw(request->rw), ver(request->ver), zoom(request->zoom),
- schm(request->schm), res(request->res), frmt(request->frmt)
-{
-}
-
-//---------------------------------------------------------------
-QMapTileReply::QMapTileReply(const QMapTileRequest& request)
- : req(request)
-{
-}
-
-QTM_END_NAMESPACE
diff --git a/src/location/qmaptilerequest.h b/src/location/qmaptilerequest.h
deleted file mode 100644
index 7e5efe8b56..0000000000
--- a/src/location/qmaptilerequest.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QLOCATION_MAPTILEREQUEST_H
-#define QLOCATION_MAPTILEREQUEST_H
-
-#include <QString>
-
-#include "qmaptile.h"
-
-QTM_BEGIN_NAMESPACE
-class QMapTileRequestPrivate;
-/*!
-* This class represents a request for a specific map tile. By definition, a map is
-* divided into 2^currZoomLevel columns and 2^currZoomLevel rows of tiles.
-*/
-class Q_LOCATION_EXPORT QMapTileRequest
-{
-public:
- QMapTileRequest(const MapVersion& mapVersion,
- const MapScheme& mapScheme,
- const MapResolution& mapResolution,
- const MapFormat& mapFormat);
- /*!
- * Copy constructor.
- * @param request The request to be copied.
- */
- QMapTileRequest(const QMapTileRequest& request);
- /*!
- * Default constructor
- */
- QMapTileRequest();
- /*!
- * Destructor
- */
- ~QMapTileRequest();
- /*!
- * Assignment operator.
- * @param request The request to assign from.
- * @return A reference to this request.
- */
- QMapTileRequest& operator=(const QMapTileRequest& request); //disallow
-
- /*!
- * @return The col index of the requested map tile.
- */
- quint32 col() const;
- /*!
- * Sets the col index of the requested map tile.
- * Valid values are 0 ... 2^currZoomLevel - 1.
- * @param c The col index.
- */
- void setCol(quint32 c);
-
- /*!
- * @return The row index of the requested map tile.
- */
- quint32 row() const;
-
- /*!
- * Sets the row index of the requested map tile.
- * Valid values are 0 ... 2^currZoomLevel - 1.
- * @param r The row index.
- */
- void setRow(quint32 r);
-
- /*!
- * @return The version of the requested map tile.
- */
- MapVersion version() const;
-
- /*!
- * Sets the version of the requested map tile.
- * @param version The version.
- */
- void setVersion(const MapVersion& version);
-
- /*!
- * @return The resolution of the requested map tile.
- */
- MapResolution resolution() const;
-
- /*!
- * Sets the resolution of the requested map tile.
- * @param resolution The resolution.
- */
- void setResolution(const MapResolution& resolution);
-
- /*!
- * @return The format of the requested map tile.
- */
- MapFormat format() const;
-
- /*!
- * Sets the format of the requested map tile.
- * @param format The format.
- */
- void setFormat(const MapFormat& format);
-
- /*!
- * @return The scheme of the requested map tile.
- */
- MapScheme scheme() const;
-
- /*!
- * Sets the scheme of the requested map tile.
- * @param scheme The scheme.
- */
- void setScheme(const MapScheme& scheme);
-
- /*!
- * @return The zoom level of the requested map tile.
- */
- quint16 zoomLevel() const;
- /*!
- * Sets the zoom level of the requested map tile.
- * @param level The zoom level.
- */
- void setZoomLevel(quint16 level);
-
-private:
- QMapTileRequestPrivate *d_ptr;
- Q_DECLARE_PRIVATE(QMapTileRequest)
-};
-
-QTM_END_NAMESPACE
-
-#endif
diff --git a/src/location/qmapview.cpp b/src/location/qmapview.cpp
index b6d5935854..80503f5e4f 100755
--- a/src/location/qmapview.cpp
+++ b/src/location/qmapview.cpp
@@ -50,7 +50,7 @@
#include "qmapview.h"
#include "qmapview_p.h"
-#include "qmaptile.h"
+#include "qgeomaptile.h"
#include "qmaproute.h"
#include "qmapobject.h"
#include "qmapobject_p.h"
@@ -61,6 +61,7 @@
#include "qmapellipse.h"
#include "qmapmarker.h"
#include "qmapmarker_p.h"
+#include "qgeomapservice.h"
#define RELEASE_INTERVAL 10000
#define DEFAULT_ZOOM_LEVEL 4
@@ -109,29 +110,29 @@ QMapView::~QMapView()
}
/*!
- Initializes a the map view with a given \a geoEngine and centers
+ Initializes a the map view with a given \a mapService and centers
the map at \a center.
*/
-void QMapView::init(QGeoEngine* geoEngine, const QGeoCoordinate& center)
+void QMapView::init(QGeoMapService* mapService, const QGeoCoordinate& center)
{
Q_D(QMapView);
- if (!geoEngine)
+ if (!mapService)
return;
//Is this map engine replacing an old one?
- if (d->geoEngine) {
- QObject::disconnect(geoEngine, SIGNAL(finished(QMapTileReply*)),
- this, SLOT(tileFetched(QMapTileReply*)));
+ if (d->mapService) {
+ QObject::disconnect(mapService, SIGNAL(finished(QGeoMapTileReply*)),
+ this, SLOT(tileFetched(QGeoMapTileReply*)));
}
QObject::disconnect(&d->releaseTimer, SIGNAL(timeout()),
this, SLOT(releaseRemoteTiles()));
- d->geoEngine = geoEngine;
+ d->mapService = mapService;
- QObject::connect(d->geoEngine, SIGNAL(finished(QMapTileReply*)),
- this, SLOT(tileFetched(QMapTileReply*)), Qt::QueuedConnection);
+ QObject::connect(d->mapService, SIGNAL(finished(QGeoMapTileReply*)),
+ this, SLOT(tileFetched(QGeoMapTileReply*)), Qt::QueuedConnection);
QObject::connect(&d->releaseTimer, SIGNAL(timeout()),
this, SLOT(releaseRemoteTiles()));
@@ -266,27 +267,27 @@ void QMapView::paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
/*!
This slot is called when a requested map tile has become available.
- Internally, this slot is connected to QGeoEngine::finished(QMapTileReply*).
+ Internally, this slot is connected to QGeoEngine::finished(QGeoMapTileReply*).
*/
-void QMapView::tileFetched(QMapTileReply* reply)
+void QMapView::tileFetched(QGeoMapTileReply* reply)
{
Q_D(QMapView);
- if (!d->geoEngine)
+ if (!d->mapService)
return; //This really should not be happening
//Are we actually waiting for this tile?
- const QMapTileRequest& request = reply->request();
+ const QGeoMapTileRequest& request = reply->request();
quint64 tileIndex = getTileIndex(request.col(), request.row());
if (!d->pendingTiles.contains(tileIndex)) {
- d->geoEngine->release(reply);
+ delete reply;
return; //discard
}
//Not the reply we expected?
if (reply != d->pendingTiles[tileIndex]) {
- d->geoEngine->release(reply);
+ delete reply;
return; //discard
}
@@ -297,15 +298,15 @@ void QMapView::tileFetched(QMapTileReply* reply)
request.resolution().id != d->mapResolution.id ||
request.scheme().id != d->mapSchmeme.id ||
request.version().id != d->mapVersion.id) {
- d->geoEngine->release(reply);
+ delete reply;
return; //discard
}
QPixmap tile;
- tile.loadFromData(reply->rawData(), "PNG");
+ tile.loadFromData(reply->data(), "PNG");
d->mapTiles[tileIndex] = qMakePair(tile, true);
this->update();
- d->geoEngine->release(reply);
+ delete reply;
}
void QMapView::mousePressEvent(QGraphicsSceneMouseEvent* event)
@@ -365,8 +366,8 @@ void QMapView::wheelEvent(QGraphicsSceneWheelEvent* event)
quint16 QMapView::maxZoomLevel() const
{
Q_D(const QMapView);
- if (d->geoEngine)
- return d->geoEngine->maxZoomLevel();
+ if (d->mapService)
+ return d->mapService->maxZoomLevel();
return 0;
}
/*!
@@ -385,13 +386,13 @@ void QMapView::setZoomLevel(int zoomLevel)
{
Q_D(QMapView);
- if (!d->geoEngine)
+ if (!d->mapService)
return;
quint16 oldZoomLevel = d->currZoomLevel;
- if (zoomLevel > d->geoEngine->maxZoomLevel())
- d->currZoomLevel = d->geoEngine->maxZoomLevel();
+ if (zoomLevel > d->mapService->maxZoomLevel())
+ d->currZoomLevel = d->mapService->maxZoomLevel();
else if (zoomLevel < 0)
d->currZoomLevel = 0;
else
@@ -499,7 +500,7 @@ void QMapView::moveViewPort(int deltaX, int deltaY)
{
Q_D(QMapView);
- if (!d->geoEngine)
+ if (!d->mapService)
return;
qreal pixelPerXAxis = d->numColRow * d->mapResolution.size.width();
@@ -586,7 +587,7 @@ QPointF QMapView::mercatorToMap(const QPointF& mercatorCoordinate) const
{
Q_D(const QMapView);
- if (!d->geoEngine)
+ if (!d->mapService)
return QPointF();
return QPointF(static_cast<qint64>(mercatorCoordinate.x() * ((qreal) d->numColRow) * ((qreal) d->mapResolution.size.width())),
@@ -600,7 +601,7 @@ QPointF QMapView::mapToMercator(const QPointF& mapCoordinate) const
{
Q_D(const QMapView);
- if (!d->geoEngine)
+ if (!d->mapService)
return QPointF();
return QPointF(mapCoordinate.x() / (((qreal) d->numColRow) * ((qreal) d->mapResolution.size.width())),
@@ -669,8 +670,7 @@ void QMapView::removeMapObject(QMapObject* mapObject)
QHash<quint64, QList<QMapObject*> > tileToObjectsMap; //!< Map tile to map object hash map.
d->mapObjects.remove(mapObject);
- for (int i = 0; i < mapObject->d_ptr->intersectingTiles.count(); i++)
- {
+ for (int i = 0; i < mapObject->d_ptr->intersectingTiles.count(); i++) {
if (tileToObjectsMap.contains(mapObject->d_ptr->intersectingTiles[i]))
tileToObjectsMap[mapObject->d_ptr->intersectingTiles[i]].removeAll(mapObject);
if (d->tileToObjects.contains(mapObject->d_ptr->intersectingTiles[i]))
@@ -732,12 +732,10 @@ QMapObject* QMapView::getTopmostMapObject(const QPointF& mapCoordinate)
QList<QMapObject*>& objects = d->tileToObjects[tileIndex];
- for (int i = 0; i < objects.count(); i++)
- {
+ for (int i = 0; i < objects.count(); i++) {
QMapObject* obj = objects[i];
- if (obj->intersects(rect))
- {
+ if (obj->intersects(rect)) {
if (!selected || selected->zValue() < obj->zValue())
selected = obj;
}
@@ -861,18 +859,18 @@ class QMapView::TileIteratorPrivate
{
public:
TileIteratorPrivate(const QMapViewPrivate* mapViewPrivate, const QRectF& viewPort)
- : hasNext(true), viewPort(viewPort),
- numColRow(mapViewPrivate->numColRow),
- mapRes(mapViewPrivate->mapResolution),
- currX(static_cast<qint64>(viewPort.left())),
- currY(static_cast<qint64>(viewPort.top())),
- rect(QPointF(), mapViewPrivate->mapResolution.size),
- valid(false)
- {
+ : hasNext(true), viewPort(viewPort),
+ numColRow(mapViewPrivate->numColRow),
+ mapRes(mapViewPrivate->mapResolution),
+ currX(static_cast<qint64>(viewPort.left())),
+ currY(static_cast<qint64>(viewPort.top())),
+ rect(QPointF(), mapViewPrivate->mapResolution.size),
+ valid(false) {
}
quint32 cl;
quint32 rw;
+ quint64 tileIndex;
bool hasNext;
QRectF viewPort;
quint64 numColRow;
@@ -897,7 +895,7 @@ public:
Constructs a TileIterator with its associated \a mapView and \a viewPort.
*/
QMapView::TileIterator::TileIterator(const QMapView& mapView, const QRectF& viewPort)
- : d_ptr(new QMapView::TileIteratorPrivate(mapView.d_ptr, viewPort))
+ : d_ptr(new QMapView::TileIteratorPrivate(mapView.d_ptr, viewPort))
{}
/*!
@@ -918,6 +916,7 @@ void QMapView::TileIterator::next()
d->cl = (d->currX / d->mapRes.size.width()) % d->numColRow;
qint64 left = (d->currX / d->mapRes.size.width()) * d->mapRes.size.width();
d->rw = d->currY / d->mapRes.size.height();
+ d->tileIndex = ((quint64) d->rw) * d->numColRow + d->cl;
if (d->currY > 0) {
qint64 top = (d->currY / d->mapRes.size.height()) * d->mapRes.size.height();
@@ -977,6 +976,12 @@ quint32 QMapView::TileIterator::row() const
return d->rw;
}
+quint64 QMapView::TileIterator::index() const
+{
+ Q_D(const QMapView::TileIterator);
+ return d->tileIndex;
+}
+
/*!
Returns the bounding box of the map tile (in map pixel coordinates).
*/
diff --git a/src/location/qmapview.h b/src/location/qmapview.h
index 225a4c168a..97da7cb764 100755
--- a/src/location/qmapview.h
+++ b/src/location/qmapview.h
@@ -53,8 +53,8 @@
#include <QColor>
#include "qgeocoordinate.h"
-#include "qgeoengine.h"
-#include "qroute.h"
+#include "qgeoroute.h"
+#include "qgeomaptile.h"
QTM_BEGIN_NAMESPACE
@@ -67,6 +67,8 @@ class QMapEllipse;
class QMapObject;
class QMapMarker;
class QMapViewPrivate;
+class QGeoMapService;
+class QGeoMapTileReply;
class Q_LOCATION_EXPORT QMapView : public QGraphicsWidget
{
@@ -85,6 +87,7 @@ public:
void next();
quint32 col() const;
quint32 row() const;
+ quint64 index() const;
QRectF tileRect() const;
private:
@@ -99,7 +102,7 @@ public:
QMapView(QGraphicsItem* parent = 0, Qt::WindowFlags wFlags = 0);
virtual ~QMapView();
- void init(QGeoEngine* geoEngine, const QGeoCoordinate& center = QGeoCoordinate(0, 0));
+ void init(QGeoMapService* mapService, const QGeoCoordinate& center = QGeoCoordinate(0, 0));
virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0);
@@ -122,12 +125,7 @@ public:
bool isPannable() const;
QPointF geoToMap(const QGeoCoordinate& geoCoordinate) const;
- QPointF mercatorToMap(const QPointF& mercatorCoordinate) const;
QGeoCoordinate mapToGeo(const QPointF& mapCoordinate) const;
- QPointF mapToMercator(const QPointF&mapCoordinate) const;
- void mapToTile(const QPointF& mapCoordinate, quint32* col, quint32* row) const;
- quint64 getTileIndex(quint32 col, quint32 row) const;
- QRectF getTileRect(quint32 col, quint32 row) const;
void setRouteDetailLevel(quint32 pixels);
quint32 routeDetailLevel() const;
@@ -164,6 +162,13 @@ public:
private:
Q_DISABLE_COPY(QMapView)
+ QPointF mercatorToMap(const QPointF& mercatorCoordinate) const;
+ QPointF mapToMercator(const QPointF&mapCoordinate) const;
+
+ void mapToTile(const QPointF& mapCoordinate, quint32* col, quint32* row) const;
+ QRectF getTileRect(quint32 col, quint32 row) const;
+ quint64 getTileIndex(quint32 col, quint32 row) const;
+
protected:
virtual void mousePressEvent(QGraphicsSceneMouseEvent* event);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent* event);
@@ -173,7 +178,7 @@ protected:
public slots:
void releaseRemoteTiles();
- void tileFetched(QMapTileReply* reply);
+ void tileFetched(QGeoMapTileReply* reply);
void setZoomLevel(int zoomLevel);
signals:
diff --git a/src/location/qmapview_p.cpp b/src/location/qmapview_p.cpp
index 4ffe9a8b1d..1925d10ebf 100755
--- a/src/location/qmapview_p.cpp
+++ b/src/location/qmapview_p.cpp
@@ -44,17 +44,18 @@
#include "qmapview_p.h"
#include "qmapobject.h"
#include "qmapobject_p.h"
+#include "qgeomapservice.h"
QTM_BEGIN_NAMESPACE
QMapViewPrivate::QMapViewPrivate(QtMobility::QMapView *q)
- : q_ptr(q), numColRow(1), geoEngine(0), currZoomLevel(0),
- horizontalPadding(0), verticalPadding(0), routeDetails(0),
- panActive(false), pannable(true), releaseTimer(q),
- mapVersion(MapVersion(MapVersion::Newest)),
- mapSchmeme(MapScheme(MapScheme::Normal_Day)),
- mapResolution(MapResolution(MapResolution::Res_256_256)),
- mapFormat(MapFormat(MapFormat::Png))
+ : q_ptr(q), numColRow(1), mapService(0), currZoomLevel(0),
+ horizontalPadding(0), verticalPadding(0), routeDetails(0),
+ panActive(false), pannable(true), releaseTimer(q),
+ mapVersion(MapVersion(MapVersion::Newest)),
+ mapSchmeme(MapScheme(MapScheme::Normal_Day)),
+ mapResolution(MapResolution(MapResolution::Res_256_256)),
+ mapFormat(MapFormat(MapFormat::Png))
{
}
@@ -160,7 +161,7 @@ QHash<quint64, QPair<QPixmap, bool> > QMapViewPrivate::preZoomOut(qreal scale)
*/
void QMapViewPrivate::requestTile(quint32 col, quint32 row)
{
- if (!geoEngine)
+ if (!mapService)
return;
Q_Q(QMapView);
@@ -170,7 +171,7 @@ void QMapViewPrivate::requestTile(quint32 col, quint32 row)
return;
}
- QMapTileRequest request;
+ QGeoMapTileRequest request;
request.setVersion(mapVersion);
request.setScheme(mapSchmeme);
request.setResolution(mapResolution);
@@ -179,7 +180,7 @@ void QMapViewPrivate::requestTile(quint32 col, quint32 row)
request.setRow(row);
request.setZoomLevel(currZoomLevel);
- QMapTileReply* reply = geoEngine->get(request);
+ QGeoMapTileReply* reply = mapService->getMapTile(request);
pendingTiles[tileIndex] = reply;
}
@@ -188,12 +189,12 @@ void QMapViewPrivate::requestTile(quint32 col, quint32 row)
*/
void QMapViewPrivate::cancelPendingTiles()
{
- QHashIterator<quint64, QMapTileReply*> it(pendingTiles);
+ QHashIterator<quint64, QGeoMapTileReply*> it(pendingTiles);
while (it.hasNext()) {
it.next();
- geoEngine->cancel(it.value());
- geoEngine->release(it.value());
+ it.value()->cancel();
+ it.value()->deleteLater();
}
pendingTiles.clear();
diff --git a/src/location/qmapview_p.h b/src/location/qmapview_p.h
index 18c3a9d848..552d8d87fd 100755
--- a/src/location/qmapview_p.h
+++ b/src/location/qmapview_p.h
@@ -47,11 +47,13 @@
#include <QSet>
#include <QHash>
-#include "qmaptile.h"
+#include "qgeomaptile.h"
#include "qmapview.h"
QTM_BEGIN_NAMESPACE
+class QGeoMapService;
+
class QMapViewPrivate
{
public:
@@ -71,7 +73,7 @@ public:
QRectF viewPort; //!< The logical view port.
quint32 numColRow; //!< The number of tiles along both the x- and y-axis
- QGeoEngine* geoEngine; //!< the underlying geo engine
+ QGeoMapService* mapService; //!< the underlying map service
quint32 horizontalPadding; //!< horizontal preload padding
quint32 verticalPadding; //!< vertical preload padding
quint32 routeDetails; //!< Minimum manhattan distance betwee two consecutive visible route way points.
@@ -98,9 +100,9 @@ public:
/*!
* Stores for each requested map tile (as given by its
- * one-dimensional tile index) the corresonding QMapTileReply.
+ * one-dimensional tile index) the corresonding QGeoMapTileReply.
*/
- QHash<quint64, QMapTileReply*> pendingTiles; //!< Pending requested map tiles
+ QHash<quint64, QGeoMapTileReply*> pendingTiles; //!< Pending requested map tiles
QHash<quint64, QPair<QPixmap, bool> > mapTiles;
diff --git a/src/location/qmlbackendmonitorao_s60.cpp b/src/location/qmlbackendmonitorao_s60.cpp
index 89f0d544ce..ece36a6305 100644
--- a/src/location/qmlbackendmonitorao_s60.cpp
+++ b/src/location/qmlbackendmonitorao_s60.cpp
@@ -100,7 +100,7 @@ void QMLBackendMonitorAO::RunL()
case KErrNone :
//retrieve the triggerInfo corresponding to iTriggerInfo.iTriggerId
triggerInfo = iTriggerMonitorInfo->getMonitorTriggerInfo(
- iTriggerInfo.iTriggerId);
+ iTriggerInfo.iTriggerId);
if (triggerInfo) {
//callback called only if generated for the current AO - Trigger ID
(triggerInfo->iParent)->handleTriggerEvent(iTriggerInfo.iFiredPositionInfo ,
diff --git a/src/location/qreversegeocodingrequest.cpp b/src/location/qreversegeocodingrequest.cpp
index 70b4d13135..53ee9e3ad0 100644
--- a/src/location/qreversegeocodingrequest.cpp
+++ b/src/location/qreversegeocodingrequest.cpp
@@ -62,17 +62,23 @@ QReverseGeocodingRequest::QReverseGeocodingRequest()
Constructs a request for the geocoordinate \a coordinate.
*/
QReverseGeocodingRequest::QReverseGeocodingRequest(const QGeoCoordinate& coordinate)
- : d_ptr(new QReverseGeocodingRequestPrivate(coordinate))
+ : d_ptr(new QReverseGeocodingRequestPrivate())
{
+ setCoordinate(coordinate);
}
+
+/*!
+ Destructor.
+*/
QReverseGeocodingRequest::~QReverseGeocodingRequest()
{
Q_D(QReverseGeocodingRequest);
delete d;
}
+
/*!
Returns the service version.
-
+
Currently the only supported version is 1.0.
*/
QString QReverseGeocodingRequest::version() const
@@ -119,17 +125,54 @@ QGeoCoordinate QReverseGeocodingRequest::coordinate() const
return d->coord;
}
+/*!
+ Returns the request string based on this request and \a host.
+*/
+QString QReverseGeocodingRequest::requestString(const QString &host) const
+{
+ Q_D(const QReverseGeocodingRequest);
+ return d->requestString(host);
+}
+
+/******************************************************************************
+ ****************************************************************************/
+
QReverseGeocodingRequestPrivate::QReverseGeocodingRequestPrivate()
{
languageMARC = "eng";
vers = "1.0";
}
-QReverseGeocodingRequestPrivate::QReverseGeocodingRequestPrivate(const QGeoCoordinate& coordinate)
- : coord(coordinate)
+QString QReverseGeocodingRequestPrivate::requestString(const QString &host) const
{
- languageMARC = "eng";
- vers = "1.0";
+ QString request = "http://";
+ request += host;
+ request += "/geocoder/rgc/";
+ request += vers;
+ request += "?referer=localhost";
+ request += "&long=";
+ request += trimDouble(coord.longitude());
+ request += "&lat=";
+ request += trimDouble(coord.latitude());
+
+ if (languageMARC != "") {
+ request += "&lg=";
+ request += languageMARC;
+ }
+
+ return request;
+}
+
+QString QReverseGeocodingRequestPrivate::trimDouble(qreal degree, int decimalDigits) const
+{
+ QString sDegree = QString::number(degree, 'g', decimalDigits);
+
+ int index = sDegree.indexOf('.');
+
+ if (index == -1)
+ return sDegree;
+ else
+ return QString::number(degree, 'g', decimalDigits + index);
}
diff --git a/src/location/qreversegeocodingrequest.h b/src/location/qreversegeocodingrequest.h
index abff3eb468..8733b8e536 100644
--- a/src/location/qreversegeocodingrequest.h
+++ b/src/location/qreversegeocodingrequest.h
@@ -66,6 +66,8 @@ public:
QGeoCoordinate coordinate() const;
void setCoordinate(const QGeoCoordinate& coordinate);
+ QString requestString(const QString &host) const;
+
private:
Q_DISABLE_COPY(QReverseGeocodingRequest)
diff --git a/src/location/qreversegeocodingrequest_p.h b/src/location/qreversegeocodingrequest_p.h
index 5462b704d3..93e7588c0d 100644
--- a/src/location/qreversegeocodingrequest_p.h
+++ b/src/location/qreversegeocodingrequest_p.h
@@ -52,7 +52,9 @@ class QReverseGeocodingRequestPrivate
{
public:
QReverseGeocodingRequestPrivate();
- QReverseGeocodingRequestPrivate(const QGeoCoordinate& coordinate);
+
+ QString requestString(const QString &host) const;
+ QString trimDouble(qreal degree, int decimalDigits = 10) const;
QString vers;
QString languageMARC;
diff --git a/src/location/qroute.cpp b/src/location/qroute.cpp
deleted file mode 100644
index d026526f7e..0000000000
--- a/src/location/qroute.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qroute.h"
-
-QTM_BEGIN_NAMESPACE
-
-/*!
- \class QRoute
- \brief The QRoute class is a representation of a route.
- \ingroup location
-
- This class represents a route as contained in a QRouteReply.
- A QRoute contains a collection of QManeuver objects.
-*/
-
-/*!
- The default constructor.
-*/
-QRoute::QRoute() {}
-
-
-/*!
- The copy constructor.
-*/
-QRoute::QRoute(const QRoute& route)
- : dist(route.dist), tod(route.tod), toa(route.toa), box(route.box), man(route.man)
-{
-}
-
-/*!
- The assignment operator.
-*/
-QRoute& QRoute::operator=(const QRoute & route)
-{
- dist = route.dist;
- tod = route.tod;
- toa = route.toa;
- box = route.box;
- man = route.man;
-
- return *this;
-}
-
-/*!
- Returns the departure time of this route.
-*/
-QDateTime QRoute::departure() const
-{
- return tod;
-}
-
-/*!
- Returns the arrival time of this route.
-*/
-QDateTime QRoute::arrival() const
-{
- return toa;
-}
-
-/*!
- Returns the distance covered by this route in meters.
-*/
-quint32 QRoute::distance() const
-{
- return dist;
-}
-
-/*!
- Returns the bounding box that completely encloses the route.
-
- The x coordinates of the corner points represent longitudes
- and the y coordinates represent latitudes.
-*/
-const QRectF& QRoute::boundingBox() const
-{
- return box;
-}
-
-/*!
- Returns the list of all maneuvers comprising the route.
-*/
-QList<QManeuver> QRoute::maneuvers() const
-{
- return man;
-}
-
-QTM_END_NAMESPACE
-
diff --git a/src/location/qroutereply.cpp b/src/location/qroutereply.cpp
deleted file mode 100644
index 82eaa5a38f..0000000000
--- a/src/location/qroutereply.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include "qroutereply.h"
-#include "qroutereply_p.h"
-
-QTM_BEGIN_NAMESPACE
-
-/*!
- \class QRouteReply
- \brief The QRouteReply class represents a response to a request for routing information.
- \ingroup location
-
- This class represents a routing response.
-*/
-
-/*!
- \enum QRouteReply::ResultCode
-
- Possible result codes as returned by the geo engine
-
- \value OK
- request succeeded
- \value Failed
- request failed
- \value FailedWithAlternative
- request failed, but a close alternative was found
-*/
-
-QRouteReply::QRouteReply()
- : d_ptr(new QRouteReplyPrivate())
-{
-}
-QRouteReply::~QRouteReply()
-{
- Q_D(QRouteReply);
- delete d;
-}
-/*!
- Returns the result code as reported by the geo engine.
-*/
-QRouteReply::ResultCode QRouteReply::resultCode() const
-{
- Q_D(const QRouteReply);
- return d->rCode;
-}
-/*!
- Sets the result code
-*/
-void QRouteReply::setResultCode(QRouteReply::ResultCode result)
-{
- Q_D(QRouteReply);
- d->rCode = result;
-}
-
-/*!
- Returns a textual description of the result.
-*/
-QString QRouteReply::resultDescription() const
-{
- Q_D(const QRouteReply);
- return d->descr;
-}
-
-/*!
- Sets a textual description of the result.
-*/
-void QRouteReply::setResultDescription(QString description)
-{
- Q_D(QRouteReply);
- d->descr = description;
-}
-
-/*!
- Returns the RFC 3066 language code of the reply.
-*/
-QString QRouteReply::language() const
-{
- Q_D(const QRouteReply);
- return d->lang;
-}
-
-/*!
- Sets the RFC 3066 language code of the reply.
-*/
-void QRouteReply::setLanguage(QString language)
-{
- Q_D(QRouteReply);
- d->lang = language;
-}
-
-/*!
- Returns the number of routes contained in this reply.
-*/
-int QRouteReply::count() const
-{
- Q_D(const QRouteReply);
- return d->rt.size();
-}
-
-/*!
- Returns a list containing all found routes.
-
- \sa QRoute
-*/
-const QList<QRoute>& QRouteReply::routes() const
-{
- Q_D(const QRouteReply);
- return d->rt;
-}
-/*!
- Adds a route to the list of found routes.
-*/
-void QRouteReply::addRoute(QRoute route)
-{
- Q_D(QRouteReply);
- d->rt.append(route);
-}
-
-#include "moc_qroutereply.cpp"
-
-QTM_END_NAMESPACE
diff --git a/src/location/qroutexmlparser.h b/src/location/qroutexmlparser.h
deleted file mode 100644
index 5580b455cc..0000000000
--- a/src/location/qroutexmlparser.h
+++ /dev/null
@@ -1,45 +0,0 @@
-
-#ifndef QROUTEXMLPARSER_H
-#define QROUTEXMLPARSER_H
-
-#include "qmobilityglobal.h"
-#include <QList>
-
-class QXmlStreamReader;
-class QIODevice;
-class QRectF;
-class QDateTime;
-
-QTM_BEGIN_NAMESPACE
-
-class QRouteReply;
-class QRoute;
-class QGeoCoordinate;
-class QManeuver;
-
-class QRouteXmlParser
-{
-
-public:
-
- QRouteXmlParser();
- ~QRouteXmlParser();
-
- bool parse(QIODevice* source, QRouteReply *output);
-
-private:
- bool readRootElement(QRouteReply *output);
- bool readRoute(QRoute *route);
- bool readXsdDateTime(const QString& strDateTime, QDateTime *dateTime, const QString &attributeName);
- bool readXsdDuration(const QString& strDuration, qint32 *durationSeconds, const QString &attributeName);
- bool readManeuver(QManeuver *maneuver);
- bool readGeoPoints(const QString& strPoints, QList<QGeoCoordinate> *geoPoints, const QString &elementName);
- bool readBoundingBox(QRectF *rect);
- bool readCoordinate(QGeoCoordinate *coordinate, const QString &elementName);
-
- QXmlStreamReader *m_reader;
-};
-
-QTM_END_NAMESPACE
-
-#endif