map_print 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bcc0124c6e8b0ca5bae918c8306ff3057f8d400e
4
- data.tar.gz: 0c47173c8d8a2079d54a6775ee738f3f9a50a233
3
+ metadata.gz: cc968d11e40e86fdaa3559d6093c39f994f9ae41
4
+ data.tar.gz: 9659ed13e55f82993d8e386715ea2cfb42f25d79
5
5
  SHA512:
6
- metadata.gz: 2a3fc9ee3d584924d37ac49a68319a9827f9c4b3a00718c5f77d81ee969b0ddacec7ba30626fca03fb04e527c68ee206c2cf3cc0fd5f0d4ff2a16f5c129f17da
7
- data.tar.gz: 36f8e4882219e98149d3750d778e25292d277198a13b21c5e4b0f6c39d50486627105d2bba0bdfe1a6dc63967fb6dfee58892b3b854632f3f37df37dbbac1c26
6
+ metadata.gz: 88d26aaac1871cdc2402c2977d28abe57e6394a34c4a0e0b4eb6fca0866bd086d2eac8393fae1ec457a03e2a593343e771b06fde41badba10694370001732479
7
+ data.tar.gz: bca0ee97779b4917a6e972353f4ceeff84a8678485a5435c26d91c2058f0edb252b78fd7d8d81c5b414da1388c111efd693ed43344c456dc14527d0ae999f40f
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- map_print (1.1.0)
4
+ map_print (1.2.0)
5
5
  mini_magick (~> 4.3)
6
6
  parallel (~> 1.6)
7
7
  prawn (~> 2.0)
@@ -33,14 +33,27 @@ module MapPrint
33
33
  private
34
34
  def print_map
35
35
  map_image = @context.print_layers
36
- map_image = @context.print_geojson(MiniMagick::Image.new(map_image.path))
37
36
 
38
- size = @context.map[:size] || {}
39
- size[:width] ||= map_image.width
40
- size[:height] ||= map_image.height
37
+ size = @context.map[:size]
38
+ geometry = ''
39
+ if size && (size[:width] || size[:height])
40
+ geometry += size[:width].to_s if size[:width]
41
+ geometry += 'x'
42
+ geometry += size[:height].to_s if size[:height]
43
+
44
+ image = MiniMagick::Image.new(map_image.path)
45
+ image.combine_options do |c|
46
+ c.density 300
47
+ c.resize geometry
48
+ c.unsharp '1.5x1+0.7+0.02'
49
+ end
50
+ image.write map_image.path
51
+ end
52
+
53
+ map_image = @context.print_geojson(MiniMagick::Image.new(map_image.path))
41
54
 
42
55
  position = @context.map[:position] || {}
43
- @pdf.image map_image.path, at: [position[:x] || 0, @pdf.bounds.top - (position[:y] || 0)], fit: size.values
56
+ @pdf.image map_image.path, at: [position[:x] || 0, @pdf.bounds.top - (position[:y] || 0)]
44
57
  end
45
58
 
46
59
  def print_image(image_path, position)
@@ -34,7 +34,6 @@ module MapPrint
34
34
 
35
35
  def print_map
36
36
  map_image = @context.print_layers
37
- map_image = @context.print_geojson(MiniMagick::Image.new(map_image.path))
38
37
 
39
38
  size = @context.map[:size]
40
39
  geometry = ''
@@ -42,9 +41,19 @@ module MapPrint
42
41
  geometry += size[:width].to_s if size[:width]
43
42
  geometry += 'x'
44
43
  geometry += size[:height].to_s if size[:height]
44
+
45
+ image = MiniMagick::Image.new(map_image.path)
46
+ image.combine_options do |c|
47
+ c.density 300
48
+ c.resize geometry
49
+ c.unsharp '1.5x1+0.7+0.02'
50
+ end
51
+ image.write map_image.path
45
52
  end
46
53
 
47
- overlay_image(map_image, @context.map[:position], geometry)
54
+ map_image = @context.print_geojson(MiniMagick::Image.new(map_image.path))
55
+
56
+ overlay_image(map_image, @context.map[:position])
48
57
  end
49
58
 
50
59
  private
@@ -1,3 +1,3 @@
1
1
  module MapPrint
2
- VERSION = '1.1.0'
2
+ VERSION = '1.2.0'
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: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Fast
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-11 00:00:00.000000000 Z
11
+ date: 2016-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler