libgd-gis 0.3.2 → 0.3.21

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
  SHA256:
3
- metadata.gz: e54f40ea70b79fc866db311f7ac994ca267483f62de518b2f6f4f5989957f5e6
4
- data.tar.gz: c8825bd11685f5a0254bd5fdaa5b654cee53dff608a990ac91bc4bacfcba4f31
3
+ metadata.gz: ae0d79550ce61b3bebaa90e48f7b57c5dd1f1fca8be67d857e41fd8fec69e75c
4
+ data.tar.gz: b37ff43e8f0a0dd9112ad256c46e3aa1154975ca737544eae761bec9d074ee32
5
5
  SHA512:
6
- metadata.gz: 7bf12c61f036e85b93aa1b7617fb2aa63f9c0fb788f3ad53e1bf313259b5847658e3c1c1cf2682227fdc9d542cabf86489cb94d9a79c5cf15949519dfe08be69
7
- data.tar.gz: bdc13c7e7aa1e99f4328c3ea69699b4e8f548ea5aeb975b317a81fe136d8dc94b1e64655987f51a0fcf4db0af030ffd8e5a125ae8cd3191a34c8814575cffa0e
6
+ metadata.gz: 6272498890dd101132b00edcd65d63b023721afa2d18a77bb17919b53d6220927ff5d532803d1c24e726799ac3d7671b648d2979c38725880403d5cd5dc966be
7
+ data.tar.gz: 65464584707bb1c54bb8401c847a395ba646f94846d5897fe5e6b099c97d812616035d35770d3106860819ce0d318b8980b56c7e067ace39c683ed6a5fa18273
@@ -50,7 +50,7 @@ module GD
50
50
  if icon.is_a?(Array) || icon.nil?
51
51
  fill, stroke = icon || [GD::GIS::ColorHelpers.random_rgb, GD::GIS::ColorHelpers.random_rgb]
52
52
  @icon = build_default_marker(fill, stroke)
53
- elsif icon == "numeric" || icon == "alphabetic"
53
+ elsif %w[numeric alphabetic].include?(icon)
54
54
  @icon = icon
55
55
  @font_color = font_color
56
56
  else
@@ -65,7 +65,6 @@ module GD
65
65
  @r, @g, @b, @a = color
66
66
  @a = 0 if @a.nil?
67
67
  @count = count
68
-
69
68
  end
70
69
 
71
70
  # Builds a default circular marker icon.
@@ -100,18 +99,17 @@ module GD
100
99
  #
101
100
  # @return [void]
102
101
  def render!(img, projector)
103
-
104
- case @icon
105
- when "numeric"
106
- value = @count
107
- when "alphabetic"
108
- value = (@count + 96).chr
109
- else
110
- value = "*"
111
- end
102
+ value = case @icon
103
+ when "numeric"
104
+ @count
105
+ when "alphabetic"
106
+ (@count + 96).chr
107
+ else
108
+ "*"
109
+ end
112
110
 
113
111
  if @icon.is_a?(GD::Image)
114
- w = @icon.width
112
+ w = @icon.width
115
113
  h = @icon.height
116
114
  else
117
115
  w = radius_from_text(img, value, font: @font, size: @size) * 2
@@ -127,31 +125,31 @@ module GD
127
125
 
128
126
  text = @label.call(row)
129
127
  next if text.nil? || text.strip.empty?
128
+
130
129
  font_h = @size * 1.1
131
130
 
132
131
  if @icon == "numeric" || @icon == "alphabetic"
133
132
 
134
133
  draw_symbol_circle!(
135
- img: img,
136
- x: x,
137
- y: y,
138
- symbol: value,
139
- radius: 12,
140
- bg_color: @color,
141
- font_color: @font_color,
142
- font: @font,
143
- font_size: @size
144
- )
134
+ img: img,
135
+ x: x,
136
+ y: y,
137
+ symbol: value,
138
+ bg_color: @color,
139
+ font_color: @font_color,
140
+ font: @font,
141
+ font_size: @size
142
+ )
145
143
  else
146
144
  img.copy(@icon, x - (w / 2), y - (h / 2), 0, 0, w, h)
147
145
  end
148
146
 
149
147
  img.text(text,
150
- x: x + (w / 2) + 4,
151
- y: y + (font_h / 2),
152
- size: @size,
153
- color: GD::Color.rgba(@r, @g, @b, @a),
154
- font: @font)
148
+ x: x + (w / 2) + 4,
149
+ y: y + (font_h / 2),
150
+ size: @size,
151
+ color: GD::Color.rgba(@r, @g, @b, @a),
152
+ font: @font)
155
153
  end
156
154
  end
157
155
 
@@ -159,7 +157,7 @@ module GD
159
157
  #
160
158
  # - x, y: circle center in pixels
161
159
  # - y for text() is BASELINE (not top). We compute baseline to center the text.
162
- def draw_symbol_circle!(img:, x:, y:, symbol:, radius:, bg_color:, font_color:, font:, font_size:, angle: 0.0)
160
+ def draw_symbol_circle!(img:, x:, y:, symbol:, bg_color:, font_color:, font:, font_size:, angle: 0.0)
163
161
  diameter = radius_from_text(img, symbol, font: font, size: font_size) * 2
164
162
 
165
163
  # 1) Bullet background
@@ -203,9 +201,8 @@ module GD
203
201
  )
204
202
 
205
203
  # Use the larger dimension to ensure the text fits
206
- (([w, h].max / 2.0).ceil) + padding
204
+ ([w, h].max / 2.0).ceil + padding
207
205
  end
208
-
209
206
  end
210
207
  end
211
208
  end
data/lib/test.rb CHANGED
@@ -1,4 +1,3 @@
1
- def foo
2
- end
1
+ def foo; end
3
2
 
4
3
  foo(1, 2)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libgd-gis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Germán Alberto Giménez Silva