BIG CHANGE - Removed Gogole maps. Leafletjs instead.

-- NextGen Gallery is not working, due next gen image format changed -- I'll fix soon
This commit is contained in:
bastianonm 2018-08-01 12:18:31 +00:00
parent 277560810a
commit 5151dbf37c
4 changed files with 51 additions and 81 deletions

View File

@ -332,6 +332,7 @@ var WPGPXMAPS = {
this.EventSelectChart = null,
this.Polylines = [],
this.CurrentPositionMarker = null,
this.CurrentGPSPositionMarker = null,
this.init = function(targetElement, mapType, scrollWheelZoom, ThunderforestApiKey){
this.map = L.map(targetElement,
@ -822,56 +823,50 @@ var WPGPXMAPS = {
}
}
var bounds = new google.maps.LatLngBounds();
//var bounds = new google.maps.LatLngBounds();
var markerCurrentPosition = null;
if ( usegpsposition == "true" )
if ( usegpsposition == "true" )
{
// Try HTML5 geolocation
if(navigator.geolocation) {
var context = map;
navigator.geolocation.watchPosition(function(position)
{
var radius = position.coords.accuracy / 2;
navigator.geolocation.getCurrentPosition(function(position) {
// user position
var pos = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
var pos = [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)
if (context.CurrentGPSPositionMarker == null)
{
markerCurrentPosition.setIcon(currentpositioncon);
context.CurrentGPSPositionMarker = L.marker(pos)
.addTo(context.map)
.bindPopup("You are within " + radius + " meters from this point")
.openPopup();
}
else
{
context.CurrentGPSPositionMarker.setLatLng(pos);
}
this.map.Bounds.push([position.coords.latitude, position.coords.longitude]);
this.map.CenterMap();
}, 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
});
context.Bounds.push(pos);
context.CenterMap();
},
function(e){
// some errors
},
{
enableHighAccuracy: false,
timeout: 5000,
maximumAge: 0
});
}
}
@ -902,8 +897,8 @@ var WPGPXMAPS = {
imageLat = imageLat.replace(",", ".");
imageLon = imageLon.replace(",", ".");
var p = new google.maps.LatLng(imageLat, imageLon);
bounds.extend(p);
//var p = new google.maps.LatLng(imageLat, imageLon);
//bounds.extend(p);
var mc = new CustomMarker(map, p, imageUrl, img_w, img_h );
@ -1035,38 +1030,7 @@ var WPGPXMAPS = {
$("div > ul > li > a", $_tab).click(FixMapSize);
}
var controlUIcenter = null;
var idFirstCenterChanged = true;
google.maps.event.addListener(map, 'center_changed', function() {
if (idFirstCenterChanged == true)
{
idFirstCenterChanged = false;
return;
}
if (controlUIcenter == null)
{
// Set CSS for the control border
controlUIcenter = document.createElement('img');
controlUIcenter.src = pluginUrl + "/wp-gpx-maps/img/backToCenter.png";
controlUIcenter.style.cursor = 'pointer';
controlUIcenter.title = lng.backToCenter;
controlDiv.appendChild(controlUIcenter);
// Setup the click event listeners
google.maps.event.addDomListener(controlUIcenter, 'click', function(event) {
map.setCenter(bounds.getCenter());
map.fitBounds(bounds);
controlDiv.removeChild(controlUIcenter);
controlUIcenter = null;
return false;
});
}
});
var graphh = jQuery('#myChart_' + params.targetId).css("height");
if (graphDist != '' && (graphEle != '' || graphSpeed != '' || graphHr != '' || graphAtemp != '' || graphCad != '') && graphh != "0px")

View File

@ -2,10 +2,10 @@
Contributors: bastianonm, Stephan Klein, Michel Selerin
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8VHWLRW6JBTML
Tags: maps, gpx, gps, graph, chart, google maps, track, garmin, image, nextgen-gallery, nextgen, exif, OpenStreetMap, OpenCycleMap, Hike&Bike, heart rate, heartrate, cadence
Tags: maps, gpx, gps, graph, chart, leaflet, track, garmin, image, nextgen-gallery, nextgen, exif, OpenStreetMap, OpenCycleMap, Hike&Bike, heart rate, heartrate, cadence
Requires at least: 2.0.0
Tested up to: 4.9.4
Stable tag: 1.5.05
Tested up to: 4.9.7
Stable tag: 1.6.01
Draws a gpx track with altitude graph. You can also display your nextgen gallery images in the map.
@ -153,6 +153,9 @@ Yes!
1. Altitude & Speed & Hearth rate
== Changelog ==
= 1.6.01 =
* Removed Gogole maps. Leafletjs instead.
* -- NextGen Gallery is not working, due next gen image format changed -- I'll fix soon
= 1.5.05 =
* renamed javascript functions to avoid collision with other plugins
* reduced chart line thickness

View File

@ -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.6-beta
* Version: 1.6.01
* Author: Bastianon Massimo
* Author URI: http://www.devfarm.it/
* Text Domain: wp-gpx-maps
@ -77,8 +77,9 @@ function enqueue_WP_GPX_Maps_scripts() {
/* chartjs */
wp_register_script('chartjs', plugins_url( '/js/Chart.min.js', __FILE__ ), array(), "2.7.2" );
wp_register_script('WP-GPX-Maps', plugins_url( '/js/WP-GPX-Maps.js', __FILE__ ), array('jquery','googlemaps','chartjs'), "1.5.05_8" );
wp_register_script('WP-GPX-Maps', plugins_url( '/js/WP-GPX-Maps.js', __FILE__ ), array('jquery','leaflet','chartjs'), "1.5.05_8" );
/*
$wpgpxmaps_googlemapsv3_apikey = get_option('wpgpxmaps_googlemapsv3_apikey');
if ($wpgpxmaps_googlemapsv3_apikey) {
@ -86,7 +87,8 @@ function enqueue_WP_GPX_Maps_scripts() {
}
else {
wp_enqueue_script('googlemaps', '//maps.googleapis.com/maps/api/js', null, null);
}
}
*/
wp_enqueue_script('leaflet');
wp_enqueue_script('leaflet.fullscreen');
@ -608,10 +610,9 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
$ngimgs_data = '';
if ( $ngGalleries != '' || $ngImages != '' ) {
//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'];
$data = str_replace("\n","",$data);

View File

@ -34,6 +34,8 @@
array_push($pictures, nggdb::find_image($i));
}
// print_r ($pictures);
foreach ($pictures as $p) {
$item = array();