From 74a20ff7b5b55fb1452716413f24988df335a618 Mon Sep 17 00:00:00 2001 From: Bryon Lewis Date: Thu, 7 Nov 2024 14:15:45 -0500 Subject: [PATCH 1/3] improving selection, adding test chart data --- vue/package.json | 1 - vue/src/client/services/ApiService.ts | 11 + .../animation/AnimationDownloadDialog.vue | 26 +- .../components/imageViewer/ImageFilter.vue | 149 +++++++++- .../imageViewer/ImageGifCreation.vue | 270 ------------------ .../components/imageViewer/ImageViewer.vue | 51 +++- vue/src/store.ts | 4 +- 7 files changed, 211 insertions(+), 301 deletions(-) delete mode 100644 vue/src/components/imageViewer/ImageGifCreation.vue diff --git a/vue/package.json b/vue/package.json index 804356efd..7392730f4 100644 --- a/vue/package.json +++ b/vue/package.json @@ -21,7 +21,6 @@ "@techstark/opencv-js": "^4.9.0-release.2", "@turf/turf": "7.0.0-alpha.113", "@types/mapbox__mapbox-gl-draw": "^1.4.6", - "canvas-capture": "^2.1.1", "django-s3-file-field": "^1.0.1", "js-cookie": "^3.0.5", "lodash": "^4.17.21", diff --git a/vue/src/client/services/ApiService.ts b/vue/src/client/services/ApiService.ts index fe2103006..dd22ef58a 100644 --- a/vue/src/client/services/ApiService.ts +++ b/vue/src/client/services/ApiService.ts @@ -120,6 +120,17 @@ export interface DownloadSettings { pointArea?: number; } +export interface DefaultAnimationSettings { + fps: number; + sources: Constellation[]; + noData: number; + include: ('obs' | 'nonobs')[]; + point_radius: number; + cloudCover: number; + rescale: boolean; + rescale_border: number; +} + export interface DownloadAnimationSettings { output_format: 'mp4' | 'gif'; fps: number; diff --git a/vue/src/components/animation/AnimationDownloadDialog.vue b/vue/src/components/animation/AnimationDownloadDialog.vue index 79c9f64d3..35bdbc697 100644 --- a/vue/src/components/animation/AnimationDownloadDialog.vue +++ b/vue/src/components/animation/AnimationDownloadDialog.vue @@ -4,6 +4,7 @@ import { debounce } from "lodash"; import { ApiService, Constellation, + DefaultAnimationSettings, DownloadAnimationSettings, } from "../../client/services/ApiService"; import AnimationDownloaded from "./AnimationDownloaded.vue"; @@ -11,6 +12,7 @@ import AnimationDownloaded from "./AnimationDownloaded.vue"; const props = defineProps<{ type: "site" | "modelRun"; id: string; + defaults?: DefaultAnimationSettings; }>(); const emit = defineEmits<{ @@ -22,10 +24,10 @@ const validForm = ref(true); const outputFormat: Ref = ref("mp4"); const formatChoices = ref(["mp4", "gif"]); -const fps = ref(1); -const pointRadius = ref(5); -const constellationChoices = ref(["S2", "WV", "L8"]); -const selectedSources: Ref = ref(["WV", "S2"]); +const fps = ref(props.defaults ? props.defaults.fps : 1); +const pointRadius = ref(props.defaults ? props.defaults.point_radius : 5); +const constellationChoices = ref( ["S2", "WV", "L8"]); +const selectedSources: Ref = ref(props.defaults?.sources || ["WV", "S2"]); const labelChoices = ref(["geom", "date", "source", "obs", "obs_label"]); const labels: Ref = ref([ "geom", @@ -34,9 +36,13 @@ const labels: Ref = ref([ "obs", "obs_label", ]); -const cloudCover = ref(95); -const noData = ref(100); -const include: Ref = ref([ +onMounted(() => { + console.log('Animation Defaults'); + console.log(props.defaults); +}); +const cloudCover = ref(props.defaults ? props.defaults.cloudCover : 95); +const noData = ref(props.defaults ? props.defaults.noData : 100); +const include: Ref = ref(props.defaults?.include || [ "obs", "nonobs", ]); @@ -158,9 +164,9 @@ const cancel = debounce(() => emit("close"), 5000, { leading: true }); > (), { }); const emit = defineEmits<{ - (e: "imageFilter", data: {image: EvaluationImage; poly: PixelPoly, groundTruthPoly?: PixelPoly}[]): void; + (e: "imageFilter", data: {image: EvaluationImage; poly: PixelPoly, groundTruthPoly?: PixelPoly}[]): void, + (e: "animationDefaults", data: DefaultAnimationSettings): void; + (e: "rescaleBBox", data: number): void; }>(); const baseImageSources = ref(['S2', 'WV', 'L8', 'PL']) const baseObs = ref(['observations', 'non-observations']) const filterSettings = ref(true); +const rescaleBorder = ref(1) + +const downloadingGifPointSize = computed({ + get() { + return state.gifSettings.pointSize || 1; + }, + set(val: number) { + state.gifSettings = { ...state.gifSettings, pointSize: val }; + }, +}); + +const playbackFps = computed({ + get() { + return state.gifSettings.fps || 1; + }, + set(val: number) { + state.gifSettings = { ...state.gifSettings, fps: val }; + }, +}); const filteredImages = computed(() => { @@ -44,6 +67,39 @@ const filteredImages = computed(() => { watch(filteredImages, () => { emit('imageFilter', filteredImages.value); }) + +watch([ + () => state.imageFilter.sources, + () => state.imageFilter.obsFilter, + () => state.imageFilter.cloudCover, + () => state.imageFilter.noData], () => { + const defaultAnimationSettings: DefaultAnimationSettings = { + cloudCover: state.imageFilter.cloudCover, + noData: state.imageFilter.noData, + sources: state.imageFilter.sources, + include: state.imageFilter.obsFilter.map((item) => item === 'non-observations' ? 'nonobs' : 'obs'), + rescale: props.rescaleImage, + rescale_border: rescaleBorder.value, + fps: playbackFps.value, + point_radius: downloadingGifPointSize.value, + } + console.log('Emitting Animation Defaults'); + emit('animationDefaults', defaultAnimationSettings); +}) +watch(rescaleBorder, () => { + const defaultAnimationSettings: DefaultAnimationSettings = { + cloudCover: state.imageFilter.cloudCover, + noData: state.imageFilter.noData, + sources: state.imageFilter.sources, + include: state.imageFilter.obsFilter.map((item) => item === 'non-observations' ? 'nonobs' : 'obs'), + rescale: props.rescaleImage, + rescale_border: rescaleBorder.value, + fps: playbackFps.value, + point_radius: downloadingGifPointSize.value, + } + emit('animationDefaults', defaultAnimationSettings); + emit('rescaleBBox', rescaleBorder.value); +}) + + \ No newline at end of file diff --git a/vue/src/components/imageViewer/ImageGifCreation.vue b/vue/src/components/imageViewer/ImageGifCreation.vue deleted file mode 100644 index b65a66661..000000000 --- a/vue/src/components/imageViewer/ImageGifCreation.vue +++ /dev/null @@ -1,270 +0,0 @@ - - - - - \ No newline at end of file diff --git a/vue/src/components/imageViewer/ImageViewer.vue b/vue/src/components/imageViewer/ImageViewer.vue index b96fca0ba..25477043d 100644 --- a/vue/src/components/imageViewer/ImageViewer.vue +++ b/vue/src/components/imageViewer/ImageViewer.vue @@ -18,13 +18,13 @@ import { import type { PixelPoly } from "./imageUtils"; import { drawData, processImagePoly } from "./imageUtils"; import maplibregl from "maplibre-gl"; -import ImageGifCreation from "./ImageGifCreation.vue"; +import AnimationDownloadDialog from "../animation/AnimationDownloadDialog.vue"; import ImageFilter from "./ImageFilter.vue"; import ImageEditorDetails from "./ImageEditorDetails.vue"; import ImageSliderDetails from "./ImageSliderDetails.vue"; import ImagePolygonEditor from "./ImagePolygonEditor.vue"; import ImageSAM from "./ImageSAM.vue"; -import { SiteModelStatus } from "../../client/services/ApiService"; +import { DefaultAnimationSettings, SiteModelStatus } from "../../client/services/ApiService"; interface Props { siteEvalId: string; dialog?: boolean; @@ -111,7 +111,8 @@ const editingGeoJSON = ref(false); const SAMViewer: Ref = ref(null); const sidePanelExpanded = ref(false || props.editable); const sidePanelTab: Ref = ref(null); - +const animationDefaults: Ref = ref(undefined); +const animationDialog = ref(false); const evaluationGeoJSON: Ref = ref(null); // holds the site geoJSON so it can be edited @@ -441,17 +442,25 @@ const clearStorage = async () => { Rescale Images - + + + Download Animation + diff --git a/vue/src/store.ts b/vue/src/store.ts index 2333d6c7e..c98a3e72d 100644 --- a/vue/src/store.ts +++ b/vue/src/store.ts @@ -182,7 +182,9 @@ export const state = reactive<{ modelRuns: KeyedModelRun[], totalNumModelRuns: number; openedModelRuns: Set; - gifSettings: { fps: number, quality: number, pointSize: number}, + gifSettings: { + fps: number, + pointSize: number,}, performerIds: number[], performerMapping: Record, proposals: { From 934fb3cab46a0863c4ee76d149da16a66611619d Mon Sep 17 00:00:00 2001 From: Bryon Lewis Date: Fri, 8 Nov 2024 08:59:42 -0500 Subject: [PATCH 2/3] finalizing settings cration --- .../components/imageViewer/ImageFilter.vue | 25 +++++++++++++++---- .../components/imageViewer/ImageViewer.vue | 2 +- vue/src/components/siteList/SiteListCard.vue | 2 +- vue/src/store.ts | 2 +- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/vue/src/components/imageViewer/ImageFilter.vue b/vue/src/components/imageViewer/ImageFilter.vue index 65e77d1db..39198fe52 100644 --- a/vue/src/components/imageViewer/ImageFilter.vue +++ b/vue/src/components/imageViewer/ImageFilter.vue @@ -152,7 +152,10 @@ watch(rescaleBorder, () => { justify="center" align="center" > - + Cloud Cover: @@ -177,7 +180,10 @@ watch(rescaleBorder, () => { justify="center" align="center" > - + NoData: @@ -202,7 +208,10 @@ watch(rescaleBorder, () => { justify="center" align="center" > - + FPS: @@ -227,7 +236,10 @@ watch(rescaleBorder, () => { justify="center" align="center" > - + Rescale Border: @@ -252,7 +264,10 @@ watch(rescaleBorder, () => { justify="center" align="center" > - + Point Radius: diff --git a/vue/src/components/imageViewer/ImageViewer.vue b/vue/src/components/imageViewer/ImageViewer.vue index 25477043d..a53e32bb3 100644 --- a/vue/src/components/imageViewer/ImageViewer.vue +++ b/vue/src/components/imageViewer/ImageViewer.vue @@ -455,7 +455,7 @@ const clearStorage = async () => { @click="animationDialog = true" > - mdi-download-box-outline + mdi-movie-roll diff --git a/vue/src/components/siteList/SiteListCard.vue b/vue/src/components/siteList/SiteListCard.vue index 0be86dfe1..7970a1f5c 100644 --- a/vue/src/components/siteList/SiteListCard.vue +++ b/vue/src/components/siteList/SiteListCard.vue @@ -385,7 +385,7 @@ const animationDialog = ref(false); - Downloading {{ downloadingData.current }} of {{ downloadingData.total }} in source: {{ downloadingData.source}} + Downloading {{ downloadingData.current }} of {{ downloadingData.total }} in source: {{ downloadingData.source }} diff --git a/vue/src/store.ts b/vue/src/store.ts index c98a3e72d..c40148dfe 100644 --- a/vue/src/store.ts +++ b/vue/src/store.ts @@ -270,7 +270,7 @@ export const state = reactive<{ modelRuns: [], totalNumModelRuns: 0, openedModelRuns: new Set(), - gifSettings: { fps: 1, quality: 1, pointSize: 1}, + gifSettings: { fps: 1, pointSize: 1}, performerMapping: {}, performerIds: [], proposals: {}, From 8948ce407adaf2995c74e4cb0c1723727944df75 Mon Sep 17 00:00:00 2001 From: Bryon Lewis Date: Tue, 12 Nov 2024 08:01:33 -0500 Subject: [PATCH 3/3] addresing comments --- vue/src/components/animation/AnimationDownloadDialog.vue | 4 ---- vue/src/store.ts | 3 ++- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/vue/src/components/animation/AnimationDownloadDialog.vue b/vue/src/components/animation/AnimationDownloadDialog.vue index 35bdbc697..bb50eeb73 100644 --- a/vue/src/components/animation/AnimationDownloadDialog.vue +++ b/vue/src/components/animation/AnimationDownloadDialog.vue @@ -36,10 +36,6 @@ const labels: Ref = ref([ "obs", "obs_label", ]); -onMounted(() => { - console.log('Animation Defaults'); - console.log(props.defaults); -}); const cloudCover = ref(props.defaults ? props.defaults.cloudCover : 95); const noData = ref(props.defaults ? props.defaults.noData : 100); const include: Ref = ref(props.defaults?.include || [ diff --git a/vue/src/store.ts b/vue/src/store.ts index c40148dfe..a9132e15f 100644 --- a/vue/src/store.ts +++ b/vue/src/store.ts @@ -184,7 +184,8 @@ export const state = reactive<{ openedModelRuns: Set; gifSettings: { fps: number, - pointSize: number,}, + pointSize: number, + }, performerIds: number[], performerMapping: Record, proposals: {