This commit is contained in:
bastianonm 2012-02-22 14:29:44 +00:00
parent c5837f4993
commit 36fb58126f
4 changed files with 48 additions and 50 deletions

View File

@ -59,8 +59,10 @@ function _wpgpxmaps(params)
case 'ROADMAP': { mapType = google.maps.MapTypeId.ROADMAP; break;} case 'ROADMAP': { mapType = google.maps.MapTypeId.ROADMAP; break;}
default: { mapType = google.maps.MapTypeId.HYBRID; break;} default: { mapType = google.maps.MapTypeId.HYBRID; break;}
} }
var mapOptions = { var mapOptions = {
mapTypeId: mapType mapTypeId: mapType,
scrollwheel: false
}; };
var map = new google.maps.Map(el_map, mapOptions); var map = new google.maps.Map(el_map, mapOptions);
@ -129,14 +131,8 @@ function _wpgpxmaps(params)
marker.setTitle("Current Position"); marker.setTitle("Current Position");
if ( chart ) if ( chart )
{ {
var l1 = event.latLng.Qa; var l1 = event.latLng.lat();
if (!(l1)) var l2 = event.latLng.lng();
l1 = event.latLng.Oa;
var l2 = event.latLng.Ra;
if (!(l2))
l2 = event.latLng.Pa;
var ci = getClosestIndex(mapData,l1,l2); var ci = getClosestIndex(mapData,l1,l2);
var r = chart.setSelection([{'row': parseInt(ci) + 1}]); var r = chart.setSelection([{'row': parseInt(ci) + 1}]);
} }
@ -156,6 +152,11 @@ function _wpgpxmaps(params)
numberFormat1 = "#,##0.#mi"; numberFormat1 = "#,##0.#mi";
numberFormat2 = "#,###ft"; numberFormat2 = "#,###ft";
} }
else if (unit=="2")
{
numberFormat1 = "#,###0.#km";
numberFormat2 = "#,###m";
}
var showSpeed = (graphData[0].length == 3); var showSpeed = (graphData[0].length == 3);

View File

@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=basti
Tags: maps, gpx, gps, graph, google maps, google chart, track, garmin Tags: maps, gpx, gps, graph, google maps, google chart, track, garmin
Requires at least: 2.0.0 Requires at least: 2.0.0
Tested up to: 3.3 Tested up to: 3.3
Stable tag: 1.1.6 Stable tag: 1.1.7
License: GPLv2 or later License: GPLv2 or later
Draws a gpx track with altitude graph Draws a gpx track with altitude graph
@ -58,7 +58,7 @@ The attributes are:
1. pointsoffset: skip points closer than XX meters(default is 10) 1. pointsoffset: skip points closer than XX meters(default is 10)
1. uom: the unit of measure of distance/altitude are values are: 0, 1 (0 = meters, 1 = miles/feet) 1. uom: the unit of measure of distance/altitude are values are: 0, 1, 2 (0 = meters, 1 = feet/miles, 2 = meters/kilometers)
1. mlinecolor: map line color (default is #3366cc) 1. mlinecolor: map line color (default is #3366cc)
@ -83,6 +83,10 @@ Yes!
2. Admin area - Settings 2. Admin area - Settings
== Changelog == == Changelog ==
= 1.1.7 =
* new unit of measure (meters/kilometers)
* mouse wheel scrolling issue fixed
* minor bug fixes
= 1.1.6 = = 1.1.6 =
* improved charts * improved charts
* improved admin area * improved admin area

View File

@ -3,7 +3,7 @@
Plugin Name: WP-GPX-Maps Plugin Name: WP-GPX-Maps
Plugin URI: http://www.darwinner.it/ Plugin URI: http://www.darwinner.it/
Description: Draws a gpx track with altitude graph Description: Draws a gpx track with altitude graph
Version: 1.1.6 Version: 1.1.7
Author: Bastianon Massimo Author: Bastianon Massimo
Author URI: http://www.pedemontanadelgrappa.it/ Author URI: http://www.pedemontanadelgrappa.it/
License: GPL License: GPL
@ -88,7 +88,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
$r = rand(1,5000000); $r = rand(1,5000000);
$cacheFileName = md5($gpx.$w.$mh.$mt.$gh.$showW.$donotreducegpx.$pointsoffset,$showSpeed); $cacheFileName = md5($gpx.$w.$mh.$mt.$gh.$showW.$donotreducegpx.$pointsoffset.$showSpeed.$uom);
$gpxcache = gpxCacheFolderPath(); $gpxcache = gpxCacheFolderPath();
if(!(file_exists($gpxcache) && is_dir($gpxcache))) if(!(file_exists($gpxcache) && is_dir($gpxcache)))
@ -141,12 +141,25 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
$points_graph = ''; $points_graph = '';
$waypoints = ''; $waypoints = '';
if ($showSpeed == true) foreach ($points as $p) {
{ $points_maps .= '['.(float)$p[0].','.(float)$p[1].'],';
foreach ($points as $p) { $_dist = $p[3];
$points_maps .= '['.(float)$p[0].','.(float)$p[1].'],'; $_ele = $p[2];
if ($uom == '1')
{
// Miles and feet
$_dist *= 0.000621371192;
$_ele *= 3.2808399;
} else if ($uom == '2')
{
// meters / kilometers
$_dist = $_dist/1000;
}
if ($showSpeed == true) {
$_speed = $p[4]; // dafault m/s $_speed = $p[4]; // dafault m/s
if ($uomspeed == '2') // miles/h if ($uomspeed == '2') // miles/h
@ -156,37 +169,16 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
else if ($uomspeed == '1') // km/h else if ($uomspeed == '1') // km/h
{ {
$_speed *= 3.6; $_speed *= 3.6;
} }
if ($uom == '1') $points_graph .= '['.$_dist.','.$_ele.','.$_speed.'],';
{ }
// Miles and feet else {
$points_graph .= '['.((float)$p[3]*0.000621371192).','.((float)$p[2]*3.2808399).','.$_speed.'],'; $points_graph .= '['.$_dist.','.$_ele.'],';
} }
else
{
$points_graph .= '['.(float)$p[3].','.(float)$p[2].','.$_speed.'],';
}
}
} }
else
{
foreach ($points as $p) {
$points_maps .= '['.(float)$p[0].','.(float)$p[1].'],';
if ($uom == '1')
{
// Miles and feet
$points_graph .= '['.((float)$p[3]*0.000621371192).','.((float)$p[2]*3.2808399).'],';
}
else
{
$points_graph .= '['.(float)$p[3].','.(float)$p[2].'],';
}
}
}
if ($showW == true) if ($showW == true)
{ {

View File

@ -78,8 +78,9 @@
<th scope="row">Unit of measure:</th> <th scope="row">Unit of measure:</th>
<td> <td>
<select name='wpgpxmaps_unit_of_measure'> <select name='wpgpxmaps_unit_of_measure'>
<option value="0" <?php if ($uom == '0') echo 'selected'; ?>>meters</option> <option value="0" <?php if ($uom == '0') echo 'selected'; ?>>meters/meters</option>
<option value="1" <?php if ($uom == '1') echo 'selected'; ?>>miles/feet</option> <option value="1" <?php if ($uom == '1') echo 'selected'; ?>>feet/miles</option>
<option value="2" <?php if ($uom == '2') echo 'selected'; ?>>meters/kilometers</option>
</select> </select>
</td> </td>
</tr> </tr>