Skip to content

Commit

Permalink
repair track markers
Browse files Browse the repository at this point in the history
  • Loading branch information
yamax2 committed Jul 11, 2020
1 parent 560a468 commit 8907843
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 42 deletions.
69 changes: 33 additions & 36 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ GEM
airbrussh (1.4.0)
sshkit (>= 1.6.1, != 1.7.0)
arel (9.0.0)
ast (2.4.0)
autoprefixer-rails (9.7.6)
ast (2.4.1)
autoprefixer-rails (9.8.5)
execjs
bindex (0.8.1)
bootsnap (1.4.6)
Expand All @@ -67,7 +67,7 @@ GEM
momentjs-rails (>= 2.10.5, <= 3.0.0)
builder (3.2.4)
byebug (11.1.3)
capistrano (3.14.0)
capistrano (3.14.1)
airbrussh (>= 1.0.0)
i18n
rake (>= 10.0.0)
Expand All @@ -93,7 +93,7 @@ GEM
crack (0.4.3)
safe_yaml (~> 1.0.0)
crass (1.0.6)
diff-lcs (1.3)
diff-lcs (1.4.4)
docile (1.3.2)
draper (4.0.1)
actionpack (>= 5.0)
Expand All @@ -106,12 +106,12 @@ GEM
tzinfo
execjs (2.7.0)
exifr (1.3.6)
factory_bot (5.2.0)
activesupport (>= 4.2.0)
factory_bot_rails (5.2.0)
factory_bot (~> 5.2.0)
railties (>= 4.2.0)
ffi (1.13.0)
factory_bot (6.1.0)
activesupport (>= 5.0.0)
factory_bot_rails (6.1.0)
factory_bot (~> 6.1.0)
railties (>= 5.0.0)
ffi (1.13.1)
font-awesome-rails (4.7.0.5)
railties (>= 3.2, < 6.1)
fugit (1.3.6)
Expand Down Expand Up @@ -160,7 +160,7 @@ GEM
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
loofah (2.5.0)
loofah (2.6.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
Expand All @@ -171,7 +171,7 @@ GEM
mimemagic (0.3.5)
mini_mime (1.0.2)
mini_portile2 (2.4.0)
mini_racer (0.2.14)
mini_racer (0.2.15)
libv8 (> 7.3)
minitest (5.14.1)
moment-timezone-rails (1.0.0)
Expand All @@ -181,15 +181,15 @@ GEM
msgpack (1.3.3)
net-scp (3.0.0)
net-ssh (>= 2.6.5, < 7.0.0)
net-ssh (6.0.2)
net-ssh (6.1.0)
nio4r (2.5.2)
nokogiri (1.10.9)
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
oj (3.10.6)
ox (2.13.2)
parallel (1.19.1)
parser (2.7.1.3)
ast (~> 2.4.0)
parallel (1.19.2)
parser (2.7.1.4)
ast (~> 2.4.1)
pg (1.2.3)
polyamorous (2.3.2)
activerecord (>= 5.2.1)
Expand All @@ -206,8 +206,6 @@ GEM
nio4r (~> 2.0)
raabro (1.3.1)
rack (2.2.3)
rack-protection (2.0.8.1)
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (5.2.4.3)
Expand All @@ -223,10 +221,10 @@ GEM
bundler (>= 1.3.0)
railties (= 5.2.4.3)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.4)
actionpack (>= 5.0.1.x)
actionview (>= 5.0.1.x)
activesupport (>= 5.0.1.x)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
activesupport (>= 5.0.1.rc1)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
Expand All @@ -248,10 +246,10 @@ GEM
rb-fsevent (0.10.4)
rb-inotify (0.10.1)
ffi (~> 1.0)
redis (4.1.4)
redis (4.2.1)
redis-classy (2.4.1)
redis-namespace (~> 1.0)
redis-mutex (4.0.1)
redis-mutex (4.0.2)
redis-classy (~> 2.0)
redis-namespace (1.7.0)
redis (>= 3.0.4)
Expand All @@ -277,23 +275,23 @@ GEM
rspec-mocks (~> 3.9)
rspec-support (~> 3.9)
rspec-support (3.9.3)
rubocop (0.85.1)
rubocop (0.87.1)
parallel (~> 1.10)
parser (>= 2.7.0.1)
parser (>= 2.7.1.1)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.7)
rexml
rubocop-ast (>= 0.0.3)
rubocop-ast (>= 0.1.0, < 1.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (0.0.3)
rubocop-ast (0.1.0)
parser (>= 2.7.0.1)
rubocop-rails (2.6.0)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 0.82.0)
rubocop-rspec (1.39.0)
rubocop (>= 0.68.1)
rubocop-rspec (1.42.0)
rubocop (>= 0.87.0)
ruby-progressbar (1.10.1)
ruby_dep (1.5.0)
russian (0.6.0)
Expand All @@ -320,17 +318,16 @@ GEM
tilt
shoulda-matchers (4.3.0)
activesupport (>= 4.2.0)
sidekiq (6.0.7)
sidekiq (6.1.0)
connection_pool (>= 2.2.2)
rack (~> 2.0)
rack-protection (>= 2.0.0)
redis (>= 4.1.0)
redis (>= 4.2.0)
sidekiq-cron (1.2.0)
fugit (~> 1.1)
sidekiq (>= 4.2.1)
sidekiq-failures (1.0.0)
sidekiq (>= 4.0.0)
sidekiq-throttled (0.11.0)
sidekiq-throttled (0.12.0)
concurrent-ruby
redis-prescription
sidekiq
Expand Down Expand Up @@ -380,7 +377,7 @@ GEM
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
websocket-driver (0.7.2)
websocket-driver (0.7.3)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
yandex_client (0.2.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ $(document)
async: true,
marker_options:
clickable: true
startIconUrl: 'https://raw.githubusercontent.com/mpetazzoni/leaflet-gpx/master/pin-icon-start.png',
endIconUrl: 'https://raw.githubusercontent.com/mpetazzoni/leaflet-gpx/master/pin-icon-end.png',
shadowUrl: 'https://raw.githubusercontent.com/mpetazzoni/leaflet-gpx/master/pin-shadow.png'
startIconUrl: '<%= image_url('pin-icon-start.png') %>'
endIconUrl: '<%= image_url('pin-icon-end.png') %>'
shadowUrl: '<%= image_url('pin-shadow.png') %>'
polyline_options:
color: track.color
).on('loaded', ((e) ->
Expand Down
Empty file removed vendor/.keep
Empty file.
Binary file added vendor/assets/images/pin-icon-end.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vendor/assets/images/pin-icon-start.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vendor/assets/images/pin-icon-wpt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vendor/assets/images/pin-shadow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 20 additions & 3 deletions vendor/assets/javascripts/gpx.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,13 @@ var _DEFAULT_MARKER_OPTS = {
endIconUrl: 'pin-icon-end.png',
shadowUrl: 'pin-shadow.png',
wptIcons: [],
wptIconsType: [],
wptIconUrls : {
'': 'pin-icon-wpt.png',
},
wptIconTypeUrls : {
'': 'pin-icon-wpt.png',
},
pointMatchers: [],
iconSize: [33, 50],
shadowSize: [50, 50],
Expand Down Expand Up @@ -373,7 +377,13 @@ L.GPX = L.FeatureGroup.extend({
if (symEl.length > 0) {
symKey = symEl[0].textContent;
}


var typeEl = el[i].getElementsByTagName('type');
var typeKey = '';
if (typeEl.length > 0) {
typeKey = typeEl[0].textContent;
}

/*
* Add waypoint marker based on the waypoint symbol key.
*
Expand All @@ -384,11 +394,17 @@ L.GPX = L.FeatureGroup.extend({
*/
var wptIcons = options.marker_options.wptIcons;
var wptIconUrls = options.marker_options.wptIconUrls;
var wptIconsType = options.marker_options.wptIconsType;
var wptIconTypeUrls = options.marker_options.wptIconTypeUrls;
var symIcon;
if (wptIcons && wptIcons[symKey]) {
symIcon = wptIcons[symKey];
} else if (wptIconUrls && wptIconUrls[symKey]) {
} else if (wptIconsType && wptIconsType[typeKey]){
symIcon = wptIconsType[typeKey];
} else if (wptIconUrls && wptIconUrls[symKey]){
symIcon = new L.GPXTrackIcon({iconUrl: wptIconUrls[symKey]});
} else if (wptIconTypeUrls && wptIconTypeUrls[typeKey]){
symIcon = new L.GPXTrackIcon({iconUrl: wptIconTypeUrls[typeKey]});
} else if (wptIcons && wptIcons['']) {
symIcon = wptIcons[''];
} else if (wptIconUrls && wptIconUrls['']) {
Expand All @@ -402,7 +418,8 @@ L.GPX = L.FeatureGroup.extend({
var marker = new L.Marker(ll, {
clickable: options.marker_options.clickable,
title: name,
icon: symIcon
icon: symIcon,
type: 'waypoint'
});
marker.bindPopup("<b>" + name + "</b>" + (desc.length > 0 ? '<br>' + desc : '')).openPopup();
this.fire('addpoint', { point: marker, point_type: 'waypoint', element: el[i] });
Expand Down

0 comments on commit 8907843

Please sign in to comment.