Scale up travel times
This commit is contained in:
@@ -25,6 +25,7 @@ map_otm = Open Topo Map
|
|||||||
map_ign_france = IGN (France)
|
map_ign_france = IGN (France)
|
||||||
map_ign_spain = IGN (Spain)
|
map_ign_spain = IGN (Spain)
|
||||||
map_linz = LINZ (New Zealand)
|
map_linz = LINZ (New Zealand)
|
||||||
|
map_usgs = USGS (USA)
|
||||||
|
|
||||||
pic = Picture
|
pic = Picture
|
||||||
pics = Pictures
|
pics = Pictures
|
||||||
@@ -48,3 +49,7 @@ end = End
|
|||||||
|
|
||||||
date_time = $0 at $1
|
date_time = $0 at $1
|
||||||
time_zone = Time zone
|
time_zone = Time zone
|
||||||
|
|
||||||
|
unit_day = day
|
||||||
|
unit_days = days
|
||||||
|
unit_hour = h
|
||||||
@@ -25,6 +25,7 @@ map_otm = Open Topo Map
|
|||||||
map_ign_france = IGN (France)
|
map_ign_france = IGN (France)
|
||||||
map_ign_spain = IGN (Espagne)
|
map_ign_spain = IGN (Espagne)
|
||||||
map_linz = LINZ (Nouvelle-Zélande)
|
map_linz = LINZ (Nouvelle-Zélande)
|
||||||
|
map_usgs = USGS (États-Unis)
|
||||||
|
|
||||||
pic = Photo
|
pic = Photo
|
||||||
pics = Photos
|
pics = Photos
|
||||||
@@ -48,3 +49,7 @@ end = Arrivée
|
|||||||
|
|
||||||
date_time = $0 à $1
|
date_time = $0 à $1
|
||||||
time_zone = Fuseau horaire
|
time_zone = Fuseau horaire
|
||||||
|
|
||||||
|
unit_day = jour
|
||||||
|
unit_days = jours
|
||||||
|
unit_hour = h
|
||||||
@@ -213,6 +213,7 @@ function initSpotMessages(aoMessages, aoTracks) {
|
|||||||
aoLayers[oSpot.lang('map_ign_france')] = L.tileLayer(self.tmp('tile_api'), {id: 'ign.fr', minZoom: 0, maxZoom: 18, tileSize: 256});
|
aoLayers[oSpot.lang('map_ign_france')] = L.tileLayer(self.tmp('tile_api'), {id: 'ign.fr', minZoom: 0, maxZoom: 18, tileSize: 256});
|
||||||
aoLayers[oSpot.lang('map_ign_spain')] = L.tileLayer(self.tmp('tile_api'), {id: 'ign.es', minZoom: 1, maxZoom: 20});
|
aoLayers[oSpot.lang('map_ign_spain')] = L.tileLayer(self.tmp('tile_api'), {id: 'ign.es', minZoom: 1, maxZoom: 20});
|
||||||
aoLayers[oSpot.lang('map_linz')] = L.tileLayer(self.tmp('tile_api'), {id: 'linz', maxZoom: 17, continuousWorld: true, attribution: 'Sourced from LINZ. CC BY 4.0'});
|
aoLayers[oSpot.lang('map_linz')] = L.tileLayer(self.tmp('tile_api'), {id: 'linz', maxZoom: 17, continuousWorld: true, attribution: 'Sourced from LINZ. CC BY 4.0'});
|
||||||
|
aoLayers[oSpot.lang('map_usgs')] = L.tileLayer(self.tmp('tile_api'), {id: 'usgs', minZoom: 1, maxZoom: 16});
|
||||||
|
|
||||||
//Map
|
//Map
|
||||||
var oMap = L.map(self.tmp('$Map')[0], {
|
var oMap = L.map(self.tmp('$Map')[0], {
|
||||||
@@ -307,26 +308,34 @@ function initSpotMessages(aoMessages, aoTracks) {
|
|||||||
|
|
||||||
var iSpeedCorrecRatio = 0;
|
var iSpeedCorrecRatio = 0;
|
||||||
var iAngle = iElevDelta / iSegDistance;
|
var iAngle = iElevDelta / iSegDistance;
|
||||||
if(iAngle < -1) iSpeedCorrecRatio = 0.5;
|
if(iAngle < -1) iSpeedCorrecRatio = 0.5;
|
||||||
else if(iAngle < -0.2) iSpeedCorrecRatio = 1.25;
|
else if(iAngle < -0.2) iSpeedCorrecRatio = 1.25;
|
||||||
else if(iAngle < 0.1) iSpeedCorrecRatio = 1;
|
else if(iAngle < 0.1) iSpeedCorrecRatio = 1;
|
||||||
else if(iAngle < 0.25) iSpeedCorrecRatio = 0.85;
|
else if(iAngle < 0.25) iSpeedCorrecRatio = 0.85;
|
||||||
else if(iAngle < 0.5) iSpeedCorrecRatio = 0.6;
|
else if(iAngle < 0.5) iSpeedCorrecRatio = 0.6;
|
||||||
else if(iAngle < 1) iSpeedCorrecRatio = 0.5;
|
else if(iAngle < 1) iSpeedCorrecRatio = 0.5;
|
||||||
else iSpeedCorrecRatio = 0.25;
|
else iSpeedCorrecRatio = 0.25;
|
||||||
iTime += iSegDistance / 1000 * iSpeedCorrecRatio / 3.5 ; //default speed: 3.5km/h
|
iTime += iSegDistance / 1000 * iSpeedCorrecRatio / 3.5 ; //default speed: 3.5km/h
|
||||||
}
|
}
|
||||||
|
|
||||||
var iTimeHours = Math.floor(iTime);
|
var iTimeHours = 0, iTimeMinutes = 0;
|
||||||
var iTimeMinutes = Math.round((iTime - iTimeHours) * 4) * 15; //Approx 15 minutes
|
var iTimeDays = Math.floor(iTime/8); //8 hours a day
|
||||||
if(iTimeMinutes == 60) {
|
if(iTimeDays > 1) iTimeDays = Math.round(iTimeDays * 2) / 2; //Round down to the closest half day
|
||||||
iTimeMinutes = 0;
|
else {
|
||||||
iTimeHours += 1;
|
iTimeDays = 0;
|
||||||
|
iTimeHours = Math.floor(iTime);
|
||||||
|
iTime -= iTimeHours;
|
||||||
|
|
||||||
|
iTimeMinutes = Math.floor(iTime * 4) * 15; //Round down to the closest 15 minutes
|
||||||
}
|
}
|
||||||
if(iTimeMinutes==0) iTimeMinutes = '';
|
|
||||||
|
var sDuration = '~ '
|
||||||
|
+(iTimeDays>0?(iTimeDays+(iTimeDays%2==0?'':'½')+' '+oSpot.lang(iTimeDays>1?'unit_days':'unit_day')):'')//Days
|
||||||
|
+((iTimeHours>0 || iTimeDays==0)?iTimeHours+oSpot.lang('unit_hour'):'') //Hours
|
||||||
|
+((iTimeDays>0 || iTimeMinutes==0)?'':iTimeMinutes) //Minutes
|
||||||
|
|
||||||
$('<p>', {'class':'detail'}).addIcon('fa-distance fa-fw', true).append(Math.round(iDistance/1000)+'km').appendTo($Tooltip);
|
$('<p>', {'class':'detail'}).addIcon('fa-distance fa-fw', true).append(Math.round(iDistance/1000)+'km').appendTo($Tooltip);
|
||||||
$('<p>', {'class':'detail'}).addIcon('fa-time fa-fw', true).append('~ '+iTimeHours+'h'+iTimeMinutes).appendTo($Tooltip);
|
$('<p>', {'class':'detail'}).addIcon('fa-time fa-fw', true).append(sDuration).appendTo($Tooltip);
|
||||||
$('<p>', {'class':'detail'}).addIcon('fa-elev-gain fa-fw', true).append(iElevGain+'m').appendTo($Tooltip);
|
$('<p>', {'class':'detail'}).addIcon('fa-elev-gain fa-fw', true).append(iElevGain+'m').appendTo($Tooltip);
|
||||||
$('<p>', {'class':'detail'}).addIcon('fa-elev-drop fa-fw', true).append(iElevDrop+'m').appendTo($Tooltip);
|
$('<p>', {'class':'detail'}).addIcon('fa-elev-drop fa-fw', true).append(iElevDrop+'m').appendTo($Tooltip);
|
||||||
|
|
||||||
@@ -445,7 +454,7 @@ function updateFeed(bFirstChunk, bDiscrete) {
|
|||||||
|
|
||||||
self.tmp('updatable', true);
|
self.tmp('updatable', true);
|
||||||
|
|
||||||
if(bFirstChunk && $.isEmptyObject(asData)) toggleFeedPanel(false);
|
if(bFirstChunk) toggleFeedPanel(!$.isEmptyObject(asData));
|
||||||
}, {
|
}, {
|
||||||
'project_id': self.vars(['project', 'id']),
|
'project_id': self.vars(['project', 'id']),
|
||||||
'chunk': self.tmp('news_chunk')
|
'chunk': self.tmp('news_chunk')
|
||||||
|
|||||||
Reference in New Issue
Block a user