about summary refs log tree commit diff stats
path: root/src/bounding_box.h
blob: 25c779088fa7be4eb49e5e6dac92dfad1beb612b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#ifndef BOUNDING_BOX_H_75D2077D
#define BOUNDING_BOX_H_75D2077D

namespace twitter {
  
  class coordinate {
  public:
    
    coordinate(int degrees, int minutes = 0, int seconds = 0) :
      _degrees(degrees),
      _minutes(minutes),
      _seconds(seconds)
    {
    }
    
    int getDegrees() const
    {
      return _degrees;
    }
    
    int getMinutes() const
    {
      return _minutes;
    }
    
    int getSeconds() const
    {
      return _seconds;
    }
    
    operator double() const
    {
      return (double)_degrees + ((double)_minutes / (double)60) + ((double)_seconds / (double)3600);
    }
    
  private:
    
    int _degrees;
    int _minutes;
    int _seconds;
  };
  
  class bounding_box {
  public:
    
    bounding_box(
      coordinate south_west_long,
      coordinate south_west_lat,
      coordinate north_east_long,
      coordinate north_east_lat) :
        _south_west_long(south_west_long),
        _south_west_lat(south_west_lat),
        _north_east_long(north_east_long),
        _north_east_lat(north_east_lat)
    {
    }
    
    const coordinate& getSouthWestLongitude() const
    {
      return _south_west_long;
    }
    
    const coordinate& getSouthWestLatitude() const
    {
      return _south_west_lat;
    }
    
    const coordinate& getNorthEastLongitude() const
    {
      return _north_east_long;
    }
    
    const coordinate& getNorthEastLatitude() const
    {
      return _north_east_lat;
    }
    
  private:
    
    coordinate _south_west_long;
    coordinate _south_west_lat;
    coordinate _north_east_long;
    coordinate _north_east_lat;
  };
  
}

#endif /* end of include guard: BOUNDING_BOX_H_75D2077D */