This commit is contained in:
parent
9dce1e2583
commit
7bafbcb51f
104
WP-GPX-Maps.js
104
WP-GPX-Maps.js
|
@ -117,6 +117,16 @@ 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)
|
||||
{
|
||||
|
||||
|
@ -299,26 +309,19 @@ function _wpgpxmaps(params)
|
|||
|
||||
// Print Images
|
||||
|
||||
var divImages = document.getElementById("ngimages_"+targetId);
|
||||
jQuery("#ngimages_" + targetId).attr("style","display:block;position:absolute;left:-50000px");
|
||||
jQuery("#ngimages_" + targetId + " span").each(function(){
|
||||
|
||||
divImages.style.display='block';
|
||||
divImages.style.position='absolute';
|
||||
divImages.style.left='-50000px';
|
||||
var imageLat = jQuery(this).attr("lat");
|
||||
var imageLon = jQuery(this).attr("lon");
|
||||
|
||||
var img_spans = divImages.getElementsByTagName("span");
|
||||
jQuery("img",this).each(function() {
|
||||
|
||||
if (img_spans.length > 0)
|
||||
{
|
||||
var bb = new google.maps.LatLngBounds();
|
||||
for (var i = 0; i < img_spans.length; i++) {
|
||||
jQuery(this).load(function(){
|
||||
|
||||
var imageLat = img_spans[i].getAttribute("lat");
|
||||
var imageLon = img_spans[i].getAttribute("lon");
|
||||
var imageImg = img_spans[i].getElementsByTagName('img')[0];
|
||||
var imageUrl = imageImg.getAttribute("src");
|
||||
|
||||
var img_w = imageImg.clientWidth;
|
||||
var img_h = imageImg.clientHeight;
|
||||
var imageUrl = jQuery(this).attr("src");
|
||||
var img_w = jQuery(this).width();
|
||||
var img_h = jQuery(this).height();
|
||||
|
||||
var p = new google.maps.LatLng(imageLat, imageLon);
|
||||
bounds.extend(p);
|
||||
|
@ -335,21 +338,58 @@ function _wpgpxmaps(params)
|
|||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
if (jQuery(this).width() + jQuery(this).height() > 0)
|
||||
{
|
||||
jQuery(this).trigger("load");
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// Print Track
|
||||
if (mapData != '')
|
||||
{
|
||||
var points = [];
|
||||
var lastCut=0;
|
||||
var polylinenes = [];
|
||||
|
||||
for (i=0; i < mapData.length; i++)
|
||||
{
|
||||
if (mapData[i] == null)
|
||||
{
|
||||
var poly = new google.maps.Polyline({
|
||||
path: points.slice(lastCut,i),
|
||||
strokeColor: color1,
|
||||
strokeOpacity: .7,
|
||||
strokeWeight: 4,
|
||||
map: map
|
||||
});
|
||||
polylinenes.push(poly);
|
||||
lastCut=i;
|
||||
}
|
||||
else
|
||||
{
|
||||
var p = new google.maps.LatLng(mapData[i][0], mapData[i][1]);
|
||||
points.push(p);
|
||||
bounds.extend(p);
|
||||
}
|
||||
}
|
||||
|
||||
if (points.length != lastCut)
|
||||
{
|
||||
var poly = new google.maps.Polyline({
|
||||
path: points.slice(lastCut),
|
||||
strokeColor: color1,
|
||||
strokeOpacity: .7,
|
||||
strokeWeight: 4,
|
||||
map: map
|
||||
});
|
||||
polylinenes.push(poly);
|
||||
currentPoints = [];
|
||||
}
|
||||
|
||||
if (startIcon != '')
|
||||
{
|
||||
|
@ -362,6 +402,7 @@ function _wpgpxmaps(params)
|
|||
icon: startIconImage,
|
||||
zIndex: 10
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
if (endIcon != '')
|
||||
|
@ -378,14 +419,6 @@ function _wpgpxmaps(params)
|
|||
|
||||
}
|
||||
|
||||
var poly = new google.maps.Polyline({
|
||||
path: points,
|
||||
strokeColor: color1,
|
||||
strokeOpacity: .7,
|
||||
strokeWeight: 4
|
||||
});
|
||||
poly.setMap(map);
|
||||
|
||||
var first = getItemFromArray(mapData,0)
|
||||
|
||||
if (currentIcon == '')
|
||||
|
@ -407,7 +440,10 @@ function _wpgpxmaps(params)
|
|||
zIndex: 10
|
||||
});
|
||||
|
||||
google.maps.event.addListener(poly,'mouseover',function(event){
|
||||
for (i=0; i < polylinenes.length; i++)
|
||||
{
|
||||
|
||||
google.maps.event.addListener(polylinenes[i],'mouseover',function(event){
|
||||
if (marker)
|
||||
{
|
||||
marker.setPosition(event.latLng);
|
||||
|
@ -430,11 +466,14 @@ function _wpgpxmaps(params)
|
|||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
map.setCenter(bounds.getCenter());
|
||||
map.fitBounds(bounds);
|
||||
|
||||
if (graphDist != '' && (graphEle != '' || graphSpeed != '' || graphHr != '' || graphCad != ''))
|
||||
var graphh = jQuery('#hchart_' + params.targetId).css("height");
|
||||
|
||||
if (graphDist != '' && (graphEle != '' || graphSpeed != '' || graphHr != '' || graphCad != '') && graphh != "0px")
|
||||
{
|
||||
|
||||
var valLen = graphDist.length;
|
||||
|
@ -509,7 +548,10 @@ function _wpgpxmaps(params)
|
|||
if(item.x == this.x)
|
||||
{
|
||||
var point = getItemFromArray(mapData,i)
|
||||
if (point)
|
||||
{
|
||||
marker.setPosition(new google.maps.LatLng(point[0],point[1]));
|
||||
}
|
||||
marker.setTitle(lng.currentPosition);
|
||||
i+=10000000;
|
||||
}
|
||||
|
@ -560,6 +602,7 @@ function _wpgpxmaps(params)
|
|||
|
||||
for (i=0; i<valLen; i++)
|
||||
{
|
||||
if (graphDist[i] != null)
|
||||
eleData.push([graphDist[i],graphEle[i]]);
|
||||
}
|
||||
|
||||
|
@ -628,6 +671,7 @@ function _wpgpxmaps(params)
|
|||
|
||||
for (i=0; i<valLen; i++)
|
||||
{
|
||||
if (graphDist[i] != null)
|
||||
speedData.push([graphDist[i],graphSpeed[i]]);
|
||||
}
|
||||
|
||||
|
@ -675,12 +719,15 @@ function _wpgpxmaps(params)
|
|||
var hrData = [];
|
||||
|
||||
for (i=0; i<valLen; i++)
|
||||
{
|
||||
if (graphDist[i] != null)
|
||||
{
|
||||
var c = graphHr[i];
|
||||
if (c==0)
|
||||
c = null;
|
||||
hrData.push([graphDist[i],c]);
|
||||
}
|
||||
}
|
||||
|
||||
var yaxe = {
|
||||
title: { text: null },
|
||||
|
@ -714,12 +761,15 @@ function _wpgpxmaps(params)
|
|||
var cadData = [];
|
||||
|
||||
for (i=0; i<valLen; i++)
|
||||
{
|
||||
if (graphDist[i] != null)
|
||||
{
|
||||
var c = graphCad[i];
|
||||
if (c==0)
|
||||
c = null;
|
||||
cadData.push([graphDist[i],c]);
|
||||
}
|
||||
}
|
||||
|
||||
var yaxe = {
|
||||
title: { text: null },
|
||||
|
|
13
readme.txt
13
readme.txt
|
@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|||
Tags: maps, gpx, gps, graph, chart, google maps, highcharts, 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.4
|
||||
Stable tag: 1.1.29
|
||||
Stable tag: 1.1.30
|
||||
License: GPLv2 or later
|
||||
|
||||
Draws a gpx track with altitude graph. You can also display your nextgen gallery images in the map.
|
||||
|
@ -19,7 +19,10 @@ Fully configurable:
|
|||
- Custom icons
|
||||
- Multiple language support
|
||||
|
||||
Display your NextGen Gallery images inside the map! Check nextgen gallery EXIF support..
|
||||
NextGen Gallery Integration:
|
||||
|
||||
Display your NextGen Gallery images inside the map!
|
||||
Even if you don't have a gps camera, this plugin can retrive the image position starting from the image date and you gpx file.
|
||||
|
||||
- iphone/ipad/ipod Compatible
|
||||
|
||||
|
@ -117,6 +120,8 @@ The attributes are:
|
|||
|
||||
1. summary: Print symmary details of your GPX (default is FALSE)
|
||||
|
||||
1. dtoffset: the difference (in seconds) between your gpx tool date and your camera date
|
||||
|
||||
|
||||
= What happening if I've a very large gpx? =
|
||||
This plugin will print a small amout of points to speedup javascript and pageload.
|
||||
|
@ -133,6 +138,10 @@ Yes!
|
|||
1. Altitude & Speed & Hearth rate
|
||||
|
||||
== Changelog ==
|
||||
= 1.1.30 =
|
||||
* If you set Chart Height (shortcode gheight) = 0 means hide the graph
|
||||
* Fix: All images should work, independent from browser cache
|
||||
* Next Gen Gallery images positions derived from date. You can adjust the date with the shortcode attribute dtoffset
|
||||
= 1.1.29 =
|
||||
* Decimal separator is working with all the browsers
|
||||
* minutes per mile and minutes per kilometer was wrong
|
||||
|
|
|
@ -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.29
|
||||
Version: 1.1.30
|
||||
Author: Bastianon Massimo
|
||||
Author URI: http://www.pedemontanadelgrappa.it/
|
||||
License: GPL
|
||||
|
@ -51,7 +51,7 @@ function enqueue_WP_GPX_Maps_scripts()
|
|||
wp_enqueue_script( 'googleapis' );
|
||||
|
||||
wp_deregister_script( 'WP-GPX-Maps' );
|
||||
wp_register_script( 'WP-GPX-Maps', plugins_url('/WP-GPX-Maps.js', __FILE__), array('jquery'), "1.1.29");
|
||||
wp_register_script( 'WP-GPX-Maps', plugins_url('/WP-GPX-Maps.js', __FILE__), array('jquery'), "1.1.30");
|
||||
wp_enqueue_script( 'WP-GPX-Maps' );
|
||||
|
||||
wp_deregister_script( 'highcharts' );
|
||||
|
@ -134,12 +134,13 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
$ngImages = findValue($attr, "ngimages", "wpgpxmaps_map_ngImages", "");
|
||||
$download = findValue($attr, "download", "wpgpxmaps_download", "");
|
||||
$summary = findValue($attr, "summary", "wpgpxmaps_summary", "");
|
||||
$dtoffset = findValue($attr, "dtoffset", "wpgpxmaps_dtoffset", 0);
|
||||
|
||||
$r = rand(1,5000000);
|
||||
|
||||
$gpxurl = $gpx;
|
||||
|
||||
$cacheFileName = "$gpx,$w,$mh,$mt,$gh,$showW,$showHr,$showCad,$donotreducegpx,$pointsoffset,$showSpeed,$uomspeed,$uom,v1.1.29";
|
||||
$cacheFileName = "$gpx,$w,$mh,$mt,$gh,$showW,$showHr,$showCad,$donotreducegpx,$pointsoffset,$showSpeed,$uomspeed,$uom,v1.1.30";
|
||||
|
||||
$cacheFileName = md5($cacheFileName);
|
||||
|
||||
|
@ -158,6 +159,9 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
$cache_str = file_get_contents($gpxcache);
|
||||
$cache_obj = unserialize($cache_str);
|
||||
$points_maps = $cache_obj["points_maps"];
|
||||
$points_x_time = $cache_obj["points_x_time"];
|
||||
$points_x_lat = $cache_obj["points_x_lat"];
|
||||
$points_x_lon = $cache_obj["points_x_lon"];
|
||||
$points_graph_dist = $cache_obj["points_graph_dist"];
|
||||
$points_graph_ele = $cache_obj["points_graph_ele"];
|
||||
$points_graph_speed = $cache_obj["points_graph_speed"];
|
||||
|
@ -173,6 +177,9 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
|
||||
} catch (Exception $e) {
|
||||
$points_maps = '';
|
||||
$points_x_time = '';
|
||||
$points_x_lat = '';
|
||||
$points_x_lon = '';
|
||||
$points_graph_dist = '';
|
||||
$points_graph_ele = '';
|
||||
$points_graph_speed = '';
|
||||
|
@ -222,6 +229,10 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
$points_graph_cad = '';
|
||||
$waypoints = '';
|
||||
|
||||
$points_x_time = $points->dt;
|
||||
$points_x_lat = $points->lat;
|
||||
$points_x_lon = $points->lon;
|
||||
|
||||
$max_ele = $points->maxEle;
|
||||
$min_ele = $points->minEle;
|
||||
$total_ele_up = $points->totalEleUp;
|
||||
|
@ -232,6 +243,26 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
foreach(array_keys($points->lat) as $i)
|
||||
{
|
||||
|
||||
$_lat = (float)$points->lat[$i];
|
||||
$_lon = (float)$points->lon[$i];
|
||||
|
||||
if ( $_lat == 0 && $_lon == 0 )
|
||||
{
|
||||
$points_maps .= 'null,';
|
||||
$points_graph_dist .= 'null,';
|
||||
$points_graph_ele .= 'null,';
|
||||
|
||||
if ($showSpeed == true)
|
||||
$points_graph_speed .= 'null,';
|
||||
|
||||
if ($showHr == true)
|
||||
$points_graph_hr .= 'null,';
|
||||
|
||||
if ($showCad == true)
|
||||
$points_graph_cad .= 'null,';
|
||||
}
|
||||
else
|
||||
{
|
||||
$points_maps .= '['.(float)$points->lat[$i].','.(float)$points->lon[$i].'],';
|
||||
|
||||
$_ele = (float)$points->ele[$i];
|
||||
|
@ -267,6 +298,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
{
|
||||
$points_graph_cad .= $points->cad[$i].',';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -307,7 +339,8 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
}
|
||||
}
|
||||
|
||||
$p="/,$/";
|
||||
$p="/(,|,null,)$/";
|
||||
|
||||
$points_maps = preg_replace($p, "", $points_maps);
|
||||
|
||||
$points_graph_dist = preg_replace($p, "", $points_graph_dist);
|
||||
|
@ -338,7 +371,10 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
$ngimgs_data = '';
|
||||
if ( $ngGalleries != '' || $ngImages != '' )
|
||||
{
|
||||
$ngimgs = getNGGalleryImages($ngGalleries, $ngImages, $error);
|
||||
|
||||
//print_r($points);
|
||||
|
||||
$ngimgs = getNGGalleryImages($ngGalleries, $ngImages, $points_x_time, $points_x_lat, $points_x_lon, $dtoffset, $error);
|
||||
$ngimgs_data ='';
|
||||
foreach ($ngimgs as $img) {
|
||||
$data = $img['data'];
|
||||
|
@ -349,6 +385,9 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
|
||||
@file_put_contents($gpxcache,
|
||||
serialize(array( "points_maps" => $points_maps,
|
||||
"points_x_time" => $points_x_time,
|
||||
"points_x_lat" => $points_x_lat,
|
||||
"points_x_lon" => $points_x_lon,
|
||||
"points_graph_dist" => $points_graph_dist,
|
||||
"points_graph_ele" => $points_graph_ele,
|
||||
"points_graph_speed" => $points_graph_speed,
|
||||
|
@ -367,6 +406,15 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
|
||||
@chmod($gpxcache,0755);
|
||||
|
||||
if ($gh == "0" || $gh == "0px")
|
||||
{
|
||||
$points_graph_dist = '';
|
||||
$points_graph_ele = '';
|
||||
$points_graph_speed = '';
|
||||
$points_graph_hr = '';
|
||||
$points_graph_cad = '';
|
||||
}
|
||||
|
||||
$output = '
|
||||
<div id="wpgpxmaps_'.$r.'" class="wpgpxmaps">
|
||||
<div id="map_'.$r.'" style="width:'.$w.'; height:'.$mh.'"></div>
|
||||
|
|
|
@ -82,7 +82,7 @@
|
|||
|
||||
if (file_exists($gpxPath))
|
||||
{
|
||||
$points = parseXml($gpxPath, $gpxOffset);
|
||||
$points = @parseXml($gpxPath, $gpxOffset);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -98,8 +98,9 @@
|
|||
$f = round($count/200);
|
||||
if ($f>1)
|
||||
for($i=$count;$i>0;$i--)
|
||||
if ($i % $f != 0)
|
||||
if ($i % $f != 0 && $points->lat[$i] != null)
|
||||
{
|
||||
unset($points->dt[$i]);
|
||||
unset($points->lat[$i]);
|
||||
unset($points->lon[$i]);
|
||||
unset($points->ele[$i]);
|
||||
|
@ -118,6 +119,7 @@
|
|||
|
||||
$points = null;
|
||||
|
||||
$points->dt = array();
|
||||
$points->lat = array();
|
||||
$points->lon = array();
|
||||
$points->ele = array();
|
||||
|
@ -139,25 +141,37 @@
|
|||
|
||||
$gpx->registerXPathNamespace('10', 'http://www.topografix.com/GPX/1/0');
|
||||
$gpx->registerXPathNamespace('11', 'http://www.topografix.com/GPX/1/1');
|
||||
$gpx->registerXPathNamespace('gpxx', 'http://www.garmin.com/xmlschemas/GpxExtensions/v3');
|
||||
$gpx->registerXPathNamespace('gpxtpx', 'http://www.garmin.com/xmlschemas/TrackPointExtension/v1');
|
||||
|
||||
$nodes = $gpx->xpath('//trkpt | //10:trkpt | //11:trkpt | //11:rtept');
|
||||
$nodes = $gpx->xpath('//trk | //10:trk | //11:trk');
|
||||
|
||||
//normal gpx
|
||||
|
||||
if ( count($nodes) > 0 )
|
||||
{
|
||||
|
||||
foreach($nodes as $_trk)
|
||||
{
|
||||
|
||||
$trk = simplexml_load_string($_trk->asXML());
|
||||
|
||||
$trk->registerXPathNamespace('10', 'http://www.topografix.com/GPX/1/0');
|
||||
$trk->registerXPathNamespace('11', 'http://www.topografix.com/GPX/1/1');
|
||||
$trk->registerXPathNamespace('gpxtpx', 'http://www.garmin.com/xmlschemas/TrackPointExtension/v1');
|
||||
|
||||
$trkpts = $trk->xpath('//trkpt | //10:trkpt | //11:trkpt');
|
||||
|
||||
$lastLat = 0;
|
||||
$lastLon = 0;
|
||||
$lastEle = 0;
|
||||
$lastTime = 0;
|
||||
$dist = 0;
|
||||
//$dist = 0;
|
||||
$lastOffset = 0;
|
||||
$speedBuffer = array();
|
||||
|
||||
// normal case
|
||||
foreach($nodes as $trkpt)
|
||||
foreach($trkpts as $trkpt)
|
||||
{
|
||||
|
||||
$lat = $trkpt['lat'];
|
||||
$lon = $trkpt['lon'];
|
||||
$ele = $trkpt->ele;
|
||||
|
@ -189,6 +203,7 @@
|
|||
{
|
||||
//Base Case
|
||||
|
||||
array_push($points->dt, strtotime($time));
|
||||
array_push($points->lat, (float)$lat);
|
||||
array_push($points->lon, (float)$lon);
|
||||
array_push($points->ele, (float)round($ele,2));
|
||||
|
@ -248,6 +263,7 @@
|
|||
|
||||
$lastOffset=0;
|
||||
|
||||
array_push($points->dt, strtotime($time));
|
||||
array_push($points->lat, (float)$lat );
|
||||
array_push($points->lon, (float)$lon );
|
||||
array_push($points->ele, (float)round($ele, 2) );
|
||||
|
@ -267,7 +283,22 @@
|
|||
$lastLon=$lon;
|
||||
$lastEle=$ele;
|
||||
$lastTime=$time;
|
||||
|
||||
}
|
||||
|
||||
array_push($points->dt, null);
|
||||
array_push($points->lat, null);
|
||||
array_push($points->lon, null);
|
||||
array_push($points->ele, null);
|
||||
array_push($points->dist, null);
|
||||
array_push($points->speed, null);
|
||||
array_push($points->hr, null);
|
||||
array_push($points->cad, null);
|
||||
|
||||
unset($trkpts);
|
||||
|
||||
}
|
||||
|
||||
unset($nodes);
|
||||
|
||||
try {
|
||||
|
@ -281,6 +312,9 @@
|
|||
else
|
||||
{
|
||||
|
||||
// gpx garmin case
|
||||
$gpx->registerXPathNamespace('gpxx', 'http://www.garmin.com/xmlschemas/GpxExtensions/v3');
|
||||
|
||||
$nodes = $gpx->xpath('//gpxx:rpt');
|
||||
|
||||
if ( count($nodes) > 0 )
|
||||
|
@ -339,12 +373,79 @@
|
|||
}
|
||||
unset($nodes);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
//gpx strange case
|
||||
|
||||
$nodes = $gpx->xpath('//rtept | //10:rtept | //11:rtept');
|
||||
if ( count($nodes) > 0 )
|
||||
{
|
||||
|
||||
$lastLat = 0;
|
||||
$lastLon = 0;
|
||||
$lastEle = 0;
|
||||
$dist = 0;
|
||||
$lastOffset = 0;
|
||||
|
||||
// Garmin case
|
||||
foreach($nodes as $rtept)
|
||||
{
|
||||
|
||||
$lat = $rtept['lat'];
|
||||
$lon = $rtept['lon'];
|
||||
if ($lastLat == 0 && $lastLon == 0)
|
||||
{
|
||||
//Base Case
|
||||
array_push($points->lat, (float)$lat );
|
||||
array_push($points->lon, (float)$lon );
|
||||
array_push($points->ele, 0 );
|
||||
array_push($points->dist, 0 );
|
||||
array_push($points->speed, 0 );
|
||||
array_push($points->hr, 0 );
|
||||
array_push($points->cad, 0 );
|
||||
$lastLat=$lat;
|
||||
$lastLon=$lon;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Normal Case
|
||||
$offset = calculateDistance($lat, $lon, 0,$lastLat, $lastLon, 0);
|
||||
$dist = $dist + $offset;
|
||||
if (((float) $offset + (float) $lastOffset) > $gpxOffset)
|
||||
{
|
||||
//Bigger Offset -> write coordinate
|
||||
$lastOffset=0;
|
||||
array_push($points->lat, (float)$lat );
|
||||
array_push($points->lon, (float)$lon );
|
||||
array_push($points->ele, 0 );
|
||||
array_push($points->dist, 0 );
|
||||
array_push($points->speed, 0 );
|
||||
array_push($points->hr, 0 );
|
||||
array_push($points->cad, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
//Smoller Offset -> continue..
|
||||
$lastOffset= (float) $lastOffset + (float) $offset;
|
||||
}
|
||||
}
|
||||
$lastLat=$lat;
|
||||
$lastLon=$lon;
|
||||
}
|
||||
unset($nodes);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Empty Gpx or not supported File!";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
unset($gpx);
|
||||
return $points;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
return is_plugin_active("nextgen-gallery/nggallery.php");
|
||||
}
|
||||
|
||||
function getNGGalleryImages($ngGalleries, $ngImages, &$error)
|
||||
function getNGGalleryImages($ngGalleries, $ngImages, $dt, $lat, $lon, $dtoffset, &$error)
|
||||
{
|
||||
|
||||
$result = array();
|
||||
|
@ -16,7 +16,6 @@
|
|||
|
||||
if (!isNGGalleryActive())
|
||||
return '';
|
||||
|
||||
try {
|
||||
|
||||
$pictures = array();
|
||||
|
@ -26,6 +25,7 @@
|
|||
foreach ($imgids as $i) {
|
||||
array_push($pictures, nggdb::find_image($i));
|
||||
}
|
||||
|
||||
foreach ($pictures as $p) {
|
||||
$item = array();
|
||||
$item["data"] = $p->thumbHTML;
|
||||
|
@ -40,6 +40,17 @@
|
|||
{
|
||||
$result[] = $item;
|
||||
}
|
||||
else if (isset($p->imagedate))
|
||||
{
|
||||
$_dt = strtotime($p->imagedate) + $dtoffset;
|
||||
$_item = findItemCoordinate($_dt, $dt, $lat, $lon);
|
||||
if ($_item != null)
|
||||
{
|
||||
$item["lat"] = $_item["lat"];
|
||||
$item["lon"] = $_item["lon"];
|
||||
$result[] = $item;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -55,6 +66,19 @@
|
|||
return $result;
|
||||
}
|
||||
|
||||
function findItemCoordinate($imgdt, $dt, $lat, $lon)
|
||||
{
|
||||
foreach(array_keys($dt) as $i)
|
||||
{
|
||||
if ($i!=0 && $imgdt >= $dt[$i-1] && $imgdt <= $dt[$i])
|
||||
{
|
||||
if ($lat[$i] != 0 && $lon[$i] != 0)
|
||||
return array( "lat" => $lat[$i], "lon" => $lon[$i] );
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function getExifGps($exifCoord, $hemi)
|
||||
{
|
||||
$degrees = count($exifCoord) > 0 ? gps2Num($exifCoord[0]) : 0;
|
||||
|
|
Loading…
Reference in New Issue