Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LEFEBVREJP email
radix
Commits
bf59eae2
Commit
bf59eae2
authored
Jun 29, 2021
by
LEFEBVREJP email
Browse files
Formally defined radixgeo::Coordinate type.
parent
7911242f
Pipeline
#152430
passed with stages
in 18 minutes and 24 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
radixgeo/CMakeLists.txt
View file @
bf59eae2
...
...
@@ -2,10 +2,12 @@ TRIBITS_SUBPACKAGE(geo)
SET
(
SOURCE
coordinate.cc
coordinateconversion.cc
)
SET
(
HEADERS
coordinate.hh
coordinateconversion.hh
)
...
...
radixgeo/cmake/Dependencies.cmake
View file @
bf59eae2
TRIBITS_PACKAGE_DEFINE_DEPENDENCIES
(
LIB_REQUIRED_PACKAGES radixcore radixbug
LIB_REQUIRED_PACKAGES
radixmath
radixcore radixbug
LIB_OPTIONAL_PACKAGES
TEST_REQUIRED_PACKAGES testframework
TEST_OPTIONAL_PACKAGES
...
...
radixgeo/coordinate.cc
0 → 100644
View file @
bf59eae2
#include
"radixgeo/coordinate.hh"
#include
"radixmath/util.hh"
namespace
radix
{
Coordinate
::
Coordinate
()
:
m_latitude
(
0.
)
,
m_longitude
(
0.
)
,
m_altitude
(
0.
)
{
}
Coordinate
::
Coordinate
(
double
latitude
,
double
longitude
,
double
altitude
)
:
m_latitude
(
latitude
)
,
m_longitude
(
longitude
)
,
m_altitude
(
altitude
)
{
}
double
Coordinate
::
altitude
()
const
{
return
m_altitude
;
}
void
Coordinate
::
setAltitude
(
double
newAltitude
)
{
m_altitude
=
newAltitude
;
}
double
Coordinate
::
distanceTo
(
const
Coordinate
&
point
)
const
{
return
greatCircleDistance
(
m_latitude
,
m_longitude
,
point
.
latitude
(),
point
.
longitude
(),
EARTH_RADIUS_MEAN
);
}
double
Coordinate
::
longitude
()
const
{
return
m_longitude
;
}
void
Coordinate
::
setLongitude
(
double
newLongitude
)
{
m_longitude
=
newLongitude
;
}
double
Coordinate
::
latitude
()
const
{
return
m_latitude
;
}
void
Coordinate
::
setLatitude
(
double
newLatitude
)
{
m_latitude
=
newLatitude
;
}
}
// namespace radix
radixgeo/coordinate.hh
0 → 100644
View file @
bf59eae2
#ifndef RADIX_RADIXGEO_COORDINATE_HH_
#define RADIX_RADIXGEO_COORDINATE_HH_
#include
"radixcore/visibility.hh"
namespace
radix
{
class
RADIX_PUBLIC
Coordinate
{
double
m_latitude
=
0.0
;
double
m_longitude
=
0.0
;
double
m_altitude
=
0.0
;
public:
Coordinate
();
Coordinate
(
double
latitude
,
double
longitude
,
double
altitude
);
double
latitude
()
const
;
void
setLatitude
(
double
newLatitude
);
double
longitude
()
const
;
void
setLongitude
(
double
newLongitude
);
double
altitude
()
const
;
void
setAltitude
(
double
newAltitude
);
double
distanceTo
(
const
Coordinate
&
point
)
const
;
};
}
// namespace radix
#endif
/** RADIX_RADIXGEO_COORDINATE_HH_ */
radixgeo/tests/CMakeLists.txt
View file @
bf59eae2
INCLUDE
(
GoogleTest
)
ADD_GOOGLE_TEST
(
tstCoordinateConversion.cc NP 1
)
ADD_GOOGLE_TEST
(
tstCoordinate.cc NP 1
)
radixgeo/tests/tstCoordinate.cc
0 → 100644
View file @
bf59eae2
#include
"gtest/gtest.h"
#include
"radixgeo/coordinate.hh"
using
namespace
radix
;
TEST
(
Radixgeo
,
Coordinate
)
{
Coordinate
c1
(
0
,
-
90
,
0
);
Coordinate
c2
(
0
,
-
91
,
0
);
EXPECT_DOUBLE_EQ
(
111198.41730306273
,
c1
.
distanceTo
(
c2
));
// Much of this is captured in radixmath::greatCircleDistance
c1
.
setAltitude
(
1
);
EXPECT_EQ
(
1
,
c1
.
altitude
());
c1
.
setLatitude
(
20
);
EXPECT_EQ
(
20
,
c1
.
latitude
());
c1
.
setLongitude
(
34
);
EXPECT_EQ
(
34
,
c1
.
longitude
());
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment