map2d_widget
pureprojection.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 PUREPROJECTION_H
28 #define PUREPROJECTION_H
29 
30 #include "../core/size.h"
31 #include "../core/point.h"
32 #include "../internals/pointlatlng.h"
33 #include "pointlatlng.h"
34 #include "cmath"
35 #include "rectlatlng.h"
36 
37 using namespace core;
38 
39 namespace internals
40 {
41 
43 {
44 
45 
46 public:
47  virtual Size TileSize()const=0;
48 
49  virtual double Axis()const=0;
50 
51  virtual double Flattening()const=0;
52 
53  virtual core::Point FromLatLngToPixel(double lat, double lng, int const& zoom)=0;
54 
55  virtual PointLatLng FromPixelToLatLng(const int &x,const int &y,const int &zoom)=0;
56 
57  virtual QString Type(){return "PureProjection";}
58  core::Point FromLatLngToPixel(const PointLatLng &p,const int &zoom);
59 
60  PointLatLng FromPixelToLatLng(const Point &p,const int &zoom);
61  virtual core::Point FromPixelToTileXY(const core::Point &p);
62  virtual core::Point FromTileXYToPixel(const core::Point &p);
63  virtual Size GetTileMatrixMinXY(const int &zoom)=0;
64  virtual Size GetTileMatrixMaxXY(const int &zoom)=0;
65  virtual Size GetTileMatrixSizeXY(const int &zoom);
66  int GetTileMatrixItemCount(const int &zoom);
67  virtual Size GetTileMatrixSizePixel(const int &zoom);
68  QList<core::Point> GetAreaTileList(const RectLatLng &rect,const int &zoom,const int &padding);
69  virtual double GetGroundResolution(const int &zoom,const double &latitude);
70 
71  double DegreesToRadians(const double &deg)const
72  {
73  return (D2R * deg);
74  }
75 
76  double RadiansToDegrees(const double &rad)const
77  {
78  return (R2D * rad);
79  }
80  void FromGeodeticToCartesian(double Lat,double Lng,double Height, double &X, double &Y, double &Z);
81  void FromCartesianTGeodetic(const double &X,const double &Y,const double &Z, double &Lat, double &Lng);
82  static double DistanceBetweenLatLng(PointLatLng const& p1,PointLatLng const& p2);
83 
84 protected:
85 
86  static const double PI;
87  static const double HALF_PI;
88  static const double TWO_PI;
89  static const double EPSLoN;
90  static const double MAX_VAL;
91  static const double MAXLONG;
92  static const double DBLLONG;
93  static const double R2D;
94  static const double D2R;
95 
96  static double Sign(const double &x);
97 
98  static double AdjustLongitude(double x);
99  static void SinCos(const double &val, double &sin, double &cos);
100  static double e0fn(const double &x);
101  static double e1fn(const double &x);
102  static double e2fn(const double &x);
103  static double e3fn(const double &x);
104  static double mlfn(const double &e0,const double &e1,const double &e2,const double &e3,const double &phi);
105  static qlonglong GetUTMzone(const double &lon);
106 
107 };
108 }
109 
110 
111 #endif // PUREPROJECTION_H
static const double DBLLONG
Definition: pureprojection.h:92
Definition: rectlatlng.h:37
Definition: accessmode.h:35
double RadiansToDegrees(const double &rad) const
Definition: pureprojection.h:76
Definition: size.h:35
static const double MAXLONG
Definition: pureprojection.h:91
Definition: pointlatlng.h:35
static const double PI
Definition: pureprojection.h:86
static const double EPSLoN
Definition: pureprojection.h:89
double DegreesToRadians(const double &deg) const
Definition: pureprojection.h:71
Definition: point.h:35
Definition: copyrightstrings.h:33
static const double R2D
Definition: pureprojection.h:93
static const double MAX_VAL
Definition: pureprojection.h:90
static const double TWO_PI
Definition: pureprojection.h:88
virtual QString Type()
Definition: pureprojection.h:57
Definition: pureprojection.h:42
static const double D2R
Definition: pureprojection.h:94
static const double HALF_PI
Definition: pureprojection.h:87