diff --git a/README.md b/README.md index c9b7bb51e3..4b2acee972 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ IGO2 library is divided into several elements: - @igo2/context : Library of components uniting @igo2/geo and @igo2/auth -- @igo2/tools : Library integrate basic components +- @igo2/integration : Library integrate basic components ## Demo diff --git a/packages/geo/src/lib/catalog/catalog-browser/catalog-browser-group.component.html b/packages/geo/src/lib/catalog/catalog-browser/catalog-browser-group.component.html index 58e613ef99..a590e5c881 100644 --- a/packages/geo/src/lib/catalog/catalog-browser/catalog-browser-group.component.html +++ b/packages/geo/src/lib/catalog/catalog-browser/catalog-browser-group.component.html @@ -44,6 +44,7 @@

diff --git a/packages/geo/src/lib/catalog/catalog-browser/catalog-browser-group.component.ts b/packages/geo/src/lib/catalog/catalog-browser/catalog-browser-group.component.ts index b68d0b0a42..9330f57400 100644 --- a/packages/geo/src/lib/catalog/catalog-browser/catalog-browser-group.component.ts +++ b/packages/geo/src/lib/catalog/catalog-browser/catalog-browser-group.component.ts @@ -67,6 +67,8 @@ export class CatalogBrowserGroupComponent implements OnInit, OnDestroy { @Input() resolution: number; + @Input() catalogAllowLegend = false; + /** * Whether the group can be toggled when it's collapsed */ 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 892cac25a6..d40e846a9a 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,7 +1,6 @@ -

{{title}}

- +

{{title}}

+ +
+ + +
diff --git a/packages/geo/src/lib/catalog/catalog-browser/catalog-browser-layer.component.scss b/packages/geo/src/lib/catalog/catalog-browser/catalog-browser-layer.component.scss index 287ffcf042..0e400b073d 100644 --- a/packages/geo/src/lib/catalog/catalog-browser/catalog-browser-layer.component.scss +++ b/packages/geo/src/lib/catalog/catalog-browser/catalog-browser-layer.component.scss @@ -1,4 +1,16 @@ +@import '../../../../../core/src/style/partial/core.variables'; + .mat-badge-small .mat-badge-content { color: rgba(0, 0, 0, 0.38); } - \ No newline at end of file + + .igo-cataloglayer-title { + cursor: pointer; + } + + + .igo-cataloglayer-legend-container { + padding-left: 18px; + width: calc(100% - 18px); + margin-left: $igo-icon-size; + } \ No newline at end of file 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 bf693490fd..507ef50cc7 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 @@ -11,6 +11,9 @@ import { getEntityTitle, getEntityIcon } from '@igo2/common'; 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'; /** * Catalog browser layer item @@ -27,8 +30,13 @@ export class CatalogBrowserLayerComponent implements OnInit { private lastTimeoutRequest; + public layerLegendShown$: BehaviorSubject = new BehaviorSubject(false); + public igoLayer$ = new BehaviorSubject(undefined); + @Input() resolution: number; + @Input() catalogAllowLegend = false; + /** * Catalog layer */ @@ -63,7 +71,7 @@ export class CatalogBrowserLayerComponent implements OnInit { return getEntityIcon(this.layer) || 'layers'; } - constructor() {} + constructor(private layerService: LayerService ) {} ngOnInit(): void { this.isInResolutionsRange(); @@ -78,6 +86,12 @@ export class CatalogBrowserLayerComponent implements OnInit { this.onToggleClick(event); } + askForLegend(event) { + this.layerLegendShown$.next(!this.layerLegendShown$.value); + this.layerService.createAsyncLayer(this.layer.options).pipe(first()) + .subscribe(layer => this.igoLayer$.next(layer)); + } + /** * On toggle button click, emit the added change event * @internal diff --git a/packages/geo/src/lib/catalog/catalog-browser/catalog-browser.component.html b/packages/geo/src/lib/catalog/catalog-browser/catalog-browser.component.html index ad300f2d51..736bb77ebb 100644 --- a/packages/geo/src/lib/catalog/catalog-browser/catalog-browser.component.html +++ b/packages/geo/src/lib/catalog/catalog-browser/catalog-browser.component.html @@ -6,6 +6,7 @@ [group]="item" [state]="store.state" [resolution]="resolution$ | async" + [catalogAllowLegend]="catalogAllowLegend" [toggleCollapsed]="toggleCollapsedGroup" (addedChange)="onGroupAddedChange($event)" (layerAddedChange)="onLayerAddedChange($event)"> @@ -17,6 +18,7 @@ igoListItem [layer]="item" [resolution]="resolution$ | async" + [catalogAllowLegend]="catalogAllowLegend" [added]="store.state.get(item).added" (addedChange)="onLayerAddedChange($event)"> diff --git a/packages/geo/src/lib/catalog/catalog-browser/catalog-browser.component.ts b/packages/geo/src/lib/catalog/catalog-browser/catalog-browser.component.ts index 148b6a6e96..7792a0cc94 100644 --- a/packages/geo/src/lib/catalog/catalog-browser/catalog-browser.component.ts +++ b/packages/geo/src/lib/catalog/catalog-browser/catalog-browser.component.ts @@ -41,6 +41,8 @@ export class CatalogBrowserComponent implements OnInit, OnDestroy { get resolution$(): BehaviorSubject { return this.map.viewController.resolution$; } + @Input() catalogAllowLegend = false; + /** * Catalog */ @@ -84,6 +86,9 @@ export class CatalogBrowserComponent implements OnInit, OnDestroy { valueAccessor: (item: CatalogItem) => item.title }); } + + this.catalogAllowLegend = this.catalog.showLegend ? this.catalog.showLegend : this.catalogAllowLegend; + this.watcher = new EntityStoreWatcher(this.store, this.cdRef); } diff --git a/packages/geo/src/lib/catalog/catalog-browser/catalog-browser.module.ts b/packages/geo/src/lib/catalog/catalog-browser/catalog-browser.module.ts index bd97864ba6..38168fe808 100644 --- a/packages/geo/src/lib/catalog/catalog-browser/catalog-browser.module.ts +++ b/packages/geo/src/lib/catalog/catalog-browser/catalog-browser.module.ts @@ -20,6 +20,7 @@ import { IgoMetadataModule } from './../../metadata/metadata.module'; import { CatalogBrowserComponent } from './catalog-browser.component'; import { CatalogBrowserLayerComponent } from './catalog-browser-layer.component'; import { CatalogBrowserGroupComponent } from './catalog-browser-group.component'; +import { IgoLayerModule } from '../../layer/layer.module'; /** * @ignore @@ -36,7 +37,8 @@ import { CatalogBrowserGroupComponent } from './catalog-browser-group.component' IgoLanguageModule, IgoListModule, IgoCollapsibleModule, - IgoMetadataModule + IgoMetadataModule, + IgoLayerModule ], exports: [ CatalogBrowserComponent diff --git a/packages/geo/src/lib/catalog/shared/catalog.interface.ts b/packages/geo/src/lib/catalog/shared/catalog.interface.ts index b6304772d8..7ea32542c6 100644 --- a/packages/geo/src/lib/catalog/shared/catalog.interface.ts +++ b/packages/geo/src/lib/catalog/shared/catalog.interface.ts @@ -26,6 +26,7 @@ export interface Catalog { tooltipType?: TooltipType.ABSTRACT | TooltipType.TITLE; sortDirection?: 'asc' | 'desc'; setCrossOriginAnonymous?: boolean; + showLegend?: boolean; } export interface CatalogItem { diff --git a/packages/geo/src/lib/filter/shared/spatial-filter.service.ts b/packages/geo/src/lib/filter/shared/spatial-filter.service.ts index 1cfe503ae3..37613e45e6 100644 --- a/packages/geo/src/lib/filter/shared/spatial-filter.service.ts +++ b/packages/geo/src/lib/filter/shared/spatial-filter.service.ts @@ -96,9 +96,7 @@ export class SpatialFilterService { 'igo.geo.terrapi.' + name ); } catch (e) { - item.name = - name.substring(0, 1).toUpperCase() + - name.substring(1, name.length - 1); + item.name = name.substring(0, 1).toUpperCase() + name.substring(1, name.length - 1); } try { @@ -106,9 +104,7 @@ export class SpatialFilterService { 'igo.geo.spatialFilter.group.' + substr ); } catch (e) { - item.group = - substr.substring(0, 1).toUpperCase() + - substr.substring(1, name.length - 1); + item.group = substr.substring(0, 1).toUpperCase() + substr.substring(1, name.length - 1); } items.push(item); @@ -124,9 +120,7 @@ export class SpatialFilterService { 'igo.geo.terrapi.' + name ); } catch (e) { - item.name = - name.substring(0, 1).toUpperCase() + - name.substring(1, name.length - 1); + item.name = name.substring(0, 1).toUpperCase() + name.substring(1, name.length - 1); } item.source = type;