Solved! Go to Solution.
private var shapefileGL:GraphicsLayer;
[Bindable]
public var polygonFillSymbol:SimpleFillSymbol = new SimpleFillSymbol("solid",0,1,new SimpleLineSymbol());
private function fileLoaded(result:Array):void
{
for each(var i:Geometry in result)
{
switch (_shapeFileLoader.shpType)
{
case ShpType.SHAPE_POLYGON:
{
graphic = new Graphic(i, this.polygonFillSymbol);
this.shapefileGL.add(graphic);
}
}
}
}
protected function fillStyle_changeHandler(event:IndexChangeEvent):void
{
polygonFillSymbol.style = fillStyle.selectedItem.style;
}
<s:Label text="Layer Logs:" y="780"/>
<s:HGroup width="100%"
height="50%"
y="800">
<s:TextArea width="100%"
height="90%"
id="log" />
</s:HGroup>
private function addLog(message:String):void
{
log.text = StringUtil.substitute("{0}\n\n{1}", message, log.text);
}
protected function onLayerLoadError(event:LayerEvent):void
{
addLog(StringUtil.substitute("Error on loading layer {0}", event.layer.name));
nonLoadedCount++;
var mapLayersCount:int = ArrayCollection(myMap.layers).length;
if (mapLayersCount == (nonLoadedCount + loadedCount))
{
addLog(StringUtil.substitute("Loaded: {0} of {1} layers\n {2} layers fault on loading.",
loadedCount, mapLayersCount, nonLoadedCount));
}
}
protected function onLayerLoad(event:LayerEvent):void
{
addLog(StringUtil.substitute("{0} is loaded", event.layer.name));
loadedCount++;
var mapLayersCount:int = ArrayCollection(myMap.layers).length;
if (mapLayersCount == (nonLoadedCount + loadedCount))
{
addLog(StringUtil.substitute("Loaded: {0} of {1} layers\n {2} layers fault on loading.",
loadedCount, mapLayersCount, nonLoadedCount));
}
}
protected function onLayerUpdateStart(event:LayerEvent):void
{
addLog(StringUtil.substitute("{0} update started", event.layer.name));
if (updateStartedCount == updateEndedCount)
{
updateStartedCount = updateEndedCount = 0; // reset
}
updateStartedCount++;
}
protected function onLayerUpdateEnd(event:LayerEvent):void
{
addLog(StringUtil.substitute("{0} update ended >> update success = {1}",
event.layer.name, event.updateSuccess));
updateEndedCount++;
if (updateStartedCount == updateEndedCount)
{
addLog("All layers are updated");
}
}
this.shapefileGL = new GraphicsLayer();
baseWidget.map.addLayer( this.shapefileGL);
this.shapefileGL.addEventListener(LayerEvent.UPDATE_START, updateStart);
this.shapefileGL.addEventListener(LayerEvent.UPDATE_END, updateEnd);
this.shapefileGL.addEventListener(LayerEvent.LOAD, loaded);
private function updateStart(event:LayerEvent):void
{
LogUtil.getLogger(ShowShapefileMediator).info("updateStart");
}
private function updateEnd(event:LayerEvent):void
{
LogUtil.getLogger(ShowShapefileMediator).info("updateEnd");
}
private function loaded(event:LayerEvent):void
{
LogUtil.getLogger(ShowShapefileMediator).info("loaded");
}