olp-cpp-sdk  1.22.0
GeoPoint.h
1 /*
2  * Copyright (C) 2019-2020 HERE Europe B.V.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * SPDX-License-Identifier: Apache-2.0
17  * License-Filename: LICENSE
18  */
19 
20 #pragma once
21 
22 #include <cstdint>
23 
24 #include <olp/core/CoreApi.h>
25 
26 namespace olp {
27 namespace geo {
28 
48 class CORE_API GeoPoint {
49  public:
50  GeoPoint();
51 
59  GeoPoint(uint32_t xx, uint32_t yy);
60 
69  std::uint32_t x;
70 
79  std::uint32_t y;
80 
89  bool operator==(const GeoPoint& other) const;
90 
99  inline bool operator!=(const GeoPoint& other) const {
100  return !operator==(other);
101  }
102 
110  GeoPoint& operator+=(const GeoPoint& other);
111 };
112 
113 inline GeoPoint::GeoPoint() : x(0), y(0) {}
114 
115 inline GeoPoint::GeoPoint(uint32_t xx, uint32_t yy) : x(xx), y(yy) {}
116 
117 inline bool GeoPoint::operator==(const GeoPoint& other) const {
118  return x == other.x && y == other.y;
119 }
120 
121 inline GeoPoint& GeoPoint::operator+=(const GeoPoint& other) {
122  x += other.x;
123  y += other.y;
124  return *this;
125 }
126 
127 } // namespace geo
128 } // namespace olp
A geographic location that uses the WGS84 Coordinate System encoded in a 32-bit unsigned integer.
Definition: GeoPoint.h:48
bool operator==(const GeoPoint &other) const
Checks whether the values of the GeoPoint and the other parameters are equal.
Definition: GeoPoint.h:117
bool operator!=(const GeoPoint &other) const
Checks whether the values of the GeoPoint and the other parameters are not equal.
Definition: GeoPoint.h:99
std::uint32_t y
An absolute world Y-coordinate value.
Definition: GeoPoint.h:79
std::uint32_t x
An absolute world X-coordinate value.
Definition: GeoPoint.h:69
GeoPoint & operator+=(const GeoPoint &other)
Adds the values of the GeoPoint and other parameters.
Definition: GeoPoint.h:121
Rules all the other namespaces.
Definition: AppleSignInProperties.h:24