Extjs & ArcGIS JavaScriptAPI

Ext.namespace("GIS.ESRI");
/**<script type="text/javascript" src="js/esri/esri-ext/EsriMapPlugin.js" charset="utf-8"></script>
 * new Ext.Panel({plugins:[new GIS.ESRI.EsriMapPlugin()]})
 * @class GIS.ESRI.EsriMapPlugin
 * @extends Ext.util.Observable
 */
GIS.ESRI.EsriMapPlugin =Ext.extend(Ext.util.Observable,{
	map:null,
	initEsriMap:function(domid)
	{
		dojo.require("esri.map");
		this.map = new esri.Map(domid);
		var myTiledMapServiceLayer= new esri.layers.ArcGISTiledMapServiceLayer("http://10.2.15.221:8399/arcgis/rest/services/hnstl_cache/MapServer");
		this.map.addLayer(myTiledMapServiceLayer);
	},
	addLayer:function(lyr)
	{
		if(this.map)
		this.map.addLayer(lyr);
	},
	init:function(panel)
	{
		Ext.apply(panel, {
			onRender:panel.onRender.createSequence(function(ct,pos){
				var id=panel.body.dom.id?panel.body.dom.id:panel.id;
				dojo.addOnLoad(this.initEsriMap.createDelegate(this,[id]));
			}.createDelegate(this))
			,onResize:panel.onResize.createSequence(function(w,h){
 		 		var width=panel.getInnerWidth();
				var height=panel.getInnerHeight();
	        	if(this.map)
	        	{
	        		this.map.width=width;
	        		this.map.height=height;
	        		this.map.resize();
	        	}
 		 	}.createDelegate(this))
		})
	}
});
GIS.ESRI.EsriMapPlugin.yeah=function()
{
	return Ext.ComponentMgr.all.find(function(obj) 
	{
		return obj instanceof GIS.ESRI.EsriMapPlugin;
	});
}


你可能感兴趣的:(cache,ext,REST,dojo)