Consistency and range checking for GEO data
RFC5545 defines the GEO property as a pair of FLOATs.
Incidence
presents it as three getter/setter pairs, which allow inconsistent values.
This patch provides a more error-resistant interface.
-
setGeoLatitude()
andsetGeoLongitude()
perform range checks. Invalid values are logged and discarded, keeping the (presumed valid) current value. -
If either of
geoLatitude()
orgeoLongitude()
returnINVALID_LATLON
, then both do, andhasGeo()
returnsfalse
, regardless of member values. -
setHasGeo(false)
sets both coordinates toINVALID_LATLON
, without requiring that the client set them. -
setHasGeo(true)
still requires the client to set valid coordinates, buthasGeo()
will returnfalse
until it does.