Class: AIXM::Feature::Service
- Inherits:
-
AIXM::Feature
- Object
- AIXM::Feature
- AIXM::Feature::Service
- Defined in:
- lib/aixm/feature/service.rb
Overview
Service provided by a unit.
Cheat Sheet in Pseudo Code:
service = AIXM.service(
source: String or nil
type: TYPES
)
service. = AIXM. or nil
service.remarks = String or nil
service.add_frequency(AIXM.frequency)
Constant Summary collapse
- TYPES =
{ ACS: :area_control_service, ADS: :automatic_dependent_surveillance_service, ADVS: :advisory_service, AFIS: :aerodrome_flight_information_service, AFS: :aeronautical_fixed_service, AIS: :aeronautical_information_service, ALRS: :alerting_service, AMS: :aeronautical_mobile_service, AMSS: :aeronautical_mobile_satellite_service, APP: :approach_control_service, 'APP-ARR': :approach_control_service_for_arrival, 'APP-DEP': :approach_control_service_for_departure, ARTCC: :air_route_traffic_control_centre_service, ATC: :air_traffic_control_service, ATFM: :air_traffic_flow_management_service, ATIS: :automated_terminal_information_service, 'ATIS-ARR': :automated_terminal_information_service_for_arrival, 'ATIS-DEP': :automated_terminal_information_service_for_departure, ATM: :air_traffic_management_service, ATS: :air_traffic_service, BOF: :briefing_service, BS: :commercial_broadcasting_service, COM: :communications_service, CTAF: :common_traffic_advisory_frequency_service, DVDF: :doppler_vdf_service, EFAS: :en_route_flight_advisory_service, ENTRY: :entry_clearance_service, EXIT: :exit_clearance_service, FCST: :forecasting_service, FIS: :flight_information_service, FISA: :automated_flight_information_service, FSS: :flight_service_station_service, GCA: :ground_controlled_approach_service, INFO: :information_provision_service, MET: :meteorological_service, NOF: :international_notam_service, OAC: :oceanic_area_control_service, OVERFLT: :overflight_clearance_service, PAR: :precision_approach_radar_service, RAC: :rules_of_the_air_and_air_traffic_services, RADAR: :radar_service, RAF: :regional_area_forecasting_service, RCC: :rescue_coordination_service, SAR: :search_and_rescue_service, SIGMET: :sigmet_service, SMC: :surface_movement_control_service, SMR: :surface_movement_radar_service, SRA: :surveillance_radar_approach_service, SSR: :secondary_surveillance_radar_service, TAR: :terminal_area_radar_service, TWEB: :transcribed_weather_broadcast_service, TWR: :aerodrome_control_tower_service, UAC: :upper_area_control_service, UDF: :uhf_direction_finding_service, VDF: :vhf_direction_finding_service, VOLMET: :volmet_service, VOT: :vor_test_facility, OTHER: :other # specify in remarks }.freeze
- GUESSED_UNIT_TYPES_MAP =
Map service types to guessed unit types
{ :advisory_service => :advisory_centre, :aerodrome_control_tower_service => :aerodrome_control_tower, :aerodrome_flight_information_service => :aerodrome_control_tower, :aeronautical_information_service => :aeronautical_information_services_office, :air_route_traffic_control_centre_service => :air_route_traffic_control_centre, :air_traffic_control_service => :air_traffic_control_centre, :air_traffic_flow_management_service => :air_traffic_flow_management_unit, :air_traffic_management_service => :air_traffic_management_unit, :air_traffic_service => :air_traffic_services_unit, :approach_control_service => :approach_control_office, :approach_control_service_for_arrival => :arrivals_approach_control_office, :approach_control_service_for_departure => :depatures_approach_control_office, :area_control_service => :area_control_centre, :automated_terminal_information_service => :aerodrome_control_tower, :automated_terminal_information_service_for_arrival => :aerodrome_control_tower, :automated_terminal_information_service_for_departure => :aerodrome_control_tower, :automatic_dependent_surveillance_service => :automatic_dependent_surveillance_unit, :briefing_service => :briefing_office, :commercial_broadcasting_service => :commercial_broadcasting_station, :communications_service => :communications_office, :flight_information_service => :flight_information_centre, :flight_service_station_service => :flight_service_station, :forecasting_service => :forecasting_office, :ground_controlled_approach_service => :ground_controlled_approach_systems_office, :international_notam_service => :international_notam_office, :meteorological_service => :meteorological_office, :oceanic_area_control_service => :oceanic_control_centre, :precision_approach_radar_service => :precision_approach_radar_centre, :radar_service => :radar_office, :regional_area_forecasting_service => :regional_area_forecast_centre, :rescue_coordination_service => :rescue_coordination_centre, :search_and_rescue_service => :search_and_rescue_centre, :secondary_surveillance_radar_service => :secondary_surveillance_radar_centre, :sigmet_service => :meteorological_office, :surface_movement_control_service => :surface_movement_control_office, :surface_movement_radar_service => :surface_movement_radar_office, :surveillance_radar_approach_service => :surveillance_radar_approach_centre, :terminal_area_radar_service => :terminal_area_surveillance_radar_centre, :transcribed_weather_broadcast_service => :meteorological_office, :uhf_direction_finding_service => :uhf_direction_finding_station, :upper_area_control_service => :upper_area_control_centre, :vhf_direction_finding_service => :vdf_direction_finding_station, :volmet_service => :meteorological_office, :other => :other }
Instance Attribute Summary collapse
-
#frequencies ⇒ Array<AIXM::Component::Frequency>
readonly
Frequencies used by this service.
-
#remarks ⇒ String?
Free text remarks.
-
#timetable ⇒ AIXM::Component::Timetable?
Operating hours.
-
#type ⇒ Symbol
Type of service (see TYPES).
-
#unit ⇒ AIXM::Feature::Unit
readonly
Unit providing this service.
Attributes inherited from AIXM::Feature
Instance Method Summary collapse
-
#add_frequency(frequency) ⇒ self
Add a frequency used by this service.
-
#guessed_unit_type ⇒ Symbol?
Guess the unit type for this service.
-
#initialize(source: nil, type:) ⇒ Service
constructor
A new instance of Service.
- #inspect ⇒ String
-
#to_uid ⇒ String
UID markup.
-
#to_xml(sequence:) ⇒ String
AIXM or OFMX markup.
Methods inherited from AIXM::Feature
Constructor Details
#initialize(source: nil, type:) ⇒ Service
Returns a new instance of Service.
145 146 147 148 149 |
# File 'lib/aixm/feature/service.rb', line 145 def initialize(source: nil, type:) super(source: source) self.type = type @frequencies = [] end |
Instance Attribute Details
#frequencies ⇒ Array<AIXM::Component::Frequency> (readonly)
Returns frequencies used by this service.
143 144 145 |
# File 'lib/aixm/feature/service.rb', line 143 def frequencies @frequencies end |
#remarks ⇒ String?
Returns free text remarks.
140 141 142 |
# File 'lib/aixm/feature/service.rb', line 140 def remarks @remarks end |
#timetable ⇒ AIXM::Component::Timetable?
Returns operating hours.
137 138 139 |
# File 'lib/aixm/feature/service.rb', line 137 def end |
#type ⇒ Symbol
Returns type of service (see TYPES).
134 135 136 |
# File 'lib/aixm/feature/service.rb', line 134 def type @type end |
#unit ⇒ AIXM::Feature::Unit
Returns unit providing this service.
131 132 133 |
# File 'lib/aixm/feature/service.rb', line 131 def unit @unit end |
Instance Method Details
#add_frequency(frequency) ⇒ self
Add a frequency used by this service
179 180 181 182 183 184 |
# File 'lib/aixm/feature/service.rb', line 179 def add_frequency(frequency) fail(ArgumentError, "invalid frequency") unless frequency.is_a? AIXM::Component::Frequency frequency.send(:service=, self) @frequencies << frequency self end |
#guessed_unit_type ⇒ Symbol?
Guess the unit type for this service
189 190 191 |
# File 'lib/aixm/feature/service.rb', line 189 def guessed_unit_type GUESSED_UNIT_TYPES_MAP[type] end |
#inspect ⇒ String
152 153 154 |
# File 'lib/aixm/feature/service.rb', line 152 def inspect %Q(#<#{self.class} type=#{type.inspect}>) end |
#to_uid ⇒ String
Returns UID markup.
194 195 196 197 198 199 200 201 |
# File 'lib/aixm/feature/service.rb', line 194 def to_uid builder = Builder::XmlMarkup.new(indent: 2) builder.SerUid do |ser_uid| ser_uid << unit.to_uid.indent(2) ser_uid.codeType(TYPES.key(type).to_s) ser_uid.noSeq(@sequence) end end |
#to_xml(sequence:) ⇒ String
Returns AIXM or OFMX markup.
204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
# File 'lib/aixm/feature/service.rb', line 204 def to_xml(sequence:) @sequence = sequence builder = Builder::XmlMarkup.new(indent: 2) builder.comment! ["Service: #{TYPES.key(type)}", unit&.name].compact.join(' by ') builder.Ser({ source: (source if AIXM.ofmx?) }.compact) do |ser| ser << to_uid.indent(2) ser << .to_xml(as: :Stt).indent(2) if ser.txtRmk(remarks) if remarks end frequencies.each do |frequency| builder << frequency.to_xml end builder.target! end |