Skip to content
Snippets Groups Projects
download.component.ts 1.24 KiB
Newer Older
  • Learn to ignore specific revisions
  • import { Component, Input } from '@angular/core';
    
    
    Tifenn Guillas's avatar
    Tifenn Guillas committed
    import { Criterion, ConeSearch } from '../../store/model';
    
    import { getCriterionStr, getHost as host } from '../../../shared/utils';
    
    import { Dataset } from 'src/app/metamodel/model';
    
    
    @Component({
        selector: 'app-result-download',
    
        templateUrl: 'download.component.html',
    
        styleUrls: ['download.component.css']
    
    export class DownloadSectionComponent {
    
        @Input() datasetName: string;
    
        @Input() datasetList: Dataset[];
    
        @Input() dataLength: number;
    
        @Input() criteriaList: Criterion[];
    
    Tifenn Guillas's avatar
    Tifenn Guillas committed
        @Input() coneSearch: ConeSearch;
    
        @Input() outputList: number[];
    
        getDataset(): Dataset {
            return this.datasetList.find(dataset => dataset.name === this.datasetName);
        }
    
        getUrl(format: string): string {
    
            let query: string = host() + '/search/' + this.datasetName + '?a=' + this.outputList.join(';');
    
            if (this.criteriaList.length > 0) {
                query += '&c=' + this.criteriaList.map(criterion => getCriterionStr(criterion)).join(';');
            }
    
    Tifenn Guillas's avatar
    Tifenn Guillas committed
            if (this.coneSearch !== null) {
                query += '&cs=' + this.coneSearch.ra + ':' + this.coneSearch.dec + ':' + this.coneSearch.radius;
            }
    
            query += '&f=' + format
            return query;
        }