~thomas-voss/location-service/fix-settings-not-being-applied

« back to all changes in this revision

Viewing changes to include/location_service/com/ubuntu/location/wgs84/latitude.h

  • Committer: Thomas Voß
  • Date: 2013-05-28 14:20:45 UTC
  • Revision ID: thomas.voss@canonical.com-20130528142045-kq5umqdmm4o53vwk
Initial push.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_WGS84_LATITUDE_H_
 
2
#define LOCATION_SERVICE_COM_UBUNTU_LOCATION_WGS84_LATITUDE_H_
 
3
 
 
4
#include "com/ubuntu/location/units/units.h"
 
5
#include "com/ubuntu/location/wgs84/coordinate.h"
 
6
 
 
7
#include <stdexcept>
 
8
 
 
9
namespace com
 
10
{
 
11
namespace ubuntu
 
12
{
 
13
namespace location
 
14
{
 
15
namespace wgs84
 
16
{
 
17
namespace tag
 
18
{
 
19
struct Latitude;
 
20
}
 
21
typedef Coordinate<tag::Latitude, units::PlaneAngle> Latitude;
 
22
 
 
23
template<>
 
24
struct CoordinateTraits<Latitude>
 
25
{
 
26
    static double min()
 
27
    {
 
28
        return -90;
 
29
    };
 
30
    static double max()
 
31
    {
 
32
        return 90;
 
33
    };
 
34
 
 
35
    static void check_and_throw_if_invalid(const typename Latitude::Quantity& coordinate)
 
36
    {
 
37
        if (coordinate.value() < min())
 
38
            throw std::out_of_range(u8"Latitude(coordinate.value() < min())");
 
39
        if (coordinate.value() > max())
 
40
            throw std::out_of_range(u8"Latitude(coordinate.value() > max())");
 
41
    }
 
42
};
 
43
}
 
44
}
 
45
}
 
46
}
 
47
#endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_WGS84_LATITUDE_H_