GlowFilter on a Transparent Graphic

569
2
05-23-2010 08:04 PM
AmyRamsdell
New Contributor III
I would like to highlight the outline of a feature in a dynamic service layer after an identify.

I have tried to add a graphic of the geometry returned on top of the dynmaic layer with the symbol style set to null/none and also tried the alpha set to 0 with the graphic's glowfilter alpha = 1.  The idea was to set the graphic transparent but keep the glow filter opaque. That didn't work because somehow the glowfilter is attached to the graphic so regardless of its alpha, it seems that it uses the alpha of the graphic layer. As I have it now, the graphic layer has a solid fill, alpha=1, and a glowfilter and ordered that layer below the dynamicservicelayer.  The only problem with that, is if you have a polygon layer only the outside edges of the polys in the dynlayer appear highlighted because the interior edges cover up the glowfilter.

I wanted to keep the underlying dynamic layer because the symbology already has a unique value renderer on it in the service and it loads faster than a graphics and feature layer. Any suggestions on how to approach this?

Thanks,
Amy
Tags (2)
0 Kudos
2 Replies
CarolineCochrane
New Contributor III
Hi Amy,

I would also love to include a way of highlighting the boundary of the features returned by the identify tool.

I am using 9.3.1 server, with the latest flex viewer source code.

Did you ever get a resolution to this?

All the best,

Caroline
0 Kudos
AmyRamsdell
New Contributor III
There probably is a better way to do this now but this is the way I did it back then. I was using the 2.0 api. I do hope this makes sense.  Basically, the trick was having a blank graphics layer in between the dynamic service and the click graphic layer.  Without that blank layer, the glowfilter doesn't work on all sides of the poly graphic. It is missing on the sides where the poly is touching another one because of the way the click graphics are added on the clickgraphics layer

private var glowYellow:GlowFilter = new GlowFilter(0xFFFF00, 1.0, 16, 16, 50);
private var lastIdentifyResultGraphic:Graphic = new Graphic();

//Add the 3 layers to the map in specific order
 
//Need this graphics layer even though empty
//for correct display of select outline on identify
watershedBndyLayer = new ArcGISDynamicMapServiceLayer(url);
resultGraphicsLayer = new GraphicsLayer;
clickGraphicsLayer = new GraphicsLayer;
clickGraphicsLayer.blendMode = BlendMode.LAYER;
    
glowYellow.knockout = true;
map.addLayer(watershedBndyLayer,2);  //dynamic service layer displays above the other two
map.addLayer(resultGraphicsLayer,3); //empty layer
map.addLayer(clickGraphicsLayer,4);  // identify results graphic with glowfilter 

In my identify task on the dynamic service in the mapClickHandler(event:MapMouseEvent) 
I add the graphic to the clickGraphicsLayer with the same fill color as the glowfilter. In my case, yellow.

You can find all the code for a clickGraphic from the older forum, none of that was anything I came up with myself. But as I added the graphic to the layer:

lastIdentifyResultGraphic.autoMoveToTop = false;
lastIdentifyResultGraphic.filters = [glowYellow]; 
clickGraphicsLayer.add(lastIdentifyResultGraphic);

then for the click graphic's attribute results, I used an InfoSymbolRenderer to dispaly the attributes 
Ex:

 var infoSym:InfoSymbol = new InfoSymbol();
     var myRenderer:ClassFactory; 
     if (infoSymFormat == "infoSymLabel"){
      myRenderer = new ClassFactory(InfoSymLabelRenderer);
      infoSym.containerStyleName="infoLabel";
      infoSym.infoRenderer = myRenderer;
      clickGraphic.symbol = infoSym;
      clickGraphic.attributes = arrayVerticalDataGridContent[0];
     } 

then finally moved that to the top:

clickGraphicsLayer.moveToTop(clickGraphic);

0 Kudos