rozi 0.0.1
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 +7 -0
- data/lib/rozi.rb +0 -0
- data/lib/rozi/ozi_functions.rb +62 -0
- data/lib/rozi/track.rb +58 -0
- data/lib/rozi/track_point.rb +39 -0
- data/lib/rozi/track_writer.rb +59 -0
- data/lib/rozi/version.rb +4 -0
- data/lib/rozi/waypoint.rb +90 -0
- data/lib/rozi/waypoint_writer.rb +48 -0
- data/test/rozi/track_point_test.rb +35 -0
- data/test/rozi/track_test.rb +27 -0
- data/test/rozi/track_writer_test.rb +64 -0
- data/test/rozi/waypoint_test.rb +41 -0
- data/test/rozi/waypoint_writer_test.rb +63 -0
- metadata +61 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 100b9a40deb4353ee5c210b4559d0c61457abddf
|
4
|
+
data.tar.gz: b1e50676fdd98f846eea6a9e322bec93b2a83755
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a70dc9fb2f08fbb68e5e8dd9960f05b9e28174ca28d5d1395aee1d8eef283db57dcd52541f4130af5828325d4f52e99d81fd4ff141f50ff1e765d969ed2a6999
|
7
|
+
data.tar.gz: 16b38ee7d75b4debe5ac1e2814694eb5d25e34bc36f110c4d6211d84cefddb901b46bad06282c419bed38296608cca4d5a73cea4b3b416b2ccf5d7f7fb3b2e79
|
data/lib/rozi.rb
ADDED
File without changes
|
@@ -0,0 +1,62 @@
|
|
1
|
+
|
2
|
+
module Rozi
|
3
|
+
|
4
|
+
##
|
5
|
+
# Contains general functions for working with Ozi Explorer file formats.
|
6
|
+
#
|
7
|
+
module OziFunctions
|
8
|
+
##
|
9
|
+
# Escapes commas so the text can be used in Ozi file formats.
|
10
|
+
#
|
11
|
+
# @param [String] text
|
12
|
+
# @return [String]
|
13
|
+
#
|
14
|
+
def escape_text(text)
|
15
|
+
text.gsub(/,/, 209.chr.encode("UTF-8", "ISO-8859-1"))
|
16
|
+
end
|
17
|
+
|
18
|
+
##
|
19
|
+
# Converts the input to an RGB color represented by an integer.
|
20
|
+
#
|
21
|
+
# @param [String, Integer] color Can be a RRGGBB hex string or an integer.
|
22
|
+
# @return [Integer]
|
23
|
+
#
|
24
|
+
# @example
|
25
|
+
# interpret_color(255) # 255
|
26
|
+
# interpret_color("ABCDEF") # 15715755
|
27
|
+
#
|
28
|
+
def interpret_color(color)
|
29
|
+
if color.is_a? String
|
30
|
+
# Turns RRGGBB into BBGGRR for hex conversion.
|
31
|
+
color = color[-2..-1] << color[2..3] << color[0..1]
|
32
|
+
color = color.to_i(16)
|
33
|
+
end
|
34
|
+
|
35
|
+
color
|
36
|
+
end
|
37
|
+
|
38
|
+
##
|
39
|
+
# Opens a file handle with the correct settings for writing an Ozi
|
40
|
+
# Explorer file format.
|
41
|
+
#
|
42
|
+
# @param [String] path
|
43
|
+
# @return [File]
|
44
|
+
#
|
45
|
+
def open_file_for_writing(path)
|
46
|
+
if block_given?
|
47
|
+
file = File.open(path, "w") { |f|
|
48
|
+
f.set_encoding("ISO-8859-1", "UTF-8", crlf_newline: true)
|
49
|
+
yield f
|
50
|
+
}
|
51
|
+
|
52
|
+
return nil
|
53
|
+
else
|
54
|
+
file = File.open(path, "w")
|
55
|
+
file.set_encoding("ISO-8859-1", "UTF-8", crlf_newline: true)
|
56
|
+
|
57
|
+
return file
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
data/lib/rozi/track.rb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
|
2
|
+
module Rozi
|
3
|
+
|
4
|
+
##
|
5
|
+
# This class represents a Track in Ozi Explorer. It contains attributes
|
6
|
+
# about the track's appearance as well as a list of track points.
|
7
|
+
#
|
8
|
+
class Track
|
9
|
+
attr_accessor :points
|
10
|
+
|
11
|
+
attr_accessor :line_width, :color, :description, :skip_value, :type,
|
12
|
+
:fill_type, :fill_color
|
13
|
+
|
14
|
+
DEFAULTS = {
|
15
|
+
line_width: 2,
|
16
|
+
color: 255,
|
17
|
+
description: "",
|
18
|
+
skip_value: 1,
|
19
|
+
type: 0,
|
20
|
+
fill_type: 0,
|
21
|
+
fill_color: 0
|
22
|
+
}
|
23
|
+
|
24
|
+
def initialize(args={})
|
25
|
+
@points = args[:points] || []
|
26
|
+
|
27
|
+
DEFAULTS.each_pair { |key, value| set(key, value) }
|
28
|
+
|
29
|
+
args.each_pair { |key, value| set(key, value) }
|
30
|
+
end
|
31
|
+
|
32
|
+
##
|
33
|
+
# @returns [Array] the attributes of the track as an Array
|
34
|
+
#
|
35
|
+
def attributes
|
36
|
+
[@line_width, @color, @description, @skip_value,
|
37
|
+
@type, @fill_type, @fill_color]
|
38
|
+
end
|
39
|
+
|
40
|
+
##
|
41
|
+
# Allows adding points to the track using the `<<` syntax.
|
42
|
+
#
|
43
|
+
def <<(point)
|
44
|
+
@points << point
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def set(key, value)
|
50
|
+
begin
|
51
|
+
self.send(key.to_s() + "=", value)
|
52
|
+
rescue NoMethodError
|
53
|
+
fail ArgumentError, "Not a valid attribute: #{key}"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
|
2
|
+
module Rozi
|
3
|
+
|
4
|
+
class TrackPoint
|
5
|
+
attr_accessor :latitude, :longitude, :break, :altitude, :date,
|
6
|
+
:date_string, :time_string
|
7
|
+
|
8
|
+
DEFAULTS = {
|
9
|
+
break: 0,
|
10
|
+
altitude: -777,
|
11
|
+
date: 0,
|
12
|
+
date_string: "",
|
13
|
+
time_string: ""
|
14
|
+
}
|
15
|
+
|
16
|
+
def initialize(args={})
|
17
|
+
DEFAULTS.each_pair { |key, value| set(key, value) }
|
18
|
+
|
19
|
+
args.each_pair { |key, value| set(key, value) }
|
20
|
+
end
|
21
|
+
|
22
|
+
def to_a
|
23
|
+
[@latitude, @longitude, @break, @altitude,
|
24
|
+
@date, @date_string, @time_string]
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def set(key, value)
|
30
|
+
begin
|
31
|
+
self.send(key.to_s() + "=", value)
|
32
|
+
rescue NoMethodError
|
33
|
+
fail ArgumentError, "Not a valid attribute: #{key}"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
|
2
|
+
require "rozi/ozi_functions"
|
3
|
+
|
4
|
+
module Rozi
|
5
|
+
|
6
|
+
class TrackWriter
|
7
|
+
|
8
|
+
include OziFunctions
|
9
|
+
|
10
|
+
##
|
11
|
+
# Writes the track to +file+ as an Ozi Explorer .plt file.
|
12
|
+
#
|
13
|
+
# @param [AddressKit::Ozi::Track] track
|
14
|
+
# @param [File, #write] file
|
15
|
+
#
|
16
|
+
def write(track, file)
|
17
|
+
write_inner = Proc.new { |track, file|
|
18
|
+
file.write(<<-TEXT)
|
19
|
+
OziExplorer Track Point File Version 2.1
|
20
|
+
WGS 84
|
21
|
+
Altitude is in Feet
|
22
|
+
Reserved 3
|
23
|
+
TEXT
|
24
|
+
|
25
|
+
file.write(track_attributes_to_text(track))
|
26
|
+
file.write("\n")
|
27
|
+
|
28
|
+
file.write(track.points.count.to_s() + "\n")
|
29
|
+
|
30
|
+
track.points.each { |point|
|
31
|
+
file.write(track_point_to_text(point))
|
32
|
+
file.write("\n")
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
if file.is_a? String
|
37
|
+
open_file_for_writing(file) { |f|
|
38
|
+
write_inner.call(track, f)
|
39
|
+
}
|
40
|
+
else
|
41
|
+
write_inner.call(track, file)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def track_attributes_to_text(track)
|
46
|
+
attrs = track.attributes
|
47
|
+
attrs.map! { |item| item.is_a?(String) ? escape_text(item) : item }
|
48
|
+
|
49
|
+
"0,%d,%d,%s,%d,%d,%d,%d" % attrs
|
50
|
+
end
|
51
|
+
|
52
|
+
def track_point_to_text(point)
|
53
|
+
p = point.to_a()
|
54
|
+
|
55
|
+
" %.6f,%.6f,%d,%.1f,%.7f,%s,%s" % p
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
data/lib/rozi/version.rb
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
|
2
|
+
require "rozi/ozi_functions"
|
3
|
+
|
4
|
+
module Rozi
|
5
|
+
|
6
|
+
##
|
7
|
+
# Represents a waypoint in Ozi Explorer.
|
8
|
+
#
|
9
|
+
class Waypoint
|
10
|
+
|
11
|
+
include OziFunctions
|
12
|
+
|
13
|
+
# TODO: Finish list of symbols.
|
14
|
+
SYMBOLS = {:default => 3, :house => 10}
|
15
|
+
|
16
|
+
attr_accessor :number, :name, :latitude, :longitude, :date,
|
17
|
+
:display_format, :description, :pointer_direction, :altitude,
|
18
|
+
:font_size, :font_style, :symbol_size
|
19
|
+
|
20
|
+
attr_reader :fg_color, :bg_color
|
21
|
+
|
22
|
+
def initialize(args={})
|
23
|
+
@number = -1
|
24
|
+
@name = ""
|
25
|
+
@latitude = 0.0
|
26
|
+
@longitude = 0.0
|
27
|
+
@date = nil
|
28
|
+
@symbol = 3
|
29
|
+
@display_format = 4
|
30
|
+
@fg_color = 0
|
31
|
+
@bg_color = 65535
|
32
|
+
@description = ""
|
33
|
+
@pointer_direction = 0
|
34
|
+
@altitude = -777
|
35
|
+
@font_size = 6
|
36
|
+
@font_style = 0
|
37
|
+
@symbol_size = 17
|
38
|
+
|
39
|
+
args.each_pair { |key, value|
|
40
|
+
begin
|
41
|
+
self.send(key.to_s() + "=", value)
|
42
|
+
rescue NoMethodError
|
43
|
+
fail ArgumentError, "Not a valid attribute: #{key}"
|
44
|
+
end
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
def to_a
|
49
|
+
[@number, @name, @latitude, @longitude, @date, @symbol, @display_format,
|
50
|
+
@fg_color, @bg_color, @description, @pointer_direction, @altitude,
|
51
|
+
@font_size, @font_style, @symbol_size]
|
52
|
+
end
|
53
|
+
|
54
|
+
def symbol=(value)
|
55
|
+
if value.is_a? Symbol
|
56
|
+
value = SYMBOLS[value]
|
57
|
+
end
|
58
|
+
|
59
|
+
@symbol = value
|
60
|
+
end
|
61
|
+
|
62
|
+
##
|
63
|
+
# Returns the symbol as a +Symbol+ by default. Pass +:number+ to return
|
64
|
+
# the symbol as a integer.
|
65
|
+
#
|
66
|
+
def symbol(format=:symbol)
|
67
|
+
@@symbols_rev ||= SYMBOLS.invert()
|
68
|
+
|
69
|
+
case format
|
70
|
+
when :symbol then @@symbols_rev[@symbol]
|
71
|
+
when :number then @symbol
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
##
|
76
|
+
# Sets the foreground color. Accepts a hex string or a decimal value.
|
77
|
+
#
|
78
|
+
def fg_color=(color)
|
79
|
+
@fg_color = interpret_color(color)
|
80
|
+
end
|
81
|
+
|
82
|
+
##
|
83
|
+
# Sets the background color. Accepts a hex string or a decimal value.
|
84
|
+
#
|
85
|
+
def bg_color=(color)
|
86
|
+
@bg_color = interpret_color(color)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
|
2
|
+
require "rozi/ozi_functions"
|
3
|
+
|
4
|
+
module Rozi
|
5
|
+
|
6
|
+
##
|
7
|
+
# This class writes a list of waypoints to a ".wpt" file that can be opened
|
8
|
+
# by Ozi Explorer.
|
9
|
+
#
|
10
|
+
class WaypointWriter
|
11
|
+
|
12
|
+
include OziFunctions
|
13
|
+
|
14
|
+
def write(waypoints, file)
|
15
|
+
write_inner = Proc.new { |waypoints, file|
|
16
|
+
file.write <<-TEXT
|
17
|
+
OziExplorer Waypoint File Version 1.1
|
18
|
+
WGS 84
|
19
|
+
Reserved 2
|
20
|
+
|
21
|
+
TEXT
|
22
|
+
|
23
|
+
waypoints.each { |wpt|
|
24
|
+
file.write(waypoint_to_text(wpt))
|
25
|
+
file.write("\n")
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
if file.is_a? String
|
30
|
+
file = open_file_for_writing(file) { |f|
|
31
|
+
write_inner.call(waypoints, f)
|
32
|
+
}
|
33
|
+
else
|
34
|
+
write_inner.call(waypoints, file)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def waypoint_to_text(waypoint)
|
39
|
+
wpt = waypoint.to_a()
|
40
|
+
wpt.map! { |item| item.is_a?(String) ? escape_text(item) : item }
|
41
|
+
wpt.map! { |item| item.nil? ? "" : item }
|
42
|
+
wpt.map! { |item| item.is_a?(Float) ? item.round(6) : item }
|
43
|
+
|
44
|
+
"%d,%s,%f,%f,%s,%d,1,%d,%d,%d,%s,%d,,,%d,%d,%d,%d" % wpt
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
|
2
|
+
require "rozi/track_point"
|
3
|
+
require "minitest/autorun"
|
4
|
+
|
5
|
+
module Rozi
|
6
|
+
|
7
|
+
class TrackPointTest < Minitest::Test
|
8
|
+
def test_initialize_defaults
|
9
|
+
point = TrackPoint.new()
|
10
|
+
|
11
|
+
TrackPoint::DEFAULTS.each_pair { |key, value|
|
12
|
+
assert_equal value, point.send(key)
|
13
|
+
}
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_initialize_with_args
|
17
|
+
attrs = {latitude: 123.45, longitude: 567.89, break: 1}
|
18
|
+
point = TrackPoint.new(attrs)
|
19
|
+
|
20
|
+
attrs.each_pair { |key, value|
|
21
|
+
assert_equal value, point.send(key)
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_to_a
|
26
|
+
point = TrackPoint.new(latitude: 123.45, longitude: 234.56)
|
27
|
+
|
28
|
+
assert_equal(
|
29
|
+
[123.45, 234.56, 0, -777, 0, "", ""],
|
30
|
+
point.to_a()
|
31
|
+
)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
require "rozi/track"
|
3
|
+
|
4
|
+
module Rozi
|
5
|
+
|
6
|
+
class TrackTest < Minitest::Test
|
7
|
+
def test_initialize_defaults
|
8
|
+
t = Track.new()
|
9
|
+
|
10
|
+
Track::DEFAULTS.each_pair { |key, value|
|
11
|
+
assert_equal value, t.send(key)
|
12
|
+
}
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_initialize_with_args
|
16
|
+
points = [:foo, :bar]
|
17
|
+
attrs = {points: points, line_width: 2, type: 10}
|
18
|
+
|
19
|
+
t = Track.new(attrs)
|
20
|
+
|
21
|
+
attrs.each_pair { |key, value|
|
22
|
+
assert_equal value, t.send(key)
|
23
|
+
}
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
|
2
|
+
require "stringio"
|
3
|
+
|
4
|
+
require "rozi/track_writer"
|
5
|
+
|
6
|
+
module Rozi
|
7
|
+
|
8
|
+
class TrackWriterTest < Minitest::Test
|
9
|
+
def test_write
|
10
|
+
point1 = mock()
|
11
|
+
point1.expects(:to_a).returns([12.34, 56.78, 0, -777, 0, "", ""])
|
12
|
+
|
13
|
+
point2 = mock()
|
14
|
+
point2.expects(:to_a).returns([23.45, 67.89, 0, -777, 0, "", ""])
|
15
|
+
|
16
|
+
track = mock()
|
17
|
+
track.expects(:attributes).returns([2, 255, "foo, bar", 1, 0, 0, 0])
|
18
|
+
track.expects(:points).twice.returns([point1, point2])
|
19
|
+
|
20
|
+
file = StringIO.new()
|
21
|
+
|
22
|
+
subject = TrackWriter.new()
|
23
|
+
subject.write(track, file)
|
24
|
+
|
25
|
+
file.rewind()
|
26
|
+
|
27
|
+
assert_equal(<<-TRACK, file.read())
|
28
|
+
OziExplorer Track Point File Version 2.1
|
29
|
+
WGS 84
|
30
|
+
Altitude is in Feet
|
31
|
+
Reserved 3
|
32
|
+
0,2,255,fooÑ bar,1,0,0,0
|
33
|
+
2
|
34
|
+
12.340000,56.780000,0,-777.0,0.0000000,,
|
35
|
+
23.450000,67.890000,0,-777.0,0.0000000,,
|
36
|
+
TRACK
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_track_attributes_to_text
|
40
|
+
subject = TrackWriter.new()
|
41
|
+
|
42
|
+
track = mock()
|
43
|
+
track.expects(:attributes).returns([2, 0, "foo, bar", 1, 0, 0, 0])
|
44
|
+
|
45
|
+
assert_equal(
|
46
|
+
"0,2,0,fooÑ bar,1,0,0,0",
|
47
|
+
subject.track_attributes_to_text(track)
|
48
|
+
)
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_track_point_to_text
|
52
|
+
subject = TrackWriter.new()
|
53
|
+
|
54
|
+
point = mock()
|
55
|
+
point.expects(:to_a).returns([12.34, 56.78, 0, -777, 0, "", ""])
|
56
|
+
|
57
|
+
assert_equal(
|
58
|
+
" 12.340000,56.780000,0,-777.0,0.0000000,,",
|
59
|
+
subject.track_point_to_text(point)
|
60
|
+
)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
|
2
|
+
require "rozi/waypoint"
|
3
|
+
|
4
|
+
module Rozi
|
5
|
+
|
6
|
+
class WaypointTest < Minitest::Test
|
7
|
+
def test_initialize
|
8
|
+
wp = Waypoint.new(number: 5, name: "Test point")
|
9
|
+
|
10
|
+
assert_equal "Test point", wp.name
|
11
|
+
assert_equal 5, wp.number
|
12
|
+
|
13
|
+
assert_raises(ArgumentError) {
|
14
|
+
# Invalid attribute "foo".
|
15
|
+
wp = Waypoint.new(foo: 123)
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_symbol
|
20
|
+
wp = Waypoint.new()
|
21
|
+
wp.symbol = :house
|
22
|
+
|
23
|
+
assert_equal :house, wp.symbol
|
24
|
+
assert_equal 10, wp.symbol(:number)
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_colors
|
28
|
+
wp = Waypoint.new()
|
29
|
+
|
30
|
+
wp.fg_color = "000000"
|
31
|
+
assert_equal 0, wp.fg_color
|
32
|
+
|
33
|
+
wp.fg_color = "ABCDEF"
|
34
|
+
assert_equal 15715755, wp.fg_color
|
35
|
+
|
36
|
+
wp.fg_color = 128
|
37
|
+
assert_equal 128, wp.fg_color
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
|
2
|
+
require "rozi/waypoint_writer"
|
3
|
+
require "rozi/waypoint"
|
4
|
+
|
5
|
+
module Rozi
|
6
|
+
|
7
|
+
class WaypointWriterTest < Minitest::Test
|
8
|
+
def setup
|
9
|
+
@subject = WaypointWriter.new()
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_write
|
13
|
+
waypoints = []
|
14
|
+
waypoints << Waypoint.new(
|
15
|
+
name: "Test", latitude: 60.872030, longitude: 12.049732
|
16
|
+
)
|
17
|
+
waypoints << Waypoint.new(
|
18
|
+
name: "Test 2", latitude: 61.872030, longitude: 12.049732
|
19
|
+
)
|
20
|
+
waypoints << Waypoint.new(
|
21
|
+
name: "Test 3", latitude: 60.872030, longitude: 13.049732
|
22
|
+
)
|
23
|
+
|
24
|
+
file = StringIO.new()
|
25
|
+
|
26
|
+
@subject.write(waypoints, file)
|
27
|
+
|
28
|
+
expected_output = <<-TEXT.chomp
|
29
|
+
OziExplorer Waypoint File Version 1.1
|
30
|
+
WGS 84
|
31
|
+
Reserved 2
|
32
|
+
|
33
|
+
-1,Test,60.872030,12.049732,,3,1,4,0,65535,,0,,,-777,6,0,17
|
34
|
+
-1,Test 2,61.872030,12.049732,,3,1,4,0,65535,,0,,,-777,6,0,17
|
35
|
+
-1,Test 3,60.872030,13.049732,,3,1,4,0,65535,,0,,,-777,6,0,17
|
36
|
+
TEXT
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_waypoint_to_text
|
40
|
+
wpt = Waypoint.new(name: "test")
|
41
|
+
|
42
|
+
assert_equal(
|
43
|
+
"-1,test,0.000000,0.000000,,3,1,4,0,65535,,0,,,-777,6,0,17",
|
44
|
+
@subject.waypoint_to_text(wpt)
|
45
|
+
)
|
46
|
+
|
47
|
+
wpt = Waypoint.new(name: "test", symbol: :house)
|
48
|
+
|
49
|
+
assert_equal(
|
50
|
+
"-1,test,0.000000,0.000000,,10,1,4,0,65535,,0,,,-777,6,0,17",
|
51
|
+
@subject.waypoint_to_text(wpt)
|
52
|
+
)
|
53
|
+
|
54
|
+
wpt = Waypoint.new(name: "test", description: "æøå, ÆØÅ")
|
55
|
+
|
56
|
+
assert_equal(
|
57
|
+
"-1,test,0.000000,0.000000,,3,1,4,0,65535,æøåÑ ÆØÅ,0,,,-777,6,0,17",
|
58
|
+
@subject.waypoint_to_text(wpt)
|
59
|
+
)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
metadata
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rozi
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tomas Sandven
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-05-06 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email: tomas191191@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/rozi.rb
|
20
|
+
- lib/rozi/ozi_functions.rb
|
21
|
+
- lib/rozi/track.rb
|
22
|
+
- lib/rozi/track_point.rb
|
23
|
+
- lib/rozi/track_writer.rb
|
24
|
+
- lib/rozi/version.rb
|
25
|
+
- lib/rozi/waypoint.rb
|
26
|
+
- lib/rozi/waypoint_writer.rb
|
27
|
+
- test/rozi/track_point_test.rb
|
28
|
+
- test/rozi/track_test.rb
|
29
|
+
- test/rozi/track_writer_test.rb
|
30
|
+
- test/rozi/waypoint_test.rb
|
31
|
+
- test/rozi/waypoint_writer_test.rb
|
32
|
+
homepage:
|
33
|
+
licenses:
|
34
|
+
- GPL
|
35
|
+
metadata: {}
|
36
|
+
post_install_message:
|
37
|
+
rdoc_options: []
|
38
|
+
require_paths:
|
39
|
+
- lib
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - '>='
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
requirements: []
|
51
|
+
rubyforge_project:
|
52
|
+
rubygems_version: 2.2.2
|
53
|
+
signing_key:
|
54
|
+
specification_version: 4
|
55
|
+
summary: A gem for working with several Ozi Explorer file formats
|
56
|
+
test_files:
|
57
|
+
- test/rozi/waypoint_test.rb
|
58
|
+
- test/rozi/track_point_test.rb
|
59
|
+
- test/rozi/track_writer_test.rb
|
60
|
+
- test/rozi/waypoint_writer_test.rb
|
61
|
+
- test/rozi/track_test.rb
|