GoogeleLayer.as
/** * @Description: * @Type:组件类 * @Copyright: Copyright 2013 * @Company: * @Author : NEIL * @Date:2013-10-21 * @Version 1.0 */ package com { import com.esri.ags.SpatialReference; import com.esri.ags.geometry.Extent; import com.esri.ags.geometry.MapPoint; import com.esri.ags.layers.TiledMapServiceLayer; import com.esri.ags.layers.supportClasses.LOD; import com.esri.ags.layers.supportClasses.TileInfo; import flash.events.Event; import flash.net.URLRequest; public class GoogeleLayer extends TiledMapServiceLayer { public var _fullextent:String=""; public var _initextent:String=""; [Bindable] public var _tileInfo:TileInfo=new TileInfo(); private var _baseURL:String=""; public function GoogeleLayer() { super(); } public function getXml():void { buildTileInfo(); setLoaded(true); } override public function get fullExtent():Extent { var fullExtentArr:Array=_fullextent.split(","); return new Extent(Number(fullExtentArr[0]), Number(fullExtentArr[1]), Number(fullExtentArr[2]), Number(fullExtentArr[3]), new SpatialReference(102113)); } override public function get initialExtent():Extent { var initExtentArr:Array=_initextent.split(","); return new Extent(Number(initExtentArr[0]), Number(initExtentArr[1]), Number(initExtentArr[2]), Number(initExtentArr[3]), new SpatialReference(102113)); } override public function get spatialReference():SpatialReference { return new SpatialReference(102113); } override public function get tileInfo():TileInfo { return _tileInfo; } override protected function getTileURL(level:Number, row:Number, col:Number):URLRequest { var urlMap:String=baseURL + "/tiles" + "/" + String(level) + "/" + col.toString() + "/" + row.toString() + ".png"; return new URLRequest(urlMap); } public function get baseURL():String { return _baseURL; } public function set baseURL(value:String):void { _baseURL=value; } public function buildTileInfo():void { _tileInfo.height=256; _tileInfo.width=256; _tileInfo.origin=new MapPoint(-20037508.342787001, 20037508.342787001); _tileInfo.spatialReference=new SpatialReference(102113); _tileInfo.lods=[new LOD(10, 152.874056570411, 577790.554289), new LOD(11, 76.4370282850732, 288895.277144), new LOD(12, 38.2185141425366, 144447.638572), new LOD(13, 19.1092570712683, 72223.819286), new LOD(14, 9.55462853563415, 36111.909643), new LOD(15, 4.77731426794937, 18055.954822),]; } } }