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

@ -1293,4 +1293,4 @@ Author URI: http://www.pedemontanadelgrappa.it/
return Math.sqrt(dLat * dLat + dLon * dLon); return Math.sqrt(dLat * dLat + dLon * dLon);
} }
}( jQuery )); }( jQuery ));

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,54 +634,57 @@ 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() {
mapType : "'.$mt.'", jQuery("#wpgpxmaps_'.$r.'").wpgpxmaps({
mapData : ['.$points_maps.'], targetId : "'.$r.'",
graphDist : ['.($hideGraph ? '' : $points_graph_dist).'], mapType : "'.$mt.'",
graphEle : ['.($hideGraph ? '' : $points_graph_ele).'], mapData : ['.$points_maps.'],
graphSpeed : ['.($hideGraph ? '' : $points_graph_speed).'], graphDist : ['.($hideGraph ? '' : $points_graph_dist).'],
graphHr : ['.($hideGraph ? '' : $points_graph_hr).'], graphEle : ['.($hideGraph ? '' : $points_graph_ele).'],
graphAtemp : ['.($hideGraph ? '' : $points_graph_atemp).'], graphSpeed : ['.($hideGraph ? '' : $points_graph_speed).'],
graphCad : ['.($hideGraph ? '' : $points_graph_cad).'], graphHr : ['.($hideGraph ? '' : $points_graph_hr).'],
graphGrade : ['.($hideGraph ? '' : $points_graph_grade).'], graphAtemp : ['.($hideGraph ? '' : $points_graph_atemp).'],
waypoints : ['.$waypoints.'], graphCad : ['.($hideGraph ? '' : $points_graph_cad).'],
unit : "'.$uom.'", graphGrade : ['.($hideGraph ? '' : $points_graph_grade).'],
unitspeed : "'.$uomspeed.'", waypoints : '.$waypoints.',
color1 : ['.$colors_map.'], unit : "'.$uom.'",
color2 : "'.$color_graph.'", unitspeed : "'.$uomspeed.'",
color3 : "'.$color_graph_speed.'", color1 : ['.$colors_map.'],
color4 : "'.$color_graph_hr.'", color2 : "'.$color_graph.'",
color5 : "'.$color_graph_cad.'", color3 : "'.$color_graph_speed.'",
color6 : "'.$color_graph_grade.'", color4 : "'.$color_graph_hr.'",
color7 : "'.$color_graph_atemp.'", color5 : "'.$color_graph_cad.'",
chartFrom1 : "'.$chartFrom1.'", color6 : "'.$color_graph_grade.'",
chartTo1 : "'.$chartTo1.'", color7 : "'.$color_graph_atemp.'",
chartFrom2 : "'.$chartFrom2.'", chartFrom1 : "'.$chartFrom1.'",
chartTo2 : "'.$chartTo2.'", chartTo1 : "'.$chartTo1.'",
startIcon : "'.$startIcon.'", chartFrom2 : "'.$chartFrom2.'",
endIcon : "'.$endIcon.'", chartTo2 : "'.$chartTo2.'",
currentIcon : "'.$currentIcon.'", startIcon : "'.$startIcon.'",
waypointIcon : "'.$waypointIcon.'", endIcon : "'.$endIcon.'",
currentpositioncon : "'.$currentpositioncon.'", currentIcon : "'.$currentIcon.'",
usegpsposition : "'.$usegpsposition.'", waypointIcon : "'.$waypointIcon.'",
zoomOnScrollWheel : "'.$zoomOnScrollWheel.'", currentpositioncon : "'.$currentpositioncon.'",
ngGalleries : ['.$ngGalleries.'], usegpsposition : "'.$usegpsposition.'",
ngImages : ['.$ngImages.'], zoomOnScrollWheel : "'.$zoomOnScrollWheel.'",
pluginUrl : "'.plugins_url().'", ngGalleries : ['.$ngGalleries.'],
langs : { altitude : "'.__("Altitude", "wp-gpx-maps").'", ngImages : ['.$ngImages.'],
currentPosition : "'.__("Current Position", "wp-gpx-maps").'", pluginUrl : "'.plugins_url().'",
speed : "'.__("Speed", "wp-gpx-maps").'", langs : { altitude : "'.__("Altitude", "wp-gpx-maps").'",
grade : "'.__("Grade", "wp-gpx-maps").'", currentPosition : "'.__("Current Position", "wp-gpx-maps").'",
heartRate : "'.__("Heart rate", "wp-gpx-maps").'", speed : "'.__("Speed", "wp-gpx-maps").'",
atemp : "'.__("Temperature", "wp-gpx-maps").'", grade : "'.__("Grade", "wp-gpx-maps").'",
cadence : "'.__("Cadence", "wp-gpx-maps").'", heartRate : "'.__("Heart rate", "wp-gpx-maps").'",
goFullScreen : "'.__("Go Full Screen", "wp-gpx-maps").'", atemp : "'.__("Temperature", "wp-gpx-maps").'",
exitFullFcreen : "'.__("Exit Full Screen", "wp-gpx-maps").'", cadence : "'.__("Cadence", "wp-gpx-maps").'",
hideImages : "'.__("Hide Images", "wp-gpx-maps").'", goFullScreen : "'.__("Go Full Screen", "wp-gpx-maps").'",
showImages : "'.__("Show Images", "wp-gpx-maps").'", exitFullFcreen : "'.__("Exit Full Screen", "wp-gpx-maps").'",
backToCenter : "'.__("Back to center", "wp-gpx-maps").'" hideImages : "'.__("Hide Images", "wp-gpx-maps").'",
} showImages : "'.__("Show Images", "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 )