Class: AIXM::Feature::Airport::UsageLimitation::Condition

Inherits:
Object
  • Object
show all
Defined in:
lib/aixm/feature/airport.rb

Overview

Flight and/or aircraft characteristics used to target a usage limitation.

Constant Summary collapse

AIRCRAFT =
{
  L: :landplane,
  S: :seaplane,
  A: :amphibian,
  H: :helicopter,
  G: :gyrocopter,
  T: :tilt_wing,
  R: :short_takeoff_and_landing,
  E: :glider,
  N: :hangglider,
  P: :paraglider,
  U: :ultra_light,
  B: :balloon,
  D: :unmanned_drone,
  OTHER: :other                    # specify in remarks
}.freeze
RULES =
{
  I: :ifr,
  V: :vfr,
  IV: :ifr_and_vfr
}.freeze
REALMS =
{
  CIVIL: :civilian,
  MIL: :military,
  OTHER: :other     # specify in remarks
}.freeze
ORIGINS =
{
  NTL: :national,
  INTL: :international,
  ANY: :any,
  OTHER: :other           # specify in remarks
}.freeze
PURPOSES =
{
  S: :scheduled,
  NS: :not_scheduled,
  P: :private,
  TRG: :school_or_training,
  WORK: :aerial_work,
  OTHER: :other               # specify in remarks
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#aircraftSymbol?


476
477
478
# File 'lib/aixm/feature/airport.rb', line 476

def aircraft
  @aircraft
end

#originString?


485
486
487
# File 'lib/aixm/feature/airport.rb', line 485

def origin
  @origin
end

#purposeString?


488
489
490
# File 'lib/aixm/feature/airport.rb', line 488

def purpose
  @purpose
end

#realmString?


482
483
484
# File 'lib/aixm/feature/airport.rb', line 482

def realm
  @realm
end

#ruleString?


479
480
481
# File 'lib/aixm/feature/airport.rb', line 479

def rule
  @rule
end

Instance Method Details

#inspectString


491
492
493
# File 'lib/aixm/feature/airport.rb', line 491

def inspect
  %Q(#<#{self.class} aircraft=#{aircraft.inspect} rule=#{rule.inspect} realm=#{realm.inspect} origin=#{origin.inspect} purpose=#{purpose.inspect}>)
end

#to_xmlString


516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
# File 'lib/aixm/feature/airport.rb', line 516

def to_xml
  builder = Builder::XmlMarkup.new(indent: 2)
  builder.UsageCondition do |usage_condition|
    if aircraft
      usage_condition.AircraftClass do |aircraft_class|
        aircraft_class.codeType(AIRCRAFT.key(aircraft).to_s)
      end
    end
    if rule || realm || origin || purpose
      usage_condition.FlightClass do |flight_class|
        flight_class.codeRule(RULES.key(rule).to_s) if rule
        flight_class.codeMil(REALMS.key(realm).to_s) if realm
        flight_class.codeOrigin(ORIGINS.key(origin).to_s) if origin
        flight_class.codePurpose(PURPOSES.key(purpose).to_s) if purpose
      end
    end
  end
end