AW-3101 vnd.farmmaps.itemtype.shape.processed download as shape (zip)

This commit is contained in:
2025-04-28 10:20:19 +02:00
parent f039898c26
commit 2e55b5a70e
4 changed files with 67 additions and 42 deletions

View File

@@ -1,8 +1,9 @@
import { Location } from '@angular/common';
import { Component, Injectable } from '@angular/core';
import { Component, Injectable, OnDestroy } 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 { Subscription } from 'rxjs';
import * as mapActions from '../../actions/map.actions';
import * as mapReducers from '../../reducers/map.reducer';
import { ForItemType } from '../for-item/for-itemtype.decorator';
@@ -16,12 +17,17 @@ import { AbstractSelectedItemComponent } from '../selected-item/selected-item.co
templateUrl: './selected-item-geotiff.component.html',
styleUrls: ['./selected-item-geotiff.component.scss']
})
export class SelectedItemGeotiffComponent extends AbstractSelectedItemComponent {
export class SelectedItemGeotiffComponent extends AbstractSelectedItemComponent implements OnDestroy {
sub: Subscription;
constructor(store: Store<mapReducers.State | commonReducers.State>, public itemService: ItemService, itemTypeService: ItemTypeService, location: Location, router: Router, private itemService$: ItemService,private folderService$: FolderService) {
super(store, itemTypeService,location,router);
}
ngOnDestroy(): void {
if (this.sub) this.sub.unsubscribe();
}
onLayerChanged(layerIndex: number) {
this.store.dispatch(new mapActions.SetLayerIndex(layerIndex));
}
@@ -34,7 +40,7 @@ export class SelectedItemGeotiffComponent extends AbstractSelectedItemComponent
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) => {
this.sub = this.itemService.getItemLink(itemLink).subscribe((itemLinkUrl:IUrlType) => {
window.location.href = itemLinkUrl.url;
})
}