From 014ff39ee4b085b5eff3e4221ce66a92f3221710 Mon Sep 17 00:00:00 2001 From: bastianonm Date: Tue, 20 Mar 2012 07:31:51 +0000 Subject: [PATCH] --- WP-GPX-Maps.js | 53 ++++++++++++++++++++++++++++++---- readme.txt | 8 +++-- wp-gpx-maps.php | 53 +++++++++++++++++----------------- wp-gpx-maps_admin_settings.php | 3 ++ 4 files changed, 84 insertions(+), 33 deletions(-) diff --git a/WP-GPX-Maps.js b/WP-GPX-Maps.js index 1bcfbbd..ab771b6 100644 --- a/WP-GPX-Maps.js +++ b/WP-GPX-Maps.js @@ -145,19 +145,62 @@ function _wpgpxmaps(params) var mapWidth = el_map.style.width; + + var mapTypeIds = []; + for(var type in google.maps.MapTypeId) { + mapTypeIds.push(google.maps.MapTypeId[type]); + } + mapTypeIds.push("OSM1"); + mapTypeIds.push("OSM2"); + mapTypeIds.push("OSM3"); + switch (mapType) { case 'TERRAIN': { mapType = google.maps.MapTypeId.TERRAIN; break;} case 'SATELLITE': { mapType = google.maps.MapTypeId.SATELLITE; break;} case 'ROADMAP': { mapType = google.maps.MapTypeId.ROADMAP; break;} + case 'OSM1': { mapType = "OSM1"; break;} + case 'OSM2': { mapType = "OSM2"; break;} + case 'OSM3': { mapType = "OSM3"; break;} default: { mapType = google.maps.MapTypeId.HYBRID; break;} } - - var mapOptions = { + + var map = new google.maps.Map(el_map, { mapTypeId: mapType, - scrollwheel: false - }; - var map = new google.maps.Map(el_map, mapOptions); + scrollwheel: false, + mapTypeControlOptions: { + style: google.maps.MapTypeControlStyle.DROPDOWN_MENU, + mapTypeIds: mapTypeIds + } + }); + + map.mapTypes.set("OSM1", new google.maps.ImageMapType({ + getTileUrl: function(coord, zoom) { + return "http://tile.openstreetmap.org/" + zoom + "/" + coord.x + "/" + coord.y + ".png"; + }, + tileSize: new google.maps.Size(256, 256), + name: "Open Street Map", + maxZoom: 18 + })); + + map.mapTypes.set("OSM2", new google.maps.ImageMapType({ + getTileUrl: function(coord, zoom) { + return "http://a.tile.opencyclemap.org/cycle/" + zoom + "/" + coord.x + "/" + coord.y + ".png"; + }, + tileSize: new google.maps.Size(256, 256), + name: "Open Cycle Map", + maxZoom: 18 + })); + + map.mapTypes.set("OSM3", new google.maps.ImageMapType({ + getTileUrl: function(coord, zoom) { + return "http://toolserver.org/tiles/hikebike/" + zoom + "/" + coord.x + "/" + coord.y + ".png"; + }, + tileSize: new google.maps.Size(256, 256), + name: "Hike & Bike", + maxZoom: 18 + })); + var bounds = new google.maps.LatLngBounds(); // Print WayPoints diff --git a/readme.txt b/readme.txt index 0a4ac08..33fad16 100644 --- a/readme.txt +++ b/readme.txt @@ -1,10 +1,10 @@ === 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, google chart, track, garmin, image, nextgen-gallery, nextgen, exif +Tags: maps, gpx, gps, graph, chart, google maps, google chart, track, garmin, image, nextgen-gallery, nextgen, exif, OpenStreetMap, OpenCycleMap, Hike&Bike. Requires at least: 2.0.0 Tested up to: 3.3 -Stable tag: 1.1.12 +Stable tag: 1.1.13 License: GPLv2 or later Draws a gpx track with altitude graph @@ -109,6 +109,9 @@ Yes! 2. Admin area - Settings == Changelog == += 1.1.13 = +* added new types of maps: Open Street Map, Open Cycle Map, Hike & Bike. +* fixed nextgen gallery caching problem = 1.1.12 = * nextgen gallery display bug fixes = 1.1.11 = @@ -173,6 +176,7 @@ Yes! * Initial release == Upgrade Notice == += 1.1.13 = = 1.1.12 = = 1.1.11 = = 1.1.10 = diff --git a/wp-gpx-maps.php b/wp-gpx-maps.php index 63e8b1a..9267330 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.12 +Version: 1.1.13 Author: Bastianon Massimo Author URI: http://www.pedemontanadelgrappa.it/ License: GPL @@ -46,7 +46,7 @@ function enqueue_WP_GPX_Maps_scripts() google.load('visualization', '1', {'packages':['corechart']}); google.load("maps", "3", {other_params: 'sensor=false'}); - + '.$data.''; - } - - } if ($points_maps == '' && $gpx != '') { @@ -226,13 +212,28 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='') } - @file_put_contents($gpxcache, - serialize(array( "points_maps" => $points_maps, - "points_graph" => $points_graph, - "waypoints" => $waypoints, - "ngimgs" => $ngimgs_data) - ), - LOCK_EX); + $ngimgs_data = ''; + if ( $ngGalleries != '' || $ngImages != '' ) + { + $ngimgs = getNGGalleryImages($ngGalleries,$ngImages); + + $ngimgs_data =''; + + foreach ($ngimgs as $img) { + $data = $img['data']; + $data = str_replace("\n","",$data); + $ngimgs_data .= ''.$data.''; + } + + } + + @file_put_contents($gpxcache, + serialize(array( "points_maps" => $points_maps, + "points_graph" => $points_graph, + "waypoints" => $waypoints) + ), + LOCK_EX); + @chmod($gpxcache,0755); $output = ' diff --git a/wp-gpx-maps_admin_settings.php b/wp-gpx-maps_admin_settings.php index 3d4446b..ab0eb94 100644 --- a/wp-gpx-maps_admin_settings.php +++ b/wp-gpx-maps_admin_settings.php @@ -79,6 +79,9 @@ > ROADMAP: normal street map.
> SATELLITE: satellite images.
> TERRAIN: maps with physical features such as terrain and vegetation.
+ > Open Street Map
+ > Open Cycle Map
+ > Hike & Bike