Ticket #56 (assigned enhancement)

Opened 4 years ago

Last modified 4 years ago

Support inRange property in layer tree

Reported by: sypasche Owned by: fvanderbiest
Priority: blocker Milestone: Future
Component: Tree.client Version: SVN
Keywords: layertree node enabling disabling Cc:
State:

Description

It should watch the inRange property of the displayed layers, and set a class accordingly.

This would allow the out of scale layers to be grayed out or added out of scale icons.

Change History

  Changed 4 years ago by fvanderbiest

  • keywords layertree node enabling disabling added
  • type changed from defect to enhancement

Here's a different approach to the pb of enabling/disabling nodes in the layerTree. Maybe it's not relevant, but at least, I gave it a try.

I simply added minscale and maxscale attributes to the nodes for which it is useful. Here's some code in Layer Tree?.js that does it :

    /**
     * Updates the tree to enable/disable nodes based on their min/maxscale attributes.
     */
    updateDisabled: function() {
        var mapScale = this.map.getScale();
        this.getRootNode().cascade(function(node) {
            if ((node.attributes.minscale && mapScale<node.attributes.minscale)
                ||(node.attributes.maxscale && mapScale>node.attributes.maxscale))
                node.disable();
            else
                node.enable();
        }, this);
    }

Then, I just added in my app code :

map.events.register('zoomend', map, function(){layerTree.updateDisabled();});

When ticket #66 is fixed, this should be part of Layer Tree? code.

follow-up: ↓ 3   Changed 4 years ago by pgiraud

  • milestone set to 0.3 Release

We could use the 'changelayer' event on the map instead because layer visibility has changed. Then, this would be a control that detects that the layer visibility has changed and not only that it is out of range.

in reply to: ↑ 2   Changed 4 years ago by fvanderbiest

  • owner changed from sypasche to fvanderbiest
  • status changed from new to assigned

Replying to pgiraud:

We could use the 'changelayer' event on the map instead because layer visibility has changed. Then, this would be a control that detects that the layer visibility has changed and not only that it is out of range.

I do not think that this approach allows for enough flexibility.

Let's think of a situation, where you have one OL layer, combining several WMS layers, each of them having different min/maxScale (set by the WMS configuration). Then, you would not be able to grey individual nodes in the layerTree (corresponding to each WMS layer) depending on the current map resolution.

Or, do I miss something ?

follow-up: ↓ 5   Changed 4 years ago by pgiraud

Okay, given this particular use case, I know think that this should be addressed in an other ticket. Please don't hesitate to open one, for you WMS sublayers specificity.

I'm still convinced that the changelayer event is the one to use to handle the layers inRange property.

in reply to: ↑ 4   Changed 4 years ago by fvanderbiest

Replying to pgiraud:

Okay, given this particular use case, I now think that this should be addressed in an other ticket. Please don't hesitate to open one, for you WMS sublayers specificity.

Done : http://trac.mapfish.org/trac/mapfish/ticket/114

I'm still convinced that the changelayer event is the one to use to handle the layers inRange property.

Me too :-) Both approaches will be necessary IMO.

  Changed 4 years ago by elemoine

  • milestone changed from 0.3 Release to Future

I agree with pgiraud that this particular ticket could be addressed by having the layer tree listen to the changelayer map event. But since we don't have a patch for this, I'm bumping the ticket to milestone Future.

Note: See TracTickets for help on using tickets.