map_print 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 139b682f39bdac95f76c9c486a146dc16376e0f6
4
- data.tar.gz: 6df45284cb99894a860474e60b8443cbe4adf458
3
+ metadata.gz: b403565fd160476de9c6c7bc64b96f87168c0709
4
+ data.tar.gz: 2acbf3eea43cc28719c4d50270de1ad244fb4b37
5
5
  SHA512:
6
- metadata.gz: 5ecda32b632e257d4e79bd22900480796e2bb0f3167de4c5b53661902a923b8508314be59e69b6dd1b23e0a24638cd22f8eca0ae31954c59ada553d7b190ad57
7
- data.tar.gz: 298ed01e24f773854d869243140641f33a5982fc640a504a3c3aa958cb9f79bb08d289a3ac77af272bf8ab57f130c45b6e6c10756c893f4903ea025b83965640
6
+ metadata.gz: 96ae6bc8c7a4d0b81539616ce93b8c0cd13f1288b70e7fa20d9f24de5f6207d24665bd651a534d592d73b8e04441d92b8a6e9053716e8fb642c5df8b7b2af246
7
+ data.tar.gz: 1a347d350da58f79f5336f13ab07efbea01ca0e28be37233a947d26ac670479e112e355db05daacb1c85fa664d690532c49611126959d522edac6d3f6a47a6d8
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # MapPrint
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/map_print.svg)](https://badge.fury.io/rb/map_print)
4
+
3
5
  MapPrint allows for exporting many map sources and GeoJSON to a pdf file. Allowing to specify map element, text/image elements as well as printing a legend with the reference and a scale bar.
4
6
 
5
7
  ## Installation
@@ -50,7 +50,10 @@ module MapPrint
50
50
 
51
51
  FileUtils.cp map_image.path, './map.png' if defined?(DEBUG)
52
52
 
53
- pdf.image map_image.path, at: [@map[:position][:x], pdf.bounds.top - @map[:position][:y]]
53
+ size = @map[:size]
54
+ size[:width] ||= map_image.width
55
+ size[:height] ||= map_image.height
56
+ pdf.image map_image.path, at: [@map[:position][:x], pdf.bounds.top - @map[:position][:y]], fit: size.values
54
57
 
55
58
  print_images_on_pdf(pdf)
56
59
  print_texts_on_pdf(pdf)
@@ -68,6 +71,14 @@ module MapPrint
68
71
  print_texts_on_png(map_image)
69
72
  print_legend_on_png(map_image)
70
73
 
74
+ size = @map[:size]
75
+ if size
76
+ size[:width] ||= map_image.width
77
+ size[:height] ||= map_image.height
78
+ puts "Fitting map image (#{map_image.width}x#{map_image.height}) in #{size[:width]}x#{size[:height]}"
79
+ map_image.colorspace("RGB").resize("#{size[:width]}x#{size[:height]}\>").colorspace("sRGB").unsharp "0x0.75+0.75+0.008"
80
+ end
81
+
71
82
  FileUtils.cp map_image.path, @output_path
72
83
  end
73
84
 
@@ -81,17 +92,8 @@ module MapPrint
81
92
 
82
93
  def print_layers
83
94
  file = LayerHandler.new(@map[:layers], @map[:sw], @map[:ne], @map[:zoom]).process
84
- size = @map[:size]
85
-
86
- FileUtils.cp file.path, 'layers.png' if defined?DEBUG
87
95
 
88
- if size
89
- image = MiniMagick::Image.new(file.path)
90
- size[:width] ||= image.width
91
- size[:height] ||= image.height
92
- puts "Fitting map image (#{image.width}x#{image.height}) in #{size[:width]}x#{size[:height]}"
93
- image.colorspace("RGB").resize("#{size[:width]}x#{size[:height]}\>").colorspace("sRGB").unsharp "0x0.75+0.75+0.008"
94
- end
96
+ FileUtils.cp file.path, 'layers.png' if defined?(DEBUG)
95
97
 
96
98
  file
97
99
  end
@@ -1,3 +1,3 @@
1
1
  module MapPrint
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: map_print
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Fast
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-27 00:00:00.000000000 Z
11
+ date: 2015-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler