10
Mar
11

SelectWithin – MapGuide 2011 or MG OpenSource Fix for FUSION

I really like the widgets in MapGuide Flexible Web Layouts a.k.a Fusion.

I had a weird issue where I buffered an area and wanted to select within that buffer those layers available to select (in my case ‘Parcels’).  But the list of selected layers include those that are hidden in Groups that aren’t even turned on.

Here is how to fix MapGuide so you only get the list of selectable layers that are actually turned on:

In the C:\Program Files\Autodesk\MapGuideEnterprise2011\WebServerExtensions\www\fusion\widgets\SelectWithin\ folder open the SelectWithinPanel.templ page in notepad.exe.

we want to replace the FillLayerList() function with the following:

function FillLayerList()
{
 //GL: FILTER BASED ON LEGEND
 var currentVisibleLayer=0;
 var list = document.getElementById("layers");
 var listNames = document.getElementById("layerNames");
 list.options.length = 0;
 var map = GetParent().Fusion.getMapByName(mapName);
 var layers = map.aMaps[0].getSelectableLayers();
 if(layers.length > 0) {
 for(var i = 0; i < layers.length; i++) {
 var layer = layers[i];
 if(layer.visible)
 {
 var groupVisible = true;
 var currentGroup = layer.parentGroup;
 while(currentGroup.name != "layerRoot")
 {
 if(!currentGroup.visible)
 groupVisible=false; 
 currentGroup = currentGroup.parentGroup;
 
 }
 if(groupVisible!=false)
 {
 list.options[currentVisibleLayer] = new Option(layer.legendLabel != ""? layer.legendLabel: layer.layerName);
 if (i == 0) list.options[0].selected = true;
 listNames.options[currentVisibleLayer] = new Option(layer.layerName);
 currentVisibleLayer++;
 }
 }
 }
 } else {
 
 list.options[0] = new Option("__#BUFFERNOLAYER#__");
 }
 document.getElementById("Done").disabled = layers.length == 0;
}
Advertisements

4 Responses to “SelectWithin – MapGuide 2011 or MG OpenSource Fix for FUSION”


  1. May 4, 2011 at 12:49 pm

    has this been filed in the fusion trac?

  2. May 4, 2011 at 1:21 pm

    Not sure Zac. I’ll have a look.

  3. May 4, 2011 at 1:52 pm

    Ok just checked. Nope.
    I don’t have access to file bugs in fusion.

  4. 4 Faisal
    January 6, 2013 at 6:59 pm

    Dear Gordon

    Kindly tell me how i can use .png images as symbols of point type layers in maestro

    Thanks and Regards


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Gordon Luckett

Arrow Geomatics Inc's Gordon Luckett

Contact

gordon dot luckett at arrowgeo dot com 1-519-837-9500 (Arrow Geomatics Inc.)

Checkout MapGuide Guy’s Youtube Channel

gordonluckett@twitter


%d bloggers like this: