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
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: false
|
2
|
+
|
3
|
+
# Base module for TridentSpec.
|
4
|
+
#
|
5
|
+
# These methods should never need to be called directly.
|
6
|
+
# @private
|
7
|
+
module USPSFlags::Core::TridentSpecs
|
8
|
+
require 'usps_flags/core/trident_specs/base'
|
9
|
+
require 'usps_flags/core/trident_specs/header'
|
10
|
+
require 'usps_flags/core/trident_specs/short'
|
11
|
+
require 'usps_flags/core/trident_specs/delta'
|
12
|
+
require 'usps_flags/core/trident_specs/long'
|
13
|
+
require 'usps_flags/core/trident_specs/circle'
|
14
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: false
|
2
|
+
|
3
|
+
# Core SVG data for the trident specification sheet.
|
4
|
+
#
|
5
|
+
# This class should never need to be called directly.
|
6
|
+
# @private
|
7
|
+
class USPSFlags::Core::TridentSpecs::Base
|
8
|
+
SA = USPSFlags::Helpers::SpecArrows
|
9
|
+
BF = USPSFlags::Config::BASE_FLY
|
10
|
+
BH = USPSFlags::Config::BASE_HOIST
|
11
|
+
|
12
|
+
def initialize(options = {})
|
13
|
+
@config = options[:config]
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: false
|
2
|
+
|
3
|
+
# Core SVG data for the trident specification sheet.
|
4
|
+
#
|
5
|
+
# This class should never need to be called directly.
|
6
|
+
# @private
|
7
|
+
class USPSFlags::Core::TridentSpecs::Circle < USPSFlags::Core::TridentSpecs::Long
|
8
|
+
def p
|
9
|
+
<<~SVG
|
10
|
+
<!-- Circle Trident -->
|
11
|
+
<g transform="translate(#{BF * 23 / 80},#{BH * 9 / 32})"><g transform="scale(0.7)">
|
12
|
+
#{@heading}
|
13
|
+
|
14
|
+
#{USPSFlags::Core::Icons::Trident.new(:stf).svg}
|
15
|
+
|
16
|
+
#{boundary_box}
|
17
|
+
|
18
|
+
<!-- Right -->
|
19
|
+
#{inner_diameter} <!-- Inner circle diameter -->
|
20
|
+
#{outer_diameter} <!-- Outer circle diameter -->
|
21
|
+
#{circle_to_bottom} <!-- Circle to bottom -->
|
22
|
+
|
23
|
+
#{left_arrow}
|
24
|
+
</g></g>
|
25
|
+
SVG
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def inner_diameter
|
31
|
+
<<~SVG
|
32
|
+
#{SA.vertical(@box_right + @config[:bar_width], @box_top + @config[:crossbar_from_top] + @config[:bar_width] * 2, @box_top + @config[:crossbar_from_top] + @config[:width], @config[:center_point], @config[:center_point], fly: @fly, unit: @unit)} <!-- Inner circle diameter -->
|
33
|
+
SVG
|
34
|
+
end
|
35
|
+
|
36
|
+
def outer_diameter
|
37
|
+
<<~SVG
|
38
|
+
#{SA.vertical(@box_right + @config[:bar_width], @box_top + @config[:crossbar_from_top] + @config[:width], @box_top + @config[:crossbar_from_top] + @config[:bar_width] + @config[:width], nil, outer_box_right, fly: @fly, unit: @unit)} <!-- Outer circle diameter -->
|
39
|
+
SVG
|
40
|
+
end
|
41
|
+
|
42
|
+
def outer_box_right
|
43
|
+
@config[:center_point] + @config[:bar_width] / 2
|
44
|
+
end
|
45
|
+
|
46
|
+
def circle_to_bottom
|
47
|
+
<<~SVG
|
48
|
+
#{SA.vertical(@box_right + @config[:bar_width], @box_top + @config[:crossbar_from_top] + @config[:bar_width] + @config[:width], @box_bottom, nil, @box_right, fly: @fly, unit: @unit)} <!-- Circle to bottom -->
|
49
|
+
SVG
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# frozen_string_literal: false
|
2
|
+
|
3
|
+
# Core SVG data for the trident specification sheet.
|
4
|
+
#
|
5
|
+
# This class should never need to be called directly.
|
6
|
+
# @private
|
7
|
+
class USPSFlags::Core::TridentSpecs::Delta < USPSFlags::Core::TridentSpecs::Base
|
8
|
+
def initialize(options = {})
|
9
|
+
super
|
10
|
+
@box_top = options[:bt]
|
11
|
+
@box_bottom = options[:bb]
|
12
|
+
@box_left = options[:bl]
|
13
|
+
@box_right = options[:br]
|
14
|
+
@fly = options[:fly]
|
15
|
+
@unit = options[:unit]
|
16
|
+
@heading = options[:heading]
|
17
|
+
end
|
18
|
+
|
19
|
+
def p
|
20
|
+
<<~SVG
|
21
|
+
<!-- Delta Trident -->
|
22
|
+
<g transform="translate(#{BF * 5 / 80},#{BH * 9 / 32})"><g transform="scale(0.7)">
|
23
|
+
#{@heading}
|
24
|
+
|
25
|
+
#{USPSFlags::Core::Icons::Trident.new(:d).svg}
|
26
|
+
|
27
|
+
#{boundary_box}
|
28
|
+
|
29
|
+
#{right_arrow}
|
30
|
+
|
31
|
+
#{left_arrow}
|
32
|
+
</g></g>
|
33
|
+
SVG
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def boundary_box
|
39
|
+
<<~SVG
|
40
|
+
<!-- Boundary box -->
|
41
|
+
<rect x="#{@box_left}" y="#{@box_top}" width="#{@box_right - @box_left}" height="#{BH * 5 / 8}" stroke="#666666" stroke-width="#{BF / 600}" stroke-dasharray="15, 15" fill="none" />
|
42
|
+
SVG
|
43
|
+
end
|
44
|
+
|
45
|
+
def right_arrow
|
46
|
+
<<~SVG
|
47
|
+
<!-- Right -->
|
48
|
+
#{gap_height} <!-- Delta gap height -->
|
49
|
+
#{SA.vertical(@box_right + @config[:bar_width], @box_bottom - @config[:delta_from_bottom] - @config[:bar_width], @box_bottom - @config[:delta_from_bottom], nil, @box_right, fly: @fly, unit: @unit)} <!-- Delta width -->
|
50
|
+
#{SA.vertical(@box_right + @config[:bar_width], @box_bottom - @config[:delta_from_bottom], @box_bottom, nil, @box_right, fly: @fly, unit: @unit)} <!-- Delta to bottom -->
|
51
|
+
SVG
|
52
|
+
end
|
53
|
+
|
54
|
+
def gap_height
|
55
|
+
SA.vertical(@box_right + @config[:bar_width], gap_height_top, @box_bottom - @config[:delta_from_bottom] - @config[:bar_width], @config[:center_point], @config[:center_point] + @config[:delta_gap_width], fly: @fly, unit: @unit)
|
56
|
+
end
|
57
|
+
|
58
|
+
def gap_height_top
|
59
|
+
@box_bottom - @config[:delta_from_bottom] - @config[:bar_width] - @config[:delta_gap_height]
|
60
|
+
end
|
61
|
+
|
62
|
+
def left_arrow
|
63
|
+
<<~SVG
|
64
|
+
<!-- Left -->
|
65
|
+
#{SA.vertical(@box_left - @config[:bar_width] * 1.5, @box_top, @box_bottom, @box_left, @box_left, label_offset: -BF / 30, label_offset_y: -BF * 2 / 11, label_align: "middle", fly: @fly, unit: @unit)} <!-- Boundary height -->
|
66
|
+
SVG
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: false
|
2
|
+
|
3
|
+
# Core SVG data for the trident specification sheet.
|
4
|
+
#
|
5
|
+
# This class should never need to be called directly.
|
6
|
+
# @private
|
7
|
+
class USPSFlags::Core::TridentSpecs::Header < USPSFlags::Core::TridentSpecs::Base
|
8
|
+
def initialize(options = {})
|
9
|
+
@fly = options[:fly]
|
10
|
+
@fly_fraction = options[:fly_fraction]
|
11
|
+
@hoist = options[:hoist]
|
12
|
+
@hoist_fraction = options[:hoist_fraction]
|
13
|
+
@unit_text = options[:unit_text]
|
14
|
+
@scaled_border = options[:scaled_border]
|
15
|
+
end
|
16
|
+
|
17
|
+
def p
|
18
|
+
<<~SVG
|
19
|
+
#{field}
|
20
|
+
|
21
|
+
#{heading}
|
22
|
+
#{units}
|
23
|
+
SVG
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def field
|
29
|
+
<<~SVG
|
30
|
+
<!-- Field -->
|
31
|
+
#{USPSFlags::Core.field}
|
32
|
+
SVG
|
33
|
+
end
|
34
|
+
|
35
|
+
def heading
|
36
|
+
<<~SVG
|
37
|
+
<!-- Specification Heading Information -->
|
38
|
+
<g>
|
39
|
+
<style><![CDATA[tspan.heading{font-size: 50%;}]]></style>
|
40
|
+
<text x="#{BF / 2}" y="#{BH * 3 / 40}" font-family="sans-serif" font-size="#{BH / 20}px" font-weight="bold" fill="#041E42" text-anchor="middle">United States Power Squadrons<tspan class="heading" dy ="-#{BH / 50}">®</tspan></text>
|
41
|
+
</g>
|
42
|
+
<text x="#{BF / 2}" y="#{BH / 8}" font-family="sans-serif" font-size="#{BH / 30}px" fill="#041E42" text-anchor="middle">Officer Flag Trident Specification</text>
|
43
|
+
<text x="#{BF / 2}" y="#{BH * 2 / 11}" font-family="sans-serif" font-size="#{BH / 40}px" fill="#041E42" text-anchor="middle">All measurements are relative to a field with</text>
|
44
|
+
SVG
|
45
|
+
end
|
46
|
+
|
47
|
+
def units
|
48
|
+
<<~SVG
|
49
|
+
<g>
|
50
|
+
<style><![CDATA[tspan.title{font-size: #{USPSFlags::Config::FRACTION_SCALE * 9 / 10}%;}]]></style>
|
51
|
+
<text x="#{BF / 2}" y="#{BH * 4 / 19}" font-family="sans-serif" font-size="#{BH / 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>
|
52
|
+
</g>
|
53
|
+
<text x="#{BF / 2}" y="#{BH / 4}" font-family="sans-serif" font-size="#{BH / 40}px" fill="#041E42" text-anchor="middle">Measurements not specified are the same as on the short trident.</text>
|
54
|
+
#{scaled_border if @scaled_border}
|
55
|
+
SVG
|
56
|
+
end
|
57
|
+
|
58
|
+
def scaled_border
|
59
|
+
<<~SVG
|
60
|
+
<!-- Flag border scaled to spec trident size -->
|
61
|
+
<rect x="#{BF * 0.41}" y="#{BH * 0.38}" width="#{BF}" height="#{BH}" transform="scale(0.7)" style="fill: none; stroke: #E0E0E0; stroke-width: 5px;" />
|
62
|
+
<text x="#{BF * 0.64}" y="#{BH * 0.96}" font-family="sans-serif" font-size="#{BH / 60}px" fill="#CCCCCC" text-anchor="middle">Scale size of a flag.</text>
|
63
|
+
SVG
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: false
|
2
|
+
|
3
|
+
# Core SVG data for the trident specification sheet.
|
4
|
+
#
|
5
|
+
# This class should never need to be called directly.
|
6
|
+
# @private
|
7
|
+
class USPSFlags::Core::TridentSpecs::Long < USPSFlags::Core::TridentSpecs::Base
|
8
|
+
def initialize(options = {})
|
9
|
+
super
|
10
|
+
@box_top = options[:bt]
|
11
|
+
@box_bottom = options[:bb]
|
12
|
+
@box_left = options[:bl]
|
13
|
+
@box_right = options[:br]
|
14
|
+
@fly = options[:fly]
|
15
|
+
@unit = options[:unit]
|
16
|
+
@heading = options[:heading]
|
17
|
+
end
|
18
|
+
|
19
|
+
def p
|
20
|
+
<<~SVG
|
21
|
+
<!-- Long Trident -->
|
22
|
+
<g transform="translate(#{BF * 40 / 80},#{BH * 9 / 32})"><g transform="scale(0.7)">
|
23
|
+
#{@heading}
|
24
|
+
|
25
|
+
#{USPSFlags::Core::Icons::Trident.new(:n).svg}
|
26
|
+
|
27
|
+
#{boundary_box}
|
28
|
+
|
29
|
+
<!-- Right -->
|
30
|
+
#{hash_to_bottom} <!-- Hash to bottom -->
|
31
|
+
|
32
|
+
#{left_arrow}
|
33
|
+
</g></g>
|
34
|
+
SVG
|
35
|
+
end
|
36
|
+
|
37
|
+
def boundary_box
|
38
|
+
<<~SVG
|
39
|
+
<!-- Boundary box -->
|
40
|
+
<rect x="#{@box_left}" y="#{@box_top}" width="#{@box_right - @box_left}" height="#{BH * 3 / 4}" stroke="#666666" stroke-width="#{BF / 600}" stroke-dasharray="15, 15" fill="none" />
|
41
|
+
SVG
|
42
|
+
end
|
43
|
+
|
44
|
+
def left_arrow
|
45
|
+
<<~SVG
|
46
|
+
<!-- Left -->
|
47
|
+
#{SA.vertical(@box_left - @config[:bar_width] * 1.5, @box_top, @box_bottom, @box_left, @box_left, label_offset: -BF / 30, label_offset_y: -BF / 4.5, label_align: "middle", fly: @fly, unit: @unit)} <!-- Boundary height -->
|
48
|
+
SVG
|
49
|
+
end
|
50
|
+
|
51
|
+
def hash_to_bottom
|
52
|
+
SA.vertical(@box_right + @config[:bar_width], @box_top + @config[:crossbar_from_top] + @config[:bar_width] * 3, @box_bottom, @config[:center_point] + @config[:hash_width] / 2, @box_right, fly: @fly, unit: @unit)
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,176 @@
|
|
1
|
+
# frozen_string_literal: false
|
2
|
+
|
3
|
+
# Core SVG data for the trident specification sheet.
|
4
|
+
#
|
5
|
+
# This class should never need to be called directly.
|
6
|
+
# @private
|
7
|
+
class USPSFlags::Core::TridentSpecs::Short < USPSFlags::Core::TridentSpecs::Base
|
8
|
+
def initialize(options = {})
|
9
|
+
super
|
10
|
+
@box_top = options[:bt]
|
11
|
+
@box_bottom = options[:bb]
|
12
|
+
@box_left = options[:bl]
|
13
|
+
@box_right = options[:br]
|
14
|
+
@fly = options[:fly]
|
15
|
+
@unit = options[:unit]
|
16
|
+
@heading = options[:heading]
|
17
|
+
end
|
18
|
+
|
19
|
+
def p
|
20
|
+
<<~SVG
|
21
|
+
<!-- Short Trident -->
|
22
|
+
<g transform="translate(-#{BF * 14 / 80},#{BH * 9 / 32})"><g transform="scale(0.7)">
|
23
|
+
#{@heading}
|
24
|
+
|
25
|
+
#{USPSFlags::Core::Icons::Trident.new(:s).svg}
|
26
|
+
|
27
|
+
#{boundary_box}#{right}#{left}#{bottom}#{top}#{overlay}
|
28
|
+
</g></g>
|
29
|
+
SVG
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def boundary_box
|
35
|
+
<<~SVG
|
36
|
+
<!-- Boundary box -->
|
37
|
+
<rect x="#{@box_left}" y="#{@box_top}" width="#{@box_right - @box_left}" height="#{BH / 2}" stroke="#666666" stroke-width="#{BF / 600}" stroke-dasharray="15, 15" fill="none" />
|
38
|
+
SVG
|
39
|
+
end
|
40
|
+
|
41
|
+
def right
|
42
|
+
<<~SVG
|
43
|
+
<!-- Right -->
|
44
|
+
#{SA.vertical(@box_right + @config[:bar_width], @box_top, @box_top + @config[:bar_width] * 4 / 5, @box_right, @box_right, fly: @fly, unit: @unit)} <!-- Side spike top gap -->
|
45
|
+
#{right_top_gap_to_hash_gap} <!-- Top gap to hash gap -->
|
46
|
+
#{right_crossbar_to_hash_gap} <!-- Crossbar to hash gap -->
|
47
|
+
|
48
|
+
#{right_hash} <!-- Hash -->
|
49
|
+
#{right_hash_to_bottom} <!-- Hash to bottom -->
|
50
|
+
SVG
|
51
|
+
end
|
52
|
+
|
53
|
+
def right_top_gap_to_hash_gap
|
54
|
+
SA.vertical(@box_right + @config[:bar_width], @box_top + @config[:bar_width] * 4 / 5, right_top_gap_bottom, nil, @box_right, fly: @fly, unit: @unit)
|
55
|
+
end
|
56
|
+
|
57
|
+
def right_top_gap_bottom
|
58
|
+
@box_top + @config[:bar_width] * 9 / 10 * 2 + @config[:side_point_height] + @config[:side_spike_height]
|
59
|
+
end
|
60
|
+
|
61
|
+
def right_crossbar_to_hash_gap
|
62
|
+
SA.vertical(@box_right + @config[:bar_width], right_crossbar_top, right_crossbar_bottom, nil, @config[:center_point] + @config[:hash_width] / 2, fly: @fly, unit: @unit)
|
63
|
+
end
|
64
|
+
|
65
|
+
def right_crossbar_top
|
66
|
+
@box_top + @config[:bar_width] * 18 / 10 + @config[:side_point_height] + @config[:side_spike_height]
|
67
|
+
end
|
68
|
+
|
69
|
+
def right_crossbar_bottom
|
70
|
+
@box_top + @config[:bar_width] * 28 / 10 + @config[:side_point_height] + @config[:side_spike_height]
|
71
|
+
end
|
72
|
+
|
73
|
+
def right_hash
|
74
|
+
SA.vertical(@box_right + @config[:bar_width], right_hash_top, right_hash_bottom, nil, @config[:center_point] + @config[:hash_width] / 2, fly: @fly, unit: @unit)
|
75
|
+
end
|
76
|
+
|
77
|
+
def right_hash_top
|
78
|
+
@box_top + @config[:bar_width] * 28 / 10 + @config[:side_point_height] + @config[:side_spike_height]
|
79
|
+
end
|
80
|
+
|
81
|
+
def right_hash_bottom
|
82
|
+
@box_top + @config[:bar_width] * 38 / 10 + @config[:side_point_height] + @config[:side_spike_height]
|
83
|
+
end
|
84
|
+
|
85
|
+
def right_hash_to_bottom
|
86
|
+
SA.vertical(@box_right + @config[:bar_width], @box_top + @config[:bar_width] * 38 / 10 + @config[:side_point_height] + @config[:side_spike_height], @box_bottom, nil, @box_right, fly: @fly, unit: @unit)
|
87
|
+
end
|
88
|
+
|
89
|
+
def left
|
90
|
+
<<~SVG
|
91
|
+
<!-- Left -->
|
92
|
+
#{SA.vertical(@box_left - @config[:bar_width] * 5.25, @box_top, @box_bottom, @box_left, @box_left, fly: @fly, unit: @unit)} <!-- Boundary height -->
|
93
|
+
#{left_main_point_height} <!-- Main point height -->
|
94
|
+
#{left_side_point_height} <!-- Side point height -->
|
95
|
+
SVG
|
96
|
+
end
|
97
|
+
|
98
|
+
def left_main_point_height
|
99
|
+
SA.vertical(@box_left - @config[:bar_width] * 0.75, @box_top, @box_top + @config[:center_point_height], nil, @config[:center_point] - @config[:bar_width], label_offset: -BF / 24, label_offset_y: -BF / 60, label_align: 'middle', fly: @fly, unit: @unit)
|
100
|
+
end
|
101
|
+
|
102
|
+
def left_side_point_height
|
103
|
+
SA.vertical(@box_left - @config[:bar_width] * 1.5, @box_top + @config[:bar_width] * 4 / 5, left_side_point_bottom, @box_left, @box_left + @config[:bar_width], label_offset: -BF / 24, label_align: 'middle', fly: @fly, unit: @unit)
|
104
|
+
end
|
105
|
+
|
106
|
+
def left_side_point_bottom
|
107
|
+
@box_top + @config[:bar_width] * 4 / 5 + @config[:side_point_height]
|
108
|
+
end
|
109
|
+
|
110
|
+
def bottom
|
111
|
+
<<~SVG
|
112
|
+
<!-- Bottom -->
|
113
|
+
#{bottom_bar_width} <!-- Bar width -->
|
114
|
+
#{bottom_hash_width} <!-- Hash width -->
|
115
|
+
#{SA.horizontal(@box_bottom + @config[:bar_width] * 4, @box_left, @box_right, @box_bottom, @box_bottom, fly: @fly, unit: @unit)} <!-- Boundary width -->
|
116
|
+
SVG
|
117
|
+
end
|
118
|
+
|
119
|
+
def bottom_bar_width
|
120
|
+
SA.horizontal(@box_bottom + @config[:bar_width], @config[:center_point] - @config[:bar_width] / 2, @config[:center_point] + @config[:bar_width] / 2, @box_bottom, @box_bottom, fly: @fly, unit: @unit)
|
121
|
+
end
|
122
|
+
|
123
|
+
def bottom_hash_width
|
124
|
+
SA.horizontal(@box_bottom + @config[:bar_width] * 2.5, @config[:center_point] - @config[:hash_width] / 2, @config[:center_point] + @config[:hash_width] / 2, bottom_hash_width_pointer_left, bottom_hash_width_pointer_right, fly: @fly, unit: @unit)
|
125
|
+
end
|
126
|
+
|
127
|
+
def bottom_hash_width_pointer_left
|
128
|
+
@box_top + @config[:bar_width] * 4 + @config[:center_point_height] + @config[:side_spike_height]
|
129
|
+
end
|
130
|
+
|
131
|
+
def bottom_hash_width_pointer_right
|
132
|
+
@box_top + @config[:bar_width] * 4 + @config[:center_point_height] + @config[:side_spike_height]
|
133
|
+
end
|
134
|
+
|
135
|
+
def top
|
136
|
+
<<~SVG
|
137
|
+
<!-- Top -->
|
138
|
+
#{top_side_point_width} <!-- Side point width -->
|
139
|
+
#{top_main_point_width} <!-- Main point width -->
|
140
|
+
SVG
|
141
|
+
end
|
142
|
+
|
143
|
+
def top_side_point_width
|
144
|
+
SA.horizontal(@box_top - @config[:bar_width], @box_left, @box_left + @config[:bar_width] * 3 / 2, @box_top, @box_top + @config[:bar_width] * 4 / 5 + @config[:side_point_height], label_offset: -BF / 60, fly: @fly, unit: @unit)
|
145
|
+
end
|
146
|
+
|
147
|
+
def top_main_point_width
|
148
|
+
SA.horizontal(@box_top - @config[:bar_width] * 2.5, top_main_point_top, @config[:center_point] + @config[:bar_width], @box_top + @config[:center_point_height], @box_top + @config[:center_point_height], label_offset: -BF / 60, fly: @fly, unit: @unit)
|
149
|
+
end
|
150
|
+
|
151
|
+
def top_main_point_top
|
152
|
+
@config[:center_point] - @config[:bar_width]
|
153
|
+
end
|
154
|
+
|
155
|
+
def overlay
|
156
|
+
<<~SVG
|
157
|
+
<!-- Overlay -->
|
158
|
+
<!-- Main point barb -->
|
159
|
+
#{overlay_lines}
|
160
|
+
<text x="#{@config[:center_point] + @config[:bar_width] * 9 / 8}" y="#{@box_top + @config[:center_point_height] - @config[:main_point_barb]}" font-family="sans-serif" font-size="#{BF / 100}px" fill="#041E42" text-anchor="left">#{@barb_label}</text>
|
161
|
+
SVG
|
162
|
+
end
|
163
|
+
|
164
|
+
def overlay_lines
|
165
|
+
<<~SVG
|
166
|
+
#{overlay_line(@box_top + @config[:center_point_height] - @config[:main_point_barb], @box_top + @config[:center_point_height] - @config[:main_point_barb] * 5)}
|
167
|
+
#{overlay_line(@box_top + @config[:center_point_height], @box_top + @config[:center_point_height])}
|
168
|
+
SVG
|
169
|
+
end
|
170
|
+
|
171
|
+
def overlay_line(y1, y2)
|
172
|
+
<<~SVG
|
173
|
+
<line x1="#{@config[:center_point] + @config[:bar_width] / 2}" y1="#{y1}" x2="#{@config[:center_point] + @config[:bar_width] * 3 / 2}" y2="#{y2}" stroke="#666666" stroke-width="2" stroke-dasharray="5, 5" />
|
174
|
+
SVG
|
175
|
+
end
|
176
|
+
end
|