* Speed improvement
* Rewritten js classes * Added Temperature chart * Added HTML5 Gps position (you can now follow the gpx with your mobile phone/tablet/pc)
This commit is contained in:
parent
c3d9848749
commit
410253dd4a
168
WP-GPX-Maps.js
168
WP-GPX-Maps.js
|
@ -1,45 +1,17 @@
|
|||
/*
|
||||
|
||||
WP-GPX-Maps
|
||||
|
||||
Plugin Name: WP-GPX-Maps
|
||||
Plugin URI: http://www.devfarm.it/
|
||||
Description: Draws a gpx track with altitude graph
|
||||
Version: 1.3.0
|
||||
Author: Bastianon Massimo
|
||||
Author URI: http://www.pedemontanadelgrappa.it/
|
||||
*/
|
||||
|
||||
var t;
|
||||
var funqueue = [];
|
||||
(function ( $ ) {
|
||||
|
||||
var infowindow;
|
||||
var mapLoading = false;
|
||||
var CustomMarker;
|
||||
|
||||
var wrapFunction = function(fn, context, params) {
|
||||
return function() {
|
||||
fn.apply(context, params);
|
||||
};
|
||||
}
|
||||
|
||||
function wpgpxmaps(params)
|
||||
{
|
||||
funqueue.push( wrapFunction(_wpgpxmaps, this, [params]));
|
||||
unqueue();
|
||||
}
|
||||
|
||||
function unqueue()
|
||||
{
|
||||
if (google == undefined || google.maps == undefined || Highcharts == undefined)
|
||||
{
|
||||
t = setTimeout("unqueue()",200);
|
||||
}
|
||||
else
|
||||
{
|
||||
setup();
|
||||
while (funqueue.length > 0) {
|
||||
(funqueue.shift())();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setup()
|
||||
{
|
||||
|
||||
CustomMarker = function( map, latlng, src, img_w, img_h) {
|
||||
this.latlng_ = latlng;
|
||||
this.setMap(map);
|
||||
|
@ -115,20 +87,7 @@ function setup()
|
|||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
function get_random_color() {
|
||||
var letters = '0123456789ABCDEF'.split('');
|
||||
var color = '#';
|
||||
for (var i = 0; i < 6; i++ ) {
|
||||
color += letters[Math.round(Math.random() * 15)];
|
||||
}
|
||||
return color;
|
||||
}
|
||||
|
||||
|
||||
function _wpgpxmaps(params)
|
||||
{
|
||||
$.fn.wpgpxmaps = function( params ) {
|
||||
|
||||
var targetId = params.targetId;
|
||||
var mapType = params.mapType;
|
||||
|
@ -137,6 +96,7 @@ function _wpgpxmaps(params)
|
|||
var graphEle = params.graphEle;
|
||||
var graphSpeed = params.graphSpeed;
|
||||
var graphHr = params.graphHr;
|
||||
var graphAtemp = params.graphAtemp;
|
||||
var graphCad = params.graphCad;
|
||||
var graphGrade = params.graphGrade;
|
||||
var waypoints = params.waypoints;
|
||||
|
@ -148,6 +108,7 @@ function _wpgpxmaps(params)
|
|||
var color4 = params.color4;
|
||||
var color5 = params.color5;
|
||||
var color6 = params.color6;
|
||||
var color7 = params.color7;
|
||||
var chartFrom1 = params.chartFrom1;
|
||||
var chartTo1 = params.chartTo1;
|
||||
var chartFrom2 = params.chartFrom2;
|
||||
|
@ -159,6 +120,8 @@ function _wpgpxmaps(params)
|
|||
var zoomOnScrollWheel = params.zoomOnScrollWheel;
|
||||
var lng = params.langs;
|
||||
var pluginUrl = params.pluginUrl;
|
||||
var usegpsposition = params.usegpsposition;
|
||||
var currentpositioncon= params.currentpositioncon;
|
||||
|
||||
// Unit of measure settings
|
||||
var l_s;
|
||||
|
@ -316,11 +279,66 @@ function _wpgpxmaps(params)
|
|||
return false;
|
||||
});
|
||||
|
||||
|
||||
controlDiv.index = 1;
|
||||
map.controls[google.maps.ControlPosition.TOP_RIGHT].push(controlDiv);
|
||||
|
||||
var bounds = new google.maps.LatLngBounds();
|
||||
|
||||
var markerCurrentPosition = null;
|
||||
|
||||
if ( usegpsposition == "true" )
|
||||
{
|
||||
|
||||
// Try HTML5 geolocation
|
||||
if(navigator.geolocation) {
|
||||
|
||||
navigator.geolocation.getCurrentPosition(function(position) {
|
||||
|
||||
// user position
|
||||
var pos = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
|
||||
|
||||
// draw current position marker
|
||||
markerCurrentPosition = new google.maps.Marker({
|
||||
position: pos,
|
||||
map: map,
|
||||
title: "you",
|
||||
animation: google.maps.Animation.DROP,
|
||||
zIndex: 10
|
||||
});
|
||||
|
||||
if (currentpositioncon)
|
||||
{
|
||||
markerCurrentPosition.setIcon(currentpositioncon);
|
||||
}
|
||||
bounds.extend(pos);
|
||||
|
||||
map.setCenter(bounds.getCenter());
|
||||
map.fitBounds(bounds);
|
||||
|
||||
|
||||
}, function() {});
|
||||
|
||||
navigator.geolocation.watchPosition(function(position){
|
||||
// move current position marker
|
||||
if (markerCurrentPosition != null)
|
||||
{
|
||||
markerCurrentPosition.setPosition(new google.maps.LatLng(position.coords.latitude, position.coords.longitude));
|
||||
}
|
||||
},
|
||||
function(e){
|
||||
// some errors
|
||||
},
|
||||
{
|
||||
enableHighAccuracy: false,
|
||||
timeout: 5000,
|
||||
maximumAge: 0
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Print WayPoints
|
||||
if (waypoints != '')
|
||||
{
|
||||
|
@ -648,7 +666,7 @@ function _wpgpxmaps(params)
|
|||
|
||||
var graphh = jQuery('#hchart_' + params.targetId).css("height");
|
||||
|
||||
if (graphDist != '' && (graphEle != '' || graphSpeed != '' || graphHr != '' || graphCad != '') && graphh != "0px")
|
||||
if (graphDist != '' && (graphEle != '' || graphSpeed != '' || graphHr != '' || graphAtemp != '' || graphCad != '') && graphh != "0px")
|
||||
{
|
||||
|
||||
var valLen = graphDist.length;
|
||||
|
@ -995,6 +1013,48 @@ function _wpgpxmaps(params)
|
|||
l_y_arr.push(l_hr);
|
||||
}
|
||||
|
||||
|
||||
if (graphAtemp != '')
|
||||
{
|
||||
|
||||
var atempData = [];
|
||||
|
||||
for (i=0; i<valLen; i++)
|
||||
{
|
||||
if (graphDist[i] != null)
|
||||
{
|
||||
var c = graphAtemp[i];
|
||||
if (c==0)
|
||||
c = null;
|
||||
atempData.push([graphDist[i],c]);
|
||||
}
|
||||
}
|
||||
|
||||
var yaxe = {
|
||||
title: { text: null },
|
||||
labels: {
|
||||
//align: 'right',
|
||||
formatter: function() {
|
||||
return Highcharts.numberFormat(this.value, 1, decPoint,thousandsSep) + " °C";
|
||||
}
|
||||
},
|
||||
opposite: true
|
||||
}
|
||||
|
||||
hoptions.yAxis.push(yaxe);
|
||||
hoptions.series.push({
|
||||
name: lng.atemp,
|
||||
lineWidth: 1,
|
||||
marker: { radius: 0 },
|
||||
data : atempData,
|
||||
color: color7,
|
||||
yAxis: hoptions.series.length
|
||||
});
|
||||
|
||||
l_y_arr.push({ suf : "°C", dec : 1 });
|
||||
}
|
||||
|
||||
|
||||
if (graphCad != '')
|
||||
{
|
||||
|
||||
|
@ -1082,7 +1142,8 @@ function _wpgpxmaps(params)
|
|||
jQuery("#hchart_" + params.targetId).css("display","none");
|
||||
}
|
||||
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
function addWayPoint(map, image, shadow, lat, lon, title, descr)
|
||||
{
|
||||
|
@ -1096,6 +1157,7 @@ function addWayPoint(map, image, shadow, lat, lon, title, descr)
|
|||
icon: image,
|
||||
zIndex: 5
|
||||
});
|
||||
|
||||
google.maps.event.addListener(m, 'mouseover', function() {
|
||||
if (infowindow)
|
||||
{
|
||||
|
@ -1182,3 +1244,5 @@ function dist(lat1,lon1,lat2,lon2)
|
|||
var dLon = (lon2-lon1);
|
||||
return Math.sqrt(dLat * dLat + dLon * dLon);
|
||||
}
|
||||
|
||||
}( jQuery ));
|
16
readme.txt
16
readme.txt
|
@ -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.8
|
||||
Stable tag: 1.2.6
|
||||
Stable tag: 1.3.0
|
||||
|
||||
Draws a gpx track with altitude graph. You can also display your nextgen gallery images in the map.
|
||||
|
||||
|
@ -14,11 +14,18 @@ Draws a gpx track with altitude graph. You can also display your nextgen gallery
|
|||
This plugin has, as input, the GPX file with the track you've made and as output it shows the map of the track and an interactive altitude graph (where available).
|
||||
|
||||
Fully configurable:
|
||||
|
||||
- Custom colors
|
||||
- Custom icons
|
||||
- Multiple language support
|
||||
|
||||
Supported charts:
|
||||
- Altitude
|
||||
- Speed
|
||||
- Heart Rate
|
||||
- Temperature
|
||||
- Cadence
|
||||
- Grade
|
||||
|
||||
NextGen Gallery Integration:
|
||||
|
||||
Display your NextGen Gallery images inside the map!
|
||||
|
@ -180,6 +187,11 @@ Yes!
|
|||
1. Altitude & Speed & Hearth rate
|
||||
|
||||
== Changelog ==
|
||||
= 1.3.0 =
|
||||
* Speed improvement
|
||||
* Rewritten js classes
|
||||
* Added Temperature chart
|
||||
* Added HTML5 Gps position (you can now follow the gpx with your mobile phone/tablet/pc)
|
||||
= 1.2.6 =
|
||||
* Speed improvement
|
||||
= 1.2.5 =
|
||||
|
|
124
wp-gpx-maps.php
124
wp-gpx-maps.php
|
@ -3,7 +3,7 @@
|
|||
Plugin Name: WP-GPX-Maps
|
||||
Plugin URI: http://www.devfarm.it/
|
||||
Description: Draws a gpx track with altitude graph
|
||||
Version: 1.2.6
|
||||
Version: 1.3.0
|
||||
Author: Bastianon Massimo
|
||||
Author URI: http://www.pedemontanadelgrappa.it/
|
||||
*/
|
||||
|
@ -14,6 +14,7 @@ include 'wp-gpx-maps_utils.php';
|
|||
include 'wp-gpx-maps_admin.php';
|
||||
|
||||
add_shortcode('sgpx','handle_WP_GPX_Maps_Shortcodes');
|
||||
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);
|
||||
|
@ -59,7 +60,7 @@ function enqueue_WP_GPX_Maps_scripts()
|
|||
wp_enqueue_script( 'highcharts' );
|
||||
|
||||
wp_deregister_script( 'WP-GPX-Maps' );
|
||||
wp_register_script( 'WP-GPX-Maps', plugins_url('/WP-GPX-Maps.js', __FILE__), array('jquery','googlemaps','highcharts'), "1.2.3");
|
||||
wp_register_script( 'WP-GPX-Maps', plugins_url('/WP-GPX-Maps.js', __FILE__), array('jquery','googlemaps','highcharts'), "1.3.0");
|
||||
wp_enqueue_script( 'WP-GPX-Maps' );
|
||||
|
||||
}
|
||||
|
@ -100,6 +101,84 @@ function findValue($attr, $attributeName, $optionName, $defaultValue)
|
|||
return $val;
|
||||
}
|
||||
|
||||
function handle_WP_GPX_Maps_folder_Shortcodes($attr, $content=''){
|
||||
|
||||
$folder = findValue($attr, "folder", "", "");
|
||||
$pointsoffset = findValue($attr, "pointsoffset", "wpgpxmaps_pointsoffset", 10);
|
||||
$distanceType = findValue($attr, "distanceType", "wpgpxmaps_distance_type", 0);
|
||||
$donotreducegpx = findValue($attr, "donotreducegpx", "wpgpxmaps_donotreducegpx", false);
|
||||
$uom = findValue($attr, "uom", "wpgpxmaps_unit_of_measure", "0");
|
||||
|
||||
// fix folder path
|
||||
$sitePath = sitePath();
|
||||
$folder = trim($folder);
|
||||
$folder = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $folder);
|
||||
$folder = $sitePath . $folder;
|
||||
|
||||
$files = scandir($folder);
|
||||
|
||||
foreach($files as $file) {
|
||||
|
||||
if (substr($file, - 4) == ".gpx" ) {
|
||||
|
||||
$gpx = $folder . DIRECTORY_SEPARATOR . $file;
|
||||
$points = getPoints($gpx, $pointsoffset, $donotreducegpx, $distanceType);
|
||||
|
||||
$points_maps = '';
|
||||
$points_graph_dist = '';
|
||||
$points_graph_ele = '';
|
||||
|
||||
if (is_array ($points_x_lat))
|
||||
foreach(array_keys($points_x_lat) as $i) {
|
||||
|
||||
$_lat = (float)$points_x_lat[$i];
|
||||
$_lon = (float)$points_x_lon[$i];
|
||||
|
||||
if ( $_lat == 0 && $_lon == 0 )
|
||||
{
|
||||
$points_maps .= 'null,';
|
||||
$points_graph_dist .= 'null,';
|
||||
$points_graph_ele .= 'null,';
|
||||
|
||||
}
|
||||
else {
|
||||
$points_maps .= '['.number_format((float)$points_x_lat[$i], 7 , '.' , '' ).','.number_format((float)$points_x_lon[$i], 7 , '.' , '' ).'],';
|
||||
|
||||
$_ele = (float)$points->ele[$i];
|
||||
$_dist = (float)$points->dist[$i];
|
||||
|
||||
if ($uom == '1')
|
||||
{
|
||||
// Miles and feet
|
||||
$_dist *= 0.000621371192;
|
||||
$_ele *= 3.2808399;
|
||||
} else if ($uom == '2')
|
||||
{
|
||||
// meters / kilometers
|
||||
$_dist = (float)($_dist / 1000);
|
||||
} else if ($uom == '3')
|
||||
{
|
||||
// meters / kilometers / nautical miles
|
||||
$_dist = (float)($_dist / 1000 / 1.852);
|
||||
} else if ($uom == '4')
|
||||
{
|
||||
// meters / miles
|
||||
$_dist *= 0.000621371192;
|
||||
}
|
||||
|
||||
$points_graph_dist .= number_format ( $_dist , 2 , '.' , '' ).',';
|
||||
$points_graph_ele .= number_format ( $_ele , 2 , '.' , '' ).',';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
print_r($points);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
||||
{
|
||||
|
||||
|
@ -112,6 +191,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
$gh = findValue($attr, "gheight", "wpgpxmaps_graph_height", "200px");
|
||||
$showCad = findValue($attr, "showcad", "wpgpxmaps_show_cadence", false);
|
||||
$showHr = findValue($attr, "showhr", "wpgpxmaps_show_hr", false);
|
||||
$showAtemp = findValue($attr, "showatemp", "wpgpxmaps_show_atemp", false);
|
||||
$showW = findValue($attr, "waypoints", "wpgpxmaps_show_waypoint", false);
|
||||
$showEle = findValue($attr, "showele", "wpgpxmaps_show_elevation", "true");
|
||||
$showSpeed = findValue($attr, "showspeed", "wpgpxmaps_show_speed", false);
|
||||
|
@ -125,6 +205,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
$color_graph = findValue($attr, "glinecolor", "wpgpxmaps_graph_line_color", "#3366cc");
|
||||
$color_graph_speed = findValue($attr, "glinecolorspeed", "wpgpxmaps_graph_line_color_speed", "#ff0000");
|
||||
$color_graph_hr = findValue($attr, "glinecolorhr", "wpgpxmaps_graph_line_color_hr", "#ff77bd");
|
||||
$color_graph_atemp = findValue($attr, "glinecoloratemp", "wpgpxmaps_graph_line_color_atemp", "#ff77bd");
|
||||
$color_graph_cad = findValue($attr, "glinecolorcad", "wpgpxmaps_graph_line_color_cad", "#beecff");
|
||||
$color_graph_grade = findValue($attr, "glinecolorgrade", "wpgpxmaps_graph_line_color_grade", "#beecff");
|
||||
|
||||
|
@ -153,12 +234,15 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
$p_avg_speed = findValue($attr, "summaryavgspeed", "wpgpxmaps_summary_avg_speed", false);
|
||||
$p_total_time = findValue($attr, "summarytotaltime", "wpgpxmaps_summary_total_time", false);
|
||||
|
||||
$usegpsposition = findValue($attr, "usegpsposition", "wpgpxmaps_usegpsposition", false);
|
||||
$currentpositioncon = findValue($attr, "currentpositioncon", "wpgpxmaps_currentpositioncon", "");
|
||||
|
||||
|
||||
$colors_map = "\"".implode("\",\"",(explode(" ",$color_map)))."\"";
|
||||
|
||||
$gpxurl = $gpx;
|
||||
|
||||
$cacheFileName = "$gpx,$w,$mh,$mt,$gh,$showEle,$showW,$showHr,$showCad,$donotreducegpx,$pointsoffset,$showSpeed,$showGrade,$uomspeed,$uom,$distanceType,v1.1.38";
|
||||
$cacheFileName = "$gpx,$w,$mh,$mt,$gh,$showEle,$showW,$showHr,$showAtemp,$showCad,$donotreducegpx,$pointsoffset,$showSpeed,$showGrade,$uomspeed,$uom,$distanceType,v1.2.7";
|
||||
|
||||
$cacheFileName = md5($cacheFileName);
|
||||
|
||||
|
@ -183,6 +267,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
$points_graph_ele = $cache_obj["points_graph_ele"];
|
||||
$points_graph_speed = $cache_obj["points_graph_speed"];
|
||||
$points_graph_hr = $cache_obj["points_graph_hr"];
|
||||
$points_graph_atemp = $cache_obj["points_graph_atemp"];
|
||||
$points_graph_cad = $cache_obj["points_graph_cad"];
|
||||
$points_graph_grade = $cache_obj["points_graph_grade"];
|
||||
$waypoints = $cache_obj["waypoints"];
|
||||
|
@ -204,6 +289,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
$points_graph_ele = '';
|
||||
$points_graph_speed = '';
|
||||
$points_graph_hr = '';
|
||||
$points_graph_atemp = '';
|
||||
$points_graph_cad = '';
|
||||
$points_graph_grade = '';
|
||||
$waypoints= '';
|
||||
|
@ -246,6 +332,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
$points_graph_ele = '';
|
||||
$points_graph_speed = '';
|
||||
$points_graph_hr = '';
|
||||
$points_graph_atemp = '';
|
||||
$points_graph_cad = '';
|
||||
$points_graph_grade = '';
|
||||
$waypoints = '';
|
||||
|
@ -281,6 +368,9 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
if ($showHr == true)
|
||||
$points_graph_hr .= 'null,';
|
||||
|
||||
if ($showAtemp == true)
|
||||
$points_graph_atemp .= 'null,';
|
||||
|
||||
if ($showCad == true)
|
||||
$points_graph_cad .= 'null,';
|
||||
|
||||
|
@ -327,6 +417,10 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
$points_graph_hr .= number_format ( $points->hr[$i] , 2 , '.' , '' ).',';
|
||||
}
|
||||
|
||||
if ($showAtemp == true) {
|
||||
$points_graph_atemp .= number_format ( $points->atemp[$i] , 1 , '.' , '' ).',';
|
||||
}
|
||||
|
||||
if ($showCad == true) {
|
||||
$points_graph_cad .= number_format ( $points->cad[$i] , 2 , '.' , '' ).',';
|
||||
}
|
||||
|
@ -401,6 +495,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
$points_graph_ele = preg_replace($p, "", $points_graph_ele);
|
||||
$points_graph_speed = preg_replace($p, "", $points_graph_speed);
|
||||
$points_graph_hr = preg_replace($p, "", $points_graph_hr);
|
||||
$points_graph_atemp = preg_replace($p, "", $points_graph_atemp);
|
||||
$points_graph_cad = preg_replace($p, "", $points_graph_cad);
|
||||
$points_graph_grade = preg_replace($p, "", $points_graph_grade);
|
||||
|
||||
|
@ -418,8 +513,11 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
if (preg_match("/^(0,?)+$/", $points_graph_hr))
|
||||
$points_graph_hr = "";
|
||||
|
||||
if (preg_match("/^(0,?)+$/", $points_graph_cad))
|
||||
$points_graph_cad = "";
|
||||
if (preg_match("/^(0,?)+$/", $points_graph_hr))
|
||||
$points_graph_hr = "";
|
||||
|
||||
if (preg_match("/^(0,?)+$/", $points_graph_atemp))
|
||||
$points_graph_atemp = "";
|
||||
|
||||
if (preg_match("/^(0,?)+$/", $points_graph_grade))
|
||||
$points_graph_grade = "";
|
||||
|
@ -451,6 +549,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
"points_graph_ele" => $points_graph_ele,
|
||||
"points_graph_speed" => $points_graph_speed,
|
||||
"points_graph_hr" => $points_graph_hr,
|
||||
"points_graph_atemp" => $points_graph_atemp,
|
||||
"points_graph_cad" => $points_graph_cad,
|
||||
"points_graph_grade" => $points_graph_grade,
|
||||
"waypoints" => $waypoints,
|
||||
|
@ -474,7 +573,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
$r = $post->ID."_".rand(1,5000000);
|
||||
|
||||
$output = '
|
||||
<div id="wpgpxmaps_'.$r.'" class="wpgpxmaps">
|
||||
<div id="" class="wpgpxmaps">
|
||||
<div id="map_'.$r.'" style="width:'.$w.'; height:'.$mh.'"></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>
|
||||
|
@ -482,14 +581,14 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
</div>
|
||||
'. $error .'
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
wpgpxmaps({ targetId : "'.$r.'",
|
||||
jQuery("#wpgpxmaps_'.$r.'").wpgpxmaps({ targetId : "'.$r.'",
|
||||
mapType : "'.$mt.'",
|
||||
mapData : ['.$points_maps.'],
|
||||
graphDist : ['.($hideGraph ? '' : $points_graph_dist).'],
|
||||
graphEle : ['.($hideGraph ? '' : $points_graph_ele).'],
|
||||
graphSpeed : ['.($hideGraph ? '' : $points_graph_speed).'],
|
||||
graphHr : ['.($hideGraph ? '' : $points_graph_hr).'],
|
||||
graphAtemp : ['.($hideGraph ? '' : $points_graph_atemp).'],
|
||||
graphCad : ['.($hideGraph ? '' : $points_graph_cad).'],
|
||||
graphGrade : ['.($hideGraph ? '' : $points_graph_grade).'],
|
||||
waypoints : ['.$waypoints.'],
|
||||
|
@ -501,6 +600,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
color4 : "'.$color_graph_hr.'",
|
||||
color5 : "'.$color_graph_cad.'",
|
||||
color6 : "'.$color_graph_grade.'",
|
||||
color7 : "'.$color_graph_atemp.'",
|
||||
chartFrom1 : "'.$chartFrom1.'",
|
||||
chartTo1 : "'.$chartTo1.'",
|
||||
chartFrom2 : "'.$chartFrom2.'",
|
||||
|
@ -509,6 +609,8 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
endIcon : "'.$endIcon.'",
|
||||
currentIcon : "'.$currentIcon.'",
|
||||
waypointIcon : "'.$waypointIcon.'",
|
||||
currentpositioncon : "'.$currentpositioncon.'",
|
||||
usegpsposition : "'.$usegpsposition.'",
|
||||
zoomOnScrollWheel : "'.$zoomOnScrollWheel.'",
|
||||
ngGalleries : ['.$ngGalleries.'],
|
||||
ngImages : ['.$ngImages.'],
|
||||
|
@ -518,6 +620,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
speed : "'.__("Speed", "wp-gpx-maps").'",
|
||||
grade : "'.__("Grade", "wp-gpx-maps").'",
|
||||
heartRate : "'.__("Heart rate", "wp-gpx-maps").'",
|
||||
atemp : "'.__("Temperature", "wp-gpx-maps").'",
|
||||
cadence : "'.__("Cadence", "wp-gpx-maps").'",
|
||||
goFullScreen : "'.__("Go Full Screen", "wp-gpx-maps").'",
|
||||
exitFullFcreen : "'.__("Exit Full Screen", "wp-gpx-maps").'",
|
||||
|
@ -526,7 +629,6 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
backToCenter : "'.__("Back to center", "wp-gpx-maps").'"
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
// print summary
|
||||
|
@ -686,7 +788,9 @@ function WP_GPX_Maps_install() {
|
|||
add_option("wpgpxmaps_map_waypoint_icon", '', '', 'yes');
|
||||
add_option("wpgpxmaps_map_nggallery", '', '', 'yes');
|
||||
add_option("wpgpxmaps_show_hr", '', '', 'yes');
|
||||
add_option("wpgpxmaps_show_atemp", '', '', 'yes');
|
||||
add_option("wpgpxmaps_graph_line_color_hr", '#ff77bd', '', 'yes');
|
||||
add_option("wpgpxmaps_graph_line_color_atemp", '#ff77bd', '', 'yes');
|
||||
add_option('wpgpxmaps_show_cadence','','','yes');
|
||||
add_option('wpgpxmaps_zoomonscrollwheel','','','yes');
|
||||
add_option('wpgpxmaps_download','','','yes');
|
||||
|
@ -718,7 +822,9 @@ function WP_GPX_Maps_remove() {
|
|||
delete_option('wpgpxmaps_map_waypoint_icon');
|
||||
delete_option('wpgpxmaps_map_nggallery');
|
||||
delete_option('wpgpxmaps_show_hr');
|
||||
delete_option('wpgpxmaps_show_atemp');
|
||||
delete_option('wpgpxmaps_graph_line_color_hr');
|
||||
delete_option('wpgpxmaps_graph_line_color_atemp');
|
||||
delete_option('wpgpxmaps_show_cadence');
|
||||
delete_option('wpgpxmaps_graph_line_color_cad');
|
||||
delete_option('wpgpxmaps_zoomonscrollwheel');
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
$showEle = get_option("wpgpxmaps_show_elevation");
|
||||
$showSpeed = get_option('wpgpxmaps_show_speed');
|
||||
$showHr = get_option('wpgpxmaps_show_hr');
|
||||
$showAtemp = get_option('wpgpxmaps_show_atemp');
|
||||
|
||||
$showCad = get_option('wpgpxmaps_show_cadence');
|
||||
$showGrade = get_option('wpgpxmaps_show_grade');
|
||||
$zoomonscrollwheel = get_option("wpgpxmaps_zoomonscrollwheel");
|
||||
|
@ -33,6 +35,8 @@
|
|||
$avg_speed = get_option("wpgpxmaps_summary_avg_speed");
|
||||
$total_time = get_option("wpgpxmaps_summary_total_time");
|
||||
|
||||
$usegpsposition = get_option("wpgpxmaps_usegpsposition");
|
||||
|
||||
$distanceType = get_option("wpgpxmaps_distance_type");
|
||||
|
||||
if (empty($showEle))
|
||||
|
@ -93,11 +97,18 @@
|
|||
<input name="wpgpxmaps_download" type="checkbox" value="true" <?php if($download == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Allow users to download your GPX file</i>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Use browser GPS position:</th>
|
||||
<td>
|
||||
<input name="wpgpxmaps_usegpsposition" type="checkbox" value="true" <?php if($usegpsposition == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Allow users to use browser GPS in order to display their current position on map</i>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<p class="submit">
|
||||
<input type="hidden" name="action" value="update" />
|
||||
<input name="page_options" type="hidden" value="wpgpxmaps_height,wpgpxmaps_graph_height,wpgpxmaps_width,wpgpxmaps_download,wpgpxmaps_skipcache,wpgpxmaps_distance_type" />
|
||||
<input name="page_options" type="hidden" value="wpgpxmaps_height,wpgpxmaps_graph_height,wpgpxmaps_width,wpgpxmaps_download,wpgpxmaps_skipcache,wpgpxmaps_distance_type,wpgpxmaps_usegpsposition" />
|
||||
<input type="submit" class="button-primary" value="<?php _e('Save Changes', "wp_gpx_maps") ?>" />
|
||||
</p>
|
||||
|
||||
|
@ -235,6 +246,13 @@
|
|||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row">Current GPS Position Icon:</th>
|
||||
<td>
|
||||
<input name="wpgpxmaps_currentpositioncon" value="<?php echo get_option('wpgpxmaps_currentpositioncon'); ?>" style="width:400px" /> <em>(Url to image) Leave empty for default</em>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row">Custom Waypoint Icon:</th>
|
||||
<td>
|
||||
|
@ -246,7 +264,7 @@
|
|||
|
||||
<p class="submit">
|
||||
<input type="hidden" name="action" value="update" />
|
||||
<input name="page_options" type="hidden" value="wpgpxmaps_show_waypoint,wpgpxmaps_map_line_color,wpgpxmaps_map_type,wpgpxmaps_map_start_icon,wpgpxmaps_map_end_icon,wpgpxmaps_map_current_icon,wpgpxmaps_zoomonscrollwheel,wpgpxmaps_map_waypoint_icon" />
|
||||
<input name="page_options" type="hidden" value="wpgpxmaps_show_waypoint,wpgpxmaps_map_line_color,wpgpxmaps_map_type,wpgpxmaps_map_start_icon,wpgpxmaps_map_end_icon,wpgpxmaps_map_current_icon,wpgpxmaps_zoomonscrollwheel,wpgpxmaps_map_waypoint_icon,wpgpxmaps_currentpositioncon" />
|
||||
<input type="submit" class="button-primary" value="<?php _e('Save Changes', "wp_gpx_maps") ?>" />
|
||||
</p>
|
||||
|
||||
|
@ -259,6 +277,13 @@
|
|||
<h3 class="title">Chart</h3>
|
||||
|
||||
<table class="form-table">
|
||||
<tr>
|
||||
<th scope="row">Show altitude:</th>
|
||||
<td>
|
||||
<input type="checkbox" <?php if($showEle == "true"){echo('checked');} ?> onchange="wpgpxmaps_show_elevation.value = this.checked" onload="wpgpxmaps_show_elevation.value = this.checked" /> <i>Show Altitude</i>
|
||||
<input name="wpgpxmaps_show_elevation" type="hidden" value="<?php echo $showEle; ?>">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr>
|
||||
<th scope="row">Altitude line color:</th>
|
||||
|
@ -287,14 +312,6 @@
|
|||
<em>(leave empty for auto scale)</em>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row">Show elevation:</th>
|
||||
<td>
|
||||
<input type="checkbox" <?php if($showEle == "true"){echo('checked');} ?> onchange="wpgpxmaps_show_elevation.value = this.checked" onload="wpgpxmaps_show_elevation.value = this.checked" /> <i>Show elevation</i>
|
||||
<input name="wpgpxmaps_show_elevation" type="hidden" value="<?php echo $showEle; ?>">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Show speed:</th>
|
||||
<td>
|
||||
|
@ -342,6 +359,21 @@
|
|||
<input name="wpgpxmaps_graph_line_color_hr" type="color" data-hex="true" value="<?php echo get_option('wpgpxmaps_graph_line_color_hr'); ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row">Show Temperature (where aviable):</th>
|
||||
<td>
|
||||
<input name="wpgpxmaps_show_atemp" type="checkbox" value="true" <?php if($showAtemp == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Show Temperature</i>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Temperature line color:</th>
|
||||
<td>
|
||||
<input name="wpgpxmaps_graph_line_color_atemp" type="color" data-hex="true" value="<?php echo get_option('wpgpxmaps_graph_line_color_atemp'); ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<th scope="row">Show Cadence (where aviable):</th>
|
||||
<td>
|
||||
|
@ -375,7 +407,7 @@
|
|||
|
||||
<p class="submit">
|
||||
<input type="hidden" name="action" value="update" />
|
||||
<input name="page_options" type="hidden" value="wpgpxmaps_unit_of_measure,wpgpxmaps_graph_line_color,wpgpxmaps_show_elevation,wpgpxmaps_show_speed,wpgpxmaps_graph_line_color_speed,wpgpxmaps_show_hr,wpgpxmaps_graph_line_color_hr,wpgpxmaps_unit_of_measure_speed,wpgpxmaps_graph_offset_from1,wpgpxmaps_graph_offset_to1,wpgpxmaps_graph_offset_from2,wpgpxmaps_graph_offset_to2,wpgpxmaps_graph_line_color_cad,wpgpxmaps_show_cadence,wpgpxmaps_show_grade,wpgpxmaps_graph_line_color_grade" />
|
||||
<input name="page_options" type="hidden" value="wpgpxmaps_unit_of_measure,wpgpxmaps_graph_line_color,wpgpxmaps_show_elevation,wpgpxmaps_show_speed,wpgpxmaps_graph_line_color_speed,wpgpxmaps_show_hr,wpgpxmaps_graph_line_color_hr,wpgpxmaps_unit_of_measure_speed,wpgpxmaps_graph_offset_from1,wpgpxmaps_graph_offset_to1,wpgpxmaps_graph_offset_from2,wpgpxmaps_graph_offset_to2,wpgpxmaps_graph_line_color_cad,wpgpxmaps_show_cadence,wpgpxmaps_show_grade,wpgpxmaps_graph_line_color_grade,wpgpxmaps_show_atemp,wpgpxmaps_graph_line_color_atemp" />
|
||||
<input type="submit" class="button-primary" value="<?php _e('Save Changes', "wp_gpx_maps") ?>" />
|
||||
</p>
|
||||
|
||||
|
|
|
@ -117,6 +117,7 @@
|
|||
unset($points->dist[$i]);
|
||||
unset($points->speed[$i]);
|
||||
unset($points->hr[$i]);
|
||||
unset($points->atemp[$i]);
|
||||
unset($points->cad[$i]);
|
||||
unset($points->grade[$i]);
|
||||
}
|
||||
|
@ -137,6 +138,7 @@
|
|||
$points->dist = array();
|
||||
$points->speed = array();
|
||||
$points->hr = array();
|
||||
$points->atemp = array();
|
||||
$points->cad = array();
|
||||
$points->grade = array();
|
||||
|
||||
|
@ -195,6 +197,7 @@
|
|||
$time = $trkpt->time;
|
||||
$speed = (float)$trkpt->speed;
|
||||
$hr = 0;
|
||||
$atemp = 0;
|
||||
$cad = 0;
|
||||
$grade = 0;
|
||||
|
||||
|
@ -211,6 +214,14 @@
|
|||
}
|
||||
}
|
||||
|
||||
$_atemp = @$trkpt->xpath('extensions/gpxtpx:TrackPointExtension/gpxtpx:atemp/text() | extensions/TrackPointExtension/atemp/text()');
|
||||
if ($_atemp)
|
||||
{
|
||||
foreach ($_atemp as $node) {
|
||||
$atemp = (float)$node;
|
||||
}
|
||||
}
|
||||
|
||||
$_cad = @$trkpt->xpath('extensions/gpxtpx:TrackPointExtension/gpxtpx:cad/text() | extensions/TrackPointExtension/cad/text()');
|
||||
if ($_cad)
|
||||
{
|
||||
|
@ -231,6 +242,7 @@
|
|||
array_push($points->dist, (float)round($dist,2));
|
||||
array_push($points->speed, 0);
|
||||
array_push($points->hr, $hr);
|
||||
array_push($points->atemp, $atemp);
|
||||
array_push($points->cad, $cad);
|
||||
array_push($points->grade, $grade);
|
||||
|
||||
|
@ -298,6 +310,9 @@
|
|||
array_push($points->dist, (float)round($dist, 2) );
|
||||
array_push($points->speed, (float)round($avgSpeed, 1) );
|
||||
array_push($points->hr, $hr);
|
||||
array_push($points->atemp, $atemp);
|
||||
|
||||
|
||||
array_push($points->cad, $cad);
|
||||
array_push($points->grade, (float)round($grade, 2) );
|
||||
|
||||
|
@ -322,6 +337,7 @@
|
|||
array_push($points->dist, null);
|
||||
array_push($points->speed, null);
|
||||
array_push($points->hr, null);
|
||||
array_push($points->atemp, null);
|
||||
array_push($points->cad, null);
|
||||
array_push($points->grade, null);
|
||||
|
||||
|
@ -340,6 +356,7 @@
|
|||
array_pop($points->dist, null);
|
||||
array_pop($points->speed, null);
|
||||
array_pop($points->hr, null);
|
||||
array_pop($points->atemp, null);
|
||||
array_pop($points->cad, null);
|
||||
array_pop($points->grade, null);
|
||||
|
||||
|
@ -389,6 +406,7 @@
|
|||
array_push($points->dist, 0 );
|
||||
array_push($points->speed, 0 );
|
||||
array_push($points->hr, 0 );
|
||||
array_push($points->atemp, 0 );
|
||||
array_push($points->cad, 0 );
|
||||
array_push($points->grade, 0 );
|
||||
$lastLat=$lat;
|
||||
|
@ -409,6 +427,7 @@
|
|||
array_push($points->dist, 0 );
|
||||
array_push($points->speed, 0 );
|
||||
array_push($points->hr, 0 );
|
||||
array_push($points->atemp, 0 );
|
||||
array_push($points->cad, 0 );
|
||||
array_push($points->grade, 0 );
|
||||
}
|
||||
|
@ -454,6 +473,7 @@
|
|||
array_push($points->dist, 0 );
|
||||
array_push($points->speed, 0 );
|
||||
array_push($points->hr, 0 );
|
||||
array_push($points->atemp, 0 );
|
||||
array_push($points->cad, 0 );
|
||||
array_push($points->grade, 0 );
|
||||
$lastLat=$lat;
|
||||
|
@ -474,6 +494,7 @@
|
|||
array_push($points->dist, 0 );
|
||||
array_push($points->speed, 0 );
|
||||
array_push($points->hr, 0 );
|
||||
array_push($points->atemp, 0 );
|
||||
array_push($points->cad, 0 );
|
||||
array_push($points->grade, 0 );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue