/* Copyright (c) 2004-2006, The Dojo Foundation All Rights Reserved. Licensed under the Academic Free License version 2.1 or above OR the modified BSD license. For more information on Dojo licensing, see: http://dojotoolkit.org/community/licensing.shtml */ dojo.provide("dojo.widget.html.YahooMap"); dojo.require("dojo.event.*"); dojo.require("dojo.html"); dojo.require("dojo.math"); dojo.require("dojo.widget.HtmlWidget"); dojo.require("dojo.widget.YahooMap"); (function(){ var yappid = djConfig["yAppId"]||djConfig["yahooAppId"]||"dojotoolkit"; if(!dojo.hostenv.post_load_){ if(yappid == "dojotoolkit"){ dojo.debug("please provide a unique Yahoo App ID in djConfig.yahooAppId when using the map widget"); } var tag = ""; if(!dj_global["YMap"]){ document.write(tag); } }else{ dojo.debug("cannot initialize map system after the page has been loaded! Please either manually include the script block provided by Yahoo in your page or require() the YahooMap widget before onload has fired"); } })(); dojo.widget.html.YahooMap=function(){ dojo.widget.HtmlWidget.call(this); dojo.widget.YahooMap.call(this); this.map=null; this.datasrc=""; this.data=[]; this.width=0; this.height=0; this.controls=["zoomlong","maptype","pan"]; }; dojo.inherits(dojo.widget.html.YahooMap, dojo.widget.HtmlWidget); dojo.lang.extend(dojo.widget.html.YahooMap, { widgetType: "YahooMap", templatePath:null, templateCssPath:null, findCenter:function(aPts){ var start=new YGeoPoint(37,-90); if(aPts.length==0) return start; var minLat,maxLat, minLon, maxLon, cLat, cLon; minLat=maxLat=aPts[0].Lat; minLon=maxLon=aPts[0].Lon; for(var i=0; i"+d[i].description+""); } this.map.addOverlay(m); } var c=this.findCenter(pts); var z=this.map.getZoomLevel(pts); this.map.drawZoomAndCenter(c,z); }, initialize:function(args, frag){ if(!YMap || !YGeoPoint){ dojo.raise("dojo.widget.YahooMap: The Yahoo Map script must be included in order to use this widget."); } if(this.datasrc){ this.parse(dojo.byId(this.datasrc)); } else if(this.domNode.getElementsByTagName("table")[0]){ this.parse(this.domNode.getElementsByTagName("table")[0]); } }, postCreate:function(){ // clean the domNode before creating the map. while(this.domNode.childNodes.length>0){ this.domNode.removeChild(this.domNode.childNodes[0]); } if(this.width>0&&this.height>0){ this.map=new YMap(this.domNode, YAHOO_MAP_REG, new YSize(this.width, this.height)); }else{ this.map=new YMap(this.domNode); } this.setControls(); this.render(); } });