The QueryMapFeatures request that gets sent to MapGuide from these functions 
goes through the same process that is used to render the map, and therefore any 
layers not visible at the current scale *should* get filtered out anyway. How 
much of a performance difference do you get when you select a feature?

Regardless of the impact, the current code is wrong and so it would be great if 
you could create a ticket for this issue. 

Having said that, the code you've included below would actually introduce a new 
problem, because layers that are not visible in the legend, but are still 
visible and selectable in the map, will have node.isDisplayed = false. 

I looked through the code to see if there are any other node properties that 
correspond exactly to the current visibility of the layer and I couldn't find 
one. However (node.visible && (node.curScale != -1)) seems to give the required 
value. node.visible reflects whether or not the layer is enabled (e.g. 
unchecking it in the legend sets the value to false). node.curScale corresponds 
to the scale range for the layer that is currently active, and it gets set to 
-1 when the layer is out of visible range.

I hope this all makes sense...

Chris.

-----Original Message-----
From: mapguide-users-boun...@lists.osgeo.org 
[mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of Bruno Scott
Sent: Thursday, March 05, 2009 8:14 AM
To: mapguide-users@lists.osgeo.org
Subject: [mapguide-users] Defect : Confusion between layer.visible and 
layer.isDisplayed


Using fiddler i found something interresting in two mapguide ajax functions
  QueryFeatureInfo (when selecting a feature )
and
  RequestHyperLinkData (when mouse over a feature)

These 2 functions calls GetVisSelLayers or GetVisLayers 
then GetLayers(onlyVisible, onlySelectable)
the DoGetLayers

This function returns the list of all either visible and/or selectable
layers
this is the code
function DoGetLayers(nodes, layers, onlyVisible, onlySelectable)
{
    for(var i=0; i < nodes.length; i++)
    {
        var node = nodes[i];
        if(node.type == 0)
        {
            if(onlyVisible && !node.visible)
                continue;
            if(node.children != null && node.children.length > 0)
                DoGetLayers(node.children, layers, onlyVisible,
onlySelectable);
        }
        else if(node.type == 1)
        {
            if(onlyVisible && !node.visible)
                continue;
            if(onlySelectable && !node.selectable)
                continue;
            layers.push(new Layer(node.legend, node.name, node.objectId));
        }
    }
}
It should be
function DoGetLayers(nodes, layers, onlyVisible, onlySelectable)
{
    for(var i=0; i < nodes.length; i++)
    {
        var node = nodes[i];
        if(node.type == 0)
        {
            if(onlyVisible && !node.isDisplayed)
                continue;
            if(node.children != null && node.children.length > 0)
                DoGetLayers(node.children, layers, onlyVisible,
onlySelectable);
        }
        else if(node.type == 1)
        {
            if(onlyVisible && !node.isDisplayed)
                continue;
            if(onlySelectable && !node.selectable)
                continue;
            layers.push(new Layer(node.legend, node.name, node.objectId));
        }
    }
}

This little defect does not make a big difference on a map like Sheboygan
But mine is Oracle based and has more than 300 layers.
Most of them are eventually visible at a given (low)scale but not displayed
at all.
When i select a feature or i mouse over it, it query the mapguide server
with hundreds of not displayed layers. You bet, things get very slow.

I've made some search on the ajax viewer code and found that this function
is only called by
  QueryFeatureInfo
  RequestHyperLinkData
  selectwithin

Do you aggree that i fill a ticket and a diff patch?

Bruno Scott


-- 
View this message in context: 
http://n2.nabble.com/Defect-%3A-Confusion-between-layer.visible-and-layer.isDisplayed-tp2430031p2430031.html
Sent from the MapGuide Users mailing list archive at Nabble.com.

_______________________________________________
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users
_______________________________________________
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users

Reply via email to