AP_Common: avoid using struct Location

clang reports this could be a problem when compiling under some EABIs.  Remove it from most places as it is just noise, replace with class where we want to avoid including Location.h
This commit is contained in:
Peter Barker 2023-02-03 09:58:38 +11:00 committed by Peter Barker
parent d13a4579e3
commit 1dff5b5710
2 changed files with 8 additions and 8 deletions

View File

@ -234,7 +234,7 @@ bool Location::get_vector_from_origin_NEU(Vector3f &vec_neu) const
}
// return horizontal distance in meters between two locations
ftype Location::get_distance(const struct Location &loc2) const
ftype Location::get_distance(const Location &loc2) const
{
ftype dlat = (ftype)(loc2.lat - lat);
ftype dlng = ((ftype)diff_longitude(loc2.lng,lng)) * longitude_scale((lat+loc2.lat)/2);
@ -242,7 +242,7 @@ ftype Location::get_distance(const struct Location &loc2) const
}
// return the altitude difference in meters taking into account alt frame.
bool Location::get_alt_distance(const struct Location &loc2, ftype &distance) const
bool Location::get_alt_distance(const Location &loc2, ftype &distance) const
{
int32_t alt1, alt2;
if (!get_alt_cm(AltFrame::ABSOLUTE, alt1) || !loc2.get_alt_cm(AltFrame::ABSOLUTE, alt2)) {
@ -374,7 +374,7 @@ assert_storage_size<Location, 16> _assert_storage_size_Location;
// return bearing in radians from location to loc2, return is 0 to 2*Pi
ftype Location::get_bearing(const struct Location &loc2) const
ftype Location::get_bearing(const Location &loc2) const
{
const int32_t off_x = diff_longitude(loc2.lng,lng);
const int32_t off_y = (loc2.lat - lat) / loc2.longitude_scale((lat+loc2.lat)/2);

View File

@ -61,10 +61,10 @@ public:
bool get_vector_from_origin_NEU(Vector3f &vec_neu) const WARN_IF_UNUSED;
// return horizontal distance in meters between two locations
ftype get_distance(const struct Location &loc2) const;
ftype get_distance(const Location &loc2) const;
// return the altitude difference in meters taking into account alt frame.
bool get_alt_distance(const struct Location &loc2, ftype &distance) const WARN_IF_UNUSED;
bool get_alt_distance(const Location &loc2, ftype &distance) const WARN_IF_UNUSED;
// return the distance in meters in North/East/Down plane as a N/E/D vector to loc2
// NOT CONSIDERING ALT FRAME!
@ -97,10 +97,10 @@ public:
void zero(void);
// return the bearing in radians, from 0 to 2*Pi
ftype get_bearing(const struct Location &loc2) const;
ftype get_bearing(const Location &loc2) const;
// return bearing in centi-degrees from location to loc2, return is 0 to 35999
int32_t get_bearing_to(const struct Location &loc2) const {
int32_t get_bearing_to(const Location &loc2) const {
return int32_t(get_bearing(loc2) * DEGX100 + 0.5);
}
@ -110,7 +110,7 @@ public:
/*
* convert invalid waypoint with useful data. return true if location changed
*/
bool sanitize(const struct Location &defaultLoc);
bool sanitize(const Location &defaultLoc);
// return true when lat and lng are within range
bool check_latlng() const;