This commit is contained in:
bastianonm 2012-06-25 10:22:56 +00:00
parent cdad1eacde
commit f49fa634a2
9 changed files with 311 additions and 107 deletions

View File

@ -459,6 +459,9 @@ function _wpgpxmaps(params)
l_y = { suf : "m", dec : 0 }; 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 // define the options
var hoptions = { var hoptions = {
@ -490,7 +493,6 @@ function _wpgpxmaps(params)
shared: true, shared: true,
crosshairs: true, crosshairs: true,
formatter: function() { formatter: function() {
if (marker) if (marker)
{ {
var hchart_xserie = hchart.xAxis[0].series[0].data; 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,decPoint,thousandsSep) + l_x.suf + "</b><br />";
var tooltip = "<b>" + Highcharts.numberFormat(this.x, l_x.dec) + l_x.suf + "</b><br />";
for (i=0; i < this.points.length; i++) 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; return tooltip;
} }
@ -533,7 +534,7 @@ function _wpgpxmaps(params)
xAxis: { xAxis: {
labels: { labels: {
formatter: function() { 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: { labels: {
align: 'left', align: 'left',
formatter: function() { 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; 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 }; l_s = { suf : "mi/h", dec : 0 };
} }
@ -619,7 +628,7 @@ function _wpgpxmaps(params)
labels: { labels: {
//align: 'right', //align: 'right',
formatter: function() { 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 opposite: true
@ -670,7 +679,7 @@ function _wpgpxmaps(params)
labels: { labels: {
//align: 'right', //align: 'right',
formatter: function() { 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 opposite: true
@ -709,7 +718,7 @@ function _wpgpxmaps(params)
labels: { labels: {
//align: 'right', //align: 'right',
formatter: function() { 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 opposite: true

Binary file not shown.

View File

@ -1,56 +1,80 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: wp-gpx-maps\n" "Project-Id-Version: wp-gpx-maps\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-06-21 14:24+0100\n" "POT-Creation-Date: 2012-06-25 11:55+0100\n"
"PO-Revision-Date: 2012-06-21 14:31+0100\n" "PO-Revision-Date: 2012-06-25 11:56+0100\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"X-Poedit-KeywordsList: __;_e\n" "X-Poedit-KeywordsList: __;_e\n"
"X-Poedit-Basepath: .\n" "X-Poedit-Basepath: .\n"
"X-Poedit-Language: Italian\n" "X-Poedit-Language: Italian\n"
"X-Poedit-Country: ITALY\n" "X-Poedit-Country: ITALY\n"
"X-Poedit-SearchPath-0: ..\n" "X-Poedit-SearchPath-0: ..\n"
#: ../wp-gpx-maps.php:348 #: ../wp-gpx-maps.php:420
msgid "Altitude" msgid "Altitude"
msgstr "Altitudine" msgstr "Altitudine"
#: ../wp-gpx-maps.php:349 #: ../wp-gpx-maps.php:421
msgid "Current Position" msgid "Current Position"
msgstr "Posizione Corrente" msgstr "Posizione Corrente"
#: ../wp-gpx-maps.php:350 #: ../wp-gpx-maps.php:422
msgid "Speed" msgid "Speed"
msgstr "Velocità" msgstr "Velocità"
#: ../wp-gpx-maps.php:351 #: ../wp-gpx-maps.php:423
msgid "Heart rate" msgid "Heart rate"
msgstr "Battito Cardiaco" msgstr "Battito Cardiaco"
#: ../wp-gpx-maps.php:352 #: ../wp-gpx-maps.php:424
msgid "Cadence" msgid "Cadence"
msgstr "Cadenza" msgstr "Cadenza"
#: ../wp-gpx-maps.php:353 #: ../wp-gpx-maps.php:425
msgid "Go Full Screen" msgid "Go Full Screen"
msgstr "Schermo intero" msgstr "Schermo intero"
#: ../wp-gpx-maps.php:354 #: ../wp-gpx-maps.php:426
msgid "Exit Full Screen" msgid "Exit Full Screen"
msgstr "Torna a dimensioni originali" msgstr "Torna a dimensioni originali"
#: ../wp-gpx-maps.php:370 #: ../wp-gpx-maps.php:439
msgid "Download" msgid "Total distance"
msgstr "Scarica" msgstr "Distanza totale"
#: ../wp-gpx-maps_admin_settings.php:67 #: ../wp-gpx-maps.php:443
#: ../wp-gpx-maps_admin_settings.php:143 msgid "Max elevation"
#: ../wp-gpx-maps_admin_settings.php:245 msgstr "Altitudine massima"
#: ../wp-gpx-maps_admin_settings.php:276
msgid "Save Changes" #: ../wp-gpx-maps.php:444
msgstr "Salva" 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"

View File

@ -2,8 +2,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: wp-gpx-maps\n" "Project-Id-Version: wp-gpx-maps\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-06-20 19:00+0100\n" "POT-Creation-Date: 2012-06-25 11:54+0100\n"
"PO-Revision-Date: 2012-06-20 19:00+0100\n" "PO-Revision-Date: 2012-06-25 11:55+0100\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -13,42 +13,66 @@ msgstr ""
"X-Poedit-Basepath: .\n" "X-Poedit-Basepath: .\n"
"X-Poedit-SearchPath-0: ..\n" "X-Poedit-SearchPath-0: ..\n"
#: ../wp-gpx-maps.php:348 #: ../wp-gpx-maps.php:420
msgid "Altitude" msgid "Altitude"
msgstr "" msgstr ""
#: ../wp-gpx-maps.php:349 #: ../wp-gpx-maps.php:421
msgid "Current Position" msgid "Current Position"
msgstr "" msgstr ""
#: ../wp-gpx-maps.php:350 #: ../wp-gpx-maps.php:422
msgid "Speed" msgid "Speed"
msgstr "" msgstr ""
#: ../wp-gpx-maps.php:351 #: ../wp-gpx-maps.php:423
msgid "Heart rate" msgid "Heart rate"
msgstr "" msgstr ""
#: ../wp-gpx-maps.php:352 #: ../wp-gpx-maps.php:424
msgid "Cadence" msgid "Cadence"
msgstr "" msgstr ""
#: ../wp-gpx-maps.php:353 #: ../wp-gpx-maps.php:425
msgid "Go Full Screen" msgid "Go Full Screen"
msgstr "" msgstr ""
#: ../wp-gpx-maps.php:354 #: ../wp-gpx-maps.php:426
msgid "Exit Full Screen" msgid "Exit Full Screen"
msgstr "" 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" msgid "Download"
msgstr "" msgstr ""
#: ../wp-gpx-maps_admin_settings.php:67 #: ../wp-gpx-maps_admin_settings.php:75
#: ../wp-gpx-maps_admin_settings.php:143 #: ../wp-gpx-maps_admin_settings.php:151
#: ../wp-gpx-maps_admin_settings.php:245 #: ../wp-gpx-maps_admin_settings.php:255
#: ../wp-gpx-maps_admin_settings.php:276 #: ../wp-gpx-maps_admin_settings.php:286
msgid "Save Changes" msgid "Save Changes"
msgstr "" msgstr ""

View File

@ -89,7 +89,7 @@ The attributes are:
1. glinecolorcad: cadence line color (default is #beecff) 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 1. chartFrom1: minimun value for altitude chart
@ -115,6 +115,8 @@ The attributes are:
1. download: Allow users to download your GPX file 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? = = What happening if I've a very large gpx? =
This plugin will print a small amout of points to speedup javascript and pageload. This plugin will print a small amout of points to speedup javascript and pageload.

View File

@ -70,6 +70,8 @@ function print_WP_GPX_Maps_scripts()
.wpgpxmaps img { max-width: none; width: none; padding:0; background:none; } .wpgpxmaps img { max-width: none; width: none; padding:0; background:none; }
.wpgpxmaps .ngimages { display:none; } .wpgpxmaps .ngimages { display:none; }
.wpgpxmaps .myngimages { border:1px solid #fff;position:absolute;cursor:pointer;margin:0;z-index:1; } .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> </style>
<?php <?php
} }
@ -127,16 +129,17 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
$startIcon = findValue($attr, "starticon", "wpgpxmaps_map_start_icon", ""); $startIcon = findValue($attr, "starticon", "wpgpxmaps_map_start_icon", "");
$endIcon = findValue($attr, "endicon", "wpgpxmaps_map_end_icon", ""); $endIcon = findValue($attr, "endicon", "wpgpxmaps_map_end_icon", "");
$currentIcon = findValue($attr, "currenticon", "wpgpxmaps_map_current_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", ""); $ngGalleries = findValue($attr, "nggalleries", "wpgpxmaps_map_ngGalleries", "");
$ngImages = findValue($attr, "ngimages", "wpgpxmaps_map_ngImages", ""); $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); $r = rand(1,5000000);
$gpxurl = $gpx; $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); $cacheFileName = md5($cacheFileName);
@ -146,6 +149,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
@mkdir($gpxcache,0755,true); @mkdir($gpxcache,0755,true);
$gpxcache.= DIRECTORY_SEPARATOR.$cacheFileName.".tmp"; $gpxcache.= DIRECTORY_SEPARATOR.$cacheFileName.".tmp";
// Try to load cache // Try to load cache
if (file_exists($gpxcache)) 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_hr = $cache_obj["points_graph_hr"];
$points_graph_cad = $cache_obj["points_graph_cad"]; $points_graph_cad = $cache_obj["points_graph_cad"];
$waypoints = $cache_obj["waypoints"]; $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) { } catch (Exception $e) {
$points_maps= ''; $points_maps= '';
$points_graph_dist = ''; $points_graph_dist = '';
@ -168,6 +179,12 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
$points_graph_hr = ''; $points_graph_hr = '';
$points_graph_cad = ''; $points_graph_cad = '';
$waypoints= ''; $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_hr = '';
$points_graph_cad = ''; $points_graph_cad = '';
$waypoints = ''; $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) foreach(array_keys($points->lat) as $i)
{ {
@ -229,18 +253,9 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
if ($showSpeed == true) { if ($showSpeed == true) {
$_speed = (float)$points->speed[$i]; // dafault m/s $_speed = (float)$points->speed[$i];
if ($uomspeed == '2') // miles/h $points_graph_speed .= convertSpeed($_speed,$uomspeed).',';
{
$_speed *= 2.2369362920544025;
}
else if ($uomspeed == '1') // km/h
{
$_speed *= 3.6;
}
$points_graph_speed .= $_speed.',';
} }
if ($showHr == true) if ($showHr == true)
@ -253,7 +268,36 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
$points_graph_cad .= $points->cad[$i].','; $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) if ($showW == true)
{ {
@ -310,10 +354,17 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
"points_graph_speed" => $points_graph_speed, "points_graph_speed" => $points_graph_speed,
"points_graph_hr" => $points_graph_hr, "points_graph_hr" => $points_graph_hr,
"points_graph_cad" => $points_graph_cad, "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); LOCK_EX);
@chmod($gpxcache,0755); @chmod($gpxcache,0755);
$output = ' $output = '
@ -363,6 +414,30 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
}); });
</script>'; </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 ($download=='true' && $gpxurl != '')
{ {
if ($isGpxUrl == true) if ($isGpxUrl == true)
@ -379,6 +454,35 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
return $output; 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) function downloadRemoteFile($remoteFile)
{ {
try try
@ -438,6 +542,7 @@ function WP_GPX_Maps_install() {
add_option('wpgpxmaps_show_cadence','','','yes'); add_option('wpgpxmaps_show_cadence','','','yes');
add_option('wpgpxmaps_zoomonscrollwheel','','','yes'); add_option('wpgpxmaps_zoomonscrollwheel','','','yes');
add_option('wpgpxmaps_download','','','yes'); add_option('wpgpxmaps_download','','','yes');
add_option('wpgpxmaps_summary','','','yes');
} }
function WP_GPX_Maps_remove() { function WP_GPX_Maps_remove() {
@ -469,6 +574,7 @@ function WP_GPX_Maps_remove() {
delete_option('wpgpxmaps_graph_line_color_cad'); delete_option('wpgpxmaps_graph_line_color_cad');
delete_option('wpgpxmaps_zoomonscrollwheel'); delete_option('wpgpxmaps_zoomonscrollwheel');
delete_option('wpgpxmaps_download'); delete_option('wpgpxmaps_download');
delete_option('wpgpxmaps_summary');
} }
?> ?>

View File

@ -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>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>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>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>chartFrom1</b>: minimun value for altitude chart</li>
<li><b>chartTo1</b>: maxumin 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> <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>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>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>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> </ul>
<p> <p>

View File

@ -19,7 +19,8 @@
$showHr = get_option('wpgpxmaps_show_hr'); $showHr = get_option('wpgpxmaps_show_hr');
$showCad = get_option('wpgpxmaps_show_cadence'); $showCad = get_option('wpgpxmaps_show_cadence');
$zoomonscrollwheel = get_option("wpgpxmaps_zoomonscrollwheel"); $zoomonscrollwheel = get_option("wpgpxmaps_zoomonscrollwheel");
$download = get_option("wpgpxmaps_download"); $download = get_option("wpgpxmaps_download");
$summary = get_option("wpgpxmaps_summary");
if (!($t)) if (!($t))
$t = 'HYBRID'; $t = 'HYBRID';
@ -56,14 +57,21 @@
<tr> <tr>
<th scope="row">GPX Download:</th> <th scope="row">GPX Download:</th>
<td> <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> </td>
</tr> </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> </table>
<p class="submit"> <p class="submit">
<input type="hidden" name="action" value="update" /> <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") ?>" /> <input type="submit" class="button-primary" value="<?php _e('Save Changes', "wp_gpx_maps") ?>" />
</p> </p>
@ -79,13 +87,13 @@
<tr> <tr>
<th scope="row">On mouse scroll wheel:</th> <th scope="row">On mouse scroll wheel:</th>
<td> <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> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Waypoints Support:</th> <th scope="row">Waypoints Support:</th>
<td> <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> </td>
</tr> </tr>
<tr> <tr>
@ -197,6 +205,8 @@
<option value="0" <?php if ($uomSpeed == '0') echo 'selected'; ?>>m/s</option> <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="1" <?php if ($uomSpeed == '1') echo 'selected'; ?>>km/h</option>
<option value="2" <?php if ($uomSpeed == '2') echo 'selected'; ?>>miles/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> </select>
</td> </td>
</tr> </tr>
@ -213,7 +223,7 @@
<tr> <tr>
<th scope="row">Show Heart Rate (where aviable):</th> <th scope="row">Show Heart Rate (where aviable):</th>
<td> <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> </td>
</tr> </tr>
<tr> <tr>
@ -227,7 +237,7 @@
<tr> <tr>
<th scope="row">Show Cadence (where aviable):</th> <th scope="row">Show Cadence (where aviable):</th>
<td> <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> </td>
</tr> </tr>
<tr> <tr>
@ -258,13 +268,13 @@
<tr> <tr>
<th scope="row"></th> <th scope="row"></th>
<td> <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> </td>
</tr> </tr>
<tr> <tr>
<th scope="row"></th> <th scope="row"></th>
<td> <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> </td>
</tr> </tr>
</table> </table>

View File

@ -125,6 +125,12 @@
$points->speed = array(); $points->speed = array();
$points->hr = array(); $points->hr = array();
$points->cad = 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); $gpx = simplexml_load_file($filePath);
@ -202,6 +208,8 @@
$offset = calculateDistance((float)$lat, (float)$lon, (float)$ele, (float)$lastLat, (float)$lastLon, (float)$lastEle); $offset = calculateDistance((float)$lat, (float)$lon, (float)$ele, (float)$lastLat, (float)$lastLon, (float)$lastEle);
$dist = $dist + $offset; $dist = $dist + $offset;
$points->totalLength = $dist;
if ($speed == 0) if ($speed == 0)
{ {
$datediff = (float)my_date_diff($lastTime,$time); $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); array_push($speedBuffer, $speed);
if (((float) $offset + (float) $lastOffset) > $gpxOffset) if (((float) $offset + (float) $lastOffset) > $gpxOffset)
@ -249,6 +269,13 @@
$lastTime=$time; $lastTime=$time;
} }
unset($nodes); 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 else
@ -311,6 +338,7 @@
$lastLon=$lon; $lastLon=$lon;
} }
unset($nodes); unset($nodes);
} }
else else
{ {