usps_flags 0.5.0 → 0.5.1
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 +22 -11
- data/.travis.yml +1 -1
- data/Gemfile.lock +5 -2
- data/README.md +6 -0
- data/lib/usps_flags.rb +35 -44
- data/lib/usps_flags/config.rb +89 -87
- data/lib/usps_flags/core.rb +44 -42
- data/lib/usps_flags/core/ensign.rb +53 -49
- data/lib/usps_flags/core/field.rb +96 -92
- data/lib/usps_flags/core/footer.rb +9 -5
- data/lib/usps_flags/core/headers.rb +58 -48
- data/lib/usps_flags/core/icons.rb +11 -7
- data/lib/usps_flags/core/icons/anchor.rb +62 -56
- data/lib/usps_flags/core/icons/binoculars.rb +21 -15
- data/lib/usps_flags/core/icons/lighthouse.rb +28 -22
- data/lib/usps_flags/core/icons/star.rb +21 -15
- data/lib/usps_flags/core/icons/trident.rb +136 -127
- data/lib/usps_flags/core/icons/trident_parts/hashes.rb +62 -55
- data/lib/usps_flags/core/icons/trumpet.rb +34 -28
- data/lib/usps_flags/core/pennant.rb +50 -46
- data/lib/usps_flags/core/trident_spec.rb +135 -131
- data/lib/usps_flags/core/trident_specs.rb +11 -7
- data/lib/usps_flags/core/trident_specs/base.rb +36 -26
- data/lib/usps_flags/core/trident_specs/circle.rb +36 -30
- data/lib/usps_flags/core/trident_specs/delta.rb +41 -30
- data/lib/usps_flags/core/trident_specs/header.rb +56 -50
- data/lib/usps_flags/core/trident_specs/horizontal.rb +80 -0
- data/lib/usps_flags/core/trident_specs/long.rb +41 -25
- data/lib/usps_flags/core/trident_specs/overlay.rb +40 -0
- data/lib/usps_flags/core/trident_specs/short.rb +30 -156
- data/lib/usps_flags/core/trident_specs/vertical.rb +108 -0
- data/lib/usps_flags/core/tridents.rb +54 -50
- data/lib/usps_flags/core/us.rb +40 -44
- data/lib/usps_flags/core/wheel.rb +7 -3
- data/lib/usps_flags/errors.rb +25 -23
- data/lib/usps_flags/generate.rb +111 -107
- data/lib/usps_flags/generate/flag.rb +160 -157
- data/lib/usps_flags/generate/generator_methods.rb +139 -0
- data/lib/usps_flags/generate/helper_methods.rb +88 -0
- data/lib/usps_flags/helpers.rb +163 -165
- data/lib/usps_flags/helpers/builders.rb +92 -85
- data/lib/usps_flags/helpers/spec_arrows.rb +127 -123
- data/lib/usps_flags/helpers/valid_flags.rb +45 -41
- data/lib/usps_flags/rational.rb +35 -0
- data/spec/usps_flags/config_spec.rb +17 -10
- data/spec/usps_flags/core_spec.rb +31 -31
- data/spec/usps_flags/generate_spec.rb +76 -73
- data/spec/usps_flags/helpers_spec.rb +8 -8
- data/spec/usps_flags/rational_spec.rb +17 -0
- data/spec/usps_flags_spec.rb +19 -21
- data/usps_flags.gemspec +7 -6
- metadata +34 -10
- data/lib/rational.rb +0 -39
- data/lib/usps_flags/generate/private.rb +0 -199
- data/spec/rational_spec.rb +0 -19
@@ -4,66 +4,73 @@
|
|
4
4
|
#
|
5
5
|
# These methods should never need to be called directly.
|
6
6
|
# @private
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
7
|
+
class USPSFlags
|
8
|
+
class Core
|
9
|
+
module Icons
|
10
|
+
class TridentParts
|
11
|
+
module Hashes
|
12
|
+
def delta_hash
|
13
|
+
<<~SVG
|
14
|
+
<polyline mask="url(#delta-mask)" fill="#{@color_code}" points="#{delta_mask_points(@trident_config[:center_point], @trident_config[:height][:d], @trident_config[:delta_from_bottom])}" />
|
15
|
+
<mask id="delta-mask">
|
16
|
+
<g>
|
17
|
+
<rect x="0" y="0" width="#{USPSFlags::Config::BASE_FLY}" height="#{USPSFlags::Config::BASE_FLY}" fill="#FFFFFF" />
|
18
|
+
<polyline transform="scale(#{@trident_config[:delta_gap_scale]}) translate(#{@trident_config[:delta_gap_x]},#{@trident_config[:delta_gap_y]})" fill="#000000" points="#{delta_points(@trident_config[:center_point], @trident_config[:height][:d], @trident_config[:delta_from_bottom])}" />
|
19
|
+
</g>
|
20
|
+
</mask>
|
21
|
+
SVG
|
22
|
+
end
|
20
23
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
24
|
+
def delta_mask_points(center, height, bottom)
|
25
|
+
top = @top_point + height - bottom
|
26
|
+
<<~SVG
|
27
|
+
#{center}, #{top - @trident_config[:delta_height]}
|
28
|
+
#{center + @trident_config[:width] / 2}, #{top}
|
29
|
+
#{center - @trident_config[:width] / 2}, #{top}
|
30
|
+
#{center}, #{top - @trident_config[:delta_height]}
|
31
|
+
SVG
|
32
|
+
end
|
30
33
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
34
|
+
def delta_points(center, height, bottom)
|
35
|
+
top = @top_point + height - bottom - @trident_config[:delta_height]
|
36
|
+
mid = @top_point + height - bottom * 17 / 20
|
37
|
+
<<~SVG
|
38
|
+
#{center}, #{top}
|
39
|
+
#{center + @trident_config[:width] / 2}, #{mid}
|
40
|
+
#{center - @trident_config[:width] / 2}, #{mid}
|
41
|
+
#{center}, #{top}
|
42
|
+
SVG
|
43
|
+
end
|
41
44
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
45
|
+
def circle_hash
|
46
|
+
center = @trident_config[:center_point]
|
47
|
+
<<~SVG
|
48
|
+
<circle cx="#{center}" cy="#{@top_point + @circle_from_top}" r="#{@trident_config[:width] / 2}" fill="#{@color_code}" mask="url(#circle-mask)" />
|
49
|
+
<mask id="circle-mask">
|
50
|
+
<g>
|
51
|
+
<rect x="0" y="0" width="#{USPSFlags::Config::BASE_FLY}" height="#{USPSFlags::Config::BASE_FLY}" fill="#FFFFFF" />
|
52
|
+
<circle cx="#{center}" cy="#{@top_point + @circle_from_top}" r="#{@trident_config[:width] / 2 - @trident_config[:bar_width]}" fill="#000000" />
|
53
|
+
</g>
|
54
|
+
</mask>
|
55
|
+
<mask id="circle-mask-for-main-spike">
|
56
|
+
<g transform="scale(1.05) translate(-@trident_config[:br_width], -@trident_config[:br_width]/2)">
|
57
|
+
<rect x="0" y="0" width="#{USPSFlags::Config::BASE_FLY}" height="#{USPSFlags::Config::BASE_FLY}" fill="#FFFFFF" />
|
58
|
+
<circle cx="#{center}" cy="#{@top_point + @circle_from_top}" r="#{@trident_config[:width] / 2 - @trident_config[:bar_width]}" fill="#000000" />
|
59
|
+
</g>
|
60
|
+
</mask>
|
61
|
+
SVG
|
62
|
+
end
|
60
63
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
64
|
+
def standard_hash
|
65
|
+
x_pos = (@trident_config[:center_point] - @trident_config[:hash_width] / 2)
|
66
|
+
svg = "<path d=\"M #{x_pos} #{(@top_point + @hash_from_top)}\n"
|
67
|
+
@lower_hash.each { |x, y| svg << "l #{x} #{y}\n" }
|
68
|
+
svg << "\" fill=\"#{@color_code}\" />\n"
|
65
69
|
|
66
|
-
|
70
|
+
svg
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
67
74
|
end
|
68
75
|
end
|
69
76
|
end
|
@@ -4,36 +4,42 @@
|
|
4
4
|
#
|
5
5
|
# This class should never need to be called directly.
|
6
6
|
# @private
|
7
|
-
class USPSFlags
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
class USPSFlags
|
8
|
+
class Core
|
9
|
+
module Icons
|
10
|
+
class Trumpet
|
11
|
+
def initialize(type: :s)
|
12
|
+
@color = type == :n ? USPSFlags::Config::BLUE : USPSFlags::Config::RED
|
13
|
+
@count = type == :s ? 1 : 2
|
14
|
+
end
|
12
15
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
16
|
+
def svg
|
17
|
+
if @count == 2
|
18
|
+
<<~SVG
|
19
|
+
<g transform="translate(1100,-600)"><g transform="rotate(45)">#{trumpet}</g></g>
|
20
|
+
<g transform="translate(-300,1100)"><g transform="rotate(-45)">#{trumpet}</g></g>
|
21
|
+
SVG
|
22
|
+
else
|
23
|
+
trumpet
|
24
|
+
end
|
25
|
+
end
|
23
26
|
|
24
|
-
private
|
27
|
+
private
|
25
28
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
29
|
+
def trumpet
|
30
|
+
<<~SVG
|
31
|
+
<path d="M1139.9999958974363,480.00000000000006
|
32
|
+
c-44.15476410256406,-6.5910035897434796,-116.84910635897381,-20.41065056410247,-114.87185282051291,-47.179479230769175
|
33
|
+
c4.028547230769618,-65.74318056410249,367.85434817948703,-61.23149248717954,369.23087128205134,-2.051282051282101
|
34
|
+
c-4.777324897435847,30.46226187179502,-55.229016102563946,41.4042592820515,-114.87183128205106,49.230751282051415
|
35
|
+
c20.35720646153868,375.0059741538461,27.19074102564059,490.4570292564102,53.33331769230767,1003.0769130769231
|
36
|
+
c87.68105358974367,28.51730900000007,159.61708317948705,60.951568051282266,231.79492435897487,145.6410723076924
|
37
|
+
c-309.3606388717951,-1.4643622051280545,-403.6171671794875,0.35877820512882863,-709.7436194871801,-2.0512861538461493
|
38
|
+
c106.18124384615362,-96.7690410256414,99.88082358974339,-91.1716969230772,229.74356769230792,-141.53843102564088"
|
39
|
+
fill="#{@color}" />
|
40
|
+
SVG
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
38
44
|
end
|
39
45
|
end
|
@@ -4,51 +4,55 @@
|
|
4
4
|
#
|
5
5
|
# This class should never need to be called directly.
|
6
6
|
# @private
|
7
|
-
class USPSFlags
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
7
|
+
class USPSFlags
|
8
|
+
class Core
|
9
|
+
class Pennant
|
10
|
+
def initialize(type: :cruise)
|
11
|
+
@type = type.to_s.upcase
|
12
|
+
@fly = USPSFlags::Config::BASE_FLY
|
13
|
+
@hoist = USPSFlags::Config::BASE_HOIST / 4
|
14
|
+
end
|
15
|
+
|
16
|
+
def svg
|
17
|
+
return oic if @type == 'OIC'
|
18
|
+
return cruise if @type == 'CRUISE'
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def oic
|
24
|
+
<<~SVG
|
25
|
+
<polyline fill="#{USPSFlags::Config::BLUE}" points="0 0 #{USPSFlags::Config::BASE_FLY} #{USPSFlags::Config::BASE_HOIST / 8} 0 #{USPSFlags::Config::BASE_HOIST / 4}" />
|
26
|
+
SVG
|
27
|
+
end
|
28
|
+
|
29
|
+
def cruise
|
30
|
+
<<~SVG
|
31
|
+
#{cruise_red}#{cruise_white}#{cruise_blue}
|
32
|
+
<path d="M 0 0 l #{@fly} #{@hoist / 2} l -#{@fly} #{@hoist / 2}" fill="none" stroke="#000000" stroke-width="2" />
|
33
|
+
<g transform=\"translate(385, 340)\">
|
34
|
+
#{USPSFlags::Core.star}
|
35
|
+
</g>"
|
36
|
+
SVG
|
37
|
+
end
|
38
|
+
|
39
|
+
def cruise_red
|
40
|
+
<<~SVG
|
41
|
+
<path d="M 0 0 l #{@fly * 10 / 36} #{@hoist * 5 / 36} l 0 #{@hoist * 26 / 36} l -#{@fly * 10 / 36} #{@hoist * 5 / 36}" fill="#{USPSFlags::Config::RED}" />
|
42
|
+
SVG
|
43
|
+
end
|
44
|
+
|
45
|
+
def cruise_white
|
46
|
+
<<~SVG
|
47
|
+
<path d="M #{@fly * 10 / 36} #{@hoist * 5 / 36} l #{@fly * 11 / 36} #{@hoist * 5.5 / 36} l 0 #{@hoist * 15 / 36} l -#{@fly * 11 / 36} #{@hoist * 5.5 / 36}" fill="#FFFFFF" />
|
48
|
+
SVG
|
49
|
+
end
|
50
|
+
|
51
|
+
def cruise_blue
|
52
|
+
<<~SVG
|
53
|
+
<path d="M #{@fly * 21 / 36} #{@hoist * 10.5 / 36} l #{@fly * 15 / 36} #{@hoist * 7.5 / 36} l -#{@fly * 15 / 36} #{@hoist * 7.5 / 36}" fill="#{USPSFlags::Config::BLUE}" />
|
54
|
+
SVG
|
55
|
+
end
|
56
|
+
end
|
53
57
|
end
|
54
58
|
end
|
@@ -4,137 +4,141 @@
|
|
4
4
|
#
|
5
5
|
# This class should never need to be called directly.
|
6
6
|
# @private
|
7
|
-
class USPSFlags
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
7
|
+
class USPSFlags
|
8
|
+
class Core
|
9
|
+
class TridentSpec
|
10
|
+
SA = USPSFlags::Helpers::SpecArrows
|
11
|
+
BF = USPSFlags::Config::BASE_FLY
|
12
|
+
BH = USPSFlags::Config::BASE_HOIST
|
13
|
+
|
14
|
+
def initialize(fly: 24, unit: 'in', scaled_border: false)
|
15
|
+
@config = USPSFlags.configuration.trident
|
16
|
+
@scaled_border = scaled_border
|
17
|
+
configure_sizes(fly)
|
18
|
+
configure_labels(unit)
|
19
|
+
end
|
20
|
+
|
21
|
+
def svg
|
22
|
+
svg = spec_header
|
23
|
+
svg << add_short_trident
|
24
|
+
svg << add_delta_trident
|
25
|
+
svg << add_national_tridents
|
26
|
+
|
27
|
+
svg
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def box_left
|
33
|
+
(BF * 27 / 32) / 2
|
34
|
+
end
|
35
|
+
|
36
|
+
def box_right
|
37
|
+
(BF * 37 / 32) / 2
|
38
|
+
end
|
39
|
+
|
40
|
+
def add_short_trident
|
41
|
+
box_top = BH / 4
|
42
|
+
box_bottom = BH * 3 / 4
|
43
|
+
add_trident(:Short, box_top, box_bottom, box_left, box_right)
|
44
|
+
end
|
45
|
+
|
46
|
+
def add_delta_trident
|
47
|
+
box_top = BH * 3 / 16
|
48
|
+
box_bottom = BH * 13 / 16
|
49
|
+
add_trident(:Delta, box_top, box_bottom, box_left, box_right)
|
50
|
+
end
|
51
|
+
|
52
|
+
def add_national_tridents
|
53
|
+
box_top = BH / 8
|
54
|
+
box_bottom = BH * 7 / 8
|
55
|
+
add_trident(:Circle, box_top, box_bottom, box_left, box_right) +
|
56
|
+
add_trident(:Long, box_top, box_bottom, box_left, box_right)
|
57
|
+
end
|
58
|
+
|
59
|
+
def configure_sizes(fly)
|
60
|
+
@fly = Rational(fly)
|
61
|
+
get_hoist_from_fly(@fly)
|
62
|
+
configure_hoist_fraction
|
63
|
+
configure_fly_fraction
|
64
|
+
end
|
65
|
+
|
66
|
+
def get_hoist_from_fly(fly)
|
67
|
+
hoist = (fly * Rational(2, 3))
|
68
|
+
@hoist = if hoist == hoist.to_i
|
69
|
+
hoist.to_i
|
70
|
+
else
|
71
|
+
hoist
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def configure_hoist_fraction
|
76
|
+
@hoist_fraction = ''
|
77
|
+
if @hoist == @hoist.to_i
|
78
|
+
@hoist = @hoist.to_i
|
79
|
+
else
|
80
|
+
@hoist, @hoist_fraction = USPSFlags::Rational.new(@hoist).to_simplified_a
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def configure_fly_fraction
|
85
|
+
@fly_fraction = ''
|
86
|
+
if @fly == @fly.to_i
|
87
|
+
@fly = @fly.to_i
|
88
|
+
else
|
89
|
+
@fly, @fly_fraction = USPSFlags::Rational.new(@fly).to_simplified_a
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def configure_labels(unit)
|
94
|
+
@label_font_size = if Math.sqrt(@fly) > 24
|
95
|
+
BF * Math.log(24, Math.sqrt(@fly)) / 60
|
96
|
+
else
|
97
|
+
BF / 60
|
98
|
+
end
|
99
|
+
|
100
|
+
@unit_text = unit.nil? ? '' : unit.to_s
|
101
|
+
@unit = unit
|
102
|
+
|
103
|
+
configure_barb_label
|
104
|
+
end
|
105
|
+
|
106
|
+
def configure_barb_label
|
107
|
+
barb_label = Rational(@config[:main_point_barb]) * @fly / BF
|
108
|
+
@barb_label = if barb_label == barb_label.to_i
|
109
|
+
"#{barb_label.to_i}#{@unit_text}"
|
110
|
+
else
|
111
|
+
"#{USPSFlags::Rational.new(barb_label).to_simplified_s}#{@unit_text}"
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def spec_header
|
116
|
+
USPSFlags::Core::TridentSpecs::Header.new(
|
117
|
+
fly: @fly, fly_fraction: @fly_fraction, hoist: @hoist, hoist_fraction: @hoist_fraction,
|
118
|
+
unit_text: @unit_text, scaled_border: @scaled_border
|
119
|
+
).p
|
120
|
+
end
|
121
|
+
|
122
|
+
def add_trident(type, box_top, box_bottom, box_left, box_right)
|
123
|
+
sym = { Short: :s, Delta: :d, Circle: :stf, Long: :n }[type]
|
124
|
+
|
125
|
+
Object.const_get("USPSFlags::Core::TridentSpecs::#{type}").new(
|
126
|
+
bt: box_top, bb: box_bottom, bl: box_left, br: box_right,
|
127
|
+
fly: @fly, unit: @unit, heading: heading(sym), config: @config
|
128
|
+
).p
|
129
|
+
end
|
130
|
+
|
131
|
+
def heading(type_sym)
|
132
|
+
type, description = {
|
133
|
+
s: ['Short', 'Squadron Officers'], d: ['Delta', 'District Officers'],
|
134
|
+
stf: ['Circle', 'Staff Commanders Only'], n: ['Long', 'National Officers']
|
135
|
+
}[type_sym]
|
136
|
+
|
137
|
+
<<~SVG
|
138
|
+
<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>
|
139
|
+
<text x="#{BF / 2}" y="#{BH * 5 / 80}" font-family="sans-serif" font-size="#{BH / 40}px" fill="#BF0D3E" text-anchor="middle">#{description}</text>
|
140
|
+
SVG
|
141
|
+
end
|
110
142
|
end
|
111
143
|
end
|
112
|
-
|
113
|
-
def spec_header
|
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
|
118
|
-
end
|
119
|
-
|
120
|
-
def add_trident(type, box_top, box_bottom, box_left, box_right)
|
121
|
-
sym = { Short: :s, Delta: :d, Circle: :stf, Long: :n }[type]
|
122
|
-
|
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
|
127
|
-
end
|
128
|
-
|
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]
|
134
|
-
|
135
|
-
<<~SVG
|
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>
|
138
|
-
SVG
|
139
|
-
end
|
140
144
|
end
|