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;}
default: { mapType = google.maps.MapTypeId.HYBRID; break;}
}
var mapOptions = {
mapTypeId: mapType
mapTypeId: mapType,
scrollwheel: false
};
var map = new google.maps.Map(el_map, mapOptions);
@ -129,14 +131,8 @@ function _wpgpxmaps(params)
marker.setTitle("Current Position");
if ( chart )
{
var l1 = event.latLng.Qa;
if (!(l1))
l1 = event.latLng.Oa;
var l2 = event.latLng.Ra;
if (!(l2))
l2 = event.latLng.Pa;
var l1 = event.latLng.lat();
var l2 = event.latLng.lng();
var ci = getClosestIndex(mapData,l1,l2);
var r = chart.setSelection([{'row': parseInt(ci) + 1}]);
}
@ -156,6 +152,11 @@ function _wpgpxmaps(params)
numberFormat1 = "#,##0.#mi";
numberFormat2 = "#,###ft";
}
else if (unit=="2")
{
numberFormat1 = "#,###0.#km";
numberFormat2 = "#,###m";
}
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
Requires at least: 2.0.0
Tested up to: 3.3
Stable tag: 1.1.6
Stable tag: 1.1.7
License: GPLv2 or later
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. 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)
@ -83,6 +83,10 @@ Yes!
2. Admin area - Settings
== Changelog ==
= 1.1.7 =
* new unit of measure (meters/kilometers)
* mouse wheel scrolling issue fixed
* minor bug fixes
= 1.1.6 =
* improved charts
* improved admin area

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.6
Version: 1.1.7
Author: Bastianon Massimo
Author URI: http://www.pedemontanadelgrappa.it/
License: GPL
@ -88,7 +88,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
$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();
if(!(file_exists($gpxcache) && is_dir($gpxcache)))
@ -141,11 +141,24 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
$points_graph = '';
$waypoints = '';
if ($showSpeed == true)
{
foreach ($points as $p) {
$points_maps .= '['.(float)$p[0].','.(float)$p[1].'],';
foreach ($points as $p) {
$points_maps .= '['.(float)$p[0].','.(float)$p[1].'],';
$_dist = $p[3];
$_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
@ -158,36 +171,15 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
$_speed *= 3.6;
}
if ($uom == '1')
{
// Miles and feet
$points_graph .= '['.((float)$p[3]*0.000621371192).','.((float)$p[2]*3.2808399).','.$_speed.'],';
}
else
{
$points_graph .= '['.(float)$p[3].','.(float)$p[2].','.$_speed.'],';
}
$points_graph .= '['.$_dist.','.$_ele.','.$_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].'],';
}
else {
$points_graph .= '['.$_dist.','.$_ele.'],';
}
}
if ($showW == true)
{
$wpoints = getWayPoints($gpx);

View File

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