usps_flags 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/usps_flags/core.rb +2 -2
- data/lib/usps_flags/core/trident_specs.rb +1 -0
- data/lib/usps_flags/core/trident_specs/build.rb +2 -78
- data/lib/usps_flags/core/trident_specs/build_intersections.rb +118 -0
- data/lib/usps_flags/generate.rb +2 -2
- data/usps_flags.gemspec +2 -2
- metadata +4 -5
- data/lib/usps_flags/core/CC.svg +0 -125
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e50d14a11c735b4f9f42cdf1e900ab1b30613e09316ce57c27ce6453b9d3d5ae
|
4
|
+
data.tar.gz: 59a5f3523c03d5ceb97d7596923ea53c322f8fe9701d23bd5bca1d1d4f7956ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e21147c8d7ce0d667d5a128a39552c1039508aeb58c1f5935a95269f108c15004509d0303234bdfd72373ecc348da6026a2af2cb0f2a6271c179629342e283e0
|
7
|
+
data.tar.gz: 2481de64b0dbe9c5e3d9b09f0f28a7ccd39f83d878dc8db5dbba17c12cc14f89c4e62ac9c3cc1767e20d540a05782bc93eca674c73a6a2b9462b1029146e629e
|
data/Gemfile.lock
CHANGED
data/lib/usps_flags/core.rb
CHANGED
@@ -10,8 +10,8 @@ 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(
|
14
|
-
USPSFlags::Core::TridentSpecs::
|
13
|
+
def self.intersection_spec(scaled_border: false)
|
14
|
+
USPSFlags::Core::TridentSpecs::BuildIntersections.new(scaled_border: scaled_border).svg
|
15
15
|
end
|
16
16
|
|
17
17
|
def self.headers(width: nil, height: nil, pennant: false, scale: nil, title: 'USPS Flag')
|
@@ -24,17 +24,6 @@ class USPSFlags
|
|
24
24
|
svg
|
25
25
|
end
|
26
26
|
|
27
|
-
def intersections
|
28
|
-
# Static labeling
|
29
|
-
@fly = Rational(2048, 5)
|
30
|
-
@unit = ''
|
31
|
-
|
32
|
-
svg = spec_header(no_measurements: true)
|
33
|
-
svg << add_intersections
|
34
|
-
|
35
|
-
svg
|
36
|
-
end
|
37
|
-
|
38
27
|
private
|
39
28
|
|
40
29
|
def box_left
|
@@ -64,71 +53,6 @@ class USPSFlags
|
|
64
53
|
add_trident(:Long, box_top, box_bottom, box_left, box_right)
|
65
54
|
end
|
66
55
|
|
67
|
-
def add_intersections
|
68
|
-
svg = +''
|
69
|
-
|
70
|
-
svg += "<g transform=\"translate(-#{BF * 1 / 16}, #{BH / 4}) scale(0.6)\">"
|
71
|
-
svg += USPSFlags::Core::Tridents.cc(trident_color: :blue)
|
72
|
-
svg += cc_label
|
73
|
-
svg += '</g>'
|
74
|
-
|
75
|
-
svg += "<g transform=\"translate(#{BF * 7 / 16}, #{BH / 4}) scale(0.6)\">"
|
76
|
-
svg += USPSFlags::Core::Tridents.vc(trident_color: :red)
|
77
|
-
svg += vc_label
|
78
|
-
svg += '</g>'
|
79
|
-
|
80
|
-
svg
|
81
|
-
end
|
82
|
-
|
83
|
-
def cc_label
|
84
|
-
offset = BF.to_f * 1 / 32
|
85
|
-
height = BF.to_f * 15 / 64
|
86
|
-
|
87
|
-
small_arrow = SA.vertical(
|
88
|
-
offset, -height / 3, 0,
|
89
|
-
pointer_top: height / 3, pointer_bottom: 0, label_offset: BF / 35,
|
90
|
-
label_offset_y: -BF / 50, label_align: 'middle', fly: @fly, unit: @unit
|
91
|
-
)
|
92
|
-
|
93
|
-
<<~SVG
|
94
|
-
<!-- CC Intersection -->
|
95
|
-
<g transform="translate(#{BF / 2}, #{BH - 200}) rotate(45)">
|
96
|
-
#{big_arrow}
|
97
|
-
#{small_arrow}
|
98
|
-
</g>
|
99
|
-
SVG
|
100
|
-
end
|
101
|
-
|
102
|
-
def vc_label
|
103
|
-
offset = BF.to_f * 1 / 32
|
104
|
-
height = BF.to_f * 15 / 64
|
105
|
-
|
106
|
-
small_arrow = SA.vertical(
|
107
|
-
offset, -height * 15 / 32, 0,
|
108
|
-
pointer_top: height * 15 / 32, pointer_bottom: 0, label_offset: BF / 35,
|
109
|
-
label_offset_y: -BF / 50, label_align: 'middle', fly: @fly, unit: @unit
|
110
|
-
)
|
111
|
-
|
112
|
-
<<~SVG
|
113
|
-
<!-- CC Intersection -->
|
114
|
-
<g transform="translate(#{BF / 2}, #{BH - 200}) rotate(45)">
|
115
|
-
#{big_arrow}
|
116
|
-
#{small_arrow}
|
117
|
-
</g>
|
118
|
-
SVG
|
119
|
-
end
|
120
|
-
|
121
|
-
def big_arrow
|
122
|
-
offset = BF * 1 / 32
|
123
|
-
height = BF * 15 / 64
|
124
|
-
|
125
|
-
SA.vertical(
|
126
|
-
offset * 3, -height, 0,
|
127
|
-
pointer_top: height, pointer_bottom: 0, label_offset: BF / 60,
|
128
|
-
label_offset_y: -BF / 10, label_align: 'left', fly: @fly, unit: @unit
|
129
|
-
)
|
130
|
-
end
|
131
|
-
|
132
56
|
def configure_sizes(fly)
|
133
57
|
@fly = Rational(fly)
|
134
58
|
get_hoist_from_fly(@fly)
|
@@ -185,10 +109,10 @@ class USPSFlags
|
|
185
109
|
end
|
186
110
|
end
|
187
111
|
|
188
|
-
def spec_header
|
112
|
+
def spec_header
|
189
113
|
USPSFlags::Core::TridentSpecs::Header.new(
|
190
114
|
fly: @fly, fly_fraction: @fly_fraction, hoist: @hoist, hoist_fraction: @hoist_fraction,
|
191
|
-
unit_text: @unit_text, scaled_border: @scaled_border
|
115
|
+
unit_text: @unit_text, scaled_border: @scaled_border
|
192
116
|
).p
|
193
117
|
end
|
194
118
|
|
@@ -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
|
data/lib/usps_flags/generate.rb
CHANGED
@@ -110,10 +110,10 @@ class USPSFlags
|
|
110
110
|
# @param [String] outfile The unit to append to all trident measurements.
|
111
111
|
# @param [String] scale The image scale divisor factor.
|
112
112
|
# @return [String] Returns the SVG data.
|
113
|
-
def intersection_spec(outfile: nil,
|
113
|
+
def intersection_spec(outfile: nil, scale: nil, scaled_border: false)
|
114
114
|
svg = +''
|
115
115
|
svg << USPSFlags::Core.headers(scale: scale, title: 'USPS Trident Specifications')
|
116
|
-
svg << USPSFlags::Core.intersection_spec(
|
116
|
+
svg << USPSFlags::Core.intersection_spec(scaled_border: scaled_border)
|
117
117
|
svg << USPSFlags::Core.footer
|
118
118
|
|
119
119
|
USPSFlags::Helpers.output(svg, outfile: outfile)
|
data/usps_flags.gemspec
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'usps_flags'
|
5
|
-
s.version = '0.6.
|
6
|
-
s.date = '2020-08-
|
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.6.
|
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: 2020-08-
|
11
|
+
date: 2020-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: file_utils
|
@@ -194,7 +194,6 @@ files:
|
|
194
194
|
- lib/usps_flags/config.rb
|
195
195
|
- lib/usps_flags/configuration.rb
|
196
196
|
- lib/usps_flags/core.rb
|
197
|
-
- lib/usps_flags/core/CC.svg
|
198
197
|
- lib/usps_flags/core/ensign.rb
|
199
198
|
- lib/usps_flags/core/field.rb
|
200
199
|
- lib/usps_flags/core/footer.rb
|
@@ -211,6 +210,7 @@ files:
|
|
211
210
|
- lib/usps_flags/core/trident_specs.rb
|
212
211
|
- lib/usps_flags/core/trident_specs/base.rb
|
213
212
|
- lib/usps_flags/core/trident_specs/build.rb
|
213
|
+
- lib/usps_flags/core/trident_specs/build_intersections.rb
|
214
214
|
- lib/usps_flags/core/trident_specs/circle.rb
|
215
215
|
- lib/usps_flags/core/trident_specs/delta.rb
|
216
216
|
- lib/usps_flags/core/trident_specs/header.rb
|
@@ -263,8 +263,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
263
263
|
- !ruby/object:Gem::Version
|
264
264
|
version: '0'
|
265
265
|
requirements: []
|
266
|
-
|
267
|
-
rubygems_version: 2.7.6
|
266
|
+
rubygems_version: 3.1.4
|
268
267
|
signing_key:
|
269
268
|
specification_version: 4
|
270
269
|
summary: Flag generator for United States Power Squadrons
|
data/lib/usps_flags/core/CC.svg
DELETED
@@ -1,125 +0,0 @@
|
|
1
|
-
<?xml version="1.0" standalone="no"?>
|
2
|
-
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
|
3
|
-
<svg version="1.0" xmlns="http://www.w3.org/2000/svg" width="1024" height="682" viewBox="-3.072 -4.096 3084.288 2058.24" preserveAspectRatio="xMidYMid meet">
|
4
|
-
<title>CC</title>
|
5
|
-
<metadata>
|
6
|
-
<desc id="created-by">Julian Fiander</desc>
|
7
|
-
<desc id="generated-at">20200216.1756-0500</desc>
|
8
|
-
<desc id="trademark-desc">This image is a registered trademark of United States Power Squadrons.</desc>
|
9
|
-
<desc id="trademark-link">https://www.usps.org/images/secretary/itcom/trademark.pdf</desc>
|
10
|
-
</metadata><path d="M 0 0
|
11
|
-
l 3072 0
|
12
|
-
l 0 2048
|
13
|
-
l -3072 0
|
14
|
-
l 0 -2048 z
|
15
|
-
" fill="#012169" />
|
16
|
-
<g transform="translate(-354, 236)">
|
17
|
-
<g transform="rotate(-45, 1536, 1024)">
|
18
|
-
<path d="M 1536 256
|
19
|
-
l 80 184
|
20
|
-
l -40 -24
|
21
|
-
l 0 1376
|
22
|
-
l -80 0
|
23
|
-
l 0 -1376
|
24
|
-
l -40 24
|
25
|
-
l 80 -184
|
26
|
-
" fill="#FFFFFF" />
|
27
|
-
<path d="M 1296 784
|
28
|
-
l 480 0
|
29
|
-
l 0 80
|
30
|
-
l -480 0
|
31
|
-
l 0 -80
|
32
|
-
" fill="#FFFFFF" />
|
33
|
-
<path d="M 1296 785
|
34
|
-
l 0 -464
|
35
|
-
l 120 168
|
36
|
-
l -40 0
|
37
|
-
l 0 296
|
38
|
-
" fill="#FFFFFF" />
|
39
|
-
<path d="M 1776 785
|
40
|
-
l 0 -464
|
41
|
-
l -120 168
|
42
|
-
l 40 0
|
43
|
-
l 0 296
|
44
|
-
" fill="#FFFFFF" />
|
45
|
-
<path d="M 1400 944
|
46
|
-
l 273 0
|
47
|
-
l 0 80
|
48
|
-
l -273 0
|
49
|
-
l 0 -80
|
50
|
-
" fill="#FFFFFF" />
|
51
|
-
</g>
|
52
|
-
</g>
|
53
|
-
|
54
|
-
<path d="M 1536 256
|
55
|
-
l 80 184
|
56
|
-
l -40 -24
|
57
|
-
l 0 1376
|
58
|
-
l -80 0
|
59
|
-
l 0 -1376
|
60
|
-
l -40 24
|
61
|
-
l 80 -184
|
62
|
-
" fill="#FFFFFF" />
|
63
|
-
<path d="M 1296 784
|
64
|
-
l 480 0
|
65
|
-
l 0 80
|
66
|
-
l -480 0
|
67
|
-
l 0 -80
|
68
|
-
" fill="#FFFFFF" />
|
69
|
-
<path d="M 1296 785
|
70
|
-
l 0 -464
|
71
|
-
l 120 168
|
72
|
-
l -40 0
|
73
|
-
l 0 296
|
74
|
-
" fill="#FFFFFF" />
|
75
|
-
<path d="M 1776 785
|
76
|
-
l 0 -464
|
77
|
-
l -120 168
|
78
|
-
l 40 0
|
79
|
-
l 0 296
|
80
|
-
" fill="#FFFFFF" />
|
81
|
-
<path d="M 1400 944
|
82
|
-
l 273 0
|
83
|
-
l 0 80
|
84
|
-
l -273 0
|
85
|
-
l 0 -80
|
86
|
-
" fill="#FFFFFF" />
|
87
|
-
|
88
|
-
<g transform="translate(354, 236)">
|
89
|
-
<g transform="rotate(45, 1536, 1024)">
|
90
|
-
<path d="M 1536 256
|
91
|
-
l 80 184
|
92
|
-
l -40 -24
|
93
|
-
l 0 1376
|
94
|
-
l -80 0
|
95
|
-
l 0 -1376
|
96
|
-
l -40 24
|
97
|
-
l 80 -184
|
98
|
-
" fill="#FFFFFF" />
|
99
|
-
<path d="M 1296 784
|
100
|
-
l 480 0
|
101
|
-
l 0 80
|
102
|
-
l -480 0
|
103
|
-
l 0 -80
|
104
|
-
" fill="#FFFFFF" />
|
105
|
-
<path d="M 1296 785
|
106
|
-
l 0 -464
|
107
|
-
l 120 168
|
108
|
-
l -40 0
|
109
|
-
l 0 296
|
110
|
-
" fill="#FFFFFF" />
|
111
|
-
<path d="M 1776 785
|
112
|
-
l 0 -464
|
113
|
-
l -120 168
|
114
|
-
l 40 0
|
115
|
-
l 0 296
|
116
|
-
" fill="#FFFFFF" />
|
117
|
-
<path d="M 1400 944
|
118
|
-
l 273 0
|
119
|
-
l 0 80
|
120
|
-
l -273 0
|
121
|
-
l 0 -80
|
122
|
-
" fill="#FFFFFF" />
|
123
|
-
</g>
|
124
|
-
</g>
|
125
|
-
</svg>
|