Class: NationalGrid::LatitudeLongitude
- Inherits:
-
Object
- Object
- NationalGrid::LatitudeLongitude
- Includes:
- Inspect
- Defined in:
- lib/national_grid/latitude_longitude.rb,
ext/national_grid/national_grid_latitude_longitude.c
Instance Method Summary collapse
- #elevation ⇒ Object
- #initialize(*args) ⇒ Object constructor
- #latitude ⇒ Object
- #longitude ⇒ Object
- #to_a ⇒ Object
- #to_easting_northing ⇒ Object
Methods included from Inspect
Constructor Details
#initialize(*args) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'ext/national_grid/national_grid_latitude_longitude.c', line 16 static VALUE initialize(int argc, VALUE* argv, VALUE self) { VALUE latitude, longitude, elevation; rb_scan_args(argc, argv, "03", &latitude, &longitude, &elevation); LatLonDecimal* data = latitude_longitude(self); data->lat = default_to_zero(latitude); data->lon = default_to_zero(longitude); data->elevation = default_to_zero(elevation); return self; } |
Instance Method Details
#elevation ⇒ Object
36 37 38 |
# File 'ext/national_grid/national_grid_latitude_longitude.c', line 36 static VALUE elevation(VALUE self) { return DBL2NUM(latitude_longitude(self)->elevation); } |
#latitude ⇒ Object
28 29 30 |
# File 'ext/national_grid/national_grid_latitude_longitude.c', line 28 static VALUE latitude(VALUE self) { return DBL2NUM(latitude_longitude(self)->lat); } |
#longitude ⇒ Object
32 33 34 |
# File 'ext/national_grid/national_grid_latitude_longitude.c', line 32 static VALUE longitude(VALUE self) { return DBL2NUM(latitude_longitude(self)->lon); } |
#to_a ⇒ Object
5 6 7 |
# File 'lib/national_grid/latitude_longitude.rb', line 5 def to_a [latitude, longitude, elevation] end |
#to_easting_northing ⇒ Object
40 41 42 43 44 |
# File 'ext/national_grid/national_grid_latitude_longitude.c', line 40 static VALUE to_easting_northing(VALUE self) { EastingNorthing data = OSGB36EastingNorthingFromETRS89EastingNorthing(ETRS89EastingNorthingFromETRS89LatLon(*latitude_longitude(self))); if (data.geoid == 0) return Qnil; return new_national_grid_easting_northing(data); } |