Class: AIPP::Border::Position

Inherits:
Object
  • Object
show all
Defined in:
lib/aipp/border.rb

Overview

Position defines an exact point on a border

Examples:

position = AIPP::Border::Position.new(
  geometries: border.geometries, geometry_index: 0, coordinates_index: 0
)
position.xy   # => #<AIXM::XY 45.12013320N 006.00953165E>

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(geometries:, geometry_index:, coordinates_index:) ⇒ Position

Returns a new instance of Position.



160
161
162
# File 'lib/aipp/border.rb', line 160

def initialize(geometries:, geometry_index:, coordinates_index:)
  @geometries, @geometry_index, @coordinates_index = geometries, geometry_index, coordinates_index
end

Instance Attribute Details

#coordinates_indexObject

Returns the value of attribute coordinates_index.



158
159
160
# File 'lib/aipp/border.rb', line 158

def coordinates_index
  @coordinates_index
end

#geometry_indexObject

Returns the value of attribute geometry_index.



157
158
159
# File 'lib/aipp/border.rb', line 157

def geometry_index
  @geometry_index
end

Instance Method Details

#inspectString

Returns:



165
166
167
# File 'lib/aipp/border.rb', line 165

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

#xyAIXM::XY?

Coordinates for this position

Returns:

  • (AIXM::XY, nil)

    coordinates or nil if the indexes don’t exist



172
173
174
# File 'lib/aipp/border.rb', line 172

def xy
  @geometries.dig(@geometry_index, @coordinates_index)
end