mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-21 15:25:19 +03:00
Safehome : read
This commit is contained in:
parent
cf80f8c9ab
commit
a81050d121
11 changed files with 347 additions and 30 deletions
|
@ -120,6 +120,8 @@ sources.js = [
|
||||||
'./js/appUpdater.js',
|
'./js/appUpdater.js',
|
||||||
'./js/feature_framework.js',
|
'./js/feature_framework.js',
|
||||||
'./js/defaults_dialog.js',
|
'./js/defaults_dialog.js',
|
||||||
|
'./js/safehomeCollection.js',
|
||||||
|
'./js/safehome.js',
|
||||||
'./node_modules/openlayers/dist/ol.js'
|
'./node_modules/openlayers/dist/ol.js'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
BIN
images/icons/cf_icon_safehome.png
Normal file
BIN
images/icons/cf_icon_safehome.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.3 KiB |
BIN
images/icons/cf_icon_safehome_used.png
Normal file
BIN
images/icons/cf_icon_safehome_used.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.3 KiB |
9
js/fc.js
9
js/fc.js
|
@ -61,7 +61,7 @@ var CONFIG,
|
||||||
OUTPUT_MAPPING,
|
OUTPUT_MAPPING,
|
||||||
SETTINGS,
|
SETTINGS,
|
||||||
BRAKING_CONFIG,
|
BRAKING_CONFIG,
|
||||||
SAFEHOME;
|
SAFEHOMES;
|
||||||
|
|
||||||
var FC = {
|
var FC = {
|
||||||
MAX_SERVO_RATE: 125,
|
MAX_SERVO_RATE: 125,
|
||||||
|
@ -546,12 +546,15 @@ var FC = {
|
||||||
|
|
||||||
SETTINGS = {};
|
SETTINGS = {};
|
||||||
|
|
||||||
SAFEHOME = {
|
/* SAFEHOME = {
|
||||||
|
bufferPoint : {
|
||||||
number: 0,
|
number: 0,
|
||||||
enabled: 0,
|
enabled: 0,
|
||||||
lon: 0,
|
lon: 0,
|
||||||
lat: 0
|
lat: 0
|
||||||
};
|
}
|
||||||
|
}; */
|
||||||
|
SAFEHOMES = new SafehomeCollection();
|
||||||
},
|
},
|
||||||
getOutputUsages: function() {
|
getOutputUsages: function() {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -217,6 +217,12 @@ var MSPCodes = {
|
||||||
|
|
||||||
MSP2_INAV_OPFLOW_CALIBRATION: 0x2032,
|
MSP2_INAV_OPFLOW_CALIBRATION: 0x2032,
|
||||||
|
|
||||||
|
MSP2_INAV_FWUPDT_PREPARE: 0x2033,
|
||||||
|
MSP2_INAV_FWUPDT_STORE: 0x2034,
|
||||||
|
MSP2_INAV_FWUPDT_EXEC: 0x2035,
|
||||||
|
MSP2_INAV_FWUPDT_ROLLBACK_PREPARE: 0x2036,
|
||||||
|
MSP2_INAV_FWUPDT_ROLLBACK_EXEC: 0x2037,
|
||||||
|
|
||||||
MSP2_INAV_SAFEHOME: 0x2038,
|
MSP2_INAV_SAFEHOME: 0x2038,
|
||||||
MSP2_INAV_SET_SAFEHOME: 0x2039
|
MSP2_INAV_SET_SAFEHOME: 0x2039
|
||||||
};
|
};
|
||||||
|
|
|
@ -440,6 +440,7 @@ var mspHelper = (function (gui) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MSPCodes.MSP_WP:
|
case MSPCodes.MSP_WP:
|
||||||
|
console.log("data : ",data);
|
||||||
MISSION_PLANER.bufferPoint.number = data.getUint8(0);
|
MISSION_PLANER.bufferPoint.number = data.getUint8(0);
|
||||||
MISSION_PLANER.bufferPoint.action = data.getUint8(1);
|
MISSION_PLANER.bufferPoint.action = data.getUint8(1);
|
||||||
MISSION_PLANER.bufferPoint.lat = data.getInt32(2, true) / 10000000;
|
MISSION_PLANER.bufferPoint.lat = data.getInt32(2, true) / 10000000;
|
||||||
|
@ -1461,13 +1462,21 @@ var mspHelper = (function (gui) {
|
||||||
SENSOR_DATA.temperature[i] = temp_decidegrees / 10; // °C
|
SENSOR_DATA.temperature[i] = temp_decidegrees / 10; // °C
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
/* case MSPCodes.MSP2_INAV_SAFEHOME:
|
||||||
|
SAFEHOME.bufferPoint.number = data.getUint8(0);
|
||||||
|
SAFEHOME.bufferPoint.enabled = data.getUint8(1);
|
||||||
|
SAFEHOME.bufferPoint.lon = data.getInt32(2, true);
|
||||||
|
SAFEHOME.bufferPoint.lat = data.getInt32(6, true);
|
||||||
|
break; */
|
||||||
case MSPCodes.MSP2_INAV_SAFEHOME:
|
case MSPCodes.MSP2_INAV_SAFEHOME:
|
||||||
console.log(MSPCodes.MSP2_INAV_SAFEHOME);
|
SAFEHOMES.put(new Safehome(
|
||||||
SAFEHOME.number = data.getUint8(0);
|
data.getUint8(0),
|
||||||
SAFEHOME.enable = data.getUint8(1);
|
data.getUint8(1),
|
||||||
SAFEHOME.lon = data.getInt32(2);
|
data.getInt32(2, true) / 1e7,
|
||||||
SAFEHOME.lat = data.getInt32(3);
|
data.getInt32(6, true) / 1e7
|
||||||
|
));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
console.log('Unknown code detected: ' + dataHandler.code);
|
console.log('Unknown code detected: ' + dataHandler.code);
|
||||||
} else {
|
} else {
|
||||||
|
@ -2099,8 +2108,9 @@ var mspHelper = (function (gui) {
|
||||||
buffer.push(MISSION_PLANER.bufferPoint.endMission); //sbufReadU8(src); // future: to set nav flag
|
buffer.push(MISSION_PLANER.bufferPoint.endMission); //sbufReadU8(src); // future: to set nav flag
|
||||||
break;
|
break;
|
||||||
case MSPCodes.MSP_WP:
|
case MSPCodes.MSP_WP:
|
||||||
console.log(MISSION_PLANER.bufferPoint.number);
|
console.log("MISSION_PLANER.bufferPoint.number : ",MISSION_PLANER.bufferPoint.number);
|
||||||
buffer.push(MISSION_PLANER.bufferPoint.number+1);
|
buffer.push(MISSION_PLANER.bufferPoint.number+1);
|
||||||
|
console.log("buffer ", buffer);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case MSPCodes.MSP_WP_MISSION_SAVE:
|
case MSPCodes.MSP_WP_MISSION_SAVE:
|
||||||
|
@ -2144,8 +2154,12 @@ var mspHelper = (function (gui) {
|
||||||
buffer.push(BRAKING_CONFIG.bankAngle);
|
buffer.push(BRAKING_CONFIG.bankAngle);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSPCodes.MSP2_INAV_SET_SAFEHOME:
|
/* case MSPCodes.MSP2_INAV_SAFEHOME:
|
||||||
|
console.log("SAFEHOME.bufferPoint.number : ",SAFEHOME.bufferPoint.number);
|
||||||
|
buffer.push(SAFEHOME.bufferPoint.number+1);
|
||||||
break;
|
break;
|
||||||
|
case MSPCodes.MSP2_INAV_SET_SAFEHOME:
|
||||||
|
break; */
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
@ -2914,6 +2928,26 @@ var mspHelper = (function (gui) {
|
||||||
MSP.send_message(MSPCodes.MSP_WP_GETINFO, false, false, callback);
|
MSP.send_message(MSPCodes.MSP_WP_GETINFO, false, false, callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* self.getSafehomeInfo = function (callback) {
|
||||||
|
MSP.send_message(MSPCodes.MSP2_INAV_SAFEHOME, false, false, callback);
|
||||||
|
}; */
|
||||||
|
|
||||||
|
self.loadSafehomes = function (callback) {
|
||||||
|
SAFEHOMES.flush();
|
||||||
|
let safehomeId = 0;
|
||||||
|
MSP.send_message(MSPCodes.MSP2_INAV_SAFEHOME, [safehomeId], false, nextSafehome);
|
||||||
|
|
||||||
|
function nextSafehome() {
|
||||||
|
safehomeId++;
|
||||||
|
if (safehomeId < SAFEHOMES.getMaxSafehomeCount()-1) {
|
||||||
|
MSP.send_message(MSPCodes.MSP2_INAV_SAFEHOME, [safehomeId], false, nextSafehome);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
MSP.send_message(MSPCodes.MSP2_INAV_SAFEHOME, [safehomeId], false, callback);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
self._getSetting = function (name) {
|
self._getSetting = function (name) {
|
||||||
if (SETTINGS[name]) {
|
if (SETTINGS[name]) {
|
||||||
return Promise.resolve(SETTINGS[name]);
|
return Promise.resolve(SETTINGS[name]);
|
||||||
|
|
68
js/safeHome.js
Normal file
68
js/safeHome.js
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
/*global $*/
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
let Safehome = function (number, enabled, lat, lon) {
|
||||||
|
|
||||||
|
var self = {};
|
||||||
|
|
||||||
|
self.getNumber = function () {
|
||||||
|
return number;
|
||||||
|
};
|
||||||
|
|
||||||
|
self.setNumber = function (data) {
|
||||||
|
number = data;
|
||||||
|
};
|
||||||
|
|
||||||
|
self.getLon = function () {
|
||||||
|
return lon;
|
||||||
|
};
|
||||||
|
|
||||||
|
self.setLon = function (data) {
|
||||||
|
lon = data;
|
||||||
|
};
|
||||||
|
|
||||||
|
self.getLonToMap = function () {
|
||||||
|
return lon / 1e7;
|
||||||
|
};
|
||||||
|
|
||||||
|
self.setLonFromMap = function (data) {
|
||||||
|
lon = data * 1e7;
|
||||||
|
};
|
||||||
|
|
||||||
|
self.getLat = function () {
|
||||||
|
return lat;
|
||||||
|
};
|
||||||
|
|
||||||
|
self.setLat = function (data) {
|
||||||
|
lat = data;
|
||||||
|
};
|
||||||
|
|
||||||
|
self.getLatToMap = function () {
|
||||||
|
return lat / 1e7;
|
||||||
|
};
|
||||||
|
|
||||||
|
self.setLatFromMap = function (data) {
|
||||||
|
lat = data * 1e7;
|
||||||
|
};
|
||||||
|
|
||||||
|
self.isUsed = function () {
|
||||||
|
return enabled == 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
self.getEnabled = function () {
|
||||||
|
return enabled;
|
||||||
|
};
|
||||||
|
|
||||||
|
self.setEnabled = function (data) {
|
||||||
|
enabled = data;
|
||||||
|
};
|
||||||
|
|
||||||
|
self.cleanup = function () {
|
||||||
|
number = 0;
|
||||||
|
enabled = 0;
|
||||||
|
lon = 0;
|
||||||
|
lat = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
return self;
|
||||||
|
};
|
86
js/safehomeCollection.js
Normal file
86
js/safehomeCollection.js
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
/*global ServoMixRule*/
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
let SafehomeCollection = function () {
|
||||||
|
|
||||||
|
let self = {},
|
||||||
|
data = [],
|
||||||
|
maxSafehomeCount = 8;
|
||||||
|
|
||||||
|
self.setMaxSafehomeCount = function (value) {
|
||||||
|
maxSafehomeCount = value;
|
||||||
|
};
|
||||||
|
|
||||||
|
self.getMaxSafehomeCount = function () {
|
||||||
|
return maxSafehomeCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
self.put = function (element) {
|
||||||
|
data.push(element);
|
||||||
|
};
|
||||||
|
|
||||||
|
self.get = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
self.clean = function (index){
|
||||||
|
data[index].cleanup();
|
||||||
|
};
|
||||||
|
|
||||||
|
self.flush = function () {
|
||||||
|
data = [];
|
||||||
|
};
|
||||||
|
|
||||||
|
self.inflate = function () {
|
||||||
|
while (self.hasFreeSlots()) {
|
||||||
|
self.put(new Safehome(0, 0, 0, 0));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
self.hasFreeSlots = function () {
|
||||||
|
return data.length < self.getMaxSafehomeCount();
|
||||||
|
};
|
||||||
|
|
||||||
|
self.isSafehomeConfigured = function(safehomeId) {
|
||||||
|
|
||||||
|
for (let safehomeIndex in data) {
|
||||||
|
if (data.hasOwnProperty(safehomeIndex)) {
|
||||||
|
let safehome = data[safehomeIndex];
|
||||||
|
|
||||||
|
if (safehome.getNumber() == safehomeId && safehome.isUsed()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
self.getNumberOfConfiguredSafehome = function () {
|
||||||
|
let count = 0;
|
||||||
|
for (let i = 0; i < self.getMaxSafehomeCount(); i ++) {
|
||||||
|
if (self.isSafehomeConfigured(i)) {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
};
|
||||||
|
|
||||||
|
self.getUsedSafehomeIndexes = function () {
|
||||||
|
let out = [];
|
||||||
|
|
||||||
|
for (let safehomeIndex in data) {
|
||||||
|
if (data.hasOwnProperty(safehomeIndex)) {
|
||||||
|
let safehome = data[safehomeIndex];
|
||||||
|
out.push(safehome.getNumber());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let unique = [...new Set(out)];
|
||||||
|
|
||||||
|
return unique.sort(function(a, b) {
|
||||||
|
return a-b;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return self;
|
||||||
|
};
|
|
@ -236,29 +236,29 @@
|
||||||
top: 100px;
|
top: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab-mission-control .missionTable {
|
.tab-mission-control .safehomesTable {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab-mission-control .missionTable thead {
|
.tab-mission-control .safehomesTable thead {
|
||||||
display: table-header-group !important;
|
display: table-header-group !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab-mission-control .missionTable thead tr {
|
.tab-mission-control .safehomesTable thead tr {
|
||||||
border-left: 1px solid #e4e4e4;
|
border-left: 1px solid #e4e4e4;
|
||||||
border-right: 1px solid #e4e4e4;
|
border-right: 1px solid #e4e4e4;
|
||||||
background-color: #828885;
|
background-color: #828885;
|
||||||
color: #FFF;
|
color: #FFF;
|
||||||
}
|
}
|
||||||
.tab-mission-control .missionTable td,
|
.tab-mission-control .safehomesTable td,
|
||||||
.tab-mission-control .missionTable th {
|
.tab-mission-control .safehomesTable th {
|
||||||
padding: 2px;
|
padding: 2px;
|
||||||
height: 2.5em;
|
height: 2.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab-mission-control .missionTable tr:nth-child(even) td,
|
.tab-mission-control .safehomesTable tr:nth-child(even) td,
|
||||||
.tab-mission-control .missionTable tr:nth-child(even) th {
|
.tab-mission-control .safehomesTable tr:nth-child(even) th {
|
||||||
background-color: #ebe7e7;
|
background-color: #ebe7e7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="spacer">
|
<div class="spacer">
|
||||||
<div>
|
<div>
|
||||||
<table class="mixer-table logic__table">
|
<table class="safehomesTable">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width: 50px" data-i18n="SafehomeSelected"></th>
|
<th style="width: 50px" data-i18n="SafehomeSelected"></th>
|
||||||
|
|
|
@ -66,7 +66,8 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
if (CONFIGURATOR.connectionValid) {
|
if (CONFIGURATOR.connectionValid) {
|
||||||
var loadChainer = new MSPChainerClass();
|
var loadChainer = new MSPChainerClass();
|
||||||
loadChainer.setChain([
|
loadChainer.setChain([
|
||||||
mspHelper.getMissionInfo
|
mspHelper.getMissionInfo,
|
||||||
|
mspHelper.loadSafehomes
|
||||||
]);
|
]);
|
||||||
loadChainer.setExitPoint(loadHtml);
|
loadChainer.setExitPoint(loadHtml);
|
||||||
loadChainer.execute();
|
loadChainer.execute();
|
||||||
|
@ -93,6 +94,10 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
isOffline = true;
|
isOffline = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$safehomesTable = $('.safehomesTable');
|
||||||
|
$safehomesTableBody = $safehomesTable.find('tbody');
|
||||||
|
|
||||||
|
|
||||||
if (typeof require !== "undefined") {
|
if (typeof require !== "undefined") {
|
||||||
loadSettings();
|
loadSettings();
|
||||||
// let the dom load finish, avoiding the resizing of the map
|
// let the dom load finish, avoiding the resizing of the map
|
||||||
|
@ -327,6 +332,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
var pointForSend = 0;
|
var pointForSend = 0;
|
||||||
var actionPointForSend = 0;
|
var actionPointForSend = 0;
|
||||||
var settings = { speed: 0, alt: 5000};
|
var settings = { speed: 0, alt: 5000};
|
||||||
|
var safehomeFromBuffer = [];
|
||||||
|
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
// Reinit Form
|
// Reinit Form
|
||||||
|
@ -380,14 +386,64 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
// Manage Safehome
|
// Manage Safehome
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
function getSafeHomePointFromFC() {
|
function renderSafehomesTable() {
|
||||||
console.log("Test");
|
/*
|
||||||
|
* Process safehome table UI
|
||||||
|
*/
|
||||||
|
let safehomes = SAFEHOMES.get();
|
||||||
|
$safehomesTableBody.find("*").remove();
|
||||||
|
for (let safehomeIndex in safehomes) {
|
||||||
|
if (safehomes.hasOwnProperty(safehomeIndex)) {
|
||||||
|
const safehome = safehomes[safehomeIndex];
|
||||||
|
console.log(safehome.getEnabled());
|
||||||
|
|
||||||
|
$safehomesTableBody.append('\
|
||||||
|
<tr>\
|
||||||
|
<td><input type="checkbox" class="toggle safehome-view-value"/></td> \
|
||||||
|
<td><span class="safehome-number"/></td>\
|
||||||
|
<td class="safehome-enabled"><input type="checkbox" class="toggle safehome-enabled-value"/></td> \
|
||||||
|
<td><input type="number" class="safehome-lon" step="1e-7"/></td>\
|
||||||
|
<td><input type="number" class="safehome-lat" step="1e-7"/></td>\
|
||||||
|
</tr>\
|
||||||
|
');
|
||||||
|
|
||||||
|
const $row = $safehomesTableBody.find('tr:last');
|
||||||
|
|
||||||
|
/* $row.find(".safehome-view-value").prop('checked',true)).change(function () {
|
||||||
|
|
||||||
|
}); */
|
||||||
|
|
||||||
|
$row.find(".safehome-number").text(safehome.getNumber()+1);
|
||||||
|
|
||||||
|
$row.find(".safehome-enabled-value").prop('checked',safehome.isUsed()).change(function () {
|
||||||
|
safehome.setEnabled($(this).val());
|
||||||
|
});
|
||||||
|
|
||||||
|
$row.find(".safehome-lon").val(safehome.getLon()).change(function () {
|
||||||
|
safehome.setLon($(this).val());
|
||||||
|
});
|
||||||
|
|
||||||
|
$row.find(".safehome-lat").val(safehome.getLat()).change(function () {
|
||||||
|
safehome.setLat($(this).val());
|
||||||
|
});
|
||||||
|
|
||||||
|
$row.find("[data-role='role-servo-delete']").attr("data-index", safehomeIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
GUI.switchery();
|
||||||
|
localize();
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadSafehome() {
|
|
||||||
MSP.send_message(MSPCodes.MSP2_INAV_SAFEHOME, false, false, getSafeHomePointFromFC);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
function renderSafehomesOnMap(safehomes) {
|
||||||
|
/*
|
||||||
|
* Process safehome on Map
|
||||||
|
*/
|
||||||
|
safehomes.get().forEach(function (safehome) {
|
||||||
|
console.log(safehome.getNumber());
|
||||||
|
map.addLayer(addSafeHomeMarker(safehome));
|
||||||
|
});
|
||||||
|
}
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
// Manage Plotting functions
|
// Manage Plotting functions
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
|
@ -411,7 +467,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
$('#missionDistance').text(0);
|
$('#missionDistance').text(0);
|
||||||
|
|
||||||
map.getLayers().forEach(function (t) {
|
map.getLayers().forEach(function (t) {
|
||||||
if (t instanceof ol.layer.Vector && typeof t.alt !== 'undefined') {
|
if (t instanceof ol.layer.Vector && typeof t.alt !== 'undefined' && t.kind == "marker") {
|
||||||
var geometry = t.getSource().getFeatures()[0].getGeometry();
|
var geometry = t.getSource().getFeatures()[0].getGeometry();
|
||||||
var action = t.action;
|
var action = t.action;
|
||||||
var markerNumber = t.number;
|
var markerNumber = t.number;
|
||||||
|
@ -548,7 +604,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
population: 4000,
|
population: 4000,
|
||||||
rainfall: 500
|
rainfall: 500
|
||||||
});
|
});
|
||||||
|
console.log(_pos);
|
||||||
iconFeature.setStyle(getPointIcon(_action, false, String(markers.length)));
|
iconFeature.setStyle(getPointIcon(_action, false, String(markers.length)));
|
||||||
|
|
||||||
var vectorSource = new ol.source.Vector({
|
var vectorSource = new ol.source.Vector({
|
||||||
|
@ -559,6 +615,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
source: vectorSource
|
source: vectorSource
|
||||||
});
|
});
|
||||||
|
|
||||||
|
vectorLayer.kind = "marker";
|
||||||
vectorLayer.alt = _alt;
|
vectorLayer.alt = _alt;
|
||||||
vectorLayer.number = markers.length;
|
vectorLayer.number = markers.length;
|
||||||
vectorLayer.action = _action;
|
vectorLayer.action = _action;
|
||||||
|
@ -572,6 +629,55 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
return vectorLayer;
|
return vectorLayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getSafehomeIcon(safehome) {
|
||||||
|
return new ol.style.Style({
|
||||||
|
image: new ol.style.Icon(({
|
||||||
|
anchor: [0.5, 1],
|
||||||
|
opacity: 1,
|
||||||
|
scale: 0.5,
|
||||||
|
src: '../images/icons/cf_icon_safehome' + (safehome.isUsed() ? '_used' : '')+ '.png'
|
||||||
|
})),
|
||||||
|
text: new ol.style.Text(({
|
||||||
|
text: String(Number(safehome.getNumber())+1),
|
||||||
|
font: '12px sans-serif',
|
||||||
|
offsetY: -15,
|
||||||
|
offsetX: -2,
|
||||||
|
fill: new ol.style.Fill({
|
||||||
|
color: '#FFFFFF'
|
||||||
|
}),
|
||||||
|
stroke: new ol.style.Stroke({
|
||||||
|
color: '#FFFFFF'
|
||||||
|
}),
|
||||||
|
}))
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function addSafeHomeMarker(safehome) {
|
||||||
|
|
||||||
|
var coord = ol.proj.fromLonLat([safehome.getLon(), safehome.getLat()]);
|
||||||
|
console.log(coord);
|
||||||
|
var iconFeature = new ol.Feature({
|
||||||
|
geometry: new ol.geom.Point(coord),
|
||||||
|
name: 'Null Island',
|
||||||
|
population: 4000,
|
||||||
|
rainfall: 500
|
||||||
|
});
|
||||||
|
|
||||||
|
iconFeature.setStyle(getSafehomeIcon(safehome));
|
||||||
|
|
||||||
|
var vectorSource = new ol.source.Vector({
|
||||||
|
features: [iconFeature]
|
||||||
|
});
|
||||||
|
|
||||||
|
var vectorLayer = new ol.layer.Vector({
|
||||||
|
source: vectorSource
|
||||||
|
});
|
||||||
|
|
||||||
|
vectorLayer.kind = "safehome";
|
||||||
|
|
||||||
|
return vectorLayer;
|
||||||
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
// Manage Map construction
|
// Manage Map construction
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
|
@ -671,7 +777,8 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
var handleShowSafehome = function () {
|
var handleShowSafehome = function () {
|
||||||
$('#MPeditPoint, #missionPlanerTotalInfo','#missionPlanerTemplate', '#missionPlanerSettings').hide();
|
$('#MPeditPoint, #missionPlanerTotalInfo','#missionPlanerTemplate', '#missionPlanerSettings').hide();
|
||||||
$('#missionPlanerSafeHome').fadeIn(300);
|
$('#missionPlanerSafeHome').fadeIn(300);
|
||||||
loadSafehome();
|
renderSafehomesTable();
|
||||||
|
renderSafehomesOnMap(SAFEHOMES);
|
||||||
};
|
};
|
||||||
|
|
||||||
button.addEventListener('click', handleShowSafehome, false);
|
button.addEventListener('click', handleShowSafehome, false);
|
||||||
|
@ -1098,6 +1205,17 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
closeSettingsPanel();
|
closeSettingsPanel();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#saveSafehome').on('click', function () {
|
||||||
|
//settings = { speed: $('#MPdefaultPointSpeed').val(), alt: $('#MPdefaultPointAlt').val() };
|
||||||
|
//saveSettings();
|
||||||
|
//closeSettingsPanel();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#cancelSafehome').on('click', function () {
|
||||||
|
loadSettings();
|
||||||
|
closeSettingsPanel();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// Add function to update parameter i field in the selected Edit WP Box
|
// Add function to update parameter i field in the selected Edit WP Box
|
||||||
$('#pointType').on('change', function () {
|
$('#pointType').on('change', function () {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue