Class: Rozi::Waypoint
- Inherits:
-
DataStruct
- Object
- DataStruct
- Rozi::Waypoint
- Includes:
- Shared
- Defined in:
- lib/rozi/waypoints.rb
Overview
Represents a waypoint in Ozi Explorer
Constant Summary collapse
- PROPERTIES =
[ :number, :name, :latitude, :longitude, :date, :symbol, :display_format, :fg_color, :bg_color, :description, :pointer_direction, :altitude, :font_size, :font_style, :symbol_size ]
- DISPLAY_FORMATS =
{ :number_only => 0, :name_only => 1, :number_and_name => 2, :name_with_dot => 3, :name_with_symbol => 4, :symbol_only => 5, :comment_with_symbol => 6, :man_overboard => 7, :marker => 8 }
Instance Method Summary collapse
-
#bg_color=(color) ⇒ Object
Sets the background color.
-
#display_format(raw: false) ⇒ Object
Returns the value of the display format property.
- #display_format=(display_format) ⇒ Object
-
#fg_color=(color) ⇒ Object
Sets the foreground color.
-
#initialize(*args, **kwargs) ⇒ Waypoint
constructor
A new instance of Waypoint.
Methods included from Shared
#datum_valid?, #escape_text, #interpret_color, #unescape_text
Constructor Details
#initialize(*args, **kwargs) ⇒ Waypoint
Returns a new instance of Waypoint.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/rozi/waypoints.rb', line 49 def initialize(*args, **kwargs) update( number: -1, name: "", latitude: 0.0, longitude: 0.0, date: nil, symbol: 0, display_format: :name_with_dot, fg_color: 0, bg_color: 65535, description: "", pointer_direction: 0, altitude: -777, font_size: 6, font_style: 0, symbol_size: 17 ) super end |
Instance Method Details
#bg_color=(color) ⇒ Object
Sets the background color
102 103 104 |
# File 'lib/rozi/waypoints.rb', line 102 def bg_color=(color) @data[:bg_color] = interpret_color(color) end |
#display_format(raw: false) ⇒ Object
Returns the value of the display format property
76 77 78 79 80 81 82 |
# File 'lib/rozi/waypoints.rb', line 76 def display_format(raw: false) if raw super else DISPLAY_FORMATS.invert[super] end end |
#display_format=(display_format) ⇒ Object
84 85 86 87 88 89 90 |
# File 'lib/rozi/waypoints.rb', line 84 def display_format=(display_format) if display_format.is_a? Symbol @data[:display_format] = DISPLAY_FORMATS[display_format] else @data[:display_format] = display_format end end |
#fg_color=(color) ⇒ Object
Sets the foreground color
95 96 97 |
# File 'lib/rozi/waypoints.rb', line 95 def fg_color=(color) @data[:fg_color] = interpret_color(color) end |