olp-cpp-sdk 1.24.0
Loading...
Searching...
No Matches
GeoCoordinates.h
1/*
2 * Copyright (C) 2019-2021 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 <olp/core/CoreApi.h>
23#include <olp/core/geo/Types.h>
24#include <olp/core/geo/coordinates/GeoPoint.h>
25
26namespace olp {
27namespace geo {
28
38class CORE_API GeoCoordinates {
39 public:
42
53 GeoCoordinates(double latitude_radians, double longitude_radians);
54
66 GeoCoordinates(double latitude_degrees, double longitude_degrees,
67 DegreeType degrees);
68
82 static GeoCoordinates FromDegrees(double latitude_degrees,
83 double longitude_degrees);
84
92 static GeoCoordinates FromGeoPoint(const GeoPoint& geo_point);
93
100
106 double GetLatitude() const;
107
114 void SetLatitude(double latitude_radians);
115
121 double GetLongitude() const;
122
129 void SetLongitude(double longitude_radians);
130
136 double GetLatitudeDegrees() const;
137
144 void SetLatitudeDegrees(double latitude_degrees);
145
151 double GetLongitudeDegrees() const;
152
159 void SetLongitudeDegrees(double longitude_degrees);
160
166
174 explicit operator bool() const;
175
184 bool IsValid() const;
185
186 private:
188 double latitude_;
190 double longitude_;
192 static const double kNaN_;
193};
194
200CORE_API bool operator==(const GeoCoordinates& lhs, const GeoCoordinates& rhs);
201
202} // namespace geo
203} // namespace olp
A geographic location that uses the WGS84 Coordinate System.
Definition GeoCoordinates.h:38
void SetLongitudeDegrees(double longitude_degrees)
Sets the longitude in degrees.
GeoCoordinates Normalized() const
Normalizes the latitude and longitude to the [-pi/2, pi/2] and [-pi, pi] ranges correspondingly.
GeoPoint ToGeoPoint() const
Converts the current coordinates to a geo point.
void SetLatitudeDegrees(double latitude_degrees)
Sets the latitude in degrees.
void SetLongitude(double longitude_radians)
Sets the longitude in radians.
void SetLatitude(double latitude_radians)
Sets the latitude in radians.
static GeoCoordinates FromDegrees(double latitude_degrees, double longitude_degrees)
Creates a GeoCoordinates instance from latitude and longitude.
GeoCoordinates()
Creates a GeoCoordinates instance with invalid coordinates.
static GeoCoordinates FromGeoPoint(const GeoPoint &geo_point)
Creates a GeoCoordinates instance from a geo point.
double GetLongitudeDegrees() const
Gets the WGS84 longitude in degrees.
double GetLatitude() const
Gets the WGS84 latitude in radians.
double GetLongitude() const
Gets the WGS84 longitude in radians.
double GetLatitudeDegrees() const
Gets the WGS84 latitude in degrees.
GeoCoordinates(double latitude_degrees, double longitude_degrees, DegreeType degrees)
Creates a GeoCoordinates instance from latitude and longitude.
GeoCoordinates(double latitude_radians, double longitude_radians)
Creates a GeoCoordinates instance from latitude and longitude.
bool IsValid() const
Checks whether the radian values of latitude and longitude are valid double numbers.
A geographic location that uses the WGS84 Coordinate System encoded in a 32-bit unsigned integer.
Definition GeoPoint.h:48
Rules all the other namespaces.
Definition AppleSignInProperties.h:24
Definition Types.h:49