From f039898c26ba74d84b3b8406364782876da784b5 Mon Sep 17 00:00:00 2001 From: Peter Bastiani Date: Mon, 28 Apr 2025 08:45:05 +0200 Subject: [PATCH] AW-3101 vnd.farmmaps.itemtype.geotiff.processed -> Download as tiff --- .../selected-item-geotiff.component.html | 43 ++++++++++--------- .../selected-item-geotiff.component.ts | 21 ++++++--- .../selected-item-temporal.component.ts | 2 +- 3 files changed, 39 insertions(+), 27 deletions(-) diff --git a/projects/common-map/src/fm-map/components/selected-item-geotiff/selected-item-geotiff.component.html b/projects/common-map/src/fm-map/components/selected-item-geotiff/selected-item-geotiff.component.html index 88d2730..58b1b99 100644 --- a/projects/common-map/src/fm-map/components/selected-item-geotiff/selected-item-geotiff.component.html +++ b/projects/common-map/src/fm-map/components/selected-item-geotiff/selected-item-geotiff.component.html @@ -7,28 +7,31 @@

{{parentItem.name}}

{{item.name}}

-
-
diff --git a/projects/common-map/src/fm-map/components/selected-item-geotiff/selected-item-geotiff.component.ts b/projects/common-map/src/fm-map/components/selected-item-geotiff/selected-item-geotiff.component.ts index b633d3d..26fa44a 100644 --- a/projects/common-map/src/fm-map/components/selected-item-geotiff/selected-item-geotiff.component.ts +++ b/projects/common-map/src/fm-map/components/selected-item-geotiff/selected-item-geotiff.component.ts @@ -1,12 +1,12 @@ -import { Component, Injectable } from '@angular/core'; import { Location } from '@angular/common'; -import { Store } from '@ngrx/store'; -import * as mapReducers from '../../reducers/map.reducer'; -import { commonReducers, ItemTypeService, ItemService, FolderService } from '@farmmaps/common'; +import { Component, Injectable } from '@angular/core'; import { Router } from '@angular/router'; +import { commonReducers, FolderService, IItem, IItemLinkType, ItemService, ItemTypeService, IUrlType } from '@farmmaps/common'; +import { Store } from '@ngrx/store'; +import * as mapActions from '../../actions/map.actions'; +import * as mapReducers from '../../reducers/map.reducer'; import { ForItemType } from '../for-item/for-itemtype.decorator'; import { AbstractSelectedItemComponent } from '../selected-item/selected-item.component'; -import * as mapActions from '../../actions/map.actions'; @ForItemType("vnd.farmmaps.itemtype.geotiff.processed") @@ -18,7 +18,7 @@ import * as mapActions from '../../actions/map.actions'; }) export class SelectedItemGeotiffComponent extends AbstractSelectedItemComponent { - constructor(store: Store, itemTypeService: ItemTypeService, location: Location, router: Router, private itemService$: ItemService,private folderService$: FolderService) { + constructor(store: Store, public itemService: ItemService, itemTypeService: ItemTypeService, location: Location, router: Router, private itemService$: ItemService,private folderService$: FolderService) { super(store, itemTypeService,location,router); } @@ -29,4 +29,13 @@ export class SelectedItemGeotiffComponent extends AbstractSelectedItemComponent layer(layers:any,layerIndex:number) { return layers.find(l => l.index == layerIndex); } + + download(event:MouseEvent,item:IItem,layers:any,layerIndex:number) { + event.stopPropagation(); + event.preventDefault(); + const itemLink : IItemLinkType = {itemcode:item.code,query:`layer=${this.layer(layers,layerIndex).name}`,pathsuffix:"download", validminutes:10} + const foo = this.itemService.getItemLink(itemLink).subscribe((itemLinkUrl:IUrlType) => { + window.location.href = itemLinkUrl.url; + }) + } } diff --git a/projects/common-map/src/fm-map/components/selected-item-temporal/selected-item-temporal.component.ts b/projects/common-map/src/fm-map/components/selected-item-temporal/selected-item-temporal.component.ts index ef546ac..9179f22 100644 --- a/projects/common-map/src/fm-map/components/selected-item-temporal/selected-item-temporal.component.ts +++ b/projects/common-map/src/fm-map/components/selected-item-temporal/selected-item-temporal.component.ts @@ -66,7 +66,7 @@ export class SelectedItemTemporalComponent extends AbstractSelectedItemComponent event.preventDefault(); const itemLink : IItemLinkType = {itemcode:item.code,query:`layer=${this.layer(layers,layerIndex).name}`,pathsuffix:"download", validminutes:10} const foo = this.itemService.getItemLink(itemLink).subscribe((itemLinkUrl:IUrlType) => { - window.location.href =itemLinkUrl.url + window.location.href = itemLinkUrl.url; }) } }