Select to view content in your preferred language

Table of Contents - Legend Widget for FlexViewer 2.x

187622
664
12-01-2010 07:30 AM
RobertScheitlin__GISP
MVP Emeritus
All,

Here is the next in my line of widgets for the FlexViewer 2.x.

The legend portion of this widget is the same code as my dynamic legend widget so,

IT IS FOR ARCGIS SERVER 10 OR GREATER ONLY

This is just a simple TOC Widget that includes my dynamic legend component.
This widget also includes my enhancement for map service transparency,
right click context menu for zoom to make layer visible, and my scale
dependent renderer for the TOC checkboxes.
Tags (2)
0 Kudos
664 Replies
SaugatJoshi
Deactivated User
Robert,

Is there a way we can extent the TOC's(FV 2.3.1) alpha slider to sublayer. For eg: in TOC if I have the layer name as Building and its sublayers as schools, hospital, etc The alpha slider is activated only when Building is clicked and disabled at other times. I can see the sublayer name as TocLayerInfoItem in dedbugger mode when I put a breakpoint at
private function setSelectedTreeItem(event:ListEvent):void
   {
    var item:TocItem = TocItem(event.itemRenderer.data);
    if (item is TocMapLayerItem){
     var item2:TocMapLayerItem = item as TocMapLayerItem;
     _sellayer = item2.layer;
     layerIsSelected = true;
     if(slider)
      slider.value = item2.layer.alpha;
    }else{
     layerIsSelected = false;
    }
   }


How can we control the transparency level of sublayers. Thanks.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Saugat,

   REST does not expose any ability to change the transparency of a particular layer in a map service so the answer is no. The only way you could do this is to add another mapservice that just shows the layer that you are intrested in controlling the alpha for.
0 Kudos
SaugatJoshi
Deactivated User
Hi Robert, thanks for the comment. I think if I have the feature access enabled in the map service, probably we can control it. The problem is that I have 10 group layers and at least 5 sublayers in each group layer. Feature service would create a great amount of delay for 100+ layers I have (every time zoom in/zoom out will send me back 100+ images). Is there any other workaround you can think of other than creating feature service or map service for each of the layers(or grouplayer).
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Saugat,

   Nope... This might be possible in ArcGIS Server 10.1 but not now.
0 Kudos
SaraRoth
Emerging Contributor
Robert,
If I have only one parent map service, is there a way to change the code so that the user won't have to click on the parent map service in the TOC before using the transparency slider?
0 Kudos
RavinHasseea
Emerging Contributor
Hi, I have downloaded the new TOC/Legend widget at
http://www.arcgis.com/home/item.html?id=e2cb71d5c04d40d19e9f945ae0db7ce8

While this looks really good, I would like to implement the following:
1. Turn on a sub layer automatically from a separate widget
2. Switch off all sub layers when group layer is switched off
3. Switch on group layer automatically when a sub layer is turn on
4. Disable / Enable a TOC node from a separate widget

Any suggestions?
0 Kudos
SaugatJoshi
Deactivated User
Hi Robert,

I want to remove some sublayers from the TOC. I have a dynamic map service
<operationallayers>
            <layer label="City" type="dynamic" visible="false" alpha="1"
                   url="http://*******/arcgis/rest/services/City/MapServer"/>       
          
        </operationallayers>

So the TOC looks like
City
  -Parks
  -Schools
  -Police Station
  -Fire

I just want to show Parks, Schools and Police station but hide "Fire" in the TOC. I believe <excludelayer></excludelayer> hides the entire dynamic layer. How can I acheive this?

Thanks.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Saugat,

   There was an example of this in the original TOCWidget.xml file:

<excludelayers >
        <excludelayer mapservice="Layers">0</excludelayer>
    </excludelayers>


The zero above is the sublayer number you wish to exclude.
0 Kudos
KathrynJones
Emerging Contributor
Hi Robert,

I know there has been a lot of questions about the <excludelayer> tag, but I can't seem to find an answer for my question. I was hoping you might be able to help!

The <excludelayer> code appears to be working in that the sublayer isn't shown in the TOC, however when I turn on any of the other sublayers the one I've excluded turns on with the layer that is being turned on!

For example, I'm trying to exclude the Powerlines layer. In the TOC, Powerlines isn't there which is as expected, however when I turn on, for example, Pipelines, the Powerlines data turns on as well as the Pipelines data.

This isn't the expected result is it?

I've tried with other map services and I get the same result.

I'm using version 10.0, I haven't upgraded to any service packs yet. Could this be why it's acting strange?

Thanks in advance for your help 🙂


CODE

config:
  <layer label="Infrastructure" type="dynamic" visible="false" alpha="0.75"
     url="http://auper1gis01/ArcGIS/rest/services/ENV_DATA_GROUPS/Infrastructure/MapServer">
     <sublayer id="0" popupconfig="popups/PopUp_Pipelines.xml"/>
     <sublayer id="1" popupconfig="popups/PopUp_Powerlines.xml"/>
     <sublayer id="2" popupconfig="popups/PopUp_RailwayStops.xml"/>    
     <sublayer id="3" popupconfig="popups/PopUp_Railway.xml"/>
   </layer>


TOCWidget.xml:

<excludelayers >
  <excludelayer mapservice="Infrastructure">1</excludelayer>
</excludelayers>
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Kathryn,

  Actually this is a desired behavior in most circumstances. If I remember correctly others wanted to have a sublayer excluded from the TOC so that the user could not turn it on or off unless the main group was turned on or off. I see our case where you are thinking that if a layer is excluded from the TOC it should be excluded from the map all together that is just not the way it works. If you want the sublayer to be completely removed from the map then you would need to write a definition query to do that.
0 Kudos