simple-trail 0.0.1 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/simple_trail/manipulation/straightener.rb +6 -5
- data/lib/simple_trail/parser/gpx.rb +1 -0
- data/simple-trail.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4708a23602be79835bd4571f488ea1a6bb34cb27077ed7a3ee27b2b9085c4f10
|
4
|
+
data.tar.gz: 34b942f6bca75eb207ec7a12c1950ebf4d17b2bae740d0b2d678a2df11a4b00c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ffae4a26011fe622d7acbb1eb70bd5e3814051356e611e60dfba8cdaac4964ed40d5331629a382d1f6833ff5e9719269144fc9854bbc78f07f1f42dfc94f97a
|
7
|
+
data.tar.gz: 0e70b0dc79e59266e53479cffd4464bd543a4288b8b111e3b0aa90dca700ad8b554c4285e687709006ea0656920ca5eba1704d3374122e487640fb8ce19b65ba
|
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
module Manipulation
|
4
4
|
class Straightener
|
5
|
+
attr_reader :points, :cluster_groups
|
6
|
+
|
5
7
|
def initialize(points)
|
6
8
|
@points = points
|
7
9
|
@latlng_points = @points.map { |p| Geokit::LatLng.new(p[:lat], p[:lon]) }
|
@@ -10,12 +12,11 @@ module Manipulation
|
|
10
12
|
def points_without_clusters
|
11
13
|
@average_distance_between ||= average_distance_between
|
12
14
|
@possible_clusters = detect_clusters
|
13
|
-
|
15
|
+
straighten_points!
|
14
16
|
end
|
15
17
|
|
16
|
-
def
|
17
|
-
group_clusters
|
18
|
-
straighten_points!
|
18
|
+
def cluster_groups
|
19
|
+
@cluster_groups ||= group_clusters
|
19
20
|
end
|
20
21
|
|
21
22
|
private
|
@@ -42,7 +43,7 @@ module Manipulation
|
|
42
43
|
end
|
43
44
|
|
44
45
|
def straighten_points!
|
45
|
-
|
46
|
+
cluster_groups.each do |cluster_group|
|
46
47
|
cluster_coords = @points.values_at(*cluster_group)
|
47
48
|
avg_lat = cluster_coords.map { |cc| cc[:lat].to_f }.inject(:+) / cluster_coords.size
|
48
49
|
avg_lon = cluster_coords.map { |cc| cc[:lon].to_f }.inject(:+) / cluster_coords.size
|
data/simple-trail.gemspec
CHANGED
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = 'simple-trail'
|
8
|
-
s.version = '0.0.
|
8
|
+
s.version = '0.0.3'
|
9
9
|
s.date = '2020-08-03'
|
10
10
|
s.summary = 'Readind and manipulating GPX and other trail representation file'
|
11
11
|
s.description = 'Optimazing and manipulating GPX file data. For my private purposes mostly'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple-trail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Staszek Zawadzki
|
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
120
|
- !ruby/object:Gem::Version
|
121
121
|
version: '0'
|
122
122
|
requirements: []
|
123
|
-
rubygems_version: 3.
|
123
|
+
rubygems_version: 3.0.8
|
124
124
|
signing_key:
|
125
125
|
specification_version: 4
|
126
126
|
summary: Readind and manipulating GPX and other trail representation file
|