mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-16 04:45:18 +03:00
Initial build
This commit is contained in:
parent
3d1fcca7bb
commit
8fcdf76945
8 changed files with 657 additions and 130 deletions
|
@ -3506,6 +3506,12 @@
|
|||
"confirm_delete_point_with_options": {
|
||||
"message": "Do you really want to delete this Waypoint with non-Geo JUMP/SET_HEAD/RTH options? \nIf yes, Non-Geo options attached will be removed also!"
|
||||
},
|
||||
"confirm_multimission_file_load": {
|
||||
"message": "This is a multi mission file. Loading will over write current multi mission.\nContinue?"
|
||||
},
|
||||
"confirm_overwrite_multimission_file_load_option": {
|
||||
"message": "This will over write current multi mission.\nContinue?"
|
||||
},
|
||||
"no_waypoints_to_load": {
|
||||
"message": "No waypoints to load !"
|
||||
},
|
||||
|
|
50
images/icons/cf_icon_multimission_white.svg
Normal file
50
images/icons/cf_icon_multimission_white.svg
Normal file
|
@ -0,0 +1,50 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
|
||||
<svg
|
||||
version="1.1"
|
||||
id="Capa_1"
|
||||
x="0px"
|
||||
y="0px"
|
||||
viewBox="0 0 141.7 141.7"
|
||||
enable-background="new 0 0 141.7 141.7"
|
||||
xml:space="preserve"
|
||||
sodipodi:docname="cf_icon_MM_white.svg"
|
||||
inkscape:version="1.1 (c68e22c387, 2021-05-23)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"><defs
|
||||
id="defs12" /><sodipodi:namedview
|
||||
id="namedview10"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="true"
|
||||
showgrid="false"
|
||||
inkscape:zoom="3.7402965"
|
||||
inkscape:cx="77.132923"
|
||||
inkscape:cy="70.983678"
|
||||
inkscape:window-width="1366"
|
||||
inkscape:window-height="715"
|
||||
inkscape:window-x="-8"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="Capa_1" />
|
||||
<g
|
||||
id="g7"
|
||||
transform="rotate(-90,69.810245,71.05)">
|
||||
<g
|
||||
id="_x34_29._Network">
|
||||
<g
|
||||
id="g4">
|
||||
<path
|
||||
fill="#ffffff"
|
||||
d="M 122.4,98.3 V 77.6 c 0,-7.2 -5.9,-13.1 -13.1,-13.1 H 76.6 V 43.7 C 84.2,41 89.7,33.7 89.7,25.2 89.7,14.4 80.9,5.6 70.1,5.6 59.3,5.6 50.5,14.4 50.5,25.2 50.5,33.8 56,41 63.6,43.7 V 64.5 H 30.7 c -7.2,0 -13.1,5.9 -13.1,13.1 V 98.4 C 10,101 4.5,108.3 4.5,116.8 c 0,10.8 8.8,19.6 19.6,19.6 10.8,0 19.6,-8.8 19.6,-19.6 0,-8.5 -5.5,-15.8 -13.1,-18.5 V 77.6 h 32.7 v 20.8 c -7.6,2.7 -13.1,9.9 -13.1,18.5 0,10.8 8.8,19.6 19.6,19.6 10.8,0 19.6,-8.8 19.6,-19.6 0,-8.5 -5.5,-15.8 -13.1,-18.5 V 77.6 H 109 v 20.8 c -7.6,2.7 -13.1,9.9 -13.1,18.5 0,10.8 8.8,19.6 19.6,19.6 10.8,0 19.6,-8.8 19.6,-19.6 0.4,-8.6 -5.1,-15.9 -12.7,-18.6 z m -98.2,25.1 c -3.6,0 -6.5,-2.9 -6.5,-6.5 0,-3.6 2.9,-6.5 6.5,-6.5 3.6,0 6.5,2.9 6.5,6.5 0,3.6 -2.9,6.5 -6.5,6.5 z m 45.8,0 c -3.6,0 -6.5,-2.9 -6.5,-6.5 0,-3.6 2.9,-6.5 6.5,-6.5 3.6,0 6.5,2.9 6.5,6.5 0.1,3.6 -2.9,6.5 -6.5,6.5 z m 0,-91.7 c -3.6,0 -6.5,-2.9 -6.5,-6.6 0,-3.6 2.9,-6.5 6.5,-6.5 3.6,0 6.5,2.9 6.5,6.5 0.1,3.7 -2.9,6.6 -6.5,6.6 z m 45.8,91.7 c -3.6,0 -6.5,-2.9 -6.5,-6.5 0,-3.6 2.9,-6.5 6.5,-6.5 3.6,0 6.5,2.9 6.5,6.5 0.1,3.6 -2.8,6.5 -6.5,6.5 z"
|
||||
id="path2" />
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.3 KiB |
|
@ -455,7 +455,8 @@ var mspHelper = (function (gui) {
|
|||
data.getInt32(10, true),
|
||||
data.getInt16(14, true),
|
||||
data.getInt16(16, true),
|
||||
data.getInt16(18, true)
|
||||
data.getInt16(18, true), // CR8
|
||||
data.getUint8(20) // CR8
|
||||
));
|
||||
break;
|
||||
case MSPCodes.MSP_BOXIDS:
|
||||
|
@ -2989,6 +2990,7 @@ var mspHelper = (function (gui) {
|
|||
self.loadWaypoints = function (callback) {
|
||||
MISSION_PLANER.reinit();
|
||||
let waypointId = 1;
|
||||
let startTime = new Date().getTime();
|
||||
MSP.send_message(MSPCodes.MSP_WP_GETINFO, false, false, getFirstWP);
|
||||
|
||||
function getFirstWP() {
|
||||
|
@ -3001,6 +3003,7 @@ var mspHelper = (function (gui) {
|
|||
MSP.send_message(MSPCodes.MSP_WP, [waypointId], false, nextWaypoint);
|
||||
}
|
||||
else {
|
||||
GUI.log('Receive time: ' + (new Date().getTime() - startTime) + 'ms');
|
||||
MSP.send_message(MSPCodes.MSP_WP, [waypointId], false, callback);
|
||||
}
|
||||
};
|
||||
|
@ -3008,6 +3011,7 @@ var mspHelper = (function (gui) {
|
|||
|
||||
self.saveWaypoints = function (callback) {
|
||||
let waypointId = 1;
|
||||
let startTime = new Date().getTime();
|
||||
MSP.send_message(MSPCodes.MSP_SET_WP, MISSION_PLANER.extractBuffer(waypointId), false, nextWaypoint)
|
||||
|
||||
function nextWaypoint() {
|
||||
|
@ -3021,6 +3025,7 @@ var mspHelper = (function (gui) {
|
|||
};
|
||||
|
||||
function endMission() {
|
||||
GUI.log('Send time: ' + (new Date().getTime() - startTime) + 'ms');
|
||||
MSP.send_message(MSPCodes.MSP_WP_GETINFO, false, false, callback);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -72,7 +72,7 @@ let WaypointCollection = function () {
|
|||
};
|
||||
|
||||
self.isEmpty = function () {
|
||||
return data == [];
|
||||
return data.length == 0; // CR9
|
||||
};
|
||||
|
||||
self.flush = function () {
|
||||
|
@ -180,13 +180,17 @@ let WaypointCollection = function () {
|
|||
optionIdx = 0;
|
||||
idx++;
|
||||
}
|
||||
if (element.getNumber() == ((bMWPfile && bReverse) ? self.get().length : self.get().length-1)) {
|
||||
// CR8
|
||||
if (!(bMWPfile && bReverse)) {
|
||||
if (element.getNumber() == self.get().length - 1) {
|
||||
element.setEndMission(0xA5);
|
||||
}
|
||||
else {
|
||||
else if ((element.getNumber() == self.get().length - 2) && element.getEndMission() == 0xA5) {
|
||||
element.setEndMission(0);
|
||||
}
|
||||
}
|
||||
// CR8
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -60,7 +60,11 @@
|
|||
.tab-mission-control .ic_removeAll {
|
||||
background-image: url(../images/icons/cf_icon_MP_removeAll_grey.svg);
|
||||
}
|
||||
|
||||
/* CR8 */
|
||||
.tab-mission-control .ic_openMultimission {
|
||||
background-image: url(../images/icons/cf_icon_multimission_white.svg);
|
||||
}
|
||||
/* CR8 */
|
||||
.tab-mission-control .ic_save {
|
||||
background-image: url(../images/icons/cf_icon_MP_save_grey.svg);
|
||||
}
|
||||
|
@ -92,7 +96,11 @@
|
|||
.tab-mission-control .ic_center {
|
||||
background-image: url(../images/icons/cf_icon_MP_center_grey.svg);
|
||||
}
|
||||
|
||||
/* CR8 */
|
||||
.tab-mission-control .ic_setup {
|
||||
background-image: url(../images/icons/cf_icon_setup_white.svg);
|
||||
}
|
||||
/* CR8 */
|
||||
.tab-mission-control .btnicon {
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
|
@ -277,21 +285,31 @@
|
|||
.ol-touch .mission-control-settings {
|
||||
top: 80px;
|
||||
}
|
||||
.mission-control-safehome {
|
||||
top: 115px;
|
||||
left: .5em;
|
||||
}
|
||||
.ol-touch .mission-control-safehome {
|
||||
top: 120px;
|
||||
}
|
||||
|
||||
.mission-control-elevation {
|
||||
/* CR8 */
|
||||
.mission-control-multimission {
|
||||
top: 90px;
|
||||
left: .5em;
|
||||
}
|
||||
.ol-touch .mission-control-elevation {
|
||||
.ol-touch .mission-control-multimission {
|
||||
top: 100px;
|
||||
}
|
||||
|
||||
.mission-control-elevation {
|
||||
top: 115px;
|
||||
left: .5em;
|
||||
}
|
||||
.ol-touch .mission-control-elevation {
|
||||
top: 120px;
|
||||
}
|
||||
|
||||
.mission-control-safehome {
|
||||
top: 140px;
|
||||
left: .5em;
|
||||
}
|
||||
.ol-touch .mission-control-safehome {
|
||||
top: 140px;
|
||||
}
|
||||
/* CR8 */
|
||||
.mission-control-template {
|
||||
top: 140px;
|
||||
left: .5em;
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="missionPlanerTotalInfo" class="gui_box grey">
|
||||
<div class="gui_box_titlebar">
|
||||
<div class="spacer_box_title i18n-replaced" data-i18n="missionTotalInformationHead">Total information</div>
|
||||
|
@ -63,6 +64,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="missionPlanerSettings" class="gui_box grey" style="display: none">
|
||||
<div class="gui_box_titlebar">
|
||||
<div class="spacer_box_title i18n-replaced" data-i18n="missionDefaultSettingsHead">Default settings</div>
|
||||
|
@ -86,7 +88,37 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- CR8 -->
|
||||
<div id="missionPlannerMultiMission" class="gui_box grey" style="display: none">
|
||||
<div class="gui_box_titlebar">
|
||||
<div class="spacer_box_title i18n-replaced" data-i18n="missionSafehomeHead">Multi Mission Manager</div>
|
||||
<div class="btnMenu btnMenuIcon save_btn">
|
||||
<div id="showHideMultimissionButton">
|
||||
<a class="ic_hide" href="#" title="Hide"></a>
|
||||
</div>
|
||||
<a id="cancelMultimission" class="ic_cancel" href="#" title="Cancel"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="spacer" id="multimissionContent">
|
||||
<div style="display: inline-block">
|
||||
<label>Mission Info: </label>
|
||||
<span id="multimissionInfo">None</span>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="btn btnTable btnTableIcon save_btn" style="display: inline-block">
|
||||
<label for="multimissionOptionList">Mission Number </label>
|
||||
<select name="Number" id="multimissionOptionList">
|
||||
<option value="0">ALL</option>
|
||||
</select>
|
||||
<a class="ic_save disabled" id="updateMultimissionButton" href="#" title="Update All" style="float: right"></a>
|
||||
</div>
|
||||
<div class="btn btnTable btnTableIcon save_btn" style="padding-top: 4px; float: left">
|
||||
<label for="addMultimissionButton">Add New Mission</label>
|
||||
<a class="ic_add disabled" id="addMultimissionButton" href="#" title="Add"></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- CR8 -->
|
||||
<div id="missionPlanerHome" class="gui_box grey" style="display: none">
|
||||
<div class="gui_box_titlebar">
|
||||
<div class="spacer_box_title i18n-replaced" data-i18n="missionHomeHead">Take Off home</div>
|
||||
|
@ -180,8 +212,8 @@
|
|||
<div id="showHideWPeditButton" class="save_btn">
|
||||
<a class="ic_hide" href="#" title="Hide"></a>
|
||||
</div>
|
||||
<div id="removePoint" class="btnMenu-danger">
|
||||
<a class="ic_removeAll" href="#" title="Remove"></a>
|
||||
<!-- CR8 --> <div id="removePoint" class="btn btnMenu-danger">
|
||||
<!-- CR8 --> <a id="removePointButton" class="ic_removeAll" href="#" title="Remove"></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -238,8 +270,8 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<th style="width: 30px">
|
||||
<div id="addOptionsPoint" class="btnTable btnTableIcon btnTable-success">
|
||||
<a class="ic_add" data-role="waypointOptions-add" href="#" style="float: center" title="Add"></a>
|
||||
<!-- CR8 --> <div id="addOptionsPoint" class="btn btnTable btnTableIcon btnTable-success">
|
||||
<!-- CR8 --> <a id="addOptionsPointButton" class="ic_add" data-role="waypointOptions-add" href="#" style="float: center" title="Add"></a>
|
||||
</div>
|
||||
</th>
|
||||
<th style="width: 50px" data-i18n="WaypointOptionId"></th>
|
||||
|
|
|
@ -347,7 +347,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
var markers = []; // Layer for Waypoints
|
||||
var lines = []; // Layer for lines between waypoints
|
||||
var safehomeMarkers =[]; // layer for Safehome points
|
||||
var safehomeMarkers = []; // layer for Safehome points
|
||||
|
||||
var map;
|
||||
|
||||
|
@ -357,6 +357,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
var selectedMarker = null;
|
||||
var selectedFeature = null;
|
||||
var tempMarker = null;
|
||||
var disableMarkerEdit = false; // CR8
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// define & init parameters for default Settings
|
||||
|
@ -379,11 +380,19 @@ TABS.mission_control.initialize = function (callback) {
|
|||
vMaxDistSH = 0;
|
||||
settings = { speed: 0, alt: 5000, safeRadiusSH : 50, maxDistSH : vMaxDistSH};
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// define & init Waypoints parameters
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
var mission = new WaypointCollection();
|
||||
|
||||
// CR8
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// define & init Multi Mission parameters
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
var multimission = new WaypointCollection();
|
||||
var multimissionCount = 0;
|
||||
var maxMultimissionCount = 9;
|
||||
// CR8
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// define & init home parameters
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -481,7 +490,6 @@ TABS.mission_control.initialize = function (callback) {
|
|||
|
||||
const $row = $safehomesTableBody.find('tr:last');
|
||||
|
||||
|
||||
$row.find(".safehome-number").text(safehome.getNumber()+1);
|
||||
|
||||
$row.find(".safehome-enabled-value").prop('checked',safehome.isUsed()).change(function () {
|
||||
|
@ -734,6 +742,225 @@ TABS.mission_control.initialize = function (callback) {
|
|||
renderHomeOnMap();
|
||||
plotElevation();
|
||||
}
|
||||
// CR8
|
||||
/////////////////////////////////////////////
|
||||
//
|
||||
// Manage Multi Mission
|
||||
//
|
||||
/////////////////////////////////////////////
|
||||
/* Multi Mission uses a 'multimission' waypoint collection as a repository for all missions loaded. 'mission' WP
|
||||
* collection remains as the WP source used for the map display.
|
||||
* All missions can be displayed on the map or only a single mission. With all missions displayed 'mission' and
|
||||
* 'multimission' both contain all missions. When a single mission is displayed 'multimission' contains all
|
||||
* missions except the currently displayed mission and 'mission' only contains the currently displayed mission.
|
||||
* On update to display all missions the current dislayed mission is merged back into 'multimission' and 'mission'
|
||||
* updated as a copy of 'multimission'.
|
||||
* When all missions are displayed WP data can be viewed but mission edit is disabled.
|
||||
* Mission WPs can be edited only when a single mission is loaded on the map. */
|
||||
|
||||
var startWPCount = 0;
|
||||
|
||||
function renderMultimissionTable() {
|
||||
$('#multimissionOptionList').prop('options').length = 1;
|
||||
for (var i = 1; i <= multimissionCount; i++) {
|
||||
$('#multimissionOptionList').append($('<option>', {value: i, text: i}));
|
||||
}
|
||||
updateMultimissionState();
|
||||
}
|
||||
|
||||
function updateMultimissionState() {
|
||||
if (!mission.isEmpty() || multimissionCount) {
|
||||
if (multimissionCount < maxMultimissionCount) {
|
||||
$("#addMultimissionButton").removeClass('disabled');
|
||||
} else {
|
||||
$("#addMultimissionButton").addClass('disabled');
|
||||
}
|
||||
if (multimissionCount) {
|
||||
let totalmultimissionWPs = multimission.get().length + mission.get().length;
|
||||
if (multimissionAllWPLoaded()) {
|
||||
$('#missionDistance').text('N/A');
|
||||
totalmultimissionWPs = mission.get().length;
|
||||
$("#updateMultimissionButton").addClass('disabled');
|
||||
}
|
||||
$('#multimissionInfo').text(multimissionCount + ' missions (' + totalmultimissionWPs + '/' + mission.getMaxWaypoints() + ' WPs)');
|
||||
} else {
|
||||
$('#multimissionInfo').text('No multi missions loaded');
|
||||
$('#cancelMultimission').trigger('click');
|
||||
}
|
||||
} else {
|
||||
$("#addMultimissionButton").addClass('disabled');
|
||||
}
|
||||
}
|
||||
|
||||
function updateAllMultimission(missionDelete = false) {
|
||||
// flag if new MM mission empty at update
|
||||
let missionIsEmptyOnUpdate = mission.isEmpty() ? true : false;
|
||||
|
||||
var i = startWPCount;
|
||||
if (!missionDelete) { // if mission set for delete update MM without adding in currently loaded mission
|
||||
mission.get().forEach(function (element) {
|
||||
multimission.get().splice(i, 0, element);
|
||||
i++;
|
||||
});
|
||||
}
|
||||
|
||||
i = 0;
|
||||
multimission.get().forEach(function (element) { // renumber MM WPs
|
||||
element.setNumber(i);
|
||||
i++;
|
||||
});
|
||||
multimission.update();
|
||||
// multimission.missionDisplayDebug();
|
||||
|
||||
mission.reinit();
|
||||
mission.copy(multimission);
|
||||
mission.update();
|
||||
// mission.missionDisplayDebug();
|
||||
|
||||
/* Remove empty missions at update.
|
||||
* Cancel MM if only 2 MM missions loaded and one mission is empty */
|
||||
if (missionIsEmptyOnUpdate) {
|
||||
multimissionCount -= multimissionCount == 2 ? 2 : 1;
|
||||
if (!multimissionCount) {
|
||||
multimissionCount = 0;
|
||||
multimission.flush();
|
||||
}
|
||||
renderMultimissionTable();
|
||||
}
|
||||
|
||||
selectedMarker = null;
|
||||
clearEditForm();
|
||||
setView(14);
|
||||
refreshLayers();
|
||||
updateTotalInfo();
|
||||
}
|
||||
|
||||
function editMultimission() {
|
||||
var MMCount = 0;
|
||||
var endWPCount = 0;
|
||||
var found = false;
|
||||
startWPCount = 0;
|
||||
mission.get().forEach(function (element) {
|
||||
if (element.getEndMission() == 0xA5 && !found) {
|
||||
MMCount ++;
|
||||
endWPCount = element.getNumber();
|
||||
if (MMCount == Number($('#multimissionOptionList').val())) {
|
||||
found = true;
|
||||
} else {
|
||||
startWPCount = endWPCount + 1;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
mission.reinit();
|
||||
tempMissionData = multimission.get().slice(startWPCount, endWPCount + 1); // copy selected single mission from MM
|
||||
let i = 0;
|
||||
tempMissionData.forEach(function (element) { // write copied mission to active mission
|
||||
mission.put(element);
|
||||
mission.get()[i].setNumber(i);
|
||||
i++;
|
||||
});
|
||||
multimission.get().splice(startWPCount, (endWPCount - startWPCount + 1)) // cut current mission from MM
|
||||
|
||||
mission.update();
|
||||
selectedMarker = null;
|
||||
clearEditForm();
|
||||
setView(14);
|
||||
refreshLayers();
|
||||
updateTotalInfo();
|
||||
}
|
||||
|
||||
function mapSelectEditMultimission(WPNumber) {
|
||||
let MMCount = 1;
|
||||
|
||||
mission.get().forEach(function (element) {
|
||||
if (element.getEndMission() == 0xA5 && element.getNumber() < WPNumber) {
|
||||
MMCount ++;
|
||||
}
|
||||
});
|
||||
$('#multimissionOptionList').val(MMCount).change();
|
||||
}
|
||||
|
||||
function deleteMultimission() {
|
||||
updateAllMultimission(true);
|
||||
multimissionCount -= multimissionCount == 2 ? 2 : 1;
|
||||
if (!multimissionCount) {
|
||||
multimission.flush();
|
||||
} else {
|
||||
setMultimissionEditControl(false);
|
||||
}
|
||||
renderMultimissionTable();
|
||||
|
||||
$("#updateMultimissionButton").addClass('disabled');
|
||||
}
|
||||
|
||||
function addMultimission() {
|
||||
if (Number($('#multimissionOptionList').val()) || !multimissionCount) {
|
||||
updateAllMultimission();
|
||||
}
|
||||
multimissionCount += !multimissionCount ? 2 : 1;
|
||||
renderMultimissionTable();
|
||||
$('#multimissionOptionList').val(multimissionCount);
|
||||
|
||||
removeAllWaypoints();
|
||||
startWPCount = multimission.get().length;
|
||||
|
||||
$("#updateMultimissionButton").removeClass('disabled');
|
||||
setMultimissionEditControl(true);
|
||||
}
|
||||
|
||||
function removeAllMultiMissionCheck() {
|
||||
if (!multimissionCount) return true;
|
||||
|
||||
if (!multimissionAllWPLoaded()) {
|
||||
deleteMultimission();
|
||||
return false;
|
||||
}
|
||||
|
||||
multimissionCount = 0;
|
||||
multimission.flush();
|
||||
renderMultimissionTable();
|
||||
|
||||
setMultimissionEditControl(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
function fileLoadMultiMissionCheck() {
|
||||
if (!multimissionCount || !multimissionAllWPLoaded()) return true;
|
||||
|
||||
if (multimissionAllWPLoaded() && confirm(chrome.i18n.getMessage('confirm_overwrite_multimission_file_load_option'))) {
|
||||
nwdialog.setContext(document);
|
||||
nwdialog.openFileDialog(function(result) {
|
||||
loadMissionFile(result);
|
||||
multimissionCount = 0;
|
||||
multimission.flush();
|
||||
renderMultimissionTable();
|
||||
})
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function multimissionAllWPLoaded() {
|
||||
return Number($('#multimissionOptionList').val()) == 0;
|
||||
}
|
||||
|
||||
function setMultimissionEditControl(enabled = true) {
|
||||
if (enabled) {
|
||||
disableMarkerEdit = false;
|
||||
$("*", "#MPeditPoint").prop('disabled',false);
|
||||
$("#addOptionsPointButton").removeClass('disabled');
|
||||
$("#removePointButton").removeClass('disabled');
|
||||
$("#waypointOptionsTableBody").fadeIn();
|
||||
} else {
|
||||
disableMarkerEdit = true;
|
||||
$("*", "#MPeditPoint").prop('disabled',true);
|
||||
$("#addOptionsPointButton").addClass('disabled');
|
||||
$("#removePointButton").addClass('disabled');
|
||||
$("#waypointOptionsTableBody").fadeOut();
|
||||
}
|
||||
}
|
||||
// CR8
|
||||
|
||||
/////////////////////////////////////////////
|
||||
//
|
||||
// Manage Waypoint
|
||||
|
@ -742,7 +969,8 @@ TABS.mission_control.initialize = function (callback) {
|
|||
|
||||
function removeAllWaypoints() {
|
||||
mission.reinit();
|
||||
cleanLayers();
|
||||
refreshLayers(); // CR8
|
||||
// cleanLayers();
|
||||
clearEditForm();
|
||||
updateTotalInfo();
|
||||
clearFilename();
|
||||
|
@ -811,7 +1039,8 @@ TABS.mission_control.initialize = function (callback) {
|
|||
let oldPos,
|
||||
oldAction,
|
||||
poiList = [],
|
||||
oldHeading;
|
||||
oldHeading,
|
||||
multiMissionWPNum = 0; // CR8
|
||||
let activatePoi = false;
|
||||
let activateHead = false;
|
||||
$('#missionDistance').text(0);
|
||||
|
@ -843,12 +1072,25 @@ TABS.mission_control.initialize = function (callback) {
|
|||
else if (typeof oldPos !== 'undefined' && activatePoi != true && activateHead == true) {
|
||||
paintLine(oldPos, coord, element.getNumber(), color='#1497f1', lineDash=0, lineText=String(oldHeading)+"°");
|
||||
}
|
||||
// CR8
|
||||
if (element.getEndMission() == 0xA5) {
|
||||
oldPos = 'undefined';
|
||||
activatePoi = false;
|
||||
activateHead = false;
|
||||
multiMissionWPNum = element.getNumber() + 1;
|
||||
} else {
|
||||
oldPos = coord;
|
||||
}
|
||||
// CR8
|
||||
}
|
||||
}
|
||||
else if (element.isAttached()) {
|
||||
if (element.getAction() == MWNP.WPTYPE.JUMP) {
|
||||
let coord = ol.proj.fromLonLat([mission.getWaypoint(element.getP1()).getLonMap(), mission.getWaypoint(element.getP1()).getLatMap()]);
|
||||
// CR8
|
||||
let jumpWPIndex = 0;
|
||||
jumpWPIndex = multiMissionWPNum + element.getP1();
|
||||
let coord = ol.proj.fromLonLat([mission.getWaypoint(jumpWPIndex).getLonMap(), mission.getWaypoint(jumpWPIndex).getLatMap()]);
|
||||
// CR8
|
||||
paintLine(oldPos, coord, element.getNumber(), color='#e935d6', lineDash=5, lineText="Repeat x"+(element.getP2() == -1 ? " infinite" : String(element.getP2())), selection=false, arrow=true);
|
||||
}
|
||||
// If classic WPs is defined with a heading = -1, change Boolean for POI to false. If it is defined with a value different from -1, activate Heading boolean
|
||||
|
@ -864,6 +1106,14 @@ TABS.mission_control.initialize = function (callback) {
|
|||
oldHeading = String(element.getP1());
|
||||
}
|
||||
}
|
||||
// CR8
|
||||
if (element.getEndMission() == 0xA5) {
|
||||
oldPos = 'undefined';
|
||||
activatePoi = false;
|
||||
activateHead = false;
|
||||
multiMissionWPNum = element.getNumber() + 1;
|
||||
}
|
||||
// CR8
|
||||
}
|
||||
});
|
||||
//reset text position
|
||||
|
@ -871,6 +1121,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
textGeom.setCoordinates(map.getCoordinateFromPixel([0,0]));
|
||||
}
|
||||
let lengthMission = mission.getDistance(true);
|
||||
|
||||
$('#missionDistance').text(lengthMission[lengthMission.length -1] != -1 ? lengthMission[lengthMission.length -1].toFixed(1) : 'infinite');
|
||||
}
|
||||
|
||||
|
@ -920,7 +1171,6 @@ TABS.mission_control.initialize = function (callback) {
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
if (arrow) {
|
||||
var vectorSource = new ol.source.Vector({
|
||||
features: [feature, featureArrow]
|
||||
|
@ -948,7 +1198,12 @@ TABS.mission_control.initialize = function (callback) {
|
|||
|
||||
map.addLayer(vectorLayer);
|
||||
}
|
||||
|
||||
// CR8
|
||||
function refreshLayers() {
|
||||
cleanLayers();
|
||||
redrawLayers();
|
||||
}
|
||||
// CR8
|
||||
function cleanLayers() {
|
||||
for (var i in lines) {
|
||||
map.removeLayer(lines[i]);
|
||||
|
@ -975,8 +1230,8 @@ TABS.mission_control.initialize = function (callback) {
|
|||
map.addLayer(addWaypointMarker(element));
|
||||
}
|
||||
});
|
||||
repaintLine4Waypoints(mission); // CR9
|
||||
}
|
||||
repaintLine4Waypoints(mission);
|
||||
}
|
||||
|
||||
function redrawLayer() {
|
||||
|
@ -1092,7 +1347,13 @@ TABS.mission_control.initialize = function (callback) {
|
|||
localize();
|
||||
return waypoint;
|
||||
}
|
||||
|
||||
// CR8
|
||||
function setView(zoom) {
|
||||
var coord = ol.proj.fromLonLat([mission.getWaypoint(0).getLonMap(), mission.getWaypoint(0).getLatMap()]);
|
||||
map.getView().setCenter(coord);
|
||||
map.getView().setZoom(zoom);
|
||||
}
|
||||
// CR8
|
||||
/////////////////////////////////////////////
|
||||
//
|
||||
// Manage Map construction
|
||||
|
@ -1217,7 +1478,6 @@ TABS.mission_control.initialize = function (callback) {
|
|||
element: element,
|
||||
target: options.target
|
||||
});
|
||||
|
||||
};
|
||||
ol.inherits(app.PlannerSafehomeControl, ol.control.Control);
|
||||
|
||||
|
@ -1254,21 +1514,56 @@ TABS.mission_control.initialize = function (callback) {
|
|||
element: element,
|
||||
target: options.target
|
||||
});
|
||||
|
||||
};
|
||||
ol.inherits(app.PlannerElevationControl, ol.control.Control);
|
||||
|
||||
// CR8
|
||||
// /**
|
||||
// * @constructor
|
||||
// * @extends {ol.control.Control}
|
||||
// * @param {Object=} opt_options Control options.
|
||||
// */
|
||||
app.PlannerMultiMissionControl = function (opt_options) {
|
||||
var options = opt_options || {};
|
||||
var button = document.createElement('button');
|
||||
|
||||
button.innerHTML = ' ';
|
||||
button.style = 'background: url(\'../images/icons/cf_icon_multimission_white.svg\') no-repeat 1px -1px;background-color: rgba(0,60,136,.5);';
|
||||
|
||||
var handleShowSettings = function () {
|
||||
$('#missionPlannerMultiMission').fadeIn(300);
|
||||
};
|
||||
|
||||
button.addEventListener('click', handleShowSettings, false);
|
||||
button.addEventListener('touchstart', handleShowSettings, false);
|
||||
|
||||
var element = document.createElement('div');
|
||||
element.className = 'mission-control-multimission ol-unselectable ol-control';
|
||||
element.appendChild(button);
|
||||
element.title = 'MP MultiMission';
|
||||
|
||||
ol.control.Control.call(this, {
|
||||
element: element,
|
||||
target: options.target
|
||||
});
|
||||
};
|
||||
ol.inherits(app.PlannerMultiMissionControl, ol.control.Control);
|
||||
// CR8
|
||||
|
||||
/**
|
||||
* @param {ol.MapBrowserEvent} evt Map browser event.
|
||||
* @return {boolean} `true` to start the drag sequence.
|
||||
*/
|
||||
app.Drag.prototype.handleDownEvent = function (evt) {
|
||||
if (disableMarkerEdit) return false; // CR8
|
||||
|
||||
var map = evt.map;
|
||||
|
||||
var feature = map.forEachFeatureAtPixel(evt.pixel,
|
||||
function (feature, layer) {
|
||||
return feature;
|
||||
});
|
||||
|
||||
tempMarker = map.forEachFeatureAtPixel(evt.pixel,
|
||||
function (feature, layer) {
|
||||
return layer;
|
||||
|
@ -1299,7 +1594,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
|
||||
var geometry = /** @type {ol.geom.SimpleGeometry} */
|
||||
(this.feature_.getGeometry());
|
||||
if (tempMarker.kind == "waypoint" ||tempMarker.kind == "safehome" || tempMarker.kind == "home") {
|
||||
if ((tempMarker.kind == "waypoint") || tempMarker.kind == "safehome" || tempMarker.kind == "home") {
|
||||
geometry.translate(deltaX, deltaY);
|
||||
this.coordinate_[0] = evt.coordinate[0];
|
||||
this.coordinate_[1] = evt.coordinate[1];
|
||||
|
@ -1331,7 +1626,6 @@ TABS.mission_control.initialize = function (callback) {
|
|||
$('.home-lon').val(Math.round(coord[0] * 10000000) / 10000000);
|
||||
$('.home-lat').val(Math.round(coord[1] * 10000000) / 10000000);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1362,7 +1656,7 @@ 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 () => {
|
||||
const elevationAtWP = await mission.getWaypoint(tempMarker.number).getElevation(globalSettings);
|
||||
|
@ -1409,6 +1703,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
if (CONFIGURATOR.connectionValid) {
|
||||
control_list = [
|
||||
new app.PlannerSettingsControl(),
|
||||
new app.PlannerMultiMissionControl(), // CR8
|
||||
new app.PlannerSafehomeControl(),
|
||||
new app.PlannerElevationControl(),
|
||||
]
|
||||
|
@ -1416,8 +1711,9 @@ TABS.mission_control.initialize = function (callback) {
|
|||
else {
|
||||
control_list = [
|
||||
new app.PlannerSettingsControl(),
|
||||
new app.PlannerMultiMissionControl(), // CR8
|
||||
new app.PlannerElevationControl(),
|
||||
//new app.PlannerSafehomeControl() // TO COMMENT FOR RELEASE : DECOMMENT FOR DEBUG
|
||||
// new app.PlannerSafehomeControl() // TO COMMENT FOR RELEASE : DECOMMENT FOR DEBUG
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -1468,6 +1764,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
map.getView().setZoom(result.missionPlanerLastValues.zoom);
|
||||
}
|
||||
});
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Map on-click behavior definition
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1525,7 +1822,6 @@ TABS.mission_control.initialize = function (callback) {
|
|||
$('#pointP2').val(selectedMarker.getP2());
|
||||
changeSwitchery($('#pointP3'), selectedMarker.getP3() == 1);
|
||||
|
||||
|
||||
// Selection box update depending on choice of type of waypoint
|
||||
for (var j in dictOfLabelParameterPoint[selectedMarker.getAction()]) {
|
||||
if (dictOfLabelParameterPoint[selectedMarker.getAction()][j] != '') {
|
||||
|
@ -1539,7 +1835,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
$('#MPeditPoint').fadeIn(300);
|
||||
redrawLayer();
|
||||
}
|
||||
else if (selectedFeature && tempMarker.kind == "line" && tempMarker.selection) {
|
||||
else if (selectedFeature && tempMarker.kind == "line" && tempMarker.selection && !disableMarkerEdit) { // CR8
|
||||
let tempWpCoord = ol.proj.toLonLat(evt.coordinate);
|
||||
let tempWp = new Waypoint(tempMarker.number, MWNP.WPTYPE.WAYPOINT, Math.round(tempWpCoord[1] * 10000000), Math.round(tempWpCoord[0] * 10000000), alt=Number(settings.alt), p1=Number(settings.speed));
|
||||
if (homeMarkers.length && HOME.getAlt() != "N/A") {
|
||||
|
@ -1549,15 +1845,13 @@ TABS.mission_control.initialize = function (callback) {
|
|||
|
||||
mission.insertWaypoint(tempWp, tempMarker.number);
|
||||
mission.update();
|
||||
cleanLayers();
|
||||
redrawLayers();
|
||||
refreshLayers(); // CR8
|
||||
plotElevation();
|
||||
})()
|
||||
} else {
|
||||
mission.insertWaypoint(tempWp, tempMarker.number);
|
||||
mission.update();
|
||||
cleanLayers();
|
||||
redrawLayers();
|
||||
refreshLayers(); // CR8
|
||||
plotElevation();
|
||||
}
|
||||
}
|
||||
|
@ -1576,7 +1870,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
$('.home-lon').val(Math.round(coord[0] * 10000000) / 10000000);
|
||||
$('.home-lat').val(Math.round(coord[1] * 10000000) / 10000000);
|
||||
}
|
||||
else {
|
||||
else if (!disableMarkerEdit) { // CR8
|
||||
let tempWpCoord = ol.proj.toLonLat(evt.coordinate);
|
||||
let tempWp = new Waypoint(mission.get().length, MWNP.WPTYPE.WAYPOINT, Math.round(tempWpCoord[1] * 10000000), Math.round(tempWpCoord[0] * 10000000), alt=Number(settings.alt), p1=Number(settings.speed));
|
||||
if (homeMarkers.length && HOME.getAlt() != "N/A") {
|
||||
|
@ -1586,21 +1880,30 @@ TABS.mission_control.initialize = function (callback) {
|
|||
|
||||
mission.put(tempWp);
|
||||
mission.update();
|
||||
cleanLayers();
|
||||
redrawLayers();
|
||||
refreshLayers(); // CR8
|
||||
plotElevation();
|
||||
})()
|
||||
} else {
|
||||
mission.put(tempWp);
|
||||
mission.update();
|
||||
cleanLayers();
|
||||
redrawLayers();
|
||||
refreshLayers(); // CR8
|
||||
plotElevation();
|
||||
}
|
||||
}
|
||||
//mission.missionDisplayDebug();
|
||||
updateMultimissionState(); // CR8
|
||||
});
|
||||
|
||||
// CR8
|
||||
map.on('dblclick', function () {
|
||||
if (!(multimissionCount && multimissionAllWPLoaded()) || selectedMarker == null) return;
|
||||
|
||||
mapSelectEditMultimission(selectedMarker.getNumber());
|
||||
updateMultimissionState();
|
||||
});
|
||||
// CR8
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// change mouse cursor when over marker
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1701,6 +2004,19 @@ TABS.mission_control.initialize = function (callback) {
|
|||
}
|
||||
});
|
||||
|
||||
$('#showHideMultimissionButton').on('click', function () {
|
||||
var src = ($(this).children().attr('class') === 'ic_hide')
|
||||
? 'ic_show'
|
||||
: 'ic_hide';
|
||||
$(this).children().attr('class', src);
|
||||
if ($(this).children().attr('class') === 'ic_hide') {
|
||||
$('#multimissionContent').fadeIn(300);
|
||||
}
|
||||
else {
|
||||
$('#multimissionContent').fadeOut(300);
|
||||
}
|
||||
});
|
||||
|
||||
/////////////////////////////////////////////
|
||||
// Callback for Waypoint edition
|
||||
/////////////////////////////////////////////
|
||||
|
@ -1729,8 +2045,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
selectedMarker.setLat(Math.round(Number($('#pointLat').val()) * 10000000));
|
||||
mission.updateWaypoint(selectedMarker);
|
||||
mission.update();
|
||||
cleanLayers();
|
||||
redrawLayers();
|
||||
refreshLayers(); // CR8
|
||||
selectedFeature = markers[selectedMarker.getLayerNumber()].getSource().getFeatures()[0];
|
||||
selectedFeature.setStyle(getWaypointIcon(selectedMarker, true));
|
||||
plotElevation();
|
||||
|
@ -1742,8 +2057,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
selectedMarker.setLon(Math.round(Number($('#pointLon').val()) * 10000000));
|
||||
mission.updateWaypoint(selectedMarker);
|
||||
mission.update();
|
||||
cleanLayers();
|
||||
redrawLayers();
|
||||
refreshLayers(); // CR8
|
||||
selectedFeature = markers[selectedMarker.getLayerNumber()].getSource().getFeatures()[0];
|
||||
selectedFeature.setStyle(getWaypointIcon(selectedMarker, true));
|
||||
plotElevation();
|
||||
|
@ -1781,6 +2095,11 @@ TABS.mission_control.initialize = function (callback) {
|
|||
});
|
||||
|
||||
$('#pointP3').on('change', function (event) {
|
||||
// CR8
|
||||
if (disableMarkerEdit) {
|
||||
changeSwitchery($('#pointP3'), selectedMarker.getP3() == 1);
|
||||
}
|
||||
// CR8
|
||||
if (selectedMarker) {
|
||||
const P3Value = selectedMarker.getP3();
|
||||
selectedMarker.setP3( $('#pointP3').prop("checked") ? 1.0 : 0.0);
|
||||
|
@ -1820,8 +2139,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
mission.dropAttachedFromWaypoint(selectedMarker, $(event.currentTarget).attr("data-index")-1);
|
||||
renderWaypointOptionsTable(selectedMarker);
|
||||
//cleanLines();
|
||||
cleanLayers();
|
||||
redrawLayers();
|
||||
refreshLayers(); // CR8
|
||||
selectedFeature = markers[selectedMarker.getLayerNumber()].getSource().getFeatures()[0];
|
||||
selectedFeature.setStyle(getWaypointIcon(selectedMarker, true));
|
||||
}
|
||||
|
@ -1832,8 +2150,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
mission.addAttachedFromWaypoint(selectedMarker);
|
||||
renderWaypointOptionsTable(selectedMarker);
|
||||
//cleanLines();
|
||||
cleanLayers();
|
||||
redrawLayers();
|
||||
refreshLayers(); // CR8
|
||||
selectedFeature = markers[selectedMarker.getLayerNumber()].getSource().getFeatures()[0];
|
||||
selectedFeature.setStyle(getWaypointIcon(selectedMarker, true));
|
||||
}
|
||||
|
@ -1922,12 +2239,58 @@ TABS.mission_control.initialize = function (callback) {
|
|||
}
|
||||
});
|
||||
|
||||
// CR8
|
||||
/////////////////////////////////////////////
|
||||
// Callback for MULTIMISSION Table
|
||||
/////////////////////////////////////////////
|
||||
$('#multimissionOptionList').on('change', function () {
|
||||
if (multimissionAllWPLoaded()) {
|
||||
updateAllMultimission();
|
||||
|
||||
$("#updateMultimissionButton").addClass('disabled');
|
||||
setMultimissionEditControl(multimissionCount ? false : true);
|
||||
updateMultimissionState();
|
||||
return;
|
||||
} else {
|
||||
// only update all missions when a single mission is loaded on map
|
||||
var missions = 0;
|
||||
mission.get().forEach(function (element) {
|
||||
missions += element.getEndMission() == 0xA5 ? 1 : 0;
|
||||
});
|
||||
if (missions == 1) updateAllMultimission();
|
||||
|
||||
$("#updateMultimissionButton").removeClass('disabled');
|
||||
setMultimissionEditControl(true);
|
||||
}
|
||||
|
||||
editMultimission();
|
||||
});
|
||||
|
||||
$('#addMultimissionButton').on('click', function () {
|
||||
addMultimission();
|
||||
});
|
||||
|
||||
$('#updateMultimissionButton').on('click', function () {
|
||||
$('#multimissionOptionList').val('0').change();
|
||||
});
|
||||
|
||||
$('#cancelMultimission').on('click', function () {
|
||||
$('#missionPlannerMultiMission').fadeOut(300);
|
||||
});
|
||||
// CR8
|
||||
|
||||
/////////////////////////////////////////////
|
||||
// Callback for Remove buttons
|
||||
/////////////////////////////////////////////
|
||||
$('#removeAllPoints').on('click', function () {
|
||||
if (markers.length && confirm(chrome.i18n.getMessage('confirm_delete_all_points'))) {
|
||||
// CR8
|
||||
if (removeAllMultiMissionCheck()) {
|
||||
removeAllWaypoints();
|
||||
|
||||
updateMultimissionState();
|
||||
}
|
||||
// CR8
|
||||
plotElevation();
|
||||
}
|
||||
});
|
||||
|
@ -1947,8 +2310,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
selectedMarker = null;
|
||||
mission.update();
|
||||
clearEditForm();
|
||||
cleanLayers();
|
||||
redrawLayers();
|
||||
refreshLayers(); // CR8
|
||||
plotElevation();
|
||||
}
|
||||
}
|
||||
|
@ -1957,20 +2319,19 @@ TABS.mission_control.initialize = function (callback) {
|
|||
selectedMarker = null;
|
||||
mission.update();
|
||||
clearEditForm();
|
||||
cleanLayers();
|
||||
redrawLayers();
|
||||
refreshLayers(); // CR8
|
||||
plotElevation();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/////////////////////////////////////////////
|
||||
// Callback for Save/load buttons
|
||||
/////////////////////////////////////////////
|
||||
$('#loadFileMissionButton').on('click', function () {
|
||||
if (!fileLoadMultiMissionCheck()) return; // CR8
|
||||
|
||||
if (markers.length && !confirm(chrome.i18n.getMessage('confirm_delete_all_points'))) return;
|
||||
removeAllWaypoints();
|
||||
nwdialog.setContext(document);
|
||||
nwdialog.openFileDialog(function(result) {
|
||||
loadMissionFile(result);
|
||||
|
@ -1993,7 +2354,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
});
|
||||
|
||||
$('#saveMissionButton').on('click', function () {
|
||||
if (!mission.get().length) {
|
||||
if (mission.isEmpty()) { // CR8
|
||||
alert(chrome.i18n.getMessage('no_waypoints_to_save'));
|
||||
return;
|
||||
}
|
||||
|
@ -2011,7 +2372,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
});
|
||||
|
||||
$('#saveEepromMissionButton').on('click', function () {
|
||||
if (!mission.get().length) {
|
||||
if (mission.isEmpty()) { // CR8
|
||||
alert(chrome.i18n.getMessage('no_waypoints_to_save'));
|
||||
return;
|
||||
}
|
||||
|
@ -2040,8 +2401,6 @@ TABS.mission_control.initialize = function (callback) {
|
|||
closeSettingsPanel();
|
||||
});
|
||||
|
||||
|
||||
|
||||
updateTotalInfo();
|
||||
}
|
||||
|
||||
|
@ -2070,6 +2429,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
|
||||
// parse mission file
|
||||
removeAllWaypoints();
|
||||
missionEndFlagCount = 0; // CR8
|
||||
var node = null;
|
||||
var nodemission = null;
|
||||
for (var noderoot in result) {
|
||||
|
@ -2136,8 +2496,15 @@ TABS.mission_control.initialize = function (callback) {
|
|||
point.setP2(parseInt(node.$[attr]));
|
||||
} else if (attr.match(/parameter3/i)) {
|
||||
point.setP3(parseInt(node.$[attr]));
|
||||
// CR8
|
||||
} else if (attr.match(/flag/i)) {
|
||||
point.setEndMission(parseInt(node.$[attr]));
|
||||
if (parseInt(node.$[attr]) == 0xA5) {
|
||||
missionEndFlagCount ++;
|
||||
}
|
||||
}
|
||||
// CR8
|
||||
}
|
||||
mission.put(point);
|
||||
}
|
||||
}
|
||||
|
@ -2146,6 +2513,22 @@ TABS.mission_control.initialize = function (callback) {
|
|||
}
|
||||
// update Attached Waypoints (i.e non Map Markers)
|
||||
mission.update(true);
|
||||
// CR8
|
||||
if (missionEndFlagCount > 1) {
|
||||
if (multimissionCount && !confirm(chrome.i18n.getMessage('confirm_multimission_file_load'))) {
|
||||
mission.flush();
|
||||
return;
|
||||
} else {
|
||||
multimissionCount = missionEndFlagCount;
|
||||
multimission.reinit();
|
||||
multimission.copy(mission);
|
||||
renderMultimissionTable();
|
||||
$('#missionPlannerMultiMission').fadeIn(300);
|
||||
setMultimissionEditControl(false);
|
||||
}
|
||||
}
|
||||
updateMultimissionState();
|
||||
// CR8
|
||||
if (Object.keys(mission.getCenter()).length !== 0) {
|
||||
var coord = ol.proj.fromLonLat([mission.getCenter().lon / 10000000 , mission.getCenter().lat / 10000000]);
|
||||
map.getView().setCenter(coord);
|
||||
|
@ -2157,9 +2540,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
}
|
||||
}
|
||||
else {
|
||||
var coord = ol.proj.fromLonLat([mission.getWaypoint(0).getLonMap(), mission.getWaypoint(0).getLatMap()]);
|
||||
map.getView().setCenter(coord);
|
||||
map.getView().setZoom(16);
|
||||
setView(16); // CR8
|
||||
}
|
||||
|
||||
redrawLayers();
|
||||
|
@ -2201,6 +2582,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
'parameter1': (MWNP.WPTYPE.REV[waypoint.getAction()] == "JUMP" ? waypoint.getP1()+1 : waypoint.getP1()),
|
||||
'parameter2': waypoint.getP2(),
|
||||
'parameter3': waypoint.getP3(),
|
||||
'flag': waypoint.getEndMission(), // CR8
|
||||
} };
|
||||
data.missionitem.push(point);
|
||||
});
|
||||
|
@ -2221,7 +2603,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
/////////////////////////////////////////////
|
||||
//
|
||||
// Load/Save FC mission Toolbox
|
||||
//
|
||||
// mission = configurator store, WP number indexed from 0, MISSION_PLANER = FC NVM store, WP number indexed from 1
|
||||
/////////////////////////////////////////////
|
||||
function getWaypointsFromFC(loadEeprom) {
|
||||
if (loadEeprom) {
|
||||
|
@ -2246,9 +2628,25 @@ TABS.mission_control.initialize = function (callback) {
|
|||
mission.reinit();
|
||||
mission.copy(MISSION_PLANER);
|
||||
mission.update(true);
|
||||
var coord = ol.proj.fromLonLat([mission.getWaypoint(0).getLonMap(), mission.getWaypoint(0).getLatMap()]);
|
||||
map.getView().setCenter(coord);
|
||||
map.getView().setZoom(16);
|
||||
// CR8
|
||||
multimissionCount = 0;
|
||||
let missionEndFlagCount = 0;
|
||||
mission.get().forEach(function (element) {
|
||||
if (element.getEndMission() == 0xA5) {
|
||||
missionEndFlagCount ++;
|
||||
}
|
||||
});
|
||||
if (missionEndFlagCount > 1) {
|
||||
multimissionCount = missionEndFlagCount;
|
||||
multimission.reinit();
|
||||
multimission.copy(mission);
|
||||
renderMultimissionTable();
|
||||
$('#missionPlannerMultiMission').fadeIn(300);
|
||||
setMultimissionEditControl(false);
|
||||
}
|
||||
updateMultimissionState();
|
||||
setView(16);
|
||||
// CR8
|
||||
redrawLayers();
|
||||
updateTotalInfo();
|
||||
});
|
||||
|
@ -2275,22 +2673,19 @@ TABS.mission_control.initialize = function (callback) {
|
|||
mission.reinit();
|
||||
mission.copy(MISSION_PLANER);
|
||||
mission.update(true);
|
||||
cleanLayers();
|
||||
redrawLayers();
|
||||
refreshLayers(); // CR8
|
||||
$('#MPeditPoint').fadeOut(300);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
function updateTotalInfo() {
|
||||
if (CONFIGURATOR.connectionValid) {
|
||||
$('#availablePoints').text(mission.getCountBusyPoints() + '/' + mission.getMaxWaypoints());
|
||||
let availableWPs = mission.getMaxWaypoints() - mission.getCountBusyPoints(); // CR8
|
||||
$('#availablePoints').text(availableWPs + '/' + mission.getMaxWaypoints());
|
||||
$('#missionValid').html(mission.getValidMission() ? chrome.i18n.getMessage('armingCheckPass') : chrome.i18n.getMessage('armingCheckFail'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function updateFilename(filename) {
|
||||
$('#missionFilename').text(filename);
|
||||
$('#infoMissionFilename').show();
|
||||
|
@ -2339,8 +2734,8 @@ TABS.mission_control.initialize = function (callback) {
|
|||
}
|
||||
|
||||
function plotElevation() {
|
||||
if ($('#missionPlanerElevation').is(":visible")) {
|
||||
if (mission.get().length == 0) {
|
||||
if ($('#missionPlanerElevation').is(":visible") && !disableMarkerEdit) { // CR8
|
||||
if (mission.isEmpty()) { // CR8
|
||||
var data = [[0], [0]];
|
||||
var layout = {showlegend: true,
|
||||
legend: {
|
||||
|
@ -2427,6 +2822,16 @@ TABS.mission_control.initialize = function (callback) {
|
|||
|
||||
};
|
||||
|
||||
// window.addEventListener("error", handleError, true);
|
||||
|
||||
// function handleError(evt) {
|
||||
// if (evt.message) { // Chrome sometimes provides this
|
||||
// alert("error: "+evt.message +" at linenumber: "+evt.lineno+" of file: "+evt.filename);
|
||||
// } else {
|
||||
// alert("error: "+evt.type+" from element: "+(evt.srcElement || evt.target));
|
||||
// }
|
||||
// }
|
||||
|
||||
TABS.mission_control.cleanup = function (callback) {
|
||||
if (callback) callback();
|
||||
};
|
||||
|
|
|
@ -908,6 +908,13 @@ OSD.constants = {
|
|||
min_version: '3.0.0',
|
||||
preview: FONT.symbol(SYM.GLIDESLOPE) + FONT.embed_dot('12.3'),
|
||||
},
|
||||
// CR8
|
||||
{
|
||||
name: 'MISSION INFO',
|
||||
id: 128,
|
||||
preview: 'M1/6>27WP'
|
||||
},
|
||||
// CR8
|
||||
{
|
||||
name: 'VERSION',
|
||||
id: 119,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue