Class: AIXM::Feature::Obstacle

Inherits:
AIXM::Feature show all
Includes:
Concerns::Association, Concerns::Remarks
Defined in:
lib/aixm/feature/obstacle.rb

Overview

Obstacles are individual objects described as cylindrical volume with circular base and height.

Cheat Sheet in Pseudo Code:

obstacle = AIXM.obstacle(
  source: String or nil
  region: String or nil
  name: String or nil
  type: TYPES
  xy: AIXM.xy
  z: AIXM.z
  radius: AIXM.d or nil
)
obstacle.lighting = true or false (default for AIXM) or nil (means: unknown, default for OFMX)
obstacle.lighting_remarks = String or nil
obstacle.marking = true or false or nil (means: unknown, default)
obstacle.marking_remarks = String or nil
obstacle.height = AIXM.d or nil
obstacle.height_accurate = true or false or nil (means: unknown, default)
obstacle.xy_accuracy = AIXM.d or nil
obstacle.z_accuracy = AIXM.d or nil
obstacle.valid_from = Time or Date or String or nil
obstacle.valid_until = Time or Date or String or nil
obstacle.remarks = String or nil
obstacle.comment = Object or nil
obstacle.link_to   # => AIXM.obstacle or nil
obstacle.link_type   # => LINK_TYPE or nil

See ObstacleGroup for how to define physical links between two obstacles (e.g. cables between powerline towers).

Please note: As soon as an obstacle is added to an obstacle group, the xy_accuracy and z_accuracy of the obstacle group overwrite whatever is set on the individual obstacles. On the other hand, if the obstacle group has no source set, it will inherit this value from the first obstacle in the group.

Constant Summary collapse

TYPES =
{
  ANTENNA: :antenna,
  BUILDING: :building,
  CHIMNEY: :chimney,
  CRANE: :crane,
  MAST: :mast,
  TOWER: :tower,
  WINDTURBINE: :wind_turbine,
  OTHER: :other   # specify in remarks
}.freeze
{
  CABLE: :cable,
  SOLID: :solid,
  OTHER: :other
}.freeze

Constants inherited from AIXM::Feature

REGION_RE

Instance Attribute Summary collapse

Attributes included from Concerns::Remarks

#remarks

Attributes inherited from AIXM::Feature

#comment, #region, #source

Attributes inherited from Component

#meta

Instance Method Summary collapse

Methods included from Concerns::Association

included

Methods inherited from AIXM::Feature

#==, #hash

Methods included from Concerns::HashEquality

#eql?, #hash

Methods included from Concerns::XMLBuilder

#build_fragment, #to_uid, #to_xml

Methods included from Concerns::Memoize

included, method

Constructor Details

#initialize(source: nil, region: nil, name: nil, type:, xy:, z:, radius: nil) ⇒ Obstacle

See the cheat sheet for examples on how to create instances of this class.



203
204
205
206
207
# File 'lib/aixm/feature/obstacle.rb', line 203

def initialize(source: nil, region: nil, name: nil, type:, xy:, z:, radius: nil)
  super(source: source, region: region)
  self.name, self.type, self.xy, self.z, self.radius = name, type, xy, z, radius
  @lighting = @marking = false
end

Instance Attribute Details

#heightAIXM::D? #height=(value) ⇒ Object

Height from ground to top point.

Overloads:



149
150
151
# File 'lib/aixm/feature/obstacle.rb', line 149

def height
  @height
end

#height_accurateBoolean? #height_accurate=(value) ⇒ Object

Height accuracy.

Overloads:

  • #height_accurateBoolean?

    Returns nil means unknown.

    Returns:

    • (Boolean, nil)

      nil means unknown

  • #height_accurate=(value) ⇒ Object

    Parameters:

    • value (Boolean, nil)

      nil means unknown



157
158
159
# File 'lib/aixm/feature/obstacle.rb', line 157

def height_accurate
  @height_accurate
end

#lightingBoolean? #lighting=(value) ⇒ Object

Presence of lighting (e.g. strobes).

Overloads:

  • #lightingBoolean?

    Returns nil means unknown.

    Returns:

    • (Boolean, nil)

      nil means unknown

  • #lighting=(value) ⇒ Object

    Parameters:

    • value (Boolean, nil)

      nil means unknown



117
118
119
# File 'lib/aixm/feature/obstacle.rb', line 117

def lighting
  @lighting
end

#lighting_remarksString? #lighting_remarks=(value) ⇒ Object

Detailed description of the lighting.

Overloads:

  • #lighting_remarksString?

    Returns:

    • (String, nil)
  • #lighting_remarks=(value) ⇒ Object

    Parameters:

    • value (String, nil)


125
126
127
# File 'lib/aixm/feature/obstacle.rb', line 125

def lighting_remarks
  @lighting_remarks
end

Type of physical link between this and another obstacle.

Returns:



199
200
201
# File 'lib/aixm/feature/obstacle.rb', line 199

def link_type
  @link_type
end

#linked_toAIXM::Feature::Obstacle?

Another obstacle to which a physical link exists.

Returns:



194
195
196
# File 'lib/aixm/feature/obstacle.rb', line 194

def linked_to
  @linked_to
end

#markingBoolean? #marking=(value) ⇒ Object

Presence of marking (e.g. red/white paint).

Overloads:

  • #markingBoolean?

    Returns nil means unknown.

    Returns:

    • (Boolean, nil)

      nil means unknown

  • #marking=(value) ⇒ Object

    Parameters:

    • value (Boolean, nil)

      nil means unknown



133
134
135
# File 'lib/aixm/feature/obstacle.rb', line 133

def marking
  @marking
end

#marking_remarksString nil #marking_remarks=(value) ⇒ Object

Detailed description of the marking.

Overloads:

  • #marking_remarksString nil

    Returns:

    • (String nil)
  • #marking_remarks=(value) ⇒ Object

    Parameters:

    • value (String, nil)


141
142
143
# File 'lib/aixm/feature/obstacle.rb', line 141

def marking_remarks
  @marking_remarks
end

#nameString #name=(value) ⇒ Object

Full name.

Overloads:

  • #nameString

    Returns:

    • (String)
  • #name=(value) ⇒ Object

    Parameters:

    • value (String)


77
78
79
# File 'lib/aixm/feature/obstacle.rb', line 77

def name
  @name
end

#radiusAIXM::D #radius=(value) ⇒ Object

Circular base radius.

Overloads:



101
102
103
# File 'lib/aixm/feature/obstacle.rb', line 101

def radius
  @radius
end

#typeSymbol #type=(value) ⇒ Object

Type of obstacle.

Overloads:

  • #typeSymbol

    Returns any of TYPES.

    Returns:

    • (Symbol)

      any of TYPES

  • #type=(value) ⇒ Object

    Parameters:

    • value (Symbol)

      any of TYPES



85
86
87
# File 'lib/aixm/feature/obstacle.rb', line 85

def type
  @type
end

#valid_fromTime, ... #valid_from=(value) ⇒ Object

Effective after this point in time.

Overloads:

  • #valid_fromTime, ...

    Returns:

    • (Time, Date, String, nil)
  • #valid_from=(value) ⇒ Object

    Parameters:

    • value (Time, Date, String, nil)


181
182
183
# File 'lib/aixm/feature/obstacle.rb', line 181

def valid_from
  @valid_from
end

#valid_untilTime, ... #valid_until=(value) ⇒ Object

Effective until this point in time.

Overloads:

  • #valid_untilTime, ...

    Returns:

    • (Time, Date, String, nil)
  • #valid_until=(value) ⇒ Object

    Parameters:

    • value (Time, Date, String, nil)


189
190
191
# File 'lib/aixm/feature/obstacle.rb', line 189

def valid_until
  @valid_until
end

#xyAIXM::XY #xy=(value) ⇒ Object

Circular base center point.

Overloads:



93
94
95
# File 'lib/aixm/feature/obstacle.rb', line 93

def xy
  @xy
end

#xy_accuracyAIXM::D? #xy_accuracy=(value) ⇒ Object

Margin of error for circular base center point.

Overloads:



165
166
167
# File 'lib/aixm/feature/obstacle.rb', line 165

def xy_accuracy
  @xy_accuracy
end

#zAIXM::Z #z=(value) ⇒ Object

Elevation of the top point in :qnh.

Overloads:



109
110
111
# File 'lib/aixm/feature/obstacle.rb', line 109

def z
  @z
end

#z_accuracyAIXM::D? #z_accuracy=(value) ⇒ Object

Margin of error for top point.

Overloads:



173
174
175
# File 'lib/aixm/feature/obstacle.rb', line 173

def z_accuracy
  @z_accuracy
end

Instance Method Details

#grouped?Boolean

Whether part of an obstacle group.

Returns:

  • (Boolean)


298
299
300
# File 'lib/aixm/feature/obstacle.rb', line 298

def grouped?
  obstacle_group && obstacle_group.obstacles.count > 1
end

#inspectString

Returns:

  • (String)


210
211
212
# File 'lib/aixm/feature/obstacle.rb', line 210

def inspect
  %Q(#<#{self.class} xy="#{xy}" type=#{type.inspect} name=#{name.inspect}>)
end

#linked?Boolean

Whether obstacle is linked to another one.

Returns:

  • (Boolean)


305
306
307
# File 'lib/aixm/feature/obstacle.rb', line 305

def linked?
  !!linked_to
end

#obstacle_groupAIXM::Feature::ObstacleGroup

Returns group this obstacle belongs to.

Returns:



69
# File 'lib/aixm/feature/obstacle.rb', line 69

belongs_to :obstacle_group