package dmPlug
{
import com.esri.ags.Map;
import com.esri.ags.SpatialReference;
import com.esri.ags.geometry.Extent;
import com.esri.ags.layers.ArcGISDynamicMapServiceLayer;
import com.esri.ags.layers.DynamicMapServiceLayer;
import flash.display.Loader;
import flash.net.URLRequest;
import flash.net.URLVariables;
import mx.controls.Alert;
public class WMSMapServiceLayer extends DynamicMapServiceLayer
{
internal const service:String="WMS";
internal const request:String="GetMap"
internal const scalar:Number=1;
public var url:String;
public var format:String="image/png";
public var serviceName:String;
public var urlWms:String;
public var wmstVersion:String;
public var styles:String;
public var srs:String="EPSG:4326";
public var transparentBG:String;
private var _timeStamp:String;
private var _layers:String;
public function WMSMapServiceLayer()
{
super();
this.setLoaded(true);
this.url=url;
}
public function set timeStamp(value:String):void
{
_timeStamp=value;
}
public function set layers(value:String):void
{
_layers=value;
}
override protected function loadMapImage(loader:Loader) : void
{
var mapExtent:Extent = map.extent;
if (map.spatialReference)
{
mapExtent.spatialReference = map.spatialReference;
}
var spatialReference:SpatialReference = mapExtent.spatialReference;
var pxHeight:Number =map.height;
var pxWidth:Number =map.width;
var _url:String=this.url;
_url +"SERVICE="+service;
_url += "&VERSION=1.1.1";
_url += "&REQUEST="+request;
_url += "&STYLES=";
_url += "&layers="+_layers;
_url +="&timeStamp="+_timeStamp;
_url += "&SRS="+srs;
_url += "&FORMAT=image/png";
_url += "&WIDTH="+pxWidth;
_url += "&HEIGHT="+pxHeight;
_url += "&BBOX="+this.map.extent.xmin+","+this.map.extent.ymin+","+this.map.extent.xmax+","+this.map.extent.ymax;
_url += "&transparent=true"
_url += "&token=";
_url += "&st=12434"
var wmsReq:URLRequest = new URLRequest(_url);
loader.load(wmsReq);
return;
}
}
}