Class: NSWTopo::Labels::Barrier::Segment
- Inherits:
-
Object
- Object
- NSWTopo::Labels::Barrier::Segment
- Defined in:
- lib/nswtopo/layer/labels/barrier.rb
Instance Attribute Summary collapse
-
#barrier ⇒ Object
readonly
Returns the value of attribute barrier.
-
#bounds ⇒ Object
readonly
Returns the value of attribute bounds.
Instance Method Summary collapse
- #conflicts_with?(segment, buffer: 0) ⇒ Boolean
-
#initialize(segment, barrier) ⇒ Segment
constructor
A new instance of Segment.
Constructor Details
#initialize(segment, barrier) ⇒ Segment
Returns a new instance of Segment.
5 6 7 8 9 10 |
# File 'lib/nswtopo/layer/labels/barrier.rb', line 5 def initialize(segment, ) @segment, = segment, @bounds = @segment.transpose.map(&:minmax).map do |min, max| [min - .buffer, max + .buffer] end end |
Instance Attribute Details
#barrier ⇒ Object (readonly)
Returns the value of attribute barrier.
11 12 13 |
# File 'lib/nswtopo/layer/labels/barrier.rb', line 11 def end |
#bounds ⇒ Object (readonly)
Returns the value of attribute bounds.
11 12 13 |
# File 'lib/nswtopo/layer/labels/barrier.rb', line 11 def bounds @bounds end |
Instance Method Details
#conflicts_with?(segment, buffer: 0) ⇒ Boolean
13 14 15 |
# File 'lib/nswtopo/layer/labels/barrier.rb', line 13 def conflicts_with?(segment, buffer: 0) [@segment, segment].overlap?(.buffer + buffer) end |