usps_flags 0.1.26 → 0.2.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
- checksums.yaml.gz.sig +3 -1
- data/Gemfile.lock +1 -1
- data/README.md +44 -20
- data/lib/usps_flags/core/field.rb +6 -6
- data/lib/usps_flags/core/footer.rb +2 -2
- data/lib/usps_flags/core/pennant.rb +14 -14
- data/lib/usps_flags/core/trident.rb +145 -132
- data/lib/usps_flags/core/trident_spec.rb +71 -49
- data/lib/usps_flags/core/tridents.rb +61 -0
- data/lib/usps_flags/core/trumpet.rb +11 -1
- data/lib/usps_flags/generate/flag.rb +115 -0
- data/lib/usps_flags/generate.rb +45 -221
- data/lib/usps_flags/helpers/builders.rb +71 -0
- data/lib/usps_flags/helpers/spec_arrows.rb +81 -0
- data/lib/usps_flags/helpers.rb +32 -147
- data/lib/usps_flags.rb +12 -2
- data/spec/usps_flags/generate_spec.rb +37 -5
- data/spec/usps_flags/helpers_spec.rb +4 -1
- data/spec/usps_flags_spec.rb +101 -126
- data/usps_flags.gemspec +2 -2
- data.tar.gz.sig +0 -0
- metadata +6 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f60a474823123130c88cb0644669640e155c213
|
4
|
+
data.tar.gz: 9bbf9f5359b28e8a8f375754000a5290046f6a69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24bf52afae4c48b31d9304939e350922f27e8fb9409130c5b897cc4bf78db1f99f9632320d49f1092fbd226302846fe8d4c1d917534fd4c36f35c1e7b081d7e5
|
7
|
+
data.tar.gz: d1ee90e5fe2895a6cdbc1f8306237258b5835b93b8939f2111f3e6f81c56e0ac1a01b2459d507212a20094b67062362698864aa9fc5f6daf43802b384bcde319
|
checksums.yaml.gz.sig
CHANGED
@@ -1 +1,3 @@
|
|
1
|
-
|
1
|
+
׳[pgM���� 'M�/r�����,.;ƁBO��9K81����/C��r���˄=�Q�eg[����-�}��72A�/��s鶱F�
|
2
|
+
%�1n��fK��X�l�8
|
3
|
+
Z����I�
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -2,30 +2,37 @@
|
|
2
2
|
|
3
3
|
[](https://rubygems.org/gems/usps_flags)
|
4
4
|
[](https://travis-ci.org/jfiander/usps-flags)
|
5
|
-
[](https://coveralls.io/github/jfiander/usps-flags?branch=master)
|
5
|
+
[](https://coveralls.io/github/jfiander/usps-flags?branch=master)
|
6
6
|
[](https://codeclimate.com/github/jfiander/usps-flags/maintainability)
|
7
7
|
|
8
|
-
This gem allows you to generate precise SVG and PNG flag images based on
|
8
|
+
This gem allows you to generate precise SVG and PNG flag images based on
|
9
|
+
official specifications.
|
9
10
|
|
10
11
|
## Installation
|
11
12
|
|
12
13
|
### Rails
|
13
14
|
|
14
15
|
Add to your Gemfile:
|
16
|
+
|
15
17
|
```ruby
|
16
18
|
gem 'usps_flags'
|
17
19
|
```
|
18
20
|
|
19
21
|
Create the file `config/initializers/usps_flags.rb`:
|
22
|
+
|
20
23
|
```ruby
|
21
24
|
USPSFlags::Config.flags_dir "#{Rails.root}/app/assets/images/flags"
|
22
25
|
```
|
23
26
|
|
24
27
|
### Other
|
25
28
|
|
26
|
-
Run
|
29
|
+
Run the following commands:
|
27
30
|
|
28
|
-
|
31
|
+
```ruby
|
32
|
+
gem install usps_flags
|
33
|
+
require 'usps_flags'
|
34
|
+
USPSFlags::Config.flags_dir "path/to/flags/dir"
|
35
|
+
```
|
29
36
|
|
30
37
|
## Available flags
|
31
38
|
|
@@ -45,6 +52,7 @@ Tests are written in Rspec. To run all specs in a cloned repo, run 'rake'.
|
|
45
52
|
### All files
|
46
53
|
|
47
54
|
To generate all static files, run:
|
55
|
+
|
48
56
|
```ruby
|
49
57
|
USPSFlags::Generate.all svg: true, png: true, zips: true
|
50
58
|
```
|
@@ -54,6 +62,7 @@ USPSFlags::Generate.all svg: true, png: true, zips: true
|
|
54
62
|
### Zip archives
|
55
63
|
|
56
64
|
To re-generate zip files from current static files, run:
|
65
|
+
|
57
66
|
```ruby
|
58
67
|
USPSFlags::Generate.zips svg: true, png: true
|
59
68
|
```
|
@@ -63,38 +72,47 @@ USPSFlags::Generate.zips svg: true, png: true
|
|
63
72
|
### Individual files
|
64
73
|
|
65
74
|
To generate an individual SVG file, run:
|
75
|
+
|
66
76
|
```ruby
|
67
|
-
USPSFlags::Generate.
|
77
|
+
USPSFlags::Generate.svg "flag", outfile: nil, scale: nil, field: true
|
68
78
|
```
|
69
79
|
|
70
|
-
- `outfile` specifies where to save the file. If left as `nil`, this method will
|
71
|
-
|
72
|
-
- `
|
80
|
+
- `outfile` specifies where to save the file. If left as `nil`, this method will
|
81
|
+
`puts` the generated SVG. Either way, the SVG code is returned.
|
82
|
+
- `scale` is a divisor scaling factor – the larger it is, the smaller the
|
83
|
+
resulting SVG will be rendered. Accepted values are floats between 0 and 1,
|
84
|
+
and integers above that.
|
85
|
+
- `field` specifies whether to render the field of a flag, or to only render the
|
86
|
+
insignia. Setting this to `false` will invert some colors for visibility.
|
73
87
|
|
74
88
|
### Trident spec sheet
|
75
89
|
|
76
90
|
To generate the trident spec sheet, run:
|
91
|
+
|
77
92
|
```ruby
|
78
93
|
USPSFlags::Generate.spec outfile: nil, scale: nil, fly: 24, unit: "in"
|
79
94
|
```
|
80
95
|
|
81
|
-
- `outfile` specifies where to save the file. If left as `nil`, this method will
|
82
|
-
|
96
|
+
- `outfile` specifies where to save the file. If left as `nil`, this method will
|
97
|
+
`puts` the generated SVG. Either way, the SVG code is returned.
|
98
|
+
- `scale` is a divisor scaling factor – the larger it is, the smaller the
|
99
|
+
resulting SVG will be rendered. Accepted values are floats between 0 and 1,
|
100
|
+
and integers above that.
|
83
101
|
- `fly` specifies the custom fly measurement to scale all trident labels to.
|
84
|
-
- `unit` specifies the custom fly measurement unit to append to all trident
|
102
|
+
- `unit` specifies the custom fly measurement unit to append to all trident
|
103
|
+
labels.
|
85
104
|
|
86
105
|
### Convert SVG to PNG
|
87
106
|
|
88
107
|
To convert SVG data to a PNG image, run:
|
108
|
+
|
89
109
|
```ruby
|
90
110
|
USPSFlags::Generate.png svg_data, outfile: nil, trim: false
|
91
|
-
|
92
|
-
# USPSFlags::Generate.png File.read("path/to/svg_image.svg"), outfile: "path/to/output.png", trim: false
|
93
|
-
# USPSFlags::Generate.png USPSFlags::Generate.get("LtC"), outfile: "path/to/output.png", trim: true
|
94
111
|
```
|
95
112
|
|
96
113
|
- `outfile` is required, and specifies where to save the file.
|
97
|
-
- `trim` specifies whether to trim blank space from around the image. (This is
|
114
|
+
- `trim` specifies whether to trim blank space from around the image. (This is
|
115
|
+
ideal for generating insignia.)
|
98
116
|
|
99
117
|
## Constructing
|
100
118
|
|
@@ -114,13 +132,16 @@ f.svg # Generate SVG file
|
|
114
132
|
f.png # Generate PNG file
|
115
133
|
```
|
116
134
|
|
117
|
-
- Calling any DSL method without argument, or with `nil` as argument will return
|
118
|
-
|
135
|
+
- Calling any DSL method without argument, or with `nil` as argument will return
|
136
|
+
the current value.
|
137
|
+
- You can explicitly set `svg_file` to `""` to suppress printing the SVG content
|
138
|
+
to console/log.
|
119
139
|
- Calling `.png` requires `png_file` to be set.
|
120
140
|
|
121
141
|
## Security
|
122
142
|
|
123
|
-
This gem is cryptographically signed. To be sure the gem code hasn’t been
|
143
|
+
This gem is cryptographically signed. To be sure the gem code hasn’t been
|
144
|
+
tampered with:
|
124
145
|
|
125
146
|
Add my public key as a trusted certificate:
|
126
147
|
|
@@ -136,6 +157,9 @@ gem install usps_flags -P HighSecurity
|
|
136
157
|
|
137
158
|
## License
|
138
159
|
|
139
|
-
Actual images generated (other than the US Ensign) are
|
160
|
+
Actual images generated (other than the US Ensign) are
|
161
|
+
[registered trademarks](http://www.usps.org/national/itcom/trademark.html) of
|
162
|
+
United States Power Squadrons.
|
140
163
|
|
141
|
-
This project is released under the
|
164
|
+
This project is released under the
|
165
|
+
[GPLv3](https://raw.github.com/jfiander/usps-flags/master/LICENSE).
|
@@ -31,25 +31,25 @@ class USPSFlags::Core::Field
|
|
31
31
|
def svg
|
32
32
|
case @style
|
33
33
|
when :regular
|
34
|
-
<<~
|
34
|
+
<<~SVG
|
35
35
|
<path d="M 0 0
|
36
36
|
l #{@fly} 0
|
37
37
|
l 0 #{@hoist}
|
38
38
|
l -#{@fly} 0
|
39
39
|
l 0 -#{@hoist}
|
40
40
|
" fill="#{@color_code}" #{@border_svg}/>
|
41
|
-
|
41
|
+
SVG
|
42
42
|
when :swallowtail
|
43
|
-
<<~
|
43
|
+
<<~SVG
|
44
44
|
<path d="M 0 0
|
45
45
|
l #{@fly} #{@hoist/6}
|
46
46
|
l -#{@fly/5} #{@hoist/3}
|
47
47
|
l #{@fly/5} #{@hoist/3}
|
48
48
|
l -#{@fly} #{@hoist/6}
|
49
49
|
" fill="#FFFFFF" stroke="#000000" stroke-width="#{USPSFlags::Config::BASE_FLY/600}" />
|
50
|
-
|
50
|
+
SVG
|
51
51
|
when :past
|
52
|
-
<<~
|
52
|
+
<<~SVG
|
53
53
|
<path d="M 0 0
|
54
54
|
l #{@fly/2} #{@hoist*1/12}
|
55
55
|
l 0 #{@hoist*10/12}
|
@@ -72,7 +72,7 @@ class USPSFlags::Core::Field
|
|
72
72
|
l #{@fly/5} #{@hoist/3}
|
73
73
|
l -#{@fly} #{@hoist/6}
|
74
74
|
" fill="none" stroke="#000000" stroke-width="#{USPSFlags::Config::BASE_FLY/600}" />
|
75
|
-
|
75
|
+
SVG
|
76
76
|
end
|
77
77
|
end
|
78
78
|
end
|
@@ -15,26 +15,26 @@ class USPSFlags::Core::Pennant
|
|
15
15
|
<polyline fill="#{USPSFlags::Config::BLUE}" points="0 0 #{USPSFlags::Config::BASE_FLY} #{USPSFlags::Config::BASE_HOIST/8} 0 #{USPSFlags::Config::BASE_HOIST/4}" />
|
16
16
|
SVG
|
17
17
|
elsif @type == "CRUISE"
|
18
|
-
svg = <<~
|
18
|
+
svg = <<~SVG
|
19
19
|
<path d="M 0 0
|
20
|
-
l #{fly*10/36} #{hoist*5/36}
|
21
|
-
l 0 #{hoist*26/36}
|
22
|
-
l -#{fly*10/36} #{hoist*5/36}
|
20
|
+
l #{@fly*10/36} #{@hoist*5/36}
|
21
|
+
l 0 #{@hoist*26/36}
|
22
|
+
l -#{@fly*10/36} #{@hoist*5/36}
|
23
23
|
" fill="#{USPSFlags::Config::RED}" />
|
24
|
-
<path d="M #{fly*10/36} #{hoist*5/36}
|
25
|
-
l #{fly*11/36} #{hoist*5.5/36}
|
26
|
-
l 0 #{hoist*15/36}
|
27
|
-
l -#{fly*11/36} #{hoist*5.5/36}
|
24
|
+
<path d="M #{@fly*10/36} #{@hoist*5/36}
|
25
|
+
l #{@fly*11/36} #{@hoist*5.5/36}
|
26
|
+
l 0 #{@hoist*15/36}
|
27
|
+
l -#{@fly*11/36} #{@hoist*5.5/36}
|
28
28
|
" fill="#FFFFFF" />
|
29
|
-
<path d="M #{fly*21/36} #{hoist*10.5/36}
|
30
|
-
l #{fly*15/36} #{hoist*7.5/36}
|
31
|
-
l -#{fly*15/36} #{hoist*7.5/36}
|
29
|
+
<path d="M #{@fly*21/36} #{@hoist*10.5/36}
|
30
|
+
l #{@fly*15/36} #{@hoist*7.5/36}
|
31
|
+
l -#{@fly*15/36} #{@hoist*7.5/36}
|
32
32
|
" fill="#{USPSFlags::Config::BLUE}" />
|
33
33
|
<path d="M 0 0
|
34
|
-
l #{fly} #{hoist/2}
|
35
|
-
l -#{fly} #{hoist/2}
|
34
|
+
l #{@fly} #{@hoist/2}
|
35
|
+
l -#{@fly} #{@hoist/2}
|
36
36
|
" fill="none" stroke="#000000" stroke-width="2" />
|
37
|
-
|
37
|
+
SVG
|
38
38
|
|
39
39
|
svg << "<g transform=\"translate(385, 340)\">"
|
40
40
|
svg << USPSFlags::Core::Star.new.svg
|
@@ -8,158 +8,171 @@ class USPSFlags::Core::Trident
|
|
8
8
|
raise "Error: Invalid trident type. Options are #{valid_types}." unless valid_types.include? type
|
9
9
|
@type = type
|
10
10
|
|
11
|
+
load_config
|
12
|
+
configure_trident_segments
|
13
|
+
configure_colors(color, field_color)
|
14
|
+
end
|
15
|
+
|
16
|
+
def svg
|
17
|
+
svg = ""
|
18
|
+
svg << "<g mask=\"url(#delta-mask)\">" if @type == :d
|
19
|
+
svg << "<g mask=\"url(#circle-mask-for-main-spike)\">" if @type == :stf
|
20
|
+
|
21
|
+
@trident_segments.each do |segment|
|
22
|
+
start = segment.keys.first
|
23
|
+
points = segment.values.first
|
24
|
+
svg << "<path d=\"M #{start[0]} #{start[1]}\n"
|
25
|
+
points.each { |x, y| svg << "l #{x} #{y}\n" }
|
26
|
+
svg << "\" fill=\"#{@color_code}\" />\n"
|
27
|
+
end
|
28
|
+
svg << "</g>" if [:d, :stf].include?(@type)
|
29
|
+
|
30
|
+
case @type
|
31
|
+
when :d
|
32
|
+
svg << delta_hash
|
33
|
+
when :stf
|
34
|
+
svg << circle_hash
|
35
|
+
else
|
36
|
+
svg << standard_hash
|
37
|
+
end
|
38
|
+
|
39
|
+
svg
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
def load_config
|
11
44
|
@trident_config = USPSFlags::Config.trident
|
12
|
-
main_spike_overhang = @trident_config[:bar_width] / 2
|
13
|
-
side_spike_overhang = @trident_config[:bar_width] / 2
|
45
|
+
@main_spike_overhang = @trident_config[:bar_width] / 2
|
46
|
+
@side_spike_overhang = @trident_config[:bar_width] / 2
|
14
47
|
@top_point = ((USPSFlags::Config::BASE_HOIST - @trident_config[:height][@type]) / 2)
|
15
|
-
crossbar_top = @top_point + @trident_config[:crossbar_from_top]
|
48
|
+
@crossbar_top = @top_point + @trident_config[:crossbar_from_top]
|
16
49
|
@hash_from_top = @trident_config[:crossbar_from_top] + (@trident_config[:bar_width] * 2)
|
17
50
|
@circle_from_top = @trident_config[:crossbar_from_top] + @trident_config[:bar_width]*123/128 + @trident_config[:width]/2
|
18
|
-
main_length = @trident_config[:height][@type] - (@trident_config[:point_height] - @trident_config[:main_point_barb])
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
]
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
[
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
[-@trident_config[:width], 0],
|
41
|
-
[0, -@trident_config[:bar_width]]
|
42
|
-
]
|
43
|
-
},
|
44
|
-
{
|
45
|
-
# Left spike
|
46
|
-
[(@trident_config[:center_point] - @trident_config[:width]/2), (crossbar_top + 1)] =>
|
47
|
-
[
|
48
|
-
[0, -(@trident_config[:side_spike_height]+@trident_config[:point_height])],
|
49
|
-
[(@trident_config[:bar_width]+side_spike_overhang), @trident_config[:point_height]],
|
50
|
-
[-side_spike_overhang, 0],
|
51
|
-
[0, @trident_config[:side_spike_height]]
|
52
|
-
]
|
53
|
-
},
|
54
|
-
{
|
55
|
-
# Right spike
|
56
|
-
[(@trident_config[:center_point] + @trident_config[:width]/2), (crossbar_top + 1)] =>
|
57
|
-
[
|
58
|
-
[0, -(@trident_config[:side_spike_height]+@trident_config[:point_height])],
|
59
|
-
[-(@trident_config[:bar_width]+side_spike_overhang), @trident_config[:point_height]],
|
60
|
-
[side_spike_overhang, 0],
|
61
|
-
[0, @trident_config[:side_spike_height]]
|
62
|
-
]
|
63
|
-
}
|
64
|
-
]
|
51
|
+
@main_length = @trident_config[:height][@type] - (@trident_config[:point_height] - @trident_config[:main_point_barb])
|
52
|
+
end
|
53
|
+
|
54
|
+
def configure_trident_segments
|
55
|
+
@trident_segments = [main_spike, crossbar, left_spike, right_spike]
|
56
|
+
@lower_hash = lower_hash
|
57
|
+
end
|
58
|
+
|
59
|
+
def main_spike
|
60
|
+
{
|
61
|
+
[@trident_config[:center_point], @top_point] =>
|
62
|
+
[
|
63
|
+
[@trident_config[:bar_width], @trident_config[:point_height]],
|
64
|
+
[-@main_spike_overhang, -@trident_config[:main_point_barb]],
|
65
|
+
[0, @main_length],
|
66
|
+
[-(@trident_config[:bar_width]), 0],
|
67
|
+
[0, -@main_length],
|
68
|
+
[-@main_spike_overhang, @trident_config[:main_point_barb]],
|
69
|
+
[@trident_config[:bar_width], -@trident_config[:point_height]]
|
70
|
+
]
|
71
|
+
}
|
72
|
+
end
|
65
73
|
|
66
|
-
|
74
|
+
def crossbar
|
75
|
+
{
|
76
|
+
[(@trident_config[:center_point] - @trident_config[:width]/2), (@crossbar_top)] =>
|
77
|
+
[
|
78
|
+
[@trident_config[:width], 0],
|
79
|
+
[0, @trident_config[:bar_width]],
|
80
|
+
[-@trident_config[:width], 0],
|
81
|
+
[0, -@trident_config[:bar_width]]
|
82
|
+
]
|
83
|
+
}
|
84
|
+
end
|
85
|
+
|
86
|
+
def left_spike
|
87
|
+
{
|
88
|
+
[(@trident_config[:center_point] - @trident_config[:width]/2), (@crossbar_top + 1)] =>
|
89
|
+
[
|
90
|
+
[0, -(@trident_config[:side_spike_height]+@trident_config[:point_height])],
|
91
|
+
[(@trident_config[:bar_width]+@side_spike_overhang), @trident_config[:point_height]],
|
92
|
+
[-@side_spike_overhang, 0],
|
93
|
+
[0, @trident_config[:side_spike_height]]
|
94
|
+
]
|
95
|
+
}
|
96
|
+
end
|
97
|
+
|
98
|
+
def right_spike
|
99
|
+
{
|
100
|
+
[(@trident_config[:center_point] + @trident_config[:width]/2), (@crossbar_top + 1)] =>
|
101
|
+
[
|
102
|
+
[0, -(@trident_config[:side_spike_height]+@trident_config[:point_height])],
|
103
|
+
[-(@trident_config[:bar_width]+@side_spike_overhang), @trident_config[:point_height]],
|
104
|
+
[@side_spike_overhang, 0],
|
105
|
+
[0, @trident_config[:side_spike_height]]
|
106
|
+
]
|
107
|
+
}
|
108
|
+
end
|
109
|
+
|
110
|
+
def lower_hash
|
111
|
+
[
|
67
112
|
[@trident_config[:hash_width], 0],
|
68
113
|
[0, @trident_config[:bar_width]],
|
69
114
|
[-@trident_config[:hash_width], 0],
|
70
115
|
[0, -@trident_config[:bar_width]]
|
71
116
|
]
|
117
|
+
end
|
72
118
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
@field_color_code = case field_color
|
77
|
-
when :red
|
78
|
-
USPSFlags::Config::RED
|
79
|
-
when :blue
|
80
|
-
USPSFlags::Config::BLUE
|
81
|
-
end
|
82
|
-
when :red
|
119
|
+
def configure_colors(color, field_color)
|
120
|
+
@color_code = "#FFFFFF"
|
121
|
+
if color == :red
|
83
122
|
@color_code = USPSFlags::Config::RED
|
84
123
|
@field_color_code = "#FFFFFF"
|
85
|
-
|
124
|
+
elsif color == :blue
|
86
125
|
@color_code = USPSFlags::Config::BLUE
|
87
126
|
@field_color_code = "#FFFFFF"
|
127
|
+
elsif color == :white && field_color == :red
|
128
|
+
@field_color_code = USPSFlags::Config::RED
|
129
|
+
elsif color == :white && field_color == :blue
|
130
|
+
@field_color_code = USPSFlags::Config::BLUE
|
88
131
|
end
|
89
132
|
end
|
90
133
|
|
91
|
-
def
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
""
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
svg << "</g>" if [:d, :stf].include?(@type)
|
134
|
+
def delta_hash
|
135
|
+
<<~SVG
|
136
|
+
<polyline mask="url(#delta-mask)" fill="#{@color_code}" points="
|
137
|
+
#{@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]}
|
140
|
+
#{@trident_config[:center_point]}, #{@top_point + @trident_config[:height][:d] - @trident_config[:delta_from_bottom] - @trident_config[:delta_height]}" />
|
141
|
+
<mask id="delta-mask">
|
142
|
+
<g>
|
143
|
+
<rect x="0" y="0" width="#{USPSFlags::Config::BASE_FLY}" height="#{USPSFlags::Config::BASE_FLY}" fill="#FFFFFF" />
|
144
|
+
<polyline transform="scale(#{@trident_config[:delta_gap_scale]}) translate(#{@trident_config[:delta_gap_x]},#{@trident_config[:delta_gap_y]})" fill="#000000" points="
|
145
|
+
#{@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]}
|
147
|
+
#{@trident_config[:center_point] - @trident_config[:width]/2}, #{@top_point + @trident_config[:height][:d] - @trident_config[:delta_from_bottom]}
|
148
|
+
#{@trident_config[:center_point]}, #{@top_point + @trident_config[:height][:d] - @trident_config[:delta_from_bottom] - @trident_config[:delta_height]}" />
|
149
|
+
</g>
|
150
|
+
</mask>
|
151
|
+
SVG
|
152
|
+
end
|
111
153
|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
#{@trident_config[:center_point]
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
</mask>
|
130
|
-
SVG
|
131
|
-
elsif @type == :stf
|
132
|
-
# Circle hash
|
133
|
-
svg << <<~SVG
|
134
|
-
<circle cx="#{@trident_config[:center_point]}" cy="#{@top_point + @circle_from_top}" r="#{@trident_config[:width]/2}" fill="#{@color_code}" mask="url(#circle-mask)" />
|
135
|
-
<mask id="circle-mask">
|
136
|
-
<g>
|
137
|
-
<rect x="0" y="0" width="#{USPSFlags::Config::BASE_FLY}" height="#{USPSFlags::Config::BASE_FLY}" fill="#FFFFFF" />
|
138
|
-
<circle cx="#{@trident_config[:center_point]}" cy="#{@top_point + @circle_from_top}" r="#{@trident_config[:width]/2-@trident_config[:bar_width]}" fill="#000000" />
|
139
|
-
</g>
|
140
|
-
</mask>
|
141
|
-
<mask id="circle-mask-for-main-spike">
|
142
|
-
<g transform="scale(1.05) translate(-@trident_config[:br_width], -@trident_config[:br_width]/2)">
|
143
|
-
<rect x="0" y="0" width="#{USPSFlags::Config::BASE_FLY}" height="#{USPSFlags::Config::BASE_FLY}" fill="#FFFFFF" />
|
144
|
-
<circle cx="#{@trident_config[:center_point]}" cy="#{@top_point + @circle_from_top}" r="#{@trident_config[:width]/2-@trident_config[:bar_width]}" fill="#000000" />
|
145
|
-
</g>
|
146
|
-
</mask>
|
147
|
-
SVG
|
148
|
-
else
|
149
|
-
# Standard hash
|
150
|
-
svg << "<path d=\"M #{(@trident_config[:center_point] - @trident_config[:hash_width]/2)} #{(@top_point + @hash_from_top)}\n"
|
151
|
-
@lower_hash.each do |x, y|
|
152
|
-
svg << "l #{x} #{y}\n"
|
153
|
-
end
|
154
|
-
svg << "\" fill=\"#{@color_code}\" />\n"
|
154
|
+
def circle_hash
|
155
|
+
<<~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)" />
|
157
|
+
<mask id="circle-mask">
|
158
|
+
<g>
|
159
|
+
<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-@trident_config[:bar_width]}" fill="#000000" />
|
161
|
+
</g>
|
162
|
+
</mask>
|
163
|
+
<mask id="circle-mask-for-main-spike">
|
164
|
+
<g transform="scale(1.05) translate(-@trident_config[:br_width], -@trident_config[:br_width]/2)">
|
165
|
+
<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-@trident_config[:bar_width]}" fill="#000000" />
|
167
|
+
</g>
|
168
|
+
</mask>
|
169
|
+
SVG
|
170
|
+
end
|
155
171
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
# cc_cross_marker = USPSFlags::Config::BASE_HOIST*7/8-(USPSFlags::Config::BASE_HOIST/8+@trident_config[:crossbar_from_top]+@trident_config[:bar_width]*3)*1/3
|
161
|
-
# svg << "<line x1=\"#{USPSFlags::Config::BASE_FLY*3/8}\" x2=\"#{USPSFlags::Config::BASE_FLY*5/8}\" y1=\"#{cc_cross_marker}\" y2=\"#{cc_cross_marker}\" stroke=\"black\" stroke-width=\"#{USPSFlags::Config::BASE_FLY/600}\" />"
|
162
|
-
end
|
172
|
+
def standard_hash
|
173
|
+
svg = "<path d=\"M #{(@trident_config[:center_point] - @trident_config[:hash_width]/2)} #{(@top_point + @hash_from_top)}\n"
|
174
|
+
@lower_hash.each { |x, y| svg << "l #{x} #{y}\n" }
|
175
|
+
svg << "\" fill=\"#{@color_code}\" />\n"
|
163
176
|
|
164
177
|
svg
|
165
178
|
end
|