Skip to content

Commit

Permalink
feat(layerSync): prevent refresh of linked layer if applied OGC filte…
Browse files Browse the repository at this point in the history
…rs are the same (#1027)

* feat(layerSync): prevent refresh of linked layer if applied OGC filter are the same

* wip

Co-authored-by: Pierre-Étienne Lord <pe_lord@yahoo.ca>
  • Loading branch information
pelord and Pierre-Étienne Lord committed Mar 29, 2022
1 parent 0a0fba1 commit f4affea
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/geo/src/lib/layer/utils/layerSync-watcher.ts
Expand Up @@ -172,7 +172,9 @@ export class LayerSyncWatcher extends Watcher {
const layerType = layerToApply.ol.getProperties().sourceOptions.type;
(layerToApply.dataSource as OgcFilterableDataSource).setOgcFilters(ogcFilters, false);
if (layerType === 'wfs') {
layerToApply.ol.getSource().refresh();
if (ogcFilters !== (layerToApply.dataSource as OgcFilterableDataSource).ogcFilters$.value) {
layerToApply.ol.getSource().refresh();
}
}
if (layerType === 'wms') {
let appliedOgcFilter;
Expand Down Expand Up @@ -200,8 +202,10 @@ export class LayerSyncWatcher extends Watcher {
l.bidirectionnal !== false && l.linkedIds.indexOf(currentLinkedId) !== -1) {
const layerType = layer.ol.getProperties().sourceOptions.type;
if (layerType === 'wfs') {
(layer.dataSource as OgcFilterableDataSource).setOgcFilters(ogcFilters, true);
layer.ol.getSource().refresh();
if (ogcFilters !== (layer.dataSource as OgcFilterableDataSource).ogcFilters$.value) {
(layer.dataSource as OgcFilterableDataSource).setOgcFilters(ogcFilters, true);
layer.ol.getSource().refresh();
}
}
if (layerType === 'wms') {
let appliedOgcFilter;
Expand Down

0 comments on commit f4affea

Please sign in to comment.