fdc 0.0.5 → 0.1.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/fdc +1 -1
- data/lib/fdc/converter.rb +37 -9
- metadata +5 -8
data/bin/fdc
CHANGED
@@ -98,7 +98,7 @@ ARGV.each do |file|
|
|
98
98
|
next
|
99
99
|
end
|
100
100
|
|
101
|
-
@converter.compile
|
101
|
+
@converter.compile clamp: options[:clamp], extrude: options[:extrude], gps: options[:gps]
|
102
102
|
|
103
103
|
if options[:stdout]
|
104
104
|
STDOUT.puts @converter.kml
|
data/lib/fdc/converter.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'pathname'
|
2
|
+
require 'securerandom'
|
2
3
|
|
3
4
|
require 'fdc/utilities'
|
4
5
|
require 'fdc/exceptions'
|
@@ -39,21 +40,48 @@ class Fdc::Converter
|
|
39
40
|
@parser.parse @file
|
40
41
|
|
41
42
|
end
|
43
|
+
|
44
|
+
# Parse IGC file data from a supplied string
|
45
|
+
#
|
46
|
+
# @param [String] data The contents of the IGC file
|
47
|
+
# @param [Hash] opts Optional paramers
|
48
|
+
# @option opts [String] :encoding The encoding of the igc file data
|
49
|
+
# @raise [Fdc::FileFormatError] If the file format is invalid
|
50
|
+
def parse_str(data, opts={})
|
51
|
+
@parser.parse data
|
52
|
+
end
|
42
53
|
|
43
|
-
# Compile the KML document from the parsed IGC file.
|
54
|
+
# # Compile the KML document from the parsed IGC file.
|
55
|
+
# #
|
56
|
+
# # @param [Boolean] clamp Whether the track should be clamped to the ground
|
57
|
+
# # @param [Boolean] extrude Whether the track should be extruded to the ground
|
58
|
+
# # @param [Boolean] gps Whether GPS altitude information should be used
|
59
|
+
# # @raise [RuntimeError] If {#parse} was not called before
|
60
|
+
# def compile(clamp=false, extrude=false, gps=false)
|
61
|
+
#
|
62
|
+
# # State assertion
|
63
|
+
# raise RuntimeError, "Cannot compile without preceding parse" unless @parser.ready?
|
64
|
+
#
|
65
|
+
# name = @path.basename(@path.extname)
|
66
|
+
# @compiler.compile name, clamp, extrude, gps
|
44
67
|
#
|
45
|
-
#
|
46
|
-
# @param [Boolean] extrude Whether the track should be extruded to the ground
|
47
|
-
# @param [Boolean] gps Whether GPS altitude information should be used
|
48
|
-
# @raise [RuntimeError] If {#parse} was not called before
|
49
|
-
def compile(clamp=false, extrude=false, gps=false)
|
68
|
+
# end
|
50
69
|
|
70
|
+
# Compile the KML document from the parsed IGC file
|
71
|
+
#
|
72
|
+
# @param [Hash] opts Options for the compiled KML
|
73
|
+
# @option opts [String] :name The name of the document
|
74
|
+
# @option opts [Boolean] :clamp Whether the track should be clamped to the ground
|
75
|
+
# @option opts [Boolean] :extrude Whether the track should be extruded to the ground
|
76
|
+
# @option opts [Boolean] :gps Whether GPS altitude information should be used
|
77
|
+
def compile(opts={})
|
78
|
+
|
51
79
|
# State assertion
|
52
80
|
raise RuntimeError, "Cannot compile without preceding parse" unless @parser.ready?
|
53
81
|
|
54
|
-
name =
|
55
|
-
@compiler.compile name, clamp, extrude, gps
|
56
|
-
|
82
|
+
name = opts[:name] or SecureRandom.hex(8)
|
83
|
+
@compiler.compile name, opts[:clamp], opts[:extrude], opts[:gps]
|
84
|
+
|
57
85
|
end
|
58
86
|
|
59
87
|
# Export the compiled KML document
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fdc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.0.beta.1
|
5
|
+
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Tobias Noiges
|
@@ -72,16 +72,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
72
72
|
version: '0'
|
73
73
|
segments:
|
74
74
|
- 0
|
75
|
-
hash:
|
75
|
+
hash: -403667447316499823
|
76
76
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
77
|
none: false
|
78
78
|
requirements:
|
79
|
-
- - ! '
|
79
|
+
- - ! '>'
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version:
|
82
|
-
segments:
|
83
|
-
- 0
|
84
|
-
hash: 3174214199651078789
|
81
|
+
version: 1.3.1
|
85
82
|
requirements: []
|
86
83
|
rubyforge_project:
|
87
84
|
rubygems_version: 1.8.24
|