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

Inherits:
Object
  • Object
show all
Includes:
Association
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

Methods included from Association

included

Instance Attribute Details

#aircraftSymbol?

Returns kind of aircraft (see AIRCRAFT).

Returns:

  • (Symbol, nil)

    kind of aircraft (see AIRCRAFT)


451
452
453
# File 'lib/aixm/feature/airport.rb', line 451

def aircraft
  @aircraft
end

#originString?

Returns geographic origin of the flight (see ORIGINS).

Returns:

  • (String, nil)

    geographic origin of the flight (see ORIGINS)


460
461
462
# File 'lib/aixm/feature/airport.rb', line 460

def origin
  @origin
end

#purposeString?

Returns purpose of the flight (see PURPOSES).

Returns:

  • (String, nil)

    purpose of the flight (see PURPOSES)


463
464
465
# File 'lib/aixm/feature/airport.rb', line 463

def purpose
  @purpose
end

#realmString?

Returns whether military or civil (see REALMS).

Returns:

  • (String, nil)

    whether military or civil (see REALMS)


457
458
459
# File 'lib/aixm/feature/airport.rb', line 457

def realm
  @realm
end

#ruleString?

Returns flight rule (see RULES).

Returns:

  • (String, nil)

    flight rule (see RULES)


454
455
456
# File 'lib/aixm/feature/airport.rb', line 454

def rule
  @rule
end

Instance Method Details

#inspectString

Returns:

  • (String)

466
467
468
# File 'lib/aixm/feature/airport.rb', line 466

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

#to_xmlString

Returns AIXM or OFMX markup.

Returns:

  • (String)

    AIXM or OFMX markup


491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
# File 'lib/aixm/feature/airport.rb', line 491

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

#usage_limitationAIXM::Feature::Airport::UsageLimitation

Returns usage limitation the condition belongs to.

Returns:


448
# File 'lib/aixm/feature/airport.rb', line 448

belongs_to :usage_limitation