map_print 0.9.0 → 1.0.0

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: 071baa0acdcea17783abc5c2a0cd40b5a7bead82
4
- data.tar.gz: 397e7e367a66af93f2abc590aaf462fb4afa94d5
3
+ metadata.gz: 0b7f7ff077bdc65127a96cb126451677f4f8317f
4
+ data.tar.gz: 0fb0c8560df44020151c117670206c3593acc3a8
5
5
  SHA512:
6
- metadata.gz: e77dcb704714848b51dc7a2bde3f0e0c42557a0735284f005cccdf3608395e33b93f7ac2bfaefa27e508d26a947c5e71d971bff3f3032060829a4d2d0836fccc
7
- data.tar.gz: 4afb485eb8225eec40a8d50d8853f4f8d456df08e1b87a610b9acf6fc89f833873a6d81fc80e71f8afc52a182a01bd1e50d81c6bfed58fba10e0f9f92899d63b
6
+ metadata.gz: c4100a81072048511823a1ba2cd7b3e10779b24f0493cb7fe22cdf4d1455c255fc2ef767f3b079268e4a1dc0a845500d3c16752ecf37d4a8e4065f3b6ae02967
7
+ data.tar.gz: 75daabd87f3a99af524f38cd73806ad4c433efb39460d0e01f76992d4d4059131a6ba7f7141f96ad74103864d1547b03b810c9d78883d92f26ceecf502b141d6
data/.travis.yml CHANGED
@@ -2,3 +2,4 @@ language: ruby
2
2
  rvm:
3
3
  - 2.0.0
4
4
  - 2.1
5
+ - 2.2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- map_print (0.9.0)
4
+ map_print (1.0.0)
5
5
  mini_magick (~> 4.3)
6
6
  parallel (~> 1.6)
7
7
  prawn (~> 2.0)
@@ -58,6 +58,7 @@ module MapPrint
58
58
  if @map[:geojson]
59
59
  geojson_image = GeoJSONHandler.new(@map[:geojson], @map[:sw], @map[:ne], map_image.width, map_image.height).process
60
60
  result = MiniMagick::Image.open(map_image.path).composite(geojson_image) do |c|
61
+ c.density 300
61
62
  c.compose "atop"
62
63
  end
63
64
  result.write map_image.path
@@ -1,13 +1,14 @@
1
1
  module MapPrint
2
+ class FeatureNotImplemented < StandardError; end
3
+
2
4
  class GeoJSONHandlerError < StandardError; end
3
5
  class InvalidGeoJSON < GeoJSONHandlerError; end
4
6
  class NoPointImage < GeoJSONHandlerError; end
5
7
  class NoGeometryPresent < GeoJSONHandlerError; end
6
- class FeatureNotImplemented < GeoJSONHandlerError; end
7
8
 
8
9
  class LegendHandlerError < StandardError; end
9
10
  class NoLegendData < LegendHandlerError; end
10
- class InvalidSize < LegendHandlerError; end
11
+ class InvalidLegendSize < LegendHandlerError; end
11
12
  class MissingLayoutInformation < LegendHandlerError; end
12
13
 
13
14
  class ScalebarHandlerError < StandardError; end
@@ -4,9 +4,9 @@ module MapPrint
4
4
  class GeoJSONHandler
5
5
  def initialize(geojson, sw, ne, width, height)
6
6
  @top_lat = ne[:lat]
7
- @total_lat = ne[:lat] - sw[:lat]
7
+ @total_lat = (ne[:lat] - sw[:lat])
8
8
  @left_lng = sw[:lng]
9
- @total_lng = ne[:lng] - sw[:lng]
9
+ @total_lng = (ne[:lng] - sw[:lng])
10
10
  @height = height
11
11
  @width = width
12
12
  @geojson = JSON[geojson]
@@ -16,7 +16,7 @@ module MapPrint
16
16
 
17
17
  def process
18
18
  tempfile = Tempfile.new ['geojson', '.png']
19
- `convert -size #{@width}x#{@height} xc:transparent #{tempfile.path}`
19
+ `convert -density 300 -size #{@width}x#{@height} xc:transparent #{tempfile.path}`
20
20
  @image = MiniMagick::Image.new tempfile.path
21
21
 
22
22
  draw_geojson
@@ -53,13 +53,13 @@ module MapPrint
53
53
  when 'Polygon'
54
54
  polygon(geometry, properties)
55
55
  when 'MultiPoint'
56
- multi_point(geometry, properties)
56
+ raise FeatureNotImplemented.new("Please consider contributing!")
57
57
  when 'MultiLineString'
58
- multi_line_string(geometry, properties)
58
+ raise FeatureNotImplemented.new("Please consider contributing!")
59
59
  when 'MultiPolygon'
60
- multi_polygon(geometry, properties)
60
+ raise FeatureNotImplemented.new("Please consider contributing!")
61
61
  when 'GeometryCollection'
62
- geometry_collection(geometry, properties)
62
+ raise FeatureNotImplemented.new("Please consider contributing!")
63
63
  else
64
64
  Logger.warn "Feature type '#{geometry['type']}' not implemented!"
65
65
  end
@@ -74,22 +74,25 @@ module MapPrint
74
74
  end
75
75
 
76
76
  def point(point, image_path)
77
- x = get_x(point['coordinates'][1])
78
- y = get_y(point['coordinates'][0])
77
+ x = get_x(point['coordinates'][0])
78
+ y = get_y(point['coordinates'][1])
79
79
 
80
80
  point_image = MiniMagick::Image.open(image_path)
81
81
  x -= point_image.width / 2
82
82
  y -= point_image.height / 2
83
83
 
84
84
  @image.composite(point_image) do |c|
85
+ c.density 300
85
86
  c.geometry("+#{x}+#{y}")
86
87
  end.write @image.path
87
88
  end
88
89
 
89
90
  def line_string(geometry, properties)
90
91
  properties ||= {}
91
- points = geometry['coordinates'].map do |coord|
92
- "#{get_x(coord[1])},#{get_y(coord[0])}"
92
+ coords = geometry['coordinates']
93
+ coords = coords.first if coords.first.first.is_a?(Array)
94
+ points = coords.map do |coord|
95
+ "#{get_x(coord[0])},#{get_y(coord[1])}"
93
96
  end
94
97
 
95
98
  draw_command = (0..(points.length - 2)).map do |i|
@@ -97,37 +100,25 @@ module MapPrint
97
100
  end.join(' ')
98
101
 
99
102
  @image.combine_options do |c|
103
+ c.density 300
100
104
  c.draw "#{draw_options(properties)} #{draw_command}"
101
105
  end
102
106
  end
103
107
 
104
108
  def polygon(geometry, properties)
105
109
  properties ||= {}
106
- points = geometry['coordinates'].map do |coord|
107
- "#{get_x(coord[1])},#{get_y(coord[0])}"
110
+ coords = geometry['coordinates']
111
+ coords = coords.first if coords.first.first.is_a?(Array)
112
+ points = coords.map do |coord|
113
+ "#{get_x(coord[0])},#{get_y(coord[1])}"
108
114
  end
109
115
 
110
116
  @image.combine_options do |c|
117
+ c.density 300
111
118
  c.draw "#{draw_options(properties, false)} polygon #{points.join(' ')}"
112
119
  end
113
120
  end
114
121
 
115
- def multi_point(geometry, properties)
116
- raise FeatureNotImplemented.new("Please consider contributing!")
117
- end
118
-
119
- def multi_line_string(geometry, properties)
120
- raise FeatureNotImplemented.new("Please consider contributing!")
121
- end
122
-
123
- def multi_polygon(geometry, properties)
124
- raise FeatureNotImplemented.new("Please consider contributing!")
125
- end
126
-
127
- def geometry_collection(geometry, properties)
128
- raise FeatureNotImplemented.new("Please consider contributing!")
129
- end
130
-
131
122
  def draw_options(properties, line=true)
132
123
  options = ''
133
124
  if properties['stroke'] || properties['stroke'].nil?
@@ -153,7 +144,7 @@ module MapPrint
153
144
  end
154
145
 
155
146
  def get_y(lat)
156
- @height * (1 - (@top_lat - lat) / @total_lat);
147
+ @height * (@top_lat - lat) / @total_lat;
157
148
  end
158
149
  end
159
150
  end
@@ -6,11 +6,12 @@ module MapPrint
6
6
 
7
7
  class << self
8
8
  def distance_between(from, to)
9
- return 0.0 if from == to # fixes a "zero-distance" bug
9
+ return 0.0 if from.lat == to.lat && from.lng == to.lng
10
10
 
11
11
  distance_between_sphere(from, to)
12
12
  end
13
13
 
14
+ private
14
15
  def distance_between_sphere(from, to)
15
16
  lat_sin = Math.sin(deg2rad(from.lat)) * Math.sin(deg2rad(to.lat))
16
17
  lat_cos = Math.cos(deg2rad(from.lat)) * Math.cos(deg2rad(to.lat))
@@ -28,6 +28,7 @@ module MapPrint
28
28
  next_image.close
29
29
  tmp_image = MiniMagick::Image.open(next_image.path)
30
30
  result = image.composite(tmp_image) do |c|
31
+ c.density 300
31
32
  c.compose "atop"
32
33
  if layer[:opacity] && layer[:opacity] < 1
33
34
  c.blend layer[:opacity] * 100
@@ -1,21 +1,32 @@
1
+ require_relative 'png_handlers/texts'
2
+ require_relative 'validations/size'
3
+
1
4
  module MapPrint
2
5
  class LegendHandler
6
+ include PngHandlers::Texts
7
+ include Validations::Size
8
+
3
9
  def initialize(legend)
4
10
  @legend = legend
5
11
  validate_data!
12
+ @x_step = @legend[:size][:width] / @legend[:columns]
13
+ @y_step = @legend[:size][:height] / @legend[:rows]
14
+ @elements_in_block = @legend[:orientation] == 'vertical' ? @legend[:rows] : @legend[:columns]
15
+ @legend[:textbox_style] ||= {}
16
+
17
+ if @legend[:textbox_size]
18
+ @legend[:textbox_style][:size] = "#{@legend[:textbox_size][:width]}x#{@legend[:textbox_size][:height]}"
19
+ end
6
20
  end
7
21
 
8
22
  def process
9
23
  size = @legend[:size]
10
24
  tempfile = Tempfile.new ['legend', '.png']
11
- `convert -size #{size[:width]}x#{size[:height]} xc:white #{tempfile.path}`
25
+ `convert -density 300 -size #{size[:width]}x#{size[:height]} xc:white #{tempfile.path}`
12
26
  image = MiniMagick::Image.new tempfile.path
13
27
 
14
- x_step = size[:width] / @legend[:columns]
15
- y_step = size[:height] / @legend[:rows]
16
28
  image_geometry = ''
17
29
  textbox_offset = 0
18
- text_size = "#{@legend[:textbox_size][:width]}x#{@legend[:textbox_size][:height]}" if @legend[:textbox_size]
19
30
 
20
31
  if @legend[:image_size]
21
32
  image_geometry += "#{@legend[:image_size][:width]}x#{@legend[:image_size][:height]}"
@@ -23,24 +34,23 @@ module MapPrint
23
34
  end
24
35
  textbox_offset += @legend[:textbox_offset] if @legend[:textbox_offset]
25
36
 
26
- if @legend[:orientation] == 'vertical'
27
- print_vertical(image, x_step, y_step, image_geometry, textbox_offset, text_size)
28
- else
29
- print_horizontal(image, x_step, y_step, image_geometry, textbox_offset, text_size)
30
- end
37
+ print(image, image_geometry, textbox_offset)
31
38
  image
32
39
  end
33
40
 
34
41
  private
35
42
  def validate_data!
36
43
  raise NoLegendData.new('No legend data present') if @legend.nil? || @legend.empty?
37
- raise InvalidSize.new('No legend width present') unless @legend[:size] && @legend[:size][:width]
38
- raise InvalidSize.new('No legend height present') unless @legend[:size][:height]
44
+ validate_size!(@legend[:size], InvalidLegendSize)
45
+ validate_layout!
46
+ end
47
+
48
+ def validate_layout!
39
49
  raise MissingLayoutInformation.new('Missing column layout information') unless @legend[:columns]
40
50
  raise MissingLayoutInformation.new('Missing rows layout information') unless @legend[:rows]
41
51
  end
42
52
 
43
- def print_vertical(legend_image, x_step, y_step, image_geometry, textbox_offset, text_size)
53
+ def print(legend_image, image_geometry, textbox_offset)
44
54
  return unless @legend[:elements].is_a?(Array)
45
55
  x = 0
46
56
  y = 0
@@ -49,60 +59,38 @@ module MapPrint
49
59
  @legend[:elements].each do |legend_item|
50
60
  image_file = MiniMagick::Image.open(legend_item[:image])
51
61
  result = legend_image.composite(image_file) do |c|
62
+ c.density 300
52
63
  c.geometry image_geometry + "+#{x}+#{y}"
53
64
  end
54
65
  result.write legend_image.path
55
66
 
56
67
  position = "#{x + textbox_offset},#{y}"
57
- draw_text(legend_image, legend_item[:text], position, text_size)
68
+ draw_text(legend_image, legend_item[:text], position, @legend[:textbox_style])
58
69
 
59
- if z % @legend[:rows] == 0
60
- x += x_step
61
- y = 0
62
- else
63
- y += y_step
64
- end
70
+ x, y = get_next_x_y(x, y, z)
65
71
  z += 1
66
72
  end
67
73
  end
68
74
 
69
- def print_horizontal(legend_image, x_step, y_step, image_geometry, textbox_offset, text_size)
70
- return unless @legend[:elements].is_a?(Array)
71
- x = 0
72
- y = 0
73
- z = 1
74
-
75
- @legend[:elements].each do |legend_item|
76
- image_file = MiniMagick::Image.open(legend_item[:image])
77
- result = legend_image.composite(image_file) do |c|
78
- c.geometry image_geometry + "+#{x}+#{y}"
79
- end
80
- result.write legend_image.path
81
-
82
- position = "#{x + textbox_offset},#{y}"
83
- draw_text(legend_image, legend_item[:text], position, text_size)
84
-
85
- if z % @legend[:columns] == 0
86
- y += y_step
87
- x = 0
88
- else
89
- x += x_step
90
- end
91
- z += 1
75
+ def get_next_x_y(x, y, z)
76
+ if @legend[:orientation] == 'vertical'
77
+ y, x = next_step(y, x, @y_step, @x_step, z)
78
+ else
79
+ x, y = next_step(x, y, @x_step, @y_step, z)
92
80
  end
81
+
82
+ return x, y
93
83
  end
94
84
 
95
- def draw_text(image, text, position, text_size)
96
- options = @legend[:textbox_style] || {}
97
- image.combine_options do |c|
98
- c.fill options[:fill_color] if options[:fill_color]
99
- c.stroke options[:color] if options[:color]
100
- c.font options[:font] || 'Arial'
101
- c.pointsize options[:pointsize] if options[:pointsize]
102
- c.gravity options[:gravity] || 'NorthWest'
103
- c.size text_size
104
- c.draw "text #{position} '#{text}'"
85
+ def next_step(small_step_value, big_step_value, small_step, big_step, z)
86
+ if z % @elements_in_block == 0
87
+ big_step_value += big_step
88
+ small_step_value = 0
89
+ else
90
+ small_step_value += small_step
105
91
  end
92
+
93
+ return small_step_value, big_step_value
106
94
  end
107
95
  end
108
96
  end
@@ -5,6 +5,8 @@ module MapPrint
5
5
  class Logger
6
6
  include Singleton
7
7
 
8
+ attr_accessor :logger
9
+
8
10
  def initialize
9
11
  @logger = ::Logger.new File.new('map_print.log', 'a+')
10
12
  end
@@ -13,7 +13,7 @@ module MapPrint
13
13
  def print
14
14
  raise ParameterError.new('Missing png_options width attribute') unless @context.png_options && @context.png_options[:width]
15
15
  raise ParameterError.new('Missing png_options height attribute') unless @context.png_options[:height]
16
- `convert -size #{@context.png_options[:width]}x#{@context.png_options[:height]} xc:#{@context.png_options[:background_color] || 'transparent'} #{@context.output_path}`
16
+ `convert -density 300 -size #{@context.png_options[:width]}x#{@context.png_options[:height]} xc:#{@context.png_options[:background_color] || 'transparent'} #{@context.output_path}`
17
17
  @png = MiniMagick::Image.new @context.output_path
18
18
 
19
19
  print_map
@@ -53,6 +53,7 @@ module MapPrint
53
53
  geometry += "+#{position[:x] || 0}+#{position[:y] || 0}" if position
54
54
 
55
55
  result = @png.composite(image) do |c|
56
+ c.density 300
56
57
  c.geometry geometry unless geometry.nil? || geometry.empty?
57
58
  end
58
59
  result.write @context.output_path
@@ -10,6 +10,7 @@ module MapPrint
10
10
  geometry += "+#{image[:position][:x]}+#{image[:position][:y]}"
11
11
  result = png.composite(image_file) do |c|
12
12
  c.geometry geometry
13
+ c.density 300
13
14
  end
14
15
  result.write @context.output_path
15
16
  end
@@ -11,14 +11,22 @@ module MapPrint
11
11
 
12
12
  def draw_text(png, text, position, options)
13
13
  png.combine_options do |c|
14
- c.fill options[:fill_color] if options[:fill_color]
15
- c.stroke options[:color] if options[:color]
16
- c.font options[:font] || 'Arial'
17
- c.pointsize options[:pointsize] if options[:pointsize]
18
- c.gravity options[:gravity] || 'NorthWest'
14
+ c.density 300
15
+ sanitize_options(options).each do |option, value|
16
+ c.send option, value
17
+ end
19
18
  c.draw "text #{position} '#{text}'"
20
19
  end
21
20
  end
21
+
22
+ def sanitize_options(options)
23
+ return {} unless options.is_a?(Hash)
24
+ options[:stroke] = options.delete :color if options[:color]
25
+ options[:fill] = options.delete :fill_color if options[:fill_color]
26
+ options[:gravity] ||= 'NorthWest'
27
+ options[:font] ||= 'Arial'
28
+ options
29
+ end
22
30
  end
23
31
  end
24
32
  end
@@ -28,6 +28,7 @@ module MapPrint
28
28
 
29
29
  MiniMagick::Tool::Montage.new do |montage|
30
30
  montage.mode('concatenate')
31
+ montage.density 300
31
32
  montage.tile("#{provider.x_size}x#{provider.y_size}")
32
33
  montage.merge! provider.tiles.collect(&:file_path)
33
34
  montage << file.path
@@ -1,7 +1,10 @@
1
1
  require_relative 'png_handlers/texts'
2
+ require_relative 'validations/size'
3
+
2
4
  module MapPrint
3
5
  class ScalebarHandler
4
- include MapPrint::PngHandlers::Texts
6
+ include PngHandlers::Texts
7
+ include Validations::Size
5
8
 
6
9
  ZOOM_METERS_PER_PIXEL = {
7
10
  0 => 156543.03,
@@ -52,6 +55,7 @@ module MapPrint
52
55
 
53
56
  y_position = size[:height] - (@scalebar[:bar_height] || 10) - @padding_bottom
54
57
  image.combine_options do |c|
58
+ c.density 300
55
59
  c.stroke 'black'
56
60
  c.fill 'white'
57
61
  c.draw "rectangle #{@padding_left},#{size[:height] - @padding_bottom} #{@padding_left + quarter},#{y_position}"
@@ -63,7 +67,7 @@ module MapPrint
63
67
  c.draw "rectangle #{@padding_left + 3*quarter},#{size[:height] - @padding_bottom} #{@padding_left + 4*quarter},#{y_position}"
64
68
  end
65
69
 
66
- text_options = { pointsize: 12, gravity: 'NorthWest' }
70
+ text_options = { pointsize: 4, gravity: 'NorthWest' }
67
71
  draw_text(image, "0", "#{@padding_left},#{@padding_top}", text_options)
68
72
  draw_text(image, (pixels_for_distance/4).round(-2).to_s, "#{-quarter + @padding_left - @padding_right},#{@padding_top}", text_options.merge(gravity: 'North'))
69
73
  draw_text(image, (pixels_for_distance/2).round(-2).to_s, "#{@padding_left - @padding_right},#{@padding_top}", text_options.merge(gravity: 'North'))
@@ -75,9 +79,8 @@ module MapPrint
75
79
  private
76
80
  def validate_data!
77
81
  raise NoScalebarData.new('No scalebar data present') if @scalebar.nil? || @scalebar.empty?
78
- raise InvalidScalebarSize.new('No scalebar width present') unless @scalebar[:size] && @scalebar[:size][:width]
79
- raise InvalidScalebarSize.new('No scalebar height present') unless @scalebar[:size][:height]
80
82
  raise InvalidScalebarZoom.new('Zoom must be between 0..18') unless (0..18).include?(@zoom)
83
+ validate_size!(@scalebar[:size], InvalidScalebarSize)
81
84
  end
82
85
 
83
86
  def get_distance_in_units
@@ -3,37 +3,6 @@ require 'fileutils'
3
3
 
4
4
  module MapPrint
5
5
  class Tile
6
-
7
- METERS_PER_PIXELS = {
8
- 0 => 26862156543.031,
9
- 1 => 8078271.521,
10
- 2 => 7739135.761,
11
- 3 => 6919567.881,
12
- 4 => 889783.941,
13
- 5 => 214891.9771,
14
- 6 => 222445.9801721,
15
- 7 => 161731222.991,
16
- 8 => 11611.5001,
17
- 9 => 52305.751,
18
- 10 => 152.871,
19
- 11 => 76.4371,
20
- 12 => 38.2191,
21
- 13 => 519.1091,
22
- 14 => 9.55461,
23
- 15 => 4.77731,
24
- 16 => 2.38871,
25
- 17 => 1.19431,
26
- 18 => 0.5972
27
- }
28
-
29
- class << self
30
-
31
- def meters_per_pixel(zoom)
32
- METERS_PER_PIXELS[zoom]
33
- end
34
-
35
- end
36
-
37
6
  def initialize(x, y, z, base_url)
38
7
  @base_url = base_url
39
8
  @x = x
@@ -52,15 +21,6 @@ module MapPrint
52
21
  end
53
22
  end
54
23
 
55
- def get_pixel_difference(lat_lng)
56
- tile_lat_lng = tile_number_to_lat_lng
57
-
58
- x_pixels = lat_lng.distance_to(LatLng.new(lat_lng.lat, tile_lat_lng[:lng])) / METERS_PER_PIXELS[@z]
59
- y_pixels = lat_lng.distance_to(LatLng.new(tile_lat_lng[:lat], lat_lng.lng)) / METERS_PER_PIXELS[@z]
60
-
61
- { x: x_pixels, y: y_pixels }
62
- end
63
-
64
24
  def tile_number_to_lat_lng
65
25
  n = 2.0 ** @z
66
26
  lon_deg = @x / n * 360.0 - 180.0
@@ -99,7 +59,5 @@ module MapPrint
99
59
  def folder_name
100
60
  "cache/#{cache_name}/#{@z}/#{@x}"
101
61
  end
102
-
103
62
  end
104
-
105
63
  end
@@ -61,19 +61,17 @@ module MapPrint
61
61
  end
62
62
 
63
63
  def x_array
64
- return @x_array if @x_array
65
-
66
- x1 = @sw_lat_lng.get_slippy_map_tile_number(@zoom)[:x]
67
- x2 = @ne_lat_lng.get_slippy_map_tile_number(@zoom)[:x]
68
- @x_array ||= x1 < x2 ? x1..x2 : (x2..x1).to_a
64
+ @x_array ||= get_tile_coord_array(:x)
69
65
  end
70
66
 
71
67
  def y_array
72
- return @y_array if @y_array
68
+ @y_array ||= get_tile_coord_array(:y)
69
+ end
73
70
 
74
- y1 = @sw_lat_lng.get_slippy_map_tile_number(@zoom)[:y]
75
- y2 = @ne_lat_lng.get_slippy_map_tile_number(@zoom)[:y]
76
- @y_array ||= y1 < y2 ? y1..y2 : (y2..y1).to_a
71
+ def get_tile_coord_array(coord)
72
+ coord1 = @sw_lat_lng.get_slippy_map_tile_number(@zoom)[coord]
73
+ coord2 = @ne_lat_lng.get_slippy_map_tile_number(@zoom)[coord]
74
+ coord1 < coord2 ? coord1..coord2 : coord2..coord1
77
75
  end
78
76
 
79
77
  def tile_class
@@ -0,0 +1,10 @@
1
+ module MapPrint
2
+ module Validations
3
+ module Size
4
+ def validate_size!(size, exception)
5
+ raise exception.new('No width present') unless size && size[:width]
6
+ raise exception.new('No height present') unless size[:height]
7
+ end
8
+ end
9
+ end
10
+ end
@@ -1,3 +1,3 @@
1
1
  module MapPrint
2
- VERSION = '0.9.0'
2
+ VERSION = '1.0.0'
3
3
  end
data/map_print.gemspec CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ['Andreas Fast']
10
10
  spec.email = ['andis.machine@gmail.com']
11
11
 
12
- spec.summary = %q{Easily export maps to pdf}
13
- spec.description = %q{MapPrint allows to export many map sources and GeoJSON objects to a pdf file, along with legend and text elements to create rich maps.}
12
+ spec.summary = %q{Easily export maps to pdf or png}
13
+ spec.description = %q{MapPrint allows to export many map sources and GeoJSON objects to a pdf/png file, along with legend and text elements to create rich maps.}
14
14
  spec.homepage = 'http://github.com/afast/map_print'
15
15
  spec.license = 'MIT'
16
16
 
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.9.0
4
+ version: 1.0.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-02-11 00:00:00.000000000 Z
11
+ date: 2016-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -136,7 +136,7 @@ dependencies:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0.19'
139
- description: MapPrint allows to export many map sources and GeoJSON objects to a pdf
139
+ description: MapPrint allows to export many map sources and GeoJSON objects to a pdf/png
140
140
  file, along with legend and text elements to create rich maps.
141
141
  email:
142
142
  - andis.machine@gmail.com
@@ -182,9 +182,9 @@ files:
182
182
  - lib/map_print/tiles/osm_tile.rb
183
183
  - lib/map_print/tiles/tile.rb
184
184
  - lib/map_print/tiles/tile_factory.rb
185
+ - lib/map_print/validations/size.rb
185
186
  - lib/map_print/version.rb
186
187
  - map_print.gemspec
187
- - minimum_map.pdf
188
188
  homepage: http://github.com/afast/map_print
189
189
  licenses:
190
190
  - MIT
@@ -209,5 +209,5 @@ rubyforge_project:
209
209
  rubygems_version: 2.4.8
210
210
  signing_key:
211
211
  specification_version: 4
212
- summary: Easily export maps to pdf
212
+ summary: Easily export maps to pdf or png
213
213
  test_files: []
data/minimum_map.pdf DELETED
Binary file