38 const QUrl &requestUrl,
const QString &userAgent,
const QString &authenticationKey)
40 QNetworkRequest networkRequest(requestUrl);
41 networkRequest.setHeader(QNetworkRequest::UserAgentHeader, userAgent.toLatin1());
42 networkRequest.setRawHeader(
43 "Authorization", QStringLiteral(
"Bearer %1").arg(authenticationKey).toLatin1());
45 return networkRequest;
100 auto northeastCoordObj = CoordinateJson::tryConvertFromQGeoCoordinate(boundingGeoRect.topRight());
101 auto southwestCoordObj = CoordinateJson::tryConvertFromQGeoCoordinate(boundingGeoRect.bottomLeft());
103 return !northeastCoordObj.isEmpty() && !southwestCoordObj.isEmpty()
106 {northeastKey, northeastCoordObj},
107 {southwestKey, southwestCoordObj},
114 if (!coordinateBounds.contains(northeastKey) || !coordinateBounds.contains(southwestKey))
117 const auto northeast =
118 CoordinateJson::tryConvertToQGeoCoordinate(coordinateBounds.value(northeastKey).toObject());
119 const auto southwest =
120 CoordinateJson::tryConvertToQGeoCoordinate(coordinateBounds.value(southwestKey).toObject());
122 return northeast.isValid() && southwest.isValid()
123 ? QGeoRectangle(QList<QGeoCoordinate>({northeast, southwest}))
135 const auto addressJsonObj = siteJsonObj.value(QStringLiteral(
"address")).toObject();
136 if (!addressJsonObj.isEmpty()) {
137 address.setCountry(addressJsonObj.value(QStringLiteral(
"country")).toVariant().toString());
138 address.setCountryCode(addressJsonObj.value(QStringLiteral(
"countryCode")).toVariant().toString());
139 address.setState(addressJsonObj.value(QStringLiteral(
"adminArea")).toVariant().toString());
141 auto city = addressJsonObj.value(QStringLiteral(
"city")).toVariant().toString();
145 : addressJsonObj.value(QStringLiteral(
"locality")).toVariant().toString());
146 address.setPostalCode(addressJsonObj.value(QStringLiteral(
"postalCode")).toVariant().toString());
148 auto streetName = addressJsonObj.value(QStringLiteral(
"thoroughfare")).toVariant().toString();
149 auto streetNumber = addressJsonObj.value(QStringLiteral(
"streetNumber")).toVariant().toString();
150 address.setStreet(QString(
"%1 %2").arg(streetName).arg(streetNumber).trimmed());
153 address.setText(siteJsonObj.value(QStringLiteral(
"formatAddress")).toVariant().toString());
160 QGeoLocation location;
162 location.setAddress(tryConvertToGeoAddress(siteJsonObj));
163 location.setCoordinate(
164 OhosMapKit::CoordinateJson::tryConvertToQGeoCoordinate(
165 siteJsonObj.value(QStringLiteral(
"location")).toObject()));
166 location.setBoundingShape(
167 OhosMapKit::CoordinateBoundsJson::tryConvertToQGeoRectangle(
168 siteJsonObj.value(QStringLiteral(
"viewport")).toObject()));