Quetzal-CoaTL
The Coalescence Template Library
Loading...
Searching...
No Matches
resolution.hpp
1// Copyright 2021 Arnaud Becheler <abechele@umich.edu>
2
3/*********************************************************************** * This program is free software; you can
4 *redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free
5 *Software Foundation; either version 2 of the License, or * (at your option) any later version. *
6 * *
7 ***************************************************************************/
8
9#pragma once
10
11namespace quetzal::geography
12{
15template <typename T> class resolution
16{
17
18 private:
19 T _lat;
20 T _lon;
21
22 public:
24 using value_type = T;
25
29 constexpr explicit resolution(value_type lat, value_type lon) : _lat(lat), _lon(lon)
30 {
31 }
32
35 constexpr value_type lat() const noexcept
36 {
37 return _lat;
38 }
39
41 constexpr value_type lon() const noexcept
42 {
43 return _lon;
44 }
45
49 constexpr resolution &lat(value_type value) noexcept
50 {
51 _lat = value;
52 return *this;
53 }
54
58 constexpr resolution &lon(value_type value) noexcept
59 {
60 _lon = value;
61 return *this;
62 }
63
67 constexpr bool operator==(const resolution &other) const noexcept
68 {
69 if (_lat == other.lat() && _lon == other.lon())
70 return true;
71 return false;
72 }
73
77 constexpr bool operator!=(const resolution &other) const noexcept
78 {
79 return !(operator==(other));
80 }
81};
82
83} // namespace quetzal::geography
Resolution of a spatial grid.
Definition resolution.hpp:16
constexpr bool operator==(const resolution &other) const noexcept
EqualityComparable.
Definition resolution.hpp:67
constexpr value_type lat() const noexcept
Gets latitude resolution.
Definition resolution.hpp:35
constexpr resolution & lat(value_type value) noexcept
Sets latitude resolution.
Definition resolution.hpp:49
constexpr resolution(value_type lat, value_type lon)
Constructor.
Definition resolution.hpp:29
constexpr value_type lon() const noexcept
Gets longitude resolution.
Definition resolution.hpp:41
constexpr resolution & lon(value_type value) noexcept
Sets longitude resolution.
Definition resolution.hpp:58
constexpr bool operator!=(const resolution &other) const noexcept
Unequality comparison operator.
Definition resolution.hpp:77
Geospatial data formatting and processing.
Definition geography.hpp:17