diff --git a/packages/geo/src/lib/catalog/catalog-browser/catalog-browser-layer.component.html b/packages/geo/src/lib/catalog/catalog-browser/catalog-browser-layer.component.html index d3eb2f75a9..6d7266b290 100644 --- a/packages/geo/src/lib/catalog/catalog-browser/catalog-browser-layer.component.html +++ b/packages/geo/src/lib/catalog/catalog-browser/catalog-browser-layer.component.html @@ -1,6 +1,6 @@ -

{{title}}

+

{{title}}

diff --git a/packages/geo/src/lib/catalog/catalog-browser/catalog-browser-layer.component.ts b/packages/geo/src/lib/catalog/catalog-browser/catalog-browser-layer.component.ts index d47953c2bd..61b1651a23 100644 --- a/packages/geo/src/lib/catalog/catalog-browser/catalog-browser-layer.component.ts +++ b/packages/geo/src/lib/catalog/catalog-browser/catalog-browser-layer.component.ts @@ -13,7 +13,8 @@ import { CatalogItemLayer } from '../shared'; import { BehaviorSubject } from 'rxjs'; import { LayerService } from '../../layer/shared/layer.service'; import { first } from 'rxjs/operators'; -import { Layer } from '../../layer/shared/layers'; +import { Layer, TooltipType } from '../../layer/shared/layers'; +import { MetadataLayerOptions } from '../../metadata/shared/metadata.interface'; /** * Catalog browser layer item @@ -78,6 +79,33 @@ export class CatalogBrowserLayerComponent implements OnInit { this.isPreview$.subscribe(value => this.addedLayerIsPreview.emit(value)); } + computeTitleTooltip(): string { + const layerOptions = this.layer.options; + if (!layerOptions.tooltip) { + return getEntityTitle(this.layer); + } + const layerTooltip = layerOptions.tooltip; + const layerMetadata = (layerOptions as MetadataLayerOptions).metadata; + switch (layerOptions.tooltip.type) { + case TooltipType.TITLE: + return this.layer.title; + case TooltipType.ABSTRACT: + if (layerMetadata && layerMetadata.abstract) { + return layerMetadata.abstract; + } else { + return this.layer.title; + } + case TooltipType.CUSTOM: + if (layerTooltip && layerTooltip.text) { + return layerTooltip.text; + } else { + return this.layer.title; + } + default: + return this.layer.title; + } + } + /** * On mouse event, mouseenter /mouseleave * @internal diff --git a/packages/geo/src/lib/catalog/shared/catalog.service.ts b/packages/geo/src/lib/catalog/shared/catalog.service.ts index aa85dcc86d..9ce7d2aa55 100644 --- a/packages/geo/src/lib/catalog/shared/catalog.service.ts +++ b/packages/geo/src/lib/catalog/shared/catalog.service.ts @@ -364,7 +364,8 @@ export class CatalogService { minResolution: getResolutionFromScale(layer.MinScaleDenominator), metadata: { url: metadata ? metadata.OnlineResource : undefined, - extern: metadata ? true : undefined + extern: metadata ? true : undefined, + abstract: layer.Abstract }, legendOptions, tooltip: { type: catalog.tooltipType }, diff --git a/packages/geo/src/lib/layer/layer-legend/layer-legend.component.ts b/packages/geo/src/lib/layer/layer-legend/layer-legend.component.ts index 4bc20d20f6..d17387e842 100644 --- a/packages/geo/src/lib/layer/layer-legend/layer-legend.component.ts +++ b/packages/geo/src/lib/layer/layer-legend/layer-legend.component.ts @@ -165,7 +165,7 @@ export class LayerLegendComponent implements OnInit, OnDestroy { if (layerOptions && layerOptions.legendOptions) { const translate = this.languageService.translate; const title = translate.instant('igo.geo.layer.legend.default'); - let stylesAvailable = [{ name: '', title } as ItemStyleOptions]; + const stylesAvailable = [{ name: '', title } as ItemStyleOptions]; if (layerOptions.legendOptions.stylesAvailable) { stylesAvailable.concat(layerOptions.legendOptions.stylesAvailable.filter(sA => ( sA.name.normalize('NFD').replace(/[\u0300-\u036f]/gi, '') !== 'default' &&