Ticket #56 (assigned enhancement)

Opened 1 year ago

Last modified 4 months ago

Support inRange property in layer tree

Reported by: sypasche Assigned to: fvanderbiest (accepted)
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

01/30/08 10:17:39 changed by fvanderbiest

  • keywords set to layertree node enabling disabling.
  • state changed.
  • 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 ) 04/04/08 17:59:35 changed 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 ) 04/21/08 11:19:12 changed 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 ) 04/22/08 17:20:11 changed 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 ) 04/22/08 18:04:08 changed 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.

09/03/08 13:23:09 changed 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.