diff options
author | Jiří Techet <techet@gmail.com> | 2014-09-08 22:59:40 +0200 |
---|---|---|
committer | Jiří Techet <techet@gmail.com> | 2014-09-08 22:59:40 +0200 |
commit | 1bf18c23e64863812397e67a9741d8880889a530 (patch) | |
tree | cda673f456ec7fa6b48cbb33204bef21f04f82e9 | |
parent | b594983b8fdddb953a66c6c47c3cfd60e4be3e34 (diff) | |
download | libchamplain-1bf18c23e64863812397e67a9741d8880889a530.tar.gz |
Trim latitude/longitude so it's within valid range
-rw-r--r-- | champlain/champlain-coordinate.c | 4 | ||||
-rw-r--r-- | champlain/champlain-marker.c | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/champlain/champlain-coordinate.c b/champlain/champlain-coordinate.c index 1eddc59..c968ca7 100644 --- a/champlain/champlain-coordinate.c +++ b/champlain/champlain-coordinate.c @@ -123,8 +123,8 @@ set_location (ChamplainLocation *location, ChamplainCoordinatePrivate *priv = CHAMPLAIN_COORDINATE (location)->priv; - priv->longitude = longitude; - priv->latitude = latitude; + priv->longitude = CLAMP (longitude, CHAMPLAIN_MIN_LONGITUDE, CHAMPLAIN_MAX_LONGITUDE); + priv->latitude = CLAMP (latitude, CHAMPLAIN_MIN_LATITUDE, CHAMPLAIN_MAX_LATITUDE); g_object_notify (G_OBJECT (location), "latitude"); g_object_notify (G_OBJECT (location), "longitude"); diff --git a/champlain/champlain-marker.c b/champlain/champlain-marker.c index 3bb02c1..ca72bed 100644 --- a/champlain/champlain-marker.c +++ b/champlain/champlain-marker.c @@ -272,9 +272,9 @@ set_location (ChamplainLocation *location, g_return_if_fail (CHAMPLAIN_IS_MARKER (location)); ChamplainMarkerPrivate *priv = CHAMPLAIN_MARKER (location)->priv; - - priv->lon = longitude; - priv->lat = latitude; + + priv->lon = CLAMP (longitude, CHAMPLAIN_MIN_LONGITUDE, CHAMPLAIN_MAX_LONGITUDE); + priv->lat = CLAMP (latitude, CHAMPLAIN_MIN_LATITUDE, CHAMPLAIN_MAX_LATITUDE); g_object_notify (G_OBJECT (location), "latitude"); g_object_notify (G_OBJECT (location), "longitude"); |