Select to view content in your preferred language

layerDrawingOptions and custom Symbol

844
2
Jump to solution
10-31-2012 09:57 AM
PaulHastings1
Deactivated User
can the renderers in layerDrawingOptions make use of custom symbols? i have the following custom symbol (simplified for the time being)

package symbols {    import com.esri.ags.Map;  import com.esri.ags.geometry.Geometry;  import com.esri.ags.geometry.MapPoint;  import com.esri.ags.symbols.MarkerSymbol;  import com.esri.ags.symbols.Symbol;    import flash.display.Sprite;    public class MooringSymbol extends MarkerSymbol {      public function MooringSymbol() {    super();   }      override public function clear(sprite:Sprite):void {    sprite.graphics.clear();   }      override public function draw(sprite:Sprite,geometry:Geometry,attributes:Object,map:Map):void {    if (geometry is MapPoint) {          var radius:int=15;// POC testing, production based on attributes     sprite.x=toScreenX(map,(geometry as MapPoint).x);     sprite.y=toScreenY(map,(geometry as MapPoint).y);     sprite.graphics.beginFill(0xFF0000,0.5);     sprite.graphics.drawCircle(0,0,radius);     sprite.graphics.endFill();         }     }     } }


applied to the  layerDrawingOptions for a given layer:

protected function infrastructureLayer_initializeHandler(event:FlexEvent):void {         drawingOptions=infrastructureLayer.layerDrawingOptions;     var r:SimpleRenderer=new SimpleRenderer();      var dO:LayerDrawingOptions=new LayerDrawingOptions();             r.symbol=new MooringSymbol();     dO.renderer=r;     dO.alpha=1;     dO.layerId=0;     dO.showLabels=true;     dO.scaleSymbols=false;     drawingOptions[0]=dO;     infrastructureLayer.layerDrawingOptions=drawingOptions;     infrastructureLayer.refresh();     }


but it appears the symbol is never applied as that layer shows up empty. if i switch to a standard Symbol (MarkerSybol, etc.), works fine.

is approach this possible? any suggestions.

thanks.
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
DasaPaddock
Esri Regular Contributor
0 Kudos
2 Replies
DasaPaddock
Esri Regular Contributor
Custom symbols are not supported unless they implement IJSONSupport and the JSON is supported by the REST API.

See:
http://resources.arcgis.com/en/help/rest/apiref/symbol.html
http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/utils/IJSONSupport.html
0 Kudos
PaulHastings1
Deactivated User
thanks for the reply.

can i interpret that as i shouldn't be extending Symbol but constructing the symbol as JSON to send back to the server? any chance of some examples of that?

i think my real problem is server-side vs client-side symbolization.
0 Kudos