Select to view content in your preferred language

Table of Contents - Legend Widget for FlexViewer 2.x

186437
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
FaizanTayyab
Deactivated User
Hi Robert,

Thanks for the reply.

On a different note, I am having issues with feature layers (global data). It some times fails on

else if (layer is FeatureLayer)
    {
     var FeatServId:Number = Number.NaN;
     var msName:String = FeatureLayer(layer).url.replace("FeatureServer","MapServer");
     var x:String = msName.substring(msName.length - 9);
     if(msName.substring(msName.length - 9) != "MapServer")
     {
      httpServ.url = msName.substring(0,msName.lastIndexOf("/")) + "/legend?f=json";
      FeatServId = parseInt(msName.substring(msName.lastIndexOf("/")+ 1));
     }else{
      httpServ.url = msName + "/legend?f=json";
     }
     //if(layer.layerDetails!=null){
      if(layer.layerDetails.version >= 10.01)      {
       httpServ.resultFormat = "text";
       lname = FeatureLayer(layer).id;
       httpServ.addEventListener(ResultEvent.RESULT,function(event:ResultEvent):void{processLegend(event,lname,FeatServId)});
       httpServ.send();
      } else {
       lname = FeatureLayer(layer).id;
       getFeatureResult(FeatureLayer(layer).layerDetails,lname);
      }
     //}
    }


I think because of number of features, it is unable to retrieve the layerDetails for the global feature layer. Is there any way, i can wait for the layerDetails to load before proceeding ensuring that the data is loaded in.

Thanks
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Faizan,

   I don't know why you are having this issue because in the TocMapLayerItem.as there is the onLayerLoad function that wait for the layer to be fully loaded before any legend generation begins...
0 Kudos
CharlesHarris
Emerging Contributor
Robert-

I notice that when trying to use this map service http://maps3.arcgisonline.com/ArcGIS/rest/services/A-16/HHS_IOM_Health_Resources/MapServer with your TOC that the TOC is having a problem with the png picture marker symbols that are used at the county and city level.  The TOC seems to be unable to draw the symbols and the "Generating TOC Legend" never stops spinning.

At one point I got the attached error message.



Do you have any ideas?

Thanks,

Jeremy
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Jeremy,

   I thought that the picturemarkersymbol source was always coming back as a byteArray now and I guess if it is coming from a ArcGIS Server 10.0 it still comes as a url instead. Hang tight I will get it fixed.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
All,

   There is a new version out that fixes the issue that Jeremy was having with PictureMarkerSymbols coming from a 10.0 Server. You can now download the fix in Version 2.4.4
0 Kudos
CharlesHarris
Emerging Contributor
Thanks Robert!
0 Kudos
JamesKo
Occasional Contributor
Is anyone else getting these warning messages?

warning: The class widgets.TOC.toc.tocClasses.LegendDataClassItem has been used in a call to net.registerClassAlias() in _TOCWidget_FlexInit. This will cause widgets.TOC:TOCWidget to be leaked. To resolve the leak, define widgets.TOC.toc.tocClasses.LegendDataClassItem in the top-level application.
  
warning: The class widgets.TOC.toc.tocClasses.LegendDataItem has been used in a call to net.registerClassAlias() in _TOCWidget_FlexInit. This will cause widgets.TOC:TOCWidget to be leaked. To resolve the leak, define widgets.TOC.toc.tocClasses.LegendDataItem in the top-level application. 

warning: The class widgets.TOC.toc.tocClasses.LegendSymbolItem has been used in a call to net.registerClassAlias() in _TOCWidget_FlexInit. This will cause widgets.TOC:TOCWidget to be leaked. To resolve the leak, define widgets.TOC.toc.tocClasses.LegendSymbolItem in the top-level application.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
James,

   What FLEX SDK are you building against. I have not seen this and I build this widget using the 4.1 SDK, but I have tried 4.5.1 too.
0 Kudos
JamesKo
Occasional Contributor
Hi Robert,

I'm using SDK 4.5.1 with Flash Builder 4.5 and FV 2.4.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
James,

   Hmm... Only difference is I'm using Flash Builder 4.5.1.313231 (Use Help > About Flash Builder > Installation Details > Adobe Flash Builder Localized Top Feature)
0 Kudos