map2d_widget
urlfactory.h
Go to the documentation of this file.
1 
12 /*
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 3 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 * for more details.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
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 "placemark.h"
44 #include <QTextCodec>
45 #include "cmath"
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();
59  QString MakeImageUrl(const MapType::Types &type,const core::Point &pos,const int &zoom,const QString &language);
62  int Timeout;
63  private:
64  void GetSecGoogleWords(const core::Point &pos, QString &sec1, QString &sec2);
65  int GetServerNum(const core::Point &pos,const int &max) const;
66  void TryCorrectGoogleVersions();
67  bool isCorrectedGoogleVersions;
68  QString TileXYToQuadKey(const int &tileX,const int &tileY,const int &levelOfDetail) const;
69  bool CorrectGoogleVersions;
70  bool UseGeocoderCache; //TODO GetSet
71  bool UsePlacemarkCache;//TODO GetSet
72  static const double EarthRadiusKm;
73  double GetDistance(internals::PointLatLng p1,internals::PointLatLng p2);
74  QMutex mutex;
75 
76  protected:
77  static short timelapse;
78  QString LanguageStr;
80  void setIsCorrectGoogleVersions(bool value);
81  QString MakeGeocoderUrl(QString keywords);
82  QString MakeReverseGeocoderUrl(internals::PointLatLng &pt,const QString &language);
83  internals::PointLatLng GetLatLngFromGeocoderUrl(const QString &url,const bool &useCache, GeoCoderStatusCode::Types &status);
84  Placemark GetPlacemarkFromReverseGeocoderUrl(const QString &url,const bool &useCache);
85  };
86 
87 }
88 #endif // URLFACTORY_H
QString MakeGeocoderUrl(QString keywords)
Definition: urlfactory.cpp:492
Definition: providerstrings.h:34
Placemark GetPlacemarkFromGeocoder(internals::PointLatLng location)
Definition: urlfactory.cpp:595
Types
Definition: maptype.h:39
Definition: accessmode.h:35
QString MakeImageUrl(const MapType::Types &type, const core::Point &pos, const int &zoom, const QString &language)
Definition: urlfactory.cpp:175
Definition: pointlatlng.h:35
internals::PointLatLng GetLatLngFromGeocoderUrl(const QString &url, const bool &useCache, GeoCoderStatusCode::Types &status)
Definition: urlfactory.cpp:507
static short timelapse
Definition: urlfactory.h:77
Definition: point.h:35
Definition: urlfactory.h:48
void setIsCorrectGoogleVersions(bool value)
Definition: urlfactory.cpp:80
QNetworkProxy Proxy
Definition: urlfactory.h:56
Types
Definition: geodecoderstatus.h:40
QString LanguageStr
Definition: urlfactory.h:78
UrlFactory()
Definition: urlfactory.cpp:34
Definition: placemark.h:34
~UrlFactory()
Definition: urlfactory.cpp:53
QByteArray UserAgent
Gets or sets the value of the User-agent HTTP header.
Definition: urlfactory.h:55
int Timeout
Definition: urlfactory.h:62
bool IsCorrectGoogleVersions()
Definition: urlfactory.cpp:85
internals::PointLatLng GetLatLngFromGeodecoder(const QString &keywords, GeoCoderStatusCode::Types &status)
Definition: urlfactory.cpp:503
Placemark GetPlacemarkFromReverseGeocoderUrl(const QString &url, const bool &useCache)
Definition: urlfactory.cpp:600
QString MakeReverseGeocoderUrl(internals::PointLatLng &pt, const QString &language)
Definition: urlfactory.cpp:497