// 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.type!="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,_4){
this.saMap=_2.saMap;
this.layer=_2;
this.configuration=new Object();
if(_1==null){
this.attributes=new Array();
var _5=this.attributes.length;
}else{
if(_1.type.toLowerCase()=="feature"){
this.createAttributesFromGeoJSON(_1.properties);
var _5=this.attributes.length;
}else{
this.attributes=new Array();
var _5=this.attributes.length;
}
}
this.createAttributeBindings(_3);
if(_1.type&&_1.geometry){
this.setShape(_1.geometry.type);
}else{
for(var i=0;i<_5;i++){
if(this.attributes[i].name=="geoType"){
this.setShape(this.attributes[i].value);
}
}
}
if(_1.geometry){
this.buildGeometry(_1.geometry);
}
if(!this.points||this.points.length==0){
if(_4){
this.points=_4;
}
}
if(!_1){
return;
}
this.noId=true;
this.priority=0;
this.updateIcons();
if(this.noId){
this.id="x"+Math.random();
}
}
GeoObject.prototype.createAttributeBindings=function(_7){
this.infoBoxElement=this.layer.configuration.infoBox;
this.objectParameters=this.layer.configuration.properties;
this.objectAttributes=this.createAttributeLookupTable(this.layer.configuration.properties,this.attributes);
if(this.infoBoxElement){
this.infoBoxParameters=this.layer.configuration.infoBox.parameters;
this.infoBoxAttributes=this.createAttributeLookupTable(this.layer.configuration.infoBox.parameters,this.attributes);
this.infoBoxMargin=this.layer.configuration.infoBox.margin;
if(this.layer.configuration.infoBox.positioning){
if(this.layer.configuration.infoBox.positioning=="normal"||this.layer.configuration.infoBox.positioning=="alwaysAbove"||this.layer.configuration.infoBox.positioning=="centered"){
this.infoBoxPositioning=this.layer.configuration.infoBox.positioning;
}else{
if(this.layer.configuration.infoBox.positioning.length>7&&this.layer.configuration.infoBox.positioning.substring(0,7)=="target:"){
this.infoBoxPositioning="target";
var _8=layer.configuration.infoBox.positioning.substring(7,this.layer.configuration.infoBox.positioning.length);
this.infoBoxTarget=document.getElementById(_8);
if(this.infoBoxTarget==null){
this.infoBoxPositioning=="normal";
}
}
}
}else{
this.infoBoxPositioning="normal";
}
}else{
this.infoBoxElement=new Object();
this.infoBoxElement.active=false;
}
if(_7){
this.searchResultParameters=this.layer.configuration.search.properties;
this.searchResultAttributes=this.createAttributeLookupTable(this.layer.configuration.search.properties,this.attributes);
}
if(this.layer.searchControl){
this.searchAttributes=new Array();
for(var i=0;i<this.layer.searchControl.searchAttributes.length;i++){
for(var j=0;j<this.attributes.length;j++){
if(this.layer.searchControl.searchAttributes[i]==this.attributes[j].name){
this.searchAttributes[i]=this.attributes[j].value.toLowerCase();
}
}
}
}
};
GeoObject.prototype.setShape=function(_b){
this.type=_b;
this.transparency=0.5;
this.color="#00b000";
this.style="solid";
this.lineWidth=1;
switch(_b.toLowerCase()){
case ("#polygon"):
case ("polygon"):
this.type="poly";
if(this.layer.configuration.polygons){
this.shapeParameters=this.layer.configuration.polygons.parameters;
if(this.layer.configuration.polygons.conditions){
this.conditions=this.layer.configuration.polygons.conditions;
}
}else{
this.shapeParameters=new Array();
}
this.shapeAttributes=this.createAttributeLookupTable(this.shapeParameters,this.attributes);
break;
case ("#multipolygon"):
case ("multipolygon"):
this.type="multipolygon";
if(this.layer.configuration.polygons){
this.shapeParameters=this.layer.configuration.polygons.parameters;
if(this.layer.configuration.polygons.conditions){
this.conditions=this.layer.configuration.polygons.conditions;
}
}else{
this.shapeParameters=new Array();
}
this.shapeAttributes=this.createAttributeLookupTable(this.shapeParameters,this.attributes);
break;
case ("#line"):
case ("line"):
case ("linestring"):
this.type="line";
if(this.layer.configuration.lines){
this.shapeParameters=this.layer.configuration.lines.parameters;
if(this.layer.configuration.lines.conditions){
this.conditions=this.layer.configuration.lines.conditions;
}
}else{
this.shapeParameters=new Array();
}
this.shapeAttributes=this.createAttributeLookupTable(this.shapeParameters,this.attributes);
break;
case ("#multiline"):
case ("multilinestring"):
case ("multiline"):
this.type="multiline";
if(this.layer.configuration.lines){
this.shapeParameters=this.layer.configuration.lines.parameters;
if(this.layer.configuration.lines.conditions){
this.conditions=this.layer.configuration.lines.conditions;
}
}else{
this.shapeParameters=new Array();
}
this.shapeAttributes=this.createAttributeLookupTable(this.shapeParameters,this.attributes);
break;
case ("#multipoint"):
case ("multipoint"):
this.type="multipoint";
break;
case ("#point"):
case ("point"):
this.type="point";
break;
default:
this.type="unknown";
break;
}
};
GeoObject.prototype.createAttributesFromGeoJSON=function(_c){
this.attributes=new Array();
for(variable in _c){
if(typeof (variable)!="function"){
var _d=new Object();
_d.name=decodeURIComponent(variable);
_d.value=decodeURIComponent(_c[variable]);
this.attributes.push(_d);
}
}
};
GeoObject.prototype.buildGeometry=function(_e){
if(_e.type){
switch(_e.type.toLowerCase()){
case ("linestring"):
this.type="line";
break;
case ("point"):
this.type="point";
break;
case ("polygon"):
this.type="poly";
break;
case ("multipolygon"):
this.type="multipolygon";
break;
case ("multilinestring"):
this.type="multiline";
break;
case ("multipoint"):
this.type="multipoint";
break;
}
if(_e.coordinates){
this.points=this.readCoordinateList(_e.coordinates);
}
if(this.type=="point"&&this.points){
if(this.points.length){
this.point=this.points[0];
}else{
this.point=this.points;
}
}
}else{
}
};
GeoObject.prototype.readCoordinateList=function(_f){
if(_f==null||_f.length==null){
return null;
}
var _10=new Array();
var _11=new Object();
for(var i=0;i<_f.length;i++){
if(_f[i].length){
var _13=this.readCoordinateList(_f[i]);
if(_13!=null){
_10.push(_13);
}
}else{
try{
var _14=parseFloat(_f[i]);
if(i==0){
_11.x=_14;
}else{
if(i==1){
_11.y=_14;
}
}
}
catch(e){
}
}
}
if(typeof (_11.x)!="undefined"||typeof (_11.y)!="undefined"){
if(typeof (_11.x)!="undefined"&&typeof (_11.y)!="undefined"){
return _11;
}else{
return null;
}
}else{
return _10;
}
};
GeoObject.prototype.updateIcons=function(){
for(var i=0;i<this.objectParameters.length;i++){
if(typeof (this.objectAttributes[i])!="undefined"){
var _16=this.objectAttributes[i];
var _17=this.attributes[_16].value;
}else{
if(this.objectParameters[i].value&&this.objectParameters[i].value!=null){
var _17=this.objectParameters[i].value;
}else{
_17=null;
}
}
switch(this.objectParameters[i].type){
case ("id"):
if(_17&&_17!=""){
this.id=_17;
this.noId=false;
}
break;
case ("priority"):
if(_17){
try{
this.priority=parseInt(_17);
}
catch(e){
this.priority=0;
}
break;
}
case ("defaultImage"):
this.imageConfig=this.objectParameters[i];
this.icon=this.objectParameters[i].image.clone();
if(_17&&_17!=""){
var _18=_17.split(",");
this.icon.image=_18[0];
if(_18.length>1){
if(!this.selectedIcon){
this.selectedIcon=new Object();
}
this.selectedIcon.image=_18[1];
}else{
this.selectedIcon=null;
}
}else{
if(this.objectParameters[i].selectedImage){
this.selectedIcon=this.objectParameters[i].selectedImage.clone();
}
}
break;
case ("conditionalImage"):
var _19=this.objectParameters[i].value.split(",");
if(_19.length!=2){
break;
}
for(var j=0;j<this.attributes.length;j++){
if(_19[0]==this.attributes[j].name&&_19[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;
}
}
var _1b=this.type=="point"||this.type=="multipoint";
if(this.layer.configuration.defaultCombinedImage&&this.layer.configuration.defaultCombinedImage.parts.length>0&&_1b){
this.icon=null;
this.selectedIcon=null;
this.defaultCombinedImages=new Array();
if(this.type=="point"){
this.defaultCombinedImages.push(this.layer.configuration.defaultCombinedImage.clone());
}else{
for(var k=0;k<this.points.length;k++){
this.defaultCombinedImages.push(this.layer.configuration.defaultCombinedImage.clone());
}
}
}
this.createBoundingArea();
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 _17=this.attributes[this.shapeAttributes[j]].value;
}else{
var _17=this.shapeParameters[j].value;
}
switch(this.shapeParameters[j].type){
case ("style"):
this.style=_17;
break;
case ("transparency"):
try{
this.transparency=parseFloat(_17);
}
catch(e){
}
break;
case ("color"):
this.color=_17;
break;
case ("lineWidth"):
try{
this.lineWidth=parseInt(_17);
}
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;
}
}
}
}
}
}
if(this.type!="multipoint"){
this.mapCenterGeoOffsetX=this.point.x-this.saMap.initialGeoCenterX;
this.mapCenterGeoOffsetY=this.point.y-this.saMap.initialGeoCenterY;
}else{
this.mapCenterGeoOffsetListX=new Array();
this.mapCenterGeoOffsetListY=new Array();
for(var i=0;i<this.points.length;i++){
this.mapCenterGeoOffsetListX[i]=this.points[i].x-this.saMap.initialGeoCenterX;
this.mapCenterGeoOffsetListY[i]=this.points[i].y-this.saMap.initialGeoCenterY;
}
}
};
GeoObject.prototype.createBoundingArea=function(){
if(this.defaultCombinedImages&&(this.type=="point"||this.type=="multipoint")){
if(this.type=="multipoint"){
this.boundingAreas=new Array();
for(var i=0;i<this.points.length;i++){
this.boundingAreas[i]=new DynamicBoundingArea(this.points[i],this.defaultCombinedImages[i],this.saMap);
}
}else{
this.boundingArea=new DynamicBoundingArea(this.point,this.defaultCombinedImages[0],this.saMap);
}
}else{
var _1e=10;
if(this.icon){
_1e=parseInt(this.icon.width)/2;
}
if(isNaN(_1e)){
_1e=10;
}
this.boundingArea=new BoundingArea(this.point,this.points,this.type,this.saMap,_1e);
this.point=this.boundingArea.centerpoint;
}
};
GeoObject.prototype.setSelected=function(){
this.outLine();
};
GeoObject.prototype.cancelSelection=function(){
this.cancelOutLine();
};
GeoObject.prototype.createAttributeLookupTable=function(_1f,_20){
if(!_1f){
return;
}
var _21=new Array();
var n1=_1f.length;
if(_20){
var n2=_20.length;
}else{
var n2=0;
}
for(var i=0;i<n1;i++){
var _25=false;
for(var j=0;j<n2;j++){
if(_20[j].name==_1f[i].name){
_21[i]=j;
}else{
var n3=_1f[i].alternates.length;
for(var k=0;k<n3;k++){
if(_20[j].name==_1f[i].alternates[k]){
_21[i]=j;
_25=true;
break;
}
}
}
}
}
return _21;
};
GeoObject.prototype.clonePosition=function(_29){
this.point.x=_29.point.x;
this.point.y=_29.point.y;
if(this.points){
this.points=new Array();
if(this.type=="line"||this.type=="poly"){
for(var i=0;i<_29.points.length;i++){
this.points[i]=this.saMap.point(_29.points[i].x,_29.points[i].y);
}
}
}
};
GeoObject.prototype.show=function(){
this.isHidden=false;
if(this.clientNode){
setVisible(this.clientNode,true);
}
if(this.clientNodes){
for(var i=0;i<this.clientNodes.length;i++){
setVisible(this.clientNodes[i],true);
}
}
};
GeoObject.prototype.hide=function(){
this.isHidden=true;
if(this.clientNode){
setVisible(this.clientNode,false);
}
if(this.clientNodes){
for(var i=0;i<this.clientNodes.length;i++){
setVisible(this.clientNodes[i],false);
}
}
};
GeoObject.prototype.updateScreenPosition=function(){
var _2d=this.saMap.tileSize/this.saMap.tileGeoWidth;
this.viewX=this.mapCenterGeoOffsetX*_2d+this.saMap.totalOffsetX+this.saMap.mapWidth/2;
this.viewY=this.saMap.mapHeight-(this.mapCenterGeoOffsetY*_2d-this.saMap.totalOffsetY+this.saMap.mapHeight/2);
if(this.clientNodes){
this.viewXList=new Array();
this.viewYList=new Array();
for(var i=0;i<this.clientNodes.length;i++){
this.viewXList[i]=this.mapCenterGeoOffsetListX[i]*_2d+this.saMap.totalOffsetX+this.saMap.mapWidth/2;
this.viewYList[i]=this.saMap.mapHeight-(this.mapCenterGeoOffsetListY[i]*_2d-this.saMap.totalOffsetY+this.saMap.mapHeight/2);
setX(this.clientNodes[i],this.viewXList[i]-this.iconOffsetX/2);
setY(this.clientNodes[i],this.viewYList[i]-this.iconOffsetY/2);
}
}else{
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.clientNodes){
for(var i=0;i<this.clientNodes.length;i++){
setX(this.clientNodes[i],this.viewXList[i]-this.iconOffsetX/2);
setY(this.clientNodes[i],this.viewYList[i]-this.iconOffsetY/2);
}
}
};
GeoObject.prototype.pixelOffset=function(_30,_31){
if(this.hideObjectInfoTimer){
this.cancelInfoBox();
}
this.viewX+=_30;
this.viewY+=_31;
if(this.clientNode){
setX(this.clientNode,this.viewX-this.iconOffsetX/2);
setY(this.clientNode,this.viewY-this.iconOffsetY/2);
}
if(this.clientNodes){
for(var i=0;i<this.clientNodes.length;i++){
this.viewXList[i]+=_30;
this.viewYList[i]+=_31;
setX(this.clientNodes[i],this.viewXList[i]-this.iconOffsetX/2);
setY(this.clientNodes[i],this.viewYList[i]-this.iconOffsetY/2);
}
}
};
GeoObject.prototype.draw=function(_33,_34,_35,_36){
if(this.type!="multipoint"){
this.mapCenterGeoOffsetX=this.point.x-this.saMap.initialGeoCenterX;
this.mapCenterGeoOffsetY=this.point.y-this.saMap.initialGeoCenterY;
}
if(this.type=="point"||this.type=="multipoint"){
var _37=new Array();
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";
_37.push(this.clientNode);
n=1;
}else{
if(this.type=="multipoint"){
if(this.clientNodes){
for(var i=0;i<this.clientNodes.length;i++){
if(this.clientNodes[i]&&this.clientNodes[i].parentNode){
this.clientNodes[i].parentNode.removeChild(this.clientNodes[i]);
}
}
}
this.clientNodes=new Array();
for(var i=0;i<this.points.length;i++){
this.clientNodes[i]=document.createElement("div");
this.clientNodes[i].className="rwcMarker";
}
n=this.clientNodes.length;
_37=this.clientNodes;
}
}
for(var i=0;i<n;i++){
if(this.icon){
_37[i].id=this.id;
_37[i].image=document.createElement("img");
_37[i].appendChild(_37[i].image);
this.icon.applyConfiguration(_37[i].image);
this.setIconOffset(this.icon);
}else{
if(this.defaultCombinedImages){
this.defaultCombinedImages[i].destroy();
this.defaultCombinedImages[i].applyConfiguration(_37[i],this.attributes,false,this.saMap);
this.iconOffsetX=0;
this.iconOffsetY=0;
}else{
this.iconOffsetX=0;
this.iconOffsetY=0;
}
}
}
this.updateScreenPosition();
for(var i=0;i<n;i++){
if(!(this.isHidden||_35)&&!this.saMap.zoomActive){
setVisible(_37[i],true);
}else{
setVisible(_37[i],false);
}
_34.appendChild(_37[i]);
}
}else{
if(!(this.isHidden||_35)){
if(isIe6||isIe7&&this.layer.objectCanvas){
this.drawUsingVML();
}else{
if(this.layer.objectCanvas&&this.layer.objectCanvas.getContext){
this.drawUsingCanvas();
}else{
}
}
this.updateScreenPosition();
}
}
};
GeoObject.prototype.drawUsingVML=function(){
var _39=this.saMap.tileSize/this.saMap.tileGeoWidth;
if(this.type=="line"||this.type=="multiline"){
if(this.type=="line"){
n=1;
}else{
if(this.type=="multiline"){
n=this.points.length;
}
}
for(var i=0;i<n;i++){
if(this.type=="line"){
drawPoints=this.points;
}else{
if(this.type=="multiline"){
drawPoints=this.points[i];
}
}
var _3c="";
if(drawPoints){
var n=drawPoints.length;
for(var i=0;i<n;i++){
if(_3c!=""){
_3c+=",";
}
var _3d=this.saMap.mapToScreenCoordinates(drawPoints[i].x,drawPoints[i].y);
_3c+=Math.round(_3d.x)+","+Math.round(_3d.y);
}
}
var _3e=" opacity=\""+Math.round(this.transparency*100)+"%\"";
var _3f=" strokecolor=\""+this.color+"\"";
var _40="<v:stroke joinstyle=\"round\" weight=\""+this.lineWidth+"\"  endcap=\"round\" "+_3e+"/>";
if(this.layer.tempCanvas){
this.layer.tempCanvas.innerHTML+="<v:polyline filled=\"false\" "+_3f+" points=\""+_3c+"\" >"+_40+"</v:polyline>";
}else{
this.layer.objectCanvas.innerHTML+="<v:polyline filled=\"false\" "+_3f+" points=\""+_3c+"\" >"+_40+"</v:polyline>";
}
}
}else{
if(this.type=="poly"||this.type=="multipolygon"){
var _41=" style=\"position:absolute;top:0;left:0;width:"+this.saMap.mapWidth+"px;height:"+this.saMap.mapHeight+"px\"";
var _3e=" opacity=\""+Math.round(this.transparency*100)+"%\"";
var _42=" coordsize="+this.saMap.mapWidth+","+this.saMap.mapHeight;
var _43="<v:fill "+_3e+" type=\"solid\" color=\""+this.color+"\"></v:fill>";
if(this.lineWidth>0){
var _40="<v:stroke weight=\""+this.lineWidth+"\"  endcap=\"round\" />";
var _44=" stroked=\"true\"";
}else{
var _40="";
var _44=" stroked=\"false\"";
}
var _3f=" strokecolor=\""+this.color;
if(this.type=="poly"){
n=1;
}else{
if(this.type=="multipolygon"){
n=this.points.length;
}
}
for(var i=0;i<n;i++){
if(this.type=="poly"){
var _45=this.points;
}else{
if(this.type=="multipolygon"){
var _45=this.points[i];
}
}
if(_45.length>1){
var _46=this.saMap.mapToScreenCoordinates(_45[0].x,_45[0].y);
var _47="m "+Math.round(_46.x)+","+Math.round(_46.y)+" l ";
var o=_45.length;
for(var i=1;i<o;i++){
var _46=this.saMap.mapToScreenCoordinates(_45[i].x,_45[i].y);
_47+=Math.round(_46.x)+","+Math.round(_46.y);
if(i<_45.length-1){
_47+=", ";
}else{
_47+=" x e";
}
}
if(this.layer.tempCanvas){
this.layer.tempCanvas.innerHTML+="<v:shape"+_41+_3f+_44+" coordorigin=\"0 0\" "+_42+" \" path=\""+_47+"\">"+_40+_43+"</v:shape>";
}else{
this.layer.objectCanvas.innerHTML+="<v:shape"+_41+_3f+_44+" coordorigin=\"0 0\" "+_42+" \" path=\""+_47+"\">"+_40+_43+"</v:shape>";
}
}
}
}
}
};
GeoObject.prototype.drawUsingCanvas=function(){
var _49=this.saMap.tileSize/this.saMap.tileGeoWidth;
var ctx=this.layer.objectCanvas.getContext("2d");
if(this.type=="multiline"||this.type=="multipolygon"){
n=this.points.length;
}else{
n=1;
}
for(var i=0;i<n;i++){
if(this.type=="multiline"||this.type=="multipolygon"){
var _4c=this.points[i];
}else{
var _4c=this.points;
}
ctx.globalAlpha=1;
ctx.beginPath();
ctx.lineWidth=this.lineWidth;
ctx.lineCap="round";
ctx.lineJoin="round";
if(this.type=="line"){
var _4d=this.saMap.screenBounds.lineInside(_4c,false);
if(_4d==-1){
this.updateScreenPosition();
return;
}
var _4e=this.saMap.screenBounds.lineInside(_4c,true);
}else{
_4d=0;
_4e=_4c.length-1;
}
var _4f=this.saMap.mapToScreenCoordinates(_4c[_4d].x,_4c[_4d].y);
ctx.moveTo(_4f.x,_4f.y);
var o=_4e+1;
for(var j=_4d;j<o;j++){
var _4f=this.saMap.mapToScreenCoordinates(_4c[j].x,_4c[j].y);
ctx.lineTo(_4f.x,_4f.y);
if(this.type=="line"||this.type=="multiline"){
var _52=_4c[j];
while(j<(o-2)){
var _53=distance2D(_52,_4c[j+1])*_49;
if(_53<1){
j++;
}else{
break;
}
}
}
}
try{
ctx.fillStyle=this.color;
ctx.strokeStyle=this.color;
}
catch(e){
ctx.fillStyle="Red";
ctx.strokeStyle="Red";
}
if(this.type=="line"||this.type=="multiline"){
try{
ctx.globalAlpha=this.transparency;
}
catch(e){
ctx.globalAlpha=1;
}
ctx.stroke();
}else{
if(this.type=="poly"||this.type=="multipolygon"){
ctx.closePath();
ctx.stroke();
try{
ctx.globalAlpha=this.transparency;
}
catch(e){
ctx.globalAlpha=1;
}
if(isSafari2){
ctx.beginPath();
var _4f=this.saMap.mapToScreenCoordinates(_4c[0].x,_4c[0].y);
ctx.moveTo(_4f.x,_4f.y);
for(var j=1;j<_4c.length;j++){
var _4f=this.saMap.mapToScreenCoordinates(_4c[j].x,_4c[j].y);
ctx.lineTo(_4f.x,_4f.y);
}
ctx.closePath();
}
ctx.fill();
}
}
}
};
GeoObject.prototype.setVisible=function(_54){
this.isHidden=!_54;
if(this.clientNode){
setVisible(this.clientNode,!this.isHidden);
}
if(this.clientNodes){
for(var i=0;i<this.clientNodes.length;i++){
setVisible(this.clientNode[i],!this.isHidden);
}
}
};
GeoObject.prototype.useNormalIcon=function(){
this.isSelected=false;
if(this.clientNode||this.clientNodes){
if(this.icon){
if(this.clientNode){
this.icon.applyConfiguration(this.clientNode.image);
}
if(this.clientNodes){
for(var i=0;i<this.clientNodes.length;i++){
this.icon.applyConfiguration(this.clientNodes[i].image);
}
}
this.setIconOffset(this.icon);
this.centerIcon();
}else{
if(this.defaultCombinedImages){
if(this.clientNode){
this.defaultCombinedImages[0].applyConfiguration(this.clientNode,this.attributes,false,this.saMap);
}
if(this.clientNodes){
for(var i=0;i<this.clientNodes.length;i++){
this.defaultCombinedImages[i].applyConfiguration(this.clientNodes[i],this.attributes,false,this.saMap);
}
}
this.createBoundingArea();
}
}
}
};
GeoObject.prototype.useSelectedIcon=function(){
this.isSelected=true;
if(this.clientNode||this.clientNodes){
if(this.selectedIcon&&this.selectedIcon.image!=""){
if(this.clientNode){
this.selectedIcon.applyConfiguration(this.clientNode.image);
}
if(this.clientNodes){
for(var i=0;i<this.clientNodes.length;i++){
this.selectedIcon.applyConfiguration(this.clientNodes[i].image);
}
}
this.setIconOffset(this.selectedIcon);
this.centerIcon();
}else{
if(this.defaultCombinedImages){
if(this.clientNode){
this.defaultCombinedImages[0].applyConfiguration(this.clientNode,this.attributes,true,this.saMap);
}
if(this.clientNodes){
for(var i=0;i<this.clientNodes.length;i++){
this.defaultCombinedImages[i].applyConfiguration(this.clientNodes[i],this.attributes,true,this.saMap);
}
}
this.createBoundingArea();
}
}
}
};
GeoObject.prototype.setIconOffset=function(_58){
if(_58.height){
this.iconOffsetY=parseInt(_58.height);
}else{
this.iconOffsetY=0;
}
if(_58.width){
this.iconOffsetX=parseInt(_58.width);
}else{
this.iconOffsetX=25;
}
if(_58.height){
this.iconOffsetY=parseInt(_58.height);
}else{
this.iconOffsetY=25;
}
};
GeoObject.prototype.outLine=function(){
if(!this.outLineArea){
this.outLineArea=document.createElement("div");
addClass(this.outLineArea,"RWCOutline");
this.layer.container.appendChild(this.outLineArea);
}
if(this.type=="point"&&this.clientNode){
var _59=1;
var _5a=1;
if(this.icon&&this.icon.width){
if(this.selectedIcon&&this.selectedIcon.width){
if(!this.isSelected){
_59=Math.abs(parseInt(this.icon.width)-parseInt(this.selectedIcon.width))/2;
}
var _5b=Math.max(parseInt(this.icon.width)+2,parseInt(this.selectedIcon.width)+2);
}else{
var _5b=parseInt(this.icon.width)+2;
}
}else{
var _5b=5;
}
if(this.icon&&this.icon.height){
if(this.selectedIcon&&this.selectedIcon.height){
if(!this.isSelected){
_5a=Math.abs(parseInt(this.icon.height)-parseInt(this.selectedIcon.height))/2;
}
var _5c=Math.max(parseInt(this.icon.height)+2,parseInt(this.selectedIcon.height)+2);
}else{
var _5c=parseInt(this.icon.height)+2;
}
}else{
var _5c=5;
}
setX(this.outLineArea,getX(this.clientNode)-_59-1);
setY(this.outLineArea,getY(this.clientNode)-_5a-1);
}else{
var _5d=this.saMap.mapToScreenCoordinates(this.boundingArea.minX,this.boundingArea.maxY);
var _5e=this.saMap.mapToScreenCoordinates(this.boundingArea.maxX,this.boundingArea.minY);
setX(this.outLineArea,Math.round(_5d.x));
setY(this.outLineArea,Math.round(_5d.y));
var _5b=Math.abs(Math.round(_5e.x-_5d.x));
if(_5b<2){
_5b=2;
}
var _5c=Math.abs(Math.round(_5d.y-_5e.y));
if(_5c<2){
_5c=2;
}
}
setWidth(this.outLineArea,_5b);
setHeight(this.outLineArea,_5c);
};
GeoObject.prototype.cancelOutLine=function(){
if(this.outLineArea){
if(this.outLineArea.parentNode){
this.outLineArea.parentNode.removeChild(this.outLineArea);
}
this.outLineArea=null;
}
};
GeoObject.prototype.displayInfoBox=function(_5f){
this.infoBoxTimeout=_5f;
if(this.infoBox){
if(this.hideObjectInfoTimer){
clearTimeout(this.hideObjectInfoTimer);
this.hideObjectInfoTimer=null;
}
return;
}
if(this.type=="line"||this.type=="poly"||this.type=="multiline"||this.type=="multipolygon"||(this.clientNode&&this.type=="point")||(this.clientNodes&&this.type=="multipoint")){
if(this.saMap.activeinfoBoxObject&&this.saMap.activeinfoBoxObject.id!=this.id&&(!this.saMap.activeinfoBoxObject.infoBoxTimeout||this.saMap.activeinfoBoxObject.infoBoxTimeout>0)&&_5f>0){
this.saMap.activeinfoBoxObject.cancelInfoBox();
}
this.saMap.activeinfoBoxObject=this;
if(this.type=="point"||this.type=="multipoint"){
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 _60;
var _61;
if(!this.defaultCombinedImages){
var _62=new GeoRectangle(0,0,0,0);
}else{
_62=this.boundingArea.getBounds();
}
if(this.clientNode){
if(!this.defaultCombinedImages){
if(this.clientNode.offsetWidth!=0){
_62=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){
_62=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){
_62=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){
_62=new GeoRectangle(this.iconOffsetX/2,this.iconOffsetY/2,-this.iconOffsetX/2,-this.iconOffsetY/2);
}
}
}
}
}
}
var _63=1/this.saMap.getPixelsToViewUnits();
if(this.defaultCombinedImages){
var _64=_62.xMax*_63;
var _65=_62.yMax*_63;
var _66=_62.xMin*_63;
var _67=_62.yMin*_63;
}else{
var _64=_62.xMax;
var _65=_62.yMax;
var _66=_62.xMin;
var _67=_62.yMin;
}
if(this.infoBoxPositioning=="centered"){
if(((this.viewX+_64+this.infoBox.offsetWidth+this.infoBoxMargin)>(this.saMap.mapWidth)-5)){
var _68=false;
_60=this.viewX-_66-this.infoBoxMargin-this.infoBox.offsetWidth+cumulativeOffsetLeft(this.saMap.mapContainer);
}else{
var _68=true;
_60=this.viewX-_64+this.infoBoxMargin+cumulativeOffsetLeft(this.saMap.mapContainer);
}
}else{
if(this.infoBoxPositioning=="alwaysAbove"){
_60=this.viewX+_66+this.infoBoxMargin+cumulativeOffsetLeft(this.saMap.mapContainer);
}else{
if(((this.viewX+_64+this.infoBox.offsetWidth+this.infoBoxMargin)>(this.saMap.mapWidth)-5)&&this.infoBoxPositioning=="normal"){
_60=this.viewX+_66-this.infoBoxMargin-this.infoBox.offsetWidth+cumulativeOffsetLeft(this.saMap.mapContainer);
}else{
_60=this.viewX+_64+this.infoBoxMargin+cumulativeOffsetLeft(this.saMap.mapContainer);
}
}
}
if(this.infoBoxPositioning=="centered"){
if(((this.viewY-_65-this.infoBox.offsetHeight-this.infoBoxMargin)>5)){
_61=this.viewY+_67-this.infoBoxMargin-this.infoBox.offsetHeight+cumulativeOffsetTop(this.saMap.mapContainer);
if(_68){
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{
_61=this.viewY+_65+this.infoBoxMargin+cumulativeOffsetTop(this.saMap.mapContainer);
if(_68){
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){
_61+=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+_65+this.infoBox.offsetHeight+this.infoBoxMargin)>(this.saMap.mapHeight)-5)||this.infoBoxPositioning=="alwaysAbove"){
_61=this.viewY+_67-this.infoBoxMargin-this.infoBox.offsetHeight+cumulativeOffsetTop(this.saMap.mapContainer);
}else{
_61=this.viewY+_65+this.infoBoxMargin+cumulativeOffsetTop(this.saMap.mapContainer);
}
}
if(this.infoBoxPositioning=="alwaysAbove"){
if(isFireFox||isMozilla){
_60-=document.body.scrollLeft;
}
setX(this.infoBox,_60);
this.infoBox.style.top="auto";
if(isIe6||isIe7){
if(isIe6){
_61=(document.body.offsetHeight-_67-this.infoBoxMargin-this.viewY-cumulativeOffsetTop(this.saMap.mapContainer))+document.body.scrollTop;
}else{
if(isIe7){
_61=(document.body.offsetHeight-_67-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=_61+"px";
}else{
if(isFireFox||isMozilla){
this.infoBox.style.bottom=(document.body.offsetHeight-_67-this.infoBoxMargin-this.viewY-cumulativeOffsetTop(this.saMap.mapContainer))+document.body.scrollTop+"px";
}else{
this.infoBox.style.bottom=(document.body.offsetHeight-_67-this.infoBoxMargin-this.viewY-cumulativeOffsetTop(this.saMap.mapContainer))+"px";
}
}
}else{
setX(this.infoBox,_60);
setY(this.infoBox,_61);
}
}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,_6f){
this.hideObjectInfoTimer=null;
this.cancelInfoBox();
};
GeoObject.prototype.createInfo=function(_70){
var _71=document.createElement("div");
_71.id="content"+this.id;
addClass(_71,this.infoBoxElement.css);
_71.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 _73=this.attributes[this.infoBoxAttributes[i]].value;
}else{
var _73=this.infoBoxParameters[i].value;
}
if(_73&&_73!=""){
if(this.infoBoxParameters[i].type=="string"){
this.hasInfoBoxContent=true;
var _74=document.createElement("div");
_74.className="rwcInfoBoxText";
_71.appendChild(_74);
if(this.infoBoxAttributes[i]&&this.attributes[this.infoBoxAttributes[i]].label){
var _75=this.attributes[this.infoBoxAttributes[i]].label+_73;
}else{
if(this.infoBoxParameters[i].label){
var _75=this.infoBoxParameters[i].label+_73;
}else{
var _75=_73;
}
}
_74.innerHTML=_75;
}else{
if(this.infoBoxParameters[i].type=="image"){
this.hasInfoBoxContent=true;
var _74=document.createElement("img");
_74.className="rwcInfoBoxImage";
_71.appendChild(_74);
setImageSource(_74,_73);
var _76=document.createElement("br");
_71.appendChild(_76);
}else{
if(this.infoBoxParameters[i].type=="url"){
this.hasInfoBoxContent=true;
var _74=document.createElement("a");
_71.appendChild(_74);
_74.className="rwcInfoBoxAnchor";
_74.target="_blank";
_74.href=_73;
if(this.infoBoxAttributes[i]&&this.attributes[this.infoBoxAttributes[i]].label){
_74.innerHTML=this.attributes[this.infoBoxAttributes[i]].label;
}else{
if(this.infoBoxParameters[i].label){
_74.innerHTML=this.infoBoxParameters[i].label;
}
}
var _76=document.createElement("br");
_71.appendChild(_76);
}
}
}
}
}
}
return _71;
};
GeoObject.prototype.onInfoBoxMouseOver=function(evt,_78){
clearTimeout(this.hideObjectInfoTimer);
this.hideObjectInfoTimer=null;
this.useSelectedIcon();
this.infoBoxSelected=true;
};
GeoObject.prototype.onInfoBoxMouseOut=function(evt,_7a){
if(this.infoBoxTimeout){
this.setInfoTimer(this.infoBoxTimeout);
}
this.infoBoxSelected=false;
};
GeoObject.prototype.updateInfoBox=function(){
if(this.infoBox){
this.placeInfoBox();
if((this.viewX&&this.viewY)&&(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.setImage=function(_7b,_7c,_7d,_7e){
if(!this.icon){
this.icon=new ImageConfiguration();
}
this.icon.image=_7b;
this.icon.tooltip=_7e;
if(_7c){
this.icon.width=_7c+"px";
}
if(_7d){
this.icon.height=_7d+"px";
}
if(this.clientNode){
if(!this.clientNode.image){
this.clientNode.image=document.createElement("img");
}
this.icon.applyConfiguration(this.clientNode.image);
}else{
if(this.clientNodes){
for(var i=0;i<this.clientNodes.length;i++){
if(!this.clientNodes[i].image){
this.clientNode[i].image=document.createElement("img");
}
this.icon.applyConfiguration(this.clientNodes[i].image);
}
}
}
if(this.layer.container){
this.draw(this.saMap,this.layer.container,this.layer.isHidden,0);
}
};
GeoObject.prototype.setSelectedImage=function(_80,_81,_82,_83){
if(!_80){
this.selectedIcon=null;
return;
}
if(!this.selectedIcon){
this.selectedIcon=new ImageConfiguration();
}
this.selectedIcon.image=_80;
this.selectedIcon.tooltip=_83;
if(_81){
this.selectedIcon.width=_81+"px";
}else{
this.selectedIcon.width=this.icon.width;
}
if(_82){
this.selectedIcon.height=_82+"px";
}else{
this.selectedIcon.height=this.icon.height;
}
};
GeoObject.prototype.setPosition=function(x,y,_86){
if(this.type=="poly"||this.type=="line"||this.type=="multipoint"||this.type=="multiline"||this.type=="multipolygon"){
if(_86){
this.points=_86;
}else{
return;
}
}
if(this.type=="point"){
this.point.x=x;
this.point.y=y;
}
this.updateIcons();
for(var i=0;i<this.saMap.onObjectUpdatedEventHandlers.length;i++){
this.saMap.onObjectUpdatedEventHandlers[i](this.saMap,this,this.id,"setPosition");
}
};
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(_88){
for(var i=0;i<this.attributes.length;i++){
if(this.attributes[i].name==_88){
return this.attributes[i].value;
}
}
return null;
};
GeoObject.prototype.setAttribute=function(_8a,_8b,_8c){
var _8d=new Object();
_8d.name=_8a;
_8d.value=_8b;
_8d.label=_8c;
for(var i=0;i<this.attributes.length;i++){
if(this.attributes[i].name==_8d.name){
this.attributes[i].value=_8d.value;
this.attributes[i].label=_8d.label;
this.updateIcons();
return;
}
}
this.attributes.push(_8d);
for(var i=0;i<this.objectParameters.length;i++){
if(this.objectParameters[i].name==_8a){
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]==_8a){
this.objectAttributes[i]=this.attributes.length-1;
break;
}
}
}
}
}
for(var i=0;i<this.infoBoxParameters.length;i++){
if(this.infoBoxParameters[i].name==_8a){
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]==_8a){
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]==_8a){
this.searchAttributes[i]=_8b.toLowerCase();
}
}
}
this.updateIcons();
for(var i=0;i<this.saMap.onObjectUpdatedEventHandlers.length;i++){
this.saMap.onObjectUpdatedEventHandlers[i](this.saMap,this,this.id,"attribute set");
}
};
GeoObject.prototype.unload=function(){
this.cancelOutLine();
this.cancelInfoBox();
};
GeoObject.prototype.inside=function(x,y){
if(this.boundingAreas){
for(var i=0;i<this.boundingAreas.length;i++){
if(this.boundingAreas[i].inside(x,y)){
return true;
}
}
return false;
}else{
return this.boundingArea.inside(x,y);
}
};
function BoundingArea(_93,_94,_95,_96,_97){
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=_95;
this.saMap=_96;
this.padding=_97;
if(isNaN(this.padding)){
this.padding=10;
}
if((this.type=="line"||this.type=="poly")&&_94){
this.points=_94;
for(var i=0;i<_94.length;i++){
if(_94[i].x>this.maxX){
this.maxX=_94[i].x;
}
if(_94[i].x<this.minX){
this.minX=_94[i].x;
}
if(_94[i].y>this.maxY){
this.maxY=_94[i].y;
}
if(_94[i].y<this.minY){
this.minY=_94[i].y;
}
}
}else{
if(this.type=="point"){
this.maxX=_93.x;
this.maxY=_93.y;
this.minX=_93.x;
this.minY=_93.y;
this.centerpoint=_93;
}else{
if(this.type=="multipoint"||this.type=="multiline"||this.type=="multipolygon"){
this.children=new Array();
if(this.type=="multipoint"){
for(var i=0;i<_94.length;i++){
this.children[i]=new BoundingArea(_94[i],null,"point",this.saMap,_97);
}
}else{
if(this.type=="multiline"){
for(var i=0;i<_94.length;i++){
this.children[i]=new BoundingArea(null,_94[i],"line",this.saMap,_97);
}
}else{
if(this.type=="multipolygon"){
for(var i=0;i<_94.length;i++){
this.children[i]=new BoundingArea(null,_94[i],"poly",this.saMap,_97);
}
}
}
}
this.maxX=Number.NEGATIVE_INFINITY;
this.maxY=Number.NEGATIVE_INFINITY;
this.minX=Number.MAX_VALUE;
this.minY=Number.MAX_VALUE;
for(var i=0;i<this.children.length;i++){
if(this.children[i].maxX>this.maxX){
this.maxX=this.children[i].maxX;
}
if(this.children[i].maxY>this.maxY){
this.maxY=this.children[i].maxY;
}
if(this.children[i].minX<this.minX){
this.minX=this.children[i].minX;
}
if(this.children[i].minY<this.minY){
this.minY=this.children[i].minY;
}
}
}
}
}
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;
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 _9b=this.padding*this.saMap.tileGeoWidth/this.saMap.tileSize;
if((x>=this.minX-_9b&&x<=this.maxX+_9b)&&(y>=this.minY-_9b&&y<=this.maxY+_9b)){
if(this.type=="point"){
return true;
}else{
if(this.type=="multipoint"||this.type=="multiline"||this.type=="multipolygon"){
if(this.children){
for(var i=0;i<this.children.length;i++){
if(this.children[i].inside(x,y)){
return true;
}
}
return false;
}
}else{
return this.edgeTest(x,y);
}
}
}else{
return false;
}
};
BoundingArea.prototype.lineInside=function(_9d,_9e){
if(_9d&&_9d.length>1){
if(_9e){
for(var i=_9d.length-1;i>0;i--){
var _a0=this.lineTest(_9d[i].x,_9d[i].y,_9d[i-1].x,_9d[i-1].y);
if(_a0){
return i;
}
}
}else{
for(var i=0;i<_9d.length-1;i++){
var _a0=this.lineTest(_9d[i].x,_9d[i].y,_9d[i+1].x,_9d[i+1].y);
if(_a0){
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(_a7){
var cx=_a7.maxX-this.maxX;
if(cx>0){
if(_a7.minX>this.maxX){
return false;
}
}else{
if(this.minX>_a7.maxX){
return false;
}
}
var cy=_a7.maxY-this.maxY;
if(cy>0){
if(_a7.minY>this.maxY){
return false;
}
}else{
if(this.minY>_a7.maxY){
return false;
}
}
return true;
};
BoundingArea.prototype.edgeTest=function(x,y){
if(this.points){
var _ac=this.saMap.point(x,y);
if(this.type=="line"){
var _ad=pointToLineDistance2D(_ac,this.points);
viewUnitsToPixels=this.saMap.tileSize/this.saMap.tileGeoWidth;
_ad=_ad.distance*viewUnitsToPixels;
if(_ad<3){
return true;
}else{
return false;
}
}else{
return pointInPolygon2D(_ac,this.points);
}
}
};
function DynamicBoundingArea(_ae,_af,_b0){
this.point=_ae;
this.combinedImage=_af;
this.saMap=_b0;
}
DynamicBoundingArea.prototype.inside=function(x,y){
if(!this.imageBounds){
var _b3=this.combinedImage.bounds(this.saMap);
if(_b3.complete){
this.imageBounds=_b3;
}
}
if(this.imageBounds){
var _b4=this.point.x+this.imageBounds.xMin;
var _b5=this.point.y+this.imageBounds.yMin;
var _b6=this.point.x+this.imageBounds.xMax;
var _b7=this.point.y+this.imageBounds.yMax;
if(x>=_b4&&x<=_b6&&y>=_b5&&y<=_b7){
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){
this.id=id;
var _9=new LayerIdObject(id);
this.sublayerID=new Array();
this.sublayerID.push(_9);
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.imageFormat=this.saMap.config.viewSettings.imageFormat;
if(_8){
this.allowClientObjects=true;
}
}
Layer.prototype.merge=function(id,_b,_c,_d){
this.id+=","+id;
var _e=new LayerIdObject(id);
this.sublayerID.push(_e);
this.sublayerName.push(_b);
this.sublayerUseLayerControl.push(_c);
if(this.container){
this.container.id+=id;
}
if(_d){
this.allowClientObjects=true;
}
};
Layer.prototype.createTiles=function(_f,_10,_11,_12,_13,_14,_15){
if(this.isNonTileLayer){
this.nRows=1;
this.nCols=1;
this.layerOffsetX=Math.floor(-(_13-this.saMap.mapWidth)/4);
this.layerOffsetY=Math.floor(-(_13-this.saMap.mapHeight)/4);
this.paddingX=(_13-this.saMap.mapWidth)/2;
this.paddingY=(_13-this.saMap.mapHeight)/2;
}else{
this.nRows=_f;
this.nCols=_10;
this.paddingX=_11;
this.paddingY=_12;
this.layerOffsetX=Math.round((_13)/2*-((Math.ceil(_10/2)-Math.floor(_10/2))-1));
this.layerOffsetY=Math.round((_13)/2*-((Math.ceil(_f/2)-Math.floor(_f/2))-1));
}
this.tileSize=_13;
this.tileGeoWidth=_14;
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,_13,this.saMap.prefix+_15+"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+this.id+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 _1c=-1;
if(this.saMap.view.overlayArray){
for(var i=0;i<this.saMap.view.overlayArray.length;i++){
if(this.saMap.view.overlayArray[i].container){
_1c=i;
break;
}
}
}
if(_1c!=-1){
this.saMap.mapContainer.insertBefore(this.container,this.saMap.view.overlayArray[_1c].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 _1d=this.saMap.config.getLayerConfiguration("");
this.geoObjectLayer.createDefaults(_1d,null);
this.geoObjectLayer.noUpdate=true;
this.geoObjectLayer.isUserLayer=true;
this.geoObjectLayer.geoObjectArray=new Array();
this.geoObjectLayer.draw();
this.geoObjectLayer.hide();
};
Layer.prototype.dim=function(_1e){
this.dimmed=true;
this.dimColor=_1e;
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(_23,_24){
if(!this.haveClientObjects){
return;
}
if(_24&&!isNaN(_24)){
geoObject.priority=_24;
}else{
_24=0;
}
for(var i=0;i<this.geoObjectArray.length;i++){
if(this.geoObjectArray[i].priority&&this.geoObjectArray[i].priority>_24){
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";
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(_26,_27){
if(this.isNonTileLayer){
var x=getX(this.tiles[0].node);
var y=getY(this.tiles[0].node);
setX(this.tiles[0].node,x+_26);
setY(this.tiles[0].node,y+_27);
}else{
var n=this.tiles.length;
for(var i=0;i<n;i++){
this.tiles[i].pixelOffset(_26,_27,this.nRows,this.nCols);
}
}
};
Layer.prototype.offset=function(_2c,_2d){
var _2e=_2c+this.relativeOffsetX;
var _2f=_2d+this.relativeOffsetY;
var _30=-Math.round(_2e/this.tileSize);
var _31=Math.round(this.tileSize*(_30+_2e/this.tileSize));
var _32=-Math.round(_2f/this.tileSize);
var _33=Math.round(this.tileSize*(_32+_2f/this.tileSize));
var n=this.tiles.length;
for(var i=0;i<n;i++){
this.tiles[i].offset(_30,_31,_32,_33,this.paddingX,this.paddingY);
}
};
Layer.prototype.getTilesGeoBoundingBox=function(){
var _36=new GeoRectangle();
for(var i=0;i<this.tiles.length;i++){
var _38=this.tiles[i].getGeoCenter();
if(!_38){
continue;
}
var _39=_38.x-this.saMap.tileGeoWidth/2;
var _3a=_38.x+this.saMap.tileGeoWidth/2;
var _3b=_38.y-this.saMap.tileGeoWidth/2;
var _3c=_38.y+this.saMap.tileGeoWidth/2;
var _3d=new GeoRectangle(_3a,_3c,_39,_3b);
_36=_36.union(_3d,_36);
}
return _36;
};
Layer.prototype.refresh=function(_3e){
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);
}else{
var _3f=Math.abs(this.tiles[0].col);
var _40=Math.abs(this.tiles[0].row);
var _41=_40%this.saMap.nRows;
var _42=_3f%this.saMap.nCols;
var _43=Math.ceil(this.saMap.nRows/2-1);
var _44=Math.ceil(this.saMap.nCols/2-1);
var _45=_43;
var _46=_44;
row=_45;
col=_46;
var _47=0;
totalTiles=this.tiles.length;
while((row<=this.saMap.nRows+1&&row>=-1||col<=this.saMap.nCols+1&&col>=-1)){
tileNr=Math.floor(this.saMap.nCols*row)+col;
if(tileNr>=0&&tileNr<this.tiles.length){
this.updateSingleTile(this.tiles[tileNr]);
}
var _48=row-_45;
var _49=col-_46;
if(_48==-_47&&_49==_47){
col++;
_47++;
}else{
if(_48<_49&&_48>-_47){
row++;
}else{
if(_48>=_49&&_49>-_47){
col--;
}else{
if(_48>_49&&_48>-_47){
row--;
}else{
col++;
}
}
}
}
}
}
};
Layer.prototype.startZoom=function(_4a){
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);
}
_4a.appendChild(this.zoomTiles[i].node);
if(this.dimmed){
this.zoomTiles[i].dim(this.dimColor);
}
i++;
}
}
};
Layer.prototype.zoom=function(_4e){
if(!this.isHidden){
var _4f=this.saMap.zoomOldTileGeoWidth/this.saMap.zoomNewTileGeoWidth;
var _50=0;
if(_4e!=0){
var _51=this.tileSize*_4f;
var _52=Math.round(this.tileSize+(_51-this.tileSize)*_4e);
var _53=(this.tileSize*this.nCols);
var _54=(this.tileSize*this.nRows);
var _55=Math.round(_53+(_53*_4f-_53)*_4e);
var _56=Math.round(_54+(_54*_4f-_54)*_4e);
var _57=Math.round(_55/_52);
var _58=(_52*_57)!=_55;
if(_58!=0){
_50=1;
}
}
var n=this.zoomTiles.length;
for(var i=0;i<n;i++){
tileUpdateData=this.zoomTiles[i].zoom(_4e,_4f,_50);
}
}
};
Layer.prototype.endZoom=function(){
this.isZooming=false;
};
Layer.prototype.buildRequestString=function(){
var _5b=this.getVisibleLayersID();
if(_5b==null){
this.mapRequestString="";
return;
}
if(_5b!=""){
var _5c="&layers="+_5b;
}else{
var _5c="";
}
if(this.imageFormat!=""){
imageFormatString="&format="+this.imageFormat;
}
var _5d="";
if((this.imageFormat=="gif"||(this.imageFormat=="png"&&!isIe6))&&this.layerNr!=0){
_5d="&transparent=true";
}else{
_5d="&transparent=false";
}
var _5e;
if(this.saMap.fixedScales){
var _5f=(this.saMap.tileGeoWidth*this.saMap.geoWidthToScale)-2;
_5e="&scale="+_5f;
}else{
var _5f=this.tileGeoWidth;
_5e="&geowidth="+_5f;
}
if(isNaN(this.tileSize)||this.tileSize<=0||this.tileSize>Number.MAX_VALUE||isNaN(_5f)||(_5f)<Number.MIN_VALUE||(_5f)>Number.MAX_VALUE){
return "";
}
if(this.saMap.config.viewSettings.mapTileService&&this.saMap.config.viewSettings.mapTileService!=""){
var _60=this.saMap.config.viewSettings.mapTileService;
}else{
var _60=this.saMap.mapServerUrl;
}
this.mapRequestString=_60+"RWCInterface.axd?view="+this.saMap.viewName+imageFormatString+_5d+_5c+"&width="+this.tileSize+"&height="+this.tileSize+_5e;
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(_61){
if(this.mapRequestString==""||this.isHidden){
if(_61.node.src!="pic/blank.gif"&&(!this.isHidden||_61.node.src!="")){
_61.node.src="pic/blank.gif";
}
return;
}
var _62=this.tileGeoWidth/this.tileSize;
var x=this.saMap.initialGeoCenterX+this.tileGeoWidth*(_61.col-(Math.ceil(this.nCols/2)-1));
var y=this.saMap.initialGeoCenterY+this.tileGeoWidth*(-_61.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-_62*this.saMap.totalOffsetX;
y=this.saMap.initialGeoCenterY+_62*this.saMap.totalOffsetY;
}
geoCenterString="&x="+x+"&y="+y;
var _65="";
if(this.haveClientObjects){
var _66=Math.floor((this.saMap.config.viewSettings.requestMaxLength-this.mapRequestString.length-geoCenterString.length)/8);
var _67=new Array();
var _68=new RWCPoint(x-this.tileGeoWidth/2,y+this.tileGeoWidth/2);
var _69=new RWCPoint(x+this.tileGeoWidth/2,y-this.tileGeoWidth/2);
_67.push(_68);
_67.push(_69);
var _6a=new BoundingArea(null,_67,"line",this.saMap,0);
_65=this.saMap.encodeClientObjects(this.geoObjectLayer.geoObjectArray,_6a,_66);
}
var url=this.mapRequestString+geoCenterString+_65;
_61.refreshImage(url);
var _6c=new RWCPoint();
_6c.x=x;
_6c.y=y;
_61.setGeoCenter(_6c);
};
Layer.prototype.getVisibleLayersID=function(){
var _6d="";
var _6e=0;
for(var i=0;i<this.sublayerID.length;i++){
if(!this.sublayerID[i].isHidden){
if(_6d!=""){
_6d+=",";
}
_6d+=this.sublayerID[i].id;
_6e++;
}
}
if(_6e==0){
return null;
}else{
return _6d;
}
};
Layer.prototype.show=function(id){
foundLayer=false;
if(this.sublayerID.length==1&&!id){
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(_7b,_7c){
if(!this.customAttributes){
this.customAttributes=new Object();
}
this.customAttributes[_7b]=_7c;
};
Layer.prototype.removeAttribute=function(_7d){
if(this.customAttributes){
this.customAttributes[_7d]=null;
}
};
function OverlayLayer(id,_7f,_80,_81,_82,_83){
this.id=id;
if(!this.id){
this.id="-1";
}
var _84=new LayerIdObject(id);
this.name=_7f;
this.type="objects";
this.useLayerControl=_83;
this.layerNr=_80;
this.saMap=_81;
this.searchEnabled=_82;
}
OverlayLayer.prototype.createDefaults=function(_85,_86){
this.configuration=new Object();
this.configuration.route=new Object();
this.configuration.route=_85.route;
this.configuration.search=new Object();
this.configuration.downloadBehavior=_85.downloadBehavior;
this.configuration.search.zoomToResults=_85.search.zoomToResults;
this.configuration.searchControl=_85.search.searchControl;
this.configuration.search.searchResults=_85.search.searchResults;
this.configuration.properties=this.buildParameterList(_85.geoObjects.parameters,_86);
this.configuration.defaultCombinedImage=_85.geoObjects.defaultCombinedImage;
if(_85.infoBox){
this.configuration.infoBox=_85.infoBox.clone();
this.configuration.infoBox.parameters=this.buildParameterList(_85.infoBox.parameters,_86);
this.configuration.infoBox.positioning=_85.infoBox.positioning;
this.configuration.infoBox.margin=_85.infoBox.margin;
}
if(_85.shapes){
if(_85.shapes.polygons){
this.configuration.polygons=new Object();
this.configuration.polygons.parameters=this.buildParameterList(_85.shapes.polygons.parameters,_86);
this.configuration.polygons.conditions=_85.shapes.polygons.conditions;
}
if(_85.shapes.lines){
this.configuration.lines=new Object();
this.configuration.lines.parameters=this.buildParameterList(_85.shapes.lines.parameters,_86);
this.configuration.lines.conditions=_85.shapes.lines.conditions;
}
}
if(this.searchEnabled){
this.configuration.search.properties=this.buildParameterList(_85.search.searchResults.parameters,_86);
this.configuration.search.controlGroups=_85.search.searchParameters.controlGroups;
if(this.configuration.searchControl.active){
switch(this.configuration.searchControl.mode){
case ("docked"):
setVisible(this.saMap.dockingArea,true);
var _87=this.saMap.dockingArea;
break;
case ("overlay"):
var _87=this.saMap.embedDiv;
break;
case ("standalone"):
var _87=document.body;
break;
}
this.maxCount=_85.downloadBehavior.maxCount;
this.searchControl=new SearchControl(_87,this.saMap.mapServerUrl,this.saMap,this,this.saMap.prefix,_85.search,_85.downloadBehavior);
if(this.configuration.searchControl.mode=="docked"){
this.saMap.dockingOffset=Math.max(this.saMap.dockingOffset,this.searchControl.container.offsetHeight);
}
}
}
if(_85.downloadBehavior.downloadModel=="once"){
this.downloadOnce=true;
this.getAll=true;
}else{
if(_85.downloadBehavior.downloadModel=="getall"){
this.getAll=true;
}else{
if(_85.downloadBehavior.downloadModel=="grid"){
this.useGrid=true;
}
}
}
if(_85.downloadBehavior.timeout>0){
this.timeout=_85.downloadBehavior.timeout*1000;
this.reloadTimer=setTimeout(associateObjWithEvent(this,"reload"),this.timeout);
}
};
OverlayLayer.prototype.reload=function(){
this.refresh(true);
};
OverlayLayer.prototype.buildParameterList=function(_88,_89){
var _8a=new Array();
if(!_88){
return;
}
var n1=_88.length;
for(var i=0;i<n1;i++){
_8a[i]=_88[i].clone();
if(_89){
var _8d=false;
for(var j=0;j<_89.Properties.length;j++){
if(_89.Properties[j].Name==_88[i].name){
_8a[i].value=_89.Properties[j].Value;
_8d=true;
break;
}
}
if(!_8d){
var n2=_88[i].alternates.length;
for(var j=0;j<n2;j++){
for(var k=0;k<_89.Properties[k].length;k++){
if(_89.Properties[k].Name==_88[i].alternates[j]){
_8a[i].value=_89.Properties[k].Value;
_8d=true;
break;
}
}
if(_8d){
break;
}
}
}
}
}
return _8a;
};
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+this.id;
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 _93=document.createElement("div");
_93.className="rwcCanvasOverlay";
}else{
var _93=document.createElement("canvas");
_93.className="rwcCanvasOverlay";
addClass(_93,"rwcNoPrint");
_93.width=this.saMap.mapWidth;
_93.height=this.saMap.mapHeight;
}
return _93;
};
OverlayLayer.prototype.updateCanvas=function(){
if(!this.container){
this.draw();
return;
}
var _94=this.createCanvas();
if(isIe6||isIe7){
this.tempCanvas=_94;
this.drawShapes();
this.tempCanvas=null;
}
if(isSafari2){
this.saMap.mapContainer.insertBefore(_94,this.objectCanvas);
}else{
this.container.insertBefore(_94,this.objectCanvas);
}
setX(_94,0);
setY(_94,0);
setVisible(_94,false);
this.objectCanvas.parentNode.removeChild(this.objectCanvas);
this.objectCanvas=_94;
if(!isIe6&&!isIe7){
this.drawShapes();
}
if(!this.saMap.zoomActive){
setVisible(_94,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].type=="multipolygon"||this.geoObjectArray[i].type=="multiline"){
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(_9b){
if(this.noUpdate||!_9b){
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,_9b,null);
}
}
};
OverlayLayer.prototype.pixelOffset=function(_9e,_9f){
if(this.geoObjectArray){
var n=this.geoObjectArray.length;
for(var i=0;i<n;i++){
this.geoObjectArray[i].pixelOffset(_9e,_9f);
}
}
if(this.objectCanvas){
var _a2=getX(this.objectCanvas);
var _a3=getY(this.objectCanvas);
setX(this.objectCanvas,_a2+_9e);
setY(this.objectCanvas,_a3+_9f);
}
};
OverlayLayer.prototype.updateSearchControl=function(){
if(this.searchControl){
this.searchControl.addResults(this.searchControl.startIndex);
}
};
OverlayLayer.prototype.activateProxy=function(_a4,_a5){
this.useProxy=true;
this.proxyName=_a4;
this.customProxyString=_a5;
};
OverlayLayer.prototype.deactivateProxy=function(){
this.useProxy=false;
};
OverlayLayer.prototype.getGeoObjects=function(url,_a7,_a8,_a9,_aa,_ab,_ac,_ad){
if(this.id=="-1"||this.noUpdate&&!_ac){
return;
}
if(this.timeout){
clearTimeout(this.reloadTimer);
this.reloadTimer=setTimeout(associateObjWithEvent(this,"reload"),this.timeout);
}
var _ae=this.saMap.tileGeoWidth/this.saMap.tileSize;
var _af=(_aa-_a8)*_ae;
var _b0=-this.saMap.totalOffsetX;
var _b1=this.saMap.totalOffsetY;
var _b2=this.saMap.initialGeoCenterX+_b0*_ae;
var _b3=this.saMap.initialGeoCenterY+_b1*_ae;
var _b4="&layers="+this.id;
var _b5="";
if(this.searchEnabled&&this.searchControl){
_b5=this.searchControl.buildSearchString();
}
if(this.isClientOnly&&!this.useProxy){
return;
}
var _b6="";
if(this.maxCount&&!isNaN(this.maxCount)){
_b6="&context-subset=0,"+this.maxCount;
}
var _b7="&responsetype=JSON";
var _b8=this.saMap.mapWidth;
var _b9=this.saMap.mapHeight;
if(this.downloadOnce){
this.noUpdate=true;
}
if(this.useGrid){
var _ba=2;
_ab=_ab.toPrecision(1)*2;
_aa=_aa.toPrecision(1)*2;
_b8=_aa-_a8;
_b9=_ab-_a9;
var _af=_af.toPrecision(2);
var _af=_af*1;
var _bb=Math.round((this.saMap.initialGeoCenterX-_b2)/(_af/_ba));
var _bc=Math.round((this.saMap.initialGeoCenterY-_b3)/(_af/_ba));
_b2=this.saMap.initialGeoCenterX-_bb*(_af/2);
_b3=this.saMap.initialGeoCenterY-_bc*(_af/2);
var _af=_af+((_af/_ba)*2)*1.1;
}
if(_ad){
var _bd="request="+_ad;
}else{
var _bd="request=GetGeoObjects";
}
if(!this.getAll){
var _be="&pixel-x-topleft="+_a8+"&pixel-y-topleft="+_a9+"&pixel-x-bottomright="+_aa+"&pixel-y-bottomright="+_ab;
}else{
var _be="";
}
if(this.useProxy){
var _bf=url+"RWCProxy.axd?"+"proxy="+this.proxyName+this.customProxyString+_b5+_b6;
}else{
var _bf=url+"RWCInterface.axd?"+_bd+"&view="+this.saMap.viewName+_b4+"&geowidth="+_af+"&width="+_b8+"&height="+_b9+"&positions=true"+"&x="+_b2+"&y="+_b3+_be+_b5+_b6+_b7;
}
if(this.customAttributes){
for(variable in this.customAttributes){
if(typeof (this.customAttributes[variable])!="function"&&this.customAttributes[variable]){
_bf=_bf+"&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",_bf,true);
this.xmlHttp.send("");
};
OverlayLayer.prototype.onGetGeoObjectsResponse=function(){
if(this.xmlHttp&&this.xmlHttp.readyState==4){
if(this.xmlHttp.responseText){
this.removeGeoObjects();
this.geoObjectArray=new Array();
try{
this.geoJSON=eval("("+this.xmlHttp.responseText+")");
}
catch(e){
this.saMap.removeWorkItem();
return;
}
this.resetDrivingDirections();
this.readGeoJSON(this.geoJSON,false);
if(this.haveRouteSearch&&this.drivingDirections){
this.drivingDirections.finalize(false);
}
for(var i=0;i<this.saMap.onAfterUpdateEventHandlers.length;i++){
this.saMap.onAfterUpdateEventHandlers[i](this.saMap,this);
}
this.draw();
}
this.saMap.removeWorkItem();
delete this.xmlHttp["onreadystatechange"];
this.xmlHttp=null;
}
};
OverlayLayer.prototype.onGetGeoObjectsSearchResponse=function(){
if(this.xmlHttp&&this.xmlHttp.readyState==4){
if(this.xmlHttp.responseText){
this.removeGeoObjects();
this.geoObjectArray=new Array();
try{
this.geoJSON=eval("("+this.xmlHttp.responseText+")");
}
catch(e){
this.saMap.removeWorkItem();
return;
}
this.readGeoJSON(this.geoJSON,true);
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();
delete this.xmlHttp["onreadystatechange"];
this.xmlHttp=null;
}
};
OverlayLayer.prototype.setEditable=function(_c2){
this.editable=_c2;
};
OverlayLayer.prototype.setAsRouteSearchLayer=function(){
this.saMap.routeLayer=this;
this.haveRouteSearch=true;
this.noUpdate=false;
this.downloadOnce=false;
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 _c3=this.saMap.dockingArea;
break;
case ("overlay"):
var _c3=this.saMap.embedDiv;
break;
case ("standalone"):
var _c3=document.body;
break;
}
if(!this.drivingDirections){
this.drivingDirections=new DrivingDirectionsControl(_c3,this.saMap,this,this.saMap.prefix,this.configuration.route);
}
if(this.configuration.route.drivingDirections.mode=="docked"){
this.saMap.dockingOffset=Math.max(this.saMap.dockingOffset,this.drivingDirections.container.offsetHeight);
}
}
};
OverlayLayer.prototype.showDrivingDirections=function(_c4){
if(this.haveRouteSearch&&this.drivingDirections){
this.drivingDirections.show(_c4);
}
};
OverlayLayer.prototype.resetDrivingDirections=function(){
if(this.haveRouteSearch&&this.drivingDirections){
this.drivingDirections.reset();
}
};
OverlayLayer.prototype.readGeoJSON=function(_c5,_c6){
if(!_c5){
return;
}
if(_c5.type&&_c5.type.toLowerCase()=="featurecollection"){
if(_c5.features){
var _c7=_c5.features;
}
}else{
if(_c5.type&&_c5.type.toLowerCase()=="feature"){
var _c7=new Array();
_c7.push(_c5);
}else{
if(_c5.type&&_c5.type.toLowerCase()=="geometry"){
var _c7=new Array();
var _c8=new Object();
_c8.geometry=_c5;
_c7.push(_c8);
}
}
}
if(!_c7){
return;
}
for(var i=0;i<_c7.length;i++){
var _ca=this.readFeature(_c7[i],_c6);
if(_ca){
this.insertObject(_ca,_ca.priority);
if(this.haveRouteSearch&&this.drivingDirections){
this.drivingDirections.insertObject(_ca);
}
for(var j=0;j<this.saMap.onObjectUpdatedEventHandlers.length;j++){
this.saMap.onObjectUpdatedEventHandlers[j](this,_ca,_ca.id,"createGeoObject");
}
}
}
};
OverlayLayer.prototype.readFeature=function(_cc,_cd){
if(!_cc){
return null;
}
var _ce=new GeoObject(_cc,this,_cd);
return _ce;
};
OverlayLayer.prototype.insertObject=function(_cf,_d0){
if(_d0&&!isNaN(_d0)){
_cf.priority=_d0;
}else{
_d0=0;
}
for(var i=0;i<this.geoObjectArray.length;i++){
if(this.geoObjectArray[i].priority&&this.geoObjectArray[i].priority>_d0){
this.geoObjectArray=this.geoObjectArray.insert(i,_cf);
return;
}
}
this.geoObjectArray.push(_cf);
};
OverlayLayer.prototype.addOrUpdateGeoObject=function(_d2){
if(this.geoObjectArray){
var n=this.geoObjectArray.length;
for(var i=0;i<n;i++){
if(this.geoObjectArray[i].id==_d2.id){
this.geoObjectArray[i].clonePosition(_d2);
this.geoObjectArray[i].updateScreenPosition();
return;
}
}
}
if(!this.geoObjectArray){
this.geoObjectArray=new Array();
}
_d2.draw(this.saMap,this.container,this.isHidden,this.geoObjectArray.length);
this.geoObjectArray.push(_d2);
};
OverlayLayer.prototype.getGeoObjectArray=function(){
if(this.geoObjectArray){
return this.geoObjectArray;
}else{
return null;
}
};
OverlayLayer.prototype.getGeoObjectById=function(_d5){
if(this.geoObjectArray){
var n=this.geoObjectArray.length;
for(var i=0;i<n;i++){
if(this.geoObjectArray[i].id==_d5){
return this.geoObjectArray[i];
}
}
return null;
}
};
OverlayLayer.prototype.removeGeoObject=function(_d8){
if(this.geoObjectArray){
var n=this.geoObjectArray.length;
for(var i=0;i<n;i++){
if(this.geoObjectArray[i].id==_d8){
this.geoObjectArray[i].unload();
if(this.saMap.selectedObject&&this.saMap.selectedObject.id==this.geoObjectArray[i].id){
this.saMap.selectedObject=null;
}
if(this.geoObjectArray[i].clientNode){
this.geoObjectArray[i].clientNode.parentNode.removeChild(this.geoObjectArray[i].clientNode);
}
this.geoObjectArray.splice(i,1);
for(var j=0;j<this.saMap.onObjectUpdatedEventHandlers.length;j++){
this.saMap.onObjectUpdatedEventHandlers[j](this.saMap,this,this.id,"removeGeoObject");
}
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 _de=0;
while(_de<this.geoObjectArray.length){
if(this.geoObjectArray[_de].noId){
this.geoObjectArray[_de].unload();
if(this.geoObjectArray[_de].clientNode){
this.geoObjectArray[_de].clientNode.parentNode.removeChild(this.geoObjectArray[_de].clientNode);
}
this.geoObjectArray.splice(_de,1);
}else{
_de++;
}
}
}
};
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(_e1,_e2){
if(!this.customAttributes){
this.customAttributes=new Object();
}
this.customAttributes[_e1]=_e2;
};
OverlayLayer.prototype.removeAttribute=function(_e3){
if(this.customAttributes){
this.customAttributes[_e3]=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.update=function(){
for(var i=0;i<this.listItems.length;i++){
this.listItems[i].unload();
}
removeAllChildElements(this.overlayBody);
this.createLayerList();
};
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 _7=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(_7.container,"rwcLayerListItem");
this.overlayBody.appendChild(_7.container);
this.listItems.push(_7);
}
}
}
for(var i=0;i<this.saMap.view.overlayArray.length;i++){
if(this.saMap.view.overlayArray[i].useLayerControl){
var _7=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(_7.container,"rwcLayerListItem");
this.overlayBody.appendChild(_7.container);
if(this.saMap.config.GUI.layerControl.reorderableLayers){
_7.downArrow=document.createElement("img");
_7.downArrow.className="rwcReorderArrowDown";
this.saMap.config.GUI.layerControl.downArrow.applyConfiguration(_7.downArrow);
_7.container.appendChild(_7.downArrow);
if(i<this.saMap.view.overlayArray.length-1&&this.saMap.view.overlayArray[i+1].useLayerControl){
_7.reorderDownDelegate=associateObjWithEvent(_7,"onReorderDown");
Evt.addEventListener(_7.downArrow,"click",_7.reorderDownDelegate);
addClass(_7.downArrow,"rwcClickable");
}else{
addClass(_7.downArrow,"rwcDisabled");
}
_7.upArrow=document.createElement("img");
_7.upArrow.className="rwcReorderArrowUp";
this.saMap.config.GUI.layerControl.upArrow.applyConfiguration(_7.upArrow);
_7.container.appendChild(_7.upArrow);
if(i>0){
_7.reorderUpDelegate=associateObjWithEvent(_7,"onReorderUp");
Evt.addEventListener(_7.upArrow,"click",_7.reorderUpDelegate);
addClass(_7.upArrow,"rwcClickable");
}else{
addClass(_7.upArrow,"rwcDisabled");
}
}
var _8=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"){
_8++;
}
}
if(this.saMap.config.GUI.layerControl.legend){
for(var j=0;j<this.saMap.view.overlayArray[i].configuration.properties.length;j++){
var _9;
if(this.saMap.view.overlayArray[i].configuration.properties[j].type=="defaultImage"||this.saMap.view.overlayArray[i].configuration.properties[j].type=="conditionalImage"){
_9=document.createElement("img");
_9.className="rwcLegendImage";
if(this.saMap.view.overlayArray[i].configuration.properties[j].value&&this.saMap.view.overlayArray[i].configuration.properties[j].value!=""){
setImageSource(_9,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(_9,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 _a=document.createElement("span");
_a.innerHTML=this.saMap.view.overlayArray[i].configuration.properties[j].label;
}
}
if(_8>1&&(this.saMap.view.overlayArray[i].configuration.properties[j].type=="defaultImage"||this.saMap.view.overlayArray[i].configuration.properties[j].type=="conditionalImage")){
this.overlayBody.appendChild(_9);
this.overlayBody.appendChild(_a);
}else{
if(_9&&(this.saMap.view.overlayArray[i].configuration.properties[j].type=="defaultImage"||this.saMap.view.overlayArray[i].configuration.properties[j].type=="conditionalImage")){
_9.className="rwcInlineLegendImage";
_7.container.insertBefore(_9,_7.text);
}
}
}
}
this.listItems.push(_7);
_7.nr=this.listItems.length-1;
}
}
};
LayerControl.prototype.elementClicked=function(_b,_c){
if(this.saMap.zoomActive){
return;
}
if(_c){
this.saMap.view.showLayer(_b);
}else{
this.saMap.view.hideLayer(_b);
}
};
LayerControl.prototype.isVisible=function(_d){
var n=this.listItems.length;
for(var i=0;i<n;i++){
if(this.listItems[i].id==_d){
return this.listItems[i].selected;
break;
}
}
};
LayerControl.prototype.headerClicked=function(evt,_11){
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,_1a,_1b,_1c,_1d,_1e){
this.id=id;
this.listControl=_1d;
this.imageConfig=_1b;
this.selectedImageConfig=_1c;
this.container=document.createElement("div");
this.image=document.createElement("img");
if(_1e){
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=_1a+"&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 _1f=!this.selected;
this.listControl.elementClicked(this.id,_1f);
};
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.editor=new GUIElement();
this.GUI.editor.setValues(true,"RWCAttributeEditor","overlay");
this.GUI.editor.startMode="All";
this.GUI.editor.attributes=new Object();
this.GUI.editor.attributes.parameters=new Array();
var _3=new Parameter("name","string","","Name:","on");
var _4=new Parameter("infostring","string","","Infobox text:","on");
var _5=new Parameter("color","string","","Color:","on");
var _6=new Parameter("transparency","string","","Transparency:","on");
var _7=new Parameter("lineWidth","string","","Line Width:","on");
this.GUI.editor.attributes.parameters.push(_3);
this.GUI.editor.attributes.parameters.push(_4);
this.GUI.editor.attributes.parameters.push(_5);
this.GUI.editor.attributes.parameters.push(_6);
this.GUI.editor.attributes.parameters.push(_7);
this.GUI.editor.moveMarker=new ImageConfiguration();
this.GUI.editor.moveMarker.setImage(this.defaultUrl+"pic/standard/moveMarker.png","12px","12px","");
this.GUI.editor.createMarker=new ImageConfiguration();
this.GUI.editor.createMarker.setImage(this.defaultUrl+"pic/standard/moveMarker2.png","12px","12px","");
this.GUI.enableAnimatedZoom=true;
this.GUI.enableKeyEvents=true;
this.GUI.enableMouseScrollEvent=true;
this.GUI.layerControl=new ListConfiguration();
var _8=new ImageConfiguration();
_8.setImage(this.defaultUrl+"pic/standard/bluecheckbox.png","16px","16px","Activate layer");
var _9=new ImageConfiguration();
_9.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(),_8,_9,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.JSONConfigurationObject="lookingGlassJSON";
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.JSONConfigurationObject="miniMapJSON";
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.parameters=new Array();
var _a=new Parameter("Id","id",null,null,"on");
_a.alternates=new Array();
_a.alternates.push("id");
_a.alternates.push("POI_ID");
this.overlayLayers.defaultLayer.geoObjects.parameters.push(_a);
var _b=new Parameter("rwcDefaultIcon","defaultImage","","","on");
_b.image=new ImageConfiguration();
_b.image.setImage(this.defaultUrl+"pic/standard/circlegreen.png","18px","18px","");
_b.selectedImage=new ImageConfiguration();
_b.selectedImage.setImage(this.defaultUrl+"pic/standard/circlegreen_glow.png","24px","24px","");
this.overlayLayers.defaultLayer.geoObjects.parameters.push(_b);
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 _c=new Parameter("POI_NAME","string","","","on");
this.overlayLayers.defaultLayer.infoBox.parameters.push(_c);
var _d=new Parameter("infostring","string","","","on");
this.overlayLayers.defaultLayer.infoBox.parameters.push(_d);
var _e=new Parameter("clientSideInfoImage","image","","","on");
this.overlayLayers.defaultLayer.infoBox.parameters.push(_e);
var _f={"DrivingDirections":{"active":"true","CollapseImage":{"image":"pic/standard/close2.png","tooltip":""},"css":"rwcDrivingDirectionOverlay","EvenItem":{"css":"rwcDrivingDirectionEvenItem"},"Heading":{"value":"Driving Directions"},"Images":{"Default":{"Left":{"height":"24px","image":"pic/standard/dd_turnleft.png","width":"24px"},"Right":{"height":"24px","image":"pic/standard/dd_turnright.png","width":"24px"},"Straight":{"height":"24px","image":"pic/standard/dd_straight.png","width":"24px"}},"Roundabout":{"Left":{"height":"24px","image":"pic/standard/dd_roundabout.png","width":"24px"},"Right":{"height":"24px","image":"pic/standard/dd_roundabout.png","width":"24px"},"Straight":{"height":"24px","image":"pic/standard/dd_roundabout.png","width":"24px"}},"Sliproad":{"Left":{"height":"24px","image":"pic/standard/dd_exit.png","width":"24px"},"Right":{"height":"24px","image":"pic/standard/dd_exit.png","width":"24px"},"Straight":{"height":"24px","image":"pic/standard/dd_exit.png","width":"24px"}},"Start":{"Left":{"height":"24px","image":"pic/standard/dd_start.png","width":"24px"},"Right":{"height":"24px","image":"pic/standard/dd_start.png","width":"24px"},"Straight":{"height":"24px","image":"pic/standard/dd_start.png","width":"24px"}},"Stop":{"Left":{"height":"24px","image":"pic/standard/dd_stop.png","width":"24px"},"Right":{"height":"24px","image":"pic/standard/dd_stop.png","width":"24px"},"Straight":{"height":"24px","image":"pic/standard/dd_stop.png","width":"24px"}}},"mode":"overlay","OddItem":{"css":"rwcDrivingDirectionOddItem"}}};
this.overlayLayers.defaultLayer.route=new Object();
this.overlayLayers.defaultLayer.route.drivingDirections=new DrivingDirectionsConfiguration(_f.DrivingDirections);
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.search.searchGUI=new Object();
this.overlayLayers.defaultLayer.shapes=new Object();
var _10=new Parameter("style","style","solid","","on");
var _11=new Parameter("color","color","red","","on");
var _12=new Parameter("transparency","transparency","0.5","","on");
var _13=new Parameter("lineWidth","lineWidth","2","","on");
this.overlayLayers.defaultLayer.shapes.lines=new Object();
this.overlayLayers.defaultLayer.shapes.lines.parameters=new Array();
this.overlayLayers.defaultLayer.shapes.lines.parameters.push(_10);
this.overlayLayers.defaultLayer.shapes.lines.parameters.push(_11);
this.overlayLayers.defaultLayer.shapes.lines.parameters.push(_12);
this.overlayLayers.defaultLayer.shapes.lines.parameters.push(_13);
this.overlayLayers.defaultLayer.shapes.polygons=new Object();
this.overlayLayers.defaultLayer.shapes.polygons.parameters=new Array();
this.overlayLayers.defaultLayer.shapes.polygons.parameters.push(_10);
this.overlayLayers.defaultLayer.shapes.polygons.parameters.push(_11);
this.overlayLayers.defaultLayer.shapes.polygons.parameters.push(_12);
this.overlayLayers.defaultLayer.shapes.polygons.parameters.push(_13);
var _14=new Object();
_14.name="measureTool";
_14.geoObjects=new Object();
_14.geoObjects.parameters=new Array();
var _a=new Parameter("id","id",null,null,"on");
_14.geoObjects.parameters.push(_a);
var _b=new Parameter("rwcDefaultIcon","defaultImage","","","on");
_b.image=new ImageConfiguration();
_b.image.setImage(this.defaultUrl+"pic/standard/pin.png","30px","40px","");
_b.selectedImage=null;
_14.geoObjects.parameters.push(_b);
_14.shapes=new Object();
var _10=new Parameter("style","style","solid","","on");
var _11=new Parameter("color","color","red","","on");
var _12=new Parameter("transparency","transparency","0.5","","on");
var _13=new Parameter("lineWidth","lineWidth","3","","on");
_14.shapes.lines=new Object();
_14.shapes.lines.parameters=new Array();
_14.shapes.lines.parameters.push(_10);
_14.shapes.lines.parameters.push(_11);
_14.shapes.lines.parameters.push(_12);
_14.shapes.lines.parameters.push(_13);
_14.shapes.polygons=new Object();
_14.shapes.polygons.parameters=new Array();
_14.shapes.polygons.parameters.push(_10);
_14.shapes.polygons.parameters.push(_11);
_14.shapes.polygons.parameters.push(_12);
_14.shapes.polygons.parameters.push(_13);
_14.infoBox=new GUIElement();
_14.infoBox.setValues(true,"rwcWhiteInfoBox","overlay");
_14.infoBox.positioning="normal";
_14.infoBox.margin=0;
_14.infoBox.parameters=new Array();
var _c=new Parameter("name","string","","","on");
_14.infoBox.parameters.push(_c);
var _d=new Parameter("distance","string","","","on");
_14.infoBox.parameters.push(_d);
_14.downloadBehavior=new Object();
_14.downloadBehavior.downloadModel="once";
_14.downloadBehavior.initiation="manual";
_14.downloadBehavior.maxCount=0;
_14.downloadBehavior.timeout=0;
_14.search=new Object();
_14.search.searchParameters=new Object();
_14.search.searchResults=new Object();
this.overlayLayers.layerTemplates.push(_14);
var _15=new Object();
_15.name="geoCoding";
_15.geoObjects=new Object();
_15.geoObjects.parameters=new Array();
var _a=new Parameter("id","id",null,null,"on");
_15.geoObjects.parameters.push(_a);
var _b=new Parameter("rwcDefaultIcon","defaultImage","","","on");
_b.image=new ImageConfiguration();
_b.image.setImage(this.defaultUrl+"pic/standard/pin.png","30px","40px","");
_b.selectedImage=null;
_15.geoObjects.parameters.push(_b);
_15.shapes=new Object();
var _10=new Parameter("style","style","solid","","on");
var _11=new Parameter("color","color","red","","on");
var _12=new Parameter("transparency","transparency","0.5","","on");
var _13=new Parameter("lineWidth","lineWidth","3","","on");
_15.shapes.lines=new Object();
_15.shapes.lines.parameters=new Array();
_15.shapes.lines.parameters.push(_10);
_15.shapes.lines.parameters.push(_11);
_15.shapes.lines.parameters.push(_12);
_15.shapes.lines.parameters.push(_13);
_15.shapes.polygons=new Object();
_15.shapes.polygons.parameters=new Array();
_15.shapes.polygons.parameters.push(_10);
_15.shapes.polygons.parameters.push(_11);
_15.shapes.polygons.parameters.push(_12);
_15.shapes.polygons.parameters.push(_13);
_15.infoBox=new GUIElement();
_15.infoBox.setValues(true,"rwcWhiteInfoBox","overlay");
_15.infoBox.positioning="normal";
_15.infoBox.margin=0;
_15.infoBox.parameters=new Array();
var _c=new Parameter("address","string","","","on");
_15.infoBox.parameters.push(_c);
_15.downloadBehavior=new Object();
_15.downloadBehavior.downloadModel="getall";
_15.downloadBehavior.initiation="manual";
_15.downloadBehavior.maxCount=20;
_15.downloadBehavior.timeout=0;
_15.search=new Object();
_15.search.searchParameters=new Object();
_15.search.searchResults=new GUIElement();
_15.search.searchResults.setValues(true,"rwcResultsList","overlay");
_15.search.searchResults.forwardImage=new ImageConfiguration();
_15.search.searchResults.forwardImage.setImage(this.defaultUrl+"pic/standard/arrowright.png","18px","15px","");
_15.search.searchResults.backImage=new ImageConfiguration();
_15.search.searchResults.backImage.setImage(this.defaultUrl+"pic/standard/arrowleft.png","18px","15px","");
_15.search.searchResults.parameters=new Array();
var _c=new Parameter("address","string","","","on");
_15.search.searchResults.parameters.push(_c);
_15.search.searchParameters.controlGroups=new Array();
var _16=new Object();
_16.type="geoCoding";
_16.css="";
_15.search.searchParameters.controlGroups[0]=new ControlGroup(_16,this);
_15.search.searchControl=new GUIElement();
_15.search.searchControl.setValues(true,"","overlay");
_15.search.searchGUI=new Object();
_15.search.searchControl.heading="Search";
this.overlayLayers.layerTemplates.push(_15);
};
MapConfiguration.prototype.override=function(_17){
if(_17){
if(_17.GUISettings){
this.overrideGUI(_17.GUISettings);
}
if(_17.ViewSettings){
this.overrideViewSettings(_17.ViewSettings);
}
if(_17.OverlayLayers){
this.readLayerTemplates(_17.OverlayLayers);
}
}
};
MapConfiguration.prototype.overrideGUI=function(_18){
if(_18.BackgroundControl){
this.GUI.backgroundControl.override(_18.BackgroundControl);
if(_18.BackgroundControl.ButtonImage){
this.GUI.backgroundControl.element=new ImageConfiguration(_18.BackgroundControl.ButtonImage);
}
if(_18.BackgroundControl.SelectedButtonImage){
this.GUI.backgroundControl.selectedElement=new ImageConfiguration(_18.BackgroundControl.SelectedButtonImage);
}
}
if(_18.ClickTool){
if(_18.ClickTool.value){
this.GUI.clickTool=_18.ClickTool.value;
}
}
if(_18.CloseBox&&_18.CloseBox.CloseBox){
this.GUI.closeBox=new ImageConfiguration(_18.CloseBox.CloseBox);
}else{
if(_18.CloseBox){
this.GUI.closeBox=new ImageConfiguration(_18.CloseBox);
}
}
if(_18.DefaultTool){
if(_18.DefaultTool.OutputElement){
this.GUI.dragTool.outputElement=_18.DefaultTool.OutputElement.value;
}
if(_18.DefaultTool.value){
this.GUI.dragTool.defaultTool=_18.DefaultTool.value;
}
}
if(_18.DetailedInfo){
this.GUI.detailedInfo.override(_18.DetailedInfo);
if(_18.DetailedInfo.Parameter){
this.GUI.detailedInfo.parameters=this.readParameterList(_18.DetailedInfo.Parameter);
}
}
if(_18.DockingPanel&&_18.DockingPanel.DockingPanel){
this.GUI.dockingPanel=new ImageConfiguration(_18.DockingPanel.DockingPanel);
}else{
if(_18.DockingPanel){
this.GUI.dockingPanel=new ImageConfiguration(_18.DockingPanel);
}
}
if(_18.Editor){
this.GUI.editor.override(_18.Editor);
if(_18.Editor.Attributes&&_18.Editor.Attributes.Parameter){
this.GUI.editor.attributes.parameters=this.readParameterList(_18.Editor.Attributes.Parameter);
}
if(_18.Editor.MoveMarker){
this.GUI.editor.moveMarker=new ImageConfiguration(_18.Editor.MoveMarker);
}
if(_18.Editor.CreateMarker){
this.GUI.editor.createMarker=new ImageConfiguration(_18.Editor.CreateMarker);
}
if(_18.Editor.StartMode){
this.GUI.editor.startMode=_18.Editor.StartMode;
}
}
if(_18.EnableAnimatedZoom){
if(_18.EnableAnimatedZoom.value){
this.GUI.enableAnimatedZoom=stringToBoolean(_18.EnableAnimatedZoom.value,false);
}
}
if(_18.EnableKeyEvents){
if(_18.EnableKeyEvents.value){
this.GUI.enableKeyEvents=stringToBoolean(_18.EnableKeyEvents.value,false);
}
}
if(_18.EnableMouseScrollEvent){
if(_18.EnableMouseScrollEvent.value){
this.GUI.enableMouseScrollEvent=stringToBoolean(_18.EnableMouseScrollEvent.value,false);
}
}
if(_18.LayerControl){
this.GUI.layerControl.override(_18.LayerControl);
if(_18.LayerControl.Legend&&_18.LayerControl.Legend.value){
this.GUI.layerControl.legend=stringToBoolean(_18.LayerControl.Legend.value,false);
}
if(_18.LayerControl.ReorderableLayers){
if(_18.LayerControl.ReorderableLayers.value){
this.GUI.layerControl.reorderableLayers=stringToBoolean(_18.LayerControl.ReorderableLayers.value,false);
}
if(_18.LayerControl.ReorderableLayers.DownArrow){
this.GUI.layerControl.downArrow=new ImageConfiguration(_18.LayerControl.ReorderableLayers.DownArrow);
}
if(_18.LayerControl.ReorderableLayers.UpArrow){
this.GUI.layerControl.upArrow=new ImageConfiguration(_18.LayerControl.ReorderableLayers.UpArrow);
}
}
}
if(_18.LookingGlass){
this.GUI.lookingGlass.override(_18.LookingGlass);
if(_18.LookingGlass.AlternateView&&_18.LookingGlass.AlternateView.value){
this.GUI.lookingGlass.alternateView=_18.LookingGlass.AlternateView.value;
}
if(_18.LookingGlass.Scale){
if(_18.LookingGlass.Scale.model){
this.GUI.lookingGlass.model=_18.LookingGlass.Scale.model;
}
if(_18.LookingGlass.Scale.value){
this.GUI.lookingGlass.scaleValue=_18.LookingGlass.Scale.value;
}
}
if(_18.LookingGlass.Configuration&&_18.LookingGlass.Configuration.file){
this.GUI.lookingGlass.configuration=_18.LookingGlass.Configuration.file;
}
if(_18.LookingGlass.JSONConfigurationObject&&_18.LookingGlass.JSONConfigurationObject.name){
this.GUI.lookingGlass.JSONConfigurationObject=_18.LookingGlass.JSONConfigurationObject.name;
}
}
if(_18.MiniMap){
this.GUI.miniMap.override(_18.MiniMap);
if(_18.MiniMap.AlternateView&&_18.MiniMap.AlternateView.value){
this.GUI.miniMap.alternateView=_18.MiniMap.AlternateView.value;
}
if(_18.MiniMap.Scale){
if(_18.MiniMap.Scale.model){
this.GUI.miniMap.model=_18.MiniMap.Scale.model;
}
if(_18.MiniMap.Scale.value){
this.GUI.miniMap.scaleValue=_18.MiniMap.Scale.value;
}
if(_18.MiniMap.Configuration&&_18.MiniMap.Configuration.file){
this.GUI.miniMap.configuration=_18.MiniMap.Configuration.file;
}
if(_18.MiniMap.JSONConfigurationObject&&_18.MiniMap.JSONConfigurationObject.name){
this.GUI.miniMap.JSONConfigurationObject=_18.MiniMap.JSONConfigurationObject.name;
}
}
if(_18.MiniMap.ShowMainMap&&_18.MiniMap.ShowMainMap.value){
this.GUI.miniMap.showMainMap=stringToBoolean(_18.MiniMap.ShowMainMap.value,true);
}
}
if(_18.MousePositionBox){
this.GUI.mousePositionBox.override(_18.MousePositionBox);
}
if(_18.OpenBox&&_18.OpenBox.OpenBox){
this.GUI.openBox=new ImageConfiguration(_18.OpenBox.OpenBox);
}else{
if(_18.OpenBox){
this.GUI.openBox=new ImageConfiguration(_18.OpenBox);
}
}
if(_18.Padding&&_18.Padding.value){
try{
var _19=parseInt(_18.Padding.value);
this.GUI.padding=_19;
}
catch(e){
}
}
if(_18.PanControl){
this.GUI.panControl.override(_18.PanControl);
if(_18.PanControl.PanUp){
this.GUI.panControl.panUp=new ImageConfiguration(_18.PanControl.PanUp);
}
if(_18.PanControl.PanDown){
this.GUI.panControl.panDown=new ImageConfiguration(_18.PanControl.PanDown);
}
if(_18.PanControl.PanLeft){
this.GUI.panControl.panLeft=new ImageConfiguration(_18.PanControl.PanLeft);
}
if(_18.PanControl.PanRight){
this.GUI.panControl.panRight=new ImageConfiguration(_18.PanControl.PanRight);
}
}
if(_18.ProgressIndicator&&_18.ProgressIndicator.ProgressIndicator){
this.GUI.progressIndicator=new ImageConfiguration(_18.ProgressIndicator.ProgressIndicator);
}else{
if(_18.ProgressIndicator){
this.GUI.progressIndicator=new ImageConfiguration(_18.ProgressIndicator);
}
}
if(_18.ScaleBar){
this.GUI.scaleBar.override(_18.ScaleBar);
if(_18.ScaleBar.mode){
this.GUI.scaleBar.mode=_18.ScaleBar.mode;
}
if(_18.ScaleBar.maxSize){
this.GUI.scaleBar.maxSize=_18.ScaleBar.maxSize;
}
}
if(_18.Strings){
if(_18.Strings.StartPoint&&_18.Strings.StartPoint.value){
this.GUI.strings.startPoint=_18.Strings.StartPoint.value;
}
if(_18.Strings.EndPoint&&_18.Strings.EndPoint.value){
this.GUI.strings.endPoint=_18.Strings.EndPoint.value;
}
if(_18.Strings.NoInfo&&_18.Strings.NoInfo.value){
this.GUI.strings.noInfo=_18.Strings.NoInfo.value;
}
if(_18.Strings.NoObject&&_18.Strings.NoObject.value){
this.GUI.strings.noObject=_18.Strings.NoObject.value;
}
if(_18.Strings.NoResults&&_18.Strings.NoResults.value){
this.GUI.strings.noResults=_18.Strings.NoResults.value;
}
}
if(_18.ZoomControl){
this.GUI.zoomControl.override(_18.ZoomControl);
if(_18.ZoomControl.ZoomInButton){
this.GUI.zoomControl.zoomInButton=new ImageConfiguration(_18.ZoomControl.ZoomInButton);
}
if(_18.ZoomControl.ZoomOutButton){
this.GUI.zoomControl.zoomOutButton=new ImageConfiguration(_18.ZoomControl.ZoomOutButton);
}
if(_18.ZoomControl.ZoomScaleElement){
this.GUI.zoomControl.zoomScaleElement=new ImageConfiguration(_18.ZoomControl.ZoomScaleElement);
}
if(_18.ZoomControl.ZoomScaleMarker){
this.GUI.zoomControl.zoomScaleMarker=new ImageConfiguration(_18.ZoomControl.ZoomScaleMarker);
}
}
};
MapConfiguration.prototype.overrideViewSettings=function(_1a){
if(_1a.ImageFormat&&_1a.ImageFormat.value){
this.viewSettings.imageFormat=_1a.ImageFormat.value;
}
if(_1a.TileSize&&_1a.TileSize.value){
this.viewSettings.tileSize=_1a.TileSize.value;
}
if(_1a.DisableObjectLayers&&_1a.DisableObjectLayers.value){
this.viewSettings.disableObjectLayers=_1a.DisableObjectLayers.value;
}
if(_1a.Borders){
if(_1a.Borders.active){
this.viewSettings.borders.active=stringToBoolean(_1a.Borders.active,false);
}
if(_1a.Borders.rectangle){
var _1b=_1a.Borders.rectangle;
var _1b=_1b.split(",");
if(_1b&&_1b.length==4){
try{
for(var i=0;i<_1b.length;i++){
_1b[i]=parseFloat(_1b[i]);
}
this.viewSettings.borders.geoRect=new GeoRectangle(_1b[0],_1b[1],_1b[2],_1b[3]);
}
catch(e){
this.viewSettings.borders.active=false;
}
}
}
}
if(_1a.RequestMaxLength&&_1a.RequestMaxLength.value){
try{
this.viewSettings.requestMaxLength=parseInt(_1a.RequestMaxLength.value);
}
catch(e){
this.viewSettings.requestMaxLength=1024;
}
}
if(_1a.MapTileService&&_1a.MapTileService.value){
this.viewSettings.mapTileService=_1a.MapTileService.value;
}
};
MapConfiguration.prototype.readLayerTemplates=function(_1d){
if(_1d.DefaultLayer){
this.readLayer(_1d.DefaultLayer,this.overlayLayers.defaultLayer);
}
if(_1d.LayerTemplate){
if(!_1d.LayerTemplate.length){
var _1e=new Array();
_1e.push(_1d.LayerTemplate);
}else{
var _1e=_1d.LayerTemplate;
}
for(var i=0;i<_1e.length;i++){
var _20=_1e[i].name;
var _21=false;
for(var j=0;j<this.overlayLayers.layerTemplates.length;j++){
if(_20==this.overlayLayers.layerTemplates[j].name){
this.readLayer(_1e[i],this.overlayLayers.layerTemplates[j]);
_21=true;
}
}
if(!_21){
var _23=this.readLayer(_1e[i]);
this.overlayLayers.layerTemplates.push(_23);
}
}
}
};
MapConfiguration.prototype.readLayer=function(_24,_25){
if(!_25){
layerCfg=new Object();
}
if(!_24){
return;
}
if(!_25){
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=_25;
}
layerCfg.name=_24.name;
if(_24.GeoObjects){
if(_24.GeoObjects.Parameter){
layerCfg.geoObjects.parameters=this.readParameterList(_24.GeoObjects.Parameter);
}
if(_24.GeoObjects.CombinedVisualization){
var _26=this.readCombinedImage(_24.GeoObjects.CombinedVisualization);
if(_26){
_26.replaceGroupRefs(this.visitedGroups);
layerCfg.geoObjects.defaultCombinedImage=_26;
}
}
}
if(_24.Shapes){
layerCfg.shapes=new Object();
if(_24.Shapes.Polygons){
if(_24.Shapes.Polygons.Parameter){
layerCfg.shapes.polygons=new Object();
layerCfg.shapes.polygons.parameters=this.readParameterList(_24.Shapes.Polygons.Parameter);
}
if(_24.Shapes.Polygons.Condition){
layerCfg.shapes.polygons.conditions=this.readConditionsList(_24.Shapes.Polygons.Condition);
}
}
if(_24.Shapes.Lines){
if(_24.Shapes.Lines.Parameter){
layerCfg.shapes.lines=new Object();
layerCfg.shapes.lines.parameters=this.readParameterList(_24.Shapes.Lines.Parameter);
}
if(_24.Shapes.Lines.Condition){
layerCfg.shapes.lines.conditions=this.readConditionsList(_24.Shapes.Lines.Condition);
}
}
}
if(_24.InfoBox){
layerCfg.infoBox=new GUIElement(_24.InfoBox);
if(_24.InfoBox.Parameter){
layerCfg.infoBox.parameters=this.readParameterList(_24.InfoBox.Parameter);
}
if(_24.InfoBox.Positioning&&_24.InfoBox.Positioning.value){
layerCfg.infoBox.positioning=_24.InfoBox.Positioning.value;
}
if(_24.InfoBox.positioning){
layerCfg.infoBox.positioning=_24.InfoBox.positioning;
}
if(_24.InfoBox.Margin){
layerCfg.infoBox.margin=stringToInt(_24.InfoBox.Margin.value,0);
}else{
layerCfg.infoBox.margin=0;
}
}
if(_24.Route){
if(_24.Route.DrivingDirections){
layerCfg.route.drivingDirections=new DrivingDirectionsConfiguration(_24.Route.DrivingDirections);
}
}else{
var _27={"DrivingDirections":{"active":"true","CollapseImage":{"image":"pic/standard/close2.png","tooltip":""},"css":"rwcDrivingDirectionOverlay","EvenItem":{"css":"rwcDrivingDirectionEvenItem"},"Heading":{"value":"Driving Directions"},"Images":{"Default":{"Left":{"height":"24px","image":"pic/standard/dd_turnleft.png","width":"24px"},"Right":{"height":"24px","image":"pic/standard/dd_turnright.png","width":"24px"},"Straight":{"height":"24px","image":"pic/standard/dd_straight.png","width":"24px"}},"Roundabout":{"Left":{"height":"24px","image":"pic/standard/dd_roundabout.png","width":"24px"},"Right":{"height":"24px","image":"pic/standard/dd_roundabout.png","width":"24px"},"Straight":{"height":"24px","image":"pic/standard/dd_roundabout.png","width":"24px"}},"Sliproad":{"Left":{"height":"24px","image":"pic/standard/dd_exit.png","width":"24px"},"Right":{"height":"24px","image":"pic/standard/dd_exit.png","width":"24px"},"Straight":{"height":"24px","image":"pic/standard/dd_exit.png","width":"24px"}},"Start":{"Left":{"height":"24px","image":"pic/standard/dd_start.png","width":"24px"},"Right":{"height":"24px","image":"pic/standard/dd_start.png","width":"24px"},"Straight":{"height":"24px","image":"pic/standard/dd_start.png","width":"24px"}},"Stop":{"Left":{"height":"24px","image":"pic/standard/dd_stop.png","width":"24px"},"Right":{"height":"24px","image":"pic/standard/dd_stop.png","width":"24px"},"Straight":{"height":"24px","image":"pic/standard/dd_stop.png","width":"24px"}}},"mode":"overlay","OddItem":{"css":"rwcDrivingDirectionOddItem"}}};
if(!layerCfg.route){
layerCfg.route=new Object();
}
layerCfg.route.drivingDirections=new DrivingDirectionsConfiguration(_27.DrivingDirections);
}
if(_24.Search){
if(_24.Search.SearchControl){
layerCfg.search.searchControl=new ListConfiguration(_24.Search.SearchControl);
}
if(_24.Search.ControlGroups&&_24.Search.ControlGroups.ControlGroup){
layerCfg.search.searchParameters.controlGroups=new Array();
if(!_24.Search.ControlGroups.ControlGroup.length){
var _28=new Array();
_28.push(_24.Search.ControlGroups.ControlGroup);
}else{
var _28=_24.Search.ControlGroups.ControlGroup;
}
for(var i=0;i<_28.length;i++){
layerCfg.search.searchParameters.controlGroups[i]=new ControlGroup(_28[i],this);
}
}
if(_24.Search.SearchResults){
layerCfg.search.searchResults=new ListConfiguration(_24.Search.SearchResults);
if(_24.Search.SearchResults.Parameter){
layerCfg.search.searchResults.parameters=this.readParameterList(_24.Search.SearchResults.Parameter);
}
}
if(_24.Search.SearchGUI){
layerCfg.search.searchGUI=new Object();
if(_24.Search.SearchGUI.SliderControl){
layerCfg.search.searchGUI.sliderControl=new GUIElement(_24.Search.SearchGUI.SliderControl);
if(_24.Search.SearchGUI.SliderControl.Bar){
layerCfg.search.searchGUI.sliderControl.bar=new ImageConfiguration(_24.Search.SearchGUI.SliderControl.Bar);
}
if(_24.Search.SearchGUI.SliderControl.BarFiller){
layerCfg.search.searchGUI.sliderControl.barFiller=new ImageConfiguration(_24.Search.SearchGUI.SliderControl.BarFiller);
}
if(_24.Search.SearchGUI.SliderControl.Marker){
layerCfg.search.searchGUI.sliderControl.marker=new ImageConfiguration(_24.Search.SearchGUI.SliderControl.Marker);
}
if(_24.Search.SearchGUI.SliderControl.Tick){
layerCfg.search.searchGUI.sliderControl.tick=new ImageConfiguration(_24.Search.SearchGUI.SliderControl.Tick);
}
}
}
if(_24.Search.ZoomToResults&&_24.Search.ZoomToResults.value){
layerCfg.search.zoomToResults=stringToBoolean(_24.Search.ZoomToResults.value,false);
}
}
if(_24.DownloadBehavior){
if(_24.DownloadBehavior.downloadModel){
layerCfg.downloadBehavior.downloadModel=_24.DownloadBehavior.downloadModel;
}
if(_24.DownloadBehavior.maxCount){
try{
layerCfg.downloadBehavior.maxCount=parseInt(_24.DownloadBehavior.maxCount);
}
catch(e){
layerCfg.downloadBehavior.maxCount=0;
}
}
if(_24.DownloadBehavior.initiation){
layerCfg.downloadBehavior.initiation=_24.DownloadBehavior.initiation;
}
if(_24.DownloadBehavior.timeout){
try{
layerCfg.downloadBehavior.timeout=parseInt(_24.DownloadBehavior.timeout);
}
catch(e){
layerCfg.downloadBehavior.timeout=0;
}
}
}
return layerCfg;
};
MapConfiguration.prototype.getLayerConfiguration=function(_2a){
for(var i=0;i<this.overlayLayers.layerTemplates.length;i++){
if(_2a==this.overlayLayers.layerTemplates[i].name){
return this.overlayLayers.layerTemplates[i];
}
}
return this.overlayLayers.defaultLayer;
};
MapConfiguration.prototype.readConditionsList=function(_2c){
var _2d=new Array();
if(_2c){
if(!_2c.length){
var _2e=new Array();
_2e.push(_2c);
}else{
_2e=_2c;
}
var n=_2e.length;
for(var i=0;i<n;i++){
var _31=new Object();
_31.name=_2e[i].name;
_31.value=_2e[i].value;
if(_2e[i].Parameter){
_31.parameters=this.readParameterList(_2e[i].Parameter);
}
_2d.push(_31);
}
}
return _2d;
};
MapConfiguration.prototype.readParameterList=function(_32){
var _33=new Array();
if(_32){
if(!_32.length&&_32.type){
_33[0]=this.readParameter(_32);
}else{
if(_32.length){
var n=_32.length;
for(var i=0;i<n;i++){
var _36=this.readParameter(_32[i]);
_33[i]=_36;
}
}
}
}
return _33;
};
MapConfiguration.prototype.readParameter=function(_37){
var _38=_37.type;
var _39=_37.serverName;
var _3a=_37.value;
var _3b=_37.label;
var _3c=_37.state;
if(_3c==null){
_3c="on";
}
var _3d=new Parameter(_39,_38,_3a,_3b,_3c);
if(_37.Image){
_3d.image=new ImageConfiguration(_37.Image);
}
if(_37.SelectedImage){
_3d.selectedImage=new ImageConfiguration(_37.SelectedImage);
}
if(_37.Alternate){
_3d.alternates=new Array();
for(var i=0;i<_37.Alternate.length;i++){
var _3f=_37.Alternate[i].serverName;
_3d.alternates[i]=_3f;
}
}
return _3d;
};
MapConfiguration.prototype.readCombinedImage=function(_40){
this.visitedGroups=new Array();
var _41=new Array();
_41=this.readCombinedImageParts(_40.ChildNodes);
var _42=new CombinedImage(_41);
return _42;
};
MapConfiguration.prototype.readCombinedImageParts=function(_43){
var _44=new Array();
if(_43){
for(variable in _43){
if(typeof (_43[variable])!="function"){
var _45=this.readCombinedImagePart(_43[variable]);
_44.push(_45);
}
}
}
return _44;
};
MapConfiguration.prototype.readCombinedImagePart=function(_46){
var _47=_46.NodeName;
var _48=null;
if(_47=="Condition"){
var _47=_46.type;
var _49=_46.attribute;
var _4a=_46.value;
var not=_46.not;
_48=new CombinedImageCondition(_47,_49,_4a,not);
}else{
if(_47=="Group"){
var id=_46.id;
_48=new CombinedImageGroup(id);
this.visitedGroups.push(_48);
}else{
if(_47=="GroupRef"){
var id=_46.id;
_48=new CombinedImageGroupRef(id);
}else{
if(_47=="Image"){
var _4d=_46.image;
var _4e=_46.imageAttribute;
var _4f=_46.tooltip;
var _50=_46.tooltipAttribute;
var _51=_46.width;
var _52=_46.widthAttribute;
var _53=_46.height;
var _54=_46.heightAttribute;
_48=new CombinedImageImage(_4d,_4e,_4f,_50,_51,_52,_53,_54);
}else{
if(_47=="Label"){
var _55=_46.caption;
var _56=_46.captionAttribute;
var css=_46.css;
_48=new CombinedImageLabel(_55,_56,css);
}else{
if(_47=="Offset"){
var x=_46.x;
var y=_46.y;
_48=new CombinedImageOffset(x,y);
}
}
}
}
}
}
if(_48){
_48.children=this.readCombinedImageParts(_46.ChildNodes);
}
return _48;
};
function ControlGroup(_5a,_5b){
this.type=_5a.type;
this.label=_5a.label;
this.css=_5a.css;
if(_5a.Parameter){
this.parameters=_5b.readParameterList(_5a.Parameter);
}
}
function Parameter(_5c,_5d,_5e,_5f,_60){
this.name=_5c;
this.type=_5d;
this.value=_5e;
this.label=_5f;
this.state=_60;
this.alternates=new Array();
}
Parameter.prototype.clone=function(){
var _61=new Parameter(this.name,this.type,this.value,this.label,this.state);
if(this.image){
_61.image=this.image.clone();
}
if(this.selectedImage){
_61.selectedImage=this.selectedImage.clone();
}
if(this.alternates){
_61.alternates=new Array();
for(var i=0;i<this.alternates.length;i++){
_61.alternates[i]=this.alternates[i];
}
}
return _61;
};
function CombinedImage(_63){
this.parts=_63;
}
CombinedImage.prototype.replaceGroupRefs=function(_64){
for(var i=0;i<this.parts.length;i++){
var _66=this.parts[i];
_66.replaceGroupRefs(_64);
}
};
CombinedImage.prototype.clone=function(){
var _67=new CombinedImage(new Array());
for(var i=0;i<this.parts.length;i++){
var _69=this.parts[i].clone();
_67.parts.push(_69);
}
return _67;
};
CombinedImage.prototype.bounds=function(_6a){
var _6b=new GeoRectangle(0,0,0,0);
var _6c=true;
for(var i=0;i<this.parts.length;i++){
var _6e=this.parts[i];
var _6f=_6e.bounds(_6a);
_6b=_6b.union(_6b,_6f);
_6c=_6c&&_6f.complete;
}
_6b.complete=_6c;
return _6b;
};
CombinedImage.prototype.inside=function(x,y,_72){
for(var i=0;i<this.parts.length;i++){
var _74=this.parts[i];
if(_74.inside(x,y,_72)){
return true;
}
}
return false;
};
CombinedImage.prototype.applyConfiguration=function(_75,_76,_77){
for(var i=0;i<this.parts.length;i++){
var _79=this.parts[i];
_79.applyConfiguration(_75,0,0,_76,_77);
}
};
CombinedImage.prototype.destroy=function(){
for(var i=0;i<this.parts.length;i++){
var _7b=this.parts[i];
_7b.destroy();
}
};
function applyConfigurationForChildren(_7c,_7d,_7e,_7f,_80){
for(var i=0;i<this.children.length;i++){
var _82=this.children[i];
_82.applyConfiguration(_7c,_7d,_7e,_7f,_80);
}
}
function destroyChildren(){
for(var i=0;i<this.children.length;i++){
var _84=this.children[i];
_84.destroy();
}
}
function replaceGroupRefsBase(_85){
for(var i=0;i<this.children.length;i++){
var _87=this.children[i];
var _88=_87.objectType;
if(_88=="CombinedImageGroupRef"){
for(var j=0;j<_85.length;j++){
if(_85[j].id==_87.id){
this.children[i]=_85[j].clone();
break;
}
}
}
this.children[i].replaceGroupRefs(_85);
}
}
function boundsOfChildren(_8a){
var _8b=new GeoRectangle(0,0,0,0);
var _8c=true;
for(var i=0;i<this.children.length;i++){
var _8e=this.children[i];
var _8f=_8e.bounds(_8a);
_8b=_8b.union(_8b,_8f);
_8c=_8c&&_8f.complete;
}
_8b.complete=_8c;
return _8b;
}
function insideChildren(x,y,_92){
for(var i=0;i<this.children.length;i++){
var _94=this.children[i];
if(_94.inside(x,y,_92)){
return true;
}
}
}
function findAttribute(_95,_96){
for(var i=0;i<_95.length;i++){
if(_95[i].name==_96){
return _95[i].value;
}
}
return null;
}
function CombinedImageCondition(_98,_99,_9a,not){
this.type=_98;
this.attributeName=_99;
this.attributeValue=_9a;
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(_9c){
if(this.matched){
return this.boundsOfChildren(_9c);
}else{
var _9d=new GeoRectangle(0,0,0,0);
_9d.complete=true;
return _9d;
}
};
CombinedImageCondition.prototype.insideChildren=insideChildren;
CombinedImageCondition.prototype.inside=function(x,y,_a0){
if(this.matched){
return this.insideChildren(x,y,_a0);
}else{
return false;
}
};
CombinedImageCondition.prototype.applyConfiguration=function(_a1,x,y,_a4,_a5){
switch(this.type){
case "value":
var _a6=findAttribute(_a4,this.attributeName);
this.matched=(_a6==this.attributeValue);
break;
case "selected":
this.matched=_a5;
break;
}
if(this.not&&this.not=="true"){
this.matched=!this.matched;
}
if(this.matched){
this.applyConfigurationForChildren(_a1,x,y,_a4,_a5);
}else{
this.destroy();
}
};
CombinedImageCondition.prototype.applyConfigurationForChildren=applyConfigurationForChildren;
CombinedImageCondition.prototype.destroy=destroyChildren;
CombinedImageCondition.prototype.clone=function(){
var _a7=new CombinedImageCondition(this.type,this.attributeName,this.attributeValue,this.not);
for(var i=0;i<this.children.length;i++){
_a7.children.push(this.children[i].clone());
}
return _a7;
};
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 _aa=new CombinedImageGroup(this.id);
for(var i=0;i<this.children.length;i++){
_aa.children.push(this.children[i].clone());
}
return _aa;
};
function CombinedImageGroupRef(id){
this.id=id;
this.objectType="CombinedImageGroupRef";
this.children=new Array();
}
CombinedImageGroupRef.prototype.replaceGroupRefs=replaceGroupRefsBase;
function CombinedImageImage(_ad,_ae,_af,_b0,_b1,_b2,_b3,_b4){
this.image=_ad;
this.imageAttribute=_ae;
this.tooltip=_af;
this.tooltipAttribute=_b0;
this.width=_b1;
this.widthAttribute=_b2;
this.height=_b3;
this.heightAttribute=_b4;
this.objectType="CombinedImageImage";
this.children=new Array();
this.imgNode=null;
}
CombinedImageImage.prototype.replaceGroupRefs=replaceGroupRefsBase;
CombinedImageImage.prototype.boundsOfChildren=boundsOfChildren;
CombinedImageImage.prototype.bounds=function(_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;
var _ba=this.boundsOfChildren(_b5);
var _bb=_ba.complete;
_ba=_ba.union(_ba,new GeoRectangle(_b8,_b9,0,0));
_ba.complete=_bb;
return _ba;
};
CombinedImageImage.prototype.insideChildren=insideChildren;
CombinedImageImage.prototype.inside=function(x,y,_be){
var _bf=0;
var _c0=0;
try{
_bf=parseInt(this.width,10);
_c0=parseInt(this.height,10);
}
catch(e){
}
var _c1=_be.getPixelsToViewUnits()*_bf;
var _c2=_be.getPixelsToViewUnits()*_c0;
if(x>=0&&x<=_c1&&y>=0&&y<=_c2){
return true;
}else{
return this.insideChildren(x,y,_be);
}
};
CombinedImageImage.prototype.applyConfiguration=function(_c3,x,y,_c6,_c7){
var _c8=new ImageConfiguration();
var _c9=this.image;
if(this.imageAttribute){
_c9=findAttribute(_c6,this.imageAttribute);
if(!_c9){
_c9=this.image;
}
}
var _ca=this.tooltip;
if(this.tooltipAttribute){
_ca=findAttribute(_c6,this.tooltipAttribute);
if(!_ca){
_ca=this.tooltip;
}
}
var _cb=this.width;
if(this.widthAttribute){
_cb=findAttribute(_c6,this.widthAttribute);
if(!_cb){
_cb=this.width;
}
}
var _cc=this.height;
if(this.heightAttribute){
_cc=findAttribute(_c6,this.heightAttribute);
if(!_cc){
_cc=this.height;
}
}
_c8.setImage(_c9,_cb,_cc,_ca);
if(!this.imgNode){
var _cd=document.createElement("img");
this.imgNode=_cd;
_c3.appendChild(_cd);
}
_c8.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(_c3,x,y,_c6,_c7);
};
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 _d0=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++){
_d0.children.push(this.children[i].clone());
}
return _d0;
};
function CombinedImageLabel(_d2,_d3,css){
this.caption=_d2;
this.captionAttribute=_d3;
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(_d5){
var _d6=this.boundsOfChildren(_d5);
if(this.pNode){
var _d7=this.pNode.offsetWidth;
var _d8=this.pNode.offsetHeight;
if(_d7){
var _d9=_d5.getPixelsToViewUnits()*_d7;
var _da=_d5.getPixelsToViewUnits()*_d8;
_d6=_d6.union(_d6,new GeoRectangle(_d9,_da,0,0));
_d6.complete=true;
return _d6;
}
}
_d6.complete=false;
return _d6;
};
CombinedImageLabel.prototype.insideChildren=insideChildren;
CombinedImageLabel.prototype.inside=function(x,y,_dd){
if(this.pNode){
var _de=this.pNode.offsetWidth;
var _df=this.pNode.offsetHeight;
if(_de){
var _e0=_dd.getPixelsToViewUnits()*_de;
var _e1=_dd.getPixelsToViewUnits()*_df;
var _e2=x>=0&&x<=_e0&&y>=0&&y<=_e1;
if(_e2){
_e2=_e2;
}
return _e2;
}
}
return this.insideChildren(x,y,_dd);
};
CombinedImageLabel.prototype.applyConfiguration=function(_e3,x,y,_e6,_e7){
if(!this.pNode){
var _e8=document.createElement("div");
this.pNode=_e8;
}
if(this.css){
this.pNode.className=this.css;
}
if(this.captionAttribute){
var _e9=findAttribute(_e6,this.captionAttribute);
if(_e9){
this.pNode.innerHTML=_e9;
}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"){
_e3.appendChild(this.pNode);
}
this.applyConfigurationForChildren(x,y,_e3,_e6,_e7);
};
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 _ea=new CombinedImageLabel(this.caption,this.captionAttribute,this.css);
for(var i=0;i<this.children.length;i++){
_ea.children.push(this.children[i].clone());
}
return _ea;
};
function CombinedImageOffset(x,y,_ee){
this.x=x;
this.y=y;
this.attributeName=_ee;
this.objectType="CombinedImageOffset";
this.children=new Array();
}
CombinedImageOffset.prototype.replaceGroupRefs=replaceGroupRefsBase;
CombinedImageOffset.prototype.boundsOfChildren=boundsOfChildren;
CombinedImageOffset.prototype.bounds=function(_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;
var _f4=this.boundsOfChildren(_ef);
var _f5=_f4.complete;
_f4=new GeoRectangle(_f4.xMax+_f2,_f4.yMax+_f3,_f4.xMin+_f2,_f4.yMin+_f3);
_f4.complete=_f5;
return _f4;
};
CombinedImageOffset.prototype.insideChildren=insideChildren;
CombinedImageOffset.prototype.inside=function(x,y,_f8){
var _f9=0;
var _fa=0;
try{
_f9=parseInt(this.x,10);
_fa=parseInt(this.y,10);
}
catch(e){
}
var _fb=_f8.getPixelsToViewUnits()*_f9;
var _fc=_f8.getPixelsToViewUnits()*_fa;
return this.insideChildren(x-_fb,y-_fc,_f8);
};
CombinedImageOffset.prototype.applyConfiguration=function(_fd,x,y,_100,_101){
var _102=findAttribute(_100,this.attributeName);
if(_102){
var _103=_102.split(",");
if(_103.length==2){
this.x=_103[0];
this.y=_103[1];
}
}
var _104=0;
var _105=0;
try{
_104=parseInt(this.x,10);
_105=parseInt(this.y,10);
}
catch(e){
}
this.applyConfigurationForChildren(_fd,x+_104,y+_105,_100,_101);
};
CombinedImageOffset.prototype.applyConfigurationForChildren=applyConfigurationForChildren;
CombinedImageOffset.prototype.destroy=destroyChildren;
CombinedImageOffset.prototype.clone=function(){
var _106=new CombinedImageOffset(this.x,this.y,this.attributeName);
for(var i=0;i<this.children.length;i++){
_106.children.push(this.children[i].clone());
}
return _106;
};
function ImageConfiguration(_108){
if(_108){
this.image=_108.image;
this.tooltip=_108.tooltip;
if(_108.width){
this.width=_108.width;
}
if(_108.height){
this.height=_108.height;
}
}
}
ImageConfiguration.prototype.setImage=function(_109,_10a,_10b,_10c){
this.image=_109;
this.width=_10a;
this.height=_10b;
this.tooltip=_10c;
};
ImageConfiguration.prototype.override=function(_10d){
var _10e=_10d.getAttribute("image");
if(_10e){
this.image=_10e;
}else{
this.image="";
}
var _10f=_10d.getAttribute("tooltip");
if(_10f){
this.tooltip=_10f;
}else{
this.tooltip="";
}
var _110=_10d.getAttribute("width");
if(_110){
this.width=_110;
}
var _111=_10d.getAttribute("height");
if(_111){
this.height=_111;
}
};
ImageConfiguration.prototype.clone=function(){
var _112=new ImageConfiguration(null);
_112.image=this.image;
_112.tooltip=this.tooltip;
_112.width=this.width;
_112.height=this.height;
return _112;
};
ImageConfiguration.prototype.applyConfiguration=function(_113){
setImageSource(_113,this.image);
if(typeof (this.tooltip)!="undefined"){
_113.alt=this.tooltip;
_113.title=this.tooltip;
}
try{
if(this.height){
_113.style.height=this.height;
}
if(this.width){
_113.style.width=this.width;
}
}
catch(e){
}
};
function ListConfiguration(_114,_115){
if(!_114){
return;
}
var _116=_114.active;
if(_116=="false"){
this.active=false;
}else{
this.active=true;
}
this.mode=_114.mode;
this.css=_114.css;
if(!this.css){
this.css="";
}
if(_114.Heading&&_114.Heading.value){
this.heading=_114.Heading.value;
}
if(_114.ExpandImage){
this.expandImage=new ImageConfiguration(_114.ExpandImage);
}
if(_114.CollapseImage){
this.collapseImage=new ImageConfiguration(_114.CollapseImage);
}
if(_114.ListImage){
this.listImage=new ImageConfiguration(_114.ListImage);
}
if(_114.SelectedListImage){
this.selectedListImage=new ImageConfiguration(_114.SelectedListImage);
}
if(_114.BackImage){
this.backImage=new ImageConfiguration(_114.BackImage);
}
if(_114.ForwardImage){
this.forwardImage=new ImageConfiguration(_114.ForwardImage);
}
}
ListConfiguration.prototype.setValues=function(_117,css,mode,_11a,_11b,_11c,_11d,_11e,_11f,_120){
this.active=_117;
this.mode=mode;
this.css=css;
this.heading=_11a;
this.expandImage=_11b;
this.collapseImage=_11c;
this.listImage=_11d;
this.selectedListImage=_11e;
this.backImage=_11f;
this.forwardImage=_120;
};
ListConfiguration.prototype.override=function(_121){
if(_121.active){
this.active=stringToBoolean(_121.active,false);
}
if(_121.mode=="docked"||_121.mode=="overlay"||_121.mode=="standalone"){
this.mode=_121.mode;
}
if(_121.css!=null){
this.css=_121.css;
}
if(_121.Heading&&_121.Heading.value){
this.heading=_121.Heading.value;
}
if(_121.ExpandImage){
this.expandImage=new ImageConfiguration(_121.ExpandImage);
}
if(_121.CollapseImage){
this.collapseImage=new ImageConfiguration(_121.CollapseImage);
}
if(_121.ListImage){
this.listImage=new ImageConfiguration(_121.ListImage);
}
if(_121.SelectedListImage){
this.selectedListImage=new ImageConfiguration(_121.SelectedListImage);
}
if(_121.BackImage){
this.backImage=new ImageConfiguration(_121.BackImage);
}
if(_121.ForwardImage){
this.forwardImage=new ImageConfiguration(_121.ForwardImage);
}
};
function DrivingDirectionsConfiguration(_122){
if(!_122){
return;
}
var _123=_122.active;
if(_123=="false"){
this.active=false;
}else{
this.active=true;
}
this.mode=_122.mode;
this.css=_122.css;
if(!this.css){
this.css="";
}
if(_122.Heading&&_122.Heading.value){
this.heading=_122.Heading.value;
}
if(_122.EvenItem&&_122.EvenItem.css){
this.evenItemCSS=_122.EvenItem.css;
}
if(_122.OddItem&&_122.OddItem.css){
this.oddItemCSS=_122.OddItem.css;
}
if(_122.CollapseImage){
this.collapseImage=new ImageConfiguration(_122.CollapseImage);
}
if(_122.Images){
this.images=new Object();
for(var obj in _122.Images){
if(_122.Images[obj]&&typeof (_122.Images[obj])!="function"){
var type=obj.toLowerCase();
this.images[type]=new Object();
for(var _126 in _122.Images[obj]){
if(_122.Images[obj][_126]&&typeof (_122.Images[obj][_126])!="function"){
var _127=_126.toLowerCase();
var _128=_122.Images[obj][_126].image;
var _129=_122.Images[obj][_126].width;
var _12a=_122.Images[obj][_126].height;
this.images[type][_127]=new Object();
this.images[type][_127].image=_128;
this.images[type][_127].width=_129;
this.images[type][_127].height=_12a;
}
}
}
}
}
}
function GUIElement(_12b){
if(_12b==null){
return;
}
this.active=stringToBoolean(_12b.active,false);
var mode=_12b.mode;
if(mode=="docked"||mode=="overlay"||mode=="standalone"){
this.mode=mode;
}else{
this.mode="overlay";
}
var css=_12b.css;
if(css){
this.css=css;
}else{
this.css="";
}
}
GUIElement.prototype.override=function(_12e){
if(_12e.active){
this.active=stringToBoolean(_12e.active,false);
}
if(_12e.mode=="docked"||_12e.mode=="overlay"||_12e.mode=="standalone"){
this.mode=_12e.mode;
}
if(_12e.css!=null){
this.css=_12e.css;
}
};
GUIElement.prototype.setValues=function(_12f,css,mode){
this.active=_12f;
this.css=css;
this.mode=mode;
};
GUIElement.prototype.overrideGUIElement=function(_132){
var _133=_132.getAttribute("active");
if(_133){
if(_133=="false"){
this.active=false;
}else{
if(_133=="true"){
this.active=true;
}
}
}
var mode=_132.getAttribute("mode");
if(mode=="docked"||mode=="overlay"||mode=="standalone"){
this.mode=mode;
}
var css=_132.getAttribute("css");
if(css!=null){
this.css=css;
}
};
GUIElement.prototype.clone=function(){
var _136=new GUIElement(null);
_136.setValues(this.active,this.css,this.mode);
return _136;
};
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 _142=new GeoRectangle(maxX,maxY,minX,minY);
return _142;
};

function ZoomTool(_1,_2,_3){
this.saMap=_1;
this.type="zoom";
this.name="Zoom Tool";
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){
this.startPoint=this.saMap.startDragToolBehaviour(_4,this);
setVisible(this.zoomRect,true);
setVisible(this.zoomRect,true);
this.currentPoint=this.startPoint;
setX(this.zoomRect,this.startPoint.x);
setY(this.zoomRect,this.startPoint.y);
setWidth(this.zoomRect,1);
setHeight(this.zoomRect,1);
};
ZoomTool.prototype.manipulate=function(_5){
this.currentPoint=_5;
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);
}
};
ZoomTool.prototype.cancelManipulation=function(){
setVisible(this.zoomRect,false);
};
ZoomTool.prototype.endManipulation=function(){
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.zoomToRect(getX(this.zoomRect),getY(this.zoomRect),getWidth(this.zoomRect),getHeight(this.zoomRect));
}
};
ZoomTool.prototype.unload=function(){
};
function PanTool(_a){
this.saMap=_a;
this.type="pan";
this.name="Pan Tool";
this.manipulateFunc=associateObjWithEvent(this,"manipulate");
this.endManipulationFunc=associateObjWithEvent(this,"endManipulation");
this.cursor="move";
}
PanTool.prototype.startManipulation=function(_b){
if(this.saMap.mainMap){
if(this.saMap.currentTool.type="pan"){
this.saMap.mainMap.currentTool.startManipulation(_b);
this.saMap.manipulationActive=false;
return;
}else{
return;
}
}
this.startPoint=this.saMap.startDragToolBehaviour(_b,this);
this.saMap.beginDrag();
};
PanTool.prototype.manipulate=function(_c){
var _d=_c;
this.saMap.drag(_d.x-this.startPoint.x,_d.y-this.startPoint.y);
};
PanTool.prototype.cancelManipulation=function(){
this.saMap.endDrag();
};
PanTool.prototype.endManipulation=function(_e,_f){
this.saMap.endDrag();
};
PanTool.prototype.unload=function(){
};
function SelectionTool(_10,_11,_12){
this.saMap=_10;
this.embedDiv=_12;
this.type="select";
this.name="Select Tool";
this.selectRect=document.createElement("div");
this.selectRect.id=_11+"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){
setVisible(this.selectRect,true);
this.startPoint=this.saMap.startDragToolBehaviour(evt,this);
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);
};
SelectionTool.prototype.manipulate=function(_14){
this.currentPoint=_14;
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);
}
};
SelectionTool.prototype.cancelManipulation=function(){
setVisible(this.selectRect,false);
};
SelectionTool.prototype.endManipulation=function(){
setVisible(this.selectRect,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)){
var _19=getX(this.selectRect);
var _1a=_19+getWidth(this.selectRect);
var _1b=getY(this.selectRect);
var _1c=_1b+getHeight(this.selectRect);
var _1d=this.saMap.getGeoObjectsBySelection(_1a,_1c,_19,_1b);
var _1e=this.saMap.createObjectSelectionList(_1d,false);
if(this.outPutElement){
this.outPutElement.innerHTML=_1e.innerHTML;
}
}
};
SelectionTool.prototype.unload=function(){
};

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,_8){
this.mapServerUrl=_2;
this.saMap=_3;
this.invisibleControl=_8;
this.searchGUI=_6.searchGUI;
this.container=document.createElement("div");
this.container.id=this.saMap.prefix+_4.name+"SearchControl";
if(this.invisibleControl){
this.container.style.display="none";
}
if(_6.searchControl.css&&_6.searchControl.css!=""){
addClass(this.container,_6.searchControl.css);
}else{
addClass(this.container,"rwcSearchControlOverlay");
}
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();
if(this.layer.configuration.search.controlGroups){
var _9=false;
var _a=false;
for(var i=0;i<this.layer.configuration.search.controlGroups.length;i++){
if(this.layer.configuration.search.controlGroups[i].type=="geoCoding"){
if(_a){
throw new Error("Cannot have controls for geocoding and reverse geocoding in the same layer!");
}
this.controlGroups[i]=new GeoCodingControlGroup(this.layer.configuration.search.controlGroups[i],this.container,this,this.downloadBehavior);
_9=true;
}else{
if(this.layer.configuration.search.controlGroups[i].type=="reverseGeoCoding"){
if(_9){
throw new Error("Cannot have controls for geocoding and reverse geocoding in the same layer!");
}
this.controlGroups[i]=new GeoCodingControlGroup(this.layer.configuration.search.controlGroups[i],this.container,this,this.downloadBehavior);
_a=true;
}else{
this.controlGroups[i]=new SearchControlGroup(this.layer.configuration.search.controlGroups[i],this.container,this,this.downloadBehavior);
}
}
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(_c,_d){
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(_f){
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 _10=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 _10=this.controlGroups[j].filter(this.layer.geoObjectArray[i]);
if(!_10){
this.layer.geoObjectArray[i].hide();
break;
}
}
}
if(_10){
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 _15="";
for(var i=0;i<this.controlGroups.length;i++){
if(this.controlGroups[i].isServerSearch){
_15+=this.controlGroups[i].buildSearchString();
}
}
return _15;
};
SearchControl.prototype.addResults=function(_17){
if(typeof (this.layer.geoObjectArray)=="undefined"){
return;
}
this.initiateClientSearch();
if(this.layer.configuration.search.searchResults.active){
this.drawSearchResultsList(_17);
}
this.layer.draw();
};
SearchControl.prototype.drawSearchResultsList=function(_18){
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 _1a=document.createElement("h4");
_1a.className="rwcSearchResultHeading";
_1a.innerHTML=this.layer.configuration.search.searchResults.heading;
this.resultsBox.appendChild(_1a);
}
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 _1b=document.createElement("div");
_1b.innerHTML=this.saMap.config.GUI.strings.noResults;
this.resultsBox.appendChild(_1b);
setVisible(this.resultsBox,true);
return;
}
var _1c=this.resultsBox.parentNode.offsetHeight-this.resultsBox.offsetTop-this.guiHeight;
this.maxResultsPerPage=Math.floor(_1c/this.itemHeight);
if(this.maxResultsPerPage>10){
this.maxResultsPerPage=10;
}
if(this.maxResultsPerPage<=0){
this.maxResultsPerPage=1;
}
this.startIndex=_18;
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 _1d=new SearchResult(this.layer.geoObjectArray[i],this.resultsBox,this.saMap);
this.searchResultArray.push(_1d);
}
this.indexText=document.createElement("span");
this.resultsBox.appendChild(this.indexText);
this.indexText.innerHTML=this.startIndex+"-"+(this.startIndex+this.pageCount)+" ("+this.maxCount+")";
var _1e=document.createElement("br");
this.resultsBox.appendChild(_1e);
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,_20){
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,_22){
this.startIndex-=this.maxResultsPerPage;
if(this.startIndex<0){
this.startIndex=0;
}
this.addResults(this.startIndex);
};
SearchControl.prototype.reduceSearchResults=function(_23,_24,_25){
if(!this.layer.geoObjectArray){
return;
}
var n=this.layer.geoObjectArray.length;
switch(_25){
case ("toggle"):
for(var i=0;i<n;i++){
if(!this.layer.geoObjectArray[i].searchAttributes[_23]||this.layer.geoObjectArray[i].searchAttributes[_23]==_24){
this.layer.geoObjectArray[i].hide();
}
}
break;
case ("string"):
var _28=new RegExp("("+_24+")");
for(var i=0;i<n;i++){
if(!this.layer.geoObjectArray[i].searchAttributes[_23]||!_28.test(this.layer.geoObjectArray[i].searchAttributes[_23])){
this.layer.geoObjectArray[i].hide();
}
}
break;
case ("interval"||"slider"):
for(var i=0;i<n;i++){
var _29=parseInt(this.layer.geoObjectArray[i].searchAttributes[_23]);
if(isNaN(_24.min)&&isNaN(_24.max)){
break;
}
if(isNaN(_29)||_29<_24.min||_29>_24.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(_2b,_2c,_2d){
this.node=document.createElement("div");
this.geoObject=_2b;
this.saMap=_2d;
this.node.className="rwcSearchListItem";
this.container=_2c;
_2c.appendChild(this.node);
for(var j=0;j<_2b.searchResultParameters.length;j++){
if(typeof (_2b.searchResultAttributes[j])!="undefined"){
var _2f=_2b.attributes[_2b.searchResultAttributes[j]].value;
}else{
var _2f=_2b.searchResultParameters[j].value;
}
if(_2f!=null&&_2f!=""){
this.node.innerHTML+="<div>"+_2f+"</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,_31){
var _32=this.saMap.mapWidth/2-this.geoObject.viewX;
var _33=this.saMap.mapHeight/2-this.geoObject.viewY;
this.saMap.beginDrag();
this.saMap.drag(_32,_33);
this.saMap.endDrag();
this.geoObject.updateInfoBox();
};
SearchResult.prototype.searchItemMouseOver=function(evt,_35){
this.geoObject.displayInfoBox();
};
SearchResult.prototype.searchItemMouseOut=function(evt,_37){
this.geoObject.cancelInfoBox();
};
SearchResult.prototype.unload=function(evt,_39){
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(_3a,_3b,_3c,_3d){
this.container=document.createElement("div");
this.configuration=_3a;
this.type=_3a.type;
if(this.type=="client"){
this.isServerSearch=false;
}else{
this.isServerSearch=true;
}
this.searchControl=_3c;
this.container.className=this.configuration.css;
this.controlList=new Array();
if(this.configuration.parameters){
for(var i=0;i<this.configuration.parameters.length;i++){
this.addControl(this.configuration.parameters[i]);
}
}
if(_3d.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);
}
_3b.appendChild(this.container);
}
SearchControlGroup.prototype.buildSearchString=function(){
var _3f="";
for(var i=0;i<this.controlList.length;i++){
_3f+=this.controlList[i].buildSearchString();
}
return _3f;
};
SearchControlGroup.prototype.filter=function(_41){
for(var i=0;i<this.controlList.length;i++){
var _43=this.controlList[i].filter(_41);
if(!_43){
return false;
}
}
return true;
};
SearchControlGroup.prototype.addToAttributeList=function(_44){
for(var i=0;i<this.controlList.length;i++){
var _46=false;
for(var j=0;j<_44.length;j++){
if(this.controlList[i].name==_44[j]){
_46=true;
this.controlList[i].attributeId=j;
break;
}
}
if(!_46){
this.controlList[i].attributeId=_44.length;
_44.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(false);
}
}
};
SearchControlGroup.prototype.reduceSearchResults=function(_48,_49,_4a){
if(this.type="client"){
this.searchControl.reduceSearchResults(_48,_49,_4a);
}else{
this.update();
}
};
SearchControlGroup.prototype.onSearchButtonClick=function(evt,_4c){
this.update();
};
SearchControlGroup.prototype.onClearButtonClick=function(evt,_4e){
this.searchControl.clearSearch();
};
SearchControlGroup.prototype.clear=function(evt,_50){
for(var i=0;i<this.controlList.length;i++){
this.controlList[i].clear();
}
};
SearchControlGroup.prototype.addControl=function(_52){
var _53;
switch(_52.type){
case ("toggle"):
if(!_52.image){
_52.image=this.searchControl.layer.configuration.searchControl.listImage;
}
if(!_52.selectedImage){
_52.selectedImage=this.searchControl.layer.configuration.searchControl.selectedListImage;
}
_53=new ToggleControl(_52,this.container,this,this.isServerSearch);
break;
case ("string"):
_53=new StringControl(_52,this.container,this,this.isServerSearch);
break;
case ("interval"):
_53=new IntervalControl(_52,this.container,this,this.isServerSearch);
break;
case ("slider"):
_53=new SliderControl(_52,this.container,this,this.isServerSearch,this.searchControl.searchGUI);
break;
case ("select"):
_53=new SelectControl(_52,this.container,this,this.isServerSearch);
break;
}
if(_53){
this.controlList.push(_53);
}
};
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(_55,_56,_57,_58){
this.selected=true;
this.name=_55.name;
this.imageConfig=_55.image;
this.selectedImageConfig=_55.selectedImage;
this.value=_55.value.toLowerCase();
this.isServerSearch=_58;
this.controlGroup=_57;
this.container=document.createElement("div");
this.image=document.createElement("img");
if(_55.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+=_55.label;
this.container.appendChild(this.text);
_56.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){
if(this.controlGroup.searchControl.isAutomatic){
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 _59="&context-"+this.name+"="+this.value;
}else{
var _59="";
}
return encodeURI(_59);
};
ToggleControl.prototype.filter=function(_5a){
if(this.selected){
return true;
}else{
if(_5a.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(_5b,_5c,_5d,_5e){
this.controlGroup=_5d;
this.name=_5b.name;
this.value=_5b.value;
this.lastValue="";
this.isServerSearch=_5e;
this.container=document.createElement("div");
this.container.innerHTML+=_5b.label+"<br>";
this.searchBox=document.createElement("input");
this.searchBox.setAttribute("autocomplete","off");
this.container.appendChild(this.searchBox);
_5c.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,_60){
if(evt.keyCode=="13"){
this.controlGroup.update();
}
};
StringControl.prototype.onKeyUp=function(evt,_62){
var _63=new RegExp("/^"+this.lastValue).test(this.searchBox.value);
if(this.searchBox.value.length>=this.lastValue.length&&_63){
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(_64){
if(_64.searchAttributes[this.attributeId]!=null){
if(_64.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(_65,_66,_67,_68){
this.controlGroup=_67;
this.name=_65.name;
this.value=_65.value;
this.isServerSearch=_68;
this.container=document.createElement("div");
this.container.innerHTML+=_65.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);
_66.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 _6a=new Interval(min,max);
this.controlGroup.reduceSearchResults(this.attributeId,_6a,"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 _6c=new Interval(min,max);
this.controlGroup.reduceSearchResults(this.attributeId,_6c,"interval");
}else{
this.controlGroup.update();
}
}
if(!isNaN(max)){
this.previousMaxValue=max;
}else{
this.previousMaxValue=null;
}
};
IntervalControl.prototype.filter=function(_6d){
var _6e=parseInt(_6d.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=_6e+1;
}
if(isNaN(min)){
min=_6e-1;
}
if(isNaN(_6e)||_6e<min||_6e>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(_71,_72,_73,_74,_75){
this.controlGroup=_73;
this.name=_71.name;
this.isServerSearch=_74;
var _76=_71.value.split(":");
if(_76.length==2){
this.type=_76[0];
if(this.type=="enum"){
this.valueArray=_76[1].split(",");
this.value=new Interval(0,this.valueArray.length);
this.valueArray.push("");
}else{
var _77=_76[1].split(",");
if(_77.length==2){
this.value=new Interval(parseInt(_77[0]),parseInt(_77[1]));
}else{
}
}
}else{
this.type="range";
var _77=_71.value.split(",");
if(_77.length==2){
this.value=new Interval(parseInt(_77[0]),parseInt(_77[1]));
}else{
return;
}
}
this.container=document.createElement("div");
this.label=document.createElement("p");
this.label.className="rwcSliderLabel";
this.label.innerHTML+=_71.label+"<br>";
this.container.appendChild(this.label);
this.barContainer=document.createElement("span");
this.barContainer.style.position="absolute";
if(_75.sliderControl.bar){
this.barLength=parseInt(_75.sliderControl.bar.width);
this.barHeight=parseInt(_75.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(_75&&_75.sliderControl){
setImageSource(this.bar,_75.sliderControl.bar.image);
setImageSource(this.barFiller,_75.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(_75.sliderControl.marker.image){
var _78=_75.sliderControl.marker.image;
this.markerAdjustX=parseInt(_75.sliderControl.marker.width);
}else{
var _78="pic/standard/slidebar_control.png";
this.markerAdjustX=19;
}
if(this.type=="enum"){
var _79=this.barLength/(this.valueArray.length-1);
var _7a=parseInt(_75.sliderControl.tick.width);
if(_75.sliderControl.tick.width&&_79>_7a){
for(var i=1;i<this.valueArray.length-1;i++){
var _7c=document.createElement("img");
_75.sliderControl.tick.applyConfiguration(_7c);
_7c.className="rwcSliderTick";
_7c.style.left=(Math.round(_79*i)-this.markerAdjustX/2-(_7a/2))+"px";
this.barContainer.appendChild(_7c);
}
}
}
if(this.type=="range"||this.type=="min"){
this.minElement=this.createMarker(_78,0);
this.barContainer.appendChild(this.minElement);
}
if(this.type=="range"||this.type=="max"||this.type=="enum"){
this.maxElement=this.createMarker(_78,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);
_72.appendChild(this.container);
this.updateFiller();
this.dragDelegate=associateObjWithEvent(this,"beginDrag");
Evt.addEventListener(this.barContainer,"mousedown",this.dragDelegate);
}
SliderControl.prototype.createMarker=function(img,_7e){
var _7f=document.createElement("img");
_7f.style.left=_7e+"px";
_7f.style.position="absolute";
setImageSource(_7f,img);
return _7f;
};
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 _82=this.currentMax;
}else{
var _82=this.value.max;
}
searchString="&context-"+this.name+"="+this.valueArray[_82];
break;
}
return searchString;
};
SliderControl.prototype.beginDrag=function(evt,_84){
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 _85=getPixelPositionFromEvent(evt,this.barContainer);
var _86=_85.x;
this.minElementAdjustX=this.minElement.offsetWidth/2;
var _87=parseInt(this.minElement.style.left);
minD=Math.abs(_87+this.minElementAdjustX-_86);
this.maxElementAdjustX=this.maxElement.offsetWidth/2;
var _88=parseInt(this.maxElement.style.left);
maxD=Math.abs(_88+this.maxElementAdjustX-_86);
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,_8a){
evt=new Evt(evt);
var _8b=getPixelPositionFromEvent(evt,this.barContainer);
var _8c=_8b.x;
if(this.activeControl==0){
var _8d=_8c-this.minElementAdjustX;
if(_8d<0){
_8d=0;
var _8e=true;
}
if(this.maxElement){
var _8f=parseInt(this.maxElement.style.left);
if(_8d>_8f-this.maxElement.offsetWidth){
_8d=_8f-this.maxElement.offsetWidth;
}
}else{
if(_8d>this.bar.offsetWidth-this.minElement.offsetWidth){
_8d=this.bar.offsetWidth-this.minElement.offsetWidth;
}
}
this.minElement.style.left=_8d+"px";
this.updateFiller();
if(_8e){
this.currentMin=null;
this.updateLabels();
}else{
if(this.maxElement){
this.currentMin=Math.round((_8d/(this.bar.offsetWidth-this.maxElement.offsetWidth))*(this.value.max-this.value.min))+this.value.min;
}else{
this.currentMin=Math.round((_8d/(this.bar.offsetWidth-this.minElement.offsetWidth))*(this.value.max-this.value.min))+this.value.min;
}
this.updateLabels();
}
this.controlGroup.update();
}else{
var _8d=_8c-this.maxElementAdjustX;
if(_8d>this.bar.offsetWidth-this.maxElement.offsetWidth){
var _8e=true;
_8d=this.bar.offsetWidth-this.maxElement.offsetWidth;
}else{
if(this.minElement){
var _90=parseInt(this.minElement.style.left);
if(_8d<_90+this.minElement.offsetWidth){
_8d=_90+this.minElement.offsetWidth;
}
}else{
if(_8d<0){
_8d=0;
}
}
}
if(this.type!="enum"){
this.maxElement.style.left=_8d+"px";
}
this.updateFiller();
if(_8e){
this.currentMax=null;
}else{
this.currentMax=Math.round((_8d/(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,_92){
this.drag(evt,_92);
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 _93=parseInt(this.minElement.style.left)+this.markerAdjustX/2;
}else{
if(parseInt(this.maxElement.style.left)>this.markerAdjustX/2){
var _93=this.markerAdjustX/2;
}else{
var _93=0;
}
}
this.barFiller.style.left=_93+"px";
if(this.maxElement){
this.barFiller.style.width=parseInt(this.maxElement.style.left)-_93+"px";
}else{
this.barFiller.style.width=this.barLength-parseInt(this.minElement.style.left)-this.markerAdjustX+"px";
}
};
SliderControl.prototype.filter=function(_94){
if(this.type=="enum"){
if(this.currentMax==null){
return true;
}else{
if(_94.searchAttributes[this.attributeId]&&(this.valueArray[this.currentMax].toLowerCase()==_94.searchAttributes[this.attributeId].toLowerCase())){
return true;
}else{
return false;
}
}
}else{
var _95=parseInt(_94.searchAttributes[this.attributeId]);
var _96=this.currentMin;
var _97=this.currentMax;
if(this.currentMin==null&&this.currentMax==null){
return true;
}
if(isNaN(_95)){
return false;
}
if(_97==null){
_97=_95+1;
}
if(_96==null){
_96=_95-1;
}
if(_95<_96||_95>_97){
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(_98,_99,_9a,_9b){
this.name=_98.name;
this.controlGroup=_9a;
this.isServerSearch=_9b;
this.selectBox=document.createElement("select");
this.selectBox.className="rwcSelectControl";
var _9c=_98.value.split(",");
var _9d=_98.label.split(",");
if(_9c.length!=_9d.length){
return;
}
for(var i=0;i<_9c.length;i++){
this.selectBox.options[this.selectBox.options.length]=new Option(_9d[i],_9c[i]);
}
this.container=document.createElement("div");
_99.appendChild(this.container);
this.container.appendChild(this.selectBox);
this.changeDelegate=associateObjWithEvent(this,"onChange");
Evt.addEventListener(this.selectBox,"change",this.changeDelegate);
}
SelectControl.prototype.onChange=function(){
if(this.controlGroup.searchControl.isAutomatic){
this.controlGroup.update();
}
};
SelectControl.prototype.filter=function(_9f){
if(this.selectBox.selectedIndex==0){
return true;
}
if(_9f.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 _a0="";
}else{
var _a0="&context-"+this.name+"="+this.selectBox[this.selectBox.selectedIndex].value;
}
return _a0;
};
SelectControl.prototype.clear=function(){
this.selectBox.selectedIndex=0;
};
SelectControl.prototype.unload=function(){
Evt.removeEventListener(this.selectBox,"change",this.changeDelegate);
};
function GeoCodingControlGroup(_a1,_a2,_a3,_a4){
this.container=document.createElement("div");
if(_a1.css){
addClass(this.container,_a1.css);
}
this.configuration=_a1;
this.type=_a1.type;
this.isServerSearch=true;
this.searchControl=_a3;
try{
this.maxCount=parseInt(_a4.maxCount);
}
catch(e){
this.maxCount=10;
}
if(_a4.downloadModel){
this.downloadModel=_a4.downloadModel;
}else{
this.downloadModel="standard";
}
this.layer=_a3.layer;
this.searchControlGroup=new SearchControlGroup(_a1,_a2,this,_a4);
if(this.type=="geoCoding"){
var _a5=new Parameter("address","string","","",null);
this.searchControlGroup.addControl(_a5);
}else{
if(this.type=="reverseGeoCoding"){
var _a6=new Parameter("X","string","","X",null);
this.searchControlGroup.addControl(_a6);
this.xBox=this.searchControlGroup.controlList[this.searchControlGroup.controlList.length-1];
var _a7=new Parameter("Y","string","","Y",null);
this.searchControlGroup.addControl(_a7);
this.yBox=this.searchControlGroup.controlList[this.searchControlGroup.controlList.length-1];
}
}
}
GeoCodingControlGroup.prototype.buildSearchString=function(){
var max="&max="+this.maxCount;
var _a9="&refsystem="+this.searchControl.saMap.SRS;
if(this.type=="geoCoding"){
if(this.downloadModel=="standard"){
var _aa=this.searchControl.saMap.getGeoRect();
var _ab="&bbox="+_aa.xMin+","+_aa.yMin+","+_aa.xMax+","+_aa.yMax;
}else{
var _ab="";
}
}else{
if(this.type=="reverseGeoCoding"){
try{
var _ac=parseFloat(this.xBox.searchBox.value);
var _ad=parseFloat(this.yBox.searchBox.value);
}
catch(e){
return "";
}
var _ae=3;
var _af=this.searchControl.saMap.tileGeoWidth/this.searchControl.saMap.tileSize;
var _ab="&bbox="+(_ac-_af*_ae)+","+(_ad-_af*_ae)+","+(_ac+_af*_ae)+","+(_ad+_af*_ae);
}
}
var _b0="&return=geojson"+max+_ab+_a9+"&request=locate";
for(var i=0;i<this.searchControlGroup.controlList.length;i++){
_b0+=this.searchControlGroup.controlList[i].buildSearchString();
}
_b0=_b0.replace("context-","");
this.layer.activateProxy("geoCoding",_b0);
return "";
};
GeoCodingControlGroup.prototype.filter=function(_b2){
return this.searchControlGroup.filter(_b2);
};
GeoCodingControlGroup.prototype.addToAttributeList=function(_b3){
this.searchControlGroup.addToAttributeList(_b3);
};
GeoCodingControlGroup.prototype.update=function(){
this.searchControlGroup.update();
};
GeoCodingControlGroup.prototype.reduceSearchResults=function(){
this.searchControlGroup.reduceSearchResults();
};
GeoCodingControlGroup.prototype.onSearchButtonClick=function(){
this.searchControlGroup.onSearchButtonClick();
};
GeoCodingControlGroup.prototype.onClearButtonClick=function(){
this.searchControlGroup.onClearButtonClick();
};
GeoCodingControlGroup.prototype.clear=function(){
this.searchControlGroup.clear();
};
GeoCodingControlGroup.prototype.clearSearch=function(){
this.searchControl.clearSearch();
};
GeoCodingControlGroup.prototype.unload=function(){
this.searchControlGroup.unload();
};
GeoCodingControlGroup.prototype.initiateSearch=function(){
this.searchControl.initiateSearch(true);
};
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.onObjectUpdatedEventHandlers=new Array();
this.registerOnNewGeoRectEventHandler(RWCBuiltInOnNewGeoRect);
this.totalZoomTime=2000;
this.config=new MapConfiguration(_1);
if(_7){
this.JSONConfig=_7;
}else{
if(_8){
this.JSONConfiguration(this.mapServerUrl,_8);
}else{
if(typeof (RWCCustomConfiguration)!="undefined"){
this.JSONConfig=RWCCustomConfiguration;
}
}
}
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 Map 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;
this.SRS=this.viewJSON.ViewInfo.SRS;
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.setDragTool(this.config.GUI.dragTool.defaultTool,true);
RWCBuiltInOnNewGeoRect(this);
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";
}
var _18=null;
if(typeof (top[this.config.GUI.miniMap.JSONConfigurationObject])!="undefined"){
_18=top[this.config.GUI.miniMap.JSONConfigurationObject];
}
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,_18);
this.miniMapDiv.appendChild(this.miniMapDiv.closeBox);
this.closeMiniMapClickDelegate=associateObjWithEvent(this,"closeMiniMap");
Evt.addEventListener(this.miniMapDiv.closeBox,"click",this.closeMiniMapClickDelegate);
};
SpatialAceMap.prototype.tileMouseDown=function(evt,_1a){
if(this.zoomActive==true){
return;
}
if(evt.button==2){
return;
}
if(this.manipulationActive){
if(this.dragEndManipulationDelegate){
this.dragEndManipulation(evt);
}else{
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 _1b=getPixelPositionFromEvent(tmpEvt,this.mapContainer);
this.mainMap.clickPoint=this.getPosition(_1b.x,_1b.y);
this.mainMap.clickPending=true;
}else{
tmpEvt=new Evt(evt);
var _1b=getPixelPositionFromEvent(tmpEvt,this.mapContainer);
this.clickPoint=this.getPosition(_1b.x,_1b.y);
this.clickPending=true;
}
this.currentTool.startManipulation(evt);
};
SpatialAceMap.prototype.startDragToolBehaviour=function(evt,_1d){
evt=new Evt(evt);
if(document.attachEvent){
document.body.attachEvent("onselectstart",returnFalse,false);
document.body.attachEvent("ondrag",returnFalse,false);
}
this.dragInitiatingTool=_1d;
this.manipulationActive=true;
this.latestDragPixelPoint=null;
this.dragStartPixelPoint=getPixelPositionFromEvent(evt,this.mapContainer);
this.latestDragPixelPoint=this.dragStartPixelPoint;
this.dragManipulateDelegate=associateObjWithEvent(this,"dragManipulate");
this.dragEndManipulationDelegate=associateObjWithEvent(this,"dragEndManipulation");
Evt.addEventListener(document,"mousemove",this.dragManipulateDelegate,false);
Evt.addEventListener(document,"mouseup",this.dragEndManipulationDelegate,false);
evt.consume();
return this.dragStartPixelPoint;
};
SpatialAceMap.prototype.dragManipulate=function(evt){
if(!this.manipulationActive||!evt){
return;
}
evt=new Evt(evt);
this.latestDragPixelPoint=getPixelPositionFromEvent(evt,this.mapContainer);
if(this.dragInitiatingTool&&this.dragInitiatingTool.manipulate){
this.dragInitiatingTool.manipulate(this.latestDragPixelPoint);
}
evt.consume();
};
SpatialAceMap.prototype.dragEndManipulation=function(evt){
if(!this.manipulationActive||!evt){
return;
}
this.manipulationActive=false;
if(this.endManipulationTimeout){
clearTimeout(this.endManipulationTimeout);
}
evt=new Evt(evt);
if(document.detachEvent){
document.body.detachEvent("onselectstart",returnFalse,false);
document.body.detachEvent("ondrag",returnFalse,false);
}
if(this.dragManipulateDelegate){
Evt.removeEventListener(document,"mousemove",this.dragManipulateDelegate,false);
this.dragManipulateDelegate=null;
}
if(this.dragEndManipulationDelegate){
Evt.removeEventListener(document,"mouseup",this.dragEndManipulationDelegate,false);
this.dragEndManipulationDelegate=null;
}
if(this.dragInitiatingTool&&this.dragInitiatingTool.endManipulation){
this.dragInitiatingTool.endManipulation();
}
if(this.latestDragPixelPoint&&distance2D(this.dragStartPixelPoint,this.latestDragPixelPoint)/this.rescalingFactor<2&&this.clickPending){
this.activateClickTools(this.latestDragPixelPoint);
}
evt.consume();
};
SpatialAceMap.prototype.dragCancelManipulation=function(){
if(!this.manipulationActive){
return;
}
this.manipulationActive=false;
if(this.endManipulationTimeout){
clearTimeout(this.endManipulationTimeout);
}
if(document.detachEvent){
document.body.detachEvent("onselectstart",returnFalse,false);
document.body.detachEvent("ondrag",returnFalse,false);
}
if(this.dragManipulateDelegate){
Evt.removeEventListener(document,"mousemove",this.dragManipulateDelegate,false);
this.dragManipulateDelegate=null;
}
if(this.dragEndManipulationDelegate){
Evt.removeEventListener(document,"mouseup",this.dragEndManipulationDelegate,false);
this.dragEndManipulationDelegate=null;
}
if(this.dragInitiatingTool&&this.dragInitiatingTool.cancelManipulation){
this.dragInitiatingTool.cancelManipulation();
}
};
SpatialAceMap.prototype.onMouseMovePosition=function(evt,_21){
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(500);
}
}
}
if(this.manipulationActive){
if(this.endManipulationTimeout){
clearTimeout(this.endManipulationTimeout);
}
this.endManipulationTimeout=setTimeout(associateObjWithEvent(this,"dragEndManipulation"),300);
}
return;
}
if(this.endManipulationTimeout){
clearTimeout(this.endManipulationTimeout);
}
if(this.mousePosition.y>(this.mapContainer.offsetHeight-this.dockingOffset)){
return;
}
var _22=this.getPosition(this.mousePosition.x,this.mousePosition.y);
if(this.clickTool&&this.clickTool.update&&!isOpera){
this.clickTool.update(_22);
}
var _23=this.view.updateTooltips(_22.x,_22.y);
if(_23&&_23.length>0){
for(var i=0;i<_23.length;i++){
if(_23[i].enter){
for(var j=0;j<this.onMouseOverEventHandlers.length;j++){
this.onMouseOverEventHandlers[j](this,_23[i].geoObject);
}
}else{
for(var j=0;j<this.onMouseOutEventHandlers.length;j++){
this.onMouseOutEventHandlers[j](this,_23[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=_22.x+"<br>"+_22.y;
}
};
SpatialAceMap.prototype.onMouseWheel=function(evt,_27){
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 _28=getPixelPositionFromEvent(tmpEvt,this.mapContainer);
}else{
var _28=this.mousePosition;
}
var _29=this.getPosition(_28.x,_28.y);
this.setMapCenter(_29.x,_29.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(_2b,_2c){
if(!this.initialized||this.bufferTimer){
return;
}
_2b=_2b*this.rescalingFactor;
_2c=_2c*this.rescalingFactor;
var _2d=_2b-this.lastOffsetX;
var _2e=_2c-this.lastOffsetY;
if(this.config.viewSettings.borders&&this.config.viewSettings.borders.active&&!this.mainMap){
var _2f=this.getMapCenter();
var _30=this.tileGeoWidth/this.tileSize;
var _31=_2f.x-_2d*_30;
var _32=_2f.y+_2e*_30;
var _33=this.point(_31,_32);
var _34=this.checkBorders(_33);
var _35=this.tileSize/this.tileGeoWidth;
_2d=-(_34.x-_2f.x)*_35;
_2e=(_34.y-_2f.y)*_35;
_2b=_2d+this.lastOffsetX;
_2c=_2e+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(_2d));
setY(this.view.zoomContainer,zY+Math.round(_2e));
}
this.view.pixelOffset(Math.round(_2d),Math.round(_2e));
if(this.activeinfoBoxObject){
this.activeinfoBoxObject.updateInfoBox();
}
this.lastOffsetX=_2b;
this.lastOffsetY=_2c;
this.totalOffsetX+=_2d;
this.totalOffsetY+=_2e;
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);
}
}
}
if(this.selectedObject){
this.selectedObject.outLine();
}
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(_2b*this.linkedMapArray[i].currentScaleFactor,_2c*this.linkedMapArray[i].currentScaleFactor);
}
}
};
SpatialAceMap.prototype.checkBorders=function(_39){
if(this.config.viewSettings.borders&&this.config.viewSettings.borders.active&&!this.mainMap){
var _3a=this.tileGeoWidth/this.tileSize;
adjustedX=_39.x;
adjustedY=_39.y;
var _3b=adjustedX+this.mapWidth/2*_3a;
if(_3b>this.config.viewSettings.borders.geoRect.xMax){
adjustedX=_39.x-(_3b-this.config.viewSettings.borders.geoRect.xMax);
}
var _3c=adjustedX-this.mapWidth/2*_3a;
if(_3c<this.config.viewSettings.borders.geoRect.xMin){
adjustedX=_39.x+(this.config.viewSettings.borders.geoRect.xMin-_3c);
_3b=adjustedX+this.mapWidth/2*_3a;
if(_3b>this.config.viewSettings.borders.geoRect.xMax){
adjustedX=this.config.viewSettings.borders.geoRect.centerPoint.x;
}
}
var _3d=adjustedY+this.mapHeight/2*_3a;
if(_3d>this.config.viewSettings.borders.geoRect.yMax){
adjustedY=_39.y-(_3d-this.config.viewSettings.borders.geoRect.yMax);
}
var _3e=adjustedY-this.mapHeight/2*_3a;
if(_3e<this.config.viewSettings.borders.geoRect.yMin){
adjustedY=_39.y+(this.config.viewSettings.borders.geoRect.yMin-_3e);
_3d=adjustedY+this.mapHeight/2*_3a;
if(_3d>this.config.viewSettings.borders.geoRect.yMax){
adjustedY=this.config.viewSettings.borders.geoRect.centerPoint.y;
}
}
var _3f=this.point(adjustedX,adjustedY);
return _3f;
}
return _39;
};
SpatialAceMap.prototype.ieBuffer=function(evt,_41){
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){
}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);
}
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(_43,_44){
if(!this.initialized){
return;
}
var _45=this.getPosition(_43,_44);
if(this.mainMap){
this.mainMap.setMapCenter(_45.x,_45.y);
}else{
this.setMapCenter(_45.x,_45.y);
}
};
SpatialAceMap.prototype.activateClickTools=function(_46){
this.clickPending=false;
if(this.clickTool&&this.clickTool.click){
this.clickTool.click(_46.x,_46.y);
}else{
if(this.clickTool){
this.clickTool(_46.x,_46.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(_48,_49){
var _4a=new Object();
var _4b=this.getPixelsToViewUnits();
centerOffsetX=_48-this.mapWidth/2-this.totalOffsetX;
centerOffsetY=-_49+this.mapHeight/2+this.totalOffsetY;
_4a.x=this.initialGeoCenterX+_4b*centerOffsetX;
_4a.y=this.initialGeoCenterY+_4b*centerOffsetY;
return _4a;
};
SpatialAceMap.prototype.getPixelsToViewUnits=function(){
return (this.tileGeoWidth/this.tileSize);
};
SpatialAceMap.prototype.startZoomTransition=function(_4c,_4d,_4e){
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=_4e;
this.zoomTotalIterations=_4e;
this.zoomOldTileGeoWidth=_4c;
this.zoomNewTileGeoWidth=_4d;
this.zoomTotalScaling=_4c/_4d;
this.view.startZoom();
this.newTileGeoWidth=_4d;
this.zoomStartTime=new Date().getTime();
this.zoomEndTime=this.zoomStartTime+this.totalZoomTime;
this.zoomTimer=setTimeout(associateObjWithEvent(this,"onZoomIteration"),5);
};
SpatialAceMap.prototype.onZoomIteration=function(evt,_50){
if(!this.zoomActive){
return;
}
var i=0;
var _52=(this.zoomTotalIterations-this.zoomIterationsRemaining)/this.zoomTotalIterations;
this.view.zoom(_52);
if(this.zoomIterationsRemaining>0){
this.zoomIterationsRemaining--;
this.zoomRemaining=new Date().getTime();
this.zoomRemaining=this.zoomEndTime-this.zoomRemaining;
var _53=this.zoomIterationsRemaining;
try{
if(this.zoomIterationsRemaining>0){
if(this.zoomRemaining/this.zoomIterationsRemaining<5){
this.zoomIterationsRemaining=Math.round(this.zoomRemaining/5);
}
}
}
catch(e){
this.zoomIterationsRemaining=_53;
}
this.zoomTimer=setTimeout(associateObjWithEvent(this,"onZoomIteration"),5);
}else{
this.zoomActive=false;
this.view.showObjectLayers();
this.view.endZoom();
}
};
SpatialAceMap.prototype.onKeyDown=function(evt,_55){
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;
if(this.shiftTool){
this.setTool(this.shiftTool);
}
}
break;
case (90):
if(!this.altPressed){
this.altPressed=true;
if(this.manipulationActive==true){
this.currentTool.cancelManipulation();
}
this.manipulationActive=false;
if(this.altTool){
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 _56=this.config.GUI.lookingGlass.alternateView;
}else{
var _56=this.viewName;
}
try{
var _57=parseFloat(this.config.GUI.lookingGlass.scaleValue);
}
catch(e){
var _57=0.1;
}
this.lookingGlassId=this.linkedMapArray.length;
this.createLookingGlass(-500,-500,this.config.GUI.lookingGlass.model,_57,_56);
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();
}
this.setSelectedObject(null);
if(this.manipulationActive){
this.currentTool.cancelManipulation();
this.manipulationActive=false;
}
break;
default:
break;
}
};
SpatialAceMap.prototype.onKeyUp=function(evt,_59){
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(_5a,_5b){
if(this.zoomActive==true){
return;
}
this.beginDrag();
this.drag(_5a,_5b);
this.endDrag();
};
SpatialAceMap.prototype.setTileGeoWidth=function(_5c,_5d){
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&&_5d&&!isOpera){
this.startZoomTransition(this.tileGeoWidth,_5c,5);
}
var _5f=_5c/this.tileGeoWidth;
this.tileGeoWidth=_5c;
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/_5f;
this.totalOffsetY=this.totalOffsetY/_5f;
if(this.config.viewSettings.borders&&this.config.viewSettings.borders.active&&!this.mainMap){
var _60=this.getMapCenter();
var _61=this.checkBorders(_60);
this.setMapCenter(_61.x,_61.y);
}
for(var i=0;i<this.onNewGeoRectEventHandlers.length;i++){
this.onNewGeoRectEventHandlers[i](this);
}
this.placeAndRefreshTiles();
this.view.updateCanvas();
if(this.selectedObject){
this.selectedObject.outLine();
}
if(this.config.GUI.scaleBar&&this.config.GUI.scaleBar.active){
this.requestScaleBar();
}
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 _62=Number.MAX_VALUE;
var _63=-1;
for(var i=0;i<this.fixedTileGeoWidths.length;i++){
var _65=Math.abs(this.tileGeoWidth-this.fixedTileGeoWidths[i]);
if(_65<_62){
_62=_65;
_63=i;
}
}
return _63;
};
SpatialAceMap.prototype.registerInfoLayer=function(_66){
if(!this.registeredCenterInfoLayers){
this.registeredCenterInfoLayers=new Array();
}
if(!this.registeredAreaInfoLayers){
this.registeredAreaInfoLayers=new Array();
}
this.registeredCenterInfoLayers.push(_66);
this.registeredAreaInfoLayers.push(_66);
};
SpatialAceMap.prototype.registerCenterInfoLayer=function(_67){
if(!this.registeredCenterInfoLayers){
this.registeredCenterInfoLayers=new Array();
}
this.registeredCenterInfoLayers.push(_67);
};
SpatialAceMap.prototype.registerAreaInfoLayer=function(_68){
if(!this.registeredAreaInfoLayers){
this.registeredAreaInfoLayers=new Array();
}
this.registeredAreaInfoLayers.push(_68);
};
SpatialAceMap.prototype.registerInfoLayerAreaAction=function(id,_6a){
if(!this.registeredInfoLayerAreaActions){
this.registeredInfoLayerAreaActions=new Object();
}
this.registeredInfoLayerAreaActions[id]=_6a;
};
SpatialAceMap.prototype.registerInfoLayerCenterAction=function(id,_6c){
if(!this.registeredInfoLayerCenterActions){
this.registeredInfoLayerCenterActions=new Object();
}
this.registeredInfoLayerCenterActions[id]=_6c;
};
SpatialAceMap.prototype.getInfoLayersString=function(_6d){
var _6e="";
for(var i=0;i<_6d.length;i++){
if(_6e!=""){
_6e=_6e+",";
}
_6e=_6e+_6d[i];
}
return _6e;
};
SpatialAceMap.prototype.getInfoLayerCenterInformation=function(_70){
if(!this.registeredInfoLayerCenterActions||!this.registeredCenterInfoLayers){
return null;
}
var _71=this.buildActionsQuery(this.registeredInfoLayerCenterActions);
var _72=this.getCurrentZoomIndex();
var _73=this.tileGeoWidth/this.scaleToGeoWidth;
if(_72!=-1){
_73=this.fixedInfoScaleSteps[_72];
}
var _74="&scale="+_73;
var _75=this.getInfoLayersString(this.registeredCenterInfoLayers);
if(_75==""){
return;
}
var _76="&layers="+_75;
var _77=null;
if(this.fixedScales){
_77=this.getInfoLayerCenter();
}else{
_77=this.getMapCenter();
}
var _78="&x="+_77.x+"&y="+_77.y;
var _79="&responsetype=JSON";
var _7a=this.mapServerUrl+"RWCInterface.axd?request=GetGeoObjectsInfoAt&view="+this.viewName+_76+"&width="+this.tileSize+"&height="+this.tileSize+"&pixel-x-bottomright="+this.tileSize+"&pixel-y-bottomright="+this.tileSize+_74+_78+_79+_71;
if(_7a==this.lastGetGeoObjectsInfoAtRequest){
return;
}
this.lastGetGeoObjectsInfoAtRequest=_7a;
this.getInfoLayerCenterInformationCallback=_70;
this.getGeoObjectsInfoAtXmlHttp=new XMLHttpRequest();
this.getGeoObjectsInfoAtXmlHttp.open("GET",_7a,true);
this.getGeoObjectsInfoAtXmlHttp.onreadystatechange=associateObjWithCallback(this,this.onGetGeoObjectsInfoAtResponse);
this.getGeoObjectsInfoAtXmlHttp.send("");
};
SpatialAceMap.prototype.getInfoLayerAreaInformation=function(_7b){
if(!this.registeredInfoLayerAreaActions||!this.registeredAreaInfoLayers){
return null;
}
var _7c=this.buildActionsQuery(this.registeredInfoLayerAreaActions);
var _7d=this.getCurrentZoomIndex();
var _7e=this.tileGeoWidth/this.scaleToGeoWidth;
if(_7d!=-1){
_7e=this.fixedScaleSteps[_7d];
}
var _7f="&scale="+_7e;
var _80=this.getInfoLayersString(this.registeredAreaInfoLayers);
if(_80==""){
return;
}
var _81="&layers="+_80;
var _82=null;
var _83=null;
var _84=null;
if(!this.fixedScales){
var _85=this.view.getTilesGeoBoundingBox();
if(!_85||!_85.centerPoint){
return;
}
_82=_85.centerPoint;
_83=this.tileSize*this.nCols;
_84=this.tileSize*this.nRows;
}else{
_82=this.getMapCenter();
_83=this.mapWidth;
_84=this.mapHeight;
}
var _86="&x="+_82.x+"&y="+_82.y;
var _87="&responsetype=JSON";
var _88=this.mapServerUrl+"RWCInterface.axd?request=GetGeoObjectsInfoIn&view="+this.viewName+_81+"&width="+_83+"&height="+_84+"&pixel-x-bottomright="+_83+"&pixel-y-bottomright="+_84+_7f+_86+_87+_7c;
this.getInfoLayerAreaInformationCallback=_7b;
this.getGeoObjectsInfoInXmlHttp=new XMLHttpRequest();
this.getGeoObjectsInfoInXmlHttp.open("GET",_88,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 _89=eval("("+this.getGeoObjectsInfoAtXmlHttp.responseText+")");
this.getInfoLayerCenterInformationCallback(true,_89);
}
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 _8a=eval("("+this.getGeoObjectsInfoInXmlHttp.responseText+")");
this.getInfoLayerAreaInformationCallback(true,_8a);
}
catch(e){
this.getInfoLayerAreaInformationCallback(false,this.getGeoObjectsInfoInXmlHttp.responseText);
}
}
this.getInfoLayerAreaInformationCallback=null;
this.getGeoObjectsInfoInXmlHttp=null;
}
};
SpatialAceMap.prototype.buildActionsQuery=function(_8b){
var _8c="";
if(_8b){
for(id in _8b){
if(typeof (_8b[id])!="function"&&_8b[id]){
if(_8c!=""){
_8c=_8c+",";
}
_8c=_8c+id+","+_8b[id];
}
}
}
if(_8c!=""){
_8c="&actions="+_8c;
}
return _8c;
};
SpatialAceMap.prototype.getInfoLayerCenter=function(){
if(!this.fixedScales||!this.fixedInfoScaleSteps){
return null;
}
var _8d=this.getCurrentZoomIndex();
var _8e=this.fixedInfoScaleSteps[_8d];
var _8f=this.getMapCenter();
var _90=_8e*this.scaleToGeoWidth;
var _91=(Math.floor(_8f.x/_90)*_90)+_90/2;
var _92=(Math.floor(_8f.y/_90)*_90)+_90/2;
var _93=this.point(_91,_92);
return _93;
};
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(_94,top,_96,_97){
if(!this.fixedScales){
if(_96<40){
_94=_94-((40-_96)/2);
_96=40;
}
if(_97<40){
top=top-((40-_97)/2);
_97=40;
}
}
var _98=_94+_96/2;
var _99=top+_97/2;
var _9a=this.mapWidth/2-_98;
var _9b=this.mapHeight/2-_99;
this.beginDrag();
this.drag(_9a,_9b);
this.endDrag();
var _9c=(_96/this.mapWidth);
var _9d=(_97/this.mapHeight);
if(_9c>_9d){
var _9e=_96/this.mapWidth;
}else{
var _9e=_97/this.mapHeight;
}
var _9f=this.tileGeoWidth*_9e;
if(this.fixedScales){
var _a0=Number.MAX_VALUE;
var _a1=_9f;
var _a2=0;
for(var i=0;i<this.fixedTileGeoWidths.length;i++){
var _a4=Math.abs(_9f-this.fixedTileGeoWidths[i]);
if(_a4<_a0){
_a0=_a4;
_a1=this.fixedTileGeoWidths[i];
var _a5=i;
}
}
if(this.zoomControl){
this.zoomControl.moveToZoomLevel(_a1);
}else{
this.setTileGeoWidth(_a1,false);
}
}else{
this.setTileGeoWidth(_9f,false);
}
};
SpatialAceMap.prototype.setTool=function(_a6){
this.currentTool=_a6;
if(_a6.cursor){
this.setCursor(_a6.cursor);
}else{
this.setCursor("crosshair");
}
};
SpatialAceMap.prototype.setCursor=function(_a7){
this.latestCursor=_a7;
this.mapContainer.style.cursor=_a7;
for(var i=0;i<this.view.layerArray.length;i++){
if(this.view.layerArray[i].container){
this.view.layerArray[i].container.style.cursor=_a7;
}
}
for(var i=0;i<this.view.overlayArray.length;i++){
if(this.view.overlayArray[i].container){
this.view.overlayArray[i].container.style.cursor=_a7;
}
}
};
SpatialAceMap.prototype.getGeoObjectsAt=function(_a9,_aa){
var _ab="";
var _ac=this.tileGeoWidth/this.tileSize;
var _ad=this.mapWidth*_ac;
var _ae=-this.totalOffsetX;
var _af=this.totalOffsetY;
var _b0=this.initialGeoCenterX+_ae*_ac;
var _b1=this.initialGeoCenterY+_af*_ac;
var _b2="&context-details=true";
var _b3="&responsetype=JSON";
var _b4="";
for(var i=0;i<this.view.overlayArray.length;i++){
if(!this.view.overlayArray[i].isUserLayer){
if(i!=0){
_b4+=",";
}
_b4+=this.view.overlayArray[i].id;
}
}
if(_b4!=""){
_b4="&layers="+_b4;
}
var _b6=this.mapServerUrl+"RWCInterface.axd?request=GetGeoObjectsAt"+"&view="+this.viewName+_ab+"&width="+this.mapWidth+"&height="+this.mapHeight+"&geowidth="+_ad+"&x="+_b0+"&y="+_b1+"&pixel-x="+_a9+"&pixel-y="+_aa+"&positions=true"+_b4+_b2+_b3;
this.addWorkItem();
this.getGeoObjectsAtXmlHttp=new XMLHttpRequest();
this.getGeoObjectsAtXmlHttp.onreadystatechange=associateObjWithCallback(this,this.onGetGeoObjectsAtResponse);
this.getGeoObjectsAtXmlHttp.open("GET",_b6,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 _b7=eval("("+this.getGeoObjectsAtXmlHttp.responseText+")");
}
catch(e){
this.removeWorkItem();
return;
}
if(this.config.GUI.detailedInfo.active){
this.drawDetailedInfoBox(_b7);
}
}
this.removeWorkItem();
this.getGeoObjectsAtXmlHttp=null;
}
};
SpatialAceMap.prototype.setSelectedObject=function(_b8){
if(this.selectedObject){
this.selectedObject.cancelSelection();
}
this.selectedObject=_b8;
if(this.selectedObject){
this.selectedObject.setSelected();
}
};
SpatialAceMap.prototype.drawDetailedInfoBox=function(_b9){
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(_b9.features.length>0){
var _ba=_b9.features[0];
for(var j=0;j<this.config.GUI.detailedInfo.parameters.length;j++){
var _bc=_ba.properties[this.config.GUI.detailedInfo.parameters[j].name];
if(_bc&&_bc!=""){
var _bd=false;
_bd=true;
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(_bc);
this.objectInfoContainer.appendChild(pg);
break;
case ("image"):
var _bf=document.createElement("img");
setImageSource(_bf,_bc);
_bf.className="rwcDetailedInfoBoxImage";
this.objectInfoContainer.appendChild(_bf);
linebreak=document.createElement("br");
this.objectInfoContainer.appendChild(linebreak);
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,_c1){
Evt.removeEventListener(this.infoClose,"click",this.infoCloseDelegate);
this.embedDiv.removeChild(this.objectInfoContainer);
this.objectInfoContainer=null;
};
SpatialAceMap.prototype.mapResized=function(evt,_c3){
if(this.resizeTimer){
clearTimeout(this.resizeTimer);
}
this.resizeTimer=setTimeout(associateObjWithEvent(this,"onResizeTimer"),200);
};
SpatialAceMap.prototype.onResizeTimer=function(evt,_c5){
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,_c8){
this.workItemCount++;
if(this.panControl){
if(this.panControl.progressIndicator){
setVisible(this.panControl.progressIndicator,this.workItemCount>0);
}
}
};
SpatialAceMap.prototype.removeWorkItem=function(evt,_ca){
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,_cf,_d0,_d1){
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);
}
var _d2=null;
if(typeof (top[this.config.GUI.lookingGlass.JSONConfigurationObject])!="undefined"){
_d2=top[this.config.GUI.lookingGlass.JSONConfigurationObject];
}
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,_d1,this.prefix+"Mag",this.config.GUI.lookingGlass.configuration,this.prefix+"Mag",_cf,_d0,false,_d2);
this.lookingGlass.noAdjust=true;
this.lookingGlass.initialize();
};
SpatialAceMap.prototype.lookingGlassMouseMove=function(evt,_d4){
var _d5=new Evt(evt);
var _d6=getPixelPositionFromEvent(_d5,this.mapContainer);
setX(this.lookingGlassContainer,_d6.x-75);
setY(this.lookingGlassContainer,_d6.y-75);
var _d7=this.getPosition(_d6.x,_d6.y);
this.lookingGlass.setNewCenter(_d7.x,_d7.y);
_d5.consume();
};
SpatialAceMap.prototype.drawOverlayRectangle=function(_d8,_d9,_da){
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=_d8+"px";
this.mainMapRectangle.style.width=_d9+"px";
var _db=this.tileSize/this.tileGeoWidth;
centerOffsetX=(_da.x-this.initialGeoCenterX)*_db+this.mapWidth/2+this.totalOffsetX;
centerOffsetY=(_da.y-this.initialGeoCenterY)*_db+this.mapHeight/2-this.totalOffsetY;
var _dc=centerOffsetX-_d9/2;
var _dd=centerOffsetY-_d8/2;
if(!isNaN(_dc)&&!isNaN(_dd)){
setX(this.mainMapRectangle,_dc);
setY(this.mainMapRectangle,_dd);
}
};
SpatialAceMap.prototype.requestScaleBar=function(){
var _de=new Array();
var _df=this.getMapCenter();
var _e0=new Object();
_e0.y=_df.y;
_e0.x=_df.x+1;
_de[0]=_df;
_de[1]=_e0;
this.scaleBarDelegate=associateObjWithCallback(this,this.drawScaleBar);
this.getDistances(_de,this.scaleBarDelegate);
};
SpatialAceMap.prototype.drawScaleBar=function(_e1){
var _e2=this.config.GUI.scaleBar.maxSize;
if(this.config.GUI.scaleBar.unit=="imperial"){
var _e3=1.0936;
var _e4=(this.tileGeoWidth*_e1[0])/this.tileSize*_e3;
var _e5=(_e4*_e2);
if(_e5>1760){
var _e5=_e5/1760;
var _e6=true;
}
var _e5=_e5.toPrecision(1);
}else{
var _e4=(this.tileGeoWidth*_e1[0])/this.tileSize;
var _e5=(_e4*_e2).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(!_e6){
var _e7=Math.round(_e5/_e4);
}else{
var _e7=Math.round(_e5/(_e4/1760));
}
_e7-=6;
this.scaleBar.style.width=_e7+"px";
if(this.config.GUI.scaleBar.unit=="imperial"){
if(_e6){
this.scaleBar.innerHTML=_e5*1+"mi";
}else{
this.scaleBar.innerHTML=_e5*1+"yrds";
}
}else{
if(_e5>1000){
this.scaleBar.innerHTML=Math.round(_e5/1000)+"km";
}else{
this.scaleBar.innerHTML=_e5*1+"m";
}
}
};
SpatialAceMap.prototype.createLayerLegend=function(_e8,_e9){
var _ea=document.createElement("div");
for(var j=0;j<_e8.configuration.properties.length;j++){
if(_e8.configuration.properties[j].type=="defaultImage"||_e8.configuration.properties[j].type=="conditionalImage"){
var _ec=document.createElement("img");
_ec.className="rwcLegendImage";
if(_e8.configuration.properties[j].value!=null&&_e8.configuration.properties[j].value!=""&&_e8.configuration.properties[j].type=="defaultImage"){
if(_e9){
setImageSource(_ec,_e8.configuration.properties[j].value);
}else{
_ec.src=_e8.configuration.properties[j].value;
}
}else{
if(_e8.configuration.properties[j].image.image&&_e8.configuration.properties[j].image.image!=""){
if(_e9){
setImageSource(_ec,_e8.configuration.properties[j].image.image);
}else{
_ec.src=_e8.configuration.properties[j].image.image;
}
}
}
_ea.appendChild(_ec);
if(_e8.configuration.properties[j].label&&_e8.configuration.properties[j].label!=""){
var _ed=document.createElement("span");
_ed.innerHTML=_e8.configuration.properties[j].label;
_ea.appendChild(_ed);
}
lineBreak=document.createElement("br");
_ea.appendChild(lineBreak);
}
}
return _ea;
};
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();
try{
this.currentTool.unload();
}
catch(e){
}
if(this.panControl){
this.panControl.unload();
}
if(this.zoomControl){
this.zoomControl.unload();
}
if(this.layerControl){
this.layerControl.unload();
}
if(this.backgroundControl){
this.backgroundControl.unload();
}
if(this.dragManipulateDelegate){
Evt.removeEventListener(document,"mousemove",this.dragManipulateDelegate,false);
this.dragManipulateDelegate=null;
}
if(this.dragEndManipulationDelegate){
Evt.removeEventListener(document,"mouseup",this.dragEndManipulationDelegate,false);
this.dragEndManipulationDelegate=null;
}
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();
if(this.selectedObject){
this.selectedObject.outLine();
}
}
};
SpatialAceMap.prototype.refreshObjects=function(){
if(this.initialized){
this.view.getGeoObjects(0,0,this.nCols*this.tileSize,this.nRows*this.tileSize);
this.view.updateCanvas();
if(this.selectedObject){
this.selectedObject.outLine();
}
}
};
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 _ef;
if(this.fixedScales){
var _f0=-1;
for(var i=0;i<this.fixedTileGeoWidths.length;i++){
if(this.tileGeoWidth==this.fixedTileGeoWidths[i]){
_f0=i;
break;
}
}
if(_f0==0){
return;
}
var _f2=Math.max(0,_f0-1);
_ef=this.fixedTileGeoWidths[_f2];
}else{
_ef=this.tileGeoWidth*0.5;
}
if(this.fixedScales&&this.zoomControl){
this.zoomControl.moveToZoomLevel(_ef);
}else{
this.setTileGeoWidth(_ef,true);
}
};
SpatialAceMap.prototype.zoomOut=function(){
if(this.mainMap){
this.mainMap.zoomOut();
return;
}
if(!this.initialized){
return;
}
var _f3;
if(this.fixedScales){
var _f4=Number.MAX_VALUE;
for(var i=0;i<this.fixedTileGeoWidths.length;i++){
if(this.tileGeoWidth==this.fixedTileGeoWidths[i]){
_f4=i;
break;
}
}
if(_f4==(this.fixedTileGeoWidths.length-1)){
return;
}
var _f6=Math.min(this.fixedTileGeoWidths.length-1,_f4+1);
_f3=this.fixedTileGeoWidths[_f6];
}else{
_f3=this.tileGeoWidth*2;
}
if(this.fixedScales&&this.zoomControl){
this.zoomControl.moveToZoomLevel(_f3);
}else{
this.setTileGeoWidth(_f3,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 _f9=this.tileGeoWidth/this.tileSize;
var _fa=new Object();
_fa.x=this.initialGeoCenterX-(this.totalOffsetX*_f9);
_fa.y=this.initialGeoCenterY+(this.totalOffsetY*_f9);
return _fa;
};
SpatialAceMap.prototype.setMapCenter=function(x,y){
if(!this.initialized||isNaN(x)||isNaN(y)){
return;
}
var _fd=this.tileSize/this.tileGeoWidth;
var _fe=-(x-this.initialGeoCenterX)*_fd-this.totalOffsetX;
var _ff=(y-this.initialGeoCenterY)*_fd-this.totalOffsetY;
if(_fe==0&&_ff==0){
return;
}
this.rescalingFactor=1;
this.beginDrag();
this.drag(Math.round(_fe),Math.round(_ff));
this.endDrag();
};
SpatialAceMap.prototype.getScale=function(){
if(!this.initialized){
return;
}
var _100=this.tileGeoWidth/this.scaleToGeoWidth;
return _100;
};
SpatialAceMap.prototype.setScale=function(_101){
if(!this.initialized||!_101||isNaN(_101)||_101<=0){
return;
}
if(this.MainMap){
if(this.linkMap.scaleModel=="factor"){
var _102=_101/this.linkMap.scaleValue;
this.MainMap.setScale(_102);
}
return;
}
newTileGeoWidth=_101*this.scaleToGeoWidth;
if(this.fixedScales){
var _103=Number.MAX_VALUE;
var _104=_101*this.scaleToGeoWidth;
for(var i=0;i<this.fixedTileGeoWidths.length;i++){
var diff=Math.abs(_104-this.fixedTileGeoWidths[i]);
if(diff<_103){
_103=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 _107=new Array();
for(var i=0;i<this.fixedScaleSteps.length;i++){
_107[i]=this.fixedScaleSteps[i];
}
return _107;
}else{
return null;
}
};
SpatialAceMap.prototype.createGeoObject=function(x,y,_10b,_10c,type,_10e,_10f){
if(!this.initialized){
return;
}
var _110=this.getOrCreateLayer(_10c);
geoObjectNode=new Object();
geoObjectNode.type="Feature";
geoObjectNode.properties=new Object();
geoObjectNode.geometry=new Object();
geoObjectNode.geometry.coordinates=new Array();
if(!type||type=="point"){
geoObjectNode.properties.geoType="#point";
geoObjectNode.geometry.type="Point";
var p=new Array();
p.push(x);
p.push(y);
geoObjectNode.geometry.coordinates.push(p);
}else{
if(type=="poly"){
geoObjectNode.properties.geoType="#polygon";
geoObjectNode.geometry.type="Polygon";
}else{
if(type=="line"){
geoObjectNode.properties.geoType="#line";
geoObjectNode.geometry.type="LineString";
}else{
if(type=="multiline"){
geoObjectNode.properties.geoType="#line";
geoObjectNode.geometry.type="MultiLine";
}else{
if(type=="multipoint"){
geoObjectNode.properties.geoType="#point";
geoObjectNode.geometry.type="MultiPoint";
for(var i=0;i<_10e.length;i++){
var p=new Array();
p.push(_10e[i].x);
p.push(_10e[i].y);
geoObjectNode.geometry.coordinates.push(p);
}
}else{
if(type=="multipolygon"){
geoObjectNode.properties.geoType="#polygon";
geoObjectNode.geometry.type="MultiPolygon";
}
}
}
}
}
}
var _113=new GeoObject(geoObjectNode,_110,false,_10e);
if(_10b&&_10b!=""){
_113.id=_10b;
_113.noId=false;
}
if(!_110.geoObjectArray){
_110.geoObjectArray=new Array();
}
_110.insertObject(_113,_10f);
for(var i=0;i<this.onObjectUpdatedEventHandlers.length;i++){
this.onObjectUpdatedEventHandlers[i](this,_113,_113.id,"createGeoObject");
}
return _113;
};
SpatialAceMap.prototype.createGeoObjectFromGeoJSON=function(_114,_115,_116,_117){
var _118=this.getOrCreateLayer(_116);
var _119=new GeoObject(_114,_118,false,null);
if(_115&&_115!=""){
_119.id=_115;
_119.noId=false;
}
if(!_118.geoObjectArray){
_118.geoObjectArray=new Array();
}
_118.insertObject(_119,_117);
for(var i=0;i<this.onObjectUpdatedEventHandlers.length;i++){
this.onObjectUpdatedEventHandlers[i](this,_119,_119.id,"createGeoObject");
}
return _119;
};
SpatialAceMap.prototype.getOrCreateLayer=function(_11b){
var _11c=this.getObjectLayerById(_11b);
if(!_11c){
var _11c=this.getLayerById(_11b);
if(!_11c||!_11c.haveClientObjects){
if(!_11b||_11b==""){
_11b="userLayer"+Math.random();
}
_11c=new OverlayLayer(_11b,_11b,0,this,false,false,false);
var _11d=this.config.getLayerConfiguration("");
_11c.createDefaults(_11d,null);
_11c.noUpdate=true;
_11c.isUserLayer=true;
this.view.overlayArray.push(_11c);
}else{
_11c=_11c.geoObjectLayer;
}
}
return _11c;
};
SpatialAceMap.prototype.removeGeoObject=function(_11e,_11f){
if(!this.initialized){
return false;
}
var _120=this.view.getObjectLayerById(_11f);
if(_120){
return _120.removeGeoObject(_11e);
}
return false;
};
SpatialAceMap.prototype.getGeoObject=function(_121,_122){
if(!this.initialized){
return;
}
var _123=this.view.getObjectLayerById(_122);
if(_123){
var _124=_123.getGeoObjectById(_121);
if(_124){
return _124;
}
}
return null;
};
SpatialAceMap.prototype.getGeoObjectsArray=function(_125){
if(!this.initialized){
return;
}
var _126=this.view.getObjectLayerById(_125);
if(_126&&_126.geoObjectArray){
var _127=_126.geoObjectArray;
return _127;
}
return null;
};
SpatialAceMap.prototype.centerOnGeoObject=function(_128,_129){
if(!this.initialized){
return false;
}
var _12a=this.view.getObjectLayerById(_129);
if(_12a){
var _12b=_12a.getGeoObjectById(_128);
if(_12b){
this.setMapCenter(_12b.point.x,_12b.point.y);
return true;
}
}
return false;
};
SpatialAceMap.prototype.addObjectLayer=function(_12c,_12d,_12e,_12f){
if(!this.initialized){
return;
}
var _130=this.config.getLayerConfiguration(_12d);
var _131=false;
layer=new OverlayLayer(_12c,_12c,_12c,this,_131,_12f);
if(_12e){
layer.searchEnabled=_12e;
}
layer.createDefaults(_130,null);
layer.isUserLayer=true;
this.view.overlayArray.push(layer);
layer.noUpdate=true;
layer.isClientOnly=true;
layer.draw();
if(layer.useLayerControl&&this.layerControl){
this.layerControl.update();
}
return layer;
};
SpatialAceMap.prototype.getLayerById=function(_132){
if(this.initialized){
return this.view.getLayerById(_132);
}
};
SpatialAceMap.prototype.getObjectLayerById=function(_133){
if(this.initialized){
return this.view.getObjectLayerById(_133);
}
};
SpatialAceMap.prototype.removeObjectLayer=function(_134){
if(!this.initialized){
return false;
}
for(var i=0;i<this.view.overlayArray.length;i++){
if(this.view.overlayArray[i].id==_134){
if(this.selectedObject&&this.selectedObject.layer.id==_134){
this.setSelectedObject(null);
}
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();
this.layerControl.update();
return true;
}
}
return false;
};
SpatialAceMap.prototype.getObjectLayers=function(){
if(this.initialized){
return this.view.overlayArray;
}
};
SpatialAceMap.prototype.mapToLatLong=function(x,y,_138){
this.projectPointTo(x,y,this.refSystem,"World.WGS84lola",_138);
};
SpatialAceMap.prototype.latLongToMap=function(x,y,_13b){
this.projectPointTo(x,y,"World.WGS84lola",this.refSystem,_13b);
};
SpatialAceMap.prototype.projectPointTo=function(x,y,_13e,_13f,_140){
this.callback=_140;
var _141=this.mapServerUrl+"RWCInterface.axd?request=ProjectPointTo"+"&x="+x+"&y="+y+"&from="+_13e+"&to="+_13f+"&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",_141,true);
this.pointXmlHttp.send("");
};
SpatialAceMap.prototype.onProjectPointToResponse=function(){
if(this.pointXmlHttp&&this.pointXmlHttp.readyState==4){
if(this.pointXmlHttp.responseText){
try{
var _142=eval("("+this.pointXmlHttp.responseText+")");
}
catch(e){
this.removeWorkItem();
return;
}
var _143=_142.ProjectedPoint;
var x=parseFloat(_142.ProjectedPoint.X);
var y=parseFloat(_142.ProjectedPoint.Y);
this.removeWorkItem();
this.callback(x,y);
}
}
};
SpatialAceMap.prototype.reorderLayer=function(_146,step){
if(!this.initialized||!this.config.GUI.layerControl.reorderableLayers){
return false;
}
for(var i=0;i<this.view.overlayArray.length;i++){
if(this.view.overlayArray[i].id==_146){
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(_149,_14a){
if(!this.initialized){
return;
}
var json="&responsetype=JSON";
var view="&view="+this.viewName;
var _14d="&points=";
_14d+=_149[0].x+","+_149[0].y;
for(var i=1;i<_149.length;i++){
_14d+=","+_149[i].x+","+_149[i].y;
}
var _14f=this.mapServerUrl+"RWCInterface.axd?request=GetGreatCircleDistances"+view+_14d+"&refsys="+this.refSystem+json;
if(!this.getDistanceQueue){
this.getDistanceQueue=new Array();
}
if(this.getDistanceRequestActive==true){
var _150=new Object();
_150.points=_149;
_150.callback=_14a;
this.getDistanceQueue.push(_150);
return;
}
this.getDistanceRequestActive=true;
if(_14a){
this.getDistanceCallback=_14a;
}
this.getDistancesXmlHttp=new XMLHttpRequest();
this.getDistancesXmlHttp.onreadystatechange=associateObjWithCallback(this,this.getDistanceResponse);
this.getDistancesXmlHttp.open("GET",_14f,true);
this.getDistancesXmlHttp.send("");
};
SpatialAceMap.prototype.getDistanceResponse=function(){
if(this.getDistancesXmlHttp&&this.getDistancesXmlHttp.readyState==4){
if(this.getDistancesXmlHttp.responseText){
var _151=new Array();
try{
var _152=eval("("+this.getDistancesXmlHttp.responseText+")");
}
catch(e){
return;
}
for(var i=0;i<_152.distances.length;i++){
_151.push(parseFloat(_152.distances[i].d));
}
if(this.getDistanceCallback){
this.getDistanceCallback(_151);
}
}
this.getDistanceRequestActive=false;
if(this.getDistanceQueue&&this.getDistanceQueue.length>0){
var _154=this.getDistanceQueue[0].points;
var _155=this.getDistanceQueue[0].callback;
this.getDistanceQueue.splice(0,1);
this.getDistances(_154,_155);
}
}
};
SpatialAceMap.prototype.createObjectList=function(_156,_157){
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(_156){
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 _15a=document.createElement("img");
_15a.className="rwcLegendImage";
if(this.view.overlayArray[i].configuration.properties[j].image.image&&this.view.overlayArray[i].configuration.properties[j].image.image!=""){
setImageSource(_15a,this.view.overlayArray[i].configuration.properties[j].image.image);
}
legendDiv.appendChild(_15a);
if(this.view.overlayArray[i].configuration.properties[j].label&&this.view.overlayArray[i].configuration.properties[j].label!=""){
var _15b=document.createElement("span");
_15b.innerHTML=this.view.overlayArray[i].configuration.properties[j].label;
legendDiv.appendChild(_15b);
}
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 _15d=this.view.overlayArray[i].geoObjectArray[k].createInfo(_157);
_15d.className="rwcListInfoBox";
_15d.style.position="relative";
_15d.style.lineHeight="18px";
if(_157){
var _15e=document.createElement("span");
_15e.innerHTML=k+1+".";
_15d.insertBefore(_15e,_15d.firstChild);
}
this.objectList.appendChild(_15d);
}
}
}
return this.objectList;
};
SpatialAceMap.prototype.setClickTool=function(_15f){
if(this.clickTool&&this.clickTool.cancel){
this.clickTool.cancel();
}
switch(_15f){
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:
if(typeof (top[_15f])=="function"){
this.clickTool=new top[_15f](this,this.prefix);
}else{
this.clickTool=null;
}
break;
}
};
SpatialAceMap.prototype.mapToScreenCoordinates=function(x,y){
if(!this.initialized){
return;
}
var _162=new Object();
var _163=this.tileSize/this.tileGeoWidth;
_162.x=(x-this.initialGeoCenterX)*_163+this.mapWidth/2+this.totalOffsetX;
_162.y=(this.initialGeoCenterY-y)*_163+this.mapHeight/2+this.totalOffsetY;
return _162;
};
SpatialAceMap.prototype.getGeoObjectsBySelection=function(maxX,maxY,minX,minY){
var _168=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){
_168.push(this.view.overlayArray[i].geoObjectArray[j]);
}
}
}
}
return _168;
};
SpatialAceMap.prototype.createObjectSelectionList=function(_16b,_16c){
var _16d=document.createElement("div");
for(var i=0;i<_16b.length;i++){
var _16f=_16b[i].createInfo(false);
_16f.className="rwcListInfoBox";
_16f.style.position="relative";
_16f.style.lineHeight="18px";
if(_16c&&_16b[i].type=="point"){
var _170=document.createElement("img");
_170.src=_16b[i].icon.image;
_16f.insertBefore(_170,_16f.firstChild);
}
_16d.appendChild(_16f);
}
return _16d;
};
SpatialAceMap.prototype.setDefaultTool=function(_171){
this.setDragTool(_171,true);
};
SpatialAceMap.prototype.setDragTool=function(_172,_173){
if(this.manipulationActive==true){
this.currentTool.cancelManipulation();
}
this.manipulationActive=false;
if(this.currentTool&&this.currentTool.deactivate){
this.currentTool.deactivate();
}
switch(_172){
case ("select"):
this.defaultTool=this.selectionTool;
this.shiftTool=this.zoomTool;
this.altTool=this.panTool;
break;
case ("zoom"):
this.defaultTool=this.zoomTool;
if(_173){
this.shiftTool=this.panTool;
}
this.altTool=this.selectionTool;
break;
case ("pan"):
this.defaultTool=this.panTool;
if(_173){
this.shiftTool=this.zoomTool;
}
this.altTool=this.selectionTool;
break;
default:
if(typeof (top[_172])=="function"){
this.defaultTool=new top[_172](this,this.prefix,this.embedDiv);
this.shiftTool=this.panTool;
this.altTool=this.zoomTool;
}else{
this.defaultTool=this.panTool;
this.shiftTool=this.zoomTool;
this.altTool=this.selectionTool;
}
break;
}
if(!_173){
this.shiftTool=null;
this.altTool=null;
}
this.setTool(this.defaultTool);
};
SpatialAceMap.prototype.printMap=function(_174,_175,_176){
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 _177=this.getGeoObjectsBySelection(this.mapWidth,this.mapHeight,0,0);
for(var i=0;i<this.view.overlayArray.length;i++){
var _179=document.createElement("span");
_179.innerHTML=this.view.overlayArray[i].name+"<br>";
var _17a=this.createLayerLegend(this.view.overlayArray[i],false);
_17a.className="rwcPrintLegend";
this.printArea.appendChild(_179);
this.printArea.appendChild(_17a);
}
if(_175){
var _17b=this.createObjectSelectionList(_177,false);
}
if((isMozilla||isFireFox)&&this.view.overlayArray.length>0){
var _17c="&layers=";
for(var i=0;i<this.view.layerArray.length;i++){
if(_17c!="&layers="){
_17c+=",";
}
if(!this.view.layerArray[i].isHidden){
_17c+=this.view.layerArray[i].id;
}
}
for(var i=0;i<this.view.overlayArray.length;i++){
if(!this.view.overlayArray[i].isHidden){
if(_17c!="&layers="){
_17c+=",";
}
_17c+=this.view.overlayArray[i].id;
}
}
var _17d=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 _17e=this.getMapCenter();
this.printImage.src=this.mapServerUrl+"RWCInterface.axd?view="+this.viewName+"&format=gif&transparent=true"+"&width="+this.mapWidth+"&height="+this.mapHeight+"&scale="+_17d+"&x="+_17e.x+"&y="+_17e.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<_177.length;i++){
if(_177[i].type=="point"){
var _17f=document.createElement("img");
_17f.src=_177[i].icon.image;
_17f.className="rwcMarker";
_17f.style.height=_177[i].icon.height;
_17f.style.width=_177[i].icon.width;
setX(_17f,_177[i].viewX-_177[i].iconOffsetX/2);
setY(_17f,_177[i].viewY-_177[i].iconOffsetY/2);
this.printOverlay.appendChild(_17f);
}
}
this.mapContainer.insertBefore(this.printOverlay,this.view.overlayArray[0].container);
}
}
if(_175){
this.printArea.appendChild(_17b);
}
window.print();
};
SpatialAceMap.prototype.zoomToObjects=function(_180,_181){
if(!this.initialized||_180==null||_180.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<_180.length;i++){
if(_180[i].type=="point"){
if(_180[i].point.x>xMax){
xMax=_180[i].point.x;
}
if(_180[i].point.y>yMax){
yMax=_180[i].point.y;
}
if(_180[i].point.x<xMin){
xMin=_180[i].point.x;
}
if(_180[i].point.y<yMin){
yMin=_180[i].point.y;
}
}else{
for(var j=0;j<_180[i].points.length;j++){
if(_180[i].points[j].x>xMax){
xMax=_180[i].points[j].x;
}
if(_180[i].points[j].y>yMax){
yMax=_180[i].points[j].y;
}
if(_180[i].points[j].x<xMin){
xMin=_180[i].points[j].x;
}
if(_180[i].points[j].y<yMin){
yMin=_180[i].points[j].y;
}
}
}
}
var _188=xMax-xMin;
var _189=yMax-yMin;
var _18a=xMax-_188/2;
var _18b=yMax-_189/2;
if(_181){
var _18c=this.tileGeoWidth/this.tileSize;
var xMod=(_181*2);
var yMod=(_181*2);
}else{
var xMod=0;
var yMod=0;
}
var _18f=this.tileSize/this.mapContainer.offsetHeight;
var _190=this.tileSize+(_18f*xMod);
var _191=this.tileSize+(_18f*yMod);
var _192=_188*(_190/this.mapContainer.offsetWidth);
var _193=_192/this.scaleToGeoWidth;
var _194=_189*(_191/this.mapContainer.offsetHeight);
var _195=_194/this.scaleToGeoWidth;
var _196=Math.max(_193,_195);
this.setArea(_18a,_18b,_196);
};
SpatialAceMap.prototype.setArea=function(x,y,_199){
if(!this.initialized){
return;
}
var _19a=_199;
if(this.fixedScales){
_19a=this.fixedScaleSteps[this.fixedScaleSteps.length-1];
for(var i=this.fixedScaleSteps.length-1;i>=0;i--){
if(this.fixedScaleSteps[i]>=_199){
_19a=this.fixedScaleSteps[i];
}else{
break;
}
}
}else{
var _19c=this.tileGeoWidth/this.scaleToGeoWidth;
if(_19a/_19c<0.05){
_19a=0.05*_19c;
}
}
var _19d=this.tileGeoWidth;
this.tileGeoWidth=_19a*this.scaleToGeoWidth;
this.view.setTileGeoWidth(this.tileGeoWidth);
var _19e=this.tileSize/this.tileGeoWidth;
var _19f=this.totalOffsetX;
var _1a0=this.totalOffsetY;
this.totalOffsetX=-(x-this.initialGeoCenterX)*_19e;
this.totalOffsetY=(y-this.initialGeoCenterY)*_19e;
if(this.totalOffsetX!=_19f||this.totalOffsetY!=_1a0){
this.view.offset(Math.round(this.totalOffsetX),Math.round(this.totalOffsetY));
}
if(this.zoomControl){
this.zoomControl.refreshZoomLevel(this.tileGeoWidth);
}
if(this.totalOffsetX!=_19f||this.totalOffsetY!=_1a0||this.tileGeoWidth!=_19d){
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(_1a2){
if(typeof (_1a2)=="function"){
this.onClickEventHandlers.push(_1a2);
}
};
SpatialAceMap.prototype.registerOnBeforeUpdateEventHandler=function(_1a3){
if(typeof (_1a3)=="function"){
this.onBeforeUpdateEventHandlers.push(_1a3);
}
};
SpatialAceMap.prototype.registerOnAfterUpdateEventHandler=function(_1a4){
if(typeof (_1a4)=="function"){
this.onAfterUpdateEventHandlers.push(_1a4);
}
};
SpatialAceMap.prototype.registerOnNewGeoRectEventHandler=function(_1a5){
if(typeof (_1a5)=="function"){
this.onNewGeoRectEventHandlers.push(_1a5);
}
};
SpatialAceMap.prototype.registerOnClientSearchEventHandler=function(_1a6){
if(typeof (_1a6)=="function"){
this.onClientSearchEventHandlers.push(_1a6);
}
};
SpatialAceMap.prototype.registerOnMouseOverEventHandler=function(_1a7){
if(typeof (_1a7)=="function"){
this.onMouseOverEventHandlers.push(_1a7);
}
if(isOpera||!this.mouseMovePositionDelegate){
this.mouseMovePositionDelegate=associateObjWithEvent(this,"onMouseMovePosition");
Evt.addEventListener(document,"mousemove",this.mouseMovePositionDelegate);
}
};
SpatialAceMap.prototype.registerOnMouseOutEventHandler=function(_1a8){
if(typeof (_1a8)=="function"){
this.onMouseOutEventHandlers.push(_1a8);
}
if(isOpera||!this.mouseMovePositionDelegate){
this.mouseMovePositionDelegate=associateObjWithEvent(this,"onMouseMovePosition");
Evt.addEventListener(document,"mousemove",this.mouseMovePositionDelegate);
}
};
SpatialAceMap.prototype.registerOnFullyUpdatedEventHandler=function(_1a9){
if(typeof (_1a9)=="function"){
this.onFullyUpdatedEventHandlers.push(_1a9);
}
};
SpatialAceMap.prototype.registerOnObjectUpdatedEventHandler=function(_1aa){
if(typeof (_1aa)=="function"){
this.onObjectUpdatedEventHandlers.push(_1aa);
}
};
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;
}
var _1ad=this.getMapCenter();
var _1ae=this.tileGeoWidth/this.tileSize;
return new GeoRectangle(_1ad.x+_1ae*(this.embedDiv.offsetWidth/2),_1ad.y+_1ae*(this.embedDiv.offsetHeight/2),_1ad.x-_1ae*(this.embedDiv.offsetWidth/2),_1ad.y-_1ae*(this.embedDiv.offsetHeight/2));
};
SpatialAceMap.prototype.getAllLayers=function(){
if(!this.initialized){
return;
}
var _1af=new Array();
if(this.view.layerArray){
_1af=_1af.concat(this.view.layerArray);
}
if(this.view.overlayArray){
_1af=_1af.concat(this.view.overlayArray);
}
return _1af;
};
SpatialAceMap.prototype.initiateGeoCodingComponent=function(_1b0){
this.geoCodingLayer=this.addObjectLayer(this.prefix+"GeoCoding","geoCoding",_1b0);
};
SpatialAceMap.prototype.geoCodingQuery=function(_1b1,_1b2,_1b3,_1b4,_1b5,_1b6){
if(!this.geoCodingLayer){
this.initiateGeoCodingComponent(false);
}
if(_1b1){
var _1b7="&address="+encodeURIComponent(_1b1);
}else{
return;
}
if(_1b2){
countryString="&country="+_1b2;
}else{
countryString="";
}
if(_1b3){
var _1b8="&bbox="+_1b3.xMin+","+_1b3.yMin+","+_1b3.xMax+","+_1b3.yMax;
}else{
var _1b8="";
}
if(_1b4){
var _1b9="max="+_1b9;
}else{
var _1b9="";
}
if(_1b5){
}
this.gcXmlHttp=new XMLHttpRequest();
this.gcXmlHttp.open("GET",mapServerUrl+"RWCProxy.axd?proxy=geoCoding&request=locate&return=json"+_1b7+countryString+_1b8+_1b9,true);
this.gcXmlHttp.onreadystatechange=associateObjWithCallback(this.geoCodingLayer,this.geoCodingLayer.onGetGeoObjectsResponse);
this.gcXmlHttp.send("");
};
SpatialAceMap.prototype.updatePrintImage=function(_1ba,_1bb,_1bc){
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 _1bd="&format="+this.config.viewSettings.imageFormat;
var _1be;
var _1bf=Math.round((this.tileGeoWidth*this.geoWidthToScale)-2);
_1be="&scale="+_1bf;
var _1c0=this.getAllLayers();
var _1c1="";
for(var i=0;i<_1c0.length;i++){
if(!_1c0[i].isHidden){
if(_1c0[i].type=="combinedImage"){
for(var j=0;j<_1c0[i].sublayerID.length;j++){
if(!_1c0[i].sublayerID[j].isHidden){
if(_1c1!=""){
_1c1+=",";
}
_1c1+=_1c0[i].sublayerID[j].id;
}
}
}else{
if(_1ba||_1c0[i].type!="objects"){
if(_1c1!=""){
_1c1+=",";
}
_1c1+=_1c0[i].id;
}
}
}
this.mapRequestString="";
if(_1bb){
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];
}
}
}
}
}
_1c1="&layers="+_1c1;
var _1c4=this.getMapCenter();
var _1c5=this.mapServerUrl+"RWCInterface.axd?view="+this.viewName+_1bd+"&transparent=false"+_1c1+"&width="+this.mapContainer.offsetWidth+"&height="+this.mapContainer.offsetHeight+_1be+"&x="+_1c4.x+"&y="+_1c4.y+this.mapRequestString;
var _1c6="";
if(_1bc){
var _1c7;
var _1c8=Math.floor((this.config.viewSettings.requestMaxLength-_1c5.length)/8);
if(_1c8>0){
_1c6=this.encodeClientObjects(_1bc,this.screenBounds,_1c8);
}
}
this.printImage.src=_1c5+_1c6;
};
SpatialAceMap.prototype.encodeClientObjects=function(_1c9,_1ca,_1cb){
if(!_1c9){
return;
}
clientObjectString="";
var _1cc=0;
var _1cd=0;
var _1ce=0;
for(var i=0;i<_1c9.length;i++){
if(_1c9[i].points){
if(_1c9[i].points){
var _1d0=_1c9[i].points;
}else{
var _1d0=_1c9[i].point;
}
var _1d0=RWCClipToRectangle(_1c9[i],_1ca,_1cb,2);
var _1d1=new Object();
if(_1d0&&_1d0.length>0){
if(_1c9[i].type=="poly"){
var _1d2=_1c9[i].type+_1cd;
_1cd++;
}else{
if(_1c9[i].type=="line"){
var _1d2=_1c9[i].type+_1cc;
_1cc++;
}else{
if(_1c9[i].type=="point"){
var _1d2=_1c9[i].type+_1ce;
_1ce++;
}
}
}
clientObjectString+="&"+_1d2+"="+RWCEncodePointList(_1d0,_1d1);
clientObjectString+="&sh="+_1d1.value;
}
}
}
return clientObjectString;
};
RWCBuiltInOnNewGeoRect=function(map){
map.geoRect=map.getGeoRect();
var _1d4=new Array();
_1d4.push(map.point(map.geoRect.xMax,map.geoRect.yMax));
_1d4.push(map.point(map.geoRect.xMin,map.geoRect.yMax));
_1d4.push(map.point(map.geoRect.xMin,map.geoRect.yMin));
_1d4.push(map.point(map.geoRect.xMax,map.geoRect.yMin));
map.screenBounds=new BoundingArea(null,_1d4,"poly",map,0);
};

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";
setWidth(this.node,this.tileSize);
setHeight(this.node,this.tileSize);
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";
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;
var _3c=null;
var _3d=null;
var _3e=false;
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;
if(ls==0){
var _46=distance2D(_3a[i],_39);
u=0;
}else{
var u=dot/ls;
var _48=new Object();
if(u<0){
_48.x=_3a[i].x;
_48.y=_3a[i].y;
}else{
if(u>1){
_48.x=_3a[i+1].x;
_48.y=_3a[i+1].y;
}else{
_48.x=_3a[i].x+u*C;
_48.y=_3a[i].y+u*D;
}
}
var _46=distance2D(_48,_39);
}
if(_46<_3b){
_3d=_48;
_3b=_46;
if(u<0){
_3c=i;
_3e=true;
}else{
if(u>1){
_3c=i+1;
_3e=true;
}else{
_3c=i;
_3e=false;
}
}
}
}
var _49=new Object();
_49.distance=_3b;
_49.closestPoint=_3d;
_49.pointIndex=_3c;
_49.exactPoint=_3e;
return _49;
}
function pointInPolygon2D(p,_4b){
var c=false;
var j=_4b.length-1;
for(i=0;i<_4b.length;j=i++){
if((((_4b[i].y<=p.y)&&(p.y<_4b[j].y))||((_4b[j].y<=p.y)&&(p.y<_4b[i].y)))&&(p.x<(_4b[j].x-_4b[i].x)*(p.y-_4b[i].y)/(_4b[j].y-_4b[i].y)+_4b[i].x)){
c=!c;
}
}
return c;
}
function RWCPoint(x,y){
this.x=x;
this.y=y;
}
function testBrowserForRWC(){
var _50=new Object();
if(!isMozilla&&!isIe6&&!isIe7&&!isFireFox&&!isSafari3&&!isOpera&&!isSafari2){
_50.isSupported=false;
_50.msg="Your browser is not supported by this version of the Carmenta Server Rich Web Client";
}else{
_50.isSupported=true;
_50.msg="Browser is supported";
}
return _50;
}
function stringToBoolean(_51,_52){
if(_51){
var il=_51.toLowerCase();
if(il=="false"){
return false;
}else{
if(il=="true"){
return true;
}else{
return _52;
}
}
}else{
return _52;
}
}
function stringToInt(_54,_55){
try{
_56=parseInt(_54);
}
catch(e){
var _56=_55;
}
return _56;
}
function getPixelPositionFromEvent(evt,_58){
if(isFireFox||isMozilla||isIe6){
return new RWCPoint(evt.x-cumulativeOffsetLeft(_58)+document.body.scrollLeft,evt.y-cumulativeOffsetTop(_58)+document.body.scrollTop);
}else{
if(isIe7){
return new RWCPoint(evt.x-cumulativeOffsetLeft(_58)+document.documentElement.scrollLeft,evt.y-cumulativeOffsetTop(_58)+document.documentElement.scrollTop);
}else{
return new RWCPoint(evt.x-cumulativeOffsetLeft(_58),evt.y-cumulativeOffsetTop(_58));
}
}
}
function RWCEncodePointList(_59,_5a){
var i=0;
var py=0;
var px=0;
var _5e="";
if(_59&&_59.length>0){
if(_59[0].x<1){
_5a.value=7;
_5a.factor=10000000;
}else{
if(_59[0].x<1000){
_5a.value=5;
_5a.factor=100000;
}else{
if(_59[0].x<100000){
_5a.value=3;
_5a.factor=1000;
}else{
_5a.value=0;
_5a.factor=1;
}
}
}
}
for(i=0;i<_59.length;++i){
var _5f=_59[i];
var y=_5f.y;
var x=_5f.x;
var ye=Math.round(y*_5a.factor);
var xe=Math.round(x*_5a.factor);
dy=ye-py;
dx=xe-px;
py=ye;
px=xe;
_5e+=RWCEncodeSignedNumber(dy)+RWCEncodeSignedNumber(dx);
}
return _5e;
}
function RWCEncodeSignedNumber(n){
var sn=n<<1;
if(n<0){
sn=~(sn);
}
return (RWCEncodeNumber(sn));
}
function RWCEncodeNumber(num){
var _67="";
while(num>=32){
_67+=(String.fromCharCode((32|(num&31))+63));
num>>=5;
}
_67+=(String.fromCharCode(num+63));
return _67;
}
function RWCClipToRectangle(_68,_69,_6a,_6b){
var _6c=new Array();
if(!_68.boundingArea.boundingAreaInside(_69)){
return _6c;
}
if(!_68.points){
return _68.point;
}else{
if(_68.points.length<2){
return _68.points;
}
}
if(_68.type=="line"){
var _6d=_69.lineInside(_68.points,false);
if(_6d==-1){
return null;
}
var _6e=_69.lineInside(_68.points,true);
_6c=_68.points.slice(_6d,_6e+1);
}else{
if(_68.type=="poly"){
_6c=_68.points;
}
}
var _6f=Math.max((_69.maxX-_69.minX),(_69.maxY-_69.minY));
var _70=_6b;
var _71=_6f/(_6a*_70);
while(_6c.length>_6a&&_6c.length>4){
tmppoints=new Array();
var n=_6c.length;
tmppoints.push(_6c[0]);
for(var i=1;i<n-1;i++){
var _74=_6c[i];
tmppoints.push(_6c[i]);
while(i<(n-2)){
var _75=distance2D(_74,_6c[i+1]);
if(_75<_71){
i++;
}else{
break;
}
}
}
tmppoints.push(_6c[n-1]);
_6c=tmppoints;
_70=_70/1.4;
_71=_6f/(_6a*_70);
}
return _6c;
}
if(!window.XMLHttpRequest){
XMLHttpRequest=function(){
var _76=null;
try{
_76=new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e){
try{
_76=new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e){
}
}
return _76;
};
}

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;
var _10=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 ("rwcEditable"):
_f=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"):
_10=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,_10);
}else{
var _12=new Layer(id,_8,"combinedImage",i,this.saMap,true,_b,_e,_10);
this.layerArray.push(_12);
}
}else{
var _12=new Layer(id,_8,_d,i,this.saMap,_c,false,_e,_10);
this.layerArray.push(_12);
_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,_10);
}else{
var _12=new Layer(id,_8,"combinedImage",i,this.saMap,true,_b,_e,_10);
this.layerArray.push(_12);
}
}else{
var _12=new Layer(id,_8,_d,i,this.saMap,_c,_b,_e,_10);
this.layerArray.push(_12);
}
break;
case ("objects"):
if(!this.saMap.config.viewSettings.disableObjectLayers){
var _12=new OverlayLayer(id,_8,i,this.saMap,_a,_b,_e);
var _13=this.saMap.config.getLayerConfiguration(_9);
_12.createDefaults(_13,this.saMap.viewJSON.ViewInfo.Layers[i].Layer);
this.overlayArray.push(_12);
}
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,_10);
}else{
var _12=new Layer(id,_8,"combinedImage",i,this.saMap,true,_b,_e,_10);
this.layerArray.push(_12);
}
}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,_10);
}else{
var _12=new Layer(id,_8,"combinedImage",i,this.saMap,_c,_b,_e,_10);
this.layerArray.push(_12);
}
}
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,_10);
}else{
var _12=new Layer(id,_8,"combinedImage",i,this.saMap,true,_b,_e,_10);
this.layerArray.push(_12);
}
}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,_10);
}else{
var _12=new Layer(id,_8,"combinedImage",i,this.saMap,_c,_b,_e,_10);
this.layerArray.push(_12);
}
}
}
_12.editable=_f;
}
};
View.prototype.moveOverlayLayer=function(_14,_15){
if(_14<_15){
this.overlayArray.splice(_15+1,0,this.overlayArray[_14]);
this.overlayArray.splice(_14,1);
}else{
this.overlayArray.splice(_15,0,this.overlayArray[_14]);
this.overlayArray.splice(_14+1,1);
}
};
View.prototype.createTiles=function(_16,_17,_18,_19){
if(!this.layerArray){
return;
}
for(var i=0;i<this.layerArray.length;i++){
if(this.layerArray[i].isNonTileLayer){
var _1b=Math.max(this.saMap.mapWidth,this.saMap.mapHeight);
_1b=_1b+this.saMap.config.GUI.padding;
var _1c=this.saMap.tileGeoWidth*(_1b/this.saMap.tileSize);
this.layerArray[i].createTiles(_16,_17,_18,_19,_1b,_1c,i);
}else{
this.layerArray[i].createTiles(_16,_17,_18,_19,this.saMap.tileSize,this.saMap.tileGeoWidth,i);
}
}
};
View.prototype.setTileGeoWidth=function(_1d){
for(var i=0;i<this.layerArray.length;i++){
if(this.layerArray[i].isNonTileLayer){
var _1f=Math.max(this.saMap.mapWidth,this.saMap.mapHeight);
_1f=_1f+this.saMap.config.GUI.padding;
this.layerArray[i].tileGeoWidth=_1d*(_1f/this.saMap.tileSize);
}else{
this.layerArray[i].tileGeoWidth=_1d;
}
}
};
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(_25,_26){
for(var i=0;i<this.layerArray.length;i++){
this.layerArray[i].pixelOffset(_25,_26);
}
for(var i=0;i<this.overlayArray.length;i++){
this.overlayArray[i].pixelOffset(_25,_26);
}
};
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 _2b=new Array();
var _2c=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].geoObjectArray[j].boundingAreas)&&!this.overlayArray[i].isHidden&&!this.overlayArray[i].geoObjectArray[j].isHidden){
var _2f=this.overlayArray[i].geoObjectArray[j].inside(x,y);
if(_2f){
if(this.lastSelectedGeoObject){
var _30={enter:false,geoObject:this.lastSelectedGeoObject};
_2b.push(_30);
}
_2c=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 _31={enter:true,geoObject:this.overlayArray[i].geoObjectArray[j]};
_2b.push(_31);
this.lastSelectedGeoObject=this.overlayArray[i].geoObjectArray[j];
return _2b;
}
}
}
}
}
if(!_2c&&this.lastSelectedGeoObject){
var _30={enter:false,geoObject:this.lastSelectedGeoObject};
_2b.push(_30);
this.lastSelectedGeoObject=null;
}
if(!_2c&&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 _2b;
};
View.prototype.offset=function(_32,_33){
for(var i=0;i<this.layerArray.length;i++){
this.layerArray[i].offset(_32,_33);
}
};
View.prototype.refresh=function(_35){
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(_35);
}
};
View.prototype.getLayerId=function(_37){
if(typeof (this.layerArray[_37])!="undefined"){
var _38=this.layerArray[_37].getVisibleLayersID();
if(_38==null){
return null;
}else{
return _38;
}
}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(_40){
for(var i=0;i<this.layerArray.length;i++){
this.layerArray[i].zoom(_40);
}
};
View.prototype.showLayer=function(id){
var _43=this.getObjectLayerById(id);
if(_43){
_43.show();
}else{
for(var i=0;i<this.layerArray.length;i++){
this.layerArray[i].show(id);
}
}
};
View.prototype.hideLayer=function(id){
var _46=this.getObjectLayerById(id);
if(_46){
_46.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(_4c,_4d,_4e,_4f){
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].configuration.downloadBehavior.initiation!="manual"){
this.overlayArray[i].getGeoObjects(this.saMap.mapServerUrl,this.saMap,_4c,_4d,_4e,_4f);
}
}
}
}
};
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 ViewList(_1,_2,_3){
this.container=document.getElementById(_2);
this.container.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){
if(this.getViewXmlHttp.status==500){
this.loadingBox.innerHTML="<h2>The Carmenta Map Server web interfaces used by the Rich Web Client is not available at this moment. Check that the server is running and that the RWC interface is enabled.<h2>";
return;
}
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.container.innerHTML+=_5;
this.container.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(isNaN(newScale)){
this.updateMarker();
return;
}
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();
if(this.selectedZoomLevel==i-1||this.selectedZoomLevel==i+1){
var _1a=true;
}else{
var _1a=false;
}
this.selectedZoomLevel=i;
this.saMap.setTileGeoWidth(this.zoomLevelGeoWidths[i],_1a);
this.updateMarker();
break;
}
}
};
ZoomControl.prototype.refreshZoomLevel=function(_1b){
for(var i=0;i<this.zoomLevelGeoWidths.length;i++){
if(this.zoomLevelGeoWidths[i]==_1b){
this.markerAbortDrag();
this.selectedZoomLevel=i;
this.updateMarker();
break;
}
}
};
ZoomControl.prototype.zoomInClicked=function(evt,_1e){
this.zoomIn();
};
ZoomControl.prototype.zoomOutClicked=function(evt,_20){
this.zoomOut();
};
ZoomControl.prototype.zoomIn=function(){
this.saMap.zoomIn();
};
ZoomControl.prototype.zoomOut=function(){
this.saMap.zoomOut();
};
ZoomControl.prototype.updateMarker=function(){
if(this.scaleMarker){
var _21=this.zoomLevelElements[this.selectedZoomLevel].offsetLeft+this.scaleMarkerOffsetX;
var _22=this.zoomLevelElements[this.selectedZoomLevel].offsetTop+this.scaleMarkerOffsetY;
setX(this.scaleMarker,_21);
setY(this.scaleMarker,_22);
}
};
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;
this.name="Measure Distance Tool";
}
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;
this.name="Route Search Tool";
}
RouteSearch.prototype.click=function(_11,_12){
var _13=this.saMap.getPosition(_11,_12);
if(this.routeState==0){
if(!this.saMap.routeLayer){
this.saMap.routeLayer=this.saMap.addObjectLayer(this.prefix+"RouteLayer","default");
this.saMap.routeLayer.setAsRouteSearchLayer();
}
this.startPoint=_13;
this.startObject=this.saMap.createGeoObject(_13.x,_13.y,this.prefix+"StartPoint",this.saMap.routeLayer.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.saMap.routeLayer.id,"line",points);
this.line.activate();
this.routeState=1;
}else{
if(this.routeState==1){
if(this.startObject){
this.saMap.removeGeoObject(this.startObject.id,this.saMap.routeLayer.id);
}
if(this.line){
this.saMap.removeGeoObject(this.line.id,this.saMap.routeLayer.id);
}
this.saMap.routeLayer.draw();
this.startObject=null;
this.line=null;
this.endPoint=_13;
var _14="&from="+this.startPoint.x+","+this.startPoint.y+"&to="+this.endPoint.x+","+this.endPoint.y+"&refsystem="+this.saMap.SRS+"&info=information"+"&return=geojson&request=getroute";
this.saMap.routeLayer.activateProxy("routeSearch",_14);
this.saMap.routeLayer.refresh(true);
this.saMap.routeLayer.resetDrivingDirections();
this.saMap.routeLayer.showDrivingDirections(true);
this.routeState=0;
}else{
this.cancel();
}
}
};
RouteSearch.prototype.update=function(_15){
if(this.routeState==1){
var _16=new Array();
if(this.startObject&&this.line){
var _17=this.saMap.point(this.startObject.point.x,this.startObject.point.y);
var _18=this.saMap.point(_15.x,_15.y);
_16.push(_17);
_16.push(_18);
this.line.setPosition(0,0,_16);
this.saMap.routeLayer.draw();
}
}
};
RouteSearch.prototype.cancel=function(){
if(this.saMap.routeLayer){
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.startObject=null;
this.line=null;
this.saMap.routeLayer.draw();
}
this.routeState=0;
};

function EditTool(_1,_2,_3,_4){
this.saMap=_1;
this.type="edit";
this.name="Edit Tool";
this.embedDiv=_3;
this.manipulateFunc=associateObjWithEvent(this,"move");
this.endManipulationFunc=associateObjWithEvent(this,"endManipulation");
this.cursor="pointer";
Evt.addEventListener(document,"mousemove",this.manipulateFunc,false);
}
EditTool.prototype.startManipulation=function(_5){
evt2=new Evt(_5);
this.pixelPoint=getPixelPositionFromEvent(evt2,this.saMap.mapContainer);
this.startPoint=this.saMap.getPosition(this.pixelPoint.x,this.pixelPoint.y);
this.currentPoint=this.startPoint;
this.selectedObject=null;
if(this.marker){
this.dragMode=true;
this.moveCounter=0;
}else{
var n=this.saMap.view.overlayArray.length;
for(var i=0;i<n;i++){
if(this.saMap.view.overlayArray[i].geoObjectArray){
m=this.saMap.view.overlayArray[i].geoObjectArray.length;
for(var j=0;j<m;j++){
if(this.saMap.view.overlayArray[i].editable&&this.saMap.view.overlayArray[i].geoObjectArray[j].boundingArea.inside(this.startPoint.x,this.startPoint.y)){
this.selectedObject=this.saMap.view.overlayArray[i].geoObjectArray[j];
this.dragMode=true;
this.moveCounter=0;
if(this.selectedObject.type!="point"){
this.referencePoint=this.saMap.point(this.selectedObject.point.x,this.selectedObject.point.y);
}
break;
}
}
}
}
}
if(!this.selectedObject&&!this.dragMode){
this.saMap.panTool.startManipulation(_5);
return;
}
if(document.attachEvent){
document.body.attachEvent("onselectstart",returnFalse,false);
document.body.attachEvent("ondrag",returnFalse,false);
}
Evt.addEventListener(document,"mouseup",this.endManipulationFunc,false);
evt2.consume();
};
EditTool.prototype.deactivate=function(){
this.unload();
};
EditTool.prototype.move=function(_9,_a){
this.moveCounter++;
if(this.dragMode){
if(!this.marker){
this.manipulate(_9,_a);
}else{
if(this.newPoint){
this.saMap.selectedObject.points=this.saMap.selectedObject.points.insert(this.pointIndex);
this.newPoint=null;
}
_9=new Evt(_9);
var _b=getPixelPositionFromEvent(_9,this.saMap.mapContainer);
this.currentPoint=this.saMap.getPosition(_b.x,_b.y);
var _c=this.saMap.selectedObject.points;
_c[this.pointIndex]=this.currentPoint;
this.saMap.selectedObject.setPosition(null,null,_c);
this.saMap.selectedObject.layer.updateCanvas();
setX(this.marker,_b.x-Math.round(this.marker.width/2));
setY(this.marker,_b.y-Math.round(this.marker.height/2));
}
if(this.saMap.selectedObject){
this.saMap.selectedObject.outLine();
}
}else{
_9=new Evt(_9);
var _b=getPixelPositionFromEvent(_9,this.saMap.mapContainer);
this.currentPoint=this.saMap.getPosition(_b.x,_b.y);
if(this.saMap.selectedObject){
if(this.saMap.selectedObject.type=="poly"||this.saMap.selectedObject.type=="line"){
if(this.saMap.selectedObject.type=="poly"){
var _c=this.saMap.selectedObject.points.slice(0);
var _d=this.saMap.point(this.saMap.selectedObject.points[0].x,this.saMap.selectedObject.points[0].y);
_c.push(_d);
}else{
var _c=this.saMap.selectedObject.points;
}
var _e=pointToLineDistance2D(this.currentPoint,_c);
viewUnitsToPixels=this.saMap.tileSize/this.saMap.tileGeoWidth;
shortestDist=_e.distance*viewUnitsToPixels;
if(!_e.exactPoint){
distance1=distance2D(_e.closestPoint,this.saMap.selectedObject.points[_e.pointIndex]);
if(_e.pointIndex<(this.saMap.selectedObject.points.length-1)){
distance2=distance2D(_e.closestPoint,this.saMap.selectedObject.points[_e.pointIndex+1]);
}else{
distance2=distance2D(_e.closestPoint,this.saMap.selectedObject.points[0]);
}
distance1=distance1*viewUnitsToPixels;
distance2=distance2*viewUnitsToPixels;
if(distance1<distance2&&distance1<10){
_e.exactPoint=true;
}else{
if(distance1>distance2&&distance2<10){
_e.exactPoint=true;
if(_e.pointIndex<(this.saMap.selectedObject.points.length-1)){
_e.pointIndex++;
}else{
_e.pointIndex=0;
}
}
}
}
if(!_e.exactPoint){
var _f=this.saMap.mapToScreenCoordinates(_e.closestPoint.x,_e.closestPoint.y);
}else{
var _f=this.saMap.mapToScreenCoordinates(this.saMap.selectedObject.points[_e.pointIndex].x,this.saMap.selectedObject.points[_e.pointIndex].y);
}
if(shortestDist<10){
if(!this.marker){
this.marker=document.createElement("img");
addClass(this.marker,"RWCEditMarker");
this.saMap.mapContainer.appendChild(this.marker);
}
if(_e.exactPoint){
this.saMap.config.GUI.editor.moveMarker.applyConfiguration(this.marker);
this.newPoint=null;
this.pointIndex=_e.pointIndex;
}else{
this.saMap.config.GUI.editor.createMarker.applyConfiguration(this.marker);
this.newPoint=_e.closestPoint;
this.pointIndex=_e.pointIndex+1;
}
setX(this.marker,_f.x-Math.round(this.marker.width/2));
setY(this.marker,_f.y-Math.round(this.marker.height/2));
var _10=true;
}
}
}
if(!_10&&this.marker){
this.marker.parentNode.removeChild(this.marker);
this.marker=null;
}
}
};
EditTool.prototype.manipulate=function(evt,_12){
evt=new Evt(evt);
this.moveCounter++;
var _13=getPixelPositionFromEvent(evt,this.saMap.mapContainer);
this.currentPoint=this.saMap.getPosition(_13.x,_13.y);
if(this.selectedObject&&this.dragMode){
if(this.selectedObject.type=="point"){
this.selectedObject.setPosition(this.currentPoint.x,this.currentPoint.y);
this.selectedObject.layer.refresh();
}else{
if(this.selectedObject&&(this.selectedObject.type=="poly"||this.selectedObject.type=="line")){
vector2d=this.saMap.point(this.currentPoint.x-this.startPoint.x,this.currentPoint.y-this.startPoint.y);
var _14=this.saMap.point(vector2d.x-(this.selectedObject.point.x-this.referencePoint.x),vector2d.y-(this.selectedObject.point.y-this.referencePoint.y));
var _15=this.selectedObject.points;
for(var i=0;i<_15.length;i++){
_15[i].x=_15[i].x+_14.x;
_15[i].y=_15[i].y+_14.y;
}
this.selectedObject.setPosition(null,null,_15);
this.selectedObject.layer.updateCanvas();
}
}
}
evt.consume();
};
EditTool.prototype.cancelManipulation=function(){
if(document.detachEvent){
document.body.detachEvent("onselectstart",returnFalse,false);
document.body.detachEvent("ondrag",returnFalse,false);
}
if(this.marker){
this.marker.parentNode.removeChild(this.marker);
this.marker=null;
}
this.dragMode=false;
this.saMap.manipulationActive=false;
Evt.removeEventListener(document,"mouseup",this.endManipulationFunc,false);
};
EditTool.prototype.endManipulation=function(evt,_18){
evt=new Evt(evt);
if(document.detachEvent){
document.body.detachEvent("onselectstart",returnFalse,false);
document.body.detachEvent("ondrag",returnFalse,false);
}
Evt.removeEventListener(document,"mouseup",this.endManipulationFunc,false);
var _19=this.saMap.mapToScreenCoordinates(this.currentPoint.x,this.currentPoint.y);
if((!this.currentPoint||distance2D(_19,this.pixelPoint)<=2)&&this.moveCounter<4){
this.saMap.activateClickTools(this.pixelPoint);
}
if(this.marker){
this.marker.parentNode.removeChild(this.marker);
this.marker=null;
}
this.dragMode=false;
this.saMap.manipulationActive=false;
evt.consume();
};
EditTool.prototype.unload=function(){
try{
Evt.removeEventListener(document,"mousemove",this.manipulateFunc,false);
Evt.removeEventListener(document,"mouseup",this.endManipulationFunc,false);
}
catch(e){
}
};
function CreateTool(_1a,_1b){
this.saMap=_1a;
this.prefix=_1b;
this.name="Create Tool";
if(this.saMap.config.GUI.editor&&this.saMap.config.GUI.editor.startMode){
this.mode=this.saMap.config.GUI.editor.startMode;
}else{
this.mode="All";
}
}
CreateTool.prototype.click=function(_1c,_1d){
if(this.actionmenu){
this.actionmenu.unload();
}
if(!this.editLayer){
var _1e=this.saMap.getLayerById(this.prefix+"editLayer");
if(_1e&&_1e.editable){
this.editLayer=_1e;
}else{
this.editLayer=this.saMap.addObjectLayer(this.prefix+"editLayer","default");
this.editLayer.editable=true;
}
}
this.point=this.saMap.getPosition(_1c,_1d);
this.pixelPoint=this.saMap.point(_1c,_1d);
var n=this.saMap.view.overlayArray.length;
this.selectedObject=null;
for(var i=0;i<n;i++){
if(this.saMap.view.overlayArray[i].editable&&this.saMap.view.overlayArray[i].geoObjectArray){
m=this.saMap.view.overlayArray[i].geoObjectArray.length;
for(var j=0;j<m;j++){
if(this.saMap.view.overlayArray[i].geoObjectArray[j].boundingArea.inside(this.point.x,this.point.y)&&this.saMap.view.overlayArray[i].geoObjectArray[j].id!=(this.prefix+"editMoveLine")){
this.selectedObject=this.saMap.view.overlayArray[i].geoObjectArray[j];
var hit=true;
if(this.mode=="All"&&((this.selectedObject.type=="line"&&this.selectedObject.points.length>2)||(this.selectedObject.type=="poly"&&this.selectedObject.points.length>3))){
distance=Number.MAX_VALUE;
for(var k=0;k<this.selectedObject.points.length;k++){
var _24=this.saMap.mapToScreenCoordinates(this.selectedObject.points[k].x,this.selectedObject.points[k].y);
var _25=distance2D(this.pixelPoint,_24);
if(_25<distance){
this.closestPoint=this.selectedObject.points[k];
this.pointIndex=k;
distance=_25;
}
}
if(distance<10){
var _26=true;
}else{
var _26=false;
}
}
}
}
}
}
if(this.mode=="All"){
this.createActionMenu(this.pixelPoint,hit,_26);
}else{
if(this.mode=="Point"){
this.performAction("Add point object");
}else{
if(this.mode=="Line"){
if(!this.lineEditMode){
this.performAction("Add line object");
}else{
if(distance2D(this.pixelPoint,this.lastPixelPoint)>2){
this.performAction("Add point to line");
}else{
this.performAction("Close Line");
}
}
}else{
if(this.mode=="Polygon"){
if(!this.polygonEditMode){
this.performAction("Add polygon object");
}else{
if(distance2D(this.pixelPoint,this.lastPixelPoint)>2){
this.performAction("Add point to polygon");
}else{
this.performAction("Close polygon");
}
}
}else{
if(this.mode=="Select"&&hit){
this.performAction("Select object");
}
}
}
}
}
this.lastPixelPoint=this.pixelPoint;
};
CreateTool.prototype.setMode=function(_27){
if(!_27){
return;
}
switch(_27){
case ("All"):
this.mode="All";
break;
case ("Point"):
this.mode="Point";
break;
case ("Line"):
this.mode="Line";
break;
case ("Polygon"):
this.mode="Polygon";
break;
case ("Select"):
this.mode="Select";
break;
}
};
CreateTool.prototype.createActionMenu=function(_28,hit,_2a){
if(this.lineEditMode){
if(this.selectedObject&&this.selectedObject.type=="line"&&this.selectedObject.id!=this.currentObject.id){
var _2b=this.saMap.mapToScreenCoordinates(this.selectedObject.points[0].x,this.selectedObject.points[0].y);
var _2c=this.saMap.mapToScreenCoordinates(this.selectedObject.points[this.selectedObject.points.length-1].x,this.selectedObject.points[this.selectedObject.points.length-1].y);
this.startDistance=distance2D(_2b,this.pixelPoint);
this.endDistance=distance2D(_2c,this.pixelPoint);
if(this.startDistance<3||this.endDistance<3){
this.actionmenu=new ActionMenu(this,this.saMap.embedDiv,_28,["Add point to line","Connect lines","Finish Line","Cancel"]);
}else{
this.actionmenu=new ActionMenu(this,this.saMap.embedDiv,_28,["Add point to line","Finish Line","Cancel"]);
}
}else{
this.actionmenu=new ActionMenu(this,this.saMap.embedDiv,_28,["Add point to line","Finish Line","Cancel"]);
}
}else{
if(this.polygonEditMode){
if(this.currentObject.points.length>1){
this.actionmenu=new ActionMenu(this,this.saMap.embedDiv,_28,["Add point to polygon","Finish polygon","Cancel"]);
}else{
this.actionmenu=new ActionMenu(this,this.saMap.embedDiv,_28,["Add point to polygon","Cancel"]);
}
}else{
if(hit){
if(this.selectedObject.type=="point"){
this.actionmenu=new ActionMenu(this,this.saMap.embedDiv,_28,["Add point object","Add line object","Add polygon object","Select object","Remove object","Cancel"]);
}else{
if(this.selectedObject.type=="poly"||this.selectedObject.type=="line"){
if(_2a){
this.actionmenu=new ActionMenu(this,this.saMap.embedDiv,_28,["Add point object","Add line object","Add polygon object","Append points","Select object","Remove closest point in object","Remove object","Cancel"]);
}else{
this.actionmenu=new ActionMenu(this,this.saMap.embedDiv,_28,["Add point object","Add line object","Add polygon object","Append points","Select object","Remove object","Cancel"]);
}
}
}
}else{
this.actionmenu=new ActionMenu(this,this.saMap.embedDiv,_28,["Add point object","Add line object","Add polygon object","Cancel"]);
}
}
}
};
CreateTool.prototype.performAction=function(_2d){
if(this.editLayer.geoObjectArray){
var _2e=this.editLayer.geoObjectArray.length;
}else{
var _2e=0;
}
switch(_2d){
case ("Add point object"):
var _2f=this.saMap.createGeoObject(this.point.x,this.point.y,RWCGetUniqueId(this.editLayer.geoObjectArray,this.prefix),this.editLayer.id,"point",null,1);
_2f.activate();
this.selectedObject=_2f;
this.performAction("Select object");
break;
case ("Add line object"):
this.lineEditMode=true;
var _30=new Array();
_30.push(this.point);
this.currentObject=this.saMap.createGeoObject(this.point.x,this.point.y,RWCGetUniqueId(this.editLayer.geoObjectArray,this.prefix),this.editLayer.id,"line",_30,1);
this.currentObject.activate();
this.createMoveLine(this.point);
break;
case ("Add point to line"):
var _31=this.currentObject.points;
_31.push(this.point);
this.currentObject.setPosition(null,null,_31);
this.currentObject.layer.updateCanvas();
break;
case ("Remove closest point in object"):
var _31=this.selectedObject.points;
_31.splice(this.pointIndex,1);
this.selectedObject.setPosition(null,null,_31);
if(this.saMap.selectedObject){
this.saMap.selectedObject.outLine();
}
this.selectedObject.layer.updateCanvas();
break;
case ("Finish Line"):
var _31=this.currentObject.points;
_31.push(this.point);
this.currentObject.setPosition(null,null,_31);
case ("Close Line"):
this.cancelMoveLine();
this.currentObject.layer.updateCanvas();
this.selectedObject=this.currentObject;
this.lineEditMode=false;
this.performAction("Select object");
break;
case ("Append points"):
if(this.selectedObject.type=="line"){
this.lineEditMode=true;
}else{
if(this.selectedObject.type=="poly"){
this.polygonEditMode=true;
this.selectedObject.type="line";
this.oldLineWidth=this.currentObject.lineWidth;
this.currentObject.updateIcons();
this.currentObject.lineWidth=2;
this.currentObject.layer.updateCanvas();
}
}
this.currentObject=this.selectedObject;
this.createMoveLine(this.point);
break;
case ("Connect lines"):
this.cancelMoveLine(this.point);
if(this.startDistance>this.endDistance){
var _31=this.selectedObject.points.concat(this.currentObject.points);
}else{
var _32=new Array();
for(var i=this.currentObject.points.length-1;i>=0;i--){
_32.push(this.currentObject.points[i]);
}
var _31=_32.concat(this.selectedObject.points);
}
this.saMap.removeGeoObject(this.currentObject.id,this.editLayer.id);
this.selectedObject.setPosition(null,null,_31);
this.selectedObject.layer.updateCanvas();
this.performAction("Select object");
this.lineEditMode=false;
this.onUpdated(this.selectedObject,this.selectedObject.id,"merged");
break;
case ("Add polygon object"):
this.polygonEditMode=true;
var _30=new Array();
_30.push(this.point);
this.currentObject=this.saMap.createGeoObject(this.point.x,this.point.y,RWCGetUniqueId(this.editLayer.geoObjectArray,this.prefix),this.editLayer.id,"poly",_30,1);
this.currentObject.type="line";
this.oldLineWidth=this.currentObject.lineWidth;
this.currentObject.lineWidth=2;
this.currentObject.activate();
this.createMoveLine(this.point);
break;
case ("Add point to polygon"):
var _31=this.currentObject.points;
_31.push(this.point);
this.currentObject.setPosition(null,null,_31);
this.currentObject.lineWidth=2;
this.currentObject.layer.updateCanvas();
break;
case ("Finish polygon"):
var _31=this.currentObject.points;
_31.push(this.point);
this.currentObject.setPosition(null,null,_31);
case ("Close polygon"):
this.cancelMoveLine(this.point);
var _30=this.currentObject.points;
this.currentObject.type="poly";
this.currentObject.lineWidth=this.oldLineWidth;
this.currentObject.updateIcons();
this.currentObject.layer.updateCanvas();
this.polygonEditMode=false;
this.selectedObject=this.currentObject;
this.performAction("Select object");
break;
case ("Remove object"):
var id=this.selectedObject.id;
var _35=this.selectedObject.layer;
var _36=this.selectedObject.type;
if(this.attributeEditor&&this.selectedObject.id==this.attributeEditor.editObject.id){
this.attributeEditor.onClose();
this.attributeEditor=null;
}
this.saMap.removeGeoObject(this.selectedObject.id,this.selectedObject.layer.id);
if(_36=="point"){
_35.refresh();
}else{
_35.updateCanvas();
}
break;
case ("Select object"):
if(!this.saMap.config.GUI.editor||!this.saMap.config.GUI.editor.attributes||!this.saMap.config.GUI.editor.attributes.parameters){
return;
}
if(this.attributeEditor){
this.attributeEditor.onClose();
}
this.saMap.setSelectedObject(this.selectedObject);
this.attributeEditor=new AttributeEditor(this.saMap,this,this.selectedObject,this.saMap.config.GUI.editor);
break;
case ("Cancel"):
break;
default:
alert("Not implemented yet!");
break;
}
if(this.actionmenu){
this.actionmenu.unload();
this.actionmenu=null;
}
};
CreateTool.prototype.createMoveLine=function(_37){
var _38=new Array();
_38.push(_37);
_38.push(_37);
if(!this.mouseLine){
this.mouseMoveDelegate=associateObjWithEvent(this,"updateMoveLine");
Evt.addEventListener(document,"mousemove",this.mouseMoveDelegate);
var _38=new Array();
_38.push(_37);
_38.push(_37);
this.mouseLine=this.saMap.createGeoObject(null,null,this.prefix+"editMoveLine",this.editLayer.id,"line",_38,1);
}else{
this.mouseLine.points=_38;
this.mouseLine.updateIcons();
this.mouseLine.layer.updateCanvas();
}
};
CreateTool.prototype.updateMoveLine=function(evt,_3a){
if(!this.mouseLine||this.actionmenu){
return;
}
evt=new Evt(evt);
var _3b=new Array();
_3b.push(this.currentObject.points[this.currentObject.points.length-1]);
endPointInPixels=getPixelPositionFromEvent(evt,this.saMap.mapContainer);
var _3c=this.saMap.getPosition(endPointInPixels.x,endPointInPixels.y);
_3b.push(_3c);
this.mouseLine.points=_3b;
this.mouseLine.updateIcons();
this.mouseLine.layer.updateCanvas();
evt.consume();
};
CreateTool.prototype.cancelMoveLine=function(_3d){
if(this.mouseMoveDelegate){
Evt.removeEventListener(document,"mousemove",this.mouseMoveDelegate);
this.mouseMoveDelegate=null;
}
if(this.mouseLine){
this.saMap.removeGeoObject(this.mouseLine.id,this.mouseLine.layer.id);
this.mouseLine=null;
}
};
CreateTool.prototype.closeAttributeEditor=function(){
this.attributeEditor=null;
};
CreateTool.prototype.cancel=function(){
this.lineEditMode=false;
if(this.polygonEditMode){
var _3e=this.currentObject.points;
this.currentObject.type="poly";
this.currentObject.lineWidth=this.oldLineWidth;
this.currentObject.updateIcons();
this.currentObject.layer.updateCanvas();
this.polygonEditMode=false;
this.selectedObject=this.currentObject;
this.performAction("Select object");
}
if(this.actionmenu){
this.actionmenu.unload();
this.actionmenu=null;
}
this.cancelMoveLine();
};
function AttributeEditor(_3f,_40,_41,_42){
this.saMap=_3f;
this.parent=_40;
this.editObject=_41;
this.container=document.createElement("div");
addClass(this.container,_42.css);
this.heading=document.createElement("h3");
this.heading.innerHTML="Object Editor";
this.container.appendChild(this.heading);
this.editArea=document.createElement("div");
this.attributeEnties=new Array();
for(var i=0;i<_42.attributes.parameters.length;i++){
var _44=this.editObject.getAttribute(_42.attributes.parameters[i].name);
var _45=new AttributeEntry(this,this.editArea,_42.attributes.parameters[i].name,_44,this.saMap.config.GUI.closeBox);
this.attributeEnties.push(_45);
}
this.container.appendChild(this.editArea);
this.closeBox=document.createElement("img");
this.closeBox.className="rwcCloseBox";
this.saMap.config.GUI.closeBox.applyConfiguration(this.closeBox);
this.closeBox.title=this.saMap.config.GUI.closeBox.tooltip;
this.container.appendChild(this.closeBox);
this.addButton=document.createElement("button");
this.addButton.innerHTML="Commit";
this.container.appendChild(this.addButton);
this.editCloseDelegate=associateObjWithEvent(this,"onClose");
Evt.addEventListener(this.closeBox,"click",this.editCloseDelegate);
this.addDelegate=associateObjWithEvent(this,"onAdd");
Evt.addEventListener(this.addButton,"click",this.addDelegate);
if(this.saMap.config.GUI.editor.mode=="standalone"){
document.body.appendChild(this.container);
}else{
this.saMap.embedDiv.appendChild(this.container);
}
}
AttributeEditor.prototype.onClose=function(){
this.unload();
this.container.parentNode.removeChild(this.container);
this.parent.closeAttributeEditor();
};
AttributeEditor.prototype.onAdd=function(){
for(var i=0;i<this.attributeEnties.length;i++){
if(typeof (this.attributeEnties[i].valueBox.value)!="undefined"&&this.attributeEnties[i].valueBox.value!=null&&(this.attributeEnties[i].value!=this.attributeEnties[i].valueBox.value)){
this.editObject.setAttribute(this.attributeEnties[i].name,this.attributeEnties[i].valueBox.value);
this.attributeEnties[i].value=this.attributeEnties[i].valueBox.value;
}
}
if(this.editObject.type=="line"||this.editObject.type=="poly"){
this.editObject.layer.updateCanvas();
}
};
AttributeEditor.prototype.unload=function(){
Evt.removeEventListener(this.closeBox,"click",this.editCloseDelegate);
Evt.removeEventListener(this.addButton,"click",this.addDelegate);
};
function AttributeEntry(_47,_48,_49,_4a,_4b){
this.parent=_47;
this.name=_49;
if(typeof (_4a)=="undefined"||_4a==null){
this.value="";
}else{
this.value=_4a;
}
this.container=document.createElement("div");
addClass(this.container,"RWCAttributeEditorItem");
this.nameBox=document.createElement("span");
addClass(this.nameBox,"RWCAttributeNameSpan");
this.valueBox=document.createElement("input");
addClass(this.valueBox,"RWCAttributeSpan");
this.container.appendChild(this.nameBox);
this.container.appendChild(this.valueBox);
this.nameBox.innerHTML=this.name;
this.valueBox.value=this.value;
_48.appendChild(this.container);
}
AttributeEntry.prototype.setValue=function(_4c){
this.value=_4c;
this.valueBox.value=this.value;
};
AttributeEntry.prototype.onRemove=function(){
this.unload();
this.parent.removeAttribute(this.name);
};
AttributeEntry.prototype.unload=function(){
this.container.parentNode.removeChild(this.container);
};
function ActionMenu(_4d,_4e,_4f,_50){
this.parent=_4d;
this.pixelPosition=_4f;
this.container=document.createElement("div");
addClass(this.container,"rwcActionMenu");
_4e.appendChild(this.container);
setX(this.container,_4f.x);
setY(this.container,_4f.y);
this.actionList=new Array();
for(var i=0;i<_50.length;i++){
this.actionList.push(new ActionMenuObject(this,_50[i]));
}
}
ActionMenu.prototype.onClick=function(_52){
this.parent.performAction(_52);
};
ActionMenu.prototype.unload=function(){
for(var i=0;i<this.actionList.length;i++){
this.actionList[i].unload();
}
this.container.parentNode.removeChild(this.container);
};
function ActionMenuObject(_54,_55){
this.parent=_54;
this.value=_55;
this.container=document.createElement("div");
this.container.innerHTML=_55;
addClass(this.container,"rwcActionMenuObject");
this.parent.container.appendChild(this.container);
this.clickDelegate=associateObjWithEvent(this,"onClick");
Evt.addEventListener(this.container,"click",this.clickDelegate);
}
ActionMenuObject.prototype.onClick=function(){
this.parent.onClick(this.value);
};
ActionMenuObject.prototype.unload=function(){
Evt.removeEventListener(this.container,"click",this.clickDelegate);
};
function RWCGetUniqueId(_56,_57){
if(!_56){
return _57+0+"u"+Math.random().toPrecision(4);
}
found=true;
count=0;
while(found){
var _58=_57+_56.length+count++ +"u"+Math.random().toPrecision(4);
found=false;
for(var i=0;i<_56.length;i++){
if(_56[i].id==_58){
found=true;
}
}
}
return _58;
}

