This commit is contained in:
parent
cdad1eacde
commit
f49fa634a2
|
@ -459,6 +459,9 @@ function _wpgpxmaps(params)
|
|||
l_y = { suf : "m", dec : 0 };
|
||||
}
|
||||
|
||||
var nn = 1111.1;
|
||||
var decPoint = nn.toLocaleString().substring(5, 6);
|
||||
var thousandsSep = nn.toLocaleString().substring(1, 2);
|
||||
|
||||
// define the options
|
||||
var hoptions = {
|
||||
|
@ -490,7 +493,6 @@ function _wpgpxmaps(params)
|
|||
shared: true,
|
||||
crosshairs: true,
|
||||
formatter: function() {
|
||||
|
||||
if (marker)
|
||||
{
|
||||
var hchart_xserie = hchart.xAxis[0].series[0].data;
|
||||
|
@ -505,11 +507,10 @@ function _wpgpxmaps(params)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
var tooltip = "<b>" + Highcharts.numberFormat(this.x, l_x.dec) + l_x.suf + "</b><br />";
|
||||
var tooltip = "<b>" + Highcharts.numberFormat(this.x, l_x.dec,decPoint,thousandsSep) + l_x.suf + "</b><br />";
|
||||
for (i=0; i < this.points.length; i++)
|
||||
{
|
||||
tooltip += this.points[i].series.name + ": " + Highcharts.numberFormat(this.points[i].y, l_y_arr[i].dec) + l_y_arr[i].suf + "<br />";
|
||||
tooltip += this.points[i].series.name + ": " + Highcharts.numberFormat(this.points[i].y, l_y_arr[i].dec,decPoint,thousandsSep) + l_y_arr[i].suf + "<br />";
|
||||
}
|
||||
return tooltip;
|
||||
}
|
||||
|
@ -533,7 +534,7 @@ function _wpgpxmaps(params)
|
|||
xAxis: {
|
||||
labels: {
|
||||
formatter: function() {
|
||||
return Highcharts.numberFormat(this.value, l_x.dec) + l_x.suf;
|
||||
return Highcharts.numberFormat(this.value, l_x.dec,decPoint,thousandsSep) + l_x.suf;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -559,7 +560,7 @@ function _wpgpxmaps(params)
|
|||
labels: {
|
||||
align: 'left',
|
||||
formatter: function() {
|
||||
return Highcharts.numberFormat(this.value, l_y.dec) + l_y.suf;
|
||||
return Highcharts.numberFormat(this.value, l_y.dec,decPoint,thousandsSep) + l_y.suf;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -594,7 +595,15 @@ function _wpgpxmaps(params)
|
|||
|
||||
var l_s;
|
||||
|
||||
if (unitspeed == '2') // miles/h
|
||||
if (unitspeed == '4') // min/miles
|
||||
{
|
||||
l_s = { suf : "min/mi", dec : 3 };
|
||||
}
|
||||
else if (unitspeed == '3') // min/km
|
||||
{
|
||||
l_s = { suf : "min/km", dec : 3 };
|
||||
}
|
||||
else if (unitspeed == '2') // miles/h
|
||||
{
|
||||
l_s = { suf : "mi/h", dec : 0 };
|
||||
}
|
||||
|
@ -619,7 +628,7 @@ function _wpgpxmaps(params)
|
|||
labels: {
|
||||
//align: 'right',
|
||||
formatter: function() {
|
||||
return Highcharts.numberFormat(this.value, l_s.dec) + l_s.suf;
|
||||
return Highcharts.numberFormat(this.value, l_s.dec,decPoint,thousandsSep) + l_s.suf;
|
||||
}
|
||||
},
|
||||
opposite: true
|
||||
|
@ -670,7 +679,7 @@ function _wpgpxmaps(params)
|
|||
labels: {
|
||||
//align: 'right',
|
||||
formatter: function() {
|
||||
return Highcharts.numberFormat(this.value, l_hr.dec) + l_hr.suf;
|
||||
return Highcharts.numberFormat(this.value, l_hr.dec,decPoint,thousandsSep) + l_hr.suf;
|
||||
}
|
||||
},
|
||||
opposite: true
|
||||
|
@ -709,7 +718,7 @@ function _wpgpxmaps(params)
|
|||
labels: {
|
||||
//align: 'right',
|
||||
formatter: function() {
|
||||
return Highcharts.numberFormat(this.value, l_cad.dec) + l_cad.suf;
|
||||
return Highcharts.numberFormat(this.value, l_cad.dec,decPoint,thousandsSep) + l_cad.suf;
|
||||
}
|
||||
},
|
||||
opposite: true
|
||||
|
|
Binary file not shown.
|
@ -1,56 +1,80 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: wp-gpx-maps\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2012-06-21 14:24+0100\n"
|
||||
"PO-Revision-Date: 2012-06-21 14:31+0100\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Poedit-KeywordsList: __;_e\n"
|
||||
"X-Poedit-Basepath: .\n"
|
||||
"X-Poedit-Language: Italian\n"
|
||||
"X-Poedit-Country: ITALY\n"
|
||||
"X-Poedit-SearchPath-0: ..\n"
|
||||
|
||||
#: ../wp-gpx-maps.php:348
|
||||
msgid "Altitude"
|
||||
msgstr "Altitudine"
|
||||
|
||||
#: ../wp-gpx-maps.php:349
|
||||
msgid "Current Position"
|
||||
msgstr "Posizione Corrente"
|
||||
|
||||
#: ../wp-gpx-maps.php:350
|
||||
msgid "Speed"
|
||||
msgstr "Velocità"
|
||||
|
||||
#: ../wp-gpx-maps.php:351
|
||||
msgid "Heart rate"
|
||||
msgstr "Battito Cardiaco"
|
||||
|
||||
#: ../wp-gpx-maps.php:352
|
||||
msgid "Cadence"
|
||||
msgstr "Cadenza"
|
||||
|
||||
#: ../wp-gpx-maps.php:353
|
||||
msgid "Go Full Screen"
|
||||
msgstr "Schermo intero"
|
||||
|
||||
#: ../wp-gpx-maps.php:354
|
||||
msgid "Exit Full Screen"
|
||||
msgstr "Torna a dimensioni originali"
|
||||
|
||||
#: ../wp-gpx-maps.php:370
|
||||
msgid "Download"
|
||||
msgstr "Scarica"
|
||||
|
||||
#: ../wp-gpx-maps_admin_settings.php:67
|
||||
#: ../wp-gpx-maps_admin_settings.php:143
|
||||
#: ../wp-gpx-maps_admin_settings.php:245
|
||||
#: ../wp-gpx-maps_admin_settings.php:276
|
||||
msgid "Save Changes"
|
||||
msgstr "Salva"
|
||||
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: wp-gpx-maps\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2012-06-25 11:55+0100\n"
|
||||
"PO-Revision-Date: 2012-06-25 11:56+0100\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Poedit-KeywordsList: __;_e\n"
|
||||
"X-Poedit-Basepath: .\n"
|
||||
"X-Poedit-Language: Italian\n"
|
||||
"X-Poedit-Country: ITALY\n"
|
||||
"X-Poedit-SearchPath-0: ..\n"
|
||||
|
||||
#: ../wp-gpx-maps.php:420
|
||||
msgid "Altitude"
|
||||
msgstr "Altitudine"
|
||||
|
||||
#: ../wp-gpx-maps.php:421
|
||||
msgid "Current Position"
|
||||
msgstr "Posizione Corrente"
|
||||
|
||||
#: ../wp-gpx-maps.php:422
|
||||
msgid "Speed"
|
||||
msgstr "Velocità"
|
||||
|
||||
#: ../wp-gpx-maps.php:423
|
||||
msgid "Heart rate"
|
||||
msgstr "Battito Cardiaco"
|
||||
|
||||
#: ../wp-gpx-maps.php:424
|
||||
msgid "Cadence"
|
||||
msgstr "Cadenza"
|
||||
|
||||
#: ../wp-gpx-maps.php:425
|
||||
msgid "Go Full Screen"
|
||||
msgstr "Schermo intero"
|
||||
|
||||
#: ../wp-gpx-maps.php:426
|
||||
msgid "Exit Full Screen"
|
||||
msgstr "Torna a dimensioni originali"
|
||||
|
||||
#: ../wp-gpx-maps.php:439
|
||||
msgid "Total distance"
|
||||
msgstr "Distanza totale"
|
||||
|
||||
#: ../wp-gpx-maps.php:443
|
||||
msgid "Max elevation"
|
||||
msgstr "Altitudine massima"
|
||||
|
||||
#: ../wp-gpx-maps.php:444
|
||||
msgid "Min elevation"
|
||||
msgstr "Altitudine minima"
|
||||
|
||||
#: ../wp-gpx-maps.php:445
|
||||
msgid "Total climbing"
|
||||
msgstr "Totale salita"
|
||||
|
||||
#: ../wp-gpx-maps.php:446
|
||||
msgid "Total descent"
|
||||
msgstr "Totale discesa"
|
||||
|
||||
#: ../wp-gpx-maps.php:450
|
||||
msgid "Average speed"
|
||||
msgstr "Velocità media"
|
||||
|
||||
#: ../wp-gpx-maps.php:466
|
||||
msgid "Download"
|
||||
msgstr "Scarica"
|
||||
|
||||
#: ../wp-gpx-maps_admin_settings.php:75
|
||||
#: ../wp-gpx-maps_admin_settings.php:151
|
||||
#: ../wp-gpx-maps_admin_settings.php:255
|
||||
#: ../wp-gpx-maps_admin_settings.php:286
|
||||
msgid "Save Changes"
|
||||
msgstr "Salva"
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: wp-gpx-maps\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2012-06-20 19:00+0100\n"
|
||||
"PO-Revision-Date: 2012-06-20 19:00+0100\n"
|
||||
"POT-Creation-Date: 2012-06-25 11:54+0100\n"
|
||||
"PO-Revision-Date: 2012-06-25 11:55+0100\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
|
@ -13,42 +13,66 @@ msgstr ""
|
|||
"X-Poedit-Basepath: .\n"
|
||||
"X-Poedit-SearchPath-0: ..\n"
|
||||
|
||||
#: ../wp-gpx-maps.php:348
|
||||
#: ../wp-gpx-maps.php:420
|
||||
msgid "Altitude"
|
||||
msgstr ""
|
||||
|
||||
#: ../wp-gpx-maps.php:349
|
||||
#: ../wp-gpx-maps.php:421
|
||||
msgid "Current Position"
|
||||
msgstr ""
|
||||
|
||||
#: ../wp-gpx-maps.php:350
|
||||
#: ../wp-gpx-maps.php:422
|
||||
msgid "Speed"
|
||||
msgstr ""
|
||||
|
||||
#: ../wp-gpx-maps.php:351
|
||||
#: ../wp-gpx-maps.php:423
|
||||
msgid "Heart rate"
|
||||
msgstr ""
|
||||
|
||||
#: ../wp-gpx-maps.php:352
|
||||
#: ../wp-gpx-maps.php:424
|
||||
msgid "Cadence"
|
||||
msgstr ""
|
||||
|
||||
#: ../wp-gpx-maps.php:353
|
||||
#: ../wp-gpx-maps.php:425
|
||||
msgid "Go Full Screen"
|
||||
msgstr ""
|
||||
|
||||
#: ../wp-gpx-maps.php:354
|
||||
#: ../wp-gpx-maps.php:426
|
||||
msgid "Exit Full Screen"
|
||||
msgstr ""
|
||||
|
||||
#: ../wp-gpx-maps.php:370
|
||||
#: ../wp-gpx-maps.php:439
|
||||
msgid "Total distance"
|
||||
msgstr ""
|
||||
|
||||
#: ../wp-gpx-maps.php:443
|
||||
msgid "Max elevation"
|
||||
msgstr ""
|
||||
|
||||
#: ../wp-gpx-maps.php:444
|
||||
msgid "Min elevation"
|
||||
msgstr ""
|
||||
|
||||
#: ../wp-gpx-maps.php:445
|
||||
msgid "Total climbing"
|
||||
msgstr ""
|
||||
|
||||
#: ../wp-gpx-maps.php:446
|
||||
msgid "Total descent"
|
||||
msgstr ""
|
||||
|
||||
#: ../wp-gpx-maps.php:450
|
||||
msgid "Average speed"
|
||||
msgstr ""
|
||||
|
||||
#: ../wp-gpx-maps.php:466
|
||||
msgid "Download"
|
||||
msgstr ""
|
||||
|
||||
#: ../wp-gpx-maps_admin_settings.php:67
|
||||
#: ../wp-gpx-maps_admin_settings.php:143
|
||||
#: ../wp-gpx-maps_admin_settings.php:245
|
||||
#: ../wp-gpx-maps_admin_settings.php:276
|
||||
#: ../wp-gpx-maps_admin_settings.php:75
|
||||
#: ../wp-gpx-maps_admin_settings.php:151
|
||||
#: ../wp-gpx-maps_admin_settings.php:255
|
||||
#: ../wp-gpx-maps_admin_settings.php:286
|
||||
msgid "Save Changes"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ The attributes are:
|
|||
|
||||
1. glinecolorcad: cadence line color (default is #beecff)
|
||||
|
||||
1. uomspeed: the unit of measure of speed are: 0, 1, 2 (0 = m/s, 1 = km/h, 2 = miles/h)
|
||||
1. uomspeed: the unit of measure of speed are: 0, 1, 2, 3, 4 (0 = m/s, 1 = km/h, 2 = miles/h, 3 = min/km, 4 = min/miles)
|
||||
|
||||
1. chartFrom1: minimun value for altitude chart
|
||||
|
||||
|
@ -115,6 +115,8 @@ The attributes are:
|
|||
|
||||
1. download: Allow users to download your GPX file
|
||||
|
||||
1. summary: Print symmary details of your GPX (default is FALSE)
|
||||
|
||||
|
||||
= What happening if I've a very large gpx? =
|
||||
This plugin will print a small amout of points to speedup javascript and pageload.
|
||||
|
|
138
wp-gpx-maps.php
138
wp-gpx-maps.php
|
@ -70,6 +70,8 @@ function print_WP_GPX_Maps_scripts()
|
|||
.wpgpxmaps img { max-width: none; width: none; padding:0; background:none; }
|
||||
.wpgpxmaps .ngimages { display:none; }
|
||||
.wpgpxmaps .myngimages { border:1px solid #fff;position:absolute;cursor:pointer;margin:0;z-index:1; }
|
||||
.wpgpxmaps_summary .summarylabel { }
|
||||
.wpgpxmaps_summary .summaryvalue { font-weight: bold; }
|
||||
</style>
|
||||
<?php
|
||||
}
|
||||
|
@ -127,16 +129,17 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
$startIcon = findValue($attr, "starticon", "wpgpxmaps_map_start_icon", "");
|
||||
$endIcon = findValue($attr, "endicon", "wpgpxmaps_map_end_icon", "");
|
||||
$currentIcon = findValue($attr, "currenticon", "wpgpxmaps_map_current_icon", "");
|
||||
$waypointIcon = findValue($attr, "waypointicon", "wpgpxmaps_map_waypoint_icon", "");
|
||||
$waypointIcon = findValue($attr, "waypointicon", "wpgpxmaps_map_waypoint_icon", "");
|
||||
$ngGalleries = findValue($attr, "nggalleries", "wpgpxmaps_map_ngGalleries", "");
|
||||
$ngImages = findValue($attr, "ngimages", "wpgpxmaps_map_ngImages", "");
|
||||
$download = findValue($attr, "download", "wpgpxmaps_download", "");
|
||||
$download = findValue($attr, "download", "wpgpxmaps_download", "");
|
||||
$summary = findValue($attr, "summary", "wpgpxmaps_summary", "");
|
||||
|
||||
$r = rand(1,5000000);
|
||||
|
||||
$gpxurl = $gpx;
|
||||
|
||||
$cacheFileName = "$gpx,$w,$mh,$mt,$gh,$showW,$showHr,$showCad,$donotreducegpx,$pointsoffset,$showSpeed,$uom,v1.1.27";
|
||||
$cacheFileName = "$gpx,$w,$mh,$mt,$gh,$showW,$showHr,$showCad,$donotreducegpx,$pointsoffset,$showSpeed,$uomspeed,$uom,v1.1.28l";
|
||||
|
||||
$cacheFileName = md5($cacheFileName);
|
||||
|
||||
|
@ -146,6 +149,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
@mkdir($gpxcache,0755,true);
|
||||
|
||||
$gpxcache.= DIRECTORY_SEPARATOR.$cacheFileName.".tmp";
|
||||
|
||||
|
||||
// Try to load cache
|
||||
if (file_exists($gpxcache))
|
||||
|
@ -160,6 +164,13 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
$points_graph_hr = $cache_obj["points_graph_hr"];
|
||||
$points_graph_cad = $cache_obj["points_graph_cad"];
|
||||
$waypoints = $cache_obj["waypoints"];
|
||||
$max_ele = $cache_obj["max_ele"];
|
||||
$min_ele = $cache_obj["min_ele"];
|
||||
$total_ele_up = $cache_obj["total_ele_up"];
|
||||
$total_ele_down = $cache_obj["total_ele_down"];
|
||||
$avg_speed = $cache_obj["avg_speed"];
|
||||
$tot_len = $cache_obj["tot_len"];
|
||||
|
||||
} catch (Exception $e) {
|
||||
$points_maps= '';
|
||||
$points_graph_dist = '';
|
||||
|
@ -168,6 +179,12 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
$points_graph_hr = '';
|
||||
$points_graph_cad = '';
|
||||
$waypoints= '';
|
||||
$max_ele = 0;
|
||||
$min_ele = 0;
|
||||
$total_ele_up = 0;
|
||||
$total_ele_down = 0;
|
||||
$avg_speed = 0;
|
||||
$tot_len = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -204,6 +221,13 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
$points_graph_hr = '';
|
||||
$points_graph_cad = '';
|
||||
$waypoints = '';
|
||||
|
||||
$max_ele = $points->maxEle;
|
||||
$min_ele = $points->minEle;
|
||||
$total_ele_up = $points->totalEleUp;
|
||||
$total_ele_down = $points->totalEleDown;
|
||||
$avg_speed = $points->avgSpeed;
|
||||
$tot_len = $points->totalLength;
|
||||
|
||||
foreach(array_keys($points->lat) as $i)
|
||||
{
|
||||
|
@ -229,18 +253,9 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
|
||||
if ($showSpeed == true) {
|
||||
|
||||
$_speed = (float)$points->speed[$i]; // dafault m/s
|
||||
$_speed = (float)$points->speed[$i];
|
||||
|
||||
if ($uomspeed == '2') // miles/h
|
||||
{
|
||||
$_speed *= 2.2369362920544025;
|
||||
}
|
||||
else if ($uomspeed == '1') // km/h
|
||||
{
|
||||
$_speed *= 3.6;
|
||||
}
|
||||
|
||||
$points_graph_speed .= $_speed.',';
|
||||
$points_graph_speed .= convertSpeed($_speed,$uomspeed).',';
|
||||
}
|
||||
|
||||
if ($showHr == true)
|
||||
|
@ -253,7 +268,36 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
$points_graph_cad .= $points->cad[$i].',';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($uom == '1')
|
||||
{
|
||||
// Miles and feet
|
||||
$tot_len = round($tot_len * 0.000621371192,2)." mi";
|
||||
$max_ele = ($max_ele * 3.2808399)." ft";
|
||||
$min_ele = ($min_ele * 3.2808399)." ft";
|
||||
$total_ele_up = ($total_ele_up * 3.2808399)." ft";
|
||||
$total_ele_down = ($total_ele_down * 3.2808399)." ft";
|
||||
} else if ($uom == '2')
|
||||
{
|
||||
// meters / kilometers
|
||||
$tot_len = round($tot_len / 1000,2)." km";
|
||||
$max_ele = $max_ele ." m";
|
||||
$min_ele = $min_ele ." m";
|
||||
$total_ele_up = $total_ele_up ." m";
|
||||
$total_ele_down = $total_ele_down ." m";
|
||||
}
|
||||
else
|
||||
{
|
||||
// meters / kilometers
|
||||
$tot_len = $tot_len ." m";
|
||||
$max_ele = $max_ele ." m";
|
||||
$min_ele = $min_ele ." m";
|
||||
$total_ele_up = $total_ele_up ." m";
|
||||
$total_ele_down = $total_ele_down ." m";
|
||||
}
|
||||
|
||||
$avg_speed = convertSpeed($avg_speed,$uomspeed,true);
|
||||
|
||||
if ($showW == true)
|
||||
{
|
||||
|
@ -310,10 +354,17 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
"points_graph_speed" => $points_graph_speed,
|
||||
"points_graph_hr" => $points_graph_hr,
|
||||
"points_graph_cad" => $points_graph_cad,
|
||||
"waypoints" => $waypoints)
|
||||
"waypoints" => $waypoints,
|
||||
"max_ele" => $max_ele,
|
||||
"min_ele" => $min_ele,
|
||||
"total_ele_up" => $total_ele_up,
|
||||
"total_ele_down" => $total_ele_down,
|
||||
"avg_speed" => $avg_speed,
|
||||
"tot_len" => $tot_len
|
||||
)
|
||||
),
|
||||
LOCK_EX);
|
||||
|
||||
|
||||
@chmod($gpxcache,0755);
|
||||
|
||||
$output = '
|
||||
|
@ -363,6 +414,30 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
});
|
||||
</script>';
|
||||
|
||||
// print summary
|
||||
if ($summary=='true' && ( $points_graph_speed != '' || $points_graph_ele != '' || $points_graph_dist != '') )
|
||||
{
|
||||
|
||||
$output .= "<div id='wpgpxmaps_summary_".$r."' class='wpgpxmaps_summary'>";
|
||||
if ($points_graph_dist != '')
|
||||
{
|
||||
$output .= "<span class='summarylabel'>".__("Total distance", "wp-gpx-maps").":</span><span class='summaryvalue'> $tot_len</span><br />";
|
||||
}
|
||||
if ($points_graph_ele != '')
|
||||
{
|
||||
$output .= "<span class='summarylabel'>".__("Max elevation", "wp-gpx-maps").":</span><span class='summaryvalue'> $max_ele</span><br />";
|
||||
$output .= "<span class='summarylabel'>".__("Min elevation", "wp-gpx-maps").":</span><span class='summaryvalue'> $min_ele</span><br />";
|
||||
$output .= "<span class='summarylabel'>".__("Total climbing", "wp-gpx-maps").":</span><span class='summaryvalue'> $total_ele_up</span><br />";
|
||||
$output .= "<span class='summarylabel'>".__("Total descent", "wp-gpx-maps").":</span><span class='summaryvalue'> $total_ele_down</span><br />";
|
||||
}
|
||||
if ($points_graph_speed != '')
|
||||
{
|
||||
$output .= "<span class='summarylabel'>".__("Average speed", "wp-gpx-maps").":</span><span class='summaryvalue'> $avg_speed</span><br />";
|
||||
}
|
||||
$output .= "</div>";
|
||||
}
|
||||
|
||||
// print download link
|
||||
if ($download=='true' && $gpxurl != '')
|
||||
{
|
||||
if ($isGpxUrl == true)
|
||||
|
@ -379,6 +454,35 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
return $output;
|
||||
}
|
||||
|
||||
function convertSpeed($speed,$uomspeed, $addUom = false)
|
||||
{
|
||||
if ($uomspeed == '4') // min/mi
|
||||
{
|
||||
$speed *= 0.037282272;
|
||||
if ($addUom == true) $speed = round($speed,2) . " min/mi";
|
||||
}
|
||||
else if ($uomspeed == '3') // min/km
|
||||
{
|
||||
$speed *= 0.06;
|
||||
if ($addUom == true) $speed = round($speed,2) . " min/km";
|
||||
}
|
||||
else if ($uomspeed == '2') // miles/h
|
||||
{
|
||||
$speed *= 2.2369362920544025;
|
||||
if ($addUom == true) $speed = round($speed,2) . " mi/h";
|
||||
}
|
||||
else if ($uomspeed == '1') // km/h
|
||||
{
|
||||
$speed *= 3.6;
|
||||
if ($addUom == true) $speed = round($speed,2) . " km/h";
|
||||
}
|
||||
else // dafault m/s
|
||||
{
|
||||
if ($addUom == true) $speed = round($speed,2) . " m/s";
|
||||
}
|
||||
return $speed;
|
||||
}
|
||||
|
||||
function downloadRemoteFile($remoteFile)
|
||||
{
|
||||
try
|
||||
|
@ -438,6 +542,7 @@ function WP_GPX_Maps_install() {
|
|||
add_option('wpgpxmaps_show_cadence','','','yes');
|
||||
add_option('wpgpxmaps_zoomonscrollwheel','','','yes');
|
||||
add_option('wpgpxmaps_download','','','yes');
|
||||
add_option('wpgpxmaps_summary','','','yes');
|
||||
}
|
||||
|
||||
function WP_GPX_Maps_remove() {
|
||||
|
@ -469,6 +574,7 @@ function WP_GPX_Maps_remove() {
|
|||
delete_option('wpgpxmaps_graph_line_color_cad');
|
||||
delete_option('wpgpxmaps_zoomonscrollwheel');
|
||||
delete_option('wpgpxmaps_download');
|
||||
delete_option('wpgpxmaps_summary');
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -105,7 +105,7 @@ function WP_GPX_Maps_html_page() {
|
|||
<li><b>showspeed</b>: show speed inside the chart (default is FALSE)</li>
|
||||
<li><b>showhr</b>: show heart rate inside the chart (default is FALSE)</li>
|
||||
<li><b>showcad</b>: show cadence inside the chart (default is FALSE)</li>
|
||||
<li><b>uomspeed</b>: the unit of measure of speed are: 0, 1, 2 (0 = m/s, 1 = km/h, 2 = miles/h)</li>
|
||||
<li><b>uomspeed</b>: the unit of measure of speed are: 0, 1, 2 (0 = m/s, 1 = km/h, 2 = miles/h, 3 = min/km, 4 = min/miles)</li>
|
||||
<li><b>chartFrom1</b>: minimun value for altitude chart</li>
|
||||
<li><b>chartTo1</b>: maxumin value for altitude chart</li>
|
||||
<li><b>chartFrom2</b>: minimun value for speed chart</li>
|
||||
|
@ -118,6 +118,7 @@ function WP_GPX_Maps_html_page() {
|
|||
<li><b>ngimages</b>: NextGen Image id or a list of Images id separated by a comma</li>
|
||||
<li><b>zoomonscrollwheel</b>: zoom on map when mouse scroll wheel (default is FALSE)</li>
|
||||
<li><b>download</b>: Allow users to download your GPX file (default is FALSE)</li>
|
||||
<li><b>summary</b>: Print symmary details of your GPX (default is FALSE)</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
|
|
|
@ -19,7 +19,8 @@
|
|||
$showHr = get_option('wpgpxmaps_show_hr');
|
||||
$showCad = get_option('wpgpxmaps_show_cadence');
|
||||
$zoomonscrollwheel = get_option("wpgpxmaps_zoomonscrollwheel");
|
||||
$download = get_option("wpgpxmaps_download");
|
||||
$download = get_option("wpgpxmaps_download");
|
||||
$summary = get_option("wpgpxmaps_summary");
|
||||
|
||||
if (!($t))
|
||||
$t = 'HYBRID';
|
||||
|
@ -56,14 +57,21 @@
|
|||
<tr>
|
||||
<th scope="row">GPX Download:</th>
|
||||
<td>
|
||||
<input name="wpgpxmaps_download" type="checkbox" value="true" <?php if($download == true){echo('checked');} ?> onchange="this.value = (this.checked)" /><i>Allow users to download your GPX file</i>
|
||||
<input name="wpgpxmaps_download" type="checkbox" value="true" <?php if($download == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Allow users to download your GPX file</i>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Summary table:</th>
|
||||
<td>
|
||||
<input name="wpgpxmaps_summary" type="checkbox" value="true" <?php if($summary == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Print summary table</i>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<p class="submit">
|
||||
<input type="hidden" name="action" value="update" />
|
||||
<input name="page_options" type="hidden" value="wpgpxmaps_height,wpgpxmaps_graph_height,wpgpxmaps_width,wpgpxmaps_download" />
|
||||
<input name="page_options" type="hidden" value="wpgpxmaps_height,wpgpxmaps_graph_height,wpgpxmaps_width,wpgpxmaps_download,wpgpxmaps_summary" />
|
||||
<input type="submit" class="button-primary" value="<?php _e('Save Changes', "wp_gpx_maps") ?>" />
|
||||
</p>
|
||||
|
||||
|
@ -79,13 +87,13 @@
|
|||
<tr>
|
||||
<th scope="row">On mouse scroll wheel:</th>
|
||||
<td>
|
||||
<input name="wpgpxmaps_zoomonscrollwheel" type="checkbox" value="true" <?php if($zoomonscrollwheel == true){echo('checked');} ?> onchange="this.value = (this.checked)" /><i>Enable zoom</i>
|
||||
<input name="wpgpxmaps_zoomonscrollwheel" type="checkbox" value="true" <?php if($zoomonscrollwheel == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Enable zoom</i>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Waypoints Support:</th>
|
||||
<td>
|
||||
<input name="wpgpxmaps_show_waypoint" type="checkbox" value="true" <?php if($showW == true){echo('checked');} ?> onchange="this.value = (this.checked)" /><i>Show Waypoints</i>
|
||||
<input name="wpgpxmaps_show_waypoint" type="checkbox" value="true" <?php if($showW == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Show Waypoints</i>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -197,6 +205,8 @@
|
|||
<option value="0" <?php if ($uomSpeed == '0') echo 'selected'; ?>>m/s</option>
|
||||
<option value="1" <?php if ($uomSpeed == '1') echo 'selected'; ?>>km/h</option>
|
||||
<option value="2" <?php if ($uomSpeed == '2') echo 'selected'; ?>>miles/h</option>
|
||||
<option value="3" <?php if ($uomSpeed == '3') echo 'selected'; ?>>min/km</option>
|
||||
<option value="4" <?php if ($uomSpeed == '4') echo 'selected'; ?>>min/miles</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -213,7 +223,7 @@
|
|||
<tr>
|
||||
<th scope="row">Show Heart Rate (where aviable):</th>
|
||||
<td>
|
||||
<input name="wpgpxmaps_show_hr" type="checkbox" value="true" <?php if($showHr == true){echo('checked');} ?> onchange="this.value = (this.checked)" /><i>Show heart rate</i>
|
||||
<input name="wpgpxmaps_show_hr" type="checkbox" value="true" <?php if($showHr == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Show heart rate</i>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -227,7 +237,7 @@
|
|||
<tr>
|
||||
<th scope="row">Show Cadence (where aviable):</th>
|
||||
<td>
|
||||
<input name="wpgpxmaps_show_cadence" type="checkbox" value="true" <?php if($showCad == true){echo('checked');} ?> onchange="this.value = (this.checked)" /><i>Show Cadence</i>
|
||||
<input name="wpgpxmaps_show_cadence" type="checkbox" value="true" <?php if($showCad == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Show Cadence</i>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -258,13 +268,13 @@
|
|||
<tr>
|
||||
<th scope="row"></th>
|
||||
<td>
|
||||
<i>Skip points closer than </i> <input name="wpgpxmaps_pointsoffset" type="text" id="wpgpxmaps_pointsoffset" value="<?php echo $po ?>" style="width:50px;" /><i>meters</i>.
|
||||
<i>Skip points closer than </i> <input name="wpgpxmaps_pointsoffset" type="text" id="wpgpxmaps_pointsoffset" value="<?php echo $po ?>" style="width:50px;" /> <i>meters</i>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"></th>
|
||||
<td>
|
||||
<input name="wpgpxmaps_donotreducegpx" type="checkbox" value="true" <?php if($donotreducegpx == true){echo('checked');} ?> onchange="this.value = (this.checked)" /><i>Do not reduce gpx</i>.
|
||||
<input name="wpgpxmaps_donotreducegpx" type="checkbox" value="true" <?php if($donotreducegpx == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Do not reduce gpx</i>.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
|
@ -125,6 +125,12 @@
|
|||
$points->speed = array();
|
||||
$points->hr = array();
|
||||
$points->cad = array();
|
||||
$points->maxEle = 0;
|
||||
$points->minEle = 0;
|
||||
$points->totalEleUp = 0;
|
||||
$points->totalEleDown = 0;
|
||||
$points->avgSpeed = 0;
|
||||
$points->totalLength = 0;
|
||||
|
||||
$gpx = simplexml_load_file($filePath);
|
||||
|
||||
|
@ -202,6 +208,8 @@
|
|||
$offset = calculateDistance((float)$lat, (float)$lon, (float)$ele, (float)$lastLat, (float)$lastLon, (float)$lastEle);
|
||||
$dist = $dist + $offset;
|
||||
|
||||
$points->totalLength = $dist;
|
||||
|
||||
if ($speed == 0)
|
||||
{
|
||||
$datediff = (float)my_date_diff($lastTime,$time);
|
||||
|
@ -211,6 +219,18 @@
|
|||
}
|
||||
}
|
||||
|
||||
if ($ele != 0 && $lastEle != 0)
|
||||
{
|
||||
if ((float)$ele > (float)$lastEle)
|
||||
{
|
||||
$points->totalEleUp += (float)($ele - $lastEle);
|
||||
}
|
||||
else
|
||||
{
|
||||
$points->totalEleDown += (float)($lastEle - $ele);
|
||||
}
|
||||
}
|
||||
|
||||
array_push($speedBuffer, $speed);
|
||||
|
||||
if (((float) $offset + (float) $lastOffset) > $gpxOffset)
|
||||
|
@ -249,6 +269,13 @@
|
|||
$lastTime=$time;
|
||||
}
|
||||
unset($nodes);
|
||||
|
||||
try {
|
||||
$points->maxEle = max($points->ele);
|
||||
$points->minEle = min($points->ele);
|
||||
$points->totalLength = max($points->dist);
|
||||
$points->avgSpeed = array_sum($points->speed) / count($points->speed);
|
||||
} catch (Exception $e) { }
|
||||
|
||||
}
|
||||
else
|
||||
|
@ -311,6 +338,7 @@
|
|||
$lastLon=$lon;
|
||||
}
|
||||
unset($nodes);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue