Skip to content

Commit

Permalink
fix(*): provide hashtags for search and add eye into filter tool (#789)
Browse files Browse the repository at this point in the history
* feat(search-settings) provide hashtag tooltip to radio buttons

* feat(icherche) provide hashtag for cadastre type

* fix(search-result) manage other sources "More results"

* feat(time/ogc filter) Add the eye/off in the time/ogc filter into the ogcFilter and timeFilter tool
  • Loading branch information
pelord authored Dec 21, 2020
1 parent f464fc6 commit 7b45d3b
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,20 @@ <h4 (click)="toggleLegendOnClick()" *ngIf="header" [ngStyle]="{'cursor': filters
[matTooltip]="'igo.geo.filter.addFilter' | translate" [color]="color" (click)="addFilterToSequence()">
<mat-icon svgIcon="plus"></mat-icon>
</button>
<button *ngIf="!layer.visible && header" mat-icon-button tooltip-position="below"
matTooltipShowDelay="500" [matTooltip]="'igo.geo.layer.showLayer' | translate" color="color" (click)="setVisible()">
<mat-icon svgIcon="eye-off"></mat-icon>
<button *ngIf="header"
mat-icon-button
[color]="layer.visible ? 'primary' : 'default'"
collapsibleButton
tooltip-position="below"
matTooltipShowDelay="500"
[matTooltip]="layer.visible ?
('igo.geo.layer.hideLayer' | translate) :
('igo.geo.layer.showLayer' | translate)"
(click)="layer.visible = !layer.visible">
<mat-icon
[ngClass]="{disabled: !(inResolutionRange$ | async)}"
[svgIcon]="layer.visible ? 'eye' : 'eye-off'">
</mat-icon>
</button>
</mat-list-item>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Input, OnInit } from '@angular/core';
import { Component, Input, OnDestroy, OnInit } from '@angular/core';

import { Layer } from '../../layer/shared/layers/layer';
import { WMSDataSource } from '../../datasource/shared/datasources/wms-datasource';
Expand All @@ -13,14 +13,14 @@ import {
import { OGCFilterService } from '../shared/ogc-filter.service';
import { IgoMap } from '../../map';
import { OgcFilterWriter } from '../shared/ogc-filter';
import { BehaviorSubject } from 'rxjs';
import { BehaviorSubject, Subscription } from 'rxjs';

@Component({
selector: 'igo-ogc-filterable-item',
templateUrl: './ogc-filterable-item.component.html',
styleUrls: ['./ogc-filterable-item.component.scss']
})
export class OgcFilterableItemComponent implements OnInit {
export class OgcFilterableItemComponent implements OnInit, OnDestroy {
public color = 'primary';
private lastRunOgcFilter;
private defaultLogicalParent = OgcFilterOperator.And;
Expand All @@ -29,7 +29,8 @@ export class OgcFilterableItemComponent implements OnInit {
public filtersCollapsed = true;
public hasPushButton: boolean = false;
showLegend$: BehaviorSubject<boolean> = new BehaviorSubject(false);

inResolutionRange$: BehaviorSubject<boolean> = new BehaviorSubject(true);
private resolution$$: Subscription;
private ogcFilterWriter;

@Input() layer: Layer;
Expand Down Expand Up @@ -86,6 +87,15 @@ export class OgcFilterableItemComponent implements OnInit {
? ogcFilters.editable
: false;
}

const resolution$ = this.layer.map.viewController.resolution$;
this.resolution$$ = resolution$.subscribe(() => {
this.inResolutionRange$.next(this.layer.isInResolutionsRange);
});
}

ngOnDestroy(): void {
this.resolution$$.unsubscribe();
}

addFilterToSequence() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,20 @@
</mat-icon>
<h4 (click)="toggleLegendOnClick()" [ngStyle]="{'cursor': filtersCollapsed ? 'default' : 'pointer'}" matLine>{{layer.title}}</h4>

<button *ngIf="!layer.visible" mat-icon-button tooltip-position="below" matTooltipShowDelay="500"
[matTooltip]="'igo.geo.layer.showLayer' | translate" color="color" (click)="setVisible()">
<mat-icon svgIcon="eye-off"></mat-icon>
<button *ngIf="header"
mat-icon-button
[color]="layer.visible ? 'primary' : 'default'"
collapsibleButton
tooltip-position="below"
matTooltipShowDelay="500"
[matTooltip]="layer.visible ?
('igo.geo.layer.hideLayer' | translate) :
('igo.geo.layer.showLayer' | translate)"
(click)="layer.visible = !layer.visible">
<mat-icon
[ngClass]="{disabled: !(inResolutionRange$ | async)}"
[svgIcon]="layer.visible ? 'eye' : 'eye-off'">
</mat-icon>
</button>

</mat-list-item>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import { Component, Input } from '@angular/core';
import { Component, Input, OnDestroy, OnInit } from '@angular/core';

import { Layer } from '../../layer/shared/layers/layer';
import { TimeFilterableDataSource } from '../shared/time-filter.interface';
import { TimeFilterService } from '../shared/time-filter.service';
import { BehaviorSubject } from 'rxjs';
import { BehaviorSubject, Subscription } from 'rxjs';

@Component({
selector: 'igo-time-filter-item',
templateUrl: './time-filter-item.component.html',
styleUrls: ['./time-filter-item.component.scss']
})
export class TimeFilterItemComponent {
export class TimeFilterItemComponent implements OnInit, OnDestroy {
public color = 'primary';
showLegend$: BehaviorSubject<boolean> = new BehaviorSubject(false);
inResolutionRange$: BehaviorSubject<boolean> = new BehaviorSubject(true);
private resolution$$: Subscription;

filtersCollapsed: boolean = false;

Expand All @@ -25,6 +27,17 @@ export class TimeFilterItemComponent {
}
constructor(private timeFilterService: TimeFilterService) {}

ngOnInit(): void {
const resolution$ = this.layer.map.viewController.resolution$;
this.resolution$$ = resolution$.subscribe(() => {
this.inResolutionRange$.next(this.layer.isInResolutionsRange);
});
}

ngOnDestroy(): void {
this.resolution$$.unsubscribe();
}

handleYearChange(year: string | [string, string]) {
this.timeFilterService.filterByYear(this.datasource, year);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
<mat-radio-button *ngFor="let settingValue of setting.values"
class="mat-typography"
[value]="settingValue"
[matTooltip]="getAvailableHashtagsValues(settingValue)"
[checked]="settingValue.enabled"
(click)="$event.stopPropagation()"
(change)="settingsValueCheckedRadioButton($event, source, setting, settingValue)">
Expand Down
3 changes: 2 additions & 1 deletion packages/geo/src/lib/search/shared/sources/icherche.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ export class IChercheSearchSource extends SearchSource implements TextSearch {
{
title: 'igo.geo.search.icherche.type.cadastre',
value: 'cadastre',
enabled: types.indexOf('cadastre') !== -1
enabled: types.indexOf('cadastre') !== -1,
hashtags: ['cadastre']
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,8 @@ export class SearchResultsToolComponent implements OnInit, OnDestroy {
moreResults = igoList.querySelector('.ilayer .moreResults');
} else if (source[0].source.getId() === 'nominatim') {
moreResults = igoList.querySelector('.nominatim .moreResults');
} else {
moreResults = igoList.querySelector('.' + source[0].source.getId() + ' .moreResults');
}

if (
Expand Down

0 comments on commit 7b45d3b

Please sign in to comment.