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 {
display: grid;
grid-template: 1fr 1fr 1fr 1fr / 1fr 1fr;
grid-template-columns: 65% 35%;
text-align: center;
}
#optiontop label, #optiontop input[type=checkbox] {
#optiontop select {
width: 100% !important;
}
#optiontop label {
margin-top: auto;
margin-bottom: auto;
}
#optiontop input[type=checkbox] {
margin-right: auto;
}
label[for=markerstyleselect] {
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;
margin-top: 3px;
margin-bottom: 3px;
}

View File

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

View File

@ -2029,6 +2029,11 @@ L.Edit.PolyVerticesEdit = L.Handler.extend({
this._updatePrevNext(marker, marker2);
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 () {
@ -2038,6 +2043,11 @@ L.Edit.PolyVerticesEdit = L.Handler.extend({
this._createMiddleMarker(marker1, marker);
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 () {

View File

@ -113,12 +113,14 @@ echo '</ul>'."\n";
<option value="h"><?php p($l->t('on hover')); ?></option>
<option value="p"><?php p($l->t('permanent')); ?></option>
</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')); ?>"
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>
<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>
<hr/>
<h3 class="sectiontitle"><?php p($l->t('Custom tile servers')); ?></h3>