summaryrefslogtreecommitdiff
path: root/src/plugins/geoservices/esri
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/geoservices/esri')
-rw-r--r--src/plugins/geoservices/esri/esri.pro10
-rw-r--r--src/plugins/geoservices/esri/esri_plugin.json3
-rw-r--r--src/plugins/geoservices/esri/geocodereply_esri.cpp2
-rw-r--r--src/plugins/geoservices/esri/geocodereply_esri.h2
-rw-r--r--src/plugins/geoservices/esri/geocodingmanagerengine_esri.cpp2
-rw-r--r--src/plugins/geoservices/esri/geocodingmanagerengine_esri.h2
-rw-r--r--src/plugins/geoservices/esri/geomapsource.cpp2
-rw-r--r--src/plugins/geoservices/esri/geomapsource.h2
-rw-r--r--src/plugins/geoservices/esri/georoutejsonparser_esri.cpp2
-rw-r--r--src/plugins/geoservices/esri/georoutejsonparser_esri.h2
-rw-r--r--src/plugins/geoservices/esri/georoutereply_esri.cpp2
-rw-r--r--src/plugins/geoservices/esri/georoutereply_esri.h2
-rw-r--r--src/plugins/geoservices/esri/georoutingmanagerengine_esri.cpp2
-rw-r--r--src/plugins/geoservices/esri/georoutingmanagerengine_esri.h2
-rw-r--r--src/plugins/geoservices/esri/geoserviceproviderfactory_esri.cpp9
-rw-r--r--src/plugins/geoservices/esri/geoserviceproviderfactory_esri.h2
-rw-r--r--src/plugins/geoservices/esri/geotiledmap_esri.cpp2
-rw-r--r--src/plugins/geoservices/esri/geotiledmap_esri.h2
-rw-r--r--src/plugins/geoservices/esri/geotiledmappingmanagerengine_esri.cpp2
-rw-r--r--src/plugins/geoservices/esri/geotiledmappingmanagerengine_esri.h2
-rw-r--r--src/plugins/geoservices/esri/geotiledmapreply_esri.cpp2
-rw-r--r--src/plugins/geoservices/esri/geotiledmapreply_esri.h2
-rw-r--r--src/plugins/geoservices/esri/geotilefetcher_esri.cpp2
-rw-r--r--src/plugins/geoservices/esri/geotilefetcher_esri.h2
-rw-r--r--src/plugins/geoservices/esri/placecategoriesreply_esri.cpp65
-rw-r--r--src/plugins/geoservices/esri/placecategoriesreply_esri.h61
-rw-r--r--src/plugins/geoservices/esri/placemanagerengine_esri.cpp369
-rw-r--r--src/plugins/geoservices/esri/placemanagerengine_esri.h109
-rw-r--r--src/plugins/geoservices/esri/placesearchreply_esri.cpp223
-rw-r--r--src/plugins/geoservices/esri/placesearchreply_esri.h78
30 files changed, 939 insertions, 30 deletions
diff --git a/src/plugins/geoservices/esri/esri.pro b/src/plugins/geoservices/esri/esri.pro
index 3a4da208..fce3947f 100644
--- a/src/plugins/geoservices/esri/esri.pro
+++ b/src/plugins/geoservices/esri/esri.pro
@@ -16,7 +16,10 @@ HEADERS += \
geotiledmap_esri.h \
geotiledmappingmanagerengine_esri.h \
geotiledmapreply_esri.h \
- geotilefetcher_esri.h
+ geotilefetcher_esri.h \
+ placemanagerengine_esri.h \
+ placesearchreply_esri.h \
+ placecategoriesreply_esri.h
SOURCES += \
geocodereply_esri.cpp \
@@ -29,7 +32,10 @@ SOURCES += \
geotiledmap_esri.cpp \
geotiledmappingmanagerengine_esri.cpp \
geotiledmapreply_esri.cpp \
- geotilefetcher_esri.cpp
+ geotilefetcher_esri.cpp \
+ placemanagerengine_esri.cpp \
+ placesearchreply_esri.cpp \
+ placecategoriesreply_esri.cpp
RESOURCES += \
esri.qrc
diff --git a/src/plugins/geoservices/esri/esri_plugin.json b/src/plugins/geoservices/esri/esri_plugin.json
index 3398648e..c1e37614 100644
--- a/src/plugins/geoservices/esri/esri_plugin.json
+++ b/src/plugins/geoservices/esri/esri_plugin.json
@@ -7,7 +7,8 @@
"OnlineMappingFeature",
"OnlineGeocodingFeature",
"ReverseGeocodingFeature",
- "OnlineRoutingFeature"
+ "OnlineRoutingFeature",
+ "OnlinePlacesFeature"
],
"Priority": 1000
}
diff --git a/src/plugins/geoservices/esri/geocodereply_esri.cpp b/src/plugins/geoservices/esri/geocodereply_esri.cpp
index f1dac184..fd1071c9 100644
--- a/src/plugins/geoservices/esri/geocodereply_esri.cpp
+++ b/src/plugins/geoservices/esri/geocodereply_esri.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013-2016 Esri <contracts@esri.com>
+** Copyright (C) 2013-2018 Esri <contracts@esri.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtLocation module of the Qt Toolkit.
diff --git a/src/plugins/geoservices/esri/geocodereply_esri.h b/src/plugins/geoservices/esri/geocodereply_esri.h
index 76b416ce..4f216193 100644
--- a/src/plugins/geoservices/esri/geocodereply_esri.h
+++ b/src/plugins/geoservices/esri/geocodereply_esri.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013-2016 Esri <contracts@esri.com>
+** Copyright (C) 2013-2018 Esri <contracts@esri.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtLocation module of the Qt Toolkit.
diff --git a/src/plugins/geoservices/esri/geocodingmanagerengine_esri.cpp b/src/plugins/geoservices/esri/geocodingmanagerengine_esri.cpp
index 976c51cf..17ed3cd2 100644
--- a/src/plugins/geoservices/esri/geocodingmanagerengine_esri.cpp
+++ b/src/plugins/geoservices/esri/geocodingmanagerengine_esri.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013-2016 Esri <contracts@esri.com>
+** Copyright (C) 2013-2018 Esri <contracts@esri.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtLocation module of the Qt Toolkit.
diff --git a/src/plugins/geoservices/esri/geocodingmanagerengine_esri.h b/src/plugins/geoservices/esri/geocodingmanagerengine_esri.h
index ff7bf882..a18f6bdd 100644
--- a/src/plugins/geoservices/esri/geocodingmanagerengine_esri.h
+++ b/src/plugins/geoservices/esri/geocodingmanagerengine_esri.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013-2016 Esri <contracts@esri.com>
+** Copyright (C) 2013-2018 Esri <contracts@esri.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtLocation module of the Qt Toolkit.
diff --git a/src/plugins/geoservices/esri/geomapsource.cpp b/src/plugins/geoservices/esri/geomapsource.cpp
index 7ec63e2f..7a7d264f 100644
--- a/src/plugins/geoservices/esri/geomapsource.cpp
+++ b/src/plugins/geoservices/esri/geomapsource.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013-2016 Esri <contracts@esri.com>
+** Copyright (C) 2013-2018 Esri <contracts@esri.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtLocation module of the Qt Toolkit.
diff --git a/src/plugins/geoservices/esri/geomapsource.h b/src/plugins/geoservices/esri/geomapsource.h
index 86258d2e..24bef6f7 100644
--- a/src/plugins/geoservices/esri/geomapsource.h
+++ b/src/plugins/geoservices/esri/geomapsource.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013-2016 Esri <contracts@esri.com>
+** Copyright (C) 2013-2018 Esri <contracts@esri.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtLocation module of the Qt Toolkit.
diff --git a/src/plugins/geoservices/esri/georoutejsonparser_esri.cpp b/src/plugins/geoservices/esri/georoutejsonparser_esri.cpp
index 30db48f0..17492d94 100644
--- a/src/plugins/geoservices/esri/georoutejsonparser_esri.cpp
+++ b/src/plugins/geoservices/esri/georoutejsonparser_esri.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013-2016 Esri <contracts@esri.com>
+** Copyright (C) 2013-2018 Esri <contracts@esri.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtLocation module of the Qt Toolkit.
diff --git a/src/plugins/geoservices/esri/georoutejsonparser_esri.h b/src/plugins/geoservices/esri/georoutejsonparser_esri.h
index 0511cf4d..d6451d70 100644
--- a/src/plugins/geoservices/esri/georoutejsonparser_esri.h
+++ b/src/plugins/geoservices/esri/georoutejsonparser_esri.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013-2016 Esri <contracts@esri.com>
+** Copyright (C) 2013-2018 Esri <contracts@esri.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtLocation module of the Qt Toolkit.
diff --git a/src/plugins/geoservices/esri/georoutereply_esri.cpp b/src/plugins/geoservices/esri/georoutereply_esri.cpp
index 811ffd0d..95de6b55 100644
--- a/src/plugins/geoservices/esri/georoutereply_esri.cpp
+++ b/src/plugins/geoservices/esri/georoutereply_esri.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013-2016 Esri <contracts@esri.com>
+** Copyright (C) 2013-2018 Esri <contracts@esri.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtLocation module of the Qt Toolkit.
diff --git a/src/plugins/geoservices/esri/georoutereply_esri.h b/src/plugins/geoservices/esri/georoutereply_esri.h
index 960c90de..19cb85bd 100644
--- a/src/plugins/geoservices/esri/georoutereply_esri.h
+++ b/src/plugins/geoservices/esri/georoutereply_esri.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013-2016 Esri <contracts@esri.com>
+** Copyright (C) 2013-2018 Esri <contracts@esri.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtLocation module of the Qt Toolkit.
diff --git a/src/plugins/geoservices/esri/georoutingmanagerengine_esri.cpp b/src/plugins/geoservices/esri/georoutingmanagerengine_esri.cpp
index ae722e59..0e6bc2c7 100644
--- a/src/plugins/geoservices/esri/georoutingmanagerengine_esri.cpp
+++ b/src/plugins/geoservices/esri/georoutingmanagerengine_esri.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013-2016 Esri <contracts@esri.com>
+** Copyright (C) 2013-2018 Esri <contracts@esri.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtLocation module of the Qt Toolkit.
diff --git a/src/plugins/geoservices/esri/georoutingmanagerengine_esri.h b/src/plugins/geoservices/esri/georoutingmanagerengine_esri.h
index 17aaa3ab..eac32222 100644
--- a/src/plugins/geoservices/esri/georoutingmanagerengine_esri.h
+++ b/src/plugins/geoservices/esri/georoutingmanagerengine_esri.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013-2016 Esri <contracts@esri.com>
+** Copyright (C) 2013-2018 Esri <contracts@esri.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtLocation module of the Qt Toolkit.
diff --git a/src/plugins/geoservices/esri/geoserviceproviderfactory_esri.cpp b/src/plugins/geoservices/esri/geoserviceproviderfactory_esri.cpp
index 0a54e008..197b16cd 100644
--- a/src/plugins/geoservices/esri/geoserviceproviderfactory_esri.cpp
+++ b/src/plugins/geoservices/esri/geoserviceproviderfactory_esri.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013-2016 Esri <contracts@esri.com>
+** Copyright (C) 2013-2018 Esri <contracts@esri.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtLocation module of the Qt Toolkit.
@@ -41,6 +41,7 @@
#include "geotiledmappingmanagerengine_esri.h"
#include "geocodingmanagerengine_esri.h"
#include "georoutingmanagerengine_esri.h"
+#include "placemanagerengine_esri.h"
#include <QtLocation/private/qgeotiledmappingmanagerengine_p.h>
@@ -76,11 +77,7 @@ QGeoRoutingManagerEngine *GeoServiceProviderFactoryEsri::createRoutingManagerEng
QPlaceManagerEngine *GeoServiceProviderFactoryEsri::createPlaceManagerEngine(
const QVariantMap &parameters, QGeoServiceProvider::Error *error, QString *errorString) const
{
- Q_UNUSED(parameters)
- Q_UNUSED(error)
- Q_UNUSED(errorString)
-
- return nullptr;
+ return new PlaceManagerEngineEsri(parameters, error, errorString);
}
QT_END_NAMESPACE
diff --git a/src/plugins/geoservices/esri/geoserviceproviderfactory_esri.h b/src/plugins/geoservices/esri/geoserviceproviderfactory_esri.h
index abd0d59b..6208348a 100644
--- a/src/plugins/geoservices/esri/geoserviceproviderfactory_esri.h
+++ b/src/plugins/geoservices/esri/geoserviceproviderfactory_esri.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013-2016 Esri <contracts@esri.com>
+** Copyright (C) 2013-2018 Esri <contracts@esri.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtLocation module of the Qt Toolkit.
diff --git a/src/plugins/geoservices/esri/geotiledmap_esri.cpp b/src/plugins/geoservices/esri/geotiledmap_esri.cpp
index 8feb9615..020001c4 100644
--- a/src/plugins/geoservices/esri/geotiledmap_esri.cpp
+++ b/src/plugins/geoservices/esri/geotiledmap_esri.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013-2016 Esri <contracts@esri.com>
+** Copyright (C) 2013-2018 Esri <contracts@esri.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtLocation module of the Qt Toolkit.
diff --git a/src/plugins/geoservices/esri/geotiledmap_esri.h b/src/plugins/geoservices/esri/geotiledmap_esri.h
index 7a21af9a..0f62d961 100644
--- a/src/plugins/geoservices/esri/geotiledmap_esri.h
+++ b/src/plugins/geoservices/esri/geotiledmap_esri.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013-2016 Esri <contracts@esri.com>
+** Copyright (C) 2013-2018 Esri <contracts@esri.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtLocation module of the Qt Toolkit.
diff --git a/src/plugins/geoservices/esri/geotiledmappingmanagerengine_esri.cpp b/src/plugins/geoservices/esri/geotiledmappingmanagerengine_esri.cpp
index 33b639fa..5d15835d 100644
--- a/src/plugins/geoservices/esri/geotiledmappingmanagerengine_esri.cpp
+++ b/src/plugins/geoservices/esri/geotiledmappingmanagerengine_esri.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013-2016 Esri <contracts@esri.com>
+** Copyright (C) 2013-2018 Esri <contracts@esri.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtLocation module of the Qt Toolkit.
diff --git a/src/plugins/geoservices/esri/geotiledmappingmanagerengine_esri.h b/src/plugins/geoservices/esri/geotiledmappingmanagerengine_esri.h
index 63172389..222b1779 100644
--- a/src/plugins/geoservices/esri/geotiledmappingmanagerengine_esri.h
+++ b/src/plugins/geoservices/esri/geotiledmappingmanagerengine_esri.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013-2016 Esri <contracts@esri.com>
+** Copyright (C) 2013-2018 Esri <contracts@esri.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtLocation module of the Qt Toolkit.
diff --git a/src/plugins/geoservices/esri/geotiledmapreply_esri.cpp b/src/plugins/geoservices/esri/geotiledmapreply_esri.cpp
index f4431bf0..78f6c69a 100644
--- a/src/plugins/geoservices/esri/geotiledmapreply_esri.cpp
+++ b/src/plugins/geoservices/esri/geotiledmapreply_esri.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013-2016 Esri <contracts@esri.com>
+** Copyright (C) 2013-2018 Esri <contracts@esri.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtLocation module of the Qt Toolkit.
diff --git a/src/plugins/geoservices/esri/geotiledmapreply_esri.h b/src/plugins/geoservices/esri/geotiledmapreply_esri.h
index 572431dd..9e649d4f 100644
--- a/src/plugins/geoservices/esri/geotiledmapreply_esri.h
+++ b/src/plugins/geoservices/esri/geotiledmapreply_esri.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013-2016 Esri <contracts@esri.com>
+** Copyright (C) 2013-2018 Esri <contracts@esri.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtLocation module of the Qt Toolkit.
diff --git a/src/plugins/geoservices/esri/geotilefetcher_esri.cpp b/src/plugins/geoservices/esri/geotilefetcher_esri.cpp
index 8ceba374..00344cf7 100644
--- a/src/plugins/geoservices/esri/geotilefetcher_esri.cpp
+++ b/src/plugins/geoservices/esri/geotilefetcher_esri.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013-2016 Esri <contracts@esri.com>
+** Copyright (C) 2013-2018 Esri <contracts@esri.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtLocation module of the Qt Toolkit.
diff --git a/src/plugins/geoservices/esri/geotilefetcher_esri.h b/src/plugins/geoservices/esri/geotilefetcher_esri.h
index 5702d1c4..8c109f73 100644
--- a/src/plugins/geoservices/esri/geotilefetcher_esri.h
+++ b/src/plugins/geoservices/esri/geotilefetcher_esri.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013-2016 Esri <contracts@esri.com>
+** Copyright (C) 2013-2018 Esri <contracts@esri.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtLocation module of the Qt Toolkit.
diff --git a/src/plugins/geoservices/esri/placecategoriesreply_esri.cpp b/src/plugins/geoservices/esri/placecategoriesreply_esri.cpp
new file mode 100644
index 00000000..44c27b19
--- /dev/null
+++ b/src/plugins/geoservices/esri/placecategoriesreply_esri.cpp
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2013-2018 Esri <contracts@esri.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "placecategoriesreply_esri.h"
+
+QT_BEGIN_NAMESPACE
+
+PlaceCategoriesReplyEsri::PlaceCategoriesReplyEsri(QObject *parent) :
+ QPlaceReply(parent)
+{
+}
+
+PlaceCategoriesReplyEsri::~PlaceCategoriesReplyEsri()
+{
+}
+
+void PlaceCategoriesReplyEsri::emitFinished()
+{
+ setFinished(true);
+ emit finished();
+}
+
+void PlaceCategoriesReplyEsri::setError(QPlaceReply::Error errorCode, const QString &errorString)
+{
+ QPlaceReply::setError(errorCode, errorString);
+ emit error(errorCode, errorString);
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/geoservices/esri/placecategoriesreply_esri.h b/src/plugins/geoservices/esri/placecategoriesreply_esri.h
new file mode 100644
index 00000000..14efcfea
--- /dev/null
+++ b/src/plugins/geoservices/esri/placecategoriesreply_esri.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2013-2018 Esri <contracts@esri.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef PLACECATEGORIESREPLYESRI_H
+#define PLACECATEGORIESREPLYESRI_H
+
+#include <QtLocation/QPlaceReply>
+
+QT_BEGIN_NAMESPACE
+
+class PlaceCategoriesReplyEsri : public QPlaceReply
+{
+ Q_OBJECT
+
+public:
+ explicit PlaceCategoriesReplyEsri(QObject *parent = 0);
+ ~PlaceCategoriesReplyEsri();
+
+ void emitFinished();
+ void setError(QPlaceReply::Error errorCode, const QString &errorString);
+};
+
+QT_END_NAMESPACE
+
+#endif // PLACECATEGORIESREPLYESRI_H
diff --git a/src/plugins/geoservices/esri/placemanagerengine_esri.cpp b/src/plugins/geoservices/esri/placemanagerengine_esri.cpp
new file mode 100644
index 00000000..8f973ff3
--- /dev/null
+++ b/src/plugins/geoservices/esri/placemanagerengine_esri.cpp
@@ -0,0 +1,369 @@
+/****************************************************************************
+**
+** Copyright (C) 2013-2018 Esri <contracts@esri.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "placemanagerengine_esri.h"
+#include "placesearchreply_esri.h"
+#include "placecategoriesreply_esri.h"
+
+#include <QJsonDocument>
+#include <QJsonObject>
+#include <QJsonArray>
+
+#include <QtCore/QUrlQuery>
+
+QT_BEGIN_NAMESPACE
+
+// https://developers.arcgis.com/rest/geocode/api-reference/geocoding-find-address-candidates.htm
+// https://developers.arcgis.com/rest/geocode/api-reference/geocoding-category-filtering.htm
+// https://developers.arcgis.com/rest/geocode/api-reference/geocoding-service-output.htm
+
+static const QString kCategoriesKey(QStringLiteral("categories"));
+static const QString kSingleLineKey(QStringLiteral("singleLine"));
+static const QString kLocationKey(QStringLiteral("location"));
+static const QString kNameKey(QStringLiteral("name"));
+static const QString kOutFieldsKey(QStringLiteral("outFields"));
+static const QString kCandidateFieldsKey(QStringLiteral("candidateFields"));
+static const QString kCountriesKey(QStringLiteral("detailedCountries"));
+static const QString kLocalizedNamesKey(QStringLiteral("localizedNames"));
+static const QString kMaxLocationsKey(QStringLiteral("maxLocations"));
+
+static const QUrl kUrlGeocodeServer("http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer?f=pjson");
+static const QUrl kUrlFindAddressCandidates("http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/findAddressCandidates");
+
+PlaceManagerEngineEsri::PlaceManagerEngineEsri(const QVariantMap &parameters, QGeoServiceProvider::Error *error,
+ QString *errorString) :
+ QPlaceManagerEngine(parameters),
+ m_networkManager(new QNetworkAccessManager(this))
+{
+ *error = QGeoServiceProvider::NoError;
+ errorString->clear();
+}
+
+PlaceManagerEngineEsri::~PlaceManagerEngineEsri()
+{
+}
+
+QList<QLocale> PlaceManagerEngineEsri::locales() const
+{
+ return m_locales;
+}
+
+void PlaceManagerEngineEsri::setLocales(const QList<QLocale> &locales)
+{
+ m_locales = locales;
+}
+
+/***** Search *****/
+
+QPlaceSearchReply *PlaceManagerEngineEsri::search(const QPlaceSearchRequest &request)
+{
+ bool unsupported = false;
+
+ // Only public visibility supported
+ unsupported |= request.visibilityScope() != QLocation::UnspecifiedVisibility &&
+ request.visibilityScope() != QLocation::PublicVisibility;
+ unsupported |= request.searchTerm().isEmpty() && request.categories().isEmpty();
+
+ if (unsupported)
+ return QPlaceManagerEngine::search(request);
+
+ QUrlQuery queryItems;
+ queryItems.addQueryItem(QStringLiteral("f"), QStringLiteral("json"));
+
+ const QGeoCoordinate center = request.searchArea().center();
+ if (center.isValid())
+ {
+ const QString location = QString("%1,%2").arg(center.longitude()).arg(center.latitude());
+ queryItems.addQueryItem(kLocationKey, location);
+ }
+
+ const QGeoRectangle boundingBox = request.searchArea().boundingGeoRectangle();
+ if (!boundingBox.isEmpty())
+ {
+ const QString searchExtent = QString("%1,%2,%3,%4")
+ .arg(boundingBox.topLeft().longitude())
+ .arg(boundingBox.topLeft().latitude())
+ .arg(boundingBox.bottomRight().longitude())
+ .arg(boundingBox.bottomRight().latitude());
+ queryItems.addQueryItem(QStringLiteral("searchExtent"), searchExtent);
+ }
+
+ if (!request.searchTerm().isEmpty())
+ queryItems.addQueryItem(kSingleLineKey, request.searchTerm());
+
+ QStringList categories;
+ if (!request.categories().isEmpty())
+ {
+ foreach (const QPlaceCategory &placeCategory, request.categories())
+ categories.append(placeCategory.categoryId());
+ queryItems.addQueryItem("category", categories.join(","));
+ }
+
+ if (request.limit() > 0)
+ queryItems.addQueryItem(kMaxLocationsKey, QString::number(request.limit()));
+
+ queryItems.addQueryItem(kOutFieldsKey, QStringLiteral("*"));
+
+ QUrl requestUrl(kUrlFindAddressCandidates);
+ requestUrl.setQuery(queryItems);
+
+ QNetworkRequest networkRequest(requestUrl);
+ networkRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
+ QNetworkReply *networkReply = m_networkManager->get(networkRequest);
+
+ PlaceSearchReplyEsri *reply = new PlaceSearchReplyEsri(request, networkReply, m_candidateFieldsLocale, m_countriesLocale, this);
+ connect(reply, SIGNAL(finished()), this, SLOT(replyFinished()));
+ connect(reply, SIGNAL(error(QPlaceReply::Error,QString)), this, SLOT(replyError(QPlaceReply::Error,QString)));
+
+ return reply;
+}
+
+void PlaceManagerEngineEsri::replyFinished()
+{
+ QPlaceReply *reply = qobject_cast<QPlaceReply *>(sender());
+ if (reply)
+ emit finished(reply);
+}
+
+void PlaceManagerEngineEsri::replyError(QPlaceReply::Error errorCode, const QString &errorString)
+{
+ QPlaceReply *reply = qobject_cast<QPlaceReply *>(sender());
+ if (reply)
+ emit error(reply, errorCode, errorString);
+}
+
+/***** Categories *****/
+
+QPlaceReply *PlaceManagerEngineEsri::initializeCategories()
+{
+ initializeGeocodeServer();
+
+ PlaceCategoriesReplyEsri *reply = new PlaceCategoriesReplyEsri(this);
+ connect(reply, SIGNAL(finished()), this, SLOT(replyFinished()));
+ connect(reply, SIGNAL(error(QPlaceReply::Error,QString)), this, SLOT(replyError(QPlaceReply::Error,QString)));
+
+ // TODO delayed finished() emission
+ if (!m_categories.isEmpty())
+ reply->emitFinished();
+
+ m_pendingCategoriesReply.append(reply);
+ return reply;
+}
+
+void PlaceManagerEngineEsri::parseCategories(const QJsonArray &jsonArray, const QString &parentCategoryId)
+{
+ foreach (const QJsonValue &jsonValue, jsonArray)
+ {
+ if (!jsonValue.isObject())
+ continue;
+
+ const QJsonObject jsonCategory = jsonValue.toObject();
+ const QString key = jsonCategory.value(kNameKey).toString();
+ const QString localeName = localizedName(jsonCategory);
+
+ if (key.isEmpty())
+ continue;
+
+ QPlaceCategory category;
+ category.setCategoryId(key);
+ category.setName(localeName.isEmpty() ? key : localeName); // localizedNames
+ m_categories.insert(key, category);
+ m_subcategories[parentCategoryId].append(key);
+ m_parentCategory.insert(key, parentCategoryId);
+ emit categoryAdded(category, parentCategoryId);
+
+ if (jsonCategory.contains(kCategoriesKey))
+ {
+ const QJsonArray jsonArray = jsonCategory.value(kCategoriesKey).toArray();
+ parseCategories(jsonArray, key);
+ }
+ }
+}
+
+QString PlaceManagerEngineEsri::parentCategoryId(const QString &categoryId) const
+{
+ return m_parentCategory.value(categoryId);
+}
+
+QStringList PlaceManagerEngineEsri::childCategoryIds(const QString &categoryId) const
+{
+ return m_subcategories.value(categoryId);
+}
+
+QPlaceCategory PlaceManagerEngineEsri::category(const QString &categoryId) const
+{
+ return m_categories.value(categoryId);
+}
+
+QList<QPlaceCategory> PlaceManagerEngineEsri::childCategories(const QString &parentId) const
+{
+ QList<QPlaceCategory> categories;
+ foreach (const QString &id, m_subcategories.value(parentId))
+ categories.append(m_categories.value(id));
+ return categories;
+}
+
+void PlaceManagerEngineEsri::finishCategories()
+{
+ foreach (PlaceCategoriesReplyEsri *reply, m_pendingCategoriesReply)
+ reply->emitFinished();
+ m_pendingCategoriesReply.clear();
+}
+
+void PlaceManagerEngineEsri::errorCaterogies(const QString &error)
+{
+ foreach (PlaceCategoriesReplyEsri *reply, m_pendingCategoriesReply)
+ reply->setError(QPlaceReply::CommunicationError, error);
+}
+
+/***** GeocodeServer *****/
+
+void PlaceManagerEngineEsri::initializeGeocodeServer()
+{
+ // Only fetch categories once
+ if (m_categories.isEmpty() && !m_geocodeServerReply)
+ {
+ m_geocodeServerReply = m_networkManager->get(QNetworkRequest(kUrlGeocodeServer));
+ connect(m_geocodeServerReply, SIGNAL(finished()), this, SLOT(geocodeServerReplyFinished()));
+ connect(m_geocodeServerReply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(geocodeServerReplyError()));
+ }
+}
+
+QString PlaceManagerEngineEsri::localizedName(const QJsonObject &jsonObject)
+{
+ const QJsonObject localizedNames = jsonObject.value(kLocalizedNamesKey).toObject();
+
+ foreach (const QLocale &locale, m_locales)
+ {
+ const QString localeStr = locale.name();
+ if (localizedNames.contains(localeStr))
+ {
+ return localizedNames.value(localeStr).toString();
+ }
+
+ const QString shortLocale = localeStr.left(2);
+ if (localizedNames.contains(shortLocale))
+ {
+ return localizedNames.value(shortLocale).toString();
+ }
+ }
+ return QString();
+}
+
+void PlaceManagerEngineEsri::parseCandidateFields(const QJsonArray &jsonArray)
+{
+ foreach (const QJsonValue &jsonValue, jsonArray)
+ {
+ if (!jsonValue.isObject())
+ continue;
+
+ const QJsonObject jsonCandidateField = jsonValue.toObject();
+ if (!jsonCandidateField.contains(kLocalizedNamesKey))
+ continue;
+
+ const QString key = jsonCandidateField.value(kNameKey).toString();
+ m_candidateFieldsLocale.insert(key, localizedName(jsonCandidateField));
+ }
+}
+
+void PlaceManagerEngineEsri::parseCountries(const QJsonArray &jsonArray)
+{
+ foreach (const QJsonValue &jsonValue, jsonArray)
+ {
+ if (!jsonValue.isObject())
+ continue;
+
+ const QJsonObject jsonCountry = jsonValue.toObject();
+ if (!jsonCountry.contains(kLocalizedNamesKey))
+ continue;
+
+ const QString key = jsonCountry.value(kNameKey).toString();
+ m_countriesLocale.insert(key, localizedName(jsonCountry));
+ }
+}
+
+void PlaceManagerEngineEsri::geocodeServerReplyFinished()
+{
+ if (!m_geocodeServerReply)
+ return;
+
+ QJsonDocument document = QJsonDocument::fromJson(m_geocodeServerReply->readAll());
+ if (!document.isObject())
+ {
+ errorCaterogies(m_geocodeServerReply->errorString());
+ return;
+ }
+
+ QJsonObject jsonObject = document.object();
+
+ // parse categories
+ if (jsonObject.contains(kCategoriesKey))
+ {
+ const QJsonArray jsonArray = jsonObject.value(kCategoriesKey).toArray();
+ parseCategories(jsonArray, QString());
+ }
+
+ // parse candidateFields
+ if (jsonObject.contains(kCandidateFieldsKey))
+ {
+ const QJsonArray jsonArray = jsonObject.value(kCandidateFieldsKey).toArray();
+ parseCandidateFields(jsonArray);
+ }
+
+ // parse countries
+ if (jsonObject.contains(kCountriesKey))
+ {
+ const QJsonArray jsonArray = jsonObject.value(kCountriesKey).toArray();
+ parseCountries(jsonArray);
+ }
+
+ finishCategories();
+
+ m_geocodeServerReply->deleteLater();
+}
+
+void PlaceManagerEngineEsri::geocodeServerReplyError()
+{
+ if (m_categories.isEmpty() && !m_geocodeServerReply)
+ return;
+
+ errorCaterogies(m_geocodeServerReply->errorString());
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/geoservices/esri/placemanagerengine_esri.h b/src/plugins/geoservices/esri/placemanagerengine_esri.h
new file mode 100644
index 00000000..2edb2d1a
--- /dev/null
+++ b/src/plugins/geoservices/esri/placemanagerengine_esri.h
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** Copyright (C) 2013-2018 Esri <contracts@esri.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef PLACEMANAGERENGINEESRI_H
+#define PLACEMANAGERENGINEESRI_H
+
+#include <QtLocation/QPlaceManagerEngine>
+#include <QtLocation/QGeoServiceProvider>
+
+QT_BEGIN_NAMESPACE
+
+class PlaceCategoriesReplyEsri;
+class QNetworkAccessManager;
+class QNetworkReply;
+
+class PlaceManagerEngineEsri : public QPlaceManagerEngine
+{
+ Q_OBJECT
+
+public:
+ PlaceManagerEngineEsri(const QVariantMap &parameters, QGeoServiceProvider::Error *error, QString *errorString);
+ ~PlaceManagerEngineEsri();
+
+ QPlaceSearchReply *search(const QPlaceSearchRequest &request) override;
+
+ QPlaceReply *initializeCategories() override;
+ QString parentCategoryId(const QString &categoryId) const override;
+ QStringList childCategoryIds(const QString &categoryId) const override;
+ QPlaceCategory category(const QString &categoryId) const override;
+
+ QList<QPlaceCategory> childCategories(const QString &parentId) const override;
+
+ QList<QLocale> locales() const override;
+ void setLocales(const QList<QLocale> &locales) override;
+
+private slots:
+ void geocodeServerReplyFinished();
+ void geocodeServerReplyError();
+ void replyFinished();
+ void replyError(QPlaceReply::Error errorCode, const QString &errorString);
+
+private:
+ QNetworkAccessManager *m_networkManager = Q_NULLPTR;
+
+ // geocode serveur
+ void initializeGeocodeServer();
+
+ QNetworkReply *m_geocodeServerReply = Q_NULLPTR;
+
+ // categories
+ void finishCategories();
+ void errorCaterogies(const QString &error);
+ void parseCategories(const QJsonArray &jsonArray, const QString &parentCategoryId);
+
+ QList<PlaceCategoriesReplyEsri *> m_pendingCategoriesReply;
+ QHash<QString, QPlaceCategory> m_categories;
+ QHash<QString, QStringList> m_subcategories;
+ QHash<QString, QString> m_parentCategory;
+
+ // localized names
+ QString localizedName(const QJsonObject &jsonObject);
+ void parseCandidateFields(const QJsonArray &jsonArray);
+ void parseCountries(const QJsonArray &jsonArray);
+
+ QList<QLocale> m_locales;
+ QHash<QString, QString> m_candidateFieldsLocale;
+ QHash<QString, QString> m_countriesLocale;
+ void localizedName();
+};
+
+QT_END_NAMESPACE
+
+#endif // PLACEMANAGERENGINEESRI_H
diff --git a/src/plugins/geoservices/esri/placesearchreply_esri.cpp b/src/plugins/geoservices/esri/placesearchreply_esri.cpp
new file mode 100644
index 00000000..a5a3585a
--- /dev/null
+++ b/src/plugins/geoservices/esri/placesearchreply_esri.cpp
@@ -0,0 +1,223 @@
+/****************************************************************************
+**
+** Copyright (C) 2013-2018 Esri <contracts@esri.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "placesearchreply_esri.h"
+#include "placemanagerengine_esri.h"
+
+#include <QtCore/QJsonDocument>
+#include <QtCore/QJsonArray>
+#include <QtCore/QJsonObject>
+#include <QtNetwork/QNetworkReply>
+#include <QtPositioning/QGeoCircle>
+#include <QtPositioning/QGeoRectangle>
+#include <QtLocation/QPlaceResult>
+#include <QtLocation/QPlaceSearchRequest>
+#include <QtLocation/private/qplacesearchrequest_p.h>
+
+static const QString kCandidatesKey(QStringLiteral("candidates"));
+static const QString kAttributesKey(QStringLiteral("attributes"));
+static const QString kAddressKey(QStringLiteral("address"));
+static const QString kLongLabelKey(QStringLiteral("LongLabel"));
+static const QString kCityKey(QStringLiteral("City"));
+static const QString kCountryKey(QStringLiteral("Country"));
+static const QString kRegionKey(QStringLiteral("Region"));
+static const QString kPostalKey(QStringLiteral("Postal"));
+static const QString kStAddrKey(QStringLiteral("StAddr"));
+static const QString kStateKey(QStringLiteral("State"));
+static const QString kDistrictKey(QStringLiteral("District"));
+static const QString kLocationKey(QStringLiteral("location"));
+static const QString kXKey(QStringLiteral("x"));
+static const QString kYKey(QStringLiteral("y"));
+static const QString kDistanceKey(QStringLiteral("Distance"));
+static const QString kPhoneKey(QStringLiteral("Phone"));
+static const QString kExtentKey(QStringLiteral("extent"));
+static const QString kXminKey(QStringLiteral("xmin"));
+static const QString kYminKey(QStringLiteral("ymin"));
+static const QString kXmaxKey(QStringLiteral("xmax"));
+static const QString kYmaxKey(QStringLiteral("ymax"));
+
+QT_BEGIN_NAMESPACE
+
+PlaceSearchReplyEsri::PlaceSearchReplyEsri(const QPlaceSearchRequest &request, QNetworkReply *reply,
+ const QHash<QString, QString> &candidateFields,
+ const QHash<QString, QString> &countries, PlaceManagerEngineEsri *parent) :
+ QPlaceSearchReply(parent), m_candidateFields(candidateFields), m_countries(countries)
+{
+ Q_ASSERT(parent);
+ if (!reply) {
+ setError(UnknownError, QStringLiteral("Null reply"));
+ return;
+ }
+ setRequest(request);
+
+ connect(reply, SIGNAL(finished()), this, SLOT(replyFinished()));
+ connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(networkError(QNetworkReply::NetworkError)));
+ connect(this, &QPlaceReply::aborted, reply, &QNetworkReply::abort);
+ connect(this, &QObject::destroyed, reply, &QObject::deleteLater);
+}
+
+PlaceSearchReplyEsri::~PlaceSearchReplyEsri()
+{
+}
+
+void PlaceSearchReplyEsri::setError(QPlaceReply::Error errorCode, const QString &errorString)
+{
+ QPlaceReply::setError(errorCode, errorString);
+ emit error(errorCode, errorString);
+ setFinished(true);
+ emit finished();
+}
+
+void PlaceSearchReplyEsri::replyFinished()
+{
+ QNetworkReply *reply = static_cast<QNetworkReply *>(sender());
+ reply->deleteLater();
+
+ if (reply->error() != QNetworkReply::NoError)
+ return;
+
+ QJsonDocument document = QJsonDocument::fromJson(reply->readAll());
+ if (!document.isObject())
+ {
+ setError(ParseError, tr("Response parse error"));
+ return;
+ }
+
+ QJsonValue suggestions = document.object().value(kCandidatesKey);
+ if (!suggestions.isArray())
+ {
+ setError(ParseError, tr("Response parse error"));
+ return;
+ }
+
+ QJsonArray resultsArray = suggestions.toArray();
+
+ QList<QPlaceSearchResult> results;
+ for (int i = 0; i < resultsArray.count(); ++i)
+ {
+ QJsonObject item = resultsArray.at(i).toObject();
+ QPlaceResult placeResult = parsePlaceResult(item);
+ results.append(placeResult);
+ }
+
+ setResults(results);
+ setFinished(true);
+ emit finished();
+}
+
+void PlaceSearchReplyEsri::networkError(QNetworkReply::NetworkError error)
+{
+ Q_UNUSED(error)
+ QNetworkReply *reply = static_cast<QNetworkReply *>(sender());
+ reply->deleteLater();
+ setError(QPlaceReply::CommunicationError, reply->errorString());
+}
+
+QPlaceResult PlaceSearchReplyEsri::parsePlaceResult(const QJsonObject &item) const
+{
+ QPlace place;
+ QHash<QString, QString> keys;
+
+ // set attributes
+ const QJsonObject attributes = item.value(kAttributesKey).toObject();
+ for (const QString &key: attributes.keys())
+ {
+ const QString value = attributes.value(key).toVariant().toString();
+ if (!value.isEmpty())
+ {
+ QPlaceAttribute attribute;
+ attribute.setLabel(m_candidateFields.value(key, key)); // local name or key
+ attribute.setText(value);
+ place.setExtendedAttribute(key, attribute);
+ keys.insert(key, value);
+ }
+ }
+
+ if (keys.contains(kPhoneKey))
+ {
+ QPlaceContactDetail contactDetail;
+ contactDetail.setLabel(m_candidateFields.value(kPhoneKey, kPhoneKey)); // local name or key
+ contactDetail.setValue(keys.value(kPhoneKey));
+ place.appendContactDetail(QPlaceContactDetail::Phone, contactDetail);
+ }
+
+ // set address
+ QGeoAddress geoAddress;
+ geoAddress.setCity(keys.value(kCityKey));
+ geoAddress.setCountry(m_countries.value(keys.value(kCountryKey))); // mismatch code ISO2 vs ISO3
+ geoAddress.setCounty(keys.value(kRegionKey));
+ geoAddress.setPostalCode(keys.value(kPostalKey));
+ geoAddress.setStreet(keys.value(kStAddrKey));
+ geoAddress.setState(keys.value(kStateKey));
+ geoAddress.setDistrict(keys.value(kDistrictKey));
+
+ // set location
+ const QJsonObject location = item.value(kLocationKey).toObject();
+ const QGeoCoordinate coordinate = QGeoCoordinate(location.value(kYKey).toDouble(),
+ location.value(kXKey).toDouble());
+
+ // set boundingBox
+ const QJsonObject extent = item.value(kExtentKey).toObject();
+ const QGeoCoordinate topLeft(extent.value(kYminKey).toDouble(),
+ extent.value(kXminKey).toDouble());
+ const QGeoCoordinate bottomRight(extent.value(kYmaxKey).toDouble(),
+ extent.value(kXmaxKey).toDouble());
+ const QGeoRectangle boundingBox(topLeft, bottomRight);
+
+ // set geolocation
+ QGeoLocation geoLocation;
+ geoLocation.setCoordinate(coordinate);
+ geoLocation.setAddress(geoAddress);
+ geoLocation.setBoundingBox(boundingBox);
+
+ // set place
+ place.setName(keys.value(kLongLabelKey));
+ place.setLocation(geoLocation);
+ place.setPlaceId(attributes.value(kLongLabelKey).toString());
+
+ // set place result
+ QPlaceResult result;
+ result.setPlace(place);
+ result.setTitle(keys.value(kAddressKey));
+ result.setDistance(keys.value(kDistanceKey).toDouble());
+
+ return result;
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/geoservices/esri/placesearchreply_esri.h b/src/plugins/geoservices/esri/placesearchreply_esri.h
new file mode 100644
index 00000000..195d650d
--- /dev/null
+++ b/src/plugins/geoservices/esri/placesearchreply_esri.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2013-2018 Esri <contracts@esri.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef PLACESEARCHREPLYESRI_H
+#define PLACESEARCHREPLYESRI_H
+
+#include <QtLocation/QPlaceSearchReply>
+#include <QNetworkReply>
+
+QT_BEGIN_NAMESPACE
+
+class PlaceManagerEngineEsri;
+class QNetworkReply;
+class QPlaceResult;
+
+class PlaceSearchReplyEsri : public QPlaceSearchReply
+{
+ Q_OBJECT
+
+public:
+ PlaceSearchReplyEsri(const QPlaceSearchRequest &request, QNetworkReply *reply,
+ const QHash<QString, QString> &candidateFields,
+ const QHash<QString, QString> &countries, PlaceManagerEngineEsri *parent);
+ ~PlaceSearchReplyEsri();
+
+ QString requestUrl;
+
+private slots:
+ void setError(QPlaceReply::Error errorCode, const QString &errorString);
+ void replyFinished();
+ void networkError(QNetworkReply::NetworkError error);
+
+private:
+ QPlaceResult parsePlaceResult(const QJsonObject &item) const;
+
+ const QHash<QString, QString> &m_candidateFields;
+ const QHash<QString, QString> &m_countries;
+};
+
+QT_END_NAMESPACE
+
+#endif // PLACESEARCHREPLYESRI_H