This commit is contained in:
parent
01a41563ef
commit
04d99ebd50
|
@ -4,9 +4,43 @@
|
|||
|
||||
*/
|
||||
|
||||
var t;
|
||||
var funqueue = [];
|
||||
var infowindow;
|
||||
var mapLoading = false;
|
||||
var CustomMarker;
|
||||
|
||||
function CustomMarker( map, latlng, src, img_w, img_h) {
|
||||
var wrapFunction = function(fn, context, params) {
|
||||
return function() {
|
||||
fn.apply(context, params);
|
||||
};
|
||||
}
|
||||
|
||||
function wpgpxmaps(params)
|
||||
{
|
||||
funqueue.push( wrapFunction(_wpgpxmaps, this, [params]));
|
||||
unqueue();
|
||||
}
|
||||
|
||||
function unqueue()
|
||||
{
|
||||
if ((google == undefined || google.maps == undefined || Highcharts == undefined))
|
||||
{
|
||||
t = setTimeout("unqueue()",200);
|
||||
}
|
||||
else
|
||||
{
|
||||
setup();
|
||||
while (funqueue.length > 0) {
|
||||
(funqueue.shift())();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setup()
|
||||
{
|
||||
|
||||
CustomMarker = function( map, latlng, src, img_w, img_h) {
|
||||
this.latlng_ = latlng;
|
||||
|
||||
// Once the LatLng and text are set, add the overlay to the map. This will
|
||||
|
@ -81,7 +115,11 @@ var infowindow;
|
|||
}
|
||||
};
|
||||
|
||||
function wpgpxmaps(params)
|
||||
}
|
||||
|
||||
|
||||
|
||||
function _wpgpxmaps(params)
|
||||
{
|
||||
|
||||
var targetId = params.targetId;
|
||||
|
@ -91,6 +129,7 @@ function wpgpxmaps(params)
|
|||
var graphEle = params.graphEle;
|
||||
var graphSpeed = params.graphSpeed;
|
||||
var graphHr = params.graphHr;
|
||||
var graphCad = params.graphCad;
|
||||
var waypoints = params.waypoints;
|
||||
var unit = params.unit;
|
||||
var unitspeed = params.unitspeed;
|
||||
|
@ -98,6 +137,7 @@ function wpgpxmaps(params)
|
|||
var color2 = params.color2;
|
||||
var color3 = params.color3;
|
||||
var color4 = params.color4;
|
||||
var color5 = params.color5;
|
||||
var chartFrom1 = params.chartFrom1;
|
||||
var chartTo1 = params.chartTo1;
|
||||
var chartFrom2 = params.chartFrom2;
|
||||
|
@ -570,9 +610,48 @@ function wpgpxmaps(params)
|
|||
l_y_arr.push(l_hr);
|
||||
}
|
||||
|
||||
if (graphCad != '')
|
||||
{
|
||||
|
||||
var l_cad = { suf : "", dec : 0 };
|
||||
|
||||
var cadData = [];
|
||||
|
||||
for (i=0; i<valLen; i++)
|
||||
{
|
||||
cadData.push([graphDist[i],graphCad[i]]);
|
||||
}
|
||||
|
||||
var yaxe = {
|
||||
title: { text: null },
|
||||
labels: {
|
||||
//align: 'right',
|
||||
formatter: function() {
|
||||
return Highcharts.numberFormat(this.value, l_cad.dec) + l_cad.suf;
|
||||
}
|
||||
},
|
||||
opposite: true
|
||||
}
|
||||
|
||||
hoptions.yAxis.push(yaxe);
|
||||
hoptions.series.push({
|
||||
name: 'Cadence',
|
||||
lineWidth: 1,
|
||||
marker: { radius: 0 },
|
||||
data : cadData,
|
||||
color: color5,
|
||||
yAxis: hoptions.series.length
|
||||
});
|
||||
|
||||
l_y_arr.push(l_cad);
|
||||
}
|
||||
|
||||
var hchart = new Highcharts.Chart(hoptions);
|
||||
|
||||
}
|
||||
else {
|
||||
jQuery("#hchart_" + params.targetId).css("display","none");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
14
readme.txt
14
readme.txt
|
@ -1,10 +1,10 @@
|
|||
=== WP GPX Maps ===
|
||||
Contributors: bastianonm
|
||||
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8VHWLRW6JBTML
|
||||
Tags: maps, gpx, gps, graph, chart, google maps, highcharts, track, garmin, image, nextgen-gallery, nextgen, exif, OpenStreetMap, OpenCycleMap, Hike&Bike, heart rate, heartrate
|
||||
Tags: maps, gpx, gps, graph, chart, google maps, highcharts, track, garmin, image, nextgen-gallery, nextgen, exif, OpenStreetMap, OpenCycleMap, Hike&Bike, heart rate, heartrate, cadence
|
||||
Requires at least: 2.0.0
|
||||
Tested up to: 3.3
|
||||
Stable tag: 1.1.15
|
||||
Stable tag: 1.1.16
|
||||
License: GPLv2 or later
|
||||
|
||||
Draws a gpx track with altitude graph
|
||||
|
@ -77,10 +77,14 @@ The attributes are:
|
|||
|
||||
1. showhr: show heart rate inside the chart (default is FALSE)
|
||||
|
||||
1. showcad: show cadence inside the chart (default is FALSE)
|
||||
|
||||
1. glinecolorspeed: speed line color (default is #ff0000)
|
||||
|
||||
1. glinecolorhr: heart rate line color (default is #ff77bd)
|
||||
|
||||
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. chartFrom1: minimun value for altitude chart
|
||||
|
@ -115,8 +119,13 @@ Yes!
|
|||
1. Gpx with waypoints
|
||||
2. Admin area - List of tracks
|
||||
2. Admin area - Settings
|
||||
2. Altitude & Speed
|
||||
2. Altitude & Speed & Hearth rate
|
||||
|
||||
== Changelog ==
|
||||
= 1.1.16 =
|
||||
* Cadence chart (where available)
|
||||
* minor bug fixes
|
||||
= 1.1.15 =
|
||||
* migration from google chart to highcharts. Highcharts are much better than google chart! This is the base for a new serie of improvements. Stay in touch for the next releases!
|
||||
* heart rate chart (where available)
|
||||
|
@ -189,6 +198,7 @@ Yes!
|
|||
* Initial release
|
||||
|
||||
== Upgrade Notice ==
|
||||
= 1.1.16 =
|
||||
= 1.1.15 =
|
||||
= 1.1.14 =
|
||||
= 1.1.13 =
|
||||
|
|
BIN
screenshot-3.jpg
BIN
screenshot-3.jpg
Binary file not shown.
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 83 KiB |
BIN
screenshot-4.jpg
BIN
screenshot-4.jpg
Binary file not shown.
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 78 KiB |
Binary file not shown.
After Width: | Height: | Size: 74 KiB |
Binary file not shown.
After Width: | Height: | Size: 56 KiB |
|
@ -3,7 +3,7 @@
|
|||
Plugin Name: WP-GPX-Maps
|
||||
Plugin URI: http://www.darwinner.it/
|
||||
Description: Draws a gpx track with altitude graph
|
||||
Version: 1.1.15
|
||||
Version: 1.1.16
|
||||
Author: Bastianon Massimo
|
||||
Author URI: http://www.pedemontanadelgrappa.it/
|
||||
License: GPL
|
||||
|
@ -19,10 +19,8 @@ add_shortcode('sgpx','handle_WP_GPX_Maps_Shortcodes');
|
|||
register_activation_hook(__FILE__,'WP_GPX_Maps_install');
|
||||
register_deactivation_hook( __FILE__, 'WP_GPX_Maps_remove');
|
||||
add_filter('plugin_action_links', 'WP_GPX_Maps_action_links', 10, 2);
|
||||
|
||||
add_action('wp_enqueue_scripts', 'enqueue_WP_GPX_Maps_scripts');
|
||||
|
||||
|
||||
function WP_GPX_Maps_action_links($links, $file) {
|
||||
static $this_plugin;
|
||||
|
||||
|
@ -60,7 +58,8 @@ function print_WP_GPX_Maps_scripts()
|
|||
</script>
|
||||
<style type="text/css">
|
||||
.wpgpxmaps { clear:both; }
|
||||
.wpgpxmaps img{ width: auto; max-width: auto; }
|
||||
.entry-content .wpgpxmaps img,
|
||||
.wpgpxmaps img { max-width: none; width: none; }
|
||||
.wpgpxmaps .ngimages { display:none; }
|
||||
</style>
|
||||
<?php
|
||||
|
@ -92,6 +91,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
$mh = findValue($attr, "mheight", "wpgpxmaps_height", "450px");
|
||||
$mt = findValue($attr, "mtype", "wpgpxmaps_map_type", "HYBRID");
|
||||
$gh = findValue($attr, "gheight", "wpgpxmaps_graph_height", "200px");
|
||||
$showCad = findValue($attr, "showcad", "wpgpxmaps_show_cadence", false);
|
||||
$showHr = findValue($attr, "showhr", "wpgpxmaps_show_hr", false);
|
||||
$showW = findValue($attr, "waypoints", "wpgpxmaps_show_waypoint", false);
|
||||
$showSpeed = findValue($attr, "showspeed", "wpgpxmaps_show_speed", false);
|
||||
|
@ -103,6 +103,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
$color_graph = findValue($attr, "glinecolor", "wpgpxmaps_graph_line_color", "#3366cc");
|
||||
$color_graph_speed = findValue($attr, "glinecolorspeed", "wpgpxmaps_graph_line_color_speed", "#ff0000");
|
||||
$color_graph_hr = findValue($attr, "glinecolorhr", "wpgpxmaps_graph_line_color_hr", "#ff77bd");
|
||||
$color_graph_cad = findValue($attr, "glinecolorcad", "wpgpxmaps_graph_line_color_cad", "#beecff");
|
||||
$chartFrom1 = findValue($attr, "chartfrom1", "wpgpxmaps_graph_offset_from1", "");
|
||||
$chartTo1 = findValue($attr, "chartfo1", "wpgpxmaps_graph_offset_to1", "");
|
||||
$chartFrom2 = findValue($attr, "chartfrom2", "wpgpxmaps_graph_offset_from2", "");
|
||||
|
@ -115,16 +116,14 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
|
||||
$r = rand(1,5000000);
|
||||
|
||||
$cacheFileName = "$gpx,$w,$mh,$mt,$gh,$showW,showHr,$donotreducegpx,$pointsoffset,$showSpeed,$uom,v1.1.15";
|
||||
$cacheFileName = "$gpx,$w,$mh,$mt,$gh,$showW,$showHr,$showCad,$donotreducegpx,$pointsoffset,$showSpeed,$uom,v1.1.16";
|
||||
|
||||
$cacheFileName = md5($cacheFileName);
|
||||
|
||||
$gpxcache = gpxCacheFolderPath();
|
||||
|
||||
if(!(file_exists($gpxcache) && is_dir($gpxcache)))
|
||||
{
|
||||
@mkdir($gpxcache,0755,true);
|
||||
}
|
||||
|
||||
$gpxcache.= DIRECTORY_SEPARATOR.$cacheFileName.".tmp";
|
||||
|
||||
|
@ -139,6 +138,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
$points_graph_ele = $cache_obj["points_graph_ele"];
|
||||
$points_graph_speed = $cache_obj["points_graph_speed"];
|
||||
$points_graph_hr = $cache_obj["points_graph_hr"];
|
||||
$points_graph_cad = $cache_obj["points_graph_cad"];
|
||||
$waypoints = $cache_obj["waypoints"];
|
||||
} catch (Exception $e) {
|
||||
$points_maps= '';
|
||||
|
@ -146,6 +146,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
$points_graph_ele = '';
|
||||
$points_graph_speed = '';
|
||||
$points_graph_hr = '';
|
||||
$points_graph_cad = '';
|
||||
$waypoints= '';
|
||||
}
|
||||
}
|
||||
|
@ -179,6 +180,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
$points_graph_ele = '';
|
||||
$points_graph_speed = '';
|
||||
$points_graph_hr = '';
|
||||
$points_graph_cad = '';
|
||||
$waypoints = '';
|
||||
|
||||
foreach(array_keys($points->lat) as $i)
|
||||
|
@ -224,6 +226,11 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
$points_graph_hr .= $points->hr[$i].',';
|
||||
}
|
||||
|
||||
if ($showCad == true)
|
||||
{
|
||||
$points_graph_cad .= $points->cad[$i].',';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($showW == true)
|
||||
|
@ -241,6 +248,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
$points_graph_ele = preg_replace($p, "", $points_graph_ele);
|
||||
$points_graph_speed = preg_replace($p, "", $points_graph_speed);
|
||||
$points_graph_hr = preg_replace($p, "", $points_graph_hr);
|
||||
$points_graph_cad = preg_replace($p, "", $points_graph_cad);
|
||||
|
||||
$waypoints = preg_replace($p, "", $waypoints);
|
||||
|
||||
|
@ -256,6 +264,9 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
if (preg_match("/^(0,?)+$/", $points_graph_hr))
|
||||
$points_graph_hr = "";
|
||||
|
||||
if (preg_match("/^(0,?)+$/", $points_graph_cad))
|
||||
$points_graph_cad = "";
|
||||
|
||||
}
|
||||
|
||||
$ngimgs_data = '';
|
||||
|
@ -279,6 +290,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
"points_graph_ele" => $points_graph_ele,
|
||||
"points_graph_speed" => $points_graph_speed,
|
||||
"points_graph_hr" => $points_graph_hr,
|
||||
"points_graph_cad" => $points_graph_cad,
|
||||
"waypoints" => $waypoints)
|
||||
),
|
||||
LOCK_EX);
|
||||
|
@ -292,7 +304,6 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
<div id="ngimages_'.$r.'" class="ngimages" style="display:none">'.$ngimgs_data.'</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
|
||||
jQuery(document).ready(function() {
|
||||
wpgpxmaps({ targetId : "'.$r.'",
|
||||
mapType : "'.$mt.'",
|
||||
|
@ -301,6 +312,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
graphEle : ['.$points_graph_ele.'],
|
||||
graphSpeed : ['.$points_graph_speed.'],
|
||||
graphHr : ['.$points_graph_hr.'],
|
||||
graphCad : ['.$points_graph_cad.'],
|
||||
waypoints : ['.$waypoints.'],
|
||||
unit : "'.$uom.'",
|
||||
unitspeed : "'.$uomspeed.'",
|
||||
|
@ -308,6 +320,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
color2 : "'.$color_graph.'",
|
||||
color3 : "'.$color_graph_speed.'",
|
||||
color4 : "'.$color_graph_hr.'",
|
||||
color5 : "'.$color_graph_cad.'",
|
||||
chartFrom1 : "'.$chartFrom1.'",
|
||||
chartTo1 : "'.$chartTo1.'",
|
||||
chartFrom2 : "'.$chartFrom2.'",
|
||||
|
@ -317,7 +330,6 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
currentIcon : "'.$currentIcon.'"
|
||||
});
|
||||
});
|
||||
|
||||
</script>';
|
||||
|
||||
return $output;
|
||||
|
@ -367,6 +379,7 @@ function WP_GPX_Maps_install() {
|
|||
add_option("wpgpxmaps_graph_line_color", '#3366cc', '', 'yes');
|
||||
add_option("wpgpxmaps_graph_line_color_speed", '#ff0000', '', 'yes');
|
||||
add_option("wpgpxmaps_map_line_color", '#3366cc', '', 'yes');
|
||||
add_option("wpgpxmaps_graph_line_color_cad", '#beecff', '', 'yes');
|
||||
add_option("wpgpxmaps_graph_offset_from1", '', '', 'yes');
|
||||
add_option("wpgpxmaps_graph_offset_to1", '', '', 'yes');
|
||||
add_option("wpgpxmaps_graph_offset_from2", '', '', 'yes');
|
||||
|
@ -377,6 +390,7 @@ function WP_GPX_Maps_install() {
|
|||
add_option("wpgpxmaps_map_nggallery", '', '', 'yes');
|
||||
add_option("wpgpxmaps_show_hr", '', '', 'yes');
|
||||
add_option("wpgpxmaps_graph_line_color_hr", '#ff77bd', '', 'yes');
|
||||
add_option('wpgpxmaps_show_cadence','','','yes');
|
||||
|
||||
}
|
||||
|
||||
|
@ -404,6 +418,8 @@ function WP_GPX_Maps_remove() {
|
|||
delete_option('wpgpxmaps_map_nggallery');
|
||||
delete_option('wpgpxmaps_show_hr');
|
||||
delete_option('wpgpxmaps_graph_line_color_hr');
|
||||
delete_option('wpgpxmaps_show_cadence');
|
||||
delete_option('wpgpxmaps_graph_line_color_cad');
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -97,13 +97,15 @@ function WP_GPX_Maps_html_page() {
|
|||
<li><b>waypoints</b>: print the gpx waypoints inside the map (default is FALSE)</li>
|
||||
<li><b>donotreducegpx</b>: print all the point without reduce it (default is FALSE)</li>
|
||||
<li><b>pointsoffset</b>: skip points closer than XX meters(default is 10)</li>
|
||||
<li><b>uom</b>: the unit of measure values are: 0, 1 (0 = meters, 1 = miles/feet)</li>
|
||||
<li><b>uom</b>: the unit of measure values are: 0, 1, 2 (0 = meters, 1 = miles/feet, 2 = meters/kilometers)</li>
|
||||
<li><b>mlinecolor</b>: map line color (default is #3366cc)</li>
|
||||
<li><b>glinecolor</b>: graph line color (default is #3366cc)</li>
|
||||
<li><b>glinecolorhr</b>: heart rate line color (default is #ff77bd)</li>
|
||||
<li><b>glinecolorspeed</b>: speed line color (default is #ff0000)</li>
|
||||
<li><b>glinecolorhr</b>: heart rate line color (default is #ff77bd)</li>
|
||||
<li><b>glinecolorcad</b>: cadence line color (default is #beecff)</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>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>chartFrom1</b>: minimun value for altitude chart</li>
|
||||
<li><b>chartTo1</b>: maxumin value for altitude chart</li>
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
$uomSpeed = get_option('wpgpxmaps_unit_of_measure_speed');
|
||||
$showSpeed = get_option('wpgpxmaps_show_speed');
|
||||
$showHr = get_option('wpgpxmaps_show_hr');
|
||||
$showCad = get_option('wpgpxmaps_show_cadence');
|
||||
|
||||
if (!($t))
|
||||
$t = 'HYBRID';
|
||||
|
@ -182,13 +183,8 @@
|
|||
<em>(leave empty for auto scale)</em>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
$showHr = get_option('wpgpxmaps_show_hr');
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
<th scope="row">Show heart rate:</th>
|
||||
<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>
|
||||
</td>
|
||||
|
@ -201,14 +197,24 @@
|
|||
</tr>
|
||||
|
||||
|
||||
|
||||
<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>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Cadence line color:</th>
|
||||
<td>
|
||||
<input name="wpgpxmaps_graph_line_color_cad" type="color" data-hex="true" value="<?php echo get_option('wpgpxmaps_graph_line_color_cad'); ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
<p class="submit">
|
||||
<input type="hidden" name="action" value="update" />
|
||||
<input name="page_options" type="hidden" value="wpgpxmaps_unit_of_measure,wpgpxmaps_graph_line_color,wpgpxmaps_show_speed,wpgpxmaps_graph_line_color_speed,wpgpxmaps_show_hr,wpgpxmaps_graph_line_color_hr,wpgpxmaps_unit_of_measure_speed,wpgpxmaps_graph_offset_from1,wpgpxmaps_graph_offset_to1,wpgpxmaps_graph_offset_from2,wpgpxmaps_graph_offset_to2" />
|
||||
<input name="page_options" type="hidden" value="wpgpxmaps_unit_of_measure,wpgpxmaps_graph_line_color,wpgpxmaps_show_speed,wpgpxmaps_graph_line_color_speed,wpgpxmaps_show_hr,wpgpxmaps_graph_line_color_hr,wpgpxmaps_unit_of_measure_speed,wpgpxmaps_graph_offset_from1,wpgpxmaps_graph_offset_to1,wpgpxmaps_graph_offset_from2,wpgpxmaps_graph_offset_to2,wpgpxmaps_graph_line_color_cad,wpgpxmaps_show_cadence" />
|
||||
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
|
||||
</p>
|
||||
|
||||
|
|
|
@ -106,6 +106,7 @@
|
|||
unset($points->dist[$i]);
|
||||
unset($points->speed[$i]);
|
||||
unset($points->hr[$i]);
|
||||
unset($points->cad[$i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -123,6 +124,7 @@
|
|||
$points->dist = array();
|
||||
$points->speed = array();
|
||||
$points->hr = array();
|
||||
$points->cad = array();
|
||||
|
||||
$gpx = simplexml_load_file($filePath);
|
||||
|
||||
|
@ -156,16 +158,25 @@
|
|||
$time = $trkpt->time;
|
||||
$speed = (float)$trkpt->speed;
|
||||
$hr = 0;
|
||||
$cad = 0;
|
||||
|
||||
if (isset($trkpt->extensions))
|
||||
{
|
||||
$_hr = @$trkpt->extensions->xpath('gpxtpx:TrackPointExtension/gpxtpx:hr/text()');
|
||||
$_hr = $trkpt->extensions->xpath('gpxtpx:TrackPointExtension/gpxtpx:hr/text()');
|
||||
if ($_hr)
|
||||
{
|
||||
foreach ($_hr as $node) {
|
||||
$hr = (float)$node;
|
||||
}
|
||||
}
|
||||
|
||||
$_cad = $trkpt->extensions->xpath('gpxtpx:TrackPointExtension/gpxtpx:cad/text()');
|
||||
if ($_cad)
|
||||
{
|
||||
foreach ($_cad as $node) {
|
||||
$cad = (float)$node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($lastLat == 0 && $lastLon == 0)
|
||||
|
@ -178,6 +189,7 @@
|
|||
array_push($points->dist, (float)round($dist,2));
|
||||
array_push($points->speed, 0);
|
||||
array_push($points->hr, $hr);
|
||||
array_push($points->cad, $cad);
|
||||
|
||||
$lastLat=$lat;
|
||||
$lastLon=$lon;
|
||||
|
@ -193,8 +205,6 @@
|
|||
if ($speed == 0)
|
||||
{
|
||||
$datediff = (float)my_date_diff($lastTime,$time);
|
||||
//echo "------------$time-------$lastTime-----";
|
||||
//echo "------------$datediff------------";
|
||||
if ($datediff>0)
|
||||
{
|
||||
$speed = $offset / $datediff;
|
||||
|
@ -206,7 +216,6 @@
|
|||
if (((float) $offset + (float) $lastOffset) > $gpxOffset)
|
||||
{
|
||||
//Bigger Offset -> write coordinate
|
||||
|
||||
$avgSpeed = 0;
|
||||
|
||||
foreach($speedBuffer as $s)
|
||||
|
@ -225,6 +234,7 @@
|
|||
array_push($points->dist, (float)round($dist, 2) );
|
||||
array_push($points->speed, (float)round($avgSpeed, 1) );
|
||||
array_push($points->hr, $hr);
|
||||
array_push($points->cad, $cad);
|
||||
|
||||
}
|
||||
else
|
||||
|
@ -269,6 +279,8 @@
|
|||
array_push($points->ele, 0 );
|
||||
array_push($points->dist, 0 );
|
||||
array_push($points->speed, 0 );
|
||||
array_push($points->hr, 0 );
|
||||
array_push($points->cad, 0 );
|
||||
$lastLat=$lat;
|
||||
$lastLon=$lon;
|
||||
}
|
||||
|
@ -286,6 +298,8 @@
|
|||
array_push($points->ele, 0 );
|
||||
array_push($points->dist, 0 );
|
||||
array_push($points->speed, 0 );
|
||||
array_push($points->hr, 0 );
|
||||
array_push($points->cad, 0 );
|
||||
}
|
||||
else
|
||||
{
|
Loading…
Reference in New Issue