Custom Legend

2 messages Options
Embed this post
Permalink
Nolte, Tim

Custom Legend

Reply Threaded More More options
Print post
Permalink
I was working through the guide on how to build a customer Legend. Using
the sample doesn't work. The legend never even attempts to use the
custom JavaScript function. Here is what I did:

ApplicationDefinition.xml:

                <!-- LEGEND -->
                <Widget xsi:type="WidgetType">
                        <Name>StaticLegend</Name>
                        <Type>Legend</Type>
                        <StatusItem/>
                        <<Extension xsi:type="CustomContentType">
       
<LegendRenderer>VerySimpleLegend</LegendRenderer>
                        </Extension>
                </Widget>

mapviewer.php:

        Change in window.onload:

                var p1 = new Jx.Panel({label: 'Legend'});
                p1.content.id = 'StaticLegend';


        Added to the <script> section after the window.onload:

                function VerySimpleLegend() {
                        var div = this.oLegend.domObj;
                       
                        for (var i=0; i< this.layerRoot.groups.length;
i++) {
                                var currentGroup =
this.layerRoot.groups[i].groups;
                               
                                for (var j=0; j< currentGroup.length;
j++) {
                                        var group =
document.createElement('h2');
                                        group.innerHTML =
currentGroup[j].groupName;
                                        div.appendChild(group);
                                       
                                        for (var k=0;
k<currentGroup[j].layers.length; k++) {
                                                var span =
document.createElement('span');
                                                span.style.paddingLeft =
"10px";
                                                span.innerHTML =
currentGroup[j].layers[k].layerName;
                                                div.appendChild(span);
                                        }
                                }
                        }
                }

I need to create a custom Legend and I'm getting no where. I'm running
Fusion 1.0.6 & MapServer 5.2.0. I've got a base map defined for the over
map/widget and a full map defined for the main map widget. Any help here
would be greatly appreciated. Thanks.

- Tim

----
Timothy J Nolte - [hidden email]
Network Planning Engineer

iPCS Wireless, Inc.
4717 Broadmoor Ave, Suite G
Kentwood, MI 49512

Office: 616-656-5163
PCS:    616-706-2438
Fax:    616-554-6484
Web: www.ipcswirelessinc.com
_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
Paul Spencer-2

Re: Custom Legend

Reply Threaded More More options
Print post
Permalink
Tim, I think this behaviour is only in Alan's sandbox at the moment as  
it is experimental - we hope to include it in Fusion 1.1 later this  
summer.

Cheers

Paul

On 18-Jul-08, at 12:30 PM, Nolte, Tim wrote:

> I was working through the guide on how to build a customer Legend.  
> Using
> the sample doesn't work. The legend never even attempts to use the
> custom JavaScript function. Here is what I did:
>
> ApplicationDefinition.xml:
>
> <!-- LEGEND -->
> <Widget xsi:type="WidgetType">
> <Name>StaticLegend</Name>
> <Type>Legend</Type>
> <StatusItem/>
> <<Extension xsi:type="CustomContentType">
>
> <LegendRenderer>VerySimpleLegend</LegendRenderer>
> </Extension>
> </Widget>
>
> mapviewer.php:
>
> Change in window.onload:
>
> var p1 = new Jx.Panel({label: 'Legend'});
> p1.content.id = 'StaticLegend';
>
>
> Added to the <script> section after the window.onload:
>
> function VerySimpleLegend() {
> var div = this.oLegend.domObj;
>
> for (var i=0; i< this.layerRoot.groups.length;
> i++) {
> var currentGroup =
> this.layerRoot.groups[i].groups;
>
> for (var j=0; j< currentGroup.length;
> j++) {
> var group =
> document.createElement('h2');
> group.innerHTML =
> currentGroup[j].groupName;
> div.appendChild(group);
>
> for (var k=0;
> k<currentGroup[j].layers.length; k++) {
> var span =
> document.createElement('span');
> span.style.paddingLeft =
> "10px";
> span.innerHTML =
> currentGroup[j].layers[k].layerName;
> div.appendChild(span);
> }
> }
> }
> }
>
> I need to create a custom Legend and I'm getting no where. I'm running
> Fusion 1.0.6 & MapServer 5.2.0. I've got a base map defined for the  
> over
> map/widget and a full map defined for the main map widget. Any help  
> here
> would be greatly appreciated. Thanks.
>
> - Tim
>
> ----
> Timothy J Nolte - [hidden email]
> Network Planning Engineer
>
> iPCS Wireless, Inc.
> 4717 Broadmoor Ave, Suite G
> Kentwood, MI 49512
>
> Office: 616-656-5163
> PCS:    616-706-2438
> Fax:    616-554-6484
> Web: www.ipcswirelessinc.com
> _______________________________________________
> fusion-users mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/fusion-users


__________________________________________

    Paul Spencer
    Chief Technology Officer
    DM Solutions Group Inc
    http://www.dmsolutions.ca/

_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users