Update map QML/HTML.

This commit is contained in:
srcejon 2024-02-27 16:00:18 +00:00
parent 9506c93c11
commit 5d96a09520
6 changed files with 791 additions and 630 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -303,22 +303,18 @@ Item {
height: text.height + 5
radius: 5
visible: mapTextVisible
Text {
id: text
anchors.centerIn: parent
text: mapText
textFormat: TextEdit.RichText
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
acceptedButtons: Qt.LeftButton | Qt.RightButton
//propagateComposedEvents: true // so links in Text work
onClicked: {
if (mouse.button === Qt.LeftButton) {
selected = !selected
if (selected) {
mapModel.moveToFront(mapModelFiltered.mapRowToSource(index))
}
//mouse.accepted = false // propagate to text
} else if (mouse.button === Qt.RightButton) {
menuItems.clear()
menus.clear()
@ -406,6 +402,17 @@ Item {
}
}
}
// Have Text after MouseArea, so links can be clicked
Text {
id: text
anchors.centerIn: parent
text: mapText
textFormat: TextEdit.RichText
onLinkActivated: {
console.log("Link", link);
mapModel.link(link);
}
}
}
}
}

View File

@ -229,6 +229,10 @@
viewer.screenSpaceEventHandler.setInputAction(pickEntity, Cesium.ScreenSpaceEventType.LEFT_CLICK);
viewer.screenSpaceEventHandler.setInputAction(showCoords, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK, Cesium.KeyboardEventModifier.SHIFT);
viewer.screenSpaceEventHandler.setInputAction(hideCoords, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
viewer.infoBox.frame.setAttribute('sandbox', 'allow-same-origin allow-popups allow-forms allow-scripts allow-top-navigation');
viewer.infoBox.frame.src = "about:blank"; // Force reload so new attributes are applied
var buildings = undefined;
const images = new Map();
@ -289,6 +293,77 @@
viewer.scene.light.direction = Cesium.Cartesian3.clone(scene.camera.directionWC, viewer.scene.light.direction);
}
// Image overlays
function dataCallback(interval, index) {
let time;
//console.log("Interval: " + interval + " start:" + interval.start + " stop:" + interval.stop + " index: " + index);
if (index === 0) {
// leading
time = Cesium.JulianDate.toIso8601(interval.stop);
} else {
time = Cesium.JulianDate.toIso8601(interval.start);
}
//console.log("Returning time: " + time);
return {
Time: time,
};
}
const times = Cesium.TimeIntervalCollection.fromIso8601({
iso8601: "2015-07-30/2017-06-16/P1D", // P1D = 1 day
leadingInterval: true,
trailingInterval: true,
isStopIncluded: false,
dataCallback: dataCallback,
});
// See https://wiki.earthdata.nasa.gov/display/GIBS/GIBS+API+for+Developers#GIBSAPIforDevelopers-OGCWebMapService(WMS)
var gibsProvider = new Cesium.WebMapTileServiceImageryProvider({
url: "https://gibs.earthdata.nasa.gov/wmts/epsg4326/best/MODIS_Terra_CorrectedReflectance_TrueColor/default/{Time}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpg",
style: "default",
tileMatrixSetID: "250m",
format: "image/jpeg",
clock: viewer.clock,
times: times
});
const seaMarksProvider = new Cesium.UrlTemplateImageryProvider({
url: "https://tiles.openseamap.org/seamark/{z}/{x}/{y}.png"
});
const railwaysProvider = new Cesium.UrlTemplateImageryProvider({
url: "https://a.tiles.openrailwaymap.org/standard/{z}/{x}/{y}.png"
});
var rainProvider = new Cesium.UrlTemplateImageryProvider({
url: "https://tilecache.rainviewer.com/v2/radar/0000000000/256/{z}/{x}/{y}/4/1_1.png"
});
var cloudProvider = new Cesium.UrlTemplateImageryProvider({
url: "https://tilecache.rainviewer.com/v2/satellite/0000000000/256/{z}/{x}/{y}/0/0_0.png"
});
var gibsLayer = new Cesium.ImageryLayer(gibsProvider);
gibsLayer.show = false;
viewer.imageryLayers.add(gibsLayer);
var cloudLayer = new Cesium.ImageryLayer(cloudProvider);
cloudLayer.show = false;
viewer.imageryLayers.add(cloudLayer);
var rainLayer = new Cesium.ImageryLayer(rainProvider);
rainLayer.show = false;
viewer.imageryLayers.add(rainLayer);
const seaMarksLayer = new Cesium.ImageryLayer(seaMarksProvider);
seaMarksLayer.show = false;
viewer.imageryLayers.add(seaMarksLayer);
const railwaysLayer = new Cesium.ImageryLayer(railwaysProvider);
railwaysLayer.show = false;
viewer.imageryLayers.add(railwaysLayer);
const layers = new Map([
["nasaGlobalImagery", gibsLayer],
["clouds", cloudLayer],
["rain", rainLayer],
["seaMarks", seaMarksLayer],
["railways", railwaysLayer]
]);
// Use WebSockets for handling commands from MapPlugin
// (CZML doesn't support camera control, for example)
// and sending events back to it
@ -374,7 +449,7 @@
viewer.scene.globe.nightFadeOutDistance = 0.0;
if (!command.useSunLight) {
viewer.scene.light = new Cesium.DirectionalLight({
direction : new Cesium.Cartesian3(1, 0, 0)
direction: new Cesium.Cartesian3(1, 0, 0)
});
viewer.scene.preRender.addEventListener(cameraLight);
} else {
@ -402,9 +477,9 @@
viewer.dataSources.add(
Cesium.GeoJsonDataSource.load(
"muf.geojson",
{describe: describeMUF}
{ describe: describeMUF }
)
).then(function(dataSource) {mufGeoJSONStream = dataSource; });
).then(function (dataSource) { mufGeoJSONStream = dataSource; });
}
} else if (command.command == "showfoF2") {
if (foF2GeoJSONStream != null) {
@ -415,9 +490,81 @@
viewer.dataSources.add(
Cesium.GeoJsonDataSource.load(
"fof2.geojson",
{describe: describefoF2}
{ describe: describefoF2 }
)
).then(function(dataSource) {foF2GeoJSONStream = dataSource; });
).then(function (dataSource) { foF2GeoJSONStream = dataSource; });
}
} else if (command.command == "showLayer") {
layers.get(command.layer).show = command.show;
} else if (command.command == "setLayerSettings") {
if (command.layer == "NASAGlobalImagery") {
if ('url' in command) {
console.log("Using URL: " + command.url + " format: " + command.format + " matrixSet: " + command.tileMatrixSet + " dates:" + command.dates + " length: " + command.dates.length + " typeof: " + typeof(command.dates));
viewer.imageryLayers.remove(gibsLayer, true);
const times = Cesium.TimeIntervalCollection.fromIso8601({
iso8601: command.dates[0],
leadingInterval: true,
trailingInterval: true,
isStopIncluded: false,
dataCallback: dataCallback,
});
for (let i = 1; i < command.dates.length; i++) {
const times2 = Cesium.TimeIntervalCollection.fromIso8601({
iso8601: command.dates[i],
leadingInterval: true,
trailingInterval: true,
isStopIncluded: false,
dataCallback: dataCallback,
});
times.removeInterval(times.get(times.length - 1)); // Remove element that goes to end of time
for (let i = 1; i < times2.length; i++) {
times.addInterval(times2.get(i));
}
}
gibsProvider = new Cesium.WebMapTileServiceImageryProvider({
url: command.url,
style: "default",
tileMatrixSetID: command.tileMatrixSet,
format: command.format,
clock: viewer.clock,
times: times
});
gibsLayer = new Cesium.ImageryLayer(gibsProvider);
gibsLayer.alpha = 0.5;
gibsLayer.show = command.show;
viewer.imageryLayers.add(gibsLayer);
layers.set(command.layer, gibsLayer);
}
if ('opacity' in command) {
gibsLayer.alpha = command.opacity / 100.0;
}
} else if (command.layer == "clouds") {
viewer.imageryLayers.remove(cloudLayer, true);
cloudProvider = new Cesium.UrlTemplateImageryProvider({
url: "https://tilecache.rainviewer.com/" + command.path + "/256/{z}/{x}/{y}/0/0_0.png"
});
cloudLayer = new Cesium.ImageryLayer(cloudProvider);
cloudLayer.show = command.show;
viewer.imageryLayers.add(cloudLayer);
layers.set(command.layer, cloudLayer);
} else if (command.layer == "rain") {
viewer.imageryLayers.remove(rainLayer, true);
rainProvider = new Cesium.UrlTemplateImageryProvider({
url: "https://tilecache.rainviewer.com/" + command.path + "/256/{z}/{x}/{y}/4/1_1.png"
});
rainLayer = new Cesium.ImageryLayer(rainProvider);
rainLayer.show = command.show;
viewer.imageryLayers.add(rainLayer);
layers.set(command.layer, rainLayer);
} else {
console.log("Unknown layer: " + command.layer);
}
} else if (command.command == "updateImage") {
@ -600,6 +747,12 @@
}
};
// Can be called by onclick handler in anchors in the infobox, to pass a URL to SDRangel
function infoboxLink(url) {
socket.send(JSON.stringify({ event: "link", url: url }));
return false;
}
Cesium.knockout.getObservable(viewer.clockViewModel, 'shouldAnimate').subscribe(function(isAnimating) {
reportClock();
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -9,7 +9,7 @@ On top of this, it can plot data from other plugins, such as:
* Aircraft from the ADS-B Demodulator,
* Ships from the AIS Demodulator,
* Satellites from the Satellite Tracker,
* Weather imagery from APT Demodulator,
* Satellite imagery from APT Demodulator,
* The Sun, Moon and Stars from the Star Tracker,
* Weather balloons from the Radiosonde feature,
* RF Heat Maps from the Heap Map channel,
@ -28,6 +28,7 @@ As well as internet data sources:
* Navtex transmitters,
* VLF transmitters,
* KiwiSDRs,
* Spy Servers,
* Weather radar,
* Satellite infra-red data (clouds),
* Sea marks,