\
\
\
' + layer_name + ' \
- \
+ \
\
\
Save \
@@ -1733,8 +1733,8 @@ TABS.mission_control.initialize = function (callback) {
button.style = 'background: url(\'./images/CF_template_white.svg\') no-repeat 1px -1px;background-color: rgba(0,60,136,.5);';
var handleShowSettings = function () {
- $('#layerVisibilitySelect').fadeIn(300);
updateLayerVisibilitySelectOptions();
+ $('#layerVisibilitySelect').fadeIn(300);
};
button.addEventListener('click', handleShowSettings, false);
From 3d0c602edbc9e2fdbb737d2a46eb1170cdd8051a Mon Sep 17 00:00:00 2001
From: Paul Fornage
Date: Wed, 7 Aug 2024 13:19:26 -0700
Subject: [PATCH 28/35] working on fixing info display
---
tabs/mission_control.js | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/tabs/mission_control.js b/tabs/mission_control.js
index 6721633f7..b7c53943b 100644
--- a/tabs/mission_control.js
+++ b/tabs/mission_control.js
@@ -2125,7 +2125,7 @@ TABS.mission_control.initialize = function (callback) {
});
vectorLayer.set("no_interaction", saved_layer.no_interaction, true); // stops custom dragging controls for waypoints from preventing the user panning the map
- vectorLayer.set("show_info_on_hover", saved_layer.show_info_on_hover, true); // allows info box to work with this feature
+ vectorLayer.set("show_info_on_hover", saved_layer.show_info_on_hover); // allows info box to work with this feature
vectorLayer.set("is_vis_toggleable", saved_layer.is_vis_toggleable, true); // allows user to hide this layer in visibility selector
vectorLayer.set("name", saved_layer.name, true); // name for visibility toggler
map.addLayer(vectorLayer);
@@ -2173,10 +2173,10 @@ TABS.mission_control.initialize = function (callback) {
let temp_layer = new ol.layer.Vector({
source: vectorSource,
});
- temp_layer.set("no_interaction", true, true); // stops custom dragging controls for waypoints from preventing the user panning the map
- temp_layer.set("show_info_on_hover", true, true); // allows info box to work with this feature
- temp_layer.set("is_vis_toggleable", true, true); // allows user to hide this layer in visibility selector
- temp_layer.set("name", file_name, true); // name for visibility toggler
+ temp_layer.set("no_interaction", true); // stops custom dragging controls for waypoints from preventing the user panning the map
+ temp_layer.set("show_info_on_hover", true); // allows info box to work with this feature
+ temp_layer.set("is_vis_toggleable", true); // allows user to hide this layer in visibility selector
+ temp_layer.set("name", file_name); // name for visibility toggler
map.addLayer(temp_layer);
updateLayerVisibilitySelectOptions();
});
@@ -2191,7 +2191,7 @@ TABS.mission_control.initialize = function (callback) {
*/
const displayFeatureInfo = function (pixel) {
const features = [];
- map.forEachFeatureAtPixel(pixel, function (feature) {
+ map.forEachFeatureAtPixel(pixel, function (feature) { //TODO: This does not include the features I actually want
if (feature.get('show_info_on_hover') === true){
features.push(feature);
}
From d67cb62c07f549cc5b69ee40558e81aa0b26691a Mon Sep 17 00:00:00 2001
From: Paul Fornage
Date: Wed, 7 Aug 2024 13:55:31 -0700
Subject: [PATCH 29/35] fixed info display for features
---
tabs/mission_control.js | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/tabs/mission_control.js b/tabs/mission_control.js
index b7c53943b..f6e29ec8e 100644
--- a/tabs/mission_control.js
+++ b/tabs/mission_control.js
@@ -1450,11 +1450,13 @@ TABS.mission_control.initialize = function (callback) {
' + layer_name + ' \
\
\
-
\
-
';
@@ -2119,6 +2121,10 @@ TABS.mission_control.initialize = function (callback) {
format: new ol.format.GeoJSON()
});
+ vectorSource.forEachFeature(function (temp_feature) {
+ temp_feature.set("show_info_on_hover", saved_layer.show_info_on_hover);
+ });
+
var vectorLayer = new ol.layer.Vector({
title: saved_layer.name,
source: vectorSource
@@ -2167,6 +2173,11 @@ TABS.mission_control.initialize = function (callback) {
const vectorSource = new ol.source.Vector({
features: event.features,
});
+
+ vectorSource.forEachFeature(function (temp_feature) {
+ temp_feature.set("show_info_on_hover", true);
+ });
+
let file_name = event.file.name;
GUI.log("adding file to map: " + file_name);
From 9f55d34fd4f391279921c3dfee36e1552b4c45fc Mon Sep 17 00:00:00 2001
From: Paul Fornage <36117326+paulwrath1223@users.noreply.github.com>
Date: Wed, 7 Aug 2024 20:21:22 -0700
Subject: [PATCH 30/35] cleaning
---
tabs/mission_control.js | 75 +++++++++++++++--------------------------
1 file changed, 28 insertions(+), 47 deletions(-)
diff --git a/tabs/mission_control.js b/tabs/mission_control.js
index f6e29ec8e..557bd7b20 100644
--- a/tabs/mission_control.js
+++ b/tabs/mission_control.js
@@ -2109,7 +2109,6 @@ TABS.mission_control.initialize = function (callback) {
}
- // store.set("custom_overlay_list", [])
for(let saved_layer of store.get("custom_overlay_list")){
console.log("found saved layer: ");
console.log(saved_layer.name);
@@ -2125,7 +2124,7 @@ TABS.mission_control.initialize = function (callback) {
temp_feature.set("show_info_on_hover", saved_layer.show_info_on_hover);
});
- var vectorLayer = new ol.layer.Vector({
+ const vectorLayer = new ol.layer.Vector({
title: saved_layer.name,
source: vectorSource
});
@@ -2143,57 +2142,39 @@ TABS.mission_control.initialize = function (callback) {
// Add drag and drop support for GEO files
//////////////////////////////////////////////////////////////////////////////////////////////
- // write file
-
- // read file
- // const path = app.getPath("userData")
- // fs.readFile(path, {encoding: 'utf-8'}, (err,data)=> {
- // if (err)return null
- // updateGlobalStore(JSON.parse(data))
- // })
-
-
- let dragAndDropInteraction;
-
- function setInteraction() {
- if (dragAndDropInteraction) {
- map.removeInteraction(dragAndDropInteraction);
- }
- dragAndDropInteraction = new ol.interaction.DragAndDrop({
- formatConstructors: [
- ol.format.GPX,
- ol.format.GeoJSON,
- ol.format.IGC,
- ol.format.KML,
- ol.format.TopoJSON,
- ],
+ let dragAndDropInteraction = new ol.interaction.DragAndDrop({
+ formatConstructors: [
+ ol.format.GPX,
+ ol.format.GeoJSON,
+ ol.format.IGC,
+ ol.format.KML,
+ ol.format.TopoJSON,
+ ],
+ });
+ dragAndDropInteraction.on('addfeatures', function (event) {
+ const vectorSource = new ol.source.Vector({
+ features: event.features,
});
- dragAndDropInteraction.on('addfeatures', function (event) {
- const vectorSource = new ol.source.Vector({
- features: event.features,
- });
- vectorSource.forEachFeature(function (temp_feature) {
- temp_feature.set("show_info_on_hover", true);
- });
+ vectorSource.forEachFeature(function (temp_feature) {
+ temp_feature.set("show_info_on_hover", true);
+ });
- let file_name = event.file.name;
- GUI.log("adding file to map: " + file_name);
+ let file_name = event.file.name;
+ GUI.log("adding file to map: " + file_name);
- let temp_layer = new ol.layer.Vector({
- source: vectorSource,
- });
- temp_layer.set("no_interaction", true); // stops custom dragging controls for waypoints from preventing the user panning the map
- temp_layer.set("show_info_on_hover", true); // allows info box to work with this feature
- temp_layer.set("is_vis_toggleable", true); // allows user to hide this layer in visibility selector
- temp_layer.set("name", file_name); // name for visibility toggler
- map.addLayer(temp_layer);
- updateLayerVisibilitySelectOptions();
+ let temp_layer = new ol.layer.Vector({
+ source: vectorSource,
});
- map.addInteraction(dragAndDropInteraction);
- }
- setInteraction();
+ temp_layer.set("no_interaction", true); // stops custom dragging controls for waypoints from preventing the user panning the map
+ temp_layer.set("show_info_on_hover", true); // allows info box to work with this feature
+ temp_layer.set("is_vis_toggleable", true); // allows user to hide this layer in visibility selector
+ temp_layer.set("name", file_name); // name for visibility toggler
+ map.addLayer(temp_layer);
+ updateLayerVisibilitySelectOptions();
+ });
+ map.addInteraction(dragAndDropInteraction);
/**
From 5792d161c74fcca5edab20dec641ad829e6d59fc Mon Sep 17 00:00:00 2001
From: Paul Fornage <36117326+paulwrath1223@users.noreply.github.com>
Date: Wed, 7 Aug 2024 23:01:02 -0700
Subject: [PATCH 31/35] cleaning
---
tabs/mission_control.js | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/tabs/mission_control.js b/tabs/mission_control.js
index 557bd7b20..1e5379cb6 100644
--- a/tabs/mission_control.js
+++ b/tabs/mission_control.js
@@ -1732,7 +1732,7 @@ TABS.mission_control.initialize = function (callback) {
var button = document.createElement('button');
button.innerHTML = ' ';
- button.style = 'background: url(\'./images/CF_template_white.svg\') no-repeat 1px -1px;background-color: rgba(0,60,136,.5);';
+ button.style = 'background: url(\'./images/icons/cf_icon_gps_white.svg\') no-repeat 1px -1px;background-color: rgba(0,60,136,.5);';
var handleShowSettings = function () {
updateLayerVisibilitySelectOptions();
@@ -1870,7 +1870,7 @@ TABS.mission_control.initialize = function (callback) {
var feature = map.forEachFeatureAtPixel(evt.pixel,
function (feature, layer) {
- if(layer.get("no_interaction") != true){
+ if(layer.get("no_interaction") !== true){
return feature;
}
// for features from layers that have this set to true, ignore their existence.
@@ -2108,11 +2108,7 @@ TABS.mission_control.initialize = function (callback) {
store.set("custom_overlay_list", []);
}
-
for(let saved_layer of store.get("custom_overlay_list")){
- console.log("found saved layer: ");
- console.log(saved_layer.name);
-
let features = (new ol.format.GeoJSON()).readFeatures(saved_layer.layer_data);
var vectorSource = new ol.source.Vector({
@@ -2132,7 +2128,8 @@ TABS.mission_control.initialize = function (callback) {
vectorLayer.set("no_interaction", saved_layer.no_interaction, true); // stops custom dragging controls for waypoints from preventing the user panning the map
vectorLayer.set("show_info_on_hover", saved_layer.show_info_on_hover); // allows info box to work with this feature
vectorLayer.set("is_vis_toggleable", saved_layer.is_vis_toggleable, true); // allows user to hide this layer in visibility selector
- vectorLayer.set("name", saved_layer.name, true); // name for visibility toggler
+ vectorLayer.set("name", saved_layer.name, true); // name for visibility toggle
+
map.addLayer(vectorLayer);
}
@@ -2183,7 +2180,7 @@ TABS.mission_control.initialize = function (callback) {
*/
const displayFeatureInfo = function (pixel) {
const features = [];
- map.forEachFeatureAtPixel(pixel, function (feature) { //TODO: This does not include the features I actually want
+ map.forEachFeatureAtPixel(pixel, function (feature) {
if (feature.get('show_info_on_hover') === true){
features.push(feature);
}
From 78f383b22337a77cdd3679295d9e2b63aaa10a62 Mon Sep 17 00:00:00 2001
From: Paul Fornage
Date: Thu, 8 Aug 2024 11:33:59 -0700
Subject: [PATCH 32/35] cleaning and commenting
---
tabs/mission_control.js | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/tabs/mission_control.js b/tabs/mission_control.js
index 1e5379cb6..c2d617f51 100644
--- a/tabs/mission_control.js
+++ b/tabs/mission_control.js
@@ -1437,9 +1437,7 @@ TABS.mission_control.initialize = function (callback) {
map.getLayers().forEach(layer => {
if (layer.get("is_vis_toggleable") === true) {
let layer_name = layer.get("name");
- let is_visible = !!layer.getVisible();
- GUI.log("adding to options: " + layer_name);
- GUI.log("is visible? " + (is_visible ? "true" : "false"));
+ let is_visible = layer.getVisible();
let element_id = "layerVisOption_" + layer_name;
@@ -1463,7 +1461,6 @@ TABS.mission_control.initialize = function (callback) {
$('#layerSelectContent').append(element_str);
let element = document.getElementById(element_id);
element.addEventListener("change", function () {
- GUI.log("setting visibility of layer: " + layer_name + " to " + (element.checked ? "true" : "false"));
layer.setVisible(element.checked);
});
let save_element = document.getElementById(element_id + "_Save");
@@ -2117,7 +2114,7 @@ TABS.mission_control.initialize = function (callback) {
});
vectorSource.forEachFeature(function (temp_feature) {
- temp_feature.set("show_info_on_hover", saved_layer.show_info_on_hover);
+ temp_feature.set("show_info_on_hover", saved_layer.show_info_on_hover); // `show info on hover` is saved to the layer, but is read per feature.
});
const vectorLayer = new ol.layer.Vector({
From c92e51895aa20d79a439b4a57f0c1ac32a0a74ed Mon Sep 17 00:00:00 2001
From: Paul Fornage <36117326+paulwrath1223@users.noreply.github.com>
Date: Thu, 8 Aug 2024 12:34:26 -0700
Subject: [PATCH 33/35] undid debugging stuff
---
js/main.js | 2 --
1 file changed, 2 deletions(-)
diff --git a/js/main.js b/js/main.js
index de5e40dd9..b62bdd6b1 100644
--- a/js/main.js
+++ b/js/main.js
@@ -76,8 +76,6 @@ function createWindow() {
},
});
- mainWindow.webContents.openDevTools();
-
mainWindow.webContents.on('context-menu', (_, props) => {
const menu = new Menu() ;
menu.append(new MenuItem({ label: "Undo", role: "undo", accelerator: 'CmdOrCtrl+Z', visible: props.isEditable }));
From ce803988061dc6c5cf6234c92092356f8eee7179 Mon Sep 17 00:00:00 2001
From: Paul Fornage <36117326+paulwrath1223@users.noreply.github.com>
Date: Thu, 8 Aug 2024 12:46:07 -0700
Subject: [PATCH 34/35] cleaning and commenting
---
tabs/mission_control.js | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/tabs/mission_control.js b/tabs/mission_control.js
index c2d617f51..edcbed7b4 100644
--- a/tabs/mission_control.js
+++ b/tabs/mission_control.js
@@ -1435,7 +1435,7 @@ TABS.mission_control.initialize = function (callback) {
$('#layerSelectContent').empty();
map.getLayers().forEach(layer => {
- if (layer.get("is_vis_toggleable") === true) {
+ if (layer.get("is_vis_toggleable") === true) { // for every layer that has `is_vis_toggleable` set to true:
let layer_name = layer.get("name");
let is_visible = layer.getVisible();
@@ -1460,7 +1460,7 @@ TABS.mission_control.initialize = function (callback) {
$('#layerSelectContent').append(element_str);
let element = document.getElementById(element_id);
- element.addEventListener("change", function () {
+ element.addEventListener("change", function () { // when the switch is toggled, update the layer's visibility on the map to reflect the state of the switch
layer.setVisible(element.checked);
});
let save_element = document.getElementById(element_id + "_Save");
@@ -1488,7 +1488,7 @@ TABS.mission_control.initialize = function (callback) {
}
var writer = new ol.format.GeoJSON();
- let geojsonStr = writer.writeFeatures(layer.getSource().getFeatures());
+ let geojsonStr = writer.writeFeatures(layer.getSource().getFeatures()); // save the features of the custom layer in a GEOJSON format
let name = layer.get("name");
@@ -1498,7 +1498,7 @@ TABS.mission_control.initialize = function (callback) {
show_info_on_hover: layer.get("show_info_on_hover"),
is_vis_toggleable: layer.get("is_vis_toggleable"),
layer_data: geojsonStr
- }
+ } // wrap the feature data with some extra info
custom_overlay_list.push(saved_layer);
@@ -1720,6 +1720,7 @@ TABS.mission_control.initialize = function (callback) {
ol.inherits(app.PlannerSettingsControl, ol.control.Control);
/**
+ * Responsible for adding the button that brings up the custom layer menu
* @constructor
* @extends {ol.control.Control}
* @param {Object=} opt_options Control options.
@@ -2101,7 +2102,7 @@ TABS.mission_control.initialize = function (callback) {
// Add previously saved GEO files
//////////////////////////////////////////////////////////////////////////////////////////////
- if(store.get("custom_overlay_list") === undefined) {
+ if(store.get("custom_overlay_list") === undefined) { // For new installations, add this to electron store
store.set("custom_overlay_list", []);
}
@@ -2152,7 +2153,7 @@ TABS.mission_control.initialize = function (callback) {
});
vectorSource.forEachFeature(function (temp_feature) {
- temp_feature.set("show_info_on_hover", true);
+ temp_feature.set("show_info_on_hover", true); // This tag is read per feature, but is also stored on the layer
});
let file_name = event.file.name;
@@ -2166,13 +2167,15 @@ TABS.mission_control.initialize = function (callback) {
temp_layer.set("is_vis_toggleable", true); // allows user to hide this layer in visibility selector
temp_layer.set("name", file_name); // name for visibility toggler
map.addLayer(temp_layer);
- updateLayerVisibilitySelectOptions();
+ updateLayerVisibilitySelectOptions(); // add the new layer to the list of layers in the menu
});
map.addInteraction(dragAndDropInteraction);
/**
- * Populates info box with names of all features marked to display info that the mouse is over
+ * Populates info box with names of all features marked to display info that the mouse is over.
+ *
+ * Lets you identify flight zones and such
* @param pixel the pixel the mouse is over
*/
const displayFeatureInfo = function (pixel) {
From 35e4f42df107b50cf966ed36335eb4e803c1e157 Mon Sep 17 00:00:00 2001
From: Paul Fornage <36117326+paulwrath1223@users.noreply.github.com>
Date: Thu, 8 Aug 2024 13:05:44 -0700
Subject: [PATCH 35/35] undid accidental change
---
package-lock.json | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 9beb6f04d..6517935ad 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -39,7 +39,6 @@
"@electron-forge/maker-rpm": "^7.2.0",
"@electron-forge/maker-wix": "^7.2.0",
"@electron-forge/maker-zip": "^7.2.0",
- "@electron/packager": "^18.3.3",
"electron": "28.1.4",
"node-gyp": "^10.1.0"
}
@@ -536,11 +535,10 @@
}
},
"node_modules/@electron/packager": {
- "version": "18.3.3",
- "resolved": "https://registry.npmjs.org/@electron/packager/-/packager-18.3.3.tgz",
- "integrity": "sha512-hGXzwbUdxv49XvlYwlVPC6W6j6WaXUAzKkYyyTeiwdhxvHFMfQSEJxVHsQpqMFzZZ7wrr7iqiokOFZ/qkgEzUQ==",
+ "version": "18.3.2",
+ "resolved": "https://registry.npmjs.org/@electron/packager/-/packager-18.3.2.tgz",
+ "integrity": "sha512-orjylavppgIh24qkNpWm2B/LQUpCS/YLOoKoU+eMK/hJgIhShLDsusPIQzgUGVwNCichu8/zPAGfdQZXHG0gtw==",
"dev": true,
- "license": "BSD-2-Clause",
"dependencies": {
"@electron/asar": "^3.2.1",
"@electron/get": "^3.0.0",
@@ -9651,4 +9649,4 @@
}
}
}
-}
+}
\ No newline at end of file