diff --git a/WP-GPX-Maps.js b/WP-GPX-Maps.js index 1820e90..96684bd 100644 --- a/WP-GPX-Maps.js +++ b/WP-GPX-Maps.js @@ -357,20 +357,35 @@ function _wpgpxmaps(params) var points = []; var lastCut=0; var polylinenes = []; - + var polyline_number=0; + var color=0; for (i=0; i < mapData.length; i++) { if (mapData[i] == null) { + + if ( polyline_number < color1.length ) + { + color=color1[polyline_number]; + } + else + { + color=color1[color1.length-1]; + } + var poly = new google.maps.Polyline({ path: points.slice(lastCut,i), - strokeColor: color1, + strokeColor: color, strokeOpacity: .7, strokeWeight: 4, map: map }); polylinenes.push(poly); lastCut=i; + polyline_number= polyline_number +1; + //var p = new google.maps.LatLng(mapData[i-1][0], mapData[i-1][1]); + //points.push(p); + //bounds.extend(p); } else { @@ -382,15 +397,24 @@ function _wpgpxmaps(params) if (points.length != lastCut) { + if ( polyline_number < color1.length) + { + color=color1[polyline_number]; + } + else + { + color=color1[color1.length-1]; + } var poly = new google.maps.Polyline({ path: points.slice(lastCut), - strokeColor: color1, + strokeColor: color, strokeOpacity: .7, strokeWeight: 4, map: map }); polylinenes.push(poly); currentPoints = []; + polyline_number= polyline_number +1; } if (startIcon != '') @@ -857,12 +881,18 @@ function getItemFromArray(arr,index) } } + + + function getClosestIndex(points,lat,lon) { var dd=10000; var ii=0; for (i=0; i < points.length; i++) { + if (points[i]==null) + continue; + var d = dist(points[i][0], points[i][1], lat, lon); if ( d < dd ) { diff --git a/readme.txt b/readme.txt index 2cd317e..2403616 100644 --- a/readme.txt +++ b/readme.txt @@ -1,11 +1,11 @@ === 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, cadence Requires at least: 2.0.0 Tested up to: 3.4 -Stable tag: 1.1.34 -License: GPLv2 or later +Stable tag: 1.1.35 Draws a gpx track with altitude graph. You can also display your nextgen gallery images in the map. @@ -54,7 +54,9 @@ Supported gpx namespaces are: 1. http://www.garmin.com/xmlschemas/TrackPointExtension/v1 -Thanks to: www.securcube.net, www.devfarm.it, www.pedemontanadelgrappa.it, +Thanks to: www.securcube.net, www.devfarm.it, www.pedemontanadelgrappa.it + +Up to version 1.1.15 [Highcharts-API](http://www.highcharts.com/) is the only available rendering engine. Please respect their license and pricing (only Free for Non-Commercial usage). == Installation == @@ -165,6 +167,10 @@ Yes! 1. Altitude & Speed & Hearth rate == Changelog == += 1.1.35 = +* Fix: In the post list, sometime, the maps was not displaying correctly ( the php rand() function was not working?? ) +* Various improvements for multi track gpx. Thanks to GPSracks.tv +* Summary table is now avaiable even without chart. Thanks to David = 1.1.34 = * 2 decimals for unit of measure min/km and min/mi * translation file updated (a couple of phrases added) diff --git a/wp-gpx-maps.php b/wp-gpx-maps.php index dbcc155..956347f 100644 --- a/wp-gpx-maps.php +++ b/wp-gpx-maps.php @@ -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.34 +Version: 1.1.35 Author: Bastianon Massimo Author URI: http://www.pedemontanadelgrappa.it/ License: GPL @@ -145,8 +145,8 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='') $p_avg_speed = findValue($attr, "summaryavgspeed", "wpgpxmaps_summary_avg_speed", false); $p_total_time = findValue($attr, "summarytotaltime", "wpgpxmaps_summary_total_time", false); - $r = rand(1,5000000); - + $colors_map = "\"".implode("\",\"",(explode(" ",$color_map)))."\""; + $gpxurl = $gpx; $cacheFileName = "$gpx,$w,$mh,$mt,$gh,$showW,$showHr,$showCad,$donotreducegpx,$pointsoffset,$showSpeed,$uomspeed,$uom,v1.1.32"; @@ -255,11 +255,12 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='') $avg_speed = $points->avgSpeed; $tot_len = $points->totalLength; - foreach(array_keys($points->lat) as $i) + if (is_array ($points_x_lat)) + foreach(array_keys($points_x_lat) as $i) { - $_lat = (float)$points->lat[$i]; - $_lon = (float)$points->lon[$i]; + $_lat = (float)$points_x_lat[$i]; + $_lon = (float)$points_x_lon[$i]; if ( $_lat == 0 && $_lon == 0 ) { @@ -278,7 +279,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='') } else { - $points_maps .= '['.(float)$points->lat[$i].','.(float)$points->lon[$i].'],'; + $points_maps .= '['.(float)$points_x_lat[$i].','.(float)$points_x_lon[$i].'],'; $_ele = (float)$points->ele[$i]; $_dist = (float)$points->dist[$i]; @@ -425,14 +426,10 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='') @chmod($gpxcache,0755); } - if ($gh == "0" || $gh == "0px") - { - $points_graph_dist = ''; - $points_graph_ele = ''; - $points_graph_speed = ''; - $points_graph_hr = ''; - $points_graph_cad = ''; - } + $hideGraph = ($gh == "0" || $gh == "0px"); + + global $post; + $r = $post->ID."_".rand(1,5000000); $output = '