How to retrieve image from layerLegendinfos in esri flex api?

3765
0
02-26-2015 03:00 PM
YinglunLiang
New Contributor

Hi, everyone.

I'm, currently building a flexviewer print widget with customized layout, and with a custom Legend. Basicly just need pairs of sublayer names and the symbol image in the custom Legend.

So far I managed to set getLegendResult() successfully and have a respond for my layerLegendInfos, and I've got the sublayer's name. But I've spent some hard time trying to retrieve the image from layerLegendinfos and set it as image source in the custom Legend.

Anyone knows the trick here? Possible code would be awesome.

 

And I've got the response contents from layerLegendInfo:

 

(com.esri.ags.layers.supportClasses::LayerLegendInfo)#0

  layerId = "0"

  layerLegendInfos = (null)

  layerName = "PROPERTY_DIMS_text_1"

  layerType = "Feature Layer"

  legendItemInfos = (Array)#1

  maxScale = 0

  minScale = 1250

  showInLegend = true

  visible = true(com.esri.ags.layers.supportClasses::LayerLegendInfo)#0

  layerId = "1"

  layerLegendInfos = (null)

  layerName = "CityLimits"

  layerType = "Feature Layer"

  legendItemInfos = (Array)#1

    [0] (com.esri.ags.layers.supportClasses::LegendItemInfo)#2

      imageURL = (null)

      label = ""

      symbol = (com.esri.ags.symbols::PictureMarkerSymbol)#3

        angle = 0

        height = 0

        source = (flash.utils::ByteArray)#4

          bytesAvailable = 146

          endian = "bigEndian"

          length = 146

          objectEncoding = 3

          position = 0

        width = 0

        xoffset = 0

        yoffset = 0

      values = (null)

  maxScale = 0

  minScale = 0

  showInLegend = true

  visible = true(com.esri.ags.layers.supportClasses::LayerLegendInfo)#0

  layerId = "2"

  layerLegendInfos = (null)

  layerName = "Parcelpolygon"

  layerType = "Feature Layer"

  legendItemInfos = (Array)#1

    [0] (com.esri.ags.layers.supportClasses::LegendItemInfo)#2

      imageURL = (null)

      label = ""

      symbol = (com.esri.ags.symbols::PictureMarkerSymbol)#3

        angle = 0

        height = 0

        source = (flash.utils::ByteArray)#4

          bytesAvailable = 150

          endian = "bigEndian"

          length = 150

          objectEncoding = 3

          position = 0

        width = 0

        xoffset = 0

        yoffset = 0

      values = (null)

  maxScale = 0

  minScale = 0

  showInLegend = true

  visible = true

 

Seems the Image source is in ByteArray format, and I'm not sure how to deal with this ByteArray source and get the actual image.Plus can't see any color or size infomation here. Also, I didn't see a property which can give me access to the image source, just the "source = (flash.utils::ByteArray)#4" in the response. Pretty much stuck here.

 

First time here, sorry about the codeformat.

0 Kudos
0 Replies