* Added Catalan translation, thanks to Edgar

* Updated Spanish translation, thanks to Dani
* Added different types of distance:  Normal, Flat (don't consider altitude) and Climb distance
This commit is contained in:
bastianonm 2013-12-26 13:23:14 +00:00
parent 223ad1c606
commit 9f993afafd
10 changed files with 256 additions and 30 deletions

Binary file not shown.

View File

@ -0,0 +1,93 @@
msgid ""
msgstr ""
"Project-Id-Version: wp-gpx-maps\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-10-30 14:41+0100\n"
"PO-Revision-Date: 2013-11-16 23:13+0200\n"
"Last-Translator: Svilen Savov <svilen@svilen.org>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Poedit-KeywordsList: __;_e\n"
"X-Poedit-Basepath: .\n"
"X-Generator: Poedit 1.5.7\n"
"X-Poedit-SearchPath-0: ..\n"
#: ../wp-gpx-maps.php:467
msgid "Altitude"
msgstr "Височина"
#: ../wp-gpx-maps.php:468
msgid "Current Position"
msgstr "Текуща Позиция"
#: ../wp-gpx-maps.php:469
msgid "Speed"
msgstr "Скорост"
#: ../wp-gpx-maps.php:470
msgid "Heart rate"
msgstr "Пулс"
#: ../wp-gpx-maps.php:471
msgid "Cadence"
msgstr "Ритъм"
#: ../wp-gpx-maps.php:472
msgid "Go Full Screen"
msgstr "Покажи на цял екран"
#: ../wp-gpx-maps.php:473
msgid "Exit Full Screen"
msgstr "Изход от цял екран"
#: ../wp-gpx-maps.php:474
msgid "Hide Images"
msgstr "Скрий Снимките"
#: ../wp-gpx-maps.php:475
msgid "Show Images"
msgstr "Покажи Снкмките"
#: ../wp-gpx-maps.php:476
msgid "Back to center"
msgstr "Центрирай"
#: ../wp-gpx-maps.php:489
msgid "Total distance"
msgstr "Обща дистанция"
#: ../wp-gpx-maps.php:494
msgid "Max elevation"
msgstr "Максимална височина"
#: ../wp-gpx-maps.php:496
msgid "Min elevation"
msgstr "Минимална височина"
#: ../wp-gpx-maps.php:498
msgid "Total climbing"
msgstr "Общо изкачване"
#: ../wp-gpx-maps.php:500
msgid "Total descent"
msgstr "Общо спускане"
#: ../wp-gpx-maps.php:504
msgid "Average speed"
msgstr "Средна скорост"
#: ../wp-gpx-maps.php:509
msgid "Total Time"
msgstr "Общо Време"
#: ../wp-gpx-maps.php:525
msgid "Download"
msgstr "Свали"
#: ../wp-gpx-maps_admin_settings.php:83 ../wp-gpx-maps_admin_settings.php:151
#: ../wp-gpx-maps_admin_settings.php:229 ../wp-gpx-maps_admin_settings.php:333
#: ../wp-gpx-maps_admin_settings.php:364
msgid "Save Changes"
msgstr "Запази Промените"

BIN
languages/wp-gpx-maps-ca.mo Normal file

Binary file not shown.

View File

@ -0,0 +1,93 @@
msgid ""
msgstr ""
"Project-Id-Version: wp-gpx-maps\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-10-30 14:41+0100\n"
"PO-Revision-Date: 2013-12-14 21:43+0100\n"
"Last-Translator: edgar <forced_to_confess@yahoo.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Poedit-KeywordsList: __;_e\n"
"X-Poedit-Basepath: .\n"
"X-Generator: Poedit 1.5.5\n"
"X-Poedit-SearchPath-0: ..\n"
#: ../wp-gpx-maps.php:467
msgid "Altitude"
msgstr "Altitud"
#: ../wp-gpx-maps.php:468
msgid "Current Position"
msgstr "Posició actual"
#: ../wp-gpx-maps.php:469
msgid "Speed"
msgstr "Velocitat"
#: ../wp-gpx-maps.php:470
msgid "Heart rate"
msgstr "Ritme cardíac"
#: ../wp-gpx-maps.php:471
msgid "Cadence"
msgstr "Cadència"
#: ../wp-gpx-maps.php:472
msgid "Go Full Screen"
msgstr "Anar a pantalla completa"
#: ../wp-gpx-maps.php:473
msgid "Exit Full Screen"
msgstr "Sortir de pantalla completa"
#: ../wp-gpx-maps.php:474
msgid "Hide Images"
msgstr "Amagar imatges"
#: ../wp-gpx-maps.php:475
msgid "Show Images"
msgstr "Mostrar imatges"
#: ../wp-gpx-maps.php:476
msgid "Back to center"
msgstr "Centrar"
#: ../wp-gpx-maps.php:489
msgid "Total distance"
msgstr "Distància total"
#: ../wp-gpx-maps.php:494
msgid "Max elevation"
msgstr "Altitud màxima"
#: ../wp-gpx-maps.php:496
msgid "Min elevation"
msgstr "Altitud mínima"
#: ../wp-gpx-maps.php:498
msgid "Total climbing"
msgstr "Ascensió total"
#: ../wp-gpx-maps.php:500
msgid "Total descent"
msgstr "Descens total"
#: ../wp-gpx-maps.php:504
msgid "Average speed"
msgstr "Velocitat mitjana"
#: ../wp-gpx-maps.php:509
msgid "Total Time"
msgstr "Temps total"
#: ../wp-gpx-maps.php:525
msgid "Download"
msgstr "Descarregar"
#: ../wp-gpx-maps_admin_settings.php:83 ../wp-gpx-maps_admin_settings.php:151
#: ../wp-gpx-maps_admin_settings.php:229 ../wp-gpx-maps_admin_settings.php:333
#: ../wp-gpx-maps_admin_settings.php:364
msgid "Save Changes"
msgstr "Desar canvis"

Binary file not shown.

View File

@ -3,19 +3,20 @@ msgstr ""
"Project-Id-Version: wp-gpx-maps\n" "Project-Id-Version: wp-gpx-maps\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-10-30 14:42+0100\n" "POT-Creation-Date: 2012-10-30 14:42+0100\n"
"PO-Revision-Date: 2012-10-30 14:42+0100\n" "PO-Revision-Date: 2013-12-14 21:43+0100\n"
"Last-Translator: \n" "Last-Translator: edgar <forced_to_confess@yahoo.com>\n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"X-Poedit-KeywordsList: __;_e\n" "X-Poedit-KeywordsList: __;_e\n"
"X-Poedit-Basepath: .\n" "X-Poedit-Basepath: .\n"
"X-Generator: Poedit 1.5.5\n"
"X-Poedit-SearchPath-0: ..\n" "X-Poedit-SearchPath-0: ..\n"
#: ../wp-gpx-maps.php:467 #: ../wp-gpx-maps.php:467
msgid "Altitude" msgid "Altitude"
msgstr "Altura" msgstr "Altitud"
#: ../wp-gpx-maps.php:468 #: ../wp-gpx-maps.php:468
msgid "Current Position" msgid "Current Position"
@ -43,15 +44,15 @@ msgstr "Salir de pantalla completa"
#: ../wp-gpx-maps.php:474 #: ../wp-gpx-maps.php:474
msgid "Hide Images" msgid "Hide Images"
msgstr "" msgstr "Ocultar Imágenes"
#: ../wp-gpx-maps.php:475 #: ../wp-gpx-maps.php:475
msgid "Show Images" msgid "Show Images"
msgstr "" msgstr "Mostrar Imágenes"
#: ../wp-gpx-maps.php:476 #: ../wp-gpx-maps.php:476
msgid "Back to center" msgid "Back to center"
msgstr "" msgstr "Centrar"
#: ../wp-gpx-maps.php:489 #: ../wp-gpx-maps.php:489
msgid "Total distance" msgid "Total distance"
@ -78,9 +79,8 @@ msgid "Average speed"
msgstr "Velocidad media" msgstr "Velocidad media"
#: ../wp-gpx-maps.php:509 #: ../wp-gpx-maps.php:509
#, fuzzy
msgid "Total Time" msgid "Total Time"
msgstr "Distancia total" msgstr "Tiempo total"
#: ../wp-gpx-maps.php:525 #: ../wp-gpx-maps.php:525
msgid "Download" msgid "Download"

View File

@ -4,8 +4,8 @@ Contributors: bastianonm
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8VHWLRW6JBTML 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, google maps, track, garmin, image, nextgen-gallery, nextgen, exif, OpenStreetMap, OpenCycleMap, Hike&Bike, heart rate, heartrate, cadence
Requires at least: 2.0.0 Requires at least: 2.0.0
Tested up to: 3.7.1 Tested up to: 3.8
Stable tag: 1.2.4 Stable tag: 1.2.5
Draws a gpx track with altitude graph. You can also display your nextgen gallery images in the map. Draws a gpx track with altitude graph. You can also display your nextgen gallery images in the map.
@ -26,8 +26,9 @@ Even if you don't have a gps camera, this plugin can retrive the image position
Old NGGallery Images (without gps data) and gpx: <a href="http://www.pedemontanadelgrappa.it/mappe/itinerario-3-alta-via-degli-eroi/">http://www.pedemontanadelgrappa.it/mappe/itinerario-3-alta-via-degli-eroi/</a> Old NGGallery Images (without gps data) and gpx: <a href="http://www.pedemontanadelgrappa.it/mappe/itinerario-3-alta-via-degli-eroi/">http://www.pedemontanadelgrappa.it/mappe/itinerario-3-alta-via-degli-eroi/</a>
Translated into 13 languages: Translated into 14 languages:
- Catalan ca
- Dutch nl_NL - Dutch nl_NL
- English (default) - English (default)
- French fr_FR - French fr_FR
@ -179,6 +180,10 @@ Yes!
1. Altitude & Speed & Hearth rate 1. Altitude & Speed & Hearth rate
== Changelog == == Changelog ==
= 1.2.5 =
* Added Catalan translation, thanks to Edgar
* Updated Spanish translation, thanks to Dani
* Added different types of distance: Normal, Flat (don't consider altitude) and Climb distance
= 1.2.4 = = 1.2.4 =
* Added Bulgarian translation, thanks to Svilen Savov * Added Bulgarian translation, thanks to Svilen Savov
* Added possibility to hide the elevation chart * Added possibility to hide the elevation chart

View File

@ -3,7 +3,7 @@
Plugin Name: WP-GPX-Maps Plugin Name: WP-GPX-Maps
Plugin URI: http://www.devfarm.it/ Plugin URI: http://www.devfarm.it/
Description: Draws a gpx track with altitude graph Description: Draws a gpx track with altitude graph
Version: 1.2.4 Version: 1.2.5
Author: Bastianon Massimo Author: Bastianon Massimo
Author URI: http://www.pedemontanadelgrappa.it/ Author URI: http://www.pedemontanadelgrappa.it/
*/ */
@ -140,6 +140,8 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
$ngImages = findValue($attr, "ngimages", "wpgpxmaps_map_ngImages", ""); $ngImages = findValue($attr, "ngimages", "wpgpxmaps_map_ngImages", "");
$download = findValue($attr, "download", "wpgpxmaps_download", ""); $download = findValue($attr, "download", "wpgpxmaps_download", "");
$dtoffset = findValue($attr, "dtoffset", "wpgpxmaps_dtoffset", 0); $dtoffset = findValue($attr, "dtoffset", "wpgpxmaps_dtoffset", 0);
$distanceType = findValue($attr, "distanceType", "wpgpxmaps_distance_type", 0);
$skipcache = findValue($attr, "skipcache", "wpgpxmaps_skipcache", ""); $skipcache = findValue($attr, "skipcache", "wpgpxmaps_skipcache", "");
$summary = findValue($attr, "summary", "wpgpxmaps_summary", ""); $summary = findValue($attr, "summary", "wpgpxmaps_summary", "");
@ -151,11 +153,12 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
$p_avg_speed = findValue($attr, "summaryavgspeed", "wpgpxmaps_summary_avg_speed", false); $p_avg_speed = findValue($attr, "summaryavgspeed", "wpgpxmaps_summary_avg_speed", false);
$p_total_time = findValue($attr, "summarytotaltime", "wpgpxmaps_summary_total_time", false); $p_total_time = findValue($attr, "summarytotaltime", "wpgpxmaps_summary_total_time", false);
$colors_map = "\"".implode("\",\"",(explode(" ",$color_map)))."\""; $colors_map = "\"".implode("\",\"",(explode(" ",$color_map)))."\"";
$gpxurl = $gpx; $gpxurl = $gpx;
$cacheFileName = "$gpx,$w,$mh,$mt,$gh,$showEle,$showW,$showHr,$showCad,$donotreducegpx,$pointsoffset,$showSpeed,$showGrade,$uomspeed,$uom,v1.1.38"; $cacheFileName = "$gpx,$w,$mh,$mt,$gh,$showEle,$showW,$showHr,$showCad,$donotreducegpx,$pointsoffset,$showSpeed,$showGrade,$uomspeed,$uom,$distanceType,v1.1.38";
$cacheFileName = md5($cacheFileName); $cacheFileName = md5($cacheFileName);
@ -166,6 +169,8 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
$gpxcache.= DIRECTORY_SEPARATOR.$cacheFileName.".tmp"; $gpxcache.= DIRECTORY_SEPARATOR.$cacheFileName.".tmp";
$skipcache=true;
// Try to load cache // Try to load cache
if (file_exists($gpxcache) && !($skipcache == true)) { if (file_exists($gpxcache) && !($skipcache == true)) {
@ -236,7 +241,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
return "No gpx found"; return "No gpx found";
} }
$points = getPoints( $gpx, $pointsoffset, $donotreducegpx); $points = getPoints( $gpx, $pointsoffset, $donotreducegpx, $distanceType);
$points_maps = ''; $points_maps = '';
$points_graph_dist = ''; $points_graph_dist = '';

View File

@ -33,6 +33,8 @@
$avg_speed = get_option("wpgpxmaps_summary_avg_speed"); $avg_speed = get_option("wpgpxmaps_summary_avg_speed");
$total_time = get_option("wpgpxmaps_summary_total_time"); $total_time = get_option("wpgpxmaps_summary_total_time");
$distanceType = get_option("wpgpxmaps_distance_type");
if (empty($showEle)) if (empty($showEle))
$showEle = "true"; $showEle = "true";
@ -68,6 +70,17 @@
<input name="wpgpxmaps_graph_height" type="text" id="wpgpxmaps_graph_height" value="<?php echo get_option('wpgpxmaps_graph_height'); ?>" style="width:50px;" /> <input name="wpgpxmaps_graph_height" type="text" id="wpgpxmaps_graph_height" value="<?php echo get_option('wpgpxmaps_graph_height'); ?>" style="width:50px;" />
</td> </td>
</tr> </tr>
<tr>
<th scope="row">Distance type:</th>
<td>
<select name='wpgpxmaps_distance_type'>
<option value="0" <?php if ($distanceType == '0' || $distanceType == '') echo 'selected'; ?>>Normal (default)</option>
<option value="1" <?php if ($distanceType == '1') echo 'selected'; ?>>Flat &#8594; (Only flat distance, don't take care of altitude)</option>
<option value="2" <?php if ($distanceType == '2') echo 'selected'; ?>>Climb &#8593; (Only climb distance)</option>
</select>
</td>
</tr>
<tr> <tr>
<th scope="row">Cache:</th> <th scope="row">Cache:</th>
<td> <td>
@ -84,7 +97,7 @@
<p class="submit"> <p class="submit">
<input type="hidden" name="action" value="update" /> <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" /> <input name="page_options" type="hidden" value="wpgpxmaps_height,wpgpxmaps_graph_height,wpgpxmaps_width,wpgpxmaps_download,wpgpxmaps_skipcache,wpgpxmaps_distance_type" />
<input type="submit" class="button-primary" value="<?php _e('Save Changes', "wp_gpx_maps") ?>" /> <input type="submit" class="button-primary" value="<?php _e('Save Changes', "wp_gpx_maps") ?>" />
</p> </p>

View File

@ -79,7 +79,7 @@
return TRUE; return TRUE;
} }
function getPoints($gpxPath,$gpxOffset = 10, $donotreducegpx) function getPoints($gpxPath,$gpxOffset = 10, $donotreducegpx, $distancetype)
{ {
$points = array(); $points = array();
@ -92,7 +92,7 @@
if (file_exists($gpxPath)) if (file_exists($gpxPath))
{ {
$points = @parseXml($gpxPath, $gpxOffset); $points = @parseXml($gpxPath, $gpxOffset, $distancetype);
} }
else else
{ {
@ -125,7 +125,7 @@
return $points; return $points;
} }
function parseXml($filePath, $gpxOffset) function parseXml($filePath, $gpxOffset, $distancetype)
{ {
$points = null; $points = null;
@ -242,7 +242,7 @@
else else
{ {
//Normal Case //Normal Case
$offset = calculateDistance((float)$lat, (float)$lon, (float)$ele, (float)$lastLat, (float)$lastLon, (float)$lastEle); $offset = calculateDistance((float)$lat, (float)$lon, (float)$ele, (float)$lastLat, (float)$lastLon, (float)$lastEle, $distancetype);
$dist = $dist + $offset; $dist = $dist + $offset;
$points->totalLength = $dist; $points->totalLength = $dist;
@ -397,7 +397,7 @@
else else
{ {
//Normal Case //Normal Case
$offset = calculateDistance($lat, $lon, 0,$lastLat, $lastLon, 0); $offset = calculateDistance($lat, $lon, 0,$lastLat, $lastLon, 0, $distancetype);
$dist = $dist + $offset; $dist = $dist + $offset;
if (((float) $offset + (float) $lastOffset) > $gpxOffset) if (((float) $offset + (float) $lastOffset) > $gpxOffset)
{ {
@ -462,7 +462,7 @@
else else
{ {
//Normal Case //Normal Case
$offset = calculateDistance($lat, $lon, 0,$lastLat, $lastLon, 0); $offset = calculateDistance($lat, $lon, 0,$lastLat, $lastLon, 0, $distancetype);
$dist = $dist + $offset; $dist = $dist + $offset;
if (((float) $offset + (float) $lastOffset) > $gpxOffset) if (((float) $offset + (float) $lastOffset) > $gpxOffset)
{ {
@ -500,7 +500,6 @@
} }
} }
} }
unset($gpx); unset($gpx);
@ -543,7 +542,23 @@
return (float)($degrees * 3.1415926535897932385 / 180); return (float)($degrees * 3.1415926535897932385 / 180);
} }
function calculateDistance($lat1,$lon1,$ele1,$lat2,$lon2,$ele2) function calculateDistance($lat1,$lon1,$ele1,$lat2,$lon2,$ele2,$distancetype)
{
if ($distancetype == '2') // climb
{
return (float)$ele1 - (float)$ele2;
}
else if ($distancetype == '1') // flat
{
$alpha = (float)sin((float)toRadians((float) $lat2 - (float) $lat1) / 2);
$beta = (float)sin((float)toRadians((float) $lon2 - (float) $lon1) / 2);
//Distance in meters
$a = (float) ( (float)$alpha * (float)$alpha) + (float) ( (float)cos( (float)toRadians($lat1)) * (float)cos( (float)toRadians($lat2)) * (float)$beta * (float)$beta );
$dist = 2 * 6369628.75 * (float)atan2((float)sqrt((float)$a), (float)sqrt(1 - (float) $a));
return (float)sqrt((float)pow((float)$dist, 2) + pow((float) $lat1 - (float)$lat2, 2));
}
else // normal
{ {
$alpha = (float)sin((float)toRadians((float) $lat2 - (float) $lat1) / 2); $alpha = (float)sin((float)toRadians((float) $lat2 - (float) $lat1) / 2);
$beta = (float)sin((float)toRadians((float) $lon2 - (float) $lon1) / 2); $beta = (float)sin((float)toRadians((float) $lon2 - (float) $lon1) / 2);
@ -554,6 +569,8 @@
return sqrt((float)pow((float)$ele1-(float)$ele2,2)+(float)pow((float)$d,2)); return sqrt((float)pow((float)$ele1-(float)$ele2,2)+(float)pow((float)$d,2));
} }
}
function my_date_diff($old_date, $new_date) { function my_date_diff($old_date, $new_date) {
$t1 = strtotime($new_date); $t1 = strtotime($new_date);