[fusion-users] Custom Legend

Nolte, Tim Tim.Nolte at ipcswirelessinc.com
Fri Jul 18 12:30:14 EDT 2008


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 - tnolte at ilpcs.com
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


More information about the fusion-users mailing list