File indexing completed on 2025-01-18 09:36:40
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_GEOMETRY_SRS_PROJECTIONS_PAR_DATA_HPP
0011 #define BOOST_GEOMETRY_SRS_PROJECTIONS_PAR_DATA_HPP
0012
0013 #include <string>
0014 #include <vector>
0015
0016 #include <boost/geometry/core/assert.hpp>
0017 #include <boost/geometry/core/config.hpp>
0018
0019 namespace boost { namespace geometry { namespace srs
0020 {
0021
0022 #ifndef DOXYGEN_NO_DETAIL
0023 namespace detail
0024 {
0025
0026 struct nadgrids
0027 : std::vector<std::string>
0028 {
0029 typedef std::vector<std::string> base_t;
0030
0031 nadgrids()
0032 {}
0033
0034 template <typename It>
0035 nadgrids(It first, It last)
0036 : base_t(first, last)
0037 {}
0038
0039 nadgrids(std::initializer_list<std::string> l)
0040 : base_t(l)
0041 {}
0042
0043 nadgrids(std::string const& g0)
0044 : base_t(1)
0045 {
0046 base_t& d = *this;
0047 d[0] = g0;
0048 }
0049 nadgrids(std::string const& g0, std::string const& g1)
0050 : base_t(2)
0051 {
0052 base_t& d = *this;
0053 d[0] = g0; d[1] = g1;
0054 }
0055 nadgrids(std::string const& g0, std::string const& g1, std::string const& g2)
0056 : base_t(3)
0057 {
0058 base_t& d = *this;
0059 d[0] = g0; d[1] = g1; d[2] = g2;
0060 }
0061 nadgrids(std::string const& g0, std::string const& g1, std::string const& g2, std::string const& g3)
0062 : base_t(4)
0063 {
0064 base_t& d = *this;
0065 d[0] = g0; d[1] = g1; d[2] = g2; d[3] = g3;
0066 }
0067 nadgrids(std::string const& g0, std::string const& g1, std::string const& g2, std::string const& g3, std::string const& g4)
0068 : base_t(5)
0069 {
0070 base_t& d = *this;
0071 d[0] = g0; d[1] = g1; d[2] = g2; d[3] = g3; d[4] = g4;
0072 }
0073 };
0074
0075 template <typename T = double>
0076 struct towgs84
0077 {
0078 static const std::size_t static_capacity = 7;
0079
0080 typedef std::size_t size_type;
0081 typedef T value_type;
0082 typedef T* iterator;
0083 typedef const T* const_iterator;
0084 typedef T& reference;
0085 typedef const T& const_reference;
0086
0087 towgs84()
0088 : m_size(0)
0089 {
0090 std::fill(m_data, m_data + 7, T(0));
0091 }
0092
0093 template <typename It>
0094 towgs84(It first, It last)
0095 {
0096 assign(first, last);
0097 }
0098
0099 towgs84(std::initializer_list<T> l)
0100 {
0101 assign(l.begin(), l.end());
0102 }
0103
0104 towgs84(T const& v0, T const& v1, T const& v2)
0105 : m_size(3)
0106 {
0107 m_data[0] = v0;
0108 m_data[1] = v1;
0109 m_data[2] = v2;
0110 }
0111
0112 towgs84(T const& v0, T const& v1, T const& v2, T const& v3, T const& v4, T const& v5, T const& v6)
0113 : m_size(7)
0114 {
0115 m_data[0] = v0;
0116 m_data[1] = v1;
0117 m_data[2] = v2;
0118 m_data[3] = v3;
0119 m_data[4] = v4;
0120 m_data[5] = v5;
0121 m_data[6] = v6;
0122 }
0123
0124 void push_back(T const& v)
0125 {
0126 BOOST_GEOMETRY_ASSERT(m_size < static_capacity);
0127 m_data[m_size] = v;
0128 ++m_size;
0129 }
0130
0131 template <typename It>
0132 void assign(It first, It last)
0133 {
0134 for (m_size = 0 ; first != last && m_size < 7 ; ++first, ++m_size)
0135 m_data[m_size] = *first;
0136 }
0137
0138 void assign(std::initializer_list<T> l)
0139 {
0140 assign(l.begin(), l.end());
0141 }
0142
0143 const_reference operator[](size_type i) const
0144 {
0145 BOOST_GEOMETRY_ASSERT(i < m_size);
0146 return m_data[i];
0147 }
0148
0149 reference operator[](size_type i)
0150 {
0151 BOOST_GEOMETRY_ASSERT(i < m_size);
0152 return m_data[i];
0153 }
0154
0155 size_type size() const
0156 {
0157 return m_size;
0158 }
0159
0160 bool empty() const
0161 {
0162 return m_size == 0;
0163 }
0164
0165 void clear()
0166 {
0167 m_size = 0;
0168 }
0169
0170 iterator begin() { return m_data; }
0171 iterator end() { return m_data + m_size; }
0172 const_iterator begin() const { return m_data; }
0173 const_iterator end() const { return m_data + m_size; }
0174
0175 private:
0176 size_type m_size;
0177 T m_data[7];
0178 };
0179
0180 struct axis
0181 {
0182 static const std::size_t static_capacity = 3;
0183
0184 typedef std::size_t size_type;
0185 typedef int value_type;
0186 typedef int* iterator;
0187 typedef const int* const_iterator;
0188 typedef int& reference;
0189 typedef const int& const_reference;
0190
0191 axis()
0192 : m_size(3)
0193 , m_data{0, 0, 0}
0194 {}
0195
0196 template <typename It>
0197 axis(It first, It last)
0198 {
0199 assign(first, last);
0200 }
0201
0202 axis(std::initializer_list<int> l)
0203 {
0204 assign(l.begin(), l.end());
0205 }
0206
0207 axis(int const& v0, int const& v1, int const& v2)
0208 : m_size(3)
0209 {
0210 m_data[0] = v0;
0211 m_data[1] = v1;
0212 m_data[2] = v2;
0213 }
0214
0215 void push_back(int const& v)
0216 {
0217 BOOST_GEOMETRY_ASSERT(m_size < static_capacity);
0218 m_data[m_size] = v;
0219 ++m_size;
0220 }
0221
0222 template <typename It>
0223 void assign(It first, It last)
0224 {
0225 for (m_size = 0 ; first != last && m_size < 3 ; ++first, ++m_size)
0226 m_data[m_size] = *first;
0227 }
0228
0229 void assign(std::initializer_list<int> l)
0230 {
0231 assign(l.begin(), l.end());
0232 }
0233
0234 const_reference operator[](size_type i) const
0235 {
0236 BOOST_GEOMETRY_ASSERT(i < m_size);
0237 return m_data[i];
0238 }
0239
0240 reference operator[](size_type i)
0241 {
0242 BOOST_GEOMETRY_ASSERT(i < m_size);
0243 return m_data[i];
0244 }
0245
0246 size_type size() const
0247 {
0248 return m_size;
0249 }
0250
0251 bool empty() const
0252 {
0253 return m_size == 0;
0254 }
0255
0256 void clear()
0257 {
0258 m_size = 0;
0259 }
0260
0261 iterator begin() { return m_data; }
0262 iterator end() { return m_data + m_size; }
0263 const_iterator begin() const { return m_data; }
0264 const_iterator end() const { return m_data + m_size; }
0265
0266 private:
0267 size_type m_size;
0268 int m_data[3];
0269 };
0270
0271 }
0272 #endif
0273
0274 }}}
0275
0276
0277 #endif