|
|
|
@ -1301,8 +1301,10 @@ TABS.mission_control.initialize = function (callback) {
|
|
|
|
|
let tempWp = mission.getWaypoint(tempMarker.number);
|
|
|
|
|
tempWp.setLon(Math.round(coord[0] * 10000000));
|
|
|
|
|
tempWp.setLat(Math.round(coord[1] * 10000000));
|
|
|
|
|
$('#pointLon').val(Math.round(coord[0] * 10000000) / 10000000);
|
|
|
|
|
$('#pointLat').val(Math.round(coord[1] * 10000000) / 10000000);
|
|
|
|
|
if (selectedMarker != null && tempMarker.number == selectedMarker.getLayerNumber()) {
|
|
|
|
|
$('#pointLon').val(Math.round(coord[0] * 10000000) / 10000000);
|
|
|
|
|
$('#pointLat').val(Math.round(coord[1] * 10000000) / 10000000);
|
|
|
|
|
}
|
|
|
|
|
mission.updateWaypoint(tempWp);
|
|
|
|
|
repaintLine4Waypoints(mission);
|
|
|
|
|
}
|
|
|
|
@ -1351,14 +1353,15 @@ TABS.mission_control.initialize = function (callback) {
|
|
|
|
|
* @return {boolean} `false` to stop the drag sequence.
|
|
|
|
|
*/
|
|
|
|
|
app.Drag.prototype.handleUpEvent = function (evt) {
|
|
|
|
|
if (tempMarker.kind == "waypoint" ){
|
|
|
|
|
if ( tempMarker.kind == "waypoint" ) {
|
|
|
|
|
if (selectedMarker != null && tempMarker.number == selectedMarker.getLayerNumber()) {
|
|
|
|
|
(async () => {
|
|
|
|
|
if (mission.getWaypoint(tempMarker.number).getP3() == 1.0) {
|
|
|
|
|
const elevationAtWP = await mission.getWaypoint(tempMarker.number).getElevation(globalSettings);
|
|
|
|
|
$('#elevationValueAtWP').text(elevationAtWP);
|
|
|
|
|
}
|
|
|
|
|
const elevationAtWP = await mission.getWaypoint(tempMarker.number).getElevation(globalSettings);
|
|
|
|
|
$('#elevationValueAtWP').text(elevationAtWP);
|
|
|
|
|
checkAltElevSanity(false);
|
|
|
|
|
plotElevation();
|
|
|
|
|
})()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (tempMarker.kind == "home" ) {
|
|
|
|
|
(async () => {
|
|
|
|
@ -1488,6 +1491,18 @@ TABS.mission_control.initialize = function (callback) {
|
|
|
|
|
|
|
|
|
|
var altitudeMeters = app.ConvertCentimetersToMeters(selectedMarker.getAlt());
|
|
|
|
|
|
|
|
|
|
if (globalSettings.mapProviderType == 'bing') {
|
|
|
|
|
$('#elevationAtWP').fadeIn();
|
|
|
|
|
$('#groundClearanceAtWP').fadeIn();
|
|
|
|
|
(async () => {
|
|
|
|
|
const elevationAtWP = await selectedMarker.getElevation(globalSettings);
|
|
|
|
|
$('#elevationValueAtWP').text(elevationAtWP);
|
|
|
|
|
})()
|
|
|
|
|
} else {
|
|
|
|
|
$('#elevationAtWP').fadeOut();
|
|
|
|
|
$('#groundClearanceAtWP').fadeOut();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$('#altitudeInMeters').text(` ${altitudeMeters}m`);
|
|
|
|
|
$('#pointLon').val(Math.round(coord[0] * 10000000) / 10000000);
|
|
|
|
|
$('#pointLat').val(Math.round(coord[1] * 10000000) / 10000000);
|
|
|
|
@ -1656,7 +1671,6 @@ TABS.mission_control.initialize = function (callback) {
|
|
|
|
|
if ([MWNP.WPTYPE.SET_POI,MWNP.WPTYPE.POSHOLD_TIME,MWNP.WPTYPE.LAND].includes(selectedMarker.getAction())) {
|
|
|
|
|
selectedMarker.setP1(0.0);
|
|
|
|
|
selectedMarker.setP2(0.0);
|
|
|
|
|
selectedMarker.setP3(0.0);
|
|
|
|
|
}
|
|
|
|
|
for (var j in dictOfLabelParameterPoint[selectedMarker.getAction()]) {
|
|
|
|
|
if (dictOfLabelParameterPoint[selectedMarker.getAction()][j] != '') {
|
|
|
|
@ -1699,7 +1713,7 @@ TABS.mission_control.initialize = function (callback) {
|
|
|
|
|
|
|
|
|
|
$('#pointAlt').on('change', function (event) {
|
|
|
|
|
if (selectedMarker) {
|
|
|
|
|
selectedMarker.setAlt(Number($('#pointAlt').val()));
|
|
|
|
|
checkAltElevSanity(true);
|
|
|
|
|
mission.updateWaypoint(selectedMarker);
|
|
|
|
|
mission.update();
|
|
|
|
|
redrawLayer();
|
|
|
|
@ -1727,22 +1741,34 @@ TABS.mission_control.initialize = function (callback) {
|
|
|
|
|
|
|
|
|
|
$('#pointP3').on('change', function (event) {
|
|
|
|
|
if (selectedMarker) {
|
|
|
|
|
const P3Value = selectedMarker.getP3();
|
|
|
|
|
selectedMarker.setP3( $('#pointP3').prop("checked") ? 1.0 : 0.0);
|
|
|
|
|
if ($('#pointP3').prop("checked")) {
|
|
|
|
|
if (globalSettings.mapProviderType == 'bing') {
|
|
|
|
|
(async () => {
|
|
|
|
|
const elevationAtWP = await selectedMarker.getElevation(globalSettings);
|
|
|
|
|
$('#elevationValueAtWP').text(elevationAtWP);
|
|
|
|
|
$('#elevationAtWP').fadeIn(300);
|
|
|
|
|
var altitude = Number($('#pointAlt').val());
|
|
|
|
|
if (P3Value != selectedMarker.getP3()) {
|
|
|
|
|
if ($('#pointP3').prop("checked")) {
|
|
|
|
|
if (altitude < 0) {
|
|
|
|
|
alert("Altitude below ground level, setting to default");
|
|
|
|
|
altitude = Number($('#MPdefaultPointAlt').val());
|
|
|
|
|
}
|
|
|
|
|
selectedMarker.setAlt(altitude + elevationAtWP * 100);
|
|
|
|
|
} else {
|
|
|
|
|
selectedMarker.setAlt(altitude - Number(elevationAtWP) * 100);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$('#pointAlt').val(selectedMarker.getAlt());
|
|
|
|
|
altitudeMeters = app.ConvertCentimetersToMeters(selectedMarker.getAlt());
|
|
|
|
|
$('#altitudeInMeters').text(` ${altitudeMeters}m`);
|
|
|
|
|
checkAltElevSanity(false);
|
|
|
|
|
mission.updateWaypoint(selectedMarker);
|
|
|
|
|
mission.update();
|
|
|
|
|
redrawLayer();
|
|
|
|
|
plotElevation();
|
|
|
|
|
})()
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$('#elevationAtWP').fadeOut(300);
|
|
|
|
|
}
|
|
|
|
|
mission.updateWaypoint(selectedMarker);
|
|
|
|
|
mission.update();
|
|
|
|
|
redrawLayer();
|
|
|
|
|
plotElevation();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -1824,6 +1850,9 @@ TABS.mission_control.initialize = function (callback) {
|
|
|
|
|
HOME.setLon(Math.round(ol.proj.toLonLat(mapCenter)[0] * 1e7));
|
|
|
|
|
HOME.setLat(Math.round(ol.proj.toLonLat(mapCenter)[1] * 1e7));
|
|
|
|
|
updateHome();
|
|
|
|
|
if (globalSettings.mapProviderType == 'bing') {
|
|
|
|
|
$('#elevationEarthModelclass').fadeIn(300);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('#cancelHome').on('click', function () {
|
|
|
|
@ -1834,6 +1863,26 @@ TABS.mission_control.initialize = function (callback) {
|
|
|
|
|
closeHomePanel();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('#elevationEarthModel').on('change', function (event) {
|
|
|
|
|
if (globalSettings.mapProviderType == 'bing') {
|
|
|
|
|
(async () => {
|
|
|
|
|
if (selectedMarker) {
|
|
|
|
|
const elevationAtWP = await selectedMarker.getElevation(globalSettings);
|
|
|
|
|
$('#elevationValueAtWP').text(elevationAtWP);
|
|
|
|
|
mission.updateWaypoint(selectedMarker);
|
|
|
|
|
}
|
|
|
|
|
const elevationAtHome = await HOME.getElevation(globalSettings);
|
|
|
|
|
$('#elevationValueAtHome').text(elevationAtHome+' m');
|
|
|
|
|
HOME.setAlt(elevationAtHome);
|
|
|
|
|
|
|
|
|
|
checkAltElevSanity(false);
|
|
|
|
|
mission.update();
|
|
|
|
|
redrawLayer();
|
|
|
|
|
plotElevation();
|
|
|
|
|
})()
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////
|
|
|
|
|
// Callback for Remove buttons
|
|
|
|
|
/////////////////////////////////////////////
|
|
|
|
@ -2189,6 +2238,48 @@ TABS.mission_control.initialize = function (callback) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* reset = true : changes WP Altitude value back to previous value if setting below ground level.
|
|
|
|
|
^ reset = false : changes WP Altitude to value required to give ground clearance = default Altitude setting */
|
|
|
|
|
function checkAltElevSanity(reset) {
|
|
|
|
|
if (globalSettings.mapProviderType != 'bing') {
|
|
|
|
|
selectedMarker.setAlt(Number($('#pointAlt').val()));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const elevationAtWP = Number($('#elevationValueAtWP').text());
|
|
|
|
|
let groundClearance = "NO HOME";
|
|
|
|
|
if (selectedMarker.getP3()) {
|
|
|
|
|
if (Number($('#pointAlt').val()) < 100 * elevationAtWP) {
|
|
|
|
|
if (reset) {
|
|
|
|
|
alert("Altitude below ground level. Change ignored");
|
|
|
|
|
$('#pointAlt').val(selectedMarker.getAlt());
|
|
|
|
|
} else {
|
|
|
|
|
alert("Altitude below ground level, setting to default");
|
|
|
|
|
let altitude = Number($('#MPdefaultPointAlt').val()) + 100 * elevationAtWP;
|
|
|
|
|
$('#pointAlt').val(altitude);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
groundClearance = Number($('#pointAlt').val()) / 100 - elevationAtWP;
|
|
|
|
|
} else if (homeMarkers.length & HOME.getAlt() != "N/A") {
|
|
|
|
|
let elevationAtHome = HOME.getAlt();
|
|
|
|
|
if ((Number($('#pointAlt').val()) / 100 + elevationAtHome) < elevationAtWP) {
|
|
|
|
|
if (reset) {
|
|
|
|
|
alert("Altitude below ground level. Change ignored");
|
|
|
|
|
$('#pointAlt').val(selectedMarker.getAlt());
|
|
|
|
|
} else {
|
|
|
|
|
alert("Altitude below ground level, setting to default");
|
|
|
|
|
let altitude = Number($('#MPdefaultPointAlt').val()) + 100 * (elevationAtWP - elevationAtHome);
|
|
|
|
|
$('#pointAlt').val(altitude);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
groundClearance = Number($('#pointAlt').val()) / 100 + (elevationAtHome - elevationAtWP);
|
|
|
|
|
}
|
|
|
|
|
selectedMarker.setAlt(Number($('#pointAlt').val()));
|
|
|
|
|
let altitudeMeters = parseInt(selectedMarker.getAlt()) / 100;
|
|
|
|
|
$('#altitudeInMeters').text(` ${altitudeMeters}m`);
|
|
|
|
|
$('#groundClearanceValueAtWP').text(` ${groundClearance}`);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function plotElevation() {
|
|
|
|
|
if ($('#missionPlanerElevation').is(":visible")) {
|
|
|
|
|
if (mission.get().length == 0) {
|
|
|
|
|