Class: NSWTopo::Labels::Barrier
- Inherits:
-
Object
- Object
- NSWTopo::Labels::Barrier
- Defined in:
- lib/nswtopo/layer/labels/barrier.rb
Defined Under Namespace
Classes: Segment
Instance Attribute Summary collapse
-
#buffer ⇒ Object
readonly
Returns the value of attribute buffer.
Instance Method Summary collapse
-
#initialize(feature, buffer) ⇒ Barrier
constructor
A new instance of Barrier.
- #segments ⇒ Object
Constructor Details
#initialize(feature, buffer) ⇒ Barrier
Returns a new instance of Barrier.
18 19 20 |
# File 'lib/nswtopo/layer/labels/barrier.rb', line 18 def initialize(feature, buffer) @feature, @buffer = feature, buffer end |
Instance Attribute Details
#buffer ⇒ Object (readonly)
Returns the value of attribute buffer.
21 22 23 |
# File 'lib/nswtopo/layer/labels/barrier.rb', line 21 def buffer @buffer end |
Instance Method Details
#segments ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/nswtopo/layer/labels/barrier.rb', line 23 def segments case @feature when GeoJSON::Point [[@feature.coordinates] * 2] when GeoJSON::LineString @feature.coordinates.segments when GeoJSON::Polygon @feature.coordinates.flat_map do |coordinates| coordinates.segments end end.map do |segment| Segment.new segment, self end end |