# frozen_string_literal: false
# Core SVG data for the trident specification sheet.
#
# This class should never need to be called directly.
# @private
class USPSFlags::Core::TridentSpecs::Short < USPSFlags::Core::TridentSpecs::Base
def p
output('Short', 14, :s) do
<<~SVG
#{boundary_box}
#{right}
#{left}
#{bottom}
#{top}
#{overlay}
SVG
end
end
private
def boundary_box
<<~SVG
SVG
end
def right
<<~SVG
#{SA.vertical(@box_right + @config[:bar_width], @box_top, @box_top + @config[:bar_width] * 4 / 5, @box_right, @box_right, fly: @fly, unit: @unit)}
#{right_top_gap_to_hash_gap}
#{right_crossbar_to_hash_gap}
#{right_hash}
#{right_hash_to_bottom}
SVG
end
def right_top_gap_to_hash_gap
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)
end
def right_top_gap_bottom
@box_top + @config[:bar_width] * 9 / 10 * 2 + @config[:side_point_height] + @config[:side_spike_height]
end
def right_crossbar_to_hash_gap
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)
end
def right_crossbar_top
@box_top + @config[:bar_width] * 18 / 10 + @config[:side_point_height] + @config[:side_spike_height]
end
def right_crossbar_bottom
@box_top + @config[:bar_width] * 28 / 10 + @config[:side_point_height] + @config[:side_spike_height]
end
def right_hash
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)
end
def right_hash_top
@box_top + @config[:bar_width] * 28 / 10 + @config[:side_point_height] + @config[:side_spike_height]
end
def right_hash_bottom
@box_top + @config[:bar_width] * 38 / 10 + @config[:side_point_height] + @config[:side_spike_height]
end
def right_hash_to_bottom
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)
end
def left
<<~SVG
#{SA.vertical(@box_left - @config[:bar_width] * 5.25, @box_top, @box_bottom, @box_left, @box_left, fly: @fly, unit: @unit)}
#{left_main_point_height}
#{left_side_point_height}
SVG
end
def left_main_point_height
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)
end
def left_side_point_height
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)
end
def left_side_point_bottom
@box_top + @config[:bar_width] * 4 / 5 + @config[:side_point_height]
end
def bottom
<<~SVG
#{bottom_bar_width}
#{bottom_hash_width}
#{SA.horizontal(@box_bottom + @config[:bar_width] * 4, @box_left, @box_right, @box_bottom, @box_bottom, fly: @fly, unit: @unit)}
SVG
end
def bottom_bar_width
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)
end
def bottom_hash_width
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)
end
def bottom_hash_width_pointer_left
@box_top + @config[:bar_width] * 4 + @config[:center_point_height] + @config[:side_spike_height]
end
def bottom_hash_width_pointer_right
@box_top + @config[:bar_width] * 4 + @config[:center_point_height] + @config[:side_spike_height]
end
def top
<<~SVG
#{top_side_point_width}
#{top_main_point_width}
SVG
end
def top_side_point_width
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)
end
def top_main_point_width
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)
end
def top_main_point_top
@config[:center_point] - @config[:bar_width]
end
def overlay
<<~SVG
#{overlay_lines}
#{@barb_label}
SVG
end
def overlay_lines
<<~SVG
#{overlay_line(@box_top + @config[:center_point_height] - @config[:main_point_barb], @box_top + @config[:center_point_height] - @config[:main_point_barb] * 5)}
#{overlay_line(@box_top + @config[:center_point_height], @box_top + @config[:center_point_height])}
SVG
end
def overlay_line(y1, y2)
<<~SVG
SVG
end
end