mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 17:52:21 +00:00
Merge origin/main into the renderer-contract branch: the procedural fleet models drawn through the renderer's model sets
Aircraft, military, local ADS-B, vessel, transit and rail models come from the fleet model set, loaded up front and drawn life size through the draw port's models sets; no layer touches the viewer or Cesium outside src/render/cesium/. The models capability gains glTF bytes (gltf), a per-axis stretch (axisScale), a colour for tinted parts (maskColor) and a cut below the origin (clip: 'belowOrigin'), with conformance checks. Main's rail layer and Data Library are ported to the ports; the CCTV footprint probe keeps the globe-terrain clamp through the query port.
This commit is contained in:
commit
e3865f462f
533 files changed
+55738
-2518
No files matched your search
@@ -56,6 +56,7 @@ import {
|
||||
countryGroups,
|
||||
countryOnly,
|
||||
disputedLabel,
|
||||
eventPicture,
|
||||
feedCardView,
|
||||
feedQueryFor,
|
||||
hotspotLabel,
|
||||
@@ -71,6 +72,7 @@ import {
|
||||
normalizeFilters,
|
||||
passesFilters,
|
||||
reportMarkerPosition,
|
||||
reportSeverity,
|
||||
reportsInView,
|
||||
severityStyle,
|
||||
shortTitle,
|
||||
@@ -186,6 +188,14 @@ const emptyInView = () => ({
|
||||
* chosen: outlines (disputed areas dotted) and the geocoded reports as
|
||||
* markers, the big events as picture cards. The News panel renders the feed
|
||||
* this layer publishes through getRowControls().feed.
|
||||
*
|
||||
* `pictureCards(cards, { selectedId })`, when given, draws the picture cards
|
||||
* instead of the layer: it is called on every render with one card per
|
||||
* pictured event on the map, at every height (zoomed out too, where the
|
||||
* hotspots stand as beacons), in rank order (`{ id, title, lat, lon,
|
||||
* publishedAt, severity, color, image, video, credit }`), and the selected
|
||||
* report's id or null, whose own card the layer still draws at its marker; it
|
||||
* is called with no cards when the layer is turned off.
|
||||
*/
|
||||
export function createNewsLayer({
|
||||
source,
|
||||
@@ -197,6 +207,7 @@ export function createNewsLayer({
|
||||
openUrl = (url) => globalThis.open?.(url, '_blank', 'noopener,noreferrer'),
|
||||
getViewCentre = viewCentre,
|
||||
registerCredit = registerDynamicCredit,
|
||||
pictureCards: drawPictureCards = null,
|
||||
} = {}) {
|
||||
if (
|
||||
typeof source?.getHotspots !== 'function' ||
|
||||
@@ -204,6 +215,8 @@ export function createNewsLayer({
|
||||
)
|
||||
throw new TypeError('News requires a news source');
|
||||
if (!overlayHost) throw new TypeError('News requires an overlay host');
|
||||
if (drawPictureCards !== null && typeof drawPictureCards !== 'function')
|
||||
throw new TypeError('News picture cards must be a function');
|
||||
|
||||
let viewer = null,
|
||||
// The layer's draw sets (`sets.icons` and the rest), made on init.
|
||||
@@ -742,6 +755,53 @@ export function createNewsLayer({
|
||||
}
|
||||
}
|
||||
|
||||
// What a host's picture cards are chosen from when the hotspots stand as
|
||||
// beacons: every report the close-up view would mark, and the selection.
|
||||
function cardable() {
|
||||
const current = selected();
|
||||
const all = localMode() ? localReports(NEWS_MAP_LIMIT) : mapReports;
|
||||
return current && !all.some((r) => r.id === current.id)
|
||||
? [...all, current]
|
||||
: all;
|
||||
}
|
||||
|
||||
// With a `pictureCards` function the host draws the picture cards: one per
|
||||
// event on the map with a picture (its most severe, then newest report),
|
||||
// most severe then newest first, at its marker. The host chooses which
|
||||
// stand; a click on one calls setParams({ reportId, focus: true }).
|
||||
function hostCards(drawn) {
|
||||
const events = new Set();
|
||||
return drawn
|
||||
.filter((r) => r.pins.length && onMap(r) && eventPicture(r))
|
||||
.sort(
|
||||
(a, b) =>
|
||||
reportSeverity(b) - reportSeverity(a) ||
|
||||
(b.event?.lastAt || b.publishedAt || '').localeCompare(
|
||||
a.event?.lastAt || a.publishedAt || '',
|
||||
),
|
||||
)
|
||||
.filter((report) => {
|
||||
const event = report.event?.id || report.id;
|
||||
if (events.has(event)) return false;
|
||||
events.add(event);
|
||||
return true;
|
||||
})
|
||||
.map((report) => {
|
||||
const picture = eventPicture(report);
|
||||
return {
|
||||
id: report.id,
|
||||
title: report.titleEn || report.title,
|
||||
...reportMarkerPosition(report, 0),
|
||||
publishedAt: report.event?.lastAt || report.publishedAt || null,
|
||||
severity: reportSeverity(report),
|
||||
color: severityStyle(report).color,
|
||||
image: picture.url,
|
||||
video: picture.video || null,
|
||||
credit: picture.credit,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
// The selected report's card: what, where, how attested, the link to the
|
||||
// original article ("Source: host ↗"), which a click on it opens, and the
|
||||
// service it came through.
|
||||
@@ -822,7 +882,13 @@ export function createNewsLayer({
|
||||
for (const kind of ['halos', 'points', 'icons', 'boxes'])
|
||||
sets[kind].set(list[kind]);
|
||||
updatePulse();
|
||||
pictureCards(drawn, current, labels);
|
||||
if (drawPictureCards)
|
||||
// At every height: zoomed out, a hotspot's reports give way to its
|
||||
// beacon, but their pictures still stand (the host keeps them apart).
|
||||
drawPictureCards(enabled ? hostCards(detail ? drawn : cardable()) : [], {
|
||||
selectedId: enabled ? selectedId : null,
|
||||
});
|
||||
else pictureCards(drawn, current, labels);
|
||||
selectedCard(current, labels);
|
||||
if (enabled)
|
||||
overlayHost.setEntries(NEWS_OVERLAY_SOURCE_ID, labels, { moving: false });
|
||||
@@ -1524,6 +1590,7 @@ export function createNewsLayer({
|
||||
}
|
||||
overlayHost.clearSource(NEWS_OVERLAY_SOURCE_ID);
|
||||
overlayHost.setVisible(NEWS_OVERLAY_SOURCE_ID, false);
|
||||
drawPictureCards?.([], { selectedId: null });
|
||||
requestRender();
|
||||
notify();
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user