spec/factory.rb in aixm-0.1.3 vs spec/factory.rb in aixm-0.2.0

- old
+ new

@@ -1,15 +1,19 @@ module AIXM class Factory class << self + def xy + AIXM.xy(lat: 10, long: 20) + end + def vertical_limits AIXM.vertical_limits( - upper_z: AIXM.z(alt: 65, code: :QNE), - lower_z: AIXM.z(alt: 45, code: :QNE), - max_z: AIXM.z(alt: 6000, code: :QNH), - min_z: AIXM.z(alt: 3000, code: :QFE) + upper_z: AIXM.z(65, :qne), + lower_z: AIXM.z(45, :qne), + max_z: AIXM.z(6000, :qnh), + min_z: AIXM.z(3000, :qfe) ) end def class_layer AIXM.class_layer( @@ -68,14 +72,93 @@ airspace.geometry = circle_geometry airspace.remarks = 'circle airspace' end end + def designated_point + AIXM.designated_point( + id: 'DPN', + name: 'DESIGNATED POINT NAVAID', + xy: AIXM.xy(lat: %q(47°51'33"N), long: %q(007°33'36"E)), + z: AIXM.z(500, :qnh), + type: :ICAO + ).tap do |designated_point| + designated_point.remarks = 'designated point navaid' + end + end + + def dme + AIXM.dme( + id: 'DME', + name: 'DME NAVAID', + xy: AIXM.xy(lat: %q(47°51'33"N), long: %q(007°33'36"E)), + z: AIXM.z(500, :qnh), + channel: '95X' + ).tap do |dme| + dme.remarks = 'dme navaid' + end + end + + def marker + AIXM.marker( + id: '---', + name: 'MARKER NAVAID', + xy: AIXM.xy(lat: %q(47°51'33"N), long: %q(007°33'36"E)), + z: AIXM.z(500, :qnh) + ).tap do |marker| + marker.remarks = 'marker navaid' + end + end + + def ndb + AIXM.ndb( + id: 'NDB', + name: 'NDB NAVAID', + xy: AIXM.xy(lat: %q(47°51'33"N), long: %q(007°33'36"E)), + z: AIXM.z(500, :qnh), + f: AIXM.f(555, :khz) + ).tap do |ndb| + ndb.remarks = 'ndb navaid' + end + end + + def tacan + AIXM.tacan( + id: 'TCN', + name: 'TACAN NAVAID', + xy: AIXM.xy(lat: %q(47°51'33"N), long: %q(007°33'36"E)), + z: AIXM.z(500, :qnh), + channel: '29X' + ).tap do |tacan| + tacan.remarks = 'tacan navaid' + end + end + + def vor + AIXM.vor( + id: 'VOR', + name: 'VOR NAVAID', + xy: AIXM.xy(lat: %q(47°51'33"N), long: %q(007°33'36"E)), + z: AIXM.z(500, :qnh), + type: :VOR, + f: AIXM.f(111, :mhz), + north: :geographic + ).tap do |vor| + vor.remarks = 'vor navaid' + end + end + def document time = Time.parse('2018-01-18 12:00:00 +0100') AIXM.document(created_at: time, effective_at: time).tap do |document| document.features << AIXM::Factory.polygon_airspace document.features << AIXM::Factory.circle_airspace + document.features << AIXM::Factory.designated_point + document.features << AIXM::Factory.dme + document.features << AIXM::Factory.marker + document.features << AIXM::Factory.ndb + document.features << AIXM::Factory.vor + document.features << AIXM::Factory.tacan end end end end