refs #18 add option to approximate elevation of new point. approximation is naive for the moment

merge-requests/1/head
Julien Veyssier 2017-06-01 19:19:05 +02:00
parent 029722685d
commit 0d9f9c17a6
4 changed files with 31 additions and 37 deletions

View File

@ -861,45 +861,18 @@ div#ho button {
} }
#optiontop { #optiontop {
display: grid; display: grid;
grid-template: 1fr 1fr 1fr 1fr / 1fr 1fr; grid-template-columns: 65% 35%;
text-align: center; text-align: center;
} }
#optiontop label, #optiontop input[type=checkbox] { #optiontop select {
width: 100% !important;
}
#optiontop label {
margin-top: auto; margin-top: auto;
margin-bottom: auto; margin-bottom: auto;
} }
#optiontop input[type=checkbox] { #optiontop input[type=checkbox] {
margin-right: auto; margin-right: auto;
} margin-top: 3px;
label[for=markerstyleselect] { margin-bottom: 3px;
grid-column: 1;
grid-row: 1;
}
#markerstyleselect {
grid-column: 2;
grid-row: 1;
}
label[for=tooltipstyleselect] {
grid-column: 1;
grid-row: 2;
}
#tooltipstyleselect {
grid-column: 2;
grid-row: 2;
}
#symboloverwrite {
grid-column: 2;
grid-row: 3;
}
label[for=symboloverwrite] {
grid-column: 1;
grid-row: 3;
}
#clearbeforeload {
grid-column: 2;
grid-row: 4;
}
label[for=clearbeforeload] {
grid-column: 1;
grid-row: 4;
} }

View File

@ -1235,6 +1235,10 @@
if (optionsValues.symboloverwrite !== undefined) { if (optionsValues.symboloverwrite !== undefined) {
$('#symboloverwrite').prop('checked', optionsValues.symboloverwrite); $('#symboloverwrite').prop('checked', optionsValues.symboloverwrite);
} }
if (optionsValues.approximateele !== undefined) {
$('#approximateele').prop('checked', optionsValues.approximateele);
L.drawLocal.edit.approximateElevations = $('#approximateele').is(':checked');
}
if (optionsValues.tilelayer !== undefined) { if (optionsValues.tilelayer !== undefined) {
gpxedit.restoredTileLayer = optionsValues.tilelayer; gpxedit.restoredTileLayer = optionsValues.tilelayer;
} }
@ -1247,6 +1251,7 @@
optionsValues.tooltipstyle = $('#tooltipstyleselect').val(); optionsValues.tooltipstyle = $('#tooltipstyleselect').val();
optionsValues.clearbeforeload = $('#clearbeforeload').is(':checked'); optionsValues.clearbeforeload = $('#clearbeforeload').is(':checked');
optionsValues.symboloverwrite = $('#symboloverwrite').is(':checked'); optionsValues.symboloverwrite = $('#symboloverwrite').is(':checked');
optionsValues.approximateele = $('#approximateele').is(':checked');
optionsValues.tilelayer = gpxedit.activeLayers.getActiveBaseLayer().name; optionsValues.tilelayer = gpxedit.activeLayers.getActiveBaseLayer().name;
//alert('to save: '+JSON.stringify(optionsValues)); //alert('to save: '+JSON.stringify(optionsValues));
@ -1380,6 +1385,10 @@
$('body').on('change', '#clearbeforeload', function() { $('body').on('change', '#clearbeforeload', function() {
saveOptions(); saveOptions();
}); });
$('body').on('change', '#approximateele', function() {
L.drawLocal.edit.approximateElevations = $(this).is(':checked');
saveOptions();
});
$('body').on('click', 'button.popupOkButton', function(e) { $('body').on('click', 'button.popupOkButton', function(e) {
var id = parseInt($(this).attr('layerid')); var id = parseInt($(this).attr('layerid'));
var name = $(this).parent().find('.layerName').val(); var name = $(this).parent().find('.layerName').val();

View File

@ -2029,6 +2029,11 @@ L.Edit.PolyVerticesEdit = L.Handler.extend({
this._updatePrevNext(marker, marker2); this._updatePrevNext(marker, marker2);
this._poly.fire('editstart'); this._poly.fire('editstart');
if (L.drawLocal.edit.approximateElevations) {
if (marker1._latlng.alt && marker2._latlng.alt) {
marker._latlng.alt = (marker1._latlng.alt + marker2._latlng.alt) / 2;
}
}
}; };
onDragEnd = function () { onDragEnd = function () {
@ -2038,6 +2043,11 @@ L.Edit.PolyVerticesEdit = L.Handler.extend({
this._createMiddleMarker(marker1, marker); this._createMiddleMarker(marker1, marker);
this._createMiddleMarker(marker, marker2); this._createMiddleMarker(marker, marker2);
if (L.drawLocal.edit.approximateElevations) {
if (marker1._latlng.alt && marker2._latlng.alt) {
marker._latlng.alt = (marker1._latlng.alt + marker2._latlng.alt) / 2;
}
}
}; };
onClick = function () { onClick = function () {

View File

@ -113,12 +113,14 @@ echo '</ul>'."\n";
<option value="h"><?php p($l->t('on hover')); ?></option> <option value="h"><?php p($l->t('on hover')); ?></option>
<option value="p"><?php p($l->t('permanent')); ?></option> <option value="p"><?php p($l->t('permanent')); ?></option>
</select> </select>
<input title="<?php p($l->t('Use defined symbols instead of default symbol')); ?>"
id="symboloverwrite" type="checkbox" checked></input>
<label title="<?php p($l->t('Use defined symbols instead of default symbol')); ?>" <label title="<?php p($l->t('Use defined symbols instead of default symbol')); ?>"
for="symboloverwrite"><?php p($l->t('Use defined symbols')); ?></label> for="symboloverwrite"><?php p($l->t('Use defined symbols')); ?></label>
<input type="checkbox" id="clearbeforeload" checked></input> <input title="<?php p($l->t('Use defined symbols instead of default symbol')); ?>"
id="symboloverwrite" type="checkbox" checked></input>
<label for="clearbeforeload"><?php p($l->t('Clear map before loading'));?></label> <label for="clearbeforeload"><?php p($l->t('Clear map before loading'));?></label>
<input type="checkbox" id="clearbeforeload" checked></input>
<label for="approximateele"><?php p($l->t('Approximate new points elevations'));?></label>
<input type="checkbox" id="approximateele"></input>
</div> </div>
<hr/> <hr/>
<h3 class="sectiontitle"><?php p($l->t('Custom tile servers')); ?></h3> <h3 class="sectiontitle"><?php p($l->t('Custom tile servers')); ?></h3>