/* Copyright (c) 2006 Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
 *
 * $LastChangedDate: 2007-12-14 23:57:10 -0600 (Fri, 14 Dec 2007) $
 * $Rev: 4163 $
 *
 * Version: 3.0
 * 
 * Requires: $ 1.2.2+
 */
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(5($){$.6.j.4={L:5(){9 b=$.6.j.4.i;7($.8.f)$(2).o(\'y.4\',5(a){$.d(2,\'h\',{x:a.x,l:a.l,s:a.s,r:a.r})});7(2.q)2.q(($.8.f?\'v\':\'4\'),b,n);m 2.w=b},D:5(){9 a=$.6.j.4.i;$(2).k(\'y.4\');7(2.u)2.u(($.8.f?\'v\':\'4\'),a,n);m 2.w=5(){};$.A(2,\'h\')},i:5(a){9 c=U.T.S.P(O,1);a=$.6.N(a||M.6);$.t(a,$.d(2,\'h\')||{});9 b=0,K=J;7(a.e)b=a.e/I;7(a.p)b=-a.p/3;7($.8.H)b=-a.e;a.d=a.d||{};a.G="4";c.z(b);c.z(a);g $.6.F.E(2,c)}};$.Q.t({4:5(a){g a?2.o("4",a):2.R("4")},C:5(a){g 2.k("4",a)}})})(B);',57,57,'||this||mousewheel|function|event|if|browser|var||||data|wheelDelta|mozilla|return|mwcursorposdata|handler|special|unbind|pageY|else|false|bind|detail|addEventListener|clientY|clientX|extend|removeEventListener|DOMMouseScroll|onmousewheel|pageX|mousemove|unshift|removeData|jQuery|unmousewheel|teardown|apply|handle|type|opera|120|true|returnValue|setup|window|fix|arguments|call|fn|trigger|slice|prototype|Array'.split('|'),0,{}));
var KrakMap=function(){
};

KrakMap.API=function(tc){
this.version="3.0";
this.tc=tc;
};
KrakMap.API.prototype.jump=function(_2,_3,_4,_5){
var _6=KrakMap.Util;
if(!_6.validateCoordinate(_2)||!(typeof (_3)=="number"&&isFinite(_3))||!_6.validateMapType(_4)||(_5&&!_6.validateObliqueDirection(_5))){
return;
}
this.tc.jumpToCoordinate(_3,_2.x,_2.y,_4,_5);
};
KrakMap.API.prototype.jumpToFullExtent=function(){
this.tc.jumpToFullExtent();
};
KrakMap.API.prototype.redrawGrid=function(){
this.tc.redrawGrid();
};
KrakMap.API.prototype.resizeMap=function(){
this.tc.resizeMap();
};
KrakMap.API.prototype.enableOverviewMap=function(){
this.tc.enableOverviewMap();
};
KrakMap.API.prototype.disableOverviewMap=function(){
this.tc.disableOverviewMap();
};
KrakMap.API.prototype.toggleOverviewMap=function(){
this.tc.toggleOverviewMap();
};
KrakMap.API.prototype.isOverviewMap=function(){
return this.tc.getOverviewMap()?true:false;
};
KrakMap.API.prototype.enableNavigationKeys=function(){
this.tc.enableNavigationKeys();
};
KrakMap.API.prototype.disableNavigationKeys=function(){
this.tc.disableNavigationKeys();
};
KrakMap.API.prototype.toggleNavigationKeys=function(){
this.tc.toggleNavigationKeys();
};
KrakMap.API.prototype.isNavigationKeys=function(){
return this.tc.getNavigationKeys();
};
KrakMap.API.prototype.enableMeasureTool=function(){
this.tc.enableMeasureLine();
};
KrakMap.API.prototype.disableMeasureTool=function(){
this.tc.disableMeasureLine();
};
KrakMap.API.prototype.toggleMeasureTool=function(){
this.tc.toggleMeasureLine();
};
KrakMap.API.prototype.isMeasureTool=function(){
return this.tc.measureLineEnabled;
};
KrakMap.API.prototype.enableRectangleDraw=function(){
this.tc.enableMeasureBox();
};
KrakMap.API.prototype.disableRectangleDraw=function(){
this.tc.disableMeasureBox();
};
KrakMap.API.prototype.toggleRectangleDraw=function(){
this.tc.toggleMeasureBox();
};
KrakMap.API.prototype.isRectangleDraw=function(){
return this.tc.getMeasureBox();
};
KrakMap.API.prototype.enableCircleDraw=function(){
this.tc.enableCircleDraw();
};
KrakMap.API.prototype.disableCircleDraw=function(){
this.tc.disableCircleDraw();
};
KrakMap.API.prototype.toggleCircleDraw=function(){
this.tc.toggleCircleDraw();
};
KrakMap.API.prototype.isCircleDraw=function(){
return this.tc.circleDrawEnabled;
};
KrakMap.API.prototype.enablePolygonDraw=function(){
this.tc.enablePolygonDraw();
};
KrakMap.API.prototype.disablePolygonDraw=function(){
this.tc.disablePolygonDraw();
};
KrakMap.API.prototype.togglePolygonDraw=function(){
this.tc.togglePolygonDraw();
};
KrakMap.API.prototype.isPolygonDraw=function(){
return this.tc.polygonDrawEnabled;
};
KrakMap.API.prototype.draw=function(_7,_8){
if(typeof (_7)!="string"||!(typeof (_8)=="undefined"||typeof (_8)=="boolean")){
return;
}
this.tc.enableRoute(_7,_8);
};
KrakMap.API.prototype.getWkt=function(){
var _9=this.tc.route.route.asWkt;
return (_9&&typeof (_9)=="string")?_9:"";
};
KrakMap.API.prototype.removeDrawing=function(){
this.tc.disableRoute();
};
KrakMap.API.prototype.setPrintMode=function(_a){
if(typeof (_a)!="boolean"){
return;
}
this.tc.setRouteFallBack(_a);
};
KrakMap.API.prototype.enableRouteSearch=function(){
this.tc.enableRouteSearch();
};
KrakMap.API.prototype.disableRouteSearch=function(){
this.tc.disableRouteSearch();
};
KrakMap.API.prototype.toggleRouteSearch=function(){
this.tc.toggleRouteSearch();
};
KrakMap.API.prototype.isRouteSearch=function(){
return this.tc.isRouteSearch();
};
KrakMap.API.prototype.addPoi=function(_b){
if(_b instanceof Array){
for(var i=0;i<_b.length;i++){
if(!KrakMap.Util.validatePoi(_b[i])){
return;
}
}
}else{
if(!KrakMap.Util.validatePoi(_b)){
return;
}
}
this.tc.addPoi(_b);
};
KrakMap.API.prototype.removePoi=function(_d){
if(typeof (_d)!="string"){
return;
}
this.tc.removePoi(false,_d);
};
KrakMap.API.prototype.removeAllPoi=function(_e){
if(_e&&typeof (_e)=="string"){
this.tc.removeAllPoiInLayer(_e);
return;
}
if(!_e){
this.tc.removeAllPoi();
}
};
KrakMap.API.prototype.sortPoiCategories=function(_f){
if(_f instanceof Array){
for(var i=0;i<_f.length;i++){
if(typeof (_f[i])!="string"){
return;
}
}
}else{
return;
}
this.tc.sortPoiLayers(_f);
};
KrakMap.API.prototype.switchPoiCategoryOn=function(_11){
if(!_11||typeof (_11)!="string"){
return;
}
this.tc.switchPoiLayerOn(_11);
};
KrakMap.API.prototype.switchPoiCategoryOff=function(_12){
if(!_12||typeof (_12)!="string"){
return;
}
this.tc.switchPoiLayerOff(_12);
};
KrakMap.API.prototype.togglePoiCategory=function(_13){
if(!_13||typeof (_13)!="string"){
return;
}
this.tc.togglePoiLayer(_13);
};
KrakMap.API.prototype.isPoiCategory=function(_14){
if(!_14||typeof (_14)!="string"){
return;
}
return this.tc.isPoiLayer(_14);
};
KrakMap.API.prototype.addTileLayer=function(_15,_16,url){
if(!(_15&&typeof (_15)=="string")||!(typeof (_16)=="number"&&isFinite(_16))||!(url&&typeof (url)=="string")){
return;
}
this.tc.addTileLayer(_15,_16,url);
};
KrakMap.API.prototype.removeTileLayer=function(_18){
if(!_18||typeof (_18)!="string"){
return;
}
this.tc.removeTileLayer(_18);
};
KrakMap.API.prototype.removeAllTileLayers=function(){
this.tc.removeAllTileLayers();
};
KrakMap.API.prototype.modifyTileLayer=function(_19,_1a,url){
if(!(_19&&typeof (_19)=="string")||!(typeof (_1a)&&isFinite(_1a))||!(url&&typeof (url)=="string")){
return;
}
this.tc.modifyTileLayer(_19,_1a,url);
};
KrakMap.API.prototype.switchTileLayerOn=function(_1c){
if(!_1c||typeof (_1c)!="string"){
return;
}
this.tc.switchTileLayerOn(_1c);
};
KrakMap.API.prototype.switchTileLayerOff=function(_1d){
if(!_1d||typeof (_1d)!="string"){
return;
}
this.tc.switchTileLayerOff(_1d);
};
KrakMap.API.prototype.toggleTileLayer=function(_1e){
if(!_1e||typeof (_1e)!="string"){
return;
}
this.tc.toggleTileLayer(_1e);
};
KrakMap.API.prototype.isTileLayer=function(_1f){
if(!_1f||typeof (_1f)!="string"){
return;
}
return this.tc.isTileLayer(_1f);
};
KrakMap.API.prototype.subscribeEvent=function(_20,_21){
if(typeof (_20)!="string"||typeof (_21)!="function"){
return;
}
this.tc.subscribeEvent(_20,_21);
};
KrakMap.API.prototype.unsubscribeEvent=function(_22,_23){
if(typeof (_22)!="string"||typeof (_23)!="function"){
return;
}
this.tc.unsubscribeEvent(_22,_23);
};
KrakMap.API.prototype.utmToDegrees=function(_24){
return this.tc.utmToDegrees(_24);
};
KrakMap.API.prototype.geoToPixelCoordinate=function(_25){
if(!KrakMap.Util.validateCoordinate(_25)){
return;
}
return this.tc.geoToPixelCoordinate(_25.x,_25.y);
};
KrakMap.API.prototype.pixelToGeoCoordinate=function(_26){
if(!KrakMap.Util.validateCoordinate(_26)){
return;
}
return this.tc.pixelToGeoCoordinate(_26.x,_26.y);
};
KrakMap.API.prototype.getMapViewCenter=function(){
return this.tc.getMapViewCenter();
};
KrakMap.API.prototype.setMapViewCenter=function(_27){
this.jump(_27,this.getZoomLevel(),this.getMapType(),this.getObliqueDirection());
};
KrakMap.API.prototype.getMapViewExtent=function(){
return this.tc.getMapViewExtent();
};
KrakMap.API.prototype.setMapViewExtent=function(_28,_29){
if(KrakMap.Util.validateExtent(_28)){
if(typeof (_29)=="number"&&isFinite(_29)){
this.tc.jumpToExtentWithBuffer(_28,_29);
}else{
this.tc.jumpToExtent(_28);
}
}else{
return;
}
};
KrakMap.API.prototype.getMapType=function(){
return this.tc.getMapType();
};
KrakMap.API.prototype.setMapType=function(_2a){
if(!KrakMap.Util.validateMapType(_2a)){
return;
}
this.tc.changeMapType(_2a);
};
KrakMap.API.prototype.getObliqueDirection=function(){
if(this.tc.obliqueResponse){
return this.tc.obliqueResponse.direction;
}
return null;
};
KrakMap.API.prototype.setObliqueDirection=function(_2b){
if(!KrakMap.Util.validateObliqueDirection(_2b)){
return;
}
this.tc.changeMapType("oblique",_2b);
};
KrakMap.API.prototype.getZoomLevel=function(){
return this.tc.getCurrentZoomLevel();
};
KrakMap.API.prototype.setZoomLevel=function(_2c){
if(!(typeof (_2c)=="number"&&isFinite(_2c))){
return;
}
this.tc.zoomToLevel(_2c);
};
KrakMap.API.prototype.getMetersPerPixel=function(){
return this.getZoomLevels()[this.getZoomLevel()];
};
KrakMap.API.prototype.setMetersPerPixel=function(_2d){
if(!(typeof (_2d)=="number"&&isFinite(_2d))){
return;
}
var _2e=this.getZoomLevels();
var _2f=0;
for(var i=0;i<_2e.length;i++){
if(_2e[i]<=_2d&&i>_2f){
_2f=i;
}
}
this.tc.zoomToLevel(_2f);
};
KrakMap.API.prototype.getMinZoomLevel=function(){
return this.getZoomLevels()[this.tc.getMinZoomLevel()];
};
KrakMap.API.prototype.setMinZoomLevel=function(_31){
if(!(typeof (_31)=="number"&&isFinite(_31))){
return;
}
var _32=this.getZoomLevels();
var _33=_32.length;
for(var i=_32.length-1;i>=0;i--){
if(_32[i]>=_31){
_33=i;
}
}
this.tc.setMinZoomLevel(_33);
};
KrakMap.API.prototype.getMaxZoomLevel=function(){
return this.getZoomLevels()[this.tc.getMaxZoomLevel()];
};
KrakMap.API.prototype.setMaxZoomLevel=function(_35){
if(!(typeof (_35)=="number"&&isFinite(_35))){
return;
}
var _36=this.getZoomLevels();
var _37=0;
for(var i=0;i<_36.length;i++){
if(_36[i]<=_35){
_37=i;
}
}
this.tc.setMaxZoomLevel(_37);
};
KrakMap.API.prototype.getRectangleExtent=function(){
return this.tc.getMeasuredExtent();
};
KrakMap.API.prototype.getPolygonPoints=function(){
return this.tc.polygonWKTString;
};
KrakMap.API.prototype.getCircleCenter=function(){
return this.tc.circleCenter;
};
KrakMap.API.prototype.getCircleRadius=function(){
return this.tc.circleRadius;
};
KrakMap.API.prototype.getMeasureToolPoints=function(){
return this.tc.measureLineCoordinates;
};
KrakMap.API.prototype.getMeasureToolLength=function(){
return this.tc.measureLineLength;
};
KrakMap.API.prototype.getMapGridExtent=function(){
return this.tc.getMapGridExtent();
};
KrakMap.API.prototype.getMousePosition=function(){
return this.tc.getMousePosition();
};
KrakMap.API.prototype.getZoomLevels=function(){
return this.tc.getZoomLevels();
};
KrakMap.API.prototype.setBookmark=function(_39,_3a,_3b,_3c){
this.tc.setToolbarCenterButtonCoordinate(_39,_3a,_3b,_3c);
};
KrakMap.API.prototype.setPrintAction=function(_3d){
if(typeof (_3d)!="function"){
return;
}
this.tc.setPrintAction(_3d);
};

KrakMap.Poi=function(_1,_2,_3,_4,_5){
if(!KrakMap.Util.validateCoordinate(_2)||typeof (_3)!="string"||!(_4&&typeof (_4)=="number"&&isFinite(_4))||!(_5&&typeof (_5)=="number"&&isFinite(_5))){
return;
}
var _6={dom:_1,coordinate:_2,category:_3};
if(_4&&_5){
_6.width=_4;
_6.height=_5;
}
return _6;
};

KrakMap.Util={};
KrakMap.Util.validateCoordinate=function(_1){
if(_1&&typeof (_1)=="object"&&isFinite(_1.x)&&isFinite(_1.y)&&typeof (_1.x)=="number"&&typeof (_1.y)=="number"){
return true;
}
return false;
};
KrakMap.Util.validateExtent=function(_2){
if(_2&&typeof (_2)=="object"&&isFinite(_2.top)&&isFinite(_2.bottom)&&isFinite(_2.left)&&isFinite(_2.right)&&typeof (_2.top)=="number"&&typeof (_2.bottom)=="number"&&typeof (_2.left)=="number"&&typeof (_2.right)=="number"){
return true;
}
return false;
};
KrakMap.Util.validateMapType=function(_3){
if(_3&&typeof (_3)=="string"&&(_3=="kvec"||_3=="ovc"||_3=="ortho"||_3=="oblique")){
return true;
}
return false;
};
KrakMap.Util.validateObliqueDirection=function(_4){
if(_4&&typeof (_4)=="string"&&(_4=="n"||_4=="s"||_4=="e"||_4=="w")){
return true;
}
return false;
};
KrakMap.Util.validatePoi=function(_5){
if(_5&&KrakMap.Util.validateCoordinate(_5.coordinate)&&typeof (_5.category)=="string"&&(_5.width&&typeof (_5.width)=="number"&&isFinite(_5.width))&&(_5.height&&typeof (_5.height)=="number"&&isFinite(_5.height))){
return true;
}
return false;
};

KrakMap.TileClient=function(_1){
this.tileVersion="1";
this.mapTypes=["kvec","ovc","ortho","oblique"];
this.settings=_1;
this.imgDir="http://tileclient.krak.dk/static/v3/img/";
if(_1.imgDir){
this.imgDir=_1.imgDir;
}
this.isPrint=false;
this.perspective=true;
if(_1&&_1.obliqueSettings&&typeof (_1.obliqueSettings.perspective)!="undefined"){
this.perspective=_1.obliqueSettings.perspective;
}
this.placeHolder=jQuery(_1.mapContainer);
var _2=this.placeHolder.width()-2;
var _3=this.placeHolder.height()-2;
this.Container=jQuery("<div></div>").css({overflow:"hidden",position:"relative",width:_2,height:_3}).appendTo(this.placeHolder);
if(!_1.mainMap){
this.Container.css({border:"1px solid #D8D8D8"});
}
this.toolbarContainer=null;
if(!_1.mainMap&&_1.toolBarSettings){
this.toolbarContainer=jQuery("<div></div>").css({position:"absolute",width:_2,left:0,top:0,zIndex:1}).appendTo(this.Container);
}
this.mapContainer=jQuery("<div></div>").css({position:"absolute",width:_2,height:_3,left:0,top:0,overflow:"hidden"}).appendTo(this.Container);
if(!_1.mainMap&&_1.toolBarSettings){
this.mapContainer.css({height:_3-20,left:0,top:20});
}
this.obliquePlaces=null;
var _4=this;
if(!_1.mainMap){
this.Container.css({border:"1px solid #D8D8D8"});
if(_1.toolBarSettings){
this.toolbarContainer=jQuery("<div></div>").css({position:"absolute",width:_2,left:0,top:0,zIndex:1}).appendTo(this.Container);
this.mapContainer.css({height:_3-20,left:0,top:20});
}
this.messageBoard=new KrakMap.MessageBoard(this);
this.initObliqueService();
this.ObliqueService.getBestPhotoPlaces(function(){
if(_4.mapType!="oblique"&&_4.toolbar&&_4.toolbar.oblique){
_4.toolbar.obliqueAvailable(_4);
}
});
this.obliqueResponse=null;
if(jQuery.browser.opera||(jQuery.browser.safari&&parseInt(jQuery.browser.version)<523)){
this.grabCursor="move";
this.grabbingCursor="move";
this.crosshairCursor="crosshair";
}else{
if(jQuery.browser.safari){
this.grabCursor="url("+this.imgDir+"cursors/cursor_grab.cur) 11 12,move";
this.grabbingCursor="url("+this.imgDir+"cursors/cursor_grabbing.cur) 10 12,move";
this.crosshairCursor="url("+this.imgDir+"cursors/cursor_crosshair.cur) 15 14,crosshair";
}else{
this.grabCursor="url("+this.imgDir+"cursors/cursor_grab.cur),move";
this.grabbingCursor="url("+this.imgDir+"cursors/cursor_grabbing.cur),move";
this.crosshairCursor="url("+this.imgDir+"cursors/cursor_crosshair.cur),crosshair";
}
}
}
this.eventCatcher=null;
this.gridContainer=jQuery("<div></div>").css({position:"absolute",zIndex:0}).appendTo(this.mapContainer);
this.gridContainerDomStyle=this.gridContainer.get(0).style;
this.mapGrid=jQuery("<div></div>").css({position:"absolute",zIndex:1}).appendTo(this.gridContainer);
this.mapGridDom=this.mapGrid.get(0);
this.zoomGrid=jQuery("<div></div>").css({position:"absolute",zIndex:0}).appendTo(this.gridContainer);
this.poiLayerContainer=jQuery("<div></div>").css({position:"absolute",zIndex:3}).appendTo(this.mapContainer);
this.poiLayerContainerDomStyle=this.poiLayerContainer.get(0).style;
this.mapContainerPixelWidth=this.mapContainer.width();
this.mapContainerPixelHeight=this.mapContainer.height();
if(!_1.mainMap){
this.logo=jQuery("<img></img>").attr("src",this.imgDir+"Krak_logo.gif").css({position:"absolute",zIndex:"1",right:5,bottom:15}).appendTo(this.mapContainer);
this.copyright=jQuery("<div></div>").css({position:"absolute",zIndex:1,right:0,bottom:0,whiteSpace:"nowrap",color:"black",fontSize:9,fontFamily:"Verdana, Arial, Helvetica, sans-serif"}).appendTo(this.mapContainer);
}
var _4=this;
if(!_1.mainMap){
var _5=(jQuery.browser.msie?{backgroundImage:"url("+this.imgDir+"transparent.gif)"}:{backgroundColor:"transparent"});
this.eventCatcher=jQuery("<div></div>").css({position:"absolute",width:this.mapContainer.width(),height:this.mapContainer.height(),zIndex:"2",cursor:this.grabCursor}).css(_5).html("&nbsp;").appendTo(this.mapContainer);
this.eventCatcher.bind("mousedown",function(_6){
_4.mapMoveMousedown(_6);
});
this.eventCatcher.bind("mousemove",function(_7){
_4.trackMousemove(_7);
});
this.eventCatcher.bind("dblclick",function(_8){
_4.zoomByDoubleClick(_8);
});
this.eventCatcher.bind("click",function(){
_4.throwEvent("clicked");
});
this.eventCatcher.mousewheel(function(_9,_a){
_4.zoomWithMouseWheel(_9,_a);
return false;
});
}
if(_1.zoomLevels){
this.zoomLevels=_1.zoomLevels;
}else{
this.zoomLevels=[0.125,0.25,0.5,1,2,4,8,16,32,64,128,256,512,1024];
}
this.currentZoomLevel=-1;
this.mapType="kvec";
this.minZoomLevel=0;
if(_1.minZoomLevel){
this.minZoomLevel=Number(_1.minZoomLevel);
}
this.maxZoomLevel=this.zoomLevels.length-1;
if(_1.maxZoomLevel){
this.maxZoomLevel=Number(_1.maxZoomLevel);
}
var _b=1;
this.vectorMinZoomLevel=0;
for(var i=0;i<this.zoomLevels.length;i++){
if(this.zoomLevels[i]<=_b&&i>this.vectorMinZoomLevel){
this.vectorMinZoomLevel=i;
}
}
this.metersPerPixel=0;
this.tilePixelWidth=256;
this.tilePixelHeight=256;
this.tileMeterWidth=0;
this.tileMeterHeight=0;
this.bufferSize=0;
if(_1.bufferSize){
this.bufferSize=Number(_1.bufferSize);
}
this.mapGridTilesWidth=0;
this.mapGridTilesHeight=0;
this.fullExtent=new KrakMap.Extent(6413000,6033000,437500,902500);
this.tileExtent=new KrakMap.Extent(0,0,0,0);
this.mapGridExtent=new KrakMap.Extent(0,0,0,0);
this.mapGridPixelExtent=new KrakMap.Extent(0,0,0,0);
this.mapViewExtent=new KrakMap.Extent(0,0,0,0);
this.mapGridCenter=new KrakMap.Coordinate(0,0);
this.mapViewCenter=new KrakMap.Coordinate(0,0);
this.mapGridTopLeftCoordinate=new KrakMap.Coordinate(0,0);
this.customTiles={};
this.eventReceivers={};
this.eventSubscriptions={};
this.updateTimer=null;
this.zoomTimer=null;
this.deltaZoom=0;
this.domainDistroServers=new Array("tile10.krak.dk","tile11.krak.dk","tile12.krak.dk","tile13.krak.dk");
if(_1.domainDistroServers){
this.domainDistroServers=_1.domainDistroServers;
}
this.distributionBase=8;
this.mousePositionX=0;
this.mousePositionY=0;
this.measuredExtent=new KrakMap.Extent(0,0,0,0);
this.measureBox=false;
this.navigationKeys=false;
this.toolbar={};
this.toolBarSettings={};
if(!_1.mainMap&&_1.toolBarSettings){
this.toolBarSettings=_1.toolBarSettings;
this.createToolbar(_1.toolBarSettings);
}
this.overviewMap=null;
this.viewIndicator=null;
this.overviewMapContainer=null;
this.overviewMapSettings={};
if(_1.overviewMapSettings){
this.overviewMapSettings=_1.overviewMapSettings;
}
this.mainMap=null;
if(_1.mainMap){
this.mainMap=_1.mainMap;
}
this.viewIndicator=null;
this.animateMoveTimer=null;
this.animateMoveStepTo={};
this.targetPixelCoordinate=new KrakMap.Coordinate(null,null);
this.scrollDirection={horizontal:"",vertical:""};
this.scrollSpeed=5;
this.animateScrollTimer=null;
this.routeFallBack=false;
if(_1.routeFallBack){
this.routeFallBack=_1.routeFallBack;
}
this.route=null;
this.routeWkt=null;
this.routeSearchContainer=null;
this.routeSearchOpen=false;
this.poiLayers=new Object();
this.poiGeneratedId=1;
this.polygonDrawEnabled=false;
this.polygonDrawCoordinates=[];
this.polygonDrawStartPointX=0;
this.polygonDrawStartPointY=0;
this.polygonWKTString="";
this.polygonDrawTempRoute=null;
this.polygonDrawPoints=null;
this.circleDrawEnabled=false;
this.measureLineEnabled=false;
this.measureLineCoordinates=[];
this.measureLineStartPointX=0;
this.measureLineStartPointY=0;
this.measureLineWKTString="";
this.measureLineTempRoute=null;
this.measureLinePoints=null;
this.measureLineLength=0;
this.circleCenter=null;
this.circleRadius=null;
this.circleApproximationEdges=64;
this.circleSegmentLength=2*Math.PI/this.circleApproximationEdges;
this.nonObliqueZoomLevels=this.zoomLevels.concat();
this.nonObliqueFullExtent=new KrakMap.Extent(this.fullExtent.top,this.fullExtent.bottom,this.fullExtent.left,this.fullExtent.right);
if(!this.mainMap){
if(_1.startingPoint){
var sp=_1.startingPoint;
this.jumpToCoordinate(sp.zoomLevel,sp.coordinate.x,sp.coordinate.y,sp.mapType,sp.direction);
}else{
this.jumpToFullExtent();
}
}
this.firstJump=true;
return new KrakMap.API(this);
};
KrakMap.TileClient.prototype.initObliqueService=function(){
if(!this.ObliqueService){
this.ObliqueService=new KrakMap.ObliqueService(this);
}
};
KrakMap.TileClient.prototype.buildGrid=function(){
this.throwEvent("beforeBuildingGrid");
this.throwEvent("buildingGrid");
this.redrawPoiLayers();
if(this.mainMap==null){
this.updateCopyright();
}
if(this.overviewMap){
var _e=this.overviewMap;
clearInterval(this.animateMoveTimer);
clearInterval(this.animateScrollTimer);
clearInterval(_e.animateMoveTimer);
clearInterval(_e.animateScrollTimer);
if(this.mapType=="oblique"){
var _f=this.obliquePixelToGeoCoordinates(new KrakMap.Coordinate(this.mapViewCenter.x,this.obliqueResponse.actualpixeldimensions[1]-this.mapViewCenter.y));
}else{
var _f=this.mapViewCenter;
}
_e.jumpToCoordinate(this.currentZoomLevel+this.overviewMapSettings.elevation,_f.x,_f.y,"kvec");
}
var _10=this.mapGridTilesWidth;
var _11=this.mapGridTilesHeight;
var _12=this.mapGridExtent;
var _13=this.metersPerPixel;
var _14=this.tilePixelWidth;
var _15=this.tilePixelHeight;
var _16=this.mapGridPixelExtent.bottom;
var _17=this.tileExtent;
var _18=this.tileMeterWidth;
var _19=this.tileMeterHeight;
var _1a=this.mapType;
var _1b=this.domainDistroServers;
var _1c=this.mapGridDom;
var _1d=this.tileVersion;
var _1e=this.customTiles;
var _1f=document.createDocumentFragment();
for(key in _1e){
_1e[key].documentFragment=document.createDocumentFragment();
_1e[key].container.empty();
}
if(this.mapType=="oblique"){
var _20=((Math.floor(this.mapGridExtent.bottom/_15))*this.obliqueResponse.tiledimensions[0])+(Math.floor(this.mapGridExtent.left/_14));
var _21=this.obliqueResponse;
var _22=this.ObliqueService;
var _23=this.currentZoomLevel;
var _24=this;
var _25=function(x,y){
return _20+x+(y*_24.obliqueResponse.tiledimensions[0]);
};
}
_1c.innerHTML="";
for(var i=0;i<_10;i++){
for(var j=0;j<_11;j++){
var _2a=_12.left+(_13*_14*i);
var _2b=_12.bottom+(_13*_15*j);
if(_2a>=_17.left&&_2a<=_17.right-_18&&_2b>=_17.bottom&&_2b<=_17.top-_19){
if(_1a!="oblique"){
var _2c=_14*i;
var _2d=_16-(_15*(j+1));
var _2e=(((_2a-_17.left)/_18)+((_2b-_17.bottom)/_18));
var _2f=_2e%_1b.length;
var _30=_2e%this.distributionBase;
var _31=document.createElement("img");
var _32=_31.style;
_31.src="http://"+_1b[_2f]+"/"+_30+"/"+_1a+"/"+_13.toFixed(2)+"/"+_2a.toFixed(2)+"/"+_2b.toFixed(2)+"/v"+_1d;
_31.id=_2a.toFixed(0)+"_"+_2b.toFixed(0);
_32.position="absolute";
_32.left=_2c+"px";
_32.top=_2d+"px";
_32.width=_14+"px";
_32.height=_15+"px";
_1f.appendChild(_31);
for(key in _1e){
if(_1e[key].show){
var _31=document.createElement("img");
var _32=_31.style;
var url=_1e[key].url.replace("#LEFT#",_2a.toFixed(2));
url=url.replace("#BOTTOM#",_2b.toFixed(2));
_31.src=url.replace("#MPP#",_13.toFixed(2));
_31.id=_2a.toFixed(0)+"_"+_2b.toFixed(0)+"_"+key;
_32.position="absolute";
_32.left=_2c+"px";
_32.top=_2d+"px";
_32.width=_14+"px";
_32.height=_15+"px";
_1e[key].documentFragment.appendChild(_31);
}
}
}else{
if(this.mapType=="oblique"){
var _2c=_14*i;
var _2d=_16-(_15*(j+1));
var _34=_25(i,j);
var _2e=(Math.floor(_34/_21.tiledimensions[0]))+(_34%_21.tiledimensions[0]);
var _2f=_2e%_1b.length;
var _30=_2e%this.distributionBase;
var _31=document.createElement("img");
var _32=_31.style;
_31.src="http://"+_1b[_2f]+"/oblique/"+_30+"/"+_21.direction+"/"+_22.zoomLevels[_23]+"/"+_21.filename+"/"+_34+".jpg";
_31.id="obliqueTile"+_25(i,j);
_32.position="absolute";
_32.left=_2c+"px";
_32.top=_2d+"px";
_32.width=_14+"px";
_32.height=_15+"px";
_1f.appendChild(_31);
}
}
}
}
}
_1c.appendChild(_1f);
for(key in _1e){
_1e[key].container.get(0).appendChild(_1e[key].documentFragment);
_1e[key].documentFragment=null;
}
this.throwEvent("afterBuildingGrid");
};
KrakMap.TileClient.prototype.alignTiles=function(){
if(this.mapType!="oblique"){
switch(this.zoomLevels[this.currentZoomLevel]){
case 0.125:
return new KrakMap.Extent(6413000,6033000,427480,902520);
break;
case 0.25:
return new KrakMap.Extent(6413048,6032952,427464,902536);
break;
case 0.5:
return new KrakMap.Extent(6413016,6032984,427496,902504);
break;
case 1:
return new KrakMap.Extent(6413080,6032920,427304,902696);
break;
case 2:
return new KrakMap.Extent(6413208,6032792,427176,902824);
break;
case 4:
return new KrakMap.Extent(6413976,6032024,426920,903080);
break;
case 8:
return new KrakMap.Extent(6414488,6031512,426408,903592);
break;
case 16:
return new KrakMap.Extent(6413464,6032536,425384,904616);
break;
case 32:
return new KrakMap.Extent(6415512,6030488,423336,906664);
break;
case 64:
return new KrakMap.Extent(6427800,6018200,427432,902568);
break;
case 128:
return new KrakMap.Extent(6435992,6010008,419240,910760);
break;
case 256:
return new KrakMap.Extent(6452376,5993624,370088,959912);
break;
case 512:
return new KrakMap.Extent(6419608,6026392,337320,992680);
break;
case 750:
return new KrakMap.Extent(6511000,5935000,377000,953000);
break;
case 1024:
return new KrakMap.Extent(6616216,5829784,271784,1058216);
break;
case 2048:
return new KrakMap.Extent(6485144,5960856,402856,927144);
break;
case 3328:
return new KrakMap.Extent(6648984,5797016,239016,1090984);
break;
default:
var _35=this.fullExtent;
var _36=new KrakMap.Coordinate((_35.left+_35.right)/2,(_35.bottom+_35.top)/2);
var _37=this.zoomLevels[this.currentZoomLevel]*this.tilePixelWidth;
var _38=_37/2;
var _39=new KrakMap.Extent(_36.y+_38,_36.y-_38,_36.x-_38,_36.x+_38);
var _3a=new KrakMap.Extent(0,0,0,0);
if(_39.left<_35.left){
_3a.left=_39.left;
}else{
_3a.left=_39.left-(Math.ceil(Math.abs(_39.left-_35.left)/_37)*_37);
}
if(_39.bottom<_35.bottom){
_3a.bottom=_39.bottom;
}else{
_3a.bottom=_39.bottom-(Math.ceil(Math.abs(_39.bottom-_35.bottom)/_37)*_37);
}
if(_39.right>_35.right){
_3a.right=_39.right;
}else{
_3a.right=_39.right+(Math.ceil(Math.abs(_35.right-_39.right)/_37)*_37);
}
if(_39.top>_35.top){
_3a.top=_39.top;
}else{
_3a.top=_39.top+(Math.ceil(Math.abs(_35.top-_39.top)/_37)*_37);
}
_3a.left=Math.round(_3a.left*100)/100;
_3a.bottom=Math.round(_3a.bottom*100)/100;
_3a.right=Math.round(_3a.right*100)/100;
_3a.top=Math.round(_3a.top*100)/100;
return _3a;
break;
}
}else{
return new KrakMap.Extent(this.obliqueResponse.actualpixeldimensionswithblackborder[1],0,0,this.obliqueResponse.actualpixeldimensionswithblackborder[0]);
}
};
KrakMap.TileClient.prototype.validateExtent=function(){
var _3b=this.fullExtent;
var _3c=this.mapViewExtent;
var _3d=new KrakMap.Coordinate((_3b.right+_3b.left)/2,(_3b.top+_3b.bottom)/2);
if(_3b.top<_3c.top){
this.mapViewCenter.y=this.mapViewCenter.y-(_3c.top-_3b.top);
}
if(_3b.bottom>_3c.bottom){
this.mapViewCenter.y=this.mapViewCenter.y+(_3b.bottom-_3c.bottom);
}
if(_3b.left>_3c.left){
this.mapViewCenter.x=this.mapViewCenter.x+(_3b.left-_3c.left);
}
if(_3b.right<_3c.right){
this.mapViewCenter.x=this.mapViewCenter.x-(_3c.right-_3b.right);
}
if(_3b.right-_3b.left<_3c.right-_3c.left){
this.mapViewCenter.x=_3d.x;
}
if(_3b.top-_3b.bottom<_3c.top-_3c.bottom){
this.mapViewCenter.y=_3d.y;
}
this.calculateMapViewAndGridExtent();
};
KrakMap.TileClient.prototype.calculateMapViewAndGridExtent=function(){
var _3e=this.metersPerPixel;
var _3f=this.mapViewExtent;
var _40=this.mapViewCenter;
var _41=this.mapContainerPixelWidth;
var _42=this.mapContainerPixelHeight;
var _43=this.mapGridExtent;
var _44=this.tileExtent;
var _45=this.tileMeterWidth;
var _46=this.tileMeterHeight;
var _47=this.bufferSize;
_3f.top=_40.y+(_42*_3e/2);
_3f.bottom=_40.y-(_42*_3e/2);
_3f.left=_40.x-(_41*_3e/2);
_3f.right=_40.x+(_41*_3e/2);
_43.bottom=_44.bottom+(Math.floor((_3f.bottom-_44.bottom)/_46)*_46)-(_47*_46);
_43.top=_44.top-(Math.floor((_44.top-_3f.top)/_46)*_46)+(_47*_46);
_43.left=_44.left+(Math.floor((_3f.left-_44.left)/_45)*_45)-(_47*_45);
_43.right=_44.right-(Math.floor((_44.right-_3f.right)/_45)*_45)+(_47*_45);
this.mapGridTopLeftCoordinate.x=_43.left;
this.mapGridTopLeftCoordinate.y=_43.top;
this.mapViewExtent=_3f;
this.mapGridExtent=_43;
};
KrakMap.TileClient.prototype.addTile=function(_48,_49,_4a,_4b){
var _4c=this.metersPerPixel;
var _4d=this.tilePixelWidth;
var _4e=this.tilePixelHeight;
var _4f=this.mapGridPixelExtent.bottom;
var _50=this.tileExtent;
var _51=this.domainDistroServers;
var _52=this.tileMeterWidth;
var _53=this.tileMeterHeight;
var _54=this.mapType;
var _55=this.mapGridDom;
var _56=this.tileVersion;
if(_54=="oblique"){
var _57=this.obliqueResponse;
var _58=this.ObliqueService;
var _59=this.currentZoomLevel;
}
if(_48>=_50.left&&_48<=_50.right-_52&&_49>=_50.bottom&&_49<=_50.top-_53){
if(_54!="oblique"){
var _5a=(((_48-_50.left)/_52)+((_49-_50.bottom)/_52));
var _5b=_5a%_51.length;
var _5c=_5a%this.distributionBase;
var _5d=document.createElement("img");
var _5e=_5d.style;
_5d.src="http://"+_51[_5b]+"/"+_5c+"/"+_54+"/"+_4c.toFixed(2)+"/"+_48.toFixed(2)+"/"+_49.toFixed(2)+"/v"+_56;
_5d.id=_48.toFixed(0)+"_"+_49.toFixed(0);
_5e.position="absolute";
_5e.left=_4a+"px";
_5e.top=_4b+"px";
_5e.width=_4d+"px";
_5e.height=_4e+"px";
_55.appendChild(_5d);
var _5f=this.customTiles;
for(key in _5f){
if(_5f[key].show){
var _5d=document.createElement("img");
var _5e=_5d.style;
var url=_5f[key].url.replace("#LEFT#",_48.toFixed(2));
url=url.replace("#BOTTOM#",_49.toFixed(2));
_5d.src=url.replace("#MPP#",_4c.toFixed(2));
_5d.id=_48.toFixed(0)+"_"+_49.toFixed(0)+"_"+key;
_5e.position="absolute";
_5e.left=_4a+"px";
_5e.top=_4b+"px";
_5e.width=_4d+"px";
_5e.height=_4e+"px";
_5f[key].container.append(_5d);
}
}
}else{
if(_54=="oblique"){
var _5d=document.createElement("img");
var _5e=_5d.style;
var _61=((Math.ceil(_49/_4e))*_57.tiledimensions[0])+(Math.ceil(_48/_4d));
var _5a=(Math.floor(_61/_57.tiledimensions[0]))+(_61%_57.tiledimensions[0]);
var _5c=_5a%this.distributionBase;
_5d.src="http://"+_51[0]+"/oblique/"+_5c+"/"+_57.direction+"/"+_58.zoomLevels[_59]+"/"+_57.filename+"/"+_61+".jpg";
_5d.id="obliqueTile"+_61;
_5e.position="absolute";
_5e.left=_4a+"px";
_5e.top=_4b+"px";
_5e.width=_4d+"px";
_5e.height=_4e+"px";
_55.appendChild(_5d);
}
}
}
};
KrakMap.TileClient.prototype.updateCopyright=function(){
var _62=this.metersPerPixel;
var _63="";
switch(this.mapType){
case "kvec":
_63="&copy; Kraks Forlag AS &copy; D.A.V.";
break;
case "ortho":
_63="&copy; COWI";
break;
case "ovc":
_63="&copy; Kraks Forlag AS &copy; D.A.V. &copy; COWI";
break;
case "oblique":
_63="&copy; COWI";
break;
default:
_63="&copy; Kraks Forlag AS &copy; D.A.V. &copy; COWI";
break;
}
var _64={0.125:[80,"10 m"],0.25:[100,"25 m"],0.5:[100,"50 m"],1:[100,"100 m"],2:[100,"200 m"],3:[100,"300 m"],4:[100,"400 m"],8:[100,"800 m"],16:[94,"1,5 km"],32:[94,"3 km"],64:[94,"6 km"],128:[94,"12 km"],256:[98,"25 km"],512:[98,"50 km"],750:[100,"75 km"],1024:[98,"100 km"],2048:[98,"200 km"],3328:[90,"300 km"]};
if(_64[_62]==undefined){
if(_62>10){
_64[_62]=[100,(_62/10)+" km"];
}else{
_64[_62]=[100,(_62*100)+" m"];
}
}
if(this.mapType=="oblique"){
var _65="";
}else{
var _65="<img alt=\"\" src=\""+this.imgDir+"scale_end.gif\" width=\"1\" height=\"10\" border=\"0\"><img alt=\"\" src=\""+this.imgDir+"scale_middle.gif\" width=\""+_64[_62][0]+"\" height=\"10\" border=\"0\"><img alt=\"\" src=\""+this.imgDir+"scale_end.gif\" width=\"1\" height=\"10\" border=\"0\"> "+_64[_62][1];
}
this.copyright.html(_63+" "+_65);
};
KrakMap.TileClient.prototype.animateMove=function(obj,_67){
var _68=obj.gridContainerDomStyle;
var x=parseInt(_68.left);
var y=parseInt(_68.top);
if(this.mainMap){
var _6b=5;
}else{
if(this.overviewMap){
var _6b=60;
}
}
var _6c=Math.abs(_67.x-x);
var _6d=Math.abs(_67.y-y);
var _6e=Math.sqrt((_6c*_6c)+(_6d*_6d))/_6b;
var _6f=Math.round(_6c/_6e);
var _70=Math.round(_6d/_6e);
if(obj.mapViewExtent.left>=obj.fullExtent.left&&obj.mapViewExtent.right<=obj.fullExtent.right){
if(x+_6f<_67.x){
this.animateMoveStepTo.moveX=x+_6f;
}else{
if(x-_6f>_67.x){
this.animateMoveStepTo.moveX=x-_6f;
}else{
this.animateMoveStepTo.moveX=_67.x;
}
}
}else{
this.animateMoveStepTo.moveX=_67.x;
}
if(obj.mapViewExtent.top<=obj.fullExtent.top&&obj.mapViewExtent.bottom>=obj.fullExtent.bottom){
if(y+_70<_67.y){
this.animateMoveStepTo.moveY=y+_70;
}else{
if(y-_70>_67.y){
this.animateMoveStepTo.moveY=y-_70;
}else{
this.animateMoveStepTo.moveY=_67.y;
}
}
}else{
this.animateMoveStepTo.moveY=_67.y;
}
obj.mapMoveMousemove(null);
};
KrakMap.TileClient.prototype.scrollMap=function(){
clearInterval(this.animateScrollTimer);
var _71=this;
this.animateScrollTimer=setInterval(function(){
_71.animateScrollMap(_71,_71.scrollDirection);
},1);
};
KrakMap.TileClient.prototype.animateScrollMap=function(obj,_73){
var _74=obj.gridContainerDomStyle;
var _75={};
switch(_73.horizontal){
case "left":
_75.moveX=(parseInt(_74.left)+obj.scrollSpeed);
break;
case "right":
_75.moveX=(parseInt(_74.left)-obj.scrollSpeed);
break;
default:
_75.moveX=parseInt(_74.left);
break;
}
switch(_73.vertical){
case "up":
_75.moveY=(parseInt(_74.top)+obj.scrollSpeed);
break;
case "down":
_75.moveY=(parseInt(_74.top)-obj.scrollSpeed);
break;
default:
_75.moveY=parseInt(_74.top);
break;
}
obj.animateMoveStepTo=_75;
obj.mapMoveMousemove(null);
};
KrakMap.TileClient.prototype.getPoiLayer=function(_76){
if(this.poiLayers[_76]){
return this.poiLayers[_76];
}
var _77=document.createElement("div");
_77.id=_76;
_77.style.position="absolute";
this.poiLayerContainer.get(0).appendChild(_77);
this.poiLayers[_76]=new KrakMap.PoiLayerData(_77);
return this.poiLayers[_76];
};
KrakMap.TileClient.prototype.sortPoiLayers=function(_78){
for(var i=0;i<_78.length;i++){
if(this.poiLayers[_78[i]]){
this.poiLayers[_78[i]].layer.style.zIndex=i;
}
}
};
KrakMap.TileClient.prototype.isPoiLayer=function(_7a){
if(this.poiLayers&&this.poiLayers[_7a]&&this.poiLayers[_7a].layer.style.display!="none"){
return true;
}
return false;
};
KrakMap.TileClient.prototype.redrawPoiLayers=function(){
var _7b=this.poiLayers;
for(layerKey in _7b){
for(poiKey in _7b[layerKey].pois){
var _7c=this.geoToPixelCoordinate(_7b[layerKey].pois[poiKey].x,_7b[layerKey].pois[poiKey].y);
if(this.mapType=="oblique"){
_7b[layerKey].pois[poiKey].poi.style.display="none";
}else{
var _7d=_7b[layerKey].pois[poiKey].poi.style;
_7d.left=Math.round(_7c.x-_7b[layerKey].pois[poiKey].width/2)+"px";
_7d.top=Math.round(_7c.y-_7b[layerKey].pois[poiKey].height/2)+"px";
_7d.display="block";
}
}
}
};
KrakMap.TileClient.prototype.createToolbar=function(_7e){
this.toolbar.container=jQuery("<div></div>").css({height:"19px",borderTop:"1px solid #D8D8D8",borderBottom:"1px solid #D8D8D8",background:"url("+this.imgDir+"toolbar/gfx_bgtile_maptoolbar.gif) left center repeat-x"}).appendTo(this.toolbarContainer);
this.toolbar.group1=jQuery("<span></span>").css({borderRight:"1px solid #D8D8D8","float":"left",display:"block",width:"auto"}).appendTo(this.toolbar.container);
this.toolbar.group2=jQuery("<span></span>").css({"float":"right",display:"block",width:"auto"}).appendTo(this.toolbar.container);
this.toolbar.group3=jQuery("<span></span>").css({"float":"right",display:"block",width:"auto"}).appendTo(this.toolbar.container);
this.toolbar.group4=jQuery("<span></span>").css({"float":"right",display:"block",width:"auto"}).appendTo(this.toolbar.container);
jQuery("<div></div>").css({position:"absolute",left:"0px",top:"0px",height:"5px",width:"100%",margin:"0pt",padding:"0pt",zIndex:10,background:"transparent url("+this.imgDir+"toolbar/shadow.png) repeat-x scroll left top"}).appendTo(this.mapContainer);
var _7f=function(obj){
return jQuery("<a></a>").css({background:"transparent url("+obj.imgDir+"toolbar/gfx_bgimage_mapbuttons.gif) repeat-x scroll 0pt",backgroundPosition:"0pt 0pt",borderLeft:"1px solid #D8D8D8",color:"#737373",display:"block","float":"left",fontSize:"10px",height:"20px",lineHeight:"20px",padding:"0pt 8px",margin:"0pt",display:"block",textDecoration:"none",cursor:"pointer"}).attr("href","# ");
};
var _81=function(obj,_83,_84){
return jQuery("<span></span>").css({backgroundPosition:"50%",backgroundRepeat:"no-repeat",backgroundImage:"url("+obj.imgDir+"toolbar/"+_83+")",textIndent:"-3000px",width:"15px",display:"block",margin:"0pt",padding:"0pt",color:"#737373",fontSize:"10px",lineHeight:"20px",textAlign:"left"}).text(_84);
};
var _85=this;
if(_7e.kvec){
this.toolbar.kvec=_7f(this).text("Kort").attr("title","Vektor kort").appendTo(this.toolbar.group1);
this.toolbar.kvec.bind("click",function(){
if(_85.getMapType()!="kvec"){
_85.changeMapType("kvec");
}
return false;
});
}
if(_7e.ortho){
this.toolbar.ortho=_7f(this).text("Foto").attr("title","Luftfoto").appendTo(this.toolbar.group1);
this.toolbar.ortho.bind("click",function(){
if(_85.getMapType()!="ortho"){
_85.changeMapType("ortho");
}
return false;
});
}
if(_7e.ovc){
this.toolbar.ovc=_7f(this).text("Kombi").attr("title","Kort og luftfoto").appendTo(this.toolbar.group1);
this.toolbar.ovc.bind("click",function(){
if(_85.getMapType()!="ovc"){
_85.changeMapType("ovc");
}
return false;
});
}
if(_7e.oblique){
this.toolbar.oblique=_7f(this).html("Skr&aring;foto").attr("title","Skr\xe5foto").css({color:"#AAD",cursor:"default"}).appendTo(this.toolbar.group1);
this.toolbar.oblique.bind("click",function(){
if(_85.getMapType()!="oblique"&&_85.toolbar.isObliquePlace){
_85.changeMapType("oblique");
}
return false;
});
this.toolbar.isObliquePlace=false;
this.toolbar.obliqueAvailable=function(obj){
if(obj.mapType=="oblique"){
obj.toolbar.oblique.css({color:"#737373",cursor:"pointer"});
obj.toolbar.isObliquePlace=true;
}else{
if(obj.metersPerPixel<=2&&obj.ObliqueService.isAvailable(obj.mapViewCenter)){
obj.ObliqueService.getBestPhoto(0,obj.mapViewCenter.x,obj.mapViewCenter.y,"n",function(_87){
if(!_87.errorcode){
obj.toolbar.oblique.css({color:"#737373",cursor:"pointer"});
obj.toolbar.isObliquePlace=true;
}else{
obj.toolbar.oblique.css({color:"#AAD",cursor:"default"});
obj.toolbar.isObliquePlace=false;
}
});
}else{
obj.toolbar.oblique.css({color:"#AAD",cursor:"default"});
obj.toolbar.isObliquePlace=false;
}
}
};
this.getViewExtentUpdatedEvent(this,this.toolbar.obliqueAvailable);
this.getBuildingGridEvent(this,this.toolbar.obliqueAvailable);
}
if(this.toolbar[this.getMapType()]){
this.toolbar[this.getMapType()].css({color:"#71AAD5",fontWeight:"bold",backgroundPosition:"0px -20px"});
}
this.getMapTypeChangedEvent(this,function(obj){
obj.toolbar.group1.children().css({color:"#858585",fontWeight:"normal",backgroundPosition:"0px 0px"});
if(obj.toolbar[obj.getMapType()]){
obj.toolbar[obj.getMapType()].css({color:"#71AAD5",fontWeight:"bold",backgroundPosition:"0px -20px"});
}
});
if(_7e.zoom){
this.toolbar.zoomOut=_7f(this).html("&nbsp;").css({background:"transparent url("+this.imgDir+"toolbar/iconZoomOut.gif) no-repeat scroll 4px 6px",padding:"0pt",width:"16px"}).appendTo(this.toolbar.group2);
this.toolbar.zoomBar=jQuery("<span></span>").css({background:"transparent url("+this.imgDir+"toolbar/slideBar.gif) repeat-x scroll 100% 50%",display:"block","float":"left",height:"20px",position:"relative",width:"113px",margin:"0pt",padding:"0pt"}).appendTo(this.toolbar.group2);
this.toolbar.zoomBarEventcatcher=jQuery("<div></div>").css({cursor:"pointer",position:"absolute",width:"113px",height:"20px",zIndex:0,backgroundImage:"url("+this.imgDir+"transparent.gif)"}).appendTo(this.toolbar.zoomBar);
this.toolbar.zoomBarHandle=jQuery("<span></span>").css({background:"transparent url("+this.imgDir+"toolbar/iconSlider.gif) no-repeat scroll 50%",cursor:this.grabCursor,display:"block",height:"20px",left:"95px",position:"absolute",width:"18px",zIndex:1}).appendTo(this.toolbar.zoomBar);
this.toolbar.zoomIn=_7f(this).html("&nbsp;").css({background:"transparent url("+this.imgDir+"toolbar/iconZoomIn.gif) no-repeat scroll 4px 6px",padding:"0pt",width:"16px",border:"medium none"}).appendTo(this.toolbar.group2);
this.toolbar.adjustHandle=function(obj){
var _8a=obj.zoomLevelCheck(0);
if(obj.mapType=="oblique"){
var _8b=obj.ObliqueService.zoomLevels.length-1;
}else{
var _8b=obj.getMaxZoomLevel();
}
var _8c=(obj.toolbar.zoomBar.width()-obj.toolbar.zoomBarHandle.width())/(_8b-_8a);
if(obj.getCurrentZoomLevel()==_8a){
var _8d=Math.round(obj.toolbar.zoomBar.width()-obj.toolbar.zoomBarHandle.width());
}else{
if(obj.getCurrentZoomLevel()==_8b){
var _8d=0;
}else{
var _8d=_8c*(_8b-obj.getCurrentZoomLevel());
}
}
_85.toolbar.zoomBarHandle.css("left",Math.round(_8d)+"px");
};
this.toolbar.zoomBarMousedownAction=function(_8e){
var _8f=(_8e.pageX-_85.toolbar.zoomBar.offset().left);
var _90=_85.zoomLevelCheck(0);
var _91=(_85.toolbar.zoomBar.width())/(_85.getMaxZoomLevel()-_90);
var _92=_85.getMaxZoomLevel()-Math.round(_8f/_91);
if(!_8e.pageY&&_92==_85.currentZoomLevel){
_85.toolbar.adjustHandle(_85);
}else{
_85.zoomToLevel(_92);
}
};
this.getBuildingGridEvent(this,this.toolbar.adjustHandle);
this.toolbar.zoomIn.bind("click",function(){
_85.zoomToLevel(_85.getCurrentZoomLevel()-1);
return false;
});
this.toolbar.zoomOut.bind("click",function(){
_85.zoomToLevel(_85.getCurrentZoomLevel()+1);
return false;
});
this.toolbar.zoomBarEventcatcher.bind("mousedown",this.toolbar.zoomBarMousedownAction);
this.toolbar.zoomBarHandle.bind("mousedown",function(_93){
var x=_93.pageX;
var _95=_93.pageX-_85.toolbar.zoomBarHandle.offset().left;
var _96=parseInt(_85.toolbar.zoomBarHandle.css("left"));
var _97=function(_98){
if(_96+_98.pageX-x<0){
_85.toolbar.zoomBarHandle.css("left","0px");
}else{
if(_96+_98.pageX-x>(_85.toolbar.zoomBar.width()-_85.toolbar.zoomBarHandle.width())){
_85.toolbar.zoomBarHandle.css("left",(_85.toolbar.zoomBar.width()-_85.toolbar.zoomBarHandle.width())+"px");
}else{
_85.toolbar.zoomBarHandle.css("left",(_96+_98.pageX-x)+"px");
}
}
};
var _99=function(_9a){
_85.toolbar.zoomBarEventcatcher.unbind("mousemove").unbind("mouseup").unbind("mouseout");
_85.toolbar.zoomBarEventcatcher.css({zIndex:0,cursor:"pointer"});
_85.toolbar.zoomBarMousedownAction({pageX:_9a.pageX-_95+(_85.toolbar.zoomBarHandle.width()/2)});
};
_85.toolbar.zoomBarEventcatcher.css({zIndex:2,cursor:_85.grabbingCursor});
_85.toolbar.zoomBarEventcatcher.bind("mousemove",function(){RemoveTile()}).bind("mouseup",function(){RemoveTile()}).bind("mouseout",function(){RemoveTile()});
_85.toolbar.zoomBarEventcatcher.bind("mousemove",_97).bind("mouseup",_99).bind("mouseout",_99);
});
}
if(_7e.overviewMap){
var _9b=jQuery("<div></div>").css({position:"absolute",left:"-1px",bottom:"0px",zIndex:6,height:"19px",width:"20px",borderTop:"1px solid #D8D8D8",borderRight:"1px solid #D8D8D8",background:"url("+this.imgDir+"toolbar/gfx_bgtile_maptoolbar.gif) left center repeat-x"}).appendTo(this.mapContainer);
this.toolbar.overviewMap=_7f(this).html("&nbsp;").attr("title","Vis/Skjul oversigtskort").css({background:"transparent url("+this.imgDir+"toolbar/gfx_button_maptoggle.gif) no-repeat 2px 1px",padding:"0pt 8px"}).appendTo(_9b);
this.toolbar.overviewMap.bind("click",function(){
_85.toggleOverviewMap();
return false;
});
}
if(_7e.center){
this.toolbar.center=_7f(this).attr("title","Tilbage til udgangspunkt").html(_81(this,"gfx_bgimage_center.gif","Centr\xe9r")).appendTo(this.toolbar.group3);
}
if(_7e.print){
this.toolbar.print=_7f(this).attr("title","Udskriv kort").html(_81(this,"gfx_bgimage_print.gif","Print")).appendTo(this.toolbar.group3);
this.toolbar.print.bind("click",function(){
window.print();
return false;
});
}
if(_7e.polygonDraw){
this.toolbar.polygonDraw=_7f(this).attr("title","Mark\xe9r omr\xe5de").html(_81(this,"gfx_bgimage_polygon.gif","Polygon")).appendTo(this.toolbar.group4);
this.toolbar.polygonDraw.bind("click",function(){
_85.togglePolygonDraw();
return false;
});
}
if(_7e.radius){
this.toolbar.radius=_7f(this).attr("title","Mark\xe9r omr\xe5de").html(_81(this,"gfx_bgimage_radius.gif","Radius")).appendTo(this.toolbar.group4);
this.toolbar.radius.bind("click",function(){
_85.toggleCircleDraw();
return false;
});
}
if(_7e.measureTool){
this.toolbar.measureTool=_7f(this).attr("title","Mark\xe9r omr\xe5de").html(_81(this,"gfx_bgimage_meassure.gif","Measure")).appendTo(this.toolbar.group4);
this.toolbar.measureTool.bind("click",function(){
_85.toggleMeasureLine();
return false;
});
}
if(_7e.route){
this.toolbar.route=_7f(this).attr("title","Rute- og rejseplan").html(_81(this,"gfx_bgimage_route.gif","Ruteplan")).appendTo(this.toolbar.group4);
this.toolbar.route.bind("click",function(){
_85.toggleRouteSearch();
return false;
});
}
if(_7e.measureBox){
this.toolbar.measureBox=_7f(this).attr("title","Mark\xe9r omr\xe5de").html(_81(this,"gfx_bgimage_zoom.gif","Zoom")).appendTo(this.toolbar.group4);
this.toolbar.measureBoxZoom=function(){
_85.jumpToExtent(_85.measuredExtent);
};
this.toolbar.measureBox.bind("click",function(){
if(_85.getMeasureBox()){
_85.unsubscribeEvent("measuredExtent",_85.toolbar.measureBoxZoom);
_85.disableMeasureBox();
}else{
_85.subscribeEvent("measuredExtent",_85.toolbar.measureBoxZoom);
_85.enableMeasureBox();
}
return false;
});
}
};
KrakMap.TileClient.prototype.zoomLevelCheck=function(_9c){
if(this.mapType!="oblique"){
if(_9c>this.getMaxZoomLevel()){
_9c=this.getMaxZoomLevel();
}
if(this.getMapType()!="ortho"&&_9c<this.getVectorMinZoomLevel()){
_9c=this.getVectorMinZoomLevel();
}
if(_9c<this.getMinZoomLevel()){
_9c=this.getMinZoomLevel();
}
}else{
if(_9c<0){
_9c=0;
}
if(_9c>this.ObliqueService.zoomLevels.length-1){
_9c=this.ObliqueService.zoomLevels.length-1;
}
}
return _9c;
};
KrakMap.TileClient.prototype.polygonDrawAddCoordinate=function(_9d){
var _9e=this.pixelToGeoCoordinate(this.mousePositionX,this.mousePositionY);
if(this.polygonWKTString.length==0){
this.throwEvent("beforePolygonDraw");
this.polygonDrawStartPointX=_9e.x;
this.polygonDrawStartPointY=_9e.y;
if(this.route){
this.route.clearWkt();
}
this.route=new wktCanvas(this);
this.polygonDrawTempRoute=this.route;
if(this.polygonDrawEnabled){
var _9f=this;
this.eventCatcher.bind("mousemove",function(_a0){
_9f.polygonDrawUpdatePosition(_a0);
});
}
this.polygonWKTString=_9e.x+" "+_9e.y;
}else{
var dx=Math.abs(this.polygonDrawStartPointX-_9e.x)/this.zoomLevels[this.currentZoomLevel];
var dy=Math.abs(this.polygonDrawStartPointY-_9e.y)/this.zoomLevels[this.currentZoomLevel];
var _a3=Math.sqrt((dx*dx)+(dy*dy));
if(_a3<10){
_9e=this.polygonDrawCoordinates[0];
this.disablePolygonDraw();
}
this.polygonWKTString+=","+_9e.x+" "+_9e.y;
}
this.throwEvent("beforeAddPoint");
this.polygonDrawCoordinates.push(_9e);
var _a4="LINESTRING("+this.polygonWKTString+")";
this.route=this.polygonDrawTempRoute;
this.route.setWkt(_a4,true,false);
this.polygonDrawTempRoute=this.route;
this.throwEvent("afterAddPoint");
if(!this.polygonDrawEnabled){
this.throwEvent("polygonDraw");
this.throwEvent("afterPolygonDraw");
}
};
KrakMap.TileClient.prototype.polygonDrawUpdatePosition=function(_a5){
if(this.polygonDrawEnabled&&!jQuery.browser.msie){
var _a6=this.pixelToGeoCoordinate(this.mousePositionX,this.mousePositionY);
var _a7="LINESTRING("+this.polygonWKTString+","+_a6.x+" "+_a6.y+")";
this.route=this.polygonDrawTempRoute;
this.route.setWkt(_a7,true,false);
}
};
KrakMap.TileClient.prototype.measureLineAddCoordinate=function(_a8){
var _a9=this.pixelToGeoCoordinate(this.mousePositionX,this.mousePositionY);
if(this.measureLineWKTString.length==0){
this.throwEvent("beforeMeasureTool");
this.measureLineStartPointX=_a9.x;
this.measureLineStartPointY=_a9.y;
if(this.route){
this.route.clearWkt();
}
this.route=new wktCanvas(this);
this.measureLineTempRoute=this.route;
this.measureLineLength=0;
this.measureLineWKTString=_a9.x+" "+_a9.y;
}else{
this.measureLineWKTString+=","+_a9.x+" "+_a9.y;
}
this.throwEvent("beforeAddPoint");
this.measureLineCoordinates.push(_a9);
if(this.measureLineEnabled){
var _aa=this;
this.eventCatcher.bind("mousemove",function(_ab){
_aa.measureLineUpdatePosition(_ab);
});
}
var _ac="LINESTRING("+this.measureLineWKTString+")";
this.route=this.measureLineTempRoute;
this.route.setWkt(_ac,true,false);
this.measureLineTempRoute=this.route;
this.throwEvent("afterAddPoint");
};
KrakMap.TileClient.prototype.measureLineUpdatePosition=function(_ad){
if(this.measureLineEnabled){
var _ae=this.pixelToGeoCoordinate(this.mousePositionX,this.mousePositionY);
this.updateLengthOfMeasuredLine(_ae);
var _af="LINESTRING("+this.measureLineWKTString+","+_ae.x+" "+_ae.y+")";
this.route=this.measureLineTempRoute;
if(!jQuery.browser.msie){
this.route.setWkt(_af,true,false);
}
}
};
KrakMap.TileClient.prototype.updateLengthOfMeasuredLine=function(_b0){
var len=0,x1=0,y1=0,x2=0,y2=0,dx=0,dy=0;
for(var i=1;i<this.measureLineCoordinates.length;i++){
x1=this.measureLineCoordinates[i-1].x;
y1=this.measureLineCoordinates[i-1].y;
x2=this.measureLineCoordinates[i].x;
y2=this.measureLineCoordinates[i].y;
dx=x2-x1;
dy=y2-y1;
len+=Math.sqrt(dx*dx+dy*dy);
}
if(_b0!=undefined){
if(this.measureLineCoordinates.length==1){
dx=_b0.x-this.measureLineStartPointX;
dy=_b0.y-this.measureLineStartPointY;
}else{
dx=_b0.x-x2;
dy=_b0.y-y2;
}
len+=Math.sqrt(dx*dx+dy*dy);
}
this.measureLineLength=len;
this.throwEvent("measureLine");
return len;
};
KrakMap.TileClient.prototype.obliquePixelToGeoCoordinates=function(_b9){
var _ba=this.obliqueResponse;
var _bb=_ba.actualpixeldimensions[0];
var _bc=_ba.actualpixeldimensions[1];
if(_b9.x<0){
_b9.x=0;
}else{
if(_b9.x>_bb){
_b9.x=_bb;
}
}
if(_b9.y<0){
_b9.y=0;
}else{
if(_b9.y>_bc){
_b9.y=_bc;
}
}
var _bd=_ba.pixelsize;
var _be=_b9.x;
var _bf=_b9.y;
var rM=_ba.rotmat;
var _c1=_ba.offsetX;
var _c2=_ba.offsetY;
var _c3=_ba.cameraconstant;
var pcx=_ba.pcx;
var pcy=_ba.pcy;
var pcz=_ba.pcz;
var _c7=_ba.ndz0;
var xp=_bd*(_be-(_bb/2));
var yp=-(_bf-(_bc/2))*_bd;
var _ca=(rM[0][0]*(xp+_c1))+(rM[0][1]*(yp+_c2))-rM[0][2]*_c3;
var _cb=(rM[1][0]*(xp+_c1))+(rM[1][1]*(yp+_c2))-rM[1][2]*_c3;
var _cc=(rM[2][0]*(xp+_c1))+(rM[2][1]*(yp+_c2))-rM[2][2]*_c3;
var x=(_ca/_cc)*(_c7-pcz)+pcx;
var y=(_cb/_cc)*(_c7-pcz)+pcy;
return new KrakMap.Coordinate(x.toFixed(2),y.toFixed(2));
};
KrakMap.TileClient.prototype.obliqueGeoCoordinatesToPixel=function(utm){
var _d0=this.obliqueResponse;
var _d1=_d0.actualpixeldimensions[0];
var _d2=_d0.actualpixeldimensions[1];
var _d3=_d0.pixelsize;
var _d4=_d0.cameraconstant;
var _d5=_d0.offsetX;
var _d6=_d0.offsetY;
var rM=_d0.rotmat;
var pcx=_d0.pcx;
var pcy=_d0.pcy;
var pcz=_d0.pcz;
var _db=_d0.ndz0;
var _dc=utm.x;
var _dd=utm.y;
var _de=(rM[0][0]*(_dc-pcx))+(rM[1][0]*(_dd-pcy))+(rM[2][0]*(_db-pcz));
var _df=(rM[0][1]*(_dc-pcx))+(rM[1][1]*(_dd-pcy))+(rM[2][1]*(_db-pcz));
var _e0=(rM[0][2]*(_dc-pcx))+(rM[1][2]*(_dd-pcy))+(rM[2][2]*(_db-pcz));
var _e1=-_d4*(_de/_e0);
var _e2=-_d4*(_df/_e0);
var xp=_e1-_d5;
var yp=_e2-_d6;
var _e5=(xp/_d3)+(_d1/2);
var _e6=(_d2/2)-(yp/_d3);
return new KrakMap.Coordinate(Math.round(_e5),Math.round(_e6));
};
KrakMap.TileClient.prototype.obliquePixelToGeoExtent=function(ext){
var _e8=this.obliquePixelToGeoCoordinates(new KrakMap.Coordinate(ext.left,this.obliqueResponse.actualpixeldimensions[1]-ext.top));
var _e9=this.obliquePixelToGeoCoordinates(new KrakMap.Coordinate(ext.right,this.obliqueResponse.actualpixeldimensions[1]-ext.bottom));
switch(this.obliqueResponse.direction){
case "n":
return new KrakMap.Extent(_e8.y,_e9.y,_e8.x,_e9.x);
case "s":
return new KrakMap.Extent(_e9.y,_e8.y,_e9.x,_e8.x);
case "w":
return new KrakMap.Extent(_e9.y,_e8.y,_e8.x,_e9.x);
case "e":
return new KrakMap.Extent(_e8.y,_e9.y,_e9.x,_e8.x);
default:
return new KrakMap.Extent(0,0,0,0);
}
};
KrakMap.TileClient.prototype.obliqueResponseCompleted=function(_ea,x,y,_ed){
if(_ea.errorcode&&_ea.errorcode==204){
this.messageBoard.info(this.ObliqueService._texts.noimages);
this.jumpToCoordinate(this.currentZoomLevel,x,y,"kvec");
return;
}
if(this.obliqueResponse&&this.obliqueResponse.filename==_ea.filename&&this.obliqueResponse.tilemax==_ea.tilemax&&this.obliqueResponse.direction==_ea.direction&&this.mapViewCenter.x==x&&this.mapViewCenter.y==y){
return;
}
var _ee=this;
this.eventCatcher.unbind("mousemove").unbind("mouseup").unbind("mouseout");
this.eventCatcher.bind("mousemove",function(_ef){
_ee.trackMousemove(_ef);
});
this.eventCatcher.css({zIndex:2,cursor:this.grabCursor});
this.obliqueResponse=_ea;
this.fullExtent=new KrakMap.Extent(this.obliqueResponse.actualpixeldimensions[1],0,0,this.obliqueResponse.actualpixeldimensions[0]);
this.zoomLevels=[];
var _f0=this.ObliqueService.zoomLevels.length;
for(var i=0;i<_f0;i++){
this.zoomLevels[i]=1;
}
var _f2=this.obliqueGeoCoordinatesToPixel(new KrakMap.Coordinate(this.obliqueResponse.usercoordinates[0],this.obliqueResponse.usercoordinates[1]));
this.jumpToCoordinate(_ed,_f2.x,this.obliqueResponse.actualpixeldimensions[1]-_f2.y,"oblique",_ea.direction,true);
this.throwEvent("obliqueResponse");
};
KrakMap.TileClient.prototype.trackMousemove=function(_f3){
this.mousePositionX=_f3.pageX-this.eventCatcher.offset().left;
this.mousePositionY=_f3.pageY-this.eventCatcher.offset().top;
};
KrakMap.TileClient.prototype.mapMoveMousedown=function(_f4){
this.throwEvent("beforeMapMove");
if(this.overviewMap){
clearInterval(this.animateMoveTimer);
}
document.onselectstart=function(){
return false;
};
this.eventCatcher.css({zIndex:1000,cursor:this.grabbingCursor});
this.mapMoveStartMouseX=_f4.pageX;
this.mapMoveStartMouseY=_f4.pageY;
this.mapMoveStartGridX=parseInt(this.gridContainerDomStyle.left);
this.mapMoveStartGridY=parseInt(this.gridContainerDomStyle.top);
this.mapMoveStartViewExtent=this.mapViewExtent;
var _f5=this;
this.eventCatcher.bind("mousemove",function(_f6){
_f5.mapMoveMousemove(_f6);
});
this.eventCatcher.bind("mouseup",function(_f7){
_f5.mapMoveMouseup(_f7);
});
this.eventCatcher.bind("mouseout",function(_f8){
_f5.mapMoveMouseup(_f8);
});
};
KrakMap.TileClient.prototype.mapMoveMousemove=function(_f9){
clearTimeout(this.updateTimer);
var _fa=this.gridContainerDomStyle;
if(_f9){
var _fb=this.mapMoveStartGridX-(this.mapMoveStartMouseX-_f9.pageX);
var _fc=this.mapMoveStartGridY-(this.mapMoveStartMouseY-_f9.pageY);
}else{
var _fb=this.animateMoveStepTo.moveX;
var _fc=this.animateMoveStepTo.moveY;
}
var _fd=new KrakMap.Extent(this.mapViewExtent.top,this.mapViewExtent.bottom,this.mapViewExtent.left,this.mapViewExtent.right);
var _fe=this.metersPerPixel;
var _ff=this.mapType;
var _100=false;
var _101=false;
_fd.top=this.mapGridTopLeftCoordinate.y+(_fc*_fe);
_fd.bottom=_fd.top-(this.mapContainerPixelHeight*_fe);
_fd.left=this.mapGridTopLeftCoordinate.x-(_fb*_fe);
_fd.right=_fd.left+(this.mapContainerPixelWidth*_fe);
var _102=this.fullExtent;
if(_ff=="oblique"){
var _103=(_fd.right-_fd.left)/2;
var _104=(_fd.top-_fd.bottom)/2;
_102=new KrakMap.Extent(_102.top+_104,_102.bottom-_104,_102.left-_103,_102.right+_103);
}
if(_fd.top>_102.top){
var diff=_fd.top-_102.top;
_fd.top-=diff;
_fd.bottom-=diff;
_fc-=diff/_fe;
_101=true;
}
if(_fd.bottom<_102.bottom){
var diff=_102.bottom-_fd.bottom;
_fd.top+=diff;
_fd.bottom+=diff;
_fc+=diff/_fe;
_101=true;
}
if(_fd.left<_102.left){
var diff=_102.left-_fd.left;
_fd.left+=diff;
_fd.right+=diff;
_fb-=diff/_fe;
_100=true;
}
if(_fd.right>_102.right){
var diff=_fd.right-_102.right;
_fd.left-=diff;
_fd.right-=diff;
_fb+=diff/_fe;
_100=true;
}
if((this.targetPixelCoordinate.x==parseInt(_fa.left)||_100)&&(this.targetPixelCoordinate.y==parseInt(_fa.top)||_101)){
clearInterval(this.animateMoveTimer);
clearInterval(this.animateScrollTimer);
}
var _106=this.mapViewExtent;
if(_fd.top-_fd.bottom>_102.top-_102.bottom){
_fd.top=_106.top;
_fd.bottom=_106.bottom;
if(this.mapMoveStartGridY!="undefined"){
_fc=this.mapMoveStartGridY;
}
}
if(_fd.right-_fd.left>_102.right-_102.left){
_fd.right=_106.right;
_fd.left=_106.left;
if(this.mapMoveStartGridX!="undefined"){
_fb=this.mapMoveStartGridX;
}
}
_fb=Math.round(_fb);
_fc=Math.round(_fc);
_fa.left=_fb+"px";
_fa.top=_fc+"px";
this.poiLayerContainerDomStyle.left=_fb+"px";
this.poiLayerContainerDomStyle.top=_fc+"px";
this.mapViewCenter.x=(_fd.right+_fd.left)/2;
this.mapViewCenter.y=(_fd.top+_fd.bottom)/2;
this.mapViewExtent=_fd;
this.throwEvent("mapMoving");
this.throwEvent("mapMoved");
if(_f9){
var temp=this;
this.updateTimer=setTimeout(function(){
temp.updateTileGrid(true);
},50);
}else{
this.updateTileGrid(false);
}
};
KrakMap.TileClient.prototype.updateTileGrid=function(_108){
clearTimeout(this.updateTimer);
this.throwEvent("viewExtentUpdated");
var _109=this.tileMeterWidth;
var _10a=this.tileMeterHeight;
var _10b=this.bufferSize*_109;
var _10c=this.bufferSize*_10a;
var _10d=this.mapViewExtent;
var _10e=this.mapGridExtent;
var _10f=this.mapGridPixelExtent;
var _110=this.tilePixelWidth;
var _111=this.tilePixelHeight;
var _112=this.mapGridTilesWidth;
var _113=this.mapGridTilesHeight;
var _114=this.bufferSize;
var _115=this.metersPerPixel;
var _116=this.mapType;
var _117=this.mapGridDom;
var _118=false;
var _119=this.customTiles;
var _11a=this.fullExtent;
if(_116=="oblique"&&(_10d.top>_11a.top||_10d.bottom<_11a.bottom||_10d.left<_11a.left||_10d.right>_11a.right)){
var x=this.mapViewCenter.x;
if(x>_11a.right){
x=_11a.right;
}else{
if(x<_11a.left){
x=_11a.left;
}
}
var y=this.mapViewCenter.y;
if(y>_11a.top){
y=_11a.top;
}else{
if(y<_11a.bottom){
y=_11a.bottom;
}
}
var _11d=this.obliquePixelToGeoCoordinates(new KrakMap.Coordinate(x,this.obliqueResponse.actualpixeldimensions[1]-y));
this.jumpToCoordinate(this.currentZoomLevel,_11d.x.toFixed(2),_11d.y.toFixed(2),"oblique",this.obliqueResponse.direction);
}
while(_10d.top>_10e.top-_10c){
for(var i=0;i<_112;i++){
this.addTile(_10e.left+(_109*i),_10e.top,_10f.left+(_110*i),_10f.top-_111);
}
_10f.top=_10f.top-_111;
_113++;
_10e.top=_10e.top+_10a;
_118=true;
}
while(_10e.top-_10d.top>=_10a*(_114+1)){
for(var i=0;i<_112;i++){
var _11f=(_10e.left+(_115*_110*i)).toFixed(0);
var _120=(_10e.top-_10a).toFixed(0);
if(_116!="oblique"){
jQuery("#"+_11f+"_"+_120).remove();
for(key in _119){
jQuery("#"+_11f+"_"+_120+"_"+key).remove();
}
}else{
jQuery("#obliqueTile"+(((Math.ceil(_120/_111))*this.obliqueResponse.tiledimensions[0])+(Math.ceil(_11f/_110)))).remove();
}
}
_10f.top=_10f.top+_111;
_113--;
_10e.top=_10e.top-_10a;
_118=true;
}
while(_10d.bottom<_10e.bottom+_10b){
for(var i=0;i<_112;i++){
this.addTile(_10e.left+(_115*_110*i),_10e.bottom-_10a,_10f.left+(_110*i),_10f.bottom);
}
_10f.bottom=_10f.bottom+_111;
_113++;
_10e.bottom=_10e.bottom-_10a;
_118=true;
}
while(_10d.bottom-_10e.bottom>=_10a*(_114+1)){
for(var i=0;i<_112;i++){
var _11f=(_10e.left+(_115*_110*i)).toFixed(0);
var _120=(_10e.bottom).toFixed(0);
if(_116!="oblique"){
jQuery("#"+_11f+"_"+_120).remove();
for(key in _119){
jQuery("#"+_11f+"_"+_120+"_"+key).remove();
}
}else{
jQuery("#obliqueTile"+(((Math.ceil(_120/_111))*this.obliqueResponse.tiledimensions[0])+(Math.ceil(_11f/_110))).toFixed(0)).remove();
}
}
_10f.bottom=_10f.bottom-_111;
_113--;
_10e.bottom=_10e.bottom+_10a;
_118=true;
}
while(_10d.left<_10e.left+_10b){
for(var i=0;i<_113;i++){
this.addTile(_10e.left-_109,_10e.top-_10a-(_10a*i),_10f.left-_110,_10f.top+(_111*i));
}
_10f.left=_10f.left-_110;
_112++;
_10e.left=_10e.left-_109;
_118=true;
}
while(_10d.left-_10e.left>=_109*(_114+1)){
for(var i=0;i<_112;i++){
var _11f=(_10e.left).toFixed(0);
var _120=(_10e.bottom+(_115*_110*i)).toFixed(0);
if(_116!="oblique"){
jQuery("#"+_11f+"_"+_120).remove();
for(key in _119){
jQuery("#"+_11f+"_"+_120+"_"+key).remove();
}
}else{
jQuery("#obliqueTile"+(((Math.ceil(_120/_111))*this.obliqueResponse.tiledimensions[0])+(Math.ceil(_11f/_110))).toFixed(0)).remove();
}
}
_10f.left=_10f.left+_110;
_112--;
_10e.left=_10e.left+_109;
_118=true;
}
while(_10d.right>_10e.right-_10b){
for(var i=0;i<_113;i++){
this.addTile(_10e.right,_10e.bottom+(_10a*i),_10f.right,_10f.bottom-(_111*(i+1)));
}
_10f.right=_10f.right+_110;
_112++;
_10e.right=_10e.right+_109;
_118=true;
}
while(_10e.right-_10d.right>=_109*(_114+1)){
for(var i=0;i<_112;i++){
var _11f=(_10e.right-_109).toFixed(0);
var _120=(_10e.bottom+(_115*_110*i)).toFixed(0);
if(_116!="oblique"){
jQuery("#"+_11f+"_"+_120).remove();
for(key in _119){
jQuery("#"+_11f+"_"+_120+"_"+key).remove();
}
}else{
jQuery("#obliqueTile"+(((Math.ceil(_120/_111))*this.obliqueResponse.tiledimensions[0])+(Math.ceil(_11f/_110))).toFixed(0)).remove();
}
}
_10f.right=_10f.right-_110;
_112--;
_10e.right=_10e.right-_109;
_118=true;
}
if(_118){
this.throwEvent("mapGridExtentUpdated");
}
this.mapGridExtent=_10e;
this.mapGridPixelExtent=_10f;
this.mapGridTilesWidth=_112;
this.mapGridTilesHeight=_113;
this.mapGridCenter.x=(_10e.right+_10e.left)/2;
this.mapGridCenter.y=(_10e.top+_10e.bottom)/2;
};
KrakMap.TileClient.prototype.mapMoveMouseup=function(_121){
clearTimeout(this.updateTimer);
this.updateTileGrid();
this.eventCatcher.unbind("mousemove").unbind("mouseup").unbind("mouseout");
var temp=this;
this.eventCatcher.bind("mousemove",function(_123){
temp.trackMousemove(_123);
});
this.eventCatcher.css({zIndex:2,cursor:this.grabCursor});
document.onselectstart=function(){
return true;
};
if(this.overviewMap){
this.overviewMap.moveMap(this.mapViewCenter);
}else{
if(this.mainMap&&(this.mapMoveStartViewExtent.left!=this.mapViewExtent.left||this.mapMoveStartViewExtent.top!=this.mapViewExtent.top)){
this.mainMap.moveMap(this.mapViewCenter);
}
}
this.throwEvent("afterMapMoved");
};
KrakMap.TileClient.prototype.zoomWithMouseWheel=function(_124,_125){
clearTimeout(this.zoomTimer);
if(_125<0&&this.currentZoomLevel<(this.zoomLevels.length-1)){
this.deltaZoom++;
}
if(_125>0&&this.currentZoomLevel>0){
this.deltaZoom--;
}
var temp=this;
this.zoomTimer=setTimeout(function(_127){
temp.zoomWithMouseWheelAction(_127);
},150);
};
KrakMap.TileClient.prototype.zoomWithMouseWheelAction=function(_128){
this.throwEvent("beforeZoomWithMouseWheel");
var _129=this.zoomLevelCheck(this.currentZoomLevel+this.deltaZoom);
if(_129!=this.currentZoomLevel){
if(this.mapType!="oblique"){
var _12a=this.mousePositionX;
var _12b=this.mousePositionY;
var _12c=this.pixelToGeoCoordinate(_12a,_12b);
var _12d=_12a-(this.mapContainerPixelWidth/2);
var _12e=_12b-(this.mapContainerPixelHeight/2);
var _12f=new KrakMap.Coordinate(_12c.x-(_12d*this.zoomLevels[_129]),_12c.y+(_12e*this.zoomLevels[_129]));
this.jumpToCoordinate(_129,_12f.x,_12f.y,this.mapType);
}else{
this.jumpToCoordinate(_129,this.mapViewCenter.x,this.mapViewCenter.y,this.mapType);
}
}
this.deltaZoom=0;
clearTimeout(this.zoomTimer);
this.throwEvent("afterZoomWithMouseWheel");
};
KrakMap.TileClient.prototype.zoomByDoubleClick=function(_130){
if(this.currentZoomLevel>this.minZoomLevel||(this.mapType=="oblique"&&this.currentZoomLevel>0)){
var _131=this.pixelToGeoCoordinate(this.mousePositionX,this.mousePositionY);
this.jumpToCoordinate(this.zoomLevelCheck(this.currentZoomLevel-1),_131.x,_131.y,this.mapType);
}
};
KrakMap.TileClient.prototype.measureExtentMousedown=function(_132){
this.throwEvent("beforeRectangleDraw");
document.onselectstart=function(){
return false;
};
this.eventCatcher.css("z-index",1000);
var _133=_132.pageX-this.eventCatcher.offset().left;
var _134=_132.pageY-this.eventCatcher.offset().top;
this.measureExtentStartMouseX=_133;
this.measureExtentStartMouseY=_134;
this.measureExtentZoomBox=jQuery("<div></div>").css({position:"absolute",zIndex:7,left:_133,top:_134,width:0,height:0,border:"solid",borderWidth:"1px",borderColor:"red",backgroundColor:"#FFF",opacity:0.6}).appendTo(this.mapContainer);
var temp=this;
this.eventCatcher.bind("mousemove",function(_136){
temp.measureExtentMousemove(_136);
});
this.eventCatcher.bind("mouseup",function(_137){
temp.measureExtentMouseup(_137);
});
this.eventCatcher.bind("mouseout",function(_138){
temp.measureExtentMouseup(_138);
});
};
KrakMap.TileClient.prototype.measureExtentMousemove=function(_139){
var _13a=_139.pageX-this.eventCatcher.offset().left;
var _13b=_139.pageY-this.eventCatcher.offset().top;
if(_13a>this.measureExtentStartMouseX){
this.measureExtentZoomBox.css("width",_13a-this.measureExtentStartMouseX);
}else{
this.measureExtentZoomBox.css("left",this.measureExtentStartMouseX-(this.measureExtentStartMouseX-_13a)).css("width",this.measureExtentStartMouseX-_13a);
}
if(_13b>this.measureExtentStartMouseY){
this.measureExtentZoomBox.css("height",_13b-this.measureExtentStartMouseY);
}else{
this.measureExtentZoomBox.css("top",this.measureExtentStartMouseY-(this.measureExtentStartMouseY-_13b)).css("height",this.measureExtentStartMouseY-_13b);
}
};
KrakMap.TileClient.prototype.measureExtentMouseup=function(_13c){
if(Math.abs(this.measureExtentStartMouseX-_13c.pageX)>3||Math.abs(this.measureExtentStartMouseY-_13c.pageY)>3){
var _13d=this.pixelToGeoCoordinate(this.measureExtentStartMouseX,this.measureExtentStartMouseY);
var _13e=this.pixelToGeoCoordinate(_13c.pageX-this.eventCatcher.offset().left,_13c.pageY-this.eventCatcher.offset().top);
var _13f=new KrakMap.Extent(0,0,0,0);
if(_13d.x<_13e.x){
_13f.left=_13d.x;
_13f.right=_13e.x;
}else{
_13f.left=_13e.x;
_13f.right=_13d.x;
}
if(_13d.y<_13e.y){
_13f.bottom=_13d.y;
_13f.top=_13e.y;
}else{
_13f.bottom=_13e.y;
_13f.top=_13d.y;
}
this.measuredExtent=_13f;
this.throwEvent("measuredExtent");
}
this.measureExtentZoomBox.remove();
this.eventCatcher.unbind("mousemove").unbind("mouseup").unbind("mouseout");
var temp=this;
this.eventCatcher.bind("mousemove",function(_141){
temp.trackMousemove(_141);
});
this.eventCatcher.css("z-index",2);
document.onselectstart=function(){
return true;
};
this.throwEvent("afterRectangleDraw");
};
KrakMap.TileClient.prototype.viewIndicatorMouseDown=function(_142){
var _143=this.overviewMap;
_143.viewIndicatorMoveStartLeft=parseInt(_143.viewIndicator.css("left"));
_143.viewIndicatorMoveStartTop=parseInt(_143.viewIndicator.css("top"));
_143.viewIndicatorMoveStartMouseX=_142.pageX;
_143.viewIndicatorMoveStartMouseY=_142.pageY;
_143.viewIndicatorMoving=true;
_143.viewIndicatorEventCatcher.css("zIndex",1000);
var temp=this;
_143.viewIndicatorEventCatcher.bind("mousemove",function(_145){
temp.overviewMap.viewIndicatorMousemove(_145);
}).bind("mouseup",function(_146){
temp.overviewMap.viewIndicatorMouseup();
}).bind("mouseout",function(_147){
temp.overviewMap.viewIndicatorMouseup();
});
};
KrakMap.TileClient.prototype.viewIndicatorMousemove=function(_148){
var _149=this.viewIndicator;
var _14a=this.viewIndicatorMoveStartLeft-(this.viewIndicatorMoveStartMouseX-_148.pageX);
var _14b=this.viewIndicatorMoveStartTop-(this.viewIndicatorMoveStartMouseY-_148.pageY);
_149.css({left:_14a,top:_14b});
this.scrollDirection={horizontal:"",vertical:""};
clearInterval(this.animateScrollTimer);
if(this.mapContainerPixelWidth>parseInt(_149.css("width"))){
if(parseInt(_149.css("left"))<0){
this.scrollDirection.horizontal="left";
}else{
if(parseInt(_149.css("left"))>(this.mapContainerPixelWidth-parseInt(_149.css("width")))){
this.scrollDirection.horizontal="right";
}else{
this.scrollDirection.horizontal="";
}
}
}
if(this.mapContainerPixelHeight>parseInt(_149.css("height"))){
if(parseInt(_149.css("top"))<0){
this.scrollDirection.vertical="up";
}else{
if(parseInt(_149.css("top"))>(this.mapContainerPixelHeight-parseInt(_149.css("height")))){
this.scrollDirection.vertical="down";
}else{
this.scrollDirection.vertical="";
}
}
}
if(this.scrollDirection.horizontal||this.scrollDirection.vertical){
this.scrollMap();
}
};
KrakMap.TileClient.prototype.viewIndicatorMouseup=function(){
this.scrollDirection={horizontal:"",vertical:""};
clearInterval(this.animateScrollTimer);
this.viewIndicatorMoving=false;
var _14c=this.viewIndicator;
var _14d=this.mapViewExtent.left+((parseInt(_14c.css("left"))+(parseInt(_14c.css("width"))/2))*this.metersPerPixel);
var _14e=this.mapViewExtent.top-((parseInt(_14c.css("top"))+(parseInt(_14c.css("height"))/2))*this.metersPerPixel);
var _14f=this.mainMap;
var _150=_14f.mapViewExtent.top-_14f.mapViewExtent.bottom;
var _151=_14f.mapViewExtent.right-_14f.mapViewExtent.left;
var _152=Math.sqrt((_150*_150)+(_151*_151))/2;
if(_14f.mapType=="oblique"||Math.abs(_14d-_14f.mapViewCenter.x)>_152||Math.abs(_14e-_14f.mapViewCenter.y)>_152){
_14f.jumpToCoordinate(_14f.currentZoomLevel,_14d,_14e,_14f.mapType);
}else{
_14f.moveMap(new KrakMap.Coordinate(_14d,_14e));
this.jumpToCoordinate(_14f.currentZoomLevel+_14f.overviewMapSettings.elevation,_14d,_14e,"kvec");
}
var _153=this.mainMap.getMapViewExtent();
if(_14f.mapType!="oblique"){
this.viewIndicator.css({left:Math.round((_153.left-this.mapViewExtent.left)/this.metersPerPixel),top:Math.round((this.mapViewExtent.top-_153.top)/this.metersPerPixel)});
}
this.viewIndicatorEventCatcher.css("zIndex",-1);
this.viewIndicatorEventCatcher.unbind("mousemove").unbind("mouseup").unbind("mouseout");
};
KrakMap.TileClient.prototype.navigateKeyDown=function(_154){
var temp=this;
jQuery(document).bind("keyup",function(_156){
temp.navigateKeyUp(_156);
});
switch(_154.which){
case 37:
this.scrollDirection.horizontal="left";
this.scrollMap();
break;
case 39:
this.scrollDirection.horizontal="right";
this.scrollMap();
break;
case 38:
this.scrollDirection.vertical="up";
this.scrollMap();
break;
case 40:
this.scrollDirection.vertical="down";
this.scrollMap();
break;
case 33:
if(this.currentZoomLevel>this.minZoomLevel){
this.zoomToLevel(this.zoomLevelCheck(this.currentZoomLevel-1));
}
break;
case 34:
if(this.currentZoomLevel<this.maxZoomLevel){
this.zoomToLevel(this.currentZoomLevel+1);
}
break;
default:
break;
}
};
KrakMap.TileClient.prototype.navigateKeyUp=function(_157){
switch(_157.which){
case 37:
this.scrollDirection.horizontal="";
break;
case 39:
this.scrollDirection.horizontal="";
break;
case 38:
this.scrollDirection.vertical="";
break;
case 40:
this.scrollDirection.vertical="";
break;
default:
break;
}
if(!this.scrollDirection.horizontal&&!this.scrollDirection.vertical){
clearInterval(this.animateScrollTimer);
jQuery(document).unbind("keyup");
if(this.overviewMap){
this.overviewMap.moveMap(this.mapViewCenter);
}else{
if(this.mainMap){
var _158=this.mainMap;
var _159=this.mapViewCenter.x;
var _15a=this.mapViewCenter.y;
var _15b=_158.mapViewExtent.top-_158.mapViewExtent.bottom;
var _15c=_158.mapViewExtent.right-_158.mapViewExtent.left;
var _15d=Math.sqrt((_15b*_15b)+(_15c*_15c))/2;
if(Math.abs(_159-_158.mapViewCenter.x)>_15d||Math.abs(_15a-_158.mapViewCenter.y)>_15d){
_158.jumpToCoordinate(_158.currentZoomLevel,_159,_15a,_158.mapType);
}else{
_158.moveMap(new KrakMap.Coordinate(_159,_15a));
this.jumpToCoordinate(_158.currentZoomLevel+this.overviewMapSettings.elevation,_159,_15a,_158.mapType);
}
this.viewIndicator.css({left:Math.round((this.mainMap.mapViewExtent.left-this.mapViewExtent.left)/this.metersPerPixel),top:Math.round((this.mapViewExtent.top-this.mainMap.mapViewExtent.top)/this.metersPerPixel)});
}
}
}
};
KrakMap.TileClient.prototype.throwEvent=function(type){
var _15f=null;
switch(type){
case "buildingGrid":
_15f=this.eventReceivers.buildingGrid;
break;
case "mapMoved":
_15f=this.eventReceivers.mapMoved;
break;
case "viewExtentUpdated":
_15f=this.eventReceivers.viewExtentUpdated;
break;
case "mapGridExtentUpdated":
_15f=this.eventReceivers.mapGridExtentUpdated;
break;
case "zoomed":
_15f=this.eventReceivers.zoomed;
break;
case "jumped":
_15f=this.eventReceivers.jumped;
break;
case "clicked":
_15f=this.eventReceivers.clicked;
break;
case "measuredExtent":
_15f=this.eventReceivers.measuredExtent;
break;
case "mapTypeChanged":
_15f=this.eventReceivers.mapTypeChanged;
break;
case "routeSearch":
_15f=this.eventReceivers.routeSearch;
break;
case "obliqueResponse":
_15f=this.eventReceivers.obliqueResponse;
break;
case "circleDraw":
_15f=this.eventReceivers.circleDraw;
break;
case "polygonDraw":
_15f=this.eventReceivers.polygonDraw;
break;
default:
break;
}
if(_15f){
var func=null;
for(var i=0;i<_15f.length;i++){
func=_15f[i][1];
func(_15f[i][0]);
}
}
_15f=this.eventSubscriptions[type];
if(_15f){
for(var i=0;i<_15f.length;i++){
_15f[i]();
}
}
};
KrakMap.TileClient.prototype.subscribeEvent=function(_162,_163){
var _164=this.eventSubscriptions;
if(!_164[_162]){
_164[_162]=[];
}
_164[_162].push(_163);
};
KrakMap.TileClient.prototype.unsubscribeEvent=function(_165,_166){
var _167=this.eventSubscriptions;
if(!_167[_165]){
return;
}
for(var i=0;i<_167[_165].length;i++){
if(_167[_165][i]==_166){
_167[_165].splice(i,1);
return;
}
}
};
KrakMap.TileClient.prototype.getBuildingGridEvent=function(_169,_16a){
if(!this.eventReceivers.buildingGrid){
this.eventReceivers.buildingGrid=new Array(new Array(_169,_16a));
}else{
this.eventReceivers.buildingGrid.push(new Array(_169,_16a));
}
};
KrakMap.TileClient.prototype.getMapMovedEvent=function(_16b,_16c){
if(!this.eventReceivers.mapMoved){
this.eventReceivers.mapMoved=new Array(new Array(_16b,_16c));
}else{
this.eventReceivers.mapMoved.push(new Array(_16b,_16c));
}
};
KrakMap.TileClient.prototype.getViewExtentUpdatedEvent=function(_16d,_16e){
if(!this.eventReceivers.viewExtentUpdated){
this.eventReceivers.viewExtentUpdated=new Array(new Array(_16d,_16e));
}else{
this.eventReceivers.viewExtentUpdated.push(new Array(_16d,_16e));
}
};
KrakMap.TileClient.prototype.getMapGridExtentUpdatedEvent=function(_16f,_170){
if(!this.eventReceivers.mapGridExtentUpdated){
this.eventReceivers.mapGridExtentUpdated=new Array(new Array(_16f,_170));
}else{
this.eventReceivers.mapGridExtentUpdated.push(new Array(_16f,_170));
}
};
KrakMap.TileClient.prototype.getZoomedEvent=function(_171,_172){
if(!this.eventReceivers.zoomed){
this.eventReceivers.zoomed=new Array(new Array(_171,_172));
}else{
this.eventReceivers.zoomed.push(new Array(_171,_172));
}
};
KrakMap.TileClient.prototype.getJumpedEvent=function(_173,_174){
if(!this.eventReceivers.jumped){
this.eventReceivers.jumped=new Array(new Array(_173,_174));
}else{
this.eventReceivers.jumped.push(new Array(_173,_174));
}
};
KrakMap.TileClient.prototype.getClickedEvent=function(_175,_176){
if(!this.eventReceivers.clicked){
this.eventReceivers.clicked=new Array(new Array(_175,_176));
}else{
this.eventReceivers.clicked.push(new Array(_175,_176));
}
};
KrakMap.TileClient.prototype.getMeasuredExtentEvent=function(_177,_178){
if(!this.eventReceivers.measuredExtent){
this.eventReceivers.measuredExtent=new Array(new Array(_177,_178));
}else{
this.eventReceivers.measuredExtent.push(new Array(_177,_178));
}
};
KrakMap.TileClient.prototype.getMapTypeChangedEvent=function(_179,_17a){
if(!this.eventReceivers.mapTypeChanged){
this.eventReceivers.mapTypeChanged=new Array(new Array(_179,_17a));
}else{
this.eventReceivers.mapTypeChanged.push(new Array(_179,_17a));
}
};
KrakMap.TileClient.prototype.getRouteSearchEvent=function(_17b,_17c){
if(!this.eventReceivers.routeSearch){
this.eventReceivers.routeSearch=new Array(new Array(_17b,_17c));
}else{
this.eventReceivers.routeSearch.push(new Array(_17b,_17c));
}
};
KrakMap.TileClient.prototype.getObliqueResponseEvent=function(_17d,_17e){
if(!this.eventReceivers.obliqueResponse){
this.eventReceivers.obliqueResponse=new Array(new Array(_17d,_17e));
}else{
this.eventReceivers.obliqueResponse.push(new Array(_17d,_17e));
}
};
KrakMap.TileClient.prototype.getCircleDrawEvent=function(_17f,_180){
if(!this.eventReceivers.circleDraw){
this.eventReceivers.circleDraw=[[_17f,_180]];
}else{
this.eventReceivers.circleDraw.push([_17f,_180]);
}
};
KrakMap.TileClient.prototype.getPolygonDrawEvent=function(_181,_182){
if(!this.eventReceivers.polygonDraw){
this.eventReceivers.polygonDraw=[[_181,_182]];
}else{
this.eventReceivers.polygonDraw.push([_181,_182]);
}
};
KrakMap.TileClient.prototype.jumpToCoordinate=function(_183,x,y,_186,_187,_188){
x=Number(x);
y=Number(y);
if(!_186){
_186="kvec";
}
if(_186=="oblique"&&!_188){
if(this.mapType!="oblique"&&!this.isPrint){
_183=2;
}
var obj=this;
this.ObliqueService.getBestPhoto(_183,x,y,_187,function(json,x,y,_18d){
obj.obliqueResponseCompleted(json,x.toFixed(2),y.toFixed(2),_18d);
});
return;
}
var _18e=false;
var _18f=false;
var _190=false;
if(!this.firstJump){
if(this.currentZoomLevel!=_183){
this.throwEvent("beforeZoom");
_18e=true;
}
if(this.mapType!=_186){
this.throwEvent("beforeMapTypeChange");
_18f=true;
}
if(_187&&this.obliqueResponse&&this.obliqueResponse.direction!=_187){
this.throwEvent("beforeDirectionChange");
_190=true;
}
}
this.throwEvent("beforeJump");
if(this.toolbar.center&&this.firstJump){
this.setToolbarCenterButtonCoordinate(new KrakMap.Coordinate(x,y),_183,_186);
this.firstJump=false;
}
this.togglePerspectiveView(_186,_187);
if(this.mainMap&&this.mainMap.mapType=="oblique"){
_183=1;
}
var _191=false;
if(this.mapType!=_186&&_186!=""){
if(this.mapType=="oblique"){
this.zoomLevels=this.nonObliqueZoomLevels;
this.fullExtent=this.nonObliqueFullExtent;
if(x<99999&&y<99999){
var _192=this.obliquePixelToGeoCoordinates(new KrakMap.Coordinate(x,this.obliqueResponse.actualpixeldimensions[1]-y));
x=_192.x;
y=_192.y;
}
this.obliqueResponse={};
if(this.routeWkt){
this.enableRoute(this.routeWkt,false);
}
this.mapContainer.css("backgroundColor","#FFF");
}else{
if(_186=="oblique"){
if(this.route){
this.disableRoute();
}
this.mapContainer.css("backgroundColor","#000");
}
}
this.mapType=_186;
_191=true;
}
var _193=false;
_183=this.zoomLevelCheck(Number(_183));
if(this.currentZoomLevel!=_183){
if(!this.firstJump){
_193=true;
}
this.currentZoomLevel=_183;
}
this.metersPerPixel=this.zoomLevels[this.currentZoomLevel];
this.tileExtent=this.alignTiles();
this.tilePixelWidth=256;
this.tilePixelHeight=256;
var _194=this.tilePixelWidth;
var _195=this.tilePixelHeight;
var _196=this.metersPerPixel;
this.tileMeterWidth=_194*_196;
this.tileMeterHeight=_195*_196;
if(this.mapViewCenter.x!=0&&this.mapViewCenter.y!=0&&this.mapViewCenter.x!=Number(x)&&this.mapViewCenter.y!=Number(y)){
this.throwEvent("jumped");
}
this.mapViewCenter.x=Number(x);
this.mapViewCenter.y=Number(y);
this.calculateMapViewAndGridExtent();
if(this.mapType!="oblique"){
this.validateExtent();
}
var _197=this.mapGridExtent;
var _198=this.mapGridPixelExtent;
var _199=this.mapViewExtent;
this.mapGridTilesWidth=Math.ceil((_197.right-_197.left)/this.tileMeterWidth);
this.mapGridTilesHeight=Math.ceil((_197.top-_197.bottom)/this.tileMeterHeight);
_198.top=0;
_198.bottom=this.mapGridTilesHeight*_195;
_198.left=0;
_198.right=this.mapGridTilesWidth*_194;
this.mapGridPixelExtent=_198;
this.mapGridCenter.x=(_197.right+_197.left)/2;
this.mapGridCenter.y=(_197.top+_197.bottom)/2;
this.gridContainer.css("left",Math.round(((_197.left-_199.left)/_196))+"px");
this.gridContainer.css("top",Math.round(((_199.top-_197.top)/_196))+"px");
this.poiLayerContainer.css("left",Math.round(((_197.left-_199.left)/_196))+"px");
this.poiLayerContainer.css("top",Math.round(((_199.top-_197.top)/_196))+"px");
if(_191){
this.throwEvent("mapTypeChanged");
}
if(_193){
this.throwEvent("zoomed");
}
this.buildGrid();
if(_18e){
this.throwEvent("afterZoom");
}
if(_18f){
this.throwEvent("afterMapTypeChange");
}
if(_190){
this.throwEvent("afterDirectionChange");
}
this.throwEvent("afterJump");
};
KrakMap.TileClient.prototype.zoomToLevel=function(_19a){
_19a=this.zoomLevelCheck(Number(_19a));
if(_19a!=this.currentZoomLevel){
this.jumpToCoordinate(_19a,this.mapViewCenter.x,this.mapViewCenter.y,this.mapType);
}
};
KrakMap.TileClient.prototype.changeMapType=function(_19b,_19c){
if(this.currentZoomLevel<0){
this.mapType=_19b;
}else{
if(_19b!=this.mapType||(this.mapType=="oblique"&&this.obliqueResponse.direction!=_19c)){
if(this.mapType=="oblique"&&_19b!="oblique"){
this.jumpToCoordinate(this.vectorMinZoomLevel,this.mapViewCenter.x,this.mapViewCenter.y,_19b);
}else{
this.jumpToCoordinate(this.currentZoomLevel,this.mapViewCenter.x,this.mapViewCenter.y,_19b,_19c);
}
}
}
};
KrakMap.TileClient.prototype.jumpToExtent=function(_19d,_19e){
var _19f=0;
if(!_19e){
_19e=this.mapType;
}
if(((_19d.right-_19d.left)/this.mapContainerPixelWidth)>((_19d.top-_19d.bottom)/this.mapContainerPixelHeight)){
var _1a0=(_19d.right-_19d.left)/this.mapContainerPixelWidth;
}else{
var _1a0=(_19d.top-_19d.bottom)/this.mapContainerPixelHeight;
}
if(_1a0>=this.zoomLevels[_19f]&&_1a0<=this.zoomLevels[this.zoomLevels.length-1]){
while(_1a0>=this.zoomLevels[_19f]){
_19f++;
}
}else{
if(_1a0>=this.zoomLevels[this.zoomLevels.length-1]){
_19f=this.zoomLevels.length-1;
}
}
this.jumpToCoordinate(_19f,(_19d.right+_19d.left)/2,(_19d.top+_19d.bottom)/2,_19e);
};
KrakMap.TileClient.prototype.jumpToExtentWithBuffer=function(_1a1,_1a2,_1a3){
var _1a4=0;
if(((_1a1.right-_1a1.left)/this.mapContainerPixelWidth)>((_1a1.top-_1a1.bottom)/this.mapContainerPixelHeight)){
var _1a5=(_1a1.right-_1a1.left)/this.mapContainerPixelWidth;
}else{
var _1a5=(_1a1.top-_1a1.bottom)/this.mapContainerPixelHeight;
}
if(_1a5>=this.zoomLevels[_1a4]&&_1a5<=this.zoomLevels[this.zoomLevels.length-1]){
while(_1a5>=this.zoomLevels[_1a4]){
_1a4++;
}
}else{
if(_1a5>=this.zoomLevels[this.zoomLevels.length-1]){
_1a4=this.zoomLevels.length-1;
}
}
var _1a6=this.zoomLevels[_1a4]*Number(_1a2);
_1a1.top+=_1a6;
_1a1.bottom-=_1a6;
_1a1.left-=_1a6;
_1a1.right+=_1a6;
this.jumpToExtent(_1a1,_1a3);
};
KrakMap.TileClient.prototype.jumpToFullExtent=function(){
this.jumpToExtent(this.fullExtent);
};
KrakMap.TileClient.prototype.resizeMap=function(){
var _1a7=this.placeHolder.width()-2;
var _1a8=this.placeHolder.height()-2;
this.mapContainerPixelWidth=_1a7;
this.mapContainerPixelHeight=_1a8;
this.Container.css({width:_1a7,height:_1a8});
if(this.toolbarContainer){
this.toolbarContainer.css({width:_1a7});
_1a8-=20;
}
this.mapContainer.css({width:_1a7,height:_1a8});
this.eventCatcher.css({width:_1a7,height:_1a8});
this.jumpToCoordinate(this.currentZoomLevel,this.mapViewCenter.x,this.mapViewCenter.y,this.mapType);
};
KrakMap.TileClient.prototype.redrawGrid=function(){
this.jumpToCoordinate(this.currentZoomLevel,this.mapViewCenter.x,this.mapViewCenter.y,this.mapType);
};
KrakMap.TileClient.prototype.pixelToGeoCoordinate=function(_1a9,_1aa){
var ext=this.mapViewExtent;
var z=this.zoomLevels[this.currentZoomLevel];
return new KrakMap.Coordinate(ext.left+(Number(_1a9)*z),ext.top-(Number(_1aa)*z));
};
KrakMap.TileClient.prototype.geoToPixelCoordinate=function(geoX,geoY){
if(this.mapType!="oblique"){
var _1af=new KrakMap.Coordinate(this.mapGridPixelExtent.left+Math.round(((Number(geoX)-this.mapGridExtent.left)/this.zoomLevels[this.currentZoomLevel])),this.mapGridPixelExtent.top+Math.round(((this.mapGridExtent.top-Number(geoY))/this.zoomLevels[this.currentZoomLevel])));
return _1af;
}else{
var _1b0=this.obliqueGeoCoordinatesToPixel(new KrakMap.Coordinate(geoX,geoY));
_1b0.x=_1b0.x-this.mapGridExtent.left;
_1b0.y=this.mapGridExtent.top-(this.obliqueResponse.actualpixeldimensions[1]-_1b0.y);
return _1b0;
}
};
KrakMap.TileClient.prototype.utmToDegrees=function(_1b1){
var _1b2=new Array(2);
var _1b3=new coordConvert();
_1b3.UTMXYToLatLon(Number(_1b1.x),Number(_1b1.y),32,false,_1b2);
return new KrakMap.Coordinate(_1b3.RadToDeg(_1b2[0]),_1b3.RadToDeg(_1b2[1]));
};
KrakMap.TileClient.prototype.decimalDegreesToDegreesMinSec=function(_1b4){
var _1b5=Math.round(Number(_1b4.x)*1000000);
var _1b6=Math.round(Number(_1b4.y)*1000000);
var _1b7=new Array(3);
_1b7[0]=Math.floor(_1b5/1000000);
_1b7[1]=Math.floor(((_1b5/1000000)-_1b7[0])*60);
_1b7[2]=(Math.floor(((((_1b5/1000000)-_1b7[0])*60)-_1b7[1])*100000)*60/100000).toFixed(2);
var _1b8=new Array(3);
_1b8[0]=Math.floor(_1b6/1000000);
_1b8[1]=Math.floor(((_1b6/1000000)-_1b8[0])*60);
_1b8[2]=(Math.floor(((((_1b6/1000000)-_1b8[0])*60)-_1b8[1])*100000)*60/100000).toFixed(2);
return {longitude:_1b8,latitude:_1b7};
};
KrakMap.TileClient.prototype.enableMeasureBox=function(){
this.measureBox=true;
var temp=this;
this.eventCatcher.css("cursor",this.crosshairCursor).unbind("mousedown").bind("mousedown",function(_1ba){
temp.measureExtentMousedown(_1ba);
});
if(this.toolbar.measureBox){
this.toolbar.measureBox.css({color:"#71AAD5",fontWeight:"bold",backgroundPosition:"0px -20px"});
}
};
KrakMap.TileClient.prototype.disableMeasureBox=function(){
this.measureBox=false;
var temp=this;
this.eventCatcher.css("cursor",this.grabCursor).unbind("mousedown").bind("mousedown",function(_1bc){
temp.mapMoveMousedown(_1bc);
});
if(this.toolbar.measureBox){
this.toolbar.measureBox.css({color:"#858585",fontWeight:"normal",backgroundPosition:"0px 0px"});
}
};
KrakMap.TileClient.prototype.toggleMeasureBox=function(){
if(this.measureBox){
this.disableMeasureBox();
}else{
this.enableMeasureBox();
}
};
KrakMap.TileClient.prototype.togglePerspectiveView=function(_1bd,_1be){
if(this.perspective&&_1bd=="oblique"){
var left="0px";
var _1c0="0px";
if(this.overviewMapContainer){
left="107px";
_1c0="110px";
}
if(!this.obliqueDirectionPanel){
var self=this;
var _1c2="perspective"+new Date().getTime();
this.obliqueDirectionPanel=jQuery("<div style=\"display:block;position:absolute; z-index:5; bottom:"+_1c0+"; left:"+left+"; width:65px; height:60px; background:url("+this.imgDir+"gfx_bgimage_perspective_up.png) no-repeat; _background:none;\"><img src=\""+this.imgDir+"gfx_perspective_"+_1be+".gif\" alt=\"gfx_perspective_n\" width=\"60\" height=\"60\" border=\"0\" usemap=\"#"+_1c2+"\" /><map name=\""+_1c2+"\"><area shape=\"rect\" coords=\"19,-1,41,20\" href=\"#\" title=\"Nord\" id=\"n\" /><area shape=\"rect\" coords=\"40,19,59,41\" href=\"#\" title=\"\xd8st\" id=\"e\" /><area shape=\"rect\" coords=\"19,40,41,60\" href=\"#\" title=\"Syd\" id=\"s\" /><area shape=\"rect\" coords=\"-3,19,19,41\" href=\"#\" title=\"Vest\" id=\"w\" /></map></div>").appendTo(this.mapContainer).find("area").click(function(){
self.obliqueDirectionPanel.find("img").attr("src",self.imgDir+"gfx_perspective_"+jQuery(this).attr("id")+".gif");
self.changeMapType("oblique",jQuery(this).attr("id"));
return false;
}).end();
}else{
this.obliqueDirectionPanel.css({left:left,bottom:_1c0}).find("img").attr("src",this.imgDir+"gfx_perspective_"+_1be+".gif").end().show();
}
}else{
if(this.obliqueDirectionPanel){
this.obliqueDirectionPanel.hide();
}
}
};
KrakMap.TileClient.prototype.enableOverviewMap=function(){
settings=this.overviewMapSettings;
if(!this.overviewMapSettings.elevation){
this.overviewMapSettings.elevation=2;
}
if(!this.overviewMapSettings.zoomLevels){
this.overviewMapSettings.zoomLevels=new Array(1,2,4,8,16,32,64,128,256,512,1024,2048,3328);
}
if(!this.overviewMapSettings.minZoomLevel){
this.overviewMapSettings.minZoomLevel=0;
}
if(!this.overviewMapSettings.maxZoomLevel){
this.overviewMapSettings.maxZoomLevel=this.overviewMapSettings.zoomLevels.length-1;
}
if(!this.overviewMap&&!this.mainMap){
if(this.toolbar.overviewMap){
this.toolbar.overviewMap.css({backgroundPosition:"2px -18px"});
}
this.overviewMapContainer=jQuery("<div style=\"position: absolute;width: 171px; height: 140px;z-index:4;left:0px;bottom:0px;background:transparent url("+this.imgDir+"gfx_bgtile_mapmini.png) right repeat-y;\"><div style=\"width: 166px; height: 140px; background:white;\"></div></div>");
var _1c3=jQuery("<div style=\"overflow:hidden;position:absolute;left:10px;top:10px;width:150px;height:118px;\"></div>").appendTo(jQuery("<div style=\"display: block;overflow:hidden;width: 166px; height: 140px;border-right:1px solid #D8D8D8;border-top:1px solid #D8D8D8;\"></div>").appendTo(this.overviewMapContainer.children()));
var temp=this;
if(this.mapType=="oblique"&&this.obliqueDirectionPanel){
this.obliqueDirectionPanel.css({left:"107px",bottom:"110px"});
}
if(jQuery.browser.msie&&jQuery.browser.version=="6.0"){
this.overviewMapContainer.css("background","transparent");
}
this.mapContainer.append(this.overviewMapContainer);
var _1c5;
if(jQuery.browser.msie){
_1c5={backgroundImage:"url("+this.imgDir+"transparent.gif)"};
}else{
_1c5={backgroundColor:"transparent"};
}
var _1c6=new KrakMap.TileClient({mapContainer:_1c3.get(0),mainMap:temp,zoomLevels:temp.overviewMapSettings.zoomLevels,maxZoomLevel:temp.overviewMapSettings.maxZoomLevel,minZoomLevel:temp.overviewMapSettings.minZoomLevel,bufferSize:0,domainDistroServers:temp.domainDistroServers});
_1c6=_1c6.tc;
_1c6.viewIndicator=jQuery("<div></div>").css(jQuery.extend({position:"absolute",zIndex:3,cursor:"move",border:"solid",borderColor:"#000",borderWidth:1},_1c5)).appendTo(_1c3).attr("unselectable","on");
_1c6.viewIndicatorEventCatcher=jQuery("<div></div>").css(jQuery.extend({cursor:"move",position:"absolute",top:"0px",left:"0px",width:temp.mapContainer.width(),height:temp.mapContainer.height(),zIndex:"-1"},_1c5)).appendTo(temp.mapContainer);
_1c6.getBuildingGridEvent(_1c6,function(obj){
clearInterval(obj.animateMoveMapTimer);
clearInterval(obj.animateScrollTimer);
var _1c8=obj.mainMap.getMapViewExtent();
obj.viewIndicator.css({left:Math.round((_1c8.left-obj.mapViewExtent.left)/obj.metersPerPixel),top:Math.round((obj.mapViewExtent.top-_1c8.top)/obj.metersPerPixel),width:Math.round((_1c8.right-_1c8.left)/obj.metersPerPixel),height:Math.round((_1c8.top-_1c8.bottom)/obj.metersPerPixel)});
});
var _1c9=function(obj){
if(!obj.viewIndicatorMoving){
var _1cb=obj.mainMap.getMapViewExtent();
obj.viewIndicator.css({left:Math.round((_1cb.left-obj.mapViewExtent.left)/obj.metersPerPixel),top:Math.round((obj.mapViewExtent.top-_1cb.top)/obj.metersPerPixel)});
}
};
this.getMapMovedEvent(_1c6,_1c9);
_1c6.getMapMovedEvent(_1c6,_1c9);
if(this.mapType=="oblique"){
var _1cc=this.obliquePixelToGeoCoordinates(new KrakMap.Coordinate(this.mapViewCenter.x,this.obliqueResponse.actualpixeldimensions[1]-this.mapViewCenter.y));
}else{
var _1cc=temp.mapViewCenter;
}
_1c6.jumpToCoordinate(this.currentZoomLevel+this.overviewMapSettings.elevation,_1cc.x,_1cc.y,"kvec");
this.overviewMap=_1c6;
this.overviewMap.viewIndicator.bind("mousedown",function(_1cd){
temp.viewIndicatorMouseDown(_1cd);
});
}
};
KrakMap.TileClient.prototype.disableOverviewMap=function(){
if(this.overviewMap){
if(this.toolbar.overviewMap){
this.toolbar.overviewMap.css({backgroundPosition:"2px 1px"});
}
this.overviewMapContainer.remove();
this.overviewMap.viewIndicatorEventCatcher.remove();
this.overviewMap.viewIndicatorEventCatcher=null;
this.overviewMapContainer=null;
this.overviewMap=null;
if(this.mapType=="oblique"&&this.obliqueDirectionPanel){
this.obliqueDirectionPanel.css({left:"0px",bottom:"0px"});
}
}
};
KrakMap.TileClient.prototype.toggleOverviewMap=function(){
if(this.overviewMap){
this.disableOverviewMap();
}else{
this.enableOverviewMap(this.overviewMapSettings);
}
};
KrakMap.TileClient.prototype.enableNavigationKeys=function(){
this.navigationKeys=true;
var temp=this;
this.eventCatcher.bind("mouseover",function(_1cf){
jQuery(document).bind("keydown",function(_1d0){
temp.navigateKeyDown(_1d0);
});
});
this.eventCatcher.bind("mouseout",function(_1d1){
jQuery(document).unbind("keydown");
});
};
KrakMap.TileClient.prototype.disableNavigationKeys=function(){
this.navigationKeys=false;
this.eventCatcher.unbind("mouseover").unbind("mouseout").unbind("keydown").unbind("keyup");
clearInterval(this.animateScrollTimer);
clearInterval(this.animateMoveTimer);
};
KrakMap.TileClient.prototype.toggleNavigationKeys=function(){
if(this.navigationKeys){
this.disableNavigationKeys();
}else{
this.enableNavigationKeys();
}
};
KrakMap.TileClient.prototype.moveMap=function(_1d2){
var _1d3=new KrakMap.Coordinate(_1d2.x,_1d2.y);
if(this.mapType=="oblique"){
this.jumpToCoordinate(this.currentZoomLevel,_1d3.x,_1d3.y,this.mapType);
return;
}
this.mapMoveStartGridX=parseInt(this.gridContainerDomStyle.left);
this.mapMoveStartGridY=parseInt(this.gridContainerDomStyle.top);
this.mapMoveStartViewExtent=this.mapViewExtent;
var _1d4=this.mapContainerPixelWidth;
var _1d5=this.mapContainerPixelHeight;
var _1d6=this.metersPerPixel;
if(this.mainMap&&this.mainMap.mapType=="oblique"){
_1d3.y=this.mainMap.obliqueResponse.actualpixeldimensions[1]-_1d3.y;
_1d3=this.mainMap.obliquePixelToGeoCoordinates(_1d3);
}
var _1d7=new KrakMap.Extent(_1d3.y+((_1d5*_1d6)/2),_1d3.y-((_1d5*_1d6)/2),_1d3.x-((_1d4*_1d6)/2),_1d3.x+((_1d4*_1d6)/2));
this.targetPixelCoordinate=this.geoToPixelCoordinate(_1d7.left,_1d7.top);
this.targetPixelCoordinate=new KrakMap.Coordinate(-this.targetPixelCoordinate.x,-this.targetPixelCoordinate.y);
var temp=this;
clearInterval(this.animateMoveTimer);
this.animateMoveTimer=setInterval(function(){
temp.animateMove(temp,temp.targetPixelCoordinate);
},1);
};
KrakMap.TileClient.prototype.addTileLayer=function(id,_1da,url){
this.customTiles[id]={container:jQuery("<div></div>").css({position:"absolute",zIndex:Number(this.mapGrid.css("z-index"))+_1da}).appendTo(this.gridContainer),url:url,show:true};
};
KrakMap.TileClient.prototype.modifyTileLayer=function(id,_1dd,url){
this.customTiles[id].container.css({zIndex:Number(this.mapGrid.css("z-index"))+_1dd});
this.customTiles[id].url=url;
};
KrakMap.TileClient.prototype.removeTileLayer=function(id){
this.customTiles[id].container.remove();
delete this.customTiles[id];
};
KrakMap.TileClient.prototype.removeAllTileLayers=function(){
for(key in this.customTiles){
this.customTiles[key].container.remove();
delete this.customTiles[key];
}
};
KrakMap.TileClient.prototype.switchTileLayerOn=function(_1e0){
var _1e1=this.customTiles;
if(_1e1[_1e0]&&!_1e1[_1e0].show){
_1e1[_1e0].show=true;
_1e1[_1e0].container.css("display","block");
}
};
KrakMap.TileClient.prototype.switchTileLayerOff=function(_1e2){
var _1e3=this.customTiles;
if(_1e3[_1e2]&&_1e3[_1e2].show){
_1e3[_1e2].show=false;
_1e3[_1e2].container.css("display","none");
}
};
KrakMap.TileClient.prototype.toggleTileLayer=function(_1e4){
var _1e5=this.customTiles;
if(_1e5[_1e4]&&!_1e5[_1e4].show){
this.switchTileLayerOn(_1e4);
}else{
if(_1e5[_1e4]&&_1e5[_1e4].show){
this.switchTileLayerOff(_1e4);
}
}
};
KrakMap.TileClient.prototype.isTileLayer=function(_1e6){
if(this.customTiles[_1e6]&&this.customTiles[_1e6].show){
return true;
}
return false;
};
KrakMap.TileClient.prototype.enableRoute=function(_1e7,jump){
this.route=new wktCanvas(this);
this.route.setWkt(_1e7,true,jump);
};
KrakMap.TileClient.prototype.disableRoute=function(){
if(this.route){
this.route.clearWkt();
}
this.route=null;
};
KrakMap.TileClient.prototype.enableRouteSearch=function(){
this.routeSearchOpen=true;
if(this.toolbar.route){
this.toolbar.route.css({color:"#71AAD5",fontWeight:"bold",backgroundPosition:"0px -20px"});
}
if(!this.routeSearchContainer){
this.routeSearchContainer=jQuery("<div></div>").css({opacity:"0.9",background:"#FFFFFF none repeat scroll 0%",position:"absolute",top:"0px",width:"100%",zIndex:"3",display:"none",margin:"0pt",padding:"0pt"}).appendTo(this.mapContainer);
var _1e9=jQuery("<fieldset></fieldset>").css({borderStyle:"none none solid none",borderBottom:"1px solid #D8D8D8",padding:"10px",margin:"0pt",backgroundColor:"white"}).appendTo(this.routeSearchContainer);
var temp=this;
jQuery("<a href=\"#\"><img src=\""+this.imgDir+"gfx_icon_routeplan_close.gif\" border=\"0\"></a>").css({outline:"none",position:"absolute",right:"4px",bottom:"4px"}).bind("click",function(){
temp.disableRouteSearch();
return false;
}).appendTo(this.routeSearchContainer);
jQuery("<div></div>").css({position:"absolute",background:"transparent url("+this.imgDir+"toolbar/shadow.png) repeat-x scroll left top",height:"5px",width:"100%"}).appendTo(this.routeSearchContainer);
jQuery("<label></label>").css({font:"10px Verdana,Arial, Sans-serif"}).text("Vejnavn/Husnr").appendTo(_1e9);
this.toolbar.routeFrom=jQuery("<input type=\"text\"></input>").css({border:"1px solid #D8D8D8",margin:"0 0.38em 0 2px",padding:"0",width:"30%"}).bind("keypress",function(_1eb){
if(_1eb.which==13){
temp.toolbar.searchButton.click();
return false;
}
}).appendTo(_1e9);
jQuery("<label></label>").css({font:"10px Verdana,Arial, Sans-serif"}).text("Postnr/By").appendTo(_1e9);
this.toolbar.routeTo=jQuery("<input type=\"text\"></input><br />").css({border:"1px solid #D8D8D8",margin:"0 0.38em 0 2px",padding:"0",width:"30%"}).bind("keypress",function(_1ec){
if(_1ec.which==13){
temp.toolbar.searchButton.click();
return false;
}
}).appendTo(_1e9);
this.toolbar.searchButton=jQuery("<input type=\"image\"></input>").attr({src:this.imgDir+"gfx_bgimage_button_show.gif"}).css({marginLeft:"4px",marginTop:"4px"}).appendTo(_1e9);
var _1ed=jQuery("<span></span>").css({display:"none",border:"0pt none",padding:"0px"}).appendTo(_1e9);
this.toolbar.routeOption=jQuery("<select name=\"routeoption\"></select>").css("display","none").appendTo(_1e9);
this.toolbar.routeLink=jQuery("<input type=\"image\"></input> &nbsp;").attr({src:this.imgDir+"gfx_bgimage_button_route.gif"}).css({marginLeft:"4px",marginTop:"4px"}).appendTo(_1ed);
this.toolbar.travelLink=jQuery("<input type=\"image\" src=\""+this.imgDir+"/gfx_bgimage_button_travel.gif\" />").css({marginLeft:"4px",marginTop:"4px"}).appendTo(_1ed);
var temp=this;
this.toolbar.searchButton.bind("click",function(){
temp.throwEvent("routeSearch");
_1ed.show();
return false;
});
this.toolbar.routeOption.change(function(){
temp.throwEvent("routeOptionChange");
});
this.toolbar.travelLink.bind("click",function(){
temp.throwEvent("travelLinkClick");
return false;
});
this.toolbar.routeLink.click(function(){
temp.throwEvent("routeLinkClick");
return false;
});
}
this.routeSearchContainer.fadeIn();
};
KrakMap.TileClient.prototype.disableRouteSearch=function(){
if(this.routeSearchContainer){
this.routeSearchOpen=false;
this.routeSearchContainer.fadeOut();
if(this.toolbar.route){
this.toolbar.route.css({color:"#71AAD5",fontWeight:"bold",backgroundPosition:"0px 0px"});
}
}
};
KrakMap.TileClient.prototype.toggleRouteSearch=function(){
if(!this.routeSearchContainer){
this.enableRouteSearch();
}else{
if(this.routeSearchContainer.css("display")=="none"){
this.enableRouteSearch();
}else{
this.disableRouteSearch();
}
}
};
KrakMap.TileClient.prototype.isRouteSearch=function(){
return this.routeSearchOpen;
};
KrakMap.TileClient.prototype.addPoi=function(pois){
if(!(pois instanceof Array)){
pois=[pois];
}
var _1ef={};
for(var i=0;i<pois.length;i++){
var x=pois[i].coordinate.x;
var y=pois[i].coordinate.y;
var _1f3=pois[i].width;
var _1f4=pois[i].height;
var _1f5=pois[i].category;
var poi=pois[i].dom;
if(!_1ef[_1f5]){
_1ef[_1f5]=document.createDocumentFragment();
}
var _1f7=this.geoToPixelCoordinate(x,y);
var _1f8=this.getPoiLayer(_1f5);
var id=null;
if(poi.id){
id=poi.id;
}else{
id="poiGenratedId"+this.poiGeneratedId;
this.poiGeneratedId++;
}
if(!_1f8.pois[id]){
if(_1f3<=0){
_1f3=1;
}
if(_1f4<=0){
_1f4=1;
}
var _1fa=poi.style;
_1fa.left=Math.round(_1f7.x-_1f3/2)+"px";
_1fa.top=Math.round(_1f7.y-_1f4/2)+"px";
_1fa.position="absolute";
_1fa.display="none";
_1ef[_1f5].appendChild(poi);
_1f8.pois[id]=new KrakMap.PoiData(x,y,_1f3,_1f4,_1f5,poi);
if(this.mapType=="oblique"){
_1f8.pois[id].poi.style.display="none";
}else{
_1f8.pois[id].poi.style.display="block";
}
}
}
for(var _1f5 in _1ef){
this.getPoiLayer(_1f5).layer.appendChild(_1ef[_1f5]);
}
};
KrakMap.TileClient.prototype.addPoi2=function(x,y,_1fd,poi){
this.addPoi(x,y,0,0,_1fd,poi);
};
KrakMap.TileClient.prototype.removeAllPoi=function(){
this.poiLayerContainer.empty();
this.poiLayers=new Object();
};
KrakMap.TileClient.prototype.removeAllPoiInLayer=function(_1ff){
if(this.poiLayers[_1ff]){
this.poiLayers[_1ff].layer.innerHTML="";
this.poiLayerContainer.get(0).removeChild(this.poiLayers[_1ff].layer);
delete this.poiLayers[_1ff];
}
};
KrakMap.TileClient.prototype.removePoi=function(_200,id){
if(!_200){
for(key in this.poiLayers){
if(this.poiLayers[key].pois[id]){
_200=key;
break;
}
}
}
if(_200&&this.poiLayers[_200].pois[id]){
this.poiLayers[_200].layer.removeChild(this.poiLayers[_200].pois[id].poi);
delete this.poiLayers[_200].pois[id];
}
};
KrakMap.TileClient.prototype.togglePoiLayer=function(_202){
if(this.poiLayers[_202]){
if(this.poiLayers[_202].layer.style.display=="none"){
this.poiLayers[_202].layer.style.display="block";
}else{
this.poiLayers[_202].layer.style.display="none";
}
}
};
KrakMap.TileClient.prototype.switchPoiLayerOn=function(_203){
if(this.poiLayers[_203]){
this.poiLayers[_203].layer.style.display="block";
}
};
KrakMap.TileClient.prototype.switchPoiLayerOff=function(_204){
if(this.poiLayers[_204]){
this.poiLayers[_204].layer.style.display="none";
}
};
KrakMap.TileClient.prototype.enablePolygonDraw=function(){
this.disableCircleDraw();
this.disableMeasureLine();
this.polygonDrawCoordinates=[];
this.polygonDrawStartPointX=0;
this.polygonDrawStartPointY=0;
this.polygonWKTString="";
this.polygonDrawTempRoute=null;
this.polygonDrawPoints=null;
if(this.route){
this.route.clearWkt();
}
this.route=null;
this.polygonDrawEnabled=true;
this.polygonWKTString="";
var temp=this;
this.eventCatcher.unbind("mousedown").bind("mousedown",function(_206){
temp.polygonDrawAddCoordinate(_206);
});
};
KrakMap.TileClient.prototype.disablePolygonDraw=function(){
this.polygonDrawEnabled=false;
var temp=this;
this.eventCatcher.unbind("mousedown").bind("mousedown",function(_208){
temp.mapMoveMousedown(_208);
}).unbind("mousemove").bind("mousemove",function(_209){
temp.trackMousemove(_209);
});
};
KrakMap.TileClient.prototype.togglePolygonDraw=function(){
if(this.polygonDrawEnabled){
this.disablePolygonDraw();
}else{
this.enablePolygonDraw();
}
};
KrakMap.TileClient.prototype.enableMeasureLine=function(){
this.disableCircleDraw();
this.disablePolygonDraw();
this.measureLineEnabled=true;
this.measureLineCoordinates=[];
this.measureLineWKTString="";
if(this.route){
this.route.clearWkt();
}
var temp=this;
this.eventCatcher.unbind("mousedown").bind("mousedown",function(_20b){
temp.measureLineAddCoordinate(_20b);
});
this.eventCatcher.unbind("dblclick").bind("dblclick",function(_20c){
temp.disableMeasureLine(_20c);
});
};
KrakMap.TileClient.prototype.disableMeasureLine=function(){
this.updateLengthOfMeasuredLine();
if(this.measureLineEnabled){
this.throwEvent("afterMeasureTool");
}
this.measureLineEnabled=false;
var temp=this;
this.eventCatcher.unbind("mousedown").bind("mousedown",function(_20e){
temp.mapMoveMousedown(_20e);
}).bind("mousemove",function(_20f){
temp.trackMousemove(_20f);
});
this.eventCatcher.unbind("dblclick").bind("dblclick",function(_210){
temp.zoomByDoubleClick(_210);
});
};
KrakMap.TileClient.prototype.toggleMeasureLine=function(){
if(this.measureLineEnabled){
this.disableMeasureLine();
}else{
this.enableMeasureLine();
}
};
KrakMap.TileClient.prototype.enableCircleDraw=function(){
this.disablePolygonDraw();
this.disableMeasureLine();
this.circleCenter=null;
this.circleRadius=null;
if(this.route){
this.route.clearWkt();
}
var that=this;
this.circleDrawEnabled=true;
this.eventCatcher.css("cursor",this.crosshairCursor).unbind("mousedown");
this.eventCatcher.bind("mousedown",function(_212){
that.circleDraw(_212);
});
};
KrakMap.TileClient.prototype.disableCircleDraw=function(){
var that=this;
this.circleDrawEnabled=false;
this.eventCatcher.unbind("mousedown");
this.eventCatcher.unbind("mousemove");
this.eventCatcher.unbind("mouseup");
this.eventCatcher.css("cursor",this.grabCursor).bind("mousedown",function(_214){
that.mapMoveMousedown(_214);
}).bind("mousemove",function(_215){
that.trackMousemove(_215);
});
};
KrakMap.TileClient.prototype.circleDraw=function(_216){
var that=this;
switch(_216.type){
case "mousedown":
this.disableRoute();
this.throwEvent("beforeCircleDraw");
this.route=new wktCanvas(this);
this.throwEvent("beforeAddPoint");
this.circleCenter=this.pixelToGeoCoordinate(this.mousePositionX,this.mousePositionY);
this.throwEvent("afterAddPoint");
this.eventCatcher.bind("mousemove",function(_218){
that.circleDraw(_218);
});
this.eventCatcher.bind("mouseup",function(_219){
that.circleDraw(_219);
});
break;
case "mousemove":
var cur=this.pixelToGeoCoordinate(this.mousePositionX,this.mousePositionY);
var dx=Math.abs(cur.x-this.circleCenter.x);
var dy=Math.abs(cur.y-this.circleCenter.y);
this.circleRadius=Math.sqrt(dx*dx+dy*dy);
var wkt=["POLYGON(("];
for(var i=0;i<this.circleApproximationEdges;i++){
wkt[wkt.length]=(this.circleCenter.x+this.circleRadius*Math.sin(this.circleSegmentLength*i));
wkt[wkt.length]=" ";
wkt[wkt.length]=(this.circleCenter.y+this.circleRadius*Math.cos(this.circleSegmentLength*i));
wkt[wkt.length]=(i<this.circleApproximationEdges-1)?",":"))";
}
wkt=wkt.join("");
if(!this.route.setWkt(wkt,false,false)){
throw "Invalid geometry";
}
break;
case "mouseup":
this.eventCatcher.unbind("mousemove").bind("mousemove",function(_21f){
that.trackMousemove(_21f);
});
this.eventCatcher.unbind("mouseup");
this.throwEvent("circleDraw");
this.throwEvent("afterCircleDraw");
break;
default:
return;
}
};
KrakMap.TileClient.prototype.toggleCircleDraw=function(){
if(this.isCircleDraw()){
this.disableCircleDraw();
}else{
this.enableCircleDraw();
}
};
KrakMap.TileClient.prototype.isCircleDraw=function(){
return this.circleDrawEnabled;
};
KrakMap.TileClient.prototype.getMapViewCenter=function(){
var _220=null;
if(this.mapType=="oblique"){
return this.obliquePixelToGeoCoordinates(new KrakMap.Coordinate(this.mapViewCenter.x,this.obliqueResponse.actualpixeldimensions[1]-this.mapViewCenter.y));
}else{
_220=this.mapViewCenter;
}
return _220;
};
KrakMap.TileClient.prototype.getCurrentZoomLevel=function(){
return this.currentZoomLevel;
};
KrakMap.TileClient.prototype.getZoomLevels=function(){
return this.zoomLevels;
};
KrakMap.TileClient.prototype.getVectorMinZoomLevel=function(){
return this.vectorMinZoomLevel;
};
KrakMap.TileClient.prototype.getMapType=function(){
return this.mapType;
};
KrakMap.TileClient.prototype.getMapViewExtent=function(){
if(this.mapType=="oblique"){
return this.obliquePixelToGeoExtent(this.mapViewExtent);
}
return this.mapViewExtent;
};
KrakMap.TileClient.prototype.getMapGridExtent=function(){
if(this.mapType=="oblique"){
return this.obliquePixelToGeoExtent(this.mapGridExtent);
}
return this.mapGridExtent;
};
KrakMap.TileClient.prototype.getMetersPerPixel=function(){
return this.metersPerPixel;
};
KrakMap.TileClient.prototype.getMinZoomLevel=function(){
return this.minZoomLevel;
};
KrakMap.TileClient.prototype.getMaxZoomLevel=function(){
if(this.mapType=="oblique"){
return this.ObliqueService.zoomLevels.length-1;
}
return this.maxZoomLevel;
};
KrakMap.TileClient.prototype.getMeasuredExtent=function(){
if(this.mapType=="oblique"){
return this.obliquePixelToGeoExtent(this.measuredExtent);
}
return this.measuredExtent;
};
KrakMap.TileClient.prototype.getMeasureBox=function(){
return this.measureBox;
};
KrakMap.TileClient.prototype.getNavigationKeys=function(){
return this.navigationKeys;
};
KrakMap.TileClient.prototype.getOverviewMap=function(){
return this.overviewMap;
};
KrakMap.TileClient.prototype.getMousePosition=function(){
return new KrakMap.Coordinate(this.mousePositionX,this.mousePositionY);
};
KrakMap.TileClient.prototype.getMapState=function(){
var _221=this.getMapViewCenter();
return {zoomLevel:this.getCurrentZoomLevel(),mapType:this.getMapType(),mapViewCenter:{x:_221.x,y:_221.y},minZoomLevel:this.getMinZoomLevel(),maxZoomLevel:this.getMaxZoomLevel()};
};
KrakMap.TileClient.prototype.getSerializedMapState=function(){
var _222=this.getMapViewCenter();
var _223=this.overviewMapSettings;
var _224=(this.overviewMap)?true:false;
return "{"+"zoomLevel:"+this.getCurrentZoomLevel()+","+"mapType:'"+this.getMapType()+"',"+"mapViewCenter:{x:"+_222.x+",y: "+_222.y+"},"+"minZoomLevel:"+this.getMinZoomLevel()+","+"maxZoomLevel:"+this.getMaxZoomLevel()+"}";
};
KrakMap.TileClient.prototype.setMinZoomLevel=function(_225){
this.minZoomLevel=Number(_225);
};
KrakMap.TileClient.prototype.setMaxZoomLevel=function(_226){
this.maxZoomLevel=Number(_226);
};
KrakMap.TileClient.prototype.setRouteFallBack=function(flag){
this.routeFallBack=flag;
};
KrakMap.TileClient.prototype.setMapState=function(_228){
if(typeof (_228)=="string"){
eval("mapState ="+_228);
}
this.setMinZoomLevel(_228.minZoomLevel);
this.setMaxZoomLevel(_228.maxZoomLevel);
this.jumpToCoordinate(_228.zoomLevel,_228.mapViewCenter.x,_228.mapViewCenter.y,_228.mapType);
if(_228.overviewMap){
this.enableOverviewMap(_228.overviewMapSettings);
}
if(_228.measureBox){
this.enableMeasureBox();
}
if(_228.navigationKeys){
this.enableNavigationKeys();
}
};
KrakMap.TileClient.prototype.setOverviewMapSettings=function(_229){
this.overviewMapSettings=_229;
};
KrakMap.TileClient.prototype.setToolbarCenterButtonCoordinate=function(_22a,_22b,_22c,_22d){
if(_22a.x<99999&&_22a.y<99999){
_22a=this.obliquePixelToGeoCoordinates(new KrakMap.Coordinate(Math.round(Number(_22a.x)),this.obliqueResponse.actualpixeldimensions[1]-Math.round(Number(_22a.y))));
}
var temp=this;
this.toolbar.center.unbind("click").bind("click",function(){
temp.jumpToCoordinate(_22b,_22a.x,_22a.y,_22c,_22d);
return false;
});
};
KrakMap.TileClient.prototype.setPrintAction=function(_22f){
if(this.toolbar.print){
this.toolbar.print.unbind("click").bind("click",_22f).bind("click",function(){
return false;
});
}
};
KrakMap.Extent=function(top,_231,left,_233){
this.top=Number(top);
this.bottom=Number(_231);
this.left=Number(left);
this.right=Number(_233);
};
KrakMap.Extent.prototype.toString=function(_234){
_234=Number(_234);
if(_234==undefined){
_234=0;
}
var _235;
if(_234==0){
_235="{top: "+this.top+", bottom: "+this.bottom+", left: "+this.left+", right: "+this.right+"}";
}else{
_235="{top: "+this.top.toFixed(_234)+", bottom: "+this.bottom.toFixed(_234)+", left: "+this.left.toFixed(_234)+", right: "+this.right.toFixed(_234)+"}";
}
return _235;
};
KrakMap.Coordinate=function(x,y){
this.x=Number(x);
this.y=Number(y);
};
KrakMap.Coordinate.prototype.toString=function(_238){
_238=Number(_238);
if(_238==undefined){
_238=0;
}
var _239;
if(_238==0){
_239="{x: "+this.x+", y: "+this.y+"}";
}else{
_239="{x: "+this.x.toFixed(_238)+", y: "+this.y.toFixed(_238)+"}";
}
return _239;
};
KrakMap.PoiData=function(x,y,_23c,_23d,_23e,poi){
this.x=x;
this.y=y;
this.width=_23c;
this.height=_23d;
this.layer=_23e;
this.poi=poi;
};
KrakMap.PoiLayerData=function(_240){
this.layer=_240;
this.pois=new Object();
};
KrakMap.ObliqueService=function(_241){
this.tileclient=_241;
jQuery.extend(this,_241.settings.obliqueSettings);
};
KrakMap.ObliqueService.states={loading:"loading",completed:"completed",error:"error"};
KrakMap.ObliqueService.prototype={domainDistroServers:["otile00.krak.dk","otile01.krak.dk","otile02.krak.dk","otile03.krak.dk"],url:"tileclient.krak.dk",zoomLevels:["1.0","0.7","0.4"],distributionBase:1,timeOutMillesec:10000,state:KrakMap.ObliqueService.states.loading,_codes:{nocontentfound:204,badrequest:400,notfound:404,serviceunavailable:503,timeout:1000},_texts:{unknown:"Vi beklager, men der er sket en fejl.",fatal:"Vi beklager, men der er sket en fejl.",timeout:"Vi beklager, men der er sket en fejl.",noimages:"Vi har desv\xe6rre ingen skr\xe5foto i dette omr\xe5de"},_places:{},_retrys:3,isAvailable:function(_242){
if(this.state==KrakMap.ObliqueService.states.completed){
var x=_242.x;
var y=_242.y;
var _245=_places["n"];
for(var i=_245.length-1;i>=0;i--){
if(x>=_245[i][0]&&x<=_245[i][1]&&y>=_245[i][2]&&y<=_245[i][3]){
return true;
}
}
}
return false;
},getBestPhoto:function(_247,x,y,_24a,_24b){
if(_247<0){
_247=0;
}
if(_247>this.zoomLevels.length-1){
_247=this.zoomLevels.length-1;
}
if(x<99999&&y<99999){
var _24c=this.tileclient.obliquePixelToGeoCoordinates(new KrakMap.Coordinate(Math.round(Number(x)),this.tileclient.obliqueResponse.actualpixeldimensions[1]-Math.round(Number(y))));
x=_24c.x;
y=_24c.y;
}
if(!_24a&&this.tileclient.obliqueResponse){
_24a=this.tileclient.obliqueResponse.direction;
}
if(!_24a){
_24a="n";
}
var self=this;
var url="http://"+this.url+"/ObliqueService/bestphoto/"+_24a+"/"+x+","+y+"/"+this.zoomLevels[_247];
var _24f=false;
var _250=setTimeout(function(){
_24f=true;
self._getBestPhotoError(self._codes.timeout,null);
},this.timeOutMillesec);
jQuery.ajax({url:url,dataType:"jsonp",success:function(json){
clearTimeout(_250);
if(!_24f){
if(json.errorcode&&json.errorcode!=self._codes.nocontentfound){
self._getBestPhotoError(json.errorcode,json.errordesc);
}else{
_24b(json,x,y,_247);
}
}
}});
},getBestPhotoPlaces:function(_252){
var self=this;
var url="http://"+this.url+"/ObliqueService/bestphoto/places/extents";
var _255=(arguments[1]?arguments[1]:0);
var _256=false;
var _257=setTimeout(function(){
_256=true;
self._getBestPhotoPlacesError(self._codes.timeout,null,_252,_255);
},this.timeOutMillesec);
jQuery.ajax({url:url,dataType:"jsonp",success:function(json){
clearTimeout(_257);
if(!_256){
if(json.errorcode){
self._getBestPhotoPlacesError(json.errorcode,json.errordesc,null,null);
}else{
self._endBestPhotoPlaces(json);
_252();
}
}
}});
},_endBestPhotoPlaces:function(json){
_places=json;
this.state=KrakMap.ObliqueService.states.completed;
},_getBestPhotoError:function(_25a,_25b){
switch(_25a){
case this._codes.timeout:
this.tileclient.messageBoard.error(this._texts.timeout);
break;
case this._codes.serviceunavailable:
case this._codes.badrequest:
case this._codes.notfound:
this.tileclient.messageBoard.error(this._texts.fatal);
break;
default:
this.tileclient.messageBoard.error(this._texts.unknown);
break;
}
},_getBestPhotoPlacesError:function(_25c,_25d,_25e,_25f){
switch(_25c){
case this._codes.timeout:
_25f++;
if(_25f<this._retrys){
this.getBestPhotoPlaces(_25e,_25f);
}else{
this.tileclient.messageBoard.error(this._texts.timeout);
}
break;
case this._codes.nocontentfound:
self.tileclient.messageBoard.error(this._texts.fatal);
break;
case this._codes.serviceunavailable:
case this._codes.badrequest:
case this._codes.notfound:
self.tileclient.messageBoard.error(this._texts.fatal);
break;
default:
this.tileclient.messageBoard.error(this._texts.unknown);
break;
}
}};
KrakMap.Message=function(type,text,_262){
this.type=type;
this.text=text;
this.settings=_262;
};
KrakMap.Message.types={error:"error",info:"info",wating:"wating",loading:"loading"};
KrakMap.MessageBoard=function(_263){
this.tileclient=_263;
jQuery.extend(this._displayOptions,_263.settings.messageBoardSettings);
};
KrakMap.MessageBoard.prototype={_displayOptions:{visible:true},_genericMessages:{error:"Der er sket en fejl",info:"Der er sket noget",wating:"Vent venligst",loading:"Opretter; vent venligst"},_settings:{Retry:0,CallBack:null,Block:true,CanClose:false},messages:[],active:false,error:function(){
this.parseArgument(arguments,KrakMap.Message.types.error);
},info:function(){
this.parseArgument(arguments,KrakMap.Message.types.info);
},wating:function(){
this.parseArgument(arguments,message.types.wating);
},loading:function(){
this.parseArgument(arguments,message.types.loading);
},parseArgument:function(args,type){
var m;
if(args.length==0){
m=new KrakMap.Message(type,this._genericMessages[type],this._settings);
}else{
if(args.length==1){
if(typeof (args[0]).toLowerCase()=="string"){
m=new KrakMap.Message(type,args[0],this._settings);
}
}else{
m=new KrakMap.Message(type,jQuery.extend({},this._settings,args[1]));
}
}
this.show(m);
},_bottom:0,_stack:[],show:function(m){
if(this._displayOptions.visible){
this.active=true;
this.messages.push(m);
this.advancedShow(m);
}
},advancedShow:function(m){
var html=jQuery("<div style=\"position: absolute;z-index:1000;right:0px;bottom:"+this._bottom+"px; display:none; text-align:center;\"><div style=\"display:none;color:#ffffff;border:2px solid silver;background-color: #000000;width:150px;height:50px;  font-weight: bold;\"></div></div>");
switch(m.type){
case KrakMap.Message.types.error:
html.find("div").css("background-color","#FF0000").css("color","#000000");
break;
case KrakMap.Message.types.info:
html.find("div").css("background-color","#ffffff").css("color","#000000");
break;
}
var self=this;
this._stack.push(html);
html.appendTo(this.tileclient.mapContainer).show().find("div").html(m.text).show("slow",function(){
var _26b=jQuery(this).parent();
setTimeout(function(){
self._stack.shift().find("div").hide("slow",function(){
jQuery(this).parent().remove();
jQuery.each(self._stack,function(){
this.css("bottom",parseInt(this.css("bottom").replace("px",""))+"px");
});
});
},5000);
});
},hide:function(){
this.active=false;
this.messageLayer.hide("slow").css("z-index",-1);
}};

var MAXCOORD=32670;
function wktCanvas(_1){
this.browserDetect.init();
this.tileClient=_1;
this.renderSegmented=true;
this.forceFallback=_1.routeFallBack;
this.routeContainer=document.createElement("div");
this.routeContainer.style.position="absolute";
this.routeContainer.style.zIndex=2;
this.tileClient.gridContainer.get(0).appendChild(this.routeContainer);
this.nsSvg="http://www.w3.org/2000/svg";
this.strokeOpacity="100%";
this.strokeColor="#0000ff";
this.strokeWeight="3px";
this.strokeColorHighlighted="#ff0000";
this.strokeWeightHighlighted="4px";
this.polygonFill="#0000ff";
this.polygonOpacity="50%";
this.nullBBox={minx:Infinity,maxx:-Infinity,miny:Infinity,maxy:-Infinity,width:0,height:0};
this.route={asWkt:undefined,asData:undefined,BBox:this.nullBBox,UTMBBox:new KrakMap.Extent(-Infinity,Infinity,Infinity,-Infinity),segmentExtents:[]};
this.tileClient.getBuildingGridEvent(this,this.draw);
this.tileClient.getMapGridExtentUpdatedEvent(this,this.draw);
}
wktCanvas.prototype.browserDetect={init:function(){
this.browser=this.searchString(this.dataBrowser)||"An unknown browser";
this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"an unknown version";
this.OS=this.searchString(this.dataOS)||"an unknown OS";
},searchString:function(_2){
for(var i=0;i<_2.length;i++){
var _4=_2[i].string;
var _5=_2[i].prop;
this.versionSearchString=_2[i].versionSearch||_2[i].identity;
if(_4){
if(_4.indexOf(_2[i].subString)!=-1){
return _2[i].identity;
}
}else{
if(_5){
return _2[i].identity;
}
}
}
},searchVersion:function(_6){
var _7=_6.indexOf(this.versionSearchString);
if(_7==-1){
return;
}
return parseFloat(_6.substring(_7+this.versionSearchString.length+1));
},dataBrowser:[{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.vendor,subString:"Apple",identity:"Safari"},{prop:window.opera,identity:"Opera"},{string:navigator.vendor,subString:"iCab",identity:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.vendor,subString:"Camino",identity:"Camino"},{string:navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],dataOS:[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"Mac"},{string:navigator.platform,subString:"Linux",identity:"Linux"}]};
wktCanvas.prototype.svgEnabled=function(){
var b=this.browserDetect.browser;
return (!(b=="Explorer"||(b=="Safari"&&parseFloat(this.browserDetect.version)<523)||(b=="Mozilla"&&parseFloat(this.browserDetect.version)<2)||(b=="Opera"&&this.tileClient.currentZoomLevel<1)));
};
wktCanvas.prototype.vmlEnabled=function(){
return (this.browserDetect.OS=="Windows"&&this.browserDetect.browser=="Explorer");
};
wktCanvas.prototype.geoCoordinatesToPixel=function(x,y,_b,_c){
return this.tileClient.geoToPixelCoordinate(x,y);
};
wktCanvas.prototype.isValidWKT=function(_d){
var _e=false;
var _f;
try{
_f=_d.replace(/^SRID=\d+;/,"").match(/^(\w+)/)[1].toLowerCase();
}
catch(error){
_f="";
}
if(_f=="point"){
_e=/^POINT\s*\(\s*-?\d+(\.\d+)?\s+-?\d+(\.\d+)?\s*\)\s*$/i.test(_d);
}else{
if(_f=="multipoint"){
_e=/^MULTIPOINT\s*\(\s*-?\d+(\.\d+)?\s+-?\d+(\.\d+)?(\s*,\s*-?\d+(\.\d+)?\s+-?\d+(\.\d+)?)*\s*\)\s*$/i.test(_d);
}else{
if(_f=="linestring"){
_e=/^LINESTRING\s*\(\s*-?\d+(\.\d+)?\s+-?\d+(\.\d+)?\s*,\s*-?\d+(\.\d+)?\s+-?\d+(\.\d+)?(\s*,\s*-?\d+(\.\d+)?\s+-?\d+(\.\d+)?)*\s*\)\s*$/i.test(_d);
}else{
if(_f=="multilinestring"){
_e=/^MULTILINESTRING\s*\(\s*(\(\s*-?\d+(\.\d+)?\s+-?\d+(\.\d+)?\s*,\s*-?\d+(\.\d+)?\s+-?\d+(\.\d+)?(\s*,\s*-?\d+(\.\d+)?\s+-?\d+(\.\d+)?)*\s*\)\s*,?\s*)+\s*\)\s*$/i.test(_d);
}else{
if(_f=="polygon"){
_e=/^POLYGON\s*\(\s*(\(\s*-?\d+(\.\d+)?\s+-?\d+(\.\d+)?\s*,\s*-?\d+(\.\d+)?\s+-?\d+(\.\d+)?(\s*,\s*-?\d+(\.\d+)?\s+-?\d+(\.\d+)?)*\s*\)\s*,?\s*)+\s*\)\s*$/i.test(_d);
}else{
_e=false;
}
}
}
}
}
return _e;
};
wktCanvas.prototype.parseWKT=function(wkt){
var _11={type:"unknown",coords:new Array()};
this.rcoords=_11.coords;
var _12=wkt.replace(/^SRID=\d+;/,"");
_11.type=_12.match(/^(\w+)/)[1].toLowerCase();
var _13=/-?\d+(\.\d+)?/g;
var tc=this.tileClient;
var _15=tc.gridContainer.offset();
var _16=tc.pixelToGeoCoordinate(_15.left,_15.top,tc.currentZoomLevel);
var mpp=tc.metersPerPixel;
var _18=this.route.UTMBBox;
switch(_11.type){
case "point":
case "multipoint":
this.coords=_12.match(_13);
var cl=this.coords.length-1;
for(var i=0;i<cl;i++){
this.rcoords.push(this.geoCoordinatesToPixel(parseFloat(this.coords[i]),parseFloat(this.coords[++i]),_16,mpp));
}
break;
case "linestring":
case "multilinestring":
case "polygon":
var _1b=new Array();
var _1c=this.rcoords;
var _1d=_12.split(/\)\s*,?\s*\(/g);
var pl=_1d.length;
var _1f=this.route.segmentExtents;
for(var p=0;p<pl;p++){
_1c.push(new Array());
_1b[p]=_1d[p].match(_13);
var cl=_1b[p].length-1;
var _21=new KrakMap.Extent(-Infinity,Infinity,Infinity,-Infinity);
for(var i=0;i<cl;i++){
var _22=parseFloat(_1b[p][i]);
var _23=parseFloat(_1b[p][++i]);
var rcp=_1c[p];
if(_22<_18.left){
_18.left=_22;
}
if(_22>_18.right){
_18.right=_22;
}
if(_23<_18.bottom){
_18.bottom=_23;
}
if(_23>_18.top){
_18.top=_23;
}
if(_22<_21.left){
_21.left=_22;
}
if(_22>_21.right){
_21.right=_22;
}
if(_23<_21.bottom){
_21.bottom=_23;
}
if(_23>_21.top){
_21.top=_23;
}
rcp.push(new KrakMap.Coordinate(_22,_23));
}
_1f.push(_21);
}
this.coords=_1b;
break;
}
return _11;
};
wktCanvas.prototype.createSvgElement=function(id){
var svg=document.createElementNS(this.nsSvg,"svg");
svg.setAttributeNS(null,"id",id);
svg.setAttributeNS(null,"version","1.1");
svg.setAttributeNS(null,"overflow","visible");
var _27=this.route.BBox;
svg.setAttributeNS(null,"width",_27.width+4+"px");
svg.setAttributeNS(null,"height",_27.height+4+"px");
svg.setAttributeNS(null,"viewBox",(_27.minx-2)+" "+(_27.miny-2)+" "+(_27.width+4)+" "+(_27.height+4));
svg.style.position="absolute";
svg.style.left=(_27.minx-2)+"px";
svg.style.top=(_27.miny-2)+"px";
svg.style.zIndex="95";
return svg;
};
wktCanvas.prototype.createSvgPolylineElement=function(id,_29){
var _2a=document.createElementNS(this.nsSvg,"svg:polyline");
_2a.setAttributeNS(null,"id",id);
_2a.setAttributeNS(null,"fill","none");
_2a.setAttributeNS(null,"stroke",this.strokeColor);
_2a.setAttributeNS(null,"stroke-width",this.strokeWeight);
_2a.setAttributeNS(null,"stroke-linecap","round");
_2a.setAttributeNS(null,"stroke-linejoin","round");
_2a.setAttributeNS(null,"stroke-opacity","1");
_2a.setAttributeNS(null,"points",_29);
return _2a;
};
wktCanvas.prototype.createSvgTextElement=function(x,y,id,txt){
var _2f=document.createElementNS(this.nsSvg,"svg:text");
_2f.setAttributeNS(null,"id",id);
_2f.setAttributeNS(null,"x",x+"px");
_2f.setAttributeNS(null,"y",y+"px");
_2f.setAttributeNS(null,"fill","white");
_2f.setAttributeNS(null,"font-size",12);
_2f.appendChild(document.createTextNode(txt));
return _2f;
};
wktCanvas.prototype.wkt2svg=function(_30){
var svg=this.createSvgElement("svg");
if(_30==null){
return svg;
}
var tc=this.tileClient;
var dc=_30.coords;
switch(_30.type){
case "multilinestring":
case "linestring":
if(this.renderSegmented){
for(var i=0;i<dc.length;i++){
var _35=dc[i];
if(0==_35.length){
continue;
}
var _36=new Array(_35.length);
for(var j=0;j<_35.length;j++){
var cur=_35[j];
_36.push(cur.x+","+cur.y);
if(tc.polygonDrawEnabled&&0==i&&0==j){
var _39=document.createElementNS(this.nsSvg,"svg:circle");
_39.setAttributeNS(null,"id","polygon");
_39.setAttributeNS(null,"cx",cur.x);
_39.setAttributeNS(null,"cy",cur.y);
_39.setAttributeNS(null,"r",10);
_39.setAttributeNS(null,"fill","#ff00ff");
_39.setAttributeNS(null,"fill-rule","evenodd");
_39.setAttributeNS(null,"fill-opacity","0.75");
svg.appendChild(_39);
}
}
svg.appendChild(this.createSvgPolylineElement("segment"+i,_36.join(" ")));
if(tc.measureLineEnabled){
var _3a=this.route.BBox;
if(_3a.minx<Infinity){
var len=tc.measureLineLength/1000;
var _3c=this.createSvgTextElement(_3a.minx+_3a.width/2,_3a.miny+_3a.height/2,"measuredLength"+i,len.toFixed(1)+"km");
_3c.setAttributeNS(null,"fill","black");
svg.appendChild(_3c);
}
}
}
}else{
var _36=new Array();
for(var i=0;i<dc.length;i++){
for(var j=0;j<dc[i].length;j++){
var cur=dc[i][j];
_36.push(cur.x+","+cur.y);
}
}
svg.appendChild(this.createSvgPolylineElement("segment0",_36.join(" ")));
}
break;
case "polygon":
var _3d=document.createElementNS(this.nsSvg,"svg:polygon");
_3d.setAttributeNS(null,"id","polygon");
_3d.setAttributeNS(null,"fill","#0000ff");
_3d.setAttributeNS(null,"fill-rule","evenodd");
_3d.setAttributeNS(null,"stroke-width","0px");
_3d.setAttributeNS(null,"fill-opacity","0.5");
var rgD=new Array();
for(var i=0;i<dc.length;i++){
for(var j=0;j<dc[i].length;j++){
var cur=dc[i][j];
rgD.push(cur.x+","+cur.y);
}
}
_3d.setAttribute("points",rgD.join(" "));
svg.appendChild(_3d);
if(tc.circleDrawEnabled){
this.circleDrawEnabled=true;
}
if(this.circleDrawEnabled){
var _3a=this.route.BBox;
if(_3a.minx<Infinity){
var len=tc.circleRadius/1000;
var _3f=this.createSvgTextElement(_3a.minx+_3a.width/2,_3a.miny+_3a.height/2,"measuredLength"+i,len.toFixed(1)+"km");
svg.appendChild(_3f);
}
}
break;
}
return svg;
};
wktCanvas.prototype.createVmlElement=function(){
document.namespaces.add("vml","urn:schemas-microsoft-com:vml");
var _40=(document.styleSheets.length>0)?document.styleSheets[0]:document.createStyleSheet();
_40.addRule("vml\\:polyline","behavior:url(#default#VML);position:relative;display:inline-block;");
_40.addRule("vml\\:group","behavior:url(#default#VML);position:relative;display:inline-block;");
_40.addRule("vml\\:shape","behavior:url(#default#VML);position:relative;display:inline-block;");
_40.addRule("vml\\:stroke","behavior:url(#default#VML);position:relative;display:inline-block;");
_40.addRule("vml\\:fill","behavior:url(#default#VML);position:relative;display:inline-block;");
_40.addRule("vml\\:rect","behavior:url(#default#VML);position:relative;display:inline-block;");
_40.addRule("vml\\:oval","behavior:url(#default#VML);position:relative;display:inline-block;");
_40.addRule("vml\\:textbox","behavior:url(#default#VML);position:relative;display:inline-block;");
var vml=document.createElement("div");
var _42=vml.style;
_42.position="absolute";
_42.left="0px";
_42.top="0px";
_42.zIndex="95";
return vml;
};
wktCanvas.prototype.createVmlGroup=function(id){
var _44=document.createElement("vml:group");
_44.setAttribute("id",id);
_44.setAttribute("unselectable","on");
_44.setAttribute("stroke",true);
_44.setAttribute("coordorigin","0 0");
_44.setAttribute("coordsize","512 512");
_44.style.position="absolute";
_44.style.left="0px";
_44.style.top="0px";
_44.style.width="512px";
_44.style.height="512px";
_44.style.zIndex="95";
return _44;
};
wktCanvas.prototype.createVmlPolyline=function(id,_46){
var _47=document.createElement("vml:polyline");
_47.setAttribute("id",id);
_47.setAttribute("filled","false");
_47.setAttribute("points",_46);
var _48=document.createElement("vml:stroke");
_48.setAttribute("opacity",this.strokeOpacity);
_48.setAttribute("color",this.strokeColor);
_48.setAttribute("weight",this.strokeWeight);
_47.appendChild(_48);
return _47;
};
wktCanvas.prototype.createVmlPolygon=function(id,_4a){
var _4b=document.createElement("vml:polyline");
_4b.setAttribute("id",id);
_4b.setAttribute("filled","true");
_4b.setAttribute("stroked","false");
_4b.setAttribute("points",_4a);
var _4c=document.createElement("vml:fill");
_4c.setAttribute("opacity",this.polygonOpacity);
_4c.setAttribute("color",this.polygonFill);
_4c.setAttribute("weight",this.strokeWeight);
_4b.appendChild(_4c);
return _4b;
};
wktCanvas.prototype.createVmlTextElement=function(id,txt){
var _4f=document.createElement("vml:textbox");
_4f.setAttribute("id",id);
_4f.innerHTML=txt;
return _4f;
};
wktCanvas.prototype.wkt2vml=function(_50){
var vml=this.createVmlElement();
var tc=this.tileClient;
if(_50==null){
return vml;
}
var g=this.createVmlGroup("vml");
var dc=_50.coords;
switch(_50.type){
case "multilinestring":
case "linestring":
if(this.renderSegmented){
for(var i=0;i<dc.length;i++){
var _56=dc[i];
if(0==_56.length){
continue;
}
var _57=new Array(_56.length);
for(var j=0;j<_56.length;j++){
var cur=_56[j];
_57[j]=cur.x+","+cur.y;
if(tc.polygonDrawEnabled&&0==i&&0==j){
var _5a=document.createElement("vml:oval");
_5a.setAttribute("id","polygon");
_5a.style.left=(cur.x-10)+"px";
_5a.style.top=(cur.y-10)+"px";
_5a.style.width="20px";
_5a.style.height="20px";
_5a.style.fillcolor="#ff00ff";
_5a.setAttribute("filled","true");
_5a.setAttribute("stroked","false");
var _5b=document.createElement("vml:fill");
_5b.setAttribute("opacity","0.75");
_5b.setAttribute("color","#ff00ff");
_5a.appendChild(_5b);
g.appendChild(_5a);
}
}
var _5c=this.createVmlPolyline("segment"+i,_57.join(" "));
g.appendChild(_5c);
if(tc.measureLineEnabled){
var _5d=this.route.BBox;
if(_5d.minx<Infinity){
var len=tc.measureLineLength/1000;
g.appendChild(this.createVmlTextElement("measuredLength"+i,len.toFixed(1)+"km"));
}
}
}
}else{
var _5f=new Array();
for(var i=0;i<dc.length;i++){
for(var j=0;j<dc[i].length;j++){
var cur=dc[i][j];
_5f.push(cur.x+","+cur.y);
}
}
var _5c=this.createVmlPolyline("segment0",_5f.join(" "));
g.appendChild(_5c);
}
break;
case "polygon":
for(var i=0;i<dc.length;i++){
var _60=dc[i];
if(0==_60.length){
continue;
}
var _5f=new Array();
for(var j=0;j<_60.length;j++){
var _61=_60[j];
_5f.push(_61.x+","+_61.y);
}
var _62=this.createVmlPolygon("polygon"+i,_5f.join(" "));
g.appendChild(_62);
if(tc.circleDrawEnabled){
this.circleDrawEnabled=true;
}
if(this.circleDrawEnabled){
var _5d=this.route.BBox;
if(_5d.minx<Infinity){
var len=tc.circleRadius/1000;
if(!document.getElementById("radiusText")){
var _63=this.createVmlTextElement("radiusText",len.toFixed(1)+"km");
_63.style.color="white";
var _64=(len*1000)/this.tileClient.metersPerPixel;
_63.style.left=(_64-20)+"px";
_63.style.top=(_64-6)+"px";
g.appendChild(_63);
}else{
document.getElementById("radiusText").innerHTML=len.toFixed(1)+"km";
}
}
}
}
break;
}
vml.appendChild(g);
return vml;
};
wktCanvas.prototype.getBBox=function(_65){
var _66=this.nullBBox;
var cur={x:null,y:null};
var dc=_65.coords;
switch(_65.type){
case "linestring":
case "multilinestring":
case "polygon":
for(var i=0;i<dc.length;i++){
for(var j=0;j<dc[i].length;j++){
cur=dc[i][j];
if(cur.x<_66.minx){
_66.minx=cur.x;
}
if(cur.x>_66.maxx){
_66.maxx=cur.x;
}
if(cur.y<_66.miny){
_66.miny=cur.y;
}
if(cur.y>_66.maxy){
_66.maxy=cur.y;
}
}
}
if(this.tileClient.polygonDrawEnabled){
_66.minx=_66.minx-5;
_66.maxx=_66.maxx+5;
_66.miny=_66.miny-5;
_66.maxy=_66.maxy+5;
}
break;
case "point":
case "multipoint":
for(var i=0;i<dc.length;i++){
cur=dc[i];
if(cur.x<_66.minx){
_66.minx=cur.x;
}
if(cur.x>_66.maxx){
_66.maxx=cur.x;
}
if(cur.y<_66.miny){
_66.miny=cur.y;
}
if(cur.y>_66.maxy){
_66.maxy=cur.y;
}
}
break;
}
_66.width=_66.maxx-_66.minx;
_66.height=_66.maxy-_66.miny;
return _66;
};
wktCanvas.prototype.drawFallback=function(){
var rcr=this.route;
var tc=this.tileClient;
var dc=rcr.asData.coords;
var jg=new jsGraphics(this.routeContainer);
jg.setPrintable(this.forceFallback);
jg.setColor(this.strokeColor);
jg.setStroke(parseInt(this.strokeWeight,10));
var _6f=tc.mapGridPixelExtent.left;
var _70=tc.mapGridPixelExtent.right;
var _71=tc.mapGridPixelExtent.top;
var _72=tc.mapGridPixelExtent.bottom;
for(var i=0;i<dc.length;i++){
var l=dc[i].length-1;
for(var j=0;j<l;j++){
var _76=dc[i][j];
var fx=parseInt(_76.x);
var fy=parseInt(_76.y);
var to=dc[i][j+1];
var tx=parseInt(to.x);
var ty=parseInt(to.y);
if((fx>=_6f&&fx<=_70&&fy>=_71&&fy<=_72)||(tx>=_6f&&tx<=_70&&ty>=_71&&ty<=_72)){
jg.drawLine(fx,fy,tx,ty);
}
}
}
jg.paint();
};
wktCanvas.prototype.setWkt=function(wkt,_7d,_7e){
this.renderSegmented=(_7d!=undefined)?_7d:true;
this.clearWkt();
this.route.asWkt=wkt;
this.route.asData=this.parseWKT(this.route.asWkt);
if(_7e==undefined||_7e){
this.tileClient.jumpToExtent(this.route.UTMBBox);
}else{
this.draw(this);
}
return true;
};
wktCanvas.prototype.clearWkt=function(){
this.route={asWkt:undefined,asData:undefined,BBox:this.nullBBox,UTMBBox:new KrakMap.Extent(-Infinity,Infinity,Infinity,-Infinity),segmentExtents:new Array()};
this.routeContainer.innerHTML="";
if(this.circleDrawEnabled){
this.circleDrawEnabled=false;
}
return true;
};
wktCanvas.prototype.enablePrinting=function(){
this.forceFallback=true;
};
wktCanvas.prototype.disablePrinting=function(){
this.forceFallback=false;
};
wktCanvas.prototype.draw=function(rc){
if(rc!=undefined&&rc.route.asWkt!=undefined){
var tc=rc.tileClient;
var mpp=tc.metersPerPixel;
var _82=tc.gridContainer.offset();
var _83=tc.pixelToGeoCoordinate(_82.left,_82.top);
var _84=rc.coords;
var _85=tc.mapGridExtent;
var _86=rc.route.segmentExtents;
var _87=new Array();
for(i=0;i<_84.length;i++){
_87.push(new Array());
if(!(_86[i].left>_85.right||_85.left>_86[i].right||_86[i].bottom>_85.top||_85.bottom>_86[i].top)){
var _88=new KrakMap.Coordinate(0,0);
for(j=0;j<_84[i].length;j++){
var _89=parseFloat(_84[i][j]);
var _8a=parseFloat(_84[i][++j]);
var cur=rc.geoCoordinatesToPixel(_89,_8a,_83,mpp);
if(j==0||j==_84[i].length-1||_88.x!=cur.x||_88.y!=cur.y){
_88=cur;
_87[i].push(cur);
}
}
}
}
rc.route.asData.coords=_87;
rc.route.BBox=rc.getBBox(rc.route.asData);
rc.routeContainer.innerHTML="";
if(!rc.forceFallback&&(rc.svgEnabled()||rc.vmlEnabled())){
var _8c;
if(rc.svgEnabled()){
_8c=rc.wkt2svg(rc.route.asData);
}else{
_8c=rc.wkt2vml(rc.route.asData);
}
rc.routeContainer.appendChild(_8c);
}else{
rc.drawFallback();
}
}
};
wktCanvas.prototype.highlightNone=function(){
if(this.svgEnabled()){
var _8d=document.getElementsByTagNameNS(this.nsSvg,"polyline");
if(_8d){
for(var _8e=0;_8e<_8d.length;_8e++){
_8d[_8e].setAttributeNS(null,"stroke",this.strokeColor);
_8d[_8e].setAttributeNS(null,"stroke-width",this.strokeWeight);
}
}
}else{
var _8d=document.getElementsByTagName("polyline");
if(_8d){
for(var _8e=0;_8e<_8d.length;_8e++){
var _8f=_8d[_8e].childNodes[0];
_8f.setAttribute("color",this.strokeColor);
_8f.setAttribute("weight",this.strokeWeight);
}
}
}
};
wktCanvas.prototype.highlightSegment=function(n){
this.highlightNone();
var _91=document.getElementById(n);
if(_91){
if(this.svgEnabled()){
_91.setAttributeNS(null,"stroke",this.strokeColorHighlighted);
_91.setAttributeNS(null,"stroke-width",this.strokeWeightHighlighted);
}else{
var _92=_91.childNodes[0];
_92.setAttribute("color",this.strokeColorHighlighted);
_92.setAttribute("weight",this.strokeWeightHighlighted);
}
}
};

function coordConvert(){
this.pi=3.14159265358979;
this.sm_a=6378137;
this.sm_b=6356752.314;
this.sm_EccSquared=0.00669437999013;
this.UTMScaleFactor=0.9996;
}
coordConvert.prototype.DegToRad=function(_1){
return (_1/180*this.pi);
};
coordConvert.prototype.RadToDeg=function(_2){
return (_2/this.pi*180);
};
coordConvert.prototype.ArcLengthOfMeridian=function(_3){
var _4,_5,_6,_7,_8,n;
var _a;
n=(this.sm_a-this.sm_b)/(this.sm_a+this.sm_b);
_4=((this.sm_a+this.sm_b)/2)*(1+(Math.pow(n,2)/4)+(Math.pow(n,4)/64));
_5=(-3*n/2)+(9*Math.pow(n,3)/16)+(-3*Math.pow(n,5)/32);
_6=(15*Math.pow(n,2)/16)+(-15*Math.pow(n,4)/32);
_7=(-35*Math.pow(n,3)/48)+(105*Math.pow(n,5)/256);
_8=(315*Math.pow(n,4)/512);
_a=_4*(_3+(_5*Math.sin(2*_3))+(_6*Math.sin(4*_3))+(_7*Math.sin(6*_3))+(_8*Math.sin(8*_3)));
return _a;
};
coordConvert.prototype.UTMCentralMeridian=function(_b){
var _c;
_c=this.DegToRad(-183+(_b*6));
return _c;
};
coordConvert.prototype.FootpointLatitude=function(y){
var y_,_f,_10,_11,_12,_13,n;
var _15;
n=(this.sm_a-this.sm_b)/(this.sm_a+this.sm_b);
_f=((this.sm_a+this.sm_b)/2)*(1+(Math.pow(n,2)/4)+(Math.pow(n,4)/64));
y_=y/_f;
_10=(3*n/2)+(-27*Math.pow(n,3)/32)+(269*Math.pow(n,5)/512);
_11=(21*Math.pow(n,2)/16)+(-55*Math.pow(n,4)/32);
_12=(151*Math.pow(n,3)/96)+(-417*Math.pow(n,5)/128);
_13=(1097*Math.pow(n,4)/512);
_15=y_+(_10*Math.sin(2*y_))+(_11*Math.sin(4*y_))+(_12*Math.sin(6*y_))+(_13*Math.sin(8*y_));
return _15;
};
coordConvert.prototype.MapLatLonToXY=function(phi,_17,_18,xy){
var N,nu2,ep2,t,t2,l;
var _20,_21,_22,_23,_24,_25;
var tmp;
ep2=(Math.pow(this.sm_a,2)-Math.pow(this.sm_b,2))/Math.pow(this.sm_b,2);
nu2=ep2*Math.pow(Math.cos(phi),2);
N=Math.pow(this.sm_a,2)/(this.sm_b*Math.sqrt(1+nu2));
t=Math.tan(phi);
t2=t*t;
tmp=(t2*t2*t2)-Math.pow(t,6);
l=_17-_18;
_20=1-t2+nu2;
_21=5-t2+9*nu2+4*(nu2*nu2);
_22=5-18*t2+(t2*t2)+14*nu2-58*t2*nu2;
_23=61-58*t2+(t2*t2)+270*nu2-330*t2*nu2;
_24=61-479*t2+179*(t2*t2)-(t2*t2*t2);
_25=1385-3111*t2+543*(t2*t2)-(t2*t2*t2);
xy[0]=N*Math.cos(phi)*l+(N/6*Math.pow(Math.cos(phi),3)*_20*Math.pow(l,3))+(N/120*Math.pow(Math.cos(phi),5)*_22*Math.pow(l,5))+(N/5040*Math.pow(Math.cos(phi),7)*_24*Math.pow(l,7));
xy[1]=this.ArcLengthOfMeridian(phi)+(t/2*N*Math.pow(Math.cos(phi),2)*Math.pow(l,2))+(t/24*N*Math.pow(Math.cos(phi),4)*_21*Math.pow(l,4))+(t/720*N*Math.pow(Math.cos(phi),6)*_23*Math.pow(l,6))+(t/40320*N*Math.pow(Math.cos(phi),8)*_25*Math.pow(l,8));
return;
};
coordConvert.prototype.MapXYToLatLon=function(x,y,_29,_2a){
var _2b,Nf,_2d,_2e,ep2,tf,tf2,tf4,cf;
var _34,_35,_36,_37,_38,_39,_3a,_3b;
var _3c,_3d,_3e,_3f,_40,_41,_42;
_2b=this.FootpointLatitude(y);
ep2=(Math.pow(this.sm_a,2)-Math.pow(this.sm_b,2))/Math.pow(this.sm_b,2);
cf=Math.cos(_2b);
_2e=ep2*Math.pow(cf,2);
Nf=Math.pow(this.sm_a,2)/(this.sm_b*Math.sqrt(1+_2e));
_2d=Nf;
tf=Math.tan(_2b);
tf2=tf*tf;
tf4=tf2*tf2;
_34=1/(_2d*cf);
_2d*=Nf;
_35=tf/(2*_2d);
_2d*=Nf;
_36=1/(6*_2d*cf);
_2d*=Nf;
_37=tf/(24*_2d);
_2d*=Nf;
_38=1/(120*_2d*cf);
_2d*=Nf;
_39=tf/(720*_2d);
_2d*=Nf;
_3a=1/(5040*_2d*cf);
_2d*=Nf;
_3b=tf/(40320*_2d);
_3c=-1-_2e;
_3d=-1-2*tf2-_2e;
_3e=5+3*tf2+6*_2e-6*tf2*_2e-3*(_2e*_2e)-9*tf2*(_2e*_2e);
_3f=5+28*tf2+24*tf4+6*_2e+8*tf2*_2e;
_40=-61-90*tf2-45*tf4-107*_2e+162*tf2*_2e;
_41=-61-662*tf2-1320*tf4-720*(tf4*tf2);
_42=1385+3633*tf2+4095*tf4+1575*(tf4*tf2);
_2a[0]=_2b+_35*_3c*(x*x)+_37*_3e*Math.pow(x,4)+_39*_40*Math.pow(x,6)+_3b*_42*Math.pow(x,8);
_2a[1]=_29+_34*x+_36*_3d*Math.pow(x,3)+_38*_3f*Math.pow(x,5)+_3a*_41*Math.pow(x,7);
return;
};
coordConvert.prototype.LatLonToUTMXY=function(lat,lon,_45,xy){
this.MapLatLonToXY(lat,lon,this.UTMCentralMeridian(_45),xy);
xy[0]=xy[0]*this.UTMScaleFactor+500000;
xy[1]=xy[1]*this.UTMScaleFactor;
if(xy[1]<0){
xy[1]=xy[1]+10000000;
}
return _45;
};
coordConvert.prototype.UTMXYToLatLon=function(x,y,_49,_4a,_4b){
var _4c;
x-=500000;
x/=this.UTMScaleFactor;
if(_4a){
y-=10000000;
}
y/=this.UTMScaleFactor;
_4c=this.UTMCentralMeridian(_49);
this.MapXYToLatLon(x,y,_4c,_4b);
return;
};
function btnToUTM_OnClick(){
var xy=new Array(2);
if(isNaN(parseFloat(document.frmConverter.txtLongitude.value))){
alert("Please enter a valid longitude in the lon field.");
return false;
}
lon=parseFloat(document.frmConverter.txtLongitude.value);
if((lon<-180)||(180<=lon)){
alert("The longitude you entered is out of range.  "+"Please enter a number in the range [-180, 180).");
return false;
}
if(isNaN(parseFloat(document.frmConverter.txtLatitude.value))){
alert("Please enter a valid latitude in the lat field.");
return false;
}
lat=parseFloat(document.frmConverter.txtLatitude.value);
if((lat<-90)||(90<lat)){
alert("The latitude you entered is out of range.  "+"Please enter a number in the range [-90, 90].");
return false;
}
zone=Math.floor((lon+180)/6)+1;
zone=this.LatLonToUTMXY(this.DegToRad(lat),this.DegToRad(lon),zone,xy);
document.frmConverter.txtX.value=xy[0];
document.frmConverter.txtY.value=xy[1];
document.frmConverter.txtZone.value=zone;
if(lat<0){
document.frmConverter.rbtnHemisphere[1].checked=true;
}else{
document.frmConverter.rbtnHemisphere[0].checked=true;
}
return true;
}
function btnToGeographic_OnClick(){
latlon=new Array(2);
var x,y,_50,_51;
if(isNaN(parseFloat(document.frmConverter.txtX.value))){
alert("Please enter a valid easting in the x field.");
return false;
}
x=parseFloat(document.frmConverter.txtX.value);
if(isNaN(parseFloat(document.frmConverter.txtY.value))){
alert("Please enter a valid northing in the y field.");
return false;
}
y=parseFloat(document.frmConverter.txtY.value);
if(isNaN(parseInt(document.frmConverter.txtZone.value))){
alert("Please enter a valid UTM zone in the zone field.");
return false;
}
_50=parseFloat(document.frmConverter.txtZone.value);
if((_50<1)||(60<_50)){
alert("The UTM zone you entered is out of range.  "+"Please enter a number in the range [1, 60].");
return false;
}
if(document.frmConverter.rbtnHemisphere[1].checked==true){
_51=true;
}else{
_51=false;
}
this.UTMXYToLatLon(x,y,_50,_51,latlon);
document.frmConverter.txtLongitude.value=this.RadToDeg(latlon[1]);
document.frmConverter.txtLatitude.value=this.RadToDeg(latlon[0]);
return true;
}

var jg_ok,jg_ie,jg_fast,jg_dom,jg_moz;
function _chkDHTM(_1,x,i){
x=_1.document.body||null;
jg_ie=x&&typeof x.insertAdjacentHTML!="undefined"&&_1.document.createElement;
jg_dom=(x&&!jg_ie&&typeof x.appendChild!="undefined"&&typeof _1.document.createRange!="undefined"&&typeof (i=_1.document.createRange()).setStartBefore!="undefined"&&typeof i.createContextualFragment!="undefined");
jg_fast=jg_ie&&_1.document.all&&!_1.opera;
jg_moz=jg_dom&&typeof x.style.MozOpacity!="undefined";
jg_ok=!!(jg_ie||jg_dom);
}
function _pntCnvDom(){
var x=this.wnd.document.createRange();
x.setStartBefore(this.cnv);
x=x.createContextualFragment(jg_fast?this._htmRpc():this.htm);
if(this.cnv){
this.cnv.appendChild(x);
}
this.htm="";
}
function _pntCnvIe(){
if(this.cnv){
this.cnv.insertAdjacentHTML("BeforeEnd",jg_fast?this._htmRpc():this.htm);
}
this.htm="";
}
function _pntDoc(){
this.wnd.document.write(jg_fast?this._htmRpc():this.htm);
this.htm="";
}
function _pntN(){
}
function _mkDiv(x,y,w,h){
this.htm+="<div style=\"position:absolute;"+"left:"+x+"px;"+"top:"+y+"px;"+"width:"+w+"px;"+"height:"+h+"px;"+"clip:rect(0,"+w+"px,"+h+"px,0);"+"background-color:"+this.color+(!jg_moz?";overflow:hidden":"")+";\"></div>";
}
function _mkDivIe(x,y,w,h){
this.htm+="%%"+this.color+";"+x+";"+y+";"+w+";"+h+";";
}
function _mkDivPrt(x,y,w,h){
this.htm+="<div style=\"position:absolute;"+"border-left:"+w+"px solid "+this.color+";"+"left:"+x+"px;"+"top:"+y+"px;"+"width:0px;"+"height:"+h+"px;"+"clip:rect(0,"+w+"px,"+h+"px,0);"+"background-color:"+this.color+(!jg_moz?";overflow:hidden":"")+";\"></div>";
}
var _regex=/%%([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);/g;
function _htmRpc(){
return this.htm.replace(_regex,"<div style=\"overflow:hidden;position:absolute;background-color:"+"$1;left:$2px;top:$3px;width:$4px;height:$5px\"></div>\n");
}
function _htmPrtRpc(){
return this.htm.replace(_regex,"<div style=\"overflow:hidden;position:absolute;background-color:"+"$1;left:$2px;top:$3px;width:$4px;height:$5px;border-left:$4px solid $1\"></div>\n");
}
function _mkLin(x1,y1,x2,y2){
if(x1>x2){
var _x2=x2;
var _y2=y2;
x2=x1;
y2=y1;
x1=_x2;
y1=_y2;
}
var dx=x2-x1,dy=Math.abs(y2-y1),x=x1,y=y1,_1b=(y1>y2)?-1:1;
if(dx>=dy){
var pr=dy<<1,pru=pr-(dx<<1),p=pr-dx,ox=x;
while(dx>0){
--dx;
++x;
if(p>0){
this._mkDiv(ox,y,x-ox,1);
y+=_1b;
p+=pru;
ox=x;
}else{
p+=pr;
}
}
this._mkDiv(ox,y,x2-ox+1,1);
}else{
var pr=dx<<1,pru=pr-(dy<<1),p=pr-dy,oy=y;
if(y2<=y1){
while(dy>0){
--dy;
if(p>0){
this._mkDiv(x++,y,1,oy-y+1);
y+=_1b;
p+=pru;
oy=y;
}else{
y+=_1b;
p+=pr;
}
}
this._mkDiv(x2,y2,1,oy-y2+1);
}else{
while(dy>0){
--dy;
y+=_1b;
if(p>0){
this._mkDiv(x++,oy,1,y-oy);
p+=pru;
oy=y;
}else{
p+=pr;
}
}
this._mkDiv(x2,oy,1,y2-oy+1);
}
}
}
function _mkLin2D(x1,y1,x2,y2){
if(x1>x2){
var _x2=x2;
var _y2=y2;
x2=x1;
y2=y1;
x1=_x2;
y1=_y2;
}
var dx=x2-x1,dy=Math.abs(y2-y1),x=x1,y=y1,_2b=(y1>y2)?-1:1;
var s=this.stroke;
if(dx>=dy){
if(dx>0&&s-3>0){
var _s=(s*dx*Math.sqrt(1+dy*dy/(dx*dx))-dx-(s>>1)*dy)/dx;
_s=(!(s-4)?Math.ceil(_s):Math.round(_s))+1;
}else{
var _s=s;
}
var ad=Math.ceil(s/2);
var pr=dy<<1,pru=pr-(dx<<1),p=pr-dx,ox=x;
while(dx>0){
--dx;
++x;
if(p>0){
this._mkDiv(ox,y,x-ox+ad,_s);
y+=_2b;
p+=pru;
ox=x;
}else{
p+=pr;
}
}
this._mkDiv(ox,y,x2-ox+ad+1,_s);
}else{
if(s-3>0){
var _s=(s*dy*Math.sqrt(1+dx*dx/(dy*dy))-(s>>1)*dx-dy)/dy;
_s=(!(s-4)?Math.ceil(_s):Math.round(_s))+1;
}else{
var _s=s;
}
var ad=Math.round(s/2);
var pr=dx<<1,pru=pr-(dy<<1),p=pr-dy,oy=y;
if(y2<=y1){
++ad;
while(dy>0){
--dy;
if(p>0){
this._mkDiv(x++,y,_s,oy-y+ad);
y+=_2b;
p+=pru;
oy=y;
}else{
y+=_2b;
p+=pr;
}
}
this._mkDiv(x2,y2,_s,oy-y2+ad);
}else{
while(dy>0){
--dy;
y+=_2b;
if(p>0){
this._mkDiv(x++,oy,_s,y-oy+ad);
p+=pru;
oy=y;
}else{
p+=pr;
}
}
this._mkDiv(x2,oy,_s,y2-oy+ad+1);
}
}
}
function _mkLinDott(x1,y1,x2,y2){
if(x1>x2){
var _x2=x2;
var _y2=y2;
x2=x1;
y2=y1;
x1=_x2;
y1=_y2;
}
var dx=x2-x1,dy=Math.abs(y2-y1),x=x1,y=y1,_3e=(y1>y2)?-1:1,drw=true;
if(dx>=dy){
var pr=dy<<1,pru=pr-(dx<<1),p=pr-dx;
while(dx>0){
--dx;
if(drw){
this._mkDiv(x,y,1,1);
}
drw=!drw;
if(p>0){
y+=_3e;
p+=pru;
}else{
p+=pr;
}
++x;
}
}else{
var pr=dx<<1,pru=pr-(dy<<1),p=pr-dy;
while(dy>0){
--dy;
if(drw){
this._mkDiv(x,y,1,1);
}
drw=!drw;
y+=_3e;
if(p>0){
++x;
p+=pru;
}else{
p+=pr;
}
}
}
if(drw){
this._mkDiv(x,y,1,1);
}
}
function _mkOv(_43,top,_45,_46){
var a=(++_45)>>1,b=(++_46)>>1,wod=_45&1,hod=_46&1,cx=_43+a,cy=top+b,x=0,y=b,ox=0,oy=b,aa2=(a*a)<<1,aa4=aa2<<1,bb2=(b*b)<<1,bb4=bb2<<1,st=(aa2>>1)*(1-(b<<1))+bb2,tt=(bb2>>1)-aa2*((b<<1)-1),w,h;
while(y>0){
if(st<0){
st+=bb2*((x<<1)+3);
tt+=bb4*(++x);
}else{
if(tt<0){
st+=bb2*((x<<1)+3)-aa4*(y-1);
tt+=bb4*(++x)-aa2*(((y--)<<1)-3);
w=x-ox;
h=oy-y;
if((w&2)&&(h&2)){
this._mkOvQds(cx,cy,x-2,y+2,1,1,wod,hod);
this._mkOvQds(cx,cy,x-1,y+1,1,1,wod,hod);
}else{
this._mkOvQds(cx,cy,x-1,oy,w,h,wod,hod);
}
ox=x;
oy=y;
}else{
tt-=aa2*((y<<1)-3);
st-=aa4*(--y);
}
}
}
w=a-ox+1;
h=(oy<<1)+hod;
y=cy-oy;
this._mkDiv(cx-a,y,w,h);
this._mkDiv(cx+ox+wod-1,y,w,h);
}
function _mkOv2D(_59,top,_5b,_5c){
var s=this.stroke;
_5b+=s+1;
_5c+=s+1;
var a=_5b>>1,b=_5c>>1,wod=_5b&1,hod=_5c&1,cx=_59+a,cy=top+b,x=0,y=b,aa2=(a*a)<<1,aa4=aa2<<1,bb2=(b*b)<<1,bb4=bb2<<1,st=(aa2>>1)*(1-(b<<1))+bb2,tt=(bb2>>1)-aa2*((b<<1)-1);
if(s-4<0&&(!(s-2)||_5b-51>0&&_5c-51>0)){
var ox=0,oy=b,w,h,pxw;
while(y>0){
if(st<0){
st+=bb2*((x<<1)+3);
tt+=bb4*(++x);
}else{
if(tt<0){
st+=bb2*((x<<1)+3)-aa4*(y-1);
tt+=bb4*(++x)-aa2*(((y--)<<1)-3);
w=x-ox;
h=oy-y;
if(w-1){
pxw=w+1+(s&1);
h=s;
}else{
if(h-1){
pxw=s;
h+=1+(s&1);
}else{
pxw=h=s;
}
}
this._mkOvQds(cx,cy,x-1,oy,pxw,h,wod,hod);
ox=x;
oy=y;
}else{
tt-=aa2*((y<<1)-3);
st-=aa4*(--y);
}
}
}
this._mkDiv(cx-a,cy-oy,s,(oy<<1)+hod);
this._mkDiv(cx+a+wod-s,cy-oy,s,(oy<<1)+hod);
}else{
var _a=(_5b-(s<<1))>>1,_b=(_5c-(s<<1))>>1,_x=0,_y=_b,_75=(_a*_a)<<1,_76=_75<<1,_77=(_b*_b)<<1,_78=_77<<1,_st=(_75>>1)*(1-(_b<<1))+_77,_tt=(_77>>1)-_75*((_b<<1)-1),pxl=new Array(),pxt=new Array(),_7d=new Array();
pxl[0]=0;
pxt[0]=b;
_7d[0]=_b-1;
while(y>0){
if(st<0){
pxl[pxl.length]=x;
pxt[pxt.length]=y;
st+=bb2*((x<<1)+3);
tt+=bb4*(++x);
}else{
if(tt<0){
pxl[pxl.length]=x;
st+=bb2*((x<<1)+3)-aa4*(y-1);
tt+=bb4*(++x)-aa2*(((y--)<<1)-3);
pxt[pxt.length]=y;
}else{
tt-=aa2*((y<<1)-3);
st-=aa4*(--y);
}
}
if(_y>0){
if(_st<0){
_st+=_77*((_x<<1)+3);
_tt+=_78*(++_x);
_7d[_7d.length]=_y-1;
}else{
if(_tt<0){
_st+=_77*((_x<<1)+3)-_76*(_y-1);
_tt+=_78*(++_x)-_75*(((_y--)<<1)-3);
_7d[_7d.length]=_y-1;
}else{
_tt-=_75*((_y<<1)-3);
_st-=_76*(--_y);
_7d[_7d.length-1]--;
}
}
}
}
var ox=-wod,oy=b,_oy=_7d[0],l=pxl.length,w,h;
for(var i=0;i<l;i++){
if(typeof _7d[i]!="undefined"){
if(_7d[i]<_oy||pxt[i]<oy){
x=pxl[i];
this._mkOvQds(cx,cy,x,oy,x-ox,oy-_oy,wod,hod);
ox=x;
oy=pxt[i];
_oy=_7d[i];
}
}else{
x=pxl[i];
this._mkDiv(cx-x,cy-oy,1,(oy<<1)+hod);
this._mkDiv(cx+ox+wod,cy-oy,1,(oy<<1)+hod);
ox=x;
oy=pxt[i];
}
}
this._mkDiv(cx-a,cy-oy,1,(oy<<1)+hod);
this._mkDiv(cx+ox+wod,cy-oy,1,(oy<<1)+hod);
}
}
function _mkOvDott(_81,top,_83,_84){
var a=(++_83)>>1,b=(++_84)>>1,wod=_83&1,hod=_84&1,_89=hod^1,cx=_81+a,cy=top+b,x=0,y=b,aa2=(a*a)<<1,aa4=aa2<<1,bb2=(b*b)<<1,bb4=bb2<<1,st=(aa2>>1)*(1-(b<<1))+bb2,tt=(bb2>>1)-aa2*((b<<1)-1),drw=true;
while(y>0){
if(st<0){
st+=bb2*((x<<1)+3);
tt+=bb4*(++x);
}else{
if(tt<0){
st+=bb2*((x<<1)+3)-aa4*(y-1);
tt+=bb4*(++x)-aa2*(((y--)<<1)-3);
}else{
tt-=aa2*((y<<1)-3);
st-=aa4*(--y);
}
}
if(drw&&y>=_89){
this._mkOvQds(cx,cy,x,y,1,1,wod,hod);
}
drw=!drw;
}
}
function _mkRect(x,y,w,h){
var s=this.stroke;
this._mkDiv(x,y,w,s);
this._mkDiv(x+w,y,s,h);
this._mkDiv(x,y+h,w+s,s);
this._mkDiv(x,y+s,s,h-s);
}
function _mkRectDott(x,y,w,h){
this.drawLine(x,y,x+w,y);
this.drawLine(x+w,y,x+w,y+h);
this.drawLine(x,y+h,x+w,y+h);
this.drawLine(x,y,x,y+h);
}
function jsgFont(){
this.PLAIN="font-weight:normal;";
this.BOLD="font-weight:bold;";
this.ITALIC="font-style:italic;";
this.ITALIC_BOLD=this.ITALIC+this.BOLD;
this.BOLD_ITALIC=this.ITALIC_BOLD;
}
var Font=new jsgFont();
function jsgStroke(){
this.DOTTED=-1;
}
var Stroke=new jsgStroke();
function jsGraphics(cnv,wnd){
this.setColor=function(x){
this.color=x.toLowerCase();
};
this.setStroke=function(x){
this.stroke=x;
if(!(x+1)){
this.drawLine=_mkLinDott;
this._mkOv=_mkOvDott;
this.drawRect=_mkRectDott;
}else{
if(x-1>0){
this.drawLine=_mkLin2D;
this._mkOv=_mkOv2D;
this.drawRect=_mkRect;
}else{
this.drawLine=_mkLin;
this._mkOv=_mkOv;
this.drawRect=_mkRect;
}
}
};
this.setPrintable=function(arg){
this.printable=arg;
if(jg_fast){
this._mkDiv=_mkDivIe;
this._htmRpc=arg?_htmPrtRpc:_htmRpc;
}else{
this._mkDiv=arg?_mkDivPrt:_mkDiv;
}
};
this.setFont=function(fam,sz,sty){
this.ftFam=fam;
this.ftSz=sz;
this.ftSty=sty||Font.PLAIN;
};
this.drawPolyline=this.drawPolyLine=function(x,y){
for(var i=x.length-1;i;){
--i;
this.drawLine(x[i],y[i],x[i+1],y[i+1]);
}
};
this.fillRect=function(x,y,w,h){
this._mkDiv(x,y,w,h);
};
this.drawPolygon=function(x,y){
this.drawPolyline(x,y);
this.drawLine(x[x.length-1],y[x.length-1],x[0],y[0]);
};
this.drawEllipse=this.drawOval=function(x,y,w,h){
this._mkOv(x,y,w,h);
};
this.fillEllipse=this.fillOval=function(_b3,top,w,h){
var a=w>>1,b=h>>1,wod=w&1,hod=h&1,cx=_b3+a,cy=top+b,x=0,y=b,oy=b,aa2=(a*a)<<1,aa4=aa2<<1,bb2=(b*b)<<1,bb4=bb2<<1,st=(aa2>>1)*(1-(b<<1))+bb2,tt=(bb2>>1)-aa2*((b<<1)-1),xl,dw,dh;
if(w){
while(y>0){
if(st<0){
st+=bb2*((x<<1)+3);
tt+=bb4*(++x);
}else{
if(tt<0){
st+=bb2*((x<<1)+3)-aa4*(y-1);
xl=cx-x;
dw=(x<<1)+wod;
tt+=bb4*(++x)-aa2*(((y--)<<1)-3);
dh=oy-y;
this._mkDiv(xl,cy-oy,dw,dh);
this._mkDiv(xl,cy+y+hod,dw,dh);
oy=y;
}else{
tt-=aa2*((y<<1)-3);
st-=aa4*(--y);
}
}
}
}
this._mkDiv(cx-a,cy-oy,w,(oy<<1)+hod);
};
this.fillArc=function(iL,iT,iW,iH,_cd,_ce){
var a=iW>>1,b=iH>>1,_d1=(iW&1)|((iH&1)<<16),cx=iL+a,cy=iT+b,x=0,y=b,ox=x,oy=y,aa2=(a*a)<<1,aa4=aa2<<1,bb2=(b*b)<<1,bb4=bb2<<1,st=(aa2>>1)*(1-(b<<1))+bb2,tt=(bb2>>1)-aa2*((b<<1)-1),_de,_df,_e0,_e1,_e2=(1<<(Math.floor((_cd%=360)/180)<<3))|(2<<(Math.floor((_ce%=360)/180)<<3))|((_cd>=_ce)<<16),_e3=new Array(b+1),_e4=new Array(b+1);
_cd*=Math.PI/180;
_ce*=Math.PI/180;
_de=cx+Math.round(a*Math.cos(_cd));
_df=cy+Math.round(-b*Math.sin(_cd));
_mkLinVirt(_e3,cx,cy,_de,_df);
_e0=cx+Math.round(a*Math.cos(_ce));
_e1=cy+Math.round(-b*Math.sin(_ce));
_mkLinVirt(_e4,cx,cy,_e0,_e1);
while(y>0){
if(st<0){
st+=bb2*((x<<1)+3);
tt+=bb4*(++x);
}else{
if(tt<0){
st+=bb2*((x<<1)+3)-aa4*(y-1);
ox=x;
tt+=bb4*(++x)-aa2*(((y--)<<1)-3);
this._mkArcDiv(ox,y,oy,cx,cy,_d1,_e3,_e4,_e2);
oy=y;
}else{
tt-=aa2*((y<<1)-3);
st-=aa4*(--y);
if(y&&(_e3[y]!=_e3[y-1]||_e4[y]!=_e4[y-1])){
this._mkArcDiv(x,y,oy,cx,cy,_d1,_e3,_e4,_e2);
ox=x;
oy=y;
}
}
}
}
this._mkArcDiv(x,0,oy,cx,cy,_d1,_e3,_e4,_e2);
if(_d1>>16){
if(_e2>>16){
var xl=(_df<=cy||_e1>cy)?(cx-x):cx;
this._mkDiv(xl,cy,x+cx-xl+(_d1&65535),1);
}else{
if((_e2&1)&&_e1>cy){
this._mkDiv(cx-x,cy,x,1);
}
}
}
};
this.fillPolygon=function(_e6,_e7){
var i;
var y;
var _ea,_eb;
var x1,y1;
var x2,y2;
var _f0,_f1;
var _f2;
var n=_e6.length;
if(!n){
return;
}
_ea=_e7[0];
_eb=_e7[0];
for(i=1;i<n;i++){
if(_e7[i]<_ea){
_ea=_e7[i];
}
if(_e7[i]>_eb){
_eb=_e7[i];
}
}
for(y=_ea;y<=_eb;y++){
var _f4=new Array();
_f2=0;
for(i=0;i<n;i++){
if(!i){
_f0=n-1;
_f1=0;
}else{
_f0=i-1;
_f1=i;
}
y1=_e7[_f0];
y2=_e7[_f1];
if(y1<y2){
x1=_e6[_f0];
x2=_e6[_f1];
}else{
if(y1>y2){
y2=_e7[_f0];
y1=_e7[_f1];
x2=_e6[_f0];
x1=_e6[_f1];
}else{
continue;
}
}
if((y>=y1)&&(y<y2)){
_f4[_f2++]=Math.round((y-y1)*(x2-x1)/(y2-y1)+x1);
}else{
if((y==_eb)&&(y>y1)&&(y<=y2)){
_f4[_f2++]=Math.round((y-y1)*(x2-x1)/(y2-y1)+x1);
}
}
}
_f4.sort(_CompInt);
for(i=0;i<_f2;i+=2){
this._mkDiv(_f4[i],y,_f4[i+1]-_f4[i]+1,1);
}
}
};
this.drawString=function(txt,x,y){
this.htm+="<div style=\"position:absolute;white-space:nowrap;"+"left:"+x+"px;"+"top:"+y+"px;"+"font-family:"+this.ftFam+";"+"font-size:"+this.ftSz+";"+"color:"+this.color+";"+this.ftSty+"\">"+txt+"</div>";
};
this.drawStringRect=function(txt,x,y,_fb,_fc){
this.htm+="<div style=\"position:absolute;overflow:hidden;"+"left:"+x+"px;"+"top:"+y+"px;"+"width:"+_fb+"px;"+"text-align:"+_fc+";"+"font-family:"+this.ftFam+";"+"font-size:"+this.ftSz+";"+"color:"+this.color+";"+this.ftSty+"\">"+txt+"</div>";
};
this.drawImage=function(_fd,x,y,w,h,a){
this.htm+="<div style=\"position:absolute;"+"left:"+x+"px;"+"top:"+y+"px;"+(w?("width:"+w+"px;"):"")+(h?("height:"+h+"px;"):"")+"\">"+"<img src=\""+_fd+"\""+(w?(" width=\""+w+"\""):"")+(h?(" height=\""+h+"\""):"")+(a?(" "+a):"")+">"+"</div>";
};
this.clear=function(){
this.htm="";
if(this.cnv){
this.cnv.innerHTML="";
}
};
this._mkOvQds=function(cx,cy,x,y,w,h,wod,hod){
var xl=cx-x,xr=cx+x+wod-w,yt=cy-y,yb=cy+y+hod-h;
if(xr>xl+w){
this._mkDiv(xr,yt,w,h);
this._mkDiv(xr,yb,w,h);
}else{
w=xr-xl+w;
}
this._mkDiv(xl,yt,w,h);
this._mkDiv(xl,yb,w,h);
};
this._mkArcDiv=function(x,y,oy,cx,cy,_114,_115,_116,_117){
var _118=cx+x+(_114&65535),y2,h=oy-y,xl,xr,w;
if(!h){
h=1;
}
x=cx-x;
if(_117&16711680){
y2=cy-y-h;
if(_117&255){
if(_117&2){
xl=Math.max(x,_116[y]);
w=_118-xl;
if(w>0){
this._mkDiv(xl,y2,w,h);
}
}
if(_117&1){
xr=Math.min(_118,_115[y]);
w=xr-x;
if(w>0){
this._mkDiv(x,y2,w,h);
}
}
}else{
this._mkDiv(x,y2,_118-x,h);
}
y2=cy+y+(_114>>16);
if(_117&65280){
if(_117&256){
xl=Math.max(x,_115[y]);
w=_118-xl;
if(w>0){
this._mkDiv(xl,y2,w,h);
}
}
if(_117&512){
xr=Math.min(_118,_116[y]);
w=xr-x;
if(w>0){
this._mkDiv(x,y2,w,h);
}
}
}else{
this._mkDiv(x,y2,_118-x,h);
}
}else{
if(_117&255){
if(_117&2){
xl=Math.max(x,_116[y]);
}else{
xl=x;
}
if(_117&1){
xr=Math.min(_118,_115[y]);
}else{
xr=_118;
}
y2=cy-y-h;
w=xr-xl;
if(w>0){
this._mkDiv(xl,y2,w,h);
}
}
if(_117&65280){
if(_117&256){
xl=Math.max(x,_115[y]);
}else{
xl=x;
}
if(_117&512){
xr=Math.min(_118,_116[y]);
}else{
xr=_118;
}
y2=cy+y+(_114>>16);
w=xr-xl;
if(w>0){
this._mkDiv(xl,y2,w,h);
}
}
}
};
this.setStroke(1);
this.setFont("verdana,geneva,helvetica,sans-serif","12px",Font.PLAIN);
this.color="#000000";
this.htm="";
this.wnd=wnd||window;
if(!jg_ok){
_chkDHTM(this.wnd);
}
if(jg_ok){
if(cnv){
if(typeof (cnv)=="string"){
this.cont=document.all?(this.wnd.document.all[cnv]||null):document.getElementById?(this.wnd.document.getElementById(cnv)||null):null;
}else{
if(cnv==window.document){
this.cont=document.getElementsByTagName("body")[0];
}else{
this.cont=cnv;
}
}
this.cnv=this.wnd.document.createElement("div");
this.cnv.style.fontSize=0;
this.cont.appendChild(this.cnv);
this.paint=jg_dom?_pntCnvDom:_pntCnvIe;
}else{
this.paint=_pntDoc;
}
}else{
this.paint=_pntN;
}
this.setPrintable(false);
}
function _mkLinVirt(aLin,x1,y1,x2,y2){
var dx=Math.abs(x2-x1),dy=Math.abs(y2-y1),x=x1,y=y1,_127=(x1>x2)?-1:1,_128=(y1>y2)?-1:1,p,i=0;
if(dx>=dy){
var pr=dy<<1,pru=pr-(dx<<1);
p=pr-dx;
while(dx>0){
--dx;
if(p>0){
aLin[i++]=x;
y+=_128;
p+=pru;
}else{
p+=pr;
}
x+=_127;
}
}else{
var pr=dx<<1,pru=pr-(dy<<1);
p=pr-dy;
while(dy>0){
--dy;
y+=_128;
aLin[i++]=x;
if(p>0){
x+=_127;
p+=pru;
}else{
p+=pr;
}
}
}
for(var len=aLin.length,i=len-i;i;){
aLin[len-(i--)]=x;
}
}
function _CompInt(x,y){
return (x-y);
}


