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

Returns a new instance of Surface.


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

def initialize
  @pcn = {}
end

Instance Attribute Details

#auw_weightAIXM::W?

Returns all-up wheel weight.

Returns:

  • (AIXM::W, nil)

    all-up wheel weight


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

def auw_weight
  @auw_weight
end

#compositionSymbol?

Returns composition of the surface (see COMPOSITIONS).

Returns:

  • (Symbol, nil)

    composition of the surface (see COMPOSITIONS)


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

def composition
  @composition
end

#conditionSymbol?

Returns condition of the surface (see CONDITIONS).

Returns:

  • (Symbol, nil)

    condition of the surface (see CONDITIONS)


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

def condition
  @condition
end

#preparationSymbol?

Returns preparation of the surface (see PREPARATIONS).

Returns:

  • (Symbol, nil)

    preparation of the surface (see PREPARATIONS)


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

def preparation
  @preparation
end

#remarksString?

Returns free text remarks.

Returns:

  • (String, nil)

    free text remarks


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

def remarks
  @remarks
end

#siwl_tire_pressureAIXM::P?

Returns single isolated wheel load tire pressure.

Returns:

  • (AIXM::P, nil)

    single isolated wheel load tire pressure


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

def siwl_tire_pressure
  @siwl_tire_pressure
end

#siwl_weightAIXM::W?

Returns single isolated wheel load weight.

Returns:

  • (AIXM::W, nil)

    single isolated wheel load weight


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

def siwl_weight
  @siwl_weight
end

Instance Method Details

#inspectString

Returns:

  • (String)

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?

Returns pavement classification number (e.g. “59/F/A/W/T”).

Returns:

  • (String, nil)

    pavement classification number (e.g. “59/F/A/W/T”)


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

Returns AIXM or OFMX markup.

Returns:

  • (String)

    AIXM or OFMX markup


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