11#include <QtPositioning/QGeoAddress>
12#include <QtPositioning/QGeoCoordinate>
13#include <QtPositioning/QGeoCircle>
14#include <QtPositioning/QGeoRectangle>
15#include <QtPositioning/QGeoShape>
29 , m_networkManager(networkManager)
51QString QGeoCodingManagerEngineNokia::getAuthenticationString()
const
56 authenticationString +=
"?app_code=";
57 authenticationString += m_token;
59 authenticationString +=
"&app_id=";
60 authenticationString += m_applicationId;
63 return authenticationString;
70 QString requestString =
"https://";
72 requestString +=
"/6.2/geocode.json";
74 requestString += getAuthenticationString();
75 requestString +=
"&gen=9";
77 requestString +=
"&language=";
80 bool manualBoundsRequired =
false;
82 manualBoundsRequired =
true;
86 requestString +=
"?prox=";
91 requestString += trimDouble(circ.
radius());
96 requestString +=
"&bbox=";
97 requestString += trimDouble(
rect.topLeft().latitude());
99 requestString += trimDouble(
rect.topLeft().longitude());
100 requestString +=
";";
101 requestString += trimDouble(
rect.bottomRight().latitude());
102 requestString +=
",";
103 requestString += trimDouble(
rect.bottomRight().longitude());
107 if (
address.country().isEmpty()) {
110 if (!
address.state().isEmpty())
116 if (!
address.postalCode().isEmpty())
119 if (!
address.street().isEmpty())
122 requestString +=
"&searchtext=";
123 requestString += parts.join(
"+").replace(
' ',
'+');
125 requestString +=
"&country=";
126 requestString +=
address.country();
128 if (!
address.state().isEmpty()) {
129 requestString +=
"&state=";
130 requestString +=
address.state();
133 if (!
address.city().isEmpty()) {
134 requestString +=
"&city=";
135 requestString +=
address.city();
138 if (!
address.postalCode().isEmpty()) {
139 requestString +=
"&postalcode=";
140 requestString +=
address.postalCode();
143 if (!
address.street().isEmpty()) {
144 requestString +=
"&street=";
145 requestString +=
address.street();
149 return geocode(requestString, bounds, manualBoundsRequired);
157 QString requestString =
"https://";
159 requestString +=
"/6.2/geocode.json";
161 requestString += getAuthenticationString();
162 requestString +=
"&gen=9";
164 requestString +=
"&language=";
167 requestString +=
"&searchtext=";
171 requestString +=
"&maxresults=";
181 requestString +=
"&pageinformation=";
185 bool manualBoundsRequired =
false;
188 if (
rect.isValid()) {
189 requestString +=
"&bbox=";
190 requestString += trimDouble(
rect.topLeft().latitude());
191 requestString +=
",";
192 requestString += trimDouble(
rect.topLeft().longitude());
193 requestString +=
";";
194 requestString += trimDouble(
rect.bottomRight().latitude());
195 requestString +=
",";
196 requestString += trimDouble(
rect.bottomRight().longitude());
201 requestString +=
"?prox=";
203 requestString +=
",";
205 requestString +=
",";
206 requestString += trimDouble(circ.
radius());
209 manualBoundsRequired =
true;
217 bool manualBoundsRequired,
223 limit,
offset, bounds, manualBoundsRequired,
this);
226 this, &QGeoCodingManagerEngineNokia::placesFinished);
229 this, &QGeoCodingManagerEngineNokia::placesError);
237 QString requestString =
"https://";
239 requestString +=
"/6.2/reversegeocode.json";
241 requestString += getAuthenticationString();
242 requestString +=
"&gen=9";
244 requestString +=
"&mode=retrieveAddresses";
246 requestString +=
"&prox=";
247 requestString += trimDouble(coordinate.
latitude());
248 requestString +=
",";
249 requestString += trimDouble(coordinate.
longitude());
251 bool manualBoundsRequired =
false;
255 requestString +=
",";
256 requestString += trimDouble(circ.
radius());
258 manualBoundsRequired =
true;
261 manualBoundsRequired =
true;
264 requestString +=
"&language=";
267 return geocode(requestString, bounds, manualBoundsRequired);
270QString QGeoCodingManagerEngineNokia::trimDouble(
double degree,
int decimalDigits)
282void QGeoCodingManagerEngineNokia::placesFinished()
QGeoCoordinate center
This property holds the center coordinate for the geo circle.
qreal radius
This property holds the circle radius in meters.
void finished()
This signal is emitted when this reply has finished processing.
void errorOccurred(QGeoCodeReply::Error error, const QString &errorString=QString())
This signal is emitted when an error has been detected in the processing of this reply.
Error
Describes an error which prevented the completion of the operation.
QGeoCodeReply * reverseGeocode(const QGeoCoordinate &coordinate, const QGeoShape &bounds) override
Begins the reverse geocoding of coordinate.
QGeoCodingManagerEngineNokia(QGeoNetworkAccessManager *networkManager, const QVariantMap ¶meters, QGeoServiceProvider::Error *error, QString *errorString)
~QGeoCodingManagerEngineNokia()
QGeoCodeReply * geocode(const QGeoAddress &address, const QGeoShape &bounds) override
Begins the geocoding of address.
void errorOccurred(QGeoCodeReply *reply, QGeoCodeReply::Error error, const QString &errorString=QString())
void finished(QGeoCodeReply *reply)
QLocale locale() const
Returns the locale used to hint to this geocoding manager about what language to use for the results.
double longitude
This property holds the longitude in decimal degrees.
double latitude
This property holds the latitude in decimal degrees.
virtual QNetworkReply * get(const QNetworkRequest &request)=0
Error
Describes an error related to the loading and setup of a service provider plugin.
bool isValid
This property holds the validity of the geo shape.
ShapeType type
This property holds the type of this geo shape.
Q_INVOKABLE QGeoRectangle boundingGeoRectangle() const
Returns a QGeoRectangle representing the geographical bounding rectangle of the geo shape,...
QString getCurrentHost() const
T value(const Key &key, const T &defaultValue=T()) const
bool contains(const Key &key) const
The QNetworkRequest class holds a request to be sent with QNetworkAccessManager.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
QObject * sender() const
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; othe...
void setParent(QObject *parent)
Makes the object a child of parent.
int receivers(const char *signal) const
Returns the number of receivers connected to the signal.
void deleteLater()
\threadsafe
\macro QT_RESTRICTED_CAST_FROM_ASCII
QString & replace(qsizetype i, qsizetype len, QChar after)
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
static QString static QString qsizetype indexOf(QChar c, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
QString toString() const
Returns the variant as a QString if the variant has a userType() including, but not limited to:
static QT_BEGIN_NAMESPACE const unsigned char marc_language_code_list[]
Combined button and popup list for selecting options.
constexpr Initialization Uninitialized
DBusConnection const char DBusError * error
GLenum GLuint GLintptr offset
GLuint GLuint64EXT address
QLatin1StringView QLatin1String
#define QStringLiteral(str)
const QString REVERSE_GEOCODING_HOST
const QString GEOCODING_HOST