This commit is contained in:
bastianonm 2012-09-12 13:59:14 +00:00
parent b108750b44
commit 0235961196
3 changed files with 60 additions and 27 deletions

View File

@ -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 )
{

View File

@ -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: <a href="http://www.securcube.net/">www.securcube.net</a>, <a href="http://www.devfarm.it/">www.devfarm.it</a>, <a href="http://www.pedemontanadelgrappa.it/">www.pedemontanadelgrappa.it</a>,
Thanks to: <a href="http://www.securcube.net/">www.securcube.net</a>, <a href="http://www.devfarm.it/">www.devfarm.it</a>, <a href="http://www.pedemontanadelgrappa.it/">www.pedemontanadelgrappa.it</a>
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)

View File

@ -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,7 +145,7 @@ 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;
@ -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 = '
<div id="wpgpxmaps_'.$r.'" class="wpgpxmaps">
@ -446,15 +443,15 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
wpgpxmaps({ targetId : "'.$r.'",
mapType : "'.$mt.'",
mapData : ['.$points_maps.'],
graphDist : ['.$points_graph_dist.'],
graphEle : ['.$points_graph_ele.'],
graphSpeed : ['.$points_graph_speed.'],
graphHr : ['.$points_graph_hr.'],
graphCad : ['.$points_graph_cad.'],
graphDist : ['.($hideGraph ? '' : $points_graph_dist).'],
graphEle : ['.($hideGraph ? '' : $points_graph_ele).'],
graphSpeed : ['.($hideGraph ? '' : $points_graph_speed).'],
graphHr : ['.($hideGraph ? '' : $points_graph_hr).'],
graphCad : ['.($hideGraph ? '' : $points_graph_cad).'],
waypoints : ['.$waypoints.'],
unit : "'.$uom.'",
unitspeed : "'.$uomspeed.'",
color1 : "'.$color_map.'",
color1 : ['.$colors_map.'],
color2 : "'.$color_graph.'",
color3 : "'.$color_graph_speed.'",
color4 : "'.$color_graph_hr.'",