Skip to content

Commit

Permalink
Merge pull request #798 from Flexberry/rgis-develop
Browse files Browse the repository at this point in the history
Rgis develop
  • Loading branch information
DaryaNeko authored Aug 15, 2023
2 parents adff7d0 + 82f2b47 commit 63a3803
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 1 deletion.
43 changes: 43 additions & 0 deletions addon/components/flexberry-maplayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,16 @@ let FlexberryMaplayerComponent = Ember.Component.extend(
*/
onVisibilityCheckboxChange(...args) {
this.sendAction('changeVisibility', ...args);

if (!this.get('layer')) {
console.error('layer is not defined');
return;
}

// When enabling a layer, enable all groups recursively
if (this.get('layer.visibility')) {
this.sendAction('enableGroupVisibility');
}
},

/**
Expand Down Expand Up @@ -893,6 +903,39 @@ let FlexberryMaplayerComponent = Ember.Component.extend(
this.set('_addDialogIsVisible', true);
},

/**
Processes the visibility of a group layer when the visibility of inner layers is changed
@method actions.enableGroupVisibility
*/
enableGroupVisibility() {
let layer = this.get('layer');

if (!layer) {
console.error('layer is not defined');
return;
}

if (!this.get('isGroup')) {
return;
}

if (this.get('compare.compareLayersEnabled') && !this.get('ignoreCompareMode')) {
let side = this.get('compare.side');
let compareSettings = this.get(`compare.compareState.${side}`);
let sideGroupLayers = compareSettings.groupLayersEnabled;
let isGroupVisibleInCompareTree = !!sideGroupLayers.find(id => id === layer.get('id'));

if (!isGroupVisibleInCompareTree) {
this.setGroupLayerBySide(layer, this.get('compare.side'), this.get('leafletMap'));
}
} else {
Ember.set(layer, 'visibility', true);
}

this.sendAction('enableGroupVisibility');
},

/**
Handles add dialog's 'approve' action.
Invokes component's {{#crossLink "FlexberryMaplayerComponent/sendingActions.add:method"}}'add'{{/crossLink}} action.
Expand Down
4 changes: 4 additions & 0 deletions addon/components/flexberry-maplayers.js
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,10 @@ let FlexberryMaplayersComponent = Ember.Component.extend(
this.sendAction(actionName, layer);
},

enableGroupVisibility() {
this.sendAction('enableGroupVisibility');
},

onAllLayerVisibilityChanged(e) {
this.set('allLayerVisible', !this.get('allLayerVisible'));
let visibility = this.get('allLayerVisible');
Expand Down
6 changes: 5 additions & 1 deletion addon/mixins/compare-layers.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,16 @@ export default Ember.Mixin.create({
const isEnabled = !!sideGroupLayers.find(id => id === layer.get('id'));
if (isEnabled) {
sideGroupLayers = sideGroupLayers.filter(id => id !== layer.get('id'));
let disableLayers = sideChildLayers.filter(l => l.parentIds.includes(layer.get('id')) && this.parentLayersVisible(l.parentIds, side));
Ember.set(settings, 'groupLayersEnabled', [...sideGroupLayers]);
let disableLayers = sideChildLayers.filter(l => l.parentIds.includes(layer.get('id')));
disableLayers.forEach((l) => this.setLayerBySide(l.layer, side, map));
} else {
sideGroupLayers.push(layer.get('id'));
Ember.set(settings, 'groupLayersEnabled', [...sideGroupLayers]);
let layersToEnable = sideChildLayers.filter(l => l.parentIds.includes(layer.get('id')) && this.parentLayersVisible(l.parentIds, side));
layersToEnable.forEach((l) => this.setLayerBySide(l.layer, side, map));

this.sendAction('enableGroupVisibility');
}
},

Expand Down Expand Up @@ -124,6 +126,8 @@ export default Ember.Mixin.create({
if (this.parentLayersVisible(parentIds, side)) {
this.setLayerBySide(layer, side, map);
}

this.sendAction('enableGroupVisibility');
}
},

Expand Down
1 change: 1 addition & 0 deletions addon/templates/components/flexberry-maplayer.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@
sideBySide=sideBySide
leftLayer=leftLayer
rightLayer=rightLayer
enableGroupVisibility=(action 'enableGroupVisibility')
isGroup=isGroup
backgroundLayers=backgroundLayers
ignoreCompareMode=ignoreCompareMode
Expand Down
1 change: 1 addition & 0 deletions addon/templates/components/flexberry-maplayers.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
rightLayer=rightLayer
closeOtherCalendar = (action "closeOtherCalendar")
layerTimeChanged=(action "onLayerTimeChanged")
enableGroupVisibility=(action 'enableGroupVisibility')
dynamicButtons=dynamicButtons
external=(action 'external')
backgroundLayers=backgroundLayers
Expand Down

0 comments on commit 63a3803

Please sign in to comment.