usps_flags 0.1.22 → 0.1.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/Gemfile.lock +1 -1
- data/README.md +2 -1
- data/lib/usps_flags/core/anchor.rb +64 -0
- data/lib/usps_flags/core/binoculars.rb +22 -0
- data/lib/usps_flags/core/ensign.rb +53 -0
- data/lib/usps_flags/core/field.rb +78 -0
- data/lib/usps_flags/core/footer.rb +11 -0
- data/lib/usps_flags/core/headers.rb +60 -0
- data/lib/usps_flags/core/lighthouse.rb +29 -0
- data/lib/usps_flags/core/pennant.rb +46 -0
- data/lib/usps_flags/core/star.rb +30 -0
- data/lib/usps_flags/core/trident.rb +166 -0
- data/lib/usps_flags/core/trident_spec.rb +175 -0
- data/lib/usps_flags/core/trumpet.rb +23 -0
- data/lib/usps_flags/core/us.rb +56 -0
- data/lib/usps_flags/core/wheel.rb +204 -0
- data/lib/usps_flags/core.rb +17 -884
- data/lib/usps_flags.rb +6 -0
- data/usps_flags.gemspec +2 -2
- data.tar.gz.sig +0 -0
- metadata +16 -2
- metadata.gz.sig +0 -0
@@ -0,0 +1,175 @@
|
|
1
|
+
# Core SVG data for the trident specification sheet.
|
2
|
+
#
|
3
|
+
# This class should never need to be called directly.
|
4
|
+
# @private
|
5
|
+
class USPSFlags::Core::TridentSpec
|
6
|
+
def initialize(fly: 24, unit: "in")
|
7
|
+
@trident_config = USPSFlags::Config.trident
|
8
|
+
hoist = (fly*Rational(2,3))
|
9
|
+
@hoist = hoist == hoist.to_i ? hoist.to_i : hoist
|
10
|
+
|
11
|
+
@fly_fraction = ""
|
12
|
+
@hoist_fraction = ""
|
13
|
+
if fly == fly.to_i
|
14
|
+
@fly = fly.to_i
|
15
|
+
else
|
16
|
+
@fly, @fly_fraction = fly.to_simplified_a
|
17
|
+
end
|
18
|
+
if hoist == hoist.to_i
|
19
|
+
@hoist = hoist.to_i
|
20
|
+
else
|
21
|
+
@hoist, @hoist_fraction = hoist.to_simplified_a
|
22
|
+
end
|
23
|
+
|
24
|
+
@label_font_size = if Math.sqrt(@fly) > 24
|
25
|
+
USPSFlags::Config::BASE_FLY * Math.log(24, Math.sqrt(@fly)) / 60
|
26
|
+
else
|
27
|
+
USPSFlags::Config::BASE_FLY / 60
|
28
|
+
end
|
29
|
+
|
30
|
+
@unit_text = unit.nil? ? "" : "#{unit}"
|
31
|
+
@unit = unit
|
32
|
+
|
33
|
+
barb_label = Rational(@trident_config[:main_point_barb]) * @fly / USPSFlags::Config::BASE_FLY
|
34
|
+
barb_label = barb_label == barb_label.to_i ? barb_label.to_i : barb_label.to_simplified_s
|
35
|
+
@barb_label = "#{barb_label}#{@unit_text}"
|
36
|
+
end
|
37
|
+
|
38
|
+
def svg
|
39
|
+
svg = ""
|
40
|
+
|
41
|
+
svg << <<~SVG
|
42
|
+
<!-- Field -->
|
43
|
+
#{USPSFlags::Core.field}
|
44
|
+
|
45
|
+
<!-- Specification Heading Information -->
|
46
|
+
<g>
|
47
|
+
<style><![CDATA[tspan.heading{font-size: 50%;}]]></style>
|
48
|
+
<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>
|
49
|
+
</g>
|
50
|
+
<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>
|
51
|
+
<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>
|
52
|
+
<g>
|
53
|
+
<style><![CDATA[tspan.title{font-size: #{USPSFlags::Config::FRACTION_SCALE*9/10}%;}]]></style>
|
54
|
+
<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>
|
55
|
+
</g>
|
56
|
+
<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>
|
57
|
+
SVG
|
58
|
+
|
59
|
+
box_width = USPSFlags::Config::BASE_FLY*5/32
|
60
|
+
box_left = (USPSFlags::Config::BASE_FLY*27/32)/2
|
61
|
+
box_right = (USPSFlags::Config::BASE_FLY*37/32)/2
|
62
|
+
box_top = USPSFlags::Config::BASE_HOIST/4
|
63
|
+
box_bottom = USPSFlags::Config::BASE_HOIST*3/4
|
64
|
+
|
65
|
+
svg << <<~SVG
|
66
|
+
<!-- Short Trident -->
|
67
|
+
<g transform="translate(-#{USPSFlags::Config::BASE_FLY*14/80},#{USPSFlags::Config::BASE_HOIST*9/32})"><g transform="scale(0.7)">
|
68
|
+
<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">Short</text>
|
69
|
+
<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">Squadron Officers</text>
|
70
|
+
|
71
|
+
#{USPSFlags::Core::Trident.new(:s).svg}
|
72
|
+
|
73
|
+
<!-- Boundary box -->
|
74
|
+
<rect x="#{box_left}" y="#{box_top}" width="#{box_width}" height="#{USPSFlags::Config::BASE_HOIST/2}" stroke="#666666" stroke-width="#{USPSFlags::Config::BASE_FLY/600}" stroke-dasharray="15, 15" fill="none" />
|
75
|
+
|
76
|
+
<!-- Right -->
|
77
|
+
#{USPSFlags::Helpers.v_arrow(box_right+@trident_config[:bar_width], box_top, box_top+@trident_config[:bar_width], box_right, box_right, fly: @fly, unit: @unit, font_size: @label_font_size)} <!-- Side spike top gap -->
|
78
|
+
#{USPSFlags::Helpers.v_arrow(box_right+@trident_config[:bar_width], box_top+@trident_config[:bar_width], box_top+@trident_config[:bar_width]*2+@trident_config[:point_height]+@trident_config[:side_spike_height], nil, box_right, fly: @fly, unit: @unit, font_size: @label_font_size)} <!-- Top gap to hash gap -->
|
79
|
+
#{USPSFlags::Helpers.v_arrow(box_right+@trident_config[:bar_width], box_top+@trident_config[:bar_width]*2+@trident_config[:point_height]+@trident_config[:side_spike_height], box_top+@trident_config[:bar_width]*3+@trident_config[:point_height]+@trident_config[:side_spike_height], nil, @trident_config[:center_point]+@trident_config[:hash_width]/2, fly: @fly, unit: @unit, font_size: @label_font_size)} <!-- Crossbar to hash gap -->
|
80
|
+
|
81
|
+
#{USPSFlags::Helpers.v_arrow(box_right+@trident_config[:bar_width], box_top+@trident_config[:bar_width]*3+@trident_config[:point_height]+@trident_config[:side_spike_height], box_top+@trident_config[:bar_width]*4+@trident_config[:point_height]+@trident_config[:side_spike_height], nil, @trident_config[:center_point]+@trident_config[:hash_width]/2, fly: @fly, unit: @unit, font_size: @label_font_size)} <!-- Hash -->
|
82
|
+
#{USPSFlags::Helpers.v_arrow(box_right+@trident_config[:bar_width], box_top+@trident_config[:bar_width]*4+@trident_config[:point_height]+@trident_config[:side_spike_height], box_bottom, nil, box_right, fly: @fly, unit: @unit, font_size: @label_font_size)} <!-- Hash to bottom -->
|
83
|
+
|
84
|
+
<!-- Left -->
|
85
|
+
#{USPSFlags::Helpers.v_arrow(box_left-@trident_config[:bar_width]*5.25, box_top, box_bottom, box_left, box_left, fly: @fly, unit: @unit, font_size: @label_font_size)} <!-- Boundary height -->
|
86
|
+
#{USPSFlags::Helpers.v_arrow(box_left-@trident_config[:bar_width]*0.75, box_top, box_top+@trident_config[:point_height], nil, @trident_config[:center_point]-@trident_config[:bar_width], fly: @fly, unit: @unit, label_offset: -USPSFlags::Config::BASE_FLY/26, label_offset_y: -USPSFlags::Config::BASE_FLY/100, font_size: @label_font_size, label_align: "middle")} <!-- Main point height -->
|
87
|
+
#{USPSFlags::Helpers.v_arrow(box_left-@trident_config[:bar_width]*1.5, box_top+@trident_config[:bar_width], box_top+@trident_config[:bar_width]+@trident_config[:point_height], box_left, box_left+@trident_config[:bar_width], fly: @fly, unit: @unit, label_offset: -USPSFlags::Config::BASE_FLY/24, font_size: @label_font_size, label_align: "middle")} <!-- Side point height -->
|
88
|
+
|
89
|
+
<!-- Bottom -->
|
90
|
+
#{USPSFlags::Helpers.h_arrow(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, font_size: @label_font_size)} <!-- Bar width -->
|
91
|
+
#{USPSFlags::Helpers.h_arrow(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[:point_height]+@trident_config[:side_spike_height], box_top+@trident_config[:bar_width]*4+@trident_config[:point_height]+@trident_config[:side_spike_height], fly: @fly, unit: @unit, font_size: @label_font_size)} <!-- Hash width -->
|
92
|
+
#{USPSFlags::Helpers.h_arrow(box_bottom+@trident_config[:bar_width]*4, box_left, box_right, box_bottom, box_bottom, fly: @fly, unit: @unit, font_size: @label_font_size)} <!-- Boundary width -->
|
93
|
+
|
94
|
+
<!-- Top -->
|
95
|
+
#{USPSFlags::Helpers.h_arrow(box_top-@trident_config[:bar_width], box_left, box_left+@trident_config[:bar_width]*3/2, box_top, box_top+@trident_config[:bar_width]+@trident_config[:point_height], fly: @fly, unit: @unit, label_offset: -USPSFlags::Config::BASE_FLY/60, font_size: @label_font_size)} <!-- Side point width -->
|
96
|
+
#{USPSFlags::Helpers.h_arrow(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[:point_height], box_top+@trident_config[:point_height], fly: @fly, unit: @unit, label_offset: -USPSFlags::Config::BASE_FLY/60, font_size: @label_font_size)} <!-- Main point width -->
|
97
|
+
|
98
|
+
<!-- Overlay -->
|
99
|
+
<!-- Main point barb -->
|
100
|
+
<line x1="#{@trident_config[:center_point]+@trident_config[:bar_width]/2}" y1="#{box_top+@trident_config[:point_height]-@trident_config[:main_point_barb]}" x2="#{@trident_config[:center_point]+@trident_config[:bar_width]*3/2}" y2="#{box_top+@trident_config[:point_height]-@trident_config[:main_point_barb]*5}" stroke="#666666" stroke-width="2" stroke-dasharray="5, 5" />
|
101
|
+
<line x1="#{@trident_config[:center_point]+@trident_config[:bar_width]/2}" y1="#{box_top+@trident_config[:point_height]}" x2="#{@trident_config[:center_point]+@trident_config[:bar_width]*3/2}" y2="#{box_top+@trident_config[:point_height]}" stroke="#666666" stroke-width="2" stroke-dasharray="5, 5" />
|
102
|
+
<text x="#{@trident_config[:center_point]+@trident_config[:bar_width]*5/4}" y="#{box_top+@trident_config[: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>
|
103
|
+
</g></g>
|
104
|
+
SVG
|
105
|
+
|
106
|
+
box_top = USPSFlags::Config::BASE_HOIST*3/16
|
107
|
+
box_bottom = USPSFlags::Config::BASE_HOIST*13/16
|
108
|
+
|
109
|
+
svg << <<~SVG
|
110
|
+
<!-- Delta Trident -->
|
111
|
+
<g transform="translate(#{USPSFlags::Config::BASE_FLY*5/80},#{USPSFlags::Config::BASE_HOIST*9/32})"><g transform="scale(0.7)">
|
112
|
+
<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">Delta</text>
|
113
|
+
<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">District Officers</text>
|
114
|
+
|
115
|
+
#{USPSFlags::Core::Trident.new(:d).svg}
|
116
|
+
|
117
|
+
<!-- Boundary box -->
|
118
|
+
<rect x="#{box_left}" y="#{box_top}" width="#{box_width}" height="#{USPSFlags::Config::BASE_HOIST*5/8}" stroke="#666666" stroke-width="#{USPSFlags::Config::BASE_FLY/600}" stroke-dasharray="15, 15" fill="none" />
|
119
|
+
|
120
|
+
<!-- Right -->
|
121
|
+
#{USPSFlags::Helpers.v_arrow(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, font_size: @label_font_size)} <!-- Delta gap height -->
|
122
|
+
#{USPSFlags::Helpers.v_arrow(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, font_size: @label_font_size)} <!-- Delta width -->
|
123
|
+
#{USPSFlags::Helpers.v_arrow(box_right+@trident_config[:bar_width], box_bottom-@trident_config[:delta_from_bottom], box_bottom, nil, box_right, fly: @fly, unit: @unit, font_size: @label_font_size)} <!-- Delta to bottom -->
|
124
|
+
|
125
|
+
<!-- Left -->
|
126
|
+
#{USPSFlags::Helpers.v_arrow(box_left-@trident_config[:bar_width]*1.5, box_top, box_bottom, box_left, box_left, fly: @fly, unit: @unit, label_offset: -USPSFlags::Config::BASE_FLY/30, label_offset_y: -USPSFlags::Config::BASE_FLY*2/11, font_size: @label_font_size, label_align: "middle")} <!-- Boundary height -->
|
127
|
+
</g></g>
|
128
|
+
SVG
|
129
|
+
|
130
|
+
box_top = USPSFlags::Config::BASE_HOIST/8
|
131
|
+
box_bottom = USPSFlags::Config::BASE_HOIST*7/8
|
132
|
+
|
133
|
+
svg << <<~SVG
|
134
|
+
<!-- Circle Trident -->
|
135
|
+
<g transform="translate(#{USPSFlags::Config::BASE_FLY*23/80},#{USPSFlags::Config::BASE_HOIST*9/32})"><g transform="scale(0.7)">
|
136
|
+
<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">Circle</text>
|
137
|
+
<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">Staff Commanders Only</text>
|
138
|
+
|
139
|
+
#{USPSFlags::Core::Trident.new(:stf).svg}
|
140
|
+
|
141
|
+
<!-- Boundary box -->
|
142
|
+
<rect x="#{box_left}" y="#{box_top}" width="#{box_width}" height="#{USPSFlags::Config::BASE_HOIST*3/4}" stroke="#666666" stroke-width="#{USPSFlags::Config::BASE_FLY/600}" stroke-dasharray="15, 15" fill="none" />
|
143
|
+
|
144
|
+
<!-- Right -->
|
145
|
+
#{USPSFlags::Helpers.v_arrow(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, font_size: @label_font_size)} <!-- Inner circle diameter -->
|
146
|
+
#{USPSFlags::Helpers.v_arrow(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, font_size: @label_font_size)} <!-- Outer circle diameter -->
|
147
|
+
#{USPSFlags::Helpers.v_arrow(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, font_size: @label_font_size)} <!-- Circle to bottom -->
|
148
|
+
|
149
|
+
<!-- Left -->
|
150
|
+
#{USPSFlags::Helpers.v_arrow(box_left-@trident_config[:bar_width]*1.5, box_top, box_bottom, box_left, box_left, fly: @fly, unit: @unit, label_offset: -USPSFlags::Config::BASE_FLY/30, label_offset_y: -USPSFlags::Config::BASE_FLY/4.5, font_size: @label_font_size, label_align: "middle")} <!-- Boundary height -->
|
151
|
+
</g></g>
|
152
|
+
SVG
|
153
|
+
|
154
|
+
svg << <<~SVG
|
155
|
+
<!-- Long Trident -->
|
156
|
+
<g transform="translate(#{USPSFlags::Config::BASE_FLY*40/80},#{USPSFlags::Config::BASE_HOIST*9/32})"><g transform="scale(0.7)">
|
157
|
+
<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">Long</text>
|
158
|
+
<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">National Officers</text>
|
159
|
+
|
160
|
+
#{USPSFlags::Core::Trident.new(:n).svg}
|
161
|
+
|
162
|
+
<!-- Boundary box -->
|
163
|
+
<rect x="#{box_left}" y="#{box_top}" width="#{box_width}" height="#{USPSFlags::Config::BASE_HOIST*3/4}" stroke="#666666" stroke-width="#{USPSFlags::Config::BASE_FLY/600}" stroke-dasharray="15, 15" fill="none" />
|
164
|
+
|
165
|
+
<!-- Right -->
|
166
|
+
#{USPSFlags::Helpers.v_arrow(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, font_size: @label_font_size)} <!-- Hash to bottom -->
|
167
|
+
|
168
|
+
<!-- Left -->
|
169
|
+
#{USPSFlags::Helpers.v_arrow(box_left-@trident_config[:bar_width]*1.5, box_top, box_bottom, box_left, box_left, fly: @fly, unit: @unit, label_offset: -USPSFlags::Config::BASE_FLY/30, label_offset_y: -USPSFlags::Config::BASE_FLY/4.5, font_size: @label_font_size, label_align: "middle")} <!-- Boundary height -->
|
170
|
+
</g></g>
|
171
|
+
SVG
|
172
|
+
|
173
|
+
svg
|
174
|
+
end
|
175
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Core SVG data for the trumpet insignia.
|
2
|
+
#
|
3
|
+
# This class should never need to be called directly.
|
4
|
+
# @private
|
5
|
+
class USPSFlags::Core::Trumpet
|
6
|
+
def initialize(type: :s)
|
7
|
+
@color = type == :n ? USPSFlags::Config::BLUE : USPSFlags::Config::RED
|
8
|
+
@count = type == :s ? 1 : 2
|
9
|
+
end
|
10
|
+
|
11
|
+
def svg
|
12
|
+
trumpet = "<path d=\"M1139.9999958974363,480.00000000000006c-44.15476410256406,-6.5910035897434796,-116.84910635897381,-20.41065056410247,-114.87185282051291,-47.179479230769175c4.028547230769618,-65.74318056410249,367.85434817948703,-61.23149248717954,369.23087128205134,-2.051282051282101c-4.777324897435847,30.46226187179502,-55.229016102563946,41.4042592820515,-114.87183128205106,49.230751282051415c20.35720646153868,375.0059741538461,27.19074102564059,490.4570292564102,53.33331769230767,1003.0769130769231c87.68105358974367,28.51730900000007,159.61708317948705,60.951568051282266,231.79492435897487,145.6410723076924c-309.3606388717951,-1.4643622051280545,-403.6171671794875,0.35877820512882863,-709.7436194871801,-2.0512861538461493c106.18124384615362,-96.7690410256414,99.88082358974339,-91.1716969230772,229.74356769230792,-141.53843102564088\" fill=\"#{color}\" />"
|
13
|
+
|
14
|
+
if @count == 2
|
15
|
+
<<~SVG
|
16
|
+
<g transform="translate(1100,-600)"><g transform="rotate(45)">#{trumpet}</g></g>
|
17
|
+
<g transform="translate(-300,1100)"><g transform="rotate(-45)">#{trumpet}</g></g>
|
18
|
+
SVG
|
19
|
+
else
|
20
|
+
trumpet
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# Core SVG data for the US Ensign.
|
2
|
+
#
|
3
|
+
# This class should never need to be called directly.
|
4
|
+
# @private
|
5
|
+
class USPSFlags::Core::US
|
6
|
+
def svg
|
7
|
+
base_hoist = 2000.to_f
|
8
|
+
base_fly = base_hoist*1.91
|
9
|
+
|
10
|
+
canton_hoist = base_hoist*7/13
|
11
|
+
canton_fly = canton_hoist*Math.sqrt(2)
|
12
|
+
|
13
|
+
star_offset = 20 # Half of scaled star height
|
14
|
+
|
15
|
+
svg = ""
|
16
|
+
svg << <<~SVG
|
17
|
+
<rect x="0" y="0" width="#{base_fly}" height="#{base_hoist/13}" fill="#{USPSFlags::Config::RED}" />
|
18
|
+
<rect x="0" y="#{base_hoist*1/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#FFFFFF" />
|
19
|
+
<rect x="0" y="#{base_hoist*2/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#{USPSFlags::Config::RED}" />
|
20
|
+
<rect x="0" y="#{base_hoist*3/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#FFFFFF" />
|
21
|
+
<rect x="0" y="#{base_hoist*4/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#{USPSFlags::Config::RED}" />
|
22
|
+
<rect x="0" y="#{base_hoist*5/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#FFFFFF" />
|
23
|
+
<rect x="0" y="#{base_hoist*6/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#{USPSFlags::Config::RED}" />
|
24
|
+
<rect x="0" y="#{base_hoist*7/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#FFFFFF" />
|
25
|
+
<rect x="0" y="#{base_hoist*8/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#{USPSFlags::Config::RED}" />
|
26
|
+
<rect x="0" y="#{base_hoist*9/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#FFFFFF" />
|
27
|
+
<rect x="0" y="#{base_hoist*10/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#{USPSFlags::Config::RED}" />
|
28
|
+
<rect x="0" y="#{base_hoist*11/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#FFFFFF" />
|
29
|
+
<rect x="0" y="#{base_hoist*12/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#{USPSFlags::Config::RED}" />
|
30
|
+
<rect x="0" y="0" width="#{canton_fly}" height="#{canton_hoist}" fill="#{USPSFlags::Config::BLUE}" />
|
31
|
+
SVG
|
32
|
+
|
33
|
+
[1,3,5,7,9].each do |r|
|
34
|
+
[1,3,5,7,9,11].each do |c|
|
35
|
+
svg << <<~SVG
|
36
|
+
<g transform="translate(#{canton_fly*c/12}, #{star_offset+canton_hoist*r/10})"><g transform="scale(0.31)">#{USPSFlags::Core::Star.new.svg}</g></g>
|
37
|
+
SVG
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
[2,4,6,8].each do |r|
|
42
|
+
[2,4,6,8,10].each do |c|
|
43
|
+
svg << <<~SVG
|
44
|
+
<g transform="translate(#{canton_fly*c/12}, #{star_offset+canton_hoist*r/10})"><g transform="scale(0.31)">#{USPSFlags::Core::Star.new.svg}</g></g>
|
45
|
+
SVG
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# star_diameter = base_hoist*4/5/13
|
50
|
+
# svg << <<~SVG
|
51
|
+
# <circle cx="#{canton_fly*6/12}" cy="#{canton_hoist*4/10-5}" r="#{star_diameter/2}" fill="#999999" fill-opacity="0.4" />
|
52
|
+
# SVG
|
53
|
+
|
54
|
+
svg
|
55
|
+
end
|
56
|
+
end
|