Skip to content

Commit 4e0efa0

Browse files
authored
Merge pull request #814 from SlideRuleEarth/carlos-dev4
Handling the case of no corresponding ATL08 granule for photon cloud …
2 parents 5056fae + 4d94c4b commit 4e0efa0

File tree

3 files changed

+99
-38
lines changed

3 files changed

+99
-38
lines changed

web-client/src/components/SrElevationPlot.vue

Lines changed: 83 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import SrAtl08Colors from '@/components/SrAtl08Colors.vue'
4040
import SrAtl24Colors from './SrAtl24Colors.vue'
4141
import SrCustomTooltip from '@/components/SrCustomTooltip.vue'
4242
import Dialog from 'primevue/dialog'
43+
import Button from 'primevue/button'
4344
import type { AppendToType } from '@/types/SrTypes'
4445
import { processSelectedElPnt } from '@/utils/SrMapUtils'
4546
import SrCycleSelect from '@/components/SrCycleSelect.vue'
@@ -56,6 +57,8 @@ const tooltipRef = ref()
5657
const currentTooltipContent = ref<string>('')
5758
const showContextMenu = ref(false)
5859
const contextMenuPosition = ref({ x: 0, y: 0 })
60+
const showAtl08Dialog = ref(false)
61+
const pendingRunContext = ref<any>(null)
5962
6063
const props = defineProps({
6164
startingReqId: {
@@ -586,6 +589,42 @@ const messageClass = computed(() => {
586589
}
587590
})
588591
592+
async function handleAtl08DialogConfirm() {
593+
if (!pendingRunContext.value) return
594+
595+
const runContext = pendingRunContext.value
596+
const parentReqIdStr = runContext.parentReqId.toString()
597+
598+
await useAutoReqParamsStore().presetForScatterPlotOverlay(runContext.parentReqId)
599+
await processRunSlideRuleClicked(runContext) // worker is started here
600+
601+
if (runContext.reqId > 0) {
602+
const thisReqIdStr = runContext.reqId.toString()
603+
initDataBindingsToChartStore([thisReqIdStr]) //after run gives us a reqId
604+
chartStore.setSavedColorEncodeData(
605+
parentReqIdStr,
606+
chartStore.getSelectedColorEncodeData(parentReqIdStr)
607+
)
608+
chartStore.setSelectedColorEncodeData(parentReqIdStr, 'solid')
609+
await initSymbolSize(runContext.reqId) // for new record
610+
initializeColorEncoding(runContext.reqId, 'atl03x')
611+
} else {
612+
logger.error('watch atlChartFilterStore.showPhotonCloud: processRunSlideRuleClicked failed')
613+
}
614+
615+
const msg = `Click 'Hide Photon Cloud Overlay' to remove highlighted track Photon Cloud data from the plot`
616+
requestsStore.setConsoleMsg(msg)
617+
618+
showAtl08Dialog.value = false
619+
pendingRunContext.value = null
620+
}
621+
622+
function handleAtl08DialogCancel() {
623+
atlChartFilterStore.showPhotonCloud = false
624+
showAtl08Dialog.value = false
625+
pendingRunContext.value = null
626+
}
627+
589628
watch(
590629
() => atlChartFilterStore.showPhotonCloud,
591630
async (newShowPhotonCloud, oldShowPhotonCloud) => {
@@ -604,51 +643,27 @@ watch(
604643
const isAtl03sp = recTreeStore.findApiForReqId(runContext.reqId) === 'atl03sp' //because it is deprecated
605644
if (runContext.reqId <= 0 || isAtl03sp) {
606645
// need to fetch the data because atl03sp is deprecated
607-
//console.log('showPhotonCloud runContext.reqId:', runContext.reqId, ' runContext.parentReqId:', runContext.parentReqId, 'runContext.trackFilter:', runContext.trackFilter);
608-
await useAutoReqParamsStore().presetForScatterPlotOverlay(runContext.parentReqId)
609-
await processRunSlideRuleClicked(runContext) // worker is started here
610-
//console.log('SrElevationPlot watch atlChartFilterStore.showPhotonCloud runContext:',runContext, 'reqId:', runContext.reqId, parentReqIdStr, ' parentFuncStr:', parentFuncStr);
611-
if (runContext.reqId > 0) {
612-
const thisReqIdStr = runContext.reqId.toString()
613-
initDataBindingsToChartStore([thisReqIdStr]) //after run gives us a reqId
614-
chartStore.setSavedColorEncodeData(
615-
parentReqIdStr,
616-
chartStore.getSelectedColorEncodeData(parentReqIdStr)
617-
)
618-
chartStore.setSelectedColorEncodeData(parentReqIdStr, 'solid')
619-
await initSymbolSize(runContext.reqId) // for new record
620-
initializeColorEncoding(runContext.reqId, 'atl03x')
621-
// The worker will now fetch the data from the server
622-
// and write the opfs file then update
623-
// the map selected layer and the chart
624-
} else {
625-
logger.error(
626-
'watch atlChartFilterStore.showPhotonCloud: processRunSlideRuleClicked failed'
627-
)
628-
}
646+
// Show dialog to ask user about ATL08 inclusion
647+
pendingRunContext.value = runContext
648+
showAtl08Dialog.value = true
629649
} else {
630650
// we already have the data
631651
initializeColorEncoding(runContext.reqId, parentFuncStr)
632652
const sced = chartStore.getSelectedColorEncodeData(parentReqIdStr)
633-
//console.log('sced:', sced, ' reqIdStr:', parentReqIdStr);
634653
chartStore.setSavedColorEncodeData(parentReqIdStr, sced)
635654
chartStore.setSelectedColorEncodeData(parentReqIdStr, 'solid')
636655
await prepareDbForReqId(runContext.reqId)
637656
await callPlotUpdateDebounced('from watch atlChartFilterStore.showPhotonCloud TRUE')
657+
const msg = `Click 'Hide Photon Cloud Overlay' to remove highlighted track Photon Cloud data from the plot`
658+
requestsStore.setConsoleMsg(msg)
638659
}
639-
const msg = `Click 'Hide Photon Cloud Overlay' to remove highlighted track Photon Cloud data from the plot`
640-
requestsStore.setConsoleMsg(msg)
641660
} else {
642661
chartStore.setInitLegendUnselected(recTreeStore.selectedReqIdStr, false)
643-
//console.log(`calling chartStore.getSavedColorEncodeData(${recTreeStore.selectedReqIdStr})`)
644662
const sced = chartStore.getSavedColorEncodeData(recTreeStore.selectedReqIdStr)
645-
//console.log(`called chartStore.getSavedColorEncodeData(${recTreeStore.selectedReqIdStr}) sced:${sced}`)
646663
if (sced && sced != 'unset') {
647-
//console.log('Restoring to sced:', sced, ' reqIdStr:', recTreeStore.selectedReqIdStr);
648664
chartStore.setSelectedColorEncodeData(recTreeStore.selectedReqIdStr, sced)
649665
chartStore.setSavedColorEncodeData(recTreeStore.selectedReqIdStr, 'unset')
650666
}
651-
//console.log('SrElevationPlot handlePhotonCloudChange - showPhotonCloud FALSE');
652667
atlChartFilterStore.setSelectedOverlayedReqIds([])
653668
await callPlotUpdateDebounced('from watch atlChartFilterStore.showPhotonCloud FALSE')
654669
}
@@ -951,6 +966,31 @@ watch(
951966
</div>
952967
</div>
953968
</div>
969+
<!-- ATL08 Dialog -->
970+
<Dialog
971+
v-model:visible="showAtl08Dialog"
972+
header="Photon Cloud Options"
973+
:modal="true"
974+
:closable="false"
975+
:style="{ width: '30rem' }"
976+
>
977+
<div class="atl08-dialog-content">
978+
<p>Would you like to include ATL08 classification in the photon cloud overlay?</p>
979+
<div class="atl08-dialog-checkbox">
980+
<Checkbox
981+
v-model="atlChartFilterStore.includeAtl08"
982+
binary
983+
inputId="dialogAtl08Checkbox"
984+
size="small"
985+
/>
986+
<label for="dialogAtl08Checkbox" class="sr-checkbox-label">Include atl08</label>
987+
</div>
988+
</div>
989+
<template #footer>
990+
<Button label="Cancel" text @click="handleAtl08DialogCancel" />
991+
<Button label="Continue" @click="handleAtl08DialogConfirm" />
992+
</template>
993+
</Dialog>
954994
</div>
955995
</template>
956996

@@ -1147,9 +1187,22 @@ watch(
11471187
margin-left: 0rem;
11481188
}
11491189
1190+
.atl08-dialog-content {
1191+
display: flex;
1192+
flex-direction: column;
1193+
gap: 1rem;
1194+
}
1195+
1196+
.atl08-dialog-checkbox {
1197+
display: flex;
1198+
flex-direction: row;
1199+
align-items: center;
1200+
gap: 0.5rem;
1201+
}
1202+
11501203
.sr-checkbox-label {
11511204
margin-left: 0.5rem;
1152-
font-size: 1rem; /* or match your app's font size */
1205+
font-size: 0.875rem;
11531206
cursor: pointer;
11541207
}
11551208

web-client/src/stores/atlChartFilterStore.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export const useAtlChartFilterStore = defineStore('atlChartFilter', {
1818
isWarning: true as boolean,
1919
showMessage: false as boolean,
2020
showPhotonCloud: false as boolean,
21+
includeAtl08: false as boolean, // Include ATL08 classification in photon cloud
2122
xZoomStart: 0 as number,
2223
xZoomEnd: 100 as number,
2324
yZoomStart: 0 as number,

web-client/src/stores/reqParamsStore.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { useSlideruleDefaults } from '@/stores/defaultsStore'
1313
import { useGeoJsonStore } from './geoJsonStore'
1414
import { useChartStore } from '@/stores/chartStore'
1515
import { useRasterParamsStore } from '@/stores/rasterParamsStore'
16+
import { useAtlChartFilterStore } from '@/stores/atlChartFilterStore'
1617
import { createLogger } from '@/utils/logger'
1718

1819
const logger = createLogger('ReqParamsStore')
@@ -285,14 +286,20 @@ const createReqParamsStore = (id: string) =>
285286
this.isAtl24PhotonOverlay = true
286287
} else {
287288
this.enableAtl24Classification = false
288-
this.enableAtl08Classification = true
289-
this.atl08LandType = [
290-
'atl08_noise',
291-
'atl08_ground',
292-
'atl08_canopy',
293-
'atl08_top_of_canopy',
294-
'atl08_unclassified'
295-
]
289+
// Check the includeAtl08 checkbox state
290+
const includeAtl08 = useAtlChartFilterStore().includeAtl08
291+
this.enableAtl08Classification = includeAtl08
292+
if (includeAtl08) {
293+
this.atl08LandType = [
294+
'atl08_noise',
295+
'atl08_ground',
296+
'atl08_canopy',
297+
'atl08_top_of_canopy',
298+
'atl08_unclassified'
299+
]
300+
} else {
301+
this.atl08LandType = []
302+
}
296303
this.useDatum = false
297304
this.isAtl24PhotonOverlay = false
298305
}

0 commit comments

Comments
 (0)