Compare commits
2 commits
da1b181666
...
d73ecc2b20
| Author | SHA1 | Date | |
|---|---|---|---|
| d73ecc2b20 | |||
| 5a4f9e2e20 |
1 changed files with 58 additions and 25 deletions
|
|
@ -22,7 +22,7 @@ class SkyView {
|
||||||
this.heatmapLayer = null;
|
this.heatmapLayer = null;
|
||||||
|
|
||||||
// UI state
|
// UI state
|
||||||
this.currentView = 'map';
|
this.currentView = 'map-view';
|
||||||
this.showTrails = false;
|
this.showTrails = false;
|
||||||
this.showRange = false;
|
this.showRange = false;
|
||||||
this.showSources = true;
|
this.showSources = true;
|
||||||
|
|
@ -70,16 +70,26 @@ class SkyView {
|
||||||
switchView(viewId) {
|
switchView(viewId) {
|
||||||
// Update buttons
|
// Update buttons
|
||||||
document.querySelectorAll('.view-btn').forEach(btn => btn.classList.remove('active'));
|
document.querySelectorAll('.view-btn').forEach(btn => btn.classList.remove('active'));
|
||||||
document.getElementById(`${viewId}-btn`).classList.add('active');
|
const activeBtn = document.getElementById(`${viewId}-btn`);
|
||||||
|
if (activeBtn) {
|
||||||
|
activeBtn.classList.add('active');
|
||||||
|
}
|
||||||
|
|
||||||
// Update views
|
// Update views (viewId already includes the full view ID like "map-view")
|
||||||
document.querySelectorAll('.view').forEach(view => view.classList.remove('active'));
|
document.querySelectorAll('.view').forEach(view => view.classList.remove('active'));
|
||||||
document.getElementById(`${viewId}-view`).classList.add('active');
|
const activeView = document.getElementById(viewId);
|
||||||
|
if (activeView) {
|
||||||
|
activeView.classList.add('active');
|
||||||
|
} else {
|
||||||
|
console.warn(`View element not found: ${viewId}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.currentView = viewId;
|
this.currentView = viewId;
|
||||||
|
|
||||||
// Handle view-specific initialization
|
// Handle view-specific initialization (extract base name for switch)
|
||||||
switch (viewId) {
|
const baseName = viewId.replace('-view', '');
|
||||||
|
switch (baseName) {
|
||||||
case 'coverage':
|
case 'coverage':
|
||||||
this.initializeCoverageMap();
|
this.initializeCoverageMap();
|
||||||
break;
|
break;
|
||||||
|
|
@ -208,7 +218,7 @@ class SkyView {
|
||||||
this.updateStatistics();
|
this.updateStatistics();
|
||||||
this.updateHeaderInfo();
|
this.updateHeaderInfo();
|
||||||
|
|
||||||
if (this.currentView === 'radar3d') {
|
if (this.currentView === 'radar3d-view') {
|
||||||
this.update3DRadar();
|
this.update3DRadar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -333,13 +343,35 @@ class SkyView {
|
||||||
}
|
}
|
||||||
|
|
||||||
updateSourceMarkers() {
|
updateSourceMarkers() {
|
||||||
// Clear existing source markers
|
// Remove markers for sources that no longer exist
|
||||||
this.sourceMarkers.forEach(marker => this.map.removeLayer(marker));
|
const currentSourceIds = new Set(this.sourcesData.keys());
|
||||||
this.sourceMarkers.clear();
|
for (const [id, marker] of this.sourceMarkers) {
|
||||||
|
if (!currentSourceIds.has(id)) {
|
||||||
|
this.map.removeLayer(marker);
|
||||||
|
this.sourceMarkers.delete(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Add source markers
|
// Update or create markers for current sources
|
||||||
for (const [id, source] of this.sourcesData) {
|
for (const [id, source] of this.sourcesData) {
|
||||||
if (source.latitude && source.longitude) {
|
if (source.latitude && source.longitude) {
|
||||||
|
if (this.sourceMarkers.has(id)) {
|
||||||
|
// Update existing marker
|
||||||
|
const marker = this.sourceMarkers.get(id);
|
||||||
|
|
||||||
|
// Update marker style if status changed
|
||||||
|
marker.setStyle({
|
||||||
|
radius: source.active ? 10 : 6,
|
||||||
|
fillColor: source.active ? '#00d4ff' : '#666666',
|
||||||
|
fillOpacity: 0.8
|
||||||
|
});
|
||||||
|
|
||||||
|
// Update popup content if it's open
|
||||||
|
if (marker.isPopupOpen()) {
|
||||||
|
marker.setPopupContent(this.createSourcePopupContent(source));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Create new marker
|
||||||
const marker = L.circleMarker([source.latitude, source.longitude], {
|
const marker = L.circleMarker([source.latitude, source.longitude], {
|
||||||
radius: source.active ? 10 : 6,
|
radius: source.active ? 10 : 6,
|
||||||
fillColor: source.active ? '#00d4ff' : '#666666',
|
fillColor: source.active ? '#00d4ff' : '#666666',
|
||||||
|
|
@ -356,6 +388,7 @@ class SkyView {
|
||||||
this.sourceMarkers.set(id, marker);
|
this.sourceMarkers.set(id, marker);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.updateSourcesLegend();
|
this.updateSourcesLegend();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue