/* Build date: 20100823 1238 */function HMap(_1){
var me=this;
me.map=_1;
me.globals={isInitialized:false,isDragging:false,draggingEnabled:true,doubleClickZoomEnabled:true,mouseWheelZoomEnabled:true,exclusiveInfoBoxEnabled:true,startX:0,startY:0,deltaX:0,deltaY:0,mapSize:null,mapPaddingX:0,mapPaddingY:0,mapPosition:null,tilesPerRow:0,tilesPerColumn:0,tileInitOffsetX:0,tileInitOffsetY:0,tileCount:0,mapRow:0,mapColumn:0,resolution:0,zoomLevel:0,gridContainer:null,overlayContainer:null,rightClickTimestamp:0,panIntervalCount:0,panDestination:null,panCurrent:null,polyLayer:null,currentMousePos:null,paddingLeft:0,paddingTop:0,paddingBottom:0,paddingRight:0,hiddenInputElement:null,centerPoint:null};
var G=me.globals;
if(HMapHelpers.isIE()){
HMapHelpers.loadScript("http://www.hitta.se/js/excanvas.compressed.js");
}
me.overlays=[];
me.controls=[];
HMapHelpers.applyStyle([me.map],{overflow:"hidden",position:"relative",outline:"none"});
me.map.setAttribute("tabIndex",0);
me.map.setAttribute("hideFocus",true);
G.innerContainer=HMapHelpers.createContainerDiv(me.map);
G.gridContainer=HMapHelpers.createContainerDiv(G.innerContainer);
HMapHelpers.applyStyle([G.gridContainer],{zIndex:0});
G.polyContainer=HMapHelpers.createContainerDiv(G.innerContainer);
G.overlayContainer=HMapHelpers.createContainerDiv(G.innerContainer);
HMapHelpers.applyStyle([G.overlayContainer],{zIndex:HOverlay.Z_INDEX_OFFSET});
G.polyLayer=new HPolyLayer(this);
me.transform=new HTransform();
me.mapProviderManager=new HMapProviderManager(this);
this.mapProviderManager.add(new HStandardMapProvider());
HEvent.addDomListener(document,"mousemove",function(e){
me.mouseMove(e);
});
HEvent.addDomListener(document,"mouseup",function(e){
me.mouseUp(e);
});
HEvent.addDomListener(G.innerContainer,"mousemove",function(e){
me.mouseMoveMap(e);
});
HEvent.addDomListener(G.innerContainer,"mousedown",function(e){
me.mouseDown(e);
});
HEvent.addDomListener(G.innerContainer,"mousewheel",function(e){
return me.mouseWheel(e);
});
HEvent.addDomListener(G.innerContainer,"click",function(e){
me.mouseClick(e);
});
HEvent.addDomListener(G.innerContainer,"dblclick",function(e){
me.mouseDblClick(e);
});
HEvent.addDomListener(G.innerContainer,"dragstart",HEvent.stopEvent);
HEvent.addDomListener(G.innerContainer,"selectstart",HEvent.stopEvent);
HEvent.addDomListener(G.innerContainer,"contextmenu",HEvent.stopEvent);
if(HMapHelpers.isSafari()){
var _b=document.createElement("input");
_b.id="mapinput";
HMapHelpers.applyStyle([_b],{border:"none",outline:"none",width:"0px",height:"0px",fontSize:"0px"});
me.map.appendChild(_b);
G.hiddenInputElement=_b;
HEvent.addDomListener(_b,"keydown",function(e){
return me.keyAction(e);
});
}else{
HEvent.addDomListener(me.map,"keydown",function(e){
return me.keyAction(e);
});
}
};
HMap.ZOOM_LEVELS=[0,3500,700,200,70,25,10,4,2,0.5,0.2];
HMap.RT90_BOTTOM_LEFT_GEO_POINT_NORTH=5651424;
HMap.RT90_BOTTOM_LEFT_GEO_POINT_EAST=451424;
HMap.RT90_GEO_POINT_NORTH=8200000;
HMap.DEFAULT_ZOOM_LEVEL=4;
HMap.TILE_PADDING=2;
HMap.PAN_ANIMATION_SPEED=7;
HMap.PAN_MAX_STEP_SIZE_PART=12;
HMap.PAN_TO_SMOOTH_SCROLL_PADDING=1.5;
HMap.PAN_DIRECTION_FACTOR=0.66;
HMap.NAVIGATION_KEYCODE_LEFT=37;
HMap.NAVIGATION_KEYCODE_UP=38;
HMap.NAVIGATION_KEYCODE_RIGHT=39;
HMap.NAVIGATION_KEYCODE_DOWN=40;
HMap.NAVIGATION_KEYCODE_ZOOM_IN=34;
HMap.NAVIGATION_KEYCODE_ZOOM_OUT=33;
HMap.RIGHT_DOUBLE_CLICK_INTERVAL=500;
HMap.EVENT_MAP_DRAG_START="mapdragstart";
HMap.EVENT_MAP_DRAG_END="mapdragend";
HMap.EVENT_MAP_MOVE_END="mapmoveend";
HMap.EVENT_MAP_MOVE="mapmove";
HMap.EVENT_INTERNAL_MAP_MOVE="internalmapmove";
HMap.EVENT_INTERNAL_TILE_FLIP="internaltileflip";
HMap.EVENT_MAP_MOUSE_MOVE="mapmousemove";
HMap.EVENT_MAP_ZOOM="mapzoom";
HMap.EVENT_INTERNAL_MAP_ZOOM="internalmapzoom";
HMap.EVENT_MAP_CLICK="mapclick";
HMap.EVENT_MARKER_CLICK="mapmarkerclick";
HMap.EVENT_MARKER_DBLCLICK="mapmarkerdblclick";
HMap.EVENT_MAP_DBLCLICK="mapdblclick";
HMap.EVENT_MAP_DBLCLICK_RIGHT="mapdblclickright";
HMap.EVENT_MAP_TYPE_CHANGED="maptypechanged";
HMap.EVENT_INTERNAL_MAP_TYPE_CHANGED="internalmaptypechanged";
HMap.EVENT_OVERLAY_ADDED="addoverlay";
HMap.EVENT_OVERLAY_REMOVED="removeoverlay";
HMap.EVENT_OVERLAYS_CLEARED="clearoverlays";
HMap.EVENT_INFO_BOX_OPEN="infoboxopen";
HMap.EVENT_INFO_BOX_CLOSE="infoboxclose";
HMap.EVENT_MAP_STATUS_UPDATE="mapstatusupdate";
HMap.EVENT_INTERNAL_MAP_STATUS_UPDATE="mapstatusupdate";
HMap.prototype.initGlobals=function(){
var G=this.globals;
if(this.map.offsetWidth==0||this.map.offsetHeight==0){
G.mapSize=new HSize(598,602);
}else{
G.mapSize=new HSize(this.map.offsetWidth,this.map.offsetHeight);
}
G.mapPosition=HMapHelpers.getElementPosition(this.map);
G.panDestination=new HPoint(0,0);
G.panCurrent=new HPoint(0,0);
G.tilesPerRow=Math.ceil(G.mapSize.width/HTile.TILE_WIDTH)+HMap.TILE_PADDING;
G.tilesPerColumn=Math.ceil(G.mapSize.height/HTile.TILE_HEIGHT)+HMap.TILE_PADDING;
G.mapPaddingX=Math.ceil(((G.tilesPerRow*HTile.TILE_WIDTH)-G.mapSize.width)/2);
G.mapPaddingY=Math.ceil(((G.tilesPerColumn*HTile.TILE_HEIGHT)-G.mapSize.height)/2);
G.tileCount=G.tilesPerRow*G.tilesPerColumn;
if(!G.isInitialized){
this.addControl(new HCopyrightControl());
}
G.isInitialized=true;
};
HMap.prototype.initGrid=function(){
var G=this.globals;
HMapHelpers.clearElement(G.gridContainer);
this.getMapProviderManager().initTiles();
this.grid=[];
for(var i=0;i<G.tileCount;i++){
var _11=new HTile(this,i);
this.grid.push(_11);
}
};
HMap.prototype.getTileCount=function(){
return this.globals.tileCount;
};
HMap.prototype.enableDragging=function(){
this.globals.draggingEnabled=true;
};
HMap.prototype.disableDragging=function(){
this.globals.draggingEnabled=false;
};
HMap.prototype.isDraggingEnabled=function(){
return this.globals.draggingEnabled;
};
HMap.prototype.enableDoubleClickZoom=function(){
this.globals.doubleClickZoomEnabled=true;
};
HMap.prototype.disableDoubleClickZoom=function(){
this.globals.doubleClickZoomEnabled=false;
};
HMap.prototype.isDoubleClickZoomEnabled=function(){
return this.globals.doubleClickZoomEnabled;
};
HMap.prototype.enableMouseWheelZoom=function(){
this.globals.mouseWheelZoomEnabled=true;
};
HMap.prototype.disableMouseWheelZoom=function(){
this.globals.mouseWheelZoomEnabled=false;
};
HMap.prototype.isMouseWheelZoomEnabled=function(){
return this.globals.mouseWheelZoomEnabled;
};
HMap.prototype.enableExclusiveInfoBox=function(){
this.globals.exclusiveInfoBoxEnabled=true;
};
HMap.prototype.disableExclusiveInfoBox=function(){
this.globals.exclusiveInfoBoxEnabled=false;
};
HMap.prototype.isExclusiveInfoBoxEnabled=function(){
return this.globals.exclusiveInfoBoxEnabled;
};
HMap.prototype.getContainer=function(){
return this.map;
};
HMap.prototype.getPaneMap=function(){
return this.globals.gridContainer;
};
HMap.prototype.getPaneOverlay=function(){
return this.globals.overlayContainer;
};
HMap.prototype.getPaneControls=function(){
return this.globals.overlayContainer;
};
HMap.prototype.getMapProviderManager=function(){
return this.mapProviderManager;
};
HMap.prototype.getPolyLayer=function(){
var G=this.globals;
if(!G.polyLayer.isInitialized()){
G.polyLayer.initialize();
}
return G.polyLayer;
};
HMap.prototype.addOverlay=function(_13,_14,_15){
_13.category=arguments[1]||"";
_13.categoryExplicit=arguments[2]||false;
this.overlays.push(_13);
_13.isAdded=true;
_13.init(this);
HEvent.trigger(this,HMap.EVENT_OVERLAY_ADDED,_13);
};
HMap.prototype.getOverlayCount=function(){
return this.overlays.length;
};
HMap.prototype.removeOverlay=function(_16){
HEvent.trigger(this,HMap.EVENT_OVERLAY_REMOVED,_16);
_16.isAdded=false;
_16.remove();
this.overlays.remove(_16);
};
HMap.prototype.clearOverlays=function(_17){
var _18=arguments[0]||false;
for(var i=this.overlays.length-1;i>-1;i--){
if(_18||!this.overlays[i].categoryExplicit){
this.overlays[i].isAdded=false;
this.overlays[i].remove();
this.overlays.splice(i,1);
}
}
if(this.overlays.length==0){
delete this.overlays;
this.overlays=[];
}
HEvent.trigger(this,HMap.EVENT_OVERLAYS_CLEARED);
};
HMap.prototype.clearOverlaysByCategory=function(_1a,_1b){
var _1c=arguments[1]||false;
for(var i=this.overlays.length-1;i>-1;i--){
if((!_1c&&this.overlays[i].category===_1a)||(_1c&&this.overlays[i].category!==_1a&&!this.overlays[i].categoryExplicit)){
this.overlays[i].isAdded=false;
this.overlays[i].remove();
this.overlays.splice(i,1);
}
}
HEvent.trigger(this,HMap.EVENT_OVERLAYS_CLEARED,_1a,_1c);
};
HMap.prototype.updateOverlays=function(){
for(var i=0;i<this.overlays.length;i++){
if(this.overlays[i].isActive){
this.overlays[i].update();
}
}
};
HMap.prototype.getMarkers=function(){
var _1f=arguments[0]||false;
var _20=[];
for(var i=0;i<this.overlays.length;i++){
if(this.overlays[i].isMarker){
if(!_1f||_1f.containsRT90(this.overlays[i].getRT90Point())){
_20.push(this.overlays[i]);
}
}
}
return _20;
};
HMap.prototype.updatePolyLayer=function(){
var G=this.globals;
if(G.polyLayer.isInitialized()){
G.polyLayer.update();
}
};
HMap.prototype.addControl=function(_23,_24){
var pos=arguments[1]||false;
if(!pos){
pos=_23.getDefaultPosition();
}
this.controls.push(_23);
_23.init(this,pos);
};
HMap.prototype.removeControl=function(_26){
_26.remove();
this.controls.remove(_26);
};
HMap.prototype.updateControls=function(){
for(var i=0;i<this.controls.length;i++){
this.controls[i].update();
}
};
HMap.prototype.initPosition=function(){
for(var i=0;i<this.grid.length;i++){
this.grid[i].initPosition();
}
this.updateOverlays();
this.updatePolyLayer();
this.updateMapTiles();
HEvent.trigger(this,HMap.EVENT_MAP_MOVE_END);
this.updateStatus();
};
HMap.prototype.updateMapTiles=function(){
for(var i=0;i<this.grid.length;i++){
this.grid[i].updateMapTile();
}
};
HMap.prototype.updateStatus=function(){
this.mapProviderManager.updateStatus();
};
HMap.prototype.setFocus=function(){
var G=this.globals;
if(HMapHelpers.isSafari()&&G.hiddenInputElement!=null){
G.hiddenInputElement.focus();
}else{
if(!HMapHelpers.isIE()){
this.map.focus();
}
}
};
HMap.prototype.startDrag=function(_2b){
var G=this.globals;
if(G.draggingEnabled){
G.isDragging=true;
G.dragStartEventSent=false;
G.startX=_2b.x;
G.startY=_2b.y;
G.deltaX=0;
G.deltaY=0;
}
};
HMap.prototype.drag=function(_2d){
var G=this.globals;
var dx=_2d.x-G.startX;
var dy=_2d.y-G.startY;
G.deltaX+=dx;
G.deltaY+=dy;
this.pan(dx,dy);
G.startX=_2d.x;
G.startY=_2d.y;
};
HMap.prototype.stopDrag=function(_31){
var G=this.globals;
if(G.isDragging){
G.isDragging=false;
G.startX=_31.x;
G.startY=_31.y;
if(G.dragStartEventSent){
HEvent.trigger(this,HMap.EVENT_MAP_DRAG_END);
HEvent.trigger(this,HMap.EVENT_MAP_MOVE_END);
this.updateStatus();
}
}
};
HMap.prototype.mouseMoveMap=function(_33){
var G=this.globals;
var pos=HMapHelpers.getMousePosition(_33);
G.currentMousePos=pos;
if(HEvent.isListening(this,HMap.EVENT_MAP_MOUSE_MOVE)){
var _36=new HPoint(pos.x-G.mapPosition.x,pos.y-G.mapPosition.y);
var _37=this.fromContainerPixelToRT90(_36);
HEvent.trigger(this,HMap.EVENT_MAP_MOUSE_MOVE,_37,_36);
}
};
HMap.prototype.mouseDown=function(_38){
var e=_38||window.event;
var pos=HMapHelpers.getMousePosition(e);
this.setFocus();
if(HMapHelpers.isLeftMouseClicked(e)){
this.startDrag(pos);
HEvent.stopEvent(e);
}
};
HMap.prototype.mouseMove=function(_3b){
var e=_3b||window.event;
var G=this.globals;
if(G.isDragging){
var pos=HMapHelpers.getMousePosition(e);
if(!G.dragStartEventSent){
HEvent.trigger(this,HMap.EVENT_MAP_DRAG_START);
G.dragStartEventSent=true;
}
if(HMapHelpers.isIEEvent(e)&&!HMapHelpers.isLeftMouseClicked(e)){
this.stopDrag(pos);
}else{
this.drag(pos);
}
}
};
HMap.prototype.mouseUp=function(_3f){
var e=_3f||window.event;
var G=this.globals;
var pos=HMapHelpers.getMousePosition(e);
if(HMapHelpers.isLeftMouseClicked(e)){
this.stopDrag(pos);
}
if(HMapHelpers.isRightMouseClicked(e)){
var now=new Date().getTime();
if(now-G.rightClickTimestamp<HMap.RIGHT_DOUBLE_CLICK_INTERVAL){
var _44=this.fromContainerPixelToRT90(new HPoint(pos.x-G.mapPosition.x,pos.y-G.mapPosition.y));
G.rightClickTimestamp=0;
HEvent.trigger(this,HMap.EVENT_MAP_DBLCLICK_RIGHT,_44);
if(G.doubleClickZoomEnabled){
this.zoomOut();
}
}
G.rightClickTimestamp=now;
}
};
HMap.prototype.mouseClick=function(_45){
var e=_45||window.event;
var G=this.globals;
var pos=HMapHelpers.getMousePosition(e);
if((pos.x<0||pos.y<0)||(G.deltaX!==0||G.deltaY!==0)){
return;
}
var _49=this.fromContainerPixelToRT90(new HPoint(pos.x-G.mapPosition.x,pos.y-G.mapPosition.y));
HEvent.trigger(this,HMap.EVENT_MAP_CLICK,_49);
};
HMap.prototype.mouseDblClick=function(_4a){
var e=_4a||window.event;
var G=this.globals;
var pos=HMapHelpers.getMousePosition(e);
var _4e=this.fromContainerPixelToRT90(new HPoint(pos.x-G.mapPosition.x,pos.y-G.mapPosition.y));
HEvent.trigger(this,HMap.EVENT_MAP_DBLCLICK,_4e);
if(G.doubleClickZoomEnabled){
this.setZoom(this.getZoom()+1,_4e);
}
};
HMap.prototype.mouseWheel=function(_4f){
var G=this.globals;
if(G.mouseWheelZoomEnabled&&G.currentMousePos!==null){
var e=_4f||window.event;
var _52=e.detail?e.detail*-1:e.wheelDelta/40;
var _53=G.currentMousePos;
var pos=new HPoint(_53.x-G.mapPosition.x,_53.y-G.mapPosition.y);
var _55=this.getCenter();
var _56;
if(_52>0){
_56=this.getZoom()+1;
}else{
_56=this.getZoom()-1;
}
if(this.isZoomLevelValid(_56)){
var _57=Math.round(G.mapSize.width/2)-pos.x;
var _58=Math.round(G.mapSize.height/2)-pos.y;
var res=HMap.ZOOM_LEVELS[_56];
_55.east-=(G.resolution-res)*_57;
_55.north+=(G.resolution-res)*_58;
this.setZoom(_56,_55);
}
return HEvent.stopEvent(_4f);
}
return true;
};
HMap.prototype.keyAction=function(_5a){
var e=_5a||window.event;
var _5c=e.charCode||e.keyCode;
var _5d=true;
switch(_5c){
case HMap.NAVIGATION_KEYCODE_LEFT:
this.panDirection(+1,0);
break;
case HMap.NAVIGATION_KEYCODE_UP:
this.panDirection(0,+1);
break;
case HMap.NAVIGATION_KEYCODE_RIGHT:
this.panDirection(-1,0);
break;
case HMap.NAVIGATION_KEYCODE_DOWN:
this.panDirection(0,-1);
break;
case HMap.NAVIGATION_KEYCODE_ZOOM_IN:
this.zoomIn();
break;
case HMap.NAVIGATION_KEYCODE_ZOOM_OUT:
this.zoomOut();
break;
default:
_5d=false;
}
if(_5d){
return HEvent.stopEvent(e);
}
return true;
};
HMap.prototype.checkResize=function(){
var G=this.globals;
var _5f=this.getCenter();
this.initGlobals();
this.initGrid();
this.updateOverlays();
this.updatePolyLayer();
this.updateControls();
if(G.polyLayer.isInitialized()){
G.polyLayer.initialize();
}
this.setCenter(_5f);
};
HMap.prototype.pan=function(dx,dy){
var G=this.globals;
var i;
var _64=false;
for(i=0;i<this.grid.length;i++){
if(this.grid[i].pan(dx,dy)){
_64=true;
}
}
for(i=0;i<this.overlays.length;i++){
if(this.overlays[i].isActive){
this.overlays[i].pan(dx,dy);
}
}
if(G.polyLayer.isInitialized()){
G.polyLayer.pan(dx,dy);
}
G.centerPoint=null;
HEvent.trigger(this,HMap.EVENT_INTERNAL_MAP_MOVE);
HEvent.trigger(this,HMap.EVENT_MAP_MOVE);
if(_64){
HEvent.trigger(this,HMap.EVENT_INTERNAL_TILE_FLIP);
}
};
HMap.prototype.panBy=function(dx,dy){
var G=this.globals;
var me=this;
if(!me.panTimer){
G.panDestination.x=dx;
G.panDestination.y=dy;
G.panCurrent.x=0;
G.panCurrent.y=0;
me.panTimer=setInterval(function(){
var sx=(G.panDestination.x-G.panCurrent.x)/HMap.PAN_ANIMATION_SPEED;
var sy=(G.panDestination.y-G.panCurrent.y)/HMap.PAN_ANIMATION_SPEED;
sx=(sx<0)?Math.floor(sx):Math.ceil(sx);
sy=(sy<0)?Math.floor(sy):Math.ceil(sy);
sx=HMapHelpers.signMin(sx,Math.ceil(G.mapSize.width/HMap.PAN_MAX_STEP_SIZE_PART));
sy=HMapHelpers.signMin(sy,Math.ceil(G.mapSize.height/HMap.PAN_MAX_STEP_SIZE_PART));
me.pan(sx,sy);
G.panCurrent.x+=sx;
G.panCurrent.y+=sy;
if(G.panCurrent.x==G.panDestination.x&&G.panCurrent.y==G.panDestination.y){
clearInterval(me.panTimer);
me.panTimer=null;
me.updateStatus();
HEvent.trigger(me,HMap.EVENT_MAP_MOVE_END);
}
},10);
}else{
if(Math.abs(G.panDestination.x-G.panCurrent.x)<G.mapSize.width&&Math.abs(G.panDestination.y-G.panCurrent.y)<G.mapSize.height){
G.panDestination.x+=dx;
G.panDestination.y+=dy;
}
}
};
HMap.prototype.panDirection=function(_6b,_6c){
var G=this.globals;
var _6e=Math.ceil(_6b*(G.mapSize.width-G.paddingLeft-G.paddingRight)*HMap.PAN_DIRECTION_FACTOR);
var _6f=Math.ceil(_6c*(G.mapSize.height-G.paddingTop-G.paddingBottom)*HMap.PAN_DIRECTION_FACTOR);
this.panBy(_6e,_6f);
};
HMap.prototype.panTo=function(_70){
var G=this.globals;
var _72=this.getBounds();
_72.scale(HMap.PAN_TO_SMOOTH_SCROLL_PADDING);
if(_72.containsRT90(_70)){
var _73=new HPoint(Math.round(G.mapSize.width/2),Math.round(G.mapSize.height/2));
var _74=this.fromRT90toContainerPixel(_70);
this.panBy(_73.x-_74.x,_73.y-_74.y);
}else{
this.setCenter(_70);
}
};
HMap.prototype.getSize=function(){
return this.globals.mapSize;
};
HMap.prototype.getBounds=function(){
var G=this.globals;
var sw=this.fromContainerPixelToRT90(new HPoint(G.paddingLeft,G.mapSize.height-G.paddingBottom));
var ne=this.fromContainerPixelToRT90(new HPoint(G.mapSize.width-G.paddingRight,G.paddingTop));
return new HBoundsRT90(sw,ne);
};
HMap.prototype.setVisiblePadding=function(top,_79,_7a,_7b){
var G=this.globals;
G.paddingTop=top;
G.paddingRight=_79;
G.paddingBottom=_7a;
G.paddingLeft=_7b;
if(G.isInitialized){
this.updateControls();
}
};
HMap.prototype.getBoundsZoomLevel=function(_7d,_7e){
var G=this.globals;
var _80=arguments[1]||G.mapSize;
var _81=_7d.toSpan();
for(var i=HMap.ZOOM_LEVELS.length-1;i>0;i--){
if((_80.width-G.paddingLeft-G.paddingRight)*HMap.ZOOM_LEVELS[i]>_81.east&&(_80.height-G.paddingTop-G.paddingBottom)*HMap.ZOOM_LEVELS[i]>_81.north){
return i;
}
}
return 0;
};
HMap.prototype.closeInfoBoxes=function(){
for(var i=0;i<this.overlays.length;i++){
if(this.overlays[i].infoBox){
this.overlays[i].closeInfoBox();
}
}
};
HMap.prototype.getDistancePixel=function(_84,_85){
var G=this.globals;
return G.resolution*Math.sqrt(Math.pow(_84.x-_85.x,2)+Math.pow(_84.y-_85.y,2));
};
HMap.prototype.setZoom=function(_87,_88){
if(!this.isZoomLevelValid(_87)){
return false;
}
var _89=arguments[1]||this.getCenter();
var G=this.globals;
var _8b=G.zoomLevel;
this.setCenter(_89,_87);
if(_8b!=G.zoomLevel){
HEvent.trigger(this,HMap.EVENT_INTERNAL_MAP_ZOOM,_8b,G.zoomLevel);
HEvent.trigger(this,HMap.EVENT_MAP_ZOOM,_8b,G.zoomLevel);
}
return true;
};
HMap.prototype.zoomIn=function(){
this.setZoom(this.getZoom()+1);
};
HMap.prototype.zoomOut=function(){
this.setZoom(this.getZoom()-1);
};
HMap.prototype.zoomMax=function(){
this.setZoom(this.mapProviderManager.getBaseMap().getMaxZoomLevel());
};
HMap.prototype.getZoom=function(){
var G=this.globals;
return G.zoomLevel;
};
HMap.prototype.getResolution=function(){
var G=this.globals;
return HMap.ZOOM_LEVELS[G.zoomLevel];
};
HMap.prototype.isZoomLevelValid=function(_8e,_8f){
var _90=this.mapProviderManager.getBaseMap();
return (_8e>=_90.getMinZoomLevel(_8f)&&_8e<=_90.getMaxZoomLevel(_8f));
};
HMap.prototype.getMaxZoomLevel=function(_91){
var _92=this.mapProviderManager.getBaseMap();
return _92.getMaxZoomLevel(_91);
};
HMap.prototype.setZoomLevel=function(_93){
var G=this.globals;
G.zoomLevel=_93;
G.resolution=HMap.ZOOM_LEVELS[G.zoomLevel];
};
HMap.prototype.setMapType=function(_95){
var _96=this.mapProviderManager.getBaseMap();
var _97=_96.getMapType();
_96.setMapType(_95);
if(!this.isZoomLevelValid(this.getZoom(),_95)){
this.setZoom(_96.getMaxZoomLevel(_95));
}else{
this.updateMapTiles();
}
if(_97!=_95){
HEvent.trigger(this,HMap.EVENT_INTERNAL_MAP_TYPE_CHANGED,_97,_95);
HEvent.trigger(this,HMap.EVENT_MAP_TYPE_CHANGED,_97,_95);
}
};
HMap.prototype.getMapType=function(){
return this.mapProviderManager.getBaseMap().getMapType();
};
HMap.prototype.setCenter=function(_98,_99,_9a){
var G=this.globals;
var _9c=arguments[1]||-1;
var _9d=arguments[2]||-1;
if(_9c!=-1&&(!G.isInitialized||(G.isInitialized&&this.isZoomLevelValid(_9c)))){
if(G.isInitialized){
HEvent.trigger(this,HMap.EVENT_INTERNAL_MAP_ZOOM,this.getZoom(),_9c);
HEvent.trigger(this,HMap.EVENT_MAP_ZOOM,this.getZoom(),_9c);
}
this.setZoomLevel(_9c);
}else{
if(this.getZoom()==0){
this.setZoomLevel(HMap.DEFAULT_ZOOM_LEVEL);
}
}
if(_9d!=-1){
this.mapProviderManager.getBaseMap().setMapType(_9d);
}
if(!G.isInitialized){
this.initGlobals();
this.initGrid();
}
var res=HMap.ZOOM_LEVELS[G.zoomLevel];
var _9f=_98.east-HMap.RT90_BOTTOM_LEFT_GEO_POINT_EAST;
var _a0=_98.north-HMap.RT90_BOTTOM_LEFT_GEO_POINT_NORTH;
var col=Math.ceil(Math.floor(_9f/(HTile.TILE_WIDTH*res))+0.5);
var row=Math.ceil(Math.floor(_a0/(HTile.TILE_HEIGHT*res))+0.5);
var _a3=(_9f%(HTile.TILE_WIDTH*res))/res;
var _a4=(_a0%(HTile.TILE_HEIGHT*res))/res;
var _a5=Math.floor((G.tilesPerRow-1)/2);
var _a6=Math.floor((G.tilesPerColumn-1)/2);
if(G.tilesPerRow%2==0&&Math.round(_a3)<HTile.TILE_WIDTH/2){
_a5+=1;
}
if(G.tilesPerColumn%2==0&&Math.round(_a4)<HTile.TILE_HEIGHT/2){
_a6+=1;
}
G.mapColumn=col-_a5;
G.mapRow=row-_a6;
G.tileInitOffsetX=Math.round(G.mapSize.width/2-_a5*HTile.TILE_WIDTH-_a3);
G.tileInitOffsetY=Math.round(G.mapSize.height/2-(G.tilesPerColumn-_a6)*HTile.TILE_HEIGHT+_a4);
G.centerPoint=_98;
this.initPosition();
};
HMap.prototype.getCenter=function(){
var G=this.globals;
if(G.centerPoint!==null){
return G.centerPoint;
}
var _a8=new HPoint(Math.round((G.mapSize.width-G.paddingLeft-G.paddingRight)/2)+G.paddingLeft,Math.round((G.mapSize.height-G.paddingTop-G.paddingBottom)/2)+G.paddingTop);
return this.fromContainerPixelToRT90(_a8);
};
HMap.prototype.fromContainerPixelToRT90=function(_a9){
var _aa=!!arguments[1];
var G=this.globals;
var _ac=this.grid[0];
var _ad=Math.floor((_a9.x-_ac.point.x)/HTile.TILE_WIDTH);
var _ae=-Math.floor((_a9.y-_ac.point.y)/HTile.TILE_HEIGHT);
var _af=(_a9.x-_ac.point.x)%HTile.TILE_WIDTH;
var _b0=(_a9.y-_ac.point.y)%HTile.TILE_HEIGHT;
if(_af<0){
_af+=HTile.TILE_WIDTH;
}
if(_b0<0){
_b0+=HTile.TILE_HEIGHT;
}
var _b1=_ac.mapColumn+_ad;
var _b2=_ac.mapRow+_ae;
var _b3=HMap.RT90_BOTTOM_LEFT_GEO_POINT_EAST+(((_b1-1)*HTile.TILE_WIDTH)+_af)*G.resolution;
var _b4=HMap.RT90_BOTTOM_LEFT_GEO_POINT_NORTH+((_b2*HTile.TILE_HEIGHT)-_b0)*G.resolution;
if(!_aa&&G.resolution<1){
_b3=Math.round(_b3);
_b4=Math.round(_b4);
}
return new HPointRT90(_b4,_b3);
};
HMap.prototype.fromRT90toContainerPixel=function(_b5){
var G=this.globals;
var _b7=this.fromContainerPixelToRT90(new HPoint(0,0),true);
var _b8=Math.round((_b5.east-_b7.east)/G.resolution);
var _b9=-Math.round((_b5.north-_b7.north)/G.resolution);
return new HPoint(_b8,_b9);
};
HMap.prototype.getCenterTile=function(){
var G=this.globals;
var _bb=this.grid[0];
var _bc=new HPoint(Math.round(G.mapSize.width/2),Math.round(G.mapSize.height/2));
var _bd=Math.floor((_bc.x-_bb.point.x)/HTile.TILE_WIDTH);
var _be=-Math.floor((_bc.y-_bb.point.y)/HTile.TILE_HEIGHT);
var _bf=_bb.mapColumn+_bd;
var _c0=_bb.mapRow+_be;
return {column:_bf,row:_c0};
};
HMap.prototype.getBottomLeftTile=function(){
var _c1=0;
var _c2=this.grid[_c1].point;
for(var i=0;i<this.grid.length;i++){
if(this.grid[i].point.x<=_c2.x&&this.grid[i].point.y>=_c2.y){
_c2=this.grid[i].point;
_c1=i;
}
}
return {column:this.grid[_c1].mapColumn,row:this.grid[_c1].mapRow};
};
HMap.prototype.fromRT90ToLatLng=function(_c4){
return this.transform.fromRT90ToLatLng(_c4);
};
HMap.prototype.fromLatLngToRT90=function(_c5){
return this.transform.fromLatLngToRT90(_c5);
};
function HMapProviderManager(_c6){
this.hmap=_c6;
this.providers=[];
};
HMapProviderManager.prototype.add=function(_c7){
this.insert(this.count(),_c7);
};
HMapProviderManager.prototype.insert=function(_c8,_c9){
this.providers.insert(_c8,_c9);
if(this.hmap.globals.isInitialized){
this.providers[_c8].initTiles(this.hmap);
for(var i=0;i<this.hmap.grid.length;i++){
this.providers[_c8].updateTile(i,this.hmap.getResolution(),this.hmap.grid[i].mapRow,this.hmap.grid[i].mapColumn);
this.providers[_c8].updatePosition(i,this.hmap.grid[i].point);
}
}
};
HMapProviderManager.prototype.remove=function(_cb){
_cb.remove();
this.providers.remove(_cb);
};
HMapProviderManager.prototype.count=function(){
return this.providers.length;
};
HMapProviderManager.prototype.indexOf=function(_cc){
return this.providers.indexOf(_cc);
};
HMapProviderManager.prototype.get=function(_cd){
return this.providers[_cd];
};
HMapProviderManager.prototype.getBaseMap=function(){
return this.providers[0];
};
HMapProviderManager.prototype.initTiles=function(){
for(var i=0;i<this.providers.length;i++){
this.providers[i].initTiles(this.hmap);
}
};
HMapProviderManager.prototype.updatePosition=function(_cf,_d0){
for(var i=0;i<this.providers.length;i++){
this.providers[i].updatePosition(_cf,_d0);
}
};
HMapProviderManager.prototype.updateTile=function(_d2,_d3,_d4,_d5){
for(var i=0;i<this.providers.length;i++){
this.providers[i].updateTile(_d2,_d3,_d4,_d5);
}
};
HMapProviderManager.prototype.updateStatus=function(){
for(var i=0;i<this.providers.length;i++){
this.providers[i].initStatusUpdate();
}
};
function HTile(_d8,_d9){
var G=_d8.globals;
var me=this;
me.point=new HPoint(-HTile.TILE_WIDTH,-HTile.TILE_HEIGHT);
me.hmap=_d8;
me.mapProviderManager=_d8.getMapProviderManager();
me.tileIndex=_d9;
me.tileColumn=_d9%G.tilesPerRow;
me.tileRow=(G.tilesPerColumn-1)-parseInt(_d9/G.tilesPerRow);
me.initPosition();
};
HTile.TILE_WIDTH=256;
HTile.TILE_HEIGHT=256;
HTile.prototype.initPosition=function(){
var G=this.hmap.globals;
this.mapRow=G.mapRow+this.tileRow;
this.mapColumn=G.mapColumn+this.tileColumn;
this.point.x=G.tileInitOffsetX+this.tileColumn*HTile.TILE_WIDTH;
this.point.y=G.tileInitOffsetY+((G.tilesPerColumn-1)-this.tileRow)*HTile.TILE_HEIGHT;
this.mapProviderManager.updatePosition(this.tileIndex,this.point);
};
HTile.prototype.updateMapTile=function(){
var G=this.hmap.globals;
this.mapProviderManager.updateTile(this.tileIndex,G.resolution,this.mapRow,this.mapColumn);
};
HTile.prototype.pan=function(dx,dy){
var me=this;
var G=me.hmap.globals;
me.point.x+=dx;
me.point.y+=dy;
var _e2=false;
if(me.point.x>G.mapSize.width+G.mapPaddingX-(HTile.TILE_WIDTH/2)){
me.point.x-=G.tilesPerRow*HTile.TILE_WIDTH;
me.mapColumn-=G.tilesPerRow;
_e2=true;
}else{
if(me.point.x<=-HTile.TILE_WIDTH-G.mapPaddingX+(HTile.TILE_WIDTH/2)){
me.point.x+=G.tilesPerRow*HTile.TILE_WIDTH;
me.mapColumn+=G.tilesPerRow;
_e2=true;
}
}
if(me.point.y>G.mapSize.height+G.mapPaddingY-(HTile.TILE_HEIGHT/2)){
me.point.y-=G.tilesPerColumn*HTile.TILE_HEIGHT;
me.mapRow+=G.tilesPerColumn;
_e2=true;
}else{
if(me.point.y<=-HTile.TILE_HEIGHT-G.mapPaddingY+(HTile.TILE_HEIGHT/2)){
me.point.y+=G.tilesPerColumn*HTile.TILE_HEIGHT;
me.mapRow-=G.tilesPerColumn;
_e2=true;
}
}
this.mapProviderManager.updatePosition(this.tileIndex,me.point);
if(_e2){
me.updateMapTile();
}
return _e2;
};
function HControl(){
};
HControl.Z_INDEX=10000000;
HControl.prototype.init=function(_e3,_e4){
this.hmap=_e3;
this.position=_e4;
this.container=this.hmap.getPaneControls();
this.container.appendChild(this.element);
this.update();
};
HControl.prototype.remove=function(){
this.container.removeChild(this.element);
};
HControl.prototype.getElement=function(){
return this.element;
};
HControl.prototype.update=function(){
var pos=this.getContainerPosition();
this.element.style.left=pos.x+"px";
this.element.style.top=pos.y+"px";
};
HControl.prototype.getContainerPosition=function(){
var _e6=this.hmap.getSize();
var G=this.hmap.globals;
var pos=new HPoint(0,0);
switch(this.position.anchor){
case HControlPosition.ANCHOR_TOP_RIGHT:
pos.x=_e6.width-G.paddingRight;
pos.y=0+G.paddingTop;
break;
case HControlPosition.ANCHOR_TOP_CENTER:
pos.x=G.paddingLeft+Math.round((_e6.width-G.paddingRight-G.paddingLeft)/2);
pos.y=0+G.paddingTop;
break;
case HControlPosition.ANCHOR_TOP_LEFT:
pos.x=0+G.paddingLeft;
pos.y=0+G.paddingTop;
break;
case HControlPosition.ANCHOR_LEFT_CENTER:
pos.x=0+G.paddingLeft;
pos.y=G.paddingTop+Math.round((_e6.height-G.paddingTop-G.paddingBottom)/2);
break;
case HControlPosition.ANCHOR_RIGHT_CENTER:
pos.x=_e6.width-G.paddingRight;
pos.y=G.paddingTop+Math.round((_e6.height-G.paddingTop-G.paddingBottom)/2);
break;
case HControlPosition.ANCHOR_BOTTOM_RIGHT:
pos.x=_e6.width-G.paddingRight;
pos.y=_e6.height-G.paddingBottom;
break;
case HControlPosition.ANCHOR_BOTTOM_CENTER:
pos.x=G.paddingLeft+Math.round((_e6.width-G.paddingRight-G.paddingLeft)/2);
pos.y=_e6.height-G.paddingBottom;
break;
case HControlPosition.ANCHOR_BOTTOM_LEFT:
pos.x=0+G.paddingLeft;
pos.y=_e6.height-G.paddingBottom;
break;
case HControlPosition.ANCHOR_CENTER:
pos.x=Math.round(((_e6.width-G.paddingLeft-G.paddingRight)-this.element.offsetWidth)/2+G.paddingLeft);
pos.y=Math.round(((_e6.height-G.paddingTop-G.paddingBottom)-this.element.offsetHeight)/2+G.paddingTop);
break;
}
pos.x+=this.position.offset.x;
pos.y+=this.position.offset.y;
return pos;
};
HControl.prototype.getDefaultPosition=function(){
return new HControlPosition(HControlPosition.ANCHOR_TOP_LEFT);
};
function HControlPosition(_e9,_ea){
this.anchor=_e9;
this.offset=arguments[1]||new HPoint(0,0);
};
HControlPosition.ANCHOR_TOP_RIGHT=1;
HControlPosition.ANCHOR_TOP_CENTER=2;
HControlPosition.ANCHOR_TOP_LEFT=3;
HControlPosition.ANCHOR_LEFT_CENTER=4;
HControlPosition.ANCHOR_RIGHT_CENTER=5;
HControlPosition.ANCHOR_BOTTOM_RIGHT=6;
HControlPosition.ANCHOR_BOTTOM_CENTER=7;
HControlPosition.ANCHOR_BOTTOM_LEFT=8;
HControlPosition.ANCHOR_CENTER=9;
function HZoomControl(){
var div=document.createElement("div");
div.id="HZoomControl";
HMapHelpers.applyStyle([div],{position:"absolute",fontFamily:"Verdana, Arial",fontSize:"12px",fontWeight:"normal",zIndex:HControl.Z_INDEX});
var _ec=document.createElement("img");
_ec.id="HzoomOutButton";
_ec.src=HZoomControl.GFX_URL+"zoom_out.png";
HMapHelpers.applyStyle([_ec],{position:"absolute",cursor:"pointer",width:"84px",height:"20px"});
var _ed=document.createElement("img");
_ed.id="HzoomInButton";
_ed.src=HZoomControl.GFX_URL+"zoom_in.png";
HMapHelpers.applyStyle([_ed],{position:"absolute",cursor:"pointer",width:"84px",height:"20px",left:"285px"});
var _ee=document.createElement("div");
HMapHelpers.applyStyle([_ee],{position:"absolute",left:"87px"});
var _ef=document.createElement("img");
_ef.id="HzoomBackground";
_ef.src=HZoomControl.GFX_URL+"zoom_bkg.png";
HMapHelpers.applyStyle([_ef],{position:"absolute",cursor:"auto"});
_ee.appendChild(_ef);
this.zoomIcons=[];
for(var i=1;i<=HZoomControl.ZOOM_LEVELS;i++){
this.zoomIcons[i]=document.createElement("div");
this.zoomIcons[i].id="HzoomIcon"+i;
this.zoomIcons[i].innerHTML=i;
HMapHelpers.applyStyle([this.zoomIcons[i]],{position:"absolute",backgroundColor:"#fff",fontSize:"11px",border:"1px solid #848CA1",color:"#898B86",cursor:"pointer",zIndex:HControl.Z_INDEX,textAlign:"center",width:"14px",height:"14px",left:(HZoomControl.ZOOM_LEVEL_OFFSET+HZoomControl.ZOOM_LEVEL_WIDTH*(i-1))+"px",top:"2px"});
_ee.appendChild(this.zoomIcons[i]);
}
var _f1=document.createElement("div");
HMapHelpers.applyStyle([_f1],{position:"absolute",left:"21px",top:"-3px",zIndex:(HControl.Z_INDEX+1)});
var _f2=document.createElement("img");
_f2.src=HZoomControl.GFX_URL+"zoom_handle.png";
_f1.appendChild(_f2);
var _f3=document.createElement("div");
HMapHelpers.applyStyle([_f3],{position:"absolute",left:"-1px",top:"6px",width:HZoomControl.ZOOM_HANDLE_WIDTH+"px",height:"28px",textAlign:"center",fontSize:"11px",cursor:"pointer",zIndex:(HControl.Z_INDEX+1)});
_f1.appendChild(_f3);
_ee.appendChild(_f1);
div.appendChild(_ec);
div.appendChild(_ee);
div.appendChild(_ed);
this.zoomHandle=_f1;
this.zoomHandleNumber=_f3;
this.element=div;
};
HZoomControl.prototype=new HControl();
HZoomControl.GFX_URL="http://www.hitta.se/Images/hmap/";
HZoomControl.ZOOM_LEVELS=10;
HZoomControl.WIDTH=368;
HZoomControl.ZOOM_LEVEL_OFFSET=3;
HZoomControl.ZOOM_LEVEL_WIDTH=19;
HZoomControl.ZOOM_HANDLE_WIDTH=18;
HZoomControl.ZOOM_LEVEL_CONTAINER_WIDTH=HZoomControl.ZOOM_LEVEL_OFFSET+HZoomControl.ZOOM_LEVELS*HZoomControl.ZOOM_LEVEL_WIDTH;
HZoomControl.ANIM_INTERVAL=10;
HZoomControl.ANIM_SPEED=5;
HZoomControl.prototype.init=function(_f4,_f5){
var me=this;
HControl.prototype.init.apply(me,[_f4,_f5]);
var _f7=document.getElementById("HzoomOutButton");
var _f8=document.getElementById("HzoomInButton");
HEvent.addDomListener(_f7,"click",function(e){
me.hmap.zoomOut();
HEvent.stopEvent(e);
});
HEvent.addDomListener(_f8,"click",function(e){
me.hmap.zoomIn();
HEvent.stopEvent(e);
});
var _fb=document.getElementById("HzoomBackground");
HEvent.addDomListener(_fb,"click",HEvent.stopEvent);
HEvent.addDomListener(_fb,"dblclick",HEvent.stopEvent);
HEvent.addDomListener(_f7,"dblclick",HEvent.stopEvent);
HEvent.addDomListener(_f8,"dblclick",HEvent.stopEvent);
for(var i=1;i<=HZoomControl.ZOOM_LEVELS;i++){
(function(i){
HEvent.addDomListener(me.zoomIcons[i],"click",function(e){
me.hmap.setZoom(i);
me.isDragging=false;
HEvent.stopEvent(e);
});
})(i);
}
HEvent.addDomListener(this.zoomHandle,"mousedown",function(e){
me.startZoomHandleDrag(e);
});
HEvent.addDomListener(document,"mouseup",function(e){
me.stopZoomHandleDrag(e);
});
HEvent.addDomListener(document,"mousemove",function(e){
me.zoomHandleDrag(e);
});
this.isDragging=false;
this.updateZoomLevel(_f4.getZoom(),true);
HEvent.addListener(me.hmap,HMap.EVENT_INTERNAL_MAP_ZOOM,function(_102,_103){
me.updateZoomLevel(_103);
});
HEvent.addListener(me.hmap,HMap.EVENT_INTERNAL_MAP_TYPE_CHANGED,function(){
me.updateStatus(null);
});
HEvent.addListener(HStandardMapProvider,HMap.EVENT_INTERNAL_MAP_STATUS_UPDATE,function(_104){
me.updateStatus(_104);
});
};
HZoomControl.prototype.updateZoomLevel=function(_105,_106){
var me=this;
var _108=me.zoomHandle.offsetLeft;
var dest=HZoomControl.ZOOM_LEVEL_OFFSET+(HZoomControl.ZOOM_LEVEL_WIDTH*(_105-1));
if(arguments[1]||false){
me.zoomHandle.style.left=dest+"px";
me.zoomHandleNumber.innerHTML=_105;
}else{
var _10a=setInterval(function(){
var step=(dest-_108)/HZoomControl.ANIM_SPEED;
step=(step<0)?Math.floor(step):Math.ceil(step);
_108+=step;
me.zoomHandle.style.left=_108+"px";
if(_108==dest){
clearInterval(_10a);
me.zoomHandleNumber.innerHTML=_105;
}
},HZoomControl.ANIM_INTERVAL);
}
};
HZoomControl.prototype.updateStatus=function(_10c){
if(_10c!=null){
this.currentStatus=_10c;
}
if(this.currentStatus){
var _10d=this.hmap.getMapType();
for(var i=1;i<=HZoomControl.ZOOM_LEVELS;i++){
if(i>=this.currentStatus[_10d].min&&i<=this.currentStatus[_10d].max){
HMapHelpers.applyStyle([this.zoomIcons[i]],{backgroundColor:"#fff"});
}else{
HMapHelpers.applyStyle([this.zoomIcons[i]],{backgroundColor:"#C0C0C0"});
}
}
}
};
HZoomControl.prototype.startZoomHandleDrag=function(e){
var pos=HMapHelpers.getMousePosition(e);
HEvent.stopEvent(e);
this.dragStartX=pos.x;
this.dragHandleStartX=this.zoomHandle.offsetLeft;
this.zoomHandleNumber.innerHTML="";
this.isDragging=true;
};
HZoomControl.prototype.stopZoomHandleDrag=function(e){
if(this.isDragging){
var pos=HMapHelpers.getMousePosition(e);
var left=this.restrictZoomHandleBounds(this.dragHandleStartX+(pos.x-this.dragStartX));
var _114=1+Math.round((left-HZoomControl.ZOOM_LEVEL_OFFSET)/HZoomControl.ZOOM_LEVEL_WIDTH);
if(this.hmap.getZoom()!=_114){
if(!this.hmap.setZoom(_114)){
this.hmap.zoomMax();
}
}
this.isDragging=false;
}
};
HZoomControl.prototype.zoomHandleDrag=function(e){
if(this.isDragging){
var pos=HMapHelpers.getMousePosition(e);
var left=this.restrictZoomHandleBounds(this.dragHandleStartX+(pos.x-this.dragStartX));
this.zoomHandle.style.left=left+"px";
HEvent.stopEvent(e);
}
};
HZoomControl.prototype.restrictZoomHandleBounds=function(left){
if(left<HZoomControl.ZOOM_LEVEL_OFFSET){
left=HZoomControl.ZOOM_LEVEL_OFFSET;
}
if(left>=HZoomControl.ZOOM_LEVEL_CONTAINER_WIDTH-HZoomControl.ZOOM_HANDLE_WIDTH){
left=HZoomControl.ZOOM_LEVEL_CONTAINER_WIDTH-HZoomControl.ZOOM_HANDLE_WIDTH;
}
return left;
};
HZoomControl.prototype.getDefaultPosition=function(){
return new HControlPosition(HControlPosition.ANCHOR_BOTTOM_CENTER,new HPoint(-Math.round(HZoomControl.WIDTH/2),-25));
};
function HScaleControl(){
var div=document.createElement("div");
div.id="HScaleControl";
HMapHelpers.applyStyle([div],{position:"absolute",borderStyle:"none solid solid",borderWidth:"medium 2px 2px",margin:"2px 0 5px 0",fontFamily:"Arial",fontSize:"12px",textAlign:"center",zIndex:HControl.Z_INDEX,width:"100px"});
this.element=div;
};
HScaleControl.prototype=new HControl();
HScaleControl.DEFAULT_WIDTH=100;
HScaleControl.SCALE_CONFIG={1:{dist:"35mil",width:HScaleControl.DEFAULT_WIDTH},2:{dist:"70km",width:HScaleControl.DEFAULT_WIDTH},3:{dist:"20km",width:HScaleControl.DEFAULT_WIDTH},4:{dist:"7km",width:HScaleControl.DEFAULT_WIDTH},5:{dist:"2km",width:80},6:{dist:"1km",width:HScaleControl.DEFAULT_WIDTH},7:{dist:"400m",width:HScaleControl.DEFAULT_WIDTH},8:{dist:"200m",width:HScaleControl.DEFAULT_WIDTH},9:{dist:"50m",width:HScaleControl.DEFAULT_WIDTH},10:{dist:"20m",width:HScaleControl.DEFAULT_WIDTH}};
HScaleControl.prototype.init=function(hmap,_11b){
var me=this;
HControl.prototype.init.apply(me,[hmap,_11b]);
this.updateZoomLevel(0,hmap.getZoom());
HEvent.addListener(me.hmap,HMap.EVENT_INTERNAL_MAP_ZOOM,function(_11d,_11e){
me.updateZoomLevel(_11d,_11e);
});
};
HScaleControl.prototype.updateZoomLevel=function(_11f,_120){
this.element.style.width=HScaleControl.SCALE_CONFIG[_120].width;
this.element.innerHTML=HScaleControl.SCALE_CONFIG[_120].dist;
this.element.style.marginLeft=HScaleControl.DEFAULT_WIDTH-HScaleControl.SCALE_CONFIG[_120].width;
this.update();
};
HScaleControl.prototype.getDefaultPosition=function(){
return new HControlPosition(HControlPosition.ANCHOR_BOTTOM_RIGHT,new HPoint(-106,-24));
};
function HCopyrightControl(){
var div=document.createElement("div");
HMapHelpers.applyStyle([div],{position:"absolute",fontFamily:"Arial",fontSize:"10px",zIndex:HControl.Z_INDEX});
div.innerHTML="&copy Lantm&auml;teriverket";
this.element=div;
};
HCopyrightControl.prototype=new HControl();
HCopyrightControl.prototype.getDefaultPosition=function(){
return new HControlPosition(HControlPosition.ANCHOR_BOTTOM_LEFT,new HPoint(2,-20));
};
function HLogoControl(_122,_123,_124){
this.width=_123;
this.height=_124;
this.onClick=null;
var img=document.createElement("img");
img.id="HLogoControl";
img.src=_122;
img.className="link";
if(HMapHelpers.isIEVersionBelow(7)){
HMapHelpers.applyIEPNGFix(img,_122);
}
HMapHelpers.applyStyle([img],{position:"absolute",width:_123+"px",height:_124+"px",zIndex:HControl.Z_INDEX});
this.onClick=HEvent.addDomListener(img,"click",function(e){
location.href="http://www.hitta.se";
HEvent.stopEvent(e);
});
this.element=img;
};
HLogoControl.prototype=new HControl();
HLogoControl.DEFAULT_VERT_PADDING=-25;
HLogoControl.DEFAULT_HORZ_PADDING=4;
HLogoControl.prototype.getDefaultPosition=function(){
return new HControlPosition(HControlPosition.ANCHOR_BOTTOM_LEFT,new HPoint(HLogoControl.DEFAULT_HORZ_PADDING,HLogoControl.DEFAULT_VERT_PADDING-this.height));
};
function HMapTypeControl(){
var _127=document.createElement("span");
_127.id="HMapTypeControl";
HMapHelpers.applyStyle([_127],{border:"1px solid #222",position:"absolute",fontFamily:"Arial",fontSize:"11px",zIndex:HControl.Z_INDEX,cursor:"pointer"});
var _128=document.createElement("span");
HMapHelpers.applyStyle([_128],{zIndex:HControl.Z_INDEX,padding:"2px 5px 2px 5px","float":"left"});
_128.innerHTML="Karta";
var _129=document.createElement("span");
HMapHelpers.applyStyle([_129],{zIndex:HControl.Z_INDEX,padding:"2px 5px 2px 5px","float":"left"});
_129.innerHTML="Satellit";
this.options=[];
this.options[HStandardMapProvider.MAP_TYPE_NORMAL]=_128;
this.options[HStandardMapProvider.MAP_TYPE_SATELLITE]=_129;
this.makeSelected(HStandardMapProvider.MAP_TYPE_NORMAL);
var me=this;
HEvent.addDomListener(_128,"click",function(e){
me.changeTypeTo(HStandardMapProvider.MAP_TYPE_NORMAL);
return HEvent.stopEvent(e);
});
HEvent.addDomListener(_129,"click",function(e){
me.changeTypeTo(HStandardMapProvider.MAP_TYPE_SATELLITE);
return HEvent.stopEvent(e);
});
_127.appendChild(_128);
_127.appendChild(_129);
this.element=_127;
};
HMapTypeControl.prototype=new HControl();
HMapTypeControl.prototype.init=function(hmap,_12e){
var me=this;
HControl.prototype.init.apply(me,[hmap,_12e]);
this.changeTypeTo(hmap.getMapType());
};
HMapTypeControl.prototype.changeTypeTo=function(_130){
this.makeSelected(_130);
this.hmap.setMapType(_130);
};
HMapTypeControl.prototype.makeSelected=function(_131){
for(var i=0;i<this.options.length;i++){
if(_131==i){
HMapHelpers.applyStyle([this.options[i]],{background:"#fff",border:"1px solid #ccc"});
}else{
HMapHelpers.applyStyle([this.options[i]],{background:"#ccc",border:"1px solid #fff"});
}
}
};
HMapTypeControl.prototype.getDefaultPosition=function(){
return new HControlPosition(HControlPosition.ANCHOR_TOP_LEFT,new HPoint(0,0));
};
function HSmallZoomControl(){
var div=document.createElement("div");
div.id="HSmallZoomControl";
HMapHelpers.applyStyle([div],{position:"absolute",zIndex:HControl.Z_INDEX});
var _134=document.createElement("img");
_134.src=HSmallZoomControl.GFX_URL+"zoom_out_small.png";
HMapHelpers.applyStyle([_134],{cursor:"pointer",zIndex:HControl.Z_INDEX});
var _135=document.createElement("img");
_135.src=HSmallZoomControl.GFX_URL+"zoom_in_small.png";
HMapHelpers.applyStyle([_135],{cursor:"pointer",zIndex:HControl.Z_INDEX});
var me=this;
HEvent.addDomListener(_134,"click",function(e){
me.zoomOut();
HEvent.stopEvent(e);
});
HEvent.addDomListener(_135,"click",function(e){
me.zoomIn();
HEvent.stopEvent(e);
});
HEvent.addDomListener(_134,"dblclick",HEvent.stopEvent);
HEvent.addDomListener(_135,"dblclick",HEvent.stopEvent);
div.appendChild(_134);
div.appendChild(_135);
this.element=div;
};
HSmallZoomControl.prototype=new HControl();
HSmallZoomControl.WIDTH=30;
HSmallZoomControl.GFX_URL="http://www.hitta.se/Images/hmap/";
HSmallZoomControl.prototype.zoomIn=function(){
this.hmap.zoomIn();
};
HSmallZoomControl.prototype.zoomOut=function(){
this.hmap.zoomOut();
};
HSmallZoomControl.prototype.getDefaultPosition=function(){
return new HControlPosition(HControlPosition.ANCHOR_BOTTOM_CENTER,new HPoint(-Math.round(HSmallZoomControl.WIDTH/2),-20));
};
function HLabel(html,_13a){
this.position=arguments[1]||new HControlPosition(HControlPosition.ANCHOR_CENTER);
var div=document.createElement("div");
div.innerHTML=html;
HMapHelpers.applyStyle([div],{position:"absolute"});
this.element=div;
};
HLabel.prototype=new HControl();
HLabel.prototype.getDefaultPosition=function(){
return this.position;
};
function HPanControl(){
var img=document.createElement("img");
img.id="HPanControl";
img.src="http://www.hitta.se/Images/hmap/nav-blue.png";
if(HMapHelpers.isIEVersionBelow(7)){
HMapHelpers.applyIEPNGFix(img,img.src);
}
HMapHelpers.applyStyle([img],{position:"absolute",width:"50px",height:"50px",cursor:"pointer",zIndex:HControl.Z_INDEX});
var _13d={up:{x1:13,y1:0,x2:36,y2:13},right:{x1:35,y1:12,x2:49,y2:35},down:{x1:13,y1:34,x2:36,y2:48},left:{x1:0,y1:12,x2:14,y2:35}};
var me=this;
HEvent.addDomListener(img,"click",function(e){
var _140=function(pos,box){
return (pos.x>box.x1&&pos.x<box.x2&&pos.y>box.y1&&pos.y<box.y2);
};
var pos=HMapHelpers.getMousePosition(e);
var ePos=HMapHelpers.getElementPosition(img);
pos.x-=ePos.x;
pos.y-=ePos.y;
if(_140(pos,_13d.up)){
me.hmap.panDirection(0,+1);
}else{
if(_140(pos,_13d.right)){
me.hmap.panDirection(-1,0);
}else{
if(_140(pos,_13d.down)){
me.hmap.panDirection(0,-1);
}else{
if(_140(pos,_13d.left)){
me.hmap.panDirection(+1,0);
}
}
}
}
return HEvent.stopEvent(e);
});
this.element=img;
};
HPanControl.prototype=new HControl();
HPanControl.prototype.getDefaultPosition=function(){
return new HControlPosition(HControlPosition.ANCHOR_BOTTOM_LEFT,new HPoint(5,-75));
};
var HMapHelpers={};
HMapHelpers.createContainerDiv=function(_145){
var _146=document.createElement("div");
HMapHelpers.applyStyle([_146],{position:"absolute",overflow:"hidden",textAlign:"left",width:"100%",height:"100%",left:"0px",top:"0px",UserSelect:"none",KhtmlUserSelect:"none",MozUserSelect:"none",cursor:"move"});
_145.appendChild(_146);
return _146;
};
HMapHelpers.createIconElement=function(_147){
var _148=document.createElement("div");
HMapHelpers.applyStyle([_148],{height:_147.size.height+"px",width:_147.size.width+"px",overflow:"hidden"});
var _149=_147.size.width*_147.iconIndex;
if(HMapHelpers.isIEVersionBelow(7)){
var _14a=document.createElement("div");
HMapHelpers.applyStyle([_14a],{position:"relative",display:"block",left:-_149+"px",height:_147.size.height+"px",width:_147.size.width+"px"});
HMapHelpers.applyIEPNGFix(_14a,_147.image);
_148.appendChild(_14a);
}else{
HMapHelpers.applyBackgroundImage(_148,_147.image);
HMapHelpers.setBackgroundPosition(_148,-_149+"px","0px");
}
return _148;
};
HMapHelpers.clearElement=function(_14b){
while(_14b.hasChildNodes()){
_14b.removeChild(_14b.lastChild);
}
};
HMapHelpers.getMousePosition=function(_14c){
var e=_14c||window.event;
var _14e=e.pageX||(e.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft));
var _14f=e.pageY||(e.clientY+(document.documentElement.scrollTop||document.body.scrollTop));
return new HPoint(_14e,_14f);
};
HMapHelpers.getElementPosition=function(_150){
var left=_150.offsetLeft;
var top=_150.offsetTop;
var _153=_150.offsetParent;
while(_153!=null){
left+=_153.offsetLeft;
top+=_153.offsetTop;
_153=_153.offsetParent;
}
return new HPoint(left,top);
};
HMapHelpers.getClientSize=function(){
var _154=0,_155=0;
if(typeof (window.innerWidth)=="number"){
_154=window.innerWidth;
_155=window.innerHeight;
}else{
if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){
_154=document.documentElement.clientWidth;
_155=document.documentElement.clientHeight;
}else{
if(document.body&&(document.body.clientWidth||document.body.clientHeight)){
_154=document.body.clientWidth;
_155=document.body.clientHeight;
}
}
}
return {width:_154,height:_155};
};
HMapHelpers.applyStyle=function(_156,_157){
for(var i=0;i<_156.length;i++){
for(var attr in _157){
if(attr=="float"){
_156[i].style["cssFloat"]=_157[attr];
_156[i].style["styleFloat"]=_157[attr];
}else{
try{
_156[i].style[attr]=_157[attr];
}
catch(ex){
}
}
}
}
};
HMapHelpers.isIEEvent=function(_15a){
var e=_15a||window.event;
return !e.preventDefault;
};
HMapHelpers.isIE=function(){
return !!document.all;
};
HMapHelpers.isIEVersionBelow=function(_15c){
var _15d=navigator.appName;
var _15e=navigator.appVersion;
var _15f=parseInt(_15e.indexOf("MSIE"))+1;
var _160=parseFloat(_15e.substring(_15f+4,_15f+7));
return (_15d=="Microsoft Internet Explorer"&&_160<_15c);
};
HMapHelpers.isOpera=function(){
var _161=navigator.userAgent;
return (_161.indexOf("Opera/")!=-1);
};
HMapHelpers.isSafari=function(){
var _162=navigator.userAgent;
return (_162.indexOf("Safari/")!=-1&&_162.indexOf("Chrome/")==-1);
};
HMapHelpers.isLeftMouseClicked=function(_163){
var e=_163||window.event;
if(e.which){
return (e.which==1);
}else{
if(e.button){
return (e.button==0||e.button==1);
}
}
return false;
};
HMapHelpers.isRightMouseClicked=function(_165){
var e=_165||window.event;
if(e.which){
return (e.which==3||e.which==2);
}else{
if(e.button){
return (e.button==2||e.button==3);
}
}
return false;
};
HMapHelpers.initJSONP=function(url,_168,_169){
var _16a=arguments[1]||5000;
var _16b=arguments[2]||false;
if(!document.body){
return;
}
var _16c=document.createElement("script");
_16c.setAttribute("type","text/javascript");
if(!_16b){
url+=(url.indexOf("?")==-1?"?":"&")+(new Date().getTime());
}
_16c.setAttribute("src",url);
var head=document.getElementsByTagName("head")[0];
setTimeout(function(){
head.removeChild(_16c);
},_16a);
head.appendChild(_16c);
};
HMapHelpers.getJSONP=function(url,_16f,that){
if(!HMapHelpers.jsonCounter){
HMapHelpers.jsonCounter=new Date().getTime();
}else{
HMapHelpers.jsonCounter++;
}
var _171="jsonpCallback"+HMapHelpers.jsonCounter;
HMapHelpers[_171]=function(data){
_16f.call(that,data);
HMapHelpers[_171]=null;
};
HMapHelpers.initJSONP(url+(url.indexOf("?")==-1?"?":"&")+"callback=HMapHelpers."+_171,null,true);
};
HMapHelpers.setOpacity=function(_173,_174){
_174=(_174==100)?99.999:_174;
_173.style.filter="alpha(opacity:"+_174+")";
_173.style.KHTMLOpacity=_174/100;
_173.style.MozOpacity=_174/100;
_173.style.opacity=_174/100;
};
HMapHelpers.fade=function(_175,from,to,_178){
var _179=10;
var _17a=Math.abs(from-to);
var sign=(to-from)/_17a;
var step=Math.ceil(sign*(_17a/(_178/_179)));
var _17d=setInterval(function(){
HMapHelpers.setOpacity(_175,from);
from+=step;
if((sign>0&&to<=from)||(sign<0&&to>=from)){
clearInterval(_17d);
}
},_179);
};
HMapHelpers.signMin=function(a,b){
if(a==0||b==0){
return 0;
}
var absA=Math.abs(a);
return (a/absA)*Math.min(Math.abs(b),absA);
};
HMapHelpers.applyIEPNGFix=function(_181,src){
_181.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"',sizingMethod='image')";
};
HMapHelpers.applyBackgroundImage=function(_183,src){
_183.style.backgroundImage="url("+src+")";
};
HMapHelpers.setBackgroundPosition=function(_185,left,top){
_185.style.backgroundPosition=left+" "+top;
};
HMapHelpers.loadScript=function(src){
var head=document.getElementsByTagName("head")[0];
var _18a=document.createElement("SCRIPT");
_18a.setAttribute("language","javascript");
_18a.setAttribute("type","text/javascript");
_18a.setAttribute("src",src);
head.appendChild(_18a);
};
HMapHelpers.parseUrl=function(str){
if(str.indexOf("?")!=-1){
str=str.substring(str.indexOf("?")+1);
if(str.indexOf("#")>-1){
str=str.substring(0,str.indexOf("#"));
}
}else{
if(str.indexOf("#")!=-1){
str=str.substring(str.indexOf("#")+1);
}
}
var _18c=str.split("&");
var _18d={};
for(var i=0;i<_18c.length;i++){
var pair=_18c[i].split("=");
_18d[pair[0]]=pair[1];
}
return _18d;
};
HMapHelpers.isCanvas=function(){
return (!HMapHelpers.isIE()||!(typeof window.CanvasRenderingContext2D=="undefined"&&typeof G_vmlCanvasManager=="undefined"));
};
HMapHelpers.isArray=function(_190){
return Object.prototype.toString.call(_190)==="[object Array]";
};
HMapHelpers.makeArray=function(obj){
if(obj===null){
return [];
}
if(HMapHelpers.isArray(obj)){
return obj;
}
return [obj];
};
function HOverlay(){
this.isAdded=false;
this.isActive=true;
this.container=null;
};
HOverlay.Z_INDEX_OFFSET=10000;
HOverlay.Z_INDEX_OFFSET_INFO_BOX=HOverlay.Z_INDEX_OFFSET+3000000;
HOverlay.getZIndex=function(_192){
return HOverlay.Z_INDEX_OFFSET+(HMap.RT90_GEO_POINT_NORTH-_192.north);
};
HOverlay.prototype.init=function(hmap){
this.hmap=hmap;
this.container=this.hmap.getPaneOverlay();
this.container.appendChild(this.getElement());
this.update();
};
HOverlay.prototype.remove=function(){
this.container.removeChild(this.element);
};
HOverlay.prototype.update=function(){
};
HOverlay.prototype.getElement=function(){
return this.element;
};
function HIcon(_194){
this.image=_194;
this.anchor=new HPoint(0,0);
this.infoBoxAnchorTop=new HPoint(0,0);
this.infoBoxAnchorBottom=new HPoint(0,0);
this.size=null;
this.iconIndex=null;
};
HIcon.H_DEFAULT_ICON={image:"http://www.hitta.se/images/point.png",anchor:new HPoint(10,11),infoBoxAnchorTop:new HPoint(10,-2),infoBoxAnchorBottom:new HPoint(10,25),size:new HSize(25,25),iconIndex:null};
function HMarker(_195,icon){
var me=this;
me.icon=arguments[1]||HIcon.H_DEFAULT_ICON;
me.mode=HMarker.MODE_INFOBOX_CLICK;
me.rt90point=_195;
me.draggingEnabled=false;
me.eventListeningEnabled=true;
me.overrideZIndex=null;
me.isMarker=true;
if(me.icon.iconIndex!=null){
me.element=document.createElement("div");
HMapHelpers.applyStyle([me.element],{position:"absolute",display:"block",overflow:"hidden"});
if(HMapHelpers.isIEVersionBelow(7)){
me.imgElement=document.createElement("div");
HMapHelpers.applyStyle([me.imgElement],{position:"relative",display:"block"});
me.element.appendChild(me.imgElement);
}
}else{
me.element=document.createElement("img");
HMapHelpers.applyStyle([me.element],{position:"absolute"});
}
this.setIcon(me.icon);
};
HMarker.prototype=new HOverlay();
HMarker.MODE_INFOBOX_CLICK=0;
HMarker.MODE_INFOBOX_HOVER=1;
HMarker.INFOBOX_CLOSE_DELAY=1100;
HMarker.AUTO_SCROLL_ZONE=20;
HMarker.AUTO_SCROLL_SPEED=2;
HMarker.EVENT_DRAG_START="markerdragstart";
HMarker.EVENT_DRAG_END="markerdragend";
HMarker.EVENT_DRAG_MOVE="markerdragmove";
HMarker.EVENT_MOUSE_UP="markermouseup";
HMarker.EVENT_MOUSE_DOWN="markermousedown";
HMarker.EVENT_MOUSE_CLICK="markermouseclick";
HMarker.EVENT_MOUSE_DBLCLICK="markermousedblclick";
HMarker.EVENT_MOUSE_OVER="markermouseover";
HMarker.EVENT_MOUSE_OUT="markermouseout";
HMarker.EVENT_INFOBOX_OPEN="markerinfoboxopen";
HMarker.EVENT_INFOBOX_CLOSE="markerinfoboxclose";
HMarker.prototype.init=function(hmap){
var me=this;
me.hmap=hmap;
this.container=me.hmap.getPaneOverlay();
this.container.appendChild(this.getElement());
me.update();
if(this.isEventListening()){
this.registerEventListeners();
}
};
HMarker.prototype.remove=function(){
HOverlay.prototype.remove.call(this);
this.unregisterEventListeners();
this.closeInfoBox();
};
HMarker.prototype.enableDragging=function(){
this.draggingEnabled=true;
};
HMarker.prototype.disableDragging=function(){
this.draggingEnabled=false;
};
HMarker.prototype.isDraggingEnabled=function(){
return this.draggingEnabled;
};
HMarker.prototype.enableEventListening=function(){
this.registerEventListeners();
};
HMarker.prototype.disableEventListening=function(){
this.unregisterEventListeners();
};
HMarker.prototype.isEventListening=function(){
return this.eventListeningEnabled;
};
HMarker.prototype.registerEventListeners=function(){
if(!this.listeners){
this.listeners=[];
var me=this;
this.listeners.push(HEvent.addDomListener(me.element,"click",function(e){
return me.click(e);
}));
this.listeners.push(HEvent.addDomListener(me.element,"dblclick",function(e){
return me.dblClick(e);
}));
this.listeners.push(HEvent.addDomListener(me.element,"mousedown",function(e){
return me.mouseDown(e);
}));
this.listeners.push(HEvent.addDomListener(document,"mouseup",function(e){
return me.stopDrag(e);
}));
this.listeners.push(HEvent.addDomListener(document,"mousemove",function(e){
return me.dragging(e);
}));
this.listeners.push(HEvent.addDomListener(me.element,"mouseup",function(e){
return me.mouseUp(e);
}));
this.listeners.push(HEvent.addDomListener(me.element,"mouseover",function(e){
return me.mouseOver(e);
}));
this.listeners.push(HEvent.addDomListener(me.element,"mouseout",function(e){
return me.mouseOut(e);
}));
this.eventListeningEnabled=true;
HMapHelpers.applyStyle([this.element],{cursor:"pointer"});
}
};
HMarker.prototype.unregisterEventListeners=function(){
this.eventListeningEnabled=false;
HMapHelpers.applyStyle([this.element],{cursor:""});
if(this.listeners){
HEvent.removeListeners(this.listeners);
this.listeners=null;
}
};
HMarker.prototype.getRT90Point=function(){
return this.rt90point;
};
HMarker.prototype.setRT90Point=function(_1a3){
var _1a4=!!arguments[1];
this.rt90point=new HPointRT90(_1a3.north,_1a3.east);
if(!_1a4){
this.update();
}
};
HMarker.prototype.getContainerPixelPoint=function(){
return new HPoint(this.point.x+this.icon.anchor.x,this.point.y+this.icon.anchor.y);
};
HMarker.prototype.getIcon=function(){
return this.icon;
};
HMarker.prototype.setIcon=function(icon){
this.icon=icon;
var size=this.icon.size?this.icon.size:null;
this.setImage(this.icon.image,size,this.icon.iconIndex);
if(this.hmap){
this.update();
}
};
HMarker.prototype.getElement=function(){
return this.element;
};
HMarker.prototype.setImage=function(url,size,_1a9){
var _1aa=arguments[2]==undefined?null:arguments[2];
var _1ab=arguments[1]||null;
if(_1aa!=null){
if(HMapHelpers.isIEVersionBelow(7)){
HMapHelpers.applyIEPNGFix(this.imgElement,url);
}else{
HMapHelpers.applyBackgroundImage(this.element,url);
}
if(_1ab&&_1ab.width&&_1ab.height){
HMapHelpers.applyStyle([this.element],{height:_1ab.height+"px",width:_1ab.width+"px"});
if(HMapHelpers.isIEVersionBelow(7)){
HMapHelpers.applyStyle([this.imgElement],{height:_1ab.height+"px",width:_1ab.width+"px"});
}
var _1ac=_1ab.width*-_1aa;
if(HMapHelpers.isIEVersionBelow(7)){
HMapHelpers.applyStyle([this.imgElement],{left:_1ac+"px"});
}else{
HMapHelpers.setBackgroundPosition(this.element,_1ac+"px","0px");
}
}
}else{
if(HMapHelpers.isIEVersionBelow(7)){
HMapHelpers.applyIEPNGFix(this.element,url);
}else{
this.element.src=url;
}
if(_1ab&&_1ab.width&&_1ab.height){
HMapHelpers.applyStyle([this.element],{height:_1ab.height+"px",width:_1ab.width+"px"});
}
}
};
HMarker.prototype.setZIndex=function(_1ad){
this.overrideZIndex=_1ad;
this.update();
};
HMarker.prototype.setMode=function(mode){
this.mode=mode;
};
HMarker.prototype.hide=function(){
this.element.style.display="none";
};
HMarker.prototype.show=function(){
this.element.style.display="block";
};
HMarker.prototype.isHidden=function(){
return (this.element.style.display=="none");
};
HMarker.prototype.update=function(){
this.point=this.hmap.fromRT90toContainerPixel(this.rt90point);
this.point.x-=this.icon.anchor.x;
this.point.y-=this.icon.anchor.y;
var _1af=this.overrideZIndex;
if(_1af===null){
_1af=HOverlay.getZIndex(this.rt90point);
}
HMapHelpers.applyStyle([this.element],{top:this.point.y+"px",left:this.point.x+"px",zIndex:_1af});
if(this.isInfoBoxOpen()){
this.infoBox.update();
this.infoBox.mapMove();
}
};
HMarker.prototype.pan=function(dx,dy){
this.point.x+=dx;
this.point.y+=dy;
this.element.style.left=this.point.x+"px";
this.element.style.top=this.point.y+"px";
};
HMarker.prototype.openInfoBoxHtml=function(_1b2,size,icon,_1b5){
if(_1b2||_1b5){
this.closeInfoBox();
if(this.mode==HMarker.MODE_INFOBOX_CLICK){
this.infoBox=new HInfoBox(this,size,HInfoBox.ANCHOR_BOTTOMLEFT,_1b2,icon,_1b5,true);
}else{
this.infoBox=new HInfoBox(this,size,HInfoBox.ANCHOR_BOTTOMLEFT,_1b2,icon,_1b5,false);
}
this._openInfoBox();
}else{
this.infoBox=null;
}
};
HMarker.prototype.openInfoBoxBound=function(){
this._openInfoBox();
};
HMarker.prototype._openInfoBox=function(){
if(this.infoBox&&!this.infoBox.isAdded){
if(this.hmap.isExclusiveInfoBoxEnabled()){
this.hmap.closeInfoBoxes();
}
HEvent.trigger(this,HMarker.EVENT_INFOBOX_OPEN);
this.hmap.addOverlay(this.infoBox,this.category);
}
};
HMarker.prototype.bindInfoBoxHtml=function(_1b6,size){
if(_1b6!==null){
this.infoBox=new HInfoBox(this,size,HInfoBox.ANCHOR_BOTTOMLEFT,_1b6);
}else{
this.infoBox=null;
}
};
HMarker.prototype.closeInfoBox=function(){
if(this.isInfoBoxOpen()){
HEvent.trigger(this,HMarker.EVENT_INFOBOX_CLOSE);
this.hmap.removeOverlay(this.infoBox);
}
};
HMarker.prototype.isInfoBoxOpen=function(){
return (this.infoBox&&this.infoBox.isAdded);
};
HMarker.prototype.getInfoBox=function(){
return this.infoBox;
};
HMarker.prototype.click=function(e){
if(!this.isDragging){
HEvent.trigger(this,HMarker.EVENT_MOUSE_CLICK,this.getRT90Point());
HEvent.trigger(this.hmap,HMap.EVENT_MARKER_CLICK,this);
if(this.mode==HMarker.MODE_INFOBOX_CLICK){
if(this.isInfoBoxOpen()){
this.closeInfoBox();
}else{
this._openInfoBox();
}
}else{
if(this.mode==HMarker.MODE_INFOBOX_HOVER){
if(this.isInfoBoxOpen()){
this.closeInfoBox();
}
}
}
return HEvent.stopEvent(e);
}
return true;
};
HMarker.prototype.dblClick=function(e){
HEvent.trigger(this,HMarker.EVENT_MOUSE_DBLCLICK,this.getRT90Point());
HEvent.trigger(this.hmap,HMap.EVENT_MARKER_DBLCLICK,this);
return this.mode==HMarker.MODE_INFOBOX_CLICK?HEvent.stopEvent(e):true;
};
HMarker.prototype.mouseDown=function(e){
HEvent.trigger(this,HMarker.EVENT_MOUSE_DOWN,this.getRT90Point());
if(this.draggingEnabled){
return this.startDrag(e);
}
return true;
};
HMarker.prototype.mouseUp=function(e){
HEvent.trigger(this,HMarker.EVENT_MOUSE_UP,this.getRT90Point());
};
HMarker.prototype.mouseOut=function(e){
if(this.mode==HMarker.MODE_INFOBOX_HOVER&&this.isInfoBoxOpen()){
var me=this;
me._infoboxElement=me.getInfoBox().getElement();
setTimeout(function(){
if(!me.getInfoBox().mouseIsOver&&!me.mouseIsOver){
me.closeInfoBox();
if(me.infoboxOutListener){
HEvent.removeListener(me.infoboxOutListener);
}
me.infoboxOutListener=null;
}else{
if(!me.infoboxOutListener){
me.infoboxOutListener=HEvent.addDomListener(me._infoboxElement,"mouseout",function(_1be){
var e=_1be||window.event;
var _1c0=(e.relatedTarget)?e.relatedTarget:e.toElement;
while(_1c0!=me._infoboxElement&&_1c0&&_1c0.nodeName!="BODY"){
_1c0=_1c0.parentNode;
}
if(_1c0==me._infoboxElement){
return;
}
setTimeout(function(){
if(!me.getInfoBox().mouseIsOver&&!me.mouseIsOver){
me.closeInfoBox();
if(me.infoboxOutListener){
HEvent.removeListener(me.infoboxOutListener);
}
me.infoboxOutListener=null;
}
},HMarker.INFOBOX_CLOSE_DELAY);
});
}
}
},HMarker.INFOBOX_CLOSE_DELAY);
}
this.mouseIsOver=false;
HEvent.trigger(this,HMarker.EVENT_MOUSE_OUT,this.getRT90Point());
};
HMarker.prototype.mouseOver=function(e){
HEvent.trigger(this,HMarker.EVENT_MOUSE_OVER,this.getRT90Point());
if(this.mode==HMarker.MODE_INFOBOX_HOVER){
this._openInfoBox();
}
this.mouseIsOver=true;
};
HMarker.prototype.startDrag=function(e){
if(this.draggingEnabled){
var pos=HMapHelpers.getMousePosition(e);
this.dragStart=pos;
this.dragMarkerStart=new HPoint(this.element.offsetLeft,this.element.offsetTop);
return HEvent.stopEvent(e);
}
return true;
};
HMarker.prototype.stopDrag=function(e){
var _1c5=false;
if(this.isDragging){
var me=this;
setTimeout(function(){
me.isDragging=false;
},100);
this.update();
HEvent.trigger(this,HMarker.EVENT_DRAG_END,this.getRT90Point());
HEvent.stopEvent(e);
_1c5=true;
}
this.dragStart=null;
return !_1c5;
};
HMarker.prototype.dragging=function(e){
if(this.draggingEnabled){
var pos=HMapHelpers.getMousePosition(e);
if(this.dragStart!=null&&!this.dragStart.equals(pos)){
var _1c9=this.dragMarkerStart.x+(pos.x-this.dragStart.x);
var _1ca=this.dragMarkerStart.y+(pos.y-this.dragStart.y);
var G=this.hmap.globals;
var _1cc=new HPoint(pos.x-G.mapPosition.x,pos.y-G.mapPosition.y);
if(_1cc.y<G.paddingTop+HMarker.AUTO_SCROLL_ZONE){
this.hmap.pan(0,HMarker.AUTO_SCROLL_SPEED);
}else{
if(_1cc.y>G.mapSize.height-G.paddingBottom-HMarker.AUTO_SCROLL_ZONE){
this.hmap.pan(0,-HMarker.AUTO_SCROLL_SPEED);
}
}
if(_1cc.x<G.paddingLeft+HMarker.AUTO_SCROLL_ZONE){
this.hmap.pan(HMarker.AUTO_SCROLL_SPEED,0);
}else{
if(_1cc.x>G.mapSize.width-G.paddingRight-HMarker.AUTO_SCROLL_ZONE){
this.hmap.pan(-HMarker.AUTO_SCROLL_SPEED,0);
}
}
var _1cd=this.hmap.fromContainerPixelToRT90(new HPoint(_1c9+this.icon.anchor.x,_1ca+this.icon.anchor.y));
this.setRT90Point(_1cd,true);
if(!this.isDragging){
this.isDragging=true;
HEvent.trigger(this,HMarker.EVENT_DRAG_START,_1cd);
}
HEvent.trigger(this,HMarker.EVENT_DRAG_MOVE,_1cd);
this.element.style.left=_1c9+"px";
this.element.style.top=_1ca+"px";
if(this.isInfoBoxOpen()){
this.infoBox.update();
}
return HEvent.stopEvent(e);
}
}
return true;
};
function HInfoBox(_1ce,size,_1d0,_1d1,icon,_1d3,_1d4){
var _1d5=arguments[4]||null;
var _1d6=arguments[5]||null;
var _1d7=arguments[6]||false;
if(_1ce.x&&_1ce.y){
this.setPoint(_1ce);
}else{
this.attachToMarker(_1ce);
}
this.anchorType=_1d0;
this.size=size;
this.zIndex=HOverlay.Z_INDEX_OFFSET_INFO_BOX;
this.showCloseLink=_1d7;
this.sizeApplied=false;
var _1d8=document.createElement("div");
_1d8.innerHTML=_1d1;
if(_1d5&&_1d6){
this.headerDiv=document.createElement("Div");
HMapHelpers.applyStyle([this.headerDiv],{display:"block",position:"relative",width:100+"%",minHeight:icon.size.height+"px",marginBottom:"10px"});
this.iconDiv=HMapHelpers.createIconElement(_1d5);
HMapHelpers.applyStyle([this.iconDiv],{position:"absolute",top:0+"px",left:0+"px"});
this.labelDiv=document.createElement("Div");
HMapHelpers.applyStyle([this.labelDiv],{position:"relative",width:size.width-icon.size.width-15+"px",left:icon.size.width+10+"px"});
var _1d9=document.createElement("span");
HMapHelpers.applyStyle([_1d9],{fontWeight:"bold"});
_1d9.innerHTML=_1d3;
this.labelDiv.appendChild(_1d9);
this.headerDiv.appendChild(this.iconDiv);
this.headerDiv.appendChild(this.labelDiv);
var _1da=document.createElement("Div");
HMapHelpers.applyStyle([_1da],{position:"absolute"});
_1da.appendChild(this.headerDiv);
_1da.appendChild(_1d8);
this.contentElement=_1da;
}else{
this.contentElement=_1d8;
}
};
HInfoBox.prototype=new HOverlay();
HInfoBox.CFG_POSITION_OFFSET_TOP=0;
HInfoBox.CFG_POSITION_OFFSET_BOTTOM=0;
HInfoBox.CFG_POSITION_OFFSET_LEFT=0;
HInfoBox.ANCHOR_NONE=0;
HInfoBox.ANCHOR_TOPLEFT=1;
HInfoBox.ANCHOR_TOPRIGHT=2;
HInfoBox.ANCHOR_BOTTOMLEFT=3;
HInfoBox.ANCHOR_BOTTOMRIGHT=4;
HInfoBox.POINTER_WIDTH=27;
HInfoBox.POINTER_HEIGHT=14;
HInfoBox.POINTER_INDENT=15;
HInfoBox.FLIP_OFFSET_HORZ=HInfoBox.POINTER_INDENT+parseInt(HInfoBox.POINTER_WIDTH/2);
HInfoBox.FLIP_OFFSET_VERT=HInfoBox.POINTER_HEIGHT+50;
HInfoBox.POINTER_IMG_TOP="http://www.hitta.se/images/hmap/infobox_pointer_top.gif";
HInfoBox.POINTER_IMG_BOTTOM="http://www.hitta.se/images/hmap/infobox_pointer_bottom.gif";
HInfoBox.prototype.setStyle=function(){
HMapHelpers.applyStyle([this.contentElement],{border:"1px solid #000",backgroundColor:"#fff",margin:"0px",position:"absolute",fontFamily:"verdana",fontSize:"11px",padding:"5px",zIndex:(this.zIndex+2),MozBorderRadius:"7px",WebkitBorderRadius:"7px",MozBoxShadow:"3px 3px 5px #333",WebkitBoxShadow:"3px 3px 5px #333"});
};
HInfoBox.prototype.constructInfoBox=function(){
var _1db=this.contentElement;
this.setStyle();
var _1dc=document.createElement("div");
var _1dd=document.createElement("div");
var _1de=document.createElement("div");
var _1df=document.createElement("div");
HMapHelpers.applyStyle([_1dc,_1dd,_1de,_1df,],{margin:"0px",padding:"0px",overflow:"hidden",zIndex:this.zIndex,position:"absolute",backgroundRepeat:"no-repeat"});
HMapHelpers.applyStyle([_1dc],{bottom:-HInfoBox.POINTER_HEIGHT+"px",right:HInfoBox.POINTER_INDENT+"px",width:HInfoBox.POINTER_WIDTH+"px",height:HInfoBox.POINTER_HEIGHT+"px",backgroundImage:"url('"+HInfoBox.POINTER_IMG_BOTTOM+"')"});
HMapHelpers.applyStyle([_1df],{bottom:-HInfoBox.POINTER_HEIGHT+"px",left:HInfoBox.POINTER_INDENT+"px",width:HInfoBox.POINTER_WIDTH+"px",height:HInfoBox.POINTER_HEIGHT+"px",backgroundImage:"url('"+HInfoBox.POINTER_IMG_BOTTOM+"')"});
HMapHelpers.applyStyle([_1dd],{top:-HInfoBox.POINTER_HEIGHT+"px",left:HInfoBox.POINTER_INDENT+"px",width:HInfoBox.POINTER_WIDTH+"px",height:HInfoBox.POINTER_HEIGHT+"px",backgroundImage:"url('"+HInfoBox.POINTER_IMG_TOP+"')"});
HMapHelpers.applyStyle([_1de],{top:-HInfoBox.POINTER_HEIGHT+"px",right:HInfoBox.POINTER_INDENT+"px",width:HInfoBox.POINTER_WIDTH+"px",height:HInfoBox.POINTER_HEIGHT+"px",backgroundImage:"url('"+HInfoBox.POINTER_IMG_TOP+"')"});
this.pointerBottomRight=_1dc;
this.pointerTopLeft=_1dd;
this.pointerTopRight=_1de;
this.pointerBottomLeft=_1df;
this.element=_1db;
if(this.showCloseLink){
var _1e0=this.createCloseLink();
this.element.appendChild(_1e0);
}
this.pointer=null;
this.setAnchorType(this.anchorType);
};
HInfoBox.prototype.createCloseLink=function(){
var me=this;
var _1e2=document.createElement("a");
_1e2.innerHTML="St&auml;ng";
HMapHelpers.applyStyle([_1e2],{display:"block",color:"#999",fontSize:"10px",cursor:"pointer",textDecoration:"underline",cssFloat:"right",styleFloat:"right"});
if(this.listeners==null){
this.listeners=[];
}
this.listeners.push(HEvent.addDomListener(_1e2,"mouseover",function(_1e3){
HMapHelpers.applyStyle([_1e2],{color:"#c2850f"});
}));
this.listeners.push(HEvent.addDomListener(_1e2,"mouseout",function(_1e4){
HMapHelpers.applyStyle([_1e2],{color:"#999"});
}));
this.listeners.push(HEvent.addDomListener(_1e2,"click",function(_1e5){
HEvent.stopEvent(_1e5);
if(me.marker){
me.marker.closeInfoBox();
}else{
me.remove();
}
}));
return _1e2;
};
HInfoBox.prototype.init=function(hmap){
var me=this;
me.hmap=hmap;
var elem=this.getElement();
if(elem==null){
this.constructInfoBox();
elem=this.getElement();
}
HMapHelpers.applyStyle([elem],{top:"-1000px",left:"-1000px"});
this.container=this.hmap.getPaneOverlay();
this.container.appendChild(elem);
if(!this.sizeApplied){
if(this.size==null){
this.size=new HSize(elem.offsetWidth,elem.offsetHeight);
}else{
this.setSize(this.size);
}
}
this.sizeApplied=true;
if(me.iconDiv&&me.labelDiv){
var _1e9=(me.iconDiv.offsetHeight-me.labelDiv.offsetHeight)/2;
if(_1e9>0){
HMapHelpers.applyStyle([me.labelDiv],{top:_1e9+"px"});
}
}
this.update();
this.mapMove();
if(this.listeners==null){
this.listeners=[];
}
this.listeners.push(HEvent.addListener(this.hmap,HMap.EVENT_INTERNAL_MAP_MOVE,function(){
me.mapMove();
}));
this.listeners.push(HEvent.addDomListener(this.element,"mousemove",HEvent.stopEvent));
this.listeners.push(HEvent.addDomListener(this.element,"mouseover",function(e){
me.mouseOver();
}));
this.listeners.push(HEvent.addDomListener(this.element,"mouseout",function(e){
me.mouseOut();
}));
HEvent.trigger(me,HMap.EVENT_INFO_BOX_OPEN,this);
};
HInfoBox.prototype.setSize=function(size){
var attr={};
if(size.width!=null){
attr.width=size.width+"px";
}
if(size.height!=null){
attr.height=size.height+"px";
}
HMapHelpers.applyStyle([this.getElement()],attr);
this.size=new HSize(this.getElement().offsetWidth,this.getElement().offsetHeight);
};
HInfoBox.prototype.setAnchorType=function(_1ee){
this.anchorType=_1ee;
if(this.pointer!=null){
this.element.removeChild(this.pointer);
}
switch(_1ee){
case HInfoBox.ANCHOR_TOPLEFT:
this.pointer=this.pointerTopLeft;
break;
case HInfoBox.ANCHOR_TOPRIGHT:
this.pointer=this.pointerTopRight;
break;
case HInfoBox.ANCHOR_BOTTOMLEFT:
this.pointer=this.pointerBottomLeft;
break;
case HInfoBox.ANCHOR_BOTTOMRIGHT:
this.pointer=this.pointerBottomRight;
break;
}
if(this.pointer!=null){
this.element.appendChild(this.pointer);
}
};
HInfoBox.prototype.remove=function(){
HOverlay.prototype.remove.call(this);
HEvent.removeListeners(this.listeners);
HEvent.trigger(this,HMap.EVENT_INFO_BOX_CLOSE,this);
};
HInfoBox.prototype.setPoint=function(_1ef){
this.point=new HPoint(_1ef.x,_1ef.y);
};
HInfoBox.prototype.attachToMarker=function(_1f0){
this.marker=_1f0;
};
HInfoBox.prototype.getContentContainer=function(){
return this.contentElement;
};
HInfoBox.prototype.hide=function(){
this.element.style.display="none";
};
HInfoBox.prototype.show=function(){
this.element.style.display="block";
};
HInfoBox.prototype.isHidden=function(){
return (this.element.style.display=="none");
};
HInfoBox.prototype.update=function(){
var _1f1,_1f2;
if(typeof (this.marker)!="undefined"){
this.point=this.marker.point.clone();
var icon=this.marker.getIcon();
if(icon.infoBoxAnchorTop){
_1f1=icon.infoBoxAnchorTop.clone();
}
if(icon.infoBoxAnchorBottom){
_1f2=icon.infoBoxAnchorBottom.clone();
}
}else{
_1f1=new HPoint(0,0);
_1f2=new HPoint(0,0);
}
var isIE=true;
switch(this.anchorType){
case HInfoBox.ANCHOR_TOPLEFT:
this.point.x+=_1f2.x-(HInfoBox.POINTER_WIDTH/2+HInfoBox.POINTER_INDENT);
this.point.y+=HInfoBox.POINTER_HEIGHT+_1f2.y;
break;
case HInfoBox.ANCHOR_TOPRIGHT:
if(!isIE){
this.point.x-=10;
}
this.point.x+=-(this.size.width-HInfoBox.POINTER_WIDTH/2-HInfoBox.POINTER_INDENT)+_1f2.x;
this.point.y+=HInfoBox.POINTER_HEIGHT+_1f2.y;
break;
case HInfoBox.ANCHOR_BOTTOMLEFT:
if(!isIE){
this.point.y-=8;
}
this.point.x+=_1f1.x-(HInfoBox.POINTER_WIDTH/2+HInfoBox.POINTER_INDENT);
this.point.y+=-(this.size.height+HInfoBox.POINTER_HEIGHT)+_1f1.y;
break;
case HInfoBox.ANCHOR_BOTTOMRIGHT:
if(!isIE){
this.point.y-=8;
this.point.x-=10;
}
this.point.x+=-(this.size.width-HInfoBox.POINTER_WIDTH/2-HInfoBox.POINTER_INDENT)+_1f1.x;
this.point.y+=-(this.size.height+HInfoBox.POINTER_HEIGHT)+_1f1.y;
break;
}
this.element.style.left=this.point.x+"px";
this.element.style.top=this.point.y+"px";
};
HInfoBox.prototype.pan=function(dx,dy){
this.point.x+=dx;
this.point.y+=dy;
this.element.style.left=this.point.x+"px";
this.element.style.top=this.point.y+"px";
};
HInfoBox.prototype.mouseOver=function(){
this.mouseIsOver=true;
};
HInfoBox.prototype.mouseOut=function(){
this.mouseIsOver=false;
};
HInfoBox.prototype.mapMove=function(){
var _1f7=this.checkAnchorType();
if(_1f7!=this.anchorType){
this.setAnchorType(_1f7);
this.update();
}
};
HInfoBox.prototype.checkAnchorType=function(){
var _1f8=0;
if(this.marker){
var icon=this.marker.getIcon();
if(icon.infoBoxAnchorBottom&&icon.infoBoxAnchorTop){
_1f8=Math.abs(icon.infoBoxAnchorBottom.y-icon.infoBoxAnchorTop.y);
}
}
var G=this.hmap.globals;
var _1fb=this.anchorType;
if(this.point.y<=G.paddingTop&&(this.anchorType==HInfoBox.ANCHOR_BOTTOMLEFT||this.anchorType==HInfoBox.ANCHOR_BOTTOMRIGHT)){
_1fb=_1fb-2;
}else{
if(this.point.y>(this.size.height+G.paddingTop+_1f8+HInfoBox.FLIP_OFFSET_VERT)&&(this.anchorType==HInfoBox.ANCHOR_TOPLEFT||this.anchorType==HInfoBox.ANCHOR_TOPRIGHT)){
_1fb=_1fb+2;
}
}
var _1fc=this.hmap.getSize().width;
if(this.point.x<=(_1fc-G.paddingRight-2*this.size.width)&&(this.anchorType==HInfoBox.ANCHOR_TOPRIGHT||this.anchorType==HInfoBox.ANCHOR_BOTTOMRIGHT)){
_1fb=_1fb-1;
}else{
if(this.point.x>(_1fc-G.paddingRight-this.size.width-HInfoBox.FLIP_OFFSET_HORZ)&&(this.anchorType==HInfoBox.ANCHOR_TOPLEFT||this.anchorType==HInfoBox.ANCHOR_BOTTOMLEFT)){
_1fb=_1fb+1;
}
}
return _1fb;
};
function HPolyLayer(hmap){
this.hmap=hmap;
this.globals={isInitialized:false,mainCanvas:null,mainCtx:null,volatileCanvas:null,volatileCtx:null,width:0,height:0,polyContainer:null};
this.polys=[];
var G=this.globals;
G.polyContainer=hmap.globals.polyContainer;
};
HPolyLayer.Z_INDEX=HOverlay.Z_INDEX_OFFSET-1;
HPolyLayer.CLIPPING=false;
HPolyLayer.prototype.initialize=function(){
var G=this.globals;
HMapHelpers.clearElement(G.polyContainer);
if(!HMapHelpers.isCanvas()){
alert("ExCanvas not loaded!");
}
this.initCanvas(G.polyContainer,this.hmap.getSize());
G.isInitialized=true;
};
HPolyLayer.prototype.isInitialized=function(){
return this.globals.isInitialized;
};
HPolyLayer.prototype.initCanvas=function(_200,size){
var G=this.globals;
G.size=size;
HMapHelpers.applyStyle([_200],{zIndex:HPolyLayer.Z_INDEX});
G.mainCanvas=this.createCanvas(_200,G.size.width,G.size.height);
G.mainCanvas.id="mainCanvas";
G.mainCtx=G.mainCanvas.getContext("2d");
G.volatileCanvas=this.createCanvas(_200,G.size.width,G.size.height);
G.volatileCanvas.id="volatileCanvas";
G.volatileCtx=G.volatileCanvas.getContext("2d");
this.setStyle(G.mainCtx,{strokeColor:"255, 5, 138",strokeOpacity:0.8,fillColor:"255, 25, 13",fillOpacity:0.6,weight:4});
this.setStyle(G.volatileCtx,{strokeColor:"165, 255, 0",strokeOpacity:0.8,fillColor:"25, 255, 13",fillOpacity:0.6,weight:4});
};
HPolyLayer.prototype.createCanvas=function(_203,_204,_205){
var _206=document.createElement("canvas");
_203.appendChild(_206);
if(typeof G_vmlCanvasManager!="undefined"){
_206=G_vmlCanvasManager.initElement(_206);
}
_206.width=_204;
_206.height=_205;
_206.setAttribute("width",_204);
_206.setAttribute("height",_205);
HMapHelpers.applyStyle([_206],{position:"absolute",overflow:"hidden",left:"0px",top:"0px",UserSelect:"none",KhtmlUserSelect:"none",MozUserSelect:"none",zIndex:HPolyLayer.Z_INDEX});
return _206;
};
HPolyLayer.prototype.addPoly=function(poly,_208){
var _209=arguments[1]||false;
poly.init(this.hmap);
this.polys.push(poly);
if(!_209){
this.update(true);
}
};
HPolyLayer.prototype.removePoly=function(poly){
this.polys.remove(poly);
};
HPolyLayer.prototype.update=function(_20b){
if(this.isInitialized()){
var _20c=arguments[1]||false;
var _20d=this.getBounds();
if(!_20c){
this.clearAll();
}
var len=this.polys.length;
for(var i=0;i<len;i++){
this.polys[i].update(_20d);
}
}
};
HPolyLayer.prototype.pan=function(dx,dy){
this.update();
};
HPolyLayer.prototype.getBounds=function(){
return this.hmap.getBounds();
};
HPolyLayer.prototype.getPane=function(){
return this.hmap.globals.polyContainer;
};
HPolyLayer.prototype.getCtxVolatile=function(){
return this.globals.volatileCtx;
};
HPolyLayer.prototype.getCtxMain=function(){
return this.globals.mainCtx;
};
HPolyLayer.prototype.clear=function(ctx){
var G=this.globals;
ctx.beginPath();
ctx.clearRect(0,0,G.size.width,G.size.height);
ctx.closePath();
};
HPolyLayer.prototype.clearAll=function(){
this.clear(this.getCtxVolatile());
this.clear(this.getCtxMain());
};
HPolyLayer.prototype.setStyle=function(ctx,_215){
if(_215==null){
return;
}
if(_215.strokeColor&&_215.strokeOpacity){
ctx.strokeStyle="rgba("+_215.strokeColor+", "+_215.strokeOpacity+")";
}else{
if(_215.strokeColor){
ctx.strokeStyle="rgb("+_215.strokeColor+")";
}
}
if(_215.fillColor&&_215.fillOpacity){
ctx.fillStyle="rgba("+_215.fillColor+", "+_215.fillOpacity+")";
}else{
if(_215.fillColor){
ctx.fillStyle="rgb("+_215.fillColor+")";
}
}
if(_215.weight){
ctx.lineWidth=_215.weight;
}
ctx.lineCap="round";
ctx.lineJoin="round";
};
HPolyLayer.prototype.drawPixelPoly=function(ctx,poly,fill){
if(poly.length==0){
return;
}
if(HPolyLayer.CLIPPING){
var size=this.hmap.getSize();
var _21a=new HPoint(size.width,0);
var _21b=new HPoint(0,size.height);
var _21c=0;
ctx.beginPath();
ctx.moveTo(poly[0].x,poly[0].y);
var _21d=true;
var len=poly.length;
for(var i=1;i<len;i++){
if(this.intersectLineBounds(poly[i-1],poly[i],_21a,_21b)){
if(!_21d){
ctx.moveTo(poly[i-1].x,poly[i-1].y);
}
ctx.lineTo(poly[i].x,poly[i].y);
_21d=true;
}else{
_21c++;
_21d=false;
}
}
}else{
ctx.beginPath();
ctx.moveTo(poly[0].x,poly[0].y);
var len=poly.length;
for(var i=1;i<len;i++){
ctx.lineTo(poly[i].x,poly[i].y);
}
}
fill?ctx.fill():ctx.stroke();
};
HPolyLayer.prototype.drawPolyline=function(ctx,line,_222){
if(line.getVertexCount()==0){
return;
}
var _223=arguments[2]||null;
var poly=[];
var len=line.getVertexCount();
for(var i=0;i<len;i++){
poly.push(this.hmap.fromRT90toContainerPixel(line.getVertex(i)));
}
if(_223===null){
_223=line.isClosed();
}
ctx.save();
this.setStyle(ctx,line.getStyle());
this.drawPixelPoly(ctx,poly,_223);
ctx.restore();
};
HPolyLayer.prototype.drawLine=function(ctx,_228,_229){
var _22a=this.hmap.fromRT90toContainerPixel(_228);
var _22b=this.hmap.fromRT90toContainerPixel(_229);
ctx.beginPath();
ctx.moveTo(_22a.x,_22a.y);
ctx.lineTo(_22b.x,_22b.y);
ctx.stroke();
};
HPolyLayer.prototype.drawCircle=function(ctx,_22d,_22e,_22f){
var _230=this.hmap.fromRT90toContainerPixel(_22d);
ctx.beginPath();
ctx.arc(_230.x,_230.y,_22e,0,Math.PI*2,true);
if(_22f){
ctx.fill();
}else{
ctx.stroke();
}
};
HPolyLayer.prototype.drawBounds=function(ctx,_232,_233){
var _234=this.hmap.fromRT90toContainerPixel(_232.sw);
var _235=this.hmap.fromRT90toContainerPixel(_232.ne);
ctx.beginPath();
ctx.moveTo(_234.x,_234.y);
ctx.lineTo(_234.x,_235.y);
ctx.lineTo(_235.x,_235.y);
ctx.lineTo(_235.x,_234.y);
ctx.lineTo(_234.x,_234.y);
if(_233){
ctx.fill();
}else{
ctx.stroke();
}
};
HPolyLayer.prototype.intersectLineLine=function(_236,_237,_238,_239){
var _23a=(_239.y-_238.y)*(_237.x-_236.x)-(_239.x-_238.x)*(_237.y-_236.y);
var num1=(_239.x-_238.x)*(_236.y-_238.y)-(_239.y-_238.y)*(_236.x-_238.x);
var num2=(_237.x-_236.x)*(_236.y-_238.y)-(_237.y-_236.y)*(_236.x-_238.x);
if(_23a==0){
if(num1==0&&num2==0){
if(!(Math.min(_238.x,_239.x)>Math.max(_236.x,_237.x)||Math.max(_238.x,_239.x)<Math.min(_236.x,_237.x)||Math.min(_238.y,_239.y)>Math.max(_236.y,_237.y)||Math.max(_238.y,_239.y)<Math.min(_236.y,_237.y))){
return true;
}
}
return false;
}
var x=num1/_23a;
var y=num2/_23a;
return (!((x<0||x>1)||(y<0||y>1)));
};
HPolyLayer.prototype.intersectLineLineRT90=function(_23f,_240,_241,_242){
return this.intersectLineLine(this.hmap.fromRT90toContainerPixel(_23f),this.hmap.fromRT90toContainerPixel(_240),this.hmap.fromRT90toContainerPixel(_241),this.hmap.fromRT90toContainerPixel(_242));
};
HPolyLayer.prototype.intersectLineBounds=function(_243,_244,_245,_246){
if(Math.min(_243.x,_244.x)>=Math.min(_246.x,_245.x)&&Math.max(_243.x,_244.x)<=Math.max(_246.x,_245.x)&&Math.min(_243.y,_244.y)>=Math.min(_245.y,_246.y)&&Math.max(_243.y,_244.y)<=Math.max(_245.y,_246.y)){
return true;
}
return (this.intersectLineLine(_243,_244,new HPoint(_246.x,_245.y),new HPoint(_246.x,_246.y))||this.intersectLineLine(_243,_244,new HPoint(_246.x,_246.y),new HPoint(_245.x,_246.y))||this.intersectLineLine(_243,_244,new HPoint(_245.x,_246.y),new HPoint(_245.x,_245.y))||this.intersectLineLine(_243,_244,new HPoint(_245.x,_245.y),new HPoint(_246.x,_245.y)));
};
HPolyLayer.prototype.intersectLineBoundsRT90=function(_247,_248,_249){
return this.intersectLineBounds(this.hmap.fromRT90toContainerPixel(_247),this.hmap.fromRT90toContainerPixel(_248),this.hmap.fromRT90toContainerPixel(_249.ne),this.hmap.fromRT90toContainerPixel(_249.sw));
};
function HPolyStyle(){
this.fillColor="192, 192, 16";
this.fillOpacity=0.8;
this.strokeColor="192, 16, 192";
this.strokeOpacity=0.8;
this.weight=2;
};
function HPoly(){
this.style=null;
};
HPoly.prototype.init=function(hmap){
this.hmap=hmap;
this.polyLayer=hmap.globals.polyLayer;
};
HPoly.prototype.remove=function(){
var G=this.polyLayer.globals;
this.polyLayer.clear(G.mainCtx);
};
HPoly.prototype.update=function(_24c){
};
HPoly.prototype.setStyle=function(_24d){
this.style=_24d;
};
HPoly.prototype.getStyle=function(){
return this.style;
};
function HPolyline(){
this.pathClosed=false;
this.vertexList=[];
};
HPolyline.prototype=new HPoly();
HPolyline.prototype.update=function(){
var G=this.polyLayer.globals;
this.polyLayer.drawPolyline(G.mainCtx,this);
};
HPolyline.prototype.insertVertex=function(_24f,_250){
this.vertexList.splice(_24f,0,_250);
};
HPolyline.prototype.addVertex=function(_251){
this.vertexList.push(_251);
};
HPolyline.prototype.deleteVertex=function(_252){
this.vertexList.splice(_252,1);
};
HPolyline.prototype.getVertex=function(_253){
return this.vertexList[_253];
};
HPolyline.prototype.getVertexCount=function(){
return this.vertexList.length;
};
HPolyline.prototype.reset=function(){
this.vertexList=[];
};
HPolyline.prototype.getBounds=function(){
if(this.vertexList.length==0){
return null;
}
var _254=new HBoundsRT90(this.vertexList[0],this.vertexList[0]);
var len=this.vertexList.length;
for(var i=1;i<len;i++){
_254.extend(this.vertexList[i]);
}
return _254;
};
HPolyline.prototype.getLength=function(){
var dist=0;
var len=this.vertexList.length;
for(var i=1;i<len;i++){
dist+=this.vertexList[i-1].distanceTo(this.vertexList[i]);
}
return dist;
};
HPolyline.prototype.getArea=function(){
if(this.getVertexCount()<3){
return 0;
}
var len=this.vertexList.length;
var area=0;
var prev=this.vertexList[len-1];
var curr=null;
for(var i=0;i<len;i++){
curr=this.vertexList[i];
area+=(prev.east*curr.north)-(prev.north*curr.east);
prev=curr;
}
return Math.abs(area/2);
};
HPolyline.prototype.setClosed=function(_25f){
this.pathClosed=_25f;
};
HPolyline.prototype.isClosed=function(){
return this.pathClosed;
};
function HPolylineExtended(_260){
this.pixelThreshold=arguments[0]||HPolylineExtended.THRESHOLD_PIXELS;
this.reset();
};
HPolylineExtended.prototype=new HPolyline();
HPolylineExtended.THRESHOLD_PIXELS=7;
HPolylineExtended.prototype.update=function(){
var G=this.polyLayer.globals;
var _262=this.getPolyline(this.hmap.getResolution());
_262.setStyle(this.getStyle());
this.polyLayer.drawPolyline(G.mainCtx,_262);
};
HPolylineExtended.prototype.getPolyline=function(_263){
if(!this.polylineCache[_263]){
this.polylineCache[_263]=this.createOptimized(_263);
}
return this.polylineCache[_263];
};
HPolylineExtended.prototype.reset=function(){
this.vertexList=[];
this.polylineCache={};
};
HPolylineExtended.prototype.createOptimized=function(_264){
var _265=Math.pow(this.pixelThreshold*_264,2);
var line=new HPolyline();
var _267=this.getVertexCount();
if(_267==0){
return line;
}
line.addVertex(this.getVertex(0));
var prev=line.getVertex(0);
var _269=null;
for(var i=1;i<_267-1;i++){
_269=this.getVertex(i);
if(Math.pow(prev.east-_269.east,2)+Math.pow(prev.north-_269.north,2)>_265){
line.addVertex(_269);
prev=_269;
}
}
if(_267>1){
line.addVertex(this.getVertex(_267-1));
}
return line;
};
function HPolyDot(_26b,_26c,_26d){
this.rt90point=_26b;
this.radius=_26c;
this.filled=_26d;
};
HPolyDot.prototype=new HPoly();
HPolyDot.prototype.update=function(_26e){
if(_26e.containsRT90(this.rt90point)){
this.polyLayer.drawCircle(this.polyLayer.getCtxMain(),this.rt90point,this.radius,this.filled);
}
};
if(!Array.prototype.indexOf){
Array.prototype.indexOf=function(elem,_270){
var len=this.length;
var from=Number(arguments[1])||0;
from=(from<0)?Math.ceil(from):Math.floor(from);
if(from<0){
from+=len;
}
for(;from<len;from++){
if(from in this&&this[from]===elem){
return from;
}
}
return -1;
};
}
if(!Array.prototype.remove){
Array.prototype.remove=function(elem){
var _274=this.indexOf(elem);
if(_274!==-1){
this.splice(_274,1);
}
};
}
if(!Array.prototype.insert){
Array.prototype.insert=function(_275,elem){
this.splice(_275,0,elem);
};
}
if(!Math.sinh){
Math.sinh=function(x){
return (Math.exp(x)-Math.exp(-x))/2;
};
}
if(!Math.cosh){
Math.cosh=function(x){
return (Math.exp(x)+Math.exp(-x))/2;
};
}
if(!Math.atanh){
Math.atanh=function(x){
return (1/2)*(Math.log(x+1)-Math.log(1-x));
};
}
if(!Math.toDegrees){
Math.toDegrees=function(rad){
return rad*360/(2*Math.PI);
};
}
if(!Math.toRadians){
Math.toRadians=function(deg){
return (deg*2*Math.PI)/360;
};
}
if(!Math.decimalToHex){
Math.decimalToHex=function(dec){
return dec.toString(16);
};
}
if(!Math.hexToDecimal){
Math.hexToDecimal=function(hex){
return parseInt(hex,16);
};
}
function HMapProvider(){
};
HMapProvider.prototype.initTiles=function(hmap){
this.container=this.hmap.getPaneMap();
};
HMapProvider.prototype.remove=function(){
for(var i=0;i<this.elements.length;i++){
this.container.removeChild(this.elements[i]);
}
};
HMapProvider.prototype.updateTile=function(_280,_281,_282,_283){
};
HMapProvider.prototype.updatePosition=function(_284,_285){
this.elements[_284].style.left=_285.x+"px";
this.elements[_284].style.top=_285.y+"px";
};
HMapProvider.prototype.setMapType=function(_286){
};
HMapProvider.prototype.getMapType=function(){
return 0;
};
HMapProvider.prototype.getMapTypes=function(){
return [0];
};
HMapProvider.prototype.getMinZoomLevel=function(_287){
return 1;
};
HMapProvider.prototype.getMaxZoomLevel=function(_288){
return 1;
};
HMapProvider.prototype.initStatusUpdate=function(){
};
function HStandardMapProvider(hmap){
this.hmap=hmap;
this.mapType=HStandardMapProvider.MAP_TYPE_NORMAL;
HStandardMapProvider.zoomLevel=[];
var _28a=this.getMapTypes().length;
for(var i=0;i<_28a;i++){
HStandardMapProvider.zoomLevel[i]={min:1,max:9};
}
this.overrideMinZoomLevel=0;
this.overrideMaxZoomLevel=10;
this.elements=[];
};
HStandardMapProvider.prototype=new HMapProvider();
HStandardMapProvider.TILE_BASE_URL=".hitta.se/tile/v1/";
HStandardMapProvider.TILE_MAP_NOT_FOUND_URL=".hitta.se/static/data/tiles/empty/blue-map.gif";
HStandardMapProvider.TILE_SAT_NOT_FOUND_URL=".hitta.se/static/data/tiles/empty/blue-sat.jpg";
HStandardMapProvider.TILE_DOMAINS=["map1.static"];
HStandardMapProvider.TILE_DOMAINS_COUNT=HStandardMapProvider.TILE_DOMAINS.length;
HStandardMapProvider.TILE_LOADING_URL="http://www.codetouch.com/hitta/loadingtile.gif";
HStandardMapProvider.TILE_STATUS_UPDATE_BASE_URL="http://map1.static.hitta.se/tile/v1/zoomlevel/";
HStandardMapProvider.MAP_TYPE_NORMAL=0;
HStandardMapProvider.MAP_TYPE_SATELLITE=1;
HStandardMapProvider.STATUS_UPDATE_TIMEOUT=2000;
HStandardMapProvider.prototype.initTiles=function(hmap){
this.hmap=hmap;
var _28d=this.hmap.getPaneMap();
var _28e=this.hmap.getTileCount();
this.elements.length=_28e;
for(var i=0;i<_28e;i++){
var img=document.createElement("img");
HMapHelpers.applyStyle([img],{position:"absolute",top:-HTile.TILE_WIDTH+"px",left:-HTile.TILE_HEIGHT+"px",width:HTile.TILE_WIDTH+"px",height:HTile.TILE_HEIGHT+"px"});
this.elements[i]=img;
_28d.appendChild(img);
}
this.container=_28d;
};
HStandardMapProvider.prototype.updateTile=function(_291,_292,_293,_294){
var url="";
if(_293<0||_294<0){
url="http://static"+((this.mapType==HStandardMapProvider.MAP_TYPE_SATELLITE)?HStandardMapProvider.TILE_SAT_NOT_FOUND_URL:HStandardMapProvider.TILE_MAP_NOT_FOUND_URL);
}else{
url="http://map1.static"+HStandardMapProvider.TILE_BASE_URL+this.mapType+"/"+_292+"/"+_293+"/"+_294;
}
this.elements[_291].src=url;
};
HStandardMapProvider.prototype.setMapType=function(_296){
this.mapType=_296;
};
HStandardMapProvider.prototype.getMapType=function(){
return this.mapType;
};
HStandardMapProvider.prototype.getMapTypes=function(){
return [HStandardMapProvider.MAP_TYPE_NORMAL,HStandardMapProvider.MAP_TYPE_SATELLITE];
};
HStandardMapProvider.prototype.getMinZoomLevel=function(_297){
var type=arguments[0]||this.mapType;
return Math.max(HStandardMapProvider.zoomLevel[type].min,this.overrideMinZoomLevel);
};
HStandardMapProvider.prototype.getMaxZoomLevel=function(_299){
var type=arguments[0]||this.mapType;
return Math.min(HStandardMapProvider.zoomLevel[type].max,this.overrideMaxZoomLevel);
};
HStandardMapProvider.prototype.setMinZoomLevel=function(_29b){
this.overrideMinZoomLevel=_29b;
};
HStandardMapProvider.prototype.setMaxZoomLevel=function(_29c){
this.overrideMaxZoomLevel=_29c;
};
HStandardMapProvider.prototype.updateStatusCallback=function(obj){
HStandardMapProvider.zoomLevel[0].max=obj.v0;
HStandardMapProvider.zoomLevel[1].max=obj.v1;
HEvent.trigger(HStandardMapProvider,HMap.EVENT_INTERNAL_MAP_STATUS_UPDATE,HStandardMapProvider.zoomLevel);
HEvent.trigger(HStandardMapProvider,HMap.EVENT_MAP_STATUS_UPDATE,HStandardMapProvider.zoomLevel);
};
HStandardMapProvider.prototype.initStatusUpdate=function(){
HStandardMapProvider.UPDATE=this.updateStatusCallback;
var _29e=this.hmap.getCenter();
if(!(isNaN(parseInt(_29e.north))||isNaN(parseInt(_29e.east)))){
var url=HStandardMapProvider.TILE_STATUS_UPDATE_BASE_URL+parseInt(_29e.north)+"/"+parseInt(_29e.east)+"?callback=HStandardMapProvider.UPDATE";
HMapHelpers.initJSONP(url,HStandardMapProvider.STATUS_UPDATE_TIMEOUT);
}
};
var HPointLatLng=function(lat,lng){
this.lat=parseFloat(lat);
this.lng=parseFloat(lng);
};
HPointLatLng.prototype.equals=function(_2a2){
return (this.lat==_2a2.lat&&this.lng==_2a2.lng);
};
HPointLatLng.prototype.getLat=function(){
return this.lat;
};
HPointLatLng.prototype.getLng=function(){
return this.lng;
};
HPointLatLng.prototype.toString=function(){
var lat=HPointLatLng.fromDecimalToDegree(this.lat);
var lng=HPointLatLng.fromDecimalToDegree(this.lng);
return "Lat N "+HPointLatLng.fromDegreeToString(lat.deg,lat.min,lat.sec)+"\n"+"Lon E "+HPointLatLng.fromDegreeToString(lng.deg,lng.min,lng.sec);
};
HPointLatLng.fromDegreeToString=function(deg,min,sec){
return deg+"&#176; "+min+"&#8242; "+sec+"&#8243;";
};
HPointLatLng.fromDecimalToDegree=function(dec){
var deg=parseInt(dec);
var min=parseInt((dec-deg)*60);
var sec=parseInt(((dec-deg)*60-min)*60);
return {deg:deg,min:min,sec:sec};
};
HPointLatLng.fromDegreeToDecimal=function(deg,min,sec){
return parseFloat(deg+(min/60)+(sec/3600));
};
var HTransformEllipsoid=function(a,f){
a=this.a=parseFloat(a);
f=this.f=parseFloat(f);
var e2=this.e2=f*(2-f);
var e4=Math.pow(e2,2);
var e6=Math.pow(e2,3);
var e8=Math.pow(e2,4);
var n=this.n=f/(2-f);
var n2=Math.pow(n,2);
var n3=Math.pow(n,3);
var n4=Math.pow(n,4);
this.ah=(a/(1+n))*(1+(1/4)*n2+(1/64)*n4);
var d=this.d=[];
d[0]=(1/2)*n-(2/3)*n2+(37/96)*n3-(1/360)*n4;
d[1]=(1/48)*n2+(1/15)*n3-(437/1440)*n4;
d[2]=(17/480)*n3-(37/840)*n4;
d[3]=(4397/161280)*n4;
var abc=this.abc=[];
abc[0]=e2+e4+e6+e8;
abc[1]=-(1/6)*(7*e4+17*e6+30*e8);
abc[2]=(1/120)*(224*e6+889*e8);
abc[3]=-(1/1260)*(4279*e8);
var b=this.b=[];
b[0]=(1/2)*n-(2/3)*n2+(5/16)*n3+(41/180)*n4;
b[1]=(13/48)*n2-(3/5)*n3+(557/1440)*n4;
b[2]=(61/240)*n3-(103/140)*n4;
b[3]=(49561/161280)*n4;
var xyz=this.xyz=[];
xyz[0]=e2;
xyz[1]=(1/6)*(5*e4-e6);
xyz[2]=(1/120)*(104*e6-45*e8);
xyz[3]=(1/1260)*(1237*e8);
};
var HTransform=function(){
this.e=new HTransformEllipsoid(this.SEMI_MAJOR_AXIS,this.FLATTENING);
};
HTransform.prototype={SEMI_MAJOR_AXIS:6378137,FLATTENING:1/298.257222101,FALSE_NORTHING:-667.711,FALSE_EASTING:1500064.274,SCALE_REDUCTION:1.00000561024,CENTRAL_MERIDIAN:Math.toRadians(HPointLatLng.fromDegreeToDecimal(15,48,22.624306))};
HTransform.prototype.fromRT90ToLatLng=function(_2bd){
var xi=(_2bd.north-this.FALSE_NORTHING)/(this.SCALE_REDUCTION*this.e.ah);
var eta=(_2bd.east-this.FALSE_EASTING)/(this.SCALE_REDUCTION*this.e.ah);
var xip=xi;
var etap=eta;
var d=this.e.d;
for(var i=0;i<d.length;i++){
xip-=d[i]*Math.sin((2*i+2)*xi)*Math.cosh((2*i+2)*eta);
etap-=d[i]*Math.cos((2*i+2)*xi)*Math.sinh((2*i+2)*eta);
}
var cLat=Math.asin(Math.sin(xip)/Math.cosh(etap));
var dLng=Math.atan(Math.sinh(etap)/Math.cos(xip));
var _2c6=Math.sin(cLat);
var _2c7=Math.cos(cLat);
var abc=this.e.abc;
var lat=Math.toDegrees(cLat+_2c6*_2c7*(abc[0]+abc[1]*Math.pow(_2c6,2)+abc[2]*Math.pow(_2c6,4)+abc[3]*Math.pow(_2c6,6)));
var lng=Math.toDegrees(this.CENTRAL_MERIDIAN+dLng);
return new HPointLatLng(lat,lng);
};
HTransform.prototype.fromLatLngToRT90=function(_2cb){
var lat=Math.toRadians(_2cb.getLat());
var lng=Math.toRadians(_2cb.getLng());
var _2ce=Math.sin(lat);
var _2cf=Math.cos(lat);
var xyz=this.e.xyz;
var cLat=lat-_2ce*_2cf*(xyz[0]+xyz[1]*Math.pow(_2ce,2)+xyz[2]*Math.pow(_2ce,4)+xyz[3]*Math.pow(_2ce,6));
var dLng=lng-this.CENTRAL_MERIDIAN;
var xip=Math.atan(Math.tan(cLat)/Math.cos(dLng));
var etap=Math.atanh(Math.cos(cLat)*Math.sin(dLng));
var b=this.e.b;
var x=this.SCALE_REDUCTION*this.e.ah*(xip+b[0]*Math.sin(2*xip)*Math.cosh(2*etap)+b[1]*Math.sin(4*xip)*Math.cosh(4*etap)+b[2]*Math.sin(6*xip)*Math.cosh(6*etap)+b[3]*Math.sin(8*xip)*Math.cosh(8*etap))+this.FALSE_NORTHING;
var y=this.SCALE_REDUCTION*this.e.ah*(etap+b[0]*Math.cos(2*xip)*Math.sinh(2*etap)+b[1]*Math.cos(4*xip)*Math.sinh(4*etap)+b[2]*Math.cos(6*xip)*Math.sinh(6*etap)+b[3]*Math.cos(8*xip)*Math.sinh(8*etap))+this.FALSE_EASTING;
return new HPointRT90(Math.round(x),Math.round(y));
};
function HGeoPoint(_2d8,east){
this.north=_2d8;
this.east=east;
};
var HGeoTransform={};
HGeoTransform.callbackCounter=new Date().getTime();
HGeoTransform.transformSRID=function(_2da,_2db,_2dc,_2dd){
HGeoTransform.callbackCounter++;
var _2de="sridJSONP"+HGeoTransform.callbackCounter;
HGeoTransform[_2de]=function(data){
var _2e0=new HGeoPoint(data.x,data.y);
_2dd(_2e0,_2da,_2db,_2dc);
HGeoTransform[_2de]=null;
};
var url="http://192.168.10.115:8080/transform/resources/transform/"+_2db+"/"+_2da.north+"/"+_2da.east+"?targetSRID="+_2dc+"&callback="+"HGeoTransform."+_2de;
HMapHelpers.initJSONP(url);
};
function HPoint(x,y){
this.x=x;
this.y=y;
};
HPoint.prototype.equals=function(_2e4){
return (this.x==_2e4.x&&this.y==_2e4.y);
};
HPoint.prototype.clone=function(){
return new HPoint(this.x,this.y);
};
function HSize(_2e5,_2e6){
this.width=_2e5;
this.height=_2e6;
};
HSize.prototype.equals=function(size){
return (this.width==size.width&&this.height==this.height);
};
function HPointRT90(_2e8,east){
_2e8=parseFloat(_2e8);
east=parseFloat(east);
if(east>4000000&&_2e8<=4000000){
var temp=_2e8;
_2e8=east;
east=temp;
}
this.north=_2e8;
this.east=east;
};
HPointRT90.prototype.equals=function(_2eb){
return (this.north==_2eb.north&&this.east==_2eb.east);
};
HPointRT90.prototype.distanceTo=function(_2ec){
return Math.sqrt(Math.pow(this.east-_2ec.east,2)+Math.pow(this.north-_2ec.north,2));
};
HPointRT90.prototype.clone=function(){
return new HPointRT90(this.north,this.east);
};
HPointRT90.prototype.toString=function(){
return this.north+", "+this.east;
};
function HBoundsRT90(p1,p2){
if(arguments.length==0){
this.sw=null;
this.ne=null;
}else{
if(arguments.length==1){
this.sw=p1.clone();
this.ne=p1.clone();
}else{
var w,e,n,s;
if(p1.east<p2.east){
w=p1.east;
e=p2.east;
}else{
w=p2.east;
e=p1.east;
}
if(p1.north<p2.north){
s=p1.north;
n=p2.north;
}else{
s=p2.north;
n=p1.north;
}
this.sw=new HPointRT90(s,w);
this.ne=new HPointRT90(n,e);
}
}
};
HBoundsRT90.prototype.equals=function(_2f3){
return (this.sw.equals(_2f3.sw)&&this.ne.equals(_2f3.ne));
};
HBoundsRT90.prototype.containsRT90=function(_2f4){
return (_2f4.north>=this.sw.north&&_2f4.north<=this.ne.north)&&(_2f4.east>=this.sw.east&&_2f4.east<=this.ne.east);
};
HBoundsRT90.prototype.extend=function(_2f5){
if(this.ne===null||this.sw===null){
this.sw=_2f5.clone();
this.ne=_2f5.clone();
return;
}
if(_2f5.north>this.ne.north){
this.ne.north=_2f5.north;
}else{
if(_2f5.north<this.sw.north){
this.sw.north=_2f5.north;
}
}
if(_2f5.east>this.ne.east){
this.ne.east=_2f5.east;
}else{
if(_2f5.east<this.sw.east){
this.sw.east=_2f5.east;
}
}
};
HBoundsRT90.prototype.toSpan=function(){
return new HPointRT90(this.ne.north-this.sw.north,this.ne.east-this.sw.east);
};
HBoundsRT90.prototype.scale=function(_2f6){
var span=this.toSpan();
var _2f8=Math.round(((span.east*_2f6)-span.east)/2);
var _2f9=Math.round(((span.north*_2f6)-span.north)/2);
this.sw.north-=_2f9;
this.sw.east-=_2f8;
this.ne.north+=_2f9;
this.ne.east+=_2f8;
};
HBoundsRT90.prototype.getCenter=function(){
return new HPointRT90(Math.round((this.ne.north+this.sw.north)/2),Math.round((this.ne.east+this.sw.east)/2));
};
var HEventListener={source:null,eventType:null,handler:null,isDomEvent:false};
var HEvent={events:{},addListener:function(_2fa,_2fb,_2fc){
if(_2fa==undefined){
throw new Error("HEvent.addListener: source is undefined!");
}
if(_2fb==undefined){
throw new Error("HEvent.addListener: eventType is undefined!");
}
if(_2fc==undefined){
throw new Error("HEvent.addListener: handler is undefined!");
}
if(!_2fa._listeners){
_2fa._listeners={};
}
if(!_2fa._listeners[_2fb]){
_2fa._listeners[_2fb]=[];
}
if(!_2fa._listeners[_2fb][_2fc]){
_2fa._listeners[_2fb].push(_2fc);
}
var _2fd={source:_2fa,eventType:_2fb,handler:_2fc,isDomEvent:false};
return _2fd;
},addDomListener:function(_2fe,_2ff,_300){
if(_2fe.addEventListener){
if(_2ff=="mousewheel"){
_2fe.addEventListener("DOMMouseScroll",_300,false);
}
_2fe.addEventListener(_2ff,_300,false);
}else{
if(_2fe.attachEvent){
_2fe.attachEvent("on"+_2ff,_300);
}
}
var _301={source:_2fe,eventType:_2ff,handler:_300,isDomEvent:true};
return _301;
},removeListener:function(el){
if(el==null){
return;
}
if(!el.isDomEvent){
if(el.source._listeners&&el.source._listeners[el.eventType]){
el.source._listeners[el.eventType].remove(el.handler);
}
}else{
if(el.source.removeEventListener){
if(el.eventType=="mousewheel"){
el.source.removeEventListener("DOMMouseScroll",el.handler,false);
}
el.source.removeEventListener(el.eventType,el.handler,false);
}else{
if(el.source.detachEvent){
el.source.detachEvent("on"+el.eventType,el.handler);
}
}
}
},stopEvent:function(_303){
var e=_303||window.event;
if(e.stopPropagation){
e.stopPropagation();
}
if(e.preventDefault){
e.preventDefault();
}
e.cancelBubble=true;
e.returnValue=false;
return false;
},removeListeners:function(_305){
for(var i=0;i<_305.length;i++){
HEvent.removeListener(_305[i]);
}
},clearListeners:function(_307,_308){
if(_307._listeners&&_307._listeners[_308]){
_307._listeners[_308]=[];
}
},clearSource:function(_309){
if(_309._listeners){
_309._listeners=null;
}
},isListening:function(_30a,_30b){
return (_30a._listeners&&_30a._listeners[_30b]&&_30a._listeners[_30b].length>0);
},trigger:function(_30c,_30d,_30e){
if(_30c==undefined){
throw new Error("HEvent.trigger: source is undefined!");
}
if(_30d==undefined){
throw new Error("HEvent.trigger: eventType is undefined!");
}
if(_30c._listeners&&_30c._listeners[_30d]){
var _30f=_30c._listeners[_30d];
for(var i=_30f.length-1;i>=0;i--){
if(_30f[i]!=undefined){
if(false===(_30f[i]).apply(_30c,Array.prototype.slice.call(arguments,2))){
break;
}
}
}
}
}};


