Class: GMS::Stitcher
- Inherits:
-
Object
- Object
- GMS::Stitcher
- Defined in:
- lib/google-map-stitch/stitcher.rb
Instance Attribute Summary collapse
-
#dir ⇒ Object
Returns the value of attribute dir.
-
#output_file ⇒ Object
Returns the value of attribute output_file.
Instance Method Summary collapse
-
#initialize(dir, output_file = "map.png") ⇒ Stitcher
constructor
A new instance of Stitcher.
- #process ⇒ Object
- #tiles ⇒ Object
Constructor Details
#initialize(dir, output_file = "map.png") ⇒ Stitcher
Returns a new instance of Stitcher.
8 9 10 11 |
# File 'lib/google-map-stitch/stitcher.rb', line 8 def initialize(dir, output_file="map.png") @dir = dir @output_file = output_file end |
Instance Attribute Details
#dir ⇒ Object
Returns the value of attribute dir.
6 7 8 |
# File 'lib/google-map-stitch/stitcher.rb', line 6 def dir @dir end |
#output_file ⇒ Object
Returns the value of attribute output_file.
6 7 8 |
# File 'lib/google-map-stitch/stitcher.rb', line 6 def output_file @output_file end |
Instance Method Details
#process ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/google-map-stitch/stitcher.rb', line 21 def process output = Magick::ImageList.new tiles.each do |row| column = Magick::ImageList.new row.sort.each do |file| puts "Combining #{file}" column.push(Magick::Image.read(file).first) end output.push(column.append(true)) end output.append(false).write(@output_file) end |
#tiles ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/google-map-stitch/stitcher.rb', line 13 def tiles Dir.glob(File.join(dir,"*")).sort.map do |path| Dir.glob(File.join(path,"*.png")).sort.map do |image| image end end end |