Class: Map::KmlOffsetService

Inherits:
Object
  • Object
show all
Defined in:
lib/map/kml_offset_service.rb

Constant Summary collapse

MINIMUM_POINTS =
3

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(kml) ⇒ KmlOffsetService



8
9
10
# File 'lib/map/kml_offset_service.rb', line 8

def initialize(kml)
  @kml = kml
end

Instance Attribute Details

#kmlObject (readonly)

Returns the value of attribute kml.



6
7
8
# File 'lib/map/kml_offset_service.rb', line 6

def kml
  @kml
end

Instance Method Details

#call(offset) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/map/kml_offset_service.rb', line 12

def call(offset)
  polygons = coordinates.flat_map do |point|
    call_python(point.map(&:reverse), offset) if point.length > MINIMUM_POINTS
  end.compact

  generate_kml(polygons)
end