Select to view content in your preferred language

Table of Contents (TOC) and Legend

1953
2
03-08-2012 07:16 AM
ionarawilson1
Deactivated User
Default Table of Contents (TOC) and Legend

    Hi folks,

    I need help with the TOC Table of Content ArcScript posted on the arcscript page by Tom Hill. I am developing a Flex app outside of the Flex Viewer. I need to have the Group TOC and the legends. I was already able to put together the website with the map, the group TOC and the legend using the esri Legend component. What I need help is with the following:

    1 - Have one layer always visible (in my case the county layer)
    2 - Have all the other layers off when another layer (other than the layer that is always visible, the counties layer) is checked on
    3- Have the legend pop up for the layer that is checked on (right now I would have the legend visible for all the layers that are checked on, I just need to have one single for the one layer checked on)
    4- When there are two sublayers, the legends should be side-by-side not on top of one another vertically

    I am attaching the image of my web app, the TOC arcscript I usde for the group TOC and part of the script of my main app so far:


...
    <!-- Forestry -->
    <esri:ArcGISDynamicMapServiceLayer id="ForIndirectBusinessTax" visible="false" url="http://tfs-24279/ArcGIS/rest/services/TFEI_sorted_counties_2009_totals_added_forestry_indirect_bus_t..." />
    <esri:ArcGISDynamicMapServiceLayer id="ForLaborOutput" visible="false" url="http://tfs-24279/ArcGIS/rest/services/TFEI_sorted_counties_2009_totals_added_forestry_labor_ouptput_..." />
    <esri:ArcGISDynamicMapServiceLayer id="ForEmploymentOutput" visible="false" url="http://tfs-24279/ArcGIS/rest/services/TFEI_sorted_counties_2009_totals_added_forestry_employment_oup..." />
    <esri:ArcGISDynamicMapServiceLayer id="ForIndustryOutput" visible="false" url="http://tfs-24279/ArcGIS/rest/services/TFEI_sorted_counties_2009_totals_added_forestry_industry_ouptp..."/>


    <!-- Counties-->
    <esri:ArcGISDynamicMapServiceLayer id="Labels" visible="true" url="http://tfs-24279/ArcGIS/rest/services/TFEI_sorted_counties_2009_totals_LABELS2/MapServer" />


    </esri:Map>
    </mx:Panel>


    </mx:VBox>

    <mx:VBox height="1270" >


    <mx:VBox height="490" width="570" >
    <mx:Panel title="Map Content" >
    <maplib:TOCAccordion height="450" width="100%" map="{map}" useLayerFadeEffect="true" labelFunction="{layerLabelFunc}">
    <maplib:categories>
    <!-- Each TOC category contains a label and an array of layer IDs. -->
    <mx:Object label="Counties" layers="[Labels]"/>
    <mx:Object label="Forestry" layers="[ForIndustryOutput, ForEmploymentOutput, ForLaborOutput, ForIndirectBusinessTax]"/>
    <mx:Object label="Logging" layers="[LogIndustryOutput, LogEmploymentOutput, LogLaborOutput, LogIndirectBusinessTax]"/>
    <mx:Object label="Primary Paper and Paperboard" layers="[PrimaryPaperIndustryOutput, PrimaryPaperEmploymentOutput, PrimaryPaperLaborOutput, PrimaryPaperIndirectBusinessTax]"/>
    <mx:Object label="Primary Solid Wood Products" layers="[PrimarySolidIndustryOutput, PrimarySolidEmploymentOutput, PrimarySolidLaborOutput, PrimarySolidIndirectBusinessTax]"/>
    <mx:Object label="Secondary Paper and Paperboard" layers="[SecondaryPaperIndustryOutput, SecondaryPaperEmploymentOutput, SecondaryPaperLaborOutput, SecondaryPaperIndirectBusinessTax]"/>
    <mx:Object label="Secondary Solid Wood Products" layers="[SSecondarySolidIndustryOutput, SSecondarySolidEmploymentOutput, SSecondarySolidLaborOutput, SSecondarySolidIndirectBusinessTax]"/>
    <mx:Object label="Total" layers="[TotalIndustryOutput, TotalEmploymentOutput, TotalLaborOutput, TotalIndirectBusinessTax]"/>
    </maplib:categories>
    </maplib:TOCAccordion>
    </mx:Panel>
    </mx:VBox>

    <!-- <mx:VBox height="5" borderStyle="solid">



    </mx:VBox>-->

    <mx:HBox width="570" height="408" >




    <esri:Legend id="myLegend"

    layers="{[ TotalLaborOutput ]}"
    map="{map}"
    scaleY="0.9"
    width="100%"
    height="100%"
    respectCurrentMapScale="true"
    right="5" bottom="10"

    />


    </mx:HBox >
    </mx:VBox>

    </mx:HBox>



    Any help is greatly appreciated! I am new to Flex and ActionScript so I am not sure yet how to implement this! I love Flex ! Thanks!
0 Kudos
2 Replies
by Anonymous User
Not applicable
Original User: ionara_wilson

Actually for the legend I would just have one legend (for the map that is showing, the only one checked and visible on the TOC  (besides the counties layer that does not need a legend)

Any ideas?
0 Kudos
ionarawilson1
Deactivated User
Can anybody offer any help for this? I know it would probably be easy for the Flex wizards we have here 🙂
0 Kudos