var szusertitle='中山地图网';var szusermapname='skymapsoft';var szuserwebsite='http://www.zsmap.cn/';var szEval="var domObj=this.getRawObject(szMapName);var SMap=domObj.SMap;aszScales=new Array('512000','384000','128000','64000','32000','16000','8000','4000','2000','1000');var map = new _map({name:'skymapsoft',title:'Skymapsoft',currentScale: 0,units:5,resolution:72,version:'',scales:aszScales});map.setDefaultExtents(112.884,22.1752,113.828,22.836);map.setBackgroundColor('rgb(242,239,233)');map.addLayer(new _layer( { name:'__base__',visible:true,opacity:100,imageformat:'png',queryable:false,tileSource:'auto',redrawInterval:-1,refreshInterval:-1,scales: new Array('1','1','1','1','1','1','1','1','1','1')}));map.resolution = 72;SMap.addMap( map );SMap.tileWidth=256;SMap.tileHeight=256;SMap.server = 'http://www.zsmap.cn:8080/map/';SMap.tileURL = 'tile.php';SMap.selectMap('skymapsoft');";﻿var gnLastEventId=0;var SMAP_ERROR=gnLastEventId ++;var SMAP_WARNING=gnLastEventId ++;var SMAP_NOTICE=gnLastEventId++;var SMAP_INITIALIZED=gnLastEventId ++;var SMAP_MAP_INITIALIZED=gnLastEventId ++;var SMAP_EXTENTS_CHANGED=gnLastEventId ++;var SMAP_SCALE_CHANGED=gnLastEventId ++;var SMAP_LAYERS_CHANGED=gnLastEventId ++;var SMAP_LAYER_STATUS_CHANGED=gnLastEventId ++;var SMAP_CONTEXT_MENU=gnLastEventId ++;var SMAP_METAEXTENTS_CHANGED=gnLastEventId++;var SMAP_MAP_CLICKED=gnLastEventId++;var szMapName='';function SMap( szID ) {szMapName=szID; this.isCSS=false; this.isW3C=false; this.isIE4=false; this.isNN4=false; this.isIE6CSS=false; initDHTMLAPI(); if (document.images) { this.isCSS=(document.body && document.body.style) ? true : false; this.isW3C=(this.isCSS && document.getElementById) ? true : false; this.isIE4=(this.isCSS && document.all) ? true : false; this.isNN4=(document.layers) ? true : false; this.isIE6CSS=(document.compatMode && document.compatMode.indexOf("CSS1") >=0) ? true : false; } this.domObj=this.getRawObject( szID ); this.domObj.style.overflow='hidden'; this.domObj.SMap=this; this.domObj.style.position='relative'; this.domObj.style.backgroundColor='#f0f0f0'; this.domObj.style.overflow='hidden'; this.domObj.style.border='1px solid #999'; this.domObj.style.cursor='move'; this.hideLayersOnMove=false; this.loadUnchecked=false; this.initializationState=0; this.bMouseDown=false; this.lastx=0; this.lasty=0; this.theInsideLayer=null; this.viewportWidth=this.getObjectWidth(this.domObj); this.viewportHeight=this.getObjectHeight(this.domObj); this.xOffset=0; this.yOffset=0; this.xOrigin=0; this.yOrigin=0; this.currentMap=''; document.server=''; this.nWide=0; this.nHigh=0; this.nCurrentTop=0; this.nCurrentLeft=0; this.aPixel=new Image(1,1); this.aPixel.src=document.server + 'images/a_pixel.gif'; this.imgErrors=new Array(); this.aMaps=new Array(); this.tileWidth=null; this.tileHeight=null; this.nBuffer=1; this.baseURL=''; this.cellSize=null; this.gImageID=0; this.eventManager=new _eventManager(); this.as=slideid=null; this.accelerationFactor=1; this.pixelsPerStep=30; this.timePerStep=25; this.server=''; this.init="init.php"; this.tileURL=null; this.aObjects=[]; this.aCanvases=[]; this.layersHidden=false; this.aTools=[]; this.aInfoTools=[]; for (var i=0; i<gnLastEventId; i++) { this.registerEventID( i ); } this.createLayers(); var szMap=getQueryParam('map'); var szExtents=getQueryParam('extents'); var szCPS=getQueryParam('cps'); this.initialize( szMap, szExtents, szCPS ); mySNavigator=new SNavigator( this ); mySNavigator.activate(); this.addLogo(); this.addControl(new SMyInformation); };SMap.prototype.addLogo=function() {var div=document.createElement('div');div.id='SkymapsoftLogo';div.style.position='absolute';div.style.right='6px';div.style.top='3px';div.style.zIndex=2; div.oncontextmenu=SMap_oncontextmenu;var image=document.createElement('img'); image.src=document.server + 'images/powered_by_skymapsoft_003.png'; image.height=25; image.width=86; image.style.cursor='pointer'; image.title='www.skymapsoft.com'; image.onclick=function() {window.open('http://www.skymapsoft.com');}; div.appendChild(image); this.domObj.appendChild(div); if(this.isIE4){ var imgName=image.src; if(imgName.length>3){ imgName=imgName.toUpperCase(); if(imgName.substring(imgName.length-3, imgName.length)=='PNG'){ applyPNGFilter(image); } } }};SMap.prototype.addControl=function(control){switch (true){case (control instanceof SMapControl):control.initialize(this);break;case (control instanceof SMyInformation):control.initialize(this);break;}};SMap.prototype.drawPage=function() { var browserWidth=getInsideWindowWidth(); var browserHeight=getInsideWindowHeight(); var viewport=getRawObject(szMapName); if(viewport.SMap.isIE4) { viewport.style.width=(browserWidth -2) + "px"; } else { viewport.style.width=browserWidth + "px"; } if(viewport.SMap.isIE4) { viewport.style.height=(browserHeight -2) + "px"; } else { viewport.style.height=browserHeight + "px"; } viewport.SMap.resize();};SMap.prototype.seekLayer=function(doc, name) { var theObj; for (var i=0; i < doc.layers.length; i++) { if (doc.layers[i].name==name) { theObj=doc.layers[i]; break; } if (doc.layers[i].document.layers.length > 0) { theObj=this.seekLayer(document.layers[i].document, name); } } return theObj;};SMap.prototype.getRawObject=function(obj) { var theObj; if (typeof(obj)=="string") { if (this.isW3C) { theObj=document.getElementById(obj); } else if (this.isIE4) { theObj=document.all(obj); } else if (this.isNN4) { theObj=seekLayer(document, obj); } } else { theObj=obj; } return theObj;};SMap.prototype.getObject=function(obj) { var theObj=this.getRawObject(obj); if (theObj && this.isCSS) { theObj=theObj.style; } return theObj;};SMap.prototype.getObjectWidth=function(obj) { var elem=this.getRawObject(obj); var result=0; if (elem.offsetWidth) { result=elem.offsetWidth; } else if (elem.clip && elem.clip.width) { result=elem.clip.width; } else if (elem.style && elem.style.pixelWidth) { result=elem.style.pixelWidth; } return parseInt(result);};SMap.prototype.getObjectHeight=function(obj) { var elem=this.getRawObject(obj); var result=0; if (elem.offsetHeight) { result=elem.offsetHeight; } else if (elem.clip && elem.clip.height) { result=elem.clip.height; } else if (elem.style && elem.style.pixelHeight) { result=elem.style.pixelHeight; } return parseInt(result);};SMap.prototype.zoomTo=function( cgX, cgY ) { var oMap=this.getCurrentMap(); var inchesPerUnit=new Array(1, 12, 63360.0, 39.3701, 39370.1, 4374754); var newScale; var bScaleChanged=false; if (arguments.length==3) { newScale=arguments[2]; bScaleChanged=(newScale !=this.getCurrentScale()) } else { newScale=this.getCurrentScale(); }var bZoomTo=true;if (!bScaleChanged) {var extents=this.getGeoExtents(); if (cgX >=extents[0] && cgX <=extents[2] && cgY >=extents[1] && cgY <=extents[3]) { var cx=(extents[0]+extents[2])/2; var cy=(extents[1]+extents[3])/2; var dx=(cx - cgX)/this.cellSize; var dy=(cgY - cy)/this.cellSize; this.slideBy(dx,dy);bZoomTo=false; }}if (bZoomTo) { this.cellSize=newScale/(oMap.resolution * inchesPerUnit[oMap.units]); var nFactor=oMap.zoomToScale( newScale ); this.setMapLayers(); var cpX=cgX / this.cellSize; var cpY=cgY / this.cellSize; var vpLeft=Math.round(cpX - this.viewportWidth/2); var vpTop=Math.round(cpY + this.viewportHeight/2); var cTileX=Math.floor(cpX/this.tileWidth)*this.tileWidth; var cTileY=Math.floor(cpY/this.tileHeight)*this.tileHeight; var nTilesLeft=Math.ceil(this.viewportWidth/(2*this.tileWidth))*this.tileWidth; var nTilesUp=Math.ceil(this.viewportHeight/(2*this.tileHeight))*this.tileHeight; this.nCurrentLeft=cTileX - nTilesLeft; this.nCurrentTop=-1*(cTileY + nTilesUp); this.xOrigin=this.nCurrentLeft; this.yOrigin=this.nCurrentTop; this.theInsideLayer.style.left=-1*(vpLeft - this.xOrigin) + "px"; this.theInsideLayer.style.top=(vpTop + this.yOrigin) + "px"; var layers=oMap.getLayers(); for( var k=0; k<layers.length; k++) { var d=layers[k].domObj; for(var j=0; j<this.nHigh; j++) { for( var i=0; i<this.nWide; i++) { var img=d.childNodes[(j*this.nWide)+i]; img.src=this.aPixel.src; img.style.top=(this.nCurrentTop + j*this.tileHeight - this.yOrigin) + "px"; img.style.left=(this.nCurrentLeft + i*this.tileWidth - this.xOrigin) + "px"; layers[k].setTile(img); } } } this.checkWrap( ); this.updateObjects();} if (bScaleChanged) {this.triggerEvent( SMAP_SCALE_CHANGED, this.getCurrentScale() );} this.triggerEvent( SMAP_EXTENTS_CHANGED, this.getGeoExtents() );};SMap.prototype.zoomToExtents=function(minx, miny, maxx, maxy) { var inchesPerUnit=new Array(1, 12, 63360.0, 39.3701, 39370.1, 4374754); var oMap=this.getCurrentMap(); var cgX=(maxx+minx)/2; var cgY=(maxy+miny)/2; var tmpCellSizeX=(maxx - minx)/this.viewportWidth; var tmpCellSizeY=(maxy - miny)/this.viewportHeight; var tmpCellSize=Math.max( tmpCellSizeX, tmpCellSizeY ); var tmpScale=tmpCellSize * oMap.resolution * inchesPerUnit[oMap.units]; var newScale=oMap.aScales[0]; for (var i=1; i<oMap.aScales.length; i++) { if (tmpScale >=oMap.aScales[i]) { break; } newScale=oMap.aScales[i]; } this.cellSize=newScale/(oMap.resolution * inchesPerUnit[oMap.units]); var nFactor=oMap.zoomToScale( newScale ); this.setMapLayers(); var cpX=cgX / this.cellSize; var cpY=cgY / this.cellSize; var vpLeft=Math.round(cpX - this.viewportWidth/2); var vpTop=Math.round(cpY + this.viewportHeight/2); var cTileX=Math.floor(cpX/this.tileWidth)*this.tileWidth; var cTileY=Math.floor(cpY/this.tileHeight)*this.tileHeight; var nTilesLeft=Math.ceil(this.viewportWidth/(2*this.tileWidth))*this.tileWidth; var nTilesUp=Math.ceil(this.viewportHeight/(2*this.tileHeight))*this.tileHeight; this.nCurrentLeft=cTileX - nTilesLeft; this.nCurrentTop=-1*(cTileY + nTilesUp); this.xOrigin=this.nCurrentLeft; this.yOrigin=this.nCurrentTop; this.theInsideLayer.style.left=-1*(vpLeft - this.xOrigin) + "px"; this.theInsideLayer.style.top=(vpTop + this.yOrigin) + "px"; var layers=oMap.getLayers(); for( var k=0; k<layers.length; k++) { var d=layers[k].domObj; for(var j=0; j<this.nHigh; j++) { for( var i=0; i<this.nWide; i++) { var img=d.childNodes[(j*this.nWide)+i]; img.src=this.aPixel.src; img.style.top=(this.nCurrentTop + j*this.tileHeight - this.yOrigin) + "px"; img.style.left=(this.nCurrentLeft + i*this.tileWidth - this.xOrigin) + "px"; layers[k].setTile(img); } } } this.checkWrap( ); this.updateObjects(); this.triggerEvent( SMAP_SCALE_CHANGED, this.getCurrentScale() ); this.triggerEvent( SMAP_EXTENTS_CHANGED, this.getGeoExtents() );};SMap.prototype.createDrawingCanvas=function( idx ) { var d=document.createElement( 'div' ); d.style.position='absolute'; d.style.left='0px'; d.style.top='0px'; d.style.width='3000px'; d.style.height='3000px'; d.style.zIndex=idx; this.theInsideLayer.appendChild( d ); this.aCanvases.push( d ); d.SMap=this; return d;};SMap.prototype.removeDrawingCanvas=function( canvas ) { for (var i=0; i<this.aCanvases.length;i++) { if (this.aCanvases[i]==canvas) { this.aCanvases.splice( i, 1 ); } } this.theInsideLayer.removeChild(canvas); canvas.SMap=null; return true;};SMap.prototype.addObjectGeo=function( canvas, lon, lat, obj ) { obj.lon=lon; obj.lat=lat; var aPix=this.geoToPix( lon, lat ); return this.addObjectPix( canvas, aPix[0], aPix[1], obj );};SMap.prototype.addObjectPix=function( canvas, x, y, obj ) { var xOffset=(obj.xOffset) ? obj.xOffset : 0; var yOffset=(obj.yOffset) ? obj.yOffset : 0; var top=(y - this.yOrigin + yOffset); var left=(x - this.xOrigin + xOffset); obj.style.position='absolute'; obj.style.top=top + "px"; obj.style.left=left + "px"; obj.canvas=canvas; canvas.appendChild( obj ); this.aObjects.push( obj ); return true;};SMap.prototype.shiftObject=function( x, y, obj ) { var top=safeParseInt(obj.style.top); var left=safeParseInt(obj.style.left); obj.style.top=(top + y) + "px"; obj.style.left=(left + x) + "px"; return true;};SMap.prototype.removeObject=function( obj ) { if (obj==null) { for (var i=0; i<this.aObjects.length; i++) { obj=this.aObjects[i]; if (obj.canvas) { obj.canvas.removeChild(obj); } } this.aObjects=[]; return true; } else { for (var i=0; i<this.aObjects.length; i++) { if (this.aObjects[i]==obj) { obj=this.aObjects[i]; if (obj.canvas) { obj.canvas.removeChild( obj ); obj.canvas=null; } this.aObjects.splice(i,1); return true; } } return false; }};SMap.prototype.removeAllObjects=function(canvas) { for (var i=0; i<this.aObjects.length; i++) { obj=this.aObjects[i]; if (obj.canvas && obj.canvas==canvas) { obj.canvas.removeChild( obj ); obj.canvas=null; this.aObjects.splice(i--,1); } } return true;};SMap.prototype.centerObject=function(obj) { var vpX=-safeParseInt(this.theInsideLayer.style.left) + this.viewportWidth/2; var vpY=-safeParseInt(this.theInsideLayer.style.top) + this.viewportHeight/2; var xOffset=(obj.xOffset)?obj.xOffset:0; var yOffset=(obj.yOffset)?obj.yOffset:0; var dx=safeParseInt(obj.style.left) - xOffset- vpX; var dy=safeParseInt(obj.style.top) - yOffset - vpY; this.slideBy(-dx, -dy); return true;};SMap.prototype.geoToPix=function( gX, gY ) { var pX=gX / this.cellSize; var pY=-1 * gY / this.cellSize; return [Math.floor(pX), Math.floor(pY)];};SMap.prototype.pixToGeo=function( pX, pY ) { var bAdjust=(arguments.length==3 && arguments[2]) ? true : false; if (bAdjust) { pX=pX + this.xOrigin; pY=pY + this.yOrigin; } var gX=-1 * pX * this.cellSize; var gY=pY * this.cellSize; return [gX, gY];};SMap.prototype.initialize=function() { if (this.initializationState==2) { this.triggerEvent( SMAP_ERROR, 'ERROR: S-Map! is already initialized!' ); return false; } else if (this.intializationState==1) { this.triggerEvent( SMAP_WARNING, 'WARNING: S-Map! is currently initializing ... wait for the SMAP_INITIALIZED event to be triggered.' ); return false; } this.initializationState=1; var szURL=this.server+this.init; var sep=(this.init.indexOf("?")==-1) ? "?" : "&"; if (arguments.length > 0 && arguments[0] !='') { szURL=szURL + sep + "map="+ arguments[0]; sep="&"; } if (arguments.length > 1 && arguments[1] !='') { szURL=szURL + sep + "extents="+ arguments[1]; sep="&"; } if (arguments.length > 2 && arguments[2] !='') { szURL=szURL + sep + "centerPoint="+ arguments[2]; sep="&"; } eval(szEval); document.server=this.server; this.triggerEvent( SMAP_INITIALIZED ); this.initializationState=2; return true;};SMap.prototype.initializeCallback=function( szInit ) { if (szInit.substr(0, 1) !="/") { this.triggerEvent( SMAP_ERROR, 'ERROR: S-Map! initialization '+ 'failed on the server. Message returned was:\n' + szInit); return false; } eval(szInit); this.triggerEvent( SMAP_INITIALIZED ); this.initializationState=2;};SMap.prototype.setBackgroundColor=function( color ) { this.domObj.style.backgroundColor=color; return true;};SMap.prototype.createLayers=function() { this.theInsideLayer=document.createElement('div'); this.theInsideLayer.id='theInsideLayer'; this.theInsideLayer.style.position='absolute'; this.theInsideLayer.style.left='0px'; this.theInsideLayer.style.top='0px'; this.theInsideLayer.style.zIndex='1'; this.theInsideLayer.SMap=this; if (this.currentTool) { this.theInsideLayer.style.cursor=this.currentTool.cursor; } this.domObj.appendChild(this.theInsideLayer); this.domObj.SMap=this; this.theInsideLayer.onmousedown=SMap_onmousedown; this.theInsideLayer.onmouseup=SMap_onmouseup; this.theInsideLayer.onmousemove=SMap_onmousemove; this.theInsideLayer.onmouseover=SMap_onmouseover; this.domObj.onmouseout=SMap_onmouseout; this.theInsideLayer.onkeypress=SMap_onkeypress; this.theInsideLayer.ondblclick=SMap_ondblclick; this.theInsideLayer.oncontextmenu=SMap_oncontextmenu; this.theInsideLayer.onmousewheel=SMap_onmousewheel; if (window.addEventListener && navigator.product && navigator.product=="Gecko") { this.domObj.addEventListener( "DOMMouseScroll", SMap_onmousewheel, false ); } this.theInsideLayer.ondragstart=new Function([], 'var e=e?e:event;e.cancelBubble=true;e.returnValue=false;return false;');};SMap.prototype.initializeLayers=function(nFactor) { var deltaMouseX=this.nCurrentLeft + safeParseInt(this.theInsideLayer.style.left) - this.xOrigin; var deltaMouseY=this.nCurrentTop + safeParseInt(this.theInsideLayer.style.top) - this.yOrigin; var vpTop=this.nCurrentTop - deltaMouseY; var vpLeft=this.nCurrentLeft - deltaMouseX; var vpCenterX=vpLeft + this.viewportWidth/2; var vpCenterY=vpTop + this.viewportHeight/2; var currentTileX=Math.floor(vpCenterX/this.tileWidth)*this.tileWidth; var currentTileY=Math.floor(vpCenterY/this.tileHeight)*this.tileHeight; var tileDeltaX=currentTileX - this.nCurrentLeft; var tileDeltaY=currentTileY - this.nCurrentTop; var newVpCenterX=vpCenterX * nFactor; var newVpCenterY=vpCenterY * nFactor; var newTileX=Math.floor(newVpCenterX/this.tileWidth) * this.tileWidth; var newTileY=Math.floor(newVpCenterY/this.tileHeight) * this.tileHeight; var newCurrentLeft=newTileX - tileDeltaX; var newCurrentTop=newTileY - tileDeltaY; this.nCurrentLeft=newCurrentLeft; this.nCurrentTop=newCurrentTop; var newTilLeft=-newVpCenterX + this.viewportWidth/2; var newTilTop=-newVpCenterY + this.viewportHeight/2; var xOldOrigin=this.xOrigin; var yOldOrigin=this.yOrigin; this.xOrigin=this.nCurrentLeft; this.yOrigin=this.nCurrentTop; this.theInsideLayer.style.left=(newTilLeft + this.xOrigin) + "px"; this.theInsideLayer.style.top=(newTilTop + this.yOrigin) + "px"; var layers=this.aMaps[this.currentMap].getLayers(); for( var k=0; k<layers.length; k++) { var d=layers[k].domObj; for(var j=0; j<this.nHigh; j++) { for( var i=0; i<this.nWide; i++) { var img=d.childNodes[(j*this.nWide)+i]; img.src=this.aPixel.src; img.style.top=(this.nCurrentTop + j*this.tileHeight - this.yOrigin) + "px"; img.style.left=(this.nCurrentLeft + i*this.tileWidth - this.xOrigin) + "px"; layers[k].setTile(img); } } } this.checkWrap(); this.updateObjects();};SMap.prototype.paintLayer=function(l) { var d=l.domObj; for(var j=0; j<this.nHigh; j++) { for( var i=0; i<this.nWide; i++) { var img=d.childNodes[(j*this.nWide)+i]; img.style.top=(this.nCurrentTop + j*this.tileHeight - this.yOrigin) + "px"; img.style.left=(this.nCurrentLeft + i*this.tileWidth - this.xOrigin) + "px"; l.setTile(img); } } this.checkWrap();};SMap.prototype.updateObjects=function() { for (var i=0; i<this.aObjects.length;i++) { var obj=this.aObjects[i]; var xOffset=(obj.xOffset) ? obj.xOffset : 0; var yOffset=(obj.yOffset) ? obj.yOffset : 0; var aPix=this.geoToPix( obj.lon, obj.lat ); var top=(aPix[1] - this.yOrigin + yOffset); var left=(aPix[0] - this.xOrigin + xOffset); obj.style.top=top + "px"; obj.style.left=left + "px"; }};SMap.prototype.resize=function( ) { if (this.initializationState !=2) { return false; } var newViewportWidth=this.getObjectWidth(this.domObj); var newViewportHeight=this.getObjectHeight(this.domObj); if (this.viewportWidth==null) { this.theInsideLayer.style.top=(-1*this.nCurrentTop + this.yOrigin) + "px"; this.theInsideLayer.style.left=(-1*this.nCurrentLeft + this.xOrigin) + "px"; this.viewportWidth=newViewportWidth; this.viewportHeight=newViewportHeight; } var newWide=Math.ceil((newViewportWidth / this.tileWidth) + 2*this.nBuffer); var newHigh=Math.ceil((newViewportHeight / this.tileHeight) + 2*this.nBuffer); this.viewportWidth=newViewportWidth; this.viewportHeight=newViewportHeight; if (this.nHigh==0 && this.nWide==0) { this.nWide=newWide; } while (this.nHigh < newHigh) { this.appendRow(); } while (this.nHigh > newHigh && newHigh > 3) { this.removeRow(); } while (this.nWide < newWide) { this.appendColumn(); } while (this.nWide > newWide && newWide > 3) { this.removeColumn(); } var map=this.getCurrentMap(); var layers=map.getLayers(); for(i=0;i<layers.length;i++) { layers[i].setTileLayer(); } this.triggerEvent( SMAP_EXTENTS_CHANGED, this.getGeoExtents() ); this.triggerEvent( SMAP_EXTENTS_CHANGED, this.getGeoExtents() );};SMap.prototype.createImage=function( top, left, obj ) { var img=document.createElement('img'); img.src=this.aPixel.src; img.width=this.tileWidth; img.height=this.tileHeight; img.setAttribute('style', 'position:absolute; top:'+top+'px; left:'+left+'px;' ); img.style.position='absolute'; img.style.top=(top - this.yOrigin)+'px'; img.style.left=(left - this.xOrigin)+'px'; img.style.width=this.tileWidth + "px"; img.style.height=this.tileHeight + "px"; img.style.visibility='hidden'; img.galleryimg="no"; img.onerror=SMap_imgOnError; img.onload=SMap_imgOnLoad; img.errorCount=0; img.id="i" + this.gImageID; img.layer=obj; img.SMap=this; this.gImageID=this.gImageID + 1; img.ie_hack=false; if (this.isIE4) { if (obj.imageformat && (obj.imageformat.toLowerCase()=="alpha")) {img.ie_hack=true;} } return img;};SMap.prototype.resetTile=function( id, bForce ) { var img=this.DHTMLapi.getRawObject(id); if (img.layer) { img.layer.setTile(this, bForce); }};SMap.prototype.reloadImage=function(id) {};SMap.prototype.resetImage=function(id) {};SMap_imgOnError=function(e) { if (this.layer) { this.layer.setTile(this, true); }};SMap_imgOnLoad=function(e) { if ((this.ie_hack) && (this.src !=this.SMap.aPixel.src)) { var src=this.src; this.src=this.SMap.aPixel.src; this.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"')"; } this.style.visibility='visible';};SMap.prototype.appendRow=function(layer) { if (this.nWide==0) { return; } var layers=null; if(arguments.length==1) { layers=Array(layer); } else { layers=this.aMaps[this.currentMap].getLayers(); } for( var i=0; i<layers.length; i++) { var obj=layers[i].domObj; for (var j=0; j<this.nWide; j++) { var top=this.nCurrentTop + (this.nHigh * this.tileHeight); var left=this.nCurrentLeft + (j * this.tileWidth); var img=this.createImage( top, left, layers[i] ); if (this.isIE4) { img.style.filter="Alpha(opacity="+layers[i].opacity+")"; } obj.appendChild( img ); } } this.nHigh=this.nHigh + 1;};SMap.prototype.appendColumn=function(layer) { if (this.nHigh==0) { return; } var layers=null; if(arguments.length==1) { layers=Array(layer); } else { layers=this.aMaps[this.currentMap].getLayers(); } for( var i=0; i<layers.length; i++) { var obj=layers[i].domObj; for(var j=this.nHigh-1; j>=0; j--) { var top=this.nCurrentTop + (j * this.tileHeight); var left=this.nCurrentLeft + (this.nWide * this.tileWidth); var img=this.createImage( top, left, layers[i] ); if (this.isIE4) { img.style.filter="Alpha(opacity="+layers[i].opacity+")"; } if (j < this.nHigh-1) { obj.insertBefore(img, obj.childNodes[((j+1)*this.nWide)]); } else { obj.appendChild(img); } } } this.nWide=this.nWide + 1;};SMap.prototype.removeColumn=function(layer) { if (this.nWide < 3) { return; } var layers=null; if(arguments.length==1) { layers=Array(layer); } else { layers=this.aMaps[this.currentMap].getLayers(); } for( var i=0; i<layers.length; i++) { var d=layers[i].domObj; for(var j=this.nHigh - 1; j >=0; j--) { var img=d.childNodes[((j+1)*this.nWide)-1]; d.removeChild( img ); img.onload=null; img.onerror=null; } } this.nWide=this.nWide - 1;};SMap.prototype.removeRow=function(layer) { if (this.nHigh < 3) { return; } var layers=null; if(arguments.length==1) { layers=Array(layer); } else { layers=this.aMaps[this.currentMap].getLayers(); } for( var i=0; i<layers.length; i++) { var d=layers[i].domObj; for(var j=this.nWide - 1; j >=0; j--) { var img=d.childNodes[((this.nHigh-1)*this.nWide)+j]; d.removeChild( img ); img.onload=null; img.onerror=null; } } this.nHigh=this.nHigh - 1;};SMap.prototype.hideLayers=function() { if (!this.hideLayersOnMove) { return; } if (this.layersHidden) { return; } var layers=this.aMaps[this.currentMap].getLayers(); for( var i=0; i<layers.length; i++) { layers[i]._visible=layers[i].visible; if (layers[i].name !='__base__') { layers[i].setVisibility( false ); } } for( var i=0; i < this.aCanvases.length; i++) { this.aCanvases[i].style.visibility='hidden'; this.aCanvases[i].style.display='none'; } this.layersHidden=true;};SMap.prototype.showLayers=function() { if (!this.hideLayersOnMove) { return; } if (!this.layersHidden) { return; } var layers=this.aMaps[this.currentMap].getLayers(); for( var i=0; i<layers.length; i++) { layers[i].setVisibility( layers[i]._visible ); } for( var i=0; i < this.aCanvases.length; i++) { this.aCanvases[i].style.visibility='visible'; this.aCanvases[i].style.display='block'; } this.layersHidden=false;};SMap.prototype.moveBy=function( x, y ) { var til=this.theInsideLayer; til.style.top=(safeParseInt(til.style.top)+y) + 'px'; til.style.left=(safeParseInt(til.style.left)+x )+ 'px'; this.checkWrap();};SMap.prototype.slideBy=function(x,y) { if (this.slideid!=null) { goQueueManager.dequeue( this.slideid ); } this.as=[]; var absX=Math.abs(x); var absY=Math.abs(y); var signX=x/absX; var signY=y/absY; var distance=absX>absY?absX:absY; var steps=Math.floor(distance/this.pixelsPerStep); var dx=dy=0; if (steps > 0) { dx=(x)/(steps*this.pixelsPerStep); dy=(y)/(steps*this.pixelsPerStep); } var remainderX=x - dx*steps*this.pixelsPerStep; var remainderY=y - dy*steps*this.pixelsPerStep; var px=py=0; var curspeed=this.accelerationFactor; var i=0; while(i<steps) { if (i>0) { px+=this.as[i-1][0]; py+=this.as[i-1][1]; } var cx=px+Math.round(dx*this.pixelsPerStep); var cy=py+Math.round(dy*this.pixelsPerStep); this.as[i]=new Array(cx-px,cy-py); i++; } if (remainderX !=0 || remainderY !=0) { this.as[i]=[remainderX, remainderY]; } this.hideLayers(); this.slideid=goQueueManager.enqueue(this.timePerStep,this,this.slide,[0]);};SMap.prototype.slide=function(pos) { if (pos>=this.as.length) { this.as=slideid=null; this.showLayers(); this.triggerEvent( SMAP_EXTENTS_CHANGED, this.getGeoExtents() ); return; } this.moveBy( this.as[pos][0], this.as[pos][1] ); pos ++; this.slideid=goQueueManager.enqueue(this.timePerStep,this,this.slide,[ pos]);};SMap_onkeypress=function( e ) { if (this.SMap.currentTool) { this.SMap.currentTool.onkeypress( e ); } if (this.SMap.aInfoTools.length > 0) { for (var i=0; i<this.SMap.aInfoTools.length; i++) { this.SMap.aInfoTools[i].onkeypress(e); } }};SMap_onmousemove=function( e ) { e=(e)?e:((event)?event:null); if (e.button==2) { this.SMap.triggerEvent( SMAP_CONTEXT_MENU ); } if (this.SMap.currentTool) { this.SMap.currentTool.onmousemove( e ); } if (this.SMap.aInfoTools.length > 0) { for (var i=0; i<this.SMap.aInfoTools.length; i++) { this.SMap.aInfoTools[i].onmousemove(e); } }};SMap_onmousedown=function( e ) { if (this.SMap.currentTool) { this.SMap.currentTool.onmousedown( e ); } if (this.SMap.aInfoTools.length > 0) { for (var i=0; i<this.SMap.aInfoTools.length; i++) { this.SMap.aInfoTools[i].onmousedown(e); } }};SMap_onmouseup=function( e ) { if (this.SMap.currentTool) { this.SMap.currentTool.onmouseup( e ); } if (this.SMap.aInfoTools.length > 0) { for (var i=0; i<this.SMap.aInfoTools.length; i++) { this.SMap.aInfoTools[i].onmouseup(e); } }};SMap_onmouseover=function( e ) { if (this.SMap.currentTool) { this.SMap.currentTool.onmouseover( e ); } if (this.SMap.aInfoTools.length > 0) { for (var i=0; i<this.SMap.aInfoTools.length; i++) { this.SMap.aInfoTools[i].onmouseover(e); } }};SMap_onmouseout=function( e ) { if (this.SMap.currentTool) { this.SMap.currentTool.onmouseout( e ); } if (this.SMap.aInfoTools.length > 0) { for (var i=0; i<this.SMap.aInfoTools.length; i++) { this.SMap.aInfoTools[i].onmouseout(e); } }};SMap_oncontextmenu=function( e ) { e=e?e:event; if (e.preventDefault) { e.preventDefault(); } return false;};SMap_ondblclick=function( e ) { if (this.SMap.currentTool) { this.SMap.currentTool.ondblclick( e ); } if (this.SMap.aInfoTools.length > 0) { for (var i=0; i<this.SMap.aInfoTools.length; i++) { this.SMap.aInfoTools[i].ondblclick(e); } }};SMap_onmousewheel=function( e ) { if (this.SMap.currentTool) { this.SMap.currentTool.onmousewheel( e ); }};SMap.prototype.cancelEvent=function(e) { e=(e)?e:((event)?event:null); e.returnValue=false; if (e.preventDefault) { e.preventDefault(); } return false;};SMap.prototype.registerTool=function( toolObj ) { this.aTools.push( toolObj );};SMap.prototype.activateTool=function( toolObj ) { if (toolObj.isInfoTool()) { this.aInfoTools.push(toolObj); } else { if (this.currentTool) { this.currentTool.deactivate(); } this.currentTool=toolObj; if (this.theInsideLayer) { this.setCursor(this.currentTool.cursor); } }};SMap.prototype.deactivateTool=function( toolObj ) { if (toolObj.isInfoTool()) { for (var i=0; i<this.aInfoTools.length; i++) { if (this.aInfoTools[i]==toolObj) { this.aInfoTools.splice(i,1); break; } } } else { if (this.currentTool==toolObj) { this.currentTool=null; } if (this.theInsideLayer) { this.theInsideLayer.style.cursor='auto'; } }};SMap.prototype.setCursor=function(cursor) { if (cursor && cursor.length && typeof(cursor)=='object') { for (var i=0; i < cursor.length; i++) { this.theInsideLayer.style.cursor=cursor[i]; if (this.theInsideLayer.style.cursor==cursor[i]) { break; } } } else if (typeof(cursor)=='string') { this.theInsideLayer.style.cursor=cursor; } else { this.theInsideLayer.style.cursor='auto'; }};SMap.prototype.checkWrap=function() { var bWrapped=false; this.checkMaxExtents(); this.xOffset=safeParseInt(this.theInsideLayer.style.left) + this.nCurrentLeft - this.xOrigin; this.yOffset=safeParseInt(this.theInsideLayer.style.top) + this.nCurrentTop - this.yOrigin; while (this.xOffset > 0) { this.wrapR2L(); bWrapped=true; } while (this.xOffset < -(this.nBuffer*this.tileWidth)) { this.wrapL2R(); bWrapped=true; } while (this.yOffset > -(this.nBuffer*this.tileHeight)) { this.wrapB2T(); bWrapped=true; } while (this.yOffset < -(2*this.nBuffer*this.tileHeight)) { this.wrapT2B(); bWrapped=true; } var layer=this.aMaps[this.currentMap].getLayers()[0]; if (layer) { var img=layer.domObj.childNodes[0].style; this.nCurrentTop=safeParseInt(img.top) + this.yOrigin; this.nCurrentLeft=safeParseInt(img.left) + this.xOrigin; } if (bWrapped) { this.triggerEvent( SMAP_METAEXTENTS_CHANGED, this.getMetaExtents() ); }};SMap.prototype.checkMaxExtents=function() { var maxExtents=this.getCurrentMap().maxExtents; if (maxExtents.length==4) {if ((maxExtents[0] >=maxExtents[2]) || (maxExtents[1] >=maxExtents[3])) {return false;} var geoExtents=this.getGeoExtents(); var hPixelAdjustment=0; var vPixelAdjustment=0; if (geoExtents[0] < maxExtents[0]) { hPixelAdjustment=Math.round((maxExtents[0] - geoExtents[0]) / this.cellSize); } if (geoExtents[2] > maxExtents[2]) { if(hPixelAdjustment !=0){ hPixelAdjustment +=Math.round((maxExtents[2] - geoExtents[2]) / this.cellSize);hPixelAdjustment /=2;} else {hPixelAdjustment +=Math.round((maxExtents[2] - geoExtents[2]) / this.cellSize);} }if(hPixelAdjustment !=0) { this.theInsideLayer.style.left=(safeParseInt(this.theInsideLayer.style.left) - hPixelAdjustment) + 'px'; } if(geoExtents[1] < maxExtents[1]) { vPixelAdjustment=Math.round((maxExtents[1] - geoExtents[1]) / this.cellSize); } if(geoExtents[3] > maxExtents[3]) { if(vPixelAdjustment !=0) { vPixelAdjustment +=Math.round((maxExtents[3] - geoExtents[3]) / this.cellSize);vPixelAdjustment /=2;} else { vPixelAdjustment=Math.round((maxExtents[3] - geoExtents[3]) / this.cellSize);} }if(vPixelAdjustment !=0) { this.theInsideLayer.style.top=(safeParseInt(this.theInsideLayer.style.top) + vPixelAdjustment) + 'px'; } }};SMap.prototype.wrapR2L=function() { this.xOffset=this.xOffset - (this.nBuffer * this.tileWidth); var layers=this.aMaps[this.currentMap].getLayers(); for( var k=0; k<layers.length; k++) { var d=layers[k].domObj; var refLeft=safeParseInt(d.childNodes[0].style.left); for (var j=0; j<this.nHigh; j++) { var imgLast=d.childNodes[((j+1)*this.nWide)-1]; var imgNext=d.childNodes[j*this.nWide]; imgLast.style.left=(refLeft - this.tileWidth) + 'px'; imgLast.src=this.aPixel.src; d.removeChild(imgLast); d.insertBefore(imgLast, imgNext); if (layers[k].visible) { layers[k].setTile(imgLast); } } }};SMap.prototype.wrapL2R=function() { this.xOffset=this.xOffset + (this.nBuffer*this.tileWidth); var layers=this.aMaps[this.currentMap].getLayers(); for( var k=0; k<layers.length; k++) { var d=layers[k].domObj; var refLeft=safeParseInt(d.childNodes[this.nWide-1].style.left); for (var j=0; j<this.nHigh; j++) { var imgFirst=d.childNodes[j*this.nWide]; var imgNext; if (j < this.nHigh-1) { imgNext=d.childNodes[((j+1)*this.nWide)]; } else { imgNext=null; } imgFirst.style.left=(refLeft + this.tileWidth) + 'px'; imgFirst.src=this.aPixel.src; d.removeChild(imgFirst); if (imgNext) { d.insertBefore(imgFirst, imgNext); } else { d.appendChild(imgFirst); } if (layers[k].visible) { layers[k].setTile(imgFirst); } } }};SMap.prototype.wrapT2B=function() { this.yOffset=this.yOffset + (this.nBuffer*this.tileHeight); var layers=this.aMaps[this.currentMap].getLayers(); for( var k=0; k<layers.length; k++) { var d=layers[k].domObj; var refTop=safeParseInt(d.childNodes[(this.nHigh*this.nWide)-1].style.top); for (var i=0; i<this.nWide; i++) { var imgBottom=d.childNodes[0]; imgBottom.style.top=(refTop + this.tileHeight) + 'px'; imgBottom.src=this.aPixel.src; d.removeChild(imgBottom); d.appendChild(imgBottom); if (layers[k].visible) { layers[k].setTile(imgBottom); } } }};SMap.prototype.wrapB2T=function() { this.yOffset=this.yOffset - (this.nBuffer*this.tileHeight); var layers=this.aMaps[this.currentMap].getLayers(); for( var k=0; k<layers.length; k++) { var d=layers[k].domObj; var refTop=safeParseInt(d.childNodes[0].style.top); for (var i=0; i<this.nWide; i++) { var imgTop=d.childNodes[(this.nHigh*this.nWide)-1]; imgTop.style.top=(refTop - this.tileHeight) + 'px'; imgTop.src=this.aPixel.src; d.removeChild(imgTop); d.insertBefore(imgTop, d.childNodes[0]); if (layers[k].visible) { layers[k].setTile(imgTop); } } }};SMap.prototype.addMap=function( oMap ) { oMap.SMap=this; this.aMaps[oMap.name]=oMap;};SMap.prototype.getMaps=function() { return this.aMaps;};SMap.prototype.getCurrentMap=function() { return this.aMaps[this.currentMap];};SMap.prototype.selectMap=function( name ) { if (!this.aMaps[name]) { return false; } else { this.currentMap=name; var oMap=this.getCurrentMap(); this.setBackgroundColor(oMap.backgroundColor); this.setMapLayers(); if (arguments[1] && arguments[1].length==3) { this.zoomTo(arguments[1][0], arguments[1][1], arguments[1][2]); oMap.aZoomTo.length=0; } else if (oMap.aZoomTo.length !=0) { this.zoomTo(oMap.aZoomTo[0], oMap.aZoomTo[1], oMap.aZoomTo[2]); oMap.aZoomTo.length=0; } else if (arguments[1] && arguments[1].length==4) { this.zoomToExtents( arguments[1][0], arguments[1][1], arguments[1][2], arguments[1][3] ); } else { this.zoomToExtents( oMap.currentExtents[0], oMap.currentExtents[1], oMap.currentExtents[2], oMap.currentExtents[3] ); } this.triggerEvent( SMAP_MAP_INITIALIZED, this.currentMap ); return true; }};SMap.prototype.setMapLayers=function( ) { var oMap=this.getCurrentMap(); for(var i=this.theInsideLayer.childNodes.length - 1; i>=0; i-- ) { if (this.theInsideLayer.childNodes[i].className=='mapLayer') { this.theInsideLayer.childNodes[i].appended=false; this.theInsideLayer.removeChild(this.theInsideLayer.childNodes[i]); } } layers=oMap.getLayers(); for( var i=0; i<layers.length; i++) { if(!layers[i].domObj) { var d=this.createMapLayer( layers[i].name ); this.theInsideLayer.appendChild( d ); d.appended=true; layers[i].domObj=d; layers[i].setOpacity( layers[i].opacity ); layers[i].setZIndex( layers[i].zIndex ); layers[i].setVisibility( layers[i].visible ); this.nWide=0; this.nHigh=0; this.drawGroup(layers[i]); } else if (!layers[i].domObj.appended) { this.theInsideLayer.appendChild( layers[i].domObj ); layers[i].domObj.appended=true; layers[i].setZIndex( layers[i].zIndex ); } } return true;};SMap.prototype.drawGroup=function(group) { var newViewportWidth=this.getObjectWidth(this.domObj); var newViewportHeight=this.getObjectHeight(this.domObj); if (this.viewportWidth==null) { this.theInsideLayer.style.top=(-1*this.nCurrentTop + this.yOrigin) + "px"; this.theInsideLayer.style.left=(-1*this.nCurrentLeft + this.xOrigin) + "px"; this.viewportWidth=newViewportWidth; this.viewportHeight=newViewportHeight; } var newWide=Math.ceil((newViewportWidth / this.tileWidth) + 2*this.nBuffer); var newHigh=Math.ceil((newViewportHeight / this.tileHeight) + 2*this.nBuffer); this.viewportWidth=newViewportWidth; this.viewportHeight=newViewportHeight; if (this.nHigh==0 && this.nWide==0) { this.nWide=newWide; } while (this.nHigh < newHigh) { this.appendRow(group); } while (this.nHigh > newHigh) { this.removeRow(group); } while (this.nWide < newWide) { this.appendColumn(group); } while (this.nWide > newWide) { this.removeColumn(group); } return true;};SMap.prototype.createMapLayer=function( id ) { var d=document.createElement( 'div' ); d.id=id; d.className='mapLayer'; d.style.position='absolute'; d.style.visibility='visible'; d.style.left='0px'; d.style.top='0px'; d.style.width='3000px'; d.style.height='3000px'; d.appended=false; return d;};SMap.prototype.addMapLayer=function( l ) { var map=this.getCurrentMap(); map.addLayer(l); this.setMapLayers(); this.paintLayer(l); this.triggerEvent( SMAP_LAYERS_CHANGED, this.currentMap );};SMap.prototype.removeMapLayer=function( id ) { var map=this.getCurrentMap(); var layer=map.getLayer(id); if (!layer) { return false; } if (map.removeLayer ( map.getLayer(id) )) { this.setMapLayers(); this.triggerEvent( SMAP_LAYERS_CHANGED, this.currentMap ); }};SMap.prototype.getCenter=function() { var deltaMouseX=this.nCurrentLeft - this.xOrigin + safeParseInt(this.theInsideLayer.style.left); var deltaMouseY=this.nCurrentTop - this.yOrigin + safeParseInt(this.theInsideLayer.style.top); var vpTop=this.nCurrentTop - deltaMouseY; var vpLeft=this.nCurrentLeft - deltaMouseX; var vpCenterX=vpLeft + this.viewportWidth/2; var vpCenterY=vpTop + this.viewportHeight/2; return new Array( vpCenterX, vpCenterY );};SMap.prototype.getGeoExtents=function() { var newViewportWidth=this.getObjectWidth(this.domObj); var newViewportHeight=this.getObjectHeight(this.domObj); this.viewportWidth=newViewportWidth; this.viewportHeight=newViewportHeight; var minx=-1*(safeParseInt(this.theInsideLayer.style.left) - this.xOrigin) * this.cellSize; var maxx=minx + this.viewportWidth * this.cellSize; var maxy=(safeParseInt(this.theInsideLayer.style.top) - this.yOrigin) * this.cellSize; var miny=maxy - this.viewportHeight * this.cellSize; return [minx,miny,maxx,maxy];};SMap.prototype.getGeoExtents2=function() { var newViewportWidth=this.getObjectWidth(this.domObj); var newViewportHeight=this.getObjectHeight(this.domObj); this.viewportWidth=newViewportWidth; this.viewportHeight=newViewportHeight; var minx=-1*(safeParseInt(this.theInsideLayer.style.left) - this.xOrigin + 0.25 * this.viewportWidth) * this.cellSize; var maxx=minx + 1.5 * this.viewportWidth * this.cellSize; var maxy=(safeParseInt(this.theInsideLayer.style.top) - this.yOrigin + 0.25 * this.viewportHeight) * this.cellSize; var miny=maxy - 1.5 * this.viewportHeight * this.cellSize; return [minx,miny,maxx,maxy];};SMap.prototype.getMetaExtents=function() { var result=this.getGeoExtents(); var oMap=this.getCurrentMap(); layers=oMap.getLayers(); for( var i=0; i<layers.length; i++) { if(layers[i].domObj) { var d=layers[i].domObj; var pl=safeParseInt(d.childNodes[0].style.left); var pt=safeParseInt(d.childNodes[0].style.top); var glt=this.pixToGeo(pl,pt,true); var left=-1*glt[0]; var top=-1*glt[1]; var right=left + this.nWide*this.tileWidth*this.cellSize; var bottom=top - this.nHigh*this.tileHeight*this.cellSize; result=[left, bottom, right, top]; break; } } return result;};SMap.prototype.zoomIn=function() { this.zoomByFactor(this.aMaps[this.currentMap].zoomIn());};SMap.prototype.zoomOut=function() { this.zoomByFactor(this.aMaps[this.currentMap].zoomOut());};SMap.prototype.zoomToScale=function( scale ) { this.zoomByFactor(this.aMaps[this.currentMap].zoomToScale(scale));};SMap.prototype.zoomByScaleIndex=function( scaleIndex ) {var m=this.aMaps[this.currentMap];var a=m.aScales;var s=this.aMaps[this.currentMap].aScales[this.aMaps[this.currentMap].currentScale]; this.zoomByFactor(this.aMaps[this.currentMap].zoomByScaleIndex(scaleIndex));};SMap.prototype.zoomByFactor=function( nZoomFactor ) { if (nZoomFactor==1) { this.triggerEvent( SMAP_NOTICE, "NOTICE: changing to current scale aborted"); return; } this.cellSize=this.cellSize/nZoomFactor; this.setMapLayers(); this.initializeLayers(nZoomFactor); this.triggerEvent( SMAP_SCALE_CHANGED, this.getCurrentScale() ); this.triggerEvent( SMAP_EXTENTS_CHANGED, this.getGeoExtents() );};SMap.prototype.getCurrentScale=function() {this.currentScaleIndex=this.aMaps[this.currentMap].currentScale; return this.aMaps[this.currentMap].aScales[this.aMaps[this.currentMap].currentScale];};SMap.prototype.setLayerQueryable=function( name, bQueryable ) { this.aMaps[this.currentMap].setLayerQueryable( name, bQueryable );};SMap.prototype.setLayerVisibility=function( name, bVisible ) { if(!this.loadUnchecked && bVisible) { layer=this.aMaps[this.currentMap].getLayer(name); layer.visible=true; this.setMapLayers(); this.aMaps[this.currentMap].setLayerVisibility( name, bVisible ); this.paintLayer(layer); } else { this.aMaps[this.currentMap].setLayerVisibility( name, bVisible ); }};SMap.prototype.setLayerOpacity=function( name, opacity ) { this.aMaps[this.currentMap].setLayerOpacity( name, opacity );};SMap.prototype.registerEventID=function( eventID ) { return this.eventManager.registerEventID(eventID);};SMap.prototype.registerForEvent=function( eventID, obj, func ) { return this.eventManager.registerForEvent(eventID, obj, func);};SMap.prototype.deregisterForEvent=function( eventID, obj, func ) { return this.eventManager.deregisterForEvent(eventID, obj, func);};SMap.prototype.triggerEvent=function( eventID ) { return this.eventManager.triggerEvent.apply( this.eventManager, arguments );};function safeParseInt( val ) { return Math.round(parseFloat(val));};function _map(o) { this.aLayers=[]; this.aZoomTo=[]; this.SMap=null; this.name=(typeof(o.name) !='undefined') ? o.name : 'noname'; this.title=(typeof(o.title) !='undefined') ? o.title : 'no title'; this.aScales=(typeof(o.scales) !='undefined') ? o.scales : [1]; this.currentScale=(typeof(o.currentScale) !='undefined') ? parseFloat(o.currentScale) : 0; this.units=(typeof(o.units) !='undefined') ? o.units : 5; this.resolution=(typeof(o.resolution) !='undefined') ? o.resolution:72; this.defaultExtents=(typeof(o.defaultExtents) !='undefined') ? o.defaultExtents:[]; this.currentExtents=(typeof(o.currentExtents) !='undefined') ? o.currentExtents:[]; this.maxExtents=(typeof(o.maxExtents) !='undefined') ? o.maxExtents : []; this.backgroundColor=(typeof(o.backgroundColor) !='undefined') ? o.backgroundColor : '#ffffff'; this.version=(typeof(o.version) !='undefined') ? o.version : "";};_map.prototype.addLayer=function( layer ) { layer._map=this; layer.zIndex=this.aLayers.length; this.aLayers.push( layer );};_map.prototype.removeLayer=function( l ) { var alayer=Array(); for(i=0,a=0;i<this.aLayers.length;i++) { if(this.aLayers[i]!=l) { alayer[a]=this.aLayers[i]; a++; } } this.aLayers=alayer; return true;};_map.prototype.getQueryableLayers=function() { var r=[]; var l=this.getLayers(); for( var i=0; i<l.length; i++) { if (l[i].isQueryable()) { r.push(l[i]); } } return r;};_map.prototype.getLayers=function() { var r=[]; for( var i=0; i<this.aLayers.length; i++) { if (this.aLayers[i].isVisible() && (this.aLayers[i].visible || this.SMap.loadUnchecked) ) { r.push(this.aLayers[i]); } } return r;};_map.prototype.getAllQueryableLayers=function() { var r=[]; for( var i=0; i<this.aLayers.length; i++) { if (this.aLayers[i].isQueryable()) { r.push(this.aLayers[i]); } } return r;};_map.prototype.getAllLayers=function() { return this.aLayers;};_map.prototype.getLayer=function( name ) { for (var i=0; i<this.aLayers.length; i++) { if (this.aLayers[i].name==name) { return this.aLayers[i]; } }};_map.prototype.getScales=function() { return this.aScales;};_map.prototype.zoomIn=function() { var nZoomFactor=1; if (this.currentScale < this.aScales.length - 1) { nZoomFactor=this.aScales[this.currentScale]/this.aScales[this.currentScale+1]; this.currentScale=this.currentScale + 1; } return nZoomFactor;};_map.prototype.zoomOut=function() { var nZoomFactor=1; if (this.currentScale > 0) { nZoomFactor=this.aScales[this.currentScale]/this.aScales[this.currentScale-1]; this.currentScale=this.currentScale - 1; } return nZoomFactor;};_map.prototype.zoomToScale=function( scale ) { var nZoomFactor=1; for (var i=0; i<this.aScales.length; i++) { if (this.aScales[i]==scale) { nZoomFactor=this.aScales[this.currentScale]/scale; this.currentScale=parseInt(i); } } return nZoomFactor;};_map.prototype.zoomByScaleIndex=function( scaleIndex ) { var nZoomFactor=1; nZoomFactor=this.aScales[this.currentScale]/this.aScales[scaleIndex]; this.currentScale=parseInt(scaleIndex); return nZoomFactor;};_map.prototype.setLayerQueryable=function( name, bQueryable ) { var layer=this.getLayer( name ); if(typeof(layer) !='undefined') { layer.setQueryable( bQueryable ); }};_map.prototype.setLayerVisibility=function( name, bVisible ) { var layer=this.getLayer( name ); if(typeof(layer) !='undefined') { layer.setVisibility( bVisible ); }};_map.prototype.setLayerOpacity=function( name, opacity ) { var layer=this.getLayer( name ); if(typeof(layer) !='undefined') { layer.setOpacity( opacity ); }};_map.prototype.setDefaultExtents=function( minx, miny, maxx, maxy ){ this.defaultExtents=[minx, miny, maxx, maxy]; if (this.currentExtents.length==0) this.setCurrentExtents( minx, miny, maxx, maxy );};_map.prototype.setCurrentExtents=function( minx, miny, maxx, maxy ) { this.currentExtents=[minx, miny, maxx, maxy];};_map.prototype.setMaxExtents=function( minx, miny, maxx, maxy ) { this.maxExtents=[minx, miny, maxx, maxy];};_map.prototype.setBackgroundColor=function( szBgColor ) { this.backgroundColor=szBgColor;};function _layer( o ) { this.domObj=null; this._map=null; this.name=(typeof(o.name) !='undefined') ? o.name : 'unnamed'; this.visible=(typeof(o.visible) !='undefined') ? o.visible : true; this.opacity=(typeof(o.opacity) !='undefined') ? o.opacity : 100; this.imageformat=(typeof(o.imageformat) !='undefined') ? o.imageformat : null; this.queryable=(typeof(o.queryable) !='undefined') ? o.queryable : false; this.queryState=(typeof(o.queryable) !='undefined') ? o.queryable : false; this.tileSource=(typeof(o.tileSource) !='undefined') ? o.tileSource : 'auto'; this.scales=(typeof(o.scales) !='undefined') ? o.scales : new Array(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1); this.toLoad=0; var ts=new Date(); this.timeStamp=Math.round(ts.getTime()/1000) + ts.getTimezoneOffset() * 60; this.redrawInterval=(typeof(o.redrawInterval) !='undefined') ? o.redrawInterval : -1; this.refreshInterval=(typeof(o.refreshInterval) !='undefined') ? o.refreshInterval : -1; if (this.refreshInterval > 0) { goQueueManager.enqueue( this.refreshInterval*1000, this, this.redraw ); }};_layer.prototype.isQueryable=function() { return this.queryState;};_layer.prototype.setQueryable=function( bQueryable ) { if (this.queryable) { this.queryState=bQueryable; }};_layer.prototype.isVisible=function() { return (this.scales[this._map.currentScale]==1)? true:false;};_layer.prototype.setOpacity=function( amount ) { this.opacity=amount; if (this.domObj) { this.domObj.style.opacity=amount/100; this.domObj.style.mozOpacity=amount/100; for(var i=0;i<this.domObj.childNodes.length;i++) { this.domObj.childNodes[i].style.filter="Alpha(opacity="+amount+")"; } }};_layer.prototype.setTile=function(img) { var l=safeParseInt(img.style.left) + this._map.SMap.xOrigin; var t=safeParseInt(img.style.top) + this._map.SMap.yOrigin; var szImageformat=''; var image_format=''; if (this.imageformat && this.imageformat !='') { image_format=this.imageformat; szImageformat='&i='+image_format; } if(this.tileSource=='cache') { var metaLeft=Math.floor(l/(this._map.SMap.tileWidth * this._map.SMap.metaWidth)) * this._map.SMap.tileWidth * this._map.SMap.metaWidth; var metaTop=Math.floor(t/(this._map.SMap.tileHeight * this._map.SMap.metaHeight)) * this._map.SMap.tileHeight * this._map.SMap.metaHeight; var metaTileId='t' + metaTop + 'l' + metaLeft; var groupsDir=(this.name !='') ? this.name.replace(/\W/g, '_') : 'def'; var cacheDir=this._map.SMap.webCache + this._map.name + '/' + this._map.aScales[this._map.currentScale] + '/' + groupsDir + '/def/' + metaTileId; var tileId="t" + t + "l" + l; var imageExtension=this.imageformat.toLowerCase().replace(/[\de]/g, ''); var src=cacheDir + "/" + tileId + "." + imageExtension; } else { var szVersion=''; if (this._map.version !='') { szVersion='&version='+this._map.version; } var szForce=''; var szLayers=''; if (arguments[1]) { szForce='&force=true'; } var szTimestamp=''; if (this.tileSource=='redraw' || this.tileSource=="refresh") { szTimestamp='&ts='+this.timeStamp; if (this.redrawInterval) { szTimestamp=szTimestamp + '&interval='+this.redrawInterval; } } var szGroup='&g='+img.layer.domObj.id; var szScale='&s='+this._map.aScales[this._map.currentScale]; var q='?'; if (this._map.SMap.tileURL.indexOf('?') !=-1) { if (this._map.SMap.tileURL.slice(-1) !='&') { q='&'; } else { q=''; } } if (this.tileSource=='nocache') { var src=this._map.SMap.server + this._map.SMap.tileURL.replace('tile.php', 'tile_nocache.php') + q + 'map=' + this._map.name + '&t=' + t + '&l=' + l + szScale + szForce + szGroup + szImageformat; if(typeof(this.replacementVariables) !='undefined') { for(var key in this.replacementVariables) { src +='&' + encodeURIComponent(key) + '=' + encodeURIComponent(this.replacementVariables[key]); } } } else { var src=this._map.SMap.server + this._map.SMap.tileURL + q + 'map=' + this._map.name + '&t=' + t + '&l=' + l + szScale + szForce + szGroup + szImageformat + szTimestamp + szVersion; } } if (img.src !=src) { img.style.visibility='hidden'; img.src=src; }};_layer.prototype.setVisibility=function( bVisible ) { this.visible=bVisible; if (this.domObj) { this.domObj.style.visibility=bVisible?'visible':'hidden'; this.domObj.style.display=bVisible?'block':'none'; for( var i=0; i<this.domObj.childNodes.length; i++) { this.setTile(this.domObj.childNodes[i]); }this._map.SMap.triggerEvent( SMAP_LAYER_STATUS_CHANGED, this );}};_layer.prototype.setZIndex=function( zIndex ) { this.zIndex=zIndex; if (this.domObj) { this.domObj.style.zIndex=zIndex; }};_layer.prototype.setTileLayer=function() { this.loaded=0; for(i=0; i < this.domObj.childNodes.length; i++) { img=this.domObj.childNodes[i]; if(arguments[0]) { this.setTile(img, arguments[0]); } else { this.setTile(img); } }};_layer.prototype.redraw=function() { if (arguments[0]) { this.refreshInterval=arguments[0]; } if (this.visible) { var ts=new Date(); this.timeStamp=Math.round(ts.getTime()/1000) + ts.getTimezoneOffset() * 60; this.setTileLayer(); } if (this.refreshInterval > 0) { goQueueManager.enqueue( this.refreshInterval*1000, this, this.redraw ); }};function _eventManager( ){ this.events=[]; this.lastEventID=0;};_eventManager.prototype.registerEventID=function( eventID ) { var ev=new String(eventID); if (!this.events[eventID]) { this.events[eventID]=[]; }};_eventManager.prototype.registerForEvent=function(eventID, obj, func) { var ev=new String(eventID); this.events[eventID].push( [obj, func] );};_eventManager.prototype.deregisterForEvent=function( eventID, obj, func ) { var ev=new String(eventID); var bResult=false; if (!this.events[eventID]) { return false; } for (var i=0;i<this.events[eventID].length;i++) { if (this.events[eventID][i][0]==obj && this.events[eventID][i][1]==func) { this.events[eventID].splice(i,1); bResult=true; } } return bResult;};_eventManager.prototype.triggerEvent=function( eventID ) { var ev=new String(eventID); if (!this.events[eventID]) { return false; } var args=new Array(); for(i=1; i<arguments.length; i++) { args[args.length]=arguments[i]; } for (var i=0; i<this.events[eventID].length; i++) { this.events[eventID][i][1].apply( this.events[eventID][i][0], arguments ); } return true;};var goQueueManager=new _queueManager();function _queueManager() { this.queue=new Array();};_queueManager.prototype.enqueue=function( timeout, obj, func, args ) { var pos=this.queue.length; for (var i=0; i< this.queue.length; i++) { if (this.queue[i]==null) { pos=i; break; } } var id=window.setTimeout( "_queueManager_execute("+pos+")", timeout ); this.queue[pos]=new Array( id, obj, func, args ); return pos;};_queueManager.prototype.dequeue=function( pos ) { if (this.queue[pos] !=null) { window.clearTimeout( this.queue[pos][0] ); this.queue[pos]=null; }};function _queueManager_execute( pos) { if (goQueueManager.queue[pos] !=null) { var obj=goQueueManager.queue[pos][1]; var func=goQueueManager.queue[pos][2]; if (goQueueManager.queue[pos][3] !=null) { func.apply( obj, goQueueManager.queue[pos][3] ); } else { func.apply( obj ); } goQueueManager.queue[pos]=null; }};﻿var isCSS, isW3C, isIE4, isNN4;var queryParams=null;function getMyMap(){var domObj=this.getRawObject( szMapName ); return domObj.SMap;};function initDHTMLAPI() { if (document.images) { isCSS=(document.body && document.body.style) ? true : false; isW3C=(isCSS && document.getElementById) ? true : false; isIE4=(isCSS && document.all) ? true : false; isNN4=(document.layers) ? true : false; isIE6CSS=(document.compatMode && document.compatMode.indexOf("CSS1") >=0) ? true : false; }};function seekLayer(doc, name) { var theObj; for (var i=0; i < doc.layers.length; i++) { if (doc.layers[i].name==name) { theObj=doc.layers[i]; break; } if (doc.layers[i].document.layers.length > 0) { theObj=seekLayer(document.layers[i].document, name); } } return theObj;};function getRawObject(obj) { var theObj; if (typeof(obj)=="string") { if (isW3C) { theObj=document.getElementById(obj); } else if (isIE4) { theObj=document.all(obj); } else if (isNN4) { theObj=seekLayer(document, obj); } } else { theObj=obj; } return theObj;};function getObject(obj) { var theObj=getRawObject(obj); if (theObj && isCSS) { theObj=theObj.style; } return theObj;};function shiftTo(obj, x, y) { var theObj=getObject(obj); if (theObj) { if (isCSS) { var units=(typeof theObj.left=="string") ? "px" : 0; theObj.left=x + units; theObj.top=y + units; } else if (isNN4) { theObj.moveTo(x,y) } }};function shiftBy(obj, deltaX, deltaY) { var theObj=getObject(obj); if (theObj) { if (isCSS) { var units=(typeof theObj.left=="string") ? "px" : 0; theObj.left=getObjectLeft(obj) + deltaX + units; theObj.top=getObjectTop(obj) + deltaY + units; } else if (isNN4) { theObj.moveBy(deltaX, deltaY); } }};function setZIndex(obj, zOrder) { var theObj=getObject(obj); if (theObj) { theObj.zIndex=zOrder; }}function setBGColor(obj, color) { var theObj=getObject(obj); if (theObj) { if (isNN4) { theObj.bgColor=color; } else if (isCSS) { theObj.backgroundColor=color; } }};function show(obj) { var theObj=getObject(obj); if (theObj) { theObj.visibility="visible"; }};function hide(obj) { var theObj=getObject(obj); if (theObj) { theObj.visibility="hidden"; }};function getObjectLeft(obj) { var elem=getRawObject(obj); var result=0; if (document.defaultView) { var style=document.defaultView; var cssDecl=style.getComputedStyle(elem, ""); result=cssDecl.getPropertyValue("left"); } else if (elem.currentStyle) { result=elem.currentStyle.left; } else if (elem.style) { result=elem.style.left; } else if (isNN4) { result=elem.left; } return parseInt(result);};function getObjectTop(obj) { var elem=getRawObject(obj); var result=0; if (document.defaultView) { var style=document.defaultView; var cssDecl=style.getComputedStyle(elem, ""); result=cssDecl.getPropertyValue("top"); } else if (elem.currentStyle) { result=elem.currentStyle.top; } else if (elem.style) { result=elem.style.top; } else if (isNN4) { result=elem.top; } return parseInt(result);};function getObjectWidth(obj) { var elem=getRawObject(obj); var result=0; if (elem.offsetWidth) { result=elem.offsetWidth; } else if (elem.clip && elem.clip.width) { result=elem.clip.width; } else if (elem.style && elem.style.pixelWidth) { result=elem.style.pixelWidth; } return parseInt(result);};function getObjectHeight(obj) { var elem=getRawObject(obj); var result=0; if (elem.offsetHeight) { result=elem.offsetHeight; } else if (elem.clip && elem.clip.height) { result=elem.clip.height; } else if (elem.style && elem.style.pixelHeight) { result=elem.style.pixelHeight; } return parseInt(result);};function getInsideWindowWidth() { if (window.innerWidth) { return window.innerWidth; } else if (isIE6CSS) { return document.body.parentElement.clientWidth; } else if (document.body && document.body.clientWidth) { return document.body.clientWidth; } return 0;};function getInsideWindowHeight() { if (window.innerHeight) { return window.innerHeight; } else if (isIE6CSS) { return document.body.parentElement.clientHeight; } else if (document.body && document.body.clientHeight) { return document.body.clientHeight; } return 0;};function stringLength(str){var len;var i;len=0;for (i=0;i<str.length;i++){if (str.charCodeAt(i)>255) len+=2; else len++;}return len;};function parseQueryString() { queryParams={}; var s=window.location.search; if (s!='') { s=s.substring( 1 ); var p=s.split('&'); for (var i=0;i<p.length;i++) { var q=p[i].split('='); queryParams[q[0]]=q[1]; } }};function getQueryParam(p) { if (!queryParams) { parseQueryString(); } if (queryParams[p]) { return queryParams[p]; } else { return ''; }};function applyPNGFilter(o) { var t=document.server + "images/a_pixel.gif"; var w=o.width; var h=o.height; if( o.src !=t ) { var s=o.src; o.src=t; o.width=w; o.height=h; o.runtimeStyle.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+s+'\',sizingMethod=\'scale\')'; }};function getTop(el){var offset=el.offsetTop;if(el.offsetParent) offset+=getTop(el.offsetParent);return offset;};function getLeft(el){var offset=el.offsetLeft;if(el.offsetParent) offset+=getLeft(el.offsetParent);return offset;};﻿var szMapControl='mapControl';var szMapControl_MoveUp='mapControl_MoveUp';var szMapControl_MoveLeft='mapControl_MoveLeft';var szMapControl_MoveRight='mapControl_MoveRight';var szMapControl_MoveDown='mapControl_MoveDown';var szMapControl_Refresh='mapControl_Refresh';var szMapControl_Measure='mapControl_Measure';var dragapproved=false;var z,x,y,temp1,temp2;var dragApproved=false;var nStep=120;var paintObject=false;function SMapControl() { return;};SMapControl.prototype.initialize=function(oSMap) {var div=document.createElement('div');div.id=szMapControl_MoveUp;div.oncontextmenu=SMap_oncontextmenu; div.style.zIndex=3; div.style.top='7px'; div.style.left='27px'; div.style.position='absolute'; var image=document.createElement('img'); image.src=document.server + 'images/moveUp.png'; image.height=19; image.width=19; image.style.cursor='pointer'; image.title='向北'; image.onclick=this.moveUp;if(oSMap.isIE4){ var imgName=image.src; if(imgName.length>3){ imgName=imgName.toUpperCase(); if(imgName.substring(imgName.length-3, imgName.length)=='PNG'){ applyPNGFilter(image); } } } div.appendChild(image);oSMap.domObj.appendChild(div);div=document.createElement('div');div.id=szMapControl_MoveLeft;div.oncontextmenu=SMap_oncontextmenu; div.style.zIndex=3; div.style.top='27px'; div.style.left='7px'; div.style.position='absolute'; image=document.createElement('img'); image.src=document.server + 'images/moveLeft.png'; image.height=19; image.width=19; image.style.cursor='pointer'; image.title='向西'; image.onclick=this.moveLeft;if(oSMap.isIE4){ var imgName=image.src; if(imgName.length>3){ imgName=imgName.toUpperCase(); if(imgName.substring(imgName.length-3, imgName.length)=='PNG'){ applyPNGFilter(image); } } } div.appendChild(image);oSMap.domObj.appendChild(div);div=document.createElement('div');div.id=szMapControl_Measure;div.oncontextmenu=SMap_oncontextmenu; div.style.zIndex=3; div.style.top='27px'; div.style.left='27px'; div.style.position='absolute'; image=document.createElement('img'); image.src=document.server + 'images/measure.png'; image.height=19; image.width=19; image.style.cursor='pointer'; image.title='量测距离'; image.onclick=this.measure;if(oSMap.isIE4){ var imgName=image.src; if(imgName.length>3){ imgName=imgName.toUpperCase(); if(imgName.substring(imgName.length-3, imgName.length)=='PNG'){ applyPNGFilter(image); } } } div.appendChild(image);oSMap.domObj.appendChild(div);div=document.createElement('div');div.id=szMapControl_MoveRight;div.oncontextmenu=SMap_oncontextmenu; div.style.zIndex=3; div.style.top='27px'; div.style.left='47px'; div.style.position='absolute'; image=document.createElement('img'); image.src=document.server + 'images/moveRight.png'; image.height=19; image.width=19; image.style.cursor='pointer'; image.title='向东'; image.onclick=this.moveRight;if(oSMap.isIE4){ var imgName=image.src; if(imgName.length>3){ imgName=imgName.toUpperCase(); if(imgName.substring(imgName.length-3, imgName.length)=='PNG'){ applyPNGFilter(image); } } } div.appendChild(image);oSMap.domObj.appendChild(div);div=document.createElement('div');div.id=szMapControl_MoveDown;div.oncontextmenu=SMap_oncontextmenu; div.style.zIndex=3; div.style.top='47px'; div.style.left='27px'; div.style.position='absolute'; image=document.createElement('img'); image.src=document.server + 'images/moveDown.png'; image.height=19; image.width=19; image.style.cursor='pointer'; image.title='向南'; image.onclick=this.moveDown;if(oSMap.isIE4){ var imgName=image.src; if(imgName.length>3){ imgName=imgName.toUpperCase(); if(imgName.substring(imgName.length-3, imgName.length)=='PNG'){ applyPNGFilter(image); } } } div.appendChild(image);oSMap.domObj.appendChild(div);div=document.createElement('div');div.id=szMapControl; div.style.zIndex=3; div.style.left='27px'; div.style.top='72px'; div.style.width='17px'; div.style.height='42px'; div.style.fontSize='0px'; div.style.position='absolute'; image=document.createElement('img'); image.src=document.server + 'images/zoomIn.png'; image.height=19; image.width=19; image.style.cursor='pointer'; image.title='放大'; image.onclick=this.zoomIn;if(oSMap.isIE4){ var imgName=image.src; if(imgName.length>3){ imgName=imgName.toUpperCase(); if(imgName.substring(imgName.length-3, imgName.length)=='PNG'){ applyPNGFilter(image); } } } div.appendChild(image); var i, scalesLength; var currentMap=oSMap.getCurrentMap(); var scales=currentMap.getScales(); scalesLength=scales.length; for(i=0;i < scalesLength;i++){ image=document.createElement('img'); var index=scalesLength-i-1; image.index=index; image.id='pic' + index; image.name='pic' + index; image.src=document.server + 'images/a_t.png'; image.width=18; image.style.cursor='pointer'; image.onclick=this.zoom; image.onmousemove=move; image.className='drag'; image.title='点击进行缩放'; div.appendChild(image);if(oSMap.isIE4){ var imgName=image.src; if(imgName.length>3){ imgName=imgName.toUpperCase(); if(imgName.substring(imgName.length-3, imgName.length)=='PNG'){ applyPNGFilter(image); } } } } image=document.createElement('img'); image.src=document.server + 'images/zoomOut.png'; image.height=19; image.width=19; image.style.cursor='pointer'; image.title='缩小'; image.onclick=this.zoomOut;if(oSMap.isIE4){ var imgName=image.src; if(imgName.length>3){ imgName=imgName.toUpperCase(); if(imgName.substring(imgName.length-3, imgName.length)=='PNG'){ applyPNGFilter(image); } } } div.appendChild(image);div.onmousedown=drags;div.onmouseup=new Function('dragapproved=false'); this.domObj=div; div.oncontextmenu=SMap_oncontextmenu; oSMap.domObj.appendChild(this.domObj);mapControl_setSMap(oSMap);oSMap.registerForEvent( SMAP_SCALE_CHANGED, this, this.update );this.update();};function move(){if (event.button==1&&dragapproved){z.style.pixelLeft=temp1+event.clientX-x;z.style.pixelTop=temp2+event.clientY-y;return false;}}; function drags(){if(event.srcElement.className=='drag'){dragapproved=true;z=event.srcElement;temp1=z.style.pixelLeft;temp2=z.style.pixelTop;x=event.clientX;y=event.clientY;var oSMapControl=document.getElementById(szMapControl);oSMapControl.onmousemove=move;}};SMapControl.prototype.update=function() {var o=mapControl_getSMap();var currentMap=o.getCurrentMap();var scales=currentMap.getScales();var scalesLength=scales.length;var i;for(i=0;i<scalesLength;i++){var image=getRawObject('pic'+i);if(image.index==o.currentScaleIndex){switch(i){ case(0): image.src=document.server + 'images/a_f_max.png';image.width=18; image.height=13; break; case(scalesLength-1): image.src=document.server + 'images/a_f_min.png';image.width=18; image.height=12; break; default: image.src=document.server + 'images/a_f.png';image.width=18; image.height=8; break; }if(o.isIE4){ var imgName=image.src; if(imgName.length>3){ imgName=imgName.toUpperCase(); if(imgName.substring(imgName.length-3, imgName.length)=='PNG'){ applyPNGFilter(image); } } }}else{ switch(i){ case(0): image.src=document.server + 'images/a_t_max.png';image.width=18; image.height=13; break; case(scalesLength-1): image.src=document.server + 'images/a_t_min.png';image.width=18; image.height=12; break; default: image.src=document.server + 'images/a_t.png';image.width=18; image.height=8; break; }if(o.isIE4){ var imgName=image.src; if(imgName.length>3){ imgName=imgName.toUpperCase(); if(imgName.substring(imgName.length-3, imgName.length)=='PNG'){ applyPNGFilter(image); } } }}}};SMapControl.prototype.moveUp=function() {var o=mapControl_getSMap();o.moveBy(0,nStep);};SMapControl.prototype.moveDown=function() {var o=mapControl_getSMap();o.moveBy(0,-nStep);};SMapControl.prototype.moveLeft=function() {var o=mapControl_getSMap();o.moveBy(nStep,0);};SMapControl.prototype.moveRight=function() {var o=mapControl_getSMap();o.moveBy(-nStep,0);};SMapControl.prototype.refresh=function() {var o=mapControl_getSMap();var exStr=o.getCurrentMap().defaultExtents.toString(); var ex=o.getCurrentMap().defaultExtents; o.zoomToExtents(ex[0],ex[1],ex[2],ex[3]);};SMapControl.prototype.measure=function() {if(!paintObject) {paintObject=new JScalemap(szMapName);paintObject.start();} else {paintObject.reset();paintObject.start();}};SMapControl.prototype.zoomOut=function() {var o=mapControl_getSMap();o.zoomOut();};SMapControl.prototype.zoomIn=function() {var o=mapControl_getSMap();o.zoomIn();};SMapControl.prototype.zoom=function() {var level=this.index;var o=mapControl_getSMap();var currentMap=o.getCurrentMap();var scales=currentMap.getScales();var currentScale=o.getCurrentScale();if (currentScale!=scales[level]) {o.zoomToScale(scales[level]); }};function mapControl_getSMap() {var oSMapControl=document.getElementById(szMapControl);var oSMap=oSMapControl.SMap;return oSMap;};function mapControl_setSMap(oSMap) {var oSMapControl=document.getElementById(szMapControl);oSMapControl.SMap=oSMap;};﻿var szMyInformation='myInformation';function SMyInformation() {return;};SMyInformation.prototype.initialize=function(oSMap) {var szTitle=szusertitle;var szURL=szuserwebsite;var len=stringLength(szTitle);var div=document.createElement('div');div.id=szMyInformation; div.style.zIndex=3; div.style.position='absolute'; div.style.right='1px'; div.style.bottom='1px'; div.style.width=(5.8 * (stringLength(szTitle)+4)) + 'px'; div.style.height='21px'; div.style.cursor='default'; var divBackground=document.createElement('div');divBackground.style.background='#A0A0A0'; divBackground.style.left='0px'; divBackground.style.top='0px'; divBackground.style.width=div.style.width; divBackground.style.height=div.style.height; divBackground.style.filter='alpha(opacity=35)'; divBackground.style.opacity=0.35; divBackground.style.mozOpacity=0.35; div.appendChild(divBackground); var a=document.createElement('a'); a.target='_blank'; a.href=szURL; a.appendChild(document.createTextNode(szTitle)); a.style.fontSize='12px'; a.style.color='#237A25'; var tb=document.createElement('table');tb.style.position='absolute';tb.style.top='1px';tb.width='100%';tb.height='100%';var tr=tb.insertRow(0);var td=tr.insertCell(0);td.align='center';td.vAlign='middle';td.appendChild(a);div.appendChild(tb); this.domObj=div; div.oncontextmenu=SMap_oncontextmenu; oSMap.domObj.appendChild(this.domObj); };﻿var aXmlHttp=new Array();var aXmlResponse=new Array();function xmlResult(){ for(var i=0;i<aXmlHttp.length;i++) { if(aXmlHttp[i] && aXmlHttp[i][0] && aXmlHttp[i][0].readyState==4&&aXmlHttp[i][0].responseText) { var f=aXmlHttp[i][2]; var o=aXmlHttp[i][1]; var s=aXmlHttp[i][0].responseText; aXmlHttp[i][0]=null; aXmlHttp[i][1]=null; aXmlHttp[i]=null; f.apply(o,new Array(s)); } }};function call(u,o,f){ var method="GET"; var dat; if (arguments.length==4){ method="POST"; tmp=u.split(/\?/); u=tmp[0]; dat=tmp[1]; } var idx=aXmlHttp.length; for(var i=0; i<idx;i++) if (aXmlHttp[i]==null) { idx=i; break; } aXmlHttp[idx]=new Array(2); aXmlHttp[idx][0]=getXMLHTTP(); aXmlHttp[idx][1]=o; aXmlHttp[idx][2]=f; if(aXmlHttp[idx]) { aXmlHttp[idx][0].open(method,u,true); if(method=="POST"){aXmlHttp[idx][0].setRequestHeader("Content-Type", "application/x-www-form-urlencoded");aXmlHttp[idx][0].send(dat); } aXmlHttp[idx][0].onreadystatechange=xmlResult; if(method=="GET"){ aXmlHttp[idx][0].send(null);} }};function getXMLHTTP(){ var A=null; if(!A && typeof XMLHttpRequest !="undefined") { A=new XMLHttpRequest(); } if (!A) { try { A=new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { A=new ActiveXObject("Microsoft.XMLHTTP"); } catch(oc) { A=null } } } return A;};var SCurrentTool=null;function STool( oSMap ) { this.SMap=oSMap; this.name='STool'; this.bInfoTool=false; this.wheelPlus=new Array(oSMap, oSMap.zoomOut, null); this.wheelMinus=new Array(oSMap, oSMap.zoomIn, null); this.SMap.registerTool( this );};STool.prototype.isInfoTool=function() { return this.bInfoTool;};STool.prototype.activate=function() { this.SMap.activateTool( this ); document.SCurrentTool=this;};STool.prototype.deactivate=function() { this.SMap.deactivateTool( this ); document.SCurrentTool=null;};STool.prototype.onmousemove=function(e) { return false;};STool.prototype.onmousedown=function(e) { return false;};STool.prototype.onmouseup=function(e) { return false;};STool.prototype.ondblclick=function(e) { return false;};STool.prototype.setMouseWheel=function(minusSet, plusSet) {this.wheelMinus=minusSet;this.wheelPlus=plusSet;};STool.prototype.onmousewheel=function(e) {return null; e=(e)?e:((event)?event:null); var wheelDelta=e.wheelDelta ? e.wheelDelta : e.detail*-1; var wheelSet=null; if (wheelDelta > 0) wheelSet=this.wheelPlus; else wheelSet=this.wheelMinus; if (wheelSet) { obj=(wheelSet[0]) ? wheelSet[0] : null; func=(wheelSet[1]) ? wheelSet[1] : null; args=(wheelSet[2]) ? wheelSet[2] : null; if (func) {if (args) {func.apply(obj, args);} else{ func.apply(obj);} } }};STool.prototype.adjustPixPosition=function( x, y ) {return adjustMapPixPosition(this.SMap, x, y);};function adjustMapPixPosition(SMap, x, y ) { var obj=SMap.domObj; var offsetLeft=0; var offsetTop=0; while (obj) { offsetLeft +=parseInt(obj.offsetLeft); offsetTop +=parseInt(obj.offsetTop); obj=obj.offsetParent; } var pX=parseInt(SMap.theInsideLayer.style.left) + offsetLeft - SMap.xOrigin - x; var pY=parseInt(SMap.theInsideLayer.style.top) + offsetTop - SMap.yOrigin - y; return [pX,pY];};function STool_redirect_onkeypress(e) { if (document.SCurrentTool) { document.SCurrentTool.onkeypress(e); }};STool.prototype.onkeypress=function(e) { e=(e)?e:((event)?event:null); if (e) { var charCode=(e.charCode)?e.charCode:e.keyCode; var b=true; var nStep=16; switch(charCode) { default: b=false; } if (b) { return this.cancelEvent(e); } return true; }};STool.prototype.onmouseover=function(e) { return false;};STool.prototype.onmouseout=function(e) { if (this.SMap.isIE4) { document.onkeydown=null; } document.onkeypress=null; return false;};STool.prototype.cancelEvent=function(e) { e=(e)?e:((event)?event:null); e.cancelBubble=true; e.returnValue=false; if (e.stopPropogation) { e.stopPropogation(); } if (e.preventDefault) { e.preventDefault(); } return false;};function SNavigator( oSMap ) { STool.apply( this, [oSMap] ); this.name='SNavigator'; this.cursorNormal=["url('"+document.server+"images/grab.cur'),move", '-moz-grab', 'grab', 'move'];this.cursorDrag=["url('"+document.server+"images/grabbing.cur'),move", '-moz-grabbing', 'grabbing', 'move']; this.cursor=this.cursorNormal; this.activeImage=this.SMap.server + 'images/button_pan_3.png'; this.disabledImage=this.SMap.server + 'images/button_pan_2.png'; this.lastx=null; this.lasty=null; this.bMouseDown=false; for (var p in STool.prototype) { if (!SNavigator.prototype[p]) SNavigator.prototype[p]=STool.prototype[p]; }};SNavigator.prototype.onmouseout=function(e) {e=(e)?e:((event)?event:null); if (!e.target) e.target=e.srcElement; if (e.target.id==this.SMap.domObj.id) { this.bMouseDown=false; return STool.prototype.onmouseout.apply(this, [e]); }};SNavigator.prototype.onmousemove=function(e) { e=(e)?e:((event)?event:null); if (!this.bMouseDown) { return false; } if (!this.SMap.layersHidden) { this.SMap.hideLayers(); } var newTop=safeParseInt(this.SMap.theInsideLayer.style.top); var newLeft=safeParseInt(this.SMap.theInsideLayer.style.left); var x=e.pageX || (e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft)); var y=e.pageY || (e.clientY + (document.documentElement.scrollTop || document.body.scrollTop)); newTop=newTop - this.lasty + y; newLeft=newLeft - this.lastx + x; this.SMap.theInsideLayer.style.top=newTop + 'px'; this.SMap.theInsideLayer.style.left=newLeft + 'px'; this.SMap.checkWrap.apply(this.SMap, []); this.lastx=x; this.lasty=y; return false;};SNavigator.prototype.onmousedown=function(e) { e=(e)?e:((event)?event:null); if (e.button==2) { return this.cancelEvent(e); } else {this.cursor=this.cursorDrag; this.SMap.setCursor(this.cursorDrag); if (this.SMap.isIE4) { document.onkeydown=STool_redirect_onkeypress; } document.onkeypress=STool_redirect_onkeypress; this.bMouseDown=true; var x=e.pageX || (e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft)); var y=e.pageY || (e.clientY + (document.documentElement.scrollTop || document.body.scrollTop)); this.lastx=x; this.lasty=y; this.startx=this.lastx; this.starty=this.lasty; e.cancelBubble=true; e.returnValue=false; if (e.stopPropogation) e.stopPropogation(); if (e.preventDefault) e.preventDefault(); return false; }};var gDblClickTimer=null;SNavigator.prototype.onmouseup=function(e) {this.cursor=this.cursorNormal; this.SMap.setCursor(this.cursorNormal); e=(e)?e:((event)?event:null); this.bMouseDown=false; var x=e.pageX || (e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft)); var y=e.pageY || (e.clientY + (document.documentElement.scrollTop || document.body.scrollTop)); if (Math.abs(x-this.startx) < 2 && Math.abs(y-this.starty) < 2) { if (!gDblClickTimer) { gDblClickTimer=window.setTimeout(bind(this.dispatchMapClicked, this, x, y), 250); } } else { gDblClickTimer=null; this.SMap.showLayers(); this.SMap.triggerEvent(SMAP_EXTENTS_CHANGED, this.SMap.getGeoExtents()); } return false;};SNavigator.prototype.dispatchMapClicked=function(px,py) { var a=this.adjustPixPosition( px,py ); var p=this.SMap.pixToGeo( a[0],a[1] ); gDblClickTimer=null; this.SMap.triggerEvent(SMAP_MAP_CLICKED, p);};SNavigator.prototype.ondblclick=function(e) { if (gDblClickTimer) { window.clearTimeout(gDblClickTimer); gDblClickTimer=null; } e=(e)?e:((event)?event:null); var x=e.pageX || (e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft)); var y=e.pageY || (e.clientY + (document.documentElement.scrollTop || document.body.scrollTop)); var a=this.adjustPixPosition( x,y ); var p=this.SMap.pixToGeo( a[0], a[1] );this.SMap.zoomIn(); this.SMap.zoomTo(p[0],p[1]);};function bind(m,o) { var __method=arguments[0]; var __object=arguments[1]; var args=[]; for (var i=2; i<arguments.length; i++) { args.push(arguments[i]) } return function() { return __method.apply(__object, args); }}﻿var haveInit=false;function enableTooltips(){var links,i,h;if(!document.getElementById || !document.getElementsByTagName) return;h=document.createElement('div');h.id='btc';h.style.position='absolute';document.getElementsByTagName('body')[0].appendChild(h);};function Prepare(el){var ss="<!-- Search Google -->\n";ss=ss + "<center>\n";ss=ss + "<form method=\"get\" action=\"http://www.google.cn/custom\" target=\"google_window\">\n";ss=ss + "<table>\n";ss=ss + "<tr><td nowrap=\"nowrap\" valign=\"top\" align=\"left\" height=\"32\">\n";ss=ss + "<a href=\"http://www.google.com/\">\n";ss=ss + "<img src=\"http://www.google.com/logos/Logo_25wht.gif\" border=\"0\" alt=\"Google\" align=\"middle\"></img></a><br/>\n";ss=ss + "<label for=\"sbi\" style=\"display: none\">输入您的搜索字词</label>\n";ss=ss + "<input type=\"text\" name=\"q\" size=\"16\" maxlength=\"255\" value=\"" + el.title + "\" id=\"sbi\"></input>\n";ss=ss + "<label for=\"sbb\" style=\"display: none\">提交搜索表单</label>\n";ss=ss + "<input type=\"submit\" name=\"sa\" value=\"搜索\" id=\"sbb\"></input>\n";ss=ss + "<input type=\"hidden\" name=\"client\" value=\"pub-7677434782855232\"></input>\n";ss=ss + "<input type=\"hidden\" name=\"forid\" value=\"1\"></input>\n";ss=ss + "<input type=\"hidden\" name=\"ie\" value=\"UTF-8\"></input>\n";ss=ss + "<input type=\"hidden\" name=\"oe\" value=\"UTF-8\"></input>\n";ss=ss + "<input type=\"hidden\" name=\"safe\" value=\"active\"></input>\n";ss=ss + "<input type=\"hidden\" name=\"cof\" value=\"GALT:#0066CC;GL:1;DIV:#E6E6E6;VLC:336633;AH:center;BGC:FFFFFF;LBGC:FFFFFF;ALC:0066CC;LC:0066CC;T:000000;GFNT:B3B3B3;GIMP:B3B3B3;LH:50;LW:120;L:http://www.zsmap.cn/images/logo.png;S:http://www.zsmap.cn/;FORID:1\"></input>\n";ss=ss + "<input type=\"hidden\" name=\"hl\" value=\"zh-CN\"></input>\n";ss=ss + "</td></tr></table>\n";ss=ss + "</form>\n";ss=ss + "</center>\n";ss=ss + "<!-- Search Google -->\n";var rowc=3;if(el.logo!=''){rowc=4;}if(!haveInit){enableTooltips();haveInit=true;}var tb=document.createElement('table');tb.oncontextmenu=SMap_oncontextmenu;tb.width=208;tb.border=0;tb.cellPadding=0;tb.cellSpacing=0;var tr=tb.insertRow(0);var td=tr.insertCell(0);tr.style.fontSize='0px';td.width=11;td.height=32;var oSMap=getMyMap();td.style.background='url(' + document.server + 'images/tooltip_l_t.gif)';var image=document.createElement('img');td=tr.insertCell(1);td.height=32;td.colSpan=2;td.style.background='url(' + document.server + 'images/tooltip_t_1.gif)';td=tr.insertCell(2);td.colSpan=2;td.style.background='url(' + document.server + 'images/tooltip_t_2.gif)';td=tr.insertCell(3);td.width=13;td.height=32;image=document.createElement('img');image.src=document.server + 'images/tooltip_r_t.png';image.style.width='22px';image.style.height='32px';image.style.display='block';if(oSMap.isIE4){ applyPNGFilter(image);}td.appendChild(image);tr=tb.insertRow(1);tr.style.fontSize='0px';td=tr.insertCell(0);td.width=11;td.rowSpan=rowc;td.style.background='url(' + document.server + 'images/tooltip_l.gif)';td=tr.insertCell(1);td.height=20;td.colSpan=4;td.style.background='url(' + document.server + 'images/tooltip_content.gif)';image=document.createElement('img');image.src=document.server + 'images/tooltip_close.gif';image.width=14;image.height=13;image.align='right';image.title='关闭';image.className='top';image.style.cursor='pointer';image.onclick=this.hideTooltip;td.appendChild(image);td.style.fontSize='12px';td.style.color='#0000CC';var a=null;if(el.go==''){a=document.createTextNode(el.title);}else{a=document.createElement('a');a.href=el.go;a.target='_blank';a.style.color='#0000CC';a.style.textDecoration='underline';a.style.fontSize='12px';a.appendChild(document.createTextNode(el.title));}td.appendChild(a);td=tr.insertCell(2);td.rowSpan=rowc;td.id='tooltip_r';td.width=22;image=document.createElement('img');image.src=document.server + 'images/tooltip_r.png';image.id='tooltip_img_r';image.width=22;image.style.display='block';if(oSMap.isIE4){ applyPNGFilter(image);}td.appendChild(image);tr=tb.insertRow(2); tr.style.fontSize='0px';td=tr.insertCell(0);td.colSpan=4;td.style.background='url(' + document.server + 'images/tooltip_content.gif)';td.style.fontSize='12px';if(el.description!=''){td.appendChild(document.createTextNode(el.description));}var d=document.createElement('DIV');d.appendChild(document.createTextNode('引用：'));var t_refers=document.createElement('INPUT');t_refers.type='text';t_refers.size=19;t_refers.value='<script type=\"text/javascript\" src=\"http://www.zsmap.cn/initsz.axd?uid=' + encodeURI(el.uid) + '&w=400&h=300\"></script>';t_refers.onmousemove='select()';d.appendChild(t_refers);td.appendChild(d);if(el.logo!=''){tr=tb.insertRow(3);tr.style.fontSize='0px';td=tr.insertCell(0);td.colSpan=4;td.style.background='url(' + document.server + 'images/skymapsoft_guanggao_004.gif)';image=document.createElement('img');image.width=182;image.height=101;image.border=1;image.style.display='block';image.src=el.logo; image.style.width='182px';image.style.height='101px';td.appendChild(image);}tr=tb.insertRow(rowc);tr.style.fontSize='0px';td=tr.insertCell(0);td.colSpan=4;td.style.background='url(' + document.server + 'images/tooltip_content.gif)';td.innerHTML=ss;tr=tb.insertRow(rowc+1);tr.style.fontSize='0px';td=tr.insertCell(0);td.height=13;td.width=11;image=document.createElement('img');image.src=document.server + 'images/tooltip_l_b.png';image.width=11;image.height=21;if(oSMap.isIE4){ applyPNGFilter(image);}td.appendChild(image);td=tr.insertCell(1);td.height=13;td.colSpan=4;image=document.createElement('img');image.src=document.server + 'images/tooltip_b.png';image.style.height='21px';image.style.width='100%';if(oSMap.isIE4){ applyPNGFilter(image);}td.appendChild(image);td=tr.insertCell(2);td.height=13;td.width=11;image=document.createElement('img');image.src=document.server + 'images/tooltip_r_b.png';image.height=21;image.width=22;if(oSMap.isIE4){ applyPNGFilter(image);}td.appendChild(image);el.tooltip=tb;el.SMap.registerForEvent( SMAP_EXTENTS_CHANGED, this, this.hideTooltip );};function showTooltip(e){ if(this.xmltooltip!=null) this.xmltooltip.bind(this);var d=document.getElementById('btc');if(d.childNodes.length>0) d.removeChild(d.firstChild);d.appendChild(this.tooltip);d.style.zIndex=10000;Locate(e);document.getElementById('tooltip_img_r').style.height=document.getElementById('tooltip_r').clientHeight+'px';};function hideTooltip(e){var d=document.getElementById('btc');if(d.childNodes.length>0) d.removeChild(d.firstChild);};function setOpacity(el){el.style.filter='alpha(opacity:95)';el.style.KHTMLOpacity='0.95';el.style.MozOpacity='0.95';el.style.opacity='0.95';};function CreateEl(t,c){var x=document.createElement(t);x.className=c;x.style.display='block';return(x);};function Locate(e){var posx=0,posy=0;if(e==null) e=window.event;if(e.pageX || e.pageY){ posx=e.pageX; posy=e.pageY; }else if(e.clientX || e.clientY){ if(document.documentElement.scrollTop){ posx=e.clientX+document.documentElement.scrollLeft; posy=e.clientY+document.documentElement.scrollTop; } else{ posx=e.clientX+document.body.scrollLeft; posy=e.clientY+document.body.scrollTop; }}document.getElementById('btc').style.top=(posy+10)+'px';document.getElementById('btc').style.left=(posx-20)+'px';};﻿function SXMLTooltip() {this.title='';this.description='';this.website='';this.logo='';this.uid='';};SXMLTooltip.prototype.parseElement=function(domElement) {this.logo=domElement.getAttribute("logo");this.title=domElement.getAttribute("title");this.description=domElement.getAttribute("description");this.website=domElement.getAttribute("website");this.uid=domElement.getAttribute("uid");};SXMLTooltip.prototype.bind=function(el) {if(!el.loaded){el.loaded=true;el.markid=this.markid;el.title=this.title;el.go=this.website;el.logo=this.logo;el.description=this.description;el.uid=this.uid;Prepare(el);}};﻿ function SToolTip( oSMap ){ this.SMap=oSMap; this.image=null; this.domObj=null; this.viewport=this.SMap.domObj; this.visible=false; this.init(); }; SToolTip.prototype.init=function(){this.domObj=document.createElement('div');this.domObj.setAttribute('id', 'toolTip');this.minZindex=1;this.coordX=null;this.coordY=null;this.viewport.appendChild(this.domObj);this.domObj.style.position='absolute';this.move();this.domObj.toolTip=this;this.domObj.style.zIndex=this.minZindex;this.domObj.onclick=this.onclick;this.SMap.registerForEvent( SMAP_MAP_CLICKED, this, this.onclick );this.SMap.registerForEvent( SMAP_EXTENTS_CHANGED, this, this.extentChanged );};SToolTip.prototype.onclick=function(e){ e=(e)?e:((event)?event:null);};SToolTip.prototype.setText=function(text){this.domObj.innerHTML=text;};SToolTip.prototype.setTipImage=function(url,offsetX,offsetY){offsetX=(offsetX)?offsetX:0;offsetY=(offsetX)?offsetY:0;image=document.createElement('img');image.src=url;image.setAttribute('id', 'toolTipImage');image.style.position='absolute';image.style.zIndex=this.minZindex++;image.style.top='-200px';image.style.left='-200px';image.offsetX=offsetX;image.offsetY=offsetY;this.image=image;this.image.style.cursor="hand";this.image.title="Test";this.image.go="http://Test";this.viewport.appendChild(image);this.image.SMap=this.SMap;Prepare(this.image);};SToolTip.prototype.moveGeo=function(){var pixPos=this.SMap.geoToPix(arguments[0],arguments[1]);var nPixPos=this.SMap.currentTool.adjustPixPosition( pixPos[0]*(-1), pixPos[1]*(-1) );var newX=nPixPos[0];var newY=nPixPos[1];this.move(newX,newY);};SToolTip.prototype.move=function(){ var x=0;var y=0;var aPixPos=0;var geoPix=0;var noRecenter=false;if(arguments.length<2){this.visible=false;this.domObj.style.top='-10000px';this.domObj.style.left='-10000px';aPixPos=this.SMap.currentTool.adjustPixPosition( parseInt(x) , parseInt(y) );var geoCoords=this.SMap.pixToGeo( aPixPos[0],aPixPos[1]);this.coordX=geoCoords[0];this.coordY=geoCoords[1];if(this.image)this.image.style.top='-100000px';if(this.image)this.image.style.left='-100000px';} else {x=parseInt(arguments[0]);y=parseInt(arguments[1]);this.visible=true;aPixPos=this.SMap.currentTool.adjustPixPosition( parseInt(x) , parseInt(y) );var geoCoords=this.SMap.pixToGeo( aPixPos[0],aPixPos[1]);this.coordX=geoCoords[0];this.coordY=geoCoords[1];this.domObj.style.top=y-10+'px';this.domObj.style.left=x-(getObjectWidth(this.domObj)/2)+'px';if(this.image)this.image.style.top=(y+this.image.offsetY)+'px';if(this.image)this.image.style.left=(x+this.image.offsetX)+'px'; if((arguments[2])&&arguments[2]==true)noRecenter=true; if(!noRecenter)this.recenter(this.domObj);}};SToolTip.prototype.adjustPosition=function(x,y){ var ny=parseInt(this.domObj.style.top)+y;var nx=parseInt(this.domObj.style.left)+x; this.domObj.style.top=ny+'px';this.domObj.style.left=nx+'px';if(this.image)this.image.style.top=(parseInt(this.image.style.top)+y)+'px';if(this.image)this.image.style.left=(parseInt(this.image.style.left)+x)+'px';};SToolTip.prototype.recenter=function(tip){var tipWidth=getObjectWidth(tip);var tipHeight=getObjectHeight(tip);var tipTop=parseInt(tip.style.top);var tipLeft=parseInt(tip.style.left);var viewportWheight=tip.toolTip.SMap.viewportHeight; var viewportWidth=tip.toolTip.SMap.viewportWidth;var topSlide=1;var leftSlide=1;if((tipTop+tipHeight)>viewportWheight) topSlide=(tipTop+tipHeight)-viewportWheight;if((tipLeft+tipWidth)>viewportWidth) leftSlide=(tipLeft+tipWidth)-viewportWidth;if(tipLeft<0) leftSlide=tipLeft-20;if(tipTop<0) topSlide=tipTop-20;if(topSlide!=1 || leftSlide!=1){ tip.toolTip.SMap.slideBy(-(leftSlide+10), -(topSlide+10)); tip.toolTip.adjustPosition(-(leftSlide+10), -(topSlide+10)); }};SToolTip.prototype.extentChanged=function(){var pixPos=this.SMap.geoToPix(this.coordX,this.coordY);var nPixPos=this.SMap.currentTool.adjustPixPosition( pixPos[0]*(-1), pixPos[1]*(-1) );var newX=nPixPos[0];var newY=nPixPos[1];if(this.visible)this.move(newX,newY,true);};﻿if (!window.CanvasRenderingContext2D) {(function () { var G_vmlCanvasManager_={ init: function (opt_doc) { var doc=opt_doc || document; if (/MSIE/.test(navigator.userAgent) && !window.opera) { var self=this; doc.attachEvent("onreadystatechange", function () { self.init_(doc); }); } }, init_: function (doc, e) { if (doc.readyState=="complete") { if (!doc.namespaces["g_vml_"]) { doc.namespaces.add("g_vml_", "urn:schemas-microsoft-com:vml"); } var ss=doc.createStyleSheet(); ss.cssText="canvas{display:inline-block;overflow:hidden;" + "text-align:left;}" + "canvas *{behavior:url(#default#VML)}"; var els=doc.getElementsByTagName("canvas"); for (var i=0; i < els.length; i++) { if (!els[i].getContext) { this.initElement(els[i]); } } } }, fixElement_: function (el) { var outerHTML=el.outerHTML; var newEl=document.createElement(outerHTML); if (outerHTML.slice(-2) !="/>") { var tagName="/" + el.tagName; var ns; while ((ns=el.nextSibling) && ns.tagName !=tagName) { ns.removeNode(); } if (ns) { ns.removeNode(); } } el.parentNode.replaceChild(newEl, el); return newEl; }, initElement: function (el) { el=this.fixElement_(el); el.getContext=function () { if (this.context_) { this.context_.m_=createMatrixIdentity(); return this.context_; } return this.context_=new CanvasRenderingContext2D_(this); }; var self=this; el.attachEvent("onpropertychange", function (e) { switch (e.propertyName) { case "width": case "height": break; } }); var attrs=el.attributes; if (attrs.width && attrs.width.specified) { el.style.width=attrs.width.nodeValue + "px"; } if (attrs.height && attrs.height.specified) { el.style.height=attrs.height.nodeValue + "px"; } return el; } }; G_vmlCanvasManager_.init(); var dec2hex=[]; for (var i=0; i < 16; i++) { for (var j=0; j < 16; j++) { dec2hex[i * 16 + j]=i.toString(16) + j.toString(16); } } function createMatrixIdentity() { return [ [1, 0, 0], [0, 1, 0], [0, 0, 1] ]; } function matrixMultiply(m1, m2) { var result=createMatrixIdentity(); for (var x=0; x < 3; x++) { for (var y=0; y < 3; y++) { var sum=0; for (var z=0; z < 3; z++) { sum +=m1[x][z] * m2[z][y]; } result[x][y]=sum; } } return result; } function copyState(o1, o2) { o2.fillStyle=o1.fillStyle; o2.lineCap=o1.lineCap; o2.lineJoin=o1.lineJoin; o2.lineWidth=o1.lineWidth; o2.miterLimit=o1.miterLimit; o2.shadowBlur=o1.shadowBlur; o2.shadowColor=o1.shadowColor; o2.shadowOffsetX=o1.shadowOffsetX; o2.shadowOffsetY=o1.shadowOffsetY; o2.strokeStyle=o1.strokeStyle; } function processStyle(styleString) { var str, alpha=1; styleString=String(styleString); if (styleString.substring(0, 3)=="rgb") { var start=styleString.indexOf("(", 3); var end=styleString.indexOf(")", start + 1); var guts=styleString.substring(start + 1, end).split(","); str="#"; for (var i=0; i < 3; i++) { str +=dec2hex[parseInt(guts[i])]; } if ((guts.length==4) && (styleString.substr(3, 1)=="a")) { alpha=guts[3]; } } else { str=styleString; } return [str, alpha]; } function processLineCap(lineCap) { switch (lineCap) { case "butt": return "flat"; case "round": return "round"; case "square": default: return "square"; } } function CanvasRenderingContext2D_(surfaceElement) { this.m_=createMatrixIdentity(); this.element_=surfaceElement; this.mStack_=[]; this.aStack_=[]; this.currentPath_=[]; this.strokeStyle="#000"; this.fillStyle="#ccc"; this.lineWidth=1; this.lineJoin="miter"; this.lineCap="butt"; this.miterLimit=10; this.globalAlpha=1; }; var contextPrototype=CanvasRenderingContext2D_.prototype; contextPrototype.clearRect=function() { this.element_.innerHTML=""; this.currentPath_=[]; }; contextPrototype.beginPath=function() { this.currentPath_=[]; }; contextPrototype.moveTo=function(aX, aY) { this.currentPath_.push({type: "moveTo", x: aX, y: aY}); }; contextPrototype.lineTo=function(aX, aY) { this.currentPath_.push({type: "lineTo", x: aX, y: aY}); }; contextPrototype.bezierCurveTo=function(aCP1x, aCP1y, aCP2x, aCP2y, aX, aY) { this.currentPath_.push({type: "bezierCurveTo", cp1x: aCP1x, cp1y: aCP1y, cp2x: aCP2x, cp2y: aCP2y, x: aX, y: aY}); }; contextPrototype.quadraticCurveTo=function(aCPx, aCPy, aX, aY) { this.bezierCurveTo(aCPx, aCPy, aCPx, aCPy, aX, aY); }; contextPrototype.arc=function(aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise) { if (!aClockwise) { var t=aStartAngle; aStartAngle=aEndAngle; aEndAngle=t; } var xStart=aX + (Math.cos(aStartAngle) * aRadius); var yStart=aY + (Math.sin(aStartAngle) * aRadius); var xEnd=aX + (Math.cos(aEndAngle) * aRadius); var yEnd=aY + (Math.sin(aEndAngle) * aRadius); this.currentPath_.push({type: "arc", x: aX, y: aY, radius: aRadius, xStart: xStart, yStart: yStart, xEnd: xEnd, yEnd: yEnd}); }; contextPrototype.rect=function(aX, aY, aWidth, aHeight) { this.moveTo(aX, aY); this.lineTo(aX + aWidth, aY); this.lineTo(aX + aWidth, aY + aHeight); this.lineTo(aX, aY + aHeight); this.closePath(); }; contextPrototype.strokeRect=function(aX, aY, aWidth, aHeight) { this.beginPath(); this.moveTo(aX, aY); this.lineTo(aX + aWidth, aY); this.lineTo(aX + aWidth, aY + aHeight); this.lineTo(aX, aY + aHeight); this.closePath(); this.stroke(); }; contextPrototype.fillRect=function(aX, aY, aWidth, aHeight) { this.beginPath(); this.moveTo(aX, aY); this.lineTo(aX + aWidth, aY); this.lineTo(aX + aWidth, aY + aHeight); this.lineTo(aX, aY + aHeight); this.closePath(); this.fill(); }; contextPrototype.createLinearGradient=function(aX0, aY0, aX1, aY1) { var gradient=new CanvasGradient_("gradient"); return gradient; }; contextPrototype.createRadialGradient=function(aX0, aY0, aR0, aX1, aY1, aR1) { var gradient=new CanvasGradient_("gradientradial"); gradient.radius1_=aR0; gradient.radius2_=aR1; gradient.focus_.x=aX0; gradient.focus_.y=aY0; return gradient; }; contextPrototype.drawImage=function (image, var_args) { var dx, dy, dw, dh, sx, sy, sw, sh; var w=image.width; var h=image.height; if (arguments.length==3) { dx=arguments[1]; dy=arguments[2]; sx=sy=0; sw=dw=w; sh=dh=h; } else if (arguments.length==5) { dx=arguments[1]; dy=arguments[2]; dw=arguments[3]; dh=arguments[4]; sx=sy=0; sw=w; sh=h; } else if (arguments.length==9) { sx=arguments[1]; sy=arguments[2]; sw=arguments[3]; sh=arguments[4]; dx=arguments[5]; dy=arguments[6]; dw=arguments[7]; dh=arguments[8]; } else { throw "Invalid number of arguments"; } var d=this.getCoords_(dx, dy); var w2=(sw / 2); var h2=(sh / 2); var vmlStr=[]; vmlStr.push(' <g_vml_:group', ' coordsize="100,100"', ' coordorigin="0, 0"' , ' style="width:100px;height:100px;position:absolute;'); if (this.m_[0][0] !=1 || this.m_[0][1]) { var filter=[]; filter.push("M11='", this.m_[0][0], "',", "M12='", this.m_[1][0], "',", "M21='", this.m_[0][1], "',", "M22='", this.m_[1][1], "',", "Dx='", d.x, "',", "Dy='", d.y, "'"); var max=d; var c2=this.getCoords_(dx+dw, dy); var c3=this.getCoords_(dx, dy+dh); var c4=this.getCoords_(dx+dw, dy+dh); max.x=Math.max(max.x, c2.x, c3.x, c4.x); max.y=Math.max(max.y, c2.y, c3.y, c4.y); vmlStr.push(" padding:0 ", Math.floor(max.x), "px ", Math.floor(max.y), "px 0;filter:progid:DXImageTransform.Microsoft.Matrix(", filter.join(""), ", sizingmethod='clip');") } else { vmlStr.push(" top:", d.y, "px;left:", d.x, "px;") } vmlStr.push(' ">' , '<g_vml_:image src="', image.src, '"', ' style="width:', dw, ';', ' height:', dh, ';"', ' cropleft="', sx / w, '"', ' croptop="', sy / h, '"', ' cropright="', (w - sx - sw) / w, '"', ' cropbottom="', (h - sy - sh) / h, '"', ' />', '</g_vml_:group>'); this.element_.insertAdjacentHTML("BeforeEnd", vmlStr.join("")); }; contextPrototype.stroke=function(aFill) { var lineStr=[]; var lineOpen=false; var a=processStyle(aFill ? this.fillStyle : this.strokeStyle); var color=a[0]; var opacity=a[1] * this.globalAlpha; lineStr.push('<g_vml_:shape', ' fillcolor="', color, '"', ' filled="', Boolean(aFill), '"', ' style="position:absolute;width:10;height:10;"', ' coordorigin="0 0" coordsize="10 10"', ' stroked="', !aFill, '"', ' strokeweight="', this.lineWidth, '"', ' strokecolor="', color, '"', ' path="'); var newSeq=false; var min={x: null, y: null}; var max={x: null, y: null}; for (var i=0; i < this.currentPath_.length; i++) { var p=this.currentPath_[i]; if (p.type=="moveTo") { lineStr.push(" m "); var c=this.getCoords_(p.x, p.y); lineStr.push(Math.floor(c.x), ",", Math.floor(c.y)); } else if (p.type=="lineTo") { lineStr.push(" l "); var c=this.getCoords_(p.x, p.y); lineStr.push(Math.floor(c.x), ",", Math.floor(c.y)); } else if (p.type=="close") { lineStr.push(" x "); } else if (p.type=="bezierCurveTo") { lineStr.push(" c "); var c=this.getCoords_(p.x, p.y); var c1=this.getCoords_(p.cp1x, p.cp1y); var c2=this.getCoords_(p.cp2x, p.cp2y); lineStr.push(Math.floor(c1.x), ",", Math.floor(c1.y), ",", Math.floor(c2.x), ",", Math.floor(c2.y), ",", Math.floor(c.x), ",", Math.floor(c.y)); } else if (p.type=="arc") { lineStr.push(" ar "); var c=this.getCoords_(p.x, p.y); var cStart=this.getCoords_(p.xStart, p.yStart); var cEnd=this.getCoords_(p.xEnd, p.yEnd); var absXScale=this.m_[0][0]; var absYScale=this.m_[1][1]; lineStr.push(Math.floor(c.x - absXScale * p.radius), ",", Math.floor(c.y - absYScale * p.radius), " ", Math.floor(c.x + absXScale * p.radius), ",", Math.floor(c.y + absYScale * p.radius), " ", Math.floor(cStart.x), ",", Math.floor(cStart.y), " ", Math.floor(cEnd.x), ",", Math.floor(cEnd.y)); } if(c) { if (min.x==null || c.x < min.x) { min.x=c.x; } if (max.x==null || c.x > max.x) { max.x=c.x; } if (min.y==null || c.y < min.y) { min.y=c.y; } if (max.y==null || c.y > max.y) { max.y=c.y; } } } lineStr.push(' ">'); if (typeof this.fillStyle=="object") { var focus={x: "50%", y: "50%"}; var width=(max.x - min.x); var height=(max.y - min.y); var dimension=(width > height) ? width : height; focus.x=Math.floor((this.fillStyle.focus_.x / width) * 100 + 50) + "%"; focus.y=Math.floor((this.fillStyle.focus_.y / height) * 100 + 50) + "%"; var colors=[]; if (this.fillStyle.type_=="gradientradial") { var inside=(this.fillStyle.radius1_ / dimension * 100); var expansion=(this.fillStyle.radius2_ / dimension * 100) - inside; } else { var inside=0; var expansion=100; } var insidecolor={offset: null, color: null}; var outsidecolor={offset: null, color: null}; this.fillStyle.colors_.sort(function (cs1, cs2) { return cs1.offset - cs2.offset; }); for (var i=0; i < this.fillStyle.colors_.length; i++) { var fs=this.fillStyle.colors_[i]; colors.push( (fs.offset * expansion) + inside, "% ", fs.color, ","); if (fs.offset > insidecolor.offset || insidecolor.offset==null) { insidecolor.offset=fs.offset; insidecolor.color=fs.color; } if (fs.offset < outsidecolor.offset || outsidecolor.offset==null) { outsidecolor.offset=fs.offset; outsidecolor.color=fs.color; } } colors.pop(); lineStr.push('<g_vml_:fill', ' color="', outsidecolor.color, '"', ' color2="', insidecolor.color, '"', ' type="', this.fillStyle.type_, '"', ' focusposition="', focus.x, ', ', focus.y, '"', ' colors="', colors.join(""), '"', ' opacity="', opacity, '" />'); } else if (aFill) { lineStr.push('<g_vml_:fill color="', color, '" opacity="', opacity, '" />'); } else { lineStr.push( '<g_vml_:stroke', ' opacity="', opacity,'"', ' joinstyle="', this.lineJoin, '"', ' miterlimit="', this.miterLimit, '"', ' endcap="', processLineCap(this.lineCap) ,'"', ' weight="', this.lineWidth, 'px"', ' color="', color,'" />' ); } lineStr.push("</g_vml_:shape>"); this.element_.insertAdjacentHTML("beforeEnd", lineStr.join("")); }; contextPrototype.fill=function() { this.stroke(true); }; contextPrototype.closePath=function() { this.currentPath_.push({type: "close"}); }; contextPrototype.getCoords_=function(aX, aY) { return { x: (aX * this.m_[0][0] + aY * this.m_[1][0] + this.m_[2][0]), y: (aX * this.m_[0][1] + aY * this.m_[1][1] + this.m_[2][1]) } }; contextPrototype.save=function() { var o={}; copyState(this, o); this.aStack_.push(o); this.mStack_.push(this.m_); this.m_=matrixMultiply(createMatrixIdentity(), this.m_); }; contextPrototype.restore=function() { copyState(this.aStack_.pop(), this); this.m_=this.mStack_.pop(); }; contextPrototype.translate=function(aX, aY) { var m1=[ [1, 0, 0], [0, 1, 0], [aX, aY, 1] ]; this.m_=matrixMultiply(m1, this.m_); }; contextPrototype.rotate=function(aRot) { var c=Math.cos(aRot); var s=Math.sin(aRot); var m1=[ [c, s, 0], [-s, c, 0], [0, 0, 1] ]; this.m_=matrixMultiply(m1, this.m_); }; contextPrototype.scale=function(aX, aY) { var m1=[ [aX, 0, 0], [0, aY, 0], [0, 0, 1] ]; this.m_=matrixMultiply(m1, this.m_); }; contextPrototype.clip=function() { }; contextPrototype.arcTo=function() { }; contextPrototype.createPattern=function() { return new CanvasPattern_; }; function CanvasGradient_(aType) { this.type_=aType; this.radius1_=0; this.radius2_=0; this.colors_=[]; this.focus_={x: 0, y: 0}; } CanvasGradient_.prototype.addColorStop=function(aOffset, aColor) { aColor=processStyle(aColor); this.colors_.push({offset: 1-aOffset, color: aColor}); }; function CanvasPattern_() {} G_vmlCanvasManager=G_vmlCanvasManager_; CanvasRenderingContext2D=CanvasRenderingContext2D_; CanvasGradient=CanvasGradient_; CanvasPattern=CanvasPattern_;})();} ﻿function SOverlay( oSMap ){ STool.apply( this, [oSMap] ); this.name='SOverlay';this.XMLloaded=false;this.overlayLayers=new Array();this.output;this.sessionId="";this.topLeft;this.imgWidth;this.imgHeight;this.imageMap=""; for (var p in STool.prototype) { if (!SOverlay.prototype[p]) SOverlay.prototype[p]=STool.prototype[p]; } this.ovrObjects=new Array(); this.SMap.registerForEvent( SMAP_SCALE_CHANGED, this, this.scaleChanged ); this.SMap.registerForEvent( SMAP_EXTENTS_CHANGED, this, this.reCenter );};SOverlay.prototype.scaleChanged=function( eventID, mapName ) {this.reCenter();};SOverlay.prototype.reCenter=function() {if(getRawObject('theInsideLayer') && getRawObject('imageMapLayer') && getRawObject('mapCodeDiv')){var imageMapLayer=getRawObject('imageMapLayer');var mapCodeDiv=getRawObject('mapCodeDiv');var defaultExtents=mySMap.getCurrentMap().defaultExtents;var currentExtents=mySMap.getCurrentMap().currentExtents;var geoExtents=mySMap.getGeoExtents();var insideLayerLeft=mySMap.theInsideLayer.style.left;var insideLayerTop=mySMap.theInsideLayer.style.top;var xOrigin=mySMap.xOrigin;var yOrigin=mySMap.yOrigin;var topLeft=mySMap.geoToPix( defaultExtents[0], defaultExtents[3] );topLeft[0]=topLeft[0] - xOrigin;topLeft[1]=topLeft[1] - yOrigin;this.topLeft=topLeft;var bottomRight=mySMap.geoToPix( defaultExtents[2], defaultExtents[1] );bottomRight[0]=bottomRight[0] - xOrigin;bottomRight[1]=bottomRight[1] - yOrigin;var imgWidth=bottomRight[0] - topLeft[0];this.imgWidth=imgWidth;var imgHeight=bottomRight[1] - topLeft[1];this.imgHeight=imgHeight;imageMapLayer.style.width=this.imgWidth+"px";imageMapLayer.style.height=this.imgHeight+"px";imageMapLayer.style.top=this.topLeft[1]+"px";imageMapLayer.style.left=this.topLeft[0]+"px";mapCodeDiv.style.width=this.imgWidth+"px";mapCodeDiv.style.height=this.imgHeight+"px";}};SOverlay.prototype.loadXml=function(string) {this.output=string;this.XMLloaded=true;eval(string);this.draw();};SOverlay.prototype.init=function(url){var defaultExtents=mySMap.getCurrentMap().defaultExtents;var currentExtents=mySMap.getCurrentMap().currentExtents;var mapName=mySMap.getCurrentMap().name;var geoExtents=mySMap.getGeoExtents();var insideLayerLeft=mySMap.theInsideLayer.style.left;var insideLayerTop=mySMap.theInsideLayer.style.top;var xOrigin=mySMap.xOrigin;var yOrigin=mySMap.yOrigin;var topLeft=mySMap.geoToPix( defaultExtents[0], defaultExtents[3] );topLeft[0]=topLeft[0] - xOrigin;topLeft[1]=topLeft[1] - yOrigin;this.topLeft=topLeft;var bottomRight=mySMap.geoToPix( defaultExtents[2], defaultExtents[1] );bottomRight[0]=bottomRight[0] - xOrigin;bottomRight[1]=bottomRight[1] - yOrigin;var imgWidth=bottomRight[0] - topLeft[0];this.imgWidth=imgWidth;var imgHeight=bottomRight[1] - topLeft[1];this.imgHeight=imgHeight;call(url,this,this.loadXml);};SOverlay.prototype.draw=function() {for(i=0;i<this.overlayLayers.length;i++){mySMap.addMapLayer( this.overlayLayers[i] );}var insideLayerDomObj=getRawObject('theInsideLayer');div=document.createElement( 'div' );div.id='imageMapLayer';div.className='imageMapLayer'; div.setAttribute('style','position:absolute;z-index:100;background-color:transparent;'); image=document.createElement( 'img' );image.src='images/transparent_pix.png';image.id='imageMapImage';image.setAttribute('border','0'); image.setAttribute('style', 'position:absolute;z-index:2;width:'+this.imgWidth+'px;height:'+this.imgHeight+'px;');image.setAttribute('usemap','#overlayMap');mapCodeDiv=document.createElement( 'div' );mapCodeDiv.id='mapCodeDiv';mapCodeDiv.setAttribute('style', 'position:absolute;z-index:2;left:0;top:0;');div.appendChild( mapCodeDiv );div.appendChild( image );insideLayerDomObj.appendChild( div );this.reCenter(); getRawObject('mapCodeDiv').innerHTML=this.output + this.imageMap;};SOverlay.prototype.clear=function(){this.XMLloaded=false;this.output=null;this.sessionId=null;if(getRawObject('theInsideLayer') && getRawObject('imageMapLayer'))getRawObject('theInsideLayer').removeChild(getRawObject('imageMapLayer'));for(i=0;i<this.overlayLayers.length;i++){mySMap.removeMapLayer( this.overlayLayers[i].name );}this.overlayLayers=new Array();};SOverlay.prototype.myOnClick=function() {alert('testo');};SOverlay.prototype.showInfo=function(obj) { var string="id: "+ obj.id + " | alt: "+ obj.alt + " | title: "+ obj.title;alert( string );};﻿ function _overlayLayer( szName, bVisible, opacity, imageformat, bQueryable, scales,sessionID) { _layer.apply(this,[szName,bVisible,opacity,imageformat,bQueryable,scales]); this.bWidthHeight=false; this.sessionId=sessionID; for (var p in _layer.prototype) { if (!_overlayLayer.prototype[p]) _overlayLayer.prototype[p]=_layer.prototype[p]; } };_overlayLayer.prototype.setTile=function(img){ var szForce=''; var szLayers=''; if (arguments[1]) szForce='&force=true'; var szGroup="&g="+img.layer.domObj.id; var szScale='&s='+this._map.aScales[this._map.currentScale]; var szSessionId='&sessionId='+this.sessionId; var szImageformat=''; var image_format=''; if (img.layer.imageformat && img.layer.imageformat !='') { image_format=img.layer.imageformat; szImageformat='&i='+image_format; } var l=safeParseInt(img.style.left) + this._map.SMap.xOrigin; var t=safeParseInt(img.style.top) + this._map.SMap.yOrigin; var src=this._map.SMap.server+ "/XMLOverlay/tileOverlay.php"+ '?t='+t+ '&l='+l+ szScale+szForce+szGroup+szImageformat+szSessionId; if ((this.isIE4) && (image_format.toLowerCase()=="png24")) { img.style.visibility='hidden'; img.src=this._map.SMap.aPixel.src; img.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"', sizingMethod='scale')"; } else { if (img.src !=src) { img.style.visibility='hidden'; img.src=this._map.SMap.server+ "/XMLOverlay/tileOverlay.php"+ '?t='+t+ '&l='+l+ szScale+szForce+szGroup+szImageformat+szSessionId; } }};﻿ function SXmlOverlay( oSMap, zIndex ){ STool.apply( this, [oSMap] ); this.name='SXmlOverlay'; for (var p in STool.prototype) { if (!SXmlOverlay.prototype[p]) SXmlOverlay.prototype[p]=STool.prototype[p]; } this.urlBase=this.SMap.server; this.urlBase +=(this.urlBase!=''&&this.urlBase.substring(-1)!='/')?'':'/';this.ovrObjects=new Array(); this.z_index=zIndex;this.overlayCanvas=this.SMap.createDrawingCanvas( zIndex ); this.SMap.registerForEvent( SMAP_SCALE_CHANGED, this, this.scaleChanged );};SXmlOverlay.prototype.scaleChanged=function( eventID, mapName ) {if (this.ovrObjects==null) return;for (var i=0; i < this.ovrObjects.length; i++) {if (this.ovrObjects[i]) this.ovrObjects[i].rescale();}};SXmlOverlay.prototype.remove=function() { this.SMap.deregisterForEvent( SMAP_SCALE_CHANGED, this, this.scaleChanged );this.removePoint();this.SMap.removeDrawingCanvas(this.overlayCanvas);};SXmlOverlay.prototype.loadXml=function(xml_url) { this.urlBase=this.SMap.server; this.urlBase +=(this.urlBase!=''&&this.urlBase.substring(-1)!='/')?'':'/';this.xmlOvrUrl=this.urlNormalize(xml_url);call(this.xmlOvrUrl,this,this.loadXmlCallback);};if (typeof(DOMParser)=="undefined") { DOMParser=function () {}; DOMParser.prototype.parseFromString=function (str, contentType) { if (typeof(ActiveXObject)!="undefined") { var d=new ActiveXObject("MSXML.DomDocument"); d.loadXML(str); return d; } else if (typeof(XMLHttpRequest)!="undefined") { var req=new XMLHttpRequest; req.open("GET", "data:" + (contentType || "application/xml") + ";charset=utf-8," + encodeURIComponent(str), false); if (req.overrideMimeType) { req.overrideMimeType(contentType); } req.send(null); return req.responseXML; } };};SXmlOverlay.prototype.loadXmlCallback=function(xml_string) {var xmlDocument=(new DOMParser()).parseFromString(xml_string, "text/xml");this.loadXmlDoc(xmlDocument);};SXmlOverlay.prototype.loadXmlDoc=function(xmlDocument) {var objDomTree=xmlDocument.documentElement;var dels=objDomTree.getElementsByTagName("delete");for (var i=0; i<dels.length; i++) {var a_id=dels[i].getAttributeNode("id");if (a_id==null) {this.removePoint();} else {this.removePoint(a_id.value);}}var need_update=false;var points=objDomTree.getElementsByTagName("point");for (var i=0; i<points.length; i++) {var a_pid=points[i].getAttributeNode("id");if (a_pid==null) {continue;}var pid=a_pid.value;var np=this.getPointObject(pid);if (np==null) {np=new SXmlPoint(pid,this);this.ovrObjects.push(np);}np.parse(points[i]);need_update=true;}if (need_update) this.SMap.updateObjects();};SXmlOverlay.prototype.urlNormalize=function(url) {if (url==null) return "";if (url.match(/^\//) !='/') {return this.urlBase+url;}return url;}; SXmlOverlay.prototype.getDiv=function(pid) {var div_id=this.getDivId(pid);return getRawObject(div_id);};SXmlOverlay.prototype.getPointObject=function(pid) {for (var i=0; i < this.ovrObjects.length; i++) {if (this.ovrObjects[i] !=null && this.ovrObjects[i].pid==pid) {return this.ovrObjects[i]; }}return null;};SXmlOverlay.prototype.addNewPoint=function(pid,x,y) {this.removePoint(pid);var np=new SXmlPoint(pid,this);np.placeOnMap(x,y);this.ovrObjects.push(np);return np;};SXmlOverlay.prototype.getDivId=function(pid) {return 'xmlovr_'+pid+'_div';};SXmlOverlay.prototype.removePoint=function( pid ) {if ( (this.removePoint.arguments.length < 1) || (pid==null) ) {for (var i=this.ovrObjects.length; i-- > 0; ) {if (this.ovrObjects[i] !=null) {this.ovrObjects[i].removeFromMap();delete this.ovrObjects[i];this.ovrObjects[i]=null;}this.ovrObjects.splice(i,1); }} else {for (var i=this.ovrObjects.length; i-- > 0; ) {if (this.ovrObjects[i] !=null) {if (pid==this.ovrObjects[i].pid) {this.ovrObjects[i].removeFromMap();delete this.ovrObjects[i];this.ovrObjects[i]=null;this.ovrObjects.splice(i,1);}} else {this.ovrObjects.splice(i,1);}}}}; function SXmlGraphicElement() {};SXmlGraphicElement.prototype.parseElement=function(point, domElement) {};SXmlGraphicElement.prototype.draw=function(point) {};SXmlGraphicElement.prototype.rescale=function(point) {};SXmlGraphicElement.prototype.remove=function(point) {};function SXmlSymbol() {SXmlGraphicElement.apply(this);if (_BrowserIdent_hasCanvasSupport())SXmlSymbol.prototype['draw']=SXmlSymbol.prototype['draw_canvas'];elseSXmlSymbol.prototype['draw']=SXmlSymbol.prototype['draw_js']; for (var p in SXmlGraphicElement.prototype) { if (!SXmlSymbol.prototype[p]) SXmlSymbol.prototype[p]=SXmlGraphicElement.prototype[p]; }this.shape="bullet";this.size=10; this.stroke=1;this.color=null;this.bcolor=null;this.opacity=1;this.canvas=null;this.ldiv=null;};SXmlSymbol.prototype.remove=function(point) {this.canvas=null;this.ldiv=null;};SXmlSymbol.prototype.parseElement=function(point, domElement) {this.shape=domElement.getAttribute("shape");this.size=parseInt(domElement.getAttribute("size"));var c=domElement.getAttribute("color");if (c !=null) this.color=c;var c=domElement.getAttribute("bcolor");if (c !=null) this.bcolor=c;c=parseFloat(domElement.getAttribute("opacity"));if(! isNaN(c)) this.opacity=c; c=parseInt(domElement.getAttribute("stroke"));if (! isNaN(c)) this.stroke=c;};SXmlSymbol.prototype.draw_js=function(point) {var jsgObject=new jsGraphics(point.divId); var d=this.size / 2; jsgObject.setStroke(this.stroke);if (this.shape=='square') {if (this.color) {jsgObject.setColor(this.color);jsgObject.fillRect(-d, -d, this.size, this.size);}if (this.bcolor) {jsgObject.setColor(this.bcolor);jsgObject.fillRect(-d, -d, this.size, this.size);}} else {if (this.color) {jsgObject.setColor(this.color);jsgObject.fillEllipse(-d, -d, this.size, this.size);}if (this.bcolor) {jsgObject.setColor(this.bcolor);jsgObject.drawEllipse(-d, -d, this.size, this.size);}}jsgObject.paint();};SXmlSymbol.prototype.draw_canvas=function(point) {var d=Math.floor((this.size + this.stroke) / 2); if (this.canvas==null) {this.ldiv=document.createElement( 'div' );this.ldiv.style.position='absolute'; this.ldiv.style.left=-d+'px'; this.ldiv.style.top=-d+'px';point.div.appendChild(this.ldiv);this.canvas=_BrowserIdent_newCanvas(this.ldiv);_BrowserIdent_setCanvasHW(this.canvas,d*2,d*2);} var ctx=_BrowserIdent_getCanvasContext(this.canvas);ctx.save();ctx.translate(d,d);ctx.globalAlpha=this.opacity;ctx.lineWidth=this.stroke;if (this.bcolor) ctx.strokeStyle=this.bcolor;if (this.color) ctx.fillStyle=this.color;if (this.shape=='square') {if (this.color) ctx.fillRect(-this.size/2.0,-this.size/2.0,this.size,this.size);if (this.bcolor) ctx.strokeRect(-this.size/2.0,-this.size/2.0,this.size,this.size);} else {ctx.beginPath();ctx.arc(0,0,this.size/2.0,0,Math.PI*2,false);if (this.color) ctx.fill();if (this.bcolor) ctx.stroke();}ctx.restore();};function SXmlFeature( point ) {SXmlGraphicElement.apply(this); for (var p in SXmlGraphicElement.prototype) { if (!SXmlFeature.prototype[p]) SXmlFeature.prototype[p]=SXmlGraphicElement.prototype[p]; } this.stroke=1; this.color=null; this.bcolor=null; this.opacity=1;this.cxmin=0;this.cymax=0;this.cymin=0;this.cxmax=0;this.coords="";this.img=null;this.canvas=null;this.ldiv=null;this.xn=null;this.yn=null;var map=point.xml_overlay.SMap.getCurrentMap();var scales=map.getScales();this.maxScale=scales[scales.length - 1];this.mcs=point.xml_overlay.SMap.cellSize / (point.xml_overlay.SMap.getCurrentScale() / this.maxScale);};SXmlFeature.prototype.remove=function(point) {this.img=null;this.canvas=null;this.ldiv=null;this.coords=null;this.xn.splice(0);this.yn.splice(0);};SXmlFeature.prototype.parseElement=function(point, domElement) {var t;t=parseInt(domElement.getAttribute("stroke"));if (! isNaN(t)) this.stroke=t;t=domElement.getAttribute("color");if (t !=null) this.color=t;t=domElement.getAttribute("bcolor");if (t !=null) this.bcolor=t;t=parseFloat(domElement.getAttribute("opacity"));if(! isNaN(t)) this.opacity=t; var text="";if (domElement.firstChild !=null) {text=domElement.firstChild.data;this.readCoordinates(point, text);}};SXmlFeature.prototype.readCoordinates=function(point, text) {var cx=new Array();var cy=new Array();var pp=text.split(',');var i;for (i=0; i<pp.length; i++) {var s=pp[i];var xy=s.match(/[-\+\d\.]+/g);if (xy !=null) {var x=parseFloat(xy[0]);var y=parseFloat(xy[1]);cx.push(x);cy.push(y);}}this.setCoordinates(point,cx,cy);};SXmlFeature.prototype.setCoordinates=function(point, xArray, yArray) {this.cxmin=0;this.cymax=0;this.cymin=0;this.cxmax=0;this.coords="";var i;for (i=0; i<xArray.length; i++) {var x=xArray[i];var y=yArray[i];if (i==0 || x<this.cxmin) this.cxmin=x;if (i==0 || y>this.cymax) this.cymax=y;if (i==0 || y<this.cymin) this.cymin=y;if (i==0 || x>this.cxmax) this.cxmax=x;}this.xn=new Array();this.yn=new Array();for (i=0; i<xArray.length; i++) {var x=(xArray[i] - this.cxmin) / this.mcs;var y=(this.cymax - yArray[i]) / this.mcs;if (i>0) this.coords +=",";this.coords +=Math.round(x)+","+Math.round(y);this.xn.push(x);this.yn.push(y);}};SXmlFeature.prototype.rescale=function(point) {this.draw(point);};function SXmlLinestring( point ) {SXmlFeature.apply(this, [point]);if (_BrowserIdent_hasCanvasSupport()){SXmlLinestring.prototype['draw']=SXmlLinestring.prototype['draw_canvas'];}else{SXmlLinestring.prototype['draw']=SXmlLinestring.prototype['draw_server'];} for (var p in SXmlFeature.prototype) { if (!SXmlLinestring.prototype[p]) SXmlLinestring.prototype[p]=SXmlFeature.prototype[p]; }};SXmlLinestring.prototype.draw_server=function(point) {var xy=point.xml_overlay.SMap.geoToPix( this.cxmin, this.cymax );var x0=xy[0];var y0=xy[1];xy=point.xml_overlay.SMap.geoToPix( point.div.lon, point.div.lat );var xr=xy[0];var yr=xy[1];var border=5;if (this.img==null) { this.img=document.createElement( 'img' ); point.div.appendChild( this.img ); this.img.style.position='absolute';} this.img.style.top=(y0 - yr - border)+'px'; this.img.style.left=(x0 - xr - border)+'px'; var scf=point.xml_overlay.SMap.getCurrentScale() / this.maxScale; var it=_BrowserIdent_getPreferredImageType(); var u=point.xml_overlay.SMap.server+"/XMLOverlay/drawgeom.php?gt=L&st="+this.stroke+"&bp="+border+"&sc="+scf+"&cl="+this.coords; if (this.color !=null) u +="&lc="+escape(this.color); if (it=="P") { u +="&it=P"; } else { u +="&it=G"; } if (_BrowserIdent_getPreferredOpacity()=="server") { if (this.opacity < 1) u +="&op="+(this.opacity*100); } else { if (this.opacity < 1) _BrowserIdent_setOpacity(this.img, this.opacity); } this.img.src=u;};SXmlLinestring.prototype.draw_canvas=function(point) {var xy=point.xml_overlay.SMap.geoToPix( this.cxmin, this.cymax );var x0=xy[0];var y0=xy[1];xy=point.xml_overlay.SMap.geoToPix( this.cxmax, this.cymin );var x1=xy[0];var y1=xy[1];xy=point.xml_overlay.SMap.geoToPix( point.div.lon, point.div.lat );var xr=xy[0];var yr=xy[1];var border=5; var scf=point.xml_overlay.SMap.getCurrentScale() / this.maxScale;var sizex=(x1 - x0) + (border*2);var sizey=(y1 - y0) + (border*2);if (this.canvas==null) {this.ldiv=document.createElement( 'div' );this.ldiv.style.position='absolute';point.div.appendChild(this.ldiv);this.canvas=_BrowserIdent_newCanvas(this.ldiv);} this.ldiv.style.left=(x0 - xr - border)+'px';this.ldiv.style.top=(y0 - yr - border)+'px';_BrowserIdent_setCanvasHW(this.canvas,sizey,sizex);var ctx=_BrowserIdent_getCanvasContext(this.canvas);ctx.save();ctx.clearRect(0, 0, sizex, sizey);ctx.translate(border,border);ctx.strokeStyle=this.color;ctx.globalAlpha=this.opacity;ctx.lineWidth=this.stroke;ctx.beginPath();ctx.moveTo(this.xn[0]/scf, this.yn[0]/scf);var i;for (i=1; i<this.xn.length; i++) {ctx.lineTo(this.xn[i]/scf, this.yn[i]/scf);}ctx.stroke();ctx.restore();};function SXmlPolygon( point ) {SXmlFeature.apply(this, [point]);if (_BrowserIdent_hasCanvasSupport())SXmlPolygon.prototype['draw']=SXmlPolygon.prototype['draw_canvas'];elseSXmlPolygon.prototype['draw']=SXmlPolygon.prototype['draw_server']; for (var p in SXmlFeature.prototype) { if (!SXmlPolygon.prototype[p]) SXmlPolygon.prototype[p]=SXmlFeature.prototype[p]; }};SXmlPolygon.prototype.draw_server=function(point) {var xy=point.xml_overlay.SMap.geoToPix( this.cxmin, this.cymax );var x0=xy[0];var y0=xy[1];xy=point.xml_overlay.SMap.geoToPix( point.div.lon, point.div.lat );var xr=xy[0];var yr=xy[1];var border=5;if (this.img==null) { this.img=document.createElement( 'img' ); this.img.style.position='absolute'; point.div.appendChild( this.img );} var scf=point.xml_overlay.SMap.getCurrentScale() / this.maxScale; var it=_BrowserIdent_getPreferredImageType(); var u=point.xml_overlay.SMap.server+"/XMLOverlay/drawgeom.php?gt=P&st="+this.stroke+"&bp="+border+"&sc="+scf+"&cl="+this.coords; if (this.color !=null) u +="&fc="+escape(this.color); if (this.bcolor !=null && this.bcolor !="") u +="&lc="+escape(this.bcolor); if (it=="P") { u +="&it=P"; } else { u +="&it=G"; } if (_BrowserIdent_getPreferredOpacity()=="server") { if (this.opacity < 1) u +="&op="+(this.opacity*100); } else { if (this.opacity < 1) _BrowserIdent_setOpacity(this.img, this.opacity); } this.img.style.top=(y0 - yr - border)+'px'; this.img.style.left=(x0 - xr - border)+'px'; this.img.src=u;};SXmlPolygon.prototype.draw_canvas=function(point) {var xy=point.xml_overlay.SMap.geoToPix( this.cxmin, this.cymax );var x0=xy[0];var y0=xy[1];xy=point.xml_overlay.SMap.geoToPix( this.cxmax, this.cymin );var x1=xy[0];var y1=xy[1];xy=point.xml_overlay.SMap.geoToPix( point.div.lon, point.div.lat );var xr=xy[0];var yr=xy[1];var border=5; var scf=point.xml_overlay.SMap.getCurrentScale() / this.maxScale;var sizex=(x1 - x0) + (border*2);var sizey=(y1 - y0) + (border*2);if (this.canvas==null) {this.ldiv=document.createElement( 'div' );this.ldiv.style.position='absolute';point.div.appendChild(this.ldiv);this.canvas=_BrowserIdent_newCanvas(this.ldiv);} this.ldiv.style.left=(x0 - xr - border)+'px';this.ldiv.style.top=(y0 - yr - border)+'px';_BrowserIdent_setCanvasHW(this.canvas,sizey,sizex);var ctx=_BrowserIdent_getCanvasContext(this.canvas);ctx.save();ctx.clearRect(0, 0, sizex, sizey);ctx.translate(border,border); if (this.color !=null) ctx.fillStyle=this.color; if (this.bcolor !=null && this.bcolor !="") ctx.strokeStyle=this.bcolor;ctx.globalAlpha=this.opacity;ctx.lineWidth=this.stroke;ctx.beginPath();ctx.moveTo(this.xn[0]/scf, this.yn[0]/scf);var i;for (i=1; i<this.xn.length; i++) {ctx.lineTo(this.xn[i]/scf, this.yn[i]/scf);}if (this.color !=null) ctx.fill();if (this.bcolor !=null && this.bcolor !="") ctx.stroke();ctx.restore();};function SXmlLabel() {SXmlGraphicElement.apply(this); for (var p in SXmlGraphicElement.prototype) { if (!SXmlLabel.prototype[p]) SXmlLabel.prototype[p]=SXmlGraphicElement.prototype[p]; }this.text="";this.color="black";this.boxcolor=null;this.w=72;this.h=4;this.xoff=0;this.yoff=0;this.fsize="10px";this.font="Arial";this.ldiv=null;this.ltxt=null;this.weight='normal';};SXmlLabel.prototype.remove=function(point) {this.canvas=null;this.ldiv=null;this.ltxt=null;};SXmlLabel.prototype.parseElement=function(point, domElement) {if (domElement.firstChild !=null) {this.text=domElement.firstChild.data;}var t;t=domElement.getAttribute("color");if (t !=null) {this.color=t;}this.boxcolor=domElement.getAttribute("boxcolor");t=parseInt(domElement.getAttribute("w"));if (!isNaN(t)) {this.w=t;}t=parseInt(domElement.getAttribute("h"));if (!isNaN(t)) {this.h=t;}t=parseInt(domElement.getAttribute("px"));if (!isNaN(t)) {this.xoff=t;}t=parseInt(domElement.getAttribute("py"));if (!isNaN(t)) {this.yoff=t;}t=domElement.getAttribute("fsize");if (t !=null) {this.fsize=t;}t=domElement.getAttribute("font");if (t !=null) {this.font=t;}};SXmlLabel.prototype.draw=function(point) {var x=this.xoff;var y=this.yoff;this.ldiv=document.createElement( 'div' );this.ldiv.style.fontFamily=this.font;this.ldiv.style.fontSize=this.fsize;this.ldiv.style.textAlign='center';this.ldiv.style.fontWeight=this.weight;this.ldiv.style.color=this.color; this.ldiv.style.left=x+'px'; this.ldiv.style.top=y+'px';this.ldiv.style.position='absolute';if (this.boxcolor !=null) this.ldiv.style.backgroundColor=this.boxcolor;if (this.w>0) this.ldiv.style.width=this.w+'px';else this.ldiv.style.whiteSpace='nowrap';if (this.h>0) this.ldiv.style.height=this.h+'px'; this.ltxt=document.createTextNode(this.text);this.ldiv.appendChild( this.ltxt );point.div.appendChild( this.ldiv );};function SXmlLinkLabel() {SXmlGraphicElement.apply(this); for (var p in SXmlGraphicElement.prototype) { if (!SXmlLabel.prototype[p]) SXmlLabel.prototype[p]=SXmlGraphicElement.prototype[p]; }this.text="";this.color="black";this.boxcolor=null;this.w=64;this.h=24;this.xoff=0;this.yoff=0;this.fsize="10px";this.font="Arial";this.ldiv=null;this.ltxt=null;};SXmlLinkLabel.prototype.remove=function(point) {this.canvas=null;this.ldiv=null;this.ltxt=null;};SXmlLinkLabel.prototype.parseElement=function(point, domElement) {if (domElement.firstChild !=null) {this.text=domElement.firstChild.data;}var t;t=domElement.getAttribute("color");if (t !=null) {this.color=t;}this.boxcolor=domElement.getAttribute("boxcolor");t=parseInt(domElement.getAttribute("w"));if (!isNaN(t)) {this.w=t;}t=parseInt(domElement.getAttribute("h"));if (!isNaN(t)) {this.h=t;}t=parseInt(domElement.getAttribute("px"));if (!isNaN(t)) {this.xoff=t;}t=parseInt(domElement.getAttribute("py"));if (!isNaN(t)) {this.yoff=t;}t=domElement.getAttribute("fsize");if (t !=null) {this.fsize=t;}t=domElement.getAttribute("font");if (t !=null) {this.font=t;}};SXmlLinkLabel.prototype.draw=function(point) {var x=this.xoff;var y=this.yoff;this.ldiv=document.createElement( 'div' );this.ldiv.style.fontFamily=this.font;this.ldiv.style.fontSize=this.fsize;this.ldiv.style.textAlign='center';this.ldiv.style.color=this.color; this.ldiv.style.left=x+'px'; this.ldiv.style.top=y+'px';this.ldiv.style.position='absolute';if (this.boxcolor !=null) this.ldiv.style.backgroundColor=this.boxcolor;if (this.w>0) this.ldiv.style.width=this.w+'px';else this.ldiv.style.whiteSpace='nowrap';if (this.h>0) this.ldiv.style.height=this.h+'px';this.a=document.createElement('a'); this.a.href='javascript:goto(' + point.geox + ',' + point.geoy + ',' + '4' + ');'; this.a.appendChild(document.createTextNode(this.text)); this.a.style.color='#FF0000'; this.a.style.fontSize='12px'; this.ltxt=document.createTextNode(this.text);this.ldiv.appendChild( this.a );point.div.appendChild( this.ldiv );};function SXmlIcon() {SXmlGraphicElement.apply(this);SXmlIcon.prototype['draw']=SXmlIcon.prototype['draw_plain']; for (var p in SXmlGraphicElement.prototype) { if (!SXmlIcon.prototype[p]) SXmlIcon.prototype[p]=SXmlGraphicElement.prototype[p]; }this.icon_src=null;this.icon_w=0;this.icon_h=0;this.xoff=0;this.yoff=0;this.rot=0;this.ldiv=null;this.img=null;this.canvas=null;this.xmltooltip=null;};SXmlIcon.prototype.remove=function(point) {this.ldiv=null;this.canvas=null;if (this.img) this.img.onload=null;this.img=null;};SXmlIcon.prototype.parseElement=function(point, domElement) {this.icon_src=point.xml_overlay.urlNormalize(domElement.getAttribute("src"));this.icon_w=parseInt(domElement.getAttribute("w"));this.icon_h=parseInt(domElement.getAttribute("h"));var t;t=parseInt(domElement.getAttribute("px"));if (!isNaN(t)) {this.xoff=t;}t=parseInt(domElement.getAttribute("py"));if (!isNaN(t)) {this.yoff=t;}t=parseInt(domElement.getAttribute("rot"));if (!isNaN(t)) {this.rot=t;}var elements=domElement.getElementsByTagName("tootip");for (i=0; i<elements.length; i++) {var tt=new smXMLTooltip();tt.parseElement(elements[i]);this.xmltooltip=tt;}};SXmlIcon.prototype.draw_canvas=function(point) {var dx=-this.icon_w / 2 + this.xoff; var dy=-this.icon_h / 2 + this.yoff; if (this.canvas==null) {this.ldiv=document.createElement( 'div' );this.ldiv.style.position='absolute'; this.ldiv.style.top=dy+'px'; this.ldiv.style.left=dx+'px';point.div.appendChild(this.ldiv);this.canvas=_BrowserIdent_newCanvas(this.ldiv);_BrowserIdent_setCanvasHW(this.canvas,this.icon_h*2,this.icon_w*2);} var ctx=_BrowserIdent_getCanvasContext(this.canvas);ctx.save(); ctx.translate(-dx,-dy); ctx.rotate(this.rot * Math.PI/180); this.img=new Image(); this.img.src=this.icon_src; var timg=this.img; var tw=this.icon_w; var th=this.icon_h;this.img.onload=function() {ctx.drawImage(timg, dx, dy, tw, th);ctx.restore();}};SXmlIcon.prototype.draw_plain=function(point) {var dx=-this.icon_w / 2 + this.xoff; var dy=-this.icon_h / 2 + this.yoff; this.ldiv=document.createElement( 'div' ); this.ldiv.style.position='absolute'; this.ldiv.style.top=dy+'px'; this.ldiv.style.left=dx+'px'; this.img=document.createElement( 'img' );this.img.src=this.icon_src; this.img.width=this.icon_w; this.img.height=this.icon_h; if(isIE4){ var imgName=this.icon_src; if(imgName.length>3){ imgName=imgName.toUpperCase(); if(imgName.substring(imgName.length-3, imgName.length)=='PNG'){ applyPNGFilter(this.img); } } } if (this.img.captureEvents) { this.img.captureEvents(Event.CLICK); this.img.captureEvents(Event.MOUSEDOWN); this.img.captureEvents(Event.MOUSEUP); this.img.captureEvents(Event.MOUSEMOVE); this.img.captureEvents(Event.MOUSEOUT); } this.img.style.cursor="pointer";this.img.SMap=point.xml_overlay.SMap; this.ldiv.appendChild( this.img ); point.div.appendChild( this.ldiv ); this.img.loaded=false; this.img.xmltooltip=this.xmltooltip; this.img.onclick=showTooltip; };SXmlIcon.prototype.onclick=function(e){ e=(e)?e:((event)?event:null); e={};if (this.img) {if (e) { e.pageX=getLeft(this.img)+this.icon_w/2; e.pageY=getTop(this.img)+this.icon_h/2;this.img.onclick(e);}}};function SXmlPoint(pid, xml_overlay) {this.xml_overlay=xml_overlay;this.pid=pid;this.divId=this.xml_overlay.getDivId(pid);this.geox=0;this.geoy=0;this.shown=false;this.minscale=-1;this.maxscale=-1;this.graphics=new Array();this.div=document.createElement('div');this.div.setAttribute('id', this.divId);};SXmlPoint.prototype.placeOnMap=function( x, y ) {this.geox=x;this.geoy=y;currentScale=this.xml_overlay.SMap.getCurrentScale();scales=this.xml_overlay.SMap.getCurrentMap().getScales();var currentScaleIndex=-1;for(var i=0;i<scales.length;i++){if(currentScale==scales[i])currentScaleIndex=i; }if(currentScaleIndex>-1){if(this.minscale>-1 && this.minscale>currentScaleIndex){if(this.shown)this.removeFromMap();return;}if(this.maxscale>-1 && this.maxscale<currentScaleIndex){if(this.shown)this.removeFromMap();return;}}if(this.shown)return;this.xml_overlay.SMap.addObjectGeo( this.xml_overlay.overlayCanvas, x, y, this.div );this.shown=true;}; SXmlPoint.prototype.onclick=function(e){ e=(e)?e:((event)?event:null); };SXmlPoint.prototype.removeFromMap=function( ) {if (this.shown) {this.xml_overlay.SMap.removeObject( this.div );this.shown=false;}};SXmlPoint.prototype.setPosition=function( x, y ) {if (this.shown) {this.geox=x;this.geoy=y;this.div.lat=y;this.div.lon=x;}};SXmlPoint.prototype.addGraphic=function( obj ) {this.graphics.push(obj);obj.draw(this); };SXmlPoint.prototype.clear=function() {this.div.innerHTML="";this.graphics.length=0;};SXmlPoint.prototype.setInnerHtml=function(ihtml) {this.clear();this.div.innerHTML=ihtml;};SXmlPoint.prototype.parseScaleRange=function(point_element){var minscale_a=point_element.getAttribute("minscale");if(minscale_a!=null)this.minscale=parseInt(minscale_a);var maxscale_a=point_element.getAttribute("maxscale");if(maxscale_a!=null)this.maxscale=parseInt(maxscale_a);};SXmlPoint.prototype.parse=function(point_element) {var i;var x=parseFloat(point_element.getAttribute("x"));var y=parseFloat(point_element.getAttribute("y"));this.parseScaleRange(point_element);var redraw_a=point_element.getAttribute("redraw");var redraw=false;if (redraw_a=="true")redraw=true;if (!this.shown) {this.placeOnMap(x,y);} else {this.setPosition(x,y);if (!redraw) return;this.clear();}var ihtml_element=point_element.getElementsByTagName("ihtml");for (i=0; i<ihtml_element.length; i++) {this.div.innerHTML=ihtml_element[i].firstChild.nodeValue;}var t;var elements;elements=point_element.getElementsByTagName("symbol");for (i=0; i<elements.length; i++) {t=new SXmlSymbol();t.parseElement(this, elements[i]);this.addGraphic(t);}elements=point_element.getElementsByTagName("icon");for (i=0; i<elements.length; i++) {t=new SXmlIcon();t.parseElement(this, elements[i]);this.addGraphic(t);}elements=point_element.getElementsByTagName("label");for (i=0; i<elements.length; i++) {t=new SXmlLabel();t.parseElement(this, elements[i]);this.addGraphic(t);}elements=point_element.getElementsByTagName("linestring");for (i=0; i<elements.length; i++) {t=new SXmlLinestring(this);t.parseElement(this, elements[i]);this.addGraphic(t);}elements=point_element.getElementsByTagName("polygon");for (i=0; i<elements.length; i++) {t=new SXmlPolygon(this);t.parseElement(this, elements[i]);this.addGraphic(t);}};SXmlPoint.prototype.rescale=function(point_element) {var i;this.placeOnMap(this.geox,this.geoy);for (i=0; i<this.graphics.length; i++) {this.graphics[i].rescale(this);}};function SXmlCircle( point ) {SXmlFeature.apply(this, [point]);if (_BrowserIdent_hasCanvasSupport()) {SXmlCircle.prototype['draw']=SXmlCircle.prototype['draw_canvas'];}else {SXmlCircle.prototype['draw']=SXmlCircle.prototype['draw_server'];} for (var p in SXmlFeature.prototype) { if (!SXmlCircle.prototype[p]) SXmlCircle.prototype[p]=SXmlFeature.prototype[p]; }};SXmlCircle.prototype.draw_server=function(point) {};SXmlCircle.prototype.draw_canvas=function(point) { var xy=point.xml_overlay.SMap.geoToPix( point.div.lon, point.div.lat); var x0=xy[0]; var y0=xy[1]; var radius=this.radius / 100 / this.maxScale; this.cxmin=point.div.lon - radius; this.cymin=point.div.lat - radius; this.cxmax=point.div.lon + radius; this.cymax=point.div.lat + radius; xy=point.xml_overlay.SMap.geoToPix( this.cxmin, this.cymax ); var x1=xy[0]; var y1=xy[1]; xy=point.xml_overlay.SMap.geoToPix( this.cxmax, this.cymin );var x2=xy[0];var y2=xy[1]; if (this.canvas==null) { this.ldiv=document.createElement( 'div' ); this.ldiv.style.position='absolute'; point.div.appendChild(this.ldiv); this.canvas=_BrowserIdent_newCanvas(this.ldiv); } var border=5; var sizex=(x2 - x1) + (border*2); var sizey=(y2 - y1) + (border*2); var scf=point.xml_overlay.SMap.getCurrentScale() / this.maxScale; this.ldiv.style.left=(x1 - x0 - border)+'px'; this.ldiv.style.top=(y0 - y2 - border)+'px'; _BrowserIdent_setCanvasHW(this.canvas,sizey,sizex); var ctx=_BrowserIdent_getCanvasContext(this.canvas); ctx.save(); ctx.clearRect(0,0,sizex,sizey); ctx.translate(border,border); if (this.color !=null) ctx.fillStyle=this.color; if (this.bcolor !=null && this.bcolor !="") ctx.strokeStyle=this.bcolor; ctx.globalAlpha=this.opacity; var x=(point.div.lon - this.cxmin) / this.mcs / scf; var y=(this.cymax - point.div.lat) / this.mcs / scf; var r=radius / this.mcs / scf; ctx.arc(x, y, r, 0, Math.PI*2, true); ctx.fill(); ctx.restore(); };var _BrowserIdent_browser=null;var _BrowserIdent_version=null;var _BrowserIdent_place=0;var _BrowserIdent_thestring=null;var _BrowserIdent_detect=null;function _BrowserIdent() {_BrowserIdent_detect=navigator.userAgent.toLowerCase();if (_BrowserIdent_checkIt('konqueror')) {_BrowserIdent_browser="Konqueror";} else if (_BrowserIdent_checkIt('safari')) _BrowserIdent_browser="Safari";else if (_BrowserIdent_checkIt('omniweb')) _BrowserIdent_browser="OmniWeb";else if (_BrowserIdent_checkIt('opera')) _BrowserIdent_browser="Opera";else if (_BrowserIdent_checkIt('webtv')) _BrowserIdent_browser="WebTV";else if (_BrowserIdent_checkIt('icab')) _BrowserIdent_browser="iCab";else if (_BrowserIdent_checkIt('msie')) _BrowserIdent_browser="Internet Explorer";else if (_BrowserIdent_checkIt('firefox')) _BrowserIdent_browser="Firefox";else if (!_BrowserIdent_checkIt('compatible')) {_BrowserIdent_browser="Netscape Navigator";_BrowserIdent_version=_BrowserIdent_detect.charAt(8);} else _BrowserIdent_browser="An unknown browser";if (!_BrowserIdent_version) _BrowserIdent_version=_BrowserIdent_detect.charAt(_BrowserIdent_place + _BrowserIdent_thestring.length);};function _BrowserIdent_checkIt(string) {_BrowserIdent_place=_BrowserIdent_detect.indexOf(string) + 1;_BrowserIdent_thestring=string;return _BrowserIdent_place;};function _BrowserIdent_setOpacity(imageobject, opacity) {if (opacity==undefined || opacity >=1) return '';if (_BrowserIdent_browser=="Netscape Navigator")imageobject.style.MozOpacity=opacity;else if (_BrowserIdent_browser=="Internet Explorer" && parseInt(this.version)>=4) {var tmp=imageobject.style.cssText;tmp="filter: alpha(opacity="+(opacity*100)+");" + tmp;imageobject.style.cssText=tmp;} else {var tmp=imageobject.style.cssText;tmp="opacity: "+opacity+";" + tmp;imageobject.style.cssText=tmp;}};function _BrowserIdent_getPreferredImageType() {if (_BrowserIdent_browser=="Netscape Navigator") return "P";else if (_BrowserIdent_browser=="Opera") return "P";else if (_BrowserIdent_browser=="Firefox") return "P";else if (_BrowserIdent_browser=="Safari") return "P";else if (_BrowserIdent_browser=="Konqueror") return "P";else return "G"};function _BrowserIdent_getPreferredOpacity() {if (_BrowserIdent_browser=="Netscape Navigator") return "server";else if (_BrowserIdent_browser=="Firefox") return "server";else if (_BrowserIdent_browser=="Opera") return "server";else if (_BrowserIdent_browser=="Konqueror") return "server";else return "client"};var xmlOverlayUseCanvas=true;function _BrowserIdent_hasCanvasSupport() {if (! xmlOverlayUseCanvas) return false;if (_BrowserIdent_browser=="Internet Explorer") return true;if (_BrowserIdent_browser=="Firefox") return true;if (_BrowserIdent_browser=="Safari") return true;return false;};function _BrowserIdent_newCanvas(parentNode) {var el=document.createElement('canvas');parentNode.appendChild(el);if (typeof(G_vmlCanvasManager)!="undefined") {el=G_vmlCanvasManager.initElement(el);}return el;};function _BrowserIdent_getCanvasContext(canvas) {return canvas.getContext('2d');};function _BrowserIdent_setCanvasHW(canvas, height, width) {canvas.width=width; canvas.height=height;};_BrowserIdent();﻿function coord(x, y){this.x=x;this.y=y;};function GetTagPosition(_o){ var p=new Array(), _cr=_o; p['x']=_cr.offsetLeft; p['y']=_cr.offsetTop; while(_cr=_cr.offsetParent) { p['x'] +=_cr.offsetLeft; p['y'] +=_cr.offsetTop; } return p;};function GetTagDimension(_o){ var p=new Array(); p['width']=_o.clientWidth; p['height']=_o.clientHeight; return p;};function JScalemap(_rso_div){this._paintDiv=false;this._associate=false;this.maxIndex=100;this.minIndex=-100;this.mkDiv=function(_name_){var _div=false;if(this._associate){var _div=document.createElement('div');var p=GetTagPosition(this._associate);_div.style.left=p['x']; _div.style.top=p['y']; var d=GetTagDimension(this._associate);_div.style.width=d['width'] +2;_div.style.height=d['height'] +2; _div.style.position='absolute';_div.style.overflow='hidden';var s=document.server + 'images/transparent_1pix.gif';_div.style.backgroundImage='url('+s+')';_div.style.cursor='crosshair';_div.id=_name_ + Math.round(Math.random()*100); } document.body.appendChild(_div);return _div;};this.start=function(){this._paintDiv.registerEvent();this._paintDiv.setTopper(this.maxIndex);this._paintDiv_gt.setTopper(this.maxIndex-1);};this.reset=function(){this._paintDiv.reset();};this.free=function(){this._paintDiv.free();document.body.removeChild(this._paintDiv);document.body.removeChild(this._paintDiv_gt);this._paintDiv=false;this._paintDiv_gt=false;this._associate=false;};if(typeof(_rso_div)=='string'){this._associate=document.all?(document.all[_rso_div] || null): document.getElementById? (document.getElementById(_rso_div)): false;}else if(typeof(_rso_div)=='object'){this._associate=_rso_div;} this._paintDiv=this.mkDiv('_paintDiv');this._paintDiv.gl_ArrayCoords=new Array();this._paintDiv.gl_PageCoord=null;this._paintDiv.gl_CoordsPointer=-1;this._paintDiv._total_distance=0;this._paintDiv.tooltip=null;this._paintDiv.line=null;this._paintDiv.dist=false;this._paintDiv._associate=this._associate;this._paintDiv.setTopper=function(_vi_num){var num;if(typeof(_vi_num)=='string') num=isNaN(parseInt(_vi_num))? 100: parseInt(_vi_num);else if(typeof(_vi_num)=='undefined') num=100;else num=_vi_num;this.style.zIndex=num;};this._paintDiv.setLower=function(_vi_num){var num;if(typeof(_vi_num)=='string') num=isNaN(parseInt(_vi_num))? -100: parseInt(_vi_num);else if(typeof(_vi_num)=='undefined') num=-100;else num=_vi_num;this.style.zIndex=num;};this._paintDiv.free=function(){this.gl_ArrayCoords=false;this.gl_ArrayPageCoords=false;this.gl_CoordsPointer=-1;this._total_distance=0;document.body.removeChild(this.paint);document.body.removeChild(this);};this._paintDiv.reset=function(){this.gl_ArrayCoords=new Array();this.gl_PageCoord=null;this.gl_CoordsPointer=-1;this._total_distance=0;this.line=null;this.tooltip=null;this.clearAll();this.paint.clearAll();this.style.display='';this.paint.style.display='';};this._paintDiv.clearAll=function() { this.innerHTML=''; };this._paintDiv.registerEvent=function(){this.onmousedown=this.down_event;this.onmousemove=this.move_event;this.oncontextmenu=this.contextmenu_event;this.onmouseup=this.up_event;};this._paintDiv.unregisterEvent=function(){this.onmousedown=null;this.onmousemove=null;this.oncontextmenu=null;this.onmouseup=null;};this._paintDiv.down_event=function(e){ this.dist=true;e=(e)?e:((window.event)? window.event:null);var page_x=e.pageX || (e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft)) -1;var page_y=e.pageY || (e.clientY + (document.documentElement.scrollTop || document.body.scrollTop)) -1;var layer_x=e.layerX || page_x - this.offsetLeft;var layer_y=e.layerY || page_y - this.offsetTop;var _distance=0;var o, gis1, gis2;var cr1=new coord(layer_x, layer_y);var cr2=new coord(page_x, page_y);if(this.gl_CoordsPointer >=0){o=this.gl_ArrayCoords[this.gl_CoordsPointer];gis1=get_GIS_coords(this.gl_PageCoord.x, this.gl_PageCoord.y);gis2=get_GIS_coords(page_x, page_y);_distance=getDistance(gis1.lng, gis1.lat, gis2.lng, gis2.lat);}this.gl_CoordsPointer++;this.gl_ArrayCoords[this.gl_CoordsPointer]=cr1;this.gl_PageCoord=cr2;this._total_distance +=_distance;if(this.line){ this.paint.innerHTML +=this.line; }};this._paintDiv.move_event=function(e){ if(this.dist) return;e=(e)?e:((window.event)? window.event:null);var page_x=e.pageX || (e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft)) -1;var page_y=e.pageY || (e.clientY + (document.documentElement.scrollTop || document.body.scrollTop)) -1;var layer_x=e.layerX || page_x - this.offsetLeft;var layer_y=e.layerY || page_y - this.offsetTop;var o, _distance=0, gis1, gis2;if(this.gl_CoordsPointer >=0){gis1=get_GIS_coords(this.gl_PageCoord.x, this.gl_PageCoord.y);gis2=get_GIS_coords(page_x, page_y);_distance=getDistance(gis1.lng, gis1.lat, gis2.lng, gis2.lat);this.innerHTML=''; var mile=this._total_distance + _distance;if(mile > 1) {mile=Math.round(mile*10)/10 + '公里(单击右键结束)';}else{mile=Math.round(mile*1000) + '米(单击右键结束)';} var html='<div style=\"font:normal bolder 12px Arial; color:#000;position:absolute;z-index:1000;left:' + (parseInt(layer_x) + 10) +'; top:' + layer_y +';\">' + mile +'</div>'; this.innerHTML=html; o=this.gl_ArrayCoords[this.gl_CoordsPointer]; this.line=newLine(o.x, o.y, layer_x, layer_y); this.innerHTML +=this.line; }};this._paintDiv.contextmenu_event=function(e){this.reset();this.setLower(-100);this.paint.setLower(-100);this.unregisterEvent();this.style.display='none';this.paint.style.display='none'; return false;};this._paintDiv.up_event=function(e) { this.dist=false;};this._paintDiv_gt=this.mkDiv('_paintDiv_G');this._paintDiv_gt.setTopper=this._paintDiv.setTopper;this._paintDiv_gt.setLower=this._paintDiv.setLower;this._paintDiv_gt.clearAll=function() { this.innerHTML=''; }; this._paintDiv.paint=this._paintDiv_gt;};get_GIS_coords=function(pix_x, pix_y) {var o=mapControl_getSMap();var a=adjustMapPixPosition(o, pix_x, pix_y);var s=new String(a);var a1=s.split(',');a=o.pixToGeo( a1[0],a1[1] );s=new String(a);var a1=s.split(',');return {lat:a1[0], lng:a1[1]};};function rad(d){ return d * Math.PI / 180.0;};function getDistance(lat1, lng1, lat2, lng2){ var radLat1=rad(lat1); var radLat2=rad(lat2); var a=radLat1 - radLat2; var b=rad(lng1) - rad(lng2); var s=2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a/2),2) + Math.cos(radLat1)*Math.cos(radLat2)*Math.pow(Math.sin(b/2),2))); s=s * 6378.137; s=Math.round(s * 10000) / 10000; return s;};function newLine(x1, y1, x2, y2){var o=mapControl_getSMap();var len_x, len_y, len, costheta, sintheta, strImage;var i_x, i_y;len_x=Math.floor(x2-x1);len_y=Math.floor(y2-y1);len=Math.sqrt(len_x*len_x + len_y*len_y);costheta=(len_x / len);sintheta=(len_y / len);i_x=x1, i_y=y1;if((len_y<0) && (len_x<0)){i_x=x2;i_y=y2;}if((len_y<0) && (len_x>0)){i_x=x1;i_y=y1 + len_y;}if((len_y>0) && (len_x<0)){i_x=x1 + len_x;i_y=y1;}if((len_y==0) && (len_x<0)){i_x=x1 + len_x;i_y=y1;}if((len_x==0) && (len_y<0)){i_x=x1;i_y=y1 + len_y;} var html=''; html +='<img height=2 width='+ (len+1) + ' style=\"position:absolute;left:'+i_x +';top:'+i_y + ';filter:progid:DXImageTransform.Microsoft.Matrix(SizingMethod=\'auto expand\',FilterType=\'bilinear\',' + 'M11='+costheta+ ',M12='+ (0-sintheta) + ',M21=' + sintheta + ',M22=' + costheta + ')' + '\" src=\"' + o.server + 'images/line.gif\">'; return html;};