| 1 |
/* |
| 2 |
* (C) Copyright 2013 ECMWF. |
| 3 |
* |
| 4 |
* This software is licensed under the terms of the Apache Licence Version 2.0 |
| 5 |
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. |
| 6 |
* In applying this licence, ECMWF does not waive the privileges and immunities |
| 7 |
* granted to it by virtue of its status as an intergovernmental organisation |
| 8 |
* nor does it submit to any jurisdiction. |
| 9 |
*/ |
| 10 |
|
| 11 |
#pragma once |
| 12 |
|
| 13 |
#include "atlas/projection/detail/ProjectionImpl.h" |
| 14 |
|
| 15 |
namespace atlas { |
| 16 |
class Projection; |
| 17 |
} |
| 18 |
|
| 19 |
namespace atlas { |
| 20 |
namespace projection { |
| 21 |
namespace detail { |
| 22 |
|
| 23 |
template <typename Rotation> |
| 24 |
class LonLatProjectionT final : public ProjectionImpl { |
| 25 |
private: |
| 26 |
friend class atlas::Projection; |
| 27 |
LonLatProjectionT() = default; |
| 28 |
|
| 29 |
public: |
| 30 |
// constructor |
| 31 |
LonLatProjectionT(const eckit::Parametrisation&); |
| 32 |
|
| 33 |
// destructor |
| 34 |
~LonLatProjectionT() = default; |
| 35 |
|
| 36 |
// projection name |
| 37 |
static std::string static_type() { return Rotation::typePrefix() + "lonlat"; } |
| 38 |
std::string type() const override { return static_type(); } |
| 39 |
|
| 40 |
// projection and inverse projection |
| 41 |
void xy2lonlat(double crd[]) const override { rotation_.rotate(crd); } |
| 42 |
void lonlat2xy(double crd[]) const override { rotation_.unrotate(crd); } |
| 43 |
|
| 44 |
Jacobian jacobian(const PointLonLat&) const override; |
| 45 |
|
| 46 |
bool strictlyRegional() const override { return false; } |
| 47 |
RectangularLonLatDomain lonlatBoundingBox(const Domain&) const override; |
| 48 |
|
| 49 |
// specification |
| 50 |
Spec spec() const override; |
| 51 |
|
| 52 |
std::string units() const override { return "degrees"; } |
| 53 |
|
| 54 |
operator bool() const override { return rotation_.rotated(); } |
| 55 |
|
| 56 |
void hash(eckit::Hash&) const override; |
| 57 |
|
| 58 |
private: |
| 59 |
Rotation rotation_; |
| 60 |
}; |
| 61 |
|
| 62 |
using LonLatProjection = LonLatProjectionT<NotRotated>; |
| 63 |
using RotatedLonLatProjection = LonLatProjectionT<Rotated>; |
| 64 |
|
| 65 |
// -------------------------------------------------------------------------------------------------------------------- |
| 66 |
|
| 67 |
} // namespace detail |
| 68 |
} // namespace projection |
| 69 |
} // namespace atlas |