Version 1.3.9

Versione Retrieve waypoints in JSON, possibility to add a custom marker
This commit is contained in:
bastianonm 2015-12-17 10:56:23 +00:00
parent f1a3523a32
commit 7ec4369b82
4 changed files with 62 additions and 54 deletions

View File

@ -1,11 +1,11 @@
=== WP GPX Maps === === WP GPX Maps ===
Contributors: bastianonm, Stephan Klein Contributors: bastianonm, Stephan Klein, Michel Selerin
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8VHWLRW6JBTML Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8VHWLRW6JBTML
Tags: maps, gpx, gps, graph, chart, google maps, track, garmin, image, nextgen-gallery, nextgen, exif, OpenStreetMap, OpenCycleMap, Hike&Bike, heart rate, heartrate, cadence Tags: maps, gpx, gps, graph, chart, google maps, track, garmin, image, nextgen-gallery, nextgen, exif, OpenStreetMap, OpenCycleMap, Hike&Bike, heart rate, heartrate, cadence
Requires at least: 2.0.0 Requires at least: 2.0.0
Tested up to: 4.3.1 Tested up to: 4.3.1
Stable tag: 1.3.8 Stable tag: 1.3.9
Draws a gpx track with altitude graph. You can also display your nextgen gallery images in the map. Draws a gpx track with altitude graph. You can also display your nextgen gallery images in the map.
@ -195,6 +195,8 @@ Yes!
1. Altitude & Speed & Hearth rate 1. Altitude & Speed & Hearth rate
== Changelog == == Changelog ==
= 1.3.9 =
* Retrieve waypoints in JSON, possibility to add a custom marker (Changed by Michel Selerin)
= 1.3.8 = = 1.3.8 =
* Improved Google Maps visualization * Improved Google Maps visualization
= 1.3.7 = = 1.3.7 =

View File

@ -266,7 +266,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
$mtime = 0; $mtime = 0;
} }
$cacheFileName = "$gpx,$mtime,$w,$mh,$mt,$gh,$showEle,$showW,$showHr,$showAtemp,$showCad,$donotreducegpx,$pointsoffset,$showSpeed,$showGrade,$uomspeed,$uom,$distanceType,v1.3.5"; $cacheFileName = "$gpx,$mtime,$w,$mh,$mt,$gh,$showEle,$showW,$showHr,$showAtemp,$showCad,$donotreducegpx,$pointsoffset,$showSpeed,$showGrade,$uomspeed,$uom,$distanceType,v1.3.9";
$cacheFileName = md5($cacheFileName); $cacheFileName = md5($cacheFileName);
@ -511,12 +511,16 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
} }
$avg_speed = convertSpeed($avg_speed,$uomspeed,true); $avg_speed = convertSpeed($avg_speed,$uomspeed,true);
$waypoints = '[]';
if ($showW == true) { if ($showW == true) {
$wpoints = getWayPoints($gpx); $wpoints = getWayPoints($gpx);
/*
foreach ($wpoints as $p) { foreach ($wpoints as $p) {
$waypoints .= '['.number_format ( (float)$p[0] , 7 , '.' , '' ).','.number_format ( (float)$p[1] , 7 , '.' , '' ).',\''.unescape($p[4]).'\',\''.unescape($p[5]).'\',\''.unescape($p[7]).'\'],'; $waypoints .= '['.number_format ( (float)$p[0] , 7 , '.' , '' ).','.number_format ( (float)$p[1] , 7 , '.' , '' ).',\''.unescape($p[4]).'\',\''.unescape($p[5]).'\',\''.unescape($p[7]).'\'],';
} }
*/
$waypoints = json_encode($wpoints);
} }
if ($showEle == "false") if ($showEle == "false")
@ -630,7 +634,9 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
</div> </div>
'. $error .' '. $error .'
<script type="text/javascript"> <script type="text/javascript">
jQuery("#wpgpxmaps_'.$r.'").wpgpxmaps({ targetId : "'.$r.'", jQuery(document).ready(function() {
jQuery("#wpgpxmaps_'.$r.'").wpgpxmaps({
targetId : "'.$r.'",
mapType : "'.$mt.'", mapType : "'.$mt.'",
mapData : ['.$points_maps.'], mapData : ['.$points_maps.'],
graphDist : ['.($hideGraph ? '' : $points_graph_dist).'], graphDist : ['.($hideGraph ? '' : $points_graph_dist).'],
@ -640,7 +646,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
graphAtemp : ['.($hideGraph ? '' : $points_graph_atemp).'], graphAtemp : ['.($hideGraph ? '' : $points_graph_atemp).'],
graphCad : ['.($hideGraph ? '' : $points_graph_cad).'], graphCad : ['.($hideGraph ? '' : $points_graph_cad).'],
graphGrade : ['.($hideGraph ? '' : $points_graph_grade).'], graphGrade : ['.($hideGraph ? '' : $points_graph_grade).'],
waypoints : ['.$waypoints.'], waypoints : '.$waypoints.',
unit : "'.$uom.'", unit : "'.$uom.'",
unitspeed : "'.$uomspeed.'", unitspeed : "'.$uomspeed.'",
color1 : ['.$colors_map.'], color1 : ['.$colors_map.'],
@ -678,6 +684,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
backToCenter : "'.__("Back to center", "wp-gpx-maps").'" backToCenter : "'.__("Back to center", "wp-gpx-maps").'"
} }
}); });
});
</script>'; </script>';
// print summary // print summary

View File

@ -584,7 +584,6 @@
$gpx->registerXPathNamespace('10', 'http://www.topografix.com/GPX/1/0'); $gpx->registerXPathNamespace('10', 'http://www.topografix.com/GPX/1/0');
$gpx->registerXPathNamespace('11', 'http://www.topografix.com/GPX/1/1'); $gpx->registerXPathNamespace('11', 'http://www.topografix.com/GPX/1/1');
$nodes = $gpx->xpath('//wpt | //10:wpt | //11:wpt'); $nodes = $gpx->xpath('//wpt | //10:wpt | //11:wpt');
global $wpdb; global $wpdb;
if ( count($nodes) > 0 ) if ( count($nodes) > 0 )