Constrain selections to active work areas
This commit is contained in:
@@ -28,6 +28,7 @@ import { useMapSelectionQa } from './hooks/useMapSelectionQa'
|
||||
import { useMapWorkspaceState } from './hooks/useMapWorkspaceState'
|
||||
import { useMapSelectionExtract } from './hooks/useMapSelectionExtract'
|
||||
import { useMapOrthophotoAnalysis } from './hooks/useMapOrthophotoAnalysis'
|
||||
import { isDetectionImageryDataset } from './lib/datasetCapabilities'
|
||||
import { useProviderCapabilities } from './hooks/useProviderCapabilities'
|
||||
import { useProjectWorkspace } from './hooks/useProjectWorkspace'
|
||||
import { useQualityWorkflow } from './hooks/useQualityWorkflow'
|
||||
@@ -211,6 +212,10 @@ function App(): JSX.Element {
|
||||
[availableVectorDatasets],
|
||||
)
|
||||
const rasterDatasets = useMemo(() => datasets.filter((item) => item.dataset_type === 'raster'), [datasets])
|
||||
const detectionRasterDatasets = useMemo(
|
||||
() => rasterDatasets.filter(isDetectionImageryDataset),
|
||||
[rasterDatasets],
|
||||
)
|
||||
const {
|
||||
providers,
|
||||
loadingCapabilities,
|
||||
@@ -317,14 +322,14 @@ function App(): JSX.Element {
|
||||
setCalibrationThresholdText,
|
||||
} = useDetectionWorkflow({
|
||||
selectedProjectId,
|
||||
rasterDatasets,
|
||||
rasterDatasets: detectionRasterDatasets,
|
||||
qaIouThreshold,
|
||||
loadProjectData,
|
||||
loadQualityChecks,
|
||||
})
|
||||
const useRasterTileManifestForDetection = () => {
|
||||
const manifestPath = latestRasterTileManifestPath.trim()
|
||||
if (!manifestPath || !selectedDataset || selectedDataset.dataset_type !== 'raster') {
|
||||
if (!manifestPath || !selectedDataset || !isDetectionImageryDataset(selectedDataset)) {
|
||||
return
|
||||
}
|
||||
setDetectionTileManifestPath(manifestPath)
|
||||
@@ -1171,7 +1176,7 @@ function App(): JSX.Element {
|
||||
loadingYoloPreflight={loadingYoloPreflight}
|
||||
yoloPreflightError={yoloPreflightError}
|
||||
selectedProjectId={selectedProjectId}
|
||||
rasterDatasets={rasterDatasets}
|
||||
rasterDatasets={detectionRasterDatasets}
|
||||
referenceDatasets={referenceDatasets}
|
||||
onLoadModels={loadDetectionModels}
|
||||
onRefreshYoloPreflight={() => loadYoloPreflight()}
|
||||
|
||||
@@ -1154,12 +1154,7 @@ export function MapWorkspace({
|
||||
}
|
||||
|
||||
const areaIdForSelection = (bbox: VectorSelectionBBox | null): string | undefined => (
|
||||
bbox
|
||||
&& selectedMapArea
|
||||
&& selectedAreaBbox
|
||||
&& bboxesEqual(bbox, selectedAreaBbox)
|
||||
? selectedMapArea.id
|
||||
: undefined
|
||||
bbox && selectedMapArea ? selectedMapArea.id : undefined
|
||||
)
|
||||
|
||||
const startBboxSelection = () => {
|
||||
@@ -1178,7 +1173,7 @@ export function MapWorkspace({
|
||||
setSelectionBbox(bbox)
|
||||
setFirstSelectionCorner(null)
|
||||
setBboxSelectionMode(false)
|
||||
void analyzeSelection(bbox)
|
||||
void analyzeSelection(bbox, areaIdForSelection(bbox))
|
||||
}
|
||||
|
||||
const runAreaExtract = () => {
|
||||
@@ -1387,7 +1382,7 @@ export function MapWorkspace({
|
||||
const handleMapBboxSelect = (bbox: VectorSelectionBBox) => {
|
||||
setFirstSelectionCorner(null)
|
||||
setBboxSelectionMode(false)
|
||||
void analyzeSelection(bbox)
|
||||
void analyzeSelection(bbox, areaIdForSelection(bbox))
|
||||
}
|
||||
|
||||
const runQuickAoiExtract = () => {
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import type { DatasetCreateResponse } from '../types'
|
||||
|
||||
const NON_IMAGERY_RASTER_SOURCES = new Set([
|
||||
'department_omgeving_thematic_raster',
|
||||
'digitaal_vlaanderen_dhmv',
|
||||
'vmm_flood_hazard',
|
||||
])
|
||||
|
||||
export function isDetectionImageryDataset(dataset: DatasetCreateResponse): boolean {
|
||||
if (dataset.dataset_type !== 'raster' || dataset.status !== 'ready') {
|
||||
return false
|
||||
}
|
||||
if (NON_IMAGERY_RASTER_SOURCES.has(dataset.source_name ?? '')) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
Reference in New Issue
Block a user