From 36fb58126f0e7b73d5ec80c5acffb190dfec7ab1 Mon Sep 17 00:00:00 2001 From: bastianonm Date: Wed, 22 Feb 2012 14:29:44 +0000 Subject: [PATCH] --- WP-GPX-Maps.js | 19 +++++----- readme.txt | 8 +++-- wp-gpx-maps.php | 66 +++++++++++++++------------------- wp-gpx-maps_admin_settings.php | 5 +-- 4 files changed, 48 insertions(+), 50 deletions(-) diff --git a/WP-GPX-Maps.js b/WP-GPX-Maps.js index 9d2e2e7..362f856 100644 --- a/WP-GPX-Maps.js +++ b/WP-GPX-Maps.js @@ -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); diff --git a/readme.txt b/readme.txt index 8f13020..7c80ca1 100644 --- a/readme.txt +++ b/readme.txt @@ -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 diff --git a/wp-gpx-maps.php b/wp-gpx-maps.php index ebafce3..2e4eca0 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.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,12 +141,25 @@ 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 if ($uomspeed == '2') // miles/h @@ -156,37 +169,16 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='') else if ($uomspeed == '1') // km/h { $_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 { + $points_graph .= '['.$_dist.','.$_ele.'],'; + } + } - 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) { diff --git a/wp-gpx-maps_admin_settings.php b/wp-gpx-maps_admin_settings.php index 823baa0..4149c87 100644 --- a/wp-gpx-maps_admin_settings.php +++ b/wp-gpx-maps_admin_settings.php @@ -78,8 +78,9 @@ Unit of measure: