usps_flags 0.3.26 → 0.4.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 +4 -4
- data/.rubocop.yml +87 -0
- data/Gemfile +3 -1
- data/Gemfile.lock +2 -2
- data/Rakefile +4 -2
- data/lib/rational.rb +3 -1
- data/lib/usps_flags.rb +15 -17
- data/lib/usps_flags/config.rb +32 -29
- data/lib/usps_flags/core.rb +11 -9
- data/lib/usps_flags/core/ensign.rb +20 -17
- data/lib/usps_flags/core/field.rb +33 -30
- data/lib/usps_flags/core/footer.rb +2 -0
- data/lib/usps_flags/core/headers.rb +11 -8
- data/lib/usps_flags/core/icons.rb +14 -0
- data/lib/usps_flags/core/{anchor.rb → icons/anchor.rb} +7 -5
- data/lib/usps_flags/core/{binoculars.rb → icons/binoculars.rb} +7 -5
- data/lib/usps_flags/core/{lighthouse.rb → icons/lighthouse.rb} +3 -1
- data/lib/usps_flags/core/{star.rb → icons/star.rb} +3 -1
- data/lib/usps_flags/core/{trident.rb → icons/trident.rb} +29 -25
- data/lib/usps_flags/core/{trumpet.rb → icons/trumpet.rb} +3 -1
- data/lib/usps_flags/core/pennant.rb +20 -17
- data/lib/usps_flags/core/trident_spec.rb +62 -174
- data/lib/usps_flags/core/trident_specs.rb +14 -0
- data/lib/usps_flags/core/trident_specs/base.rb +15 -0
- data/lib/usps_flags/core/trident_specs/circle.rb +51 -0
- data/lib/usps_flags/core/trident_specs/delta.rb +68 -0
- data/lib/usps_flags/core/trident_specs/header.rb +65 -0
- data/lib/usps_flags/core/trident_specs/long.rb +54 -0
- data/lib/usps_flags/core/trident_specs/short.rb +176 -0
- data/lib/usps_flags/core/tridents.rb +16 -14
- data/lib/usps_flags/core/us.rb +9 -7
- data/lib/usps_flags/core/wheel.rb +2 -0
- data/lib/usps_flags/errors.rb +16 -4
- data/lib/usps_flags/generate.rb +48 -44
- data/lib/usps_flags/generate/flag.rb +33 -30
- data/lib/usps_flags/helpers.rb +48 -63
- data/lib/usps_flags/helpers/builders.rb +39 -37
- data/lib/usps_flags/helpers/spec_arrows.rb +16 -13
- data/spec/rational_spec.rb +9 -7
- data/spec/spec_helper.rb +5 -3
- data/spec/usps_flags/config_spec.rb +15 -13
- data/spec/usps_flags/core_spec.rb +52 -51
- data/spec/usps_flags/generate_spec.rb +70 -60
- data/spec/usps_flags/helpers_spec.rb +12 -10
- data/spec/usps_flags_spec.rb +22 -20
- data/usps_flags.gemspec +4 -2
- metadata +31 -21
@@ -1,18 +1,20 @@
|
|
1
|
+
# frozen_string_literal: false
|
2
|
+
|
1
3
|
# Core SVG data for the file headers.
|
2
4
|
#
|
3
5
|
# This class should never need to be called directly.
|
4
6
|
# @private
|
5
7
|
class USPSFlags::Core::Headers
|
6
|
-
def initialize(width: nil, height: nil, pennant: false, scale: nil, title:
|
8
|
+
def initialize(width: nil, height: nil, pennant: false, scale: nil, title: 'USPS Flag')
|
7
9
|
@width = width
|
8
10
|
@height = height
|
9
11
|
@title = title
|
10
12
|
scale ||= 3
|
11
|
-
@generated_at = Time.now.strftime(
|
13
|
+
@generated_at = Time.now.strftime('%Y%m%d.%H%S%z')
|
12
14
|
|
13
15
|
if @width.nil? || @height.nil?
|
14
16
|
@width = USPSFlags::Config::BASE_FLY / scale
|
15
|
-
@height = (@width*Rational(2,3)).to_i
|
17
|
+
@height = (@width * Rational(2, 3)).to_i
|
16
18
|
@view_width = USPSFlags::Config::BASE_FLY
|
17
19
|
@view_height = USPSFlags::Config::BASE_HOIST
|
18
20
|
set_pennant_height(@height) if pennant
|
@@ -23,7 +25,7 @@ class USPSFlags::Core::Headers
|
|
23
25
|
end
|
24
26
|
|
25
27
|
def svg
|
26
|
-
svg =
|
28
|
+
svg = ''
|
27
29
|
svg << <<~SVG
|
28
30
|
<?xml version="1.0" standalone="no"?>
|
29
31
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
|
@@ -34,7 +36,7 @@ class USPSFlags::Core::Headers
|
|
34
36
|
<desc id="generated-at">#{@generated_at}</desc>
|
35
37
|
SVG
|
36
38
|
|
37
|
-
unless @title ==
|
39
|
+
unless @title == 'US Ensign'
|
38
40
|
svg << <<~SVG
|
39
41
|
<desc id="trademark-desc">This image is a registered trademark of United States Power Squadrons.</desc>
|
40
42
|
<desc id="trademark-link">https://www.usps.org/images/secretary/itcom/trademark.pdf</desc>
|
@@ -48,9 +50,10 @@ class USPSFlags::Core::Headers
|
|
48
50
|
svg
|
49
51
|
end
|
50
52
|
|
51
|
-
|
53
|
+
private
|
54
|
+
|
52
55
|
def set_pennant_height(height)
|
53
|
-
@height = height/4
|
54
|
-
@view_height = USPSFlags::Config::BASE_HOIST/4
|
56
|
+
@height = height / 4
|
57
|
+
@view_height = USPSFlags::Config::BASE_HOIST / 4
|
55
58
|
end
|
56
59
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: false
|
2
|
+
|
3
|
+
# Base module for Icons.
|
4
|
+
#
|
5
|
+
# These methods should never need to be called directly.
|
6
|
+
# @private
|
7
|
+
module USPSFlags::Core::Icons
|
8
|
+
require 'usps_flags/core/icons/anchor'
|
9
|
+
require 'usps_flags/core/icons/binoculars'
|
10
|
+
require 'usps_flags/core/icons/lighthouse'
|
11
|
+
require 'usps_flags/core/icons/star'
|
12
|
+
require 'usps_flags/core/icons/trident'
|
13
|
+
require 'usps_flags/core/icons/trumpet'
|
14
|
+
end
|
@@ -1,14 +1,16 @@
|
|
1
|
+
# frozen_string_literal: false
|
2
|
+
|
1
3
|
# Core SVG data for the anchor insignia.
|
2
4
|
#
|
3
5
|
# This class should never need to be called directly.
|
4
6
|
# @private
|
5
|
-
class USPSFlags::Core::Anchor
|
7
|
+
class USPSFlags::Core::Icons::Anchor
|
6
8
|
def initialize(color: :red)
|
7
9
|
@color_code = case color
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
10
|
+
when :red
|
11
|
+
USPSFlags::Config::RED
|
12
|
+
when :white
|
13
|
+
'#FFFFFF'
|
12
14
|
end
|
13
15
|
end
|
14
16
|
|
@@ -1,14 +1,16 @@
|
|
1
|
+
# frozen_string_literal: false
|
2
|
+
|
1
3
|
# Core SVG data for the binoculars insignia.
|
2
4
|
#
|
3
5
|
# This class should never need to be called directly.
|
4
6
|
# @private
|
5
|
-
class USPSFlags::Core::Binoculars
|
7
|
+
class USPSFlags::Core::Icons::Binoculars
|
6
8
|
def initialize(type: :d)
|
7
9
|
@color = case type
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
10
|
+
when :d
|
11
|
+
USPSFlags::Config::RED
|
12
|
+
when :n
|
13
|
+
USPSFlags::Config::BLUE
|
12
14
|
end
|
13
15
|
end
|
14
16
|
|
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: false
|
2
|
+
|
1
3
|
# Core SVG data for the lighthouse insignia.
|
2
4
|
#
|
3
5
|
# This class should never need to be called directly.
|
4
6
|
# @private
|
5
|
-
class USPSFlags::Core::Lighthouse
|
7
|
+
class USPSFlags::Core::Icons::Lighthouse
|
6
8
|
def svg
|
7
9
|
<<~SVG
|
8
10
|
<mask id="lighthouse-mask">
|
@@ -1,11 +1,14 @@
|
|
1
|
+
# frozen_string_literal: false
|
2
|
+
|
1
3
|
# Core SVG data for the trident insignia.
|
2
4
|
#
|
3
5
|
# This class should never need to be called directly.
|
4
6
|
# @private
|
5
|
-
class USPSFlags::Core::Trident
|
7
|
+
class USPSFlags::Core::Icons::Trident
|
6
8
|
def initialize(type, color: :blue, field_color: nil)
|
7
9
|
valid_types = [:s, :d, :stf, :n]
|
8
10
|
raise "Error: Invalid trident type. Options are #{valid_types}." unless valid_types.include? type
|
11
|
+
|
9
12
|
@type = type
|
10
13
|
|
11
14
|
load_config
|
@@ -14,9 +17,9 @@ class USPSFlags::Core::Trident
|
|
14
17
|
end
|
15
18
|
|
16
19
|
def svg
|
17
|
-
svg =
|
18
|
-
svg <<
|
19
|
-
svg <<
|
20
|
+
svg = ''
|
21
|
+
svg << '<g mask="url(#delta-mask)">' if @type == :d
|
22
|
+
svg << '<g mask="url(#circle-mask-for-main-spike)">' if @type == :stf
|
20
23
|
|
21
24
|
@trident_segments.each do |segment|
|
22
25
|
start = segment.keys.first
|
@@ -25,7 +28,7 @@ class USPSFlags::Core::Trident
|
|
25
28
|
points.each { |x, y| svg << "l #{x} #{y}\n" }
|
26
29
|
svg << "\" fill=\"#{@color_code}\" />\n"
|
27
30
|
end
|
28
|
-
svg <<
|
31
|
+
svg << '</g>' if [:d, :stf].include?(@type)
|
29
32
|
|
30
33
|
case @type
|
31
34
|
when :d
|
@@ -39,7 +42,8 @@ class USPSFlags::Core::Trident
|
|
39
42
|
svg
|
40
43
|
end
|
41
44
|
|
42
|
-
|
45
|
+
private
|
46
|
+
|
43
47
|
def load_config
|
44
48
|
@trident_config = USPSFlags.configuration.trident
|
45
49
|
@main_spike_overhang = @trident_config[:bar_width] / 2
|
@@ -47,7 +51,7 @@ class USPSFlags::Core::Trident
|
|
47
51
|
@top_point = ((USPSFlags::Config::BASE_HOIST - @trident_config[:height][@type]) / 2)
|
48
52
|
@crossbar_top = @top_point + @trident_config[:crossbar_from_top]
|
49
53
|
@hash_from_top = @trident_config[:crossbar_from_top] + (@trident_config[:bar_width] * 2)
|
50
|
-
@circle_from_top = @trident_config[:crossbar_from_top] + @trident_config[:bar_width]*123/128 + @trident_config[:width]/2
|
54
|
+
@circle_from_top = @trident_config[:crossbar_from_top] + @trident_config[:bar_width] * 123 / 128 + @trident_config[:width] / 2
|
51
55
|
@main_length = @trident_config[:height][@type] - (@trident_config[:center_point_height] - @trident_config[:main_point_barb])
|
52
56
|
end
|
53
57
|
|
@@ -73,7 +77,7 @@ class USPSFlags::Core::Trident
|
|
73
77
|
|
74
78
|
def crossbar
|
75
79
|
{
|
76
|
-
[(@trident_config[:center_point] - @trident_config[:width]/2), (@crossbar_top)] =>
|
80
|
+
[(@trident_config[:center_point] - @trident_config[:width] / 2), (@crossbar_top)] =>
|
77
81
|
[
|
78
82
|
[@trident_config[:width], 0],
|
79
83
|
[0, @trident_config[:bar_width]],
|
@@ -85,10 +89,10 @@ class USPSFlags::Core::Trident
|
|
85
89
|
|
86
90
|
def left_spike
|
87
91
|
{
|
88
|
-
[(@trident_config[:center_point] - @trident_config[:width]/2), (@crossbar_top + 1)] =>
|
92
|
+
[(@trident_config[:center_point] - @trident_config[:width] / 2), (@crossbar_top + 1)] =>
|
89
93
|
[
|
90
|
-
[0, -(@trident_config[:side_spike_height]
|
91
|
-
[(@trident_config[:bar_width]
|
94
|
+
[0, -(@trident_config[:side_spike_height] + @trident_config[:side_point_height])],
|
95
|
+
[(@trident_config[:bar_width] + @side_spike_overhang), @trident_config[:side_point_height]],
|
92
96
|
[-@side_spike_overhang, 0],
|
93
97
|
[0, @trident_config[:side_spike_height]]
|
94
98
|
]
|
@@ -97,10 +101,10 @@ class USPSFlags::Core::Trident
|
|
97
101
|
|
98
102
|
def right_spike
|
99
103
|
{
|
100
|
-
[(@trident_config[:center_point] + @trident_config[:width]/2), (@crossbar_top + 1)] =>
|
104
|
+
[(@trident_config[:center_point] + @trident_config[:width] / 2), (@crossbar_top + 1)] =>
|
101
105
|
[
|
102
|
-
[0, -(@trident_config[:side_spike_height]
|
103
|
-
[-(@trident_config[:bar_width]
|
106
|
+
[0, -(@trident_config[:side_spike_height] + @trident_config[:side_point_height])],
|
107
|
+
[-(@trident_config[:bar_width] + @side_spike_overhang), @trident_config[:side_point_height]],
|
104
108
|
[@side_spike_overhang, 0],
|
105
109
|
[0, @trident_config[:side_spike_height]]
|
106
110
|
]
|
@@ -117,13 +121,13 @@ class USPSFlags::Core::Trident
|
|
117
121
|
end
|
118
122
|
|
119
123
|
def configure_colors(color, field_color)
|
120
|
-
@color_code =
|
124
|
+
@color_code = '#FFFFFF'
|
121
125
|
if color == :red
|
122
126
|
@color_code = USPSFlags::Config::RED
|
123
|
-
@field_color_code =
|
127
|
+
@field_color_code = '#FFFFFF'
|
124
128
|
elsif color == :blue
|
125
129
|
@color_code = USPSFlags::Config::BLUE
|
126
|
-
@field_color_code =
|
130
|
+
@field_color_code = '#FFFFFF'
|
127
131
|
elsif field_color == :red
|
128
132
|
@field_color_code = USPSFlags::Config::RED
|
129
133
|
elsif field_color == :blue
|
@@ -135,16 +139,16 @@ class USPSFlags::Core::Trident
|
|
135
139
|
<<~SVG
|
136
140
|
<polyline mask="url(#delta-mask)" fill="#{@color_code}" points="
|
137
141
|
#{@trident_config[:center_point]}, #{@top_point + @trident_config[:height][:d] - @trident_config[:delta_from_bottom] - @trident_config[:delta_height]}
|
138
|
-
#{@trident_config[:center_point] + @trident_config[:width]/2}, #{@top_point + @trident_config[:height][:d] - @trident_config[:delta_from_bottom]}
|
139
|
-
#{@trident_config[:center_point] - @trident_config[:width]/2}, #{@top_point + @trident_config[:height][:d] - @trident_config[:delta_from_bottom]}
|
142
|
+
#{@trident_config[:center_point] + @trident_config[:width] / 2}, #{@top_point + @trident_config[:height][:d] - @trident_config[:delta_from_bottom]}
|
143
|
+
#{@trident_config[:center_point] - @trident_config[:width] / 2}, #{@top_point + @trident_config[:height][:d] - @trident_config[:delta_from_bottom]}
|
140
144
|
#{@trident_config[:center_point]}, #{@top_point + @trident_config[:height][:d] - @trident_config[:delta_from_bottom] - @trident_config[:delta_height]}" />
|
141
145
|
<mask id="delta-mask">
|
142
146
|
<g>
|
143
147
|
<rect x="0" y="0" width="#{USPSFlags::Config::BASE_FLY}" height="#{USPSFlags::Config::BASE_FLY}" fill="#FFFFFF" />
|
144
148
|
<polyline transform="scale(#{@trident_config[:delta_gap_scale]}) translate(#{@trident_config[:delta_gap_x]},#{@trident_config[:delta_gap_y]})" fill="#000000" points="
|
145
149
|
#{@trident_config[:center_point]}, #{@top_point + @trident_config[:height][:d] - @trident_config[:delta_from_bottom] - @trident_config[:delta_height]}
|
146
|
-
#{@trident_config[:center_point] + @trident_config[:width]/2}, #{@top_point + @trident_config[:height][:d] - @trident_config[:delta_from_bottom]*17/20}
|
147
|
-
#{@trident_config[:center_point] - @trident_config[:width]/2}, #{@top_point + @trident_config[:height][:d] - @trident_config[:delta_from_bottom]*17/20}
|
150
|
+
#{@trident_config[:center_point] + @trident_config[:width] / 2}, #{@top_point + @trident_config[:height][:d] - @trident_config[:delta_from_bottom] * 17 / 20}
|
151
|
+
#{@trident_config[:center_point] - @trident_config[:width] / 2}, #{@top_point + @trident_config[:height][:d] - @trident_config[:delta_from_bottom] * 17 / 20}
|
148
152
|
#{@trident_config[:center_point]}, #{@top_point + @trident_config[:height][:d] - @trident_config[:delta_from_bottom] - @trident_config[:delta_height]}" />
|
149
153
|
</g>
|
150
154
|
</mask>
|
@@ -153,24 +157,24 @@ class USPSFlags::Core::Trident
|
|
153
157
|
|
154
158
|
def circle_hash
|
155
159
|
<<~SVG
|
156
|
-
<circle cx="#{@trident_config[:center_point]}" cy="#{@top_point + @circle_from_top}" r="#{@trident_config[:width]/2}" fill="#{@color_code}" mask="url(#circle-mask)" />
|
160
|
+
<circle cx="#{@trident_config[:center_point]}" cy="#{@top_point + @circle_from_top}" r="#{@trident_config[:width] / 2}" fill="#{@color_code}" mask="url(#circle-mask)" />
|
157
161
|
<mask id="circle-mask">
|
158
162
|
<g>
|
159
163
|
<rect x="0" y="0" width="#{USPSFlags::Config::BASE_FLY}" height="#{USPSFlags::Config::BASE_FLY}" fill="#FFFFFF" />
|
160
|
-
<circle cx="#{@trident_config[:center_point]}" cy="#{@top_point + @circle_from_top}" r="#{@trident_config[:width]/2
|
164
|
+
<circle cx="#{@trident_config[:center_point]}" cy="#{@top_point + @circle_from_top}" r="#{@trident_config[:width] / 2 - @trident_config[:bar_width]}" fill="#000000" />
|
161
165
|
</g>
|
162
166
|
</mask>
|
163
167
|
<mask id="circle-mask-for-main-spike">
|
164
168
|
<g transform="scale(1.05) translate(-@trident_config[:br_width], -@trident_config[:br_width]/2)">
|
165
169
|
<rect x="0" y="0" width="#{USPSFlags::Config::BASE_FLY}" height="#{USPSFlags::Config::BASE_FLY}" fill="#FFFFFF" />
|
166
|
-
<circle cx="#{@trident_config[:center_point]}" cy="#{@top_point + @circle_from_top}" r="#{@trident_config[:width]/2
|
170
|
+
<circle cx="#{@trident_config[:center_point]}" cy="#{@top_point + @circle_from_top}" r="#{@trident_config[:width] / 2 - @trident_config[:bar_width]}" fill="#000000" />
|
167
171
|
</g>
|
168
172
|
</mask>
|
169
173
|
SVG
|
170
174
|
end
|
171
175
|
|
172
176
|
def standard_hash
|
173
|
-
svg = "<path d=\"M #{(@trident_config[:center_point] - @trident_config[:hash_width]/2)} #{(@top_point + @hash_from_top)}\n"
|
177
|
+
svg = "<path d=\"M #{(@trident_config[:center_point] - @trident_config[:hash_width] / 2)} #{(@top_point + @hash_from_top)}\n"
|
174
178
|
@lower_hash.each { |x, y| svg << "l #{x} #{y}\n" }
|
175
179
|
svg << "\" fill=\"#{@color_code}\" />\n"
|
176
180
|
|
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: false
|
2
|
+
|
1
3
|
# Core SVG data for the trumpet insignia.
|
2
4
|
#
|
3
5
|
# This class should never need to be called directly.
|
4
6
|
# @private
|
5
|
-
class USPSFlags::Core::Trumpet
|
7
|
+
class USPSFlags::Core::Icons::Trumpet
|
6
8
|
def initialize(type: :s)
|
7
9
|
@color = type == :n ? USPSFlags::Config::BLUE : USPSFlags::Config::RED
|
8
10
|
@count = type == :s ? 1 : 2
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: false
|
2
|
+
|
1
3
|
# Core SVG data for the pennants.
|
2
4
|
#
|
3
5
|
# This class should never need to be called directly.
|
@@ -6,13 +8,13 @@ class USPSFlags::Core::Pennant
|
|
6
8
|
def initialize(type: :cruise)
|
7
9
|
@type = type.to_s.upcase
|
8
10
|
@fly = USPSFlags::Config::BASE_FLY
|
9
|
-
@hoist = USPSFlags::Config::BASE_HOIST/4
|
11
|
+
@hoist = USPSFlags::Config::BASE_HOIST / 4
|
10
12
|
end
|
11
13
|
|
12
14
|
def svg
|
13
|
-
if @type ==
|
15
|
+
if @type == 'OIC'
|
14
16
|
oic
|
15
|
-
elsif @type ==
|
17
|
+
elsif @type == 'CRUISE'
|
16
18
|
<<~SVG
|
17
19
|
#{cruise}
|
18
20
|
<g transform=\"translate(385, 340)\">
|
@@ -22,32 +24,33 @@ class USPSFlags::Core::Pennant
|
|
22
24
|
end
|
23
25
|
end
|
24
26
|
|
25
|
-
|
27
|
+
private
|
28
|
+
|
26
29
|
def oic
|
27
30
|
<<~SVG
|
28
|
-
<polyline fill="#{USPSFlags::Config::BLUE}" points="0 0 #{USPSFlags::Config::BASE_FLY} #{USPSFlags::Config::BASE_HOIST/8} 0 #{USPSFlags::Config::BASE_HOIST/4}" />
|
31
|
+
<polyline fill="#{USPSFlags::Config::BLUE}" points="0 0 #{USPSFlags::Config::BASE_FLY} #{USPSFlags::Config::BASE_HOIST / 8} 0 #{USPSFlags::Config::BASE_HOIST / 4}" />
|
29
32
|
SVG
|
30
33
|
end
|
31
34
|
|
32
35
|
def cruise
|
33
36
|
<<~SVG
|
34
37
|
<path d="M 0 0
|
35
|
-
l #{@fly*10/36} #{@hoist*5/36}
|
36
|
-
l 0 #{@hoist*26/36}
|
37
|
-
l -#{@fly*10/36} #{@hoist*5/36}
|
38
|
+
l #{@fly * 10 / 36} #{@hoist * 5 / 36}
|
39
|
+
l 0 #{@hoist * 26 / 36}
|
40
|
+
l -#{@fly * 10 / 36} #{@hoist * 5 / 36}
|
38
41
|
" fill="#{USPSFlags::Config::RED}" />
|
39
|
-
<path d="M #{@fly*10/36} #{@hoist*5/36}
|
40
|
-
l #{@fly*11/36} #{@hoist*5.5/36}
|
41
|
-
l 0 #{@hoist*15/36}
|
42
|
-
l -#{@fly*11/36} #{@hoist*5.5/36}
|
42
|
+
<path d="M #{@fly * 10 / 36} #{@hoist * 5 / 36}
|
43
|
+
l #{@fly * 11 / 36} #{@hoist * 5.5 / 36}
|
44
|
+
l 0 #{@hoist * 15 / 36}
|
45
|
+
l -#{@fly * 11 / 36} #{@hoist * 5.5 / 36}
|
43
46
|
" fill="#FFFFFF" />
|
44
|
-
<path d="M #{@fly*21/36} #{@hoist*10.5/36}
|
45
|
-
l #{@fly*15/36} #{@hoist*7.5/36}
|
46
|
-
l -#{@fly*15/36} #{@hoist*7.5/36}
|
47
|
+
<path d="M #{@fly * 21 / 36} #{@hoist * 10.5 / 36}
|
48
|
+
l #{@fly * 15 / 36} #{@hoist * 7.5 / 36}
|
49
|
+
l -#{@fly * 15 / 36} #{@hoist * 7.5 / 36}
|
47
50
|
" fill="#{USPSFlags::Config::BLUE}" />
|
48
51
|
<path d="M 0 0
|
49
|
-
l #{@fly} #{@hoist/2}
|
50
|
-
l -#{@fly} #{@hoist/2}
|
52
|
+
l #{@fly} #{@hoist / 2}
|
53
|
+
l -#{@fly} #{@hoist / 2}
|
51
54
|
" fill="none" stroke="#000000" stroke-width="2" />
|
52
55
|
SVG
|
53
56
|
end
|
@@ -1,10 +1,16 @@
|
|
1
|
+
# frozen_string_literal: false
|
2
|
+
|
1
3
|
# Core SVG data for the trident specification sheet.
|
2
4
|
#
|
3
5
|
# This class should never need to be called directly.
|
4
6
|
# @private
|
5
7
|
class USPSFlags::Core::TridentSpec
|
6
|
-
|
7
|
-
|
8
|
+
SA = USPSFlags::Helpers::SpecArrows
|
9
|
+
BF = USPSFlags::Config::BASE_FLY
|
10
|
+
BH = USPSFlags::Config::BASE_HOIST
|
11
|
+
|
12
|
+
def initialize(fly: 24, unit: 'in', scaled_border: false)
|
13
|
+
@config = USPSFlags.configuration.trident
|
8
14
|
@scaled_border = scaled_border
|
9
15
|
configure_sizes(fly)
|
10
16
|
configure_labels(unit)
|
@@ -12,26 +18,42 @@ class USPSFlags::Core::TridentSpec
|
|
12
18
|
|
13
19
|
def svg
|
14
20
|
svg = spec_header
|
21
|
+
svg << add_short_trident
|
22
|
+
svg << add_delta_trident
|
23
|
+
svg << add_national_tridents
|
15
24
|
|
16
|
-
|
17
|
-
|
18
|
-
box_top = USPSFlags::Config::BASE_HOIST/4
|
19
|
-
box_bottom = USPSFlags::Config::BASE_HOIST*3/4
|
20
|
-
svg << short_trident(box_top, box_bottom, box_left, box_right)
|
25
|
+
svg
|
26
|
+
end
|
21
27
|
|
22
|
-
|
23
|
-
box_bottom = USPSFlags::Config::BASE_HOIST*13/16
|
24
|
-
svg << delta_trident(box_top, box_bottom, box_left, box_right)
|
28
|
+
private
|
25
29
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
svg << long_trident(box_top, box_bottom, box_left, box_right)
|
30
|
+
def box_left
|
31
|
+
(BF * 27 / 32) / 2
|
32
|
+
end
|
30
33
|
|
31
|
-
|
34
|
+
def box_right
|
35
|
+
(BF * 37 / 32) / 2
|
36
|
+
end
|
37
|
+
|
38
|
+
def add_short_trident
|
39
|
+
box_top = BH / 4
|
40
|
+
box_bottom = BH * 3 / 4
|
41
|
+
add_trident(:Short, box_top, box_bottom, box_left, box_right)
|
42
|
+
end
|
43
|
+
|
44
|
+
def add_delta_trident
|
45
|
+
box_top = BH * 3 / 16
|
46
|
+
box_bottom = BH * 13 / 16
|
47
|
+
add_trident(:Delta, box_top, box_bottom, box_left, box_right)
|
48
|
+
end
|
49
|
+
|
50
|
+
def add_national_tridents
|
51
|
+
box_top = BH / 8
|
52
|
+
box_bottom = BH * 7 / 8
|
53
|
+
add_trident(:Circle, box_top, box_bottom, box_left, box_right) +
|
54
|
+
add_trident(:Long, box_top, box_bottom, box_left, box_right)
|
32
55
|
end
|
33
56
|
|
34
|
-
private
|
35
57
|
def configure_sizes(fly)
|
36
58
|
@fly = Rational(fly)
|
37
59
|
get_hoist_from_fly(@fly)
|
@@ -40,7 +62,7 @@ class USPSFlags::Core::TridentSpec
|
|
40
62
|
end
|
41
63
|
|
42
64
|
def get_hoist_from_fly(fly)
|
43
|
-
hoist = (fly*Rational(2,3))
|
65
|
+
hoist = (fly * Rational(2, 3))
|
44
66
|
@hoist = if hoist == hoist.to_i
|
45
67
|
hoist.to_i
|
46
68
|
else
|
@@ -49,7 +71,7 @@ class USPSFlags::Core::TridentSpec
|
|
49
71
|
end
|
50
72
|
|
51
73
|
def configure_hoist_fraction
|
52
|
-
@hoist_fraction =
|
74
|
+
@hoist_fraction = ''
|
53
75
|
if @hoist == @hoist.to_i
|
54
76
|
@hoist = @hoist.to_i
|
55
77
|
else
|
@@ -58,7 +80,7 @@ class USPSFlags::Core::TridentSpec
|
|
58
80
|
end
|
59
81
|
|
60
82
|
def configure_fly_fraction
|
61
|
-
@fly_fraction =
|
83
|
+
@fly_fraction = ''
|
62
84
|
if @fly == @fly.to_i
|
63
85
|
@fly = @fly.to_i
|
64
86
|
else
|
@@ -68,19 +90,19 @@ class USPSFlags::Core::TridentSpec
|
|
68
90
|
|
69
91
|
def configure_labels(unit)
|
70
92
|
@label_font_size = if Math.sqrt(@fly) > 24
|
71
|
-
|
93
|
+
BF * Math.log(24, Math.sqrt(@fly)) / 60
|
72
94
|
else
|
73
|
-
|
95
|
+
BF / 60
|
74
96
|
end
|
75
97
|
|
76
|
-
@unit_text = unit.nil? ?
|
98
|
+
@unit_text = unit.nil? ? '' : "#{unit}"
|
77
99
|
@unit = unit
|
78
100
|
|
79
101
|
configure_barb_label
|
80
102
|
end
|
81
103
|
|
82
104
|
def configure_barb_label
|
83
|
-
barb_label = Rational(@
|
105
|
+
barb_label = Rational(@config[:main_point_barb]) * @fly / BF
|
84
106
|
@barb_label = if barb_label == barb_label.to_i
|
85
107
|
"#{barb_label.to_i}#{@unit_text}"
|
86
108
|
else
|
@@ -89,164 +111,30 @@ class USPSFlags::Core::TridentSpec
|
|
89
111
|
end
|
90
112
|
|
91
113
|
def spec_header
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
<!-- Specification Heading Information -->
|
97
|
-
<g>
|
98
|
-
<style><![CDATA[tspan.heading{font-size: 50%;}]]></style>
|
99
|
-
<text x="#{USPSFlags::Config::BASE_FLY/2}" y="#{USPSFlags::Config::BASE_HOIST*3/40}" font-family="sans-serif" font-size="#{USPSFlags::Config::BASE_HOIST/20}px" font-weight="bold" fill="#041E42" text-anchor="middle">United States Power Squadrons<tspan class="heading" dy ="-#{USPSFlags::Config::BASE_HOIST/50}">®</tspan></text>
|
100
|
-
</g>
|
101
|
-
<text x="#{USPSFlags::Config::BASE_FLY/2}" y="#{USPSFlags::Config::BASE_HOIST/8}" font-family="sans-serif" font-size="#{USPSFlags::Config::BASE_HOIST/30}px" fill="#041E42" text-anchor="middle">Officer Flag Trident Specification</text>
|
102
|
-
<text x="#{USPSFlags::Config::BASE_FLY/2}" y="#{USPSFlags::Config::BASE_HOIST*2/11}" font-family="sans-serif" font-size="#{USPSFlags::Config::BASE_HOIST/40}px" fill="#041E42" text-anchor="middle">All measurements are relative to a field with</text>
|
103
|
-
<g>
|
104
|
-
<style><![CDATA[tspan.title{font-size: #{USPSFlags::Config::FRACTION_SCALE*9/10}%;}]]></style>
|
105
|
-
<text x="#{USPSFlags::Config::BASE_FLY/2}" y="#{USPSFlags::Config::BASE_HOIST*4/19}" font-family="sans-serif" font-size="#{USPSFlags::Config::BASE_HOIST/40}px" fill="#041E42" text-anchor="middle">fly of #{@fly} <tspan class="title">#{@fly_fraction}</tspan> #{@unit_text} and hoist of #{@hoist} <tspan class="title">#{@hoist_fraction}</tspan> #{@unit_text}.</text>
|
106
|
-
</g>
|
107
|
-
<text x="#{USPSFlags::Config::BASE_FLY/2}" y="#{USPSFlags::Config::BASE_HOIST/4}" font-family="sans-serif" font-size="#{USPSFlags::Config::BASE_HOIST/40}px" fill="#041E42" text-anchor="middle">Measurements not specified are the same as on the short trident.</text>
|
108
|
-
#{scaled_border if @scaled_border}
|
109
|
-
SVG
|
114
|
+
USPSFlags::Core::TridentSpecs::Header.new(
|
115
|
+
fly: @fly, fly_fraction: @fly_fraction, hoist: @hoist, hoist_fraction: @hoist_fraction,
|
116
|
+
unit_text: @unit_text, scaled_border: @scaled_border
|
117
|
+
).p
|
110
118
|
end
|
111
119
|
|
112
|
-
def
|
113
|
-
|
114
|
-
<!-- Flag border scaled to spec trident size -->
|
115
|
-
<rect x="#{USPSFlags::Config::BASE_FLY*0.41}" y="#{USPSFlags::Config::BASE_HOIST*0.38}" width="#{USPSFlags::Config::BASE_FLY}" height="#{USPSFlags::Config::BASE_HOIST}" transform="scale(0.7)" style="fill: none; stroke: #E0E0E0; stroke-width: 5px;" />
|
116
|
-
<text x="#{USPSFlags::Config::BASE_FLY*0.64}" y="#{USPSFlags::Config::BASE_HOIST*0.96}" font-family="sans-serif" font-size="#{USPSFlags::Config::BASE_HOIST/60}px" fill="#CCCCCC" text-anchor="middle">Scale size of a flag.</text>
|
117
|
-
SVG
|
118
|
-
end
|
120
|
+
def add_trident(type, box_top, box_bottom, box_left, box_right)
|
121
|
+
sym = { Short: :s, Delta: :d, Circle: :stf, Long: :n }[type]
|
119
122
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
#{trident_heading(:s)}
|
125
|
-
|
126
|
-
#{USPSFlags::Core::Trident.new(:s).svg}
|
127
|
-
|
128
|
-
<!-- Boundary box -->
|
129
|
-
<rect x="#{box_left}" y="#{box_top}" width="#{box_right-box_left}" height="#{USPSFlags::Config::BASE_HOIST/2}" stroke="#666666" stroke-width="#{USPSFlags::Config::BASE_FLY/600}" stroke-dasharray="15, 15" fill="none" />
|
130
|
-
|
131
|
-
<!-- Right -->
|
132
|
-
#{USPSFlags::Helpers::SpecArrows.vertical(box_right+@trident_config[:bar_width], box_top, box_top+@trident_config[:bar_width]*4/5, box_right, box_right, fly: @fly, unit: @unit)} <!-- Side spike top gap -->
|
133
|
-
#{USPSFlags::Helpers::SpecArrows.vertical(box_right+@trident_config[:bar_width], box_top+@trident_config[:bar_width]*4/5, box_top+@trident_config[:bar_width]*9/10*2+@trident_config[:side_point_height]+@trident_config[:side_spike_height], nil, box_right, fly: @fly, unit: @unit)} <!-- Top gap to hash gap -->
|
134
|
-
#{USPSFlags::Helpers::SpecArrows.vertical(box_right+@trident_config[:bar_width], box_top+@trident_config[:bar_width]*18/10+@trident_config[:side_point_height]+@trident_config[:side_spike_height], box_top+@trident_config[:bar_width]*28/10+@trident_config[:side_point_height]+@trident_config[:side_spike_height], nil, @trident_config[:center_point]+@trident_config[:hash_width]/2, fly: @fly, unit: @unit)} <!-- Crossbar to hash gap -->
|
135
|
-
|
136
|
-
#{USPSFlags::Helpers::SpecArrows.vertical(box_right+@trident_config[:bar_width], box_top+@trident_config[:bar_width]*28/10+@trident_config[:side_point_height]+@trident_config[:side_spike_height], box_top+@trident_config[:bar_width]*38/10+@trident_config[:side_point_height]+@trident_config[:side_spike_height], nil, @trident_config[:center_point]+@trident_config[:hash_width]/2, fly: @fly, unit: @unit)} <!-- Hash -->
|
137
|
-
#{USPSFlags::Helpers::SpecArrows.vertical(box_right+@trident_config[:bar_width], box_top+@trident_config[:bar_width]*38/10+@trident_config[:side_point_height]+@trident_config[:side_spike_height], box_bottom, nil, box_right, fly: @fly, unit: @unit)} <!-- Hash to bottom -->
|
138
|
-
|
139
|
-
<!-- Left -->
|
140
|
-
#{USPSFlags::Helpers::SpecArrows.vertical(box_left-@trident_config[:bar_width]*5.25, box_top, box_bottom, box_left, box_left, fly: @fly, unit: @unit)} <!-- Boundary height -->
|
141
|
-
#{USPSFlags::Helpers::SpecArrows.vertical(box_left-@trident_config[:bar_width]*0.75, box_top, box_top+@trident_config[:center_point_height], nil, @trident_config[:center_point]-@trident_config[:bar_width], label_offset: -USPSFlags::Config::BASE_FLY/24, label_offset_y: -USPSFlags::Config::BASE_FLY/60, label_align: "middle", fly: @fly, unit: @unit)} <!-- Main point height -->
|
142
|
-
#{USPSFlags::Helpers::SpecArrows.vertical(box_left-@trident_config[:bar_width]*1.5, box_top+@trident_config[:bar_width]*4/5, box_top+@trident_config[:bar_width]*4/5+@trident_config[:side_point_height], box_left, box_left+@trident_config[:bar_width], label_offset: -USPSFlags::Config::BASE_FLY/24, label_align: "middle", fly: @fly, unit: @unit)} <!-- Side point height -->
|
143
|
-
|
144
|
-
<!-- Bottom -->
|
145
|
-
#{USPSFlags::Helpers::SpecArrows.horizontal(box_bottom+@trident_config[:bar_width], @trident_config[:center_point]-@trident_config[:bar_width]/2, @trident_config[:center_point]+@trident_config[:bar_width]/2, box_bottom, box_bottom, fly: @fly, unit: @unit)} <!-- Bar width -->
|
146
|
-
#{USPSFlags::Helpers::SpecArrows.horizontal(box_bottom+@trident_config[:bar_width]*2.5, @trident_config[:center_point]-@trident_config[:hash_width]/2, @trident_config[:center_point]+@trident_config[:hash_width]/2, box_top+@trident_config[:bar_width]*4+@trident_config[:center_point_height]+@trident_config[:side_spike_height], box_top+@trident_config[:bar_width]*4+@trident_config[:center_point_height]+@trident_config[:side_spike_height], fly: @fly, unit: @unit)} <!-- Hash width -->
|
147
|
-
#{USPSFlags::Helpers::SpecArrows.horizontal(box_bottom+@trident_config[:bar_width]*4, box_left, box_right, box_bottom, box_bottom, fly: @fly, unit: @unit)} <!-- Boundary width -->
|
148
|
-
|
149
|
-
<!-- Top -->
|
150
|
-
#{USPSFlags::Helpers::SpecArrows.horizontal(box_top-@trident_config[:bar_width], box_left, box_left+@trident_config[:bar_width]*3/2, box_top, box_top+@trident_config[:bar_width]*4/5+@trident_config[:side_point_height], label_offset: -USPSFlags::Config::BASE_FLY/60, fly: @fly, unit: @unit)} <!-- Side point width -->
|
151
|
-
#{USPSFlags::Helpers::SpecArrows.horizontal(box_top-@trident_config[:bar_width]*2.5, @trident_config[:center_point]-@trident_config[:bar_width], @trident_config[:center_point]+@trident_config[:bar_width], box_top+@trident_config[:center_point_height], box_top+@trident_config[:center_point_height], label_offset: -USPSFlags::Config::BASE_FLY/60, fly: @fly, unit: @unit)} <!-- Main point width -->
|
152
|
-
|
153
|
-
<!-- Overlay -->
|
154
|
-
<!-- Main point barb -->
|
155
|
-
<line x1="#{@trident_config[:center_point]+@trident_config[:bar_width]/2}" y1="#{box_top+@trident_config[:center_point_height]-@trident_config[:main_point_barb]}" x2="#{@trident_config[:center_point]+@trident_config[:bar_width]*3/2}" y2="#{box_top+@trident_config[:center_point_height]-@trident_config[:main_point_barb]*5}" stroke="#666666" stroke-width="2" stroke-dasharray="5, 5" />
|
156
|
-
<line x1="#{@trident_config[:center_point]+@trident_config[:bar_width]/2}" y1="#{box_top+@trident_config[:center_point_height]}" x2="#{@trident_config[:center_point]+@trident_config[:bar_width]*3/2}" y2="#{box_top+@trident_config[:center_point_height]}" stroke="#666666" stroke-width="2" stroke-dasharray="5, 5" />
|
157
|
-
<text x="#{@trident_config[:center_point]+@trident_config[:bar_width]*9/8}" y="#{box_top+@trident_config[:center_point_height]-@trident_config[:main_point_barb]}" font-family="sans-serif" font-size="#{USPSFlags::Config::BASE_FLY/100}px" fill="#041E42" text-anchor="left">#{@barb_label}</text>
|
158
|
-
</g></g>
|
159
|
-
SVG
|
123
|
+
Object.const_get("USPSFlags::Core::TridentSpecs::#{type}").new(
|
124
|
+
bt: box_top, bb: box_bottom, bl: box_left, br: box_right,
|
125
|
+
fly: @fly, unit: @unit, heading: heading(sym), config: @config
|
126
|
+
).p
|
160
127
|
end
|
161
128
|
|
162
|
-
def
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
#{USPSFlags::Core::Trident.new(:d).svg}
|
169
|
-
|
170
|
-
<!-- Boundary box -->
|
171
|
-
<rect x="#{box_left}" y="#{box_top}" width="#{box_right-box_left}" height="#{USPSFlags::Config::BASE_HOIST*5/8}" stroke="#666666" stroke-width="#{USPSFlags::Config::BASE_FLY/600}" stroke-dasharray="15, 15" fill="none" />
|
172
|
-
|
173
|
-
<!-- Right -->
|
174
|
-
#{USPSFlags::Helpers::SpecArrows.vertical(box_right+@trident_config[:bar_width], box_bottom-@trident_config[:delta_from_bottom]-@trident_config[:bar_width]-@trident_config[:delta_gap_height], box_bottom-@trident_config[:delta_from_bottom]-@trident_config[:bar_width], @trident_config[:center_point], @trident_config[:center_point]+@trident_config[:delta_gap_width], fly: @fly, unit: @unit)} <!-- Delta gap height -->
|
175
|
-
#{USPSFlags::Helpers::SpecArrows.vertical(box_right+@trident_config[:bar_width], box_bottom-@trident_config[:delta_from_bottom]-@trident_config[:bar_width], box_bottom-@trident_config[:delta_from_bottom], nil, box_right, fly: @fly, unit: @unit)} <!-- Delta width -->
|
176
|
-
#{USPSFlags::Helpers::SpecArrows.vertical(box_right+@trident_config[:bar_width], box_bottom-@trident_config[:delta_from_bottom], box_bottom, nil, box_right, fly: @fly, unit: @unit)} <!-- Delta to bottom -->
|
177
|
-
|
178
|
-
<!-- Left -->
|
179
|
-
#{USPSFlags::Helpers::SpecArrows.vertical(box_left-@trident_config[:bar_width]*1.5, box_top, box_bottom, box_left, box_left, label_offset: -USPSFlags::Config::BASE_FLY/30, label_offset_y: -USPSFlags::Config::BASE_FLY*2/11, label_align: "middle", fly: @fly, unit: @unit)} <!-- Boundary height -->
|
180
|
-
</g></g>
|
181
|
-
SVG
|
182
|
-
end
|
183
|
-
|
184
|
-
def circle_trident(box_top, box_bottom, box_left, box_right)
|
185
|
-
<<~SVG
|
186
|
-
<!-- Circle Trident -->
|
187
|
-
<g transform="translate(#{USPSFlags::Config::BASE_FLY*23/80},#{USPSFlags::Config::BASE_HOIST*9/32})"><g transform="scale(0.7)">
|
188
|
-
#{trident_heading(:stf)}
|
189
|
-
|
190
|
-
#{USPSFlags::Core::Trident.new(:stf).svg}
|
191
|
-
|
192
|
-
#{long_trident_boundary_box(box_top, box_left, box_right)}
|
193
|
-
|
194
|
-
<!-- Right -->
|
195
|
-
#{USPSFlags::Helpers::SpecArrows.vertical(box_right+@trident_config[:bar_width], box_top+@trident_config[:crossbar_from_top]+@trident_config[:bar_width]*2, box_top+@trident_config[:crossbar_from_top]+@trident_config[:width], @trident_config[:center_point], @trident_config[:center_point], fly: @fly, unit: @unit)} <!-- Inner circle diameter -->
|
196
|
-
#{USPSFlags::Helpers::SpecArrows.vertical(box_right+@trident_config[:bar_width], box_top+@trident_config[:crossbar_from_top]+@trident_config[:width], box_top+@trident_config[:crossbar_from_top]+@trident_config[:bar_width]+@trident_config[:width], nil, @trident_config[:center_point]+@trident_config[:bar_width]/2, fly: @fly, unit: @unit)} <!-- Outer circle diameter -->
|
197
|
-
#{USPSFlags::Helpers::SpecArrows.vertical(box_right+@trident_config[:bar_width], box_top+@trident_config[:crossbar_from_top]+@trident_config[:bar_width]+@trident_config[:width], box_bottom, nil, box_right, fly: @fly, unit: @unit)} <!-- Circle to bottom -->
|
198
|
-
|
199
|
-
#{long_trident_left_arrow(box_top, box_bottom, box_left, box_right)}
|
200
|
-
</g></g>
|
201
|
-
SVG
|
202
|
-
end
|
203
|
-
|
204
|
-
def long_trident(box_top, box_bottom, box_left, box_right)
|
205
|
-
<<~SVG
|
206
|
-
<!-- Long Trident -->
|
207
|
-
<g transform="translate(#{USPSFlags::Config::BASE_FLY*40/80},#{USPSFlags::Config::BASE_HOIST*9/32})"><g transform="scale(0.7)">
|
208
|
-
#{trident_heading(:n)}
|
209
|
-
|
210
|
-
#{USPSFlags::Core::Trident.new(:n).svg}
|
211
|
-
|
212
|
-
#{long_trident_boundary_box(box_top, box_left, box_right)}
|
213
|
-
|
214
|
-
<!-- Right -->
|
215
|
-
#{USPSFlags::Helpers::SpecArrows.vertical(box_right+@trident_config[:bar_width], box_top+@trident_config[:crossbar_from_top]+@trident_config[:bar_width]*3, box_bottom, @trident_config[:center_point]+@trident_config[:hash_width]/2, box_right, fly: @fly, unit: @unit)} <!-- Hash to bottom -->
|
216
|
-
|
217
|
-
#{long_trident_left_arrow(box_top, box_bottom, box_left, box_right)}
|
218
|
-
</g></g>
|
219
|
-
SVG
|
220
|
-
end
|
221
|
-
|
222
|
-
def trident_heading(type_sym)
|
223
|
-
type, description = case type_sym
|
224
|
-
when :s
|
225
|
-
["Short", "Squadron Officers"]
|
226
|
-
when :d
|
227
|
-
["Delta", "District Officers"]
|
228
|
-
when :stf
|
229
|
-
["Circle", "Staff Commanders Only"]
|
230
|
-
when :n
|
231
|
-
["Long", "National Officers"]
|
232
|
-
end
|
233
|
-
<<~SVG
|
234
|
-
<text x="#{USPSFlags::Config::BASE_FLY/2}" y="#{USPSFlags::Config::BASE_HOIST*1/40}" font-family="sans-serif" font-size="#{USPSFlags::Config::BASE_HOIST/30}px" font-weight="bold" fill="#BF0D3E" text-anchor="middle">#{type}</text>
|
235
|
-
<text x="#{USPSFlags::Config::BASE_FLY/2}" y="#{USPSFlags::Config::BASE_HOIST*5/80}" font-family="sans-serif" font-size="#{USPSFlags::Config::BASE_HOIST/40}px" fill="#BF0D3E" text-anchor="middle">#{description}</text>
|
236
|
-
SVG
|
237
|
-
end
|
238
|
-
|
239
|
-
def long_trident_boundary_box(box_top, box_left, box_right)
|
240
|
-
<<~SVG
|
241
|
-
<!-- Boundary box -->
|
242
|
-
<rect x="#{box_left}" y="#{box_top}" width="#{box_right-box_left}" height="#{USPSFlags::Config::BASE_HOIST*3/4}" stroke="#666666" stroke-width="#{USPSFlags::Config::BASE_FLY/600}" stroke-dasharray="15, 15" fill="none" />
|
243
|
-
SVG
|
244
|
-
end
|
129
|
+
def heading(type_sym)
|
130
|
+
type, description = {
|
131
|
+
s: ['Short', 'Squadron Officers'], d: ['Delta', 'District Officers'],
|
132
|
+
stf: ['Circle', 'Staff Commanders Only'], n: ['Long', 'National Officers']
|
133
|
+
}[type_sym]
|
245
134
|
|
246
|
-
def long_trident_left_arrow(box_top, box_bottom, box_left, box_right)
|
247
135
|
<<~SVG
|
248
|
-
|
249
|
-
|
136
|
+
<text x="#{BF / 2}" y="#{BH * 1 / 40}" font-family="sans-serif" font-size="#{BH / 30}px" font-weight="bold" fill="#BF0D3E" text-anchor="middle">#{type}</text>
|
137
|
+
<text x="#{BF / 2}" y="#{BH * 5 / 80}" font-family="sans-serif" font-size="#{BH / 40}px" fill="#BF0D3E" text-anchor="middle">#{description}</text>
|
250
138
|
SVG
|
251
139
|
end
|
252
140
|
end
|