This commit is contained in:
bastianonm 2012-03-20 07:31:51 +00:00
parent 23ee7966ee
commit 014ff39ee4
4 changed files with 84 additions and 33 deletions

View File

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

View File

@ -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 =

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.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'});
</script>
<script type='text/javascript' src='<?php echo plugins_url('/WP-GPX-Maps.js', __FILE__) ?>?ver=1.1.12'></script>
<script type='text/javascript' src='<?php echo plugins_url('/WP-GPX-Maps.js', __FILE__) ?>?ver=1.1.13'></script>
<?php
}
@ -97,7 +97,9 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
$r = rand(1,5000000);
$cacheFileName = md5(serialize($attr));
$cacheFileName = "$gpx,$w,$mh,$mt,$gh,$showW,$donotreducegpx,$pointsoffset,$showSpeed,$uom";
$cacheFileName = md5($cacheFileName);
$gpxcache = gpxCacheFolderPath();
@ -117,28 +119,12 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
$points_maps = $cache_obj["points_maps"];
$points_graph = $cache_obj["points_graph"];
$waypoints = $cache_obj["waypoints"];
$ngimgs_data = $cache_obj["ngimgs"];
} catch (Exception $e) {
$points_maps= '';
$points_graph= '';
$waypoints= '';
$ngimgs_data='';
}
}
if ($ngimgs_data == '' && ( $ngGalleries != '' || $ngImages != '' ))
{
$ngimgs = getNGGalleryImages($ngGalleries,$ngImages);
$ngimgs_data ='';
foreach ($ngimgs as $img) {
$data = $img['data'];
$data = str_replace("\n","",$data);
$ngimgs_data .= '<span lat="'.$img['lat'].'" lon="'.$img['lon'].'">'.$data.'</span>';
}
}
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 .= '<span lat="'.$img['lat'].'" lon="'.$img['lon'].'">'.$data.'</span>';
}
}
@file_put_contents($gpxcache,
serialize(array( "points_maps" => $points_maps,
"points_graph" => $points_graph,
"waypoints" => $waypoints)
),
LOCK_EX);
@chmod($gpxcache,0755);
$output = '

View File

@ -79,6 +79,9 @@
<input type="radio" name="wpgpxmaps_map_type" value="ROADMAP" <?php if ($t == 'ROADMAP') echo 'checked'; ?>> ROADMAP: normal street map.<br />
<input type="radio" name="wpgpxmaps_map_type" value="SATELLITE" <?php if ($t == 'SATELLITE') echo 'checked'; ?>> SATELLITE: satellite images.<br />
<input type="radio" name="wpgpxmaps_map_type" value="TERRAIN" <?php if ($t == 'TERRAIN') echo 'checked'; ?>> TERRAIN: maps with physical features such as terrain and vegetation.<br />
<input type="radio" name="wpgpxmaps_map_type" value="OSM1" <?php if ($t == 'OSM1') echo 'checked'; ?>> Open Street Map<br />
<input type="radio" name="wpgpxmaps_map_type" value="OSM2" <?php if ($t == 'OSM2') echo 'checked'; ?>> Open Cycle Map<br />
<input type="radio" name="wpgpxmaps_map_type" value="OSM3" <?php if ($t == 'OSM3') echo 'checked'; ?>> Hike & Bike<br />
</td>
</tr>