* Add feet/Nautical Miles units (thanks to elperepat)
* Update OpenStreetMaps Credits (thanks to OpenStreetMaps) * WP Tabs fix (thanks to Douglas)
This commit is contained in:
parent
b5eeba4ee6
commit
533bbc41f1
|
@ -2,7 +2,7 @@
|
|||
Plugin Name: WP-GPX-Maps
|
||||
Plugin URI: http://www.devfarm.it/
|
||||
Description: Draws a gpx track with altitude graph
|
||||
Version: 1.3.0
|
||||
Version: 1.3.3
|
||||
Author: Bastianon Massimo
|
||||
Author URI: http://www.pedemontanadelgrappa.it/
|
||||
*/
|
||||
|
@ -11,6 +11,7 @@ Author URI: http://www.pedemontanadelgrappa.it/
|
|||
|
||||
var infowindow;
|
||||
var CustomMarker;
|
||||
var map;
|
||||
|
||||
CustomMarker = function( map, latlng, src, img_w, img_h) {
|
||||
this.latlng_ = latlng;
|
||||
|
@ -135,6 +136,7 @@ Author URI: http://www.pedemontanadelgrappa.it/
|
|||
var el_map = document.getElementById("map_" + targetId);
|
||||
var el_chart = document.getElementById("chart_" + targetId);
|
||||
var el_report = document.getElementById("report_" + targetId);
|
||||
var el_osm_credits = document.getElementById("wpgpxmaps_" + targetId + "_osm_footer");
|
||||
|
||||
var mapWidth = el_map.style.width;
|
||||
|
||||
|
@ -165,7 +167,15 @@ Author URI: http://www.pedemontanadelgrappa.it/
|
|||
default: { mapType = google.maps.MapTypeId.HYBRID; break;}
|
||||
}
|
||||
|
||||
var map = new google.maps.Map(el_map, {
|
||||
if ( mapType == "TERRAIN" || mapType == "SATELLITE" || mapType == "ROADMAP" )
|
||||
{
|
||||
// google maps
|
||||
} else {
|
||||
// Show OpenStreetMaps credits
|
||||
$(el_osm_credits).show();
|
||||
}
|
||||
|
||||
map = new google.maps.Map(el_map, {
|
||||
mapTypeId: mapType,
|
||||
scrollwheel: (zoomOnScrollWheel == 'true'),
|
||||
mapTypeControlOptions: {
|
||||
|
@ -224,7 +234,6 @@ Author URI: http://www.pedemontanadelgrappa.it/
|
|||
maxZoom: 18
|
||||
}));
|
||||
|
||||
|
||||
// FULL SCREEN BUTTON
|
||||
var controlDiv = document.createElement('div');
|
||||
controlDiv.style.padding = '5px';
|
||||
|
@ -239,7 +248,7 @@ Author URI: http://www.pedemontanadelgrappa.it/
|
|||
// Setup the click event listeners
|
||||
google.maps.event.addDomListener(controlUI, 'click', function(event) {
|
||||
var isFullScreen = (controlUI.isfullscreen == true);
|
||||
var mapDiv = map.getDiv();
|
||||
var mapDiv = [ map.getDiv(), map.getDiv().parentNode ];
|
||||
var center = map.getCenter();
|
||||
|
||||
if (isFullScreen)
|
||||
|
@ -630,6 +639,18 @@ Author URI: http://www.pedemontanadelgrappa.it/
|
|||
map.setCenter(bounds.getCenter());
|
||||
map.fitBounds(bounds);
|
||||
|
||||
// FIX post tabs
|
||||
var $_tab = $(el).closest(".wordpress-post-tabs").eq(0);
|
||||
if ($_tab)
|
||||
{
|
||||
$("div > ul > li > a", $_tab).click(function(e){
|
||||
setTimeout(function(e){
|
||||
map.fitBounds(bounds);
|
||||
google.maps.event.trigger(map, 'resize');
|
||||
},10);
|
||||
});
|
||||
}
|
||||
|
||||
var controlUIcenter = null;
|
||||
var idFirstCenterChanged = true;
|
||||
|
||||
|
@ -691,6 +712,11 @@ Author URI: http://www.pedemontanadelgrappa.it/
|
|||
l_x = { suf : "mi", dec : 1 };
|
||||
l_y = { suf : "m", dec : 0 };
|
||||
}
|
||||
else if (unit=="5")
|
||||
{
|
||||
l_x = { suf : "NM", dec : 1 };
|
||||
l_y = { suf : "ft", dec : 0 };
|
||||
}
|
||||
else
|
||||
{
|
||||
l_x = { suf : "m", dec : 0 };
|
||||
|
|
|
@ -5,7 +5,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|||
Tags: maps, gpx, gps, graph, chart, google maps, track, garmin, image, nextgen-gallery, nextgen, exif, OpenStreetMap, OpenCycleMap, Hike&Bike, heart rate, heartrate, cadence
|
||||
Requires at least: 2.0.0
|
||||
Tested up to: 3.9
|
||||
Stable tag: 1.3.2
|
||||
Stable tag: 1.3.3
|
||||
|
||||
Draws a gpx track with altitude graph. You can also display your nextgen gallery images in the map.
|
||||
|
||||
|
@ -102,7 +102,7 @@ The attributes are:
|
|||
|
||||
1. pointsoffset: skip points closer than XX meters(default is 10)
|
||||
|
||||
1. uom: distance/altitude possible unit of measure are: 0, 1, 2, 3, 4 (0 = meters, 1 = feet/miles, 2 = meters/kilometers, 3 = meters/nautical miles, 4 = meters/miles)
|
||||
1. uom: distance/altitude possible unit of measure are: 0, 1, 2, 3, 4, 5 (0 = meters, 1 = feet/miles, 2 = meters/kilometers, 3 = meters/nautical miles, 4 = meters/miles, 5 = feet/nautical miles)
|
||||
|
||||
1. mlinecolor: map line color (default is #3366cc)
|
||||
|
||||
|
@ -187,6 +187,10 @@ Yes!
|
|||
1. Altitude & Speed & Hearth rate
|
||||
|
||||
== Changelog ==
|
||||
= 1.3.3 =
|
||||
* Add feet/Nautical Miles units (thanks to elperepat)
|
||||
* Update OpenStreetMaps Credits
|
||||
* WP Tabs fix
|
||||
= 1.3.2 =
|
||||
* fix: left axis not visible (downgrade highcharts to v3.0.10)
|
||||
* fix: fullscreen map js error
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
Plugin Name: WP-GPX-Maps
|
||||
Plugin URI: http://www.devfarm.it/
|
||||
Description: Draws a GPX track with altitude chart
|
||||
Version: 1.3.2
|
||||
Version: 1.3.3
|
||||
Author: Bastianon Massimo
|
||||
Author URI: http://www.pedemontanadelgrappa.it/
|
||||
*/
|
||||
|
@ -18,7 +18,7 @@ add_shortcode('sgpxf','handle_WP_GPX_Maps_folder_Shortcodes');
|
|||
register_activation_hook(__FILE__,'WP_GPX_Maps_install');
|
||||
register_deactivation_hook( __FILE__, 'WP_GPX_Maps_remove');
|
||||
add_filter('plugin_action_links', 'WP_GPX_Maps_action_links', 10, 2);
|
||||
add_action( 'wp_print_scripts', 'print_WP_GPX_Maps_scripts' );
|
||||
add_action('wp_print_styles', 'print_WP_GPX_Maps_styles' );
|
||||
add_action('wp_enqueue_scripts', 'enqueue_WP_GPX_Maps_scripts');
|
||||
add_action('plugins_loaded' ,'WP_GPX_Maps_lang_init');
|
||||
|
||||
|
@ -51,10 +51,10 @@ function enqueue_WP_GPX_Maps_scripts()
|
|||
wp_enqueue_script( 'jquery' );
|
||||
wp_enqueue_script( 'googlemaps', '//maps.googleapis.com/maps/api/js?sensor=false', null, null);
|
||||
wp_enqueue_script( 'highcharts', "//code.highcharts.com/3.0.10/highcharts.js", array('jquery'), "3.0.10", true);
|
||||
wp_enqueue_script( 'WP-GPX-Maps', plugins_url('/WP-GPX-Maps.js', __FILE__), array('jquery','googlemaps','highcharts'), "1.3.2");
|
||||
wp_enqueue_script( 'WP-GPX-Maps', plugins_url('/WP-GPX-Maps.js', __FILE__), array('jquery','googlemaps','highcharts'), "1.3.3");
|
||||
}
|
||||
|
||||
function print_WP_GPX_Maps_scripts()
|
||||
function print_WP_GPX_Maps_styles()
|
||||
{
|
||||
?>
|
||||
<style type="text/css">
|
||||
|
@ -68,6 +68,19 @@ function print_WP_GPX_Maps_scripts()
|
|||
.wpgpxmaps_summary .summaryvalue { font-weight: bold; }
|
||||
.wpgpxmaps .report { line-height:120%; }
|
||||
.wpgpxmaps .gmnoprint div:first-child { height: 20px; }
|
||||
.wpgpxmaps .wpgpxmaps_osm_footer {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 25px;
|
||||
margin: 0;
|
||||
padding: 6px;
|
||||
z-index: 999;
|
||||
background: WHITE;
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
}
|
||||
|
@ -153,6 +166,11 @@ function handle_WP_GPX_Maps_folder_Shortcodes($attr, $content=''){
|
|||
{
|
||||
// meters / miles
|
||||
$_dist *= 0.000621371192;
|
||||
} else if ($uom == '5')
|
||||
{
|
||||
// meters / kilometers / nautical miles and feet
|
||||
$_dist = (float)($_dist / 1000 / 1.852);
|
||||
$_ele *= 3.2808399;
|
||||
}
|
||||
|
||||
$points_graph_dist .= number_format ( $_dist , 2 , '.' , '' ).',';
|
||||
|
@ -390,7 +408,12 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
{
|
||||
// meters / miles
|
||||
$_dist *= 0.000621371192;
|
||||
}
|
||||
} else if ($uom == '5')
|
||||
{
|
||||
// meters / kilometers / nautical miles and feet
|
||||
$_dist = (float)($_dist / 1000 / 1.852);
|
||||
$_ele *= 3.2808399;
|
||||
}
|
||||
|
||||
$points_graph_dist .= number_format ( $_dist , 2 , '.' , '' ).',';
|
||||
$points_graph_ele .= number_format ( $_ele , 2 , '.' , '' ).',';
|
||||
|
@ -453,6 +476,14 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
$total_ele_up = round($total_ele_up, 0) ." m";
|
||||
$total_ele_down = round($total_ele_down, 0) ." m";
|
||||
}
|
||||
else if ($uom == '5') {
|
||||
// meters / kilometers / nautical miles and feet
|
||||
$tot_len = round($tot_len / 1000/1.852, 2)." NM";
|
||||
$max_ele = round($max_ele * 3.2808399, 0)." ft";
|
||||
$min_ele = round($min_ele * 3.2808399, 0)." ft";
|
||||
$total_ele_up = round($total_ele_up * 3.2808399, 0)." ft";
|
||||
$total_ele_down = round($total_ele_down * 3.2808399, 0)." ft";
|
||||
}
|
||||
else {
|
||||
// meters / meters
|
||||
$tot_len = round($tot_len, 0) ." m";
|
||||
|
@ -562,8 +593,11 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
$r = $post->ID."_".rand(1,5000000);
|
||||
|
||||
$output = '
|
||||
<div id="" class="wpgpxmaps">
|
||||
<div id="map_'.$r.'" style="width:'.$w.'; height:'.$mh.'"></div>
|
||||
<div id="wpgpxmaps_'.$r.'" class="wpgpxmaps">
|
||||
<div id="map_'.$r.'_cont" style="width:'.$w.'; height:'.$mh.';position:relative" >
|
||||
<div id="map_'.$r.'" style="width:'.$w.'; height:'.$mh.'"></div>
|
||||
<div id="wpgpxmaps_'.$r.'_osm_footer" class="wpgpxmaps_osm_footer" style="display:none;">© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors</div>
|
||||
</div>
|
||||
<div id="hchart_'.$r.'" class="plot" style="width:'.$w.'; height:'.$gh.'"></div>
|
||||
<div id="ngimages_'.$r.'" class="ngimages" style="display:none">'.$ngimgs_data.'</div>
|
||||
<div id="report_'.$r.'" class="report"></div>
|
||||
|
|
|
@ -108,7 +108,7 @@ function WP_GPX_Maps_html_page() {
|
|||
<li><b>waypoints</b>: print the gpx waypoints inside the map (default is FALSE)</li>
|
||||
<li><b>donotreducegpx</b>: print all the point without reduce it (default is FALSE)</li>
|
||||
<li><b>pointsoffset</b>: skip points closer than XX meters(default is 10)</li>
|
||||
<li><b>uom</b>: distance/altitude possible unit of measure are: 0, 1, 2, 3, 4 (0 = meters, 1 = feet/miles, 2 = meters/kilometers, 3 = meters/nautical miles, 4 = meters/miles)</li>
|
||||
<li><b>uom</b>: distance/altitude possible unit of measure are: 0, 1, 2, 3, 4, 5 (0 = meters, 1 = feet/miles, 2 = meters/kilometers, 3 = meters/nautical miles, 4 = meters/miles, 5 = feet/nautical miles)</li>
|
||||
<li><b>mlinecolor</b>: map line color (default is #3366cc)</li>
|
||||
<li><b>glinecolor</b>: graph line color (default is #3366cc)</li>
|
||||
<li><b>glinecolorspeed</b>: speed line color (default is #ff0000)</li>
|
||||
|
|
|
@ -299,6 +299,7 @@
|
|||
<option value="2" <?php if ($uom == '2') echo 'selected'; ?>>meters/kilometers</option>
|
||||
<option value="3" <?php if ($uom == '3') echo 'selected'; ?>>meters/nautical miles</option>
|
||||
<option value="4" <?php if ($uom == '4') echo 'selected'; ?>>meters/miles</option>
|
||||
<option value="5" <?php if ($uom == '5') echo 'selected'; ?>>feet/nautical miles</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
Loading…
Reference in New Issue