Class: Contrek::Concurrent::Merger
Instance Attribute Summary
Attributes included from Poolable
#number_of_threads
Attributes inherited from Finder
#maximum_width, #options
Instance Method Summary
collapse
Methods included from Poolable
#enqueue!, #wait!
Constructor Details
#initialize(options: {}) ⇒ Merger
Returns a new instance of Merger.
6
7
8
9
10
11
12
|
# File 'lib/contrek/finder/concurrent/merger.rb', line 6
def initialize(options: {})
@initialize_time = 0
@current_x = 0
@tiles = Queue.new
@whole_tile = nil
@options = options
end
|
Instance Method Details
#add_tile(result) ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/contrek/finder/concurrent/merger.rb', line 14
def add_tile(result)
@height ||= result.metadata[:height]
end_x = @current_x + result.metadata[:width]
tile = Tile.new(
finder: self,
start_x: @current_x,
end_x: end_x,
name: @tiles.size.to_s
)
tile.assign_raw_polygons!(result[:polygons])
@tiles << tile
@maximum_width = end_x
@current_x = end_x - 1
end
|
#process_info ⇒ Object
31
32
33
34
|
# File 'lib/contrek/finder/concurrent/merger.rb', line 31
def process_info
process_tiles!(nil, height: @height)
super
end
|