Class: Contrek::Concurrent::SvgStreamingMerger

Inherits:
StreamingMerger show all
Defined in:
lib/contrek/finder/concurrent/svg_streaming_merger.rb

Instance Attribute Summary

Attributes inherited from Merger

#tiles

Attributes included from Poolable

#number_of_threads

Attributes inherited from Finder

#maximum_width, #options

Instance Method Summary collapse

Methods inherited from StreamingMerger

#add_tile, #process_info

Methods inherited from VerticalMerger

#add_tile, #process_info, #transpose?

Methods inherited from Merger

#add_tile, #process_info

Methods included from Poolable

#enqueue!, #wait!

Methods inherited from Finder

#process_info, #transpose?

Constructor Details

#initialize(stream_to:, total_width:, total_height:, options: {}) ⇒ SvgStreamingMerger

Returns a new instance of SvgStreamingMerger.



6
7
8
9
10
# File 'lib/contrek/finder/concurrent/svg_streaming_merger.rb', line 6

def initialize(stream_to:, total_width:, total_height:, options: {})
  @total_width = total_width
  @total_height = total_height
  super(stream_to:, options:)
end

Instance Method Details



16
17
18
# File 'lib/contrek/finder/concurrent/svg_streaming_merger.rb', line 16

def write_footer
  @stream.write("</svg>")
end

#write_headerObject



12
13
14
# File 'lib/contrek/finder/concurrent/svg_streaming_merger.rb', line 12

def write_header
  @stream.write("<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"#{@total_width}\" height=\"#{@total_height}\"><style>#{svg_css}</style>")
end

#write_inner_polygon(inner_pts) ⇒ Object



24
25
26
# File 'lib/contrek/finder/concurrent/svg_streaming_merger.rb', line 24

def write_inner_polygon(inner_pts)
  @stream.write("<polygon points=\"#{inner_pts}\" class=\"in\"/>")
end

#write_outer_polygon(outer_pts) ⇒ Object



20
21
22
# File 'lib/contrek/finder/concurrent/svg_streaming_merger.rb', line 20

def write_outer_polygon(outer_pts)
  @stream.write("<polygon points=\"#{outer_pts}\" class=\"out\"/>")
end