Skip to content

Commit

Permalink
feat(spatial-filter): link spatial filter to export tool (#662)
Browse files Browse the repository at this point in the history
Co-authored-by: Marc-André Barbeau <marc-andre.barbeau@msp.gouv.qc.ca>
  • Loading branch information
PhilippeLafreniere18 and mbarbeau committed Jun 8, 2020
1 parent 7a26ddc commit 2ac67f1
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 6 deletions.
Expand Up @@ -121,11 +121,14 @@
{{'igo.geo.spatialFilter.goSearch' | translate}}
</button>

<button *ngIf="selectedSourceAddress || selectedThematics" mat-raised-button class="remove-button"
[disabled]="!layers.length" (click)="clearButton()">
<button mat-raised-button class="remove-button" [disabled]="!store.entities$.getValue().length" (click)="clearButton()">
{{'igo.geo.spatialFilter.removeLayer' | translate}}
</button>

<button mat-raised-button class="export-button" [disabled]="!store.entities$.getValue().length" (click)="export.emit()">
{{'igo.geo.spatialFilter.exportLayer' | translate}}
</button>

</div>

<div class="results" *ngIf="store">
Expand Down
Expand Up @@ -52,8 +52,7 @@
}

.remove-button {
left: 75px;
margin: 15px;
margin: 12px;
width: 150px;
}

Expand Down
Expand Up @@ -147,6 +147,8 @@ export class SpatialFilterItemComponent implements OnDestroy, OnInit {

@Output() clearSearchEvent = new EventEmitter();

@Output() export = new EventEmitter();

public itemType: SpatialFilterItemType[] = [SpatialFilterItemType.Address, SpatialFilterItemType.Thematics];
public selectedItemType: SpatialFilterItemType = SpatialFilterItemType.Address;
public selectedSourceAddress;
Expand Down
1 change: 1 addition & 0 deletions packages/geo/src/locale/en.geo.json
Expand Up @@ -377,6 +377,7 @@
"layer": "Layer",
"goSearch": "Launch research",
"removeLayer": "Remove results",
"exportLayer": "Export results",
"clearForm": "Remove draw",
"clearSearch": "Reset",
"Address": "Addresses",
Expand Down
1 change: 1 addition & 0 deletions packages/geo/src/locale/fr.geo.json
Expand Up @@ -379,6 +379,7 @@
"layer": "Couche",
"goSearch": "Lancer la recherche",
"removeLayer": "Retirer les résultats",
"exportLayer": "Exporter les résultats",
"clearForm": "Retirer le dessin",
"clearSearch": "Réinitialiser",
"Address": "Adresses",
Expand Down
Expand Up @@ -23,7 +23,8 @@
(thematicChange)="thematics = $event"
(toggleSearch)="getOutputToggleSearch()"
(clearButtonEvent)="layers = $event"
(clearSearchEvent)="getOutputClearSearch()">
(clearSearchEvent)="getOutputClearSearch()"
(export)="activateExportTool()">
</igo-spatial-filter-item>
</igo-panel>

Expand Down
Expand Up @@ -26,8 +26,10 @@ import { EntityStore, ToolComponent } from '@igo2/common';
import olFormatGeoJSON from 'ol/format/GeoJSON';
import { BehaviorSubject } from 'rxjs';
import { MapState } from '../../map/map.state';
import { ImportExportState } from './../../import-export/import-export.state';
import * as olstyle from 'ol/style';
import { MessageService, LanguageService } from '@igo2/core';
import { ToolState } from '../../tool/tool.state';

/**
* Tool to apply spatial filter
Expand Down Expand Up @@ -81,7 +83,9 @@ export class SpatialFilterToolComponent {
private layerService: LayerService,
private mapState: MapState,
private messageService: MessageService,
private languageService: LanguageService
private languageService: LanguageService,
private importExportState: ImportExportState,
private toolState: ToolState
) {}

getOutputType(event: SpatialFilterType) {
Expand All @@ -97,6 +101,11 @@ export class SpatialFilterToolComponent {
}
}

activateExportTool() {
this.importExportState.setSelectedTab(1);
this.toolState.toolbox.activateTool('importExport');
}

private loadFilterList() {
this.spatialFilterService
.loadFilterList(this.queryType)
Expand Down

0 comments on commit 2ac67f1

Please sign in to comment.