Class: AIXM::Component::Lighting

Inherits:
Object
  • Object
show all
Defined in:
lib/aixm/component/lighting.rb

Overview

Lighting of a runway, helipad etc

Cheat Sheet in Pseudo Code:

lighting = AIXM.lighting(
  position: POSITIONS
)
lighting.description = String or nil
lighting.intensity = INTENSITIES or nil
lighting.color = COLORS or nil
lighting.remarks = String or nil

Constant Summary collapse

POSITIONS =
{
  TDZ: :touch_down_zone,
  AIM: :aiming_point,
  CL: :center_line,
  EDGE: :edge,
  THR: :threshold,
  SWYEDGE: :stopway_edge,
  DESIG: :runway_designation,
  AFTTHR: :after_threshold,
  DISPTHR: :displaced_threshold,
  SWYCL: :stopway_center_line,
  END: :runway_end,
  SWYEND: :stopway_end,
  TWYINT: :taxiway_intersection,
  HOLDBAY: :taxyway_hold_bay,
  RTWYINT: :rapid_taxiway_intersection,
  OTHER: :other   # specify in remarks
}
INTENSITIES =
{
  LIL: :low,
  LIM: :medium,
  LIH: :high,
  OTHER: :other   # specify in remarks
}
COLORS =
{
  YEL: :yellow,
  RED: :red,
  WHI: :white,
  BLU: :blue,
  GRN: :green,
  PRP: :purple,
  OTHER: :other   # specify in remarks
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(position:) ⇒ Lighting


75
76
77
# File 'lib/aixm/component/lighting.rb', line 75

def initialize(position:)
  self.position = position
end

Instance Attribute Details

#colorSymbol?


70
71
72
# File 'lib/aixm/component/lighting.rb', line 70

def color
  @color
end

#descriptionString?


64
65
66
# File 'lib/aixm/component/lighting.rb', line 64

def description
  @description
end

#intensitySymbol?


67
68
69
# File 'lib/aixm/component/lighting.rb', line 67

def intensity
  @intensity
end

#lightableAIXM::Component::Runway::Direction, ...


58
59
60
# File 'lib/aixm/component/lighting.rb', line 58

def lightable
  @lightable
end

#positionSymbol?


61
62
63
# File 'lib/aixm/component/lighting.rb', line 61

def position
  @position
end

#remarksString?


73
74
75
# File 'lib/aixm/component/lighting.rb', line 73

def remarks
  @remarks
end

Instance Method Details

#inspectString


80
81
82
# File 'lib/aixm/component/lighting.rb', line 80

def inspect
  %Q(#<#{self.class} position=#{position.inspect}>)
end

#to_uid(as:) ⇒ String


111
112
113
114
115
116
117
# File 'lib/aixm/component/lighting.rb', line 111

def to_uid(as:)
  builder = Builder::XmlMarkup.new(indent: 2)
  builder.tag!(as) do |tag|
    tag << lightable.to_uid.indent(2)
    tag.codePsn(POSITIONS.key(position).to_s)
  end.insert_payload_hash(region: AIXM.config.mid_region)
end

#to_xml(as:) ⇒ String


120
121
122
123
124
125
126
127
128
129
130
# File 'lib/aixm/component/lighting.rb', line 120

def to_xml(as:)
  builder = Builder::XmlMarkup.new(indent: 2)
  builder.tag!(as) do |tag|
    tag << to_uid(as: "#{as}Uid").indent(2)
    tag.txtDescr(description) if description
    tag.codeIntst(INTENSITIES.key(intensity).to_s) if intensity
    tag.codeColour(COLORS.key(color).to_s) if color
    tag.txtRmk(remarks) if remarks
  end
  builder.target!
end