Custom Legend Control - Nothing Fancy

1869
5
10-22-2012 11:08 AM
JustinWilson
New Contributor II
Hello Everyone,

I'm fairly new to the ArcGIS Forums, but I have been doing some development work with our GIS department for some time.  I decided to upload a legend control that I have been working on to the site.

Requirements:

  • agslib-2.3.1.swc

  • as3corelib

  • Flex 4.5.1

[ATTACH=CONFIG]18640[/ATTACH]

<esri:Map id="map" width="500" height="500">
    <esri:ArcGISDynamicMapServiceLayer id="DL_BaseMap" name="My Base Map" url="http://....../MapServer"/>
    <esri:ArcGISDynamicMapServiceLayer id="DL_Planning" name="County Planning" url="http://....../MapServer"/>
</esri:Map>

<legend:JLegend id="myLegend" x="600" y="0" width="350" height="100%"  Map="{map}"/>

Edit: 10/23/2012 - The Layer ID needs to have the DL_.  It's how I chose to pick the layers I wish to get the legend for.

http://www.forsythco.com/gis/jlegend/jlegend_1.2.0.zip ALSO ATTACHED
0 Kudos
5 Replies
by Anonymous User
Not applicable
Original User: nelsm

I really like what you have done here. I 'm trying to do something similar. Do you have a newer version for agslib302102? When it first loads it shows the layers on in the map service and they draw properly, but the first time you turn on another layer it tuns off all the "default" layers and turns on the one you clicked. From then on it seems to manage events OK. Also....what type of container shoudl the legend be placed? I currently have it in a tab container and scrolling is grayed out even though I have it enabled. Any advice? Any chance I coudl peak under the hood of the SWC?

Thanks for posting this!
0 Kudos
JustinWilson
New Contributor II
what type of container shoudl the legend be placed? I currently have it in a tab container and scrolling is grayed out even though I have it enabled. Any advice? Any chance I coudl peak under the hood of the SWC?

Thanks for posting this!


I'm so sorry for taking so long to respond.  I'm really not very good at keeping active on the Forum.  We used the legend in an Accordion in the NavigationContent tag. The interface guy sent me this:
<mx:Accordion id="myAccordion" right="0" top="95" width="300" height="100%" chromeColor="#DFDBC1" color="#142B41" 
                          depth="1" fontFamily="calibri" fontWeight="bold" fontSize="14" openDuration="500" openEasingFunction="{Circular.easeOut}">
            <s:NavigatorContent id="accForm" width="100%" height="100%" backgroundColor="#28435D" label="TOOL FORM">
            </s:NavigatorContent>
            <s:NavigatorContent id="accresults" width="100%" height="100%" backgroundColor="#28435D" label="RESULTS"></s:NavigatorContent>
            <s:NavigatorContent id="accLayers" width="100%" height="100%" backgroundColor="#FAFAF6" label="LAYERS">
                  <s:layout>
                        <s:VerticalLayout paddingLeft="8" paddingRight="2"/>
                  </s:layout>
                  <legend:JLegend height="{accLayers.height - 5}" width="{accLayers.width - 10}" horizontalCenter="{accLayers}" id="jl" Map="{map}"/>
                  
            </s:NavigatorContent>
      </mx:Accordion>


That's how he's using it.  We had some issued with the scroll bar not showing up, but in our case it was due to the positioning.  You may want to put it in another control that allows scrolling.  The version we use is one newer that what was posted as we found a slight bug. I'm attaching the class library for this control.  Hope it helps!  Also, hope it's not irrelevant anymore.  We're moving to the JavaScript API. I'm hoping to remake this in JS.

Here is our application:  http://maps.forsythco.com/
0 Kudos
by Anonymous User
Not applicable
Original User: rioman

hi.. i love your http://maps.forsythco.com/ design. I'M new with flex and i also doesn't know about coding. can you give me the zip file for this project. i want to take a look at it with flash builder. i got flash builder 4.6. thanks.
0 Kudos
JustinWilson
New Contributor II
For that project, I only built the class library for the legend and the top button bar.  I didn't make the design.   I'll check with our GUI designer and see if they are willing to share the project.  I think he did it in 4.5, but that shouldn't make a huge difference.  I'll check back in Monday.
0 Kudos
by Anonymous User
Not applicable
Original User: rioman

Hi sumof2cubes. Any good news?
0 Kudos