SGGeod: add static constructor of an invalid Geod

Use this to allow explicitly initializing a value which isValid
will return false for.
This commit is contained in:
James Turner 2020-12-13 17:23:24 +00:00
parent b9c39fd2ab
commit deda20d5bd
2 changed files with 12 additions and 0 deletions

View File

@ -29,6 +29,13 @@ public:
/// Default constructor, initializes the instance to lat = lon = elev = 0 /// Default constructor, initializes the instance to lat = lon = elev = 0
SGGeod(void); SGGeod(void);
/**
return an SGGeod for which isValid() returns false.
This is necessaerby becuase for historical reasons, ther defaulrt constructor above initialsies to zero,zero,zero
which *is*
*/
static SGGeod invalid();
/// Factory from angular values in radians and elevation is 0 /// Factory from angular values in radians and elevation is 0
static SGGeod fromRad(double lon, double lat); static SGGeod fromRad(double lon, double lat);
/// Factory from angular values in degrees and elevation is 0 /// Factory from angular values in degrees and elevation is 0

View File

@ -663,3 +663,8 @@ SGGeodesy::radialIntersection(const SGGeod& a, double aRadial,
result = SGGeod::fromGeoc(r); result = SGGeod::fromGeoc(r);
return true; return true;
} }
SGGeod SGGeod::invalid()
{
return SGGeod::fromDeg(-999.9, -999.0);
}