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.


129
130
131
# File 'lib/aipp/border.rb', line 129

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


127
128
129
# File 'lib/aipp/border.rb', line 127

def coordinates_index
  @coordinates_index
end

#geometry_indexObject

Returns the value of attribute geometry_index


126
127
128
# File 'lib/aipp/border.rb', line 126

def geometry_index
  @geometry_index
end

Instance Method Details

#inspectString

Returns:


134
135
136
# File 'lib/aipp/border.rb', line 134

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


141
142
143
# File 'lib/aipp/border.rb', line 141

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