1 /***************************************************************************
2                qgsprojectionfactors.h
3                ------------------------
4     begin                : May 2021
5     copyright            : (C) 2021 Nyall Dawson
6     email                : nyall dot dawson at gmail dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  *                                                                         *
11  *   This program is free software; you can redistribute it and/or modify  *
12  *   it under the terms of the GNU General Public License as published by  *
13  *   the Free Software Foundation; either version 2 of the License, or     *
14  *   (at your option) any later version.                                   *
15  *                                                                         *
16  ***************************************************************************/
17 #ifndef QGSPROJECTIONFACTORS_H
18 #define QGSPROJECTIONFACTORS_H
19 
20 #include "qgis_core.h"
21 #include "qgis_sip.h"
22 #include <QString>
23 
24 /**
25  * \class QgsProjectionFactors
26  * \ingroup core
27  * \brief contains various cartographic properties, such as scale factors, angular distortion and meridian convergence.
28  * \since QGIS 3.20
29  */
30 class CORE_EXPORT QgsProjectionFactors
31 {
32   public:
33 
34     /**
35      * Returns TRUE if the factors are valid, or FALSE if they could not be calculated.
36      */
isValid()37     bool isValid() const { return mIsValid; }
38 
39     //! Meridional scale at coordinate (λ,ϕ).
meridionalScale()40     double meridionalScale() const { return mMeridionalScale; }
41 
42     //! Parallel scale at coordinate (λ,ϕ).
parallelScale()43     double parallelScale() const { return mParallelScale; }
44 
45     //! Areal scale factor at coordinate (λ,ϕ).
arealScale()46     double arealScale() const { return mArealScale; }
47 
48     //! Angular distortion at coordinate (λ,ϕ).
angularDistortion()49     double angularDistortion() const { return mAngularDistortion; }
50 
51     //! Meridian/parallel angle (in degrees), θ′, at coordinate (λ,ϕ).
meridianParallelAngle()52     double meridianParallelAngle() const { return mMeridianParallelAngle; }
53 
54     //! Meridian convergence (in degrees) at coordinate (λ,ϕ). Sometimes also described as grid declination.
meridianConvergence()55     double meridianConvergence() const { return mMeridianConvergence; }
56 
57     //! Maximum scale factor.
tissotSemimajor()58     double tissotSemimajor() const { return mTissotSemimajor; }
59 
60     //! Minimum scale factor.
tissotSemiminor()61     double tissotSemiminor() const { return mTissotSemiminor; }
62 
63     //! Partial derivative ∂x/∂λ of coordinate (λ,ϕ).
dxDlam()64     double dxDlam() const  { return mDxDlam; }
65 
66     //! Partial derivative ∂x/∂ϕ of coordinate (λ,ϕ).
dxDphi()67     double dxDphi() const  { return mDxDphi; }
68 
69     //! Partial derivative ∂y/∂λ of coordinate (λ,ϕ).
dyDlam()70     double dyDlam() const  { return mDyDlam; }
71 
72     //!Partial derivative ∂y/∂ϕ of coordinate (λ,ϕ).
dyDphi()73     double dyDphi() const  { return mDyDphi; }
74 
75 #ifdef SIP_RUN
76     SIP_PYOBJECT __repr__();
77     % MethodCode
78     QString str;
79     if ( !sipCpp->isValid() )
80     {
81       str = QStringLiteral( "<QgsProjectionFactors: invalid>" );
82     }
83     else
84     {
85       str = QStringLiteral( "<QgsProjectionFactors>" );
86     }
87     sipRes = PyUnicode_FromString( str.toUtf8().constData() );
88     % End
89 #endif
90 
91   private:
92 
93     bool mIsValid = false;
94     double mMeridionalScale = 0;
95     double mParallelScale = 0;
96     double mArealScale = 0;
97     double mAngularDistortion = 0;
98     double mMeridianParallelAngle = 0;
99     double mMeridianConvergence = 0;
100     double mTissotSemimajor = 0;
101     double mTissotSemiminor = 0;
102     double mDxDlam = 0;
103     double mDxDphi = 0;
104     double mDyDlam = 0;
105     double mDyDphi = 0;
106 
107     friend class QgsCoordinateReferenceSystem;
108 };
109 
110 #endif // QGSPROJECTIONFACTORS_H
111