Skip to content

Commit

Permalink
fix(metadata): define metadata in layerOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarbeau committed Oct 5, 2018
1 parent a632017 commit de7baed
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 23 deletions.
34 changes: 17 additions & 17 deletions demo/src/app/geo/layer/layer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import {
DataSourceService,
LayerService,
WMSDataSourceOptions,
MetadataDataSourceOptions
LayerOptions,
MetadataLayerOptions
} from '@igo2/geo';

@Component({
Expand Down Expand Up @@ -90,34 +91,33 @@ export class AppLayerComponent {
})
.subscribe(l => this.map.addLayer(l));

interface WMSoptions
extends WMSDataSourceOptions,
MetadataDataSourceOptions {}

const datasource: WMSoptions = {
const datasource: WMSDataSourceOptions = {
type: 'wms',
url: 'https://geoegl.msp.gouv.qc.ca/igo2/api/ws/igo_gouvouvert.fcgi',
refreshIntervalSec: 15,
params: {
layers: 'vg_observation_v_inondation_embacle_wmst',
version: '1.3.0'
},
metadata: {
url:
'https://www.donneesquebec.ca/recherche/fr/dataset/historique-publique-d-embacles-repertories-au-msp',
extern: true
}
};

interface LayerOptionsWithMetadata
extends LayerOptions,
MetadataLayerOptions {}

this.dataSourceService
.createAsyncDataSource(datasource)
.subscribe(dataSource => {
this.map.addLayer(
this.layerService.createLayer({
title: 'Embâcle',
source: dataSource
})
);
const layer: LayerOptionsWithMetadata = {
title: 'Embâcle',
source: dataSource,
metadata: {
url:
'https://www.donneesquebec.ca/recherche/fr/dataset/historique-publique-d-embacles-repertories-au-msp',
extern: true
}
};
this.map.addLayer(this.layerService.createLayer(layer));
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ export class CapabilitiesService {
this.getResolutionFromScale(layer.MaxScaleDenominator) || Infinity,
minResolution:
this.getResolutionFromScale(layer.MinScaleDenominator) || 0,

metadata: {
url: metadata ? metadata.OnlineResource : undefined
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Layer } from '../../layer/shared/layers/layer';

import {
MetadataOptions,
MetadataDataSourceOptions
MetadataLayerOptions
} from '../shared/metadata.interface';
import { MetadataService } from '../shared/metadata.service';

Expand Down Expand Up @@ -39,10 +39,10 @@ export class MetadataButtonComponent {
this.metadataService.open(metadata);
}

get options(): MetadataDataSourceOptions {
get options(): MetadataLayerOptions {
if (!this.layer) {
return;
}
return this.layer.dataSource.options;
return this.layer.options;
}
}
4 changes: 2 additions & 2 deletions projects/geo/src/lib/metadata/shared/metadata.interface.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { DataSourceOptions } from '../../datasource/shared/datasources/datasource.interface';
import { LayerOptions } from '../../layer/shared/layers/layer.interface';

export interface MetadataOptions {
url: string;
extern?: boolean;
}

export interface MetadataDataSourceOptions extends DataSourceOptions {
export interface MetadataLayerOptions extends LayerOptions {
metadata?: MetadataOptions;
}

0 comments on commit de7baed

Please sign in to comment.