gpx 0.6 → 0.7
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/Gemfile.lock +23 -0
- data/LICENSE.txt +21 -0
- data/gpx.gemspec +16 -0
- data/lib/gpx.rb +1 -1
- data/lib/gpx/gpx.rb +5 -6
- data/lib/gpx/gpx_file.rb +14 -17
- data/lib/gpx/magellan_track_log.rb +2 -2
- data/lib/gpx/point.rb +3 -3
- data/lib/gpx/route.rb +2 -2
- data/lib/gpx/segment.rb +2 -2
- data/lib/gpx/track.rb +5 -4
- data/lib/gpx/waypoint.rb +1 -1
- data/tests/output/myoutput.gpx +9 -5
- data/tests/output/new_gpx_file_from_scratch.gpx +3 -3
- data/tests/segment_test.rb +9 -9
- data/tests/track_test.rb +2 -2
- metadata +40 -41
    
        checksums.yaml
    ADDED
    
    | @@ -0,0 +1,7 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            SHA1:
         | 
| 3 | 
            +
              metadata.gz: a9b34462ca830301f69200682dfcf151ab8ffb0b
         | 
| 4 | 
            +
              data.tar.gz: 5be1f021827ad63d9374fa7aca82a33bbfb0738d
         | 
| 5 | 
            +
            SHA512:
         | 
| 6 | 
            +
              metadata.gz: df4469f3dae0f31aa753637f6d77f8dc9a45e6f70f419cea351b7976f16297f12fd06fda990ef42025181b497c403aa4e0e3a9911fca64c8ae3401d0a9591383
         | 
| 7 | 
            +
              data.tar.gz: 40433303bd14de58e1f9b6c9d5891429d90d71a65b60f8ba8cf00cc01e59c3b55bf50ac9fbff2b9d207603b6b0eb8e9ee65065d8154e45f4a56dc9b0bd79a4c7
         | 
    
        data/Gemfile.lock
    ADDED
    
    | @@ -0,0 +1,23 @@ | |
| 1 | 
            +
            PATH
         | 
| 2 | 
            +
              remote: .
         | 
| 3 | 
            +
              specs:
         | 
| 4 | 
            +
                gpx (0.8)
         | 
| 5 | 
            +
                  nokogiri
         | 
| 6 | 
            +
                  rake
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            GEM
         | 
| 9 | 
            +
              remote: https://rubygems.org/
         | 
| 10 | 
            +
              specs:
         | 
| 11 | 
            +
                mini_portile (0.6.2)
         | 
| 12 | 
            +
                minitest (5.6.1)
         | 
| 13 | 
            +
                nokogiri (1.6.6.2)
         | 
| 14 | 
            +
                  mini_portile (~> 0.6.0)
         | 
| 15 | 
            +
                rake (10.4.2)
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            PLATFORMS
         | 
| 18 | 
            +
              ruby
         | 
| 19 | 
            +
             | 
| 20 | 
            +
            DEPENDENCIES
         | 
| 21 | 
            +
              bundler
         | 
| 22 | 
            +
              gpx!
         | 
| 23 | 
            +
              minitest
         | 
    
        data/LICENSE.txt
    ADDED
    
    | @@ -0,0 +1,21 @@ | |
| 1 | 
            +
            The MIT License (MIT)
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            Copyright (c) [year] [fullname]
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            Permission is hereby granted, free of charge, to any person obtaining a copy
         | 
| 6 | 
            +
            of this software and associated documentation files (the "Software"), to deal
         | 
| 7 | 
            +
            in the Software without restriction, including without limitation the rights
         | 
| 8 | 
            +
            to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         | 
| 9 | 
            +
            copies of the Software, and to permit persons to whom the Software is
         | 
| 10 | 
            +
            furnished to do so, subject to the following conditions:
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            The above copyright notice and this permission notice shall be included in all
         | 
| 13 | 
            +
            copies or substantial portions of the Software.
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         | 
| 16 | 
            +
            IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         | 
| 17 | 
            +
            FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         | 
| 18 | 
            +
            AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         | 
| 19 | 
            +
            LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         | 
| 20 | 
            +
            OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         | 
| 21 | 
            +
            SOFTWARE.
         | 
    
        data/gpx.gemspec
    ADDED
    
    | @@ -0,0 +1,16 @@ | |
| 1 | 
            +
            require './lib/gpx/gpx' # load this just to get GPX::VERSION
         | 
| 2 | 
            +
            require 'rake'        # For FileList
         | 
| 3 | 
            +
            Gem::Specification.new do |s|
         | 
| 4 | 
            +
              s.name = 'gpx'
         | 
| 5 | 
            +
              s.version = GPX::VERSION
         | 
| 6 | 
            +
              s.summary = %q{A basic API for reading and writing GPX files.}
         | 
| 7 | 
            +
              s.description = %q{A basic API for reading and writing GPX files.}
         | 
| 8 | 
            +
              s.files = FileList[ "lib/**/*", "bin/*", "tests/**/*", "[A-Z]*", "Rakefile", "doc/**/*" ]
         | 
| 9 | 
            +
              s.require_path = 'lib'
         | 
| 10 | 
            +
              s.has_rdoc = true
         | 
| 11 | 
            +
              s.author = "Doug Fales"
         | 
| 12 | 
            +
              s.email = "doug.fales@gmail.com"
         | 
| 13 | 
            +
              s.homepage = "http://dougfales.github.com/gpx/"
         | 
| 14 | 
            +
              s.rubyforge_project = "gpx"
         | 
| 15 | 
            +
              s.add_dependency('hpricot')
         | 
| 16 | 
            +
            end
         | 
    
        data/lib/gpx.rb
    CHANGED
    
    
    
        data/lib/gpx/gpx.rb
    CHANGED
    
    | @@ -21,12 +21,11 @@ | |
| 21 21 | 
             
            # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         | 
| 22 22 | 
             
            #++
         | 
| 23 23 | 
             
            module GPX
         | 
| 24 | 
            -
              VERSION = "0. | 
| 24 | 
            +
              VERSION = "0.7"
         | 
| 25 25 |  | 
| 26 26 | 
             
              # A common base class which provides a useful initializer method to many
         | 
| 27 27 | 
             
              # class in the GPX library.
         | 
| 28 28 | 
             
              class Base
         | 
| 29 | 
            -
            	include XML
         | 
| 30 29 |  | 
| 31 30 | 
             
            	# This initializer can take an XML::Node and scrape out any text
         | 
| 32 31 | 
             
            	# elements with the names given in the "text_elements" array.  Each
         | 
| @@ -35,11 +34,11 @@ module GPX | |
| 35 34 | 
             
            	# have to pick out individual text elements in each initializer of each
         | 
| 36 35 | 
             
            	# class (Route, TrackPoint, Track, etc).  Just pass an array of possible
         | 
| 37 36 | 
             
            	# attributes to this method.  
         | 
| 38 | 
            -
            	def instantiate_with_text_elements(parent, text_elements | 
| 37 | 
            +
            	def instantiate_with_text_elements(parent, text_elements)
         | 
| 39 38 | 
             
            	  text_elements.each do |el|
         | 
| 40 | 
            -
            		child_xpath = " | 
| 41 | 
            -
            		unless parent. | 
| 42 | 
            -
            		  val = parent. | 
| 39 | 
            +
            		child_xpath = "//#{el}"
         | 
| 40 | 
            +
            		unless parent.at(child_xpath).nil?
         | 
| 41 | 
            +
            		  val = parent.at(child_xpath).inner_text
         | 
| 43 42 | 
             
            		  self.send("#{el}=", val)
         | 
| 44 43 | 
             
            		end
         | 
| 45 44 | 
             
            	  end
         | 
    
        data/lib/gpx/gpx_file.rb
    CHANGED
    
    | @@ -52,20 +52,19 @@ module GPX | |
| 52 52 | 
             
                          #   gpx_file = File.open(gpx_file)
         | 
| 53 53 | 
             
                          #end
         | 
| 54 54 | 
             
                          gpx_file = gpx_file.name if gpx_file.is_a?(File) 
         | 
| 55 | 
            -
                          @xml =  | 
| 55 | 
            +
                          @xml = Hpricot(File.open(gpx_file))
         | 
| 56 56 | 
             
                        else
         | 
| 57 | 
            -
                           | 
| 58 | 
            -
                          @xml = parser.parse
         | 
| 57 | 
            +
                          @xml = Hpricot(opts[:gpx_data])
         | 
| 59 58 | 
             
                        end
         | 
| 60 59 | 
             
                        # set XML namespace for XML find
         | 
| 61 | 
            -
                        if @xml.root.namespaces.namespace
         | 
| 62 | 
            -
             | 
| 63 | 
            -
                        else
         | 
| 64 | 
            -
             | 
| 65 | 
            -
                        end
         | 
| 60 | 
            +
                        #if @xml.root.namespaces.namespace
         | 
| 61 | 
            +
                        #  @ns = 'gpx:' + @xml.root.namespaces.namespace.href
         | 
| 62 | 
            +
                        #else
         | 
| 63 | 
            +
                        #  @ns = 'gpx:http://www.topografix.com/GPX/1/1'  # default to GPX 1.1
         | 
| 64 | 
            +
                        #end
         | 
| 66 65 |  | 
| 67 66 | 
             
                        reset_meta_data
         | 
| 68 | 
            -
                        bounds_element = (@xml. | 
| 67 | 
            +
                        bounds_element = (@xml.at("//metadata/bounds") rescue nil)
         | 
| 69 68 | 
             
                        if bounds_element
         | 
| 70 69 | 
             
                           @bounds.min_lat = get_bounds_attr_value(bounds_element, %w{ min_lat minlat minLat })
         | 
| 71 70 | 
             
                           @bounds.min_lon = get_bounds_attr_value(bounds_element, %w{ min_lon minlon minLon})
         | 
| @@ -75,20 +74,18 @@ module GPX | |
| 75 74 | 
             
                           get_bounds = true
         | 
| 76 75 | 
             
                        end
         | 
| 77 76 |  | 
| 78 | 
            -
            		    @time = Time.parse(@xml. | 
| 79 | 
            -
            			@name = @xml. | 
| 80 | 
            -
                        
         | 
| 77 | 
            +
            		    @time = Time.parse(@xml.at("//metadata/time").inner_text) rescue nil
         | 
| 78 | 
            +
            			@name = @xml.at("//metadata/name").inner_text rescue nil
         | 
| 81 79 | 
             
                        @tracks = [] 
         | 
| 82 | 
            -
                        @xml. | 
| 80 | 
            +
                        @xml.search("//trk").each do |trk| 
         | 
| 83 81 | 
             
                           trk = Track.new(:element => trk, :gpx_file => self) 
         | 
| 84 82 | 
             
                           update_meta_data(trk, get_bounds)
         | 
| 85 83 | 
             
                           @tracks << trk
         | 
| 86 84 | 
             
                        end
         | 
| 87 85 | 
             
                        @waypoints = [] 
         | 
| 88 | 
            -
                        @xml. | 
| 86 | 
            +
                        @xml.search("//wpt").each { |wpt| @waypoints << Waypoint.new(:element => wpt, :gpx_file => self) }
         | 
| 89 87 | 
             
                        @routes = []
         | 
| 90 | 
            -
                        @xml. | 
| 91 | 
            -
             | 
| 88 | 
            +
                        @xml.search("//rte").each { |rte| @routes << Route.new(:element => rte, :gpx_file => self) }
         | 
| 92 89 | 
             
                        @tracks.delete_if { |t| t.empty? }
         | 
| 93 90 |  | 
| 94 91 | 
             
                        calculate_duration
         | 
| @@ -222,7 +219,7 @@ module GPX | |
| 222 219 | 
             
                     doc = Document.new
         | 
| 223 220 | 
             
                     doc.root = Node.new('gpx')
         | 
| 224 221 | 
             
                     gpx_elem = doc.root
         | 
| 225 | 
            -
                     gpx_elem[' | 
| 222 | 
            +
                     gpx_elem['xsi'] = "http://www.w3.org/2001/XMLSchema-instance"
         | 
| 226 223 | 
             
                     @version = '1.1' if (@version.nil? || !(['1.0', '1.1'].include?(@version))) # default to version 1.1 of the schema (only version 1.0 and 1.1 of the schema exist)
         | 
| 227 224 | 
             
                     version_dir = @version.gsub('.','/')
         | 
| 228 225 | 
             
                     gpx_elem['xmlns'] = @ns || "http://www.topografix.com/GPX/#{version_dir}" 
         | 
| @@ -60,11 +60,11 @@ module GPX | |
| 60 60 |  | 
| 61 61 | 
             
                     # Takes the name of a magellan file, converts the contents to GPX, and
         | 
| 62 62 | 
             
                     # writes the result to gpx_filename.
         | 
| 63 | 
            -
                     def | 
| 63 | 
            +
                     def convert_to_gpx(magellan_filename, gpx_filename)
         | 
| 64 64 |  | 
| 65 65 | 
             
                        segment = Segment.new
         | 
| 66 66 |  | 
| 67 | 
            -
                        CSV.open(magellan_filename, "r") do |row| 
         | 
| 67 | 
            +
                        CSV.open(magellan_filename, "r").each do |row| 
         | 
| 68 68 | 
             
                           next if(row.size < 10 or row[INVALID_FLAG] == 'V')
         | 
| 69 69 |  | 
| 70 70 | 
             
                           lat_deg  = row[LAT][0..1]
         | 
    
        data/lib/gpx/point.rb
    CHANGED
    
    | @@ -38,9 +38,9 @@ module GPX | |
| 38 38 | 
             
                        @lat, @lon = elem["lat"].to_f, elem["lon"].to_f
         | 
| 39 39 | 
             
                        @latr, @lonr = (D_TO_R * @lat), (D_TO_R * @lon)
         | 
| 40 40 | 
             
                        #'-'? yyyy '-' mm '-' dd 'T' hh ':' mm ':' ss ('.' s+)? (zzzzzz)?
         | 
| 41 | 
            -
                        @time = (Time.xmlschema(elem. | 
| 42 | 
            -
                        @elevation = elem. | 
| 43 | 
            -
                        @speed = elem. | 
| 41 | 
            +
                        @time = (Time.xmlschema(elem.at("time").inner_text) rescue nil)
         | 
| 42 | 
            +
                        @elevation = elem.at("ele").inner_text.to_f unless elem.at("ele").nil?
         | 
| 43 | 
            +
                        @speed = elem.at("speed").inner_text.to_f unless elem.at("speed").nil?
         | 
| 44 44 | 
             
                     else
         | 
| 45 45 | 
             
                        @lat = opts[:lat]
         | 
| 46 46 | 
             
                        @lon = opts[:lon]
         | 
    
        data/lib/gpx/route.rb
    CHANGED
    
    | @@ -34,9 +34,9 @@ module GPX | |
| 34 34 | 
             
            		if(opts[:gpx_file] and opts[:element])
         | 
| 35 35 | 
             
                     rte_element = opts[:element]
         | 
| 36 36 | 
             
                     @gpx_file = opts[:gpx_file]
         | 
| 37 | 
            -
                     @name = rte_element. | 
| 37 | 
            +
                     @name = rte_element.at("//name").inner_text
         | 
| 38 38 | 
             
                     @points = []
         | 
| 39 | 
            -
                     rte_element. | 
| 39 | 
            +
                     rte_element.search("//rtept").each do |point|
         | 
| 40 40 | 
             
            		   @points << Point.new(:element => point, :gpx_file => @gpx_file)
         | 
| 41 41 | 
             
                     end
         | 
| 42 42 | 
             
            	   else
         | 
    
        data/lib/gpx/segment.rb
    CHANGED
    
    | @@ -46,8 +46,8 @@ module GPX | |
| 46 46 | 
             
                     if(opts[:element])
         | 
| 47 47 | 
             
                        segment_element = opts[:element]
         | 
| 48 48 | 
             
                        last_pt = nil
         | 
| 49 | 
            -
                        if segment_element.is_a?( | 
| 50 | 
            -
                           segment_element. | 
| 49 | 
            +
                        if segment_element.is_a?(Hpricot::Elem)
         | 
| 50 | 
            +
                           segment_element.search("//trkpt").each do |trkpt| 
         | 
| 51 51 | 
             
                              pt = TrackPoint.new(:element => trkpt, :segment => self, :gpx_file => @gpx_file)  
         | 
| 52 52 | 
             
                              unless pt.time.nil?
         | 
| 53 53 | 
             
                                 @earliest_point = pt if(@earliest_point.nil? or pt.time < @earliest_point.time)
         | 
    
        data/lib/gpx/track.rb
    CHANGED
    
    | @@ -41,8 +41,8 @@ module GPX | |
| 41 41 | 
             
                     reset_meta_data
         | 
| 42 42 | 
             
                     if(opts[:element]) 
         | 
| 43 43 | 
             
                        trk_element = opts[:element]
         | 
| 44 | 
            -
                        @name = (trk_element. | 
| 45 | 
            -
                        trk_element. | 
| 44 | 
            +
                        @name = (trk_element.at("//name").inner_text rescue "")
         | 
| 45 | 
            +
                        trk_element.search("//trkseg").each do |seg_element|
         | 
| 46 46 | 
             
                           seg = Segment.new(:element => seg_element, :track => self, :gpx_file => @gpx_file)
         | 
| 47 47 | 
             
                           update_meta_data(seg)
         | 
| 48 48 | 
             
                           @segments << seg
         | 
| @@ -69,8 +69,8 @@ module GPX | |
| 69 69 | 
             
                  # correlating things like pictures, video, and other events, if you are
         | 
| 70 70 | 
             
                  # working with a timestamp.
         | 
| 71 71 | 
             
                  def closest_point(time)
         | 
| 72 | 
            -
                     segment = segments. | 
| 73 | 
            -
                     segment. | 
| 72 | 
            +
                     segment = segments.select { |s| s.contains_time?(time) }
         | 
| 73 | 
            +
                     segment.first
         | 
| 74 74 | 
             
                  end
         | 
| 75 75 |  | 
| 76 76 | 
             
                  # Removes all points outside of a given area and updates the meta data.
         | 
| @@ -114,6 +114,7 @@ module GPX | |
| 114 114 |  | 
| 115 115 | 
             
                  # Prints out a friendly summary of this track (sans points).  Useful for
         | 
| 116 116 | 
             
                  # debugging and sanity checks.
         | 
| 117 | 
            +
             | 
| 117 118 | 
             
                  def to_s
         | 
| 118 119 | 
             
                     result = "Track \n"
         | 
| 119 120 | 
             
                     result << "\tName: #{name}\n"
         | 
    
        data/lib/gpx/waypoint.rb
    CHANGED
    
    | @@ -46,7 +46,7 @@ module GPX | |
| 46 46 | 
             
                    wpt_elem = opts[:element]
         | 
| 47 47 | 
             
                    @gpx_file = opts[:gpx_file]
         | 
| 48 48 | 
             
                    super(:element => wpt_elem, :gpx_file => @gpx_file)
         | 
| 49 | 
            -
                    instantiate_with_text_elements(wpt_elem, SUB_ELEMENTS | 
| 49 | 
            +
                    instantiate_with_text_elements(wpt_elem, SUB_ELEMENTS)
         | 
| 50 50 | 
             
                  else
         | 
| 51 51 | 
             
                    opts.each do |key, value|
         | 
| 52 52 | 
             
                      assignment_method = "#{key}="
         | 
    
        data/tests/output/myoutput.gpx
    CHANGED
    
    | @@ -1,12 +1,16 @@ | |
| 1 1 | 
             
            <?xml version="1.0"?>
         | 
| 2 | 
            -
            <gpx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns=" | 
| 2 | 
            +
            <gpx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.topografix.com/GPX/1/1" version="1.1" creator="Link2GPS - 2.0.2 - http://www.hiketech.com" xsi:schemaLocation="ttp://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
         | 
| 3 3 | 
             
              <metadata>
         | 
| 4 | 
            -
                <name> | 
| 5 | 
            -
             | 
| 6 | 
            -
             | 
| 4 | 
            +
                <name>
         | 
| 5 | 
            +
            active_log.gpx
         | 
| 6 | 
            +
            </name>
         | 
| 7 | 
            +
                <time>2015-01-08T15:09:14-08:00</time>
         | 
| 8 | 
            +
                <bound minlat="38.681488" minlon="-109.606948" maxlat="38.791759" maxlon="-109.447045"/>
         | 
| 7 9 | 
             
              </metadata>
         | 
| 8 10 | 
             
              <trk>
         | 
| 9 | 
            -
                <name> | 
| 11 | 
            +
                <name>
         | 
| 12 | 
            +
            ACTIVE LOG
         | 
| 13 | 
            +
            </name>
         | 
| 10 14 | 
             
                <trkseg>
         | 
| 11 15 | 
             
                  <trkpt lat="38.782575" lon="-109.595146">
         | 
| 12 16 | 
             
                    <time>2006-04-08T18:25:33Z</time>
         | 
| @@ -1,9 +1,9 @@ | |
| 1 1 | 
             
            <?xml version="1.0"?>
         | 
| 2 | 
            -
            <gpx  | 
| 2 | 
            +
            <gpx version="1.1" creator="GPX RubyGem 0.8 -- http://dougfales.github.io/gpx/" xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
         | 
| 3 3 | 
             
              <metadata>
         | 
| 4 4 | 
             
                <name>new_gpx_file_from_scratch.gpx</name>
         | 
| 5 | 
            -
                <time> | 
| 6 | 
            -
                < | 
| 5 | 
            +
                <time>2015-01-08T15:09:06-08:00</time>
         | 
| 6 | 
            +
                <bound minlat="90.0" minlon="180.0" maxlat="-90.0" maxlon="-180.0"/>
         | 
| 7 7 | 
             
              </metadata>
         | 
| 8 8 | 
             
              <trk>
         | 
| 9 9 | 
             
                <name/>
         | 
    
        data/tests/segment_test.rb
    CHANGED
    
    | @@ -12,11 +12,11 @@ class SegmentTest < Test::Unit::TestCase | |
| 12 12 |  | 
| 13 13 | 
             
               def test_segment_read
         | 
| 14 14 | 
             
                  assert_equal(189, @segment.points.size)
         | 
| 15 | 
            -
                  assert_equal( | 
| 16 | 
            -
                  assert_equal( | 
| 15 | 
            +
                  assert_equal(1144433525, @segment.earliest_point.time.to_i)
         | 
| 16 | 
            +
                  assert_equal(1144437991, @segment.latest_point.time.to_i)
         | 
| 17 17 | 
             
                  assert_equal(1334.447, @segment.lowest_point.elevation)
         | 
| 18 18 | 
             
                  assert_equal(1480.087, @segment.highest_point.elevation)
         | 
| 19 | 
            -
                   | 
| 19 | 
            +
                  assert_in_delta(6.98803359528853, @segment.distance, 0.001) 
         | 
| 20 20 | 
             
               end
         | 
| 21 21 |  | 
| 22 22 | 
             
               def test_segment_crop
         | 
| @@ -27,9 +27,9 @@ class SegmentTest < Test::Unit::TestCase | |
| 27 27 | 
             
                  @segment.crop(crop_rectangle)
         | 
| 28 28 |  | 
| 29 29 | 
             
                  assert_equal(106, @segment.points.size) 
         | 
| 30 | 
            -
                   | 
| 31 | 
            -
                  assert_equal( | 
| 32 | 
            -
                  assert_equal( | 
| 30 | 
            +
                  assert_in_delta(4.11422061733046, @segment.distance, 0.001) 
         | 
| 31 | 
            +
                  assert_equal(1144435041, @segment.earliest_point.time.to_i)
         | 
| 32 | 
            +
                  assert_equal(1144437752,  @segment.latest_point.time.to_i)
         | 
| 33 33 | 
             
                  assert_equal(1407.027, @segment.lowest_point.elevation)
         | 
| 34 34 | 
             
                  assert_equal(1480.087, @segment.highest_point.elevation)
         | 
| 35 35 | 
             
                  assert_equal(39.173834, @segment.bounds.min_lat)
         | 
| @@ -45,9 +45,9 @@ class SegmentTest < Test::Unit::TestCase | |
| 45 45 | 
             
                                               :max_lon=> -108.999000)
         | 
| 46 46 | 
             
                  @segment.delete_area(delete_rectangle)
         | 
| 47 47 | 
             
                  assert_equal(83, @segment.points.size) 
         | 
| 48 | 
            -
                   | 
| 49 | 
            -
                  assert_equal( | 
| 50 | 
            -
                  assert_equal( | 
| 48 | 
            +
                  assert_in_delta(3.35967118153605, @segment.distance, 0.001) 
         | 
| 49 | 
            +
                  assert_equal(1144433525, @segment.earliest_point.time.to_i)
         | 
| 50 | 
            +
                  assert_equal(1144437991,  @segment.latest_point.time.to_i)
         | 
| 51 51 | 
             
                  assert_equal(1334.447, @segment.lowest_point.elevation)
         | 
| 52 52 | 
             
                  assert_equal(1428.176, @segment.highest_point.elevation)
         | 
| 53 53 | 
             
                  assert_equal(39.180572, @segment.bounds.min_lat)
         | 
    
        data/tests/track_test.rb
    CHANGED
    
    | @@ -13,7 +13,7 @@ class TrackTest < Test::Unit::TestCase | |
| 13 13 | 
             
                  assert_equal("ACTIVE LOG", @track.name)
         | 
| 14 14 | 
             
                  assert_equal( 182, @track.points.size) 
         | 
| 15 15 | 
             
                  assert_equal(8, @track.segments.size)
         | 
| 16 | 
            -
                   | 
| 16 | 
            +
                  assert_in_delta(3.07249668492626, @track.distance, 0.001) 
         | 
| 17 17 | 
             
                  assert_equal(1267.155, @track.lowest_point.elevation)
         | 
| 18 18 | 
             
                  assert_equal(1594.003, @track.highest_point.elevation)
         | 
| 19 19 | 
             
                  assert_equal(38.681488, @track.bounds.min_lat) 
         | 
| @@ -32,7 +32,7 @@ class TrackTest < Test::Unit::TestCase | |
| 32 32 | 
             
                  assert_equal("ACTIVE LOG", @track.name)
         | 
| 33 33 | 
             
                  assert_equal( 111, @track.points.size) 
         | 
| 34 34 | 
             
                  assert_equal(4, @track.segments.size)
         | 
| 35 | 
            -
                   | 
| 35 | 
            +
                  assert_in_delta(1.62136024923607, @track.distance, 0.001) 
         | 
| 36 36 | 
             
                  assert_equal(1557.954, @track.lowest_point.elevation)
         | 
| 37 37 | 
             
                  assert_equal(1582.468, @track.highest_point.elevation)
         | 
| 38 38 | 
             
                  assert_equal(38.782511, @track.bounds.min_lat) 
         | 
    
        metadata
    CHANGED
    
    | @@ -1,31 +1,42 @@ | |
| 1 | 
            -
            --- !ruby/object:Gem::Specification | 
| 1 | 
            +
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: gpx
         | 
| 3 | 
            -
            version: !ruby/object:Gem::Version | 
| 4 | 
            -
               | 
| 5 | 
            -
              segments: 
         | 
| 6 | 
            -
              - 0
         | 
| 7 | 
            -
              - 6
         | 
| 8 | 
            -
              version: "0.6"
         | 
| 3 | 
            +
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            +
              version: '0.7'
         | 
| 9 5 | 
             
            platform: ruby
         | 
| 10 | 
            -
            authors: | 
| 6 | 
            +
            authors:
         | 
| 11 7 | 
             
            - Doug Fales
         | 
| 12 8 | 
             
            autorequire: 
         | 
| 13 9 | 
             
            bindir: bin
         | 
| 14 10 | 
             
            cert_chain: []
         | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 11 | 
            +
            date: 2015-08-01 00:00:00.000000000 Z
         | 
| 12 | 
            +
            dependencies:
         | 
| 13 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 14 | 
            +
              name: hpricot
         | 
| 15 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 16 | 
            +
                requirements:
         | 
| 17 | 
            +
                - - ">="
         | 
| 18 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            +
                    version: '0'
         | 
| 20 | 
            +
              type: :runtime
         | 
| 21 | 
            +
              prerelease: false
         | 
| 22 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 | 
            +
                requirements:
         | 
| 24 | 
            +
                - - ">="
         | 
| 25 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            +
                    version: '0'
         | 
| 20 27 | 
             
            description: A basic API for reading and writing GPX files.
         | 
| 21 28 | 
             
            email: doug.fales@gmail.com
         | 
| 22 29 | 
             
            executables: []
         | 
| 23 | 
            -
             | 
| 24 30 | 
             
            extensions: []
         | 
| 25 | 
            -
             | 
| 26 31 | 
             
            extra_rdoc_files: []
         | 
| 27 | 
            -
             | 
| 28 | 
            -
             | 
| 32 | 
            +
            files:
         | 
| 33 | 
            +
            - ChangeLog
         | 
| 34 | 
            +
            - Gemfile.lock
         | 
| 35 | 
            +
            - LICENSE.txt
         | 
| 36 | 
            +
            - README.rdoc
         | 
| 37 | 
            +
            - Rakefile
         | 
| 38 | 
            +
            - gpx.gemspec
         | 
| 39 | 
            +
            - lib/gpx.rb
         | 
| 29 40 | 
             
            - lib/gpx/bounds.rb
         | 
| 30 41 | 
             
            - lib/gpx/gpx.rb
         | 
| 31 42 | 
             
            - lib/gpx/gpx_file.rb
         | 
| @@ -36,7 +47,6 @@ files: | |
| 36 47 | 
             
            - lib/gpx/track.rb
         | 
| 37 48 | 
             
            - lib/gpx/trackpoint.rb
         | 
| 38 49 | 
             
            - lib/gpx/waypoint.rb
         | 
| 39 | 
            -
            - lib/gpx.rb
         | 
| 40 50 | 
             
            - tests/gpx10_test.rb
         | 
| 41 51 | 
             
            - tests/gpx_file_test.rb
         | 
| 42 52 | 
             
            - tests/gpx_files/arches.gpx
         | 
| @@ -58,38 +68,27 @@ files: | |
| 58 68 | 
             
            - tests/track_file_test.rb
         | 
| 59 69 | 
             
            - tests/track_test.rb
         | 
| 60 70 | 
             
            - tests/waypoint_test.rb
         | 
| 61 | 
            -
            - ChangeLog
         | 
| 62 | 
            -
            - Rakefile
         | 
| 63 | 
            -
            - README.rdoc
         | 
| 64 | 
            -
            has_rdoc: true
         | 
| 65 71 | 
             
            homepage: http://dougfales.github.com/gpx/
         | 
| 66 72 | 
             
            licenses: []
         | 
| 67 | 
            -
             | 
| 73 | 
            +
            metadata: {}
         | 
| 68 74 | 
             
            post_install_message: 
         | 
| 69 75 | 
             
            rdoc_options: []
         | 
| 70 | 
            -
             | 
| 71 | 
            -
            require_paths: 
         | 
| 76 | 
            +
            require_paths:
         | 
| 72 77 | 
             
            - lib
         | 
| 73 | 
            -
            required_ruby_version: !ruby/object:Gem::Requirement | 
| 74 | 
            -
              requirements: | 
| 78 | 
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 79 | 
            +
              requirements:
         | 
| 75 80 | 
             
              - - ">="
         | 
| 76 | 
            -
                - !ruby/object:Gem::Version | 
| 77 | 
            -
                   | 
| 78 | 
            -
             | 
| 79 | 
            -
             | 
| 80 | 
            -
            required_rubygems_version: !ruby/object:Gem::Requirement 
         | 
| 81 | 
            -
              requirements: 
         | 
| 81 | 
            +
                - !ruby/object:Gem::Version
         | 
| 82 | 
            +
                  version: '0'
         | 
| 83 | 
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 84 | 
            +
              requirements:
         | 
| 82 85 | 
             
              - - ">="
         | 
| 83 | 
            -
                - !ruby/object:Gem::Version | 
| 84 | 
            -
                   | 
| 85 | 
            -
                  - 0
         | 
| 86 | 
            -
                  version: "0"
         | 
| 86 | 
            +
                - !ruby/object:Gem::Version
         | 
| 87 | 
            +
                  version: '0'
         | 
| 87 88 | 
             
            requirements: []
         | 
| 88 | 
            -
             | 
| 89 89 | 
             
            rubyforge_project: gpx
         | 
| 90 | 
            -
            rubygems_version:  | 
| 90 | 
            +
            rubygems_version: 2.4.5
         | 
| 91 91 | 
             
            signing_key: 
         | 
| 92 | 
            -
            specification_version:  | 
| 92 | 
            +
            specification_version: 4
         | 
| 93 93 | 
             
            summary: A basic API for reading and writing GPX files.
         | 
| 94 94 | 
             
            test_files: []
         | 
| 95 | 
            -
             |