open_gpx_2_kml 1.0.5 → 1.1.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.
- data/.rspec +1 -0
- data/Gemfile.lock +1 -1
- data/example/config.csv +9 -1
- data/example/windowsconfig.csv +9 -1
- data/lib/tf1_converter/config.rb +14 -1
- data/lib/tf1_converter/csv_file.rb +10 -1
- data/lib/tf1_converter/kml/placemark.rb +51 -0
- data/lib/tf1_converter/kml_file.rb +4 -30
- data/lib/tf1_converter/version.rb +1 -1
- data/spec/environment/config.csv +8 -0
- data/spec/fixtures/expected.kml +15 -15
- data/spec/lib/tf1_converter/config_spec.rb +22 -0
- data/spec/lib/tf1_converter/csv_file_spec.rb +15 -7
- metadata +6 -4
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile.lock
CHANGED
data/example/config.csv
CHANGED
@@ -54,4 +54,12 @@ false
|
|
54
54
|
|
55
55
|
The color to use if the constant color switch is flipped (must be a key from the colors table)
|
56
56
|
CONSTANT_COLOR
|
57
|
-
Blue
|
57
|
+
Blue
|
58
|
+
|
59
|
+
use 'windows' to make file paths get translated to backslashes
|
60
|
+
PLATFORM
|
61
|
+
mac
|
62
|
+
|
63
|
+
(use 'ON' to have symbol names output in kmz popups from symbols)
|
64
|
+
GE_SYMBOL_NAME
|
65
|
+
ON
|
data/example/windowsconfig.csv
CHANGED
@@ -54,4 +54,12 @@ false
|
|
54
54
|
|
55
55
|
The color to use if the constant color switch is flipped (must be a key from the colors table)
|
56
56
|
CONSTANT_COLOR
|
57
|
-
Blue
|
57
|
+
Blue
|
58
|
+
|
59
|
+
use 'windows' to make file paths get translated to backslashes
|
60
|
+
PLATFORM
|
61
|
+
windows
|
62
|
+
|
63
|
+
(use 'ON' to have symbol names output in kmz popups from symbols)
|
64
|
+
GE_SYMBOL_NAME
|
65
|
+
ON
|
data/lib/tf1_converter/config.rb
CHANGED
@@ -13,12 +13,21 @@ module TF1Converter
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
%w(icon_path icons colors input output use_constant_color
|
16
|
+
method_names = %w(icon_path icons colors input output use_constant_color platform ge_symbol_name)
|
17
|
+
method_names.each do |name|
|
17
18
|
define_singleton_method(name.to_sym) do
|
18
19
|
instance_variable_get("@#{name}")
|
19
20
|
end
|
20
21
|
end
|
21
22
|
|
23
|
+
def self.is_windows?
|
24
|
+
self.platform == 'WINDOWS'
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.show_ge_symbol_names?
|
28
|
+
self.ge_symbol_name == 'ON'
|
29
|
+
end
|
30
|
+
|
22
31
|
def self.parse_row(row)
|
23
32
|
if @last_key == 'INPUT'
|
24
33
|
@input = row[0]
|
@@ -36,6 +45,10 @@ module TF1Converter
|
|
36
45
|
@use_constant_color = row[0].strip.downcase == 'true'
|
37
46
|
elsif @last_key == 'CONSTANT_COLOR'
|
38
47
|
@constant_color = row[0]
|
48
|
+
elsif @last_key == 'PLATFORM'
|
49
|
+
@platform = row[0].strip.upcase
|
50
|
+
elsif @last_key == 'GE_SYMBOL_NAME'
|
51
|
+
@ge_symbol_name = row[0].strip.upcase
|
39
52
|
end
|
40
53
|
if @current_control == 'ICONS'
|
41
54
|
if row.compact.empty?
|
@@ -11,11 +11,20 @@ module TF1Converter
|
|
11
11
|
CSV.open(@path, 'wb') do |csv|
|
12
12
|
csv << ['filename', 'name', 'meaning', 'time', 'lat', 'long', 'usng', 'elevation']
|
13
13
|
@waypoints.each do |wp|
|
14
|
-
csv << [
|
14
|
+
csv << [full_filename, wp.name, wp.icon_meaning, wp.timestamp, wp.lat, wp.long, wp.usng, ele_for(wp)]
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
+
def full_filename
|
20
|
+
name = CsvFile.translate_filename(@path)
|
21
|
+
if ::TF1Converter::Config.is_windows?
|
22
|
+
name.gsub("/", "\\")
|
23
|
+
else
|
24
|
+
name
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
19
28
|
def raw_path
|
20
29
|
CsvFile.raw_path(@path)
|
21
30
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module TF1Converter
|
2
|
+
module Kml
|
3
|
+
class Placemark
|
4
|
+
attr_reader :waypoint, :filename
|
5
|
+
|
6
|
+
def initialize(waypoint, filename)
|
7
|
+
@waypoint = waypoint
|
8
|
+
@filename = filename
|
9
|
+
end
|
10
|
+
|
11
|
+
def write_to(xml)
|
12
|
+
xml.Placemark do
|
13
|
+
if ::TF1Converter::Config.show_ge_symbol_names?
|
14
|
+
xml.name(waypoint.name)
|
15
|
+
end
|
16
|
+
xml.Snippet(maxLines: '0')
|
17
|
+
xml.Style(id: 'normalPlacemark') do
|
18
|
+
xml.IconStyle do
|
19
|
+
xml.Icon do
|
20
|
+
xml.href("files/#{waypoint.icon_name}")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
xml.description do
|
26
|
+
xml.cdata description_for(waypoint)
|
27
|
+
end
|
28
|
+
|
29
|
+
xml.Point do
|
30
|
+
xml.coordinates "#{waypoint.long},#{waypoint.lat}"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
def description_for(waypoint)
|
37
|
+
desc = ""
|
38
|
+
desc << waypoint.timestamp
|
39
|
+
desc << '<br>' << waypoint.name
|
40
|
+
desc << '<br>' << waypoint.icon_meaning
|
41
|
+
desc << '<br>' << "Filename: #{filename}"
|
42
|
+
desc << "<br>" << "USNG: #{waypoint.usng}"
|
43
|
+
desc << "<br>" << "Lat,Long: #{waypoint.lat},#{waypoint.long}"
|
44
|
+
if waypoint.elevation.is_a? String
|
45
|
+
desc << "<br>" << "Elevation: #{waypoint.elevation}"
|
46
|
+
end
|
47
|
+
return desc
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require_relative 'kml/track_node'
|
2
|
+
require_relative 'kml/placemark'
|
2
3
|
|
3
4
|
module TF1Converter
|
4
5
|
class KmlFile
|
@@ -45,38 +46,11 @@ module TF1Converter
|
|
45
46
|
end
|
46
47
|
|
47
48
|
def write_waypoint_xml(waypoint, xml)
|
48
|
-
|
49
|
-
|
50
|
-
xml.Snippet(maxLines: '0')
|
51
|
-
xml.Style(id: 'normalPlacemark') do
|
52
|
-
xml.IconStyle do
|
53
|
-
xml.Icon do
|
54
|
-
xml.href("files/#{waypoint.icon_name}")
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
xml.description do
|
60
|
-
xml.cdata description_for(waypoint)
|
61
|
-
end
|
62
|
-
|
63
|
-
xml.Point do
|
64
|
-
xml.coordinates "#{waypoint.long},#{waypoint.lat}"
|
65
|
-
end
|
66
|
-
end
|
49
|
+
placemark = Kml::Placemark.new(waypoint, @filename)
|
50
|
+
placemark.write_to(xml)
|
67
51
|
end
|
68
52
|
|
69
|
-
|
70
|
-
desc = ""
|
71
|
-
desc << waypoint.timestamp
|
72
|
-
desc << '<br>' << waypoint.icon_meaning
|
73
|
-
desc << '<br>' << "Filename: #{@filename}"
|
74
|
-
desc << "<br>" << "USNG: #{waypoint.usng}"
|
75
|
-
desc << "<br>" << "Lat,Long: #{waypoint.lat},#{waypoint.long}"
|
76
|
-
if waypoint.elevation.is_a? String
|
77
|
-
desc << "<br>" << "Elevation: #{waypoint.elevation}"
|
78
|
-
end
|
79
|
-
end
|
53
|
+
|
80
54
|
|
81
55
|
end
|
82
56
|
end
|
data/spec/environment/config.csv
CHANGED
@@ -58,3 +58,11 @@ Custom 21,22.png,Route Blocked,&22
|
|
58
58
|
Custom 22,23.png,Extra 23,&23
|
59
59
|
Custom 23,24.png,Extra 24,&24
|
60
60
|
Default,default.png,Default,
|
61
|
+
|
62
|
+
(use 'windows' to make file paths get translated to backslashes)
|
63
|
+
PLATFORM
|
64
|
+
mac
|
65
|
+
|
66
|
+
(use 'ON' to have symbol names output in kmz popups from symbols)
|
67
|
+
GE_SYMBOL_NAME
|
68
|
+
ON
|
data/spec/fixtures/expected.kml
CHANGED
@@ -21,7 +21,7 @@
|
|
21
21
|
</Icon>
|
22
22
|
</IconStyle>
|
23
23
|
</Style>
|
24
|
-
<description><![CDATA[18-OCT-09 2:17:38PM<br>Search Start<br>Filename: test<br>USNG: 15S WD 60922 8133<br>Lat,Long: 38.9199972,-92.2972443<br>Elevation: 159.7036133]]></description>
|
24
|
+
<description><![CDATA[18-OCT-09 2:17:38PM<br>001<br>Search Start<br>Filename: test<br>USNG: 15S WD 60922 8133<br>Lat,Long: 38.9199972,-92.2972443<br>Elevation: 159.7036133]]></description>
|
25
25
|
<Point>
|
26
26
|
<coordinates>-92.2972443,38.9199972</coordinates>
|
27
27
|
</Point>
|
@@ -36,7 +36,7 @@
|
|
36
36
|
</Icon>
|
37
37
|
</IconStyle>
|
38
38
|
</Style>
|
39
|
-
<description><![CDATA[18-OCT-09 2:18:07PM<br>Victim Detected<br>Filename: test<br>USNG: 15S WD 60946 8109<br>Lat,Long: 38.9197762,-92.2969611<br>Elevation: 206.8077393]]></description>
|
39
|
+
<description><![CDATA[18-OCT-09 2:18:07PM<br>002<br>Victim Detected<br>Filename: test<br>USNG: 15S WD 60946 8109<br>Lat,Long: 38.9197762,-92.2969611<br>Elevation: 206.8077393]]></description>
|
40
40
|
<Point>
|
41
41
|
<coordinates>-92.2969611,38.9197762</coordinates>
|
42
42
|
</Point>
|
@@ -51,7 +51,7 @@
|
|
51
51
|
</Icon>
|
52
52
|
</IconStyle>
|
53
53
|
</Style>
|
54
|
-
<description><![CDATA[18-OCT-09 2:18:36PM<br>Victim Confirmed<br>Filename: test<br>USNG: 15S WD 60928 8079<br>Lat,Long: 38.9195040,-92.2971813<br>Elevation: 228.6776123]]></description>
|
54
|
+
<description><![CDATA[18-OCT-09 2:18:36PM<br>003<br>Victim Confirmed<br>Filename: test<br>USNG: 15S WD 60928 8079<br>Lat,Long: 38.9195040,-92.2971813<br>Elevation: 228.6776123]]></description>
|
55
55
|
<Point>
|
56
56
|
<coordinates>-92.2971813,38.9195040</coordinates>
|
57
57
|
</Point>
|
@@ -66,7 +66,7 @@
|
|
66
66
|
</Icon>
|
67
67
|
</IconStyle>
|
68
68
|
</Style>
|
69
|
-
<description><![CDATA[18-OCT-09 2:19:49PM<br>Collection Point<br>Filename: test<br>USNG: 15S WD 60883 8039<br>Lat,Long: 38.9191455,-92.2977024<br>Elevation: 230.8405762]]></description>
|
69
|
+
<description><![CDATA[18-OCT-09 2:19:49PM<br>004<br>Collection Point<br>Filename: test<br>USNG: 15S WD 60883 8039<br>Lat,Long: 38.9191455,-92.2977024<br>Elevation: 230.8405762]]></description>
|
70
70
|
<Point>
|
71
71
|
<coordinates>-92.2977024,38.9191455</coordinates>
|
72
72
|
</Point>
|
@@ -81,7 +81,7 @@
|
|
81
81
|
</Icon>
|
82
82
|
</IconStyle>
|
83
83
|
</Style>
|
84
|
-
<description><![CDATA[18-OCT-09 2:20:33PM<br>Structure Damage / Safe<br>Filename: test<br>USNG: 15S WD 60912 8043<br>Lat,Long: 38.9191831,-92.2973642<br>Elevation: 234.6857910]]></description>
|
84
|
+
<description><![CDATA[18-OCT-09 2:20:33PM<br>005<br>Structure Damage / Safe<br>Filename: test<br>USNG: 15S WD 60912 8043<br>Lat,Long: 38.9191831,-92.2973642<br>Elevation: 234.6857910]]></description>
|
85
85
|
<Point>
|
86
86
|
<coordinates>-92.2973642,38.9191831</coordinates>
|
87
87
|
</Point>
|
@@ -96,7 +96,7 @@
|
|
96
96
|
</Icon>
|
97
97
|
</IconStyle>
|
98
98
|
</Style>
|
99
|
-
<description><![CDATA[18-OCT-09 2:21:40PM<br>Criminal Activity<br>Filename: test<br>USNG: 15S WD 60966 8093<br>Lat,Long: 38.9196337,-92.2967348<br>Elevation: 237.3294678]]></description>
|
99
|
+
<description><![CDATA[18-OCT-09 2:21:40PM<br>006<br>Criminal Activity<br>Filename: test<br>USNG: 15S WD 60966 8093<br>Lat,Long: 38.9196337,-92.2967348<br>Elevation: 237.3294678]]></description>
|
100
100
|
<Point>
|
101
101
|
<coordinates>-92.2967348,38.9196337</coordinates>
|
102
102
|
</Point>
|
@@ -111,7 +111,7 @@
|
|
111
111
|
</Icon>
|
112
112
|
</IconStyle>
|
113
113
|
</Style>
|
114
|
-
<description><![CDATA[18-OCT-09 2:22:29PM<br>Command Post<br>Filename: test<br>USNG: 15S WD 61002 8066<br>Lat,Long: 38.9193832,-92.2963225<br>Elevation: 239.7326660]]></description>
|
114
|
+
<description><![CDATA[18-OCT-09 2:22:29PM<br>007<br>Command Post<br>Filename: test<br>USNG: 15S WD 61002 8066<br>Lat,Long: 38.9193832,-92.2963225<br>Elevation: 239.7326660]]></description>
|
115
115
|
<Point>
|
116
116
|
<coordinates>-92.2963225,38.9193832</coordinates>
|
117
117
|
</Point>
|
@@ -126,7 +126,7 @@
|
|
126
126
|
</Icon>
|
127
127
|
</IconStyle>
|
128
128
|
</Style>
|
129
|
-
<description><![CDATA[18-OCT-09 2:23:14PM<br>Staging Area<br>Filename: test<br>USNG: 15S WD 61033 8055<br>Lat,Long: 38.9192829,-92.2959630<br>Elevation: 239.9730225]]></description>
|
129
|
+
<description><![CDATA[18-OCT-09 2:23:14PM<br>008<br>Staging Area<br>Filename: test<br>USNG: 15S WD 61033 8055<br>Lat,Long: 38.9192829,-92.2959630<br>Elevation: 239.9730225]]></description>
|
130
130
|
<Point>
|
131
131
|
<coordinates>-92.2959630,38.9192829</coordinates>
|
132
132
|
</Point>
|
@@ -141,7 +141,7 @@
|
|
141
141
|
</Icon>
|
142
142
|
</IconStyle>
|
143
143
|
</Style>
|
144
|
-
<description><![CDATA[18-OCT-09 2:24:06PM<br>Meaning 19<br>Filename: test<br>USNG: 15S WD 60985 8098<br>Lat,Long: 38.9196773,-92.2965171<br>Elevation: 238.5311279]]></description>
|
144
|
+
<description><![CDATA[18-OCT-09 2:24:06PM<br>009<br>Meaning 19<br>Filename: test<br>USNG: 15S WD 60985 8098<br>Lat,Long: 38.9196773,-92.2965171<br>Elevation: 238.5311279]]></description>
|
145
145
|
<Point>
|
146
146
|
<coordinates>-92.2965171,38.9196773</coordinates>
|
147
147
|
</Point>
|
@@ -156,7 +156,7 @@
|
|
156
156
|
</Icon>
|
157
157
|
</IconStyle>
|
158
158
|
</Style>
|
159
|
-
<description><![CDATA[18-OCT-09 2:25:24PM<br>Meaning 16<br>Filename: test<br>USNG: 15S WD 60909 8156<br>Lat,Long: 38.9202020,-92.2973907<br>Elevation: 237.5697021]]></description>
|
159
|
+
<description><![CDATA[18-OCT-09 2:25:24PM<br>010<br>Meaning 16<br>Filename: test<br>USNG: 15S WD 60909 8156<br>Lat,Long: 38.9202020,-92.2973907<br>Elevation: 237.5697021]]></description>
|
160
160
|
<Point>
|
161
161
|
<coordinates>-92.2973907,38.9202020</coordinates>
|
162
162
|
</Point>
|
@@ -171,7 +171,7 @@
|
|
171
171
|
</Icon>
|
172
172
|
</IconStyle>
|
173
173
|
</Style>
|
174
|
-
<description><![CDATA[18-OCT-09 2:26:20PM<br>Extra 21<br>Filename: test<br>USNG: 15S WD 60918 8213<br>Lat,Long: 38.9207150,-92.2972759<br>Elevation: 236.1278076]]></description>
|
174
|
+
<description><![CDATA[18-OCT-09 2:26:20PM<br>011<br>Extra 21<br>Filename: test<br>USNG: 15S WD 60918 8213<br>Lat,Long: 38.9207150,-92.2972759<br>Elevation: 236.1278076]]></description>
|
175
175
|
<Point>
|
176
176
|
<coordinates>-92.2972759,38.9207150</coordinates>
|
177
177
|
</Point>
|
@@ -186,7 +186,7 @@
|
|
186
186
|
</Icon>
|
187
187
|
</IconStyle>
|
188
188
|
</Style>
|
189
|
-
<description><![CDATA[18-OCT-09 2:26:40PM<br>Extra 22<br>Filename: test<br>USNG: 15S WD 60902 8223<br>Lat,Long: 38.9208083,-92.2974574<br>Elevation: 234.9260254]]></description>
|
189
|
+
<description><![CDATA[18-OCT-09 2:26:40PM<br>012<br>Extra 22<br>Filename: test<br>USNG: 15S WD 60902 8223<br>Lat,Long: 38.9208083,-92.2974574<br>Elevation: 234.9260254]]></description>
|
190
190
|
<Point>
|
191
191
|
<coordinates>-92.2974574,38.9208083</coordinates>
|
192
192
|
</Point>
|
@@ -201,7 +201,7 @@
|
|
201
201
|
</Icon>
|
202
202
|
</IconStyle>
|
203
203
|
</Style>
|
204
|
-
<description><![CDATA[18-OCT-09 2:27:10PM<br>Extra 23<br>Filename: test<br>USNG: 15S WD 60880 8191<br>Lat,Long: 38.9205154,-92.2977240<br>Elevation: 235.6469727]]></description>
|
204
|
+
<description><![CDATA[18-OCT-09 2:27:10PM<br>013<br>Extra 23<br>Filename: test<br>USNG: 15S WD 60880 8191<br>Lat,Long: 38.9205154,-92.2977240<br>Elevation: 235.6469727]]></description>
|
205
205
|
<Point>
|
206
206
|
<coordinates>-92.2977240,38.9205154</coordinates>
|
207
207
|
</Point>
|
@@ -216,7 +216,7 @@
|
|
216
216
|
</Icon>
|
217
217
|
</IconStyle>
|
218
218
|
</Style>
|
219
|
-
<description><![CDATA[18-OCT-09 2:29:16PM<br>Search Stop<br>Filename: test<br>USNG: 15S WD 60822 8145<br>Lat,Long: 38.9201116,-92.2983951<br>Elevation: 234.6857910]]></description>
|
219
|
+
<description><![CDATA[18-OCT-09 2:29:16PM<br>014<br>Search Stop<br>Filename: test<br>USNG: 15S WD 60822 8145<br>Lat,Long: 38.9201116,-92.2983951<br>Elevation: 234.6857910]]></description>
|
220
220
|
<Point>
|
221
221
|
<coordinates>-92.2983951,38.9201116</coordinates>
|
222
222
|
</Point>
|
@@ -231,7 +231,7 @@
|
|
231
231
|
</Icon>
|
232
232
|
</IconStyle>
|
233
233
|
</Style>
|
234
|
-
<description><![CDATA[Weber Home<br>Default<br>Filename: test<br>USNG: 15S WD 60826 8138<br>Lat,Long: 38.9200473,-92.2983507<br>Elevation: 235.8873291]]></description>
|
234
|
+
<description><![CDATA[Weber Home<br>2804 Wild Plum<br>Default<br>Filename: test<br>USNG: 15S WD 60826 8138<br>Lat,Long: 38.9200473,-92.2983507<br>Elevation: 235.8873291]]></description>
|
235
235
|
<Point>
|
236
236
|
<coordinates>-92.2983507,38.9200473</coordinates>
|
237
237
|
</Point>
|
@@ -11,4 +11,26 @@ describe TF1Converter::Config do
|
|
11
11
|
TF1Converter::Config.parse_row(['Blue', nil])
|
12
12
|
TF1Converter::Config.colors['Blue'].should_not be_nil
|
13
13
|
end
|
14
|
+
|
15
|
+
it "can load both platforms" do
|
16
|
+
TF1Converter::Config.parse_row(["PLATFORM"])
|
17
|
+
TF1Converter::Config.parse_row(['windows'])
|
18
|
+
TF1Converter::Config.platform.should == "WINDOWS"
|
19
|
+
TF1Converter::Config.is_windows?.should be_true
|
20
|
+
|
21
|
+
TF1Converter::Config.parse_row(["PLATFORM"])
|
22
|
+
TF1Converter::Config.parse_row(["mac"])
|
23
|
+
TF1Converter::Config.platform.should == "MAC"
|
24
|
+
TF1Converter::Config.is_windows?.should be_false
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'has a configuration for displaying symbol names in google earth' do
|
28
|
+
TF1Converter::Config.parse_row(["GE_SYMBOL_NAME"])
|
29
|
+
TF1Converter::Config.parse_row(["ON"])
|
30
|
+
TF1Converter::Config.show_ge_symbol_names?.should be_true
|
31
|
+
|
32
|
+
TF1Converter::Config.parse_row(["GE_SYMBOL_NAME"])
|
33
|
+
TF1Converter::Config.parse_row(["OFF"])
|
34
|
+
TF1Converter::Config.show_ge_symbol_names?.should be_false
|
35
|
+
end
|
14
36
|
end
|
@@ -5,25 +5,33 @@ module TF1Converter
|
|
5
5
|
describe CsvFile do
|
6
6
|
|
7
7
|
describe '#to_csv!' do
|
8
|
+
let(:base_path){ '/some/long.path/with.file/test.gpx' }
|
9
|
+
let(:csv) { [] }
|
10
|
+
|
11
|
+
before do
|
12
|
+
CSV.stub(:open).and_yield(csv)
|
13
|
+
end
|
14
|
+
|
8
15
|
it 'writes waypoints to the csv file' do
|
9
16
|
waypoints = [double('waypoint').as_null_object]
|
10
|
-
base_path = '/some/long.path/with.file/test.gpx'
|
11
|
-
csv = []
|
12
|
-
CSV.stub(:open).and_yield(csv)
|
13
17
|
CsvFile.new(waypoints, base_path).to_csv!
|
14
|
-
csv[1].first.should == '/some/long.path/with.file/test'
|
18
|
+
csv[1].first.should == '/some/long.path/with.file/test.csv'
|
15
19
|
end
|
16
20
|
|
17
21
|
it 'writes a blank string when theres no elevation' do
|
18
22
|
waypoint = double('waypoint', elevation: Gpx::Waypoint::NoElevation).as_null_object
|
19
23
|
waypoints = [waypoint]
|
20
|
-
base_path = '/some/long.path/with.file/test.gpx'
|
21
|
-
csv = []
|
22
|
-
CSV.stub(:open).and_yield(csv)
|
23
24
|
CsvFile.new(waypoints, base_path).to_csv!
|
24
25
|
csv[1].last.should == ''
|
25
26
|
end
|
26
27
|
|
28
|
+
it "uses windows separators if the platform is windows" do
|
29
|
+
::TF1Converter::Config.stub(platform: 'WINDOWS')
|
30
|
+
waypoints = [double('waypoint').as_null_object]
|
31
|
+
CsvFile.new(waypoints, base_path).to_csv!
|
32
|
+
csv[1].first.should == '\some\long.path\with.file\test.csv'
|
33
|
+
end
|
34
|
+
|
27
35
|
end
|
28
36
|
|
29
37
|
describe '.translate_filename' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: open_gpx_2_kml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-09-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -165,6 +165,7 @@ extra_rdoc_files: []
|
|
165
165
|
files:
|
166
166
|
- .gitignore
|
167
167
|
- .rbenv-version
|
168
|
+
- .rspec
|
168
169
|
- Gemfile
|
169
170
|
- Gemfile.lock
|
170
171
|
- README.md
|
@@ -182,6 +183,7 @@ files:
|
|
182
183
|
- lib/tf1_converter/gpx/trackpoint.rb
|
183
184
|
- lib/tf1_converter/gpx/waypoint.rb
|
184
185
|
- lib/tf1_converter/gpx_file.rb
|
186
|
+
- lib/tf1_converter/kml/placemark.rb
|
185
187
|
- lib/tf1_converter/kml/track_color.rb
|
186
188
|
- lib/tf1_converter/kml/track_node.rb
|
187
189
|
- lib/tf1_converter/kml_file.rb
|
@@ -255,7 +257,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
255
257
|
version: '0'
|
256
258
|
segments:
|
257
259
|
- 0
|
258
|
-
hash:
|
260
|
+
hash: 1029358299529324430
|
259
261
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
260
262
|
none: false
|
261
263
|
requirements:
|
@@ -264,7 +266,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
264
266
|
version: '0'
|
265
267
|
segments:
|
266
268
|
- 0
|
267
|
-
hash:
|
269
|
+
hash: 1029358299529324430
|
268
270
|
requirements: []
|
269
271
|
rubyforge_project:
|
270
272
|
rubygems_version: 1.8.23
|