olp-cpp-sdk  1.22.0
GeoRectangle.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 <olp/core/CoreApi.h>
23 #include <olp/core/geo/coordinates/GeoCoordinates.h>
24 
25 namespace olp {
26 namespace geo {
27 
33 class CORE_API GeoRectangle {
34  public:
37 
44  GeoRectangle(const GeoCoordinates& south_west,
45  const GeoCoordinates& north_east);
46 
53 
60 
67 
74 
81 
87  bool IsEmpty() const;
88 
94  double LongitudeSpan() const;
95 
101  double LatitudeSpan() const;
102 
110  bool Contains(const GeoCoordinates& point) const;
111 
119  bool Overlaps(const GeoRectangle& rectangle) const;
120 
128  bool operator==(const GeoRectangle& other) const;
129 
137  bool operator!=(const GeoRectangle& other) const;
138 
147 
156 
157  protected:
162 };
163 
164 } // namespace geo
165 } // namespace olp
A geographic location that uses the WGS84 Coordinate System.
Definition: GeoCoordinates.h:38
A rectangular area in the WGS84 Coordinate System.
Definition: GeoRectangle.h:33
GeoRectangle(const GeoCoordinates &south_west, const GeoCoordinates &north_east)
Creates a GeoRectangle instance.
bool Overlaps(const GeoRectangle &rectangle) const
Checks whether two rectangles overlap.
bool Contains(const GeoCoordinates &point) const
Checks whether the coordinates contain a point.
GeoCoordinates north_east_
The northeast corner of the rectangle.
Definition: GeoRectangle.h:161
double LongitudeSpan() const
Gets the longitude span of the rectangle.
bool IsEmpty() const
Checks whether the rectangle is empty.
GeoCoordinates Center() const
Computes the center of the rectangle.
GeoCoordinates NorthWest() const
Computes the northwest corner of the rectangle.
GeoCoordinates SouthWest() const
Computes the southwest corner of the rectangle.
GeoCoordinates SouthEast() const
Computes the southeast corner of the rectangle.
bool operator==(const GeoRectangle &other) const
Checks whether two rectangles are equal.
double LatitudeSpan() const
Gets the latitude span of the rectangle.
GeoRectangle BooleanUnion(const GeoRectangle &other) const
Unites two regtangles that have shared areas.
GeoCoordinates NorthEast() const
Computes the northeast corner of the rectangle.
GeoRectangle & GrowToContain(const GeoCoordinates &point)
Expands the current rectangle so that it contains a point.
GeoCoordinates south_west_
The southwest corner of the rectangle.
Definition: GeoRectangle.h:159
bool operator!=(const GeoRectangle &other) const
Checks whether two rectangles are not equal.
GeoRectangle()
Creates an empty rectangle.
Rules all the other namespaces.
Definition: AppleSignInProperties.h:24