class AIXM::Feature::ObstacleGroup

Groups of obstacles which consist of either linked (e.g. power line towers) or unlinked (e.g. wind turbines) members.

Obstacle group should contain at least two obstacles. However, if the details of each obstacle of the group are unknown, you may add only one virtual obstacle to the group and mention the number of real obstacles in it's remarks.

Cheat Sheet in Pseudo Code:

obstacle_group = AIXM.obstacle_group(
  source: String or nil        # see remarks below
  region: String or nil
  name: String or nil
).tap do |obstacle_group|
  obstacle_group.xy_accuracy = AIXM.d or nil
  obstacle_group.z_accuracy = AIXM.d or nil
  obstacle_group.remarks = String or nil
end
obstacle_group.add_obstacle(   # add an obstacle to the group
  AIXM.obstacle
)
obstacle_group.add_obstacle(   # add an obstacle to the group and link
  AIXM.obstacle,               # it to the obstacle last added to the group
  linked_to: :previous,
  link_type: LINK_TYPES
)
obstacle_group.add_obstacle(   # add an obstacle to the group and link
  AIXM.obstacle,               # it to any obstacle already in the group
  linked_to: AIXM.obstacle,
  link_type: LINK_TYPES
)

Please note: Accuracies (xy_accuracy and z_accuracy) set on an obstacle group are implicitly applied to all obstacles of the group unless they have their own, different accuracies set.

@see gitlab.com/openflightmaps/ofmx/wikis/Obstacle

Attributes

remarks[R]

@return [String, nil] free text remarks

Public Class Methods

new(source: nil, region: nil) click to toggle source
   # File lib/aixm/feature.rb
15 def initialize(source: nil, region: nil)
16   self.source = source
17   self.region = region || AIXM.config.region
18 end
new(source: nil, region: nil, name: nil) click to toggle source
Calls superclass method AIXM::Feature::new
   # File lib/aixm/feature/obstacle_group.rb
83 def initialize(source: nil, region: nil, name: nil)
84   super(source: source, region: region)
85   self.name = name
86 end

Public Instance Methods

inspect() click to toggle source

@return [String]

   # File lib/aixm/feature/obstacle_group.rb
89 def inspect
90   %Q(#<#{self.class} #{@obstacles.count} obstacle(s)>)
91 end
name=(value) click to toggle source
   # File lib/aixm/feature/obstacle_group.rb
93 def name=(value)
94   fail(ArgumentError, "invalid name") unless value.nil? || value.is_a?(String)
95   @name = value&.uptrans
96 end
remarks=(value) click to toggle source
    # File lib/aixm/feature/obstacle_group.rb
108 def remarks=(value)
109   @remarks = value&.to_s
110 end
to_uid() click to toggle source

@return [String] UID markup

    # File lib/aixm/feature/obstacle_group.rb
113 def to_uid
114   builder = Builder::XmlMarkup.new(indent: 2)
115   builder.OgrUid({ region: (region if AIXM.ofmx?) }.compact) do |ogr_uid|
116     ogr_uid.geoLat(obstacles.first.xy.lat(AIXM.schema))
117     ogr_uid.geoLong(obstacles.first.xy.long(AIXM.schema))
118   end
119 end
to_xml() click to toggle source

@return [String] AIXM or OFMX markup

    # File lib/aixm/feature/obstacle_group.rb
123 def to_xml
124   builder = Builder::XmlMarkup.new(indent: 2)
125   if AIXM.ofmx?
126     builder.comment! "Obstacle group: #{name}".strip
127     builder.Ogr({ source: (source if AIXM.ofmx?) }.compact) do |ogr|
128       ogr << to_uid.indent(2)
129       ogr.txtName(name)
130       ogr.codeDatum('WGE')
131       if xy_accuracy
132         ogr.valGeoAccuracy(xy_accuracy.dist.trim)
133         ogr.uomGeoAccuracy(xy_accuracy.unit.upcase.to_s)
134       end
135       if z_accuracy
136         ogr.valElevAccuracy(z_accuracy.to_ft.dist.round)
137         ogr.uomElevAccuracy('FT')
138       end
139       ogr.txtRmk(remarks) if remarks
140     end
141   end
142   obstacles.each { builder << _1.to_xml(delegate: false) }
143   builder.target!
144 end
xy_accuracy=(value) click to toggle source
    # File lib/aixm/feature/obstacle_group.rb
 98 def xy_accuracy=(value)
 99   fail(ArgumentError, "invalid xy accuracy") unless value.nil? || value.is_a?(AIXM::D)
100   @xy_accuracy = value
101 end
z_accuracy=(value) click to toggle source
    # File lib/aixm/feature/obstacle_group.rb
103 def z_accuracy=(value)
104   fail(ArgumentError, "invalid z accuracy") unless value.nil? || value.is_a?(AIXM::D)
105   @z_accuracy = value
106 end