Class: AIXM::Component::Surface

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

Overview

Surface of a runway, helipad etc

Cheat Sheet in Pseudo Code:

surface = AIXM.surface(
  composition: COMPOSITIONS or nil
  preparation: PREPARATIONS or nil
  condition: CONDITIONS or nil
)
surface.pcn = String or nil
surface.siwl_weight = AIXM.w
surface.siwl_tire_pressure = AIXM.p
surface.auw_weight = AIXM.w
surface.remarks = String or nil

Constants:

  • AIXM::PCN_RE - regular expression to match PCN notations

Constant Summary collapse

COMPOSITIONS =
{
  ASPH: :asphalt,
  BITUM: :bitumen,        # dug up, bound and rolled ground
  CONC: :concrete,
  'CONC+ASPH': :concrete_and_asphalt,
  'CONC+GRS': :concrete_and_grass,
  GRADE: :graded_earth,   # graded or rolled earth possibly with some grass
  GRASS: :grass,          # lawn
  GRAVE: :gravel,         # small and midsize rounded stones
  MACADAM: :macadam,      # small rounded stones
  METAL: :metal,
  SAND: :sand,
  SNOW: :snow,
  WATER: :water,
  OTHER: :other           # specify in remarks
}
PREPARATIONS =
{
  AFSC: :aggregate_friction_seal_coat,
  GROOVED: :grooved,      # cut or plastic grooved
  NATURAL: :natural,      # no treatment
  OILED: :oiled,
  PAVED: :paved,
  PFC: :porous_friction_course,
  RFSC: :rubberized_friction_seal_coat,
  ROLLED: :rolled,
  OTHER: :other
}
CONDITIONS =
{
  GOOD: :good,
  FAIR: :fair,
  POOR: :poor,
  OTHER: :other
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSurface


83
84
85
# File 'lib/aixm/component/surface.rb', line 83

def initialize
  @pcn = {}
end

Instance Attribute Details

#auw_weightAIXM::W?


78
79
80
# File 'lib/aixm/component/surface.rb', line 78

def auw_weight
  @auw_weight
end

#compositionSymbol?


63
64
65
# File 'lib/aixm/component/surface.rb', line 63

def composition
  @composition
end

#conditionSymbol?


69
70
71
# File 'lib/aixm/component/surface.rb', line 69

def condition
  @condition
end

#preparationSymbol?


66
67
68
# File 'lib/aixm/component/surface.rb', line 66

def preparation
  @preparation
end

#remarksString?


81
82
83
# File 'lib/aixm/component/surface.rb', line 81

def remarks
  @remarks
end

#siwl_tire_pressureAIXM::P?


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

def siwl_tire_pressure
  @siwl_tire_pressure
end

#siwl_weightAIXM::W?


72
73
74
# File 'lib/aixm/component/surface.rb', line 72

def siwl_weight
  @siwl_weight
end

Instance Method Details

#inspectString


88
89
90
# File 'lib/aixm/component/surface.rb', line 88

def inspect
  %Q(#<#{self.class} composition=#{composition.inspect} preparation=#{preparation.inspect} condition=#{condition.inspect} pcn=#{pcn.inspect}>)
end

#pcnString?


105
106
107
# File 'lib/aixm/component/surface.rb', line 105

def pcn
  @pcn.none? ? nil : @pcn.values.join("/")
end

#pcn=(value) ⇒ Object


109
110
111
112
113
# File 'lib/aixm/component/surface.rb', line 109

def pcn=(value)
  return @pcn = {} if value.nil?
  fail(ArgumentError, "invalid PCN") unless match = value.to_s.upcase.match(PCN_RE)
  @pcn = match.named_captures.reject{ |k| k == 'pcn' }
end

#to_xmlString


135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/aixm/component/surface.rb', line 135

def to_xml
  builder = Builder::XmlMarkup.new(indent: true)
  builder.codeComposition(COMPOSITIONS.key(composition).to_s) if composition
  builder.codePreparation(PREPARATIONS.key(preparation).to_s) if preparation
  builder.codeCondSfc(CONDITIONS.key(condition).to_s) if condition
  if pcn
    builder.valPcnClass(@pcn['capacity'])
    builder.codePcnPavementType(@pcn['type'])
    builder.codePcnPavementSubgrade(@pcn['subgrade'])
    builder.codePcnMaxTirePressure(@pcn['tire_pressure'])
    builder.codePcnEvalMethod(@pcn['evaluation_method'])
  end
  builder.txtPcnNote(@remarks) if remarks
  if siwl_weight
    builder.valSiwlWeight(siwl_weight.wgt.trim)
    builder.uomSiwlWeight(siwl_weight.unit.to_s.upcase)
  end
  if siwl_tire_pressure
    builder.valSiwlTirePressure(siwl_tire_pressure.pres.trim)
    builder.uomSiwlTirePressure(siwl_tire_pressure.unit.to_s.upcase)
  end
  if auw_weight
    builder.valAuwWeight(auw_weight.wgt.trim)
    builder.uomAuwWeight(auw_weight.unit.to_s.upcase)
  end
  builder.target!
end