ravegeo={internal:{},io:{},tools:{internal:{}}};
ravegeo.internal.Environment=(function(){
var _1={};
_1.isIE=(!window.opera&&navigator.userAgent.indexOf("MSIE")!=-1);
_1.isSafari=(navigator.vendor&&navigator.vendor.indexOf("Apple")!=-1);
_1.isFirefox=(navigator.userAgent.indexOf("Firefox")!=-1);
_1.isChrome=(navigator.userAgent.indexOf("Chrome")!=-1);
_1.isLinux=(navigator.userAgent.indexOf("Linux")!=-1);
_1.isWin=(navigator.userAgent.indexOf("Win")!=-1);
_1.isMac=(navigator.userAgent.indexOf("Mac")!=-1);
_1.isJavaEnabled=function(){
if(navigator.userAgent.toLowerCase().match("netscape")){
return true;
}else{
return navigator.javaEnabled();
}
};
_1.isJavaWellSupported=function(){
if(_1.isJavaEnabled()){
if(_1.isMac&&_1.isChrome){
return false;
}
return true;
}
return false;
};
return _1;
})();
ravegeo.io.Ajax=(function(){
var _2={};
var _3=0;
var _4=[];
_2.syncJsonRequest=function(_5){
var _6;
if(window.XMLHttpRequest){
_6=new XMLHttpRequest();
}else{
if(window.ActiveXObject){
_6=new ActiveXObject("Microsoft.XMLHTTP");
}else{
throw new Error("Browser not AJAX enabled.");
}
}
_6.open("GET",_5,false);
_6.send(null);
if(_6.status==200){
return eval("("+_6.responseText+")");
}else{
throw new Error("AJAX request failed: "+_6.status);
}
};
_2.asyncJsonRequest=function(_7,_8,_9){
var _a=_3++;
var _b=document.createElement("script");
_b.src=_7+"&prepend=ravegeo.io.Ajax._jsonReply("+_a+","+"&append=);";
_4[_a]={callback:_8,elem:_b};
document.body.appendChild(_b);
if(typeof (_9)!="undefined"){
setTimeout(function(){
if(_4[_a]!=null){
ravegeo.io.Ajax._jsonReply(_a,{error:{code:"REQUEST_TIMED_OUT",message:"Request timed out: "+_7}});
}
},_9);
}
};
_2._jsonReply=function(_c,_d){
var _e=_4[_c].elem;
document.body.removeChild(_e);
_4[_c].callback(_d);
_4[_c]=null;
};
return _2;
})();
ravegeo.internal.Utilities=(function(){
var _f={};
_f.addEvent=function(obj,_11,fn,_13){
if(obj.addEventListener){
if(_11=="mousewheel"){
obj.addEventListener("DOMMouseScroll",fn,_13);
}
obj.addEventListener(_11,fn,_13);
}else{
if(obj.attachEvent){
obj.attachEvent("on"+_11,fn);
}else{
obj["on"+_11]=fn;
}
}
};
_f.stopEvent=function(e){
if(e&&e.stopPropagation&&e.preventDefault){
e.stopPropagation();
e.preventDefault();
}else{
if(window.event){
window.event.cancelBubble=true;
window.event.returnValue=false;
}
}
};
_f.getTarget=function(e){
var _16;
if(!e){
e=window.event;
}
if(e.target){
_16=e.target;
}else{
if(e.srcElement){
_16=e.srcElement;
}
}
if(_16.nodeType==3||_16.nodeType==4){
_16=_16.parentNode;
}
return _16;
};
_f.leftButton=function(e){
if(!e){
e=window.event;
}
if(typeof (e.which)!="undefined"){
return e.which==0||e.which==1;
}else{
if(typeof (e.button)!="undefined"){
return e.button==0||e.button==1;
}
}
};
_f.setStyle=function(_18,_19){
if(typeof (_18.style.cssText)!="undefined"){
_18.style.cssText=_19;
}else{
_18.setAttribute("style",_19);
}
};
_f.setClassName=function(_1a,_1b){
_1a.className=_1b;
};
ravegeo.internal.Environment.isIE=(!window.opera&&navigator.userAgent.indexOf("MSIE")!=-1);
ravegeo.internal.Environment.isSafari=(navigator.vendor&&navigator.vendor.indexOf("Apple")!=-1);
_f.isImageLoaded=function(_1c){
if(typeof (_1c.complete)=="undefined"){
var _1d=new Image();
_1d.src=_1c.src;
return _1d.complete;
}
return _1c.complete;
};
if(_f.isSafari){
_f.onImageLoaded=function(_1e,_1f){
_1e.onload=function(){
_1f.apply(_1e);
};
};
}else{
_f.onImageLoaded=function(_20,_21){
_20.onload=_21;
};
}
_f.mouseX=function(e){
var _23=0;
if(e.pageX){
_23=e.pageX;
}else{
if(e.clientX){
_23=e.clientX;
if(ravegeo.internal.Environment.isIE){
if(document.documentElement&&document.documentElement.scrollLeft){
_23+=document.documentElement.scrollLeft;
}else{
if(document.body&&document.body.scrollLeft){
_23+=document.body.scrollLeft;
}
}
}
}
}
return _23;
};
_f.mouseY=function(e){
var _25=0;
if(e.pageY){
_25=e.pageY;
}else{
if(e.clientY){
_25=e.clientY;
if(ravegeo.internal.Environment.isIE){
if(document.documentElement&&document.documentElement.scrollTop){
_25+=document.documentElement.scrollTop;
}else{
if(document.body&&document.body.scrollTop){
_25+=document.body.scrollTop;
}
}
}
}
}
return _25;
};
_f.topLeftX=function(obj){
var _27=0;
if(obj.offsetParent){
do{
_27+=obj.offsetLeft;
obj=obj.offsetParent;
}while(obj);
}else{
if(obj.x){
_27+=obj.x;
}
}
return _27;
};
_f.topLeftY=function(obj){
var _29=0;
if(obj.offsetParent){
do{
_29+=obj.offsetTop;
obj=obj.offsetParent;
}while(obj);
}else{
if(obj.y){
_29+=obj.y;
}
}
return _29;
};
_f.getOpacity=function(_2a){
if(_2a.length==9){
return parseInt(_2a.substring(1,3),16)/255;
}
return 1;
};
_f.getColor=function(_2b){
if(_2b.length==9){
return "#"+_2b.substring(3);
}
return _2b;
};
_f.fixStyle=function(_2c){
if(_2c.fillColor){
_2c.fillOpacity=_f.getOpacity(_2c.fillColor);
_2c.fillColor=_f.getColor(_2c.fillColor);
}
if(_2c.strokeColor){
_2c.strokeOpacity=_f.getOpacity(_2c.strokeColor);
_2c.strokeColor=_f.getColor(_2c.strokeColor);
}
return _2c;
};
_f.setOpacity=function(el,_2e){
if(_2e<1&&_2e>=0){
el.style.opacity=""+_2e;
el.style.filter="alpha(opacity="+Math.round(_2e*100)+")";
}
};
_f.removeChildren=function(_2f,_30){
while(_2f.childNodes.length>1){
var _31=_2f.childNodes[0];
if(_31===_30){
_31=_2f.childNodes[1];
}
_2f.removeChild(_31);
}
if(_2f.childNodes.length>0&&!_30){
_2f.removeChild(_2f.childNodes[0]);
}
};
_f.stringIsEmpty=function(s){
if(s){
return s.length==0;
}
return true;
};
_f.ensureString=function(_33,_34){
if(typeof (_33)!="string"){
throw new Error("Parameter \""+_34+"\" must be a string.");
}
};
_f.getFloat=function(_35,_36){
if(typeof (_35)=="undefined"||_35==null){
_35=_36;
}
if(typeof (_35)!="number"){
_35=parseFloat(_35);
}
if(isNaN(_35)){
throw Error("Not a number!");
}
return _35;
};
_f.getInteger=function(_37,_38){
if(typeof (_37)=="undefined"||_37==null){
_37=_38;
}
if(typeof (_37)=="number"){
_37=Math.round(_37);
}else{
_37=parseInt(_37);
}
if(isNaN(_37)){
throw Error("Not a number!");
}
return _37;
};
_f.getFloatArray=function(_39){
for(idx in _39){
_39[idx]=_f.getFloat(_39[idx]);
}
return _39.slice();
};
_f.getFloatValuesObject=function(obj){
var _3b={};
for(idx in obj){
_3b[idx]=_f.getFloat(obj[idx]);
}
return _3b;
};
_f.getFloatPoint=function(_3c){
return {x:_f.getFloat(_3c.x),y:_f.getFloat(_3c.y)};
};
_f.getIntegerPoint=function(_3d){
return {x:_f.getInteger(_3d.x),y:_f.getInteger(_3d.y)};
};
_f.objectToArray=function(_3e){
var _3f=[];
for(idx in _3e){
_3f[_3f.length]=_3e[idx];
}
return _3f;
};
_f.getBoolean=function(_40,_41){
if(typeof (_40)=="undefined"||_40==null){
_40=_41;
}
if(typeof (_40)=="string"){
_40=_40=="true"?true:false;
}
if(typeof (_40)!="boolean"){
throw Error("Boolean value expected!");
}
return _40;
};
return _f;
})();
ravegeo.internal.MapCommons=(function(){
var _42={};
_42._fixParams=function(_43){
if(typeof (_43.mapContainer)=="string"){
_43.mapContainer=document.getElementById(_43.mapContainer);
}
if(!_43.url&&document&&document.getElementsByTagName){
var _44=document.getElementsByTagName("script");
var _45=/ravegeowebmap(\.debug)?\.js([\?\.]|$)/i;
for(var i=0;i<_44.length;++i){
var src=_44[i].getAttribute("src");
if(!src){
continue;
}
var m=src.match(_45);
if(m){
root=src.substring(0,m.index);
_43.url=root;
break;
}
}
}
};
_42._serializeDoubleArray=function(arr){
var s=""+arr.length+";";
for(var i=0;i<arr.length;++i){
s+=arr[i]+";";
}
return s;
};
_42._polyX_expandBounds=function(_4c,_4d,_4e,_4f){
for(var i=0;i<_4c.length;++i){
if(_4c[i]<_4e.x){
_4e.x=_4c[i];
}
if(_4c[i]>_4f.x){
_4f.x=_4c[i];
}
if(_4d[i]<_4e.y){
_4e.y=_4d[i];
}
if(_4d[i]>_4f.y){
_4f.y=_4d[i];
}
}
};
MapCommons_polyX_getBounds=function(_51,_52){
var _53={x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY};
var _54={x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY};
for(var i=0;i<_51.length;++i){
if(_51[i]<_53.x){
_53.x=_51[i];
}
if(_51[i]>_54.x){
_54.x=_51[i];
}
if(_52[i]<_53.y){
_53.y=_52[i];
}
if(_52[i]>_54.y){
_54.y=_52[i];
}
}
return {minPoint:_53,maxPoint:_54};
};
_42._polyX_isInside=function(_56,_57,_58,_59,_5a,_5b){
var _5c=getBounds(_56,_57);
return _5c.minPoint.x<_5a&&_5c.maxPoint.x>_58&&_5c.minPoint.y<_5b&&_5c.maxPoint.y>_59;
};
_42._polyX_getCenter=function(_5d,_5e){
var _5f=getBounds(_5d,_5e);
return {x:(_5f.minPoint.x+_5f.maxPoint.x)/2,y:(_5f.minPoint.y+_5f.maxPoint.y)/2};
};
MapCommons_polyX_geoToPixels=function(_60,_61,_62,_63){
var ret=[];
for(var i=0;i<_60.length;++i){
ret[ret.length]=Math.round((_60[i]-_61)*_62)+_63;
}
return ret;
};
_42._polyX_position=function(_66,_67,_68,_69,_6a){
if(_66._canvasElement){
_66._layer._layerDiv.removeChild(_66._canvasElement);
}
var _6b=MapCommons_polyX_getBounds(_66._xPoints,_66._yPoints);
var _6c=Math.round((_6b.minPoint.x-_67.x)*_68.x)-_69;
var _6d=Math.round((_6b.maxPoint.x-_67.x)*_68.x)+_69;
var _6e=Math.round((_67.y-_6b.maxPoint.y)*_68.y)-_69;
var _6f=Math.round((_67.y-_6b.minPoint.y)*_68.y)+_69;
var _70=MapCommons_polyX_geoToPixels(_66._xPoints,_6b.minPoint.x,_68.x,_69);
var _71=MapCommons_polyX_geoToPixels(_66._yPoints,_6b.maxPoint.y,-_68.y,_69);
var _72=_6d-_6c;
var _73=_6f-_6e;
var _74=ravegeo.internal.Canvas.create(_72,_73);
var _75=_74.getElement();
_66._canvasElement=_75;
_75.style.position="absolute";
_75.style.zIndex="51";
_75.style.left=_6c+"px";
_75.style.top=_6e+"px";
_66._layer._layerDiv.appendChild(_75);
if(_6a){
_74.drawPolygon(_70,_71,ravegeo.internal.Utilities.fixStyle({fillColor:_66.color}));
}else{
_74.drawPolyline(_70,_71,ravegeo.internal.Utilities.fixStyle({strokeColor:_66.color,strokeWidth:_66.width}));
}
_42._addCanvasObjectEvents(_66);
};
_42._polyX_reposition=function(_76,_77,_78,_79,_7a){
var _7b=_76._canvasElement;
var _7c=MapCommons_polyX_getBounds(_76._xPoints,_76._yPoints);
var _7d=Math.round((_7c.minPoint.x-_77.x)*_78.x)-_79;
var _7e=Math.round((_7c.maxPoint.x-_77.x)*_78.x)+_79;
var _7f=Math.round((_77.y-_7c.maxPoint.y)*_78.y)-_79;
var _80=Math.round((_77.y-_7c.minPoint.y)*_78.y)+_79;
var _81=MapCommons_polyX_geoToPixels(_76._xPoints,_7c.minPoint.x,_78.x,_79);
var _82=MapCommons_polyX_geoToPixels(_76._yPoints,_7c.maxPoint.y,-_78.y,_79);
var _83=_7e-_7d;
var _84=_80-_7f;
_7b.style.position="absolute";
_7b.style.zIndex="51";
_7b.style.left=_7d+"px";
_7b.style.top=_7f+"px";
};
_42._addCanvasObjectEvents=function(_85){
var _86=_85._canvasElement;
_86._tile={owner:_85._layer};
ravegeo.TiledMap._addMapEvents(_86);
var _87=_86.firstChild;
if(_87){
_87._object=_85;
_87._tile={owner:_85._layer};
}
};
_42._polyX_move=function(_88,_89,_8a,_8b){
var _8c=_88.getPoints();
movePoints(_8c.xValues,_89);
movePoints(_8c.yValues,_8a);
_88._xPoints=_8c.xValues;
_88._yPoints=_8c.yValues;
_88._project(_8b);
_88._layer._repositionGeoObject(_88);
};
function movePoints(_8d,_8e){
for(var i=0;i<_8d.length;i++){
_8d[i]=_8d[i]+_8e;
}
}
_42.defaultInteractionDelay=700;
_42.maxInteractionDelay=10000;
_42.getHandleTimeout=15000;
_42.getTilesInfoTimeout=15000;
_42.version="2.3.5.19825";
return _42;
})();
ravegeo.internal.ToolEventsDispatcher=(function(){
var _90=ravegeo.internal.Utilities;
var _91=function(map){
this._tools=[];
this._map=map;
};
_91.prototype.addTool=function(_93){
if(_93.activate){
_93.activate(this._map);
}
this._tools[this._tools.length]=_93;
};
_91.prototype.removeTool=function(_94){
if(_94.deactivate){
_94.deactivate(this._map);
}
for(var idx in this._tools){
if(this._tools[idx]==_94){
this._tools.splice(idx,1);
break;
}
}
};
_91.prototype.mouseDown=function(_96){
this._notifyTools("mousePressed",_96);
};
_91.prototype.mouseMoved=function(_97){
this._notifyTools("mouseMoved",_97);
};
_91.prototype.mouseUp=function(_98){
this._notifyTools("mouseReleased",_98);
};
_91.prototype.mouseClicked=function(_99){
this._notifyTools("mouseClicked",_99);
};
_91.prototype.mouseDoubleClicked=function(_9a){
this._notifyTools("mouseDoubleClicked",_9a);
};
_91.prototype._notifyTools=function(_9b,_9c){
var _9d=this._getProjectedPointFromEvent(_9c);
var _9e=this._pickObject(_9c);
var _9f=null;
var _a0=null;
if(_9e){
_a0=_9e.id;
_9f=this._map._layers[_9e._layer._id];
}
for(var idx in this._tools){
if(this._tools[idx][_9b]){
this._tools[idx][_9b](this._map,_9d[0],_9d[1],_9f,_a0);
}
}
};
_91.prototype._getProjectedPointFromEvent=function(_a2){
var _a3=this._map._getGeoPointFromEvent(_a2);
return this._map._projector.reverse(_a3[0],_a3[1]);
};
_91.prototype._pickObject=function(e){
var _a5=pickByTarget(e);
if(!_a5){
_a5=this._pickByCoordinates(e);
}
return _a5;
};
function pickByTarget(e){
var _a7=_90.getTarget(e);
var _a8=_a7._object;
if(!_a8){
_a8=_a7._symbol;
}
return _a8;
}
_91.prototype._pickByCoordinates=function(e){
var _aa=this._map._layers;
for(var _ab in _aa){
var _ac=_aa[_ab]._pickObject(this._map._getPixelsFromEvent(e));
if(_ac){
return _ac;
}
}
};
return _91;
})();
ravegeo.internal.GeometryFunctions=(function(){
var _ad={};
_ad.closestPointOnLine=function(_ae,_af,_b0,_b1){
if(_ae.length<=1){
return -1;
}
var a=Array();
var b=Array();
var _b4=Number.MAX_VALUE;
var _b5=0;
var x=0;
var y=0;
for(var i=1;i<_ae.length;i++){
a[0]=_ae[i-1];
a[1]=_af[i-1];
b[0]=_ae[i];
b[1]=_af[i];
if(!pointInsideExtendedSegmentBounds(_b0,_b1,a,b)){
continue;
}
var d=pointDistance2ToSegment(_b0,a,b);
if(d<_b4){
_b4=d;
}
}
return _b4;
};
function pointInsideExtendedSegmentBounds(_ba,ext,a,b){
for(var i=0;i<_ba.length;i++){
if(_ba[i]<Math.min(a[i],b[i])-ext||_ba[i]>Math.max(a[i],b[i])+ext){
return false;
}
}
return true;
}
function pointDistance2ToSegment(c,a,b){
var _c2=[];
var ab=sub(b,a);
var ac=sub(c,a);
var _c5=dot(ac,ab);
var _c6=length2(ab);
if(_c5<=0){
_c2=copy(a);
}else{
if(_c5>=_c6){
_c2=copy(b);
}else{
while(Math.abs(_c5)>36863){
_c5/=2;
if(Math.abs(_c6)>2){
_c6/=2;
}
}
_c2=add(a,div(mult(ab,_c5),_c6));
}
}
return length2(sub(c,_c2));
}
function sub(a,b){
var ret=Array();
for(var i=0;i<a.length;i++){
ret[i]=a[i]-b[i];
}
return ret;
}
function copy(_cb){
var to=[];
for(var i=0;i<to.length;i++){
to[i]=_cb[i];
}
return to;
}
function add(a,b){
var ret=Array();
for(var i=0;i<a.length;i++){
ret[i]=a[i]+b[i];
}
return ret;
}
function mult(a,b){
var ret=Array();
for(var i=0;i<a.length;i++){
ret[i]=a[i]*b;
}
return ret;
}
function div(a,b){
var ret=Array();
for(var i=0;i<a.length;i++){
ret[i]=a[i]/b;
}
return ret;
}
function length2(v){
var l=0;
for(var i=0;i<v.length;i++){
l+=v[i]*v[i];
}
return l;
}
function dot(a,b){
var p=0;
for(var i=0;i<a.length;i++){
p+=a[i]*b[i];
}
return p;
}
_ad.isPointInsidePolygon=function(_e1,_e2,_e3){
if(_e1.length<2){
return false;
}
var _e4=getNumberOfCrossings(_e1,_e2,_e3);
return isOdd(_e4);
};
function getNumberOfCrossings(_e5,_e6,_e7){
var _e8=_e5.length;
var _e9=[_e5[_e8-1],_e6[_e8-1]];
var _ea=0;
for(var i=0;i<_e8;++i){
var _ec=[_e5[i],_e6[i]];
var _ed=pointCrossesLine(_e7,_e9,_ec);
if(_ed){
_ea++;
}
_e9=_ec;
}
return _ea;
}
function pointCrossesLine(_ee,_ef,_f0){
var _f1=(_f0[0]-_ef[0])/(_f0[1]-_ef[1]);
var _f2=(_ef[1]<=_ee[1])&&(_ee[1]<_f0[1]);
var _f3=(_f0[1]<=_ee[1])&&(_ee[1]<_ef[1]);
var _f4=_ee[0]<_f1*(_ee[1]-_ef[1])+_ef[0];
var _f5=(_f2||_f3)&&_f4;
return _f5;
}
function isOdd(_f6){
return _f6%2!=0;
}
_ad.isPointInsideEllipse=function(_f7,_f8,_f9,_fa){
if(!pointInsideExtendedEllipseBounds(_f7,_f8,_f9,_fa)){
return false;
}
var _fb=(_f7[1]-_f7[0])/2;
var _fc=(_f8[1]-_f8[0])/2;
var _fd=[_f7[0]+_fb,_f8[0]+_fc];
var _fe=[_fb+_fa/2,_fc+_fa/2];
var _ff=[_fb-_fa/2,_fc-_fa/2];
return (isInsideEllipse(_fd,_fe,_f9)&&!isInsideEllipse(_fd,_ff,_f9));
};
function pointInsideExtendedEllipseBounds(_100,_101,_102,_103){
return (_102[0]>(_100[0]-_103/2)&&_102[0]<(_100[1]+_103/2)&&_102[1]>(_101[0]-_103/2)&&_102[1]<(_101[1]+_103/2));
}
function isInsideEllipse(_104,_105,_106){
if(_105[0]<=0||_105[1]<=0){
return false;
}
return square(_106[0]-_104[0])/square(_105[0])+square(_106[1]-_104[1])/square(_105[1])<1;
}
function square(x){
return x*x;
}
return _ad;
})();
ravegeo.Ellipse=(function(){
var _108=ravegeo.internal.Utilities;
var _109=ravegeo.internal.GeometryFunctions;
var _10a=function(id,x1,y1,x2,y2,_110,_111){
_108.ensureString(id,"id");
this.id=id;
x1=_108.getFloat(x1);
x2=_108.getFloat(x2);
y1=_108.getFloat(y1);
y2=_108.getFloat(y2);
if(x1<x2){
this._xMin=x1;
this._xMax=x2;
}else{
this._xMin=x2;
this._xMax=x1;
}
if(y1<y2){
this._yMin=y1;
this._yMax=y2;
}else{
this._yMin=y2;
this._yMax=y1;
}
this.width=_108.getInteger(_110,0);
this.color=(typeof (_111)!="undefined")?_111:"#000000";
};
_10a.prototype.getBounds=function(){
var rect={xMin:this._xMin,yMin:this._yMin,xMax:this._xMax,yMax:this._yMax};
if(this._projector){
var pmin=this._projector.reverse(rect.xMin,rect.yMin);
var pmax=this._projector.reverse(rect.xMax,rect.yMax);
rect.xMin=pmin[0];
rect.yMin=pmin[1];
rect.xMax=pmax[0];
rect.yMax=pmax[1];
}
return rect;
};
_10a.prototype._project=function(_115){
this._projector=_115;
var _116=_115.forward(this._xMin,this._yMin);
this._xMin=_116[0];
this._yMin=_116[1];
_116=_115.forward(this._xMax,this._yMax);
this._xMax=_116[0];
this._yMax=_116[1];
};
_10a.prototype._serialize=function(){
var e="e";
e+=this.id.length+";"+this.id;
e+=this._xMin+";";
e+=this._yMin+";";
e+=this._xMax+";";
e+=this._yMax+";";
e+=this.width+";";
e+=this.color.length+";"+this.color;
return e;
};
_10a.prototype._tiledMapInit=function(_118,_119){
this._layer=_118;
_118._positionGeoObject(this);
};
_10a.prototype._destroy=function(){
this._layer._layerDiv.removeChild(this._canvasElement);
};
_10a.prototype._position=function(_11a,_11b){
if(this._canvasElement){
this._layer._layerDiv.removeChild(this._canvasElement);
}
var xMin=Math.round((this._xMin-_11a.x)*_11b.x)-5;
var xMax=Math.round((this._xMax-_11a.x)*_11b.x)+5;
var yMin=Math.round((_11a.y-this._yMax)*_11b.y)-5;
var yMax=Math.round((_11a.y-this._yMin)*_11b.y)+5;
var _120=xMax-xMin;
var _121=yMax-yMin;
var _122=ravegeo.internal.Canvas.create(_120,_121);
var _123=_122.getElement();
this._canvasElement=_123;
_123.style.position="absolute";
_123.style.zIndex="51";
_123.style.left=xMin+"px";
_123.style.top=yMin+"px";
this._layer._layerDiv.appendChild(_123);
var _124=(this.width>0)?{strokeColor:this.color,strokeWidth:this.width}:{fillColor:this.color};
ravegeo.internal.Utilities.fixStyle(_124);
_122.drawOval(5,5,_120-10,_121-10,_124);
ravegeo.internal.MapCommons._addCanvasObjectEvents(this);
};
_10a.prototype._reposition=function(_125,_126){
var xMin=Math.round((this._xMin-_125.x)*_126.x)-5;
var xMax=Math.round((this._xMax-_125.x)*_126.x)+5;
var yMin=Math.round((_125.y-this._yMax)*_126.y)-5;
var yMax=Math.round((_125.y-this._yMin)*_126.y)+5;
var _12b=xMax-xMin;
var _12c=yMax-yMin;
var _12d=this._canvasElement;
_12d.style.position="absolute";
_12d.style.zIndex="51";
_12d.style.left=xMin+"px";
_12d.style.top=yMin+"px";
};
_10a.prototype._isInside=function(xMin,yMin,xMax,yMax){
return this._xMin<xMax&&this._xMax>xMin&&this._yMin<yMax&&this._yMax>yMin;
};
_10a.prototype._expandBounds=function(_132,_133){
if(this._xMin<_132.x){
_132.x=this._xMin;
}
if(this._xMax>_133.x){
_133.x=this._xMax;
}
if(this._yMin<_132.y){
_132.y=this._yMin;
}
if(this._yMax>_133.y){
_133.y=this._yMax;
}
};
_10a.prototype._getCenter=function(){
return {x:(this.minX+this.maxX)/2,y:(this.minY+this.maxY)/2};
};
_10a.prototype._setHighlight=function(_134,_135){
};
_10a.prototype._removeHighlight=function(){
};
_10a.prototype._pick=function(_136){
var _137=this._layer._geoToPixelPointsX([this._xMin,this._xMax]);
var _138=this._layer._geoToPixelPointsY([this._yMax,this._yMin]);
return _109.isPointInsideEllipse(_137,_138,_136,this.width);
};
_10a.prototype._move=function(_139,_13a,_13b){
var _13c=this.getBounds();
this._xMin=_13c.xMin+_139;
this._xMax=_13c.xMax+_139;
this._yMin=_13c.yMin+_13a;
this._yMax=_13c.yMax+_13a;
this._project(_13b);
this._layer._repositionGeoObject(this);
};
return _10a;
})();
ravegeo.Symbol=(function(){
var _13d=ravegeo.internal.Utilities;
var _13e=function(id,x,y,_142,_143,text,_145,_146){
_13d.ensureString(id,"id");
this.id=id;
this._x=_13d.getFloat(x);
this._y=_13d.getFloat(y);
this.symbol=_142;
this.label=(typeof (_143)!="undefined"&&_143!=null)?_143:"";
this.text=(typeof (text)!="undefined"&&text!=null)?text:"";
this._strAnchorX=(typeof (_145)!="undefined"&&_145!=null)?_145+"":"";
this._strAnchorY=(typeof (_146)!="undefined"&&_146!=null)?_146+"":"";
};
_13e.prototype.getPoint=function(){
if(this._projector){
var _147=this._projector.reverse(this._x,this._y);
return {x:_147[0],y:_147[1]};
}
return {x:this._x,y:this._y};
};
_13e.prototype._project=function(_148){
this._projector=_148;
var _149=this._projector.forward(this._x,this._y);
this._x=_149[0];
this._y=_149[1];
};
_13e.prototype._serialize=function(){
var s="s";
s+=this.id.length+";"+this.id;
s+=this._x+";";
s+=this._y+";";
s+=this.symbol.length+";"+this.symbol;
s+=this.label.length+";"+this.label;
s+=this.text.length+";"+this.text;
s+=this._strAnchorX.length+";"+this._strAnchorX;
s+=this._strAnchorY.length+";"+this._strAnchorY;
return s;
};
_13e.prototype._createBallon=function(_14b){
var _14c=document.createElement("div");
_13d.setStyle(_14c,"position:absolute;top:0px;left:0px;z-index:53;border:1px solid;cursor:text;padding:3px 5px 3px 5px;white-space:pre;");
_14c.style.borderColor=_13d.getColor(_14b.borderColor);
_14c.style.backgroundColor=_13d.getColor(_14b.backgroundColor);
_14c.innerHTML+=this.text;
_14c.style.color=_13d.getColor(_14b.textColor);
_14c.style.left=(this._left+this._img.width+2)+"px";
_14c.style.top=(this._top+this._img.height+2)+"px";
_13d.setClassName(_14c,"raveGeoWebMapText");
return _14c;
};
function imageLoaded(){
var _14d=this._symbol;
delete _14d._notYetLoaded;
_14d._layer._positionGeoObject(_14d);
if(_14d._doHighlight){
_14d._layer.highlightGeoObject(_14d.id,_14d._doHighlight);
delete _14d._doHighlight;
}
}
_13e.prototype._tiledMapInit=function(_14e,_14f){
var opts;
if(_14f){
opts={center:"Never"};
if(_14f._highlightElement){
opts.showHighlight=true;
}
if(_14f._alwaysBalloon){
opts.showText=true;
}
}
this._layer=_14e;
var img=document.createElement("img");
this._img=img;
img.src=this.symbol;
img.style.position="absolute";
img.style.zIndex="50";
try{
img.style.cursor="pointer";
}
catch(e){
img.style.cursor="hand";
}
img._symbol=this;
img._tile={owner:_14e};
ravegeo.TiledMap._addMapEvents(img);
var _152;
if(!_13d.stringIsEmpty(this.label)){
var _153=document.createElement("span");
this._innerLabelSpan=_153;
_153.innerHTML=this.label;
_13d.setStyle(_153,"font-family:sans-serif;font-size:small;padding:0px;white-space:pre;border:1px solid;padding:2px 3px 2px 3px;");
_13d.setClassName(_153,"raveGeoWebMapLabel");
_153.style.borderColor=_13d.getColor(_14e._labelStyle.borderColor);
_153.style.backgroundColor=_13d.getColor(_14e._labelStyle.backgroundColor);
_153.style.color=_13d.getColor(_14e._labelStyle.textColor);
labelDiv=this._labelDiv=document.createElement("div");
_13d.setStyle(labelDiv,"position:absolute;left:-755px;z-index:49;width:1500px;text-align:center;padding:5px;margin:1px;");
labelDiv.appendChild(_153);
_153._tile={owner:_14e};
ravegeo.TiledMap._addMapEvents(_153);
labelDiv._tile={owner:_14e};
ravegeo.TiledMap._addMapEvents(labelDiv);
_152=this._symbolCenterDiv=document.createElement("div");
_13d.setStyle(_152,"position:absolute;z-index:49;width:0px;height:0px;padding:0px;margin:0px;");
_152.appendChild(labelDiv);
}
_14e._positionGeoObject(this);
_14e._layerDiv.appendChild(img);
if(_152){
_14e._layerDiv.appendChild(_152);
}
if(opts){
_14e.highlightGeoObject(this.id,opts);
}
};
_13e.prototype._destroy=function(){
if(this==this._layer._map._highlightedGeoObject){
this._removeHighlight();
delete this._layer._map._highlightedGeoObject;
}
this._layer._layerDiv.removeChild(this._img);
if(this._balloon){
this._layer._layerDiv.removeChild(this._balloon);
}
if(this._symbolCenterDiv){
this._labelDiv._tile=null;
this._innerLabelSpan._tile=null;
this._layer._layerDiv.removeChild(this._symbolCenterDiv);
}
};
_13e.prototype._position=function(_154,_155){
var _156=this._getCurrentImage();
this._setLeftAndTop(_154,_155);
this._img.style.left=this._left+"px";
this._img.style.top=this._top+"px";
if(this._labelDiv){
var _157=this._inScaleRange(this._layer._labelMinScale,this._layer._labelMaxScale);
this._labelDiv.style.display=_157?"block":"none";
if(_157){
this._symbolCenterDiv.style.left=this._left+this._img.width/2+"px";
this._symbolCenterDiv.style.top=this._top+this._img.height/2+"px";
if(this._layer._labelsAboveSymbols){
this._labelDiv.style.bottom=(this._img.height/2-3)+"px";
}else{
this._labelDiv.style.top=(this._img.height/2-1)+"px";
}
}
}
this._moveText();
if(!_13d.isImageLoaded(_156)){
this._notYetLoaded=true;
_13d.onImageLoaded(_156,imageLoaded);
}
if(this._highlightElement){
var _158=Math.round(this._left+this._img.width/2);
var _159=Math.round(this._top+this._img.height/2);
var ow=this._highlightOuterWidth;
if(typeof (ow)!="undefined"){
this._highlightElement.style.left=Math.round(_158-ow)+"px";
this._highlightElement.style.top=(_159-ow)+"px";
}
}
};
_13e.prototype._moveText=function(){
if(this._balloon){
this._balloon.style.left=(this._left+this._img.width+2)+"px";
this._balloon.style.top=(this._top+this._img.height+2)+"px";
}
if(this._alwaysBalloon){
this._alwaysBalloon.style.left=(this._left+this._img.width+2)+"px";
this._alwaysBalloon.style.top=(this._top+this._img.height+2)+"px";
}
};
_13e.prototype._inScaleRange=function(_15b,_15c){
var _15d=this._layer._map.getScale();
return !(_15b&&_15d<_15b||_15c&&_15d>_15c);
};
_13e.prototype._getCurrentImage=function(){
this._showMiniSymbol=this._layer._miniSymbol!=""&&this._inScaleRange(this._layer._miniSymbolMinScale);
var _15e=new Image();
_15e.src=this._showMiniSymbol?this._layer._miniSymbol:this.symbol;
this._img.src=_15e.src;
_15e._symbol=this._img._symbol;
return _15e;
};
_13e.prototype._setLeftAndTop=function(_15f,_160){
var cx=-Math.round((_15f.x-this._x)*_160.x);
var cy=Math.round((_15f.y-this._y)*_160.y);
this.anchorX=this._strAnchorX==""||this._showMiniSymbol?this._img.width/2:_13d.getInteger(this._strAnchorX);
this.anchorY=this._strAnchorY==""||this._showMiniSymbol?this._img.height/2:_13d.getInteger(this._strAnchorY);
this._left=cx-this.anchorX;
this._top=cy-this.anchorY;
};
_13e.prototype._isInside=function(xMin,yMin,xMax,yMax){
return this._x>=xMin&&this._y>=yMin&&this._x<=xMax&&this._y<=yMax;
};
_13e.prototype._expandBounds=function(_167,_168){
if(this._x<_167.x){
_167.x=this._x;
}
if(this._x>_168.x){
_168.x=this._x;
}
if(this._y<_167.y){
_167.y=this._y;
}
if(this._y>_168.y){
_168.y=this._y;
}
};
_13e.prototype._getCenter=function(){
return {x:this._x,y:this._y};
};
_13e.prototype._setHighlight=function(_169,_16a){
if(_169){
this._alwaysBalloon=this._createBallon(this._layer._textStyle);
this._layer._layerDiv.appendChild(this._alwaysBalloon);
}
if(_16a){
var _16b=this._img.width;
var _16c=this._img.height;
var _16d=Math.round(this._left+_16b/2);
var _16e=Math.round(this._top+_16c/2);
var _16f=Math.max(_16b,_16c)/3;
var _170=(Math.sqrt(_16b*_16b+_16c*_16c)/2)+_16f;
var ow=Math.round(_170+_16f/2);
this._highlightOuterWidth=ow;
var _172=ravegeo.internal.Canvas.create(ow*2,ow*2);
var _173=_172.getElement();
_173.style.position="absolute";
_173.style.zIndex="51";
_173.style.left=Math.round(_16d-ow)+"px";
_173.style.top=(_16e-ow)+"px";
this._layer._layerDiv.appendChild(_173);
this._highlightElement=_173;
var end=Math.PI*2+0.1;
var inc=Math.PI/6;
for(var i=0;i<=end;i+=inc){
var x=ow-Math.floor(_170*Math.cos(i));
var y=ow-Math.floor(_170*Math.sin(i));
_172.drawCircle(x,y,_16f/2,_13d.fixStyle({fillColor:this._layer._highlightColor}));
}
_173._tile={owner:this._layer};
ravegeo.TiledMap._addMapEvents(_173);
var _179=_173.childNodes;
for(idx in _179){
var _17a=_179[idx];
_17a._tile={owner:this._layer};
}
}
this._img.style.zIndex="53";
};
_13e.prototype._removeHighlight=function(){
this._img.style.zIndex="50";
if(this._alwaysBalloon){
this._layer._layerDiv.removeChild(this._alwaysBalloon);
delete this._alwaysBalloon;
}
if(this._highlightElement){
this._layer._layerDiv.removeChild(this._highlightElement);
delete this._highlightOuterWidth;
delete this._highlightElement;
}
};
_13e.prototype._pick=function(_17b){
var _17c={x:this._layer._map._geoX,y:this._layer._map._geoY};
var _17d=this._layer._getGeoToPixels();
var cx=-Math.round((_17c.x-this._x)*_17d.x);
var cy=Math.round((_17c.y-this._y)*_17d.y);
var left=cx-this.anchorX+this._layer._map._mapWidth/2;
var top=cy-this.anchorY+this._layer._map._mapHeight/2;
return _17b[0]>left&&_17b[0]<(left+this._img.width+5)&&_17b[1]>top&&_17b[1]<(top+this._img.height+5);
};
_13e.prototype._move=function(_182,_183,_184){
var _185=this.getPoint();
this._x=_185.x+_182;
this._y=_185.y+_183;
this._project(_184);
this._layer._positionGeoObject(this);
};
return _13e;
})();
ravegeo.Polygon=(function(){
var _186=ravegeo.internal.Utilities;
var _187=ravegeo.internal.GeometryFunctions;
var _188=function(id,_18a,_18b,_18c){
_186.ensureString(id,"id");
this.id=id;
this._xPoints=_186.getFloatArray(_18a);
this._yPoints=_186.getFloatArray(_18b);
this.color=(typeof (_18c)!="undefined")?_18c:"#000000";
};
_188.prototype.getPoints=function(){
var xpts=this._xPoints;
var ypts=this._yPoints;
if(this._projector){
xpts=xpts.slice(0);
ypts=ypts.slice(0);
this._projector.reverseArray(xpts,ypts);
}
return {xValues:xpts,yValues:ypts};
};
_188.prototype._project=function(_18f){
this._projector=_18f;
_18f.forwardArray(this._xPoints,this._yPoints);
};
_188.prototype._serialize=function(){
var g="g";
g+=this.id.length+";"+this.id;
g+=ravegeo.internal.MapCommons._serializeDoubleArray(this._xPoints);
g+=ravegeo.internal.MapCommons._serializeDoubleArray(this._yPoints);
g+=this.color.length+";"+this.color;
return g;
};
_188.prototype._tiledMapInit=function(_191,_192){
this._layer=_191;
_191._positionGeoObject(this);
};
_188.prototype._destroy=function(){
this._layer._layerDiv.removeChild(this._canvasElement);
};
_188.prototype._position=function(_193,_194){
ravegeo.internal.MapCommons._polyX_position(this,_193,_194,5,true);
};
_188.prototype._reposition=function(_195,_196){
ravegeo.internal.MapCommons._polyX_reposition(this,_195,_196,5,true);
};
_188.prototype._isInside=function(xMin,yMin,xMax,yMax){
ravegeo.internal.MapCommons._polyX_isInside(this._xPoints,this._yPoints,xMin,yMin,xMax,yMax);
};
_188.prototype._expandBounds=function(_19b,_19c){
ravegeo.internal.MapCommons._polyX_expandBounds(this._xPoints,this._yPoints,_19b,_19c);
};
_188.prototype._getCenter=function(){
return ravegeo.internal.MapCommons._polyX_getCenter(this._xPoints,this._yPoints);
};
_188.prototype._setHighlight=function(_19d,_19e){
};
_188.prototype._removeHighlight=function(){
};
_188.prototype._pick=function(_19f){
var _1a0=this._layer._geoToPixelPointsX(this._xPoints);
var _1a1=this._layer._geoToPixelPointsY(this._yPoints);
return _187.isPointInsidePolygon(_1a0,_1a1,_19f);
};
_188.prototype._move=function(_1a2,_1a3,_1a4){
ravegeo.internal.MapCommons._polyX_move(this,_1a2,_1a3,_1a4);
};
return _188;
})();
ravegeo.Polyline=(function(){
var _1a5=ravegeo.internal.Utilities;
var _1a6=ravegeo.internal.GeometryFunctions;
var _1a7=function(id,_1a9,_1aa,_1ab,_1ac){
_1a5.ensureString(id,"id");
this.id=id;
this._xPoints=_1a5.getFloatArray(_1a9);
this._yPoints=_1a5.getFloatArray(_1aa);
this.width=_1a5.getInteger(_1ab,1);
this.color=(typeof (_1ac)!="undefined")?_1ac:"#000000";
};
_1a7.prototype.getPoints=function(){
var xpts=this._xPoints;
var ypts=this._yPoints;
if(this._projector){
xpts=xpts.slice(0);
ypts=ypts.slice(0);
this._projector.reverseArray(xpts,ypts);
}
return {xValues:xpts,yValues:ypts};
};
_1a7.prototype._project=function(_1af){
this._projector=_1af;
_1af.forwardArray(this._xPoints,this._yPoints);
};
_1a7.prototype._serialize=function(){
var l="l";
l+=this.id.length+";"+this.id;
l+=ravegeo.internal.MapCommons._serializeDoubleArray(this._xPoints);
l+=ravegeo.internal.MapCommons._serializeDoubleArray(this._yPoints);
l+=this.width+";";
l+=this.color.length+";"+this.color;
return l;
};
_1a7.prototype._tiledMapInit=function(_1b1,_1b2){
this._layer=_1b1;
_1b1._positionGeoObject(this);
};
_1a7.prototype._destroy=function(){
this._layer._layerDiv.removeChild(this._canvasElement);
};
_1a7.prototype._position=function(_1b3,_1b4){
ravegeo.internal.MapCommons._polyX_position(this,_1b3,_1b4,5+this.width,false);
};
_1a7.prototype._reposition=function(_1b5,_1b6){
ravegeo.internal.MapCommons._polyX_reposition(this,_1b5,_1b6,5+this.width,false);
};
_1a7.prototype._isInside=function(xMin,yMin,xMax,yMax){
ravegeo.internal.MapCommons._polyX_isInside(this._xPoints,this._yPoints,xMin,yMin,xMax,yMax);
};
_1a7.prototype._expandBounds=function(_1bb,_1bc){
ravegeo.internal.MapCommons._polyX_expandBounds(this._xPoints,this._yPoints,_1bb,_1bc);
};
_1a7.prototype._getCenter=function(){
return ravegeo.internal.MapCommons._polyX_getCenter(this._xPoints,this._yPoints);
};
_1a7.prototype._setHighlight=function(_1bd,_1be){
};
_1a7.prototype._removeHighlight=function(){
};
_1a7.prototype._pick=function(_1bf){
var _1c0=this._layer._geoToPixelPointsX(this._xPoints);
var _1c1=this._layer._geoToPixelPointsY(this._yPoints);
var _1c2=_1a6.closestPointOnLine(_1c0,_1c1,_1bf,this.width/2);
return (parseFloat(_1c2)<parseFloat(this.width/2*this.width/2));
};
_1a7.prototype._move=function(_1c3,_1c4,_1c5){
ravegeo.internal.MapCommons._polyX_move(this,_1c3,_1c4,_1c5);
};
return _1a7;
})();
ravegeo.internal.MercatorProjector=(function(){
var _1c6=Math.PI/180;
var _1c7=111319.49079;
var _1c8={};
_1c8.forward=function(lon,lat){
if(lat>88){
lat=88;
}
if(lat<-88){
lat=-88;
}
var _1cb=Math.sin(lat*_1c6);
var yrad=0.5*Math.log((1+_1cb)/(1-_1cb));
var y=yrad/_1c6*_1c7;
return [lon*_1c7,y];
};
_1c8.reverse=function(x,y){
var _1d0=2*Math.atan(Math.exp(y/_1c7*_1c6))-Math.PI/2;
return [x/_1c7,_1d0/_1c6];
};
_1c8.forwardArray=function(_1d1,_1d2){
for(var i in _1d1){
var p=_1c8.forward(_1d1[i],_1d2[i]);
_1d1[i]=p[0];
_1d2[i]=p[1];
}
};
_1c8.reverseArray=function(xarr,yarr){
for(var i in xarr){
var p=_1c8.reverse(xarr[i],yarr[i]);
xarr[i]=p[0];
yarr[i]=p[1];
}
};
return _1c8;
})();
ravegeo.internal.PlateCarreProjector=(function(){
var _1d9={};
_1d9.forward=function(x,y){
return [x,y];
};
_1d9.reverse=function(x,y){
return [x,y];
};
_1d9.forwardArray=function(_1de,_1df){
};
_1d9.reverseArray=function(xarr,yarr){
};
return _1d9;
})();
ravegeo.LayerOptions=(function(){
var _1e2=ravegeo.internal.Utilities;
var _1e3=function(opts){
if(typeof (opts)=="undefined"){
opts={};
}
this.gridWidth=_1e2.getInteger(opts.gridWidth,25);
this.gridHeight=_1e2.getInteger(opts.gridHeight,25);
this.labelStyle=(typeof (opts.labelStyle)=="undefined")?{}:opts.labelStyle;
var _1e5=this.labelStyle;
if(!_1e5.borderColor){
_1e5.borderColor="";
}
if(!_1e5.backgroundColor){
_1e5.backgroundColor="";
}
if(!_1e5.textColor){
_1e5.textColor="";
}
this.labelsAboveSymbols=_1e2.getBoolean(opts.labelsAboveSymbols,false);
this.hoverBorder=_1e2.getBoolean(opts.hoverBorder,true);
this.textStyle=(typeof (opts.textStyle)=="undefined")?{}:opts.textStyle;
var _1e6=this.textStyle;
if(!_1e6.borderColor){
_1e6.borderColor="";
}
if(!_1e6.backgroundColor){
_1e6.backgroundColor="";
}
if(!_1e6.textColor){
_1e6.textColor="";
}
this.highlightColor=(typeof (opts.highlightColor)=="undefined")?"":opts.highlightColor;
this.leadLinesVisible=_1e2.getBoolean(opts.leadLinesVisible,false);
this.moveFromCenter=_1e2.getBoolean(opts.moveFromCenter,this.leadLinesVisible);
this.miniSymbol=(typeof (opts.miniSymbol)=="undefined")?"":opts.miniSymbol;
this.arrangeMinScale=_1e2.getInteger(opts.arrangeMinScale,-1);
this.arrangeMaxScale=_1e2.getInteger(opts.arrangeMaxScale,-1);
this.labelMinScale=_1e2.getInteger(opts.labelMinScale,-1);
this.labelMaxScale=_1e2.getInteger(opts.labelMaxScale,-1);
this.miniSymbolMinScale=_1e2.getInteger(opts.miniSymbolMinScale,-1);
this.arrangeGeoObjects=_1e2.getBoolean(opts.arrangeGeoObjects,false);
if(this.arrangeMinScale>0||this.arrangeMaxScale>0){
this.arrangeGeoObjects=true;
}
};
_1e3.prototype._serialize=function(){
var s="";
s=writeBoolean(s,this.arrangeGeoObjects);
s+=this.arrangeMinScale+";";
s+=this.arrangeMaxScale+";";
s+=this.gridWidth+";";
s+=this.gridHeight+";";
s=writeBoolean(s,this.leadLinesVisible);
s=writeBoolean(s,this.moveFromCenter);
s+=this.labelMinScale+";";
s+=this.labelMaxScale+";";
s+=this.miniSymbolMinScale+";";
s+=this.miniSymbol.length+";"+this.miniSymbol;
s+=this.labelStyle.borderColor.length+";"+this.labelStyle.borderColor;
s+=this.labelStyle.backgroundColor.length+";"+this.labelStyle.backgroundColor;
s+=this.labelStyle.textColor.length+";"+this.labelStyle.textColor;
s=writeBoolean(s,this.labelsAboveSymbols);
s=writeBoolean(s,this.hoverBorder);
s+=this.textStyle.borderColor.length+";"+this.textStyle.borderColor;
s+=this.textStyle.backgroundColor.length+";"+this.textStyle.backgroundColor;
s+=this.textStyle.textColor.length+";"+this.textStyle.textColor;
s+=this.highlightColor.length+";"+this.highlightColor;
return s;
};
function writeBoolean(s,bool){
var _1ea=bool?1:0;
s+=_1ea+";";
return s;
}
return _1e3;
})();
ravegeo.AppletMap=(function(){
var _1eb=0;
var _1ec=ravegeo.internal.Utilities;
var _1ed=ravegeo.internal.ToolEventsDispatcher;
var _1ee=function(_1ef){
ravegeo.internal.MapCommons._fixParams(_1ef);
this._projector=ravegeo.internal.PlateCarreProjector;
this._appletTimeoutCallback=_1ef._appletTimeoutCallback;
this._callback=_1ef.callback;
this._mapContainer=_1ef.mapContainer;
this._layers=[];
this._tools=[];
var _1f0=ravegeo.internal.MapCommons.defaultInteractionDelay;
if(typeof (_1ef.interactionDelay)!="undefined"){
_1f0=_1ec.getInteger(_1ef.interactionDelay);
if(_1f0>ravegeo.internal.MapCommons.maxInteractionDelay||_1f0<0){
_1f0=ravegeo.internal.MapCommons.maxInteractionDelay;
}
}
var _1f1="webmap-";
_1f1+=ravegeo.internal.MapCommons.version+".jar";
this._id="RaveGeoWebMapApplet"+_1eb++;
var _1f2=_1ef.url+_1f1;
var html="<applet id='"+this._id+"' code='ravegeo.webmap.WebMapApplet.class' archive='"+_1f2+"' mayscript='true' width='1' height='1'>";
html+="<param name='cache_archive' value='"+_1f2+"' />";
html+="<param name='url' value='"+_1ef.url+"' />";
html+="<param name='name' value='"+_1ef.name+"' />";
if(_1ef.key){
html+="<param name='key' value='"+_1ef.key+"' />";
}
html+="<param name='callbackId' value='"+this._id+"' />";
html+="<param name='interactionDelay' value='"+_1f0+"' />";
if(_1ef.initialViewArea){
var x=_1ec.getFloat(_1ef.initialViewArea.x);
var y=_1ec.getFloat(_1ef.initialViewArea.y);
var _1f6=this._projector.forward(x,y);
html+="<param name='initialViewArea.x' value='"+_1f6[0]+"' />";
html+="<param name='initialViewArea.y' value='"+_1f6[1]+"' />";
html+="<param name='initialViewArea.scale' value='"+_1ef.initialViewArea.scale+"' />";
}
if(_1ef.style){
var _1f7="";
for(var k in _1ef.style){
_1f7+=k+"|"+_1ef.style[k]+"|";
}
html+="<param name='style' value='"+_1f7+"' />";
}
html+="</applet>";
this._mapContainer.innerHTML+=html;
ravegeo.AppletMap.appletMaps[this._id]=this;
this._isAppletLoaded=false;
if(_1ef._maxAppletLoadTime){
var _1f9=this;
setTimeout(function(){
_1f9._appletLoadTimedOut();
},_1ef._maxAppletLoadTime);
}
this._params=_1ef;
this.addTool(ravegeo.tools.internal.DeprecatedCallbacksTool);
this._sizeCallbacks=[];
};
_1ee.prototype._appletLoaded=function(){
this._isAppletLoaded=true;
};
_1ee.prototype._appletLoadTimedOut=function(){
if(!this._isAppletLoaded){
if(this._appletTimeoutCallback){
this._appletTimeoutCallback();
}else{
this._errorDuringInit("AppletLoadTimeout","The applet did not load in the specified maximum time.");
}
}
};
_1ee.prototype._mapLoaded=function(){
var _1fa=this._params;
delete this._params;
this._applet=document.getElementById(this._id);
try{
this._applet.emptyMethod();
}
catch(e){
if(this._appletTimeoutCallback){
this._appletTimeoutCallback();
}else{
this._errorDuringInit("LiveConnectNotAvailable","Could not connect to applet using LiveConnect.");
}
return;
}
var _1fb=this._mapContainer.clientWidth;
var _1fc=this._mapContainer.clientHeight;
if(this._callback&&this._callback.mapLoaded){
var map=this;
this._addSizeCallback(function(){
map._callback.mapLoaded(map);
},_1fb,_1fc);
}
this._applet.style.width=_1fb+"px";
this._applet.style.height=_1fc+"px";
try{
this._applet.emptyMethod();
}
catch(e){
}
this._notifyJavaOfResizeIfNeeded(_1fb,_1fc);
ravegeo.internal.Utilities.removeChildren(this._mapContainer,this._applet);
};
_1ee.prototype._mapSizeSet=function(_1fe,_1ff){
for(var i=0;i<this._sizeCallbacks.length;i++){
var _201=this._sizeCallbacks[i];
if(_201.width==_1fe&&_201.height==_1ff){
_201.callback();
this._sizeCallbacks.splice(i,1);
}
}
};
_1ee.prototype._errorDuringInit=function(code,_203){
this._mapContainer.innerHTML="Fatal error: "+code+"<br>"+_203;
if(this._callback&&this._callback.errorOccurred){
this._callback.errorOccurred(code,_203);
}
};
_1ee.prototype._interactionEnded=function(){
if(this._callback&&this._callback.interactionEnded){
this._callback.interactionEnded(this);
}
};
_1ee.prototype._mouseClicked=function(x,y,_206,_207){
this._notifyTools("mouseClicked",x,y,_206,_207);
};
_1ee.prototype._mouseDoubleClicked=function(x,y,_20a,_20b){
this._notifyTools("mouseDoubleClicked",x,y,_20a,_20b);
};
_1ee.prototype._mousePressed=function(x,y,_20e,_20f){
this._notifyTools("mousePressed",x,y,_20e,_20f);
};
_1ee.prototype._mouseMoved=function(x,y,_212,_213){
this._notifyTools("mouseMoved",x,y,_212,_213);
};
_1ee.prototype._mouseReleased=function(x,y,_216,_217){
this._notifyTools("mouseReleased",x,y,_216,_217);
};
_1ee.prototype._linkPressed=function(url){
window.location=url;
};
_1ee.prototype._notifyTools=function(_219,x,y,_21c,_21d){
var _21e=null;
if(_21c!=null){
_21e=this._layers[_21c];
}
for(var idx in this._tools){
if(this._tools[idx][_219]){
this._tools[idx][_219](this,x,y,_21e,_21d);
}
}
};
_1ee.prototype.getCenterX=function(){
var x=this._applet.getCenterX();
var y=this._applet.getCenterY();
var _222=this._projector.reverse(x,y);
return _222[0];
};
_1ee.prototype.getCenterY=function(){
var y=this._applet.getCenterY();
var x=this._applet.getCenterX();
var _225=this._projector.reverse(x,y);
return _225[1];
};
_1ee.prototype.getScale=function(){
return this._applet.getScale();
};
_1ee.prototype.getGeoBounds=function(){
var _226=eval("("+this._applet.getGeoBounds()+")");
_226[0]=this._projector.reverse(_226[0][0],_226[0][1]);
_226[1]=this._projector.reverse(_226[1][0],_226[1][1]);
return {xMin:_226[0][0],yMin:_226[0][1],xMax:_226[1][0],yMax:_226[1][1]};
};
_1ee.prototype.setGeoBounds=function(_227){
_227=_1ec.getFloatValuesObject(_227);
var minp=this._projector.forward(_227.xMin,_227.yMin);
var maxp=this._projector.forward(_227.xMax,_227.yMax);
_227={xMin:minp[0],yMin:minp[1],xMax:maxp[0],yMax:maxp[1]};
this._applet.setGeoBounds(_227.xMin,_227.yMin,_227.xMax,_227.yMax);
};
_1ee.prototype.getWidth=function(){
return this._mapContainer.clientWidth;
};
_1ee.prototype.getHeight=function(){
return this._mapContainer.clientHeight;
};
_1ee.prototype.getRecommendedScales=function(){
return eval("("+this._applet.getRecommendedScales()+")");
};
_1ee.prototype.geoToDisplay=function(_22a){
_22a=_1ec.getFloatPoint(_22a);
_22a=this._applet.geoToDisplay(_22a.x,_22a.y);
return eval("("+_22a+")");
};
_1ee.prototype.displayToGeo=function(_22b){
_22b=_1ec.getIntegerPoint(_22b);
_22b=this._applet.displayToGeo(_22b.x,_22b.y);
return eval("("+_22b+")");
};
_1ee.prototype.setViewArea=function(x,y,_22e){
x=_1ec.getFloat(x);
y=_1ec.getFloat(y);
_22e=_1ec.getInteger(_22e);
var _22f=this._projector.forward(x,y);
this._applet.setViewArea(_22f[0],_22f[1],_22e);
};
_1ee.prototype.newLayer=function(opts){
var _231=new ravegeo.internal.AppletLayer(this._applet,opts,this._projector);
this._layers[_231._id]=_231;
return _231;
};
_1ee.prototype.removeLayer=function(_232){
this._applet.removeLayer(_232._id);
delete this._layers[_232._id];
};
_1ee.prototype.addTool=function(tool){
if(tool.activate){
tool.activate(this);
}
this._tools[this._tools.length]=tool;
};
_1ee.prototype.removeTool=function(tool){
if(tool.deactivate){
tool.deactivate(this);
}
for(var idx in this._tools){
if(this._tools[idx]==tool){
this._tools.splice(idx,1);
break;
}
}
};
_1ee.prototype.addControl=function(_236){
var str=_236._serialize();
this._applet.addControl(str);
};
_1ee.prototype.removeControl=function(_238){
this._applet.removeControl(_238._getType());
};
_1ee.prototype.zoom=function(_239){
_239=_1ec.getFloat(_239);
this._applet.zoom(_239);
};
_1ee.prototype.zoomTo=function(_23a){
_23a=_1ec.getInteger(_23a);
this._applet.zoomTo(_23a);
};
_1ee.prototype.pan=function(dx,dy){
dx=_1ec.getFloat(dx);
dy=_1ec.getFloat(dy);
this._applet.pan(dx,dy);
};
_1ee.prototype.moveTo=function(x,y,_23f){
x=_1ec.getFloat(x);
y=_1ec.getFloat(y);
_23f=_1ec.getInteger(_23f);
var _240=this._projector.forward(x,y);
this._applet.moveTo(_240[0],_240[1],_23f);
};
_1ee.prototype.setPanningEnabled=function(_241){
this._applet.setPanningEnabled(_241);
};
_1ee.prototype.setDoubleClickZoomingEnabled=function(_242){
this._applet.setDoubleClickZoomingEnabled(_242);
};
_1ee.prototype.getUpDirection=function(){
return this._applet.getUpDirection();
};
_1ee.prototype.setUpDirection=function(_243){
_243=_1ec.getInteger(_243);
this._applet.setUpDirection(_243);
};
_1ee.prototype.getPitch=function(){
return this._applet.getPitch();
};
_1ee.prototype.setPitch=function(_244){
_244=_1ec.getFloat(_244);
this._applet.setPitch(_244);
};
_1ee.prototype.resize=function(_245,_246,_247){
_245=_1ec.getInteger(_245);
_246=_1ec.getInteger(_246);
this._applet.style.width=_245+"px";
this._applet.style.height=_246+"px";
this._mapContainer.style.width=_245+"px";
this._mapContainer.style.height=_246+"px";
this._notifyJavaOfResizeIfNeeded(_245,_246);
if(_247){
this._addSizeCallback(_247,_245,_246);
}
};
_1ee.prototype._addSizeCallback=function(_248,_249,_24a){
this._sizeCallbacks[this._sizeCallbacks.length]={width:_249,height:_24a,callback:_248};
};
_1ee.prototype.getLayers=function(){
return _1ec.objectToArray(this._layers);
};
_1ee.prototype._notifyJavaOfResizeIfNeeded=function(_24b,_24c){
if(ravegeo.internal.Environment.isMac&&ravegeo.internal.Environment.isFirefox){
this._applet.resize(_24b,this._applet.height);
this._applet.resize(this._applet.width,_24c);
}
};
_1ee.initiateCreation=function(_24d){
if(!ravegeo.internal.Environment.isJavaEnabled()){
throw new Error("Java does not seem to be enabled.");
}
var map=new ravegeo.AppletMap(_24d);
};
_1ee.prototype.implementation=function(){
return "ravegeo.AppletMap";
};
_1ee.appletMaps={};
return _1ee;
})();
ravegeo.internal.AppletLayer=(function(){
var _24f=ravegeo.internal.Utilities;
var _250=function(_251,opts,_253){
this._applet=_251;
this._projector=_253;
opts=new ravegeo.LayerOptions(opts);
this._id=this._applet.newLayer(opts._serialize());
};
_250.prototype.clear=function(){
this._applet.clearGeoObjects(this._id);
};
_250.prototype.addGeoObjects=function(objs,opts){
if(typeof (opts)=="undefined"){
opts={};
}
if(typeof (opts.clear)=="undefined"){
opts.clear=false;
}
var _256="";
for(var idx in objs){
objs[idx]._project(this._projector);
_256+=objs[idx]._serialize();
}
this._applet.addGeoObjects(this._id,_256,opts.clear);
};
_250.prototype.getGeoObjectIds=function(_258){
var js=this._applet.getGeoObjectIds(this._id,_258?true:false);
return eval("("+js+")");
};
_250.prototype.getGeoObject=function(id){
var js=this._applet.getGeoObject(this._id,id);
return eval("("+js+")");
};
_250.prototype.removeGeoObjects=function(ids){
var _25d="";
for(var idx in ids){
_25d+=ids[idx].length+";"+ids[idx];
}
this._applet.removeGeoObjects(this._id,_25d);
};
_250.prototype.setVisible=function(_25f){
if(typeof (_25f)=="undefined"){
_25f=true;
}
this._applet.setLayerVisible(this._id,_25f);
};
_250.prototype.showGeoObjects=function(_260){
_260=_24f.getInteger(_260);
this._applet.showGeoObjects(this._id,_260);
};
_250.prototype.highlightGeoObject=function(id,_262){
if(typeof (_262)=="undefined"){
_262={};
}
if(typeof (_262.center)=="undefined"){
_262.center="";
}
if(typeof (_262.showText)=="undefined"){
_262.showText=false;
}
if(typeof (_262.showHighlight)=="undefined"){
_262.showHighlight=false;
}
this._applet.highlightGeoObject(this._id,id,_262.center,_262.showText,_262.showHighlight);
};
_250.prototype.moveGeoObject=function(id,_264,_265){
_264=_24f.getFloat(_264,0);
_265=_24f.getFloat(_265,0);
this._applet.moveGeoObject(this._id,id,_264,_265);
};
_250.prototype.pickGeoObjectIds=function(x,y){
x=_24f.getFloat(x);
y=_24f.getFloat(y);
var js=this._applet.pickGeoObjectIds(this._id,x,y);
return eval("("+js+")");
};
_250.prototype.setArrangeGeoObjects=function(_269){
this._applet.setArrangeGeoObjects(this._id,_269);
};
return _250;
})();
ravegeo.internal.Canvas=(function(){
var _26a="http://www.w3.org/TR/SVG11/feature#SVG";
var _26b=(document.implementation&&(document.implementation.hasFeature("org.w3c.svg","1.0")||document.implementation.hasFeature(_26a,"1.1")||document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Shape","1.0")));
function SVGCanvas(_26c,_26d){
this._element=document.createElementNS(SVGCanvas.xmlns,"svg");
this._element.setAttributeNS(null,"width",_26c);
this._element.setAttributeNS(null,"height",_26d);
this._style={strokeColor:"#000000"};
}
SVGCanvas.xmlns="http://www.w3.org/2000/svg";
SVGCanvas.buildStyleString=function(_26e){
var _26f="fill:"+(_26e.fillColor||"none")+";";
if(typeof (_26e.fillOpacity)!="undefined"){
_26f+="fill-opacity:"+_26e.fillOpacity+";";
}
_26f+="stroke:"+(_26e.strokeColor||"none")+";";
if(typeof (_26e.strokeOpacity)!="undefined"){
_26f+="stroke-opacity:"+_26e.strokeOpacity+";";
}
if(typeof (_26e.strokeWidth)!="undefined"){
_26f+="stroke-width:"+_26e.strokeWidth+";";
}
return _26f;
};
SVGCanvas.createPoly=function(_270,_271,type,_273){
var poly=document.createElementNS(SVGCanvas.xmlns,type);
var _275="";
for(var i in _270){
_275+=_270[i]+","+_271[i]+" ";
}
poly.setAttributeNS(null,"points",_275);
poly.setAttributeNS(null,"style",SVGCanvas.buildStyleString(_273));
return poly;
};
SVGCanvas.prototype.getElement=function(){
return this._element;
};
SVGCanvas.prototype.setStyle=function(_277){
this._style=_277;
};
SVGCanvas.prototype.drawCircle=function(cx,cy,_27a,_27b){
_27b=_27b||this._style;
var _27c=document.createElementNS(SVGCanvas.xmlns,"circle");
_27c.setAttributeNS(null,"cx",cx);
_27c.setAttributeNS(null,"cy",cy);
_27c.setAttributeNS(null,"r",_27a);
_27c.setAttributeNS(null,"style",SVGCanvas.buildStyleString(_27b));
this._element.appendChild(_27c);
};
SVGCanvas.prototype.drawOval=function(x,y,_27f,_280,_281){
_281=_281||this._style;
var _282=document.createElementNS(SVGCanvas.xmlns,"ellipse");
_282.setAttributeNS(null,"cx",x+_27f/2);
_282.setAttributeNS(null,"cy",y+_280/2);
_282.setAttributeNS(null,"rx",_27f/2);
_282.setAttributeNS(null,"ry",_280/2);
_282.setAttributeNS(null,"style",SVGCanvas.buildStyleString(_281));
this._element.appendChild(_282);
};
SVGCanvas.prototype.drawPolygon=function(_283,_284,_285){
_285=_285||this._style;
this._element.appendChild(SVGCanvas.createPoly(_283,_284,"polygon",_285));
};
SVGCanvas.prototype.drawPolyline=function(_286,_287,_288){
_288=_288||this._style;
this._element.appendChild(SVGCanvas.createPoly(_286,_287,"polyline",_288));
};
SVGCanvas.prototype.drawRect=function(x,y,_28b,_28c,_28d){
_28d=_28d||this._style;
var rect=document.createElementNS(SVGCanvas.xmlns,"rect");
rect.setAttributeNS(null,"x",x);
rect.setAttributeNS(null,"y",y);
rect.setAttributeNS(null,"width",_28b);
rect.setAttributeNS(null,"height",_28c);
if(typeof (_28d.cornerRadius)!="undefined"){
var r=(_28c>_28b)?_28b*_28d.cornerRadius:_28c*_28d.cornerRadius;
rect.setAttributeNS(null,"rx",r);
rect.setAttributeNS(null,"ry",r);
}
rect.setAttributeNS(null,"style",SVGCanvas.buildStyleString(_28d));
this._element.appendChild(rect);
};
var _290=document.namespaces;
if(_290&&!_26b){
var _291=function(_292){
return document.createElement("<ivml:"+_292+" class=\"ivml\">");
};
document.createStyleSheet().addRule(".ivml","behavior:url(#default#VML)");
try{
if(!document.namespaces.ivml){
document.namespaces.add("ivml","urn:schemas-microsoft-com:vml");
}
}
catch(e){
_291=function(_293){
return document.createElement("<"+_293+" xmlns=\"urn:schemas-microsoft.com:vml\" class=\"ivml\">");
};
}
}
function VMLCanvas(_294,_295){
var _296=_291("group");
_296.style.position="absolute";
_296.style.top="0px";
_296.style.left="0px";
_296.style.width=_294+"px";
_296.style.height=_295+"px";
_296.coordsize=_294+" "+_295;
_296.coordorigin="1 1";
this._element=_296;
this._style={strokeColor:"#000000"};
}
VMLCanvas.createFillElement=function(_297){
var fill=_291("fill");
if(typeof (_297.fillColor)!="undefined"){
fill.color=_297.fillColor;
if(typeof (_297.fillOpacity)!="undefined"){
fill.opacity=_297.fillOpacity;
}
}else{
fill.on=false;
}
return fill;
};
VMLCanvas.createStrokeElement=function(_299){
var _29a=_291("stroke");
if(typeof (_299.strokeColor)!="undefined"){
_29a.color=_299.strokeColor;
if(typeof (_299.strokeOpacity)!="undefined"){
_29a.opacity=_299.strokeOpacity;
}
if(typeof (_299.strokeWidth)!="undefined"){
_29a.weight=_299.strokeWidth+"px";
}
}else{
_29a.on=false;
}
return _29a;
};
VMLCanvas.prototype.getElement=function(){
return this._element;
};
VMLCanvas.prototype.setStyle=function(_29b){
this._style=_29b;
};
VMLCanvas.prototype.drawCircle=function(cx,cy,_29e,_29f){
_29f=_29f||this._style;
this.drawOval(cx-_29e,cy-_29e,_29e*2,_29e*2,_29f);
};
VMLCanvas.prototype.drawOval=function(x,y,_2a2,_2a3,_2a4){
_2a4=_2a4||this._style;
var oval=_291("oval");
oval.style.position="absolute";
oval.style.left=x;
oval.style.top=y;
oval.style.width=(_2a2+1);
oval.style.height=(_2a3+1);
oval.position="0 0";
oval.size=_2a2+" "+_2a3;
oval.appendChild(VMLCanvas.createFillElement(_2a4));
oval.appendChild(VMLCanvas.createStrokeElement(_2a4));
this._element.appendChild(oval);
};
VMLCanvas.prototype.drawPolyline=function(_2a6,_2a7,_2a8){
_2a8=_2a8||this._style;
var line=_291("polyline");
line.style.position="absolute";
var _2aa="";
for(var i in _2a6){
_2aa+=_2a6[i]+" "+_2a7[i]+" ";
}
line.points=_2aa;
line.appendChild(VMLCanvas.createFillElement(_2a8));
var _2ac=VMLCanvas.createStrokeElement(_2a8);
_2ac.joinstyle="miter";
line.appendChild(_2ac);
this._element.appendChild(line);
};
VMLCanvas.prototype.drawPolygon=function(_2ad,_2ae,_2af){
var _2b0=[];
var _2b1=[];
_2b0.length=_2b1.length=_2ad.length+1;
for(var i in _2ad){
_2b0[i]=_2ad[i];
_2b1[i]=_2ae[i];
}
_2b0[_2ad.length]=_2ad[0];
_2b1[_2ad.length]=_2ae[0];
this.drawPolyline(_2b0,_2b1,_2af);
};
VMLCanvas.prototype.drawRect=function(x,y,_2b5,_2b6,_2b7){
_2b7=_2b7||this._style;
var rect=_291("roundrect");
rect.style.position="absolute";
rect.style.left=x;
rect.style.top=y;
rect.style.width=(_2b5+1);
rect.style.height=(_2b6+1);
rect.arcsize=_2b7.cornerRadius||0;
rect.appendChild(VMLCanvas.createFillElement(_2b7));
var _2b9=VMLCanvas.createStrokeElement(_2b7);
_2b9.joinstyle="miter";
rect.appendChild(_2b9);
this._element.appendChild(rect);
};
function CanvasCanvas(_2ba,_2bb){
var _2bc=document.createElement("canvas");
_2bc.setAttribute("width",_2ba);
_2bc.setAttribute("height",_2bb);
this._element=_2bc;
this._style={strokeColor:"#000000"};
if(_2bc.getContext){
this._canvas=_2bc.getContext("2d");
}else{
throw new Error("No implementation supported.");
}
}
CanvasCanvas.createPolyPath=function(_2bd,_2be,_2bf,_2c0){
_2bf.beginPath();
_2bf.moveTo(_2bd[0],_2be[0]);
for(var i=1;i<_2bd.length;++i){
_2bf.lineTo(_2bd[i],_2be[i]);
}
if(_2c0){
_2bf.closePath();
}
};
CanvasCanvas.drawPoly=function(_2c2,_2c3,_2c4,_2c5,_2c6){
if(typeof (_2c5.fillColor)!="undefined"){
CanvasCanvas.createPolyPath(_2c2,_2c3,_2c4,_2c6);
_2c4.fillStyle=_2c5.fillColor;
_2c4.globalAlpha=(typeof (_2c5.fillOpacity)!="undefined")?_2c5.fillOpacity:1;
_2c4.fill();
}
if(typeof (_2c5.strokeColor)!="undefined"){
CanvasCanvas.createPolyPath(_2c2,_2c3,_2c4,_2c6);
_2c4.strokeStyle=_2c5.strokeColor;
_2c4.globalAlpha=(typeof (_2c5.strokeOpacity)!="undefined")?_2c5.strokeOpacity:1;
_2c4.lineWidth=(typeof (_2c5.strokeWidth)!="undefined")?_2c5.strokeWidth:1;
_2c4.stroke();
}
};
CanvasCanvas.prototype.getElement=function(){
return this._element;
};
CanvasCanvas.prototype.setStyle=function(_2c7){
this._style=_2c7;
};
CanvasCanvas.prototype.drawCircle=function(cx,cy,_2ca,_2cb){
_2cb=_2cb||this._style;
var _2cc=this._canvas;
_2cc.beginPath();
_2cc.arc(cx,cy,_2ca,0,2*Math.PI,true);
if(typeof (_2cb.fillColor)!="undefined"){
_2cc.beginPath();
_2cc.arc(cx,cy,_2ca,0,2*Math.PI,true);
_2cc.fillStyle=_2cb.fillColor;
_2cc.globalAlpha=(typeof (_2cb.fillOpacity)!="undefined")?_2cb.fillOpacity:1;
_2cc.fill();
}
if(typeof (_2cb.strokeColor)!="undefined"){
_2cc.beginPath();
_2cc.arc(cx,cy,_2ca,0,2*Math.PI,true);
_2cc.strokeStyle=_2cb.strokeColor;
_2cc.globalAlpha=(typeof (_2cb.strokeOpacity)!="undefined")?_2cb.strokeOpacity:1;
_2cc.lineWidth=(typeof (_2cb.strokeWidth)!="undefined")?_2cb.strokeWidth:1;
_2cc.stroke();
}
};
CanvasCanvas.prototype.drawOval=function(x,y,_2cf,_2d0,_2d1){
var _2d2=this._canvas;
if(_2cf<0.01||_2d0<0.01){
return;
}
var cx=x+_2cf/2;
var cy=(y+_2d0/2)*_2cf/_2d0;
_2d2.save();
_2d2.scale(1,_2d0/_2cf);
this.drawCircle(cx,cy,_2cf/2,_2d1);
_2d2.restore();
};
CanvasCanvas.prototype.drawPolyline=function(_2d5,_2d6,_2d7){
_2d7=_2d7||this._style;
var _2d8=this._canvas;
CanvasCanvas.drawPoly(_2d5,_2d6,_2d8,_2d7,false);
};
CanvasCanvas.prototype.drawPolygon=function(_2d9,_2da,_2db){
_2db=_2db||this._style;
var _2dc=this._canvas;
CanvasCanvas.drawPoly(_2d9,_2da,_2dc,_2db,true);
};
CanvasCanvas.prototype.drawRect=function(x,y,_2df,_2e0,_2e1){
_2e1=_2e1||this._style;
var _2e2=this._canvas;
if(typeof (_2e1.fillColor)!="undefined"){
_2e2.fillStyle=_2e1.fillColor;
_2e2.globalAlpha=(typeof (_2e1.fillOpacity)!="undefined")?_2e1.fillOpacity:1;
_2e2.fillRect(x,y,_2df,_2e0);
}
if(typeof (_2e1.strokeColor)!="undefined"){
_2e2.strokeStyle=_2e1.strokeColor;
_2e2.globalAlpha=(typeof (_2e1.strokeOpacity)!="undefined")?_2e1.strokeOpacity:1;
_2e2.lineWidth=(typeof (_2e1.strokeWidth)!="undefined")?_2e1.strokeWidth:1;
_2e2.strokeRect(x,y,_2df,_2e0);
}
};
function createCanvas(_2e3,_2e4,_2e5){
if(_2e5){
var _2e6=_2e5.toLowerCase();
if(_2e6=="svg"){
return new SVGCanvas(_2e3,_2e4);
}else{
if(_2e6=="vml"){
return new VMLCanvas(_2e3,_2e4);
}else{
if(_2e6=="canvas"){
return new CanvasCanvas(_2e3,_2e4);
}
}
}
throw new Error("No such implementation.");
}else{
if(_26b){
return new SVGCanvas(_2e3,_2e4);
}else{
if(_290){
return new VMLCanvas(_2e3,_2e4);
}
}
return new CanvasCanvas(_2e3,_2e4);
}
}
return {create:createCanvas};
})();
ravegeo.internal.MapAnimator=(function(){
var _2e7=25;
var _2e8=2000;
var _2e9=function(map){
this._map=map;
};
_2e9.prototype._animateTo=function(_2eb,_2ec){
var pfc=this._map._getPixelsFromCenter(_2eb-this._map._geoX,_2ec-this._map._geoY);
var _2ee=Math.sqrt(pfc.x*pfc.x+pfc.y*pfc.y)*1.25;
if(this._lastTimeout){
clearTimeout(this._lastTimeout);
}
if(_2ee<_2e8&&_2ee>_2e7){
if(!this._myAnimatorFunc){
var self=this;
this._myAnimatorFunc=function(){
self._doAnimate();
};
}
this._animDestX=-pfc.x;
this._animDestY=pfc.y;
this._animDoneX=0;
this._animDoneY=0;
this._animTime=_2ee;
this._animStart=new Date().getTime();
this._myAnimatorFunc();
}else{
this._map._setGeoCenter(_2eb,_2ec);
}
};
_2e9.prototype._stop=function(){
if(this._lastTimeout){
clearTimeout(this._lastTimeout);
this._lastTimeout=null;
}
};
_2e9.prototype._doAnimate=function(){
var _2f0=(new Date().getTime()-this._animStart)/this._animTime;
if(_2f0>1){
this._map._interactionEnded();
delete this._lastTimeout;
}else{
var doX=Math.round(this._animDestX*_2f0-this._animDoneX);
var doY=Math.round(this._animDestY*_2f0-this._animDoneY);
this._animDoneX+=doX;
this._animDoneY+=doY;
this._map._pixMove(doX,doY);
this._lastTimeout=setTimeout(this._myAnimatorFunc,10);
}
};
return _2e9;
})();
ravegeo.TiledMap=(function(){
var _2f3=ravegeo.internal.Utilities;
var _2f4=250;
var _2f5=null;
var _2f6=0;
var _2f7=0;
var _2f8=0;
var _2f9=0;
var _2fa=0;
var _2fb=false;
var _2fc=function(_2fd){
this._url=_2fd.url;
this._name=_2fd.name;
this._key=_2fd.key;
this._tileCacherUrl=_2fd._tileServiceUrl+"GetTile?name="+_2fd._tileServiceName;
this._callback=_2fd.callback;
this._mapContainer=_2fd.mapContainer;
this._expireDate=_2fd._expireDate;
this._loadingImageUrl=this._url+"GetLoadingImage?name="+this._name;
if(typeof _2fd.interactionDelay!="undefined"){
this._interactionDelay=_2f3.getInteger(_2fd.interactionDelay);
if(this._interactionDelay>ravegeo.internal.MapCommons.maxInteractionDelay||this._interactionDelay<0){
this._interactionDelay=ravegeo.internal.MapCommons.maxInteractionDelay;
}
}else{
this._interactionDelay=ravegeo.internal.MapCommons.defaultInteractionDelay;
}
var _2fe=_2fd.tilesConfiguration;
this._originX=_2fe.originX;
this._originY=_2fe.originY;
this._nominalToMeter=_2fe.nominalToMeter;
this._tileWidthPix=_2fe.tileWidthPix;
this._tileHeightPix=_2fe.tileHeightPix;
this._zoomStepExtents=_2fe.zoomStepExtents;
if(_2fe.projection=="mercator"){
this._projector=ravegeo.internal.MercatorProjector;
}else{
this._projector=ravegeo.internal.PlateCarreProjector;
}
var geoX=this._originX;
var geoY=this._originY;
this._zoomStep=0;
if(_2fd.initialViewArea){
var iva=_2fd.initialViewArea;
geoX=_2f3.getFloat(iva.x);
geoY=_2f3.getFloat(iva.y);
var _302=this._projector.forward(iva.x,iva.y);
geoX=_302[0];
geoY=_302[1];
this._zoomStep=this._scale2ClosestZoomStep(iva.scale);
}
this._layers={};
this._nextLayerId=0;
_2f3.removeChildren(this._mapContainer);
this._outerDiv=document.createElement("div");
var _303=this._outerDiv;
_2f3.setStyle(_303,"position:absolute;top:0px;left:0px;overflow:hidden;cursor:move;");
this._tileLayer=new ravegeo.internal.TileLayer(this);
var _304=document.createElement("div");
_2f3.setStyle(_304,"width:100%;height:100%;position:relative;overflow:hidden;");
_304.appendChild(_303);
var _305=_2fe.copyright;
if(typeof (_2fd._copyright)!="undefined"){
_305=_2fd._copyright;
}
if(_305){
var _306=document.createElement("div");
_306.innerHTML=_305;
_2f3.setStyle(_306,"color:black;position:absolute;left:4px;bottom:4px;z-index:1000;cursor:text;");
_303.appendChild(_306);
}
this._layout(geoX,geoY);
this._mapContainer.appendChild(_304);
this._animator=new ravegeo.internal.MapAnimator(this);
this._toolEventsDispatcher=new ravegeo.internal.ToolEventsDispatcher(this);
this._panningEnabled=true;
this._dblClickZoomingEnabled=true;
this.addTool(ravegeo.tools.internal.DeprecatedCallbacksTool);
this.addTool(ravegeo.tools.internal.SymbolHoverTool);
_2fd.callback.mapLoaded(this);
_2f3.addEvent(document,"mouseup",endMapInteraction,false);
};
_2fc.initiateCreation=function(_307){
ravegeo.internal.MapCommons._fixParams(_307);
var url=_307.url+"GetHandle?name="+_307.name;
if(_307.key){
url+="&key="+_307.key;
}
url+="&referer="+encodeURIComponent(window.location);
ravegeo.io.Ajax.asyncJsonRequest(url,function(_309){
initiateCreationStep2(_307,_309);
},ravegeo.internal.MapCommons.getHandleTimeout);
};
function initiateCreationStep2(_30a,_30b){
if(_30b.error){
errorOccurredDuringInit(_30b.error,_30a);
return;
}
_30a._copyright=_30b.copyright;
if(_30b.tileServiceUrl){
_30a._tileServiceUrl=_30b.tileServiceUrl;
}else{
_30a._tileServiceUrl=_30a.url;
}
if(_30b.tileServiceName){
_30a._tileServiceName=_30b.tileServiceName;
}else{
_30a._tileServiceName=_30a.name;
}
_30a._expireDate=new Date();
_30a._expireDate.setTime(_30a._expireDate.getTime()+_30b.timeout);
ravegeo.io.Ajax.asyncJsonRequest(_30a._tileServiceUrl+"GetTilesInfo?name="+_30a._tileServiceName,function(_30c){
initiateCreationStep3(_30a,_30c);
},ravegeo.internal.MapCommons.getTilesInfoTimeout);
}
function initiateCreationStep3(_30d,_30e){
if(_30e.error){
errorOccurredDuringInit(_30e.error,_30d);
return;
}
_30d.tilesConfiguration=_30e;
var temp=new _2fc(_30d);
}
function errorOccurredDuringInit(_310,_311){
errorOccurred(_310.code,_310.message,_311.mapContainer,_311.callback);
}
function errorOccurred(code,_313,_314,_315){
if(_314){
_314.innerHTML="Fatal error: "+code+"<br>"+_313;
}
if(_315&&_315.errorOccurred){
_315.errorOccurred(code,_313);
}
}
_2fc.prototype._layout=function(_316,_317){
this._mapWidth=this._mapContainer.clientWidth;
this._mapHeight=this._mapContainer.clientHeight;
this._outerDiv.style.width=this._mapWidth+"px";
this._outerDiv.style.height=this._mapHeight+"px";
this._geoX=_316;
this._geoY=_317;
this._tileLayer._layout(_316,_317,this._mapWidth,this._mapHeight);
for(var _318 in this._layers){
var _319=this._layers[_318];
_319._layout(_316,_317,this._mapWidth,this._mapHeight);
}
};
_2fc.prototype._updateExpireDate=function(){
if(this._expireDate<new Date()){
var self=this;
var url=this._url+"GetHandle?name="+this._name;
if(this._key){
url+="&key="+this._key;
}
ravegeo.io.Ajax.asyncJsonRequest(url,function(_31c){
if(_31c.error){
errorOccurred(_31c.error.code,_31c.error.message,self._mapContainer,self._callback);
return;
}
var _31d=_31c.timeout;
self._expireDate=new Date();
self._expireDate.setTime(self._expireDate.getTime()+_31d);
},ravegeo.internal.MapCommons.getHandleTimeout);
}
};
_2fc.prototype._getPixelsFromCenter=function(geoX,geoY){
var _320=this._tileWidthPix/this._zoomStepExtents[this._zoomStep][0];
var _321=this._tileHeightPix/this._zoomStepExtents[this._zoomStep][1];
return {x:Math.round(geoX*_320),y:Math.round(geoY*_321)};
};
_2fc.prototype._interactionEnded=function(){
if(this._cbTimeout){
clearTimeout(this._cbTimeout);
}
var self=this;
this._cbTimeout=setTimeout(function(){
self._updateExpireDate();
if(self._callback&&self._callback.interactionEnded){
self._callback.interactionEnded(self);
}
self._cbTimeout=null;
},this._interactionDelay);
};
_2fc.prototype._setGeoCenter=function(_323,_324,_325){
var _326=false;
if(typeof (_325)!="undefined"){
_326=this._changeZoomStep(_325);
}
if(this._geoX!=_323||this._geoY!=_324||_326){
this._geoX=_323;
this._geoY=_324;
this._tileLayer._setGeoCenter(_323,_324);
for(var _327 in this._layers){
this._layers[_327]._setGeoCenter(_323,_324);
}
}
};
_2fc.prototype._changeZoomStep=function(zs){
if(zs>=0&&zs<this._zoomStepExtents.length&&zs!=this._zoomStep){
this._zoomStep=zs;
return true;
}
return false;
};
_2fc.prototype._pixMove=function(x,y){
this._geoX-=x*(this._zoomStepExtents[this._zoomStep][0]/this._tileWidthPix);
this._geoY+=y*(this._zoomStepExtents[this._zoomStep][1]/this._tileHeightPix);
this._tileLayer._pixMove(x,y);
for(var _32b in this._layers){
var _32c=this._layers[_32b];
_32c._pixMove(x,y);
}
};
_2fc.prototype._zoomStep2Scale=function(zs){
return Math.round(this._zoomStepExtents[zs][1]*this._nominalToMeter/(this._tileHeightPix*0.0003));
};
_2fc.prototype._scale2ClosestZoomStep=function(_32e){
var _32f=this._zoomStep2Scale(0);
var _330=0;
for(var i=1;i<this._zoomStepExtents.length;++i){
var _332=this._zoomStep2Scale(i);
if(Math.abs(_332-_32e)<Math.abs(_32f-_32e)){
_32f=_332;
_330=i;
}else{
break;
}
}
return _330;
};
_2fc.prototype._getGeoWidth=function(_333){
return this._zoomStepExtents[_333][0]/this._tileWidthPix*this._mapWidth;
};
_2fc.prototype._getGeoHeight=function(_334){
return this._zoomStepExtents[_334][1]/this._tileHeightPix*this._mapHeight;
};
_2fc.prototype.getCenterX=function(){
var _335=this._projector.reverse(this._geoX,this._geoY);
return _335[0];
};
_2fc.prototype.getCenterY=function(){
var _336=this._projector.reverse(this._geoX,this._geoY);
return _336[1];
};
_2fc.prototype.getScale=function(){
return this._zoomStep2Scale(this._zoomStep);
};
_2fc.prototype.geoToDisplay=function(_337){
_337=_2f3.getFloatPoint(_337);
var _338=this._projector.forward(_337.x,_337.y);
_337={x:_338[0],y:_338[1]};
var _339=this._getGeoBounds(this._zoomStep);
var _33a={width:_339.xMax-_339.xMin,height:_339.yMax-_339.yMin};
var _33b={x:this.getWidth()/_33a.width,y:this.getHeight()/_33a.height};
var _33c=_337.x-_339.xMin;
var _33d=_339.yMax-_337.y;
return {x:_33c*_33b.x,y:_33d*_33b.y};
};
_2fc.prototype.displayToGeo=function(_33e){
_33e=_2f3.getIntegerPoint(_33e);
var _33f=this._getGeoBounds(this._zoomStep);
var _340={width:_33f.xMax-_33f.xMin,height:_33f.yMax-_33f.yMin};
var _341={x:_33f.xMin+_33e.x*_340.width/this.getWidth(),y:_33f.yMin+(this.getHeight()-_33e.y)*_340.height/this.getHeight()};
var _342=this._projector.reverse(_341.x,_341.y);
return {x:_342[0],y:_342[1]};
};
_2fc.prototype.getGeoBounds=function(){
var rect=this._getGeoBounds(this._zoomStep);
var pmin=this._projector.reverse(rect.xMin,rect.yMin);
var pmax=this._projector.reverse(rect.xMax,rect.yMax);
rect.xMin=pmin[0];
rect.yMin=pmin[1];
rect.xMax=pmax[0];
rect.yMax=pmax[1];
return rect;
};
_2fc.prototype._getGeoBounds=function(_346){
var _347=this._getGeoWidth(_346);
var _348=this._getGeoHeight(_346);
return {xMin:this._geoX-_347/2,yMin:this._geoY-_348/2,xMax:this._geoX+_347/2,yMax:this._geoY+_348/2};
};
_2fc.prototype.setGeoBounds=function(_349){
_349=_2f3.getFloatValuesObject(_349);
var minp=this._projector.forward(_349.xMin,_349.yMin);
var maxp=this._projector.forward(_349.xMax,_349.yMax);
_349={xMin:minp[0],yMin:minp[1],xMax:maxp[0],yMax:maxp[1]};
var cx=(_349.xMax+_349.xMin)/2;
var cy=(_349.yMax+_349.yMin)/2;
var _34e=this._getFittingZoomStep(Math.abs(_349.xMax-_349.xMin),Math.abs(_349.yMax-_349.yMin));
this._setGeoCenter(cx,cy,_34e);
};
_2fc.prototype.getWidth=function(){
return this._mapContainer.clientWidth;
};
_2fc.prototype.getHeight=function(){
return this._mapContainer.clientHeight;
};
_2fc.prototype._getFittingZoomStep=function(_34f,_350){
for(var i=0;i<this._zoomStepExtents.length;++i){
var _352=this._getGeoWidth(i);
var _353=this._getGeoHeight(i);
if(_34f<=_352&&_350<=_353){
return i;
}
}
return this._zoomStepExtents.length-1;
};
_2fc.prototype.getRecommendedScales=function(){
var ret=[];
for(var zs in this._zoomStepExtents){
ret[zs]=this._zoomStep2Scale(zs);
}
return ret;
};
_2fc.prototype.setViewArea=function(x,y,_358){
x=_2f3.getFloat(x);
y=_2f3.getFloat(y);
_358=_2f3.getInteger(_358);
var _359=this._projector.forward(x,y);
var _35a=this._scale2ClosestZoomStep(_358);
this._setGeoCenter(_359[0],_359[1],_35a);
};
_2fc.prototype.zoom=function(_35b){
_35b=_2f3.getFloat(_35b);
if(_35b<1){
this._setGeoCenter(this._geoX,this._geoY,this._zoomStep-1);
}else{
if(_35b>1){
this._setGeoCenter(this._geoX,this._geoY,this._zoomStep+1);
}
}
};
_2fc.prototype.zoomTo=function(_35c){
_35c=_2f3.getInteger(_35c);
var _35d=this._scale2ClosestZoomStep(_35c);
this._setGeoCenter(this._geoX,this._geoY,_35d);
};
_2fc.prototype.pan=function(dx,dy){
dx=_2f3.getFloat(dx);
dy=_2f3.getFloat(dy);
var _360=this._zoomStepExtents[this._zoomStep][0]/this._tileWidthPix;
var _361=this._zoomStepExtents[this._zoomStep][1]/this._tileHeightPix;
this._animator._animateTo(this._geoX+_360*this._mapWidth*dx,this._geoY+_360*this._mapHeight*dy);
};
_2fc.prototype._showBounds=function(_362,_363,_364){
var _365=this._scale2ClosestZoomStep(_364);
if(_362.x!=Number.POSITIVE_INFINITY){
var _366=(_363.x-_362.x)*1.15;
var _367=(_363.y-_362.y)*1.15;
var i;
for(i=0;i<this._zoomStepExtents.length;++i){
var _369=this._zoomStepExtents[i][0]/this._tileWidthPix*this._mapWidth;
var _36a=this._zoomStepExtents[i][1]/this._tileHeightPix*this._mapHeight;
if(_369>_366&&_36a>_367){
break;
}
}
var _36b=_362.x+(_363.x-_362.x)/2;
var _36c=_362.y+(_363.y-_362.y)/2;
if(i>_365){
_365=i;
}
if(_365!=this._zoomStep){
this._setGeoCenter(_36b,_36c,_365);
}else{
this._animator._animateTo(_36b,_36c);
}
}else{
if(_365>this._zoomStep){
this._setGeoCenter(this._geoX,this._geoY,_365);
}
}
};
_2fc.prototype.moveTo=function(x,y,_36f){
x=_2f3.getFloat(x);
y=_2f3.getFloat(y);
_36f=_2f3.getInteger(_36f);
if(this.getScale()==_36f){
var _370=this._projector.forward(x,y);
this._animator._animateTo(_370[0],_370[1]);
}else{
this.setViewArea(x,y,_36f);
}
};
_2fc.prototype.getUpDirection=function(){
return 0;
};
_2fc.prototype.setUpDirection=function(_371){
};
_2fc.prototype.getPitch=function(){
return 90;
};
_2fc.prototype.setPitch=function(_372){
};
_2fc.prototype.resize=function(_373,_374,_375){
_373=_2f3.getInteger(_373);
_374=_2f3.getInteger(_374);
this._mapContainer.style.width=_373+"px";
this._mapContainer.style.height=_374+"px";
this._layout(this._geoX,this._geoY);
if(_375){
_375();
}
};
_2fc.prototype.newLayer=function(opts){
var _377=this._nextLayerId++;
var _378=new ravegeo.internal.GeoObjectLayer(_377,this,opts);
_378._layout(this._geoX,this._geoY,this._mapWidth,this._mapHeight);
this._layers[_377]=_378;
return _378;
};
_2fc.prototype.removeLayer=function(_379){
var _37a=_379._id;
_379._destroy();
delete this._layers[_37a];
};
_2fc.prototype.addTool=function(tool){
this._toolEventsDispatcher.addTool(tool);
};
_2fc.prototype.removeTool=function(tool){
this._toolEventsDispatcher.removeTool(tool);
};
_2fc.prototype.addControl=function(_37d){
_37d._addToTiledMap(this);
};
_2fc.prototype.removeControl=function(_37e){
_37e._removeFromTiledMap(this);
};
_2fc.prototype.setPanningEnabled=function(_37f){
this._panningEnabled=_37f;
var _380=_37f?"move":"default";
this._outerDiv.style.cursor=_380;
if(!_37f){
endMapInteraction();
}
};
_2fc.prototype.setDoubleClickZoomingEnabled=function(_381){
this._dblClickZoomingEnabled=_381;
if(!_381){
endMapInteraction();
}
};
_2fc.prototype.getLayers=function(){
return _2f3.objectToArray(this._layers);
};
_2fc.prototype._getGeoPointFromEvent=function(e){
var _383=this._getMouseCoords(e);
var dx=_383.x-_2f3.topLeftX(this._outerDiv)-this._mapWidth/2;
var dy=_383.y-_2f3.topLeftY(this._outerDiv)-this._mapHeight/2;
var x=this._geoX+dx*(this._zoomStepExtents[this._zoomStep][0]/this._tileWidthPix);
var y=this._geoY-dy*(this._zoomStepExtents[this._zoomStep][1]/this._tileHeightPix);
var _388=Array();
_388[0]=x;
_388[1]=y;
return _388;
};
_2fc.prototype._getMouseCoords=function(e){
if(this._mapContainer.style.position=="fixed"){
return {x:e.clientX,y:e.clientY};
}else{
return {x:_2f3.mouseX(e),y:_2f3.mouseY(e)};
}
};
_2fc.prototype._getPixelsFromEvent=function(e){
var _38b=this._getMouseCoords(e);
var x=_38b.x-_2f3.topLeftX(this._outerDiv);
var y=_38b.y-_2f3.topLeftY(this._outerDiv);
point=Array();
point[0]=x;
point[1]=y;
return point;
};
_2fc._mouseDown=function(e){
if(_2f3.leftButton(e)){
var map=getTargetMap(e);
map._toolEventsDispatcher.mouseDown(e);
if(map._panningEnabled){
_2f5=map;
_2f5._animator._stop();
}
_2f8=_2f6=e.clientX;
_2f9=_2f7=e.clientY;
_2f3.stopEvent(e);
}
};
_2fc._mouseMoved=function(e){
var map=getTargetMap(e);
map._toolEventsDispatcher.mouseMoved(e);
var _392=_2f5;
if(_392){
var _393=e.clientX-_2f6;
var _394=e.clientY-_2f7;
if(_393>1||_393<-1||_394>1||_394<-1){
_2f6=e.clientX;
_2f7=e.clientY;
_392._pixMove(_393,_394);
}
}
};
_2fc._mouseUp=function(e){
if(!_2f3.leftButton(e)){
return;
}
var map=getTargetMap(e);
map._toolEventsDispatcher.mouseUp(e);
var _397=_2f5;
if(_397!==null){
var _398=e.clientX-_2f6;
var _399=e.clientY-_2f7;
if(_398!=0||_399!=0){
_397._pixMove(_398,_399);
}
endMapInteraction();
}
handleMouseClicks(map,e);
};
function endMapInteraction(){
var _39a=_2f5;
if(_39a&&(_2f6!=_2f8||_2f7!=_2f9)){
_39a._interactionEnded();
}
_2f5=null;
}
function handleMouseClicks(map,e){
if(_2f8==e.clientX&&_2f9==e.clientY){
_2fa++;
if(_2fa==1){
mapClicked(map,e);
setTimeout(function(){
_2fa=0;
},_2f4);
}else{
mapDoubleClicked(map,e);
}
}
}
function mapClicked(map,e){
var targ;
if(!e){
e=window.event;
}
if(e.target){
targ=e.target;
}else{
if(e.srcElement){
targ=e.srcElement;
}
}
var map=getTargetMap(e);
map._toolEventsDispatcher.mouseClicked(e);
}
function mapDoubleClicked(_3a0,e){
var map=getTargetMap(e);
map._toolEventsDispatcher.mouseDoubleClicked(e);
if(map._dblClickZoomingEnabled){
var _3a3=map._getGeoPointFromEvent(e);
map._setGeoCenter(_3a3[0],_3a3[1],map._zoomStep-1);
}
}
_2fc._mouseWheel=function(e){
var _3a5=getTargetMap(e);
var _3a6=e.detail?e.detail:e.wheelDelta/-40;
var _3a7=getNewZoomStep(_3a5,_3a6);
var _3a8=_3a5._getGeoPointFromEvent(e);
var x=_3a8[0];
var y=_3a8[1];
var _3ab=_3a5._zoomStepExtents[_3a5._zoomStep][0]/_3a5._zoomStepExtents[_3a7][0];
var _3ac=_3a5._zoomStepExtents[_3a5._zoomStep][1]/_3a5._zoomStepExtents[_3a7][1];
var _3ad=(_3a5._geoX-x)/_3ab+x;
var _3ae=(_3a5._geoY-y)/_3ac+y;
_3a5._setGeoCenter(_3ad,_3ae,_3a7);
_2f3.stopEvent(e);
};
function getNewZoomStep(_3af,_3b0){
if(_3b0<1){
if(_3af._zoomStep>0){
return _3af._zoomStep-1;
}
}else{
if(_3b0>1){
if(_3af._zoomStepExtents.length>_3af._zoomStep+1){
return _3af._zoomStep+1;
}
}
}
return _3af._zoomStep;
}
function getTargetMap(e){
var _3b2=_2f3.getTarget(e);
if(_3b2._tile){
return _3b2._tile.owner._map;
}
}
_2fc._addMapEvents=function(_3b3){
_2f3.addEvent(_3b3,"mousedown",ravegeo.TiledMap._mouseDown,false);
_2f3.addEvent(_3b3,"dragstart",ravegeo.internal.Utilities.stopEvent,false);
_2f3.addEvent(_3b3,"mousemove",ravegeo.TiledMap._mouseMoved,false);
_2f3.addEvent(_3b3,"mouseup",ravegeo.TiledMap._mouseUp,false);
_2fc._addMapZoomEvents(_3b3);
};
_2fc._addMapZoomEvents=function(_3b4){
_2f3.addEvent(_3b4,"mousewheel",ravegeo.TiledMap._mouseWheel,false);
};
_2fc.prototype.implementation=function(){
return "ravegeo.TiledMap";
};
return _2fc;
})();
ravegeo.internal.Tile=(function(){
var Tile=function(_3b6,dtx,dty){
this.owner=_3b6;
this._dtx=dtx;
this._dty=dty;
this.img=document.createElement("img");
var img=this.img;
img.style.position="absolute";
img.style.MozUserSelect="none";
img.style.width=_3b6._tileWidthPix+"px";
img.style.height=_3b6._tileHeightPix+"px";
img.style.left=((_3b6._numberOfTiles.x/2*_3b6._tileWidthPix)+this._dtx*_3b6._tileWidthPix)+"px";
img.style.top=((_3b6._numberOfTiles.y/2*_3b6._tileHeightPix)-(this._dty+1)*_3b6._tileHeightPix)+"px";
img.oncontextmenu=function(e){
return false;
};
img._tile=this;
ravegeo.TiledMap._addMapEvents(img);
};
function onImageLoad(){
var _3bb=this._tile;
this._tile=null;
_3bb.img.src=_3bb.newImage.src;
_3bb.img.onload=null;
}
Tile.prototype._updateImage=function(){
var _3bc=this.owner._map._tileCacherUrl;
_3bc+="&tx="+(this._dtx+this.owner._ctx);
_3bc+="&ty="+(-this._dty+this.owner._cty);
_3bc+="&zoomStep="+this.owner._map._zoomStep;
if(this.newImage){
this.newImage.onload=null;
this.newImage.src=null;
this.newImage._tile=null;
}
if(this.newImage){
this.newImage.onload=null;
}
this.newImage=new Image(5,5);
this.newImage.src=_3bc;
if(!ravegeo.internal.Utilities.isImageLoaded(this.newImage)){
this.newImage._tile=this;
this.img.src=this.owner._map._loadingImageUrl;
ravegeo.internal.Utilities.onImageLoaded(this.newImage,onImageLoad);
this.newImage.src=_3bc;
}else{
this.img.src=_3bc;
}
};
Tile.prototype._position=function(){
this.img.style.left=(this._dtx*this.owner._tileWidthPix)+"px";
this.img.style.top=(this._dty*this.owner._tileHeightPix)+"px";
};
Tile.prototype._wrap=function(dtx,dty){
this._dtx+=dtx;
this._dty+=dty;
var _3bf=false;
var _3c0=this.owner._allowedTilePositions;
if(this._dtx<_3c0.min.x){
this._dtx+=this.owner._numberOfTiles.x;
_3bf=true;
}else{
if(this._dtx>_3c0.max.x){
this._dtx-=this.owner._numberOfTiles.x;
_3bf=true;
}
}
if(this._dty<_3c0.min.y){
this._dty+=this.owner._numberOfTiles.y;
_3bf=true;
}else{
if(this._dty>_3c0.max.y){
this._dty-=this.owner._numberOfTiles.y;
_3bf=true;
}
}
if(_3bf){
this._updateImage();
}
this._position();
};
return Tile;
})();
ravegeo.internal.TileLayer=(function(){
var _3c1=function(map){
this._map=map;
this._tileWidthPix=map._tileWidthPix;
this._tileHeightPix=map._tileHeightPix;
this._myDiv=document.createElement("div");
ravegeo.internal.Utilities.setStyle(this._myDiv,"position:absolute;overflow:visible;width:10px;height:10px;");
map._outerDiv.appendChild(this._myDiv);
};
_3c1.prototype._layout=function(_3c3,_3c4,_3c5,_3c6){
this._numberOfTiles={x:Math.ceil(_3c5/this._tileWidthPix)+1,y:Math.ceil(_3c6/this._tileHeightPix)+1};
var _3c7=_3c5/2;
var _3c8=_3c6/2;
this._wrapLimit={min:{},max:{}};
if(this._numberOfTiles.x%2==0){
this._wrapLimit.max.x=(this._tileWidthPix*this._numberOfTiles.x)/2-_3c7;
this._wrapLimit.min.x=-this._wrapLimit.max.x;
}else{
this._wrapLimit.max.x=(this._tileWidthPix*(this._numberOfTiles.x-1))/2-_3c7;
this._wrapLimit.min.x=-this._wrapLimit.max.x-this._tileWidthPix;
}
if(this._numberOfTiles.y%2==0){
this._wrapLimit.max.y=(this._tileHeightPix*this._numberOfTiles.y)/2-_3c8;
this._wrapLimit.min.y=-this._wrapLimit.max.y;
}else{
this._wrapLimit.max.y=(this._tileHeightPix*(this._numberOfTiles.y-1))/2-_3c8;
this._wrapLimit.min.y=-this._wrapLimit.max.y-this._tileHeightPix;
}
this._originalLeft=Math.floor(_3c5/2);
this._originalTop=Math.floor(_3c6/2);
this._tiles=[];
ravegeo.internal.Utilities.removeChildren(this._myDiv);
var _3c9=-Math.floor(this._numberOfTiles.x/2);
var _3ca=-Math.floor(this._numberOfTiles.y/2);
this._allowedTilePositions={min:{x:_3c9,y:_3ca},max:{x:_3c9+this._numberOfTiles.x-1,y:_3ca+this._numberOfTiles.y-1}};
for(var i=this._allowedTilePositions.min.x;i<=this._allowedTilePositions.max.x;++i){
for(var j=this._allowedTilePositions.min.y;j<=this._allowedTilePositions.max.y;++j){
var tile=new ravegeo.internal.Tile(this,i,j);
this._tiles[this._tiles.length]=tile;
this._myDiv.appendChild(tile.img);
}
}
this._positionAllTiles(_3c3,_3c4);
};
_3c1.prototype._setGeoCenter=function(_3ce,_3cf){
this._positionAllTiles(_3ce,_3cf);
};
_3c1.prototype._positionAllTiles=function(_3d0,_3d1){
var pfc=this._map._getPixelsFromCenter(this._map._originX-_3d0,this._map._originY-_3d1);
this._dx=pfc.x%this._tileWidthPix;
this._dy=-pfc.y%this._tileHeightPix;
if(pfc.x<0){
this._ctx=-Math.ceil(pfc.x/this._tileWidthPix);
}else{
this._ctx=-Math.floor(pfc.x/this._tileWidthPix);
}
if(pfc.y<0){
this._cty=-Math.ceil(pfc.y/this._tileHeightPix)-1;
}else{
this._cty=-Math.floor(pfc.y/this._tileHeightPix)-1;
}
for(var i=0;i<this._tiles.length;++i){
this._tiles[i]._updateImage();
this._tiles[i]._position();
}
this._wrapIfNecessary();
this._positionDiv();
this._map._interactionEnded();
};
_3c1.prototype._positionDiv=function(){
this._myDiv.style.left=(this._originalLeft+this._dx)+"px";
this._myDiv.style.top=(this._originalTop+this._dy)+"px";
};
_3c1.prototype._pixMove=function(x,y){
this._dx+=x;
this._dy+=y;
this._wrapIfNecessary();
this._positionDiv();
};
_3c1.prototype._wrapIfNecessary=function(){
if(this._shouldWrap()){
var dtx=0;
if(this._dx<this._wrapLimit.min.x){
dtx=Math.min(Math.ceil(this._dx/this._tileWidthPix),-1);
}else{
if(this._dx>this._wrapLimit.max.x){
dtx=Math.max(Math.ceil(this._dx/this._tileWidthPix),1);
}
}
var dty=0;
if(this._dy<this._wrapLimit.min.y){
dty=Math.min(Math.ceil(this._dy/this._tileHeightPix),-1);
}else{
if(this._dy>this._wrapLimit.max.y){
dty=Math.max(Math.ceil(this._dy/this._tileHeightPix),1);
}
}
this._wrap(dtx,dty);
}
};
_3c1.prototype._shouldWrap=function(){
var _3d8=this._dx>this._wrapLimit.max.x||this._dx<this._wrapLimit.min.x;
var _3d9=this._dy>this._wrapLimit.max.y||this._dy<this._wrapLimit.min.y;
return _3d8||_3d9;
};
_3c1.prototype._wrap=function(dtx,dty){
this._ctx-=dtx;
this._cty+=dty;
this._dx-=this._tileWidthPix*dtx;
this._dy-=this._tileHeightPix*dty;
for(var i=0;i<this._tiles.length;++i){
this._tiles[i]._wrap(dtx,dty);
}
};
return _3c1;
})();
ravegeo.internal.GeoObjectLayer=(function(){
var _3dd=ravegeo.internal.Utilities;
var _3de={borderColor:"#000000",backgroundColor:"#7f7f7f",textColor:"#ffffff"};
var _3df={borderColor:"#7f7f7f",backgroundColor:"#ffffff",textColor:"#000000"};
var _3e0=function(id,map,opts){
this._id=id;
this._map=map;
if(typeof (opts)=="undefined"){
opts={};
}
opts=new ravegeo.LayerOptions(opts);
this._textStyle=fixStyle(opts.textStyle,_3de);
this._labelStyle=fixStyle(opts.labelStyle,_3df);
this._labelsAboveSymbols=opts.labelsAboveSymbols;
this._hoverBorder=_3dd.getBoolean(opts.hoverBorder,true);
this._highlightColor=opts.highlightColor;
if(!this._highlightColor){
this._highlightColor="#ff0000";
}
this._labelMinScale=opts.labelMinScale==-1?0:opts.labelMinScale;
this._labelMaxScale=opts.labelMaxScale==-1?Number.MAX_VALUE:opts.labelMaxScale;
this._miniSymbolMinScale=opts.miniSymbolMinScale==-1?Number.MAX_VALUE:opts.miniSymbolMinScale;
this._miniSymbol=opts.miniSymbol;
this._geoObjects={};
this._layerDiv=document.createElement("div");
ravegeo.internal.Utilities.setStyle(this._layerDiv,"position:absolute;z-index:"+(50+id)+";overflow:visible;width:0px;height:0px;");
map._outerDiv.appendChild(this._layerDiv);
};
function fixStyle(_3e4,_3e5){
if(!_3e4){
_3e4={};
}
if(!_3e4.borderColor){
_3e4.borderColor=_3e5.borderColor;
}
if(!_3e4.backgroundColor){
_3e4.backgroundColor=_3e5.backgroundColor;
}
if(!_3e4.textColor){
_3e4.textColor=_3e5.textColor;
}
return _3e4;
}
_3e0.prototype._layout=function(_3e6,_3e7,_3e8,_3e9){
this._pixMapCenter={left:Math.round(_3e8/2),top:Math.round(_3e9/2)};
this._setGeoCenter(_3e6,_3e7);
};
_3e0.prototype._setGeoCenter=function(_3ea,_3eb){
this._geoCenter={x:_3ea,y:_3eb};
this._layerPixPosition={left:this._pixMapCenter.left,top:this._pixMapCenter.top};
this._positionLayerDiv();
this._positionGeoObjects();
};
_3e0.prototype._positionLayerDiv=function(){
this._layerDiv.style.left=this._layerPixPosition.left+"px";
this._layerDiv.style.top=this._layerPixPosition.top+"px";
};
_3e0.prototype._positionGeoObjects=function(){
for(var _3ec in this._geoObjects){
var _3ed=this._geoObjects[_3ec];
_3ed._position(this._geoCenter,this._getGeoToPixels());
}
};
_3e0.prototype._positionGeoObject=function(_3ee){
_3ee._position(this._geoCenter,this._getGeoToPixels());
};
_3e0.prototype._repositionGeoObject=function(_3ef){
_3ef._reposition(this._geoCenter,this._getGeoToPixels());
};
_3e0.prototype._getGeoToPixels=function(){
return {x:this._map._tileWidthPix/this._map._zoomStepExtents[this._map._zoomStep][0],y:this._map._tileHeightPix/this._map._zoomStepExtents[this._map._zoomStep][1]};
};
_3e0.prototype._pixMove=function(dx,dy){
this._layerPixPosition.left+=dx;
this._layerPixPosition.top+=dy;
this._positionLayerDiv();
};
_3e0.prototype._destroy=function(){
this.clear();
this._map._outerDiv.removeChild(this._layerDiv);
delete this._layerDiv;
};
_3e0.prototype.clear=function(){
for(var id in this._geoObjects){
this._geoObjects[id]._destroy();
}
this._geoObjects={};
};
_3e0.prototype.addGeoObjects=function(objs,opts){
if(opts&&opts.clear){
this.clear();
}
for(var idx in objs){
var obj=objs[idx];
obj._project(this._map._projector);
var _3f7=this._geoObjects[obj.id];
obj._tiledMapInit(this,_3f7);
if(_3f7){
_3f7._destroy();
}
this._geoObjects[obj.id]=obj;
}
};
_3e0.prototype.getGeoObjectIds=function(_3f8){
var ret=[];
var id;
if(_3f8){
var _3fb=this._map.getGeoBounds();
for(id in this._geoObjects){
var _3fc=this._geoObjects[id];
if(_3fc._isInside(_3fb.xMin,_3fb.yMin,_3fb.xMax,_3fb.yMax)){
ret[ret.length]=id;
}
}
}else{
for(id in this._geoObjects){
ret[ret.length]=id;
}
}
return ret;
};
_3e0.prototype.getGeoObject=function(id){
var ret=this._geoObjects[id];
if(typeof (ret)=="undefined"){
return null;
}
return ret;
};
_3e0.prototype.removeGeoObjects=function(ids){
for(var idx in ids){
var id=ids[idx];
if(this._geoObjects[id]){
this._geoObjects[id]._destroy();
delete this._geoObjects[id];
}
}
};
_3e0.prototype.setVisible=function(_402){
if(typeof (_402)=="undefined"||_402){
this._layerDiv.style.visibility="visible";
}else{
this._layerDiv.style.visibility="hidden";
}
};
_3e0.prototype.showGeoObjects=function(_403){
_403=_3dd.getInteger(_403);
var _404={x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY};
var _405={x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY};
for(var id in this._geoObjects){
var obj=this._geoObjects[id];
obj._expandBounds(_404,_405);
}
this._map._showBounds(_404,_405,_403);
};
_3e0.prototype.highlightGeoObject=function(id,_409){
var _40a=this._geoObjects[id];
if(!_409){
_409={};
}
var map=this._map;
if(map._highlightedGeoObject){
map._highlightedGeoObject._removeHighlight();
delete map._highlightedGeoObject;
}
if(_40a){
if(_40a._notYetLoaded){
_40a._doHighlight=_409;
}
if(typeof (_409.center)!="string"){
_409.center="";
}
if(!_409.showText){
_409.showText=false;
}
if(!_409.showHighlight){
_409.showHighlight=false;
}
_40a._setHighlight(_409.showText,_409.showHighlight);
map._highlightedGeoObject=_40a;
var _40c=_409.center.toLowerCase();
var _40d;
if(_40c=="whennotshowing"){
var _40e=(map._mapWidth*0.43)*(map._zoomStepExtents[map._zoomStep][0]/map._tileWidthPix);
var _40f=(map._mapHeight*0.43)*(map._zoomStepExtents[map._zoomStep][1]/map._tileHeightPix);
var minx=map._geoX-_40e;
var miny=map._geoY-_40f;
var maxx=map._geoX+_40e;
var maxy=map._geoY+_40f;
_40d=_40a._getCenter();
if(_40d.x<minx||_40d.x>maxx||_40d.y<miny||_40d.y>maxy){
map._animator._animateTo(_40d.x,_40d.y);
}
}else{
if(_40c!="never"){
_40d=_40a._getCenter();
map._animator._animateTo(_40d.x,_40d.y);
}
}
}
};
_3e0.prototype.moveGeoObject=function(id,_415,_416){
_415=_3dd.getFloat(_415,0);
_416=_3dd.getFloat(_416,0);
var _417=this._geoObjects[id];
if(_417){
_417._move(_415,_416,this._map._projector);
}
};
_3e0.prototype.pickGeoObjectIds=function(geoX,geoY){
geoX=_3dd.getFloat(geoX);
geoY=_3dd.getFloat(geoY);
var _41a=this._map._projector.forward(geoX,geoY);
var _41b=this._geoToPixelPoint(_41a);
var _41c=[];
for(var _41d in this._geoObjects){
var _41e=this._geoObjects[_41d];
if(_41e._pick(_41b)){
_41c[_41c.length]=_41e.id;
}
}
return _41c;
};
_3e0.prototype._pickObject=function(_41f){
for(var _420 in this._geoObjects){
var _421=this._geoObjects[_420];
if(_421._pick(_41f)){
return _421;
}
}
};
_3e0.prototype._geoToPixelPointsX=function(_422){
var _423=this._getGeoToPixels().x;
var _424=this._map._getGeoBounds(this._map._zoomStep);
var ret=[];
for(var i=0;i<_422.length;i++){
ret[i]=(_422[i]-_424.xMin)*_423;
}
return ret;
};
_3e0.prototype._geoToPixelPointsY=function(_427){
var _428=this._getGeoToPixels().y;
var _429=this._map._getGeoBounds(this._map._zoomStep);
var ret=[];
for(var i=0;i<_427.length;i++){
ret[i]=(_429.yMax-_427[i])*_428;
}
return ret;
};
_3e0.prototype._geoToPixelPoint=function(_42c){
var _42d=this._getGeoToPixels();
var _42e=this._map._getGeoBounds(this._map._zoomStep);
var x=(_42c[0]-_42e.xMin)*_42d.x;
var y=(_42e.yMax-_42c[1])*_42d.y;
var ret=[x,y];
return ret;
};
_3e0.prototype.setArrangeGeoObjects=new function(_432){
};
return _3e0;
})();
ravegeo.tools.MoveObjectTool=(function(){
var _433=function(){
this.startX=0;
this.startY=0;
this.objectPressedId=null;
this.layerPressed=null;
};
_433.prototype.mousePressed=function(map,x,y,_437,_438){
if(_437){
var _439=_437.getGeoObject(_438);
this.objectPressedId=_439.id;
this.layerPressed=_437;
this.startX=x;
this.startY=y;
map.setPanningEnabled(false);
}
};
_433.prototype.mouseMoved=function(map,x,y,_43d,_43e){
if(this.objectPressedId){
var _43f=x-this.startX;
var _440=y-this.startY;
if(_43f!=0||_440!=0){
this.startX=x;
this.startY=y;
this.layerPressed.moveGeoObject(this.objectPressedId,_43f,_440);
}
}
};
_433.prototype.mouseReleased=function(map,x,y,_444,_445){
this.objectPressedId=null;
this.layerPressed=null;
map.setPanningEnabled(true);
};
_433.prototype.deactivate=function(map){
map.setPanningEnabled(true);
};
return _433;
})();
ravegeo.tools.internal.SymbolHoverTool=(function(){
var _447={};
var _448=ravegeo.internal.Utilities;
var _449;
var _44a;
_447.mousePressed=function(map,x,y,_44e,_44f){
if(_44e){
var _450=_44e.getGeoObject(_44f);
if(_450.symbol){
_44a=_450;
}
}
};
_447.mouseReleased=function(map,x,y,_454,_455){
_44a=null;
if(_454){
var _456=_454.getGeoObject(_455);
reselectSymbol(_456);
}
};
_447.mouseMoved=function(map,x,y,_45a,_45b){
if(!_45a){
diselectCurrent();
return;
}
var _45c=_45a.getGeoObject(_45b);
if(_45c==_44a){
diselectCurrent();
return;
}
reselectSymbol(_45c);
};
function reselectSymbol(_45d){
if(_45d!=_449){
if(_449){
diselectCurrent();
}
if(_45d.symbol){
if(_45d._layer._hoverBorder){
_45d._img.style.border="1px solid gray";
}
if(!_45d._alwaysBalloon&&!_448.stringIsEmpty(_45d.text)){
_45d._balloon=_45d._createBallon(_45d._layer._textStyle);
_45d._layer._layerDiv.appendChild(_45d._balloon);
}
_449=_45d;
}
}
}
function diselectCurrent(){
if(!_449){
return;
}
var _45e=_449._balloon;
_449._balloon=null;
_449._img.style.border="0px none";
if(_45e){
try{
_449._layer._layerDiv.removeChild(_45e);
}
catch(e){
}
}
_449=null;
}
return _447;
})();
ravegeo.tools.internal.DeprecatedCallbacksTool=(function(){
var _45f={};
_45f.mouseClicked=function(map,x,y,_463,_464){
if(_464){
objectClicked(map,_463,_464);
}else{
mapClicked(map,x,y);
}
};
function objectClicked(map,_466,_467){
var _468=_466.getGeoObject(_467);
if(_468&&_468.symbol){
var _469=map._callback;
if(_469&&_469.symbolClicked){
_469.symbolClicked(map,_466,_467);
}
}
}
function mapClicked(map,x,y){
var _46d=map._callback;
if(_46d&&_46d.mapClicked){
_46d.mapClicked(map,x,y);
}
}
return _45f;
})();
ravegeo.ControlPosition=(function(){
var _46e={TOP_LEFT:0,TOP_RIGHT:1,BOTTOM_LEFT:2,BOTTOM_RIGHT:3};
return _46e;
})();
ravegeo.internal.ControlCommons=(function(){
var _46f=ravegeo.internal.Utilities;
var _470=ravegeo.ControlPosition;
var _471={};
var _472=10;
var _473=10;
_471.initControl=function(_474,_475,_476){
_474.position=_46f.getInteger(_475,_476);
validateControlPosition(_474.position);
};
function validateControlPosition(_477){
for(idx in _470){
if(_470[idx]==_477){
return;
}
}
throw Error("Unsupported control position!");
}
_471.serialize=function(_478){
var s=_478._getType();
s+=_478.position+";";
return s;
};
_471.addToTiledMap=function(map,_47b){
if(!map._controls){
initMapControls(map);
}
var div=_47b._getDivElement();
_47b._div=div;
setDivPosition(_47b);
map._outerDiv.appendChild(div);
_47b._map=map;
_47b._update();
saveControl(map,_47b);
};
function setDivPosition(_47d){
_47d._div.style.position="absolute";
switch(_47d.position){
case _470.TOP_LEFT:
_47d._div.style.top=_473+"px";
_47d._div.style.left=_472+"px";
break;
case _470.TOP_RIGHT:
_47d._div.style.top=_473+"px";
_47d._div.style.right=_472+"px";
break;
case _470.BOTTOM_LEFT:
_47d._div.style.bottom=_473+"px";
_47d._div.style.left=_472+"px";
break;
case _470.BOTTOM_RIGHT:
_47d._div.style.bottom=_473+"px";
_47d._div.style.right=_472+"px";
}
}
function saveControl(map,_47f){
var type=_47f._getType();
if(map._controls[type]){
_471.removeFromTiledMap(map,map._controls[type]);
}
map._controls[type]=_47f;
}
function initMapControls(map){
map._controls={};
if(!map._callback){
map._callback={};
}
var _482=map._callback.interactionEnded;
map._callback.interactionEnded=function(){
for(idx in map._controls){
map._controls[idx]._update();
}
if(_482){
_482(map);
}
};
}
_471.removeFromTiledMap=function(map,_484){
delete map._controls[_484._getType()];
map._outerDiv.removeChild(_484._div);
};
return _471;
})();
ravegeo.ScaleBar=(function(){
var _485=ravegeo.internal.ControlCommons;
var _486=ravegeo.ControlPosition.BOTTOM_RIGHT;
var _487=100000000;
var _488=0.0003;
var _489=150;
var _48a=function(_48b){
_485.initControl(this,_48b,_486);
};
_48a.prototype._serialize=function(){
return _485.serialize(this);
};
_48a.prototype._getType=function(){
return "s";
};
_48a.prototype._addToTiledMap=function(map){
_485.addToTiledMap(map,this);
};
_48a.prototype._removeFromTiledMap=function(map){
_485.removeFromTiledMap(map,this);
};
_48a.prototype._getDivElement=function(){
var div=document.createElement("div");
div.style.color="#000000";
div.style.textAlign="center";
div.style.padding="0px";
div.style.fontSize="8pt";
div.style.fontWeight="bold";
div.style.zIndex="10000000";
div.style.fontFamily="Arial";
this._meterDiv=document.createElement("div");
this._meterDiv.style.borderStyle="none solid solid solid";
this._meterDiv.style.borderWidth="2px 2px 2px 2px";
this._feetDiv=document.createElement("div");
this._feetDiv.style.borderStyle="none solid none solid";
this._feetDiv.style.borderWidth="2px 2px 2px 2px";
div.appendChild(this._meterDiv);
div.appendChild(this._feetDiv);
return div;
};
_48a.prototype._update=function(){
var _48f=this._updateMeterScale();
var _490=this._updateFeetScale();
this._updateBorders(_48f,_490);
};
_48a.prototype._updateMeterScale=function(){
var _491=this._map.getScale()*_488;
var _492=_489*_491;
var _493=findSuitableGeoLengthOfScaleBar(_492);
var _494=Math.round(_489*(_493/_492));
this._meterDiv.style.width=_494+"px";
var _495=(_493<1000)?_493+" m":(_493/1000)+" km";
this._meterDiv.innerHTML=_495;
return _494;
};
_48a.prototype._updateFeetScale=function(){
var _496=this._map.getScale()*_488*3.28;
var _497=_489*_496;
var _498=findSuitableFeetGeoLengthOfScaleBar(_497);
var _499=Math.round(_489*(_498/_497));
this._feetDiv.style.width=_499+"px";
var _49a=(_498<5280)?_498+" ft":(_498/5280)+" mi";
this._feetDiv.innerHTML=_49a;
return _499;
};
_48a.prototype._updateBorders=function(_49b,_49c){
if(_49b>_49c){
this._meterDiv.style.borderStyle="none solid solid solid";
this._feetDiv.style.borderStyle="none solid none solid";
}else{
this._meterDiv.style.borderStyle="none solid none solid";
this._feetDiv.style.borderStyle="solid solid none solid";
}
};
function findSuitableGeoLengthOfScaleBar(_49d){
if(_49d<10){
return 10;
}
var _49e=_487;
while(true){
if(_49d>=_49e){
break;
}
_49e/=10;
}
if(_49d>=5*_49e){
return 5*_49e;
}
if(_49d>=2*_49e){
return 2*_49e;
}
return _49e;
}
function findSuitableFeetGeoLengthOfScaleBar(_49f){
if(_49f<5280){
return findSuitableGeoLengthOfScaleBar(_49f);
}else{
_49f=_49f/5280;
var _4a0=_487/1000;
while(true){
if(_49f>=_4a0){
break;
}
_4a0/=10;
}
if(_49f>=5*_4a0){
return 5*_4a0*5280;
}
if(_49f>=2*_4a0){
return 2*_4a0*5280;
}
return _4a0*5280;
}
}
return _48a;
})();
ravegeo.WebMap=(function(){
var _4a1={};
_4a1.initiateCreation=function(_4a2){
if(ravegeo.AppletMap){
if(ravegeo.internal.Environment.isJavaWellSupported()){
_4a2._appletTimeoutCallback=function(){
ravegeo.TiledMap.initiateCreation(_4a2);
};
_4a2._maxAppletLoadTime=20000;
ravegeo.AppletMap.initiateCreation(_4a2);
}else{
ravegeo.TiledMap.initiateCreation(_4a2);
}
}else{
if(ravegeo.TiledMap){
ravegeo.TiledMap.initiateCreation(_4a2);
}else{
throw new Error("Can not show map.");
}
}
};
_4a1.version=ravegeo.internal.MapCommons.version;
return _4a1;
})();

var fixParams=function(_1){
_1.url="http://maps.labs.ericsson.net:8888/ravegeo/webmap2/";
_1._tiledProjector=ravegeo.MercatorProjector;
if(_1.callback){
_1._callback=_1.callback;
}
if(!_1.name){
_1.name="Default";
}
if(!_1.initialViewArea){
_1.initialViewArea={x:12.0203,y:57.73375,scale:25000000};
}
};
ericsson=ravegeo;
ericsson.WebMap._initiateCreation=ericsson.WebMap.initiateCreation;
ericsson.WebMap.initiateCreation=function(_2){
var _3=fixParams(_2);
this._initiateCreation(_2);
return _3;
};
ericsson.AppletMap._initiateCreation=ericsson.AppletMap.initiateCreation;
ericsson.AppletMap.initiateCreation=function(_4){
var _5=fixParams(_4);
this._initiateCreation(_4);
return _5;
};
ericsson.TiledMap._initiateCreation=ericsson.TiledMap.initiateCreation;
ericsson.TiledMap.initiateCreation=function(_6){
var _7=fixParams(_6);
this._initiateCreation(_6);
return _7;
};


