dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
urlfactory.h
Go to the documentation of this file.
1 
13 /*
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 3 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 * for more details.
23 *
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, see <http://www.gnu.org/licenses/>
26 */
27 #ifndef URLFACTORY_H
28 #define URLFACTORY_H
29 
30 #include <QtNetwork/QNetworkProxy>
31 #include <QtNetwork/QNetworkAccessManager>
32 #include <QUrl>
33 #include <QtNetwork/QNetworkRequest>
34 #include <QtNetwork/QNetworkReply>
35 #include <QTimer>
36 #include <QCoreApplication>
37 #include "providerstrings.h"
38 #include "pureimagecache.h"
39 #include "../internals/pointlatlng.h"
40 #include "geodecoderstatus.h"
41 #include <QTime>
42 #include "cache.h"
43 #include <QTextCodec>
44 #include "cmath"
45 #include "QDomElement"
46 
47 namespace core {
48  class UrlFactory: public QObject,public ProviderStrings
49  {
50  Q_OBJECT
51  public:
55  QByteArray UserAgent;
56  QNetworkProxy Proxy;
57  UrlFactory();
58  ~UrlFactory();
60  {
61  QString address;
63  };
64  QString MakeImageUrl(const MapType::Types &type,const core::Point &pos,const int &zoom,const QString &language);
65  QList <UrlFactory::geoCodingStruct> GetLatLngFromGeodecoder(const QString &keywords,GeoCoderStatusCode::Types &status,const QString &language);
66  QList <UrlFactory::geoCodingStruct> GetPlacemarkFromGeocoder(internals::PointLatLng location, GeoCoderStatusCode::Types &status, const QString &language);
67  double GetElevationFromCoordinate(const internals::PointLatLng &coordinate, GeoCoderStatusCode::Types &status);
68  int Timeout;
69 
70  private:
71  void GetSecGoogleWords(const core::Point &pos, QString &sec1, QString &sec2);
72  int GetServerNum(const core::Point &pos,const int &max) const;
73  void TryCorrectGoogleVersions();
74  bool isCorrectedGoogleVersions;
75  QString TileXYToQuadKey(const int &tileX,const int &tileY,const int &levelOfDetail) const;
76  bool CorrectGoogleVersions;
77  bool UseGeocoderCache; //TODO GetSet
78  bool UsePlacemarkCache;//TODO GetSet
79  static const double EarthRadiusKm;
80  double GetDistance(internals::PointLatLng p1,internals::PointLatLng p2);
81  QMutex mutex;
82  QList<UrlFactory::geoCodingStruct> GetGeoCodingFromXML(QString xml, GeoCoderStatusCode::Types &status);
83  QByteArray FetchWebRequest(QString url, QNetworkReply::NetworkError &result);
84  protected:
85  static short timelapse;
86  QString LanguageStr;
88  void setIsCorrectGoogleVersions(bool value);
89  QString MakeGeocoderUrl(QString keywords, const QString &language);
90  QString MakeReverseGeocoderUrl(internals::PointLatLng &pt,const QString &language);
91  QList <UrlFactory::geoCodingStruct> GetLatLngFromGeocoderUrl(const QString &url,const bool &useCache, GeoCoderStatusCode::Types &status);
92  QList <UrlFactory::geoCodingStruct> GetPlacemarkFromReverseGeocoderUrl(const QString &url,const bool &useCache, GeoCoderStatusCode::Types &status);
93  };
94 
95 }
96 #endif // URLFACTORY_H
QList< UrlFactory::geoCodingStruct > GetLatLngFromGeodecoder(const QString &keywords, GeoCoderStatusCode::Types &status, const QString &language)
Definition: urlfactory.cpp:526
internals::PointLatLng coordinates
Definition: urlfactory.h:62
QByteArray UserAgent
Gets or sets the value of the User-agent HTTP header.
Definition: urlfactory.h:55
QList< UrlFactory::geoCodingStruct > GetPlacemarkFromGeocoder(internals::PointLatLng location, GeoCoderStatusCode::Types &status, const QString &language)
Definition: urlfactory.cpp:585
double GetElevationFromCoordinate(const internals::PointLatLng &coordinate, GeoCoderStatusCode::Types &status)
Definition: urlfactory.cpp:712
QString MakeReverseGeocoderUrl(internals::PointLatLng &pt, const QString &language)
Definition: urlfactory.cpp:518
bool IsCorrectGoogleVersions()
Definition: urlfactory.cpp:87
QString MakeGeocoderUrl(QString keywords, const QString &language)
Definition: urlfactory.cpp:509
QString LanguageStr
Definition: urlfactory.h:86
QList< UrlFactory::geoCodingStruct > GetPlacemarkFromReverseGeocoderUrl(const QString &url, const bool &useCache, GeoCoderStatusCode::Types &status)
Definition: urlfactory.cpp:590
QList< UrlFactory::geoCodingStruct > GetLatLngFromGeocoderUrl(const QString &url, const bool &useCache, GeoCoderStatusCode::Types &status)
Definition: urlfactory.cpp:531
void setIsCorrectGoogleVersions(bool value)
Definition: urlfactory.cpp:82
QString MakeImageUrl(const MapType::Types &type, const core::Point &pos, const int &zoom, const QString &language)
UrlFactory::MakeImageUrl Make the requesting URL for the desired quadtile.
Definition: urlfactory.cpp:191
static short timelapse
Definition: urlfactory.h:85
QNetworkProxy Proxy
Definition: urlfactory.h:56
Definition: icore.h:39