mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
HTML: Add coordinates to the HTML exports
- Export dive coordinates (if exist) to JSON file. - Add dive coordinates to list view and detailed dive view. - Add hyperlink that opens the dive location in a new tab viewed in Google maps. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
a03e772954
commit
9015160199
2 changed files with 44 additions and 5 deletions
|
@ -208,7 +208,7 @@ function getExpanded(dive)
|
|||
{
|
||||
var res = '<table><tr><td class="words">' + translate.Date + ': </td><td>' + dive.date +
|
||||
'</td><td class="words"> ' + translate.Time + ': </td><td>' + dive.time +
|
||||
'</td><td class="words"> ' + translate.Location + ': </td><td>' + '<a onclick=\"Search_list_Modules(\'' + dive.location + '\', {location:true, divemaster:false, buddy:false, notes:false, tags:false,})\">' + dive.location + '</a>' +
|
||||
'</td><td class="words"> ' + translate.Locaiton + ': </td><td>' + '<a onclick=\"Search_list_Modules(\'' + dive.location + '\', {location:true, divemaster:false, buddy:false, notes:false, tags:false,})\">' + dive.location + '</a>' + getDiveCoor(dive) +
|
||||
'</td></tr></table><table><tr><td class="words">' + translate.Rating + ':</td><td>' + putRating(dive.rating) +
|
||||
'</td><td class="words"> ' + translate.Visibility + ':</td><td>' + putRating(dive.visibility) +
|
||||
'</td></tr></table>' +
|
||||
|
@ -499,7 +499,7 @@ Set.prototype.intersect = function(another_set)
|
|||
}
|
||||
var result = new Array();
|
||||
for (var i = 0; i < another_set.keys.length; i++) {
|
||||
if(this.contains(another_set.keys[i])) {
|
||||
if (this.contains(another_set.keys[i])) {
|
||||
result.push(another_set.keys[i]);
|
||||
}
|
||||
};
|
||||
|
@ -896,6 +896,21 @@ function get_bookmarks_HTML(dive)
|
|||
return result;
|
||||
}
|
||||
|
||||
function getDiveCoorString(coordinates){
|
||||
res = "";
|
||||
lat = coordinates.lat;
|
||||
lon = coordinates.lon;
|
||||
res += float_to_deg(lat) + ' , ' + float_to_deg(lon);
|
||||
return res;
|
||||
}
|
||||
|
||||
function getDiveCoor(dive)
|
||||
{
|
||||
if (!dive.coordinates)
|
||||
return "";
|
||||
return '<td class="words"> ' + translate.Coordinates + ': </td><td>' + '<a href="http://www.google.com/maps/@' + dive.coordinates.lat + ',' + dive.coordinates.lon + ',13z" target="_blank">' + getDiveCoorString(dive.coordinates) + '</a></td>';
|
||||
}
|
||||
|
||||
/**
|
||||
*Return HTML main data of a dive
|
||||
*/
|
||||
|
@ -903,8 +918,8 @@ function get_dive_HTML(dive)
|
|||
{
|
||||
var res = '<h2 class="det_hed">' + translate.Dive_information + '</h2><table><tr><td class="words">' + translate.Date + ': </td><td>' + dive.date +
|
||||
'</td><td class="words"> ' + translate.Time + ': </td><td>' + dive.time +
|
||||
'</td><td class="words"> ' + translate.Location + ': </td><td>' + '<a onclick=\"Search_list_Modules(\'' + dive.location + '\', {location:true, divemaster:false, buddy:false, notes:false, tags:false,})\">' + dive.location + '</a>' +
|
||||
'</td></tr></table><table><tr><td class="words">' + translate.Rating + ':</td><td>' + putRating(dive.rating) +
|
||||
'</td><td class="words"> ' + translate.Locaiton + ': </td><td>' + '<a onclick=\"Search_list_Modules(\'' + dive.location + '\', {location:true, divemaster:false, buddy:false, notes:false, tags:false,})\">' + dive.location + '</a></td>' + getDiveCoor(dive) +
|
||||
'</tr></table><table><tr><td class="words">' + translate.Rating + ':</td><td>' + putRating(dive.rating) +
|
||||
'</td><td class="words"> ' + translate.Visibility + ':</td><td>' + putRating(dive.visibility) +
|
||||
'</td></tr></table>' +
|
||||
'<table><tr><td class="words">' + translate.Air_Temp + ': </td><td>' + dive.temperature.air +
|
||||
|
@ -1000,6 +1015,14 @@ function int_to_time(n)
|
|||
return Math.floor((n) / 60) + ":" + format_two_digit((n) % (60)) + " min";
|
||||
}
|
||||
|
||||
function float_to_deg(flt){
|
||||
var deg = 0 | flt;
|
||||
flt = (flt < 0 ? flt =- flt : flt);
|
||||
var min = 0 | flt % 1 * 60;
|
||||
var sec = (0 | flt * 60 % 1 * 6000) / 100;
|
||||
return deg + "° " + min + "' " + sec + "\"";
|
||||
}
|
||||
|
||||
/**
|
||||
*Main canvas draw function
|
||||
*this calls the axis and grid initialization functions.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue