// smap.js 
//
// Map Script for the Carmenta Server Rich Web Client
//
// (C) Copyright 2008 Carmenta AB. All rights Reserved.
//
function BackgroundControl(_1,_2,_3){
this.saMap=_1;
this.buttonArray=new Array();
this.container=document.createElement("div");
addClass(this.container,this.saMap.config.GUI.backgroundControl.css);
var _4=0;
for(var i=0;i<this.saMap.view.layerArray.length;i++){
if(this.saMap.view.layerArray[i].type=="background"){
var _6=new BackgroundButton(this.saMap.view.layerArray[i],_4,this.container,this,_3);
this.saMap.view.layerArray[i].backgroundIndex=_4;
this.buttonArray[_4]=_6;
_4++;
}
}
if(_4>0){
_2.appendChild(this.container);
setVisible(this.container,true);
this.activeBackgroundIndex=0;
this.buttonArray[0].setActive();
for(var i=0;i<this.buttonArray.length;i++){
if(i==this.activeBackgroundIndex){
this.buttonArray[i].setActive();
}else{
this.buttonArray[i].setInactive();
}
}
}
}
BackgroundControl.prototype.switchBackground=function(_7){
if(this.activeBackgroundIndex!=_7){
var _8=this.activeBackgroundIndex;
this.activeBackgroundIndex=_7;
this.buttonArray[_8].setInactive();
this.buttonArray[_7].setActive();
}
};
BackgroundControl.prototype.unload=function(){
for(var i=0;i<this.buttonArray.length;i++){
this.buttonArray[i].unload();
}
};
function BackgroundButton(_a,_b,_c,_d,_e){
this.layer=_a;
this.control=_d;
this.index=_b;
this.button=document.createElement("div");
this.button.id=_e+"bg"+this.index;
this.button.className="rwcBackgroundButton";
this.button.style.top=_b*(parseInt(this.control.saMap.config.GUI.backgroundControl.element.height)+5)+"px";
this.image=document.createElement("img");
this.button.appendChild(this.image);
this.text=document.createElement("div");
this.text.innerHTML=this.layer.name;
this.text.className="rwcBackgroundButtonText";
this.button.appendChild(this.text);
_c.appendChild(this.button);
this.clickDelegate=associateObjWithEvent(this,"onClick");
Evt.addEventListener(this.button,"click",this.clickDelegate);
}
BackgroundButton.prototype.onClick=function(){
this.control.switchBackground(this.index);
};
BackgroundButton.prototype.setActive=function(){
this.control.saMap.config.GUI.backgroundControl.selectedElement.applyConfiguration(this.image);
this.layer.show(this.layer.sublayerID[0].id);
};
BackgroundButton.prototype.setInactive=function(){
this.control.saMap.config.GUI.backgroundControl.element.applyConfiguration(this.image);
this.layer.hide(this.layer.sublayerID[0].id);
};
BackgroundButton.prototype.unload=function(){
Evt.removeEventListener(this.button,"click",this.clickDelegate);
};

function DrivingDirectionsControl(_1,_2,_3,_4){
this.saMap=_2;
this.layer=_3;
this.container=document.createElement("div");
this.container.id=this.saMap.prefix+_3.name+"DrivingDirectionsControl";
addClass(this.container,this.layer.configuration.route.drivingDirections.css);
var _5=document.createElement("div");
var _6=document.createElement("h4");
_6.innerHTML=this.layer.configuration.route.drivingDirections.heading;
_5.appendChild(_6);
this.expanded=true;
var _7=document.createElement("img");
if(this.layer.configuration.route.drivingDirections.collapseImage&&this.layer.configuration.route.drivingDirections.collapseImage.image!=""){
_7.className="rwcMinimizeElement";
this.layer.configuration.route.drivingDirections.collapseImage.applyConfiguration(_7);
_5.appendChild(_7);
}
this.container.appendChild(_5);
this.clickDelegate=associateObjWithEvent(this,"headerClicked");
Evt.addEventListener(_7,"click",this.clickDelegate);
this.itemContainer=document.createElement("div");
this.itemContainer.id="rwcDrivingDirectionBody";
this.container.appendChild(this.itemContainer);
setVisible(this.container,true);
_1.appendChild(this.container);
}
DrivingDirectionsControl.prototype.insertObject=function(_8){
if(_8.getAttribute("geoType")!="#point"){
return;
}
if(_8.getAttribute("infostring")==null){
return;
}
if(!this.directionItems){
this.directionItems=new Array();
}
this.directionItems.push(new DrivingDirectionsItem(_8,this.itemContainer,this.layer.configuration.route.drivingDirections.images,this.saMap));
};
DrivingDirectionsControl.prototype.finalize=function(_9){
if(!this.directionItems){
return;
}
var _a=this.layer.configuration.route.drivingDirections.evenItemCSS;
var _b=this.layer.configuration.route.drivingDirections.oddItemCSS;
if(_9){
for(var i=this.directionItems.length-1;i>=0;i--){
this.directionItems[i].finalize(this.itemContainer,i%2==0?_a:_b);
}
}else{
for(var i=0;i<this.directionItems.length;i++){
this.directionItems[i].finalize(this.itemContainer,i%2==0?_a:_b);
}
}
};
DrivingDirectionsControl.prototype.reset=function(){
if(!this.directionItems){
return;
}
if(this.directionItems){
for(var i=0;i<this.directionItems.length;i++){
this.directionItems[i].unload();
}
}
this.container.removeChild(this.itemContainer);
this.itemContainer=document.createElement("div");
this.itemContainer.id="rwcDrivingDirectionBody";
this.container.appendChild(this.itemContainer);
this.directionItems=null;
};
DrivingDirectionsControl.prototype.show=function(_e){
if(!this.expanded&&_e){
this.container.style.display="block";
this.expanded=true;
}else{
if(this.expanded&&!_e){
this.container.style.display="none";
this.expanded=false;
}
}
};
DrivingDirectionsControl.prototype.headerClicked=function(_f,_10){
if(this.expanded){
this.show(false);
}
};
function DrivingDirectionsItem(_11,_12,_13,_14){
this.container=document.createElement("div");
this.geoObject=_11;
this.saMap=_14;
this.clickDelegate=associateObjWithEvent(this,"drivingDirectionItemClicked");
Evt.addEventListener(this.container,"click",this.clickDelegate);
var _15=null;
for(var _16 in _13){
if(_13[_16]&&typeof (_13[_16])!="function"){
if(_16!="default"){
var _17=_11.getAttribute(_16);
if(_17){
_15=_13[_16];
break;
}
}
}
}
if(!_15){
_15=_13["default"];
}
if(!_15){
return;
}
var _18="straight";
var _19=_11.getAttribute("turn");
if(_19){
_18=_19.toLowerCase();
}
try{
var _1a=_15[_18].image;
var _1b=_15[_18].width;
var _1c=_15[_18].height;
var _1d=document.createElement("div");
_1d.className="rwcDirectionSymbolDiv";
var _1e=new ImageConfiguration();
_1e.setImage(_1a,_1b,_1c,"");
var _1f=document.createElement("img");
_1e.applyConfiguration(_1f);
_1d.appendChild(_1f);
this.container.appendChild(_1d);
}
catch(e){
}
var _20=document.createElement("div");
_20.className="rwcDirectionTextDiv";
var _21=document.createElement("span");
_20.innerHTML+=_11.getAttribute("infostring");
this.container.appendChild(_20);
}
DrivingDirectionsItem.prototype.drivingDirectionItemClicked=function(evt,_23){
var _24=this.saMap.mapWidth/2-this.geoObject.viewX;
var _25=this.saMap.mapHeight/2-this.geoObject.viewY;
this.saMap.beginDrag();
this.saMap.drag(_24,_25);
this.saMap.endDrag();
this.geoObject.updateInfoBox();
};
DrivingDirectionsItem.prototype.unload=function(){
Evt.removeEventListener(this.container,"click",this.clickDelegate,false);
};
DrivingDirectionsItem.prototype.finalize=function(_26,css){
this.container.className=css;
_26.appendChild(this.container);
};

function GeoObject(_1,_2,_3){
this.saMap=_2.saMap;
this.layer=_2;
this.configuration=new Object();
this.attributes=_1.a;
var _4=this.attributes.length;
if(!_1){
return;
}
for(var i=0;i<_4;i++){
this.attributes[i].value=decodeURIComponent(this.attributes[i].value);
}
if(_1.ps){
this.transparency=0.5;
this.color="#00b000";
this.style="solid";
this.lineWidth=1;
for(var i=0;i<_4;i++){
if(this.attributes[i].name=="geoType"){
switch(this.attributes[i].value){
case ("#polygon"):
if(_2.configuration.polygons){
this.type="poly";
this.shapeParameters=_2.configuration.polygons.parameters;
this.conditions=_2.configuration.polygons.conditions;
this.shapeAttributes=this.createAttributeLookupTable(this.shapeParameters,this.attributes);
}else{
this.type="point";
}
break;
case ("#line"):
if(_2.configuration.lines){
this.type="line";
this.shapeParameters=_2.configuration.lines.parameters;
this.conditions==_2.configuration.lines.conditions;
this.shapeAttributes=this.createAttributeLookupTable(this.shapeParameters,this.attributes);
}else{
this.type="point";
}
break;
default:
this.type="point";
break;
}
}
}
if(this.shapeParameters){
for(var j=0;j<this.shapeParameters.length;j++){
if(typeof (this.shapeAttributes[j])!="undefined"){
var _7=this.attributes[this.shapeAttributes[j]].value;
}else{
var _7=this.shapeParameters[j].value;
}
switch(this.shapeParameters[j].type){
case ("style"):
this.style=_7;
break;
case ("transparency"):
try{
this.transparency=parseFloat(_7);
}
catch(e){
}
break;
case ("color"):
this.color=_7;
break;
case ("lineWidth"):
try{
this.lineWidth=parseInt(_7);
}
catch(e){
this.lineWidth=1;
}
break;
}
}
}
this.points=new Array();
n=_1.ps.length;
for(var i=0;i<n;i++){
var _8=new Object();
_8.x=parseFloat(_1.ps[i].x);
_8.y=parseFloat(_1.ps[i].y);
this.points[i]=_8;
}
}else{
this.type="point";
this.point=new Object();
if(_1.p){
this.point.x=parseFloat(_1.p.x);
this.point.y=parseFloat(_1.p.y);
}else{
this.point.x=0;
this.point.y=0;
}
}
this.infoBoxElement=_2.configuration.infoBox;
this.objectParameters=_2.configuration.properties;
this.objectAttributes=this.createAttributeLookupTable(_2.configuration.properties,this.attributes);
if(_2.configuration.infoBox){
this.infoBoxParameters=_2.configuration.infoBox.parameters;
this.infoBoxAttributes=this.createAttributeLookupTable(_2.configuration.infoBox.parameters,this.attributes);
this.infoBoxMargin=_2.configuration.infoBox.margin;
if(_2.configuration.infoBox.positioning){
if(_2.configuration.infoBox.positioning=="normal"||_2.configuration.infoBox.positioning=="alwaysAbove"||_2.configuration.infoBox.positioning=="centered"){
this.infoBoxPositioning=_2.configuration.infoBox.positioning;
}else{
if(_2.configuration.infoBox.positioning.length>7&&_2.configuration.infoBox.positioning.substring(0,7)=="target:"){
this.infoBoxPositioning="target";
var _9=_2.configuration.infoBox.positioning.substring(7,_2.configuration.infoBox.positioning.length);
this.infoBoxTarget=document.getElementById(_9);
if(this.infoBoxTarget==null){
this.infoBoxPositioning=="normal";
}
}
}
}else{
this.infoBoxPositioning="normal";
}
}else{
this.infoBoxElement=new Object();
this.infoBoxElement.active=false;
}
if(_3){
this.searchResultParameters=_2.configuration.search.properties;
this.searchResultAttributes=this.createAttributeLookupTable(_2.configuration.search.properties,this.attributes);
}
if(_2.searchControl){
this.searchAttributes=new Array();
for(var i=0;i<_2.searchControl.searchAttributes.length;i++){
for(var j=0;j<_4;j++){
if(_2.searchControl.searchAttributes[i]==this.attributes[j].name){
this.searchAttributes[i]=this.attributes[j].value.toLowerCase();
}
}
}
}
this.noId=true;
this.priority=0;
this.updateIcons();
if(this.noId){
this.id="x"+Math.random();
}
}
GeoObject.prototype.updateIcons=function(){
for(var i=0;i<this.objectParameters.length;i++){
if(typeof (this.objectAttributes[i])!="undefined"){
var _b=this.objectAttributes[i];
var _c=this.attributes[_b].value;
}else{
if(this.objectParameters[i].value&&this.objectParameters[i].value!=null){
var _c=this.objectParameters[i].value;
}else{
_c=null;
}
}
switch(this.objectParameters[i].type){
case ("id"):
if(_c&&_c!=""){
this.id=_c;
this.noId=false;
}
break;
case ("priority"):
if(_c){
try{
this.priority=parseInt(_c);
}
catch(e){
this.priority=0;
}
break;
}
case ("defaultImage"):
this.imageConfig=this.objectParameters[i];
this.icon=this.objectParameters[i].image.clone();
if(_c&&_c!=""){
var _d=_c.split(",");
this.icon.image=_d[0];
if(_d.length>1){
if(!this.selectedIcon){
this.selectedIcon=new Object();
}
this.selectedIcon.image=_d[1];
}else{
this.selectedIcon=null;
}
}else{
if(this.objectParameters[i].selectedImage){
this.selectedIcon=this.objectParameters[i].selectedImage.clone();
}
}
break;
case ("conditionalImage"):
var _e=this.objectParameters[i].value.split(",");
if(_e.length!=2){
break;
}
for(var j=0;j<this.attributes.length;j++){
if(_e[0]==this.attributes[j].name&&_e[1]==this.attributes[j].value){
this.imageConfig=this.objectParameters[i];
this.icon=this.objectParameters[i].image.clone();
if(this.objectParameters[i].selectedImage){
this.selectedIcon=this.objectParameters[i].selectedImage.clone();
}
}
}
break;
}
}
if(this.layer.configuration.defaultCombinedImage&&this.layer.configuration.defaultCombinedImage.parts.length>0&&this.type=="point"){
this.icon=null;
this.selectedIcon=null;
this.defaultCombinedImage=this.layer.configuration.defaultCombinedImage.clone();
}
if(this.defaultCombinedImage&&this.type=="point"){
this.boundingArea=new DynamicBoundingArea(this.point,this.defaultCombinedImage,this.saMap);
}else{
var _10=10;
if(this.icon){
_10=parseInt(this.icon.width)/2;
}
if(isNaN(_10)){
_10=10;
}
this.boundingArea=new BoundingArea(this.point,this.points,this.type,this.saMap,_10);
this.point=this.boundingArea.centerpoint;
}
if(this.shapeParameters){
this.shapeAttributes=this.createAttributeLookupTable(this.shapeParameters,this.attributes);
for(var j=0;j<this.shapeParameters.length;j++){
if(typeof (this.shapeAttributes[j])!="undefined"){
var _c=this.attributes[this.shapeAttributes[j]].value;
}else{
var _c=this.shapeParameters[j].value;
}
switch(this.shapeParameters[j].type){
case ("style"):
this.style=_c;
break;
case ("transparency"):
try{
this.transparency=parseFloat(_c);
}
catch(e){
}
break;
case ("color"):
this.color=_c;
break;
case ("lineWidth"):
try{
this.lineWidth=parseInt(_c);
}
catch(e){
this.lineWidth=1;
}
break;
}
}
}
if(this.conditions){
for(var i=0;i<nrOfAttributes;i++){
for(var j=0;j<this.conditions.length;j++){
if(this.conditions[j].name==this.attributes[i].name&&this.conditions[j].value==this.attributes[i].value){
for(var k=0;k<this.conditions[j].parameters.length;k++){
switch(this.conditions[j].parameters[k].type){
case ("style"):
this.style=this.conditions[j].parameters[k].value;
break;
case ("transparency"):
try{
this.transparency=parseFloat(this.conditions[j].parameters[k].value);
}
catch(e){
}
break;
case ("color"):
this.color=this.conditions[j].parameters[k].value;
break;
}
}
}
}
}
}
this.mapCenterGeoOffsetX=this.point.x-this.saMap.initialGeoCenterX;
this.mapCenterGeoOffsetY=this.point.y-this.saMap.initialGeoCenterY;
};
GeoObject.prototype.createAttributeLookupTable=function(_12,_13){
if(!_12){
return;
}
var _14=new Array();
var n1=_12.length;
if(_13){
var n2=_13.length;
}else{
var n2=0;
}
for(var i=0;i<n1;i++){
var _18=false;
for(var j=0;j<n2;j++){
if(_13[j].name==_12[i].name){
_14[i]=j;
}else{
var n3=_12[i].alternates.length;
for(var k=0;k<n3;k++){
if(_13[j].name==_12[i].alternates[k]){
_14[i]=j;
_18=true;
break;
}
}
}
}
}
return _14;
};
GeoObject.prototype.clonePosition=function(_1c){
this.point.x=_1c.point.x;
this.point.y=_1c.point.y;
if(this.points){
this.points=new Array();
for(var i=0;i<_1c.points.length;i++){
this.points[i]=this.saMap.point(_1c.points[i].x,_1c.points[i].y);
}
}
};
GeoObject.prototype.show=function(){
this.isHidden=false;
if(this.clientNode){
setVisible(this.clientNode,true);
}
};
GeoObject.prototype.hide=function(){
this.isHidden=true;
if(this.clientNode){
setVisible(this.clientNode,false);
}
};
GeoObject.prototype.updateScreenPosition=function(){
var _1e=this.saMap.tileSize/this.saMap.tileGeoWidth;
this.viewX=this.mapCenterGeoOffsetX*_1e+this.saMap.totalOffsetX+this.saMap.mapWidth/2;
this.viewY=this.saMap.mapHeight-(this.mapCenterGeoOffsetY*_1e-this.saMap.totalOffsetY+this.saMap.mapHeight/2);
if(this.clientNode){
setX(this.clientNode,this.viewX-this.iconOffsetX/2);
setY(this.clientNode,this.viewY-this.iconOffsetY/2);
}
};
GeoObject.prototype.centerIcon=function(){
if(this.clientNode){
setX(this.clientNode,this.viewX-this.iconOffsetX/2);
setY(this.clientNode,this.viewY-this.iconOffsetY/2);
}
if(this.textNode){
this.textNode.style.fontSize=this.textheight+"px";
this.textNode.style.top=Math.floor((this.iconOffsetY-this.textheight)/2)+"px";
this.textNode.style.width=this.iconOffsetX+"px";
}
};
GeoObject.prototype.pixelOffset=function(_1f,_20){
if(this.hideObjectInfoTimer){
this.cancelInfoBox();
}
this.viewX+=_1f;
this.viewY+=_20;
if(this.clientNode){
setX(this.clientNode,this.viewX-this.iconOffsetX/2);
setY(this.clientNode,this.viewY-this.iconOffsetY/2);
}
};
GeoObject.prototype.draw=function(_21,_22,_23,_24){
this.mapCenterGeoOffsetX=this.point.x-this.saMap.initialGeoCenterX;
this.mapCenterGeoOffsetY=this.point.y-this.saMap.initialGeoCenterY;
if(this.type=="point"){
if(this.clientNode&&this.clientNode.parentNode){
this.clientNode.parentNode.removeChild(this.clientNode);
}
this.clientNode=document.createElement("div");
this.clientNode.className="rwcMarker";
if(this.icon){
this.clientNode.id=this.id;
this.clientNode.image=document.createElement("img");
this.clientNode.appendChild(this.clientNode.image);
this.icon.applyConfiguration(this.clientNode.image);
this.setIconOffset(this.icon);
if(this.layer.numbered){
this.textNode=document.createElement("span");
var _25=parseInt(this.icon.height);
this.textheight=_25/2-1;
this.textNode.style.fontSize=this.textheight+"px";
this.textNode.style.top=Math.floor((_25-this.textheight)/2)+"px";
this.textNode.style.width=this.icon.width;
this.textNode.style.textAlign="center";
this.textNode.style.verticalAlign="middle";
this.textNode.innerHTML=_24+1;
this.clientNode.appendChild(this.textNode);
}
}else{
if(this.defaultCombinedImage){
this.defaultCombinedImage.destroy();
this.defaultCombinedImage.applyConfiguration(this.clientNode,this.attributes,false,this.saMap);
this.iconOffsetX=0;
this.iconOffsetY=0;
}else{
this.iconOffsetX=0;
this.iconOffsetY=0;
}
}
this.updateScreenPosition();
setVisible(this.clientNode,false);
_22.appendChild(this.clientNode);
if(!(this.isHidden||_23)&&!this.saMap.zoomActive){
setVisible(this.clientNode,true);
}
}else{
if(!(this.isHidden||_23)){
var _26=this.saMap.tileSize/this.saMap.tileGeoWidth;
var _27=this.saMap.getGeoRect();
var _28=new Array();
_28.push(this.saMap.point(_27.xMax,_27.yMax));
_28.push(this.saMap.point(_27.xMin,_27.yMax));
_28.push(this.saMap.point(_27.xMin,_27.yMin));
_28.push(this.saMap.point(_27.xMax,_27.yMin));
var _29=new BoundingArea(null,_28,"poly",this.saMap,0);
if(isIe6||isIe7&&this.layer.objectCanvas){
if(this.type=="line"){
var _2a="";
drawPoints=RWCClipToRectangle(this,_29,200,1);
if(drawPoints){
var n=drawPoints.length;
for(var i=0;i<n;i++){
if(_2a!=""){
_2a+=",";
}
var _2d=this.saMap.mapToScreenCoordinates(drawPoints[i].x,drawPoints[i].y);
_2a+=Math.round(_2d.x)+","+Math.round(_2d.y);
}
}
var _2e=" opacity=\""+Math.round(this.transparency*100)+"%\"";
var _2f=" strokecolor=\""+this.color+"\"";
var _30="<v:stroke joinstyle=\"round\" weight=\""+this.lineWidth+"\"  endcap=\"round\" "+_2e+"/>";
if(this.layer.tempCanvas){
this.layer.tempCanvas.innerHTML+="<v:polyline filled=\"false\" "+_2f+" points=\""+_2a+"\" >"+_30+"</v:polyline>";
}else{
this.layer.objectCanvas.innerHTML+="<v:polyline filled=\"false\" "+_2f+" points=\""+_2a+"\" >"+_30+"</v:polyline>";
}
}
if(this.type=="poly"){
if(this.points.length>1){
var _31=this.saMap.mapToScreenCoordinates(this.points[0].x,this.points[0].y);
var _32="m "+Math.round(_31.x)+","+Math.round(_31.y)+" l ";
var n=this.points.length;
for(var i=1;i<n;i++){
var _31=this.saMap.mapToScreenCoordinates(this.points[i].x,this.points[i].y);
_32+=Math.round(_31.x)+","+Math.round(_31.y);
if(i<this.points.length-1){
_32+=", ";
}else{
_32+=" x e";
}
}
var _33=" style=\"position:absolute;top:0;left:0;width:"+this.saMap.mapWidth+"px;height:"+this.saMap.mapHeight+"px\"";
var _2e=" opacity=\""+Math.round(this.transparency*100)+"%\"";
var _34=" coordsize="+this.saMap.mapWidth+","+this.saMap.mapHeight;
var _35="<v:fill "+_2e+" type=\"solid\" color=\""+this.color+"\"></v:fill>";
if(this.lineWidth>0){
var _30="<v:stroke weight=\""+this.lineWidth+"\"  endcap=\"round\" />";
var _36=" stroked=\"true\"";
}else{
var _30="";
var _36=" stroked=\"false\"";
}
var _2f=" strokecolor=\""+this.color;
if(this.layer.tempCanvas){
this.layer.tempCanvas.innerHTML+="<v:shape"+_33+_2f+_36+" coordorigin=\"0 0\" "+_34+" \" path=\""+_32+"\">"+_30+_35+"</v:shape>";
}else{
this.layer.objectCanvas.innerHTML+="<v:shape"+_33+_2f+_36+" coordorigin=\"0 0\" "+_34+" \" path=\""+_32+"\">"+_30+_35+"</v:shape>";
}
}
}
}else{
if(this.layer.objectCanvas&&this.layer.objectCanvas.getContext){
var ctx=this.layer.objectCanvas.getContext("2d");
ctx.globalAlpha=1;
ctx.beginPath();
ctx.lineWidth=this.lineWidth;
ctx.lineCap="round";
ctx.lineJoin="round";
if(this.type=="line"){
var _38=_29.lineInside(this.points,false);
if(_38==-1){
this.updateScreenPosition();
return;
}
var _39=_29.lineInside(this.points,true);
}else{
_38=0;
_39=this.points.length-1;
}
var _31=this.saMap.mapToScreenCoordinates(this.points[_38].x,this.points[_38].y);
ctx.moveTo(_31.x,_31.y);
var n=_39+1;
for(var i=_38;i<n;i++){
var _31=this.saMap.mapToScreenCoordinates(this.points[i].x,this.points[i].y);
ctx.lineTo(_31.x,_31.y);
if(this.type=="line"){
var _3a=this.points[i];
while(i<(n-2)){
var _3b=distance2D(_3a,this.points[i+1])*_26;
if(_3b<1){
i++;
}else{
break;
}
}
}
}
try{
ctx.fillStyle=this.color;
ctx.strokeStyle=this.color;
}
catch(e){
ctx.fillStyle="Red";
ctx.strokeStyle="Red";
}
if(this.type=="line"){
try{
ctx.globalAlpha=this.transparency;
}
catch(e){
ctx.globalAlpha=1;
}
ctx.stroke();
}else{
ctx.closePath();
ctx.stroke();
try{
ctx.globalAlpha=this.transparency;
}
catch(e){
ctx.globalAlpha=1;
}
if(isSafari2){
ctx.beginPath();
var _31=this.saMap.mapToScreenCoordinates(this.points[0].x,this.points[0].y);
ctx.moveTo(_31.x,_31.y);
for(var i=1;i<this.points.length;i++){
var _31=this.saMap.mapToScreenCoordinates(this.points[i].x,this.points[i].y);
ctx.lineTo(_31.x,_31.y);
}
ctx.closePath();
}
ctx.fill();
}
}else{
}
}
this.updateScreenPosition();
}
}
};
GeoObject.prototype.setVisible=function(_3c){
this.isHidden=!_3c;
if(this.clientNode){
setVisible(this.clientNode,!this.isHidden);
}
};
GeoObject.prototype.useSelectedIcon=function(){
if(this.clientNode){
if(this.selectedIcon&&this.selectedIcon.image!=""){
this.selectedIcon.applyConfiguration(this.clientNode.image);
this.setIconOffset(this.selectedIcon);
this.centerIcon();
}else{
if(this.defaultCombinedImage){
this.defaultCombinedImage.applyConfiguration(this.clientNode,this.attributes,true,this.saMap);
this.boundingArea=new DynamicBoundingArea(this.point,this.defaultCombinedImage,this.saMap);
}
}
}
};
GeoObject.prototype.useNormalIcon=function(){
if(this.clientNode){
if(this.icon){
this.icon.applyConfiguration(this.clientNode.image);
this.setIconOffset(this.icon);
this.centerIcon();
}else{
if(this.defaultCombinedImage){
this.defaultCombinedImage.applyConfiguration(this.clientNode,this.attributes,false,this.saMap);
this.boundingArea=new DynamicBoundingArea(this.point,this.defaultCombinedImage,this.saMap);
}
}
}
};
GeoObject.prototype.displayInfoBox=function(_3d){
this.infoBoxTimeout=_3d;
if(this.infoBox){
if(this.hideObjectInfoTimer){
clearTimeout(this.hideObjectInfoTimer);
this.hideObjectInfoTimer=null;
}
return;
}
if((this.type!="point")||(this.clientNode&&this.type=="point")){
if(this.saMap.activeinfoBoxObject&&this.saMap.activeinfoBoxObject.id!=this.id&&(!this.saMap.activeinfoBoxObject.infoBoxTimeout||this.saMap.activeinfoBoxObject.infoBoxTimeout>0)&&_3d>0){
this.saMap.activeinfoBoxObject.cancelInfoBox();
}
this.saMap.activeinfoBoxObject=this;
if(this.type=="point"){
this.useSelectedIcon();
}
this.infoBox=this.createInfo(false);
if(!this.hasInfoBoxContent){
this.infoBox=null;
return;
}
this.placeInfoBox();
}
};
GeoObject.prototype.placeInfoBox=function(){
if(this.infoBoxPositioning=="normal"||this.infoBoxPositioning=="alwaysAbove"||this.infoBoxPositioning=="centered"){
if(!this.infoBox.parentNode||((isIe6||isIe7)&&!this.infoBox.parentElement)){
document.body.appendChild(this.infoBox);
this.infoBoxMouseOverDelegate=associateObjWithEvent(this,"onInfoBoxMouseOver");
this.infoBoxMouseOutDelegate=associateObjWithEvent(this,"onInfoBoxMouseOut");
Evt.addEventListener(this.infoBox,"mouseover",this.infoBoxMouseOverDelegate,false);
Evt.addEventListener(this.infoBox,"mouseout",this.infoBoxMouseOutDelegate,false);
}
var _3e;
var _3f;
var _40=new GeoRectangle(0,0,0,0);
if(this.clientNode){
if(this.defaultCombinedImage){
_40=this.boundingArea.getBounds();
}else{
if(this.clientNode.offsetWidth!=0){
_40=new GeoRectangle(this.clientNode.offsetWidth/2,this.clientNode.offsetHeight/2,-this.clientNode.offsetWidth/2,-this.clientNode.offsetHeight/2);
}else{
if(this.selectedIcon&&this.selectedIcon.width&&this.selectedIcon.height){
_40=new GeoRectangle(stringToInt(this.selectedIcon.width,10)/2,stringToInt(this.selectedIcon.height,10)/2,-stringToInt(this.selectedIcon.width,10)/2,-stringToInt(this.selectedIcon.height,10)/2);
}else{
if(this.icon&&this.icon.width&&this.icon.height){
_40=new GeoRectangle(stringToInt(this.icon.width,10)/2,stringToInt(this.icon.height,10)/2,-stringToInt(this.icon.width,10)/2,-stringToInt(this.icon.height,10)/2);
}else{
if(this.icon&&this.iconOffsetX&&this.iconOffsetY){
_40=new GeoRectangle(this.iconOffsetX/2,this.iconOffsetY/2,-this.iconOffsetX/2,-this.iconOffsetY/2);
}
}
}
}
}
}
var _41=1/this.saMap.getPixelsToViewUnits();
if(this.defaultCombinedImage){
var _42=_40.xMax*_41;
var _43=_40.yMax*_41;
var _44=_40.xMin*_41;
var _45=_40.yMin*_41;
}else{
var _42=_40.xMax;
var _43=_40.yMax;
var _44=_40.xMin;
var _45=_40.yMin;
}
if(this.infoBoxPositioning=="centered"){
if(((this.viewX+_42+this.infoBox.offsetWidth+this.infoBoxMargin)>(this.saMap.mapWidth)-5)){
var _46=false;
_3e=this.viewX-_44-this.infoBoxMargin-this.infoBox.offsetWidth+cumulativeOffsetLeft(this.saMap.mapContainer);
}else{
var _46=true;
_3e=this.viewX-_42+this.infoBoxMargin+cumulativeOffsetLeft(this.saMap.mapContainer);
}
}else{
if(this.infoBoxPositioning=="alwaysAbove"){
_3e=this.viewX+_44+this.infoBoxMargin+cumulativeOffsetLeft(this.saMap.mapContainer);
}else{
if(((this.viewX+_42+this.infoBox.offsetWidth+this.infoBoxMargin)>(this.saMap.mapWidth)-5)&&this.infoBoxPositioning=="normal"){
_3e=this.viewX+_44-this.infoBoxMargin-this.infoBox.offsetWidth+cumulativeOffsetLeft(this.saMap.mapContainer);
}else{
_3e=this.viewX+_42+this.infoBoxMargin+cumulativeOffsetLeft(this.saMap.mapContainer);
}
}
}
if(this.infoBoxPositioning=="centered"){
if(((this.viewY-_43-this.infoBox.offsetHeight-this.infoBoxMargin)>5)){
_3f=this.viewY+_45-this.infoBoxMargin-this.infoBox.offsetHeight+cumulativeOffsetTop(this.saMap.mapContainer);
if(_46){
removeClass(this.infoBox,"topLeftInfoBox");
removeClass(this.infoBox,"bottomLeftInfoBox");
removeClass(this.infoBox,"bottomRightInfoBox");
addClass(this.infoBox,"topRightInfoBox");
}else{
removeClass(this.infoBox,"topRightInfoBox");
removeClass(this.infoBox,"bottomLeftInfoBox");
removeClass(this.infoBox,"bottomRightInfoBox");
addClass(this.infoBox,"topLeftInfoBox");
}
}else{
_3f=this.viewY+_43+this.infoBoxMargin+cumulativeOffsetTop(this.saMap.mapContainer);
if(_46){
removeClass(this.infoBox,"topLeftInfoBox");
removeClass(this.infoBox,"topRightInfoBox");
removeClass(this.infoBox,"bottomLeftInfoBox");
addClass(this.infoBox,"bottomRightInfoBox");
}else{
removeClass(this.infoBox,"topLeftInfoBox");
removeClass(this.infoBox,"topRightInfoBox");
removeClass(this.infoBox,"bottomRightInfoBox");
addClass(this.infoBox,"bottomLeftInfoBox");
}
}
if(isIe6||isIe7){
_3f+=document.body.scrollTop;
var wh=parseInt(document.documentElement.scrollHeight);
var ih=parseInt(document.body.scrollHeight);
var ww=parseInt(document.documentElement.scrollWidth);
var iw=parseInt(document.body.scrollWidth);
}
}else{
if(((this.viewY+_43+this.infoBox.offsetHeight+this.infoBoxMargin)>(this.saMap.mapHeight)-5)||this.infoBoxPositioning=="alwaysAbove"){
_3f=this.viewY+_45-this.infoBoxMargin-this.infoBox.offsetHeight+cumulativeOffsetTop(this.saMap.mapContainer);
}else{
_3f=this.viewY+_43+this.infoBoxMargin+cumulativeOffsetTop(this.saMap.mapContainer);
}
}
if(this.infoBoxPositioning=="alwaysAbove"){
if(isFireFox||isMozilla){
_3e-=document.body.scrollLeft;
}
setX(this.infoBox,_3e);
this.infoBox.style.top="auto";
if(isIe6||isIe7){
if(isIe6){
_3f=(document.body.offsetHeight-_45-this.infoBoxMargin-this.viewY-cumulativeOffsetTop(this.saMap.mapContainer))+document.body.scrollTop;
}else{
if(isIe7){
_3f=(document.body.offsetHeight-_45-this.infoBoxMargin-this.viewY-cumulativeOffsetTop(this.saMap.mapContainer));
}
}
var wh=parseInt(document.documentElement.scrollHeight);
var ih=parseInt(document.body.scrollHeight);
var ww=parseInt(document.documentElement.scrollWidth);
var iw=parseInt(document.body.scrollWidth);
this.infoBox.style.bottom=_3f+"px";
}else{
if(isFireFox||isMozilla){
this.infoBox.style.bottom=(document.body.offsetHeight-_45-this.infoBoxMargin-this.viewY-cumulativeOffsetTop(this.saMap.mapContainer))+document.body.scrollTop+"px";
}else{
this.infoBox.style.bottom=(document.body.offsetHeight-_45-this.infoBoxMargin-this.viewY-cumulativeOffsetTop(this.saMap.mapContainer))+"px";
}
}
}else{
if(isFireFox||isMozilla||isIe6||isIe7){
_3e-=document.body.scrollLeft;
_3f-=document.body.scrollTop;
}
setX(this.infoBox,_3e);
setY(this.infoBox,_3f);
}
}else{
if(this.infoBoxPositioning=="target"){
if(!this.infoBox.parentNode||((isIe6||isIe7)&&!this.infoBox.parentElement)){
this.infoBoxTarget.appendChild(this.infoBox);
}
}
}
this.hasInfoBox=true;
};
GeoObject.prototype.setInfoTimer=function(ms){
if(!ms&&this.infoBoxTimeout){
ms=this.infoBoxTimeout;
}
if(this.hideObjectInfoTimer){
clearTimeout(this.hideObjectInfoTimer);
}
if(ms>0){
this.hideObjectInfoTimer=setTimeout(associateObjWithEvent(this,"onHideObjectInfoTimer"),ms);
}
};
GeoObject.prototype.onHideObjectInfoTimer=function(evt,_4d){
this.hideObjectInfoTimer=null;
this.cancelInfoBox();
};
GeoObject.prototype.createInfo=function(_4e){
var _4f=document.createElement("div");
_4f.id="content"+this.id;
addClass(_4f,this.infoBoxElement.css);
_4f.style.position="absolute";
this.hasInfoBoxContent=false;
if(this.infoBoxParameters){
for(var i=0;i<this.infoBoxParameters.length;i++){
if(typeof (this.infoBoxAttributes[i])!="undefined"){
var _51=this.attributes[this.infoBoxAttributes[i]].value;
}else{
var _51=this.infoBoxParameters[i].value;
}
if(_51&&_51!=""){
if(this.infoBoxParameters[i].type=="string"){
this.hasInfoBoxContent=true;
var _52=document.createElement("div");
_52.className="rwcInfoBoxText";
_4f.appendChild(_52);
if(this.attributes[this.infoBoxAttributes[i]].label){
var _53=this.attributes[this.infoBoxAttributes[i]].label+_51;
}else{
if(this.infoBoxParameters[i].label){
var _53=this.infoBoxParameters[i].label+_51;
}else{
var _53=_51;
}
}
_52.innerHTML=_53;
}else{
if(this.infoBoxParameters[i].type=="image"){
this.hasInfoBoxContent=true;
var _52=document.createElement("img");
_52.className="rwcInfoBoxImage";
_4f.appendChild(_52);
setImageSource(_52,_51);
var _54=document.createElement("br");
_4f.appendChild(_54);
}else{
if(this.infoBoxParameters[i].type=="url"){
this.hasInfoBoxContent=true;
var _52=document.createElement("a");
_4f.appendChild(_52);
_52.className="rwcInfoBoxAnchor";
_52.target="_blank";
_52.href=_51;
if(this.attributes[this.infoBoxAttributes[i]].label){
_52.innerHTML=this.attributes[this.infoBoxAttributes[i]].label;
}else{
if(this.infoBoxParameters[i].label){
_52.innerHTML=this.infoBoxParameters[i].label;
}
}
var _54=document.createElement("br");
_4f.appendChild(_54);
}
}
}
}
}
}
return _4f;
};
GeoObject.prototype.onInfoBoxMouseOver=function(evt,_56){
clearTimeout(this.hideObjectInfoTimer);
this.hideObjectInfoTimer=null;
this.useSelectedIcon();
this.infoBoxSelected=true;
};
GeoObject.prototype.onInfoBoxMouseOut=function(evt,_58){
if(this.infoBoxTimeout){
this.setInfoTimer(this.infoBoxTimeout);
}
this.infoBoxSelected=false;
};
GeoObject.prototype.updateInfoBox=function(){
if(this.infoBox){
this.placeInfoBox();
if(this.viewX>this.saMap.mapWidth||this.viewX<0||this.viewY>this.saMap.mapHeight||this.viewY<0){
this.cancelInfoBox();
}
}
};
GeoObject.prototype.cancelInfoBox=function(){
this.useNormalIcon();
if(this.infoBox&&this.infoBox!=null){
clearTimeout(this.hideObjectInfoTimer);
this.hideObjectInfoTimer=null;
Evt.removeEventListener(this.infoBox,"mouseover",this.infoBoxMouseOverDelegate,false);
Evt.removeEventListener(this.infoBox,"mouseout",this.infoBoxMouseOutDelegate,false);
if(this.infoBox.parentNode){
this.infoBox.parentNode.removeChild(this.infoBox);
}
this.infoBox=null;
}
this.infoBoxSelected=false;
this.hasInfoBox=false;
};
GeoObject.prototype.setIconOffset=function(_59){
if(_59.height){
this.iconOffsetY=parseInt(_59.height);
}else{
this.iconOffsetY=0;
}
if(_59.width){
this.iconOffsetX=parseInt(_59.width);
}else{
this.iconOffsetX=25;
}
if(_59.height){
this.iconOffsetY=parseInt(_59.height);
}else{
this.iconOffsetY=25;
}
};
GeoObject.prototype.unload=function(){
this.cancelInfoBox();
};
GeoObject.prototype.setImage=function(_5a,_5b,_5c,_5d){
if(!this.icon){
this.icon=new ImageConfiguration();
}
this.icon.image=_5a;
this.icon.tooltip=_5d;
if(_5b){
this.icon.width=_5b+"px";
}
if(_5c){
this.icon.height=_5c+"px";
}
if(this.clientNode){
if(!this.clientNode.image){
this.clientNode.image=document.createElement("img");
}
this.icon.applyConfiguration(this.clientNode.image);
if(this.layer.container){
this.draw(this.saMap,this.layer.container,this.layer.isHidden,0);
}
}
};
GeoObject.prototype.setSelectedImage=function(_5e,_5f,_60,_61){
if(!_5e){
this.selectedIcon=null;
return;
}
if(!this.selectedIcon){
this.selectedIcon=new ImageConfiguration();
}
this.selectedIcon.image=_5e;
this.selectedIcon.tooltip=_61;
if(_5f){
this.selectedIcon.width=_5f+"px";
}else{
this.selectedIcon.width=this.icon.width;
}
if(_60){
this.selectedIcon.height=_60+"px";
}else{
this.selectedIcon.height=this.icon.height;
}
};
GeoObject.prototype.setPosition=function(x,y,_64){
if(_64&&(this.type=="poly"||this.type=="line")){
this.points=_64;
}
if(this.type=="point"){
this.point.x=x;
this.point.y=y;
}
this.updateIcons();
};
GeoObject.prototype.activate=function(){
if(!this.layer.container){
this.layer.draw();
}else{
this.draw(this.saMap,this.layer.container,false,0);
}
};
GeoObject.prototype.getAttribute=function(_65){
for(var i=0;i<this.attributes.length;i++){
if(this.attributes[i].name==_65){
return this.attributes[i].value;
}
}
return null;
};
GeoObject.prototype.setAttribute=function(_67,_68,_69){
var _6a=new Object();
_6a.name=_67;
_6a.value=_68;
_6a.label=_69;
for(var i=0;i<this.attributes.length;i++){
if(this.attributes[i].name==_6a.name){
this.attributes[i].value=_6a.value;
this.attributes[i].label=_6a.label;
this.updateIcons();
return;
}
}
this.attributes.push(_6a);
for(var i=0;i<this.objectParameters.length;i++){
if(this.objectParameters[i].name==_67){
this.objectAttributes[i]=this.attributes.length-1;
}else{
if(this.objectParameters[i].alternates){
for(var j=0;j<this.objectParameters[i].alternates.length;j++){
if(this.objectParameters[i].alternates[j]==_67){
this.objectAttributes[i]=this.attributes.length-1;
break;
}
}
}
}
}
for(var i=0;i<this.infoBoxParameters.length;i++){
if(this.infoBoxParameters[i].name==_67){
this.infoBoxAttributes[i]=this.attributes.length-1;
}else{
if(this.infoBoxParameters[i].alternates){
for(var j=0;j<this.infoBoxParameters[i].alternates.length;j++){
if(this.infoBoxParameters[i].alternates[j]==_67){
this.infoBoxAttributes[i]=this.attributes.length-1;
break;
}
}
}
}
}
if(this.layer.searchControl){
for(var i=0;i<this.layer.searchControl.searchAttributes.length;i++){
if(this.layer.searchControl.searchAttributes[i]==_67){
this.searchAttributes[i]=_68.toLowerCase();
}
}
}
this.updateIcons();
};
function BoundingArea(_6d,_6e,_6f,_70,_71){
this.maxX=Number.NEGATIVE_INFINITY;
this.maxY=Number.NEGATIVE_INFINITY;
this.minX=Number.MAX_VALUE;
this.minY=Number.MAX_VALUE;
this.centerpoint=new Object();
this.type=_6f;
this.saMap=_70;
this.padding=_71;
if(isNaN(this.padding)){
this.padding=10;
}
if(_6e){
this.points=_6e;
for(var i=0;i<_6e.length;i++){
if(_6e[i].x>this.maxX){
this.maxX=_6e[i].x;
}
if(_6e[i].x<this.minX){
this.minX=_6e[i].x;
}
if(_6e[i].y>this.maxY){
this.maxY=_6e[i].y;
}
if(_6e[i].y<this.minY){
this.minY=_6e[i].y;
}
}
this.width=this.maxX-this.minX;
this.height=this.maxY-this.minY;
this.centerpoint.x=this.maxX-this.width/2;
this.centerpoint.y=this.maxY-this.height/2;
}else{
this.maxX=_6d.x;
this.maxY=_6d.y;
this.minX=_6d.x;
this.minY=_6d.y;
this.centerpoint=_6d;
}
this.maxX=parseFloat(this.maxX);
this.maxY=parseFloat(this.maxY);
this.minX=parseFloat(this.minX);
this.minY=parseFloat(this.minY);
}
BoundingArea.prototype.inside=function(x,y){
var _75=this.padding*this.saMap.tileGeoWidth/this.saMap.tileSize;
if((x>=this.minX-_75&&x<=this.maxX+_75)&&(y>=this.minY-_75&&y<=this.maxY+_75)){
if(this.type=="point"){
return true;
}else{
return this.edgeTest(x,y);
}
}else{
return false;
}
};
BoundingArea.prototype.lineInside=function(_76,_77){
if(_76&&_76.length>1){
if(_77){
for(var i=_76.length-1;i>0;i--){
var _79=this.lineTest(_76[i].x,_76[i].y,_76[i-1].x,_76[i-1].y);
if(_79){
return i;
}
}
}else{
for(var i=0;i<_76.length-1;i++){
var _79=this.lineTest(_76[i].x,_76[i].y,_76[i+1].x,_76[i+1].y);
if(_79){
return i;
}
}
}
}
return -1;
};
BoundingArea.prototype.lineTest=function(x1,y1,x2,y2){
var Ax=x1-x2;
if(Ax>0){
if(this.maxX<x2||x1<this.minX){
return false;
}
}else{
if(this.maxX<x1||x2<this.minX){
return false;
}
}
var Ay=y1-y2;
if(Ay>0){
if(this.maxY<y2||y1<this.minY){
return false;
}
}else{
if(this.maxY<y1||y2<this.minY){
return false;
}
}
return true;
};
BoundingArea.prototype.boundingAreaInside=function(_80){
var cx=_80.maxX-this.maxX;
if(cx>0){
if(_80.minX>this.maxX){
return false;
}
}else{
if(this.minX>_80.maxX){
return false;
}
}
var cy=_80.maxY-this.maxY;
if(cy>0){
if(_80.minY>this.maxY){
return false;
}
}else{
if(this.minY>_80.maxY){
return false;
}
}
return true;
};
BoundingArea.prototype.edgeTest=function(x,y){
if(this.points){
var _85=this.saMap.point(x,y);
if(this.type=="line"){
var _86=pointToLineDistance2D(_85,this.points);
viewUnitsToPixels=this.saMap.tileSize/this.saMap.tileGeoWidth;
_86=_86*viewUnitsToPixels;
if(_86<3){
return true;
}else{
return false;
}
}else{
return pointInPolygon2D(_85,this.points);
}
}
};
function DynamicBoundingArea(_87,_88,_89){
this.point=_87;
this.combinedImage=_88;
this.saMap=_89;
}
DynamicBoundingArea.prototype.inside=function(x,y){
if(!this.imageBounds){
var _8c=this.combinedImage.bounds(this.saMap);
if(_8c.complete){
this.imageBounds=_8c;
}
}
x-=this.point.x;
y=-(y-this.point.y);
if(this.imageBounds){
var _8d=this.point.x+this.imageBounds.xMin;
var _8e=this.point.y+this.imageBounds.yMin;
var _8f=this.point.x+this.imageBounds.xMax;
var _90=this.point.y+this.imageBounds.yMax;
if(x>=_8d&&x<=_8f&&y>=_8e&&y<=_90){
return this.combinedImage.inside(x-this.point.x,y-this.point.y,this.saMap);
}
}else{
return this.combinedImage.inside(x,y,this.saMap);
}
return false;
};
DynamicBoundingArea.prototype.getBounds=function(){
return this.combinedImage.bounds(this.saMap);
};

function Layer(id,_2,_3,_4,_5,_6,_7,_8,_9){
this.id=id;
var _a=new LayerIdObject(id);
this.sublayerID=new Array();
this.sublayerID.push(_a);
this.sublayerName=new Array();
this.sublayerName.push(_2);
this.sublayerUseLayerControl=new Array();
this.sublayerUseLayerControl.push(_7);
this.name=_2;
this.type=_3;
this.layerNr=_4;
this.saMap=_5;
this.isZooming=false;
this.isNonTileLayer=!_6;
this.haveRouteSearch=_8;
if(this.haveRouteSearch){
_5.routeLayer=this;
}
this.imageFormat=this.saMap.config.viewSettings.imageFormat;
if(_9){
this.allowClientObjects=true;
}
}
Layer.prototype.merge=function(id,_c,_d,_e){
this.id+=","+id;
var _f=new LayerIdObject(id);
this.sublayerID.push(_f);
this.sublayerName.push(_c);
this.sublayerUseLayerControl.push(_d);
if(this.container){
this.container.id+=id;
}
if(_e){
this.allowClientObjects=true;
}
};
Layer.prototype.createTiles=function(_10,_11,_12,_13,_14,_15,_16){
if(this.isNonTileLayer){
this.nRows=1;
this.nCols=1;
this.layerOffsetX=Math.floor(-(_14-this.saMap.mapWidth)/4);
this.layerOffsetY=Math.floor(-(_14-this.saMap.mapHeight)/4);
this.paddingX=(_14-this.saMap.mapWidth)/2;
this.paddingY=(_14-this.saMap.mapHeight)/2;
}else{
this.nRows=_10;
this.nCols=_11;
this.paddingX=_12;
this.paddingY=_13;
this.layerOffsetX=Math.round((_14)/2*-((Math.ceil(_11/2)-Math.floor(_11/2))-1));
this.layerOffsetY=Math.round((_14)/2*-((Math.ceil(_10/2)-Math.floor(_10/2))-1));
}
this.tileSize=_14;
this.tileGeoWidth=_15;
this.relativeOffsetX=this.layerOffsetX;
this.relativeOffsetY=this.layerOffsetY;
this.tiles=new Array();
var i=0;
for(var row=0;row<this.nRows;row++){
for(var col=0;col<this.nCols;col++){
var t=new Tile(this.saMap,row,col,_14,this.saMap.prefix+_16+"tile",this);
this.tiles[i++]=t;
}
}
if(this.isNonTileLayer){
this.buffer=new Tile(this.saMap,0,0,this.tileSize,this.saMap.prefix+this.layerNr+"buffer",this);
this.buffer.isHidden=true;
}
};
Layer.prototype.draw=function(){
if(isOpera&&this.isHidden){
return;
}
if(this.container&&this.container.parentNode){
this.container.parentNode.removeChild(this.container);
}
this.container=document.createElement("div");
this.container.id=this.saMap.prefix+"layer"+this.layerNr;
this.container.className="rwcLayerContainer";
if(this.isHidden){
addClass(this.container,"rwcNoPrint");
this.container.style.display="none";
}
var n=this.tiles.length;
for(var i=0;i<n;i++){
this.tiles[i].draw(this.container,this.isZooming,this.dimmed);
}
if(this.isNonTileLayer){
this.buffer.draw(this.container,this.isZooming,this.dimmed);
this.bufferLoadedDelegate=associateObjWithEvent(this,"bufferLoaded");
Evt.addEventListener(this.buffer.node,"load",this.bufferLoadedDelegate);
}
var _1d=-1;
if(this.saMap.view.overlayArray){
for(var i=0;i<this.saMap.view.overlayArray.length;i++){
if(this.saMap.view.overlayArray[i].container){
_1d=i;
break;
}
}
}
if(_1d!=-1){
this.saMap.mapContainer.insertBefore(this.container,this.saMap.view.overlayArray[_1d].container);
}else{
this.saMap.mapContainer.appendChild(this.container);
}
};
Layer.prototype.enableClientObjects=function(){
if(!this.allowClientObjects){
return;
}
this.haveClientObjects=true;
this.geoObjectLayer=new OverlayLayer(this.sublayerID[0].id+"ClientObjects",this.sublayerID[0].id+"ClientObjects",0,this.saMap,false,false,false);
var _1e=this.saMap.config.getLayerConfiguration("");
this.geoObjectLayer.createDefaults(_1e,null);
this.geoObjectLayer.noUpdate=true;
this.geoObjectLayer.isUserLayer=true;
this.geoObjectLayer.geoObjectArray=new Array();
this.geoObjectLayer.draw();
this.geoObjectLayer.hide();
};
Layer.prototype.dim=function(_1f){
this.dimmed=true;
this.dimColor=_1f;
var n=this.tiles.length;
for(var i=0;i<n;i++){
this.tiles[i].dim(this.dimColor);
}
};
Layer.prototype.undim=function(){
this.dimmed=false;
var n=this.tiles.length;
for(var i=0;i<n;i++){
this.tiles[i].undim();
}
};
Layer.prototype.insertObject=function(_24,_25){
if(!this.haveClientObjects){
return;
}
if(_25&&!isNaN(_25)){
geoObject.priority=_25;
}else{
_25=0;
}
for(var i=0;i<this.geoObjectArray.length;i++){
if(this.geoObjectArray[i].priority&&this.geoObjectArray[i].priority>_25){
this.geoObjectArray=this.geoObjectArray.insert(i,geoObject);
return;
}
}
this.geoObjectArray.push(geoObject);
};
Layer.prototype.bufferLoaded=function(){
if(!isIe6){
Evt.removeEventListener(this.buffer.node,"load",this.bufferLoadedDelegate);
setVisible(this.tiles[0].node,false);
this.tiles[0].unload();
this.tiles[0]=this.buffer;
this.tiles[0].node.id=this.saMap.prefix+this.layerNr+"tile00";
this.relativeOffsetX=this.newOffsetX;
this.relativeOffsetY=this.newOffsetY;
this.offset(this.saMap.totalOffsetX,this.saMap.totalOffsetY,this.paddingX,this.paddingY);
if(!this.isHidden){
setVisible(this.tiles[0].node,true);
this.tiles[0].isHidden=false;
}
this.buffer=new Tile(this.saMap,0,0,this.tileSize,this.saMap.prefix+this.layerNr+"buffer",this);
this.buffer.isHidden=true;
this.buffer.draw(this.container,this.isZooming,this.dimmed);
this.bufferLoadedDelegate=associateObjWithEvent(this,"bufferLoaded");
Evt.addEventListener(this.buffer.node,"load",this.bufferLoadedDelegate);
}else{
this.tiles[0].node.src="/pic/blank.gif";//Kristoffer added /
setVisible(this.tiles[0].node,false);
this.tiles[0].isHidden=true;
this.relativeOffsetX=this.newOffsetX;
this.relativeOffsetY=this.newOffsetY;
this.offset(this.saMap.totalOffsetX,this.saMap.totalOffsetY,this.paddingX,this.paddingY);
this.tiles[0].node.src=this.buffer.node.src;
if(!this.isHidden){
setVisible(this.tiles[0].node,true);
this.tiles[0].isHidden=false;
}
}
};
Layer.prototype.pixelOffset=function(_27,_28){
if(this.isNonTileLayer){
var x=getX(this.tiles[0].node);
var y=getY(this.tiles[0].node);
setX(this.tiles[0].node,x+_27);
setY(this.tiles[0].node,y+_28);
}else{
var n=this.tiles.length;
for(var i=0;i<n;i++){
this.tiles[i].pixelOffset(_27,_28,this.nRows,this.nCols);
}
}
};
Layer.prototype.offset=function(_2d,_2e){
var _2f=_2d+this.relativeOffsetX;
var _30=_2e+this.relativeOffsetY;
var _31=-Math.round(_2f/this.tileSize);
var _32=Math.round(this.tileSize*(_31+_2f/this.tileSize));
var _33=-Math.round(_30/this.tileSize);
var _34=Math.round(this.tileSize*(_33+_30/this.tileSize));
var n=this.tiles.length;
for(var i=0;i<n;i++){
this.tiles[i].offset(_31,_32,_33,_34,this.paddingX,this.paddingY);
}
};
Layer.prototype.getTilesGeoBoundingBox=function(){
var _37=new GeoRectangle();
for(var i=0;i<this.tiles.length;i++){
var _39=this.tiles[i].getGeoCenter();
if(!_39){
continue;
}
var _3a=_39.x-this.saMap.tileGeoWidth/2;
var _3b=_39.x+this.saMap.tileGeoWidth/2;
var _3c=_39.y-this.saMap.tileGeoWidth/2;
var _3d=_39.y+this.saMap.tileGeoWidth/2;
var _3e=new GeoRectangle(_3b,_3d,_3a,_3c);
_37=_37.union(_3e,_37);
}
return _37;
};
Layer.prototype.refresh=function(_3f){
if(!this.isZooming){
this.removeZoomTiles();
}
this.buildRequestString();
if(this.isNonTileLayer){
this.relativeOffsetX=this.layerOffsetX-this.saMap.totalOffsetX;
this.relativeOffsetY=this.layerOffsetY-this.saMap.totalOffsetY;
this.offset(this.saMap.totalOffsetX,this.saMap.totalOffsetY,this.paddingX,this.paddingY);
this.updateSingleTile(this.buffer);
}
var n=this.tiles.length;
for(var i=0;i<n;i++){
this.updateSingleTile(this.tiles[i]);
}
};
Layer.prototype.startZoom=function(_42){
this.isZooming=true;
if(this.isHidden){
return;
}
this.zoomTiles=new Array();
var i=0;
for(var row=0;row<this.nRows;row++){
for(var col=0;col<this.nCols;col++){
this.zoomTiles[i]=new Tile(this.saMap,row,col,this.tileSize,("zoomTile"+row)+col,this);
this.zoomTiles[i].copyTilePosition(this.tiles[i]);
this.zoomTiles[i].backupPositionForZoom();
this.zoomTiles[i].node.src=this.tiles[i].node.src;
if(!this.tiles[i].reloading&&this.zoomTiles[i].node){
setVisible(this.zoomTiles[i].node,true);
}
_42.appendChild(this.zoomTiles[i].node);
if(this.dimmed){
this.zoomTiles[i].dim(this.dimColor);
}
i++;
}
}
};
Layer.prototype.zoom=function(_46){
if(!this.isHidden){
var _47=this.saMap.zoomOldTileGeoWidth/this.saMap.zoomNewTileGeoWidth;
var _48=0;
if(_46!=0){
var _49=this.tileSize*_47;
var _4a=Math.round(this.tileSize+(_49-this.tileSize)*_46);
var _4b=(this.tileSize*this.nCols);
var _4c=(this.tileSize*this.nRows);
var _4d=Math.round(_4b+(_4b*_47-_4b)*_46);
var _4e=Math.round(_4c+(_4c*_47-_4c)*_46);
var _4f=Math.round(_4d/_4a);
var _50=(_4a*_4f)!=_4d;
if(_50!=0){
_48=1;
}
}
var n=this.zoomTiles.length;
for(var i=0;i<n;i++){
tileUpdateData=this.zoomTiles[i].zoom(_46,_47,_48);
}
}
};
Layer.prototype.endZoom=function(){
this.isZooming=false;
};
Layer.prototype.buildRequestString=function(){
var _53=this.getVisibleLayersID();
if(_53==null){
this.mapRequestString="";
return;
}
if(_53!=""){
var _54="&layers="+_53;
}else{
var _54="";
}
if(this.imageFormat!=""){
imageFormatString="&format="+this.imageFormat;
}
var _55="";
if((this.imageFormat=="gif"||(this.imageFormat=="png"&&!isIe6))&&this.layerNr!=0){
_55="&transparent=true";
}else{
_55="&transparent=false";
}
var _56;
if(this.saMap.fixedScales){
var _57=(this.saMap.tileGeoWidth*this.saMap.geoWidthToScale)-2;
_56="&scale="+_57;
}else{
var _57=this.tileGeoWidth;
_56="&geowidth="+_57;
}
if(isNaN(this.tileSize)||this.tileSize<=0||this.tileSize>Number.MAX_VALUE||isNaN(_57)||(_57)<Number.MIN_VALUE||(_57)>Number.MAX_VALUE){
return "";
}
if(this.saMap.config.viewSettings.mapTileService&&this.saMap.config.viewSettings.mapTileService!=""){
var _58=this.saMap.config.viewSettings.mapTileService;
}else{
var _58=this.saMap.mapServerUrl;
}
this.mapRequestString=_58+"RWCInterface.axd?view="+this.saMap.viewName+imageFormatString+_55+_54+"&width="+this.tileSize+"&height="+this.tileSize+_56;
if(this.customAttributes){
for(variable in this.customAttributes){
if(typeof (this.customAttributes[variable])!="function"&&this.customAttributes[variable]){
this.mapRequestString=this.mapRequestString+"&context-"+variable+"="+this.customAttributes[variable];
}
}
}
};
Layer.prototype.updateSingleTile=function(_59){
if(this.mapRequestString==""||this.isHidden){
if(_59.node.src!="/pic/blank.gif"&&(!this.isHidden||_59.node.src!="")){
_59.node.src="/pic/blank.gif";
}//kristoffer added /
return;
}
var _5a=this.tileGeoWidth/this.tileSize;
var x=this.saMap.initialGeoCenterX+this.tileGeoWidth*(_59.col-(Math.ceil(this.nCols/2)-1));
var y=this.saMap.initialGeoCenterY+this.tileGeoWidth*(-_59.row+(Math.ceil(this.nRows/2)-1));
if(this.isNonTileLayer){
this.newOffsetX=this.layerOffsetX-this.saMap.totalOffsetX;
this.newOffsetY=this.layerOffsetY-this.saMap.totalOffsetY;
x=this.saMap.initialGeoCenterX-_5a*this.saMap.totalOffsetX;
y=this.saMap.initialGeoCenterY+_5a*this.saMap.totalOffsetY;
}
geoCenterString="&x="+x+"&y="+y;
var _5d="";
if(this.haveClientObjects){
var _5e=Math.floor((this.saMap.config.viewSettings.requestMaxLength-this.mapRequestString.length-geoCenterString.length)/8);
var _5f=new Array();
var _60=new RWCPoint(x-this.tileGeoWidth/2,y+this.tileGeoWidth/2);
var _61=new RWCPoint(x+this.tileGeoWidth/2,y-this.tileGeoWidth/2);
_5f.push(_60);
_5f.push(_61);
var _62=new BoundingArea(null,_5f,"line",this.saMap,0);
_5d=this.saMap.encodeClientObjects(this.geoObjectLayer.geoObjectArray,_62,_5e);
}
var url=this.mapRequestString+geoCenterString+_5d;
_59.refreshImage(url);
var _64=new RWCPoint();
_64.x=x;
_64.y=y;
_59.setGeoCenter(_64);
};
Layer.prototype.getVisibleLayersID=function(){
var _65="";
var _66=0;
for(var i=0;i<this.sublayerID.length;i++){
if(!this.sublayerID[i].isHidden){
if(_65!=""){
_65+=",";
}
_65+=this.sublayerID[i].id;
_66++;
}
}
if(_66==0){
return null;
}else{
return _65;
}
};
Layer.prototype.show=function(id){
foundLayer=false;
if(this.sublayerID.length==1){
foundLayer=true;
this.isHidden=false;
this.sublayerID[0].isHidden=false;
}else{
for(var i=0;i<this.sublayerID.length;i++){
if(this.sublayerID[i].id==id){
foundLayer=true;
this.isHidden=false;
this.sublayerID[i].isHidden=false;
}
}
}
if(foundLayer){
if(this.type=="background"&&this.saMap.backgroundControl){
if(this.backgroundIndex!=this.saMap.backgroundControl.activeBackgroundIndex){
this.saMap.backgroundControl.switchBackground(this.backgroundIndex);
return;
}
}
if(this.container){
removeClass(this.container,"rwcNoPrint");
this.container.style.display="block";
}
if(isOpera&&!this.container){
if(this.container){
this.unload();
}
this.draw();
}
if(this.saMap.layerControl){
this.saMap.layerControl.showLayer(id);
}
var n=this.tiles.length;
for(var j=0;j<n;j++){
this.tiles[j].isHidden=false;
}
this.refresh();
}
};
Layer.prototype.hide=function(id){
if(this.type=="background"&&this.saMap.backgroundControl&&this.backgroundIndex==this.saMap.backgroundControl.activeBackgroundIndex){
return;
}
visibleCount=0;
foundLayer=false;
if(this.sublayerID.length==1&&(!id||this.sublayerID[0].id==id)){
foundLayer=true;
this.sublayerID[0].isHidden=true;
visibleCount=0;
}else{
for(var i=0;i<this.sublayerID.length;i++){
if(this.sublayerID[i].id==id){
foundLayer=true;
this.sublayerID[i].isHidden=true;
}else{
if(!this.sublayerID[i].isHidden){
visibleCount++;
}
}
}
}
if(this.container){
addClass(this.container,"rwcNoPrint");
}
this.removeZoomTiles();
if(foundLayer&&this.saMap.layerControl){
this.saMap.layerControl.hideLayer(id);
}
if(visibleCount==0){
if(this.container){
this.container.style.display="none";
}
this.isHidden=true;
var n=this.tiles.length;
for(var j=0;j<n;j++){
this.tiles[j].isHidden=true;
setVisible(this.tiles[j].node,false);
if(this.tiles[j].dimFilter){
setVisible(this.tiles[j].dimFilter,false);
}
}
}else{
if(foundLayer){
this.refresh();
}
}
};
Layer.prototype.removeZoomTiles=function(){
if(this.saMap.view.zoomContainer){
if(this.zoomTiles){
for(var i=0;i<this.zoomTiles.length;i++){
this.zoomTiles[i].unload();
}
}
this.saMap.view.zoomContainer.parentNode.removeChild(this.saMap.view.zoomContainer);
this.saMap.view.zoomContainer=null;
}
};
Layer.prototype.unload=function(){
this.removeZoomTiles();
var n=this.tiles.length;
for(var i=0;i<n;i++){
this.tiles[i].unload();
}
try{
this.buffer.unload();
Evt.removeEventListener(this.buffer.node,"load",this.bufferLoadedDelegate);
this.container.parentNode.removeChild(this.container);
}
catch(e){
}
};
Layer.prototype.getType=function(){
return "ServerLayer";
};
Layer.prototype.addAttribute=function(_73,_74){
if(!this.customAttributes){
this.customAttributes=new Object();
}
this.customAttributes[_73]=_74;
};
Layer.prototype.removeAttribute=function(_75){
if(this.customAttributes){
this.customAttributes[_75]=null;
}
};
function OverlayLayer(id,_77,_78,_79,_7a,_7b,_7c){
this.id=id;
if(!this.id){
this.id="-1";
}
var _7d=new LayerIdObject(id);
this.name=_77;
this.type="objects";
this.useLayerControl=_7b;
this.layerNr=_78;
this.saMap=_79;
this.searchEnabled=_7a;
this.haveRouteSearch=_7c;
if(this.haveRouteSearch){
_79.routeLayer=this;
}
}
OverlayLayer.prototype.createDefaults=function(_7e,_7f){
this.configuration=new Object();
this.configuration.route=new Object();
this.configuration.route=_7e.route;
this.configuration.search=new Object();
this.configuration.downloadBehavior=_7e.downloadBehavior;
this.configuration.search.zoomToResults=_7e.search.zoomToResults;
this.configuration.searchControl=_7e.search.searchControl;
this.configuration.search.searchResults=_7e.search.searchResults;
this.configuration.properties=this.buildParameterList(_7e.geoObjects.parameters,_7f);
this.configuration.defaultCombinedImage=_7e.geoObjects.defaultCombinedImage;
if(_7e.infoBox){
this.configuration.infoBox=_7e.infoBox.clone();
this.configuration.infoBox.parameters=this.buildParameterList(_7e.infoBox.parameters,_7f);
this.configuration.infoBox.positioning=_7e.infoBox.positioning;
this.configuration.infoBox.margin=_7e.infoBox.margin;
}
this.numbered=_7e.geoObjects.numbered;
if(_7e.shapes){
if(_7e.shapes.polygons){
this.configuration.polygons=new Object();
this.configuration.polygons.parameters=this.buildParameterList(_7e.shapes.polygons.parameters,_7f);
this.configuration.polygons.conditions=_7e.shapes.polygons.conditions;
}
if(_7e.shapes.lines){
this.configuration.lines=new Object();
this.configuration.lines.parameters=this.buildParameterList(_7e.shapes.lines.parameters,_7f);
this.configuration.lines.conditions=_7e.shapes.lines.conditions;
}
}
if(this.haveRouteSearch){
if(this.configuration.route&&this.configuration.route.drivingDirections&&this.configuration.route.drivingDirections.active){
switch(this.configuration.route.drivingDirections.mode){
case ("docked"):
setVisible(this.saMap.dockingArea,true);
var _80=this.saMap.dockingArea;
break;
case ("overlay"):
var _80=this.saMap.embedDiv;
break;
case ("standalone"):
var _80=document.body;
break;
}
this.drivingDirections=new DrivingDirectionsControl(_80,this.saMap,this,this.saMap.prefix,_7e.route);
if(this.configuration.route.drivingDirections.mode=="docked"){
this.saMap.dockingOffset=Math.max(this.saMap.dockingOffset,this.drivingDirections.container.offsetHeight);
}
}
}
if(this.searchEnabled){
this.configuration.search.properties=this.buildParameterList(_7e.search.searchResults.parameters,_7f);
this.configuration.search.controlGroups=_7e.search.searchParameters.controlGroups;
if(this.configuration.searchControl.active){
switch(this.configuration.searchControl.mode){
case ("docked"):
setVisible(this.saMap.dockingArea,true);
var _81=this.saMap.dockingArea;
break;
case ("overlay"):
var _81=this.saMap.embedDiv;
break;
case ("standalone"):
var _81=document.body;
break;
}
this.maxCount=_7e.downloadBehavior.maxCount;
this.searchControl=new SearchControl(_81,this.saMap.mapServerUrl,this.saMap,this,this.saMap.prefix,_7e.search,_7e.downloadBehavior);
if(this.configuration.searchControl.mode=="docked"){
this.saMap.dockingOffset=Math.max(this.saMap.dockingOffset,this.searchControl.container.offsetHeight);
}
}
}
if(_7e.downloadBehavior.downloadModel=="once"){
this.downloadOnce=true;
this.getAll=true;
}else{
if(_7e.downloadBehavior.downloadModel=="getall"){
this.getAll=true;
}else{
if(_7e.downloadBehavior.downloadModel=="grid"){
this.useGrid=true;
}
}
}
if(_7e.downloadBehavior.timeout>0){
this.timeout=_7e.downloadBehavior.timeout*1000;
this.reloadTimer=setTimeout(associateObjWithEvent(this,"reload"),this.timeout);
}
};
OverlayLayer.prototype.reload=function(){
this.refresh(true);
};
OverlayLayer.prototype.buildParameterList=function(_82,_83){
var _84=new Array();
if(!_82){
return;
}
var n1=_82.length;
for(var i=0;i<n1;i++){
_84[i]=_82[i].clone();
if(_83){
var _87=false;
for(var j=0;j<_83.Properties.length;j++){
if(_83.Properties[j].Name==_82[i].name){
_84[i].value=_83.Properties[j].Value;
_87=true;
break;
}
}
if(!_87){
var n2=_82[i].alternates.length;
for(var j=0;j<n2;j++){
for(var k=0;k<_83.Properties[k].length;k++){
if(_83.Properties[k].Name==_82[i].alternates[j]){
_84[i].value=_83.Properties[k].Value;
_87=true;
break;
}
}
if(_87){
break;
}
}
}
}
}
return _84;
};
OverlayLayer.prototype.draw=function(){
if(this.container&&this.container.parentNode){
this.container.parentNode.removeChild(this.container);
}
if(isSafari2&&this.objectCanvas&&this.objectCanvas.parentNode){
this.objectCanvas.parentNode.removeChild(this.objectCanvas);
}
this.container=document.createElement("div");
this.container.id=this.saMap.prefix+"objectLayer"+this.layerNr;
this.container.className="rwcLayerContainer";
if(this.isHidden){
addClass(this.container,"rwcNoPrint");
this.container.style.display="none";
}
this.objectCanvas=this.createCanvas();
setX(this.objectCanvas,0);
setY(this.objectCanvas,0);
if(isIe6||isIe7){
this.tempCanvas=this.objectCanvas;
if(this.geoObjectArray){
var n=this.geoObjectArray.length;
for(var i=0;i<n;i++){
this.geoObjectArray[i].draw(this.saMap,this.container,this.isHidden,i);
}
}
this.tempCanvas=null;
}
if(isSafari2){
this.saMap.mapContainer.appendChild(this.objectCanvas);
}else{
this.container.appendChild(this.objectCanvas);
}
if(this.saMap.zoomActive){
setVisible(this.container,false);
setVisible(this.objectCanvas,false);
}
if(!isIe6&&!isIe7){
if(this.geoObjectArray){
var n=this.geoObjectArray.length;
for(var i=0;i<n;i++){
this.geoObjectArray[i].draw(this.saMap,this.container,this.isHidden,i);
}
}
}
this.saMap.mapContainer.appendChild(this.container);
};
OverlayLayer.prototype.createCanvas=function(){
if(isIe6||isIe7){
var _8d=document.createElement("div");
_8d.className="rwcCanvasOverlay";
}else{
var _8d=document.createElement("canvas");
_8d.className="rwcCanvasOverlay";
addClass(_8d,"rwcNoPrint");
_8d.width=this.saMap.mapWidth;
_8d.height=this.saMap.mapHeight;
}
return _8d;
};
OverlayLayer.prototype.updateCanvas=function(){
if(!this.container){
this.draw();
return;
}
var _8e=this.createCanvas();
if(isIe6||isIe7){
this.tempCanvas=_8e;
this.drawShapes();
this.tempCanvas=null;
}
if(isSafari2){
this.saMap.mapContainer.insertBefore(_8e,this.objectCanvas);
}else{
this.container.insertBefore(_8e,this.objectCanvas);
}
setX(_8e,0);
setY(_8e,0);
setVisible(_8e,false);
this.objectCanvas.parentNode.removeChild(this.objectCanvas);
this.objectCanvas=_8e;
if(!isIe6&&!isIe7){
this.drawShapes();
}
if(!this.saMap.zoomActive){
setVisible(_8e,true);
}
};
OverlayLayer.prototype.drawShapes=function(){
if(!this.container){
this.draw();
}
if(this.geoObjectArray){
var n=this.geoObjectArray.length;
for(var i=0;i<n;i++){
if(this.geoObjectArray[i].type=="poly"||this.geoObjectArray[i].type=="line"){
this.geoObjectArray[i].draw(this.saMap,this.container,this.isHidden);
}
}
}
};
OverlayLayer.prototype.show=function(){
this.isHidden=false;
if(this.searchEnabled&&this.searchControl){
this.searchControl.addResults(this.searchControl.startIndex);
}else{
if(this.geoObjectArray){
var n=this.geoObjectArray.length;
for(var i=0;i<n;i++){
this.geoObjectArray[i].setVisible(true);
}
}
}
this.updateCanvas();
if(this.container){
removeClass(this.container,"rwcNoPrint");
this.container.style.display="block";
}else{
this.draw();
}
if(this.saMap.layerControl){
this.saMap.layerControl.showLayer(this.id);
}
};
OverlayLayer.prototype.hide=function(){
this.isHidden=true;
if(this.geoObjectArray){
var n=this.geoObjectArray.length;
for(var i=0;i<n;i++){
this.geoObjectArray[i].setVisible(false);
}
}
this.updateCanvas();
if(this.container){
addClass(this.container,"rwcNoPrint");
this.container.style.display="none";
}
if(this.saMap.layerControl){
this.saMap.layerControl.hideLayer(this.id);
}
};
OverlayLayer.prototype.refresh=function(_95){
if(this.noUpdate||!_95){
if(this.geoObjectArray){
var n=this.geoObjectArray.length;
for(var i=0;i<n;i++){
this.geoObjectArray[i].updateScreenPosition();
}
}
}else{
if(!this.useLayerControl||!this.saMap.layerControl||this.saMap.layerControl.isVisible(this.id)){
this.getGeoObjects(this.saMap.mapServerUrl,this.saMap,0,0,this.saMap.nCols*this.saMap.tileSize,this.saMap.nRows*this.saMap.tileSize,_95);
}
}
};
OverlayLayer.prototype.pixelOffset=function(_98,_99){
if(this.geoObjectArray){
var n=this.geoObjectArray.length;
for(var i=0;i<n;i++){
this.geoObjectArray[i].pixelOffset(_98,_99);
}
}
if(this.objectCanvas){
var _9c=getX(this.objectCanvas);
var _9d=getY(this.objectCanvas);
setX(this.objectCanvas,_9c+_98);
setY(this.objectCanvas,_9d+_99);
}
};
OverlayLayer.prototype.updateSearchControl=function(){
if(this.searchControl){
this.searchControl.addResults(this.searchControl.startIndex);
}
};
OverlayLayer.prototype.getGeoObjects=function(url,_9f,_a0,_a1,_a2,_a3){
if(this.id=="-1"||this.noUpdate&&!forceReload){
return;
}
if(this.timeout){
clearTimeout(this.reloadTimer);
this.reloadTimer=setTimeout(associateObjWithEvent(this,"reload"),this.timeout);
}
var _a4=this.saMap.tileGeoWidth/this.saMap.tileSize;
var _a5=(_a2-_a0)*_a4;
var _a6=-this.saMap.totalOffsetX;
var _a7=this.saMap.totalOffsetY;
var _a8=this.saMap.initialGeoCenterX+_a6*_a4;
var _a9=this.saMap.initialGeoCenterY+_a7*_a4;
var _aa="&layers="+this.id;
var _ab="";
if(this.searchEnabled&&this.searchControl){
_ab=this.searchControl.buildSearchString();
}
var _ac="";
if(this.maxCount&&!isNaN(this.maxCount)){
_ac="&context-subset=0,"+this.maxCount;
}
var _ad="&responsetype=JSON";
var _ae=this.saMap.mapWidth;
var _af=this.saMap.mapHeight;
if(this.downloadOnce){
this.noUpdate=true;
}
if(this.useGrid){
var _b0=2;
_a3=_a3.toPrecision(1)*2;
_a2=_a2.toPrecision(1)*2;
_ae=_a2-_a0;
_af=_a3-_a1;
var _a5=_a5.toPrecision(2);
var _a5=_a5*1;
var _b1=Math.round((this.saMap.initialGeoCenterX-_a8)/(_a5/_b0));
var _b2=Math.round((this.saMap.initialGeoCenterY-_a9)/(_a5/_b0));
_a8=this.saMap.initialGeoCenterX-_b1*(_a5/2);
_a9=this.saMap.initialGeoCenterY-_b2*(_a5/2);
var _a5=_a5+((_a5/_b0)*2)*1.1;
}
if(!this.getAll){
var _b3="&pixel-x-topleft="+_a0+"&pixel-y-topleft="+_a1+"&pixel-x-bottomright="+_a2+"&pixel-y-bottomright="+_a3;
}else{
var _b3="";
}
var _b4=url+"RWCInterface.axd?request=GetGeoObjects"+"&view="+this.saMap.viewName+_aa+"&geowidth="+_a5+"&width="+_ae+"&height="+_af+"&positions=true"+"&x="+_a8+"&y="+_a9+_b3+_ab+_ac+_ad;
if(this.customAttributes){
for(variable in this.customAttributes){
if(typeof (this.customAttributes[variable])!="function"&&this.customAttributes[variable]){
_b4=_b4+"&context-"+variable+"="+this.customAttributes[variable];
}
}
}
if(this.xmlHttp&&this.xmlHttp.readyState>0){
this.saMap.removeWorkItem();
}
this.saMap.addWorkItem();
this.xmlHttp=new XMLHttpRequest();
if(this.searchEnabled&&this.searchControl){
this.xmlHttp.onreadystatechange=associateObjWithCallback(this,this.onGetGeoObjectsSearchResponse);
}else{
this.xmlHttp.onreadystatechange=associateObjWithCallback(this,this.onGetGeoObjectsResponse);
}
this.xmlHttp.open("GET",_b4,true);
this.xmlHttp.send("");
};
OverlayLayer.prototype.onGetGeoObjectsSearchResponse=function(){
if(this.xmlHttp&&this.xmlHttp.readyState==4){
if(this.xmlHttp.responseText){
this.removeGeoObjects();
this.geoObjectArray=new Array();
try{
this.geoObjectList=eval("("+this.xmlHttp.responseText+")");
}
catch(e){
return;
}
var n=this.geoObjectList.geoObjects.length;
for(var i=0;i<n;i++){
var _b7=new GeoObject(this.geoObjectList.geoObjects[i],this,true);
this.insertObject(_b7,_b7.priority);
}
for(var i=0;i<this.saMap.onAfterUpdateEventHandlers.length;i++){
this.saMap.onAfterUpdateEventHandlers[i](this.saMap,this);
}
if(this.configuration.search.zoomToResults){
this.saMap.zoomToObjects(this.geoObjectArray,40);
}
this.searchControl.addResults(0);
}
this.saMap.removeWorkItem();
this.xmlHttp=null;
}
};
OverlayLayer.prototype.showDrivingDirections=function(_b8){
if(this.haveRouteSearch&&this.drivingDirections){
this.drivingDirections.show(_b8);
}
};
OverlayLayer.prototype.resetDrivingDirections=function(){
if(this.haveRouteSearch&&this.drivingDirections){
this.drivingDirections.reset();
}
};
OverlayLayer.prototype.onGetGeoObjectsResponse=function(){
if(this.xmlHttp&&this.xmlHttp.readyState==4){
if(this.xmlHttp.responseText){
this.removeGeoObjects();
this.geoObjectArray=new Array();
try{
this.geoObjectList=eval("("+this.xmlHttp.responseText+")");
}
catch(e){
return;
}
var n=this.geoObjectList.geoObjects.length;
this.resetDrivingDirections();
for(var i=0;i<n;i++){
var _bb=new GeoObject(this.geoObjectList.geoObjects[i],this,false);
this.insertObject(_bb,_bb.priority);
if(this.haveRouteSearch&&this.drivingDirections){
this.drivingDirections.insertObject(_bb);
}
}
if(this.haveRouteSearch&&this.drivingDirections){
this.drivingDirections.finalize(true);
}
for(var i=0;i<this.saMap.onAfterUpdateEventHandlers.length;i++){
this.saMap.onAfterUpdateEventHandlers[i](this.saMap,this);
}
this.draw();
}
this.saMap.removeWorkItem();
this.xmlHttp=null;
}
};
OverlayLayer.prototype.insertObject=function(_bc,_bd){
if(_bd&&!isNaN(_bd)){
_bc.priority=_bd;
}else{
_bd=0;
}
for(var i=0;i<this.geoObjectArray.length;i++){
if(this.geoObjectArray[i].priority&&this.geoObjectArray[i].priority>_bd){
this.geoObjectArray=this.geoObjectArray.insert(i,_bc);
return;
}
}
this.geoObjectArray.push(_bc);
};
OverlayLayer.prototype.addOrUpdateGeoObject=function(_bf){
if(this.geoObjectArray){
var n=this.geoObjectArray.length;
for(var i=0;i<n;i++){
if(this.geoObjectArray[i].id==_bf.id){
this.geoObjectArray[i].clonePosition(_bf);
this.geoObjectArray[i].updateScreenPosition();
return;
}
}
}
if(!this.geoObjectArray){
this.geoObjectArray=new Array();
}
_bf.draw(this.saMap,this.container,this.isHidden,this.geoObjectArray.length);
this.geoObjectArray.push(_bf);
};
OverlayLayer.prototype.getGeoObjectArray=function(){
if(this.geoObjectArray){
return this.geoObjectArray;
}else{
return null;
}
};
OverlayLayer.prototype.getGeoObjectById=function(_c2){
if(this.geoObjectArray){
var n=this.geoObjectArray.length;
for(var i=0;i<n;i++){
if(this.geoObjectArray[i].id==_c2){
return this.geoObjectArray[i];
}
}
return null;
}
};
OverlayLayer.prototype.removeGeoObject=function(_c5){
if(this.geoObjectArray){
var n=this.geoObjectArray.length;
for(var i=0;i<n;i++){
if(this.geoObjectArray[i].id==_c5){
this.geoObjectArray[i].unload();
if(this.geoObjectArray[i].clientNode){
this.geoObjectArray[i].clientNode.parentNode.removeChild(this.geoObjectArray[i].clientNode);
}
this.geoObjectArray.splice(i,1);
return true;
}
}
return false;
}
};
OverlayLayer.prototype.removeGeoObjects=function(){
if(this.geoObjectArray){
var n=this.geoObjectArray.length;
for(var i=0;i<n;i++){
this.geoObjectArray[i].unload();
}
this.geoObjectArray=null;
}
if(this.container&&this.container.parentNode){
this.container.parentNode.removeChild(this.container);
}
};
OverlayLayer.prototype.removeGeoObjectWithoutId=function(){
if(this.geoObjectArray){
var _ca=0;
while(_ca<this.geoObjectArray.length){
if(this.geoObjectArray[_ca].noId){
this.geoObjectArray[_ca].unload();
if(this.geoObjectArray[_ca].clientNode){
this.geoObjectArray[_ca].clientNode.parentNode.removeChild(this.geoObjectArray[_ca].clientNode);
}
this.geoObjectArray.splice(_ca,1);
}else{
_ca++;
}
}
}
};
OverlayLayer.prototype.unload=function(){
if(this.geoObjectArray){
var n=this.geoObjectArray.length;
for(var i=0;i<n;i++){
this.geoObjectArray[i].unload();
}
}
};
OverlayLayer.prototype.getType=function(){
return "ObjectLayer";
};
OverlayLayer.prototype.addAttribute=function(_cd,_ce){
if(!this.customAttributes){
this.customAttributes=new Object();
}
this.customAttributes[_cd]=_ce;
};
OverlayLayer.prototype.removeAttribute=function(_cf){
if(this.customAttributes){
this.customAttributes[_cf]=null;
}
};
function LayerIdObject(id){
this.id=id;
this.isHidden=false;
}

function LayerControl(_1,_2,_3){
this.saMap=_1;
this.container=document.createElement("div");
this.container.id=_3+"LayerControl";
addClass(this.container,this.saMap.config.GUI.layerControl.css);
this.header=document.createElement("h4");
this.header.innerHTML=this.saMap.config.GUI.layerControl.heading;
this.expanded=true;
this.minimizeElement=document.createElement("img");
if(this.saMap.config.GUI.layerControl.collapseImage&&this.saMap.config.GUI.layerControl.collapseImage.image!=""){
this.minimizeElement.className="rwcMinimizeElement";
this.saMap.config.GUI.layerControl.collapseImage.applyConfiguration(this.minimizeElement);
this.header.appendChild(this.minimizeElement);
}
this.container.appendChild(this.header);
this.clickDelegate=associateObjWithEvent(this,"headerClicked");
Evt.addEventListener(this.minimizeElement,"click",this.clickDelegate);
this.overlayBody=document.createElement("div");
this.container.appendChild(this.overlayBody);
this.createLayerList();
if(this.listItems.length>=1){
setVisible(this.container,true);
}
_2.appendChild(this.container);
}
LayerControl.prototype.createLayerList=function(){
this.listItems=new Array();
for(var i=0;i<this.saMap.view.layerArray.length;i++){
for(var j=0;j<this.saMap.view.layerArray[i].sublayerID.length;j++){
if(this.saMap.view.layerArray[i].type!="background"&&this.saMap.view.layerArray[i].sublayerUseLayerControl[j]){
var _6=new ListElement(this.saMap.view.layerArray[i].sublayerID[j].id,this.saMap.view.layerArray[i].sublayerName[j],this.saMap.config.GUI.layerControl.listImage,this.saMap.config.GUI.layerControl.selectedListImage,this,!this.saMap.view.layerArray[i].sublayerID[j].isHidden);
addClass(_6.container,"rwcLayerListItem");
this.overlayBody.appendChild(_6.container);
this.listItems.push(_6);
}
}
}
for(var i=0;i<this.saMap.view.overlayArray.length;i++){
if(this.saMap.view.overlayArray[i].useLayerControl){
var _6=new ListElement(this.saMap.view.overlayArray[i].id,this.saMap.view.overlayArray[i].name,this.saMap.config.GUI.layerControl.listImage,this.saMap.config.GUI.layerControl.selectedListImage,this,!this.saMap.view.overlayArray[i].isHidden);
addClass(_6.container,"rwcLayerListItem");
this.overlayBody.appendChild(_6.container);
if(this.saMap.config.GUI.layerControl.reorderableLayers){
_6.downArrow=document.createElement("img");
_6.downArrow.className="rwcReorderArrowDown";
this.saMap.config.GUI.layerControl.downArrow.applyConfiguration(_6.downArrow);
_6.container.appendChild(_6.downArrow);
if(i<this.saMap.view.overlayArray.length-1&&this.saMap.view.overlayArray[i+1].useLayerControl){
_6.reorderDownDelegate=associateObjWithEvent(_6,"onReorderDown");
Evt.addEventListener(_6.downArrow,"click",_6.reorderDownDelegate);
addClass(_6.downArrow,"rwcClickable");
}else{
addClass(_6.downArrow,"rwcDisabled");
}
_6.upArrow=document.createElement("img");
_6.upArrow.className="rwcReorderArrowUp";
this.saMap.config.GUI.layerControl.upArrow.applyConfiguration(_6.upArrow);
_6.container.appendChild(_6.upArrow);
if(i>0){
_6.reorderUpDelegate=associateObjWithEvent(_6,"onReorderUp");
Evt.addEventListener(_6.upArrow,"click",_6.reorderUpDelegate);
addClass(_6.upArrow,"rwcClickable");
}else{
addClass(_6.upArrow,"rwcDisabled");
}
}
var _7=0;
for(var j=0;j<this.saMap.view.overlayArray[i].configuration.properties.length;j++){
if(this.saMap.view.overlayArray[i].configuration.properties[j].type=="defaultImage"||this.saMap.view.overlayArray[i].configuration.properties[j].type=="conditionalImage"){
_7++;
}
}
if(this.saMap.config.GUI.layerControl.legend){
for(var j=0;j<this.saMap.view.overlayArray[i].configuration.properties.length;j++){
var _8;
if(this.saMap.view.overlayArray[i].configuration.properties[j].type=="defaultImage"||this.saMap.view.overlayArray[i].configuration.properties[j].type=="conditionalImage"){
_8=document.createElement("img");
_8.className="rwcLegendImage";
if(this.saMap.view.overlayArray[i].configuration.properties[j].value&&this.saMap.view.overlayArray[i].configuration.properties[j].value!=""){
setImageSource(_8,this.saMap.view.overlayArray[i].configuration.properties[j].value);
}else{
if(this.saMap.view.overlayArray[i].configuration.properties[j].image.image&&this.saMap.view.overlayArray[i].configuration.properties[j].image.image!=""){
setImageSource(_8,this.saMap.view.overlayArray[i].configuration.properties[j].image.image);
}
}
if(this.saMap.view.overlayArray[i].configuration.properties[j].label&&this.saMap.view.overlayArray[i].configuration.properties[j].label!=""){
var _9=document.createElement("span");
_9.innerHTML=this.saMap.view.overlayArray[i].configuration.properties[j].label;
}
}
if(_7>1&&(this.saMap.view.overlayArray[i].configuration.properties[j].type=="defaultImage"||this.saMap.view.overlayArray[i].configuration.properties[j].type=="conditionalImage")){
this.overlayBody.appendChild(_8);
this.overlayBody.appendChild(_9);
}else{
if(_8&&(this.saMap.view.overlayArray[i].configuration.properties[j].type=="defaultImage"||this.saMap.view.overlayArray[i].configuration.properties[j].type=="conditionalImage")){
_8.className="rwcInlineLegendImage";
_6.container.insertBefore(_8,_6.text);
}
}
}
}
this.listItems.push(_6);
_6.nr=this.listItems.length-1;
}
}
};
LayerControl.prototype.elementClicked=function(_a,_b){
if(this.saMap.zoomActive){
return;
}
if(_b){
this.saMap.view.showLayer(_a);
}else{
this.saMap.view.hideLayer(_a);
}
};
LayerControl.prototype.isVisible=function(_c){
var n=this.listItems.length;
for(var i=0;i<n;i++){
if(this.listItems[i].id==_c){
return this.listItems[i].selected;
break;
}
}
};
LayerControl.prototype.headerClicked=function(_f,_10){
if(this.expanded){
this.overlayBody.style.display="none";
this.expanded=false;
this.saMap.config.GUI.layerControl.expandImage.applyConfiguration(this.minimizeElement);
}else{
this.overlayBody.style.display="block";
this.expanded=true;
this.saMap.config.GUI.layerControl.collapseImage.applyConfiguration(this.minimizeElement);
}
};
LayerControl.prototype.showLayer=function(id){
for(var i=0;i<this.listItems.length;i++){
if(id==this.listItems[i].id){
this.listItems[i].selected=true;
this.listItems[i].selectedImageConfig.applyConfiguration(this.listItems[i].image);
return;
}
}
};
LayerControl.prototype.hideLayer=function(id){
for(var i=0;i<this.listItems.length;i++){
if(id==this.listItems[i].id){
this.listItems[i].selected=false;
this.listItems[i].imageConfig.applyConfiguration(this.listItems[i].image);
return;
}
}
};
LayerControl.prototype.updateOverlayLayers=function(){
var n=this.listItems.length;
for(var i=0;i<n;i++){
this.listItems[i].unload();
}
this.overlayBody.innerHTML="";
this.createLayerList();
};
LayerControl.prototype.unload=function(){
Evt.removeEventListener(this.minimizeElement,"click",this.clickDelegate,false);
for(var i=0;i<this.listItems.length;i++){
this.listItems[i].unload();
}
};
function ListElement(id,_19,_1a,_1b,_1c,_1d){
this.id=id;
this.listControl=_1c;
this.imageConfig=_1a;
this.selectedImageConfig=_1b;
this.container=document.createElement("div");
this.image=document.createElement("img");
if(_1d){
this.selected=true;
this.selectedImageConfig.applyConfiguration(this.image);
}else{
this.selected=false;
this.imageConfig.applyConfiguration(this.image);
}
addClass(this.image,"rwcClickable");
this.container.appendChild(this.image);
this.text=document.createElement("span");
this.text.innerHTML=_19+"&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp";
this.container.appendChild(this.text);
this.clickDelegate=associateObjWithEvent(this,"onClick");
Evt.addEventListener(this.image,"click",this.clickDelegate);
}
ListElement.prototype.onClick=function(){
var _1e=!this.selected;
this.listControl.elementClicked(this.id,_1e);
};
ListElement.prototype.onReorderDown=function(){
this.listControl.saMap.reorderLayer(this.id,1);
};
ListElement.prototype.onReorderUp=function(){
this.listControl.saMap.reorderLayer(this.id,-1);
};
ListElement.prototype.unload=function(){
Evt.removeEventListener(this.container,"click",this.clickDelegate);
};

function LinkedMap(_1,_2,_3,_4,_5,_6,_7,_8,_9){
this.scaleModel=_6;
this.scaleValue=_7;
this.showMainMapArea=_8;
this.map=new SpatialAceMap(_1.mapServerUrl,_2,_3,null,_5,null,_9,_4);
this.map.mainMap=_1;
this.map.mainMap.addLinkedMap(this);
this.map.linkMap=this;
}
LinkedMap.prototype.initialize=function(){
if(this.map.initialized){
var _a=this.map.mainMap.getMapCenter();
this.map.setMapCenter(_a.x,_a.y);
this.updateScale();
}else{
this.map.pendingLinkInit=true;
}
if(this.showMainMapArea){
this.drawMainMapRectangle();
}
};
LinkedMap.prototype.updateScale=function(){
switch(this.scaleModel){
case ("constant"):
var _b=(this.map.scaleToGeoWidth*this.scaleValue)*(this.map.tileSize/this.map.mainMap.tileSize);
break;
case ("factor"):
var _b=(this.map.mainMap.tileGeoWidth*this.scaleValue)*(this.map.tileSize/this.map.mainMap.tileSize);
break;
case ("stepoffset"):
if(this.map.fixedScales){
var _b=this.map.mainMap.tileGeoWidth;
}else{
var _c=Math.pow(2,this.scaleValue);
var _b=this.map.mainMap.tileGeoWidth*_c*(this.map.tileSize/this.map.mainMap.tileSize);
}
break;
case ("default"):
break;
}
if(this.map.fixedScales){
var _d=Number.MAX_VALUE;
var _e=_b;
for(var i=0;i<this.map.fixedTileGeoWidths.length;i++){
var _10=Math.abs(_b-this.map.fixedTileGeoWidths[i]);
if(_10<_d){
_d=_10;
_e=this.map.fixedTileGeoWidths[i];
var _11=i;
}
}
if(this.scaleModel=="stepoffset"){
_11=_11+parseInt(this.scaleValue);
if(_11<0){
_e=this.map.fixedTileGeoWidths[0];
}else{
if(_11>this.map.fixedTileGeoWidths.length-1){
_e=this.map.fixedTileGeoWidths[this.map.fixedTileGeoWidths.length-1];
}else{
_e=this.map.fixedTileGeoWidths[_11];
}
}
}
this.currentScaleFactor=this.map.mainMap.tileGeoWidth/_e*(this.map.tileSize/this.map.mainMap.tileSize);
if(this.map.tileGeoWidth!=_e){
this.map.setTileGeoWidth(_e,false);
}
if(!this.noAdjust){
this.syncMapOffset();
}
}else{
if(this.map.tileGeoWidth!=_b){
this.currentScaleFactor=this.map.mainMap.tileGeoWidth/_b*(this.map.tileSize/this.map.mainMap.tileSize);
this.map.setTileGeoWidth(_b,false);
if(!this.noAdjust){
this.syncMapOffset();
}
}
}
};
LinkedMap.prototype.setNewCenter=function(x,y){
if(this.map.initialized){
this.map.setMapCenter(x,y);
}
};
LinkedMap.prototype.syncMapOffset=function(){
var _14=Math.round(this.map.mainMap.totalOffsetX*this.currentScaleFactor-this.map.totalOffsetX);
var _15=Math.round(this.map.mainMap.totalOffsetY*this.currentScaleFactor-this.map.totalOffsetY);
if(isNaN(_14)||isNaN(_15)||(_14==0&&_15==0)){
return;
}
this.map.view.pixelOffset(_14,_15);
this.map.totalOffsetX+=_14;
this.map.totalOffsetY+=_15;
};
LinkedMap.prototype.drawMainMapRectangle=function(){
if(this.showMainMapArea){
var _16=Math.round(this.map.mainMap.mapWidth*this.currentScaleFactor);
var _17=Math.round(this.map.mainMap.mapHeight*this.currentScaleFactor);
var _18=this.map.mainMap.getMapCenter();
if(!isNaN(_17)&&!isNaN(_16)){
this.map.drawOverlayRectangle(_17,_16,_18);
}
}
};

function MapConfiguration(_1){
this.defaultUrl=_1+"RWC/";
this.emptyImage=new ImageConfiguration();
this.emptyImage.setImage("",null,null,"");
this.createGUIConfig();
this.createViewSettings();
this.createLayerDefaults();
var _2=Math.ceil(this.viewSettings.tileSize/4);
if(this.GUI.padding<_2){
this.GUI.padding=_2;
}
}
MapConfiguration.prototype.createGUIConfig=function(){
this.GUI=new Object();
this.GUI.backgroundControl=new GUIElement();
this.GUI.backgroundControl.setValues(true,"rwcBackgroundControlOverlay","overlay");
this.GUI.backgroundControl.element=new ImageConfiguration();
this.GUI.backgroundControl.element.setImage(this.defaultUrl+"pic/standard/buttonup3.png","100px","30px","");
this.GUI.backgroundControl.selectedElement=new ImageConfiguration();
this.GUI.backgroundControl.selectedElement.setImage(this.defaultUrl+"pic/standard/buttondown3.png","100px","30px","");
this.GUI.clickTool="getPosition";
this.GUI.closeBox=new ImageConfiguration();
this.GUI.closeBox.setImage(this.defaultUrl+"pic/standard/close2.png","13px","13px","Close");
this.GUI.detailedInfo=new GUIElement();
this.GUI.detailedInfo.setValues(true,"rwcDetailedInfoBox","overlay");
this.GUI.detailedInfo.parameters=new Array();
this.GUI.dockingPanel=new ImageConfiguration();
this.GUI.dockingPanel.setImage(this.defaultUrl+"pic/standard/gradientgray.png",null,null,"");
this.GUI.dragTool=new Object();
this.GUI.dragTool.defaultTool="pan";
this.GUI.dragTool.outputElement="selectionDiv";
this.GUI.enableAnimatedZoom=true;
this.GUI.enableKeyEvents=true;
this.GUI.enableMouseScrollEvent=true;
this.GUI.layerControl=new ListConfiguration();
var _3=new ImageConfiguration();
_3.setImage(this.defaultUrl+"pic/standard/bluecheckbox.png","16px","16px","Activate layer");
var _4=new ImageConfiguration();
_4.setImage(this.defaultUrl+"pic/standard/bluecheckbox_check.png","16px","16px","Deactivate layer");
this.GUI.layerControl.setValues(true,"rwcLayerControlOverlay","overlay","Layers",this.emptyImage.clone(),this.emptyImage.clone(),_3,_4,null,null);
this.GUI.layerControl.upArrow=new ImageConfiguration();
this.GUI.layerControl.upArrow.setImage(this.defaultUrl+"pic/standard/layerListArrowUp.png","10px","10px","");
this.GUI.layerControl.downArrow=new ImageConfiguration();
this.GUI.layerControl.downArrow.setImage(this.defaultUrl+"pic/standard/layerListArrowDown.png","10px","10px","");
this.GUI.layerControl.legend=true;
this.GUI.layerControl.reorderableLayers=true;
this.GUI.lookingGlass=new GUIElement();
this.GUI.lookingGlass.setValues(true,"rwcLookingGlass","overlay");
this.GUI.lookingGlass.alternateView="";
this.GUI.lookingGlass.configuration="";
this.GUI.lookingGlass.model="factor";
this.GUI.lookingGlass.scaleValue="0.1";
this.GUI.miniMap=new GUIElement();
this.GUI.miniMap.setValues(true,"rwcMiniMap","overlay");
this.GUI.miniMap.alternateView="";
this.GUI.miniMap.configuration="";
this.GUI.miniMap.model="factor";
this.GUI.miniMap.scaleValue="16";
this.GUI.miniMap.showMainMap=true;
this.GUI.mousePositionBox=new GUIElement();
this.GUI.mousePositionBox.setValues(false,"rwcPositionBox","overlay");
this.GUI.openBox=new ImageConfiguration();
this.GUI.openBox.setImage(this.defaultUrl+"pic/standard/open.png","13px","13px","Open");
this.GUI.padding=50;
this.GUI.panControl=new GUIElement();
this.GUI.panControl.setValues(true,"rwcPanControlOverlay","overlay");
this.GUI.panControl.panUp=new ImageConfiguration();
this.GUI.panControl.panUp.setImage(this.defaultUrl+"pic/standard/panup.png","34px","30px","Pan up");
this.GUI.panControl.panDown=new ImageConfiguration();
this.GUI.panControl.panDown.setImage(this.defaultUrl+"pic/standard/pandown.png","34px","30px","Pan down");
this.GUI.panControl.panRight=new ImageConfiguration();
this.GUI.panControl.panRight.setImage(this.defaultUrl+"pic/standard/panright.png","30px","34px","Pan right");
this.GUI.panControl.panLeft=new ImageConfiguration();
this.GUI.panControl.panLeft.setImage(this.defaultUrl+"pic/standard/panleft.png","30px","34px","Pan left");
this.GUI.progressIndicator=new ImageConfiguration();
this.GUI.progressIndicator.setImage(this.defaultUrl+"pic/progress-indicator.gif","16px","16px","Loading..");
this.GUI.routeSearch=new GUIElement();
this.GUI.routeSearch.active=false;
this.GUI.scaleBar=new GUIElement();
this.GUI.scaleBar.setValues(true,"rwcScaleBar","overlay");
this.GUI.scaleBar.maxSize=100;
this.GUI.scaleBar.unit="metric";
this.GUI.strings=new Object();
this.GUI.strings.startPoint="Start";
this.GUI.strings.endPoint="End";
this.GUI.strings.noInfo="There is no information available about this object";
this.GUI.strings.noObject="No object found";
this.GUI.strings.noResults="No matches";
this.GUI.zoomControl=new GUIElement();
this.GUI.zoomControl.setValues(true,"rwcZoomControlOverlay","overlay");
this.GUI.zoomControl.zoomInButton=new ImageConfiguration();
this.GUI.zoomControl.zoomInButton.setImage(this.defaultUrl+"pic/standard/zoomin.png","27px","27px","Zoom in");
this.GUI.zoomControl.zoomOutButton=new ImageConfiguration();
this.GUI.zoomControl.zoomOutButton.setImage(this.defaultUrl+"pic/standard/zoomout.png","22px","27px","Zoom out");
this.GUI.zoomControl.zoomScaleElement=new ImageConfiguration();
this.GUI.zoomControl.zoomScaleElement.setImage(this.defaultUrl+"pic/standard/zoomlevel.png","20px","27px","");
this.GUI.zoomControl.zoomScaleMarker=new ImageConfiguration();
this.GUI.zoomControl.zoomScaleMarker.setImage(this.defaultUrl+"pic/standard/zoomlevel_selected.png","12px","27px","Selected scale");
};
MapConfiguration.prototype.createViewSettings=function(){
this.viewSettings=new Object();
this.viewSettings.borders=new Object();
this.viewSettings.borders.active=false;
this.viewSettings.disableObjectLayers=false;
this.viewSettings.imageFormat="gif";
this.viewSettings.tileSize=200;
this.viewSettings.requestMaxLength=1024;
this.viewSettings.mapTileService="";
};
MapConfiguration.prototype.createLayerDefaults=function(){
this.overlayLayers=new Object();
this.overlayLayers.layerTemplates=new Array();
this.overlayLayers.defaultLayer=new Object();
this.overlayLayers.defaultLayer.name="default";
this.overlayLayers.defaultLayer.downloadBehavior=new Object();
this.overlayLayers.defaultLayer.downloadBehavior.downloadModel="standard";
this.overlayLayers.defaultLayer.downloadBehavior.initiation="automatic";
this.overlayLayers.defaultLayer.downloadBehavior.maxCount=0;
this.overlayLayers.defaultLayer.downloadBehavior.timeout=0;
this.overlayLayers.defaultLayer.geoObjects=new Object();
this.overlayLayers.defaultLayer.geoObjects.numbered=false;
this.overlayLayers.defaultLayer.geoObjects.parameters=new Array();
var _5=new Parameter("Id","id",null,null,"on");
_5.alternates=new Array();
_5.alternates.push("id");
_5.alternates.push("POI_ID");
this.overlayLayers.defaultLayer.geoObjects.parameters.push(_5);
var _6=new Parameter("rwcDefaultIcon","defaultImage","","","on");
_6.image=new ImageConfiguration();
_6.image.setImage(this.defaultUrl+"pic/standard/circlegreen.png","18px","18px","");
_6.selectedImage=new ImageConfiguration();
_6.selectedImage.setImage(this.defaultUrl+"pic/standard/circlegreen_glow.png","24px","24px","");
this.overlayLayers.defaultLayer.geoObjects.parameters.push(_6);
this.overlayLayers.defaultLayer.infoBox=new GUIElement();
this.overlayLayers.defaultLayer.infoBox.setValues(true,"rwcWhiteInfoBox","overlay");
this.overlayLayers.defaultLayer.infoBox.positioning="normal";
this.overlayLayers.defaultLayer.infoBox.margin=0;
this.overlayLayers.defaultLayer.infoBox.parameters=new Array();
var _7=new Parameter("POI_NAME","string","","","on");
_7.alternates=new Array();
_7.alternates.push("Id");
_7.alternates.push("id");
_7.alternates.push("POI_ID");
_7.alternates.push("Name");
this.overlayLayers.defaultLayer.infoBox.parameters.push(_7);
var _8=new Parameter("clientSideInfoImage","image","","","on");
this.overlayLayers.defaultLayer.infoBox.parameters.push(_8);
this.overlayLayers.defaultLayer.route=new Object();
this.overlayLayers.defaultLayer.search=new Object();
this.overlayLayers.defaultLayer.search.searchResults=new GUIElement();
this.overlayLayers.defaultLayer.search.searchResults.setValues(false,"","overlay");
this.overlayLayers.defaultLayer.search.searchResults.parameters=new Array();
this.overlayLayers.defaultLayer.search.searchParameters=new Object();
this.overlayLayers.defaultLayer.search.searchControl=new GUIElement();
this.overlayLayers.defaultLayer.search.searchControl.setValues(false,"","overlay");
this.overlayLayers.defaultLayer.shapes=new Object();
var _9=new Parameter("style","style","solid","","on");
var _a=new Parameter("color","color","red","","on");
var _b=new Parameter("transparency","transparency","0.5","","on");
var _c=new Parameter("lineWidth","lineWidth","1","","on");
this.overlayLayers.defaultLayer.shapes.lines=new Object();
this.overlayLayers.defaultLayer.shapes.lines.parameters=new Array();
this.overlayLayers.defaultLayer.shapes.lines.parameters.push(_9);
this.overlayLayers.defaultLayer.shapes.lines.parameters.push(_a);
this.overlayLayers.defaultLayer.shapes.lines.parameters.push(_b);
this.overlayLayers.defaultLayer.shapes.lines.parameters.push(_c);
this.overlayLayers.defaultLayer.shapes.polygons=new Object();
this.overlayLayers.defaultLayer.shapes.polygons.parameters=new Array();
this.overlayLayers.defaultLayer.shapes.polygons.parameters.push(_9);
this.overlayLayers.defaultLayer.shapes.polygons.parameters.push(_a);
this.overlayLayers.defaultLayer.shapes.polygons.parameters.push(_b);
this.overlayLayers.defaultLayer.shapes.polygons.parameters.push(_c);
var _d=new Object();
_d.name="measureTool";
_d.geoObjects=new Object();
_d.geoObjects.numbered=false;
_d.geoObjects.parameters=new Array();
var _5=new Parameter("id","id",null,null,"on");
_d.geoObjects.parameters.push(_5);
var _6=new Parameter("rwcDefaultIcon","defaultImage","","","on");
_6.image=new ImageConfiguration();
_6.image.setImage(this.defaultUrl+"pic/standard/pin.png","30px","40px","");
_6.selectedImage=null;
_d.geoObjects.parameters.push(_6);
_d.shapes=new Object();
var _9=new Parameter("style","style","solid","","on");
var _a=new Parameter("color","color","red","","on");
var _b=new Parameter("transparency","transparency","0.5","","on");
var _c=new Parameter("lineWidth","lineWidth","3","","on");
_d.shapes.lines=new Object();
_d.shapes.lines.parameters=new Array();
_d.shapes.lines.parameters.push(_9);
_d.shapes.lines.parameters.push(_a);
_d.shapes.lines.parameters.push(_b);
_d.shapes.lines.parameters.push(_c);
_d.shapes.polygons=new Object();
_d.shapes.polygons.parameters=new Array();
_d.shapes.polygons.parameters.push(_9);
_d.shapes.polygons.parameters.push(_a);
_d.shapes.polygons.parameters.push(_b);
_d.shapes.polygons.parameters.push(_c);
_d.infoBox=new GUIElement();
_d.infoBox.setValues(true,"rwcWhiteInfoBox","overlay");
_d.infoBox.positioning="normal";
_d.infoBox.margin=0;
_d.infoBox.parameters=new Array();
var _7=new Parameter("name","string","","","on");
_d.infoBox.parameters.push(_7);
var _e=new Parameter("distance","string","","","on");
_d.infoBox.parameters.push(_e);
_d.downloadBehavior=new Object();
_d.downloadBehavior.downloadModel="once";
_d.downloadBehavior.initiation="manual";
_d.downloadBehavior.maxCount=0;
_d.downloadBehavior.timeout=0;
_d.search=new Object();
_d.search.searchParameters=new Object();
_d.search.searchResults=new Object();
this.overlayLayers.layerTemplates.push(_d);
};
MapConfiguration.prototype.override=function(_f){
if(_f){
if(_f.GUISettings){
this.overrideGUI(_f.GUISettings);
}
if(_f.ViewSettings){
this.overrideViewSettings(_f.ViewSettings);
}
if(_f.OverlayLayers){
this.readLayerTemplates(_f.OverlayLayers);
}
}
};
MapConfiguration.prototype.overrideGUI=function(_10){
if(_10.BackgroundControl){
this.GUI.backgroundControl.override(_10.BackgroundControl);
if(_10.BackgroundControl.ButtonImage){
this.GUI.backgroundControl.element=new ImageConfiguration(_10.BackgroundControl.ButtonImage);
}
if(_10.BackgroundControl.SelectedButtonImage){
this.GUI.backgroundControl.selectedElement=new ImageConfiguration(_10.BackgroundControl.SelectedButtonImage);
}
}
if(_10.ClickTool){
if(_10.ClickTool.value){
this.GUI.clickTool=_10.ClickTool.value;
}
}
if(_10.CloseBox){
this.GUI.closeBox=new ImageConfiguration(_10.CloseBox);
}
if(_10.DefaultTool){
if(_10.DefaultTool.OutputElement){
this.GUI.dragTool.outputElement=_10.DefaultTool.OutputElement;
}
if(_10.DefaultTool.value){
this.GUI.dragTool.defaultTool=_10.DefaultTool.value;
}
}
if(_10.DetailedInfo){
this.GUI.detailedInfo.override(_10.DetailedInfo);
if(_10.DetailedInfo.Parameter){
this.GUI.detailedInfo.parameters=this.readParameterList(_10.DetailedInfo.Parameter);
}
}
if(_10.DockingPanel){
this.GUI.dockingPanel=new ImageConfiguration(_10.DockingPanel);
}
if(_10.EnableAnimatedZoom){
if(_10.EnableAnimatedZoom.value){
this.GUI.enableAnimatedZoom=stringToBoolean(_10.EnableAnimatedZoom.value,false);
}
}
if(_10.EnableKeyEvents){
if(_10.EnableKeyEvents.value){
this.GUI.enableKeyEvents=stringToBoolean(_10.EnableKeyEvents.value,false);
}
}
if(_10.EnableMouseScrollEvent){
if(_10.EnableMouseScrollEvent.value){
this.GUI.enableMouseScrollEvent=stringToBoolean(_10.EnableMouseScrollEvent.value,false);
}
}
if(_10.LayerControl){
this.GUI.layerControl.override(_10.LayerControl);
if(_10.LayerControl.Legend&&_10.LayerControl.Legend.value){
this.GUI.layerControl.legend=stringToBoolean(_10.LayerControl.Legend.value,false);
}
if(_10.LayerControl.ReorderableLayers){
if(_10.LayerControl.ReorderableLayers.value){
this.GUI.layerControl.reorderableLayers=stringToBoolean(_10.LayerControl.ReorderableLayers.value,false);
}
if(_10.LayerControl.ReorderableLayers.DownArrow){
this.GUI.layerControl.downArrow=new ImageConfiguration(_10.LayerControl.ReorderableLayers.DownArrow);
}
if(_10.LayerControl.ReorderableLayers.UpArrow){
this.GUI.layerControl.upArrow=new ImageConfiguration(_10.LayerControl.ReorderableLayers.UpArrow);
}
}
}
if(_10.LookingGlass){
this.GUI.lookingGlass.override(_10.LookingGlass);
if(_10.LookingGlass.AlternateView&&_10.LookingGlass.AlternateView.value){
this.GUI.lookingGlass.alternateView=_10.LookingGlass.AlternateView.value;
}
if(_10.LookingGlass.Scale){
if(_10.LookingGlass.Scale.model){
this.GUI.lookingGlass.model=_10.LookingGlass.Scale.model;
}
if(_10.LookingGlass.Scale.value){
this.GUI.lookingGlass.scaleValue=_10.LookingGlass.Scale.value;
}
if(_10.LookingGlass.Configuration&&_10.LookingGlass.Configuration.file){
this.GUI.lookingGlass.configuration=_10.LookingGlass.Configuration.file;
}
}
}
if(_10.MiniMap){
this.GUI.miniMap.override(_10.MiniMap);
if(_10.MiniMap.AlternateView&&_10.MiniMap.AlternateView.value){
this.GUI.miniMap.alternateView=_10.MiniMap.AlternateView.value;
}
if(_10.MiniMap.Scale){
if(_10.MiniMap.Scale.model){
this.GUI.miniMap.model=_10.MiniMap.Scale.model;
}
if(_10.MiniMap.Scale.value){
this.GUI.miniMap.scaleValue=_10.MiniMap.Scale.value;
}
if(_10.MiniMap.Configuration&&_10.MiniMap.Configuration.file){
this.GUI.miniMap.configuration=_10.MiniMap.Configuration.file;
}
}
if(_10.MiniMap.ShowMainMap&&_10.MiniMap.ShowMainMap.value){
this.GUI.miniMap.showMainMap=stringToBoolean(_10.MiniMap.ShowMainMap.value,true);
}
}
if(_10.MousePositionBox){
this.GUI.mousePositionBox.override(_10.MousePositionBox);
}
if(_10.OpenBox){
this.GUI.openBox=new ImageConfiguration(_10.OpenBox);
}
if(_10.Padding&&_10.Padding.value){
try{
var _11=parseInt(_10.Padding.value);
this.GUI.padding=_11;
}
catch(e){
}
}
if(_10.PanControl){
this.GUI.panControl.override(_10.PanControl);
if(_10.PanControl.PanUp){
this.GUI.panControl.panUp=new ImageConfiguration(_10.PanControl.PanUp);
}
if(_10.PanControl.PanDown){
this.GUI.panControl.panDown=new ImageConfiguration(_10.PanControl.PanDown);
}
if(_10.PanControl.PanLeft){
this.GUI.panControl.panLeft=new ImageConfiguration(_10.PanControl.PanLeft);
}
if(_10.PanControl.PanRight){
this.GUI.panControl.panRight=new ImageConfiguration(_10.PanControl.PanRight);
}
}
if(_10.ProgressIndicator){
this.GUI.progressIndicator=new ImageConfiguration(_10.ProgressIndicator);
}
if(_10.ScaleBar){
this.GUI.scaleBar.override(_10.ScaleBar);
if(_10.ScaleBar.mode){
this.GUI.scaleBar.mode=_10.ScaleBar.mode;
}
if(_10.ScaleBar.maxSize){
this.GUI.scaleBar.maxSize=_10.ScaleBar.maxSize;
}
}
if(_10.Strings){
if(_10.Strings.StartPoint&&_10.Strings.StartPoint.value){
this.GUI.strings.startPoint=_10.Strings.StartPoint.value;
}
if(_10.Strings.EndPoint&&_10.Strings.EndPoint.value){
this.GUI.strings.endPoint=_10.Strings.EndPoint.value;
}
if(_10.Strings.NoInfo&&_10.Strings.NoInfo.value){
this.GUI.strings.noInfo=_10.Strings.NoInfo.value;
}
if(_10.Strings.NoObject&&_10.Strings.NoObject.value){
this.GUI.strings.noObject=_10.Strings.NoObject.value;
}
if(_10.Strings.NoResults&&_10.Strings.NoResults.value){
this.GUI.strings.noResults=_10.Strings.NoResults.value;
}
}
if(_10.ZoomControl){
this.GUI.zoomControl.override(_10.ZoomControl);
if(_10.ZoomControl.ZoomInButton){
this.GUI.zoomControl.zoomInButton=new ImageConfiguration(_10.ZoomControl.ZoomInButton);
}
if(_10.ZoomControl.ZoomOutButton){
this.GUI.zoomControl.zoomOutButton=new ImageConfiguration(_10.ZoomControl.ZoomOutButton);
}
if(_10.ZoomControl.ZoomScaleElement){
this.GUI.zoomControl.zoomScaleElement=new ImageConfiguration(_10.ZoomControl.ZoomScaleElement);
}
if(_10.ZoomControl.ZoomScaleMarker){
this.GUI.zoomControl.zoomScaleMarker=new ImageConfiguration(_10.ZoomControl.ZoomScaleMarker);
}
}
};
MapConfiguration.prototype.overrideViewSettings=function(_12){
if(_12.ImageFormat&&_12.ImageFormat.value){
this.viewSettings.imageFormat=_12.ImageFormat.value;
}
if(_12.TileSize&&_12.TileSize.value){
this.viewSettings.tileSize=_12.TileSize.value;
}
if(_12.DisableObjectLayers&&_12.DisableObjectLayers.value){
this.viewSettings.disableObjectLayers=_12.DisableObjectLayers.value;
}
if(_12.Borders){
if(_12.Borders.active){
this.viewSettings.borders.active=stringToBoolean(_12.Borders.active,false);
}
if(_12.Borders.rectangle){
var _13=_12.Borders.rectangle;
var _13=_13.split(",");
if(_13&&_13.length==4){
try{
for(var i=0;i<_13.length;i++){
_13[i]=parseFloat(_13[i]);
}
this.viewSettings.borders.geoRect=new GeoRectangle(_13[0],_13[1],_13[2],_13[3]);
}
catch(e){
this.viewSettings.borders.active=false;
}
}
}
}
if(_12.RequestMaxLength&&_12.RequestMaxLength.value){
try{
this.viewSettings.requestMaxLength=parseInt(_12.RequestMaxLength.value);
}
catch(e){
this.viewSettings.requestMaxLength=1024;
}
}
if(_12.MapTileService&&_12.MapTileService.value){
this.viewSettings.mapTileService=_12.MapTileService.value;
}
};
MapConfiguration.prototype.readLayerTemplates=function(_15){
if(_15.DefaultLayer){
this.readLayer(_15.DefaultLayer,this.overlayLayers.defaultLayer);
}
if(_15.LayerTemplate){
if(!_15.LayerTemplate.length){
var _16=new Array();
_16.push(_15.LayerTemplate);
}else{
var _16=_15.LayerTemplate;
}
for(var i=0;i<_16.length;i++){
var _18=_16[i].name;
var _19=false;
for(var j=0;j<this.overlayLayers.layerTemplates.length;j++){
if(_18==this.overlayLayers.layerTemplates[j].name){
this.readLayer(_16[i],this.overlayLayers.layerTemplates[j]);
_19=true;
}
}
if(!_19){
var _1b=this.readLayer(_16[i]);
this.overlayLayers.layerTemplates.push(_1b);
}
}
}
};
MapConfiguration.prototype.readLayer=function(_1c,_1d){
if(!_1d){
layerCfg=new Object();
}
if(!_1c){
return;
}
if(!_1d){
layerCfg.geoObjects=new Object();
layerCfg.geoObjects.parameters=new Array();
layerCfg.route=new Object();
layerCfg.search=new Object();
layerCfg.search.infoBox=new Object();
layerCfg.search.searchParameters=new Object();
layerCfg.search.searchResults=new Object();
layerCfg.downloadBehavior=new Object();
}else{
layerCfg=_1d;
}
layerCfg.name=_1c.name;
if(_1c.GeoObjects){
if(_1c.GeoObjects.numbered){
layerCfg.geoObjects.numbered=stringToBoolean(_1c.GeoObjects.numbered,false);
}
if(_1c.GeoObjects.Parameter){
layerCfg.geoObjects.parameters=this.readParameterList(_1c.GeoObjects.Parameter);
}
if(_1c.GeoObjects.CombinedVisualization){
var _1e=this.readCombinedImage(_1c.GeoObjects.CombinedVisualization);
if(_1e){
_1e.replaceGroupRefs(this.visitedGroups);
layerCfg.geoObjects.defaultCombinedImage=_1e;
}
}
}
if(_1c.Shapes){
layerCfg.shapes=new Object();
if(_1c.Shapes.Polygons){
if(_1c.Shapes.Polygons.Parameter){
layerCfg.shapes.polygons=new Object();
layerCfg.shapes.polygons.parameters=this.readParameterList(_1c.Shapes.Polygons.Parameter);
}
if(_1c.Shapes.Polygons.Condition){
layerCfg.shapes.polygons.conditions=this.readConditionsList(_1c.Shapes.Polygons.Condition);
}
}
if(_1c.Shapes.Lines){
if(_1c.Shapes.Lines.Parameter){
layerCfg.shapes.lines=new Object();
layerCfg.shapes.lines.parameters=this.readParameterList(_1c.Shapes.Lines.Parameter);
}
if(_1c.Shapes.Lines.Condition){
layerCfg.shapes.lines.conditions=this.readConditionsList(_1c.Shapes.Lines.Condition);
}
}
}
if(_1c.InfoBox){
layerCfg.infoBox=new GUIElement(_1c.InfoBox);
if(_1c.InfoBox.Parameter){
layerCfg.infoBox.parameters=this.readParameterList(_1c.InfoBox.Parameter);
}
if(_1c.InfoBox.Positioning&&_1c.InfoBox.Positioning.value){
layerCfg.infoBox.positioning=_1c.InfoBox.Positioning.value;
}
if(_1c.InfoBox.positioning){
layerCfg.infoBox.positioning=_1c.InfoBox.positioning;
}
if(_1c.InfoBox.Margin){
layerCfg.infoBox.margin=stringToInt(_1c.InfoBox.Margin.value,0);
}else{
layerCfg.infoBox.margin=0;
}
}
if(_1c.Route){
if(_1c.Route.DrivingDirections){
layerCfg.route.drivingDirections=new DrivingDirectionsConfiguration(_1c.Route.DrivingDirections);
}
}
if(_1c.Search){
if(_1c.Search.SearchControl){
layerCfg.search.searchControl=new ListConfiguration(_1c.Search.SearchControl);
}
if(_1c.Search.ControlGroups&&_1c.Search.ControlGroups.ControlGroup){
layerCfg.search.searchParameters.controlGroups=new Array();
if(!_1c.Search.ControlGroups.ControlGroup.length){
var _1f=new Array();
_1f.push(_1c.Search.ControlGroups.ControlGroup);
}else{
var _1f=_1c.Search.ControlGroups.ControlGroup;
}
for(var i=0;i<_1f.length;i++){
layerCfg.search.searchParameters.controlGroups[i]=new ControlGroup(_1f[i],this);
}
}
if(_1c.Search.SearchResults){
layerCfg.search.searchResults=new ListConfiguration(_1c.Search.SearchResults);
if(_1c.Search.SearchResults.Parameter){
layerCfg.search.searchResults.parameters=this.readParameterList(_1c.Search.SearchResults.Parameter);
}
}
if(_1c.Search.SearchGUI){
layerCfg.search.searchGUI=new Object();
if(_1c.Search.SearchGUI.SliderControl){
layerCfg.search.searchGUI.sliderControl=new GUIElement(_1c.Search.SearchGUI.SliderControl);
if(_1c.Search.SearchGUI.SliderControl.Bar){
layerCfg.search.searchGUI.sliderControl.bar=new ImageConfiguration(_1c.Search.SearchGUI.SliderControl.Bar);
}
if(_1c.Search.SearchGUI.SliderControl.BarFiller){
layerCfg.search.searchGUI.sliderControl.barFiller=new ImageConfiguration(_1c.Search.SearchGUI.SliderControl.BarFiller);
}
if(_1c.Search.SearchGUI.SliderControl.Marker){
layerCfg.search.searchGUI.sliderControl.marker=new ImageConfiguration(_1c.Search.SearchGUI.SliderControl.Marker);
}
if(_1c.Search.SearchGUI.SliderControl.Tick){
layerCfg.search.searchGUI.sliderControl.tick=new ImageConfiguration(_1c.Search.SearchGUI.SliderControl.Tick);
}
}
}
if(_1c.Search.ZoomToResults&&_1c.Search.ZoomToResults.value){
layerCfg.search.zoomToResults=stringToBoolean(_1c.Search.ZoomToResults.value,false);
}
}
if(_1c.DownloadBehavior){
if(_1c.DownloadBehavior.downloadModel){
layerCfg.downloadBehavior.downloadModel=_1c.DownloadBehavior.downloadModel;
}
if(_1c.DownloadBehavior.maxCount){
try{
layerCfg.downloadBehavior.maxCount=parseInt(_1c.DownloadBehavior.maxCount);
}
catch(e){
layerCfg.downloadBehavior.maxCount=0;
}
}
if(_1c.DownloadBehavior.initiation){
layerCfg.downloadBehavior.initiation=_1c.DownloadBehavior.initiation;
}
if(_1c.DownloadBehavior.timeout){
try{
layerCfg.downloadBehavior.timeout=parseInt(_1c.DownloadBehavior.timeout);
}
catch(e){
layerCfg.downloadBehavior.timeout=0;
}
}
}
return layerCfg;
};
MapConfiguration.prototype.getLayerConfiguration=function(_21){
for(var i=0;i<this.overlayLayers.layerTemplates.length;i++){
if(_21==this.overlayLayers.layerTemplates[i].name){
return this.overlayLayers.layerTemplates[i];
}
}
return this.overlayLayers.defaultLayer;
};
MapConfiguration.prototype.readConditionsList=function(_23){
var _24=new Array();
if(_23){
if(!_23.length){
var _25=new Array();
_25.push(_23);
}else{
_25=_23;
}
var n=_25.length;
for(var i=0;i<n;i++){
var _28=new Object();
_28.name=_25[i].name;
_28.value=_25[i].value;
if(_25[i].Parameter){
_28.parameters=this.readParameterList(_25[i].Parameter);
}
_24.push(_28);
}
}
return _24;
};
MapConfiguration.prototype.readParameterList=function(_29){
var _2a=new Array();
if(_29){
if(!_29.length){
_2a[0]=this.readParameter(_29);
}else{
var n=_29.length;
for(var i=0;i<n;i++){
var _2d=this.readParameter(_29[i]);
_2a[i]=_2d;
}
}
}
return _2a;
};
MapConfiguration.prototype.readParameter=function(_2e){
var _2f=_2e.type;
var _30=_2e.serverName;
var _31=_2e.value;
var _32=_2e.label;
var _33=_2e.state;
if(_33==null){
_33="on";
}
var _34=new Parameter(_30,_2f,_31,_32,_33);
if(_2e.Image){
_34.image=new ImageConfiguration(_2e.Image);
}
if(_2e.SelectedImage){
_34.selectedImage=new ImageConfiguration(_2e.SelectedImage);
}
if(_2e.Alternate){
_34.alternates=new Array();
for(var i=0;i<_2e.Alternate.length;i++){
var _36=_2e.Alternate[i].serverName;
_34.alternates[i]=_36;
}
}
return _34;
};
MapConfiguration.prototype.readCombinedImage=function(_37){
this.visitedGroups=new Array();
var _38=new Array();
_38=this.readCombinedImageParts(_37.ChildNodes);
var _39=new CombinedImage(_38);
return _39;
};
MapConfiguration.prototype.readCombinedImageParts=function(_3a){
var _3b=new Array();
if(_3a){
for(variable in _3a){
if(typeof (_3a[variable])!="function"){
var _3c=this.readCombinedImagePart(_3a[variable]);
_3b.push(_3c);
}
}
}
return _3b;
};
MapConfiguration.prototype.readCombinedImagePart=function(_3d){
var _3e=_3d.NodeName;
var _3f=null;
if(_3e=="Condition"){
var _3e=_3d.type;
var _40=_3d.attribute;
var _41=_3d.value;
var not=_3d.not;
_3f=new CombinedImageCondition(_3e,_40,_41,not);
}else{
if(_3e=="Group"){
var id=_3d.id;
_3f=new CombinedImageGroup(id);
this.visitedGroups.push(_3f);
}else{
if(_3e=="GroupRef"){
var id=_3d.id;
_3f=new CombinedImageGroupRef(id);
}else{
if(_3e=="Image"){
var _44=_3d.image;
var _45=_3d.imageAttribute;
var _46=_3d.widthAttribute;
var _47=_3d.heightAttribute;
var _48=_3d.tooltip;
var _49=_3d.tooltipAttribute;
var _4a=_3d.width;
var _4b=_3d.height;
_3f=new CombinedImageImage(_44,_45,_48,_49,_4a,_46,_4b,_47);
}else{
if(_3e=="Label"){
var _4c=_3d.caption;
var _4d=_3d.captionAttribute;
var css=_3d.css;
_3f=new CombinedImageLabel(_4c,_4d,css);
}else{
if(_3e=="Offset"){
var x=_3d.x;
var y=_3d.y;
var _40=_3d.attribute;
_3f=new CombinedImageOffset(x,y,_40);
}
}
}
}
}
}
if(_3f){
_3f.children=this.readCombinedImageParts(_3d.ChildNodes);
}
return _3f;
};
function ControlGroup(_51,_52){
this.type=_51.type;
this.label=_51.label;
this.css=_51.css;
if(_51.Parameter){
this.parameters=_52.readParameterList(_51.Parameter);
}
}
function Parameter(_53,_54,_55,_56,_57){
this.name=_53;
this.type=_54;
this.value=_55;
this.label=_56;
this.state=_57;
this.alternates=new Array();
}
Parameter.prototype.clone=function(){
var _58=new Parameter(this.name,this.type,this.value,this.label,this.state);
if(this.image){
_58.image=this.image.clone();
}
if(this.selectedImage){
_58.selectedImage=this.selectedImage.clone();
}
if(this.alternates){
_58.alternates=new Array();
for(var i=0;i<this.alternates.length;i++){
_58.alternates[i]=this.alternates[i];
}
}
return _58;
};
function CombinedImage(_5a){
this.parts=_5a;
}
CombinedImage.prototype.replaceGroupRefs=function(_5b){
for(var i=0;i<this.parts.length;i++){
var _5d=this.parts[i];
_5d.replaceGroupRefs(_5b);
}
};
CombinedImage.prototype.clone=function(){
var _5e=new CombinedImage(new Array());
for(var i=0;i<this.parts.length;i++){
var _60=this.parts[i].clone();
_5e.parts.push(_60);
}
return _5e;
};
CombinedImage.prototype.bounds=function(_61){
var _62=new GeoRectangle(0,0,0,0);
var _63=true;
for(var i=0;i<this.parts.length;i++){
var _65=this.parts[i];
var _66=_65.bounds(_61);
_62=_62.union(_62,_66);
_63=_63&&_66.complete;
}
_62.complete=_63;
return _62;
};
CombinedImage.prototype.inside=function(x,y,_69){
for(var i=0;i<this.parts.length;i++){
var _6b=this.parts[i];
if(_6b.inside(x,y,_69)){
return true;
}
}
return false;
};
CombinedImage.prototype.applyConfiguration=function(_6c,_6d,_6e){
for(var i=0;i<this.parts.length;i++){
var _70=this.parts[i];
_70.applyConfiguration(_6c,0,0,_6d,_6e);
}
};
CombinedImage.prototype.destroy=function(){
for(var i=0;i<this.parts.length;i++){
var _72=this.parts[i];
_72.destroy();
}
};
function applyConfigurationForChildren(_73,_74,_75,_76,_77){
for(var i=0;i<this.children.length;i++){
var _79=this.children[i];
_79.applyConfiguration(_73,_74,_75,_76,_77);
}
}
function destroyChildren(){
for(var i=0;i<this.children.length;i++){
var _7b=this.children[i];
_7b.destroy();
}
}
function replaceGroupRefsBase(_7c){
for(var i=0;i<this.children.length;i++){
var _7e=this.children[i];
var _7f=_7e.objectType;
if(_7f=="CombinedImageGroupRef"){
for(var j=0;j<_7c.length;j++){
if(_7c[j].id==_7e.id){
this.children[i]=_7c[j].clone();
break;
}
}
}
this.children[i].replaceGroupRefs(_7c);
}
}
function boundsOfChildren(_81){
var _82=new GeoRectangle(0,0,0,0);
var _83=true;
for(var i=0;i<this.children.length;i++){
var _85=this.children[i];
var _86=_85.bounds(_81);
_82=_82.union(_82,_86);
_83=_83&&_86.complete;
}
_82.complete=_83;
return _82;
}
function insideChildren(x,y,_89){
for(var i=0;i<this.children.length;i++){
var _8b=this.children[i];
if(_8b.inside(x,y,_89)){
return true;
}
}
}
function findAttribute(_8c,_8d){
for(var i=0;i<_8c.length;i++){
if(_8c[i].name==_8d){
return _8c[i].value;
}
}
return null;
}
function CombinedImageCondition(_8f,_90,_91,not){
this.type=_8f;
this.attributeName=_90;
this.attributeValue=_91;
this.not=not;
this.objectType="CombinedImageCondition";
this.children=new Array();
this.matched=false;
}
CombinedImageCondition.prototype.replaceGroupRefs=replaceGroupRefsBase;
CombinedImageCondition.prototype.boundsOfChildren=boundsOfChildren;
CombinedImageCondition.prototype.bounds=function(_93){
if(this.matched){
return this.boundsOfChildren(_93);
}else{
var _94=new GeoRectangle(0,0,0,0);
_94.complete=true;
return _94;
}
};
CombinedImageCondition.prototype.insideChildren=insideChildren;
CombinedImageCondition.prototype.inside=function(x,y,_97){
if(this.matched){
return this.insideChildren(x,y,_97);
}else{
return false;
}
};
CombinedImageCondition.prototype.applyConfiguration=function(_98,x,y,_9b,_9c){
switch(this.type){
case "value":
var _9d=findAttribute(_9b,this.attributeName);
this.matched=(_9d==this.attributeValue);
break;
case "selected":
this.matched=_9c;
break;
}
if(this.not&&this.not=="true"){
this.matched=!this.matched;
}
if(this.matched){
this.applyConfigurationForChildren(_98,x,y,_9b,_9c);
}else{
this.destroy();
}
};
CombinedImageCondition.prototype.applyConfigurationForChildren=applyConfigurationForChildren;
CombinedImageCondition.prototype.destroy=destroyChildren;
CombinedImageCondition.prototype.clone=function(){
var _9e=new CombinedImageCondition(this.type,this.attributeName,this.attributeValue,this.not);
for(var i=0;i<this.children.length;i++){
_9e.children.push(this.children[i].clone());
}
return _9e;
};
function CombinedImageGroup(id){
this.id=id;
this.objectType="CombinedImageGroup";
this.children=new Array();
}
CombinedImageGroup.prototype.replaceGroupRefs=replaceGroupRefsBase;
CombinedImageGroup.prototype.bounds=boundsOfChildren;
CombinedImageGroup.prototype.inside=insideChildren;
CombinedImageGroup.prototype.applyConfiguration=applyConfigurationForChildren;
CombinedImageGroup.prototype.destroy=destroyChildren;
CombinedImageGroup.prototype.clone=function(){
var _a1=new CombinedImageGroup(this.id);
for(var i=0;i<this.children.length;i++){
_a1.children.push(this.children[i].clone());
}
return _a1;
};
function CombinedImageGroupRef(id){
this.id=id;
this.objectType="CombinedImageGroupRef";
this.children=new Array();
}
CombinedImageGroupRef.prototype.replaceGroupRefs=replaceGroupRefsBase;
function CombinedImageImage(_a4,_a5,_a6,_a7,_a8,_a9,_aa,_ab){
this.image=_a4;
this.imageAttribute=_a5;
this.tooltip=_a6;
this.tooltipAttribute=_a7;
this.width=_a8;
this.widthAttribute=_a9;
this.height=_aa;
this.heightAttribute=_ab;
this.objectType="CombinedImageImage";
this.children=new Array();
this.imgNode=null;
}
CombinedImageImage.prototype.replaceGroupRefs=replaceGroupRefsBase;
CombinedImageImage.prototype.boundsOfChildren=boundsOfChildren;
CombinedImageImage.prototype.bounds=function(_ac){
var _ad=0;
var _ae=0;
try{
_ad=parseInt(this.width,10);
_ae=parseInt(this.height,10);
}
catch(e){
}
var _af=_ac.getPixelsToViewUnits()*_ad;
var _b0=_ac.getPixelsToViewUnits()*_ae;
var _b1=this.boundsOfChildren(_ac);
var _b2=_b1.complete;
_b1=_b1.union(_b1,new GeoRectangle(_af,_b0,0,0));
_b1.complete=_b2;
return _b1;
};
CombinedImageImage.prototype.insideChildren=insideChildren;
CombinedImageImage.prototype.inside=function(x,y,_b5){
var _b6=0;
var _b7=0;
try{
_b6=parseInt(this.width,10);
_b7=parseInt(this.height,10);
}
catch(e){
}
var _b8=_b5.getPixelsToViewUnits()*_b6;
var _b9=_b5.getPixelsToViewUnits()*_b7;
if(x>=0&&x<=_b8&&y>=0&&y<=_b9){
return true;
}else{
return this.insideChildren(x,y,_b5);
}
};
CombinedImageImage.prototype.applyConfiguration=function(_ba,x,y,_bd,_be){
var _bf=new ImageConfiguration();
var _c0=this.image;
if(this.imageAttribute){
_c0=findAttribute(_bd,this.imageAttribute);
if(!_c0){
_c0=this.image;
}
}
var _c1=this.tooltip;
if(this.tooltipAttribute){
_c1=findAttribute(_bd,this.tooltipAttribute);
if(!_c1){
_c1=this.tooltip;
}
}
var _c2=this.width;
if(this.widthAttribute){
_c2=findAttribute(_bd,this.widthAttribute);
if(!_c2){
_c2=this.width;
}
}
var _c3=this.height;
if(this.heightAttribute){
_c3=findAttribute(_bd,this.heightAttribute);
if(!_c3){
_c3=this.height;
}
}
_bf.setImage(_c0,_c2,_c3,_c1);
if(!this.imgNode){
var _c4=document.createElement("img");
this.imgNode=_c4;
_ba.appendChild(_c4);
}
_bf.applyConfiguration(this.imgNode);
var xp=0;
var yp=0;
try{
xp=parseInt(x);
yp=parseInt(y);
}
catch(e){
xp=0;
yp=0;
}
this.imgNode.style.left=xp+"px";
this.imgNode.style.top=yp+"px";
this.applyConfigurationForChildren(_ba,x,y,_bd,_be);
};
CombinedImageImage.prototype.applyConfigurationForChildren=applyConfigurationForChildren;
CombinedImageImage.prototype.destroy=function(){
if(this.imgNode&&this.imgNode.parentNode){
this.imgNode.parentNode.removeChild(this.imgNode);
}
this.imgNode=null;
this.destroyChildren();
};
CombinedImageImage.prototype.destroyChildren=destroyChildren;
CombinedImageImage.prototype.clone=function(){
var _c7=new CombinedImageImage(this.image,this.imageAttribute,this.tooltip,this.tooltipAttribute,this.width,this.widthAttribute,this.height,this.heightAttribute);
for(var i=0;i<this.children.length;i++){
_c7.children.push(this.children[i].clone());
}
return _c7;
};
function CombinedImageLabel(_c9,_ca,css){
this.caption=_c9;
this.captionAttribute=_ca;
this.css=css;
this.objectType="CombinedImageLabel";
this.children=new Array();
this.pNode=null;
}
CombinedImageLabel.prototype.replaceGroupRefs=replaceGroupRefsBase;
CombinedImageLabel.prototype.boundsOfChildren=boundsOfChildren;
CombinedImageLabel.prototype.bounds=function(_cc){
var _cd=this.boundsOfChildren(_cc);
if(this.pNode){
var _ce=this.pNode.offsetWidth;
var _cf=this.pNode.offsetHeight;
if(_ce){
var _d0=_cc.getPixelsToViewUnits()*_ce;
var _d1=_cc.getPixelsToViewUnits()*_cf;
_cd=_cd.union(_cd,new GeoRectangle(_d0,_d1,0,0));
_cd.complete=true;
return _cd;
}
}
_cd.complete=false;
return _cd;
};
CombinedImageLabel.prototype.insideChildren=insideChildren;
CombinedImageLabel.prototype.inside=function(x,y,_d4){
if(this.pNode){
var _d5=this.pNode.offsetWidth;
var _d6=this.pNode.offsetHeight;
if(_d5){
var _d7=_d4.getPixelsToViewUnits()*_d5;
var _d8=_d4.getPixelsToViewUnits()*_d6;
var _d9=x>=0&&x<=_d7&&y>=0&&y<=_d8;
if(_d9){
_d9=_d9;
}
return _d9;
}
}
return this.insideChildren(x,y,_d4);
};
CombinedImageLabel.prototype.applyConfiguration=function(_da,x,y,_dd,_de){
if(!this.pNode){
var _df=document.createElement("div");
this.pNode=_df;
}
if(this.css){
this.pNode.className=this.css;
}
if(this.captionAttribute){
var _e0=findAttribute(_dd,this.captionAttribute);
if(_e0){
this.pNode.innerHTML=_e0;
}else{
if(typeof (this.caption)!="undefined"){
this.pNode.innerHTML=this.caption;
}
}
}else{
if(typeof (this.caption)!="undefined"){
this.pNode.innerHTML=this.caption;
}
}
this.pNode.style.left=x+"px";
this.pNode.style.top=y+"px";
this.pNode.style.position="absolute";
this.pNode.style.padding="0px";
this.pNode.style.margin="0px";
if(this.captionAttribute||typeof (this.caption)!="undefined"){
_da.appendChild(this.pNode);
}
this.applyConfigurationForChildren(x,y,_da,_dd,_de);
};
CombinedImageLabel.prototype.applyConfigurationForChildren=applyConfigurationForChildren;
CombinedImageLabel.prototype.destroy=function(){
if(this.pNode&&this.pNode.parentNode){
this.pNode.parentNode.removeChild(this.pNode);
}
this.pNode=null;
this.destroyChildren();
};
CombinedImageLabel.prototype.destroyChildren=destroyChildren;
CombinedImageLabel.prototype.clone=function(){
var _e1=new CombinedImageLabel(this.caption,this.captionAttribute,this.css);
for(var i=0;i<this.children.length;i++){
_e1.children.push(this.children[i].clone());
}
return _e1;
};
function CombinedImageOffset(x,y,_e5){
this.x=x;
this.y=y;
this.attributeName=_e5;
this.objectType="CombinedImageOffset";
this.children=new Array();
}
CombinedImageOffset.prototype.replaceGroupRefs=replaceGroupRefsBase;
CombinedImageOffset.prototype.boundsOfChildren=boundsOfChildren;
CombinedImageOffset.prototype.bounds=function(_e6){
var _e7=0;
var _e8=0;
try{
_e7=parseInt(this.x,10);
_e8=parseInt(this.y,10);
}
catch(e){
}
var _e9=_e6.getPixelsToViewUnits()*_e7;
var _ea=_e6.getPixelsToViewUnits()*_e8;
var _eb=this.boundsOfChildren(_e6);
var _ec=_eb.complete;
_eb=new GeoRectangle(_eb.xMax+_e9,_eb.yMax+_ea,_eb.xMin+_e9,_eb.yMin+_ea);
_eb.complete=_ec;
return _eb;
};
CombinedImageOffset.prototype.insideChildren=insideChildren;
CombinedImageOffset.prototype.inside=function(x,y,_ef){
var _f0=0;
var _f1=0;
try{
_f0=parseInt(this.x,10);
_f1=parseInt(this.y,10);
}
catch(e){
}
var _f2=_ef.getPixelsToViewUnits()*_f0;
var _f3=_ef.getPixelsToViewUnits()*_f1;
return this.insideChildren(x-_f2,y-_f3,_ef);
};
CombinedImageOffset.prototype.applyConfiguration=function(_f4,x,y,_f7,_f8){
var _f9=findAttribute(_f7,this.attributeName);
if(_f9){
var _fa=_f9.split(",");
if(_fa.length==2){
this.x=_fa[0];
this.y=_fa[1];
}
}
var _fb=0;
var _fc=0;
try{
_fb=parseInt(this.x,10);
_fc=parseInt(this.y,10);
}
catch(e){
}
this.applyConfigurationForChildren(_f4,x+_fb,y+_fc,_f7,_f8);
};
CombinedImageOffset.prototype.applyConfigurationForChildren=applyConfigurationForChildren;
CombinedImageOffset.prototype.destroy=destroyChildren;
CombinedImageOffset.prototype.clone=function(){
var _fd=new CombinedImageOffset(this.x,this.y,this.attributeName);
for(var i=0;i<this.children.length;i++){
_fd.children.push(this.children[i].clone());
}
return _fd;
};
function ImageConfiguration(_ff){
if(_ff){
this.image=_ff.image;
this.tooltip=_ff.tooltip;
if(_ff.width){
this.width=_ff.width;
}
if(_ff.height){
this.height=_ff.height;
}
}
}
ImageConfiguration.prototype.setImage=function(_100,_101,_102,_103){
this.image=_100;
this.width=_101;
this.height=_102;
this.tooltip=_103;
};
ImageConfiguration.prototype.override=function(_104){
var _105=_104.getAttribute("image");
if(_105){
this.image=_105;
}else{
this.image="";
}
var _106=_104.getAttribute("tooltip");
if(_106){
this.tooltip=_106;
}else{
this.tooltip="";
}
var _107=_104.getAttribute("width");
if(_107){
this.width=_107;
}
var _108=_104.getAttribute("height");
if(_108){
this.height=_108;
}
};
ImageConfiguration.prototype.clone=function(){
var _109=new ImageConfiguration(null);
_109.image=this.image;
_109.tooltip=this.tooltip;
_109.width=this.width;
_109.height=this.height;
return _109;
};
ImageConfiguration.prototype.applyConfiguration=function(_10a){
setImageSource(_10a,this.image);
if(typeof (this.tooltip)!="undefined"){
_10a.alt=this.tooltip;
_10a.title=this.tooltip;
}
try{
if(this.height){
_10a.style.height=this.height;
}
if(this.width){
_10a.style.width=this.width;
}
}
catch(e){
}
};
function ListConfiguration(_10b,_10c){
if(!_10b){
return;
}
var _10d=_10b.active;
if(_10d=="false"){
this.active=false;
}else{
this.active=true;
}
this.mode=_10b.mode;
this.css=_10b.css;
if(!this.css){
this.css="";
}
if(_10b.Heading&&_10b.Heading.value){
this.heading=_10b.Heading.value;
}
if(_10b.ExpandImage){
this.expandImage=new ImageConfiguration(_10b.ExpandImage);
}
if(_10b.CollapseImage){
this.collapseImage=new ImageConfiguration(_10b.CollapseImage);
}
if(_10b.ListImage){
this.listImage=new ImageConfiguration(_10b.ListImage);
}
if(_10b.SelectedListImage){
this.selectedListImage=new ImageConfiguration(_10b.SelectedListImage);
}
if(_10b.BackImage){
this.backImage=new ImageConfiguration(_10b.BackImage);
}
if(_10b.ForwardImage){
this.forwardImage=new ImageConfiguration(_10b.ForwardImage);
}
}
ListConfiguration.prototype.setValues=function(_10e,css,mode,_111,_112,_113,_114,_115,_116,_117){
this.active=_10e;
this.mode=mode;
this.css=css;
this.heading=_111;
this.expandImage=_112;
this.collapseImage=_113;
this.listImage=_114;
this.selectedListImage=_115;
this.backImage=_116;
this.forwardImage=_117;
};
ListConfiguration.prototype.override=function(_118){
if(_118.active){
this.active=stringToBoolean(_118.active,false);
}
if(_118.mode=="docked"||_118.mode=="overlay"||_118.mode=="standalone"){
this.mode=_118.mode;
}
if(_118.css!=null){
this.css=_118.css;
}
if(_118.Heading&&_118.Heading.value){
this.heading=_118.Heading.value;
}
if(_118.ExpandImage){
this.expandImage=new ImageConfiguration(_118.ExpandImage);
}
if(_118.CollapseImage){
this.collapseImage=new ImageConfiguration(_118.CollapseImage);
}
if(_118.ListImage){
this.listImage=new ImageConfiguration(_118.ListImage);
}
if(_118.SelectedListImage){
this.selectedListImage=new ImageConfiguration(_118.SelectedListImage);
}
if(_118.BackImage){
this.backImage=new ImageConfiguration(_118.BackImage);
}
if(_118.ForwardImage){
this.forwardImage=new ImageConfiguration(_118.ForwardImage);
}
};
function DrivingDirectionsConfiguration(_119){
if(!_119){
return;
}
var _11a=_119.active;
if(_11a=="false"){
this.active=false;
}else{
this.active=true;
}
this.mode=_119.mode;
this.css=_119.css;
if(!this.css){
this.css="";
}
if(_119.Heading&&_119.Heading.value){
this.heading=_119.Heading.value;
}
if(_119.EvenItem&&_119.EvenItem.css){
this.evenItemCSS=_119.EvenItem.css;
}
if(_119.OddItem&&_119.OddItem.css){
this.oddItemCSS=_119.OddItem.css;
}
if(_119.CollapseImage){
this.collapseImage=new ImageConfiguration(_119.CollapseImage);
}
if(_119.Images){
this.images=new Object();
for(var obj in _119.Images){
if(_119.Images[obj]&&typeof (_119.Images[obj])!="function"){
var type=obj.toLowerCase();
this.images[type]=new Object();
for(var _11d in _119.Images[obj]){
if(_119.Images[obj][_11d]&&typeof (_119.Images[obj][_11d])!="function"){
var _11e=_11d.toLowerCase();
var _11f=_119.Images[obj][_11d].image;
var _120=_119.Images[obj][_11d].width;
var _121=_119.Images[obj][_11d].height;
this.images[type][_11e]=new Object();
this.images[type][_11e].image=_11f;
this.images[type][_11e].width=_120;
this.images[type][_11e].height=_121;
}
}
}
}
}
}
function GUIElement(_122){
if(_122==null){
return;
}
this.active=stringToBoolean(_122.active,false);
var mode=_122.mode;
if(mode=="docked"||mode=="overlay"||mode=="standalone"){
this.mode=mode;
}else{
this.mode="overlay";
}
var css=_122.css;
if(css){
this.css=css;
}else{
this.css="";
}
}
GUIElement.prototype.override=function(_125){
if(_125.active){
this.active=stringToBoolean(_125.active,false);
}
if(_125.mode=="docked"||_125.mode=="overlay"||_125.mode=="standalone"){
this.mode=_125.mode;
}
if(_125.css!=null){
this.css=_125.css;
}
};
GUIElement.prototype.setValues=function(_126,css,mode){
this.active=_126;
this.css=css;
this.mode=mode;
};
GUIElement.prototype.overrideGUIElement=function(_129){
var _12a=_129.getAttribute("active");
if(_12a){
if(_12a=="false"){
this.active=false;
}else{
if(_12a=="true"){
this.active=true;
}
}
}
var mode=_129.getAttribute("mode");
if(mode=="docked"||mode=="overlay"||mode=="standalone"){
this.mode=mode;
}
var css=_129.getAttribute("css");
if(css!=null){
this.css=css;
}
};
GUIElement.prototype.clone=function(){
var _12d=new GUIElement(null);
_12d.setValues(this.active,this.css,this.mode);
return _12d;
};
function GeoRectangle(xMax,yMax,xMin,yMin){
if(xMax<xMin){
var temp=xMax;
xMax=xMin;
xMin=temp;
}
if(yMax<yMin){
var temp=yMax;
yMax=yMin;
yMin=temp;
}
this.xMax=xMax;
this.yMax=yMax;
this.xMin=xMin;
this.yMin=yMin;
this.width=xMax-xMin;
this.height=yMax-yMin;
this.centerPoint=new RWCPoint(xMin+this.width/2,yMin+this.height/2);
}
GeoRectangle.prototype.union=function(r1,r2){
var minX;
if(isNaN(r1.xMin)&&!isNan(r2.xMin)){
minX=r2.xMin;
}else{
if(isNaN(r2.xMin)&&!isNaN(r1.xMin)){
minX=r1.xMin;
}else{
minX=Math.min(r1.xMin,r2.xMin);
}
}
var minY;
if(isNaN(r1.yMin)&&!isNan(r2.yMin)){
minY=r2.yMin;
}else{
if(isNaN(r2.yMin)&&!isNaN(r1.yMin)){
minY=r1.yMin;
}else{
minY=Math.min(r1.yMin,r2.yMin);
}
}
var maxX;
if(isNaN(r1.xMin+r1.width)&&!isNan(r2.xMin+r2.width)){
maxX=r2.xMin+r2.width;
}else{
if(isNaN(r2.xMin+r2.width)&&!isNaN(r1.xMin+r1.width)){
maxX=r1.xMin+r1.width;
}else{
maxX=Math.max(r1.xMin+r1.width,r2.xMin+r2.width);
}
}
var maxY;
if(isNaN(r1.yMin+r1.height)&&!isNan(r2.yMin+r2.height)){
maxY=r2.yMin+r2.height;
}else{
if(isNaN(r2.yMin+r2.height)&&!isNaN(r1.yMin+r1.height)){
maxY=r1.yMin+r1.height;
}else{
maxY=Math.max(r1.yMin+r1.height,r2.yMin+r2.height);
}
}
var _139=new GeoRectangle(maxX,maxY,minX,minY);
return _139;
};

function ZoomTool(_1,_2,_3){
this.saMap=_1;
this.type="zoom";
this.embedDiv=_3;
this.zoomRect=document.createElement("div");
this.zoomRect.id=_2+"zoomR";
this.zoomRect.className="rwcZoomRectangle";
setVisible(this.zoomRect,false);
this.embedDiv.appendChild(this.zoomRect);
this.manipulateFunc=associateObjWithEvent(this,"manipulate");
this.endManipulationFunc=associateObjWithEvent(this,"endManipulation");
this.cursor="crosshair";
}
ZoomTool.prototype.startManipulation=function(_4){
_4=new Evt(_4);
setVisible(this.zoomRect,true);
if(document.attachEvent){
document.body.attachEvent("onselectstart",returnFalse,false);
document.body.attachEvent("ondrag",returnFalse,false);
}
setVisible(this.zoomRect,true);
this.startPoint=getPixelPositionFromEvent(_4,this.saMap.mapContainer);
this.currentPoint=this.startPoint;
setX(this.zoomRect,this.startPoint.x);
setY(this.zoomRect,this.startPoint.y);
setWidth(this.zoomRect,1);
setHeight(this.zoomRect,1);
Evt.addEventListener(document,"mousemove",this.manipulateFunc,false);
Evt.addEventListener(document,"mouseup",this.endManipulationFunc,false);
_4.consume();
};
ZoomTool.prototype.manipulate=function(_5,_6){
_5=new Evt(_5);
this.currentPoint=getPixelPositionFromEvent(_5,this.saMap.mapContainer);
var w=this.currentPoint.x-this.startPoint.x;
var h=this.currentPoint.y-this.startPoint.y;
setWidth(this.zoomRect,Math.abs(w));
if(w<0){
setX(this.zoomRect,this.startPoint.x+w);
}
setHeight(this.zoomRect,Math.abs(h));
if(h<0){
setY(this.zoomRect,this.startPoint.y+h);
}
_5.consume();
};
ZoomTool.prototype.cancelManipulation=function(){
if(document.detachEvent){
document.body.detachEvent("onselectstart",returnFalse,false);
document.body.detachEvent("ondrag",returnFalse,false);
}
setVisible(this.zoomRect,false);
Evt.removeEventListener(document,"mousemove",this.manipulateFunc,false);
Evt.removeEventListener(document,"mouseup",this.endManipulationFunc,false);
};
ZoomTool.prototype.endManipulation=function(_9,_a){
_9=new Evt(_9);
if(document.detachEvent){
document.body.detachEvent("onselectstart",returnFalse,false);
document.body.detachEvent("ondrag",returnFalse,false);
}
setVisible(this.zoomRect,false);
var w=this.currentPoint.x-this.startPoint.x;
var h=this.currentPoint.y-this.startPoint.y;
if(Math.abs(w)<2&&Math.abs(h)<2){
this.saMap.activateClickTools(this.currentPoint);
}else{
this.saMap.zoomToRect(getX(this.zoomRect),getY(this.zoomRect),getWidth(this.zoomRect),getHeight(this.zoomRect));
}
Evt.removeEventListener(document,"mousemove",this.manipulateFunc,false);
Evt.removeEventListener(document,"mouseup",this.endManipulationFunc,false);
this.saMap.manipulationActive=false;
_9.consume();
};
ZoomTool.prototype.unload=function(){
try{
Evt.removeEventListener(document,"mousemove",this.manipulateFunc,false);
Evt.removeEventListener(document,"mouseup",this.endManipulationFunc,false);
}
catch(e){
}
};
function PanTool(_d){
this.saMap=_d;
this.type="pan";
this.manipulateFunc=associateObjWithEvent(this,"manipulate");
this.endManipulationFunc=associateObjWithEvent(this,"endManipulation");
this.cursor="move";
}
PanTool.prototype.startManipulation=function(_e){
if(this.saMap.mainMap){
if(this.saMap.currentTool.type="pan"){
this.saMap.mainMap.currentTool.startManipulation(_e);
this.saMap.manipulationActive=false;
return;
}else{
return;
}
}
_e=new Evt(_e);
if(document.attachEvent){
document.body.attachEvent("onselectstart",returnFalse,false);
document.body.attachEvent("ondrag",returnFalse,false);
}
this.saMap.beginDrag();
this.startPoint=getPixelPositionFromEvent(_e,this.saMap.mapContainer);
Evt.addEventListener(document,"mousemove",this.manipulateFunc,false);
Evt.addEventListener(document,"mouseup",this.endManipulationFunc,false);
_e.consume();
};
PanTool.prototype.manipulate=function(_f,_10){
_f=new Evt(_f);
var _11=getPixelPositionFromEvent(_f,this.saMap.mapContainer);
this.saMap.drag(_11.x-this.startPoint.x,_11.y-this.startPoint.y);
_f.consume();
};
PanTool.prototype.cancelManipulation=function(){
if(document.detachEvent){
document.body.detachEvent("onselectstart",returnFalse,false);
document.body.detachEvent("ondrag",returnFalse,false);
}
Evt.removeEventListener(document,"mousemove",this.manipulateFunc,false);
Evt.removeEventListener(document,"mouseup",this.endManipulationFunc,false);
this.saMap.endDrag();
};
PanTool.prototype.endManipulation=function(evt,_13){
evt=new Evt(evt);
if(document.detachEvent){
document.body.detachEvent("onselectstart",returnFalse,false);
document.body.detachEvent("ondrag",returnFalse,false);
}
this.saMap.endDrag();
Evt.removeEventListener(document,"mousemove",this.manipulateFunc,false);
Evt.removeEventListener(document,"mouseup",this.endManipulationFunc,false);
evt.consume();
};
PanTool.prototype.unload=function(){
try{
Evt.removeEventListener(document,"mousemove",this.manipulateFunc,false);
Evt.removeEventListener(document,"mouseup",this.endManipulationFunc,false);
}
catch(e){
}
};
function SelectionTool(_14,_15,_16){
this.saMap=_14;
this.embedDiv=_16;
this.type="select";
this.selectRect=document.createElement("div");
this.selectRect.id=_15+"selectR";
this.selectRect.className="rwcZoomRectangle";
setVisible(this.selectRect,false);
this.embedDiv.appendChild(this.selectRect);
this.manipulateFunc=associateObjWithEvent(this,"manipulate");
this.endManipulationFunc=associateObjWithEvent(this,"endManipulation");
this.outPutElement=document.getElementById(this.saMap.config.GUI.dragTool.outputElement);
this.cursor="crosshair";
}
SelectionTool.prototype.startManipulation=function(evt){
evt=new Evt(evt);
setVisible(this.selectRect,true);
if(document.attachEvent){
document.body.attachEvent("onselectstart",returnFalse,false);
document.body.attachEvent("ondrag",returnFalse,false);
}
this.startPoint=getPixelPositionFromEvent(evt,this.saMap.mapContainer);
this.currentPoint=this.startPoint;
setVisible(this.selectRect,true);
setX(this.selectRect,this.startPoint.x);
setY(this.selectRect,this.startPoint.y);
setWidth(this.selectRect,1);
setHeight(this.selectRect,1);
Evt.addEventListener(document,"mousemove",this.manipulateFunc,false);
Evt.addEventListener(document,"mouseup",this.endManipulationFunc,false);
evt.consume();
};
SelectionTool.prototype.manipulate=function(evt,_19){
evt=new Evt(evt);
this.currentPoint=getPixelPositionFromEvent(evt,this.saMap.mapContainer);
var w=this.currentPoint.x-this.startPoint.x;
var h=this.currentPoint.y-this.startPoint.y;
setWidth(this.selectRect,Math.abs(w));
if(w<0){
setX(this.selectRect,this.startPoint.x+w);
}
setHeight(this.selectRect,Math.abs(h));
if(h<0){
setY(this.selectRect,this.startPoint.y+h);
}
evt.consume();
};
SelectionTool.prototype.cancelManipulation=function(){
if(document.detachEvent){
document.body.detachEvent("onselectstart",returnFalse,false);
document.body.detachEvent("ondrag",returnFalse,false);
}
setVisible(this.selectRect,false);
Evt.removeEventListener(document,"mousemove",this.manipulateFunc,false);
Evt.removeEventListener(document,"mouseup",this.endManipulationFunc,false);
};
SelectionTool.prototype.endManipulation=function(evt,_1d){
evt=new Evt(evt);
if(document.detachEvent){
document.body.detachEvent("onselectstart",returnFalse,false);
document.body.detachEvent("ondrag",returnFalse,false);
}
setVisible(this.selectRect,false);
var w=this.currentPoint.x-this.startPoint.x;
var h=this.currentPoint.y-this.startPoint.y;
if(w<2&&h<2){
this.saMap.activateClickTools(this.currentPoint);
}else{
var _20=getX(this.selectRect);
var _21=_20+getWidth(this.selectRect);
var _22=getY(this.selectRect);
var _23=_22+getHeight(this.selectRect);
var _24=this.saMap.getGeoObjectsBySelection(_21,_23,_20,_22);
var _25=this.saMap.createObjectSelectionList(_24,false);
if(this.outPutElement){
this.outPutElement.innerHTML=_25.innerHTML;
}
}
Evt.removeEventListener(document,"mousemove",this.manipulateFunc,false);
Evt.removeEventListener(document,"mouseup",this.endManipulationFunc,false);
this.saMap.manipulationActive=false;
evt.consume();
};
SelectionTool.prototype.unload=function(){
try{
Evt.removeEventListener(document,"mousemove",this.manipulateFunc,false);
Evt.removeEventListener(document,"mouseup",this.endManipulationFunc,false);
}
catch(e){
}
};

function PanControl(_1,_2,_3){
this.saMap=_2;
this.container=document.createElement("div");
this.container.id=_3+"PanControl";
addClass(this.container,this.saMap.config.GUI.panControl.css);
this.panUp=document.createElement("img");
this.panDown=document.createElement("img");
this.panLeft=document.createElement("img");
this.panRight=document.createElement("img");
this.container.appendChild(this.panUp);
this.container.appendChild(this.panDown);
this.container.appendChild(this.panLeft);
this.container.appendChild(this.panRight);
this.saMap.config.GUI.panControl.panUp.applyConfiguration(this.panUp);
this.saMap.config.GUI.panControl.panDown.applyConfiguration(this.panDown);
this.saMap.config.GUI.panControl.panLeft.applyConfiguration(this.panLeft);
this.saMap.config.GUI.panControl.panRight.applyConfiguration(this.panRight);
this.panUp.className="rwcPanUp";
this.panDown.className="rwcPanDown";
this.panLeft.className="rwcPanLeft";
this.panRight.className="rwcPanRight";
this.panUp.id=_3+"panUp";
this.panDown.id=_3+"panDown";
this.panLeft.id=_3+"panLeft";
this.panRight.id=_3+"panRight";
this.panUpDelegate=associateObjWithEvent(this,"onPanUp");
this.panDownDelegate=associateObjWithEvent(this,"onPanDown");
this.panLeftDelegate=associateObjWithEvent(this,"onPanLeft");
this.panRightDelegate=associateObjWithEvent(this,"onPanRight");
this.progressIndicator=document.createElement("img");
if(this.saMap.config.GUI.progressIndicator){
this.saMap.config.GUI.progressIndicator.applyConfiguration(this.progressIndicator);
}else{
this.progressIndicator.src="pic/progress-indicator.gif";
}
this.progressIndicator.id=_3+"progressIndicator";
this.progressIndicator.className="rwcProgressIndicator";
this.container.appendChild(this.progressIndicator);
Evt.addEventListener(this.panUp,"click",this.panUpDelegate);
Evt.addEventListener(this.panDown,"click",this.panDownDelegate);
Evt.addEventListener(this.panLeft,"click",this.panLeftDelegate);
Evt.addEventListener(this.panRight,"click",this.panRightDelegate);
setVisible(this.container,true);
if(this.container,this.saMap.config.GUI.panControl.mode=="overlay"){
_1.appendChild(this.container);
}else{
if(this.container,this.saMap.config.GUI.panControl.mode=="standalone"){
document.body.appendChild(this.container);
}else{
_1.appendChild(this.container);
}
}
}
PanControl.prototype.onPanUp=function(){
this.saMap.panUp();
};
PanControl.prototype.onPanDown=function(){
this.saMap.panDown();
};
PanControl.prototype.onPanLeft=function(){
this.saMap.panLeft();
};
PanControl.prototype.onPanRight=function(){
this.saMap.panRight();
};
PanControl.prototype.unload=function(){
Evt.removeEventListener(this.panUp,"click",this.panUpDelegate);
Evt.removeEventListener(this.panDown,"click",this.panDownDelegate);
Evt.removeEventListener(this.panLeft,"click",this.panLeftDelegate);
Evt.removeEventListener(this.panRight,"click",this.panRightDelegate);
};

function SearchControl(_1,_2,_3,_4,_5,_6,_7){
this.mapServerUrl=_2;
this.saMap=_3;
this.container=document.createElement("div");
this.container.id=this.saMap.prefix+_4.name+"SearchControl";
addClass(this.container,_6.searchControl.css);
this.top=this.container.offsetTop;
this.layer=_4;
if(_7.initiation=="automatic"){
this.isAutomatic=true;
}else{
this.isAutomatic=false;
}
this.downloadBehavior=_7;
this.xmlHttp=null;
this.header=document.createElement("h4");
this.header.innerHTML=this.layer.configuration.searchControl.heading;
this.expanded=true;
this.minimizeElement=document.createElement("img");
if(this.layer.configuration.searchControl.collapseImage&&this.layer.configuration.searchControl.collapseImage.image!=""){
this.minimizeElement.className="rwcMinimizeElement";
this.layer.configuration.searchControl.collapseImage.applyConfiguration(this.minimizeElement);
this.header.appendChild(this.minimizeElement);
}
this.container.appendChild(this.header);
this.clickDelegate=associateObjWithEvent(this,"headerClicked");
Evt.addEventListener(this.minimizeElement,"click",this.clickDelegate);
this.controlGroups=new Array();
this.searchAttributes=new Array();
for(var i=0;i<this.layer.configuration.search.controlGroups.length;i++){
this.controlGroups[i]=new SearchControlGroup(this.layer.configuration.search.controlGroups[i],this.container,this,this.downloadBehavior,_6.searchGUI);
this.controlGroups[i].addToAttributeList(this.searchAttributes);
}
this.resultsBox=document.createElement("div");
this.resultsBox.className=this.layer.configuration.search.searchResults.css;
if(this.layer.configuration.search.searchResults.active){
switch(this.layer.configuration.search.searchResults.mode){
case ("overlay"):
this.saMap.embedDiv.appendChild(this.resultsBox);
break;
case ("docked"):
addClass(this.resultsBox,"rwcResultsListDocked");
this.container.appendChild(this.resultsBox);
setVisible(this.saMap.dockingArea,true);
break;
default:
this.saMap.embedDiv.appendChild(this.resultsBox);
break;
}
}
setVisible(this.resultsBox,false);
setVisible(this.container,true);
_1.appendChild(this.container);
}
SearchControl.prototype.headerClicked=function(_9,_a){
if(this.expanded){
this.expanded=false;
for(var i=0;i<this.controlGroups.length;i++){
this.controlGroups[i].container.style.display="none";
}
this.layer.configuration.searchControl.expandImage.applyConfiguration(this.minimizeElement);
}else{
this.expanded=true;
for(var i=0;i<this.controlGroups.length;i++){
this.controlGroups[i].container.style.display="block";
}
this.layer.configuration.searchControl.collapseImage.applyConfiguration(this.minimizeElement);
}
};
SearchControl.prototype.initiateSearch=function(_c,_d){
if(!this.layer.isHidden){
this.layer.getGeoObjects(this.saMap.mapServerUrl,this.saMap.viewName,0,0,this.saMap.tileSize*this.saMap.nCols,this.saMap.tileSize*this.saMap.nRows,true);
}
};
SearchControl.prototype.initiateClientSearch=function(){
if(this.layer.geoObjectArray){
var _e=true;
var n=this.layer.geoObjectArray.length;
for(var i=0;i<n;i++){
for(var j=0;j<this.controlGroups.length;j++){
if(!this.controlGroups[j].isServerSearch){
var _e=this.controlGroups[j].filter(this.layer.geoObjectArray[i]);
if(!_e){
this.layer.geoObjectArray[i].hide();
break;
}
}
}
if(_e){
this.layer.geoObjectArray[i].show();
}
}
}
for(var i=0;i<this.saMap.onClientSearchEventHandlers.length;i++){
this.onClientSearchEventHandlers[i](this.saMap);
}
};
SearchControl.prototype.clearSearch=function(){
setVisible(this.resultsBox,false);
this.layer.removeGeoObjects();
for(var i=0;i<this.controlGroups.length;i++){
this.controlGroups[i].clear();
}
};
SearchControl.prototype.buildSearchString=function(){
var _13="";
for(var i=0;i<this.controlGroups.length;i++){
if(this.controlGroups[i].isServerSearch){
_13+=this.controlGroups[i].buildSearchString();
}
}
return _13;
};
SearchControl.prototype.addResults=function(_15){
if(typeof (this.layer.geoObjectArray)=="undefined"){
return;
}
this.initiateClientSearch();
if(this.layer.configuration.search.searchResults.active){
this.drawSearchResultsList(_15);
}
this.layer.draw();
};
SearchControl.prototype.drawSearchResultsList=function(_16){
if(this.layer.geoObjectArray==null){
return;
}
if(this.searchResultArray){
for(var i=0;i<this.searchResultArray.length;i++){
this.searchResultArray[i].unload();
}
}
this.resultsBox.innerHTML="";
if(this.layer.configuration.search.searchResults.heading){
var _18=document.createElement("h4");
_18.className="rwcSearchResultHeading";
_18.innerHTML=this.layer.configuration.search.searchResults.heading;
this.resultsBox.appendChild(_18);
}
this.resultsListClose=document.createElement("img");
this.resultsListClose.className="rwcCloseBox";
this.saMap.config.GUI.closeBox.applyConfiguration(this.resultsListClose);
this.resultsBox.appendChild(this.resultsListClose);
this.resultCloseDelegate=associateObjWithEvent(this,"clearSearch");
Evt.addEventListener(this.resultsListClose,"click",this.resultCloseDelegate);
this.searchResultArray=new Array();
this.lineHeight=14;
this.itemHeight=this.lineHeight*this.layer.configuration.search.searchResults.parameters.length;
this.guiHeight=40+parseInt(this.layer.configuration.search.searchResults.forwardImage.height);
if(this.layer.geoObjectArray.length>0){
this.linesPerResult=this.layer.geoObjectArray[0].searchResultParameters.length;
}else{
var _19=document.createElement("div");
_19.innerHTML=this.saMap.config.GUI.strings.noResults;
this.resultsBox.appendChild(_19);
setVisible(this.resultsBox,true);
return;
}
var _1a=this.resultsBox.parentNode.offsetHeight-this.resultsBox.offsetTop-this.guiHeight;
this.maxResultsPerPage=Math.floor(_1a/this.itemHeight);
if(this.maxResultsPerPage>10){
this.maxResultsPerPage=10;
}
if(this.maxResultsPerPage<=0){
this.maxResultsPerPage=1;
}
this.startIndex=_16;
this.maxCount=this.layer.geoObjectArray.length;
this.pageCount=this.maxCount-this.startIndex;
if(this.pageCount>this.maxResultsPerPage){
this.pageCount=this.maxResultsPerPage;
}
this.endIndex=this.startIndex+this.pageCount;
for(var i=this.startIndex;i<this.endIndex;i++){
this.layer.geoObjectArray[i].isHidden=false;
var _1b=new SearchResult(this.layer.geoObjectArray[i],this.resultsBox,this.saMap);
this.searchResultArray.push(_1b);
}
this.indexText=document.createElement("span");
this.resultsBox.appendChild(this.indexText);
this.indexText.innerHTML=this.startIndex+"-"+(this.startIndex+this.pageCount)+" ("+this.maxCount+")";
var _1c=document.createElement("br");
this.resultsBox.appendChild(_1c);
if(typeof (this.backButton!="undefined")&&this.backButton!=null){
Evt.removeEventListener(this.backButton,"click",this.backButtonClickDelegate,false);
}
if(typeof (this.forwardButton!="undefined")&&this.forwardButton!=null){
Evt.removeEventListener(this.forwardButton,"click",this.forwardButtonClickDelegate,false);
}
if(this.startIndex>0){
for(var i=0;i<this.startIndex;i++){
this.layer.geoObjectArray[i].setVisible(false);
}
this.backButton=document.createElement("img");
this.layer.configuration.search.searchResults.backImage.applyConfiguration(this.backButton);
this.resultsBox.appendChild(this.backButton);
this.backButtonClickDelegate=associateObjWithEvent(this,"backButtonClicked");
Evt.addEventListener(this.backButton,"click",this.backButtonClickDelegate);
}
if(this.endIndex<this.maxCount){
for(var i=this.endIndex;i<this.layer.geoObjectArray.length;i++){
this.layer.geoObjectArray[i].setVisible(false);
}
this.forwardButton=document.createElement("img");
this.layer.configuration.search.searchResults.forwardImage.applyConfiguration(this.forwardButton);
this.resultsBox.appendChild(this.forwardButton);
this.forwardButtonClickDelegate=associateObjWithEvent(this,"forwardButtonClicked");
Evt.addEventListener(this.forwardButton,"click",this.forwardButtonClickDelegate);
}
setVisible(this.resultsBox,true);
};
SearchControl.prototype.forwardButtonClicked=function(evt,_1e){
this.startIndex+=this.maxResultsPerPage;
if((this.startIndex+this.maxResultsPerPage)>this.maxCount){
this.startIndex=this.maxCount-this.maxResultsPerPage;
}
this.addResults(this.startIndex);
};
SearchControl.prototype.backButtonClicked=function(evt,_20){
this.startIndex-=this.maxResultsPerPage;
if(this.startIndex<0){
this.startIndex=0;
}
this.addResults(this.startIndex);
};
SearchControl.prototype.reduceSearchResults=function(_21,_22,_23){
if(!this.layer.geoObjectArray){
return;
}
var n=this.layer.geoObjectArray.length;
switch(_23){
case ("toggle"):
for(var i=0;i<n;i++){
if(!this.layer.geoObjectArray[i].searchAttributes[_21]||this.layer.geoObjectArray[i].searchAttributes[_21]==_22){
this.layer.geoObjectArray[i].hide();
}
}
break;
case ("string"):
var _26=new RegExp("("+_22+")");
for(var i=0;i<n;i++){
if(!this.layer.geoObjectArray[i].searchAttributes[_21]||!_26.test(this.layer.geoObjectArray[i].searchAttributes[_21])){
this.layer.geoObjectArray[i].hide();
}
}
break;
case ("interval"||"slider"):
for(var i=0;i<n;i++){
var _27=parseInt(this.layer.geoObjectArray[i].searchAttributes[_21]);
if(isNaN(_22.min)&&isNaN(_22.max)){
break;
}
if(isNaN(_27)||_27<_22.min||_27>_22.max){
this.layer.geoObjectArray[i].hide();
}
}
break;
}
};
SearchControl.prototype.unload=function(){
try{
Evt.removeEventListener(this.minimizeElement,"click",this.clickDelegate,false);
if(typeof (this.backButton!="undefined")&&this.backButton!=null){
Evt.removeEventListener(this.backButton,"click",this.backButtonClickDelegate,false);
}
if(typeof (this.forwardButton!="undefined")&&this.forwardButton!=null){
Evt.removeEventListener(this.forwardButton,"click",this.forwardButtonClickDelegate,false);
}
}
catch(e){
}
if(this.searchResultArray){
for(var i=0;i<this.searchResultArray.length;i++){
this.searchResultArray[i].unload();
}
}
for(var i=0;i<this.controlGroups.length;i++){
this.controlGroups[i].unload();
}
};
function SearchResult(_29,_2a,_2b){
this.node=document.createElement("div");
this.geoObject=_29;
this.saMap=_2b;
this.node.className="rwcSearchListItem";
this.container=_2a;
_2a.appendChild(this.node);
for(var j=0;j<_29.searchResultParameters.length;j++){
if(typeof (_29.searchResultAttributes[j])!="undefined"){
var _2d=_29.attributes[_29.searchResultAttributes[j]].value;
}else{
var _2d=_29.searchResultParameters[j].value;
}
if(_2d!=null&&_2d!=""){
this.node.innerHTML+="<div>"+_2d+"</div>";
}
}
this.clickDelegate=associateObjWithEvent(this,"searchItemClicked");
Evt.addEventListener(this.node,"click",this.clickDelegate);
this.mouseOverDelegate=associateObjWithEvent(this,"searchItemMouseOver");
Evt.addEventListener(this.node,"mouseover",this.mouseOverDelegate);
this.mouseOutDelegate=associateObjWithEvent(this,"searchItemMouseOut");
Evt.addEventListener(this.node,"mouseout",this.mouseOutDelegate);
}
SearchResult.prototype.searchItemClicked=function(evt,_2f){
var _30=this.saMap.mapWidth/2-this.geoObject.viewX;
var _31=this.saMap.mapHeight/2-this.geoObject.viewY;
this.saMap.beginDrag();
this.saMap.drag(_30,_31);
this.saMap.endDrag();
this.geoObject.updateInfoBox();
};
SearchResult.prototype.searchItemMouseOver=function(evt,_33){
this.geoObject.displayInfoBox();
};
SearchResult.prototype.searchItemMouseOut=function(evt,_35){
this.geoObject.cancelInfoBox();
};
SearchResult.prototype.unload=function(evt,_37){
try{
Evt.removeEventListener(this.node,"click",this.clickDelegate,false);
Evt.removeEventListener(this.node,"mouseover",this.mouseOverDelegate,false);
Evt.removeEventListener(this.node,"mouseout",this.mouseOutDelegate,false);
}
catch(e){
}
};
function SearchControlGroup(_38,_39,_3a,_3b,_3c){
this.container=document.createElement("div");
this.configuration=_38;
this.type=_38.type;
if(this.type=="client"){
this.isServerSearch=false;
}else{
this.isServerSearch=true;
}
this.searchControl=_3a;
this.container.className=this.configuration.css;
this.controlList=new Array();
for(var i=0;i<this.configuration.parameters.length;i++){
switch(this.configuration.parameters[i].type){
case ("toggle"):
if(!this.configuration.parameters[i].image){
this.configuration.parameters[i].image=this.searchControl.layer.configuration.searchControl.listImage;
}
if(!this.configuration.parameters[i].selectedImage){
this.configuration.parameters[i].selectedImage=this.searchControl.layer.configuration.searchControl.selectedListImage;
}
this.controlList[i]=new ToggleControl(this.configuration.parameters[i],this.container,this,this.isServerSearch);
break;
case ("string"):
this.controlList[i]=new StringControl(this.configuration.parameters[i],this.container,this,this.isServerSearch);
break;
case ("interval"):
this.controlList[i]=new IntervalControl(this.configuration.parameters[i],this.container,this,this.isServerSearch);
break;
case ("slider"):
this.controlList[i]=new SliderControl(this.configuration.parameters[i],this.container,this,this.isServerSearch,_3c);
break;
case ("select"):
this.controlList[i]=new SelectControl(this.configuration.parameters[i],this.container,this,this.isServerSearch);
break;
}
}
if(_3b.initiation=="manual"){
this.searchButton=document.createElement("button");
this.searchButton.innerHTML="Search";
this.searchButton.className="rwcSearchButton";
this.container.appendChild(this.searchButton);
this.searchClickDelegate=associateObjWithEvent(this,"onSearchButtonClick");
Evt.addEventListener(this.searchButton,"click",this.searchClickDelegate);
this.clearButton=document.createElement("button");
this.clearButton.innerHTML="Clear";
this.clearButton.className="rwcClearButton";
this.container.appendChild(this.clearButton);
this.clearClickDelegate=associateObjWithEvent(this,"onClearButtonClick");
Evt.addEventListener(this.clearButton,"click",this.clearClickDelegate);
}
_39.appendChild(this.container);
}
SearchControlGroup.prototype.buildSearchString=function(){
var _3e="";
for(var i=0;i<this.controlList.length;i++){
_3e+=this.controlList[i].buildSearchString();
}
return _3e;
};
SearchControlGroup.prototype.filter=function(_40){
for(var i=0;i<this.controlList.length;i++){
var _42=this.controlList[i].filter(_40);
if(!_42){
return false;
}
}
return true;
};
SearchControlGroup.prototype.addToAttributeList=function(_43){
for(var i=0;i<this.controlList.length;i++){
var _45=false;
for(var j=0;j<_43.length;j++){
if(this.controlList[i].name==_43[j]){
_45=true;
this.controlList[i].attributeId=j;
break;
}
}
if(!_45){
this.controlList[i].attributeId=_43.length;
_43.push(this.controlList[i].name);
}
}
};
SearchControlGroup.prototype.update=function(){
if(!this.searchControl.layer.useLayerControl||!this.searchControl.saMap.layerControl||this.searchControl.saMap.layerControl.isVisible(this.searchControl.layer.id)){
if(this.type=="client"){
this.searchControl.initiateClientSearch();
}else{
this.searchControl.initiateSearch();
}
}
};
SearchControlGroup.prototype.reduceSearchResults=function(_47,_48,_49){
if(this.type="client"){
this.searchControl.reduceSearchResults(_47,_48,_49);
}else{
this.update();
}
};
SearchControlGroup.prototype.onSearchButtonClick=function(evt,_4b){
this.update();
};
SearchControlGroup.prototype.onClearButtonClick=function(evt,_4d){
this.searchControl.clearSearch();
};
SearchControlGroup.prototype.clear=function(evt,_4f){
for(var i=0;i<this.controlList.length;i++){
this.controlList[i].clear();
}
};
SearchControlGroup.prototype.unload=function(){
for(var i=0;i<this.controlList.length;i++){
this.controlList[i].unload();
}
if(this.searchButton){
Evt.removeEventListener(this.searchButton,"click",this.searchClickDelegate);
}
if(this.clearButton){
Evt.removeEventListener(this.clearButton,"click",this.clearClickDelegate);
}
};
function ToggleControl(_52,_53,_54,_55){
this.selected=true;
this.name=_52.name;
this.imageConfig=_52.image;
this.selectedImageConfig=_52.selectedImage;
this.value=_52.value.toLowerCase();
this.isServerSearch=_55;
this.controlGroup=_54;
this.container=document.createElement("div");
this.image=document.createElement("img");
if(_52.state=="off"){
this.selected=false;
this.imageConfig.applyConfiguration(this.image);
}else{
this.selected=true;
this.selectedImageConfig.applyConfiguration(this.image);
}
this.container.appendChild(this.image);
this.text=document.createElement("span");
this.text.innerHTML+=_52.label;
this.container.appendChild(this.text);
_53.appendChild(this.container);
this.clickDelegate=associateObjWithEvent(this,"onClick");
Evt.addEventListener(this.container,"click",this.clickDelegate);
}
ToggleControl.prototype.onClick=function(){
if(this.selected){
this.selected=false;
this.imageConfig.applyConfiguration(this.image);
if(this.isServerSearch){
this.controlGroup.update();
}else{
this.controlGroup.reduceSearchResults(this.attributeId,this.value,"toggle");
}
}else{
this.selected=true;
this.selectedImageConfig.applyConfiguration(this.image);
this.controlGroup.update();
}
};
ToggleControl.prototype.buildSearchString=function(){
if(this.selected){
var _56="&context-"+this.name+"="+this.value;
}else{
var _56="";
}
return encodeURI(_56);
};
ToggleControl.prototype.filter=function(_57){
if(this.selected){
return true;
}else{
if(_57.searchAttributes[this.attributeId]==this.value){
return false;
}else{
return true;
}
}
};
ToggleControl.prototype.clear=function(){
this.selected=true;
this.selectedImageConfig.applyConfiguration(this.image);
};
ToggleControl.prototype.unload=function(){
Evt.removeEventListener(this.container,"click",this.clickDelegate);
};
function StringControl(_58,_59,_5a,_5b){
this.controlGroup=_5a;
this.name=_58.name;
this.value=_58.value;
this.lastValue="";
this.isServerSearch=_5b;
this.container=document.createElement("div");
this.container.innerHTML+=_58.label+"<br>";
this.searchBox=document.createElement("input");
this.searchBox.setAttribute("autocomplete","off");
this.container.appendChild(this.searchBox);
_59.appendChild(this.container);
if(this.isServerSearch){
this.keyDownDelegate=associateObjWithEvent(this,"onKeyDown");
Evt.addEventListener(this.searchBox,"keydown",this.keyDownDelegate);
}else{
this.keyUpDelegate=associateObjWithEvent(this,"onKeyUp");
Evt.addEventListener(this.searchBox,"keyup",this.keyUpDelegate);
}
}
StringControl.prototype.onKeyDown=function(evt,_5d){
if(evt.keyCode=="13"){
this.controlGroup.update();
}
};
StringControl.prototype.onKeyUp=function(evt,_5f){
var _60=new RegExp("/^"+this.lastValue).test(this.searchBox.value);
if(this.searchBox.value.length>=this.lastValue.length&&_60){
this.controlGroup.reduceSearchResults(this.attributeId,this.searchBox.value.toLowerCase(),"string");
}else{
this.controlGroup.update();
}
this.lastValue=this.searchBox.value;
};
StringControl.prototype.buildSearchString=function(){
searchString="&context-"+this.name+"="+encodeURI(this.searchBox.value);
return searchString;
};
StringControl.prototype.filter=function(_61){
if(_61.searchAttributes[this.attributeId]!=null){
if(_61.searchAttributes[this.attributeId].indexOf(this.searchBox.value.toLowerCase())!=-1){
return true;
}else{
return false;
}
}else{
if(this.searchBox.value==""){
return true;
}else{
return false;
}
}
};
StringControl.prototype.clear=function(){
this.searchBox.value="";
this.lastValue="";
};
StringControl.prototype.unload=function(){
if(this.isServerSearch){
Evt.removeEventListener(this.searchBox,"keydown",this.keyDownDelegate);
}else{
Evt.removeEventListener(this.searchBox,"keyup",this.keyUpDelegate);
}
};
function IntervalControl(_62,_63,_64,_65){
this.controlGroup=_64;
this.name=_62.name;
this.value=_62.value;
this.isServerSearch=_65;
this.container=document.createElement("div");
this.container.innerHTML+=_62.label+"<br>";
this.minBox=document.createElement("input");
this.maxBox=document.createElement("input");
this.previousMinValue=null;
this.previousMaxValue=null;
this.container.appendChild(this.minBox);
this.container.appendChild(this.maxBox);
_63.appendChild(this.container);
this.minKeyUpDelegate=associateObjWithEvent(this,"onMinKeyUp");
Evt.addEventListener(this.minBox,"keyup",this.minKeyUpDelegate);
this.maxKeyUpDelegate=associateObjWithEvent(this,"onMaxKeyUp");
Evt.addEventListener(this.maxBox,"keyup",this.maxKeyUpDelegate);
}
IntervalControl.prototype.buildSearchString=function(){
searchString="&context-"+this.name+"="+encodeURI(this.minBox.value)+","+encodeURI(this.maxBox.value);
return searchString;
};
IntervalControl.prototype.onMinKeyUp=function(){
if(this.isServerSearch){
this.controlGroup.update();
return;
}
var min=parseInt(this.minBox.value);
if(isNaN(min)){
this.minBox.value="";
}else{
this.minBox.value=min;
}
if(min!=this.previousMinValue){
if(this.previousMinValue==null||(min>this.previousMinValue)){
max=parseInt(this.maxBox.value);
var _67=new Interval(min,max);
this.controlGroup.reduceSearchResults(this.attributeId,_67,"interval");
}else{
this.controlGroup.update();
}
}
if(!isNaN(min)){
this.previousMinValue=min;
}else{
this.previousMinValue=null;
}
};
IntervalControl.prototype.onMaxKeyUp=function(){
if(this.isServerSearch){
this.controlGroup.update();
return;
}
var max=parseInt(this.maxBox.value);
if(!isNaN(max)){
this.maxBox.value=max;
}else{
this.maxBox.value="";
}
if(max!=this.previousMaxValue){
if(this.previousMaxValue==null||(max<this.previousMaxValue)){
min=parseInt(this.minBox.value);
var _69=new Interval(min,max);
this.controlGroup.reduceSearchResults(this.attributeId,_69,"interval");
}else{
this.controlGroup.update();
}
}
if(!isNaN(max)){
this.previousMaxValue=max;
}else{
this.previousMaxValue=null;
}
};
IntervalControl.prototype.filter=function(_6a){
var _6b=parseInt(_6a.searchAttributes[this.attributeId]);
var min=parseInt(this.minBox.value);
var max=parseInt(this.maxBox.value);
if(isNaN(min)&&isNaN(max)){
return true;
}
if(isNaN(max)){
max=_6b+1;
}
if(isNaN(min)){
min=_6b-1;
}
if(isNaN(_6b)||_6b<min||_6b>max){
return false;
}else{
return true;
}
};
IntervalControl.prototype.clear=function(){
this.previousMaxValue=null;
this.previousMinValue=null;
this.minBox.value="";
this.maxBox.value="";
};
IntervalControl.prototype.unload=function(){
Evt.removeEventListener(this.minBox,"keyup",this.minKeyUpDelegate);
Evt.removeEventListener(this.maxBox,"keyup",this.maxKeyUpDelegate);
};
function SliderControl(_6e,_6f,_70,_71,_72){
this.controlGroup=_70;
this.name=_6e.name;
this.isServerSearch=_71;
var _73=_6e.value.split(":");
if(_73.length==2){
this.type=_73[0];
if(this.type=="enum"){
this.valueArray=_73[1].split(",");
this.value=new Interval(0,this.valueArray.length);
this.valueArray.push("");
}else{
var _74=_73[1].split(",");
if(_74.length==2){
this.value=new Interval(parseInt(_74[0]),parseInt(_74[1]));
}else{
}
}
}else{
this.type="range";
var _74=_6e.value.split(",");
if(_74.length==2){
this.value=new Interval(parseInt(_74[0]),parseInt(_74[1]));
}else{
return;
}
}
this.container=document.createElement("div");
this.label=document.createElement("p");
this.label.className="rwcSliderLabel";
this.label.innerHTML+=_6e.label+"<br>";
this.container.appendChild(this.label);
this.barContainer=document.createElement("span");
this.barContainer.style.position="absolute";
if(_72.sliderControl.bar){
this.barLength=parseInt(_72.sliderControl.bar.width);
this.barHeight=parseInt(_72.sliderControl.bar.height);
}else{
this.barLength=319;
this.barHeight=20;
}
this.container.className="rwcSliderContainer";
this.container.style.width=this.barLength+20+"px";
this.bar=document.createElement("img");
this.barFiller=document.createElement("img");
this.barFiller.className="rwcSliderFillBar";
this.bar.style.width=this.barLength+"px";
this.bar.style.height=this.barHeight+"px";
this.bar.style.position="absolute";
if(_72&&_72.sliderControl){
setImageSource(this.bar,_72.sliderControl.bar.image);
setImageSource(this.barFiller,_72.sliderControl.barFiller.image);
}else{
setImageSource(this.bar,"pic/standard/slidebar.png");
setImageSource(this.barFiller,"pic/standard/slidebar_fill.png");
}
this.barContainer.appendChild(this.bar);
this.minLabel=document.createElement("span");
this.minLabel.className="rwcSliderMinLabel";
this.maxLabel=document.createElement("span");
this.maxLabel.className="rwcSliderMaxLabel";
this.intervalValueLabel=document.createElement("span");
this.intervalValueLabel.className="rwcSliderSelectionLabel";
this.intervalValueLabel.style.left="120px";
if(this.type!="enum"){
this.barContainer.appendChild(this.barFiller);
this.minLabel.innerHTML="-"+this.value.min;
this.maxLabel.innerHTML=this.value.max+"+";
this.maxLabel.style.left=this.barLength-this.value.max.toString().length*7+"px";
}
this.updateLabels();
if(_72.sliderControl.marker.image){
var _75=_72.sliderControl.marker.image;
this.markerAdjustX=parseInt(_72.sliderControl.marker.width);
}else{
var _75="pic/standard/slidebar_control.png";
this.markerAdjustX=19;
}
if(this.type=="enum"){
var _76=this.barLength/(this.valueArray.length-1);
var _77=parseInt(_72.sliderControl.tick.width);
if(_72.sliderControl.tick.width&&_76>_77){
for(var i=1;i<this.valueArray.length-1;i++){
var _79=document.createElement("img");
_72.sliderControl.tick.applyConfiguration(_79);
_79.className="rwcSliderTick";
_79.style.left=(Math.round(_76*i)-this.markerAdjustX/2-(_77/2))+"px";
this.barContainer.appendChild(_79);
}
}
}
if(this.type=="range"||this.type=="min"){
this.minElement=this.createMarker(_75,0);
this.barContainer.appendChild(this.minElement);
}
if(this.type=="range"||this.type=="max"||this.type=="enum"){
this.maxElement=this.createMarker(_75,this.barLength-this.markerAdjustX);
this.barContainer.appendChild(this.maxElement);
}
this.currentMin=null;
this.currentMax=null;
this.barContainer.appendChild(this.intervalValueLabel);
this.container.appendChild(this.barContainer);
this.barContainer.appendChild(this.minLabel);
this.barContainer.appendChild(this.maxLabel);
_6f.appendChild(this.container);
this.updateFiller();
this.dragDelegate=associateObjWithEvent(this,"beginDrag");
Evt.addEventListener(this.barContainer,"mousedown",this.dragDelegate);
}
SliderControl.prototype.createMarker=function(img,_7b){
var _7c=document.createElement("img");
_7c.style.left=_7b+"px";
_7c.style.position="absolute";
setImageSource(_7c,img);
return _7c;
};
SliderControl.prototype.updateLabels=function(){
if(this.currentMin!=null){
var min=this.currentMin;
}else{
var min=this.value.min;
}
if(this.currentMax!=null){
var max=this.currentMax;
}else{
var max=this.value.max;
}
switch(this.type){
case ("range"):
this.intervalValueLabel.innerHTML="<NOBR>"+min+"-"+max+"</NOBR>";
break;
case ("max"):
this.intervalValueLabel.innerHTML="<NOBR>"+max+"</NOBR>";
break;
case ("min"):
this.intervalValueLabel.innerHTML="<NOBR>"+min+"</NOBR>";
break;
case ("enum"):
this.intervalValueLabel.innerHTML="<NOBR>"+this.valueArray[max]+"</NOBR>";
break;
}
};
SliderControl.prototype.buildSearchString=function(){
switch(this.type){
case ("range"):
searchString="&context-"+this.name+"="+this.currentMin+","+this.currentMax;
break;
case ("min"):
searchString="&context-"+this.name+"="+this.currentMin+","+this.currentMax;
break;
case ("max"):
searchString="&context-"+this.name+"="+this.currentMin+","+this.currentMax;
break;
case ("enum"):
if(this.currentMax!=null){
var _7f=this.currentMax;
}else{
var _7f=this.value.max;
}
searchString="&context-"+this.name+"="+this.valueArray[_7f];
break;
}
return searchString;
};
SliderControl.prototype.beginDrag=function(evt,_81){
if(this.dragging){
return;
}
this.dragging=true;
evt=new Evt(evt);
if(document.attachEvent){
document.body.attachEvent("onselectstart",returnFalse,false);
document.body.attachEvent("ondrag",returnFalse,false);
}
if(this.minElement&&this.maxElement){
var _82=getPixelPositionFromEvent(evt,this.barContainer);
var _83=_82.x;
this.minElementAdjustX=this.minElement.offsetWidth/2;
var _84=parseInt(this.minElement.style.left);
minD=Math.abs(_84+this.minElementAdjustX-_83);
this.maxElementAdjustX=this.maxElement.offsetWidth/2;
var _85=parseInt(this.maxElement.style.left);
maxD=Math.abs(_85+this.maxElementAdjustX-_83);
if(minD<maxD){
this.activeControl=0;
}else{
this.activeControl=1;
}
}else{
if(this.minElement&&!this.maxElement){
this.minElementAdjustX=this.minElement.offsetWidth/2;
this.activeControl=0;
}else{
if(!this.minElement&&this.maxElement){
this.maxElementAdjustX=this.maxElement.offsetWidth/2;
this.activeControl=1;
}
}
}
this.MoveDelegate=associateObjWithEvent(this,"drag");
this.DropDelegate=associateObjWithEvent(this,"drop");
Evt.addEventListener(document,"mousemove",this.MoveDelegate);
Evt.addEventListener(document,"mouseup",this.DropDelegate);
evt.consume();
};
SliderControl.prototype.drag=function(evt,_87){
evt=new Evt(evt);
var _88=getPixelPositionFromEvent(evt,this.barContainer);
var _89=_88.x;
if(this.activeControl==0){
var _8a=_89-this.minElementAdjustX;
if(_8a<0){
_8a=0;
var _8b=true;
}
if(this.maxElement){
var _8c=parseInt(this.maxElement.style.left);
if(_8a>_8c-this.maxElement.offsetWidth){
_8a=_8c-this.maxElement.offsetWidth;
}
}else{
if(_8a>this.bar.offsetWidth-this.minElement.offsetWidth){
_8a=this.bar.offsetWidth-this.minElement.offsetWidth;
}
}
this.minElement.style.left=_8a+"px";
this.updateFiller();
if(_8b){
this.currentMin=null;
this.updateLabels();
}else{
if(this.maxElement){
this.currentMin=Math.round((_8a/(this.bar.offsetWidth-this.maxElement.offsetWidth))*(this.value.max-this.value.min))+this.value.min;
}else{
this.currentMin=Math.round((_8a/(this.bar.offsetWidth-this.minElement.offsetWidth))*(this.value.max-this.value.min))+this.value.min;
}
this.updateLabels();
}
this.controlGroup.update();
}else{
var _8a=_89-this.maxElementAdjustX;
if(_8a>this.bar.offsetWidth-this.maxElement.offsetWidth){
var _8b=true;
_8a=this.bar.offsetWidth-this.maxElement.offsetWidth;
}else{
if(this.minElement){
var _8d=parseInt(this.minElement.style.left);
if(_8a<_8d+this.minElement.offsetWidth){
_8a=_8d+this.minElement.offsetWidth;
}
}else{
if(_8a<0){
_8a=0;
}
}
}
if(this.type!="enum"){
this.maxElement.style.left=_8a+"px";
}
this.updateFiller();
if(_8b){
this.currentMax=null;
}else{
this.currentMax=Math.round((_8a/(this.bar.offsetWidth-this.maxElement.offsetWidth))*(this.value.max-this.value.min)+this.value.min);
}
if(this.type=="enum"){
if(this.currentMax!=null){
if(this.currentMax!=0){
this.maxElement.style.left=(Math.round((this.bar.offsetWidth/(this.valueArray.length-1))*(this.currentMax))-this.markerAdjustX)+"px";
}else{
this.maxElement.style.left="0px";
}
}else{
this.maxElement.style.left=(this.bar.offsetWidth-this.markerAdjustX)+"px";
}
if(this.currentMax==this.valueArray.length-1){
this.currentMax=null;
}
}
this.updateLabels();
this.controlGroup.update();
}
evt.consume();
};
SliderControl.prototype.drop=function(evt,_8f){
this.drag(evt,_8f);
this.dragging=false;
Evt.removeEventListener(document,"mousemove",this.MoveDelegate);
Evt.removeEventListener(document,"mouseup",this.DropDelegate);
this.controlGroup.update();
};
SliderControl.prototype.updateFiller=function(){
if(this.minElement){
var _90=parseInt(this.minElement.style.left)+this.markerAdjustX/2;
}else{
if(parseInt(this.maxElement.style.left)>this.markerAdjustX/2){
var _90=this.markerAdjustX/2;
}else{
var _90=0;
}
}
this.barFiller.style.left=_90+"px";
if(this.maxElement){
this.barFiller.style.width=parseInt(this.maxElement.style.left)-_90+"px";
}else{
this.barFiller.style.width=this.barLength-parseInt(this.minElement.style.left)-this.markerAdjustX+"px";
}
};
SliderControl.prototype.filter=function(_91){
if(this.type=="enum"){
if(this.currentMax==null){
return true;
}else{
if(_91.searchAttributes[this.attributeId]&&(this.valueArray[this.currentMax].toLowerCase()==_91.searchAttributes[this.attributeId].toLowerCase())){
return true;
}else{
return false;
}
}
}else{
var _92=parseInt(_91.searchAttributes[this.attributeId]);
var _93=this.currentMin;
var _94=this.currentMax;
if(this.currentMin==null&&this.currentMax==null){
return true;
}
if(isNaN(_92)){
return false;
}
if(_94==null){
_94=_92+1;
}
if(_93==null){
_93=_92-1;
}
if(_92<_93||_92>_94){
return false;
}else{
return true;
}
}
};
SliderControl.prototype.clear=function(){
this.previousMaxValue=null;
this.previousMinValue=null;
};
SliderControl.prototype.unload=function(){
Evt.removeEventListener(this.barContainer,"mousedown",this.dragDelegate);
if(this.dragging){
Evt.removeEventListener(document,"mousemove",this.MoveDelegate);
Evt.removeEventListener(document,"mouseup",this.DropDelegate);
}
};
function SelectControl(_95,_96,_97,_98){
this.name=_95.name;
this.controlGroup=_97;
this.isServerSearch=_98;
this.selectBox=document.createElement("select");
this.selectBox.className="rwcSelectControl";
var _99=_95.value.split(",");
var _9a=_95.label.split(",");
if(_99.length!=_9a.length){
return;
}
for(var i=0;i<_99.length;i++){
this.selectBox.options[this.selectBox.options.length]=new Option(_9a[i],_99[i]);
}
this.container=document.createElement("div");
_96.appendChild(this.container);
this.container.appendChild(this.selectBox);
this.changeDelegate=associateObjWithEvent(this,"onChange");
Evt.addEventListener(this.selectBox,"change",this.changeDelegate);
}
SelectControl.prototype.onChange=function(){
this.controlGroup.update();
};
SelectControl.prototype.filter=function(_9c){
if(this.selectBox.selectedIndex==0){
return true;
}
if(_9c.searchAttributes[this.attributeId]==this.selectBox[this.selectBox.selectedIndex].value.toLowerCase()){
return true;
}else{
return false;
}
};
SelectControl.prototype.buildSearchString=function(){
if(this.selectBox.selectedIndex==0){
var _9d="";
}else{
var _9d="&context-"+this.name+"="+this.selectBox[this.selectBox.selectedIndex].value;
}
return _9d;
};
SelectControl.prototype.clear=function(){
this.selectBox.selectedIndex=0;
};
SelectControl.prototype.unload=function(){
Evt.removeEventListener(this.selectBox,"change",this.changeDelegate);
};
function Interval(min,max){
this.min=min;
this.max=max;
}

function SpatialAceMap(_1,_2,_3,_4,_5,_6,_7,_8,_9){
this.compatibility=testBrowserForRWC();
if(!this.compatibility.isSupported){
if(document.getElementById){
var _a=document.getElementById(_3);
_a.style.backgroundColor="White";
if(document.createElement&&document.appendChild){
this.supportMsg=document.createElement("p");
this.supportMsg.style.position="absolute";
if(document.createTextNode){
this.supportMsg.appendChild(document.createTextNode(this.compatibility.msg));
}else{
if(document.innerHTML){
this.supportMsg.innerHTML=this.compatibility.msg;
}
}
}
}
}
this.mapServerUrl=_1;
this.userInit=_6;
this.viewName=_2;
this.embedDiv=document.getElementById(_3);
if(!_5){
_5="";
}
this.prefix=_5;
this.mapContainer=document.createElement("div");
this.mapContainer.id=_5+"MapContainer";
this.mapContainer.className="rwcMapContainer";
this.embedDiv.appendChild(this.mapContainer);
this.onClickEventHandlers=new Array();
this.onBeforeUpdateEventHandlers=new Array();
this.onAfterUpdateEventHandlers=new Array();
this.onNewGeoRectEventHandlers=new Array();
this.onClientSearchEventHandlers=new Array();
this.onMouseOverEventHandlers=new Array();
this.onMouseOutEventHandlers=new Array();
this.onFullyUpdatedEventHandlers=new Array();
this.totalZoomTime=2000;
this.config=new MapConfiguration(_1);
if(_7){
this.JSONConfig=_7;
}else{
if(_8){
this.JSONConfiguration(this.mapServerUrl,_8);
}
}
if(this.JSONConfig){
this.config.override(this.JSONConfig.ClientSettings);
}
try{
this.tileSize=parseInt(this.config.viewSettings.tileSize);
}
catch(e){
this.tileSize=200;
}
this.minimumTilePadding=this.config.GUI.padding;
this.rescalingFactor=1;
if(_9){
this.viewJSON=_9;
this.constructed=true;
setTimeout(associateObjWithEvent(this,"initialize"),10);
}else{
this.getViewsXmlHttp=new XMLHttpRequest();
this.getViewsXmlHttp.open("GET",_1+"RWCInterface.axd?request=GetView&responsetype=JSON&view="+this.viewName,true);
this.getViewsXmlHttp.onreadystatechange=associateObjWithCallback(this,this.onGetViewsResponse);
this.getViewsXmlHttp.send("");
this.constructed=true;
}
}
SpatialAceMap.prototype.JSONConfiguration=function(_b,_c){
this.jsonXmlHttp=new XMLHttpRequest();
this.jsonXmlHttp.open("GET",_b+"JSONConverter.axd?url="+_c,false);
this.jsonXmlHttp.send("");
if(this.jsonXmlHttp.responseText){
try{
var _d=eval("("+this.jsonXmlHttp.responseText+")");
}
catch(e){
this.JSONConfig=null;
return;
}
this.JSONConfig=_d;
return;
}
};
SpatialAceMap.prototype.JSONResponse=function(){
if(this.jsonXmlHttp&&this.jsonXmlHttp.readyState==4){
if(this.jsonXmlHttp.responseText){
try{
var _e=eval("("+this.jsonXmlHttp.responseText+")");
}
catch(e){
this.JSONConfig=null;
return;
}
this.JSONConfig=_e;
return;
}
}
};
SpatialAceMap.prototype.onGetViewsResponse=function(){
if(this.getViewsXmlHttp&&this.getViewsXmlHttp.readyState==4){
if(this.getViewsXmlHttp.responseText){
try{
this.viewJSON=eval("("+this.getViewsXmlHttp.responseText+")");
}
catch(e){
}
this.initialize();
}
this.getViewsXmlHttp=null;
}
};
SpatialAceMap.prototype.initialize=function(){
if(!this.constructed){
this.initTimer=setTimeout(associateObjWithEvent(this,"initialize"),10);
return;
}
if(!this.viewJSON||!this.viewJSON.ViewInfo){
throw "The view '"+this.viewName+"' is not available on the Carmenta Server '"+this.mapServerUrl+"'.";
}
if(isIe6||isIe7){
if(typeof this.timeouts=="undefined"){
this.timeouts=0;
}else{
this.timeouts++;
}
if(this.timeouts<5){
if(this.embedDiv.offsetHeight<this.tileSize+50||this.mapContainer.offsetHeight<(this.embedDiv.offsetHeight-8)){
this.initTimer=setTimeout(associateObjWithEvent(this,"initialize"),50);
return;
}
}
}
this.refSystem=this.viewJSON.ViewInfo.RefSystem;
if(this.mainMap){
this.initialGeoCenterX=this.mainMap.initialGeoCenterX;
this.initialGeoCenterY=this.mainMap.initialGeoCenterY;
}else{
this.initialGeoCenterX=parseFloat(this.viewJSON.ViewInfo.CenterPoint.X);
this.initialGeoCenterY=parseFloat(this.viewJSON.ViewInfo.CenterPoint.Y);
}
initialScale=parseFloat(this.viewJSON.ViewInfo.Scale);
this.initialGeoWidth=parseFloat(this.viewJSON.ViewInfo.Width);
scaleToGeoWidth400=this.initialGeoWidth/initialScale;
this.scaleToGeoWidth=this.tileSize*scaleToGeoWidth400/400;
if(this.viewJSON.ViewInfo.FixedScales&&(this.viewJSON.ViewInfo.FixedScales.length>0)){
this.fixedScales=true;
this.fixedTileGeoWidths=new Array();
this.fixedScaleSteps=new Array();
for(var i=0;i<this.viewJSON.ViewInfo.FixedScales.length;i++){
this.fixedScaleSteps[i]=parseFloat(this.viewJSON.ViewInfo.FixedScales[i].Value);
this.fixedTileGeoWidths[i]=this.fixedScaleSteps[i]*this.scaleToGeoWidth;
}
}else{
this.fixedScales=false;
}
if(this.viewJSON.ViewInfo.FixedInfoScales&&(this.viewJSON.ViewInfo.FixedInfoScales.length>0)){
this.fixedInfoScaleSteps=new Array();
for(var i=0;i<this.viewJSON.ViewInfo.FixedInfoScales.length;i++){
this.fixedInfoScaleSteps[i]=parseFloat(this.viewJSON.ViewInfo.FixedInfoScales[i].Value);
}
}
this.geoWidthToScale=1/this.scaleToGeoWidth;
this.totalOffsetX=0;
this.totalOffsetY=0;
this.workItemCount=0;
this.mouseDownDelegate=associateObjWithEvent(this,"tileMouseDown");
Evt.addEventListener(this.mapContainer,"mousedown",this.mouseDownDelegate);
this.resizeDelegate=associateObjWithEvent(this,"mapResized");
Evt.addEventListener(window,"resize",this.resizeDelegate);
this.unloadDelegate=associateObjWithEvent(this,"unload");
Evt.addEventListener(window,"unload",this.unloadDelegate);
if(this.config.GUI.enableKeyEvents){
this.keyDownDelegate=associateObjWithEvent(this,"onKeyDown");
Evt.addEventListener(document,"keydown",this.keyDownDelegate);
this.keyUpDelegate=associateObjWithEvent(this,"onKeyUp");
Evt.addEventListener(document,"keyup",this.keyUpDelegate);
}
if(this.config.GUI.enableMouseScrollEvent){
this.mouseWheelDelegate=associateObjWithEvent(this,"onMouseWheel");
if(isIe6||isIe7||isSafari3||isOpera){
Evt.addEventListener(document,"mousewheel",this.mouseWheelDelegate);
}else{
Evt.addEventListener(document,"DOMMouseScroll",this.mouseWheelDelegate);
}
}
this.dockingArea=document.createElement("div");
this.dockingArea.className="rwcDockingArea";
this.dockingArea.id=this.prefix+"dockingArea";
this.dockingArea.style.backgroundImage="url("+this.config.GUI.dockingPanel.image+")";
setVisible(this.dockingArea,false);
this.embedDiv.appendChild(this.dockingArea);
this.dockingOffset=0;
this.view=new View(this);
var _10="";
if(this.config.GUI.layerControl.mode=="docked"){
var _11=this.dockingArea;
setVisible(this.dockingArea,true);
}else{
if(this.config.GUI.layerControl.mode=="standalone"){
var _11=document.body;
}else{
var _11=this.embedDiv;
}
}
if(this.config.GUI.layerControl.active){
this.layerControl=new LayerControl(this,_11,this.prefix);
if(this.config.GUI.layerControl.mode=="docked"){
this.dockingOffset=Math.max(this.dockingOffset,this.layerControl.container.offsetHeight);
}
}
if(this.dockingOffset!=0){
this.dockingArea.style.display="block";
}
this.dockingArea.style.height=this.dockingOffset+"px";
this.createTiles();
if(this.config.GUI.panControl.active){
this.panControl=new PanControl(this.embedDiv,this,this.prefix);
}
if(this.config.GUI.zoomControl.active){
this.zoomControl=new ZoomControl(this,this.embedDiv,this.prefix);
}
if(this.config.GUI.backgroundControl.active){
this.backgroundControl=new BackgroundControl(this,this.embedDiv,this.prefix);
}
this.panTool=new PanTool(this);
this.zoomTool=new ZoomTool(this,this.prefix,this.embedDiv);
this.selectionTool=new SelectionTool(this,this.prefix,this.embedDiv);
this.measureDistance=new MeasureDistance(this,this.prefix);
this.routeSearch=new RouteSearch(this,this.prefix);
this.setClickTool(this.config.GUI.clickTool);
this.mouseMovePositionDelegate=associateObjWithEvent(this,"onMouseMovePosition");
Evt.addEventListener(document,"mousemove",this.mouseMovePositionDelegate);
if(this.config.GUI.miniMap&&this.config.GUI.miniMap.active){
this.createMiniMap();
}
this.view.draw();
this.initialized=true;
if(this.linkedMapArray){
for(var i=0;i<this.linkedMapArray.length;i++){
this.linkedMapArray[i].initialize();
}
}
if(this.pendingLinkInit){
this.linkMap.initialize();
}
this.setDefaultTool(this.config.GUI.dragTool.defaultTool);
if(this.userInit){
this.userInit(this);
}
if(!this.hasDrawnMap){
if(this.config.GUI.scaleBar&&this.config.GUI.scaleBar.active){
this.requestScaleBar();
}
this.placeAndRefreshTiles();
}
};
SpatialAceMap.prototype.createTiles=function(){
this.mapWidth=this.mapContainer.offsetWidth;
this.mapHeight=this.mapContainer.offsetHeight-this.dockingOffset;
this.totalHeight=this.mapHeight+Math.max(this.config.GUI.padding*2,this.tileSize);
this.totalWidth=this.mapWidth+Math.max(this.config.GUI.padding*2,this.tileSize);
this.nCols=Math.ceil(this.totalWidth/this.tileSize);
this.nRows=Math.ceil(this.totalHeight/this.tileSize);
this.paddingX=(this.nCols*this.tileSize)-this.mapWidth;
this.paddingY=(this.nRows*this.tileSize)-this.mapHeight;
if(!this.tileGeoWidth){
this.tileGeoWidth=this.initialGeoWidth/this.nCols;
if(this.fixedScales){
var _12=Number.MAX_VALUE;
var _13=this.tileGeoWidth;
for(var i=0;i<this.fixedTileGeoWidths.length;i++){
var _15=Math.abs(this.tileGeoWidth-this.fixedTileGeoWidths[i]);
if(_15<_12){
_12=_15;
_13=this.fixedTileGeoWidths[i];
}
}
this.tileGeoWidth=_13;
}
}
this.view.createTiles(this.nRows,this.nCols,this.paddingX,this.paddingY);
this.hasCreatedTiles=true;
};
SpatialAceMap.prototype.createMiniMap=function(){
if(this.mainMap){
return;
}
this.miniMapDiv=document.createElement("div");
this.miniMapDiv.id=this.prefix+"mini";
if(this.config.GUI.miniMap.css){
this.miniMapDiv.className=this.config.GUI.miniMap.css;
}else{
this.miniMapDiv.className="rwcMiniMap";
}
switch(this.config.GUI.miniMap.mode){
case ("standalone"):
document.body.appendChild(this.miniMapDiv);
break;
case ("docked"):
this.dockingArea.appendChild(this.miniMapDiv);
var _16=parseInt(this.miniMapDiv.style.height);
if(_16&&!isNaN(_16)){
this.dockingOffset=Math.max(this.dockingOffset,_16);
}
if(this.dockingOffset<220){
this.dockingArea.style.height="220px";
}
setVisible(this.dockingArea,true);
break;
default:
this.embedDiv.appendChild(this.miniMapDiv);
break;
}
this.miniMapDiv.closeBox=document.createElement("img");
this.miniMapDiv.closeBox.className="rwcMiniMapCloseBox";
this.config.GUI.closeBox.applyConfiguration(this.miniMapDiv.closeBox);
if(this.config.GUI.miniMap.alternateView&&this.config.GUI.miniMap.alternateView!=""){
var _17=this.config.GUI.miniMap.alternateView;
}else{
var _17=this.viewName;
}
if(!this.config.GUI.miniMap.configuration||this.config.GUI.miniMap.configuration==""){
this.config.GUI.miniMap.configuration=this.mapServerUrl+"RWC/config/minimap.xml";
}
this.miniMap=new LinkedMap(this,_17,this.miniMapDiv.id,this.config.GUI.miniMap.configuration,this.miniMapDiv.id,this.config.GUI.miniMap.model,this.config.GUI.miniMap.scaleValue,this.config.GUI.miniMap.showMainMap);
this.miniMapDiv.appendChild(this.miniMapDiv.closeBox);
this.closeMiniMapClickDelegate=associateObjWithEvent(this,"closeMiniMap");
Evt.addEventListener(this.miniMapDiv.closeBox,"click",this.closeMiniMapClickDelegate);
};
SpatialAceMap.prototype.tileMouseDown=function(evt,_19){
if(this.zoomActive==true){
return;
}
if(evt.button==2){
return;
}
if(this.manipulationActive==true){
this.currentTool.endManipulation(evt);
}
this.rescalingFactor=1;
this.manipulationActive=true;
if(this.mainMap){
if(this.mainMap.currentTool.type=="pan"){
this.mainMap.rescalingFactor=1/this.linkMap.currentScaleFactor;
}
var _1a=getPixelPositionFromEvent(tmpEvt,this.mapContainer);
this.mainMap.clickPoint=this.getPosition(_1a.x,_1a.y);
this.mainMap.clickPending=true;
}else{
tmpEvt=new Evt(evt);
var _1a=getPixelPositionFromEvent(tmpEvt,this.mapContainer);
this.clickPoint=this.getPosition(_1a.x,_1a.y);
this.clickPending=true;
}
this.currentTool.startManipulation(evt);
};
SpatialAceMap.prototype.onMouseMovePosition=function(evt,_1c){
tmpEvt=new Evt(evt);
this.mousePosition=getPixelPositionFromEvent(tmpEvt,this.mapContainer);
if(this.mousePosition.x<0||this.mousePosition.x>this.mapWidth||this.mousePosition.y<0||this.mousePosition.y>this.mapHeight){
if(this.activeinfoBoxObject){
if(!this.activeinfoBoxObject.hideObjectInfoTimer&&!this.activeinfoBoxObject.infoBoxSelected){
if(this.activeinfoBoxObject.infoBoxTimeout){
this.activeinfoBoxObject.setInfoTimer(this.activeinfoBoxObject.infoBoxTimeout);
}else{
this.activeinfoBoxObject.setInfoTimer(1000);
}
}
}
return;
}
if(this.mousePosition.y>(this.mapContainer.offsetHeight-this.dockingOffset)){
return;
}
var _1d=this.getPosition(this.mousePosition.x,this.mousePosition.y);
if(this.clickTool&&this.clickTool.update&&!isOpera){
this.clickTool.update(_1d);
}
var _1e=this.view.updateTooltips(_1d.x,_1d.y);
if(_1e&&_1e.length>0){
for(var i=0;i<_1e.length;i++){
if(_1e[i].enter){
for(var j=0;j<this.onMouseOverEventHandlers.length;j++){
this.onMouseOverEventHandlers[j](this,_1e[i].geoObject);
}
}else{
for(var j=0;j<this.onMouseOutEventHandlers.length;j++){
this.onMouseOutEventHandlers[j](this,_1e[i].geoObject);
}
}
}
}
if(this.config.GUI.mousePositionBox&&this.config.GUI.mousePositionBox.active){
if(!this.mouseposContainer){
this.mouseposContainer=document.createElement("DIV");
if(this.config.GUI.mousePositionBox.css){
this.mouseposContainer.className=this.config.GUI.mousePositionBox.css;
}else{
this.mouseposContainer.className="rwcPositionBox";
}
if(this.config.GUI.mousePositionBox.mode=="standalone"){
document.body.appendChild(this.mouseposContainer);
}else{
this.embedDiv.appendChild(this.mouseposContainer);
}
}
this.mouseposContainer.innerHTML=_1d.x+"<br>"+_1d.y;
}
};
SpatialAceMap.prototype.onMouseWheel=function(evt,_22){
if(this.mainMap){
return;
}
target=evt.target||evt.srcElement;
if((target.nodeName=="SELECT")&&(isIe6||isIe7)){
return;
}
if(!evt){
evt=window.event;
}
if(evt.wheelDelta){
delta=evt.wheelDelta/120;
}else{
if(evt.detail){
delta=-evt.detail/3;
}else{
return;
}
}
tmpEvt=new Evt(evt);
if(delta>0){
if(this.zoomControl&&this.zoomControl.selectedZoomLevel==0){
return;
}
if(isIe6||isIe7||isOpera){
var _23=getPixelPositionFromEvent(tmpEvt,this.mapContainer);
}else{
var _23=this.mousePosition;
}
var _24=this.getPosition(_23.x,_23.y);
this.setMapCenter(_24.x,_24.y);
if(this.zoomInTimer){
clearTimeout(this.zoomInTimer);
}
this.zoomInTimer=setTimeout(associateObjWithEvent(this,"onZoomInTimer"),100);
}else{
if(delta<0){
if(this.zoomControl){
this.zoomControl.zoomOut();
}else{
this.zoomOut();
}
}
}
};
SpatialAceMap.prototype.onZoomInTimer=function(){
if(this.zoomControl){
this.zoomControl.zoomIn();
}else{
this.zoomIn();
}
this.zoomInTimer=null;
};
SpatialAceMap.prototype.beginDrag=function(){
this.lastOffsetX=0;
this.lastOffsetY=0;
if(!this.view){
return;
}
if(!this.hasDrawnMap){
this.hasDrawnMap=true;
this.view.offset(this.totalOffsetX,this.totalOffsetY);
this.flushAll();
}
if(this.linkedMapArray){
for(var i=0;i<this.linkedMapArray.length;i++){
this.linkedMapArray[i].map.beginDrag();
}
}
};
SpatialAceMap.prototype.drag=function(_26,_27){
if(!this.initialized||this.bufferTimer){
return;
}
_26=_26*this.rescalingFactor;
_27=_27*this.rescalingFactor;
var _28=_26-this.lastOffsetX;
var _29=_27-this.lastOffsetY;
if(this.config.viewSettings.borders&&this.config.viewSettings.borders.active&&!this.mainMap){
var _2a=this.getMapCenter();
var _2b=this.tileGeoWidth/this.tileSize;
var _2c=_2a.x-_28*_2b;
var _2d=_2a.y+_29*_2b;
var _2e=this.point(_2c,_2d);
var _2f=this.checkBorders(_2e);
var _30=this.tileSize/this.tileGeoWidth;
_28=-(_2f.x-_2a.x)*_30;
_29=(_2f.y-_2a.y)*_30;
_26=_28+this.lastOffsetX;
_27=_29+this.lastOffsetY;
}
if(this.view.zoomContainer){
var zX=getX(this.view.zoomContainer);
var zY=getY(this.view.zoomContainer);
setX(this.view.zoomContainer,zX+Math.round(_28));
setY(this.view.zoomContainer,zY+Math.round(_29));
}
this.view.pixelOffset(Math.round(_28),Math.round(_29));
if(this.activeinfoBoxObject){
this.activeinfoBoxObject.updateInfoBox();
}
this.lastOffsetX=_26;
this.lastOffsetY=_27;
this.totalOffsetX+=_28;
this.totalOffsetY+=_29;
if(isIe6||isSafari2){
this.bufferTimer=setTimeout(associateObjWithEvent(this,"ieBuffer"),100);
}else{
if(isFireFox&&!document.all||isOpera){
this.bufferTimer=setTimeout(associateObjWithEvent(this,"ieBuffer"),50);
}else{
if(!isIe7){
this.bufferTimer=setTimeout(associateObjWithEvent(this,"ieBuffer"),10);
}
}
}
for(var i=0;i<this.onNewGeoRectEventHandlers.length;i++){
this.onNewGeoRectEventHandlers[i](this);
}
if(this.linkedMapArray){
for(var i=0;i<this.linkedMapArray.length;i++){
this.linkedMapArray[i].map.drag(_26*this.linkedMapArray[i].currentScaleFactor,_27*this.linkedMapArray[i].currentScaleFactor);
}
}
};
SpatialAceMap.prototype.checkBorders=function(_34){
if(this.config.viewSettings.borders&&this.config.viewSettings.borders.active&&!this.mainMap){
var _35=this.tileGeoWidth/this.tileSize;
adjustedX=_34.x;
adjustedY=_34.y;
var _36=adjustedX+this.mapWidth/2*_35;
if(_36>this.config.viewSettings.borders.geoRect.xMax){
adjustedX=_34.x-(_36-this.config.viewSettings.borders.geoRect.xMax);
}
var _37=adjustedX-this.mapWidth/2*_35;
if(_37<this.config.viewSettings.borders.geoRect.xMin){
adjustedX=_34.x+(this.config.viewSettings.borders.geoRect.xMin-_37);
_36=adjustedX+this.mapWidth/2*_35;
if(_36>this.config.viewSettings.borders.geoRect.xMax){
adjustedX=this.config.viewSettings.borders.geoRect.centerPoint.x;
}
}
var _38=adjustedY+this.mapHeight/2*_35;
if(_38>this.config.viewSettings.borders.geoRect.yMax){
adjustedY=_34.y-(_38-this.config.viewSettings.borders.geoRect.yMax);
}
var _39=adjustedY-this.mapHeight/2*_35;
if(_39<this.config.viewSettings.borders.geoRect.yMin){
adjustedY=_34.y+(this.config.viewSettings.borders.geoRect.yMin-_39);
_38=adjustedY+this.mapHeight/2*_35;
if(_38>this.config.viewSettings.borders.geoRect.yMax){
adjustedY=this.config.viewSettings.borders.geoRect.centerPoint.y;
}
}
var _3a=this.point(adjustedX,adjustedY);
return _3a;
}
return _34;
};
SpatialAceMap.prototype.ieBuffer=function(evt,_3c){
this.bufferTimer=null;
};
SpatialAceMap.prototype.endDrag=function(){
this.bufferTimer=null;
if(!this.initialized){
return;
}
this.rescalingFactor=1;
if(Math.abs(this.lastOffsetX/this.rescalingFactor)<2&&Math.abs(this.lastOffsetY/this.rescalingFactor)<2&&this.clickPending){
var _3d=this.mapToScreenCoordinates(this.clickPoint.x,this.clickPoint.y);
this.activateClickTools(_3d);
}else{
for(var i=0;i<this.onBeforeUpdateEventHandlers.length;i++){
this.onBeforeUpdateEventHandlers[i](this);
}
this.view.updateNonTiledLayers();
this.view.updateCanvas();
this.view.getGeoObjects(0,0,this.tileSize*this.nCols,this.tileSize*this.nRows);
}
this.manipulationActive=false;
this.clickPending=false;
if(this.config.GUI.scaleBar&&this.config.GUI.scaleBar.active){
this.requestScaleBar();
}
if(this.linkMap&&!this.linkMap.noAdjust){
this.linkMap.syncMapOffset();
}
if(this.linkedMapArray){
for(var i=0;i<this.linkedMapArray.length;i++){
this.linkedMapArray[i].map.endDrag();
}
}
};
SpatialAceMap.prototype.moveToPosition=function(_3f,_40){
if(!this.initialized){
return;
}
var _41=this.getPosition(_3f,_40);
if(this.mainMap){
this.mainMap.setMapCenter(_41.x,_41.y);
}else{
this.setMapCenter(_41.x,_41.y);
}
};
SpatialAceMap.prototype.activateClickTools=function(_42){
this.clickPending=false;
if(this.clickTool&&this.clickTool.click){
this.clickTool.click(_42.x,_42.y);
}else{
if(this.clickTool){
this.clickTool(_42.x,_42.y);
}
}
if(this.clickCallback){
this.clickCallback(this.clickPoint);
}
for(var i=0;i<this.onClickEventHandlers.length;i++){
this.onClickEventHandlers[i](this,this.clickPoint);
}
};
SpatialAceMap.prototype.getPosition=function(_44,_45){
var _46=new Object();
var _47=this.getPixelsToViewUnits();
centerOffsetX=_44-this.mapWidth/2-this.totalOffsetX;
centerOffsetY=-_45+this.mapHeight/2+this.totalOffsetY;
_46.x=this.initialGeoCenterX+_47*centerOffsetX;
_46.y=this.initialGeoCenterY+_47*centerOffsetY;
return _46;
};
SpatialAceMap.prototype.getPixelsToViewUnits=function(){
return (this.tileGeoWidth/this.tileSize);
};
SpatialAceMap.prototype.startZoomTransition=function(_48,_49,_4a){
if(this.zoomActive==true){
this.zoomActive=false;
clearTimeout(this.zoomTimer);
this.view.endZoom();
this.view.showObjectLayers();
return;
}
this.view.hideObjectLayers();
this.zoomActive=true;
this.zoomIterationsRemaining=_4a;
this.zoomTotalIterations=_4a;
this.zoomOldTileGeoWidth=_48;
this.zoomNewTileGeoWidth=_49;
this.zoomTotalScaling=_48/_49;
this.view.startZoom();
this.newTileGeoWidth=_49;
this.zoomStartTime=new Date().getTime();
this.zoomEndTime=this.zoomStartTime+this.totalZoomTime;
this.zoomTimer=setTimeout(associateObjWithEvent(this,"onZoomIteration"),5);
};
SpatialAceMap.prototype.onZoomIteration=function(evt,_4c){
if(!this.zoomActive){
return;
}
var i=0;
var _4e=(this.zoomTotalIterations-this.zoomIterationsRemaining)/this.zoomTotalIterations;
this.view.zoom(_4e);
if(this.zoomIterationsRemaining>0){
this.zoomIterationsRemaining--;
this.zoomRemaining=new Date().getTime();
this.zoomRemaining=this.zoomEndTime-this.zoomRemaining;
var _4f=this.zoomIterationsRemaining;
try{
if(this.zoomIterationsRemaining>0){
if(this.zoomRemaining/this.zoomIterationsRemaining<5){
this.zoomIterationsRemaining=Math.round(this.zoomRemaining/5);
}
}
}
catch(e){
this.zoomIterationsRemaining=_4f;
}
this.zoomTimer=setTimeout(associateObjWithEvent(this,"onZoomIteration"),5);
}else{
this.zoomActive=false;
this.view.showObjectLayers();
this.view.endZoom();
}
};
SpatialAceMap.prototype.onKeyDown=function(evt,_51){
if(this.mainMap){
return;
}
target=evt.target||evt.srcElement;
if((target.nodeName=="INPUT"||target.nodeName=="SELECT")){
return;
}
switch(evt.keyCode){
case (16):
if(!this.shiftPressed){
this.shiftPressed=true;
if(this.manipulationActive==true){
this.currentTool.cancelManipulation();
}
this.manipulationActive=false;
this.setTool(this.shiftTool);
}
break;
case (90):
if(!this.altPressed){
this.altPressed=true;
if(this.manipulationActive==true){
this.currentTool.cancelManipulation();
}
this.manipulationActive=false;
this.setTool(this.altTool);
}
break;
case (38):
case (104):
this.panUp();
break;
case (40):
case (98):
this.panDown();
break;
case (37):
case (100):
this.panLeft();
break;
case (39):
case (102):
this.panRight();
break;
case (103):
this.panUpLeft();
break;
case (105):
this.panUpRight();
break;
case (97):
this.panDownLeft();
break;
case (99):
this.panDownRight();
break;
case (107):
if(this.zoomControl){
this.zoomControl.zoomIn();
}else{
this.zoomIn();
}
break;
case (109):
if(this.zoomControl){
this.zoomControl.zoomOut();
}else{
this.zoomOut();
}
break;
case (77):
if(this.config.GUI.lookingGlass.active&&!this.mainMap){
if(!this.lookingGlass){
if(this.config.GUI.lookingGlass.alternateView){
var _52=this.config.GUI.lookingGlass.alternateView;
}else{
var _52=this.viewName;
}
try{
var _53=parseFloat(this.config.GUI.lookingGlass.scaleValue);
}
catch(e){
var _53=0.1;
}
this.lookingGlassId=this.linkedMapArray.length;
this.createLookingGlass(-500,-500,this.config.GUI.lookingGlass.model,_53,_52);
this.mouseMoveLookingGlassDelegate=associateObjWithEvent(this,"lookingGlassMouseMove");
Evt.addEventListener(document,"mousemove",this.mouseMoveLookingGlassDelegate);
}else{
Evt.removeEventListener(document,"mousemove",this.mouseMoveLookingGlassDelegate);
this.lookingGlass.map.unload();
this.lookingGlassContainer.parentNode.removeChild(this.lookingGlassContainer);
this.lookingGlass=null;
this.linkedMapArray=this.linkedMapArray.slice(0,this.lookingGlassId).concat(this.linkedMapArray.slice(this.lookingGlassId+1));
}
}
case (27):
if(this.clickTool&&this.clickTool.cancel){
this.clickTool.cancel();
}
if(this.manipulationActive){
this.currentTool.cancelManipulation();
this.manipulationActive=false;
}
break;
default:
break;
}
};
SpatialAceMap.prototype.onKeyUp=function(evt,_55){
switch(evt.keyCode){
case (16):
this.shiftPressed=false;
this.setTool(this.defaultTool);
break;
case (90):
this.altPressed=false;
this.setTool(this.defaultTool);
break;
}
};
SpatialAceMap.prototype.pixelOffset=function(_56,_57){
if(this.zoomActive==true){
return;
}
this.beginDrag();
this.drag(_56,_57);
this.endDrag();
};
SpatialAceMap.prototype.setTileGeoWidth=function(_58,_59){
if(!this.view){
return;
}
for(var i=0;i<this.onBeforeUpdateEventHandlers.length;i++){
this.onBeforeUpdateEventHandlers[i](this);
}
if(this.view.zoomContainer){
this.view.zoomContainer.parentNode.removeChild(this.view.zoomContainer);
this.view.zoomContainer=null;
}
if(this.config.GUI.enableAnimatedZoom&&_59&&!isOpera){
this.startZoomTransition(this.tileGeoWidth,_58,5);
}
var _5b=_58/this.tileGeoWidth;
this.tileGeoWidth=_58;
this.view.setTileGeoWidth(this.tileGeoWidth);
if(this.activeinfoBoxObject){
if(!this.activeinfoBoxObject.infoBoxTimeout||this.activeinfoBoxObject.infoBoxTimeout>0){
this.activeinfoBoxObject.cancelInfoBox();
}else{
this.activeinfoBoxObject.updateInfoBox();
}
this.activeinfoBoxObject=null;
}
this.totalOffsetX=this.totalOffsetX/_5b;
this.totalOffsetY=this.totalOffsetY/_5b;
this.placeAndRefreshTiles();
this.view.updateCanvas();
if(this.config.viewSettings.borders&&this.config.viewSettings.borders.active&&!this.mainMap){
var _5c=this.getMapCenter();
var _5d=this.checkBorders(_5c);
this.setMapCenter(_5d.x,_5d.y);
}
if(this.config.GUI.scaleBar&&this.config.GUI.scaleBar.active){
this.requestScaleBar();
}
for(var i=0;i<this.onNewGeoRectEventHandlers.length;i++){
this.onNewGeoRectEventHandlers[i](this);
}
if(this.linkedMapArray){
for(var i=0;i<this.linkedMapArray.length;i++){
this.linkedMapArray[i].updateScale();
this.linkedMapArray[i].drawMainMapRectangle();
}
}
};
SpatialAceMap.prototype.getCurrentZoomIndex=function(){
if(!this.fixedScales){
return -1;
}
var _5e=Number.MAX_VALUE;
var _5f=-1;
for(var i=0;i<this.fixedTileGeoWidths.length;i++){
var _61=Math.abs(this.tileGeoWidth-this.fixedTileGeoWidths[i]);
if(_61<_5e){
_5e=_61;
_5f=i;
}
}
return _5f;
};
SpatialAceMap.prototype.registerInfoLayer=function(_62){
if(!this.registeredCenterInfoLayers){
this.registeredCenterInfoLayers=new Array();
}
if(!this.registeredAreaInfoLayers){
this.registeredAreaInfoLayers=new Array();
}
this.registeredCenterInfoLayers.push(_62);
this.registeredAreaInfoLayers.push(_62);
};
SpatialAceMap.prototype.registerCenterInfoLayer=function(_63){
if(!this.registeredCenterInfoLayers){
this.registeredCenterInfoLayers=new Array();
}
this.registeredCenterInfoLayers.push(_63);
};
SpatialAceMap.prototype.registerAreaInfoLayer=function(_64){
if(!this.registeredAreaInfoLayers){
this.registeredAreaInfoLayers=new Array();
}
this.registeredAreaInfoLayers.push(_64);
};
SpatialAceMap.prototype.registerInfoLayerAreaAction=function(id,_66){
if(!this.registeredInfoLayerAreaActions){
this.registeredInfoLayerAreaActions=new Object();
}
this.registeredInfoLayerAreaActions[id]=_66;
};
SpatialAceMap.prototype.registerInfoLayerCenterAction=function(id,_68){
if(!this.registeredInfoLayerCenterActions){
this.registeredInfoLayerCenterActions=new Object();
}
this.registeredInfoLayerCenterActions[id]=_68;
};
SpatialAceMap.prototype.getInfoLayersString=function(_69){
var _6a="";
for(var i=0;i<_69.length;i++){
if(_6a!=""){
_6a=_6a+",";
}
_6a=_6a+_69[i];
}
return _6a;
};
SpatialAceMap.prototype.getInfoLayerCenterInformation=function(_6c){
if(!this.registeredInfoLayerCenterActions||!this.registeredCenterInfoLayers){
return null;
}
var _6d=this.buildActionsQuery(this.registeredInfoLayerCenterActions);
var _6e=this.getCurrentZoomIndex();
var _6f=this.tileGeoWidth/this.scaleToGeoWidth;
if(_6e!=-1){
_6f=this.fixedInfoScaleSteps[_6e];
}
var _70="&scale="+_6f;
var _71=this.getInfoLayersString(this.registeredCenterInfoLayers);
if(_71==""){
return;
}
var _72="&layers="+_71;
var _73=null;
if(this.fixedScales){
_73=this.getInfoLayerCenter();
}else{
_73=this.getMapCenter();
}
var _74="&x="+_73.x+"&y="+_73.y;
var _75="&responsetype=JSON";
var _76=this.mapServerUrl+"RWCInterface.axd?request=GetGeoObjectsInfoAt&view="+this.viewName+_72+"&width="+this.tileSize+"&height="+this.tileSize+"&pixel-x-bottomright="+this.tileSize+"&pixel-y-bottomright="+this.tileSize+_70+_74+_75+_6d;
if(_76==this.lastGetGeoObjectsInfoAtRequest){
return;
}
this.lastGetGeoObjectsInfoAtRequest=_76;
this.getInfoLayerCenterInformationCallback=_6c;
this.getGeoObjectsInfoAtXmlHttp=new XMLHttpRequest();
this.getGeoObjectsInfoAtXmlHttp.open("GET",_76,true);
this.getGeoObjectsInfoAtXmlHttp.onreadystatechange=associateObjWithCallback(this,this.onGetGeoObjectsInfoAtResponse);
this.getGeoObjectsInfoAtXmlHttp.send("");
};
SpatialAceMap.prototype.getInfoLayerAreaInformation=function(_77){
if(!this.registeredInfoLayerAreaActions||!this.registeredAreaInfoLayers){
return null;
}
var _78=this.buildActionsQuery(this.registeredInfoLayerAreaActions);
var _79=this.getCurrentZoomIndex();
var _7a=this.tileGeoWidth/this.scaleToGeoWidth;
if(_79!=-1){
_7a=this.fixedScaleSteps[_79];
}
var _7b="&scale="+_7a;
var _7c=this.getInfoLayersString(this.registeredAreaInfoLayers);
if(_7c==""){
return;
}
var _7d="&layers="+_7c;
var _7e=null;
var _7f=null;
var _80=null;
if(!this.fixedScales){
var _81=this.view.getTilesGeoBoundingBox();
if(!_81||!_81.centerPoint){
return;
}
_7e=_81.centerPoint;
_7f=this.tileSize*this.nCols;
_80=this.tileSize*this.nRows;
}else{
_7e=this.getMapCenter();
_7f=this.mapWidth;
_80=this.mapHeight;
}
var _82="&x="+_7e.x+"&y="+_7e.y;
var _83="&responsetype=JSON";
var _84=this.mapServerUrl+"RWCInterface.axd?request=GetGeoObjectsInfoIn&view="+this.viewName+_7d+"&width="+_7f+"&height="+_80+"&pixel-x-bottomright="+_7f+"&pixel-y-bottomright="+_80+_7b+_82+_83+_78;
this.getInfoLayerAreaInformationCallback=_77;
this.getGeoObjectsInfoInXmlHttp=new XMLHttpRequest();
this.getGeoObjectsInfoInXmlHttp.open("GET",_84,true);
this.getGeoObjectsInfoInXmlHttp.onreadystatechange=associateObjWithCallback(this,this.onGetGeoObjectsInfoInResponse);
this.getGeoObjectsInfoInXmlHttp.send("");
};
SpatialAceMap.prototype.onGetGeoObjectsInfoAtResponse=function(){
if(this.getGeoObjectsInfoAtXmlHttp&&this.getGeoObjectsInfoAtXmlHttp.readyState==4){
if(this.getGeoObjectsInfoAtXmlHttp.responseText){
try{
var _85=eval("("+this.getGeoObjectsInfoAtXmlHttp.responseText+")");
this.getInfoLayerCenterInformationCallback(true,_85);
}
catch(e){
this.getInfoLayerCenterInformationCallback(false,this.getGeoObjectsInfoAtXmlHttp.responseText);
}
}
this.getInfoLayerCenterInformationCallback=null;
this.getGeoObjectsInfoAtXmlHttp=null;
}
};
SpatialAceMap.prototype.onGetGeoObjectsInfoInResponse=function(){
if(this.getGeoObjectsInfoInXmlHttp&&this.getGeoObjectsInfoInXmlHttp.readyState==4){
if(this.getGeoObjectsInfoInXmlHttp.responseText){
try{
var _86=eval("("+this.getGeoObjectsInfoInXmlHttp.responseText+")");
this.getInfoLayerAreaInformationCallback(true,_86);
}
catch(e){
this.getInfoLayerAreaInformationCallback(false,this.getGeoObjectsInfoInXmlHttp.responseText);
}
}
this.getInfoLayerAreaInformationCallback=null;
this.getGeoObjectsInfoInXmlHttp=null;
}
};
SpatialAceMap.prototype.buildActionsQuery=function(_87){
var _88="";
if(_87){
for(id in _87){
if(typeof (_87[id])!="function"&&_87[id]){
if(_88!=""){
_88=_88+",";
}
_88=_88+id+","+_87[id];
}
}
}
if(_88!=""){
_88="&actions="+_88;
}
return _88;
};
SpatialAceMap.prototype.getInfoLayerCenter=function(){
if(!this.fixedScales||!this.fixedInfoScaleSteps){
return null;
}
var _89=this.getCurrentZoomIndex();
var _8a=this.fixedInfoScaleSteps[_89];
var _8b=this.getMapCenter();
var _8c=_8a*this.scaleToGeoWidth;
var _8d=(Math.floor(_8b.x/_8c)*_8c)+_8c/2;
var _8e=(Math.floor(_8b.y/_8c)*_8c)+_8c/2;
var _8f=this.point(_8d,_8e);
return _8f;
};
SpatialAceMap.prototype.placeAndRefreshTiles=function(){
this.hasDrawnMap=true;
this.view.offset(this.totalOffsetX,this.totalOffsetY);
this.view.getGeoObjects(0,0,this.nCols*this.tileSize,this.nRows*this.tileSize);
this.flushAll();
};
SpatialAceMap.prototype.flushAll=function(){
this.view.refresh(false);
};
SpatialAceMap.prototype.zoomToRect=function(_90,top,_92,_93){
if(!this.fixedScales){
if(_92<40){
_90=_90-((40-_92)/2);
_92=40;
}
if(_93<40){
top=top-((40-_93)/2);
_93=40;
}
}
var _94=_90+_92/2;
var _95=top+_93/2;
var _96=this.mapWidth/2-_94;
var _97=this.mapHeight/2-_95;
this.beginDrag();
this.drag(_96,_97);
this.endDrag();
var _98=(_92/this.mapWidth);
var _99=(_93/this.mapHeight);
if(_98>_99){
var _9a=_92/this.mapWidth;
}else{
var _9a=_93/this.mapHeight;
}
var _9b=this.tileGeoWidth*_9a;
if(this.fixedScales){
var _9c=Number.MAX_VALUE;
var _9d=_9b;
var _9e=0;
for(var i=0;i<this.fixedTileGeoWidths.length;i++){
var _a0=Math.abs(_9b-this.fixedTileGeoWidths[i]);
if(_a0<_9c){
_9c=_a0;
_9d=this.fixedTileGeoWidths[i];
var _a1=i;
}
}
if(this.zoomControl){
this.zoomControl.moveToZoomLevel(_9d);
}else{
this.setTileGeoWidth(_9d,false);
}
}else{
this.setTileGeoWidth(_9b,false);
}
};
SpatialAceMap.prototype.setTool=function(_a2){
this.currentTool=_a2;
if(_a2.cursor){
this.setCursor(_a2.cursor);
}else{
this.setCursor("crosshair");
}
};
SpatialAceMap.prototype.setCursor=function(_a3){
this.latestCursor=_a3;
this.mapContainer.style.cursor=_a3;
for(var i=0;i<this.view.layerArray.length;i++){
if(this.view.layerArray[i].container){
this.view.layerArray[i].container.style.cursor=_a3;
}
}
for(var i=0;i<this.view.overlayArray.length;i++){
if(this.view.overlayArray[i].container){
this.view.overlayArray[i].container.style.cursor=_a3;
}
}
};
SpatialAceMap.prototype.getGeoObjectsAt=function(_a5,_a6){
var _a7="";
var _a8=this.tileGeoWidth/this.tileSize;
var _a9=this.mapWidth*_a8;
var _aa=-this.totalOffsetX;
var _ab=this.totalOffsetY;
var _ac=this.initialGeoCenterX+_aa*_a8;
var _ad=this.initialGeoCenterY+_ab*_a8;
var _ae="&context-details=true";
var _af="&responsetype=JSON";
var _b0="";
for(var i=0;i<this.view.overlayArray.length;i++){
if(!this.view.overlayArray[i].isUserLayer){
if(i!=0){
_b0+=",";
}
_b0+=this.view.overlayArray[i].id;
}
}
if(_b0!=""){
_b0="&layers="+_b0;
}
var _b2=this.mapServerUrl+"RWCInterface.axd?request=GetGeoObjectsAt"+"&view="+this.viewName+_a7+"&width="+this.mapWidth+"&height="+this.mapHeight+"&geowidth="+_a9+"&x="+_ac+"&y="+_ad+"&pixel-x="+_a5+"&pixel-y="+_a6+"&positions=true"+_b0+_ae+_af;
this.addWorkItem();
this.getGeoObjectsAtXmlHttp=new XMLHttpRequest();
this.getGeoObjectsAtXmlHttp.onreadystatechange=associateObjWithCallback(this,this.onGetGeoObjectsAtResponse);
this.getGeoObjectsAtXmlHttp.open("GET",_b2,true);
this.getGeoObjectsAtXmlHttp.send("");
};
SpatialAceMap.prototype.onGetGeoObjectsAtResponse=function(){
if(this.getGeoObjectsAtXmlHttp&&this.getGeoObjectsAtXmlHttp.readyState==4){
if(this.getGeoObjectsAtXmlHttp.responseText){
if(this.hideObjectInfoTimer){
clearTimeout(this.hideObjectInfoTimer);
}
try{
var _b3=eval("("+this.getGeoObjectsAtXmlHttp.responseText+")");
}
catch(e){
return;
}
if(this.config.GUI.detailedInfo.active){
this.drawDetailedInfoBox(_b3);
}
}
this.removeWorkItem();
this.getGeoObjectsAtXmlHttp=null;
}
};
SpatialAceMap.prototype.drawDetailedInfoBox=function(_b4){
if(this.objectInfoContainer){
Evt.removeEventListener(this.infoClose,"click",this.infoCloseDelegate);
this.embedDiv.removeChild(this.objectInfoContainer);
}
this.objectInfoContainer=document.createElement("div");
addClass(this.objectInfoContainer,this.config.GUI.detailedInfo.css);
this.infoClose=document.createElement("img");
this.infoClose.className="rwcCloseBox";
this.config.GUI.closeBox.applyConfiguration(this.infoClose);
if(_b4.geoObjects.length>0){
var _b5=_b4.geoObjects[0];
for(var j=0;j<this.config.GUI.detailedInfo.parameters.length;j++){
for(var i=0;i<_b5.a.length;i++){
var _b8=false;
if(_b5.a[i].name==this.config.GUI.detailedInfo.parameters[j].name){
_b8=true;
if(_b5.a[i].value&&_b5.a[i].value!=""){
switch(this.config.GUI.detailedInfo.parameters[j].type){
case ("string"):
var pg=document.createElement("div");
pg.className="rwcDetailedInfoBoxText";
if(this.config.GUI.detailedInfo.parameters[j].label){
pg.innerHTML+=decodeURIComponent(this.config.GUI.detailedInfo.parameters[j].label)+":<br>";
}
pg.innerHTML+=decodeURIComponent(_b5.a[i].value);
this.objectInfoContainer.appendChild(pg);
break;
case ("image"):
var _ba=document.createElement("img");
setImageSource(_ba,_b5.a[i].value);
_ba.className="rwcDetailedInfoBoxImage";
this.objectInfoContainer.appendChild(_ba);
linebreak=document.createElement("br");
this.objectInfoContainer.appendChild(linebreak);
break;
}
}
}
}
if(!_b8){
for(var k=0;k<this.config.GUI.detailedInfo.parameters[j].alternates.length;k++){
for(var i=0;i<_b5.a.length;i++){
if(_b5.a[i].name==this.config.GUI.detailedInfo.parameters[j].alternates[k]){
_b8=true;
if(_b5.a[i].value&&_b5.a[i].value!=""){
switch(this.config.GUI.detailedInfo.parameters[j].type){
case ("string"):
var pg=document.createElement("div");
pg.className="rwcDetailedInfoBoxText";
if(this.config.GUI.detailedInfo.parameters[j].label){
pg.innerHTML+=decodeURIComponent(this.config.GUI.detailedInfo.parameters[j].label)+":";
}
pg.innerHTML+=decodeURIComponent(_b5.a[i].value);
this.objectInfoContainer.appendChild(pg);
break;
case ("image"):
var _ba=document.createElement("img");
setImageSource(_ba,encodeURI(_b5.a[i].value));
_ba.className="rwcDetailedInfoBoxImage";
this.objectInfoContainer.appendChild(_ba);
linebreak=document.createElement("br");
this.objectInfoContainer.appendChild(linebreak);
break;
}
}
break;
}
}
if(_b8){
break;
}
}
}
}
}else{
this.objectInfoContainer=null;
return;
}
if(this.objectInfoContainer.innerHTML==""){
this.objectInfoContainer=null;
return;
}
this.objectInfoContainer.appendChild(this.infoClose);
this.infoCloseDelegate=associateObjWithEvent(this,"onDetailedInfoClose");
Evt.addEventListener(this.infoClose,"click",this.infoCloseDelegate);
this.embedDiv.appendChild(this.objectInfoContainer);
};
SpatialAceMap.prototype.onDetailedInfoClose=function(evt,_bd){
Evt.removeEventListener(this.infoClose,"click",this.infoCloseDelegate);
this.embedDiv.removeChild(this.objectInfoContainer);
this.objectInfoContainer=null;
};
SpatialAceMap.prototype.mapResized=function(evt,_bf){
if(this.resizeTimer){
clearTimeout(this.resizeTimer);
}
this.resizeTimer=setTimeout(associateObjWithEvent(this,"onResizeTimer"),200);
};
SpatialAceMap.prototype.onResizeTimer=function(evt,_c1){
if(this.mapWidth==this.mapContainer.offsetWidth&&this.mapHeight==(this.mapContainer.offsetHeight-this.dockingOffset)){
return;
}
if(this.zoomActive){
if(this.zoomTimer){
clearTimeout(this.zoomTimer);
}
this.view.endZoom();
this.view.showObjectLayers();
this.zoomActive=false;
}
if(this.hasCreatedTiles){
this.view.unload();
this.createTiles(this.tileGeoWidth*this.nCols);
this.view.draw();
this.placeAndRefreshTiles();
this.view.updateSearchControls();
}
if(this.linkedMapArray){
for(var i=0;i<this.linkedMapArray.length;i++){
this.linkedMapArray[i].drawMainMapRectangle();
}
}
if(this.mainMapRectangle){
this.linkMap.drawMainMapRectangle();
}
};
SpatialAceMap.prototype.addWorkItem=function(evt,_c4){
this.workItemCount++;
if(this.panControl){
if(this.panControl.progressIndicator){
setVisible(this.panControl.progressIndicator,this.workItemCount>0);
}
}
};
SpatialAceMap.prototype.removeWorkItem=function(evt,_c6){
this.workItemCount=Math.max(0,this.workItemCount-1);
if(this.panControl){
if(this.panControl.progressIndicator){
setVisible(this.panControl.progressIndicator,this.workItemCount>0);
}
}
if(this.workItemCount==0){
for(var i=0;i<this.onFullyUpdatedEventHandlers.length;i++){
this.onFullyUpdatedEventHandlers[i](this);
}
}
};
SpatialAceMap.prototype.addLinkedMap=function(map){
if(!this.linkedMapArray){
this.linkedMapArray=new Array();
}
this.linkedMapArray.push(map);
};
SpatialAceMap.prototype.createLookingGlass=function(x,y,_cb,_cc,_cd){
this.lookingGlassContainer=document.createElement("div");
this.lookingGlassContainer.className="rwcLookingGlass";
this.lookingGlassContainer.id=this.prefix+"Mag";
this.embedDiv.appendChild(this.lookingGlassContainer);
if(isOpera||isSafari2){
setX(this.lookingGlassContainer,x-75-cumulativeOffsetLeft(this.mapContainer));
setY(this.lookingGlassContainer,y-75-cumulativeOffsetTop(this.mapContainer));
}else{
setX(this.lookingGlassContainer,x-75-cumulativeOffsetLeft(this.mapContainer)+document.body.scrollLeft);
setY(this.lookingGlassContainer,y-75-cumulativeOffsetTop(this.mapContainer)+document.body.scrollTop);
}
if(!this.config.GUI.lookingGlass.configuration||this.config.GUI.lookingGlass.configuration==""){
this.config.GUI.lookingGlass.configuration=this.mapServerUrl+"RWC/config/lookingGlass.xml";
}
this.lookingGlass=new LinkedMap(this,_cd,this.prefix+"Mag",this.config.GUI.lookingGlass.configuration,this.prefix+"Mag",_cb,_cc,false);
this.lookingGlass.noAdjust=true;
this.lookingGlass.initialize();
};
SpatialAceMap.prototype.lookingGlassMouseMove=function(evt,_cf){
var _d0=new Evt(evt);
var _d1=getPixelPositionFromEvent(_d0,this.mapContainer);
setX(this.lookingGlassContainer,_d1.x-75);
setY(this.lookingGlassContainer,_d1.y-75);
var _d2=this.getPosition(_d1.x,_d1.y);
this.lookingGlass.setNewCenter(_d2.x,_d2.y);
_d0.consume();
};
SpatialAceMap.prototype.drawOverlayRectangle=function(_d3,_d4,_d5){
if(this.mainMapRectangle){
this.mainMapRectangle.parentNode.removeChild(this.mainMapRectangle);
}
this.mainMapRectangle=document.createElement("div");
this.mainMapRectangle.className="rwcMapAreaRectangle";
if(!isIe6&&!isIe7){
this.mapContainer.appendChild(this.mainMapRectangle);
}else{
this.embedDiv.appendChild(this.mainMapRectangle);
}
this.mainMapRectangle.style.height=_d3+"px";
this.mainMapRectangle.style.width=_d4+"px";
var _d6=this.tileSize/this.tileGeoWidth;
centerOffsetX=(_d5.x-this.initialGeoCenterX)*_d6+this.mapWidth/2+this.totalOffsetX;
centerOffsetY=(_d5.y-this.initialGeoCenterY)*_d6+this.mapHeight/2-this.totalOffsetY;
var _d7=centerOffsetX-_d4/2;
var _d8=centerOffsetY-_d3/2;
if(!isNaN(_d7)&&!isNaN(_d8)){
setX(this.mainMapRectangle,_d7);
setY(this.mainMapRectangle,_d8);
}
};
SpatialAceMap.prototype.requestScaleBar=function(){
var _d9=new Array();
var _da=this.getMapCenter();
var _db=new Object();
_db.y=_da.y;
_db.x=_da.x+1;
_d9[0]=_da;
_d9[1]=_db;
this.scaleBarDelegate=associateObjWithCallback(this,this.drawScaleBar);
this.getDistances(_d9,this.scaleBarDelegate);
};
SpatialAceMap.prototype.drawScaleBar=function(_dc){
var _dd=this.config.GUI.scaleBar.maxSize;
if(this.config.GUI.scaleBar.unit=="imperial"){
var _de=1.0936;
var _df=(this.tileGeoWidth*_dc[0])/this.tileSize*_de;
var _e0=(_df*_dd);
if(_e0>1760){
var _e0=_e0/1760;
var _e1=true;
}
var _e0=_e0.toPrecision(1);
}else{
var _df=(this.tileGeoWidth*_dc[0])/this.tileSize;
var _e0=(_df*_dd).toPrecision(1);
}
if(!this.scaleBar){
this.scaleBar=document.createElement("div");
if(this.config.GUI.scaleBar.css){
this.scaleBar.className=this.config.GUI.scaleBar.css;
}else{
this.scaleBar.className="rwcScaleBar";
}
if(this.config.GUI.scaleBar.mode=="standalone"){
document.body.appendChild(this.scaleBar);
}else{
this.embedDiv.appendChild(this.scaleBar);
}
}
if(!_e1){
var _e2=Math.round(_e0/_df);
}else{
var _e2=Math.round(_e0/(_df/1760));
}
_e2-=6;
this.scaleBar.style.width=_e2+"px";
if(this.config.GUI.scaleBar.unit=="imperial"){
if(_e1){
this.scaleBar.innerHTML=_e0*1+"mi";
}else{
this.scaleBar.innerHTML=_e0*1+"yrds";
}
}else{
if(_e0>1000){
this.scaleBar.innerHTML=Math.round(_e0/1000)+"km";
}else{
this.scaleBar.innerHTML=_e0*1+"m";
}
}
};
SpatialAceMap.prototype.mapToScreenCoordinates=function(x,y){
var _e5=new Object();
var _e6=this.tileSize/this.tileGeoWidth;
_e5.x=(x-this.initialGeoCenterX)*_e6+this.mapWidth/2+this.totalOffsetX;
_e5.y=(this.initialGeoCenterY-y)*_e6+this.mapHeight/2+this.totalOffsetY;
return _e5;
};
SpatialAceMap.prototype.createLayerLegend=function(_e7,_e8){
var _e9=document.createElement("div");
for(var j=0;j<_e7.configuration.properties.length;j++){
if(_e7.configuration.properties[j].type=="defaultImage"||_e7.configuration.properties[j].type=="conditionalImage"){
var _eb=document.createElement("img");
_eb.className="rwcLegendImage";
if(_e7.configuration.properties[j].value!=null&&_e7.configuration.properties[j].value!=""&&_e7.configuration.properties[j].type=="defaultImage"){
if(_e8){
setImageSource(_eb,_e7.configuration.properties[j].value);
}else{
_eb.src=_e7.configuration.properties[j].value;
}
}else{
if(_e7.configuration.properties[j].image.image&&_e7.configuration.properties[j].image.image!=""){
if(_e8){
setImageSource(_eb,_e7.configuration.properties[j].image.image);
}else{
_eb.src=_e7.configuration.properties[j].image.image;
}
}
}
_e9.appendChild(_eb);
if(_e7.configuration.properties[j].label&&_e7.configuration.properties[j].label!=""){
var _ec=document.createElement("span");
_ec.innerHTML=_e7.configuration.properties[j].label;
_e9.appendChild(_ec);
}
lineBreak=document.createElement("br");
_e9.appendChild(lineBreak);
}
}
return _e9;
};
SpatialAceMap.prototype.unload=function(){
for(var i=0;i<this.view.overlayArray.length;i++){
if(this.view.overlayArray[i].searchEnabled){
if(typeof (this.view.overlayArray[i].searchControl)!="undefined"){
this.view.overlayArray[i].searchControl.unload();
}
}
}
this.view.unload();
this.panTool.unload();
this.zoomTool.unload();
if(this.panControl){
this.panControl.unload();
}
if(this.zoomControl){
this.zoomControl.unload();
}
if(this.layerControl){
this.layerControl.unload();
}
if(this.backgroundControl){
this.backgroundControl.unload();
}
Evt.removeEventListener(this.mapContainer,"mousedown",this.mouseDownDelegate,false);
Evt.removeEventListener(window,"resize",this.resizeDelegate,false);
Evt.removeEventListener(window,"unload",this.unloadDelegate,false);
if(this.config.GUI.enableMouseScrollEvent){
if(isIe6||isIe7){
Evt.removeEventListener(document,"mousewheel",this.mouseWheelDelegate);
}else{
Evt.removeEventListener(document,"DOMMouseScroll",this.mouseWheelDelegate);
}
}
if(this.config.GUI.enableKeyEvents){
Evt.removeEventListener(document,"keydown",this.keyDownDelegate,false);
Evt.removeEventListener(document,"keyup",this.keyUpDelegate);
}
if(this.objectInfoContainer){
try{
Evt.removeEventListener(this.infoClose,"click",this.infoCloseDelegate);
}
catch(e){
}
}
if(this.mouseMovePositionDelegate){
Evt.removeEventListener(document,"mousemove",this.mouseMovePositionDelegate);
}
try{
Evt.removeEventListener(this.miniMapDiv.closeBox,"click",this.closeMiniMapClickDelegate);
}
catch(e){
}
};
SpatialAceMap.prototype.refresh=function(){
if(this.initialized){
this.placeAndRefreshTiles();
this.view.updateCanvas();
}
};
SpatialAceMap.prototype.refreshObjects=function(){
if(this.initialized){
this.view.getGeoObjects(0,0,this.nCols*this.tileSize,this.nRows*this.tileSize);
this.view.updateCanvas();
}
};
SpatialAceMap.prototype.enableMiniMap=function(){
if(!this.initialized){
return;
}
if(!this.miniMap){
this.createMiniMap();
}else{
this.miniMap.minimized=false;
this.miniMapDiv.className="rwcMiniMap";
this.config.GUI.closeBox.applyConfiguration(this.miniMapDiv.closeBox);
Evt.removeEventListener(this.miniMapDiv.closeBox,"click",this.closeMiniMapClickDelegate);
this.closeMiniMapClickDelegate=associateObjWithEvent(this,"closeMiniMap");
Evt.addEventListener(this.miniMapDiv.closeBox,"click",this.closeMiniMapClickDelegate);
if(this.miniMap.map.initialized&&this.miniMap.map.view){
this.miniMap.map.view.unload();
this.miniMap.map.createTiles(this.tileGeoWidth*this.nCols);
this.miniMap.map.view.draw();
this.miniMap.map.placeAndRefreshTiles();
this.miniMap.map.view.updateSearchControls();
this.miniMap.drawMainMapRectangle();
}
}
};
SpatialAceMap.prototype.closeMiniMap=function(){
if(!this.initialized){
return;
}
if(this.miniMap){
this.miniMap.minimized=true;
this.miniMapDiv.className="rwcMimimizedMiniMap";
Evt.removeEventListener(this.miniMapDiv.closeBox,"click",this.closeMiniMapClickDelegate);
this.closeMiniMapClickDelegate=associateObjWithEvent(this,"enableMiniMap");
this.config.GUI.openBox.applyConfiguration(this.miniMapDiv.closeBox);
Evt.addEventListener(this.miniMapDiv.closeBox,"click",this.closeMiniMapClickDelegate);
}
};
SpatialAceMap.prototype.zoomIn=function(){
if(this.mainMap){
this.mainMap.zoomIn();
return;
}
if(!this.initialized){
return;
}
var _ee;
if(this.fixedScales){
var _ef=-1;
for(var i=0;i<this.fixedTileGeoWidths.length;i++){
if(this.tileGeoWidth==this.fixedTileGeoWidths[i]){
_ef=i;
break;
}
}
if(_ef==0){
return;
}
var _f1=Math.max(0,_ef-1);
_ee=this.fixedTileGeoWidths[_f1];
}else{
_ee=this.tileGeoWidth*0.5;
}
this.setTileGeoWidth(_ee,true);
};
SpatialAceMap.prototype.zoomOut=function(){
if(this.mainMap){
this.mainMap.zoomOut();
return;
}
if(!this.initialized){
return;
}
var _f2;
if(this.fixedScales){
var _f3=Number.MAX_VALUE;
for(var i=0;i<this.fixedTileGeoWidths.length;i++){
if(this.tileGeoWidth==this.fixedTileGeoWidths[i]){
_f3=i;
break;
}
}
if(_f3==(this.fixedTileGeoWidths.length-1)){
return;
}
var _f5=Math.min(this.fixedTileGeoWidths.length-1,_f3+1);
_f2=this.fixedTileGeoWidths[_f5];
}else{
_f2=this.tileGeoWidth*2;
}
this.setTileGeoWidth(_f2,true);
};
SpatialAceMap.prototype.panLeft=function(){
if(!this.initialized){
return;
}
this.pixelOffset(this.mapWidth/2,0);
};
SpatialAceMap.prototype.panRight=function(){
if(!this.initialized){
return;
}
this.pixelOffset(-this.mapWidth/2,0);
};
SpatialAceMap.prototype.panUp=function(){
if(!this.initialized){
return;
}
this.pixelOffset(0,this.mapHeight/2);
};
SpatialAceMap.prototype.panDown=function(){
if(!this.initialized){
return;
}
this.pixelOffset(0,-this.mapHeight/2);
};
SpatialAceMap.prototype.panUpLeft=function(){
if(!this.initialized){
return;
}
this.pixelOffset(this.mapWidth/2,this.mapHeight/2);
};
SpatialAceMap.prototype.panUpRight=function(){
if(!this.initialized){
return;
}
this.pixelOffset(-this.mapWidth/2,this.mapHeight/2);
};
SpatialAceMap.prototype.panDownLeft=function(){
if(!this.initialized){
return;
}
this.pixelOffset(this.mapWidth/2,-this.mapHeight/2);
};
SpatialAceMap.prototype.panDownRight=function(){
if(!this.initialized){
return;
}
this.pixelOffset(-this.mapWidth/2,-this.mapHeight/2);
};
SpatialAceMap.prototype.setMapCenterLatLong=function(lat,lon){
if(!this.initialized){
return;
}
this.projectPointTo(lon,lat,"World.WGS84lola",this.refSystem,this.setMapCenter);
};
SpatialAceMap.prototype.getMapCenter=function(){
if(!this.initialized){
return;
}
var _f8=this.tileGeoWidth/this.tileSize;
var _f9=new Object();
_f9.x=this.initialGeoCenterX-(this.totalOffsetX*_f8);
_f9.y=this.initialGeoCenterY+(this.totalOffsetY*_f8);
return _f9;
};
SpatialAceMap.prototype.setMapCenter=function(x,y){
if(!this.initialized||isNaN(x)||isNaN(y)){
return;
}
var _fc=this.tileSize/this.tileGeoWidth;
var _fd=-(x-this.initialGeoCenterX)*_fc-this.totalOffsetX;
var _fe=(y-this.initialGeoCenterY)*_fc-this.totalOffsetY;
if(_fd==0&&_fe==0){
return;
}
this.rescalingFactor=1;
this.beginDrag();
this.drag(_fd,_fe);
this.endDrag();
};
SpatialAceMap.prototype.getScale=function(){
if(!this.initialized){
return;
}
var _ff=this.tileGeoWidth/this.scaleToGeoWidth;
return _ff;
};
SpatialAceMap.prototype.setScale=function(_100){
if(!this.initialized||!_100||isNaN(_100)||_100<=0){
return;
}
if(this.MainMap){
if(this.linkMap.scaleModel=="factor"){
var _101=_100/this.linkMap.scaleValue;
this.MainMap.setScale(_101);
}
return;
}
newTileGeoWidth=_100*this.scaleToGeoWidth;
if(this.fixedScales){
var _102=Number.MAX_VALUE;
var _103=_100*this.scaleToGeoWidth;
for(var i=0;i<this.fixedTileGeoWidths.length;i++){
var diff=Math.abs(_103-this.fixedTileGeoWidths[i]);
if(diff<_102){
_102=diff;
newTileGeoWidth=this.fixedTileGeoWidths[i];
}
}
}
if(this.zoomControl){
this.zoomControl.moveToZoomLevel(newTileGeoWidth);
}
if(!this.fixedScales||!this.zoomControl){
this.setTileGeoWidth(newTileGeoWidth,false);
}
if(this.linkedMapArray){
for(var i=0;i<this.linkedMapArray.length;i++){
this.linkedMapArray[i].updateScale();
this.linkedMapArray[i].drawMainMapRectangle();
}
}
};
SpatialAceMap.prototype.getFixedScales=function(){
if(!this.initialized){
return;
}
if(this.fixedScales){
var _106=new Array();
for(var i=0;i<this.fixedScaleSteps.length;i++){
_106[i]=this.fixedScaleSteps[i];
}
return _106;
}else{
return null;
}
};
SpatialAceMap.prototype.createGeoObject=function(x,y,_10a,_10b,type,_10d,_10e){
if(!this.initialized){
return;
}
var _10f=this.getObjectLayerById(_10b);
if(!_10f){
var _10f=this.getLayerById(_10b);
if(!_10f||!_10f.haveClientObjects){
if(!_10b||_10b==""){
_10b="userLayer"+Math.random();
}
_10f=new OverlayLayer(_10b,_10b,0,this,false,false,false);
var _110=this.config.getLayerConfiguration("");
_10f.createDefaults(_110,null);
_10f.noUpdate=true;
_10f.isUserLayer=true;
this.view.overlayArray.push(_10f);
}else{
_10f=_10f.geoObjectLayer;
}
}
geoObjectNode=new Object();
geoObjectNode.a=new Array();
typeAttribute=new Object();
typeAttribute.name="geoType";
if(!type||type=="point"){
typeAttribute.value="#point";
geoObjectNode.p=this.point(x,y);
}else{
if(type=="poly"){
typeAttribute.value="#polygon";
}else{
if(type=="line"){
typeAttribute.value="#line";
}
}
}
if(_10d){
geoObjectNode.ps=_10d;
}
geoObjectNode.a.push(typeAttribute);
var _111=new GeoObject(geoObjectNode,_10f,false);
if(_10a&&_10a!=""){
_111.id=_10a;
_111.noId=false;
}
_111.setPosition(x,y);
if(!_10f.geoObjectArray){
_10f.geoObjectArray=new Array();
}
_10f.insertObject(_111,_10e);
return _111;
};
SpatialAceMap.prototype.removeGeoObject=function(_112,_113){
if(!this.initialized){
return;
}
var _114=this.view.getObjectLayerById(_113);
if(_114){
return _114.removeGeoObject(_112);
}
return false;
};
SpatialAceMap.prototype.getGeoObject=function(_115,_116){
if(!this.initialized){
return;
}
var _117=this.view.getObjectLayerById(_116);
if(_117){
var _118=_117.getGeoObjectById(_115);
if(_118){
return _118;
}
}
return null;
};
SpatialAceMap.prototype.getGeoObjectsArray=function(_119){
if(!this.initialized){
return;
}
var _11a=this.view.getObjectLayerById(_119);
if(_11a&&_11a.geoObjectArray){
var _11b=_11a.geoObjectArray;
return _11b;
}
return null;
};
SpatialAceMap.prototype.centerOnGeoObject=function(_11c,_11d){
if(!this.initialized){
return false;
}
var _11e=this.view.getObjectLayerById(_11d);
if(_11e){
var _11f=_11e.getGeoObjectById(_11c);
if(_11f){
this.setMapCenter(_11f.point.x,_11f.point.y);
return true;
}
}
return false;
};
SpatialAceMap.prototype.addObjectLayer=function(_120,_121){
if(!this.initialized){
return;
}
var _122=this.config.getLayerConfiguration(_121);
var _123=false;
layer=new OverlayLayer(_120,_120,_120,this,_123,false,false);
layer.createDefaults(_122,null);
layer.isUserLayer=true;
this.view.overlayArray.push(layer);
layer.noUpdate=true;
layer.draw();
return layer;
};
SpatialAceMap.prototype.getLayerById=function(_124){
if(this.initialized){
return this.view.getLayerById(_124);
}
};
SpatialAceMap.prototype.getObjectLayerById=function(_125){
if(this.initialized){
return this.view.getObjectLayerById(_125);
}
};
SpatialAceMap.prototype.removeObjectLayer=function(_126){
if(!this.initialized){
return false;
}
for(var i=0;i<this.view.overlayArray.length;i++){
if(this.view.overlayArray[i].id==_126){
this.view.overlayArray[i].unload();
if(this.view.overlayArray[i].container&&this.view.overlayArray[i].container.parentNode){
this.view.overlayArray[i].container.parentNode.removeChild(this.view.overlayArray[i].container);
}
this.view.overlayArray.splice(i,1);
this.layerControl.updateOverlayLayers();
return true;
}
}
return false;
};
SpatialAceMap.prototype.getObjectLayers=function(){
if(this.initialized){
return this.view.overlayArray;
}
};
SpatialAceMap.prototype.mapToLatLong=function(x,y,_12a){
this.projectPointTo(x,y,this.refSystem,"World.WGS84lola",_12a);
};
SpatialAceMap.prototype.latLongToMap=function(x,y,_12d){
this.projectPointTo(x,y,"World.WGS84lola",this.refSystem,_12d);
};
SpatialAceMap.prototype.projectPointTo=function(x,y,_130,_131,_132){
this.callback=_132;
var _133=this.mapServerUrl+"RWCInterface.axd?request=ProjectPointTo"+"&x="+x+"&y="+y+"&from="+_130+"&to="+_131+"&responsetype=JSON";
if(this.pointXmlHttp&&this.pointXmlHttp.readyState>0){
this.removeWorkItem();
}
this.addWorkItem();
this.pointXmlHttp=new XMLHttpRequest();
this.pointXmlHttp.onreadystatechange=associateObjWithCallback(this,this.onProjectPointToResponse);
this.pointXmlHttp.open("GET",_133,true);
this.pointXmlHttp.send("");
};
SpatialAceMap.prototype.onProjectPointToResponse=function(){
if(this.pointXmlHttp&&this.pointXmlHttp.readyState==4){
if(this.pointXmlHttp.responseText){
try{
var _134=eval("("+this.pointXmlHttp.responseText+")");
}
catch(e){
return;
}
var _135=_134.ProjectedPoint;
var x=parseFloat(_134.ProjectedPoint.X);
var y=parseFloat(_134.ProjectedPoint.Y);
this.removeWorkItem();
this.callback(x,y);
}
}
};
SpatialAceMap.prototype.reorderLayer=function(_138,step){
if(!this.initialized||!this.config.GUI.layerControl.reorderableLayers){
return;
}
for(var i=0;i<this.view.overlayArray.length;i++){
if(this.view.overlayArray[i].id==_138){
if((step>0&&i<this.view.overlayArray.length-step)||(step<0&&i+step>=0)){
this.view.moveOverlayLayer(i,i+step);
}else{
return false;
}
if(this.layerControl){
this.layerControl.updateOverlayLayers();
}
for(var i=0;i<this.view.overlayArray.length;i++){
this.view.overlayArray[i].draw();
}
return true;
}
}
return false;
};
SpatialAceMap.prototype.getDistances=function(_13b,_13c){
if(!this.initialized){
return;
}
var json="&responsetype=JSON";
var view="&view="+this.viewName;
var _13f="&points=";
_13f+=_13b[0].x+","+_13b[0].y;
for(var i=1;i<_13b.length;i++){
_13f+=","+_13b[i].x+","+_13b[i].y;
}
var _141=this.mapServerUrl+"RWCInterface.axd?request=GetGreatCircleDistances"+view+_13f+"&refsys="+this.refSystem+json;
if(!this.getDistanceQueue){
this.getDistanceQueue=new Array();
}
if(this.getDistanceRequestActive==true){
var _142=new Object();
_142.points=_13b;
_142.callback=_13c;
this.getDistanceQueue.push(_142);
return;
}
this.getDistanceRequestActive=true;
if(_13c){
this.getDistanceCallback=_13c;
}
this.getDistancesXmlHttp=new XMLHttpRequest();
this.getDistancesXmlHttp.onreadystatechange=associateObjWithCallback(this,this.getDistanceResponse);
this.getDistancesXmlHttp.open("GET",_141,true);
this.getDistancesXmlHttp.send("");
};
SpatialAceMap.prototype.getDistanceResponse=function(){
if(this.getDistancesXmlHttp&&this.getDistancesXmlHttp.readyState==4){
if(this.getDistancesXmlHttp.responseText){
var _143=new Array();
try{
var _144=eval("("+this.getDistancesXmlHttp.responseText+")");
}
catch(e){
return;
}
for(var i=0;i<_144.distances.length;i++){
_143.push(parseFloat(_144.distances[i].d));
}
if(this.getDistanceCallback){
this.getDistanceCallback(_143);
}
}
this.getDistanceRequestActive=false;
if(this.getDistanceQueue&&this.getDistanceQueue.length>0){
var _146=this.getDistanceQueue[0].points;
var _147=this.getDistanceQueue[0].callback;
this.getDistanceQueue.splice(0,1);
this.getDistances(_146,_147);
}
}
};
SpatialAceMap.prototype.createObjectList=function(_148,_149){
if(!this.initialized){
return;
}
this.objectList=document.createElement("div");
this.legendDiv=document.createElement("div");
for(var i=0;i<this.view.overlayArray.length;i++){
if(_148){
for(var j=0;j<this.view.overlayArray[i].configuration.properties.length;j++){
legendDiv=document.createElement("div");
if(this.view.overlayArray[i].configuration.properties[j].type=="defaultImage"||this.view.overlayArray[i].configuration.properties[j].type=="conditionalImage"){
var _14c=document.createElement("img");
_14c.className="rwcLegendImage";
if(this.view.overlayArray[i].configuration.properties[j].image.image&&this.view.overlayArray[i].configuration.properties[j].image.image!=""){
setImageSource(_14c,this.view.overlayArray[i].configuration.properties[j].image.image);
}
legendDiv.appendChild(_14c);
if(this.view.overlayArray[i].configuration.properties[j].label&&this.view.overlayArray[i].configuration.properties[j].label!=""){
var _14d=document.createElement("span");
_14d.innerHTML=this.view.overlayArray[i].configuration.properties[j].label;
legendDiv.appendChild(_14d);
}
lineBreak=document.createElement("br");
legendDiv.appendChild(lineBreak);
}
}
this.objectList.appendChild(legendDiv);
}
if(this.view.overlayArray[i].geoObjectArray){
for(var k=0;k<this.view.overlayArray[i].geoObjectArray.length;k++){
var _14f=this.view.overlayArray[i].geoObjectArray[k].createInfo(_149);
_14f.className="rwcListInfoBox";
_14f.style.position="relative";
_14f.style.lineHeight="18px";
if(_149){
var _150=document.createElement("span");
_150.innerHTML=k+1+".";
_14f.insertBefore(_150,_14f.firstChild);
}
this.objectList.appendChild(_14f);
}
}
}
return this.objectList;
};
SpatialAceMap.prototype.setClickTool=function(_151){
if(this.clickTool&&this.clickTool.cancel){
this.clickTool.cancel();
}
switch(_151){
case ("getInfo"):
this.clickTool=this.getGeoObjectsAt;
break;
case ("getPosition"):
this.clickTool=this.getPosition;
break;
case ("setCenter"):
this.clickTool=this.moveToPosition;
break;
case ("measureDistance"):
this.clickTool=this.measureDistance;
break;
case ("routeSearch"):
this.clickTool=this.routeSearch;
break;
default:
this.clickTool=null;
break;
}
};
SpatialAceMap.prototype.mapToScreenCoordinates=function(x,y){
if(!this.initialized){
return;
}
var _154=new Object();
var _155=this.tileSize/this.tileGeoWidth;
_154.x=(x-this.initialGeoCenterX)*_155+this.mapWidth/2+this.totalOffsetX;
_154.y=(this.initialGeoCenterY-y)*_155+this.mapHeight/2+this.totalOffsetY;
return _154;
};
SpatialAceMap.prototype.getGeoObjectsBySelection=function(maxX,maxY,minX,minY){
var _15a=new Array();
for(var i=0;i<this.view.overlayArray.length;i++){
if(this.view.overlayArray[i].geoObjectArray){
for(var j=0;j<this.view.overlayArray[i].geoObjectArray.length;j++){
if(this.view.overlayArray[i].geoObjectArray[j].viewX>minX&&this.view.overlayArray[i].geoObjectArray[j].viewX<maxX&&this.view.overlayArray[i].geoObjectArray[j].viewY>minY&&this.view.overlayArray[i].geoObjectArray[j].viewY<maxY){
_15a.push(this.view.overlayArray[i].geoObjectArray[j]);
}
}
}
}
return _15a;
};
SpatialAceMap.prototype.createObjectSelectionList=function(_15d,_15e){
var _15f=document.createElement("div");
for(var i=0;i<_15d.length;i++){
var _161=_15d[i].createInfo(false);
_161.className="rwcListInfoBox";
_161.style.position="relative";
_161.style.lineHeight="18px";
if(_15e&&_15d[i].type=="point"){
var _162=document.createElement("img");
_162.src=_15d[i].icon.image;
_161.insertBefore(_162,_161.firstChild);
}
if(_15d[i].layer.numbered){
var _163=document.createElement("span");
try{
_163.innerHTML=parseInt(_15d[i].textNode.innerHTML);
}
catch(e){
}
_161.insertBefore(_163,_161.firstChild);
}
_15f.appendChild(_161);
}
return _15f;
};
SpatialAceMap.prototype.setDefaultTool=function(_164){
if(this.manipulationActive==true){
this.currentTool.cancelManipulation();
}
this.manipulationActive=false;
switch(_164){
case ("select"):
this.defaultTool=this.selectionTool;
this.shiftTool=this.zoomTool;
this.altTool=this.panTool;
break;
case ("zoom"):
this.defaultTool=this.zoomTool;
this.shiftTool=this.panTool;
this.altTool=this.selectionTool;
break;
default:
this.defaultTool=this.panTool;
this.shiftTool=this.zoomTool;
this.altTool=this.selectionTool;
break;
}
this.setTool(this.defaultTool);
};
SpatialAceMap.prototype.printMap=function(_165,_166,_167){
if(!this.initialized){
return;
}
if(this.printArea){
document.body.removeChild(this.printArea);
}
if(this.printOffsetElement){
document.body.removeChild(this.printOffsetElement);
}
this.printOffsetElement=document.createElement("p");
this.printOffsetElement.className="rwcPrintOffset";
document.body.appendChild(this.printOffsetElement);
this.printArea=document.createElement("p");
this.printArea.className="rwcPrintArea";
if(this.printImage){
this.mapContainer.removeChild(this.printImage);
this.printImage=null;
}
document.body.appendChild(this.printArea);
var _168=this.getGeoObjectsBySelection(this.mapWidth,this.mapHeight,0,0);
for(var i=0;i<this.view.overlayArray.length;i++){
var _16a=document.createElement("span");
_16a.innerHTML=this.view.overlayArray[i].name+"<br>";
var _16b=this.createLayerLegend(this.view.overlayArray[i],false);
_16b.className="rwcPrintLegend";
this.printArea.appendChild(_16a);
this.printArea.appendChild(_16b);
}
if(_166){
var _16c=this.createObjectSelectionList(_168,false);
}
if((isMozilla||isFireFox)&&this.view.overlayArray.length>0){
var _16d="&layers=";
for(var i=0;i<this.view.layerArray.length;i++){
if(_16d!="&layers="){
_16d+=",";
}
if(!this.view.layerArray[i].isHidden){
_16d+=this.view.layerArray[i].id;
}
}
for(var i=0;i<this.view.overlayArray.length;i++){
if(!this.view.overlayArray[i].isHidden){
if(_16d!="&layers="){
_16d+=",";
}
_16d+=this.view.overlayArray[i].id;
}
}
var _16e=this.getScale();
this.printImage=document.createElement("img");
this.printImage.style.position="absolute";
this.printImage.className="rwcPrintOnly";
this.printImage.style.width=this.mapWidth+"px";
this.printImage.style.height=this.mapHeight+"px";
setX(this.printImage,this.mapContainer.offsetLeft);
setY(this.printImage,this.mapContainer.offsetTop);
var _16f=this.getMapCenter();
this.printImage.src=this.mapServerUrl+"RWCInterface.axd?view="+this.viewName+"&format=gif&transparent=true"+"&width="+this.mapWidth+"&height="+this.mapHeight+"&scale="+_16e+"&x="+_16f.x+"&y="+_16f.y;
this.mapContainer.insertBefore(this.printImage,this.view.overlayArray[0].container);
}else{
if(isIe6){
if(this.printOverlay){
this.mapContainer.removeChild(this.printOverlay);
}
this.printOverlay=document.createElement("div");
this.printOverlay.className="rwcPrintArea";
this.printOverlay.style.position="absolute";
setX(this.printOverlay,this.mapContainer.offsetLeft);
setY(this.printOverlay,this.mapContainer.offsetTop);
this.printOverlay.style.width=this.mapWidth+"px";
this.printOverlay.style.height=this.mapHeight+"px";
for(var i=0;i<_168.length;i++){
if(_168[i].type=="point"){
var _170=document.createElement("img");
_170.src=_168[i].icon.image;
_170.className="rwcMarker";
_170.style.height=_168[i].icon.height;
_170.style.width=_168[i].icon.width;
setX(_170,_168[i].viewX-_168[i].iconOffsetX/2);
setY(_170,_168[i].viewY-_168[i].iconOffsetY/2);
this.printOverlay.appendChild(_170);
}
}
this.mapContainer.insertBefore(this.printOverlay,this.view.overlayArray[0].container);
}
}
if(_166){
this.printArea.appendChild(_16c);
}
window.print();
};
SpatialAceMap.prototype.zoomToObjects=function(_171,_172){
if(!this.initialized||_171==null||_171.length==0){
return;
}
var xMax=Number.NEGATIVE_INFINITY;
var yMax=Number.NEGATIVE_INFINITY;
var xMin=Number.MAX_VALUE;
var yMin=Number.MAX_VALUE;
for(var i=0;i<_171.length;i++){
if(_171[i].type=="point"){
if(_171[i].point.x>xMax){
xMax=_171[i].point.x;
}
if(_171[i].point.y>yMax){
yMax=_171[i].point.y;
}
if(_171[i].point.x<xMin){
xMin=_171[i].point.x;
}
if(_171[i].point.y<yMin){
yMin=_171[i].point.y;
}
}else{
for(var j=0;j<_171[i].points.length;j++){
if(_171[i].points[j].x>xMax){
xMax=_171[i].points[j].x;
}
if(_171[i].points[j].y>yMax){
yMax=_171[i].points[j].y;
}
if(_171[i].points[j].x<xMin){
xMin=_171[i].points[j].x;
}
if(_171[i].points[j].y<yMin){
yMin=_171[i].points[j].y;
}
}
}
}
var _179=xMax-xMin;
var _17a=yMax-yMin;
var _17b=xMax-_179/2;
var _17c=yMax-_17a/2;
if(_172){
var _17d=this.tileGeoWidth/this.tileSize;
var xMod=(_172*2);
var yMod=(_172*2);
}else{
var xMod=0;
var yMod=0;
}
var _180=this.tileSize/this.mapContainer.offsetHeight;
var _181=this.tileSize+(_180*xMod);
var _182=this.tileSize+(_180*yMod);
var _183=_179*(_181/this.mapContainer.offsetWidth);
var _184=_183/this.scaleToGeoWidth;
var _185=_17a*(_182/this.mapContainer.offsetHeight);
var _186=_185/this.scaleToGeoWidth;
var _187=Math.max(_184,_186);
this.setArea(_17b,_17c,_187);
};
SpatialAceMap.prototype.setArea=function(x,y,_18a){
if(!this.initialized){
return;
}
var _18b=_18a;
if(this.fixedScales){
_18b=this.fixedScaleSteps[this.fixedScaleSteps.length-1];
for(var i=this.fixedScaleSteps.length-1;i>=0;i--){
if(this.fixedScaleSteps[i]>=_18a){
_18b=this.fixedScaleSteps[i];
}else{
break;
}
}
}else{
var _18d=this.tileGeoWidth/this.scaleToGeoWidth;
if(_18b/_18d<0.05){
_18b=0.05*_18d;
}
}
var _18e=this.tileGeoWidth;
this.tileGeoWidth=_18b*this.scaleToGeoWidth;
this.view.setTileGeoWidth(this.tileGeoWidth);
var _18f=this.tileSize/this.tileGeoWidth;
var _190=this.totalOffsetX;
var _191=this.totalOffsetY;
this.totalOffsetX=-(x-this.initialGeoCenterX)*_18f;
this.totalOffsetY=(y-this.initialGeoCenterY)*_18f;
if(this.totalOffsetX!=_190||this.totalOffsetY!=_191){
this.view.offset(Math.round(this.totalOffsetX),Math.round(this.totalOffsetY));
}
if(this.zoomControl){
this.zoomControl.refreshZoomLevel(this.tileGeoWidth);
}
if(this.totalOffsetX!=_190||this.totalOffsetY!=_191||this.tileGeoWidth!=_18e){
this.refresh();
}
if(this.linkedMapArray){
for(var i=0;i<this.linkedMapArray.length;i++){
this.linkedMapArray[i].syncMapOffset();
this.linkedMapArray[i].updateScale();
this.linkedMapArray[i].drawMainMapRectangle();
}
}
};
SpatialAceMap.prototype.setClickCallback=function(func){
this.clickCallback=func;
};
SpatialAceMap.prototype.registerOnClickEventHandler=function(_193){
if(typeof (_193)=="function"){
this.onClickEventHandlers.push(_193);
}
};
SpatialAceMap.prototype.registerOnBeforeUpdateEventHandler=function(_194){
if(typeof (_194)=="function"){
this.onBeforeUpdateEventHandlers.push(_194);
}
};
SpatialAceMap.prototype.registerOnAfterUpdateEventHandler=function(_195){
if(typeof (_195)=="function"){
this.onAfterUpdateEventHandlers.push(_195);
}
};
SpatialAceMap.prototype.registerOnNewGeoRectEventHandler=function(_196){
if(typeof (_196)=="function"){
this.onNewGeoRectEventHandlers.push(_196);
}
};
SpatialAceMap.prototype.registerOnClientSearchEventHandler=function(_197){
if(typeof (_197)=="function"){
this.onClientSearchEventHandlers.push(_197);
}
};
SpatialAceMap.prototype.registerOnMouseOverEventHandler=function(_198){
if(typeof (_198)=="function"){
this.onMouseOverEventHandlers.push(_198);
}
if(isOpera||!this.mouseMovePositionDelegate){
this.mouseMovePositionDelegate=associateObjWithEvent(this,"onMouseMovePosition");
Evt.addEventListener(document,"mousemove",this.mouseMovePositionDelegate);
}
};
SpatialAceMap.prototype.registerOnMouseOutEventHandler=function(_199){
if(typeof (_199)=="function"){
this.onMouseOutEventHandlers.push(_199);
}
if(isOpera||!this.mouseMovePositionDelegate){
this.mouseMovePositionDelegate=associateObjWithEvent(this,"onMouseMovePosition");
Evt.addEventListener(document,"mousemove",this.mouseMovePositionDelegate);
}
};
SpatialAceMap.prototype.registerOnFullyUpdatedEventHandler=function(_19a){
if(typeof (_19a)=="function"){
this.onFullyUpdatedEventHandlers.push(_19a);
}
};
SpatialAceMap.prototype.point=function(x,y){
point=new Object();
point.x=x;
point.y=y;
return point;
};
SpatialAceMap.prototype.getGeoRect=function(){
if(!this.initialized){
return;
}
geoRect=new Object();
var _19d=this.getMapCenter();
var _19e=this.tileGeoWidth/this.tileSize;
geoRect.xMin=_19d.x-_19e*(this.embedDiv.offsetWidth/2);
geoRect.xMax=_19d.x+_19e*(this.embedDiv.offsetWidth/2);
geoRect.yMin=_19d.y-_19e*(this.embedDiv.offsetHeight/2);
geoRect.yMax=_19d.y+_19e*(this.embedDiv.offsetHeight/2);
return geoRect;
};
SpatialAceMap.prototype.getAllLayers=function(){
if(!this.initialized){
return;
}
var _19f=new Array();
if(this.view.layerArray){
_19f=_19f.concat(this.view.layerArray);
}
if(this.view.overlayArray){
_19f=_19f.concat(this.view.overlayArray);
}
return _19f;
};
SpatialAceMap.prototype.updatePrintImage=function(_1a0,_1a1,_1a2){
if(this.printImage){
this.printImage.parentNode.removeChild(this.printImage);
}
this.printImage=document.createElement("img");
this.printImage.className="rwcPrintImage";
if(this.view.overlayArray.length>0&&this.view.overlayArray[0].container){
this.mapContainer.insertBefore(this.printImage,this.view.overlayArray[0].container);
}else{
this.mapContainer.appendChild(this.printImage);
}
this.printImage.style.width=this.mapContainer.offsetWidth+"px";
this.printImage.style.height=this.mapContainer.offsetHeight+"px";
var _1a3="&format="+this.config.viewSettings.imageFormat;
var _1a4;
var _1a5=Math.round((this.tileGeoWidth*this.geoWidthToScale)-2);
_1a4="&scale="+_1a5;
var _1a6=this.getAllLayers();
var _1a7="";
for(var i=0;i<_1a6.length;i++){
if(!_1a6[i].isHidden){
if(_1a6[i].type=="combinedImage"){
for(var j=0;j<_1a6[i].sublayerID.length;j++){
if(!_1a6[i].sublayerID[j].isHidden){
if(_1a7!=""){
_1a7+=",";
}
_1a7+=_1a6[i].sublayerID[j].id;
}
}
}else{
if(_1a0||_1a6[i].type!="objects"){
if(_1a7!=""){
_1a7+=",";
}
_1a7+=_1a6[i].id;
}
}
}
this.mapRequestString="";
if(_1a1){
if(this.customAttributes){
for(variable in this.customAttributes){
if(typeof (this.customAttributes[variable])!="function"&&this.customAttributes[variable]){
this.mapRequestString=this.mapRequestString+"&context-"+variable+"="+this.customAttributes[variable];
}
}
}
}
}
_1a7="&layers="+_1a7;
var _1aa=this.getMapCenter();
var _1ab=this.mapServerUrl+"RWCInterface.axd?view="+this.viewName+_1a3+"&transparent=false"+_1a7+"&width="+this.mapContainer.offsetWidth+"&height="+this.mapContainer.offsetHeight+_1a4+"&x="+_1aa.x+"&y="+_1aa.y+this.mapRequestString;
var _1ac="";
if(_1a2){
var _1ad;
var _1ae=this.getGeoRect();
var _1af=new Array();
_1af.push(this.point(_1ae.xMax,_1ae.yMax));
_1af.push(this.point(_1ae.xMin,_1ae.yMax));
_1af.push(this.point(_1ae.xMin,_1ae.yMin));
_1af.push(this.point(_1ae.xMax,_1ae.yMin));
var _1b0=new BoundingArea(null,_1af,"poly",this,0);
var _1b1=Math.floor((this.config.viewSettings.requestMaxLength-_1ab.length)/8);
if(_1b1>0){
_1ac=this.encodeClientObjects(_1a2,_1b0,_1b1);
}
}
this.printImage.src=_1ab+_1ac;
};
SpatialAceMap.prototype.encodeClientObjects=function(_1b2,_1b3,_1b4){
if(!_1b2){
return;
}
clientObjectString="";
var _1b5=0;
var _1b6=0;
var _1b7=0;
for(var i=0;i<_1b2.length;i++){
if(_1b2[i].points){
if(_1b2[i].points){
var _1b9=_1b2[i].points;
}else{
var _1b9=_1b2[i].point;
}
var _1b9=RWCClipToRectangle(_1b2[i],_1b3,_1b4,2);
var _1ba=new Object();
if(_1b9&&_1b9.length>0){
if(_1b2[i].type=="poly"){
var _1bb=_1b2[i].type+_1b6;
_1b6++;
}else{
if(_1b2[i].type=="line"){
var _1bb=_1b2[i].type+_1b5;
_1b5++;
}else{
if(_1b2[i].type=="point"){
var _1bb=_1b2[i].type+_1b7;
_1b7++;
}
}
}
clientObjectString+="&"+_1bb+"="+RWCEncodePointList(_1b9,_1ba);
clientObjectString+="&sh="+_1ba.value;
}
}
}
return clientObjectString;
};

function Tile(_1,_2,_3,_4,id,_6){
this.startRow=_2;
this.startCol=_3;
this.saMap=_1;
this.node=document.createElement("img");
this.node.className="rwcMapTile";
this.id=(id+_2)+_3;
this.node.id=this.id;
this.layer=_6;
this.tileSize=_4;
this.reloading=false;
setWidth(this.node,this.tileSize);
setHeight(this.node,this.tileSize);
setVisible(this.node,false);
this.offset(0,0,0,0,0,0);
}
Tile.prototype.draw=function(_7,_8,_9){
this.dimmed=_9;
if(!this.node){
this.node=document.createElement("img");
this.node.className="rwcMapTile";
this.node.id=this.id;
}
_7.appendChild(this.node);
if(this.loadDelegate){
Evt.removeEventListener(this.node,"load",this.loadDelegate);
this.loadDelegate=null;
}
this.loadDelegate=associateObjWithEvent(this,"tileLoaded");
Evt.addEventListener(this.node,"load",this.loadDelegate);
};
Tile.prototype.offset=function(_a,_b,_c,_d,_e,_f){
this.row=this.startRow+_c;
this.col=this.startCol+_a;
setX(this.node,Math.ceil(_b+this.startCol*this.tileSize-_e/2));
setY(this.node,Math.ceil(_d+this.startRow*this.tileSize-_f/2));
if(this.dimFilter){
setX(this.dimFilter,getX(this.node));
setY(this.dimFilter,getY(this.node));
}
};
Tile.prototype.dim=function(_10){
this.dimmed=true;
this.dimColor=_10;
if(!this.dimFilter){
this.dimFilter=document.createElement("div");
addClass(this.dimFilter,"rwcMapTile");
addClass(this.dimFilter,"rwcDimArea");
this.dimFilter.style.backgroundColor=_10;
setWidth(this.dimFilter,this.tileSize);
setHeight(this.dimFilter,this.tileSize);
setX(this.dimFilter,getX(this.node));
setY(this.dimFilter,getY(this.node));
if(this.node.parentNode){
this.node.parentNode.appendChild(this.dimFilter);
}
}
};
Tile.prototype.undim=function(_11){
this.dimmed=false;
if(this.dimFilter&&this.dimFilter.parentNode){
this.dimFilter.parentNode.removeChild(this.dimFilter);
}
this.dimFilter=null;
};
Tile.prototype.setGeoCenter=function(_12){
this.geoCenter=_12;
};
Tile.prototype.getGeoCenter=function(){
return this.geoCenter;
};
Tile.prototype.pixelOffset=function(_13,_14,_15,_16){
var x=getX(this.node);
var y=getY(this.node);
var _19=x+_13+(this.saMap.totalWidth-this.saMap.mapWidth);
var _1a=Math.floor(_19/(this.tileSize*_16));
var _1b=y+_14+(this.saMap.totalHeight-this.saMap.mapHeight);
var _1c=Math.floor(_1b/(this.tileSize*_15));
if((_1a!=0||_1c!=0)&&isFireFox){
this.unload();
if(this.layer.container){
this.draw(this.layer.container,this.layer.isZooming,this.layer.dimmed);
}
}
setX(this.node,x+_13-this.tileSize*_16*_1a);
this.col-=_1a*_16;
setY(this.node,y+_14-this.tileSize*_15*_1c);
this.row-=_1c*_15;
if(this.dimFilter){
setX(this.dimFilter,getX(this.node));
setY(this.dimFilter,getY(this.node));
}
if(_1a!=0||_1c!=0){
this.layer.updateSingleTile(this);
}
};
Tile.prototype.refreshImage=function(url){
if((isSafari2||isSafari3)&&this.node.src==url){
}else{
if(!this.reloading){
setVisible(this.node,false);
this.saMap.addWorkItem();
this.reloading=true;
}
}
if(this.dimFilter&&this.dimFilter.parentNode){
this.dimFilter.parentNode.removeChild(this.dimFilter);
this.dimFilter=null;
}
this.node.src=url;
};
Tile.prototype.tileLoaded=function(evt){
if(this.dimmed){
this.dim(this.layer.dimColor);
}
evt=new Evt(evt);
if(!this.isHidden){
setVisible(evt.currentTarget,true);
}
this.saMap.removeWorkItem();
this.reloading=false;
if(!this.hasAddedErrorEventListener){
this.errorDelegate=associateObjWithEvent(this,"tileLoadError");
Evt.addEventListener(this.node,"error",this.errorDelegate);
this.hasAddedErrorEventListener=true;
}
};
Tile.prototype.tileLoadError=function(evt){
evt=new Evt(evt);
setVisible(evt.currentTarget,true);
this.saMap.removeWorkItem();
this.reloading=false;
};
Tile.prototype.zoom=function(_20,_21,_22){
var _23=this.oldX+this.oldWidth/2;
var _24=this.oldY+this.oldHeight/2;
var _25=Math.round(((_23-this.saMap.mapWidth/2)*_21)+this.saMap.mapWidth/2);
var _26=Math.round(((_24-this.saMap.mapHeight/2)*_21)+this.saMap.mapHeight/2);
var _27=this.oldWidth*_21;
var _28=Math.round(this.oldWidth+(_27-this.oldWidth)*_20);
setWidth(this.node,Math.abs(_28+_22));
var _29=this.oldHeight*_21;
var _2a=Math.round(this.oldHeight+(_29-this.oldHeight)*_20);
setHeight(this.node,Math.abs(_2a+_22));
var _2b=((_25-_23)*_20)-(_28-this.oldWidth)/2;
setX(this.node,this.oldX+Math.round(_2b));
var _2c=((_26-_24)*_20)-(_2a-this.oldHeight)/2;
setY(this.node,this.oldY+Math.round(_2c));
if(this.dimFilter){
setHeight(this.dimFilter,getHeight(this.node));
setWidth(this.dimFilter,getWidth(this.node));
setX(this.dimFilter,getX(this.node));
setY(this.dimFilter,getY(this.node));
}
};
Tile.prototype.copyTilePosition=function(_2d){
setX(this.node,getX(_2d.node));
setY(this.node,getY(_2d.node));
setWidth(this.node,getWidth(_2d.node));
setHeight(this.node,getHeight(_2d.node));
};
Tile.prototype.backupPositionForZoom=function(){
this.oldX=getX(this.node);
this.oldY=getY(this.node);
this.oldWidth=getWidth(this.node);
this.oldHeight=getHeight(this.node);
};
Tile.prototype.unload=function(){
if(this.node){
try{
if(this.hasAddedErrorEventListener){
Evt.removeEventListener(this.node,"error",this.errorDelegate,false);
}
Evt.removeEventListener(this.node,"load",this.loadDelegate,false);
}
catch(e){
}
if(this.node.parentNode){
this.node.parentNode.removeChild(this.node);
}
this.node=null;
}
if(this.dimFilter){
if(this.dimFilter.parentNode){
this.dimFilter.parentNode.removeChild(this.dimFilter);
}
this.dimFilter=null;
}
};

var isIe6=typeof document.compatMode!="undefined"&&window.ActiveXObject&&typeof document.all!="undefined"&&typeof document.documentElement.style.maxHeight=="undefined";
var isIe7=typeof document.documentElement!="undefined"&&typeof document.documentElement.style.maxHeight!="undefined"&&window.ActiveXObject;
var isFireFox=typeof Array.every!="undefined";
var isSafari2=document.childNodes&&!document.all&&!navigator.taintEnabled&&!window.devicePixelRatio;
var isSafari3=document.childNodes&&!document.all&&!navigator.taintEnabled&&window.devicePixelRatio;
var isOpera=window.opera&&window.getSelection;
var isMozilla=window.getComputedStyle&&!typeof Array.every!="undefined"&&!window.opera&&!isFireFox&&!isSafari3&&!isSafari2;
function Evt(_1){
this.evt=_1?_1:window.event;
this.source=_1.target?_1.target:_1.srcElement;
this.currentTarget=_1.currentTarget?_1.currentTarget:_1.srcElement;
this.x=_1.pageX?_1.pageX:_1.clientX;
this.y=_1.pageY?_1.pageY:_1.clientY;
}
Evt.prototype.toString=function(){
return "Evt [ x = "+this.x+", y = "+this.y+" ]";
};
Evt.prototype.consume=function(){
if(this.evt.stopPropagation){
this.evt.stopPropagation();
this.evt.preventDefault();
}else{
if(this.evt.cancelBubble){
this.evt.cancelBubble=true;
this.evt.returnValue=false;
}
}
};
Evt.addEventListener=function(_2,_3,_4,_5){
if(document.addEventListener){
_2.addEventListener(_3,_4,_5);
}else{
if(document.attachEvent){
_2.attachEvent("on"+_3,_4,_5);
}else{
_2["on"+_3]=_4;
}
}
};
Evt.removeEventListener=function(_6,_7,_8,_9){
if(document.removeEventListener){
_6.removeEventListener(_7,_8,_9);
}else{
if(document.detachEvent){
_6.detachEvent("on"+_7,_8,_9);
}else{
_6["on"+_7]=null;
}
}
};
function getX(_a){
if(_a){
return parseInt(_a.style.left);
}
}
function getY(_b){
if(_b){
return parseInt(_b.style.top);
}
}
function getWidth(_c){
if(_c){
return parseInt(_c.style.width);
}
}
function getHeight(_d){
if(_d){
return parseInt(_d.style.height);
}
}
function setX(_e,x){
if(_e){
_e.style.left=x+"px";
}
}
function setY(_10,y){
if(_10){
_10.style.top=y+"px";
}
}
function setWidth(_12,w){
if(_12){
_12.style.width=w+"px";
}
}
function setHeight(_14,h){
if(_14){
_14.style.height=h+"px";
}
}
function setVisible(_16,_17){
if(_16){
_16.style.visibility=_17?"visible":"hidden";
}
}
function associateObjWithEvent(obj,_19){
return function(e){
e=e||window.event;
return obj[_19](e,this);
};
}
function associateObjWithCallback(obj,fn){
return function(){
fn.apply(obj,arguments);
};
}
function returnFalse(){
return false;
}
function cumulativeOffsetLeft(_1d){
var _1e=0;
do{
_1e+=_1d.offsetLeft||0;
_1d=_1d.offsetParent;
}while(_1d);
return _1e;
}
function cumulativeOffsetTop(_1f){
var _20=0;
do{
if(isIe6&&navigator.userAgent.indexOf("SV1")==-1&&_1f.nodeType=="DIV"&&_1f.parentNode&&_1f.parentNode.nodeType=="TD"){
_20+=0;
}else{
_20+=_1f.offsetTop||0;
}
_1f=_1f.offsetParent;
}while(_1f);
return _20;
}
function removeAllChildElements(_21){
while(_21.hasChildNodes()){
_21.removeChild(_21.firstChild);
}
}
function parseQueryString(){
var _22=new Object();
var _23=window.location.search.substring(1);
var _24=_23.split("&");
for(var i=0;i<_24.length;i++){
var pos=_24[i].indexOf("=");
if(pos>0){
var key=_24[i].substring(0,pos);
var val=unescape(_24[i].substring(pos+1));
_22[key]=val;
}
}
return _22;
}
function addClass(o,c){
if(!hasClass(o,c)){
if(o.className!=""){
o.className+=" "+c;
}else{
o.className=c;
}
}
}
function removeClass(o,c){
var rep=new RegExp("\\s?"+c+"\\b");
if(o.className.indexOf(c)!=-1){
o.className=o.className.replace(rep,"");
}
}
function hasClass(o,c){
return new RegExp("\\b"+c+"\\b").test(o.className);
}
function setImageSource(img,src){
if(isIe6){
if(src.length>4){
var _32=src.substring(src.length-4,src.length);
}
if(_32==".gif"||_32==".jpg"){
img.src=src;
return;
}
src=src.replace(/\(/g,"%28");
src=src.replace(/\)/g,"%29");
src=src.replace(/%23/g,"%2523");
img.src="/pic/blank.gif";//Kristoffer added /
img.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"',sizingMethod='image')";
}else{
img.src=src;
}
}
Array.prototype.insert=function(i,o){
if(i>=0){
var a=this.slice(0,i);
var b=this.slice(i);
return a.concat(o).concat(b);
}
};
function distance2D(_37,_38){
resultvx=Math.pow((_37.x-_38.x),2);
resultvy=Math.pow((_37.y-_38.y),2);
dist=Math.sqrt(resultvx+resultvy);
return dist;
}
function pointToLineDistance2D(_39,_3a){
var _3b=Number.MAX_VALUE;
for(var i=0;i<_3a.length-1;i++){
var A=_39.x-_3a[i].x;
var B=_39.y-_3a[i].y;
var C=_3a[i+1].x-_3a[i].x;
var D=_3a[i+1].y-_3a[i].y;
var dot=A*C+B*D;
var ls=C*C+D*D;
var u=dot/ls;
var _44=new Object();
if(u<0){
_44.x=_3a[i].x;
_44.y=_3a[i].y;
}else{
if(u>1){
_44.x=_3a[i+1].x;
_44.y=_3a[i+1].y;
}else{
_44.x=_3a[i].x+u*C;
_44.y=_3a[i].y+u*D;
}
}
var _3b=Math.min(_3b,distance2D(_44,_39));
}
return _3b;
}
function pointInPolygon2D(p,_46){
var c=false;
var j=_46.length-1;
for(i=0;i<_46.length;j=i++){
if((((_46[i].y<=p.y)&&(p.y<_46[j].y))||((_46[j].y<=p.y)&&(p.y<_46[i].y)))&&(p.x<(_46[j].x-_46[i].x)*(p.y-_46[i].y)/(_46[j].y-_46[i].y)+_46[i].x)){
c=!c;
}
}
return c;
}
function RWCPoint(x,y){
this.x=x;
this.y=y;
}
function testBrowserForRWC(){
var _4b=new Object();
if(!isMozilla&&!isIe6&&!isIe7&&!isFireFox&&!isSafari3&&!isOpera&&!isSafari2){
_4b.isSupported=false;
_4b.msg="Your browser is not supported by this version of the Carmenta Server Rich Web Client";
}else{
_4b.isSupported=true;
_4b.msg="Browser is supported";
}
return _4b;
}
function stringToBoolean(_4c,_4d){
if(_4c){
var il=_4c.toLowerCase();
if(il=="false"){
return false;
}else{
if(il=="true"){
return true;
}else{
return _4d;
}
}
}else{
return _4d;
}
}
function stringToInt(_4f,_50){
try{
_51=parseInt(_4f);
}
catch(e){
var _51=_50;
}
return _51;
}
function getPixelPositionFromEvent(evt,_53){
if(isFireFox||isMozilla||isIe6||isIe7){
return new RWCPoint(evt.x-cumulativeOffsetLeft(_53)+document.body.scrollLeft,evt.y-cumulativeOffsetTop(_53)+document.body.scrollTop);
}else{
return new RWCPoint(evt.x-cumulativeOffsetLeft(_53),evt.y-cumulativeOffsetTop(_53));
}
}
function RWCEncodePointList(_54,_55){
var i=0;
var py=0;
var px=0;
var _59="";
if(_54&&_54.length>0){
if(_54[0].x<1){
_55.value=7;
_55.factor=10000000;
}else{
if(_54[0].x<1000){
_55.value=5;
_55.factor=100000;
}else{
if(_54[0].x<100000){
_55.value=3;
_55.factor=1000;
}else{
_55.value=0;
_55.factor=1;
}
}
}
}
for(i=0;i<_54.length;++i){
var _5a=_54[i];
var y=_5a.y;
var x=_5a.x;
var ye=Math.round(y*_55.factor);
var xe=Math.round(x*_55.factor);
dy=ye-py;
dx=xe-px;
py=ye;
px=xe;
_59+=RWCEncodeSignedNumber(dy)+RWCEncodeSignedNumber(dx);
}
return _59;
}
function RWCEncodeSignedNumber(n){
var sn=n<<1;
if(n<0){
sn=~(sn);
}
return (RWCEncodeNumber(sn));
}
function RWCEncodeNumber(num){
var _62="";
while(num>=32){
_62+=(String.fromCharCode((32|(num&31))+63));
num>>=5;
}
_62+=(String.fromCharCode(num+63));
return _62;
}
function RWCClipToRectangle(_63,_64,_65,_66){
var _67=new Array();
if(!_63.boundingArea.boundingAreaInside(_64)){
return _67;
}
if(!_63.points){
return _63.point;
}else{
if(_63.points.length<2){
return _63.points;
}
}
if(_63.type=="line"){
var _68=_64.lineInside(_63.points,false);
if(_68==-1){
return null;
}
var _69=_64.lineInside(_63.points,true);
_67=_63.points.slice(_68,_69+1);
}else{
if(_63.type=="poly"){
_67=_63.points;
}
}
var _6a=Math.max((_64.maxX-_64.minX),(_64.maxY-_64.minY));
var _6b=_66;
var _6c=_6a/(_65*_6b);
while(_67.length>_65&&_67.length>4){
tmppoints=new Array();
var n=_67.length;
tmppoints.push(_67[0]);
for(var i=1;i<n-1;i++){
var _6f=_67[i];
tmppoints.push(_67[i]);
while(i<(n-2)){
var _70=distance2D(_6f,_67[i+1]);
if(_70<_6c){
i++;
}else{
break;
}
}
}
tmppoints.push(_67[n-1]);
_67=tmppoints;
_6b=_6b/1.4;
_6c=_6a/(_65*_6b);
}
return _67;
}
if(!window.XMLHttpRequest){
XMLHttpRequest=function(){
var _71=null;
try{
_71=new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e){
try{
_71=new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e){
}
}
return _71;
};
}

function View(_1){
this.saMap=_1;
if(this.saMap.viewJSON.ViewInfo.Properties){
for(var i=0;i<this.saMap.viewJSON.ViewInfo.Properties;i++){
switch(this.saMap.viewJSON.ViewInfo.Properties[i].Name){
case ("clientTileSize"):
this.saMap.config.viewSettings.tileSize=parseInt(this.saMap.viewJSON.ViewInfo.Properties[i].Value);
if(this.saMap.config.viewSettings.tileSize<0||this.saMap.config.viewSettings.tileSize>Number.MAX_VALUE||isNaN(this.saMap.config.viewSettings.tileSize)){
this.saMap.config.viewSettings.tileSize=200;
}
break;
case ("clientImageFormat"):
this.saMap.config.viewSettings.imageFormat=this.saMap.viewJSON.ViewInfo.Properties[i].Value;
break;
case ("clientBorders"):
try{
var _3=this.saMap.viewJSON.ViewInfo.Properties[i].Value.split(",");
if(_3.length==4){
for(var i=0;i<4;i++){
this.viewSettings.borders.rectangle[i]=parseFloat(_3[i]);
}
this.viewSettings.borders.geoRect=new GeoRectangle(_3[0],_3[1],_3[2],_3[3]);
}
}
catch(e){
}
}
}
}
if(this.saMap.viewJSON.ViewInfo.ReorderableLayers){
this.reorderable=stringToBoolean(this.saMap.viewJSON.ViewInfo.ReorderableLayers,false);
}
this.createLayers();
}
View.prototype.createLayers=function(){
this.layerArray=new Array();
this.overlayArray=new Array();
var _4=0;
if(!this.saMap.viewJSON.ViewInfo.Layers||this.saMap.viewJSON.ViewInfo.Layers.length==0){
var _5=new Layer("","","server",0,this.saMap,true,false,false);
this.layerArray.push(_5);
return;
}
for(var i=0;i<this.saMap.viewJSON.ViewInfo.Layers.length;i++){
var id=this.saMap.viewJSON.ViewInfo.Layers[i].Layer.Id;
var _8=this.saMap.viewJSON.ViewInfo.Layers[i].Layer.Name;
var _9="";
var _a=false;
var _b=true;
var _c=true;
var _d="combinedImage";
var _e=false;
var _f=false;
if(this.saMap.viewJSON.ViewInfo.Layers[i].Layer.Properties){
for(var j=0;j<this.saMap.viewJSON.ViewInfo.Layers[i].Layer.Properties.length;j++){
switch(this.saMap.viewJSON.ViewInfo.Layers[i].Layer.Properties[j].Name){
case ("rwcTemplate"):
_9=this.saMap.viewJSON.ViewInfo.Layers[i].Layer.Properties[j].Value;
break;
case ("rwcSearch"):
_a=stringToBoolean(this.saMap.viewJSON.ViewInfo.Layers[i].Layer.Properties[j].Value,false);
break;
case ("rwcUseLayerControl"):
_b=stringToBoolean(this.saMap.viewJSON.ViewInfo.Layers[i].Layer.Properties[j].Value,true);
break;
case ("rwcTiled"):
_c=stringToBoolean(this.saMap.viewJSON.ViewInfo.Layers[i].Layer.Properties[j].Value,true);
break;
case ("rwcType"):
_d=this.saMap.viewJSON.ViewInfo.Layers[i].Layer.Properties[j].Value;
break;
case ("rwcRouteSearch"):
_e=stringToBoolean(this.saMap.viewJSON.ViewInfo.Layers[i].Layer.Properties[j].Value,false);
break;
case ("rwcAllowClientObjects"):
_f=stringToBoolean(this.saMap.viewJSON.ViewInfo.Layers[i].Layer.Properties[j].Value,false);
break;
}
}
}
if(_d){
switch(_d){
case ("background"):
if(isIe6&&this.saMap.config.viewSettings.imageFormat=="png"){
if(this.layerArray.length>0){
this.layerArray[this.layerArray.length-1].merge(id,_8,_b,_f);
}else{
var _11=new Layer(id,_8,"combinedImage",i,this.saMap,true,_b,_e,_f);
this.layerArray.push(_11);
}
}else{
var _11=new Layer(id,_8,_d,i,this.saMap,_c,false,_e,_f);
this.layerArray.push(_11);
_4++;
}
break;
case ("individualImage"):
if(isIe6&&this.saMap.config.viewSettings.imageFormat=="png"){
if(this.layerArray.length>0){
this.layerArray[this.layerArray.length-1].merge(id,_8,_b,_f);
}else{
var _11=new Layer(id,_8,"combinedImage",i,this.saMap,true,_b,_e,_f);
this.layerArray.push(_11);
}
}else{
var _11=new Layer(id,_8,_d,i,this.saMap,_c,_b,_e,_f);
this.layerArray.push(_11);
}
break;
case ("objects"):
if(!this.saMap.config.viewSettings.disableObjectLayers){
var _11=new OverlayLayer(id,_8,i,this.saMap,_a,_b,_e);
var _12=this.saMap.config.getLayerConfiguration(_9);
_11.createDefaults(_12,this.saMap.viewJSON.ViewInfo.Layers[i].Layer);
this.overlayArray.push(_11);
}
break;
default:
if(isIe6&&this.saMap.config.viewSettings.imageFormat=="png"){
if(this.layerArray.length>0){
this.layerArray[this.layerArray.length-1].merge(id,_8,_b,_f);
}else{
var _11=new Layer(id,_8,"combinedImage",i,this.saMap,true,_b,_e,_f);
this.layerArray.push(_11);
}
}else{
if(this.layerArray.length>0&&this.layerArray[this.layerArray.length-1].type=="combinedImage"&&(this.layerArray[this.layerArray.length-1].isNonTileLayer!=_c)){
this.layerArray[this.layerArray.length-1].merge(id,_8,_b,_f);
}else{
var _11=new Layer(id,_8,"combinedImage",i,this.saMap,_c,_b,_e,_f);
this.layerArray.push(_11);
}
}
break;
}
}else{
if(isIe6&&this.saMap.config.viewSettings.imageFormat=="png"){
if(this.layerArray.length>0){
this.layerArray[this.layerArray.length-1].merge(id,_8,_b,_f);
}else{
var _11=new Layer(id,_8,"combinedImage",i,this.saMap,true,_b,_e,_f);
this.layerArray.push(_11);
}
}else{
if(this.layerArray.length>0&&this.layerArray[this.layerArray.length-1].type=="combinedImage"&&(this.layerArray[this.layerArray.length-1].isNonTileLayer!=_c)){
this.layerArray[this.layerArray.length-1].merge(id,_8,_b,_f);
}else{
var _11=new Layer(id,_8,"combinedImage",i,this.saMap,_c,_b,_e,_f);
this.layerArray.push(_11);
}
}
}
}
};
View.prototype.moveOverlayLayer=function(_13,_14){
if(_13<_14){
this.overlayArray.splice(_14+1,0,this.overlayArray[_13]);
this.overlayArray.splice(_13,1);
}else{
this.overlayArray.splice(_14,0,this.overlayArray[_13]);
this.overlayArray.splice(_13+1,1);
}
};
View.prototype.createTiles=function(_15,_16,_17,_18){
if(!this.layerArray){
return;
}
for(var i=0;i<this.layerArray.length;i++){
if(this.layerArray[i].isNonTileLayer){
var _1a=Math.max(this.saMap.mapWidth,this.saMap.mapHeight);
_1a=_1a+this.saMap.config.GUI.padding;
var _1b=this.saMap.tileGeoWidth*(_1a/this.saMap.tileSize);
this.layerArray[i].createTiles(_15,_16,_17,_18,_1a,_1b,i);
}else{
this.layerArray[i].createTiles(_15,_16,_17,_18,this.saMap.tileSize,this.saMap.tileGeoWidth,i);
}
}
};
View.prototype.setTileGeoWidth=function(_1c){
for(var i=0;i<this.layerArray.length;i++){
if(this.layerArray[i].isNonTileLayer){
var _1e=Math.max(this.saMap.mapWidth,this.saMap.mapHeight);
_1e=_1e+this.saMap.config.GUI.padding;
this.layerArray[i].tileGeoWidth=_1c*(_1e/this.saMap.tileSize);
}else{
this.layerArray[i].tileGeoWidth=_1c;
}
}
};
View.prototype.updateSearchControls=function(){
for(var i=0;i<this.overlayArray.length;i++){
if(this.overlayArray[i].searchEnabled){
this.overlayArray[i].updateSearchControl();
}
}
};
View.prototype.getTilesGeoBoundingBox=function(){
for(var i=0;i<this.layerArray.length;i++){
if(!this.layerArray[i].isNonTileLayer){
return this.layerArray[i].getTilesGeoBoundingBox();
}
}
return null;
};
View.prototype.updateNonTiledLayers=function(){
for(var i=0;i<this.layerArray.length;i++){
if(this.layerArray[i].isNonTileLayer){
this.layerArray[i].updateSingleTile(this.layerArray[i].buffer);
}
}
};
View.prototype.draw=function(){
for(var i=0;i<this.layerArray.length;i++){
this.layerArray[i].draw();
}
for(var j=0;j<this.overlayArray.length;j++){
this.overlayArray[j].draw();
}
};
View.prototype.pixelOffset=function(_24,_25){
for(var i=0;i<this.layerArray.length;i++){
this.layerArray[i].pixelOffset(_24,_25);
}
for(var i=0;i<this.overlayArray.length;i++){
this.overlayArray[i].pixelOffset(_24,_25);
}
};
View.prototype.updateCanvas=function(){
for(var i=0;i<this.overlayArray.length;i++){
this.overlayArray[i].updateCanvas();
}
};
View.prototype.updateTooltips=function(x,y){
if(this.saMap.activeinfoBoxObject&&this.saMap.activeinfoBoxObject.infoBoxSelected){
return;
}
var _2a=new Array();
var _2b=false;
for(var i=0;i<this.overlayArray.length;i++){
if(this.overlayArray[i].geoObjectArray){
for(var j=this.overlayArray[i].geoObjectArray.length-1;j>=0;j--){
if(this.overlayArray[i].geoObjectArray[j].boundingArea&&!this.overlayArray[i].isHidden&&!this.overlayArray[i].geoObjectArray[j].isHidden){
var _2e=this.overlayArray[i].geoObjectArray[j].boundingArea.inside(x,y);
if(_2e){
if(this.lastSelectedGeoObject){
var _2f={enter:false,geoObject:this.lastSelectedGeoObject};
_2a.push(_2f);
}
_2b=true;
if(this.saMap.activeinfoBoxObject&&!this.saMap.activeinfoBoxObject.infoBoxElement.active){
this.saMap.activeinfoBoxObject.useNormalIcon();
this.saMap.activeinfoBoxObject=null;
}
if(this.overlayArray[i].geoObjectArray[j].infoBoxElement.active&&!this.saMap.lookingGlass){
if(this.overlayArray[i].geoObjectArray[j].hasInfoBox||this.overlayArray[i].geoObjectArray[j].infoBoxTimeout){
this.overlayArray[i].geoObjectArray[j].displayInfoBox(this.overlayArray[i].geoObjectArray[j].infoBoxTimeout);
}else{
this.overlayArray[i].geoObjectArray[j].displayInfoBox(1000);
}
}else{
if(this.saMap.activeinfoBoxObject){
this.saMap.activeinfoBoxObject.cancelInfoBox();
}
this.saMap.activeinfoBoxObject=this.overlayArray[i].geoObjectArray[j];
this.overlayArray[i].geoObjectArray[j].useSelectedIcon();
}
this.saMap.mapContainer.style.cursor="pointer";
var _30={enter:true,geoObject:this.overlayArray[i].geoObjectArray[j]};
_2a.push(_30);
this.lastSelectedGeoObject=this.overlayArray[i].geoObjectArray[j];
return _2a;
}
}
}
}
}
if(!_2b&&this.lastSelectedGeoObject){
var _2f={enter:false,geoObject:this.lastSelectedGeoObject};
_2a.push(_2f);
this.lastSelectedGeoObject=null;
}
if(!_2b&&this.saMap.activeinfoBoxObject&&!this.saMap.activeinfoBoxObject.infoBoxElement.active){
this.saMap.activeinfoBoxObject.useNormalIcon();
this.saMap.activeinfoBoxObject=null;
}
this.saMap.mapContainer.style.cursor="auto";
if(this.saMap.activeinfoBoxObject&&!this.saMap.activeinfoBoxObject.infoBoxSelected&&!this.saMap.activeinfoBoxObject.hideObjectInfoTimer&&this.saMap.activeinfoBoxObject.infoBoxElement.active){
if(this.saMap.activeinfoBoxObject.infoBoxTimeout){
this.saMap.activeinfoBoxObject.setInfoTimer(this.saMap.activeinfoBoxObject.infoBoxTimeout);
}else{
this.saMap.activeinfoBoxObject.setInfoTimer(1000);
}
}
return _2a;
};
View.prototype.offset=function(_31,_32){
for(var i=0;i<this.layerArray.length;i++){
this.layerArray[i].offset(_31,_32);
}
};
View.prototype.refresh=function(_34){
for(var i=0;i<this.layerArray.length;i++){
this.layerArray[i].refresh();
}
for(var i=0;i<this.overlayArray.length;i++){
this.overlayArray[i].refresh(_34);
}
};
View.prototype.getLayerId=function(_36){
if(typeof (this.layerArray[_36])!="undefined"){
var _37=this.layerArray[_36].getVisibleLayersID();
if(_37==null){
return null;
}else{
return _37;
}
}else{
return "";
}
};
View.prototype.getLayerById=function(id){
for(var i=0;i<this.layerArray.length;i++){
for(var j=0;j<this.layerArray[i].sublayerID.length;j++){
if(id==this.layerArray[i].sublayerID[j].id){
return this.layerArray[i];
}
}
}
for(var i=0;i<this.overlayArray.length;i++){
if(id==this.overlayArray[i].id){
return this.overlayArray[i];
}
}
return null;
};
View.prototype.getObjectLayerById=function(id){
for(var i=0;i<this.overlayArray.length;i++){
if(id==this.overlayArray[i].id){
return this.overlayArray[i];
}
}
return null;
};
View.prototype.startZoom=function(){
if(this.zoomContainer){
this.zoomContainer.parentNode.removeChild(this.zoomContainer);
}
this.zoomContainer=document.createElement("div");
this.zoomContainer.className="rwcLayerContainer";
this.zoomContainer.style.left="0px";
this.zoomContainer.style.top="0px";
setVisible(this.zoomContainer,true);
for(var i=0;i<this.layerArray.length;i++){
this.layerArray[i].startZoom(this.zoomContainer);
}
this.saMap.mapContainer.appendChild(this.zoomContainer);
};
View.prototype.endZoom=function(){
for(var i=0;i<this.layerArray.length;i++){
this.layerArray[i].endZoom();
}
if(this.zoomContainer){
this.zoomContainer.style.zIndex="-10000";
}
for(var i=0;i<this.layerArray.length;i++){
if(this.layerArray[i].zoomDim){
this.layerArray[i].zoomDim.parentNode.removeChild(this.layerArray[i].zoomDim);
this.layerArray[i].zoomDim=null;
}
}
};
View.prototype.zoom=function(_3f){
for(var i=0;i<this.layerArray.length;i++){
this.layerArray[i].zoom(_3f);
}
};
View.prototype.showLayer=function(id){
var _42=this.getObjectLayerById(id);
if(_42){
_42.show();
}else{
for(var i=0;i<this.layerArray.length;i++){
this.layerArray[i].show(id);
}
}
};
View.prototype.hideLayer=function(id){
var _45=this.getObjectLayerById(id);
if(_45){
_45.hide();
}else{
for(var i=0;i<this.layerArray.length;i++){
this.layerArray[i].hide(id);
}
}
};
View.prototype.hideObjectLayers=function(){
for(var i=0;i<this.overlayArray.length;i++){
setVisible(this.overlayArray[i].container,false);
if(this.overlayArray[i].objectCanvas){
setVisible(this.overlayArray[i].objectCanvas,false);
}
}
};
View.prototype.showObjectLayers=function(){
for(var i=0;i<this.overlayArray.length;i++){
if(!this.saMap.layerControl){
setVisible(this.overlayArray[i].container,true);
setVisible(this.overlayArray[i].objectCanvas,true);
}else{
if(this.saMap.layerControl.isVisible(this.overlayArray[i].id)||!this.overlayArray[i].useLayerControl){
setVisible(this.overlayArray[i].container,true);
setVisible(this.overlayArray[i].objectCanvas,true);
}
}
if(this.overlayArray[i].geoObjectArray){
if(!this.overlayArray[i].isHidden){
for(var j=0;j<this.overlayArray[i].geoObjectArray.length;j++){
if(!this.overlayArray[i].geoObjectArray[j].isHidden&&this.overlayArray[i].geoObjectArray[j].clientNode){
setVisible(this.overlayArray[i].geoObjectArray[j].clientNode,true);
}
}
}
}
}
};
View.prototype.updateOverlays=function(){
for(var i=0;i<this.overlayArray.length;i++){
this.overlayArray[i].refresh(false);
}
};
View.prototype.getGeoObjects=function(_4b,_4c,_4d,_4e){
for(var i=0;i<this.overlayArray.length;i++){
if(!this.overlayArray[i].noUpdate){
if(!this.overlayArray[i].useLayerControl||!this.saMap.layerControl||this.saMap.layerControl.isVisible(this.overlayArray[i].id)){
if(!this.overlayArray[i].searchEnabled||(this.overlayArray[i].searchControl&&this.overlayArray[i].searchControl.isAutomatic)){
if(this.overlayArray[i].configuration.downloadBehavior.initiation!="manual"){
this.overlayArray[i].getGeoObjects(this.saMap.mapServerUrl,this.saMap,_4b,_4c,_4d,_4e);
}
}
}
}
}
};
View.prototype.unload=function(){
for(var i=0;i<this.layerArray.length;i++){
this.layerArray[i].unload();
}
for(var i=0;i<this.overlayArray.length;i++){
this.overlayArray[i].unload();
}
};

function ViewInfo(_1,_2,_3){
this.viewName=_2;
this.saMap=_1;
this.getViewsXmlHttp=new XMLHttpRequest();
this.getViewsXmlHttp.open("GET",_3+"RWCInterface.axd?request=GetViews",true);
this.getViewsXmlHttp.onreadystatechange=associateObjWithCallback(this,this.onGetViewsResponse);
this.getViewsXmlHttp.send("");
}
ViewInfo.prototype.onGetViewsResponse=function(){
if(this.getViewsXmlHttp.readyState==4){
if(this.getViewsXmlHttp.responseXML){
this.viewInfoNode=this.getViewsXmlHttp.responseXML.selectSingleNode("//ViewInfo[Id='"+this.viewName+"']");
this.saMap.initialize();
}else{
}
this.getViewsXmlHttp=null;
}
};
ViewInfo.prototype.getLayerNode=function(){
var _4=this.viewInfoNode.selectSingleNode("Layers");
return _4;
};
ViewInfo.prototype.unload=function(){
this.getViewsXmlHttp=null;
};

function ViewList(_1,_2,_3){
this.viewContainer=document.getElementById(_2);
this.viewContainer.innerHTML="";
this.loadingBox=document.getElementById(_3);
this.loadingBox.innerHTML="<h2>Loading available views...</h2>";
this.getViewXmlHttp=new XMLHttpRequest();
this.getViewXmlHttp.onreadystatechange=associateObjWithCallback(this,this.onGetViewsResponse);
this.getViewXmlHttp.open("GET",_1+"RWCInterface.axd?request=GetViews&responseType=JSON",true);
this.getViewXmlHttp.send("");
}
ViewList.prototype.onGetViewsResponse=function(){
if(this.getViewXmlHttp.readyState==4){
if(this.getViewXmlHttp.responseText){
try{
this.json=eval("("+this.getViewXmlHttp.responseText+")");
}
catch(e){
return;
}
var _4=this.json.ViewInfos;
var _5="<p>The following maps are available:";
for(i=0;i<this.json.ViewInfos.length;i++){
_5+="<dl><dt><a href='map.aspx?id="+this.json.ViewInfos[i].ViewInfo.Id+"'>";
_5+=this.json.ViewInfos[i].ViewInfo.Name;
+"</a></dt>";
_5+="<dd>"+this.json.ViewInfos[i].ViewInfo.Description+"</dd></dl>";
}
_5+="</p>";
this.viewContainer.innerHTML+=_5;
this.viewContainer.style.visibility="visible";
this.loadingBox.style.visibility="hidden";
this.loadingBox.innerHTML="";
}
this.getViewsXmlHttp=null;
}
};
ViewList.prototype.unload=function(){
if(this.getViewsXmlHttp){
this.getViewsXmlHttp=null;
}
};

function ZoomControl(_1,_2,_3){
this.saMap=_1;
this.container=document.createElement("div");
this.container.id=_3+"ZoomControl";
addClass(this.container,this.saMap.config.GUI.zoomControl.css);
this.zoomLevelGeoWidths=new Array();
this.zoomLevelElements=new Array();
this.zoomOutButton=document.createElement("img");
this.saMap.config.GUI.zoomControl.zoomOutButton.applyConfiguration(this.zoomOutButton);
this.zoomOutClickDelegate=associateObjWithEvent(this,"zoomOutClicked");
Evt.addEventListener(this.zoomOutButton,"click",this.zoomOutClickDelegate);
this.container.appendChild(this.zoomOutButton);
if(this.saMap.fixedScales){
for(var i=this.saMap.fixedTileGeoWidths.length-1;i>=0;i--){
var _5=document.createElement("img");
this.saMap.config.GUI.zoomControl.zoomScaleElement.applyConfiguration(_5);
_5.zoomLevelClickDelegate=associateObjWithEvent(this,"zoomLevelClicked");
Evt.addEventListener(_5,"click",_5.zoomLevelClickDelegate);
this.container.appendChild(_5);
this.zoomLevelGeoWidths[i]=this.saMap.fixedTileGeoWidths[i];
if(this.saMap.tileGeoWidth==this.zoomLevelGeoWidths[i]){
this.selectedZoomLevel=i;
}
this.zoomLevelElements[i]=_5;
}
this.scaleMarker=document.createElement("img");
this.scaleMarker.className="rwcScaleMarker";
this.saMap.config.GUI.zoomControl.zoomScaleMarker.applyConfiguration(this.scaleMarker);
this.dragDelegate=associateObjWithEvent(this,"markerDrag");
this.endDragDelegate=associateObjWithEvent(this,"markerEndDrag");
this.beginDragDelegate=associateObjWithEvent(this,"markerBeginDrag");
Evt.addEventListener(this.scaleMarker,"mousedown",this.beginDragDelegate);
if(isIe6||isIe7){
this.ieDragDelegate=associateObjWithEvent(this,"cancelEvent");
Evt.addEventListener(this.scaleMarker,"dragstart",this.ieDragDelegate);
}
setVisible(this.scaleMarker,false);
}
this.zoomInButton=document.createElement("img");
this.saMap.config.GUI.zoomControl.zoomInButton.applyConfiguration(this.zoomInButton);
this.zoomInClickDelegate=associateObjWithEvent(this,"zoomInClicked");
Evt.addEventListener(this.zoomInButton,"click",this.zoomInClickDelegate);
this.container.appendChild(this.zoomInButton);
setVisible(this.container,true);
_2.appendChild(this.container);
if(this.saMap.fixedScales){
this.container.appendChild(this.scaleMarker);
this.scaleMarkerOffsetX=(this.zoomLevelElements[0].offsetWidth-this.scaleMarker.offsetWidth)/2;
this.scaleMarkerOffsetY=(this.zoomLevelElements[0].offsetHeight-this.scaleMarker.offsetHeight)/2;
this.updateMarker();
setVisible(this.scaleMarker,true);
}
}
ZoomControl.prototype.cancelEvent=function(){
window.event.returnValue=false;
};
ZoomControl.prototype.zoomLevelClicked=function(_6,_7){
_6=new Evt(_6);
var _8=_6.currentTarget;
for(var i=0;i<this.zoomLevelElements.length;i++){
if(this.zoomLevelElements[i]==_8){
this.selectedZoomLevel=i;
this.saMap.setTileGeoWidth(this.zoomLevelGeoWidths[i],false);
break;
}
}
this.updateMarker();
};
ZoomControl.prototype.markerBeginDrag=function(_a,_b){
_a=new Evt(_a);
this.markerStartX=parseInt(this.scaleMarker.style.left);
this.markerStartY=parseInt(this.scaleMarker.style.top);
this.clickX=_a.x;
this.clickY=_a.y;
if(this.zoomLevelElements[0].offsetTop!=this.zoomLevelElements[1].offsetTop){
this.vertical=true;
}
this.dragging=true;
Evt.addEventListener(document,"mousemove",this.dragDelegate,false);
Evt.addEventListener(document,"mouseup",this.endDragDelegate,false);
_a.consume();
};
ZoomControl.prototype.markerDrag=function(_c,_d){
if(!this.dragging){
return;
}
_c=new Evt(_c);
if(this.vertical){
var _e=_c.y-this.clickY;
var _f=this.zoomLevelElements[0].offsetHeight*(this.zoomLevelElements.length-1);
var _10=this.selectedZoomLevel*this.zoomLevelElements[0].offsetHeight;
if(_e>_10){
_e=_10;
}
if(_e<_10-_f){
_e=_10-_f;
}
var _11=this.markerStartY+_e;
setY(this.scaleMarker,_11);
}else{
var _12=_c.x-this.clickX;
var _f=this.zoomLevelElements[0].offsetWidth*(this.zoomLevelElements.length-1);
var _10=this.selectedZoomLevel*this.zoomLevelElements[0].offsetWidth;
if(_12>_10){
_12=_10;
}
if(_12<_10-_f){
_12=_10-_f;
}
var _13=this.markerStartX+_12;
setX(this.scaleMarker,_13);
}
_c.consume();
};
ZoomControl.prototype.markerEndDrag=function(evt,_15){
evt=new Evt(evt);
if(this.vertical){
var _16=evt.y-this.clickY;
newScale=Math.round(this.selectedZoomLevel-_16/this.zoomLevelElements[0].offsetHeight);
}else{
var _17=evt.x-this.clickX;
newScale=Math.round(this.selectedZoomLevel-_17/this.zoomLevelElements[0].offsetWidth);
}
if(newScale<0){
newScale=0;
}else{
if(newScale>this.zoomLevelElements.length-1){
newScale=this.zoomLevelElements.length-1;
}
}
Evt.removeEventListener(document,"mousemove",this.dragDelegate,false);
Evt.removeEventListener(document,"mouseup",this.endDragDelegate,false);
this.dragging=false;
if(this.selectedZoomLevel!=newScale){
this.selectedZoomLevel=newScale;
this.saMap.setTileGeoWidth(this.zoomLevelGeoWidths[this.selectedZoomLevel],false);
}
this.updateMarker();
};
ZoomControl.prototype.markerAbortDrag=function(){
if(this.dragging){
Evt.removeEventListener(document,"mousemove",this.dragDelegate,false);
Evt.removeEventListener(document,"mouseup",this.endDragDelegate,false);
this.dragging=false;
this.updateMarker();
}
};
ZoomControl.prototype.moveToZoomLevel=function(_18){
for(var i=0;i<this.zoomLevelGeoWidths.length;i++){
if(this.zoomLevelGeoWidths[i]==_18){
this.markerAbortDrag();
this.selectedZoomLevel=i;
this.saMap.setTileGeoWidth(this.zoomLevelGeoWidths[i],false);
this.updateMarker();
break;
}
}
};
ZoomControl.prototype.refreshZoomLevel=function(_1a){
for(var i=0;i<this.zoomLevelGeoWidths.length;i++){
if(this.zoomLevelGeoWidths[i]==_1a){
this.markerAbortDrag();
this.selectedZoomLevel=i;
this.updateMarker();
break;
}
}
};
ZoomControl.prototype.zoomInClicked=function(evt,_1d){
this.zoomIn();
};
ZoomControl.prototype.zoomOutClicked=function(evt,_1f){
this.zoomOut();
};
ZoomControl.prototype.zoomIn=function(){
if(this.saMap.fixedScales){
this.markerAbortDrag();
if(this.selectedZoomLevel>0){
this.selectedZoomLevel--;
this.updateMarker();
this.saMap.zoomIn();
}
}else{
this.saMap.zoomIn();
}
};
ZoomControl.prototype.zoomOut=function(){
if(this.saMap.fixedScales){
this.markerAbortDrag();
if(this.selectedZoomLevel<this.zoomLevelElements.length-1){
this.selectedZoomLevel++;
this.saMap.zoomOut();
this.updateMarker();
}
}else{
this.saMap.zoomOut();
}
};
ZoomControl.prototype.updateMarker=function(){
if(this.scaleMarker){
var _20=this.zoomLevelElements[this.selectedZoomLevel].offsetLeft+this.scaleMarkerOffsetX;
var _21=this.zoomLevelElements[this.selectedZoomLevel].offsetTop+this.scaleMarkerOffsetY;
setX(this.scaleMarker,_20);
setY(this.scaleMarker,_21);
}
};
ZoomControl.prototype.unload=function(){
try{
Evt.removeEventListener(this.zoomOutButton,"click",this.zoomOutClickDelegate,false);
Evt.removeEventListener(this.zoomInButton,"click",this.zoomInClickDelegate,false);
Evt.removeEventListener(this.scaleMarker,"mousedown",this.beginDragDelegate,false);
if(typeof (this.zoomLevelElements)!="undefinded"){
for(var i=0;i<this.zoomLevelElements.length;i++){
Evt.removeEventListener(this.zoomLevelElements[i],"click",this.zoomLevelElements[i].zoomLevelClickDelegate,false);
}
}
if(this.dragging){
Evt.removeEventListener(document,"mousemove",this.dragDelegate,false);
Evt.removeEventListener(document,"mouseup",this.endDragDelegate,false);
}
if(isIe6||isIe7){
Evt.removeEventListener(this.scaleMarker,"dragstart",this.ieDragDelegate,false);
}
}
catch(e){
}
};

function MeasureDistance(_1,_2){
this.saMap=_1;
this.prefix=_2;
this.measureState=0;
}
MeasureDistance.prototype.click=function(_3,_4){
var _5=this.saMap.getPosition(_3,_4);
if(this.measureState==0){
if(!this.layer){
this.layer=this.saMap.addObjectLayer(this.prefix+"MeasureLayer","measureTool");
}
this.pointArray=new Array();
this.startPoint=_5;
this.pointArray[0]=this.saMap.createGeoObject(_5.x,_5.y,this.prefix+"StartPoint",this.prefix+"MeasureLayer","point",null);
this.pointArray[0].setAttribute("name",this.saMap.config.GUI.strings.startPoint);
this.pointArray[0].activate();
this.distanceArray=new Array();
this.distanceArray[0]=this.startPoint;
this.measureState=1;
}else{
if(this.measureState>0){
var _6=new Array();
for(var i=0;i<this.measureState;i++){
_6.push(this.saMap.point(this.pointArray[i].point.x,this.pointArray[i].point.y));
}
_6.push(this.saMap.point(_5.x,_5.y));
if(!this.line){
this.line=this.saMap.createGeoObject(0,0,this.prefix+"measureLine",this.prefix+"MeasureLayer","line",_6);
this.line.activate();
}else{
this.line.setPosition(0,0,_6);
this.layer.updateCanvas();
}
this.endPoint=_5;
this.pointArray[this.measureState]=this.saMap.createGeoObject(this.endPoint.x,this.endPoint.y,this.prefix+"mpoint"+this.measureState,this.prefix+"MeasureLayer","point",null);
this.pointArray[this.measureState].activate();
this.distanceArray[this.measureState]=this.endPoint;
this.measureCallbackDelegate=associateObjWithCallback(this,this.measureCallback);
this.saMap.getDistances(this.distanceArray,this.measureCallbackDelegate);
this.measureState++;
}else{
this.cancel();
}
}
};
MeasureDistance.prototype.update=function(_8){
if(this.measureState>0){
this.layer.refresh();
}
};
MeasureDistance.prototype.cancel=function(){
if(this.layer){
for(var i=0;i<this.pointArray.length;i++){
this.saMap.removeGeoObject(this.pointArray[i].id,this.prefix+"MeasureLayer");
}
if(this.line){
this.saMap.removeGeoObject(this.line.id,this.prefix+"MeasureLayer");
this.line=null;
}
this.layer.draw();
}
this.measureState=0;
};
MeasureDistance.prototype.measureCallback=function(_a){
if(this.measureState==0||!_a){
return;
}
if(_a.length<this.pointArray.length){
n=_a.length;
}else{
return;
}
this.totalDistance=0;
this.distances=_a;
for(var i=0;i<n;i++){
var _c=Math.round(_a[i]);
if(_c>1000000){
var _d=Math.round(_c*0.0001)*10+" km";
}else{
if(_c>1000){
var _d=(_c*0.001).toFixed(1)+" km";
}else{
var _d=_c+" m";
}
}
this.totalDistance+=_c;
if(this.totalDistance>1000000){
var _e=Math.round(this.totalDistance*0.0001)*10+" km";
}else{
if(_c>1000){
var _e=(this.totalDistance*0.001).toFixed(1)+" km";
}else{
var _e=this.totalDistance+" m";
}
}
this.pointArray[i+1].setAttribute("distance",_d+" ("+_e+")");
}
};
function RouteSearch(_f,_10){
this.saMap=_f;
this.prefix=_10;
this.routeState=0;
}
RouteSearch.prototype.click=function(_11,_12){
var _13=this.saMap.getPosition(_11,_12);
if(this.routeState==0){
if(this.saMap.routeLayer){
this.saMap.routeLayer.addAttribute("infoMode","full");
if(!this.routeObjectLayer){
this.routeObjectLayer=this.saMap.addObjectLayer(this.prefix+"RouteLayer","measureTool");
}
}else{
return;
}
this.startPoint=_13;
this.startObject=this.saMap.createGeoObject(_13.x,_13.y,this.prefix+"StartPoint",this.routeObjectLayer.id,"point",null);
this.startObject.setAttribute("id",this.saMap.config.GUI.strings.endPoint);
this.startObject.activate();
points=new Array();
point1=this.saMap.point(_13.x,_13.y);
point2=this.saMap.point(_13.x,_13.y);
points.push(point1);
points.push(point2);
this.line=this.saMap.createGeoObject(0,0,this.prefix+"routeLine",this.routeObjectLayer.id,"line",points);
this.line.activate();
this.routeState=1;
}else{
if(this.routeState==1){
this.saMap.removeGeoObject(this.startObject.id,this.routeObjectLayer.id);
this.saMap.removeGeoObject(this.line.id,this.routeObjectLayer.id);
this.routeObjectLayer.draw();
this.startObject=null;
this.line=null;
this.endPoint=_13;
this.saMap.routeLayer.addAttribute("startpoint",this.startPoint.x+","+this.startPoint.y);
this.saMap.routeLayer.addAttribute("endpoint",this.endPoint.x+","+this.endPoint.y);
this.saMap.routeLayer.refresh(true);
this.saMap.routeLayer.resetDrivingDirections();
this.saMap.routeLayer.showDrivingDirections(true);
this.routeState=0;
}else{
this.cancel();
}
}
};
RouteSearch.prototype.update=function(_14){
if(this.routeState==1){
var _15=new Array();
var _16=this.saMap.point(this.startObject.point.x,this.startObject.point.y);
var _17=this.saMap.point(_14.x,_14.y);
_15.push(_16);
_15.push(_17);
this.line.setPosition(0,0,_15);
this.routeObjectLayer.draw();
}
};
RouteSearch.prototype.cancel=function(){
if(this.routeObjectLayer){
if(this.startObject){
this.saMap.removeGeoObject(this.startObject.id,this.routeObjectLayer.id);
}
if(this.line){
this.saMap.removeGeoObject(this.line.id,this.routeObjectLayer.id);
}
this.saMap.routeLayer.removeAttribute("startpoint");
this.saMap.routeLayer.removeAttribute("endpoint");
this.startObject=null;
this.line=null;
this.routeObjectLayer.draw();
}
this.routeState=0;
};

// position.js: make edge-positioning work on IE/Win
// version 0.5, 15-Jul-2003
// written by Andrew Clover <and@doxdesk.com>, use freely

/*@cc_on
@if (@_win32 && @_jscript_version>4)

var position_h= new Array();
var position_v= new Array();
var position_viewport;
var position_width= 0;
var position_height= 0;
var position_fontsize= 0;
var position_ARBITRARY= 200;

// Binding. Called on each new element; if the it's <body>, initialise script.
// Check all new elements to see if they need our help, make lists of them

function position_bind(el) {
  if (!position_viewport) {
    if (!document.body) return;
    // initialisation
    position_viewport= (document.compatMode=='CSS1Compat') ?
      document.documentElement : document.body;
    window.attachEvent('onresize', position_delayout);
    var em= document.createElement('div');
    em.setAttribute('id', 'position_em');
    em.style.position= 'absolute'; em.style.visibility= 'hidden';
    em.style.fontSize= 'xx-large'; em.style.height= '5em';
    em.style.top='-5em'; em.style.left= '0';
      em.style.width = position_checkFont();
//    em.style.setExpression('width', 'position_checkFont()');
    document.body.appendChild(em);
  }

  // check for absolute edge-positioned elements (ignore ones from fixed.js!)
  var st= el.style; var cs= el.currentStyle;
  if (cs.position=='absolute' && !st.fixedPWidth) {
    if (cs.left!='auto' && cs.right!='auto') {
      position_h[position_h.length]= el;
      st.position_width= position_ARBITRARY;
      st.width= st.position_width+'px';
      position_delayout();
    }
    if (cs.top!='auto' && cs.bottom!='auto') {
      position_v[position_v.length]= el;
      st.position_height= position_ARBITRARY;
      st.height= st.position_height+'px';
      position_delayout();
  } }
}

function position_checkFont() { position_delayout(); return '1em'; }

// Layout. For each edge-positioned axis, measure difference between min-edge
// and max-edge positioning, set size to the difference

// Request re-layout at next available moment
var position_delaying= false;
function position_delayout() {
  if (position_delaying) return;
  position_delaying= true;
  window.setTimeout(position_layout, 0);
}

function position_layout() {
  position_delaying= false;
  var i, el, st, pos, tmp;
  var fs= document.all['position_em'].offsetWidth;
  var newfs= (position_fontsize!=fs && position_fontsize!=0);
  position_fontsize= fs;

  // horizontal axis
  if (position_viewport.clientWidth!=position_width || newfs) {
    position_width= position_viewport.clientWidth;
    for (i= position_h.length; i-->0;) {
      el= position_h[i]; st= el.style; cs= el.currentStyle;
      pos= el.offsetLeft; tmp= cs.left; st.left= 'auto';
      st.position_width+= el.offsetLeft-pos; st.left= tmp;
      if (st.position_width<1) st.position_width= 1;
      st.width= st.position_width+'px';
  } }
  // vertical axis
  if (position_viewport.clientHeight!=position_height || newfs) {
    position_height= position_viewport.clientHeight;
    for (i= position_v.length; i-->0;) {
      el= position_v[i]; st= el.style; cs= el.currentStyle;
      pos= el.offsetTop; tmp= cs.top; st.top= 'auto';
      st.position_height+= el.offsetTop-pos; st.top= tmp;
      if (st.position_height<1) st.position_height= 1;
      st.height= st.position_height+'px';
  } }
}

// Scanning. Check document every so often until it has finished loading. Do
// nothing until <body> arrives, then call main init. Pass any new elements
// found on each scan to be bound   

var position_SCANDELAY= 500;

var position_nscanned= 0;
function position_scan() {
  var nall= document.all.length;
  for (var i= position_nscanned; i<nall; i++)
    position_bind(document.all[i]);
  position_nscanned= nall;
}

var position_scanner;
function position_stop() {
  window.clearInterval(position_scanner);
  position_scan();
}

position_scan();
position_scanner= window.setInterval(position_scan, position_SCANDELAY);
window.attachEvent('onload', position_stop);

@end @*/

/*********************************************************************
 * nili patches begin
 */

/* Layer.draw is patched to make sure the custom image map layer
 * is always drawn on top of all other image layers.
 */
Layer.prototype.draw=function(){
	if(isOpera&&this.isHidden){
		return;
	}
	if(this.container&&this.container.parentNode){
		this.container.parentNode.removeChild(this.container);
	}
	this.container=document.createElement("div");
	this.container.id=this.saMap.prefix+"layer"+this.layerNr;
	this.container.className="rwcLayerContainer";
	if(this.isHidden){
		addClass(this.container,"rwcNoPrint");
		this.container.style.display="none";
	}
	var n=this.tiles.length;
	for(var i=0;i<n;i++){
		this.tiles[i].draw(this.container,this.isZooming,this.dimmed);
	}
	if(this.isNonTileLayer){
		this.buffer.draw(this.container,this.isZooming,this.dimmed);
		this.bufferLoadedDelegate=associateObjWithEvent(this,"bufferLoaded");
		Evt.addEventListener(this.buffer.node,"load",this.bufferLoadedDelegate);
	}
	var _1d=-1;
	// { nili
	if (this.isImageMapLayer){
		this.container.isImageMapLayer=true; // Add prop to div-tag
	}else{
		if(this.saMap.view.overlayArray){
			for(var i=0;i<this.saMap.view.overlayArray.length;i++){
				if(this.saMap.view.overlayArray[i].container){
					_1d=i;
					break;
				}
			}
		}
	}
	// } nili
	if(_1d!=-1){
		this.saMap.mapContainer.insertBefore(this.container,this.saMap.view.overlayArray[_1d].container);
	}else{
		if (this.saMap.mapContainer.lastChild&&this.saMap.mapContainer.lastChild.isImageMapLayer){ // nili
			this.saMap.mapContainer.insertBefore(this.container,this.saMap.mapContainer.lastChild); // nili
		}else{ // nili
			this.saMap.mapContainer.appendChild(this.container);
		} // nili
	}
};

/* Layer.buildRequestString is patched to solve several issues:
 * 1. If the layer is an image map layer, reset the image map name.
 * 2. If the layer should be fetched from another configuration,
 *    initialize necessary parameters.
 */
Layer.prototype.buildRequestString=function(){
	// { nili
	var viewName = this.saMap.viewName;
	if (this.isImageMapLayer){
		this.mapRequestString="";
		return;
	}
	if (this.isCustomImageLayer){
		viewName=this.sourceViewName;
	}
	// } nili
	var _53=this.getVisibleLayersID();
	if(_53==null){
		this.mapRequestString="";
		return;
	}
	if(_53!=""){
		var _54="&layers="+_53;
	}else{
		var _54="";
	}
	if(this.imageFormat!=""){
		imageFormatString="&format="+this.imageFormat;
	}
	var _55="";
	if((this.imageFormat=="gif"||(this.imageFormat=="png"&&!isIe6))&&this.layerNr!=0){
		_55="&transparent=true";
	}else{
		_55="&transparent=false";
	}
	var _56;
	if(this.saMap.fixedScales){
		var _57=(this.saMap.tileGeoWidth*this.saMap.geoWidthToScale)-2;
		_56="&scale="+_57;
	}else{
		var _57=this.tileGeoWidth;
		_56="&geowidth="+_57;
	}
	if(isNaN(this.tileSize)||this.tileSize<=0||this.tileSize>Number.MAX_VALUE||isNaN(_57)||(_57)<Number.MIN_VALUE||(_57)>Number.MAX_VALUE){
		return "";
	}
	if(this.saMap.config.viewSettings.mapTileService&&this.saMap.config.viewSettings.mapTileService!=""){
		var _58=this.saMap.config.viewSettings.mapTileService;
	}else{
		var _58=this.saMap.mapServerUrl;
	}
	// { nili
	this.mapRequestString=_58+"RWCInterface.axd?view="+viewName+imageFormatString+_55+_54+"&width="+this.tileSize+"&height="+this.tileSize+_56;
	//this.mapRequestString=_58+"RWCInterface.axd?view="+this.saMap.viewName+imageFormatString+_55+_54+"&width="+this.tileSize+"&height="+this.tileSize+_56;
	// } nili
	if(this.customAttributes){
		for(variable in this.customAttributes){
			if(typeof (this.customAttributes[variable])!="function"&&this.customAttributes[variable]){
				this.mapRequestString=this.mapRequestString+"&context-"+variable+"="+this.customAttributes[variable];
			}
		}
	}
};

/* Layer.getImageMapNameString is a new function responsible for
 * creating the name of the image map to use.
 */
// { nili
Layer.prototype.getImageMapNameString=function(tile){
	if(!this.isImageMapLayer){
		return;
	}
	if(!this.saMap.fixedScales){
		return;
	}
	var scale=Math.round(this.saMap.tileGeoWidth*this.saMap.geoWidthToScale);
	var x=this.saMap.initialGeoCenterX+this.tileGeoWidth*(tile.col-(Math.ceil(this.nCols/2)-1));
	var y=this.saMap.initialGeoCenterY+this.tileGeoWidth*(-tile.row+(Math.ceil(this.nRows/2)-1));
	return "#tm_"+scale+"_"+Math.floor(x/100)+"_"+Math.floor(y/100);
};
// } nili

/* Layer.updateSingleTile is patched to solve several issues:
 * 1. If the layer is an image map layer, initialize the useMap property.
 * 2. If the layer has fixed bounds, make sure we don't call the server
 *    for images outside of those bounds.
 */
Layer.prototype.updateSingleTile=function(_59){
	if(this.mapRequestString==""||this.isHidden){
		if(_59.node.src!="/pic/blank.gif"&&(!this.isHidden||_59.node.src!="")){
			_59.node.src="/pic/blank.gif";
		}//kristoffer added /
		// { nili
		if (this.isImageMapLayer){
			_59.node.useMap="";
			var imgMap=this.getImageMapNameString(_59);
			if (imgMap){
				_59.node.useMap=imgMap;
			}
		}
		// } nili
		return;
	}
	var _5a=this.tileGeoWidth/this.tileSize;
	var x=this.saMap.initialGeoCenterX+this.tileGeoWidth*(_59.col-(Math.ceil(this.nCols/2)-1));
	var y=this.saMap.initialGeoCenterY+this.tileGeoWidth*(-_59.row+(Math.ceil(this.nRows/2)-1));
	if(this.isNonTileLayer){
		this.newOffsetX=this.layerOffsetX-this.saMap.totalOffsetX;
		this.newOffsetY=this.layerOffsetY-this.saMap.totalOffsetY;
		x=this.saMap.initialGeoCenterX-_5a*this.saMap.totalOffsetX;
		y=this.saMap.initialGeoCenterY+_5a*this.saMap.totalOffsetY;
	}
	// { nili
	if (this.layerBounds){
		// If the tile doesn't intersect the bounding box, set a blank pic
		var halfWidth = this.saMap.tileGeoWidth / 2;
		if (x + halfWidth < this.layerBounds.xMin ||
			x - halfWidth > this.layerBounds.xMax ||
			y + halfWidth < this.layerBounds.yMin ||
			y - halfWidth > this.layerBounds.yMax){
			_59.node.src="/pic/blank.gif";// kristoffer added inital /
			return;
		}
	}
	// } nili
	geoCenterString="&x="+x+"&y="+y;
	var _5d="";
	if(this.haveClientObjects){
		var _5e=Math.floor((this.saMap.config.viewSettings.requestMaxLength-this.mapRequestString.length-geoCenterString.length)/8);
		var _5f=new Array();
		var _60=new RWCPoint(x-this.tileGeoWidth/2,y+this.tileGeoWidth/2);
		var _61=new RWCPoint(x+this.tileGeoWidth/2,y-this.tileGeoWidth/2);
		_5f.push(_60);
		_5f.push(_61);
		var _62=new BoundingArea(null,_5f,"line",this.saMap,0);
		_5d=this.saMap.encodeClientObjects(this.geoObjectLayer.geoObjectArray,_62,_5e);
	}
	var url=this.mapRequestString+geoCenterString+_5d;
	_59.refreshImage(url);
	var _64=new RWCPoint();
	_64.x=x;
	_64.y=y;
	_59.setGeoCenter(_64);
};

/* OverlayLayer.draw is patched to make sure that object layers
 * do not end up on top of the image map layer.
 */
OverlayLayer.prototype.draw=function(){
	if(this.container&&this.container.parentNode){
		this.container.parentNode.removeChild(this.container);
	}
	if(isSafari2&&this.objectCanvas&&this.objectCanvas.parentNode){
		this.objectCanvas.parentNode.removeChild(this.objectCanvas);
	}
	this.container=document.createElement("div");
	this.container.id=this.saMap.prefix+"objectLayer"+this.layerNr;
	this.container.className="rwcLayerContainer";
	if(this.isHidden){
		addClass(this.container,"rwcNoPrint");
		this.container.style.display="none";
	}
	this.objectCanvas=this.createCanvas();
	setX(this.objectCanvas,0);
	setY(this.objectCanvas,0);
	if(isIe6||isIe7){
		this.tempCanvas=this.objectCanvas;
		if(this.geoObjectArray){
			var n=this.geoObjectArray.length;
			for(var i=0;i<n;i++){
				this.geoObjectArray[i].draw(this.saMap,this.container,this.isHidden,i);
			}
		}
		this.tempCanvas=null;
	}
	if(isSafari2){
		this.saMap.mapContainer.appendChild(this.objectCanvas);
	}else{
		this.container.appendChild(this.objectCanvas);
	}
	if(this.saMap.zoomActive){
		setVisible(this.container,false);
		setVisible(this.objectCanvas,false);
	}
	if(!isIe6&&!isIe7){
		if(this.geoObjectArray){
			var n=this.geoObjectArray.length;
			for(var i=0;i<n;i++){
				this.geoObjectArray[i].draw(this.saMap,this.container,this.isHidden,i);
			}
		}
	}
	if (this.saMap.mapContainer.lastChild&&this.saMap.mapContainer.lastChild.isImageMapLayer){ // nili
		this.saMap.mapContainer.insertBefore(this.container,this.saMap.mapContainer.lastChild); // nili
	}else{ // nili
		this.saMap.mapContainer.appendChild(this.container);
	} // nili
};

/* Tile.refreshImage is patched to trick some browsers to
 * verify the max-age attribute of images in the internal cache.
 * Only IE6 seems to do this correctly.
 * (Needed for the traffic flow information layer.)
 */
Tile.prototype.refreshImage=function(url){
	if((isSafari2||isSafari3)&&this.node.src==url){
	}else{
		if(!this.reloading){
			setVisible(this.node,false);
			this.saMap.addWorkItem();
			this.reloading=true;
		}
	}
	if(this.dimFilter&&this.dimFilter.parentNode){
		this.dimFilter.parentNode.removeChild(this.dimFilter);
		this.dimFilter=null;
	}
	// { nili
	var urlHack = url;
	if (!isIe6){
		urlHack+="#e"+Math.random();
	}
	// } nili
	this.node.src=urlHack; // nili (changed)
};

/* Tile.draw is patched to set width and height of images.
 * verify the max-age attribute of images in the internal cache.
 * Only IE6 seems to do this correctly.
 * (Needed for the traffic flow information layer.)
 */
Tile.prototype.draw=function(_7,_8,_9){
	this.dimmed=_9;
	if(!this.node){
		this.node=document.createElement("img");
		this.node.className="rwcMapTile";
		setWidth(this.node,this.tileSize); // nili
		setHeight(this.node,this.tileSize); // nili
		this.node.id=this.id;
	}
	_7.appendChild(this.node);
	if(this.loadDelegate){
		Evt.removeEventListener(this.node,"load",this.loadDelegate);
		this.loadDelegate=null;
	}
	this.loadDelegate=associateObjWithEvent(this,"tileLoaded");
	Evt.addEventListener(this.node,"load",this.loadDelegate);
};

/* cumulativeOffsetLeft is hacked to make sure the floating div
 * with id 'centerarea' is ignored when calculating offsets in IE6.
 * (offsetLeft does not work well in IE6 for floating divs.)
 */
function cumulativeOffsetLeft(_1d){
	var _1e=0;
	do{
		//_1e+=_1d.offsetLeft||0; // nili
		// { nili
		if (!isIe6 || _1d.id != "centerarea"){
			_1e+=_1d.offsetLeft||0;
		}
		// } nili
		_1d=_1d.offsetParent;
	}while(_1d);
	return _1e;
}

/* cumulativeOffsetTop is hacked to make sure the floating div
 * with id 'centerarea' is ignored when calculating offsets in IE6.
 * (offsetTop does not work well in IE6 for floating divs.)
 */
function cumulativeOffsetTop(_1f){
	var _20=0;
	do{
		if(isIe6&&navigator.userAgent.indexOf("SV1")==-1&&_1f.nodeType=="DIV"&&_1f.parentNode&&_1f.parentNode.nodeType=="TD"){
			_20+=0;
		}else{
			//_20+=_1f.offsetTop||0; // nili
			// { nili
			if (!isIe6 || _1f.id != "centerarea"){
				_20+=_1f.offsetTop||0;
			}
			// } nili
		}
		_1f=_1f.offsetParent;
	}while(_1f);
	return _20;
}

/* View.createLayers is patched to allow for the custom rwcType values
 * 'customBackground' and 'imageMap', along with the custom rwc attributes
 * 'rwcSourceViewName' and 'rwcLayerBounds'.
 */
View.prototype.createLayers=function(){
this.layerArray=new Array();
this.overlayArray=new Array();
var _4=0;
if(!this.saMap.viewJSON.ViewInfo.Layers||this.saMap.viewJSON.ViewInfo.Layers.length==0){
	var _5=new Layer("","","server",0,this.saMap,true,false,false);
	this.layerArray.push(_5);
	return;
}
for(var i=0;i<this.saMap.viewJSON.ViewInfo.Layers.length;i++){
var id=this.saMap.viewJSON.ViewInfo.Layers[i].Layer.Id;
var _8=this.saMap.viewJSON.ViewInfo.Layers[i].Layer.Name;
var _9="";
var _a=false;
var _b=true;
var _c=true;
var _d="combinedImage";
var _e=false;
var _f=false;
var srcViewName=""; // nili
var layerBounds=null; // nili
if(this.saMap.viewJSON.ViewInfo.Layers[i].Layer.Properties){
	for(var j=0;j<this.saMap.viewJSON.ViewInfo.Layers[i].Layer.Properties.length;j++){
		switch(this.saMap.viewJSON.ViewInfo.Layers[i].Layer.Properties[j].Name){
		case ("rwcTemplate"):
			_9=this.saMap.viewJSON.ViewInfo.Layers[i].Layer.Properties[j].Value;
			break;
		case ("rwcSearch"):
			_a=stringToBoolean(this.saMap.viewJSON.ViewInfo.Layers[i].Layer.Properties[j].Value,false);
			break;
		case ("rwcUseLayerControl"):
			_b=stringToBoolean(this.saMap.viewJSON.ViewInfo.Layers[i].Layer.Properties[j].Value,true);
			break;
		case ("rwcTiled"):
			_c=stringToBoolean(this.saMap.viewJSON.ViewInfo.Layers[i].Layer.Properties[j].Value,true);
			break;
		case ("rwcType"):
			_d=this.saMap.viewJSON.ViewInfo.Layers[i].Layer.Properties[j].Value;
			break;
		case ("rwcRouteSearch"):
			_e=stringToBoolean(this.saMap.viewJSON.ViewInfo.Layers[i].Layer.Properties[j].Value,false);
			break;
		case ("rwcAllowClientObjects"):
			_f=stringToBoolean(this.saMap.viewJSON.ViewInfo.Layers[i].Layer.Properties[j].Value,false);
			break;
		// { nili
		case ("rwcSourceViewName"):
			srcViewName=this.saMap.viewJSON.ViewInfo.Layers[i].Layer.Properties[j].Value;
			break;
		case ("rwcLayerBounds"):
			eval("layerBounds="+this.saMap.viewJSON.ViewInfo.Layers[i].Layer.Properties[j].Value);
			break;
		// } nili
		}
	}
}
if(_d){
switch(_d){
case ("background"):
	if(isIe6&&this.saMap.config.viewSettings.imageFormat=="png"){
		if(this.layerArray.length>0){
			this.layerArray[this.layerArray.length-1].merge(id,_8,_b,_f);
		}else{
			var _11=new Layer(id,_8,"combinedImage",i,this.saMap,true,_b,_e,_f);
			this.layerArray.push(_11);
		}
	}else{
		var _11=new Layer(id,_8,_d,i,this.saMap,_c,false,_e,_f);
		this.layerArray.push(_11);
		_4++;
	}
	break;
case ("individualImage"):
	if(isIe6&&this.saMap.config.viewSettings.imageFormat=="png"){
		if(this.layerArray.length>0){
			this.layerArray[this.layerArray.length-1].merge(id,_8,_b,_f);
		}else{
			var _11=new Layer(id,_8,"combinedImage",i,this.saMap,true,_b,_e,_f);
			this.layerArray.push(_11);
		}
	}else{
		var _11=new Layer(id,_8,_d,i,this.saMap,_c,_b,_e,_f);
		_11.layerBounds = layerBounds; // nili
		this.layerArray.push(_11);
	}
	break;

// nili { TODO: fix IE6 png problem
case ("imageMap"):
	var _11=new Layer(id,_8,"individualImage",i,this.saMap,_c,_b,_e,_f);
	_11.isImageMapLayer = true;
	this.layerArray.push(_11);
	break;
case ("customBackground"):
	var _11=new Layer(id,_8,"background",i,this.saMap,_c,_b,_e,_f);
	_11.isCustomImageLayer = true;
	_11.sourceViewName = srcViewName;
	this.layerArray.push(_11);
	break;
// } nili

case ("objects"):
	if(!this.saMap.config.viewSettings.disableObjectLayers){
	var _11=new OverlayLayer(id,_8,i,this.saMap,_a,_b,_e);
	var _12=this.saMap.config.getLayerConfiguration(_9);
	_11.createDefaults(_12,this.saMap.viewJSON.ViewInfo.Layers[i].Layer);
	this.overlayArray.push(_11);
	}
	break;
default:
	if(isIe6&&this.saMap.config.viewSettings.imageFormat=="png"){
	if(this.layerArray.length>0){
	this.layerArray[this.layerArray.length-1].merge(id,_8,_b,_f);
	}else{
	var _11=new Layer(id,_8,"combinedImage",i,this.saMap,true,_b,_e,_f);
	this.layerArray.push(_11);
	}
	}else{
	if(this.layerArray.length>0&&this.layerArray[this.layerArray.length-1].type=="combinedImage"&&(this.layerArray[this.layerArray.length-1].isNonTileLayer!=_c)){
	this.layerArray[this.layerArray.length-1].merge(id,_8,_b,_f);
	}else{
	var _11=new Layer(id,_8,"combinedImage",i,this.saMap,_c,_b,_e,_f);
	this.layerArray.push(_11);
	}
	}
	break;
}
}else{
if(isIe6&&this.saMap.config.viewSettings.imageFormat=="png"){
if(this.layerArray.length>0){
this.layerArray[this.layerArray.length-1].merge(id,_8,_b,_f);
}else{
var _11=new Layer(id,_8,"combinedImage",i,this.saMap,true,_b,_e,_f);
this.layerArray.push(_11);
}
}else{
if(this.layerArray.length>0&&this.layerArray[this.layerArray.length-1].type=="combinedImage"&&(this.layerArray[this.layerArray.length-1].isNonTileLayer!=_c)){
this.layerArray[this.layerArray.length-1].merge(id,_8,_b,_f);
}else{
var _11=new Layer(id,_8,"combinedImage",i,this.saMap,_c,_b,_e,_f);
this.layerArray.push(_11);
}
}
}
}
};

/* View.updateTooltips is patched to handle the current cursor.
 * Since we have an image map layer on top of everything, this
 * layer will control the cursor to be displayed.
 */
View.prototype.updateTooltips=function(x,y){
if(this.saMap.activeinfoBoxObject&&this.saMap.activeinfoBoxObject.infoBoxSelected){
	return;
}
var _2a=new Array();
var _2b=false;
for(var i=0;i<this.overlayArray.length;i++){
	if(this.overlayArray[i].geoObjectArray){
		for(var j=this.overlayArray[i].geoObjectArray.length-1;j>=0;j--){
			if(this.overlayArray[i].geoObjectArray[j].boundingArea&&!this.overlayArray[i].isHidden&&!this.overlayArray[i].geoObjectArray[j].isHidden){
				var _2e=this.overlayArray[i].geoObjectArray[j].boundingArea.inside(x,y);
				if(_2e){
					if(this.lastSelectedGeoObject){
						var _2f={enter:false,geoObject:this.lastSelectedGeoObject};
						_2a.push(_2f);
					}
					_2b=true;
					if(this.saMap.activeinfoBoxObject&&!this.saMap.activeinfoBoxObject.infoBoxElement.active){
						this.saMap.activeinfoBoxObject.useNormalIcon();
						this.saMap.activeinfoBoxObject=null;
					}
					if(this.overlayArray[i].geoObjectArray[j].infoBoxElement.active&&!this.saMap.lookingGlass){
						if(this.overlayArray[i].geoObjectArray[j].hasInfoBox||this.overlayArray[i].geoObjectArray[j].infoBoxTimeout){
							this.overlayArray[i].geoObjectArray[j].displayInfoBox(this.overlayArray[i].geoObjectArray[j].infoBoxTimeout);
						}else{
							this.overlayArray[i].geoObjectArray[j].displayInfoBox(1000);
						}
					}else{
						if(this.saMap.activeinfoBoxObject){
							this.saMap.activeinfoBoxObject.cancelInfoBox();
						}
						this.saMap.activeinfoBoxObject=this.overlayArray[i].geoObjectArray[j];
						this.overlayArray[i].geoObjectArray[j].useSelectedIcon();
					}
					this.saMap.setCursor("pointer"); // nili
					// this.saMap.mapContainer.style.cursor="pointer"; // nili
					var _30={enter:true,geoObject:this.overlayArray[i].geoObjectArray[j]};
					_2a.push(_30);
					this.lastSelectedGeoObject=this.overlayArray[i].geoObjectArray[j];
					return _2a;
				}
			}
		}
	}
}
if(!_2b&&this.lastSelectedGeoObject){
	var _2f={enter:false,geoObject:this.lastSelectedGeoObject};
	_2a.push(_2f);
	this.lastSelectedGeoObject=null;
// { nili
if(this.saMap.currentTool&&this.saMap.currentTool.cursor){ 
	this.saMap.setCursor(this.saMap.currentTool.cursor);
}else{
	this.saMap.setCursor("crosshair");
}
// } nili
}
if(!_2b&&this.saMap.activeinfoBoxObject&&!this.saMap.activeinfoBoxObject.infoBoxElement.active){
	this.saMap.activeinfoBoxObject.useNormalIcon();
	this.saMap.activeinfoBoxObject=null;
}
// nili
//this.saMap.mapContainer.style.cursor="auto";
if(this.saMap.activeinfoBoxObject&&!this.saMap.activeinfoBoxObject.infoBoxSelected&&!this.saMap.activeinfoBoxObject.hideObjectInfoTimer&&this.saMap.activeinfoBoxObject.infoBoxElement.active){
	if(this.saMap.activeinfoBoxObject.infoBoxTimeout){
		this.saMap.activeinfoBoxObject.setInfoTimer(this.saMap.activeinfoBoxObject.infoBoxTimeout);
	}else{
		this.saMap.activeinfoBoxObject.setInfoTimer(1000);
	}
}
return _2a;
};

/* GeoObject.placeInfoBox is patched to solves the scroll vs infoBox
 * placementproblem in IE6.
 */
GeoObject.prototype.placeInfoBox=function(){
if(this.infoBoxPositioning=="normal"||this.infoBoxPositioning=="alwaysAbove"||this.infoBoxPositioning=="centered"){
if(!this.infoBox.parentNode||((isIe6||isIe7)&&!this.infoBox.parentElement)){
document.body.appendChild(this.infoBox);
this.infoBoxMouseOverDelegate=associateObjWithEvent(this,"onInfoBoxMouseOver");
this.infoBoxMouseOutDelegate=associateObjWithEvent(this,"onInfoBoxMouseOut");
Evt.addEventListener(this.infoBox,"mouseover",this.infoBoxMouseOverDelegate,false);
Evt.addEventListener(this.infoBox,"mouseout",this.infoBoxMouseOutDelegate,false);
}
var _3e;
var _3f;
var _40=new GeoRectangle(0,0,0,0);
if(this.clientNode){
if(this.defaultCombinedImage){
_40=this.boundingArea.getBounds();
}else{
if(this.clientNode.offsetWidth!=0){
_40=new GeoRectangle(this.clientNode.offsetWidth/2,this.clientNode.offsetHeight/2,-this.clientNode.offsetWidth/2,-this.clientNode.offsetHeight/2);
}else{
if(this.selectedIcon&&this.selectedIcon.width&&this.selectedIcon.height){
_40=new GeoRectangle(stringToInt(this.selectedIcon.width,10)/2,stringToInt(this.selectedIcon.height,10)/2,-stringToInt(this.selectedIcon.width,10)/2,-stringToInt(this.selectedIcon.height,10)/2);
}else{
if(this.icon&&this.icon.width&&this.icon.height){
_40=new GeoRectangle(stringToInt(this.icon.width,10)/2,stringToInt(this.icon.height,10)/2,-stringToInt(this.icon.width,10)/2,-stringToInt(this.icon.height,10)/2);
}else{
if(this.icon&&this.iconOffsetX&&this.iconOffsetY){
_40=new GeoRectangle(this.iconOffsetX/2,this.iconOffsetY/2,-this.iconOffsetX/2,-this.iconOffsetY/2);
}
}
}
}
}
}
var _41=1/this.saMap.getPixelsToViewUnits();
if(this.defaultCombinedImage){
var _42=_40.xMax*_41;
var _43=_40.yMax*_41;
var _44=_40.xMin*_41;
var _45=_40.yMin*_41;
}else{
var _42=_40.xMax;
var _43=_40.yMax;
var _44=_40.xMin;
var _45=_40.yMin;
}
if(this.infoBoxPositioning=="centered"){
if(((this.viewX+_42+this.infoBox.offsetWidth+this.infoBoxMargin)>(this.saMap.mapWidth)-5)){
var _46=false;
_3e=this.viewX-_44-this.infoBoxMargin-this.infoBox.offsetWidth+cumulativeOffsetLeft(this.saMap.mapContainer);
}else{
var _46=true;
_3e=this.viewX-_42+this.infoBoxMargin+cumulativeOffsetLeft(this.saMap.mapContainer);
}
}else{
if(this.infoBoxPositioning=="alwaysAbove"){
_3e=this.viewX+_44+this.infoBoxMargin+cumulativeOffsetLeft(this.saMap.mapContainer);
}else{
if(((this.viewX+_42+this.infoBox.offsetWidth+this.infoBoxMargin)>(this.saMap.mapWidth)-5)&&this.infoBoxPositioning=="normal"){
_3e=this.viewX+_44-this.infoBoxMargin-this.infoBox.offsetWidth+cumulativeOffsetLeft(this.saMap.mapContainer);
}else{
_3e=this.viewX+_42+this.infoBoxMargin+cumulativeOffsetLeft(this.saMap.mapContainer);
}
}
}
if(this.infoBoxPositioning=="centered"){
if(((this.viewY-_43-this.infoBox.offsetHeight-this.infoBoxMargin)>5)){
_3f=this.viewY+_45-this.infoBoxMargin-this.infoBox.offsetHeight+cumulativeOffsetTop(this.saMap.mapContainer);
if(_46){
removeClass(this.infoBox,"topLeftInfoBox");
removeClass(this.infoBox,"bottomLeftInfoBox");
removeClass(this.infoBox,"bottomRightInfoBox");
addClass(this.infoBox,"topRightInfoBox");
}else{
removeClass(this.infoBox,"topRightInfoBox");
removeClass(this.infoBox,"bottomLeftInfoBox");
removeClass(this.infoBox,"bottomRightInfoBox");
addClass(this.infoBox,"topLeftInfoBox");
}
}else{
_3f=this.viewY+_43+this.infoBoxMargin+cumulativeOffsetTop(this.saMap.mapContainer);
if(_46){
removeClass(this.infoBox,"topLeftInfoBox");
removeClass(this.infoBox,"topRightInfoBox");
removeClass(this.infoBox,"bottomLeftInfoBox");
addClass(this.infoBox,"bottomRightInfoBox");
}else{
removeClass(this.infoBox,"topLeftInfoBox");
removeClass(this.infoBox,"topRightInfoBox");
removeClass(this.infoBox,"bottomRightInfoBox");
addClass(this.infoBox,"bottomLeftInfoBox");
}
}
if(isIe6||isIe7){
_3f+=document.body.scrollTop;
var wh=parseInt(document.documentElement.scrollHeight);
var ih=parseInt(document.body.scrollHeight);
var ww=parseInt(document.documentElement.scrollWidth);
var iw=parseInt(document.body.scrollWidth);
}
}else{
if(((this.viewY+_43+this.infoBox.offsetHeight+this.infoBoxMargin)>(this.saMap.mapHeight)-5)||this.infoBoxPositioning=="alwaysAbove"){
_3f=this.viewY+_45-this.infoBoxMargin-this.infoBox.offsetHeight+cumulativeOffsetTop(this.saMap.mapContainer);
}else{
_3f=this.viewY+_43+this.infoBoxMargin+cumulativeOffsetTop(this.saMap.mapContainer);
}
}
if(this.infoBoxPositioning=="alwaysAbove"){
if(isFireFox||isMozilla){
_3e-=document.body.scrollLeft;
}
setX(this.infoBox,_3e);
this.infoBox.style.top="auto";
if(isIe6||isIe7){
if(isIe6){
_3f=(document.body.offsetHeight-_45-this.infoBoxMargin-this.viewY-cumulativeOffsetTop(this.saMap.mapContainer))+document.body.scrollTop;
}else{
if(isIe7){
_3f=(document.body.offsetHeight-_45-this.infoBoxMargin-this.viewY-cumulativeOffsetTop(this.saMap.mapContainer));
}
}
var wh=parseInt(document.documentElement.scrollHeight);
var ih=parseInt(document.body.scrollHeight);
var ww=parseInt(document.documentElement.scrollWidth);
var iw=parseInt(document.body.scrollWidth);
this.infoBox.style.bottom=_3f+"px";
}else{
if(isFireFox||isMozilla){
this.infoBox.style.bottom=(document.body.offsetHeight-_45-this.infoBoxMargin-this.viewY-cumulativeOffsetTop(this.saMap.mapContainer))+document.body.scrollTop+"px";
}else{
this.infoBox.style.bottom=(document.body.offsetHeight-_45-this.infoBoxMargin-this.viewY-cumulativeOffsetTop(this.saMap.mapContainer))+"px";
}
}
}else{
/* nili
 * document.body.scrollX is 0 for all browsers but IE6. In IE6 it will place
 * the box erroneously. Removed.
if(isFireFox||isMozilla||isIe6||isIe7){
	_3e-=document.body.scrollLeft;
	_3f-=document.body.scrollTop;
}*/
setX(this.infoBox,_3e);
setY(this.infoBox,_3f);
}
}else{
if(this.infoBoxPositioning=="target"){
if(!this.infoBox.parentNode||((isIe6||isIe7)&&!this.infoBox.parentElement)){
this.infoBoxTarget.appendChild(this.infoBox);
}
}
}
this.hasInfoBox=true;
};

/* getPixelPositionFromEvent is patched to correctly calculate the
 * position in IE7 if the document is scrolled.
 */
function getPixelPositionFromEvent(evt, _53) {
    if (isFireFox || isMozilla || isIe6) {
        return new RWCPoint(evt.x - cumulativeOffsetLeft(_53) + document.body.scrollLeft, evt.y - cumulativeOffsetTop(_53) + document.body.scrollTop);
    }
    else if (isIe7) {
    return new RWCPoint(evt.x - cumulativeOffsetLeft(_53) + document.documentElement.scrollLeft, evt.y - cumulativeOffsetTop(_53) + document.documentElement.scrollTop);
    }
    else {
        return new RWCPoint(evt.x - cumulativeOffsetLeft(_53), evt.y - cumulativeOffsetTop(_53));
    }
};

/*********************************************************************
 * nili patches end
 */
