Skip to content

Commit

Permalink
Direction tool fix (#673)
Browse files Browse the repository at this point in the history
* Feat(docs): ogc filter time add example and new param (#660)

* add example and new param calendarModeYear

* doc

* doc

* doc

* doc

* doc

* docs

* doc

* criss de doc

* grrrr

* doc fuck

* calisse

* feat(docs) add wms-wfs combinés

* lint

* doc

Co-authored-by: Philippe Lafreniere <[email protected]>

* refactor(menu-button): change menu button component to library (#667)

* WIP: fix menu button reverse color fix

* refactor(portal): menu button component to igo2-lib

* refactor(portal): handling of url controls for directions tool.

Co-authored-by: josee666 <[email protected]>
Co-authored-by: Philippe Lafreniere <[email protected]>
Co-authored-by: Philippe Lafrenière <[email protected]>
  • Loading branch information
4 people authored Oct 12, 2021
1 parent 7a6979e commit d0b3ba8
Show file tree
Hide file tree
Showing 10 changed files with 221 additions and 94 deletions.
12 changes: 12 additions & 0 deletions docs/_tables/fr/properties/filter/igoOgcFilterDuring.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Propriétés,Type,Description,Valeurs possibles,Valeur défaut
begin ,String ,Valeur de début du filtre temporel ,,Valeur **minDate** de la couche
end ,String ,Valeur de fin du filtre temporel ,,Valeur **maxDate** de la couche
step ,String ,Pas de temps défini selon la norme ISO-8601 ,Voir `Wiki<https://fr.wikipedia.org/wiki/ISO_8601#Dur%C3%A9e>`__ ,60000 millisecondes
restrictedToStep ,Boolean, "| True si le filtre doit respecter le pas de temps depuis
| l'attribut **minDate**.
|
| Sinon le pas de temps est respecté selon l'attribut **begin**" ,True | False ,False
calendarModeYearBoolean,,"| Lorsque true, l’interface présentera uniquement des
| années et ajustera les requête aux service pour
| que l’année de début et de fin soit incluse dans
| le retour.",True | False ,False
12 changes: 8 additions & 4 deletions docs/_tables/fr/properties/filter/igoogcfilterduringoptions.csv
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
Propriétés,Type,Description,Valeurs possibles,Valeur défaut
begin ,String ,Valeur de début du filtre temporel ,,Valeur **minDate** de la couche
end ,String ,Valeur de fin du filtre temporel ,,Valeur **maxDate** de la couche
step ,String ,Pas de temps défini selon la norme ISO-8601 ,Voir `wiki <https://fr.wikipedia.org/wiki/ISO_8601#Dur%C3%A9e>`__ ,60000 millisecondes
begin ,String ,Valeur de début du filtre temporel ,,Valeur **minDate** de la couche
end ,String ,Valeur de fin du filtre temporel ,,Valeur **maxDate** de la couche
step ,String ,Pas de temps défini selon la norme ISO-8601 ,Voir `wiki <https://fr.wikipedia.org/wiki/ISO_8601#Dur%C3%A9e>`__ ,60000 millisecondes
restrictedToStep ,Boolean,"| True si le filtre doit respecter le pas de temps depuis
| l'attribut **minDate**.
|
| Sinon le pas de temps est respecté selon l'attribut **begin**",True | False ,False
| Sinon le pas de temps est respecté selon l'attribut **begin**",True | False ,False
calendarModeYearBoolean,,"Lorsque true, l’interface présentera uniquement des
| années et ajustera les requête aux service pour
| que l’année de début et de fin soit incluse dans
| le retour.",True | False ,False
67 changes: 67 additions & 0 deletions docs/properties.rst
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,56 @@ Liens
- `OGC WMS <https://www.opengeospatial.org/standards/wms>`__


WMS avec WFS combinés
======================


.. note::

Disponible actuellement mais la documentation est en cours de construction.

.. line-block::

Il est possible de combiner un wms et à partir d'une certaine échelle d'apeller la couche en WFS si le service web offre les 2 options.

** Attention le champ ID du service doit être bien définie car ce sera ce champ qui servira a reconnaitre chaque entitée WFS, par exemple dans
la table attributaire. Si le champ id n'est pas bien définie dans le service ou que vous configurez une sortie dans un type ou ID n'est
pas présent au 1er niveau de l'objet dans le retour du service (geojson, GML, etc), vous pourez avoir des problèmes d'entitées qui sont dédoublées.


Exemples

.. code:: json
{"title": "WMS with underlying WFS params",
"visible": true,
"maxResolution": 1200,
"workspace": {
"enabled": true,
"maxResolution": 100
},
"sourceOptions": {
"queryable": true,
"queryTitle": "nometablis",
"type": "wms",
"url": "https://ws.mapserver.transports.gouv.qc.ca/swtq",
"urlWfs": "https://ws.mapserver.transports.gouv.qc.ca/swtq",
"params": {
"layers": "etablissement_mtq"
},
"paramsWFS": {
"featureTypes": "etablissement_mtq",
"fieldNameGeometry": "geometry",
"maxFeatures": 5000
},
"ogcFilters": {
"enabled": true,
"editable": true
}
}
}
WMTS
===============

Expand Down Expand Up @@ -1072,6 +1122,22 @@ Exemple - Filtre temporel avec minimum, maximum et pas de temps.
"stepDate": "P1D"
}
Exemple - filtre temporel en mode année

.. code:: json
{
"filters" :{
"operator": "During",
"propertyName": "annee_date",
"begin": "1890-01-01T00:00:00-05:00",
"end": "2021-12-31T00:00:00-05:00",
"restrictedToStep": false,
"calendarModeYear": true
}
"stepDate": "P1Y"
}
Exemple - filtre avec boutons spécifique à un groupe et calendrier (filtrage temporel)

.. code:: json
Expand Down Expand Up @@ -1227,6 +1293,7 @@ Propriétés de l'objet filters (IgoLogicalArrayOptions|AnyBaseOgcFilterOptions)

.. _igoogcfilterduringoptions:


Propriétés de l'objet filter de type **During**

.. tabularcolumns:: |p{1cm}|p{2cm}|p{7cm}|p{2cm}|p{2cm}|
Expand Down
16 changes: 4 additions & 12 deletions src/app/pages/portal/portal.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,10 @@
(click)="onBackdropClick()">
</igo-backdrop>

<button
mat-icon-button
id= "menu-button"
[ngClass]="menuButtonClass"
color="primary"
tooltip-position="below"
matTooltipShowDelay="500"
[matTooltip]="(sidenavOpened ? 'menu.close' : 'menu.open') | translate"
(click)="onToggleSidenavClick()">
<mat-icon svgIcon="menu">
</mat-icon>
</button>
<igo-menu-button
[sidenavOpened]="sidenavOpened"
(openSidenav)="onToggleSidenavClick()">
</igo-menu-button>

<igo-search-bar
#searchBar
Expand Down
29 changes: 1 addition & 28 deletions src/app/pages/portal/portal.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,42 +22,15 @@

/*** Menu button ***/

.menu-button-reverse-color {
height: 40px;
igo-menu-button {
position: absolute;
top: 3px;
z-index: 4;
border-radius: 0;
height: 45px;
width: 48px;
}

.menu-button-reverse-color-close {

position: absolute;
left: $igo-margin;
top: $igo-margin;
z-index: 4;
border-radius: 0;
}

mat-icon.disabled {
color: rgba(0, 0, 0, 0.38);
}

.menu-button {
background-color: $app-background-color;
position: absolute;
left: $igo-margin;
top: $igo-margin;
z-index: 4;
border-radius: 0;
}

.menu-button ::ng-deep div.mat-button-ripple-round {
border-radius: 0;
}

/*** Map browser ***/
igo-map-browser {
width: 100%;
Expand Down
86 changes: 55 additions & 31 deletions src/app/pages/portal/portal.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from '@angular/core';
import { ActivatedRoute, Params } from '@angular/router';
import { Subscription, of, BehaviorSubject, combineLatest } from 'rxjs';
import { debounceTime, take, pairwise, skipWhile } from 'rxjs/operators';
import { debounceTime, take, pairwise, skipWhile, first } from 'rxjs/operators';
import { MatDialog, MatDialogConfig } from '@angular/material/dialog';
import MapBrowserEvent from 'ol/MapBrowserEvent';
import * as olProj from 'ol/proj';
Expand Down Expand Up @@ -63,7 +63,8 @@ import {
WfsWorkspace,
FeatureWorkspace,
generateIdFromSourceOptions,
computeOlFeaturesExtent
computeOlFeaturesExtent,
addStopToStore
} from '@igo2/geo';

import {
Expand All @@ -72,7 +73,8 @@ import {
SearchState,
QueryState,
ContextState,
WorkspaceState
WorkspaceState,
DirectionState
} from '@igo2/integration';

import {
Expand Down Expand Up @@ -125,8 +127,6 @@ export class PortalComponent implements OnInit, OnDestroy {
};
public workspaceMenuClass = 'workspace-menu';

public menuButtonClass;

public fullExtent = this.storageService.get('fullExtent') as boolean;
private workspaceMaximize$$: Subscription[] = [];
readonly workspaceMaximize$: BehaviorSubject<boolean> = new BehaviorSubject(
Expand Down Expand Up @@ -159,7 +159,6 @@ export class PortalComponent implements OnInit, OnDestroy {
undefined
);
private routeParams: Params;
private menuButtonReverseColor = false;
public toastPanelHtmlDisplay = false;

@ViewChild('mapBrowser', { read: ElementRef, static: true })
Expand Down Expand Up @@ -310,7 +309,8 @@ export class PortalComponent implements OnInit, OnDestroy {
private welcomeWindowService: WelcomeWindowService,
public dialogWindow: MatDialog,
private queryService: QueryService,
private storageService: StorageService
private storageService: StorageService,
private directionState: DirectionState
) {
this.hasExpansionPanel = this.configService.getConfig('hasExpansionPanel');
this.hasGeolocateButton =
Expand All @@ -329,15 +329,6 @@ export class PortalComponent implements OnInit, OnDestroy {
if (this.igoSearchPointerSummaryEnabled === undefined) {
this.igoSearchPointerSummaryEnabled = this.storageService.get('searchPointerSummaryEnabled') as boolean || false;
}

if (
typeof this.configService.getConfig('menuButtonReverseColor') !==
'undefined'
) {
this.menuButtonReverseColor = this.configService.getConfig(
'menuButtonReverseColor'
);
}
}

ngOnInit() {
Expand Down Expand Up @@ -449,7 +440,6 @@ export class PortalComponent implements OnInit, OnDestroy {
this.openSidenav();
this.toolState.openSidenav$.next(false);
}
this.menuButtonClass = this.getClassMenuButton();
}
);

Expand All @@ -473,20 +463,6 @@ export class PortalComponent implements OnInit, OnDestroy {
}
}

getClassMenuButton() {
if (this.sidenavOpened) {
return {
'menu-button': this.menuButtonReverseColor === false,
'menu-button-reverse-color': this.menuButtonReverseColor === true
};
} else {
return {
'menu-button': this.menuButtonReverseColor === false,
'menu-button-reverse-color-close ': this.menuButtonReverseColor === true
};
}
}

workspaceVisibility(): boolean {
const wks = (this.selectedWorkspace$.value as WfsWorkspace | FeatureWorkspace);
if (wks.inResolutionRange$.value) {
Expand Down Expand Up @@ -1074,6 +1050,54 @@ export class PortalComponent implements OnInit, OnDestroy {
this.openSidenav();
}, 250);
}

if (this.routeParams['routing']) {
let routingCoordLoaded = false;
const stopCoords = this.routeParams['routing'].split(';');
const routingOptions = this.routeParams['routingOptions'];
let resultSelection: number;
if (routingOptions) {
resultSelection = parseInt(routingOptions.split('result:')[1], 10);
}
this.directionState.stopsStore.storeInitialized$
.pipe(skipWhile(init => !init), first())
.subscribe((init: boolean) => {
if (init && !routingCoordLoaded) {
routingCoordLoaded = true;
stopCoords.map((coord, i) => {
if (i > 1) {
addStopToStore(this.directionState.stopsStore);
}
});
setTimeout(() => {
stopCoords.map((coord, i) => {
const stop = this.directionState.stopsStore.all().find(e => e.position === i);
stop.text = coord;
stop.coordinates = coord.split(',');
this.directionState.stopsStore.update(stop);
});
}, this.directionState.debounceTime * 1.25); // this delay is due to the default component debounce time
}
});
// zoom to active route
this.directionState.routesFeatureStore.count$
.pipe(skipWhile(c => c < 1), first())
.subscribe(c => {
if (c >= 1) {
this.directionState.zoomToActiveRoute$.next();
}
});
// select the active route by url controls
this.directionState.routesFeatureStore.count$
.pipe(skipWhile(c => c < 2), first())
.subscribe(() => {
if (resultSelection) {
this.directionState.routesFeatureStore.entities$.value.map(d => d.properties.active = false);
this.directionState.routesFeatureStore.entities$.value[resultSelection].properties.active = true;
this.directionState.zoomToActiveRoute$.next();
}
});
}
}

private readLayersQueryParams(params: Params) {
Expand Down
14 changes: 0 additions & 14 deletions src/app/pages/portal/portal.theming.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,4 @@
@include app-sidenav-theming($theme);
@include igo-welcome-window-theming($theme);
$primary: map-get($theme, primary);

.menu-button-reverse-color-close {
background-color: mat.get-color-from-palette($primary);
color: mat.get-color-from-palette($primary, default-contrast);
}

.menu-button-reverse-color {
background-color: matget-color-from-palette($primary);
color: mat.get-color-from-palette($primary, default-contrast);
}

.menu-button {
color: mat.get-color-from-palette($primary);
}
}
2 changes: 1 addition & 1 deletion src/config/interactiveTour.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"position": "auto",
"steps": [
{
"element": ".menu-button",
"element": "#menu-button",
"title": "interactiveTour.global.menu-button-title",
"text": "interactiveTour.global.menu-button",
"onHide": {
Expand Down
Loading

0 comments on commit d0b3ba8

Please sign in to comment.