@@ -72,10 +72,12 @@ export default defineComponent({
7272 });
7373 // Compute NetCDF Layer Keys
7474 const stepIndexMap: Record <string , { length: number , currentIndex: number }> = {};
75+ const resamplingMap: Record <string , ' linear' | ' nearest' > = {};
7576 visibleNetCDFLayers .value .forEach ((item ) => {
7677 const found = props .netcdfLayers .find ((layer ) => layer .id === item .netCDFLayer );
7778 if (found ) {
7879 const { opacity } = item ;
80+ resamplingMap [` netcdf_${found .id } ` ] = item .resampling === ' nearest' ? ' nearest' : ' linear' ;
7981 mapLayerOpacityMap [` netcdf_${found .id } ` ] = opacity !== undefined ? opacity : 1.0 ;
8082 stepIndexMap [` netcdf_${found .id } ` ] = {
8183 length: item .images .length ,
@@ -87,7 +89,7 @@ export default defineComponent({
8789 props .rasterLayers .forEach ((layer ) => {
8890 mapLayerOpacityMap [` raster_${layer .id } ` ] = layer ?.default_style ?.opacity !== undefined ? layer .default_style .opacity : 1.0 ;
8991 });
90- const order: { id: number , opacity: number , name: string , type: ' netcdf' | ' vector' | ' raster' , length? : number , currentIndex? : number } [] = [];
92+ const order: { id: number , opacity: number , name: string , type: ' netcdf' | ' vector' | ' raster' , length? : number , currentIndex? : number , resampling ? : ' linear ' | ' nearest ' } [] = [];
9193 MapStore .selectedMapLayers .value .forEach ((layer ) => {
9294 if (layer .type === ' netcdf' ) {
9395 if (mapLayerOpacityMap [` netcdf_${layer .id } ` ] !== undefined ) {
@@ -99,7 +101,7 @@ export default defineComponent({
99101 currentIndex = data .currentIndex ;
100102 }
101103 order .push ({
102- id: layer .id , opacity: mapLayerOpacityMap [` netcdf_${layer .id } ` ], name: layer .name , type: layer .type , length , currentIndex ,
104+ id: layer .id , opacity: mapLayerOpacityMap [` netcdf_${layer .id } ` ], name: layer .name , type: layer .type , length , currentIndex , resampling: resamplingMap [ ` netcdf_${ layer . id } ` ],
103105 });
104106 }
105107 } else if (layer .type === ' raster' ) {
@@ -155,7 +157,7 @@ export default defineComponent({
155157 });
156158
157159 const updateIndex = (layerId : number , currentIndex : number ) => {
158- updateNetCDFLayer (layerId , currentIndex );
160+ updateNetCDFLayer (layerId , { index: currentIndex } );
159161 };
160162 const throttledUpdateNetCDFLayer = throttle (updateIndex , 50 );
161163
@@ -175,7 +177,7 @@ export default defineComponent({
175177 const found = visibleNetCDFLayers .value .find ((layer ) => item .id === layer .netCDFLayer );
176178 if (found ) {
177179 found .opacity = val ;
178- updateNetCDFLayer (item .id , undefined , val );
180+ updateNetCDFLayer (item .id , { opacity: val } );
179181 }
180182 }
181183 if (item .type === ' raster' ) {
@@ -190,12 +192,22 @@ export default defineComponent({
190192 }
191193 }
192194 };
195+
196+ const toggleResampling = (id : number ) => {
197+ const found = visibleNetCDFLayers .value .find ((layer ) => id === layer .netCDFLayer );
198+ if (found ) {
199+ const val = found .resampling === ' linear' ? ' nearest' : ' linear' ;
200+ found .resampling = val ;
201+ updateNetCDFLayer (id , { resampling: val });
202+ }
203+ };
193204 return {
194205 processedLayers ,
195206 iconMapper ,
196207 updateOpacity ,
197208 throttledUpdateNetCDFLayer ,
198209 stepMapping ,
210+ toggleResampling ,
199211 };
200212 },
201213});
@@ -211,7 +223,14 @@ export default defineComponent({
211223 >
212224 <v-card-text class =" py-1 px-2" >
213225 <span class =" py-1 px-2 d-flex align-center" >
214- <v-icon size =" 16" class =" mr-1" color =" primary" >
226+ <v-tooltip v-if =" item.type === 'netcdf'" text =" Image Scaling (Nearest vs Linear)" >
227+ <template #activator =" { props } " >
228+ <v-icon size =" 16" v-bind =" props" class =" mr-1" color =" primary" @click =" toggleResampling(item.id)" >
229+ {{ item.resampling === 'nearest' ? ' mdi-view-grid' : 'mdi-grid' }}
230+ </v-icon >
231+ </template >
232+ </v-tooltip >
233+ <v-icon v-else size =" 16" class =" mr-1" color =" primary" >
215234 {{ iconMapper[item.type] }}
216235 </v-icon >
217236 <span class =" text-sm" >{{ item.name }}</span >
0 commit comments