usps_flags 0.5.7 → 0.6.2

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
  SHA256:
3
- metadata.gz: 1c7d6f56792f73b92bcf212d97079195ef98ff23f51b92789f8dfcb6a2604a5e
4
- data.tar.gz: 19926bbf380d3568715932fcd51d56eb15f84002e29e3b561b3a1e2dfc38a38c
3
+ metadata.gz: e50d14a11c735b4f9f42cdf1e900ab1b30613e09316ce57c27ce6453b9d3d5ae
4
+ data.tar.gz: 59a5f3523c03d5ceb97d7596923ea53c322f8fe9701d23bd5bca1d1d4f7956ce
5
5
  SHA512:
6
- metadata.gz: dc5a1fd943cd68942a710943b486f438cb989c842c5297dd53e73613da53cfb886fddd3572c7ceb5032b3c5913837569853490d8fd1f831fce6f779701077ce8
7
- data.tar.gz: b15bcdd3cf42d0a534d98bf3a9ade08a587bcc0a8497f74dc481737cb8015f64a73c0beca88e88bee93c4e9d0df6869f839edcf75537f3bad7db84c529614159
6
+ metadata.gz: e21147c8d7ce0d667d5a128a39552c1039508aeb58c1f5935a95269f108c15004509d0303234bdfd72373ecc348da6026a2af2cb0f2a6271c179629342e283e0
7
+ data.tar.gz: 2481de64b0dbe9c5e3d9b09f0f28a7ccd39f83d878dc8db5dbba17c12cc14f89c4e62ac9c3cc1767e20d540a05782bc93eca674c73a6a2b9462b1029146e629e
data/.gitignore CHANGED
@@ -2,3 +2,4 @@ doc/
2
2
  coverage/
3
3
  lib/output/
4
4
  tmp/
5
+ *.gem
@@ -0,0 +1 @@
1
+ 2.5.1
data/CC.png ADDED
Binary file
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- usps_flags (0.5.7)
4
+ usps_flags (0.6.2)
5
5
  file_utils (~> 1.1, >= 1.1.2)
6
6
  mini_magick (~> 4.9, >= 4.9.4)
7
7
  rubyzip (~> 1.3, >= 1.3.0)
@@ -14,13 +14,13 @@ GEM
14
14
  docile (1.1.5)
15
15
  file_utils (1.1.2)
16
16
  jaro_winkler (1.5.4)
17
- json (2.1.0)
18
- mini_magick (4.9.5)
17
+ json (2.3.1)
18
+ mini_magick (4.10.1)
19
19
  parallel (1.19.1)
20
20
  parser (2.6.5.0)
21
21
  ast (~> 2.4.0)
22
22
  rainbow (3.0.0)
23
- rake (12.3.0)
23
+ rake (12.3.3)
24
24
  rspec (3.7.0)
25
25
  rspec-core (~> 3.7.0)
26
26
  rspec-expectations (~> 3.7.0)
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # United States Power Squadrons® Flag Generator
2
2
 
3
3
  [![Gem Version](https://img.shields.io/gem/v/usps_flags.svg)](https://rubygems.org/gems/usps_flags)
4
- [![Build Status](https://travis-ci.org/jfiander/usps-flags.svg)](https://travis-ci.org/jfiander/usps-flags)
4
+ [![Build Status](https://img.shields.io/travis/jfiander/usps-flags/master.svg)](https://travis-ci.org/jfiander/usps-flags)
5
5
  [![Test Coverage](https://api.codeclimate.com/v1/badges/760b824f0edac3316a11/test_coverage)](https://codeclimate.com/github/jfiander/usps-flags/test_coverage)
6
6
  [![Maintainability](https://api.codeclimate.com/v1/badges/760b824f0edac3316a11/maintainability)](https://codeclimate.com/github/jfiander/usps-flags/maintainability)
7
7
 
@@ -10,6 +10,10 @@ class USPSFlags
10
10
  USPSFlags::Core::TridentSpecs::Build.new(fly: fly, unit: unit, scaled_border: scaled_border).svg
11
11
  end
12
12
 
13
+ def self.intersection_spec(scaled_border: false)
14
+ USPSFlags::Core::TridentSpecs::BuildIntersections.new(scaled_border: scaled_border).svg
15
+ end
16
+
13
17
  def self.headers(width: nil, height: nil, pennant: false, scale: nil, title: 'USPS Flag')
14
18
  USPSFlags::Core::Headers.new(width: width, height: height, pennant: pennant, scale: scale, title: title).svg
15
19
  end
@@ -52,7 +52,7 @@ class USPSFlags
52
52
  l #{@fly} 0
53
53
  l 0 #{@hoist}
54
54
  l -#{@fly} 0
55
- l 0 -#{@hoist}
55
+ l 0 -#{@hoist} z
56
56
  " fill="#{@color_code}" #{@border_svg}/>
57
57
  SVG
58
58
  end
@@ -71,7 +71,7 @@ class USPSFlags
71
71
  def past_field
72
72
  <<~SVG
73
73
  <g transform="translate(#{USPSFlags::Config::BASE_FLY / 1200}, #{USPSFlags::Config::BASE_FLY / 1800})">
74
- <path d="M 0 #{USPSFlags::Config::BASE_FLY / 600} #{past_line_one}" fill="#{@color_code}" />
74
+ <path d="M 0 #{USPSFlags::Config::BASE_FLY / 1200} #{past_line_one}" fill="#{@color_code}" />
75
75
  <path d="M #{@fly / 2} #{@hoist / 12} #{past_line_two}" fill="#{@past_mid_color}" />
76
76
  <path d="M #{@fly * 3 / 4} #{@hoist * 3 / 24} #{past_line_three}" fill="#{@past_tail_color}" />
77
77
  <path d="M 0 0 #{past_line_four} z" fill="none" stroke="#000000" stroke-width="#{USPSFlags::Config::BASE_FLY / 600}" />
@@ -54,7 +54,7 @@ class USPSFlags
54
54
  <<~SVG
55
55
  <?xml version="1.0" standalone="no"?>
56
56
  <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
57
- <svg version="1.0" xmlns="http://www.w3.org/2000/svg" width="#{@width}" height="#{@height}" viewBox="0 0 #{@view_width} #{@view_height}" preserveAspectRatio="xMidYMid meet">
57
+ <svg version="1.0" xmlns="http://www.w3.org/2000/svg" width="#{@width}" height="#{@height}" viewBox="-#{@view_width * 0.001} -#{@view_height * 0.002} #{@view_width * 1.004} #{@view_height * 1.005}" preserveAspectRatio="xMidYMid meet">
58
58
  <title>#{@title}</title>
59
59
  <metadata>
60
60
  <desc id="created-by">Julian Fiander</desc>
@@ -13,7 +13,7 @@ class USPSFlags
13
13
 
14
14
  def initialize(type, color: :blue, field_color: nil)
15
15
  valid_types = %i[s d stf n]
16
- raise "Error: Invalid trident type. Options are #{valid_types}." unless valid_types.include?(type)
16
+ raise "Error: Invalid trident type: #{type}. Options are #{valid_types}." unless valid_types.include?(type)
17
17
 
18
18
  @type = type
19
19
 
@@ -18,6 +18,7 @@ class USPSFlags
18
18
  require 'usps_flags/core/trident_specs/long'
19
19
  require 'usps_flags/core/trident_specs/circle'
20
20
  require 'usps_flags/core/trident_specs/build'
21
+ require 'usps_flags/core/trident_specs/build_intersections'
21
22
  end
22
23
  end
23
24
  end
@@ -0,0 +1,118 @@
1
+ # frozen_string_literal: false
2
+
3
+ # Core SVG data for the trident intersections specification sheet.
4
+ #
5
+ # This class should never need to be called directly.
6
+ # @private
7
+ class USPSFlags
8
+ class Core
9
+ module TridentSpecs
10
+ class BuildIntersections
11
+ def initialize(scaled_border: false)
12
+ @scaled_border = scaled_border
13
+ configure_sizes(Rational(2048, 5))
14
+ configure_labels('')
15
+ end
16
+
17
+ def svg
18
+ svg = spec_header
19
+ svg << add_cc_intersection
20
+ svg << add_vc_intersection
21
+ svg
22
+ end
23
+
24
+ private
25
+
26
+ def add_cc_intersection
27
+ svg = +''
28
+
29
+ svg += "<g transform=\"translate(-#{BF * 1 / 16}, #{BH / 4}) scale(0.6)\">"
30
+ svg += USPSFlags::Core::Tridents.cc(trident_color: :blue)
31
+ svg += label('CC', Rational(1, 3))
32
+ svg += '</g>'
33
+
34
+ svg
35
+ end
36
+
37
+ def add_vc_intersection
38
+ svg = +''
39
+
40
+ svg += "<g transform=\"translate(#{BF * 7 / 16}, #{BH / 4}) scale(0.6)\">"
41
+ svg += USPSFlags::Core::Tridents.vc(trident_color: :red)
42
+ svg += label('VC', Rational(15, 32))
43
+ svg += '</g>'
44
+
45
+ svg
46
+ end
47
+
48
+ def label_offset
49
+ BF.to_f * 1 / 32
50
+ end
51
+
52
+ def label_height
53
+ BF.to_f * 15 / 64
54
+ end
55
+
56
+ def label(type, fraction)
57
+ <<~SVG
58
+ <!-- #{type} Intersection -->
59
+ <g transform="translate(#{BF / 2}, #{BH - 200}) rotate(45)">
60
+ #{big_arrow}
61
+ #{small_arrow(fraction)}
62
+ </g>
63
+ SVG
64
+ end
65
+
66
+ def small_arrow(fraction)
67
+ SA.vertical(
68
+ label_offset, -label_height * fraction, 0,
69
+ pointer_top: label_height * fraction, pointer_bottom: 0, label_offset: BF / 35,
70
+ label_offset_y: -BF / 50, label_align: 'middle', fly: @fly, unit: @unit
71
+ )
72
+ end
73
+
74
+ def big_arrow
75
+ SA.vertical(
76
+ label_offset * 3, -label_height, 0,
77
+ pointer_top: label_height, pointer_bottom: 0, label_offset: BF / 60,
78
+ label_offset_y: -BF / 10, label_align: 'left', fly: @fly, unit: @unit
79
+ )
80
+ end
81
+
82
+ def configure_sizes(fly)
83
+ @fly = Rational(fly)
84
+ get_hoist_from_fly(@fly)
85
+ configure_hoist_fraction
86
+ configure_fly_fraction
87
+ end
88
+
89
+ def get_hoist_from_fly(fly)
90
+ hoist = (fly * Rational(2, 3))
91
+ @hoist = hoist
92
+ end
93
+
94
+ def configure_hoist_fraction
95
+ @hoist, @hoist_fraction = USPSFlags::Rational.new(@hoist).to_simplified_a
96
+ end
97
+
98
+ def configure_fly_fraction
99
+ @fly, @fly_fraction = USPSFlags::Rational.new(@fly).to_simplified_a
100
+ end
101
+
102
+ def configure_labels(unit)
103
+ @label_font_size = BF / 60
104
+
105
+ @unit_text = unit.nil? ? '' : unit.to_s
106
+ @unit = unit
107
+ end
108
+
109
+ def spec_header
110
+ USPSFlags::Core::TridentSpecs::Header.new(
111
+ fly: @fly, fly_fraction: @fly_fraction, hoist: @hoist, hoist_fraction: @hoist_fraction,
112
+ unit_text: @unit_text, scaled_border: @scaled_border, no_measurements: true
113
+ ).p
114
+ end
115
+ end
116
+ end
117
+ end
118
+ end
@@ -15,6 +15,7 @@ class USPSFlags
15
15
  @hoist_fraction = options[:hoist_fraction]
16
16
  @unit_text = options[:unit_text]
17
17
  @scaled_border = options[:scaled_border]
18
+ @no_measurements = options.key?(:no_measurements) && options[:no_measurements]
18
19
  end
19
20
 
20
21
  def p
@@ -43,11 +44,21 @@ class USPSFlags
43
44
  <text x="#{BF / 2}" y="#{BH * 3 / 40}" font-family="sans-serif" font-size="#{BH / 20}px" font-weight="bold" fill="#041E42" text-anchor="middle">United States Power Squadrons<tspan class="heading" dy ="-#{BH / 50}">®</tspan></text>
44
45
  </g>
45
46
  <text x="#{BF / 2}" y="#{BH / 8}" font-family="sans-serif" font-size="#{BH / 30}px" fill="#041E42" text-anchor="middle">Officer Flag Trident Specification</text>
47
+ #{measurements_are_relative}
48
+ SVG
49
+ end
50
+
51
+ def measurements_are_relative
52
+ return if @no_measurements
53
+
54
+ <<~SVG
46
55
  <text x="#{BF / 2}" y="#{BH * 2 / 11}" font-family="sans-serif" font-size="#{BH / 40}px" fill="#041E42" text-anchor="middle">All measurements are relative to a field with</text>
47
56
  SVG
48
57
  end
49
58
 
50
59
  def units
60
+ return angles if @no_measurements
61
+
51
62
  <<~SVG
52
63
  <g>
53
64
  <style><![CDATA[tspan.title{font-size: #{USPSFlags::Config::FRACTION_SCALE * 9 / 10}%;}]]></style>
@@ -58,6 +69,12 @@ class USPSFlags
58
69
  SVG
59
70
  end
60
71
 
72
+ def angles
73
+ <<~SVG
74
+ <text x="#{BF / 2}" y="#{BH * 4 / 19}" font-family="sans-serif" font-size="#{BH / 40}px" fill="#041E42" text-anchor="middle">Angled tridents are 45 degrees from vertical.</text>
75
+ SVG
76
+ end
77
+
61
78
  def scaled_border
62
79
  <<~SVG
63
80
  <!-- Flag border scaled to spec trident size -->
@@ -8,30 +8,41 @@ class USPSFlags
8
8
  class Core
9
9
  class Tridents
10
10
  class << self
11
- def cc(type, trident_color:)
12
- # The side C/C tridents are angled 45 degrees, and intersect the central one at 1/3 up from the bottom
13
- trident = USPSFlags::Core.trident(type, color: trident_color)
14
- x_distance = USPSFlags::Config::BASE_FLY * 4 / 39
15
- y_distance = USPSFlags::Config::BASE_FLY * 5 / 78
11
+ # The side C/C tridents are angled 45 degrees, and intersect the central one at 1/3 up from the bottom
12
+ #
13
+ # Center of rotation:
14
+ # # radius = USPSFlags.configuration.trident[:bar_width] / 2
15
+ # <circle cx="#{cc_center[:x]}" cy="#{cc_center[:y]}" r="#{radius}" fill="red" />
16
+ def cc(_ = nil, trident_color:)
17
+ trident = USPSFlags::Core.trident(:n, color: trident_color)
18
+ x_distance = USPSFlags::Config::BASE_FLY * 4 / 39 # 4/39 or 28/39
19
+ y_distance = USPSFlags::Config::BASE_FLY * 2 / 39 # 5/78 or 27/156
16
20
  <<~SVG
17
- <g transform="translate(-#{x_distance}, #{y_distance})"><g transform="rotate(-45, #{USPSFlags::Config::BASE_FLY / 2}, #{USPSFlags::Config::BASE_HOIST / 2})">\n#{trident}</g></g>
21
+ <g transform="translate(-#{x_distance * 1.25}, #{y_distance})">
22
+ <g transform="rotate(-45, #{USPSFlags::Config::BASE_FLY / 2}, #{USPSFlags::Config::BASE_HOIST / 2})">\n#{trident}</g>
23
+ </g>
18
24
  \n#{trident}
19
- <g transform="translate(#{x_distance}, #{y_distance})"><g transform="rotate(45, #{USPSFlags::Config::BASE_FLY / 2}, #{USPSFlags::Config::BASE_HOIST / 2})">\n#{trident}</g></g>
25
+ <g transform="translate(#{x_distance * 1.25}, #{y_distance})">
26
+ <g transform="rotate(45)" transform-origin="center">\n#{trident}</g>
27
+ </g>
20
28
  SVG
21
29
  end
22
30
 
23
- def vc(type, trident_color:)
24
- # V/C tridents are angled 45 degrees, and intersect at 15/32 up from the bottom
25
- trident = USPSFlags::Core.trident(type, color: trident_color)
26
- x_distance = USPSFlags::Config::BASE_FLY * 4 / 55
31
+ # V/C tridents are angled 45 degrees, and intersect at 15/32 up from the bottom
32
+ def vc(_ = nil, trident_color:)
33
+ trident = USPSFlags::Core.trident(:n, color: trident_color)
27
34
  <<~SVG
28
- <g transform="translate(-#{x_distance})"><g transform="rotate(-45, #{USPSFlags::Config::BASE_FLY / 2}, #{USPSFlags::Config::BASE_HOIST / 2})">\n#{trident}</g></g>
29
- <g transform="translate(#{x_distance})"><g transform="rotate(45, #{USPSFlags::Config::BASE_FLY / 2}, #{USPSFlags::Config::BASE_HOIST / 2})">\n#{trident}</g></g>
35
+ <g transform="rotate(-45, #{vc_center[:x]}, #{vc_center[:y]})">
36
+ #{trident}
37
+ </g>
38
+ <g transform="rotate(45, #{vc_center[:x]}, #{vc_center[:y]})">
39
+ #{trident}
40
+ </g>
30
41
  SVG
31
42
  end
32
43
 
44
+ # Cdr and D/C tridents are spaced 1/2 the fly apart with the central one 1/4 the fly above the sides
33
45
  def three(type, trident_color:, field_color:)
34
- # Cdr and D/C tridents are spaced 1/2 the fly apart with the central one 1/4 the fly above the sides
35
46
  trident = USPSFlags::Core.trident(type, color: trident_color, field_color: field_color)
36
47
  x_distance = USPSFlags::Config::BASE_FLY / 4
37
48
  y_distance = USPSFlags::Config::BASE_FLY / 16
@@ -42,8 +53,8 @@ class USPSFlags
42
53
  SVG
43
54
  end
44
55
 
56
+ # Lt/C and D/Lt/C tridents are spaced 1/3 the fly apart
45
57
  def two(type, trident_color:, field_color:)
46
- # Lt/C and D/Lt/C tridents are spaced 1/3 the fly apart
47
58
  trident = USPSFlags::Core.trident(type, color: trident_color, field_color: field_color)
48
59
  x_distance = USPSFlags::Config::BASE_FLY / 6
49
60
  <<~SVG
@@ -52,8 +63,8 @@ class USPSFlags
52
63
  SVG
53
64
  end
54
65
 
66
+ # Swallowtail tridents need to move towards the hoist due to the tails
55
67
  def offset(type, field_color:, field: true)
56
- # Swallowtail tridents need to move towards the hoist due to the tails
57
68
  x_distance = USPSFlags::Config::BASE_FLY / 10 if field
58
69
  svg = +''
59
70
  svg << "<g transform=\"translate(-#{x_distance})\">" if field
@@ -61,6 +72,25 @@ class USPSFlags
61
72
  svg << '</g>' if field
62
73
  svg
63
74
  end
75
+
76
+ private
77
+
78
+ def rotation_center(height_fraction)
79
+ {
80
+ x: USPSFlags::Config::BASE_FLY / 2,
81
+ y: (USPSFlags::Config::BASE_HOIST * 7 / 8) - (n_staff_height * height_fraction).to_f
82
+ }
83
+ end
84
+
85
+ def vc_center
86
+ rotation_center(Rational(15, 32))
87
+ end
88
+
89
+ def n_staff_height
90
+ top_height = USPSFlags.configuration.trident[:crossbar_from_top]
91
+ bars = (USPSFlags.configuration.trident[:bar_width] * 3)
92
+ USPSFlags.configuration.trident_heights[:n] - top_height - bars
93
+ end
64
94
  end
65
95
  end
66
96
  end
@@ -103,6 +103,22 @@ class USPSFlags
103
103
  USPSFlags::Helpers.output(svg, outfile: outfile)
104
104
  end
105
105
 
106
+ # Generate trident spec sheet for National Bridge intersections as an SVG image.
107
+ #
108
+ # @param [String] outfile The path to save the SVG file to. If not set, prints to console.
109
+ # @param [Integer] fly The nominal fly length of an appropriate flag field for the generated tridents.
110
+ # @param [String] outfile The unit to append to all trident measurements.
111
+ # @param [String] scale The image scale divisor factor.
112
+ # @return [String] Returns the SVG data.
113
+ def intersection_spec(outfile: nil, scale: nil, scaled_border: false)
114
+ svg = +''
115
+ svg << USPSFlags::Core.headers(scale: scale, title: 'USPS Trident Specifications')
116
+ svg << USPSFlags::Core.intersection_spec(scaled_border: scaled_border)
117
+ svg << USPSFlags::Core.footer
118
+
119
+ USPSFlags::Helpers.output(svg, outfile: outfile)
120
+ end
121
+
106
122
  private
107
123
 
108
124
  def special_flag(flag, outfile, scale)
@@ -24,13 +24,14 @@ class USPSFlags
24
24
  end
25
25
 
26
26
  def special(type, level:, field: true)
27
+ translate = (type == :f && level == :n) || !field
27
28
  # Paths were designed for a base fly of 3000 pixels, but the base was changed for more useful fractions.
28
29
  svg = +''
29
- svg << "<g transform=\"translate(#{USPSFlags::Config::BASE_FLY / 10})\">" unless field
30
+ svg << "<g transform=\"translate(#{USPSFlags::Config::BASE_FLY / 10})\">" if translate
30
31
  svg << "<g transform=\"scale(#{Rational(USPSFlags::Config::BASE_FLY, 3000).to_f})\">"
31
32
  svg << special_icon(type, level)
32
33
  svg << '</g>'
33
- svg << '</g>' unless field
34
+ svg << '</g>' if translate
34
35
 
35
36
  svg
36
37
  end
@@ -120,6 +120,7 @@ class USPSFlags
120
120
 
121
121
  dirs = path.split('/')
122
122
  dirs.pop
123
+ dirs = ['.'] if dirs.empty?
123
124
  ::FileUtils.mkdir_p(dirs.join('/')).first
124
125
  end
125
126
 
@@ -179,7 +180,7 @@ class USPSFlags
179
180
  end
180
181
 
181
182
  def flag_type(rank)
182
- specifics = { 'PORTCAP' => :pc, 'FLEETCAP' => :fc, 'STFC' => :stf }
183
+ specifics = { 'PORTCAP' => :pc, 'FLEETCAP' => :fc, 'STFC' => :stf, 'PSTFC' => :stf }
183
184
  return specifics[rank] if specifics.key?(rank)
184
185
  return :a if rank.match?(/.AIDE/)
185
186
  return :f if rank.match?(/.?FLT/)
@@ -15,7 +15,7 @@ class USPSFlags
15
15
  @district_past = %w[PDLTC PDC]
16
16
  @district_elected = %w[D1LT DLTC DC]
17
17
  @district_swallowtail = %w[DLT DAIDE DFLT]
18
- @national_past = %w[PSTFC PRC PVC PCC]
18
+ @national_past = %w[PNFLT PSTFC PRC PVC PCC]
19
19
  @national_elected = %w[STFC RC VC CC]
20
20
  @national_swallowtail = %w[NAIDE NFLT]
21
21
  end
@@ -42,7 +42,7 @@ describe USPSFlags::Core do
42
42
  l #{@fly} 0
43
43
  l 0 #{@hoist}
44
44
  l -#{@fly} 0
45
- l 0 -#{@hoist}
45
+ l 0 -#{@hoist} z
46
46
  " fill="#FFFFFF" stroke="#000000" stroke-width="#{USPSFlags::Config::BASE_FLY / 600}" />
47
47
  SVG
48
48
  )
@@ -55,7 +55,7 @@ describe USPSFlags::Core do
55
55
  l #{@fly} 0
56
56
  l 0 #{@hoist}
57
57
  l -#{@fly} 0
58
- l 0 -#{@hoist}
58
+ l 0 -#{@hoist} z
59
59
  " fill="#{@red}" />
60
60
  SVG
61
61
  )
@@ -78,7 +78,7 @@ describe USPSFlags::Core do
78
78
  expect(described_class.field(style: :past, color: :blue)).to eql(
79
79
  <<~SVG
80
80
  <g transform="translate(2, 1)">
81
- <path d="M 0 5 l #{@fly / 2} #{@hoist * 1 / 12}
81
+ <path d="M 0 2 l #{@fly / 2} #{@hoist * 1 / 12}
82
82
  l 0 #{@hoist * 10 / 12}
83
83
  l -#{@fly / 2} #{@hoist * 1 / 12}
84
84
  " fill="#{@blue}" />
@@ -6,7 +6,7 @@ describe USPSFlags::Generate do
6
6
  describe 'general features' do
7
7
  it 'generates a flag with the correct size' do
8
8
  expect(described_class.svg('LtC', outfile: '')).to include(
9
- 'width="1024" height="682" viewBox="0 0 3072 2048"'
9
+ 'width="1024" height="682" viewBox="-3.072 -4.096 3084.288 2058.24"'
10
10
  )
11
11
  end
12
12
 
@@ -17,7 +17,7 @@ describe USPSFlags::Generate do
17
17
  l 3072 0
18
18
  l 0 2048
19
19
  l -3072 0
20
- l 0 -2048
20
+ l 0 -2048 z
21
21
  " fill="#E4002B" />
22
22
  SVG
23
23
  )
@@ -40,7 +40,7 @@ describe USPSFlags::Generate do
40
40
 
41
41
  describe 'officer flags' do
42
42
  %w[
43
- PLTC PC PDLTC PDC PSTFC PRC PVC PCC
43
+ PLTC PC PDLTC PDC PNFLT PSTFC PRC PVC PCC
44
44
  PORTCAP FLEETCAP FLT DAIDE DFLT NAIDE NFLT
45
45
  LT 1LT LTC CDR DLT D1LT DLTC DC STFC RC VC CC
46
46
  ].each do |flag|
@@ -88,6 +88,10 @@ describe USPSFlags::Generate do
88
88
  it 'generates the trident specification sheet with a fractional field size' do
89
89
  expect(described_class.spec(outfile: '', fly: 23.5)).to include('<title>USPS Trident Specifications</title>')
90
90
  end
91
+
92
+ it 'generates the intersection specification sheet' do
93
+ expect(described_class.intersection_spec(outfile: '')).to include('CC Intersection')
94
+ end
91
95
  end
92
96
 
93
97
  describe 'png' do
@@ -11,7 +11,7 @@ describe USPSFlags::Helpers do
11
11
  it 'returns all officer flags but nothing else when given type :officer' do
12
12
  expect(described_class.valid_flags(:officer).sort).to eql(%w[
13
13
  PLTC PC PORTCAP FLEETCAP LT FLT 1LT LTC CDR PDLTC PDC DLT DAIDE
14
- DFLT D1LT DLTC DC PSTFC PRC PVC PCC NAIDE NFLT STFC RC VC CC
14
+ DFLT D1LT DLTC DC PNFLT PSTFC PRC PVC PCC NAIDE NFLT STFC RC VC CC
15
15
  ].sort)
16
16
  end
17
17
 
@@ -7,7 +7,7 @@ describe USPSFlags do
7
7
  @valid_header = <<~SVG
8
8
  <?xml version="1.0" standalone="no"?>
9
9
  <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
10
- <svg version="1.0" xmlns="http://www.w3.org/2000/svg" width="614" height="409" viewBox="0 0 3072 2048" preserveAspectRatio="xMidYMid meet">
10
+ <svg version="1.0" xmlns="http://www.w3.org/2000/svg" width="614" height="409" viewBox="-3.072 -4.096 3084.288 2058.24" preserveAspectRatio="xMidYMid meet">
11
11
  <title>LTC</title>
12
12
  <metadata>
13
13
  <desc id="created-by">Julian Fiander</desc>
@@ -2,8 +2,8 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'usps_flags'
5
- s.version = '0.5.7'
6
- s.date = '2019-12-12'
5
+ s.version = '0.6.2'
6
+ s.date = '2020-08-04'
7
7
  s.summary = 'Flag generator for United States Power Squadrons'
8
8
  s.description = 'A flag image (PNG, SVG) generator for United States Power Squadrons.'
9
9
  s.homepage = 'http://rubygems.org/gems/usps_flags'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: usps_flags
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.7
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Fiander
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-12 00:00:00.000000000 Z
11
+ date: 2020-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: file_utils
@@ -179,8 +179,10 @@ files:
179
179
  - ".gitignore"
180
180
  - ".rspec"
181
181
  - ".rubocop.yml"
182
+ - ".ruby-version"
182
183
  - ".travis.yml"
183
184
  - ".yardopts"
185
+ - CC.png
184
186
  - CONTRIBUTING.md
185
187
  - Gemfile
186
188
  - Gemfile.lock
@@ -208,6 +210,7 @@ files:
208
210
  - lib/usps_flags/core/trident_specs.rb
209
211
  - lib/usps_flags/core/trident_specs/base.rb
210
212
  - lib/usps_flags/core/trident_specs/build.rb
213
+ - lib/usps_flags/core/trident_specs/build_intersections.rb
211
214
  - lib/usps_flags/core/trident_specs/circle.rb
212
215
  - lib/usps_flags/core/trident_specs/delta.rb
213
216
  - lib/usps_flags/core/trident_specs/header.rb
@@ -260,8 +263,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
260
263
  - !ruby/object:Gem::Version
261
264
  version: '0'
262
265
  requirements: []
263
- rubyforge_project:
264
- rubygems_version: 2.7.6
266
+ rubygems_version: 3.1.4
265
267
  signing_key:
266
268
  specification_version: 4
267
269
  summary: Flag generator for United States Power Squadrons