// 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;
this.minimizeElement=document.createElement("img");
if(this.layer.configuration.route.drivingDirections.collapseImage&&this.layer.configuration.route.drivingDirections.collapseImage.image!=""){
this.minimizeElement.className="rwcMinimizeElement";
this.layer.configuration.route.drivingDirections.collapseImage.applyConfiguration(this.minimizeElement);
_5.appendChild(this.minimizeElement);
}
this.container.appendChild(_5);
this.clickDelegate=associateObjWithEvent(this,"headerClicked");
Evt.addEventListener(this.minimizeElement,"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(_7){
if(_7.type!="point"){
return;
}
if(_7.getAttribute("infostring")==null){
return;
}
if(!this.directionItems){
this.directionItems=new Array();
}
this.directionItems.push(new DrivingDirectionsItem(_7,this.itemContainer,this.layer.configuration.route.drivingDirections.images,this.saMap));
};
DrivingDirectionsControl.prototype.finalize=function(_8){
if(!this.directionItems){
return;
}
var _9=this.layer.configuration.route.drivingDirections.evenItemCSS;
var _a=this.layer.configuration.route.drivingDirections.oddItemCSS;
if(_8){
for(var i=this.directionItems.length-1;i>=0;i--){
this.directionItems[i].finalize(this.itemContainer,i%2==0?_9:_a);
}
}else{
for(var i=0;i<this.directionItems.length;i++){
this.directionItems[i].finalize(this.itemContainer,i%2==0?_9:_a);
}
}
};
DrivingDirectionsControl.prototype.reset=function(){
if(!this.directionItems){
return;
}
if(this.directionItems){
for(var i=0;i<this.directionItems.length;i++){
this.directionItems[i].unload();
}
}
destroyNode(this.itemContainer);
this.itemContainer=null;
this.itemContainer=document.createElement("div");
this.itemContainer.id="rwcDrivingDirectionBody";
this.container.appendChild(this.itemContainer);
this.directionItems=null;
};
DrivingDirectionsControl.prototype.show=function(_d){
if(!this.expanded&&_d){
this.container.style.display="block";
this.expanded=true;
}else{
if(this.expanded&&!_d){
this.container.style.display="none";
this.expanded=false;
}
}
};
DrivingDirectionsControl.prototype.headerClicked=function(_e,_f){
if(this.expanded){
this.show(false);
}
};
DrivingDirectionsControl.prototype.unload=function(){
if(this.clickDelegate){
Evt.removeEventListener(this.minimizeElement,"click",this.clickDelegate);
}
for(var i=0;i<this.directionItems.length;i++){
this.directionItems[i].unload();
}
};
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(typeof (_f[i])=="object"&&_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(){
var _15=false;
for(var i=0;i<this.objectParameters.length;i++){
if(typeof (this.objectAttributes[i])!="undefined"){
var _17=this.objectAttributes[i];
var _18=this.attributes[_17].value;
}else{
if(this.objectParameters[i].value&&this.objectParameters[i].value!=null){
var _18=this.objectParameters[i].value;
}else{
_18=null;
}
}
switch(this.objectParameters[i].type){
case ("id"):
if(_18&&_18!=""){
this.id=_18;
this.noId=false;
}
break;
case ("priority"):
if(_18){
try{
this.priority=parseInt(_18);
}
catch(e){
this.priority=0;
}
break;
}
case ("defaultImage"):
if(!_15){
this.imageConfig=this.objectParameters[i];
this.icon=this.objectParameters[i].image.clone();
if(_18&&_18!=""){
var _19=_18.split(",");
this.icon.image=_19[0];
if(_19.length>1){
if(!this.selectedIcon){
this.selectedIcon=new Object();
}
this.selectedIcon.image=_19[1];
}else{
this.selectedIcon=null;
}
}else{
if(this.objectParameters[i].selectedImage){
this.selectedIcon=this.objectParameters[i].selectedImage.clone();
}
}
}
break;
case ("conditionalImage"):
var _1a=this.objectParameters[i].value.split(",");
if(_1a.length!=2){
break;
}
for(var j=0;j<this.attributes.length;j++){
if(_1a[0]==this.attributes[j].name&&_1a[1]==this.attributes[j].value){
_15=true;
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 _1c=this.type=="point"||this.type=="multipoint";
if(this.layer.configuration.defaultCombinedImage&&this.layer.configuration.defaultCombinedImage.parts.length>0&&_1c){
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 _18=this.attributes[this.shapeAttributes[j]].value;
}else{
var _18=this.shapeParameters[j].value;
}
switch(this.shapeParameters[j].type){
case ("style"):
this.style=_18;
break;
case ("transparency"):
try{
this.transparency=parseFloat(_18);
}
catch(e){
}
break;
case ("color"):
this.color=_18;
break;
case ("lineWidth"):
try{
this.lineWidth=parseInt(_18);
}
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 _1f=10;
if(this.icon){
_1f=parseInt(this.icon.width)/2;
}
if(isNaN(_1f)){
_1f=10;
}
this.boundingArea=new BoundingArea(this.point,this.points,this.type,this.saMap,_1f);
this.point=this.boundingArea.centerpoint;
}
};
GeoObject.prototype.setSelected=function(){
this.outLine();
};
GeoObject.prototype.cancelSelection=function(){
this.cancelOutLine();
};
GeoObject.prototype.createAttributeLookupTable=function(_20,_21){
if(!_20){
return;
}
var _22=new Array();
var n1=_20.length;
if(_21){
var n2=_21.length;
}else{
var n2=0;
}
for(var i=0;i<n1;i++){
var _26=false;
for(var j=0;j<n2;j++){
if(_21[j].name==_20[i].name){
_22[i]=j;
}else{
var n3=_20[i].alternates.length;
for(var k=0;k<n3;k++){
if(_21[j].name==_20[i].alternates[k]){
_22[i]=j;
_26=true;
break;
}
}
}
}
}
return _22;
};
GeoObject.prototype.clonePosition=function(_2a){
this.point.x=_2a.point.x;
this.point.y=_2a.point.y;
if(this.points){
this.points=new Array();
if(this.type=="line"||this.type=="poly"){
for(var i=0;i<_2a.points.length;i++){
this.points[i]=this.saMap.point(_2a.points[i].x,_2a.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 _2e=this.saMap.tileSize/this.saMap.tileGeoWidth;
this.viewX=this.mapCenterGeoOffsetX*_2e+this.saMap.totalOffsetX+this.saMap.mapWidth/2;
this.viewY=this.saMap.mapHeight-(this.mapCenterGeoOffsetY*_2e-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]*_2e+this.saMap.totalOffsetX+this.saMap.mapWidth/2;
this.viewYList[i]=this.saMap.mapHeight-(this.mapCenterGeoOffsetListY[i]*_2e-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(_31,_32){
if(this.hideObjectInfoTimer){
this.cancelInfoBox();
}
this.viewX+=_31;
this.viewY+=_32;
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]+=_31;
this.viewYList[i]+=_32;
setX(this.clientNodes[i],this.viewXList[i]-this.iconOffsetX/2);
setY(this.clientNodes[i],this.viewYList[i]-this.iconOffsetY/2);
}
}
};
GeoObject.prototype.draw=function(_34,_35,_36,_37){
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 _38=new Array();
if(this.type=="point"){
destroyNode(this.clientNode);
this.clientNode=document.createElement("div");
this.clientNode.className="rwcMarker";
_38.push(this.clientNode);
n=1;
}else{
if(this.type=="multipoint"){
if(this.clientNodes){
for(var i=0;i<this.clientNodes.length;i++){
destroyNode(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;
_38=this.clientNodes;
}
}
for(var i=0;i<n;i++){
if(this.icon){
_38[i].id=this.id;
_38[i].image=document.createElement("img");
_38[i].appendChild(_38[i].image);
this.icon.applyConfiguration(_38[i].image);
this.setIconOffset(this.icon);
}else{
if(this.defaultCombinedImages){
this.defaultCombinedImages[i].destroy();
this.defaultCombinedImages[i].applyConfiguration(_38[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||_36)&&!this.saMap.zoomActive){
setVisible(_38[i],true);
}else{
setVisible(_38[i],false);
}
_35.appendChild(_38[i]);
}
}else{
if(!(this.isHidden||_36)){
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 _3a=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 m=drawPoints.length;
for(var j=0;j<m;j++){
if(_3c!=""){
_3c+=",";
}
var _3f=this.saMap.mapToScreenCoordinates(drawPoints[j].x,drawPoints[j].y);
_3c+=Math.round(_3f.x)+","+Math.round(_3f.y);
}
}
var _40=" opacity=\""+Math.round(this.transparency*100)+"%\"";
var _41=" strokecolor=\""+this.color+"\"";
var _42="<v:stroke joinstyle=\"round\" weight=\""+this.lineWidth+"\"  endcap=\"round\" "+_40+"/>";
if(this.layer.tempCanvas){
this.layer.tempCanvas.innerHTML+="<v:polyline filled=\"false\" "+_41+" points=\""+_3c+"\" >"+_42+"</v:polyline>";
}else{
this.layer.objectCanvas.innerHTML+="<v:polyline filled=\"false\" "+_41+" points=\""+_3c+"\" >"+_42+"</v:polyline>";
}
}
}else{
if(this.type=="poly"||this.type=="multipolygon"){
var _43=" style=\"position:absolute;top:0;left:0;width:"+this.saMap.mapWidth+"px;height:"+this.saMap.mapHeight+"px\"";
var _40=" opacity=\""+Math.round(this.transparency*100)+"%\"";
var _44=" coordsize="+this.saMap.mapWidth+","+this.saMap.mapHeight;
var _45="<v:fill "+_40+" type=\"solid\" color=\""+this.color+"\"></v:fill>";
if(this.lineWidth>0){
var _42="<v:stroke weight=\""+this.lineWidth+"\"  endcap=\"round\" />";
var _46=" stroked=\"true\"";
}else{
var _42="";
var _46=" stroked=\"false\"";
}
var _41=" 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 _47=this.points;
}else{
if(this.type=="multipolygon"){
var _47=this.points[i];
}
}
if(_47.length>1){
var _48=this.saMap.mapToScreenCoordinates(_47[0].x,_47[0].y);
var _49="m "+Math.round(_48.x)+","+Math.round(_48.y)+" l ";
var o=_47.length;
for(var j=1;j<o;j++){
var _48=this.saMap.mapToScreenCoordinates(_47[j].x,_47[j].y);
_49+=Math.round(_48.x)+","+Math.round(_48.y);
if(j<_47.length-1){
_49+=", ";
}else{
_49+=" x e";
}
}
if(this.layer.tempCanvas){
this.layer.tempCanvas.innerHTML+="<v:shape"+_43+_41+_46+" coordorigin=\"0 0\" "+_44+" \" path=\""+_49+"\">"+_42+_45+"</v:shape>";
}else{
this.layer.objectCanvas.innerHTML+="<v:shape"+_43+_41+_46+" coordorigin=\"0 0\" "+_44+" \" path=\""+_49+"\">"+_42+_45+"</v:shape>";
}
}
}
}
}
};
GeoObject.prototype.drawUsingCanvas=function(){
var _4b=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 _4e=this.points[i];
}else{
var _4e=this.points;
}
ctx.globalAlpha=1;
ctx.beginPath();
ctx.lineWidth=this.lineWidth;
ctx.lineCap="round";
ctx.lineJoin="round";
if(this.type=="line"){
var _4f=this.saMap.screenBounds.lineInside(_4e,false);
if(_4f==-1){
this.updateScreenPosition();
return;
}
var _50=this.saMap.screenBounds.lineInside(_4e,true);
}else{
_4f=0;
_50=_4e.length-1;
}
var _51=this.saMap.mapToScreenCoordinates(_4e[_4f].x,_4e[_4f].y);
ctx.moveTo(_51.x,_51.y);
var o=_50+1;
for(var j=_4f;j<o;j++){
var _51=this.saMap.mapToScreenCoordinates(_4e[j].x,_4e[j].y);
ctx.lineTo(_51.x,_51.y);
if(this.type=="line"||this.type=="multiline"){
var _54=_4e[j];
while(j<(o-2)){
var _55=distance2D(_54,_4e[j+1])*_4b;
if(_55<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 _51=this.saMap.mapToScreenCoordinates(_4e[0].x,_4e[0].y);
ctx.moveTo(_51.x,_51.y);
for(var j=1;j<_4e.length;j++){
var _51=this.saMap.mapToScreenCoordinates(_4e[j].x,_4e[j].y);
ctx.lineTo(_51.x,_51.y);
}
ctx.closePath();
}
ctx.fill();
}
}
}
};
GeoObject.prototype.setVisible=function(_56){
this.isHidden=!_56;
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(_5a){
if(_5a.height){
this.iconOffsetY=parseInt(_5a.height);
}else{
this.iconOffsetY=0;
}
if(_5a.width){
this.iconOffsetX=parseInt(_5a.width);
}else{
this.iconOffsetX=25;
}
if(_5a.height){
this.iconOffsetY=parseInt(_5a.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 _5b=1;
var _5c=1;
if(this.icon&&this.icon.width){
if(this.selectedIcon&&this.selectedIcon.width){
if(!this.isSelected){
_5b=Math.abs(parseInt(this.icon.width)-parseInt(this.selectedIcon.width))/2;
}
var _5d=Math.max(parseInt(this.icon.width)+2,parseInt(this.selectedIcon.width)+2);
}else{
var _5d=parseInt(this.icon.width)+2;
}
}else{
var _5d=5;
}
if(this.icon&&this.icon.height){
if(this.selectedIcon&&this.selectedIcon.height){
if(!this.isSelected){
_5c=Math.abs(parseInt(this.icon.height)-parseInt(this.selectedIcon.height))/2;
}
var _5e=Math.max(parseInt(this.icon.height)+2,parseInt(this.selectedIcon.height)+2);
}else{
var _5e=parseInt(this.icon.height)+2;
}
}else{
var _5e=5;
}
setX(this.outLineArea,getX(this.clientNode)-_5b-1);
setY(this.outLineArea,getY(this.clientNode)-_5c-1);
}else{
var _5f=this.saMap.mapToScreenCoordinates(this.boundingArea.minX,this.boundingArea.maxY);
var _60=this.saMap.mapToScreenCoordinates(this.boundingArea.maxX,this.boundingArea.minY);
setX(this.outLineArea,Math.round(_5f.x));
setY(this.outLineArea,Math.round(_5f.y));
var _5d=Math.abs(Math.round(_60.x-_5f.x));
if(_5d<2){
_5d=2;
}
var _5e=Math.abs(Math.round(_5f.y-_60.y));
if(_5e<2){
_5e=2;
}
}
setWidth(this.outLineArea,_5d);
setHeight(this.outLineArea,_5e);
};
GeoObject.prototype.cancelOutLine=function(){
destroyNode(this.outLineArea);
this.outLineArea=null;
};
GeoObject.prototype.displayInfoBox=function(_61){
this.infoBoxTimeout=_61;
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)&&_61>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 _62;
var _63;
if(!this.defaultCombinedImages){
var _64=new GeoRectangle(0,0,0,0);
}else{
_64=this.boundingArea.getBounds();
}
if(this.clientNode){
if(!this.defaultCombinedImages){
if(this.clientNode.offsetWidth!=0){
_64=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){
_64=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){
_64=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){
_64=new GeoRectangle(this.iconOffsetX/2,this.iconOffsetY/2,-this.iconOffsetX/2,-this.iconOffsetY/2);
}
}
}
}
}
}
var _65=1/this.saMap.getPixelsToViewUnits();
if(this.defaultCombinedImages){
var _66=_64.xMax*_65;
var _67=_64.yMax*_65;
var _68=_64.xMin*_65;
var _69=_64.yMin*_65;
}else{
var _66=_64.xMax;
var _67=_64.yMax;
var _68=_64.xMin;
var _69=_64.yMin;
}
if(this.infoBoxPositioning=="centered"){
if(((this.viewX+_66+this.infoBox.offsetWidth+this.infoBoxMargin)>(this.saMap.mapWidth)-5)){
var _6a=false;
_62=this.viewX-_68-this.infoBoxMargin-this.infoBox.offsetWidth+cumulativeOffsetLeft(this.saMap.mapContainer);
}else{
var _6a=true;
_62=this.viewX-_66+this.infoBoxMargin+cumulativeOffsetLeft(this.saMap.mapContainer);
}
}else{
if(this.infoBoxPositioning=="alwaysAbove"){
_62=this.viewX+_68+this.infoBoxMargin+cumulativeOffsetLeft(this.saMap.mapContainer);
}else{
if(((this.viewX+_66+this.infoBox.offsetWidth+this.infoBoxMargin)>(this.saMap.mapWidth)-5)&&this.infoBoxPositioning=="normal"){
_62=this.viewX+_68-this.infoBoxMargin-this.infoBox.offsetWidth+cumulativeOffsetLeft(this.saMap.mapContainer);
}else{
_62=this.viewX+_66+this.infoBoxMargin+cumulativeOffsetLeft(this.saMap.mapContainer);
}
}
}
if(this.infoBoxPositioning=="centered"){
if(((this.viewY-_67-this.infoBox.offsetHeight-this.infoBoxMargin)>5)){
_63=this.viewY+_69-this.infoBoxMargin-this.infoBox.offsetHeight+cumulativeOffsetTop(this.saMap.mapContainer);
if(_6a){
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{
_63=this.viewY+_67+this.infoBoxMargin+cumulativeOffsetTop(this.saMap.mapContainer);
if(_6a){
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){
_63+=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+_67+this.infoBox.offsetHeight+this.infoBoxMargin)>(this.saMap.mapHeight)-5)||this.infoBoxPositioning=="alwaysAbove"){
_63=this.viewY+_69-this.infoBoxMargin-this.infoBox.offsetHeight+cumulativeOffsetTop(this.saMap.mapContainer);
}else{
_63=this.viewY+_67+this.infoBoxMargin+cumulativeOffsetTop(this.saMap.mapContainer);
}
}
if(this.infoBoxPositioning=="alwaysAbove"){
if(isFireFox||isMozilla){
_62-=document.body.scrollLeft;
}
setX(this.infoBox,_62);
this.infoBox.style.top="auto";
if(isIe6||isIe7){
if(isIe6){
_63=(document.body.offsetHeight-_69-this.infoBoxMargin-this.viewY-cumulativeOffsetTop(this.saMap.mapContainer))+document.body.scrollTop;
}else{
if(isIe7){
_63=(document.body.offsetHeight-_69-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=_63+"px";
}else{
if(isFireFox||isMozilla){
this.infoBox.style.bottom=(document.body.offsetHeight-_69-this.infoBoxMargin-this.viewY-cumulativeOffsetTop(this.saMap.mapContainer))+document.body.scrollTop+"px";
}else{
this.infoBox.style.bottom=(document.body.offsetHeight-_69-this.infoBoxMargin-this.viewY-cumulativeOffsetTop(this.saMap.mapContainer))+"px";
}
}
}else{
if(this.type!="point"){
if(_62<cumulativeOffsetLeft(this.saMap.mapContainer)){
_62=cumulativeOffsetLeft(this.saMap.mapContainer);
}else{
if(_62>(cumulativeOffsetLeft(this.saMap.mapContainer)+this.saMap.mapWidth)){
_62=cumulativeOffsetLeft(this.saMap.mapContainer)+this.saMap.mapWidth;
}
}
if(_63<cumulativeOffsetTop(this.saMap.mapContainer)){
_63=cumulativeOffsetTop(this.saMap.mapContainer);
}else{
if(_63>(cumulativeOffsetTop(this.saMap.mapContainer)+this.saMap.mapHeight)){
_63=cumulativeOffsetTop(this.saMap.mapContainer)+this.saMap.mapHeight;
}
}
}
setX(this.infoBox,_62);
setY(this.infoBox,_63);
}
}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,_71){
this.hideObjectInfoTimer=null;
this.cancelInfoBox();
};
GeoObject.prototype.createInfo=function(_72){
var _73=document.createElement("div");
_73.id="content"+this.id;
addClass(_73,this.infoBoxElement.css);
_73.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 _75=this.attributes[this.infoBoxAttributes[i]].value;
}else{
var _75=this.infoBoxParameters[i].value;
}
if(_75&&_75!=""){
if(this.infoBoxParameters[i].type=="string"){
this.hasInfoBoxContent=true;
var _76=document.createElement("div");
_76.className="rwcInfoBoxText";
_73.appendChild(_76);
if(this.infoBoxAttributes[i]&&this.attributes[this.infoBoxAttributes[i]].label){
var _77=this.attributes[this.infoBoxAttributes[i]].label+_75;
}else{
if(this.infoBoxParameters[i].label){
var _77=this.infoBoxParameters[i].label+_75;
}else{
var _77=_75;
}
}
_76.innerHTML=_77;
}else{
if(this.infoBoxParameters[i].type=="image"){
this.hasInfoBoxContent=true;
var _76=document.createElement("img");
_76.className="rwcInfoBoxImage";
_73.appendChild(_76);
setImageSource(_76,_75);
var _78=document.createElement("br");
_73.appendChild(_78);
}else{
if(this.infoBoxParameters[i].type=="url"){
this.hasInfoBoxContent=true;
var _76=document.createElement("a");
_73.appendChild(_76);
_76.className="rwcInfoBoxAnchor";
_76.target="_blank";
_76.href=_75;
if(this.infoBoxAttributes[i]&&this.attributes[this.infoBoxAttributes[i]].label){
_76.innerHTML=this.attributes[this.infoBoxAttributes[i]].label;
}else{
if(this.infoBoxParameters[i].label){
_76.innerHTML=this.infoBoxParameters[i].label;
}
}
var _78=document.createElement("br");
_73.appendChild(_78);
}
}
}
}
}
}
return _73;
};
GeoObject.prototype.onInfoBoxMouseOver=function(evt,_7a){
clearTimeout(this.hideObjectInfoTimer);
this.hideObjectInfoTimer=null;
this.useSelectedIcon();
this.infoBoxSelected=true;
};
GeoObject.prototype.onInfoBoxMouseOut=function(evt,_7c){
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);
destroyNode(this.infoBox);
}
this.infoBox=null;
this.infoBoxSelected=false;
this.hasInfoBox=false;
};
GeoObject.prototype.setImage=function(_7d,_7e,_7f,_80){
if(!this.icon){
this.icon=new ImageConfiguration();
}
this.icon.image=_7d;
this.icon.tooltip=_80;
if(_7e){
this.icon.width=_7e+"px";
}
if(_7f){
this.icon.height=_7f+"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(_82,_83,_84,_85){
if(!_82){
this.selectedIcon=null;
return;
}
if(!this.selectedIcon){
this.selectedIcon=new ImageConfiguration();
}
this.selectedIcon.image=_82;
this.selectedIcon.tooltip=_85;
if(_83){
this.selectedIcon.width=_83+"px";
}else{
this.selectedIcon.width=this.icon.width;
}
if(_84){
this.selectedIcon.height=_84+"px";
}else{
this.selectedIcon.height=this.icon.height;
}
};
GeoObject.prototype.setPosition=function(x,y,_88){
if(this.type=="poly"||this.type=="line"||this.type=="multipoint"||this.type=="multiline"||this.type=="multipolygon"){
if(_88){
this.points=_88;
}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(_8a){
for(var i=0;i<this.attributes.length;i++){
if(this.attributes[i].name==_8a){
return this.attributes[i].value;
}
}
return null;
};
GeoObject.prototype.setAttribute=function(_8c,_8d,_8e){
var _8f=new Object();
_8f.name=_8c;
_8f.value=_8d;
_8f.label=_8e;
for(var i=0;i<this.attributes.length;i++){
if(this.attributes[i].name==_8f.name){
this.attributes[i].value=_8f.value;
this.attributes[i].label=_8f.label;
this.updateIcons();
return;
}
}
this.attributes.push(_8f);
for(var i=0;i<this.objectParameters.length;i++){
if(this.objectParameters[i].name==_8c){
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]==_8c){
this.objectAttributes[i]=this.attributes.length-1;
break;
}
}
}
}
}
if(this.infoBoxParameters){
for(var i=0;i<this.infoBoxParameters.length;i++){
if(this.infoBoxParameters[i].name==_8c){
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]==_8c){
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]==_8c){
this.searchAttributes[i]=_8d.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(_95,_96,_97,_98,_99){
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=_97;
this.saMap=_98;
this.padding=_99;
if(isNaN(this.padding)){
this.padding=10;
}
if((this.type=="line"||this.type=="poly")&&_96){
this.points=_96;
for(var i=0;i<_96.length;i++){
if(_96[i].x>this.maxX){
this.maxX=_96[i].x;
}
if(_96[i].x<this.minX){
this.minX=_96[i].x;
}
if(_96[i].y>this.maxY){
this.maxY=_96[i].y;
}
if(_96[i].y<this.minY){
this.minY=_96[i].y;
}
}
}else{
if(this.type=="point"){
this.maxX=_95.x;
this.maxY=_95.y;
this.minX=_95.x;
this.minY=_95.y;
this.centerpoint=_95;
}else{
if(this.type=="multipoint"||this.type=="multiline"||this.type=="multipolygon"){
this.children=new Array();
if(this.type=="multipoint"){
for(var i=0;i<_96.length;i++){
this.children[i]=new BoundingArea(_96[i],null,"point",this.saMap,_99);
}
}else{
if(this.type=="multiline"){
for(var i=0;i<_96.length;i++){
this.children[i]=new BoundingArea(null,_96[i],"line",this.saMap,_99);
}
}else{
if(this.type=="multipolygon"){
for(var i=0;i<_96.length;i++){
this.children[i]=new BoundingArea(null,_96[i],"poly",this.saMap,_99);
}
}
}
}
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 _9d=this.padding*this.saMap.tileGeoWidth/this.saMap.tileSize;
if((x>=this.minX-_9d&&x<=this.maxX+_9d)&&(y>=this.minY-_9d&&y<=this.maxY+_9d)){
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(_9f,_a0){
if(_9f&&_9f.length>1){
if(_a0){
for(var i=_9f.length-1;i>0;i--){
var _a2=this.lineTest(_9f[i].x,_9f[i].y,_9f[i-1].x,_9f[i-1].y);
if(_a2){
return i;
}
}
}else{
for(var i=0;i<_9f.length-1;i++){
var _a2=this.lineTest(_9f[i].x,_9f[i].y,_9f[i+1].x,_9f[i+1].y);
if(_a2){
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(_a9){
var cx=_a9.maxX-this.maxX;
if(cx>0){
if(_a9.minX>this.maxX){
return false;
}
}else{
if(this.minX>_a9.maxX){
return false;
}
}
var cy=_a9.maxY-this.maxY;
if(cy>0){
if(_a9.minY>this.maxY){
return false;
}
}else{
if(this.minY>_a9.maxY){
return false;
}
}
return true;
};
BoundingArea.prototype.edgeTest=function(x,y){
if(this.points){
var _ae=this.saMap.point(x,y);
if(this.type=="line"){
var _af=pointToLineDistance2D(_ae,this.points);
viewUnitsToPixels=this.saMap.tileSize/this.saMap.tileGeoWidth;
_af=_af.distance*viewUnitsToPixels;
if(_af<3){
return true;
}else{
return false;
}
}else{
return pointInPolygon2D(_ae,this.points);
}
}
};
function DynamicBoundingArea(_b0,_b1,_b2){
this.point=_b0;
this.combinedImage=_b1;
this.saMap=_b2;
}
DynamicBoundingArea.prototype.inside=function(x,y){
if(!this.imageBounds){
var _b5=this.combinedImage.bounds(this.saMap);
if(_b5.complete){
this.imageBounds=_b5;
}
}
if(this.imageBounds){
var _b6=this.point.x+this.imageBounds.xMin;
var _b7=this.point.y-this.imageBounds.yMin;
var _b8=this.point.x+this.imageBounds.xMax;
var _b9=this.point.y-this.imageBounds.yMax;
if(x>=_b6&&x<=_b8&&y<=_b7&&y>=_b9){
return this.combinedImage.inside(x-this.point.x,this.point.y-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));
if(typeof (this.saMap.viewJSON.ViewInfo.TileOrigin)!="undefined"){
this.layerOffsetX+=(_13)/2;
this.layerOffsetY+=(_13)/2;
}
}
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;
}
destroyNode(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++;
}
}
if(this.isNonTileLayer){
this.tiles[0].node.src="pic/blank.gif";
}
};
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="";
}
var _5d="";
if((this.imageFormat=="gif"||(this.imageFormat=="png"&&!isIe6))&&this.layerNr!=0){
_5d="&transparent=true";
}else{
_5d="&transparent=false";
}
if(this.saMap.config.viewSettings.mapTileService&&this.saMap.config.viewSettings.mapTileService!=""){
var _5e=this.saMap.config.viewSettings.mapTileService;
}else{
var _5e=this.saMap.mapServerUrl;
}
if(!this.saMap.config.viewSettings.useRWCMapRequests){
var _5f="&format=image/jpeg";
if(this.imageFormat!=""&&this.imageFormat!="jpg"){
_5f="&format=image/"+this.imageFormat;
}
if(this.saMap.fixedScales){
var _60=(this.saMap.tileGeoWidth*this.saMap.geoWidthToScale)-2;
}else{
var _60=this.tileGeoWidth;
}
if(isNaN(this.tileSize)||this.tileSize<=0||this.tileSize>Number.MAX_VALUE||isNaN(_60)||(_60)<Number.MIN_VALUE||(_60)>Number.MAX_VALUE){
return "";
}
if(map.bgColor){
var _61="&bgColor="+map.bgColor;
}else{
var _61="";
}
this.mapRequestString=_5e+"OGCWMSInterface.axd?view="+this.saMap.viewName+"&version=1.1.1&request=GetMap&Styles="+_5f+_5d+_5c+"&width="+this.tileSize+"&height="+this.tileSize+"&SRS="+this.saMap.SRS+_61;
}else{
if(this.imageFormat!=""){
_5f="&format="+this.imageFormat;
}
var _62;
if(this.saMap.fixedScales){
var _60=(this.saMap.tileGeoWidth*this.saMap.geoWidthToScale)-2;
_62="&scale="+_60;
}else{
var _60=this.tileGeoWidth;
_62="&geowidth="+_60;
}
if(isNaN(this.tileSize)||this.tileSize<=0||this.tileSize>Number.MAX_VALUE||isNaN(_60)||(_60)<Number.MIN_VALUE||(_60)>Number.MAX_VALUE){
return "";
}
this.mapRequestString=_5e+"RWCInterface.axd?view="+this.saMap.viewName+_5f+_5d+_5c+"&width="+this.tileSize+"&height="+this.tileSize+_62;
}
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(_63){
if(this.mapRequestString==""||this.isHidden){
if(_63.node.src!="pic/blank.gif"&&(!this.isHidden||_63.node.src!="")){
_63.node.src="pic/blank.gif";
}
return;
}
var _64=this.tileGeoWidth/this.tileSize;
var x=this.saMap.initialGeoCenterX+this.tileGeoWidth*(_63.col-(Math.ceil(this.nCols/2)-1));
var y=this.saMap.initialGeoCenterY+this.tileGeoWidth*(-_63.row+(Math.ceil(this.nRows/2)-1));
if(typeof (this.saMap.viewJSON.ViewInfo.TileOrigin)!="undefined"){
x+=this.tileGeoWidth/2;
y-=this.tileGeoWidth/2;
}
if(this.isNonTileLayer){
this.newOffsetX=this.layerOffsetX-this.saMap.totalOffsetX;
this.newOffsetY=this.layerOffsetY-this.saMap.totalOffsetY;
x=this.saMap.initialGeoCenterX-_64*this.saMap.totalOffsetX;
y=this.saMap.initialGeoCenterY+_64*this.saMap.totalOffsetY;
}
bboxString="&bbox="+(x-this.tileGeoWidth/2)+","+(y-this.tileGeoWidth/2)+","+(x+this.tileGeoWidth/2)+","+(y+this.tileGeoWidth/2);
geoCenterString="&x="+x+"&y="+y;
var _67="";
if(this.haveClientObjects){
var _68=Math.floor((this.saMap.config.viewSettings.requestMaxLength-this.mapRequestString.length-geoCenterString.length)/8);
var _69=new Array();
var _6a=new RWCPoint(x-this.tileGeoWidth/2,y+this.tileGeoWidth/2);
var _6b=new RWCPoint(x+this.tileGeoWidth/2,y-this.tileGeoWidth/2);
_69.push(_6a);
_69.push(_6b);
var _6c=new BoundingArea(null,_69,"line",this.saMap,0);
_67=this.saMap.encodeClientObjects(this.geoObjectLayer.geoObjectArray,_6c,_68);
}
var url="";
if(!this.saMap.config.viewSettings.useRWCMapRequests){
url=this.mapRequestString+bboxString;
}else{
url=this.mapRequestString+geoCenterString+_67;
}
_63.refreshImage(url);
var _6e=new RWCPoint();
_6e.x=x;
_6e.y=y;
_63.setGeoCenter(_6e);
};
Layer.prototype.getVisibleLayersID=function(){
var _6f="";
var _70=0;
for(var i=0;i<this.sublayerID.length;i++){
if(!this.sublayerID[i].isHidden){
if(_6f!=""){
_6f+=",";
}
_6f+=this.sublayerID[i].id;
_70++;
}
}
if(_70==0){
return null;
}else{
return _6f;
}
};
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();
}
}
destroyNode(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);
destroyNode(this.container);
this.container=null;
}
catch(e){
}
};
Layer.prototype.getType=function(){
return "ServerLayer";
};
Layer.prototype.addAttribute=function(_7d,_7e){
if(!this.customAttributes){
this.customAttributes=new Object();
}
this.customAttributes[_7d]=_7e;
};
Layer.prototype.removeAttribute=function(_7f){
if(this.customAttributes){
this.customAttributes[_7f]=null;
}
};
function OverlayLayer(id,_81,_82,_83,_84,_85,_86,_87){
this.id=id;
if(!this.id){
this.id="-1";
}
var _88=new LayerIdObject(id);
this.name=_81;
this.type="objects";
this.useLayerControl=_85;
this.layerNr=_82;
this.saMap=_83;
this.searchEnabled=_84;
if(typeof (_87)!="undefined"&&_87!=null){
this.objectType==_87.toLowerCase();
}else{
this.objectType="objects";
}
}
OverlayLayer.prototype.createDefaults=function(_89,_8a){
this.configuration=new Object();
this.configuration.route=new Object();
this.configuration.route=_89.route;
this.configuration.search=new Object();
this.configuration.downloadBehavior=_89.downloadBehavior;
this.configuration.search.zoomToResults=_89.search.zoomToResults;
this.configuration.searchControl=_89.search.searchControl;
this.configuration.search.searchResults=_89.search.searchResults;
this.configuration.properties=this.buildParameterList(_89.geoObjects.parameters,_8a);
this.configuration.defaultCombinedImage=_89.geoObjects.defaultCombinedImage;
if(_89.infoBox){
this.configuration.infoBox=_89.infoBox.clone();
this.configuration.infoBox.parameters=this.buildParameterList(_89.infoBox.parameters,_8a);
this.configuration.infoBox.positioning=_89.infoBox.positioning;
this.configuration.infoBox.margin=_89.infoBox.margin;
}
if(_89.shapes){
if(_89.shapes.polygons){
this.configuration.polygons=new Object();
this.configuration.polygons.parameters=this.buildParameterList(_89.shapes.polygons.parameters,_8a);
this.configuration.polygons.conditions=_89.shapes.polygons.conditions;
}
if(_89.shapes.lines){
this.configuration.lines=new Object();
this.configuration.lines.parameters=this.buildParameterList(_89.shapes.lines.parameters,_8a);
this.configuration.lines.conditions=_89.shapes.lines.conditions;
}
}
if(this.searchEnabled){
this.configuration.search.properties=this.buildParameterList(_89.search.searchResults.parameters,_8a);
this.configuration.search.controlGroups=_89.search.searchParameters.controlGroups;
if(this.configuration.searchControl.active){
switch(this.configuration.searchControl.mode){
case ("docked"):
setVisible(this.saMap.dockingArea,true);
var _8b=this.saMap.dockingArea;
break;
case ("overlay"):
var _8b=this.saMap.embedDiv;
break;
case ("standalone"):
var _8b=document.body;
break;
}
this.maxCount=_89.downloadBehavior.maxCount;
this.searchControl=new SearchControl(_8b,this.saMap.mapServerUrl,this.saMap,this,this.saMap.prefix,_89.search,_89.downloadBehavior);
if(this.configuration.searchControl.mode=="docked"){
this.saMap.dockingOffset=Math.max(this.saMap.dockingOffset,this.searchControl.container.offsetHeight);
}
}
}
if(_89.downloadBehavior.downloadModel=="once"){
this.downloadOnce=true;
this.getAll=true;
}else{
if(_89.downloadBehavior.downloadModel=="getall"){
this.getAll=true;
}else{
if(_89.downloadBehavior.downloadModel=="grid"){
this.useGrid=true;
}
}
}
if(_89.downloadBehavior.timeout>0){
this.timeout=_89.downloadBehavior.timeout*1000;
this.reloadTimer=setTimeout(associateObjWithEvent(this,"reload"),this.timeout);
}
};
OverlayLayer.prototype.reload=function(){
this.refresh(true);
};
OverlayLayer.prototype.buildParameterList=function(_8c,_8d){
var _8e=new Array();
if(!_8c){
return;
}
var n1=_8c.length;
for(var i=0;i<n1;i++){
_8e[i]=_8c[i].clone();
if(_8d){
var _91=false;
for(var j=0;j<_8d.Properties.length;j++){
if(_8d.Properties[j].Name==_8c[i].name){
_8e[i].value=_8d.Properties[j].Value;
_91=true;
break;
}
}
if(!_91){
var n2=_8c[i].alternates.length;
for(var j=0;j<n2;j++){
for(var k=0;k<_8d.Properties[k].length;k++){
if(_8d.Properties[k].Name==_8c[i].alternates[j]){
_8e[i].value=_8d.Properties[k].Value;
_91=true;
break;
}
}
if(_91){
break;
}
}
}
}
}
return _8e;
};
OverlayLayer.prototype.draw=function(){
destroyNode(this.container);
if(isSafari2){
destroyNode(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{
if((isIe6||isIe7)&&this.container.firstChild){
this.container.insertBefore(this.objectCanvas,this.container.firstChild);
}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 _97=document.createElement("div");
_97.className="rwcCanvasOverlay";
}else{
var _97=document.createElement("canvas");
_97.className="rwcCanvasOverlay";
addClass(_97,"rwcNoPrint");
_97.width=this.saMap.mapWidth;
_97.height=this.saMap.mapHeight;
}
_97.id=this.id+"canvas";
return _97;
};
OverlayLayer.prototype.updateCanvas=function(){
if(!this.container){
this.draw();
return;
}
var _98=this.createCanvas();
if(isIe6||isIe7){
this.tempCanvas=_98;
this.drawShapes();
this.tempCanvas=null;
}
if(isSafari2){
this.saMap.mapContainer.insertBefore(_98,this.objectCanvas);
}else{
if(this.objectCanvas.parentNode){
this.container.insertBefore(_98,this.objectCanvas);
}else{
if(isIe6||isIe7){
inserted=false;
var _99=document.getElementById(this.id+"canvas");
if(_99!=null){
this.container.insertBefore(_98,this.container.childNodes[i]);
inserted=true;
}
if(!inserted){
this.container.appendChild(_98);
}
}else{
this.container.appendChild(_98);
}
}
}
setX(_98,0);
setY(_98,0);
setVisible(_98,false);
destroyNode(this.objectCanvas);
this.objectCanvas=_98;
if(!isIe6&&!isIe7){
this.drawShapes();
}
if(!this.saMap.zoomActive){
setVisible(_98,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(_a0){
if(this.noUpdate||!_a0){
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,_a0,null);
}
}
};
OverlayLayer.prototype.pixelOffset=function(_a3,_a4){
if(this.geoObjectArray){
var n=this.geoObjectArray.length;
for(var i=0;i<n;i++){
this.geoObjectArray[i].pixelOffset(_a3,_a4);
}
}
if(this.objectCanvas){
var _a7=getX(this.objectCanvas);
var _a8=getY(this.objectCanvas);
setX(this.objectCanvas,_a7+_a3);
setY(this.objectCanvas,_a8+_a4);
}
};
OverlayLayer.prototype.updateSearchControl=function(){
if(this.searchControl){
this.searchControl.addResults(this.searchControl.startIndex);
}
};
OverlayLayer.prototype.activateProxy=function(_a9,_aa){
this.useProxy=true;
this.proxyName=_a9;
this.customProxyString=_aa;
};
OverlayLayer.prototype.deactivateProxy=function(){
this.useProxy=false;
};
OverlayLayer.prototype.getGeoObjects=function(url,_ac,_ad,_ae,_af,_b0,_b1,_b2){
if(this.id=="-1"||this.noUpdate&&!_b1){
return;
}
if(this.timeout){
clearTimeout(this.reloadTimer);
this.reloadTimer=setTimeout(associateObjWithEvent(this,"reload"),this.timeout);
}
var _b3=this.saMap.tileGeoWidth/this.saMap.tileSize;
var _b4=(_af-_ad)*_b3;
var _b5=-this.saMap.totalOffsetX;
var _b6=this.saMap.totalOffsetY;
var _b7=this.saMap.initialGeoCenterX+_b5*_b3;
var _b8=this.saMap.initialGeoCenterY+_b6*_b3;
var _b9="";
if(this.searchEnabled&&this.searchControl){
if(this.objectType=="wfs"){
_b9=this.searchControl.buildSearchString(false);
}else{
_b9=this.searchControl.buildSearchString(true);
}
}
if(this.isClientOnly&&!this.useProxy){
return;
}
var _ba="";
var _bb="";
if(this.maxCount&&!isNaN(this.maxCount)){
_bb="&context-subset=0,"+this.maxCount;
_ba="&maxFeatures="+this.maxCount;
}
if(this.objectType=="wfs"){
var _bc="&outputFormat=JSON";
}else{
var _bc="&responsetype=JSON";
}
var _bd=this.saMap.mapWidth;
var _be=this.saMap.mapHeight;
if(this.downloadOnce){
this.noUpdate=true;
}
if(this.useGrid){
var _bf=2;
_b0=_b0.toPrecision(1)*2;
_af=_af.toPrecision(1)*2;
_bd=_af-_ad;
_be=_b0-_ae;
var _b4=_b4.toPrecision(2);
var _b4=_b4*1;
var _c0=Math.round((this.saMap.initialGeoCenterX-_b7)/(_b4/_bf));
var _c1=Math.round((this.saMap.initialGeoCenterY-_b8)/(_b4/_bf));
_b7=this.saMap.initialGeoCenterX-_c0*(_b4/2);
_b8=this.saMap.initialGeoCenterY-_c1*(_b4/2);
var _b4=_b4+((_b4/_bf)*2)*1.1;
}
if(_b2){
var _c2="request="+_b2;
}else{
if(this.objectType=="wfs"){
var _c2="request=GetFeature";
}else{
var _c2="request=GetGeoObjects";
}
}
if(!this.getAll){
if(this.objectType=="wfs"){
var _c3=new ReferenceSystem(this.saMap.SRS);
var _c4=_c3.ConvertToKVPOrder(_b7-_b4/2,_b8-_b4/2);
var _c5=_c3.ConvertToKVPOrder(_b7+_b4/2,_b8+_b4/2);
var _c6="&bbox="+_c4[0]+","+_c4[1]+","+_c5[0]+","+_c5[1];
}else{
if(_af>800||_b0>800){
var _c7=Math.max(_af,_b0);
_af=Math.ceil(800*(_af/_c7));
_b0=Math.ceil(800*(_b0/_c7));
}
var _c6="&pixel-x-topleft="+_ad+"&pixel-y-topleft="+_ae+"&pixel-x-bottomright="+_af+"&pixel-y-bottomright="+_b0;
}
}else{
var _c6="";
}
if(this.useProxy){
var _c8=url+"RWCProxy.axd?"+"proxy="+this.proxyName+this.customProxyString+_b9+_bb;
}else{
if(this.objectType=="wfs"){
var _c8=url+"OGCWFSInterface.axd?"+_c2+"&service=WFS"+"&version=1.1.0"+"&view="+this.saMap.viewName+_bc+_b9+_ba+_c6+"&typeName="+this.name;
}else{
var _c8=url+"RWCInterface.axd?"+_c2+"&view="+this.saMap.viewName+"&layers="+this.id+"&geowidth="+_b4+"&width="+_bd+"&height="+_be+"&positions=true"+"&x="+_b7+"&y="+_b8+_c6+_b9+_ba+_bc;
}
}
if(this.customAttributes){
for(variable in this.customAttributes){
if(typeof (this.customAttributes[variable])!="function"&&this.customAttributes[variable]){
_c8=_c8+"&context-"+variable+"="+this.customAttributes[variable];
}
}
}
if(this.xmlHttp&&this.xmlHttp.readyState>0){
disposeXMLHttpObject(this.xmlHttp);
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",_c8,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();
disposeXMLHttpObject(this.xmlHttp);
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();
disposeXMLHttpObject(this.xmlHttp);
this.xmlHttp=null;
}
};
OverlayLayer.prototype.setEditable=function(_cb){
this.editable=_cb;
};
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 _cc=this.saMap.dockingArea;
break;
case ("overlay"):
var _cc=this.saMap.embedDiv;
break;
case ("standalone"):
var _cc=document.body;
break;
}
if(!this.drivingDirections){
this.drivingDirections=new DrivingDirectionsControl(_cc,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(_cd){
if(this.haveRouteSearch&&this.drivingDirections){
this.drivingDirections.show(_cd);
}
};
OverlayLayer.prototype.resetDrivingDirections=function(){
if(this.haveRouteSearch&&this.drivingDirections){
this.drivingDirections.reset();
}
};
OverlayLayer.prototype.readGeoJSON=function(_ce,_cf){
if(!_ce){
return;
}
if(_ce.type&&_ce.type.toLowerCase()=="featurecollection"){
if(_ce.features){
var _d0=_ce.features;
}
}else{
if(_ce.type&&_ce.type.toLowerCase()=="feature"){
var _d0=new Array();
_d0.push(_ce);
}else{
if(_ce.type&&_ce.type.toLowerCase()=="geometry"){
var _d0=new Array();
var _d1=new Object();
_d1.geometry=_ce;
_d0.push(_d1);
}
}
}
if(!_d0){
return;
}
for(var i=0;i<_d0.length;i++){
var _d3=this.readFeature(_d0[i],_cf);
if(_d3){
this.insertObject(_d3,_d3.priority);
if(this.haveRouteSearch&&this.drivingDirections){
this.drivingDirections.insertObject(_d3);
}
for(var j=0;j<this.saMap.onObjectUpdatedEventHandlers.length;j++){
this.saMap.onObjectUpdatedEventHandlers[j](this,_d3,_d3.id,"createGeoObject");
}
}
}
};
OverlayLayer.prototype.readFeature=function(_d5,_d6){
if(!_d5){
return null;
}
var _d7=new GeoObject(_d5,this,_d6);
return _d7;
};
OverlayLayer.prototype.insertObject=function(_d8,_d9){
if(_d9&&!isNaN(_d9)){
_d8.priority=_d9;
}else{
_d9=0;
}
for(var i=0;i<this.geoObjectArray.length;i++){
if(this.geoObjectArray[i].priority&&this.geoObjectArray[i].priority>_d9){
this.geoObjectArray=this.geoObjectArray.insert(i,_d8);
return;
}
}
this.geoObjectArray.push(_d8);
};
OverlayLayer.prototype.addOrUpdateGeoObject=function(_db){
if(this.geoObjectArray){
var n=this.geoObjectArray.length;
for(var i=0;i<n;i++){
if(this.geoObjectArray[i].id==_db.id){
this.geoObjectArray[i].clonePosition(_db);
this.geoObjectArray[i].updateScreenPosition();
return;
}
}
}
if(!this.geoObjectArray){
this.geoObjectArray=new Array();
}
_db.draw(this.saMap,this.container,this.isHidden,this.geoObjectArray.length);
this.geoObjectArray.push(_db);
};
OverlayLayer.prototype.getGeoObjectArray=function(){
if(this.geoObjectArray){
return this.geoObjectArray;
}else{
return null;
}
};
OverlayLayer.prototype.getGeoObjectById=function(_de){
if(this.geoObjectArray){
var n=this.geoObjectArray.length;
for(var i=0;i<n;i++){
if(this.geoObjectArray[i].id==_de){
return this.geoObjectArray[i];
}
}
return null;
}
};
OverlayLayer.prototype.removeGeoObject=function(_e1){
if(this.geoObjectArray){
var n=this.geoObjectArray.length;
for(var i=0;i<n;i++){
if(this.geoObjectArray[i].id==_e1){
this.geoObjectArray[i].unload();
if(this.saMap.selectedObject&&this.saMap.selectedObject.id==this.geoObjectArray[i].id){
this.saMap.selectedObject=null;
}
destroyNode(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;
}
destroyNode(this.container);
this.container=null;
};
OverlayLayer.prototype.removeGeoObjectWithoutId=function(){
if(this.geoObjectArray){
var _e7=0;
while(_e7<this.geoObjectArray.length){
if(this.geoObjectArray[_e7].noId){
this.geoObjectArray[_e7].unload();
destroyNode(this.geoObjectArray[_e7].clientNode);
this.geoObjectArray.splice(_e7,1);
}else{
_e7++;
}
}
}
};
OverlayLayer.prototype.unload=function(){
if(this.geoObjectArray){
var n=this.geoObjectArray.length;
for(var i=0;i<n;i++){
this.geoObjectArray[i].unload();
}
}
if(this.saMap.routeLayer&&this.saMap.routeLayer.id==this.id){
this.saMap.routeLayer=null;
}
if(this.drivingDirections){
this.drivingDirections.unload();
}
};
OverlayLayer.prototype.getType=function(){
return "ObjectLayer";
};
OverlayLayer.prototype.addAttribute=function(_ea,_eb){
if(!this.customAttributes){
this.customAttributes=new Object();
}
this.customAttributes[_ea]=_eb;
};
OverlayLayer.prototype.removeAttribute=function(_ec){
if(this.customAttributes){
this.customAttributes[_ec]=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;
var _a=document.createElement("span");
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].type=="defaultImage"&&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!=""){
_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="";
this.viewSettings.useRWCMapRequests=true;
};
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,"rwcResultsList","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.search.searchGUI.sliderControl=new GUIElement();
this.overlayLayers.defaultLayer.search.searchGUI.sliderControl.bar=new ImageConfiguration();
this.overlayLayers.defaultLayer.search.searchGUI.sliderControl.bar.setImage(this.defaultUrl+"pic/standard/slidebar.png","20px","319px","");
this.overlayLayers.defaultLayer.search.searchGUI.sliderControl.barFiller=new ImageConfiguration();
this.overlayLayers.defaultLayer.search.searchGUI.sliderControl.barFiller.setImage(this.defaultUrl+"pic/standard/slidebar_fill.png","6px","2px","");
this.overlayLayers.defaultLayer.search.searchGUI.sliderControl.marker=new ImageConfiguration();
this.overlayLayers.defaultLayer.search.searchGUI.sliderControl.marker.setImage(this.defaultUrl+"pic/standard/slidebar_control.png","19px","19px","");
this.overlayLayers.defaultLayer.search.searchGUI.sliderControl.tick=new ImageConfiguration();
this.overlayLayers.defaultLayer.search.searchGUI.sliderControl.tick.setImage(this.defaultUrl+"pic/standard/slider_tick.png","8px","9px","");
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;
}
if(_1a.UseRWCMapRequests&&_1a.UseRWCMapRequests.value){
this.viewSettings.useRWCMapRequests=stringToBoolean(_1a.UseRWCMapRequests.value,true);
}
};
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(){
destroyNode(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(){
destroyNode(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.mainMap.currentTool.type=="pan"){
this.saMap.mainMap.currentTool.startManipulation(_b);
this.saMap.manipulationActive=false;
return;
}else{
this.saMap.mainMap.realTool=this.saMap.mainMap.currentTool;
this.saMap.mainMap.currentTool=this.saMap.mainMap.panTool;
this.saMap.mainMap.currentTool.startManipulation(_b);
this.saMap.manipulationActive=false;
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(){
if(this.saMap.realTool){
this.saMap.currentTool=this.saMap.realTool;
this.saMap.realTool=null;
}
this.saMap.endDrag();
};
PanTool.prototype.endManipulation=function(_e,_f){
if(this.saMap.realTool){
this.saMap.currentTool=this.saMap.realTool;
this.saMap.realTool=null;
}
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.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(_15){
var _16="";
for(var i=0;i<this.controlGroups.length;i++){
if(this.controlGroups[i].isServerSearch){
_16+=this.controlGroups[i].buildSearchString(_15);
}
}
if(!_15){
_16="&query=<ogc:Query xmlns:ogc=\"http://www.opengis.net/ogc\" typeName=\""+this.layer.name+"\"><ogc:Filter>"+_16+"</ogc:Filter></ogc:Query>";
}
return _16;
};
SearchControl.prototype.addResults=function(_18){
if(typeof (this.layer.geoObjectArray)=="undefined"){
return;
}
this.initiateClientSearch();
if(this.layer.configuration.search.searchResults.active){
this.drawSearchResultsList(_18);
}
this.layer.draw();
};
SearchControl.prototype.drawSearchResultsList=function(_19){
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 _1b=document.createElement("h4");
_1b.className="rwcSearchResultHeading";
_1b.innerHTML=this.layer.configuration.search.searchResults.heading;
this.resultsBox.appendChild(_1b);
}
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 _1c=document.createElement("div");
_1c.innerHTML=this.saMap.config.GUI.strings.noResults;
this.resultsBox.appendChild(_1c);
setVisible(this.resultsBox,true);
return;
}
var _1d=this.resultsBox.parentNode.offsetHeight-this.resultsBox.offsetTop-this.guiHeight;
this.maxResultsPerPage=Math.floor(_1d/this.itemHeight);
if(this.maxResultsPerPage>10){
this.maxResultsPerPage=10;
}
if(this.maxResultsPerPage<=0){
this.maxResultsPerPage=5;
}
this.startIndex=_19;
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 _1e=new SearchResult(this.layer.geoObjectArray[i],this.resultsBox,this.saMap);
this.searchResultArray.push(_1e);
}
this.indexText=document.createElement("span");
this.resultsBox.appendChild(this.indexText);
this.indexText.innerHTML=(this.startIndex+1)+"-"+(this.startIndex+this.pageCount)+" ("+this.maxCount+")";
var _1f=document.createElement("br");
this.resultsBox.appendChild(_1f);
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,_21){
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,_23){
this.startIndex-=this.maxResultsPerPage;
if(this.startIndex<0){
this.startIndex=0;
}
this.addResults(this.startIndex);
};
SearchControl.prototype.reduceSearchResults=function(_24,_25,_26){
if(!this.layer.geoObjectArray){
return;
}
var n=this.layer.geoObjectArray.length;
switch(_26){
case ("toggle"):
for(var i=0;i<n;i++){
if(!this.layer.geoObjectArray[i].searchAttributes[_24]||this.layer.geoObjectArray[i].searchAttributes[_24]==_25){
this.layer.geoObjectArray[i].hide();
}
}
break;
case ("string"):
var _29=new RegExp("("+_25+")");
for(var i=0;i<n;i++){
if(!this.layer.geoObjectArray[i].searchAttributes[_24]||!_29.test(this.layer.geoObjectArray[i].searchAttributes[_24])){
this.layer.geoObjectArray[i].hide();
}
}
break;
case ("interval"||"slider"):
for(var i=0;i<n;i++){
var _2a=parseInt(this.layer.geoObjectArray[i].searchAttributes[_24]);
if(isNaN(_25.min)&&isNaN(_25.max)){
break;
}
if(isNaN(_2a)||_2a<_25.min||_2a>_25.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(_2c,_2d,_2e){
this.node=document.createElement("div");
this.geoObject=_2c;
this.saMap=_2e;
this.node.className="rwcSearchListItem";
this.container=_2d;
_2d.appendChild(this.node);
for(var j=0;j<_2c.searchResultParameters.length;j++){
if(typeof (_2c.searchResultAttributes[j])!="undefined"){
var _30=_2c.attributes[_2c.searchResultAttributes[j]].value;
}else{
var _30=_2c.searchResultParameters[j].value;
}
if(_30!=null&&_30!=""){
this.node.innerHTML+="<div>"+_30+"</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,_32){
var _33=this.saMap.mapWidth/2-this.geoObject.viewX;
var _34=this.saMap.mapHeight/2-this.geoObject.viewY;
this.saMap.beginDrag();
this.saMap.drag(_33,_34);
this.saMap.endDrag();
this.geoObject.updateInfoBox();
};
SearchResult.prototype.searchItemMouseOver=function(evt,_36){
this.geoObject.displayInfoBox();
};
SearchResult.prototype.searchItemMouseOut=function(evt,_38){
this.geoObject.cancelInfoBox();
};
SearchResult.prototype.unload=function(evt,_3a){
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(_3b,_3c,_3d,_3e){
this.container=document.createElement("div");
this.configuration=_3b;
this.type=_3b.type;
if(this.type=="client"){
this.isServerSearch=false;
}else{
this.isServerSearch=true;
}
this.searchControl=_3d;
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(_3e.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);
}
_3c.appendChild(this.container);
}
SearchControlGroup.prototype.buildSearchString=function(_40){
var _41="";
for(var i=0;i<this.controlList.length;i++){
_41+=this.controlList[i].buildSearchString(_40);
}
return _41;
};
SearchControlGroup.prototype.filter=function(_43){
for(var i=0;i<this.controlList.length;i++){
var _45=this.controlList[i].filter(_43);
if(!_45){
return false;
}
}
return true;
};
SearchControlGroup.prototype.addToAttributeList=function(_46){
for(var i=0;i<this.controlList.length;i++){
var _48=false;
for(var j=0;j<_46.length;j++){
if(this.controlList[i].name==_46[j]){
_48=true;
this.controlList[i].attributeId=j;
break;
}
}
if(!_48){
this.controlList[i].attributeId=_46.length;
_46.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(_4a,_4b,_4c){
if(this.type="client"){
this.searchControl.reduceSearchResults(_4a,_4b,_4c);
}else{
this.update();
}
};
SearchControlGroup.prototype.onSearchButtonClick=function(evt,_4e){
this.update();
};
SearchControlGroup.prototype.onClearButtonClick=function(evt,_50){
this.searchControl.clearSearch();
};
SearchControlGroup.prototype.clear=function(evt,_52){
for(var i=0;i<this.controlList.length;i++){
this.controlList[i].clear();
}
};
SearchControlGroup.prototype.addControl=function(_54){
var _55;
switch(_54.type){
case ("toggle"):
if(!_54.image){
_54.image=this.searchControl.layer.configuration.searchControl.listImage;
}
if(!_54.selectedImage){
_54.selectedImage=this.searchControl.layer.configuration.searchControl.selectedListImage;
}
_55=new ToggleControl(_54,this.container,this,this.isServerSearch);
break;
case ("string"):
_55=new StringControl(_54,this.container,this,this.isServerSearch);
break;
case ("interval"):
_55=new IntervalControl(_54,this.container,this,this.isServerSearch);
break;
case ("slider"):
_55=new SliderControl(_54,this.container,this,this.isServerSearch,this.searchControl.searchGUI);
break;
case ("select"):
_55=new SelectControl(_54,this.container,this,this.isServerSearch);
break;
}
if(_55){
this.controlList.push(_55);
}
};
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(_57,_58,_59,_5a){
this.selected=true;
this.name=_57.name;
this.imageConfig=_57.image;
this.selectedImageConfig=_57.selectedImage;
this.value=_57.value.toLowerCase();
this.isServerSearch=_5a;
this.controlGroup=_59;
this.container=document.createElement("div");
this.image=document.createElement("img");
if(_57.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+=_57.label;
this.container.appendChild(this.text);
_58.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(_5b){
var _5c="";
if(this.selected){
if(_5b){
_5c="&context-"+this.name+"="+this.value;
}
}else{
if(!_5b){
_5c="<ogc:PropertyIsNotEqualTo>"+"<ogc:PropertyName>"+this.name+"</ogc:PropertyName>"+"<ogc:Literal>"+this.value+"</ogc:Literal>"+"</ogc:PropertyIsNotEqualTo>";
}
}
return encodeURI(_5c);
};
ToggleControl.prototype.filter=function(_5d){
if(this.selected){
return true;
}else{
if(_5d.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(_5e,_5f,_60,_61){
this.controlGroup=_60;
this.name=_5e.name;
this.value=_5e.value;
this.lastValue="";
this.isServerSearch=_61;
this.container=document.createElement("div");
this.container.innerHTML+=_5e.label+"<br>";
this.searchBox=document.createElement("input");
this.searchBox.setAttribute("autocomplete","off");
this.container.appendChild(this.searchBox);
_5f.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,_63){
if(evt.keyCode=="13"){
this.controlGroup.update();
}
};
StringControl.prototype.onKeyUp=function(evt,_65){
var _66=new RegExp("/^"+this.lastValue).test(this.searchBox.value);
if(this.searchBox.value.length>=this.lastValue.length&&_66){
this.controlGroup.reduceSearchResults(this.attributeId,this.searchBox.value.toLowerCase(),"string");
}else{
this.controlGroup.update();
}
this.lastValue=this.searchBox.value;
};
StringControl.prototype.buildSearchString=function(_67){
if(_67){
searchString="&context-"+this.name+"="+encodeURI(this.searchBox.value);
}else{
searchString=encodeURI("<ogc:PropertyIsLike wildCard=\"*\" singleChar=\"_\" escape=\"\\\">"+"<ogc:PropertyName>"+this.name+"</ogc:PropertyName>"+"<ogc:Literal>*"+this.searchBox.value+"*</ogc:Literal>"+"</ogc:PropertyIsLike>");
}
return searchString;
};
StringControl.prototype.filter=function(_68){
if(_68.searchAttributes[this.attributeId]!=null){
if(_68.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(_69,_6a,_6b,_6c){
this.controlGroup=_6b;
this.name=_69.name;
this.value=_69.value;
this.isServerSearch=_6c;
this.container=document.createElement("div");
this.container.innerHTML+=_69.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);
_6a.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(_6d){
var _6e="";
if(_6d){
_6e="&context-"+this.name+"="+encodeURI(this.minBox.value)+","+encodeURI(this.maxBox.value);
}else{
if(this.maxBox.value!=null){
if(this.maxBox.value!=this.value.max){
_6e+="<ogc:PropertyIsLessThanOrEqualTo>"+"<ogc:PropertyName>"+this.name+"</ogc:PropertyName>"+"<ogc:Literal>"+this.maxBox.value+"</ogc:Literal>"+"</ogc:PropertyIsLessThanOrEqualTo>";
}
}
if(this.minBox.value!=null){
if(this.minBox.value!=this.value.min){
_6e+="<ogc:PropertyIsGreaterThanOrEqualTo>"+"<ogc:PropertyName>"+this.name+"</ogc:PropertyName>"+"<ogc:Literal>"+this.minBox.value+"</ogc:Literal>"+"</ogc:PropertyIsGreaterThanOrEqualTo>";
}
}
}
return _6e;
};
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 _70=new Interval(min,max);
this.controlGroup.reduceSearchResults(this.attributeId,_70,"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 _72=new Interval(min,max);
this.controlGroup.reduceSearchResults(this.attributeId,_72,"interval");
}else{
this.controlGroup.update();
}
}
if(!isNaN(max)){
this.previousMaxValue=max;
}else{
this.previousMaxValue=null;
}
};
IntervalControl.prototype.filter=function(_73){
var _74=parseInt(_73.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=_74+1;
}
if(isNaN(min)){
min=_74-1;
}
if(isNaN(_74)||_74<min||_74>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(_77,_78,_79,_7a,_7b){
this.controlGroup=_79;
this.name=_77.name;
this.isServerSearch=_7a;
var _7c=_77.value.split(":");
if(_7c.length==2){
this.type=_7c[0];
if(this.type=="enum"){
this.valueArray=_7c[1].split(",");
this.value=new Interval(0,this.valueArray.length);
this.valueArray.push("");
}else{
var _7d=_7c[1].split(",");
if(_7d.length==2){
this.value=new Interval(parseInt(_7d[0]),parseInt(_7d[1]));
}else{
}
}
}else{
this.type="range";
var _7d=_77.value.split(",");
if(_7d.length==2){
this.value=new Interval(parseInt(_7d[0]),parseInt(_7d[1]));
}else{
return;
}
}
this.container=document.createElement("div");
this.label=document.createElement("p");
this.label.className="rwcSliderLabel";
this.label.innerHTML+=_77.label+"<br>";
this.container.appendChild(this.label);
this.barContainer=document.createElement("span");
this.barContainer.style.position="absolute";
if(_7b.sliderControl.bar){
this.barLength=parseInt(_7b.sliderControl.bar.width);
this.barHeight=parseInt(_7b.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(_7b&&_7b.sliderControl){
setImageSource(this.bar,_7b.sliderControl.bar.image);
setImageSource(this.barFiller,_7b.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(_7b.sliderControl.marker.image){
var _7e=_7b.sliderControl.marker.image;
this.markerAdjustX=parseInt(_7b.sliderControl.marker.width);
}else{
var _7e="pic/standard/slidebar_control.png";
this.markerAdjustX=19;
}
if(this.type=="enum"){
var _7f=this.barLength/(this.valueArray.length-1);
var _80=parseInt(_7b.sliderControl.tick.width);
if(_7b.sliderControl.tick.width&&_7f>_80){
for(var i=1;i<this.valueArray.length-1;i++){
var _82=document.createElement("img");
_7b.sliderControl.tick.applyConfiguration(_82);
_82.className="rwcSliderTick";
_82.style.left=(Math.round(_7f*i)-this.markerAdjustX/2-(_80/2))+"px";
this.barContainer.appendChild(_82);
}
}
}
if(this.type=="range"||this.type=="min"){
this.minElement=this.createMarker(_7e,0);
this.barContainer.appendChild(this.minElement);
}
if(this.type=="range"||this.type=="max"||this.type=="enum"){
this.maxElement=this.createMarker(_7e,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);
_78.appendChild(this.container);
this.updateFiller();
this.dragDelegate=associateObjWithEvent(this,"beginDrag");
Evt.addEventListener(this.barContainer,"mousedown",this.dragDelegate);
}
SliderControl.prototype.createMarker=function(img,_84){
var _85=document.createElement("img");
_85.style.left=_84+"px";
_85.style.position="absolute";
setImageSource(_85,img);
return _85;
};
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(_88){
var _89="";
switch(this.type){
case ("range"):
case ("min"):
case ("max"):
if(this.currentMin!=null||this.currentMax!=null){
if(_88){
_89="&context-"+this.name+"="+this.currentMin+","+this.currentMax;
}else{
if(this.currentMax!=null&&this.currentMax!=this.value.max){
_89+="<ogc:PropertyIsLessThanOrEqualTo>"+"<ogc:PropertyName>"+this.name+"</ogc:PropertyName>"+"<ogc:Literal>"+this.currentMax+"</ogc:Literal>"+"</ogc:PropertyIsLessThanOrEqualTo>";
}
if(this.currentMin!=null&&this.currentMin!=this.value.min){
_89+="<ogc:PropertyIsGreaterThanOrEqualTo>"+"<ogc:PropertyName>"+this.name+"</ogc:PropertyName>"+"<ogc:Literal>"+this.currentMin+"</ogc:Literal>"+"</ogc:PropertyIsGreaterThanOrEqualTo>";
}
}
}
break;
case ("enum"):
if(this.currentMax!=null){
var _8a=this.currentMax;
}else{
var _8a=this.value.max;
}
if(_88){
_89="&context-"+this.name+"="+this.valueArray[_8a];
}else{
_89=encodeURI("<ogc:PropertyIsEqualTo>"+"<ogc:PropertyName>"+this.name+"</ogc:PropertyName>"+"<ogc:Literal>"+this.valueArray[_8a]+"</ogc:Literal>"+"</ogc:PropertyIsEqualTo>");
}
break;
}
return _89;
};
SliderControl.prototype.beginDrag=function(evt,_8c){
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 _8d=getPixelPositionFromEvent(evt,this.barContainer);
var _8e=_8d.x;
this.minElementAdjustX=this.minElement.offsetWidth/2;
var _8f=parseInt(this.minElement.style.left);
minD=Math.abs(_8f+this.minElementAdjustX-_8e);
this.maxElementAdjustX=this.maxElement.offsetWidth/2;
var _90=parseInt(this.maxElement.style.left);
maxD=Math.abs(_90+this.maxElementAdjustX-_8e);
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,_92){
evt=new Evt(evt);
var _93=getPixelPositionFromEvent(evt,this.barContainer);
var _94=_93.x;
if(this.activeControl==0){
var _95=_94-this.minElementAdjustX;
if(_95<0){
_95=0;
var _96=true;
}
if(this.maxElement){
var _97=parseInt(this.maxElement.style.left);
if(_95>_97-this.maxElement.offsetWidth){
_95=_97-this.maxElement.offsetWidth;
}
}else{
if(_95>this.bar.offsetWidth-this.minElement.offsetWidth){
_95=this.bar.offsetWidth-this.minElement.offsetWidth;
}
}
this.minElement.style.left=_95+"px";
this.updateFiller();
if(_96){
this.currentMin=null;
this.updateLabels();
}else{
if(this.maxElement){
this.currentMin=Math.round((_95/(this.bar.offsetWidth-this.maxElement.offsetWidth))*(this.value.max-this.value.min))+this.value.min;
}else{
this.currentMin=Math.round((_95/(this.bar.offsetWidth-this.minElement.offsetWidth))*(this.value.max-this.value.min))+this.value.min;
}
this.updateLabels();
}
this.controlGroup.update();
}else{
var _95=_94-this.maxElementAdjustX;
if(_95>this.bar.offsetWidth-this.maxElement.offsetWidth){
var _96=true;
_95=this.bar.offsetWidth-this.maxElement.offsetWidth;
}else{
if(this.minElement){
var _98=parseInt(this.minElement.style.left);
if(_95<_98+this.minElement.offsetWidth){
_95=_98+this.minElement.offsetWidth;
}
}else{
if(_95<0){
_95=0;
}
}
}
if(this.type!="enum"){
this.maxElement.style.left=_95+"px";
}
this.updateFiller();
if(_96){
this.currentMax=null;
}else{
this.currentMax=Math.round((_95/(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,_9a){
this.drag(evt,_9a);
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 _9b=parseInt(this.minElement.style.left)+this.markerAdjustX/2;
}else{
if(parseInt(this.maxElement.style.left)>this.markerAdjustX/2){
var _9b=this.markerAdjustX/2;
}else{
var _9b=0;
}
}
this.barFiller.style.left=_9b+"px";
if(this.maxElement){
this.barFiller.style.width=parseInt(this.maxElement.style.left)-_9b+"px";
}else{
this.barFiller.style.width=this.barLength-parseInt(this.minElement.style.left)-this.markerAdjustX+"px";
}
};
SliderControl.prototype.filter=function(_9c){
if(this.type=="enum"){
if(this.currentMax==null){
return true;
}else{
if(_9c.searchAttributes[this.attributeId]&&(this.valueArray[this.currentMax].toLowerCase()==_9c.searchAttributes[this.attributeId].toLowerCase())){
return true;
}else{
return false;
}
}
}else{
var _9d=parseInt(_9c.searchAttributes[this.attributeId]);
var _9e=this.currentMin;
var _9f=this.currentMax;
if(this.currentMin==null&&this.currentMax==null){
return true;
}
if(isNaN(_9d)){
return false;
}
if(_9f==null){
_9f=_9d+1;
}
if(_9e==null){
_9e=_9d-1;
}
if(_9d<_9e||_9d>_9f){
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(_a0,_a1,_a2,_a3){
this.name=_a0.name;
this.controlGroup=_a2;
this.isServerSearch=_a3;
this.selectBox=document.createElement("select");
this.selectBox.className="rwcSelectControl";
var _a4=_a0.value.split(",");
var _a5=_a0.label.split(",");
if(_a4.length!=_a5.length){
return;
}
for(var i=0;i<_a4.length;i++){
this.selectBox.options[this.selectBox.options.length]=new Option(_a5[i],_a4[i]);
}
this.container=document.createElement("div");
_a1.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(_a7){
if(this.selectBox.selectedIndex==0){
return true;
}
if(_a7.searchAttributes[this.attributeId]==this.selectBox[this.selectBox.selectedIndex].value.toLowerCase()){
return true;
}else{
return false;
}
};
SelectControl.prototype.buildSearchString=function(_a8){
if(this.selectBox.selectedIndex==0){
var _a9="";
}else{
var _aa=this.selectBox[this.selectBox.selectedIndex].value;
if(_a8){
var _a9="&context-"+this.name+"="+_aa;
}else{
var _a9="<ogc:PropertyIsEqualTo>"+"<ogc:PropertyName>"+this.name+"</ogc:PropertyName>"+"<ogc:Literal>"+_aa+"</ogc:Literal>"+"</ogc:PropertyIsEqualTo>";
}
}
return _a9;
};
SelectControl.prototype.clear=function(){
this.selectBox.selectedIndex=0;
};
SelectControl.prototype.unload=function(){
Evt.removeEventListener(this.selectBox,"change",this.changeDelegate);
};
function GeoCodingControlGroup(_ab,_ac,_ad,_ae){
this.container=document.createElement("div");
if(_ab.css){
addClass(this.container,_ab.css);
}
this.configuration=_ab;
this.type=_ab.type;
this.isServerSearch=true;
this.searchControl=_ad;
try{
this.maxCount=parseInt(_ae.maxCount);
}
catch(e){
this.maxCount=10;
}
if(_ae.downloadModel){
this.downloadModel=_ae.downloadModel;
}else{
this.downloadModel="standard";
}
this.layer=_ad.layer;
this.searchControlGroup=new SearchControlGroup(_ab,_ac,this,_ae);
if(this.type=="geoCoding"){
var _af=new Parameter("address","string","","",null);
this.searchControlGroup.addControl(_af);
}else{
if(this.type=="reverseGeoCoding"){
var _b0=new Parameter("X","string","","X",null);
this.searchControlGroup.addControl(_b0);
this.xBox=this.searchControlGroup.controlList[this.searchControlGroup.controlList.length-1];
var _b1=new Parameter("Y","string","","Y",null);
this.searchControlGroup.addControl(_b1);
this.yBox=this.searchControlGroup.controlList[this.searchControlGroup.controlList.length-1];
}
}
}
GeoCodingControlGroup.prototype.buildSearchString=function(){
var max="&max="+this.maxCount;
var _b3="&refsystem="+this.searchControl.saMap.SRS;
if(this.type=="geoCoding"){
if(this.downloadModel=="standard"){
var _b4=this.searchControl.saMap.getGeoRect();
var _b5="&bbox="+_b4.xMin+","+_b4.yMin+","+_b4.xMax+","+_b4.yMax;
}else{
var _b5="";
}
}else{
if(this.type=="reverseGeoCoding"){
try{
var _b6=parseFloat(this.xBox.searchBox.value);
var _b7=parseFloat(this.yBox.searchBox.value);
}
catch(e){
return "";
}
var _b8=3;
var _b9=this.searchControl.saMap.tileGeoWidth/this.searchControl.saMap.tileSize;
var _b5="&bbox="+(_b6-_b9*_b8)+","+(_b7-_b9*_b8)+","+(_b6+_b9*_b8)+","+(_b7+_b9*_b8);
}
}
var _ba="&return=geojson"+max+_b5+_b3+"&request=locate";
for(var i=0;i<this.searchControlGroup.controlList.length;i++){
_ba+=this.searchControlGroup.controlList[i].buildSearchString(true);
}
_ba=_ba.replace("context-","");
this.layer.activateProxy("geoCoding",_ba);
return "";
};
GeoCodingControlGroup.prototype.filter=function(_bc){
return this.searchControlGroup.filter(_bc);
};
GeoCodingControlGroup.prototype.addToAttributeList=function(_bd){
this.searchControlGroup.addToAttributeList(_bd);
};
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;
disposeXMLHttpObject(this.jsonXmlHttp);
this.jsonXmlHttp=null;
return;
}
this.JSONConfig=_e;
}
disposeXMLHttpObject(this.jsonXmlHttp);
this.jsonXmlHttp=null;
}
};
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();
}
disposeXMLHttpObject(this.getViewsXmlHttp);
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{
if(typeof (this.viewJSON.ViewInfo.TileOrigin)!="undefined"){
this.initialGeoCenterX=parseFloat(this.viewJSON.ViewInfo.TileOrigin.X);
this.initialGeoCenterY=parseFloat(this.viewJSON.ViewInfo.TileOrigin.Y);
}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;
}
if(typeof (this.viewJSON.ViewInfo.TileOrigin)!="undefined"){
if(!this.mainMap){
var _16=parseFloat(this.viewJSON.ViewInfo.CenterPoint.X);
var _17=parseFloat(this.viewJSON.ViewInfo.CenterPoint.Y);
}else{
var _16=parseFloat(this.mainMap.viewJSON.ViewInfo.CenterPoint.X);
var _17=parseFloat(this.mainMap.viewJSON.ViewInfo.CenterPoint.Y);
}
var _18=this.tileSize/this.tileGeoWidth;
this.totalOffsetX=-(_16-this.initialGeoCenterX)*_18;
this.totalOffsetY=(_17-this.initialGeoCenterY)*_18;
}
}
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 _19=parseInt(this.miniMapDiv.style.height);
if(_19&&!isNaN(_19)){
this.dockingOffset=Math.max(this.dockingOffset,_19);
}
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 _1a=this.config.GUI.miniMap.alternateView;
}else{
var _1a=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 _1b=null;
if(typeof (top[this.config.GUI.miniMap.JSONConfigurationObject])!="undefined"){
_1b=top[this.config.GUI.miniMap.JSONConfigurationObject];
}
this.miniMap=new LinkedMap(this,_1a,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,_1b);
this.miniMapDiv.appendChild(this.miniMapDiv.closeBox);
this.closeMiniMapClickDelegate=associateObjWithEvent(this,"closeMiniMap");
Evt.addEventListener(this.miniMapDiv.closeBox,"click",this.closeMiniMapClickDelegate);
};
SpatialAceMap.prototype.tileMouseDown=function(evt,_1d){
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.currentTool.type=="pan"){
this.mainMap.rescalingFactor=1/this.linkMap.currentScaleFactor;
}
var _1e=getPixelPositionFromEvent(tmpEvt,this.mapContainer);
this.mainMap.clickPoint=this.getPosition(_1e.x,_1e.y);
this.mainMap.clickPending=true;
}else{
tmpEvt=new Evt(evt);
var _1e=getPixelPositionFromEvent(tmpEvt,this.mapContainer);
this.clickPoint=this.getPosition(_1e.x,_1e.y);
this.clickPending=true;
}
this.currentTool.startManipulation(evt);
};
SpatialAceMap.prototype.startDragToolBehaviour=function(evt,_20){
evt=new Evt(evt);
if(document.attachEvent){
document.body.attachEvent("onselectstart",returnFalse,false);
document.body.attachEvent("ondrag",returnFalse,false);
}
this.dragInitiatingTool=_20;
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,_24){
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 _25=this.getPosition(this.mousePosition.x,this.mousePosition.y);
if(this.clickTool&&this.clickTool.update&&!isOpera){
this.clickTool.update(_25);
}
var _26=this.view.updateTooltips(_25.x,_25.y);
if(_26&&_26.length>0){
for(var i=0;i<_26.length;i++){
if(_26[i].enter){
for(var j=0;j<this.onMouseOverEventHandlers.length;j++){
this.onMouseOverEventHandlers[j](this,_26[i].geoObject);
}
}else{
for(var j=0;j<this.onMouseOutEventHandlers.length;j++){
this.onMouseOutEventHandlers[j](this,_26[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=_25.x+"<br>"+_25.y;
}
};
SpatialAceMap.prototype.onMouseWheel=function(evt,_2a){
if(this.mainMap){
return;
}
target=evt.target||evt.srcElement;
if(target.nodeName=="TEXTAREA"||((target.nodeName=="SELECT")&&(isIe6||isIe7))){
return;
}
if(evt.preventDefault){
evt.preventDefault();
}else{
if(evt.returnValue){
evt.returnValue=false;
}
}
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 _2b=getPixelPositionFromEvent(tmpEvt,this.mapContainer);
}else{
var _2b=this.mousePosition;
}
var _2c=this.getPosition(_2b.x,_2b.y);
this.setMapCenter(_2c.x,_2c.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(_2e,_2f){
if(!this.initialized||this.bufferTimer){
return;
}
_2e=_2e*this.rescalingFactor;
_2f=_2f*this.rescalingFactor;
var _30=_2e-this.lastOffsetX;
var _31=_2f-this.lastOffsetY;
if(this.config.viewSettings.borders&&this.config.viewSettings.borders.active&&!this.mainMap){
var _32=this.getMapCenter();
var _33=this.tileGeoWidth/this.tileSize;
var _34=_32.x-_30*_33;
var _35=_32.y+_31*_33;
var _36=this.point(_34,_35);
var _37=this.checkBorders(_36);
var _38=this.tileSize/this.tileGeoWidth;
_30=-(_37.x-_32.x)*_38;
_31=(_37.y-_32.y)*_38;
_2e=_30+this.lastOffsetX;
_2f=_31+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(_30));
setY(this.view.zoomContainer,zY+Math.round(_31));
}
this.view.pixelOffset(Math.round(_30),Math.round(_31));
if(this.activeinfoBoxObject){
this.activeinfoBoxObject.updateInfoBox();
}
this.lastOffsetX=_2e;
this.lastOffsetY=_2f;
this.totalOffsetX+=_30;
this.totalOffsetY+=_31;
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(_2e*this.linkedMapArray[i].currentScaleFactor,_2f*this.linkedMapArray[i].currentScaleFactor);
}
}
};
SpatialAceMap.prototype.checkBorders=function(_3c){
if(this.config.viewSettings.borders&&this.config.viewSettings.borders.active&&!this.mainMap){
var _3d=this.tileGeoWidth/this.tileSize;
adjustedX=_3c.x;
adjustedY=_3c.y;
var _3e=adjustedX+this.mapWidth/2*_3d;
if(_3e>this.config.viewSettings.borders.geoRect.xMax){
adjustedX=_3c.x-(_3e-this.config.viewSettings.borders.geoRect.xMax);
}
var _3f=adjustedX-this.mapWidth/2*_3d;
if(_3f<this.config.viewSettings.borders.geoRect.xMin){
adjustedX=_3c.x+(this.config.viewSettings.borders.geoRect.xMin-_3f);
_3e=adjustedX+this.mapWidth/2*_3d;
if(_3e>this.config.viewSettings.borders.geoRect.xMax){
adjustedX=this.config.viewSettings.borders.geoRect.centerPoint.x;
}
}
var _40=adjustedY+this.mapHeight/2*_3d;
if(_40>this.config.viewSettings.borders.geoRect.yMax){
adjustedY=_3c.y-(_40-this.config.viewSettings.borders.geoRect.yMax);
}
var _41=adjustedY-this.mapHeight/2*_3d;
if(_41<this.config.viewSettings.borders.geoRect.yMin){
adjustedY=_3c.y+(this.config.viewSettings.borders.geoRect.yMin-_41);
_40=adjustedY+this.mapHeight/2*_3d;
if(_40>this.config.viewSettings.borders.geoRect.yMax){
adjustedY=this.config.viewSettings.borders.geoRect.centerPoint.y;
}
}
var _42=this.point(adjustedX,adjustedY);
return _42;
}
return _3c;
};
SpatialAceMap.prototype.ieBuffer=function(evt,_44){
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);
}
for(var i=0;i<this.onNewGeoRectEventHandlers.length;i++){
this.onNewGeoRectEventHandlers[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(_46,_47){
if(!this.initialized){
return;
}
var _48=this.getPosition(_46,_47);
if(this.mainMap){
this.mainMap.setMapCenter(_48.x,_48.y);
}else{
this.setMapCenter(_48.x,_48.y);
}
};
SpatialAceMap.prototype.activateClickTools=function(_49){
this.clickPending=false;
if(this.clickTool&&this.clickTool.click){
this.clickTool.click(_49.x,_49.y);
}else{
if(this.clickTool){
this.clickTool(_49.x,_49.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(_4b,_4c){
var _4d=new Object();
var _4e=this.getPixelsToViewUnits();
centerOffsetX=_4b-this.mapWidth/2-this.totalOffsetX;
centerOffsetY=-_4c+this.mapHeight/2+this.totalOffsetY;
_4d.x=this.initialGeoCenterX+_4e*centerOffsetX;
_4d.y=this.initialGeoCenterY+_4e*centerOffsetY;
return _4d;
};
SpatialAceMap.prototype.getPixelsToViewUnits=function(){
return (this.tileGeoWidth/this.tileSize);
};
SpatialAceMap.prototype.startZoomTransition=function(_4f,_50,_51){
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=_51;
this.zoomTotalIterations=_51;
this.zoomOldTileGeoWidth=_4f;
this.zoomNewTileGeoWidth=_50;
this.zoomTotalScaling=_4f/_50;
this.view.startZoom();
this.newTileGeoWidth=_50;
this.zoomStartTime=new Date().getTime();
this.zoomEndTime=this.zoomStartTime+this.totalZoomTime;
this.zoomTimer=setTimeout(associateObjWithEvent(this,"onZoomIteration"),5);
};
SpatialAceMap.prototype.onZoomIteration=function(evt,_53){
if(!this.zoomActive){
return;
}
var i=0;
var _55=(this.zoomTotalIterations-this.zoomIterationsRemaining)/this.zoomTotalIterations;
this.view.zoom(_55);
if(this.zoomIterationsRemaining>0){
this.zoomIterationsRemaining--;
this.zoomRemaining=new Date().getTime();
this.zoomRemaining=this.zoomEndTime-this.zoomRemaining;
var _56=this.zoomIterationsRemaining;
try{
if(this.zoomIterationsRemaining>0){
if(this.zoomRemaining/this.zoomIterationsRemaining<5){
this.zoomIterationsRemaining=Math.round(this.zoomRemaining/5);
}
}
}
catch(e){
this.zoomIterationsRemaining=_56;
}
this.zoomTimer=setTimeout(associateObjWithEvent(this,"onZoomIteration"),5);
}else{
this.zoomActive=false;
this.view.showObjectLayers();
this.view.endZoom();
}
};
SpatialAceMap.prototype.onKeyDown=function(evt,_58){
if(this.mainMap){
return;
}
target=evt.target||evt.srcElement;
if((target.nodeName=="INPUT"||target.nodeName=="SELECT"||target.nodeName=="TEXTAREA")){
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 _59=this.config.GUI.lookingGlass.alternateView;
}else{
var _59=this.viewName;
}
try{
var _5a=parseFloat(this.config.GUI.lookingGlass.scaleValue);
}
catch(e){
var _5a=0.1;
}
this.lookingGlassId=this.linkedMapArray.length;
this.createLookingGlass(-500,-500,this.config.GUI.lookingGlass.model,_5a,_59);
this.mouseMoveLookingGlassDelegate=associateObjWithEvent(this,"lookingGlassMouseMove");
Evt.addEventListener(document,"mousemove",this.mouseMoveLookingGlassDelegate);
}else{
Evt.removeEventListener(document,"mousemove",this.mouseMoveLookingGlassDelegate);
this.lookingGlass.map.unload();
destroyNode(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,_5c){
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(_5d,_5e){
if(this.zoomActive==true){
return;
}
this.beginDrag();
this.drag(_5d,_5e);
this.endDrag();
};
SpatialAceMap.prototype.setTileGeoWidth=function(_5f,_60){
if(!this.view){
return;
}
for(var i=0;i<this.onBeforeUpdateEventHandlers.length;i++){
this.onBeforeUpdateEventHandlers[i](this);
}
destroyNode(this.view.zoomContainer);
this.view.zoomContainer=null;
if(this.config.GUI.enableAnimatedZoom&&_60&&!isOpera){
this.startZoomTransition(this.tileGeoWidth,_5f,5);
}
var _62=_5f/this.tileGeoWidth;
this.totalOffsetX=this.totalOffsetX/_62;
this.totalOffsetY=this.totalOffsetY/_62;
this.tileGeoWidth=_5f;
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;
}
if(this.config.viewSettings.borders&&this.config.viewSettings.borders.active&&!this.mainMap){
var _63=this.getMapCenter();
var _64=this.checkBorders(_63);
this.setMapCenter(_64.x,_64.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 _65=Number.MAX_VALUE;
var _66=-1;
for(var i=0;i<this.fixedTileGeoWidths.length;i++){
var _68=Math.abs(this.tileGeoWidth-this.fixedTileGeoWidths[i]);
if(_68<_65){
_65=_68;
_66=i;
}
}
return _66;
};
SpatialAceMap.prototype.registerInfoLayer=function(_69){
if(!this.registeredCenterInfoLayers){
this.registeredCenterInfoLayers=new Array();
}
if(!this.registeredAreaInfoLayers){
this.registeredAreaInfoLayers=new Array();
}
this.registeredCenterInfoLayers.push(_69);
this.registeredAreaInfoLayers.push(_69);
};
SpatialAceMap.prototype.registerCenterInfoLayer=function(_6a){
if(!this.registeredCenterInfoLayers){
this.registeredCenterInfoLayers=new Array();
}
this.registeredCenterInfoLayers.push(_6a);
};
SpatialAceMap.prototype.registerAreaInfoLayer=function(_6b){
if(!this.registeredAreaInfoLayers){
this.registeredAreaInfoLayers=new Array();
}
this.registeredAreaInfoLayers.push(_6b);
};
SpatialAceMap.prototype.registerInfoLayerAreaAction=function(id,_6d){
if(!this.registeredInfoLayerAreaActions){
this.registeredInfoLayerAreaActions=new Object();
}
this.registeredInfoLayerAreaActions[id]=_6d;
};
SpatialAceMap.prototype.registerInfoLayerCenterAction=function(id,_6f){
if(!this.registeredInfoLayerCenterActions){
this.registeredInfoLayerCenterActions=new Object();
}
this.registeredInfoLayerCenterActions[id]=_6f;
};
SpatialAceMap.prototype.getInfoLayersString=function(_70){
var _71="";
for(var i=0;i<_70.length;i++){
if(_71!=""){
_71=_71+",";
}
_71=_71+_70[i];
}
return _71;
};
SpatialAceMap.prototype.getInfoLayerCenterInformation=function(_73){
if(!this.registeredInfoLayerCenterActions||!this.registeredCenterInfoLayers){
return null;
}
var _74=this.buildActionsQuery(this.registeredInfoLayerCenterActions);
var _75=this.getCurrentZoomIndex();
var _76=this.tileGeoWidth/this.scaleToGeoWidth;
if(_75!=-1){
_76=this.fixedInfoScaleSteps[_75];
}
var _77="&scale="+_76;
var _78=this.getInfoLayersString(this.registeredCenterInfoLayers);
if(_78==""){
return;
}
var _79="&layers="+_78;
var _7a=null;
if(this.fixedScales){
_7a=this.getInfoLayerCenter();
}else{
_7a=this.getMapCenter();
}
var _7b="&x="+_7a.x+"&y="+_7a.y;
var _7c="&responsetype=JSON";
var _7d=this.mapServerUrl+"RWCInterface.axd?request=GetGeoObjectsInfoAt&view="+this.viewName+_79+"&width="+this.tileSize+"&height="+this.tileSize+"&pixel-x-bottomright="+this.tileSize+"&pixel-y-bottomright="+this.tileSize+_77+_7b+_7c+_74;
if(_7d==this.lastGetGeoObjectsInfoAtRequest){
return;
}
this.lastGetGeoObjectsInfoAtRequest=_7d;
this.getInfoLayerCenterInformationCallback=_73;
this.getGeoObjectsInfoAtXmlHttp=new XMLHttpRequest();
this.getGeoObjectsInfoAtXmlHttp.open("GET",_7d,true);
this.getGeoObjectsInfoAtXmlHttp.onreadystatechange=associateObjWithCallback(this,this.onGetGeoObjectsInfoAtResponse);
this.getGeoObjectsInfoAtXmlHttp.send("");
};
SpatialAceMap.prototype.getInfoLayerAreaInformation=function(_7e){
if(!this.registeredInfoLayerAreaActions||!this.registeredAreaInfoLayers){
return null;
}
var _7f=this.buildActionsQuery(this.registeredInfoLayerAreaActions);
var _80=this.getCurrentZoomIndex();
var _81=this.tileGeoWidth/this.scaleToGeoWidth;
if(_80!=-1){
_81=this.fixedScaleSteps[_80];
}
var _82="&scale="+_81;
var _83=this.getInfoLayersString(this.registeredAreaInfoLayers);
if(_83==""){
return;
}
var _84="&layers="+_83;
var _85=null;
var _86=null;
var _87=null;
if(!this.fixedScales){
var _88=this.view.getTilesGeoBoundingBox();
if(!_88||!_88.centerPoint){
return;
}
_85=_88.centerPoint;
_86=this.tileSize*this.nCols;
_87=this.tileSize*this.nRows;
}else{
_85=this.getMapCenter();
_86=this.mapWidth;
_87=this.mapHeight;
}
var _89="&x="+_85.x+"&y="+_85.y;
var _8a="&responsetype=JSON";
var _8b=this.mapServerUrl+"RWCInterface.axd?request=GetGeoObjectsInfoIn&view="+this.viewName+_84+"&width="+_86+"&height="+_87+"&pixel-x-bottomright="+_86+"&pixel-y-bottomright="+_87+_82+_89+_8a+_7f;
this.getInfoLayerAreaInformationCallback=_7e;
this.getGeoObjectsInfoInXmlHttp=new XMLHttpRequest();
this.getGeoObjectsInfoInXmlHttp.open("GET",_8b,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 _8c=eval("("+this.getGeoObjectsInfoAtXmlHttp.responseText+")");
this.getInfoLayerCenterInformationCallback(true,_8c);
}
catch(e){
this.getInfoLayerCenterInformationCallback(false,this.getGeoObjectsInfoAtXmlHttp.responseText);
}
}
this.getInfoLayerCenterInformationCallback=null;
disposeXMLHttpObject(this.getGeoObjectsInfoAtXmlHttp);
this.getGeoObjectsInfoAtXmlHttp=null;
}
};
SpatialAceMap.prototype.onGetGeoObjectsInfoInResponse=function(){
if(this.getGeoObjectsInfoInXmlHttp&&this.getGeoObjectsInfoInXmlHttp.readyState==4){
if(this.getGeoObjectsInfoInXmlHttp.responseText){
try{
var _8d=eval("("+this.getGeoObjectsInfoInXmlHttp.responseText+")");
this.getInfoLayerAreaInformationCallback(true,_8d);
}
catch(e){
this.getInfoLayerAreaInformationCallback(false,this.getGeoObjectsInfoInXmlHttp.responseText);
}
}
this.getInfoLayerAreaInformationCallback=null;
disposeXMLHttpObject(this.getGeoObjectsInfoInXmlHttp);
this.getGeoObjectsInfoInXmlHttp=null;
}
};
SpatialAceMap.prototype.buildActionsQuery=function(_8e){
var _8f="";
if(_8e){
for(id in _8e){
if(typeof (_8e[id])!="function"&&_8e[id]){
if(_8f!=""){
_8f=_8f+",";
}
_8f=_8f+id+","+_8e[id];
}
}
}
if(_8f!=""){
_8f="&actions="+_8f;
}
return _8f;
};
SpatialAceMap.prototype.getInfoLayerCenter=function(){
if(!this.fixedScales||!this.fixedInfoScaleSteps){
return null;
}
var _90=this.getCurrentZoomIndex();
var _91=this.fixedInfoScaleSteps[_90];
var _92=this.getMapCenter();
var _93=_91*this.scaleToGeoWidth;
var _94=(Math.floor(_92.x/_93)*_93)+_93/2;
var _95=(Math.floor(_92.y/_93)*_93)+_93/2;
var _96=this.point(_94,_95);
return _96;
};
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(_97,top,_99,_9a){
if(!this.fixedScales){
if(_99<40){
_97=_97-((40-_99)/2);
_99=40;
}
if(_9a<40){
top=top-((40-_9a)/2);
_9a=40;
}
}
var _9b=_97+_99/2;
var _9c=top+_9a/2;
var _9d=this.mapWidth/2-_9b;
var _9e=this.mapHeight/2-_9c;
this.beginDrag();
this.drag(_9d,_9e);
this.endDrag();
var _9f=(_99/this.mapWidth);
var _a0=(_9a/this.mapHeight);
if(_9f>_a0){
var _a1=_99/this.mapWidth;
}else{
var _a1=_9a/this.mapHeight;
}
var _a2=this.tileGeoWidth*_a1;
if(this.fixedScales){
var _a3=Number.MAX_VALUE;
var _a4=_a2;
var _a5=0;
for(var i=0;i<this.fixedTileGeoWidths.length;i++){
var _a7=Math.abs(_a2-this.fixedTileGeoWidths[i]);
if(_a7<_a3){
_a3=_a7;
_a4=this.fixedTileGeoWidths[i];
var _a8=i;
}
}
if(this.zoomControl){
this.zoomControl.moveToZoomLevel(_a4);
}else{
this.setTileGeoWidth(_a4,false);
}
}else{
this.setTileGeoWidth(_a2,false);
}
};
SpatialAceMap.prototype.setTool=function(_a9){
this.currentTool=_a9;
if(_a9.cursor){
this.setCursor(_a9.cursor);
}else{
this.setCursor("crosshair");
}
};
SpatialAceMap.prototype.setCursor=function(_aa){
this.latestCursor=_aa;
this.mapContainer.style.cursor=_aa;
for(var i=0;i<this.view.layerArray.length;i++){
if(this.view.layerArray[i].container){
this.view.layerArray[i].container.style.cursor=_aa;
}
}
for(var i=0;i<this.view.overlayArray.length;i++){
if(this.view.overlayArray[i].container){
this.view.overlayArray[i].container.style.cursor=_aa;
}
}
};
SpatialAceMap.prototype.getGeoObjectsAt=function(_ac,_ad){
var _ae=this.tileGeoWidth/this.tileSize;
var _af=this.mapWidth*_ae;
var _b0=-this.totalOffsetX;
var _b1=this.totalOffsetY;
var _b2=this.initialGeoCenterX+_b0*_ae;
var _b3=this.initialGeoCenterY+_b1*_ae;
var _b4="";
var _b5="";
var _b6=false;
for(var i=0;i<this.view.overlayArray.length;i++){
if(!this.view.overlayArray[i].isUserLayer){
if(i!=0){
_b4+=",";
_b5+=",";
}
_b4+=this.view.overlayArray[i].id;
_b5+=this.view.overlayArray[i].name;
if(this.view.overlayArray[i].objectType=="wfs"){
_b6=true;
}
}
}
var _b8="";
if(_b6){
var _b9="&context-details=true";
var _ba="&outputFormat=JSON";
var _bb=10;
var _bc=_ac-(this.mapWidth/2);
var _bd=-(_ad-(this.mapHeight/2));
var _be=_b2+_bc*_ae;
var _bf=_b3+_bd*_ae;
var _c0=new ReferenceSystem(this.SRS);
var _c1=_c0.ConvertToKVPOrder(_be-_bb*_ae,_bf-_bb*_ae);
var _c2=_c0.ConvertToKVPOrder(_be+_bb*_ae,_bf+_bb*_ae);
var _c3="&bbox="+_c1[0]+","+_c1[1]+","+_c2[0]+","+_c2[1];
_b8=this.mapServerUrl+"OGCWFSInterface.axd?request=GetFeature&service=WFS&version=1.1.0"+"&view="+this.viewName+_ba+_c3+"&typeName="+_b5+_b9;
}else{
var _b9="&context-details=true";
var _ba="&responseType=JSON";
if(_b4!=""){
_b4="&layers="+_b4;
}
_b8=this.mapServerUrl+"RWCInterface.axd?request=GetGeoObjectsAt"+"&view="+this.viewName+_b4+"&width="+this.mapWidth+"&height="+this.mapHeight+"&geowidth="+_af+"&x="+_b2+"&y="+_b3+"&pixel-x="+_ac+"&pixel-y="+_ad+"&positions=true"+_b9+_ba;
}
this.addWorkItem();
this.getGeoObjectsAtXmlHttp=new XMLHttpRequest();
this.getGeoObjectsAtXmlHttp.onreadystatechange=associateObjWithCallback(this,this.onGetGeoObjectsAtResponse);
this.getGeoObjectsAtXmlHttp.open("GET",_b8,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 _c4=eval("("+this.getGeoObjectsAtXmlHttp.responseText+")");
}
catch(e){
this.removeWorkItem();
return;
}
if(this.config.GUI.detailedInfo.active){
this.drawDetailedInfoBox(_c4);
}
}
this.removeWorkItem();
disposeXMLHttpObject(this.getGeoObjectsAtXmlHttp);
this.getGeoObjectsAtXmlHttp=null;
}
};
SpatialAceMap.prototype.setSelectedObject=function(_c5){
if(this.selectedObject){
this.selectedObject.cancelSelection();
}
this.selectedObject=_c5;
if(this.selectedObject){
this.selectedObject.setSelected();
}
};
SpatialAceMap.prototype.drawDetailedInfoBox=function(_c6){
if(this.objectInfoContainer){
Evt.removeEventListener(this.infoClose,"click",this.infoCloseDelegate);
destroyNode(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(_c6.features.length>0){
var _c7=_c6.features[0];
for(var j=0;j<this.config.GUI.detailedInfo.parameters.length;j++){
var _c9=_c7.properties[this.config.GUI.detailedInfo.parameters[j].name];
if(_c9&&_c9!=""){
var _ca=false;
_ca=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(_c9);
this.objectInfoContainer.appendChild(pg);
break;
case ("image"):
var _cc=document.createElement("img");
setImageSource(_cc,_c9);
_cc.className="rwcDetailedInfoBoxImage";
this.objectInfoContainer.appendChild(_cc);
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,_ce){
Evt.removeEventListener(this.infoClose,"click",this.infoCloseDelegate);
destroyNode(this.objectInfoContainer);
this.objectInfoContainer=null;
};
SpatialAceMap.prototype.mapResized=function(evt,_d0){
if(this.resizeTimer){
clearTimeout(this.resizeTimer);
}
this.resizeTimer=setTimeout(associateObjWithEvent(this,"onResizeTimer"),200);
};
SpatialAceMap.prototype.onResizeTimer=function(evt,_d2){
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,_d5){
this.workItemCount++;
if(this.panControl){
if(this.panControl.progressIndicator){
setVisible(this.panControl.progressIndicator,this.workItemCount>0);
}
}
};
SpatialAceMap.prototype.removeWorkItem=function(evt,_d7){
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,_dc,_dd,_de){
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 _df=null;
if(typeof (top[this.config.GUI.lookingGlass.JSONConfigurationObject])!="undefined"){
_df=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,_de,this.prefix+"Mag",this.config.GUI.lookingGlass.configuration,this.prefix+"Mag",_dc,_dd,false,_df);
this.lookingGlass.noAdjust=true;
this.lookingGlass.initialize();
};
SpatialAceMap.prototype.lookingGlassMouseMove=function(evt,_e1){
var _e2=new Evt(evt);
var _e3=getPixelPositionFromEvent(_e2,this.mapContainer);
setX(this.lookingGlassContainer,_e3.x-75);
setY(this.lookingGlassContainer,_e3.y-75);
var _e4=this.getPosition(_e3.x,_e3.y);
this.lookingGlass.setNewCenter(_e4.x,_e4.y);
_e2.consume();
};
function ForwardMouseDown(evt){
var e;
if(!evt){
e=window.event;
}else{
e=evt;
}
map.tileMouseDown(e,0);
}
SpatialAceMap.prototype.drawOverlayRectangle=function(_e7,_e8,_e9){
destroyNode(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);
}
if(isIe6||isIe7){
this.mainMapRectangle.onmousedown=ForwardMouseDown;
}
this.mainMapRectangle.style.height=_e7+"px";
this.mainMapRectangle.style.width=_e8+"px";
var _ea=this.tileSize/this.tileGeoWidth;
centerOffsetX=(_e9.x-this.initialGeoCenterX)*_ea+this.mapWidth/2+this.totalOffsetX;
centerOffsetY=(_e9.y-this.initialGeoCenterY)*_ea+this.mapHeight/2-this.totalOffsetY;
var _eb=centerOffsetX-_e8/2;
var _ec=centerOffsetY-_e7/2;
if(!isNaN(_eb)&&!isNaN(_ec)){
setX(this.mainMapRectangle,_eb);
setY(this.mainMapRectangle,_ec);
}
};
SpatialAceMap.prototype.requestScaleBar=function(){
var _ed=new Array();
var _ee=this.getMapCenter();
var _ef=new Object();
_ef.y=_ee.y;
_ef.x=_ee.x+1;
_ed[0]=_ee;
_ed[1]=_ef;
if(!this.scaleBarDelegate){
this.scaleBarDelegate=associateObjWithCallback(this,this.drawScaleBar);
}
this.getDistances(_ed,this.scaleBarDelegate);
};
SpatialAceMap.prototype.drawScaleBar=function(_f0){
var _f1=this.config.GUI.scaleBar.maxSize;
if(this.config.GUI.scaleBar.unit=="imperial"){
var _f2=1.0936;
var _f3=(this.tileGeoWidth*_f0[0])/this.tileSize*_f2;
var _f4=(_f3*_f1);
if(_f4>1760){
var _f4=_f4/1760;
var _f5=true;
}
var _f4=_f4.toPrecision(1);
}else{
var _f3=(this.tileGeoWidth*_f0[0])/this.tileSize;
var _f4=(_f3*_f1).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(!_f5){
var _f6=Math.round(_f4/_f3);
}else{
var _f6=Math.round(_f4/(_f3/1760));
}
_f6-=6;
this.scaleBar.style.width=_f6+"px";
if(this.config.GUI.scaleBar.unit=="imperial"){
if(_f5){
this.scaleBar.innerHTML=_f4*1+"mi";
}else{
this.scaleBar.innerHTML=_f4*1+"yrds";
}
}else{
if(_f4>1000){
this.scaleBar.innerHTML=Math.round(_f4/1000)+"km";
}else{
this.scaleBar.innerHTML=_f4*1+"m";
}
}
};
SpatialAceMap.prototype.createLayerLegend=function(_f7,_f8){
var _f9=document.createElement("div");
for(var j=0;j<_f7.configuration.properties.length;j++){
if(_f7.configuration.properties[j].type=="defaultImage"||_f7.configuration.properties[j].type=="conditionalImage"){
var _fb=document.createElement("img");
_fb.className="rwcLegendImage";
if(_f7.configuration.properties[j].value!=null&&_f7.configuration.properties[j].value!=""&&_f7.configuration.properties[j].type=="defaultImage"){
if(_f8){
setImageSource(_fb,_f7.configuration.properties[j].value);
}else{
_fb.src=_f7.configuration.properties[j].value;
}
}else{
if(_f7.configuration.properties[j].image.image&&_f7.configuration.properties[j].image.image!=""){
if(_f8){
setImageSource(_fb,_f7.configuration.properties[j].image.image);
}else{
_fb.src=_f7.configuration.properties[j].image.image;
}
}
}
_f9.appendChild(_fb);
if(_f7.configuration.properties[j].label&&_f7.configuration.properties[j].label!=""){
var _fc=document.createElement("span");
_fc.innerHTML=_f7.configuration.properties[j].label;
_f9.appendChild(_fc);
}
lineBreak=document.createElement("br");
_f9.appendChild(lineBreak);
}
}
return _f9;
};
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 _fd;
if(this.fixedScales){
var _fe=-1;
for(var i=0;i<this.fixedTileGeoWidths.length;i++){
if(this.tileGeoWidth==this.fixedTileGeoWidths[i]){
_fe=i;
break;
}
}
if(_fe==0){
return;
}
var _100=Math.max(0,_fe-1);
_fd=this.fixedTileGeoWidths[_100];
}else{
_fd=this.tileGeoWidth*0.5;
}
if(this.fixedScales&&this.zoomControl){
this.zoomControl.moveToZoomLevel(_fd);
}else{
this.setTileGeoWidth(_fd,true);
}
};
SpatialAceMap.prototype.zoomOut=function(){
if(this.mainMap){
this.mainMap.zoomOut();
return;
}
if(!this.initialized){
return;
}
var _101;
if(this.fixedScales){
var _102=Number.MAX_VALUE;
for(var i=0;i<this.fixedTileGeoWidths.length;i++){
if(this.tileGeoWidth==this.fixedTileGeoWidths[i]){
_102=i;
break;
}
}
if(_102==(this.fixedTileGeoWidths.length-1)){
return;
}
var _104=Math.min(this.fixedTileGeoWidths.length-1,_102+1);
_101=this.fixedTileGeoWidths[_104];
}else{
_101=this.tileGeoWidth*2;
}
if(this.fixedScales&&this.zoomControl){
this.zoomControl.moveToZoomLevel(_101);
}else{
this.setTileGeoWidth(_101,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 _107=this.tileGeoWidth/this.tileSize;
var _108=new Object();
_108.x=this.initialGeoCenterX-(this.totalOffsetX*_107);
_108.y=this.initialGeoCenterY+(this.totalOffsetY*_107);
return _108;
};
SpatialAceMap.prototype.setMapCenter=function(x,y){
if(!this.initialized||isNaN(x)||isNaN(y)){
return;
}
var _10b=this.tileSize/this.tileGeoWidth;
var _10c=-(x-this.initialGeoCenterX)*_10b-this.totalOffsetX;
var _10d=(y-this.initialGeoCenterY)*_10b-this.totalOffsetY;
if(_10c==0&&_10d==0){
return;
}
this.rescalingFactor=1;
this.beginDrag();
this.drag(Math.round(_10c),Math.round(_10d));
this.endDrag();
};
SpatialAceMap.prototype.getScale=function(){
if(!this.initialized){
return;
}
var _10e=this.tileGeoWidth/this.scaleToGeoWidth;
return _10e;
};
SpatialAceMap.prototype.setScale=function(_10f){
if(!this.initialized||!_10f||isNaN(_10f)||_10f<=0){
return;
}
if(this.MainMap){
if(this.linkMap.scaleModel=="factor"){
var _110=_10f/this.linkMap.scaleValue;
this.MainMap.setScale(_110);
}
return;
}
newTileGeoWidth=_10f*this.scaleToGeoWidth;
if(this.fixedScales){
var _111=Number.MAX_VALUE;
var _112=_10f*this.scaleToGeoWidth;
for(var i=0;i<this.fixedTileGeoWidths.length;i++){
var diff=Math.abs(_112-this.fixedTileGeoWidths[i]);
if(diff<_111){
_111=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 _115=new Array();
for(var i=0;i<this.fixedScaleSteps.length;i++){
_115[i]=this.fixedScaleSteps[i];
}
return _115;
}else{
return null;
}
};
SpatialAceMap.prototype.createGeoObject=function(x,y,_119,_11a,type,_11c,_11d){
if(!this.initialized){
return;
}
var _11e=this.getOrCreateLayer(_11a);
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<_11c.length;i++){
var p=new Array();
p.push(_11c[i].x);
p.push(_11c[i].y);
geoObjectNode.geometry.coordinates.push(p);
}
}else{
if(type=="multipolygon"){
geoObjectNode.properties.geoType="#polygon";
geoObjectNode.geometry.type="MultiPolygon";
}
}
}
}
}
}
var _121=new GeoObject(geoObjectNode,_11e,false,_11c);
if(_119&&_119!=""){
_121.id=_119;
_121.noId=false;
}
if(!_11e.geoObjectArray){
_11e.geoObjectArray=new Array();
}
_11e.insertObject(_121,_11d);
for(var i=0;i<this.onObjectUpdatedEventHandlers.length;i++){
this.onObjectUpdatedEventHandlers[i](this,_121,_121.id,"createGeoObject");
}
return _121;
};
SpatialAceMap.prototype.createGeoObjectFromGeoJSON=function(_122,_123,_124,_125){
var _126=this.getOrCreateLayer(_124);
var _127=new GeoObject(_122,_126,false,null);
if(_123&&_123!=""){
_127.id=_123;
_127.noId=false;
}
if(!_126.geoObjectArray){
_126.geoObjectArray=new Array();
}
_126.insertObject(_127,_125);
for(var i=0;i<this.onObjectUpdatedEventHandlers.length;i++){
this.onObjectUpdatedEventHandlers[i](this,_127,_127.id,"createGeoObject");
}
return _127;
};
SpatialAceMap.prototype.getOrCreateLayer=function(_129){
var _12a=this.getObjectLayerById(_129);
if(!_12a){
var _12a=this.getLayerById(_129);
if(!_12a||!_12a.haveClientObjects){
if(!_129||_129==""){
_129="userLayer"+Math.random();
}
_12a=new OverlayLayer(_129,_129,0,this,false,false,false);
var _12b=this.config.getLayerConfiguration("");
_12a.createDefaults(_12b,null);
_12a.noUpdate=true;
_12a.isUserLayer=true;
this.view.overlayArray.push(_12a);
}else{
_12a=_12a.geoObjectLayer;
}
}
return _12a;
};
SpatialAceMap.prototype.removeGeoObject=function(_12c,_12d){
if(!this.initialized){
return false;
}
var _12e=this.view.getObjectLayerById(_12d);
if(_12e){
return _12e.removeGeoObject(_12c);
}
return false;
};
SpatialAceMap.prototype.getGeoObject=function(_12f,_130){
if(!this.initialized){
return;
}
var _131=this.view.getObjectLayerById(_130);
if(_131){
var _132=_131.getGeoObjectById(_12f);
if(_132){
return _132;
}
}
return null;
};
SpatialAceMap.prototype.getGeoObjectsArray=function(_133){
if(!this.initialized){
return;
}
var _134=this.view.getObjectLayerById(_133);
if(_134&&_134.geoObjectArray){
var _135=_134.geoObjectArray;
return _135;
}
return null;
};
SpatialAceMap.prototype.centerOnGeoObject=function(_136,_137){
if(!this.initialized){
return false;
}
var _138=this.view.getObjectLayerById(_137);
if(_138){
var _139=_138.getGeoObjectById(_136);
if(_139){
this.setMapCenter(_139.point.x,_139.point.y);
return true;
}
}
return false;
};
SpatialAceMap.prototype.addObjectLayer=function(_13a,_13b,_13c,_13d){
if(!this.initialized){
return;
}
var _13e=this.config.getLayerConfiguration(_13b);
var _13f=false;
layer=new OverlayLayer(_13a,_13a,_13a,this,_13f,_13d);
if(_13c){
layer.searchEnabled=_13c;
}
layer.createDefaults(_13e,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(_140){
if(this.initialized){
return this.view.getLayerById(_140);
}
};
SpatialAceMap.prototype.getObjectLayerById=function(_141){
if(this.initialized){
return this.view.getObjectLayerById(_141);
}
};
SpatialAceMap.prototype.removeObjectLayer=function(_142){
if(!this.initialized){
return false;
}
for(var i=0;i<this.view.overlayArray.length;i++){
if(this.view.overlayArray[i].id==_142){
if(this.selectedObject&&this.selectedObject.layer.id==_142){
this.setSelectedObject(null);
}
this.view.overlayArray[i].unload();
destroyNode(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,_146){
this.projectPointTo(x,y,this.refSystem,"World.WGS84lola",_146);
};
SpatialAceMap.prototype.latLongToMap=function(x,y,_149){
this.projectPointTo(x,y,"World.WGS84lola",this.refSystem,_149);
};
SpatialAceMap.prototype.projectPointTo=function(x,y,_14c,_14d,_14e){
this.callback=_14e;
var _14f=this.mapServerUrl+"RWCInterface.axd?request=ProjectPointTo"+"&x="+x+"&y="+y+"&from="+_14c+"&to="+_14d+"&responsetype=JSON";
if(this.pointXmlHttp&&this.pointXmlHttp.readyState>0){
disposeXMLHttpObject(this.pointXmlHttp);
this.removeWorkItem();
}
this.addWorkItem();
this.pointXmlHttp=new XMLHttpRequest();
this.pointXmlHttp.onreadystatechange=associateObjWithCallback(this,this.onProjectPointToResponse);
this.pointXmlHttp.open("GET",_14f,true);
this.pointXmlHttp.send("");
};
SpatialAceMap.prototype.onProjectPointToResponse=function(){
if(this.pointXmlHttp&&this.pointXmlHttp.readyState==4){
if(this.pointXmlHttp.responseText){
try{
var _150=eval("("+this.pointXmlHttp.responseText+")");
}
catch(e){
this.removeWorkItem();
return;
}
disposeXMLHttpObject(this.pointXmlHttp);
this.pointXmlHttp=null;
var _151=_150.ProjectedPoint;
var x=parseFloat(_150.ProjectedPoint.X);
var y=parseFloat(_150.ProjectedPoint.Y);
this.removeWorkItem();
this.callback(x,y);
return;
}
disposeXMLHttpObject(this.pointXmlHttp);
this.pointXmlHttp=null;
}
};
SpatialAceMap.prototype.reorderLayer=function(_154,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==_154){
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(_157,_158){
if(!this.initialized){
return;
}
var json="&responsetype=JSON";
var view="&view="+this.viewName;
var _15b="&points=";
_15b+=_157[0].x+","+_157[0].y;
for(var i=1;i<_157.length;i++){
_15b+=","+_157[i].x+","+_157[i].y;
}
var _15d=this.mapServerUrl+"RWCInterface.axd?request=GetGreatCircleDistances"+view+_15b+"&refsys="+this.refSystem+json;
if(!this.getDistanceQueue){
this.getDistanceQueue=new Array();
}
if(this.getDistanceRequestActive==true){
var _15e=new Object();
_15e.points=_157;
_15e.callback=_158;
this.getDistanceQueue.push(_15e);
return;
}
this.getDistanceRequestActive=true;
if(_158){
this.getDistanceCallback=_158;
}
if(this.getDistancesXmlHttp){
disposeXMLHttpObject(this.getDistancesXmlHttp);
}
this.getDistancesXmlHttp=new XMLHttpRequest();
this.getDistancesXmlHttp.onreadystatechange=associateObjWithCallback(this,this.getDistanceResponse);
this.getDistancesXmlHttp.open("GET",_15d,true);
this.getDistancesXmlHttp.send("");
};
SpatialAceMap.prototype.getDistanceResponse=function(){
if(this.getDistancesXmlHttp&&this.getDistancesXmlHttp.readyState==4){
if(this.getDistancesXmlHttp.responseText){
var _15f=new Array();
try{
var _160=eval("("+this.getDistancesXmlHttp.responseText+")");
}
catch(e){
disposeXMLHttpObject(this.getDistancesXmlHttp);
this.getDistancesXmlHttp=null;
return;
}
for(var i=0;i<_160.distances.length;i++){
_15f.push(parseFloat(_160.distances[i].d));
}
if(this.getDistanceCallback){
this.getDistanceCallback(_15f);
}
}
this.getDistanceRequestActive=false;
if(this.getDistanceQueue&&this.getDistanceQueue.length>0){
var _162=this.getDistanceQueue[0].points;
var _163=this.getDistanceQueue[0].callback;
this.getDistanceQueue.splice(0,1);
this.getDistances(_162,_163);
return;
}
}
};
SpatialAceMap.prototype.createObjectList=function(_164,_165){
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(_164){
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 _168=document.createElement("img");
_168.className="rwcLegendImage";
if(this.view.overlayArray[i].configuration.properties[j].image.image&&this.view.overlayArray[i].configuration.properties[j].image.image!=""){
setImageSource(_168,this.view.overlayArray[i].configuration.properties[j].image.image);
}
legendDiv.appendChild(_168);
if(this.view.overlayArray[i].configuration.properties[j].label&&this.view.overlayArray[i].configuration.properties[j].label!=""){
var _169=document.createElement("span");
_169.innerHTML=this.view.overlayArray[i].configuration.properties[j].label;
legendDiv.appendChild(_169);
}
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 _16b=this.view.overlayArray[i].geoObjectArray[k].createInfo(_165);
_16b.className="rwcListInfoBox";
_16b.style.position="relative";
_16b.style.lineHeight="18px";
if(_165){
var _16c=document.createElement("span");
_16c.innerHTML=k+1+".";
_16b.insertBefore(_16c,_16b.firstChild);
}
this.objectList.appendChild(_16b);
}
}
}
return this.objectList;
};
SpatialAceMap.prototype.setClickTool=function(_16d){
if(this.clickTool&&this.clickTool.cancel){
this.clickTool.cancel();
}
switch(_16d){
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[_16d])=="function"){
this.clickTool=new top[_16d](this,this.prefix);
}else{
this.clickTool=null;
}
break;
}
};
SpatialAceMap.prototype.mapToScreenCoordinates=function(x,y){
if(!this.initialized){
return;
}
var _170=new Object();
var _171=this.tileSize/this.tileGeoWidth;
_170.x=(x-this.initialGeoCenterX)*_171+this.mapWidth/2+this.totalOffsetX;
_170.y=(this.initialGeoCenterY-y)*_171+this.mapHeight/2+this.totalOffsetY;
return _170;
};
SpatialAceMap.prototype.whatsAt=function(_172,_173){
var _174=map.getPosition(_172.x,_172.y);
var _175=this.tileSize/this.tileGeoWidth;
var _176=new Array();
for(var i=0;i<this.view.overlayArray.length;i++){
for(var j=0;j<this.view.overlayArray[i].geoObjectArray.length;j++){
if(this.view.overlayArray[i].geoObjectArray[j].type=="point"){
var _179=_175*distance2D(this.view.overlayArray[i].geoObjectArray[j].point,_174);
if(_179<_173){
_176.push(this.view.overlayArray[i].geoObjectArray[j]);
}
}else{
if(this.view.overlayArray[i].geoObjectArray[j].type=="line"){
var _17a=_175*pointToLineDistance2D(_174,this.view.overlayArray[i].geoObjectArray[j].points);
if(_17a<_173){
_176.push(this.view.overlayArray[i].geoObjectArray[j]);
}
}else{
if(this.view.overlayArray[i].geoObjectArray[j].type=="poly"){
var _17a=_175*pointToLineDistance2D(_174,this.view.overlayArray[i].geoObjectArray[j].points);
var _17b=pointInPolygon2D(_174,this.view.overlayArray[i].geoObjectArray[j].points);
if(_17b||_17a<_173){
_176.push(this.view.overlayArray[i].geoObjectArray[j]);
}
}else{
if(this.view.overlayArray[i].geoObjectArray[j].type=="multipoint"){
for(var k=0;k<this.view.overlayArray[i].geoObjectArray[j].points.lenth;k++){
var _179=_175*distance2D(this.view.overlayArray[i].geoObjectArray[j].points[k],_174);
if(_179<_173){
_176.push(this.view.overlayArray[i].geoObjectArray[j]);
break;
}
}
}else{
if(this.view.overlayArray[i].geoObjectArray[j].type=="multiline"){
for(var k=0;k<this.view.overlayArray[i].geoObjectArray[j].points.lenth;k++){
var _17a=_175*pointToLineDistance2D(_174,this.view.overlayArray[i].geoObjectArray[j].points[k]);
if(_17a<_173){
_176.push(this.view.overlayArray[i].geoObjectArray[j]);
break;
}
}
}else{
if(this.view.overlayArray[i].geoObjectArray[j].type=="multipolygon"){
for(var k=0;k<this.view.overlayArray[i].geoObjectArray[j].points.lenth;k++){
var _17a=_175*pointToLineDistance2D(_174,this.view.overlayArray[i].geoObjectArray[j].points[k]);
var _17b=pointInPolygon2D(_174,this.view.overlayArray[i].geoObjectArray[j].points[k]);
if(_17b||_17a<_173){
_176.push(this.view.overlayArray[i].geoObjectArray[j]);
break;
}
}
}
}
}
}
}
}
}
}
return _176;
};
SpatialAceMap.prototype.whatsIn=function(minX,minY,maxX,maxY){
var _181=map.getPosition(minX,minY);
var _182=map.getPosition(maxX,maxY);
return this.getGeoObjectsBySelection(_182.X,_182.Y,_181.X,_181.Y);
};
SpatialAceMap.prototype.getGeoObjectsBySelection=function(maxX,maxY,minX,minY){
var _187=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){
_187.push(this.view.overlayArray[i].geoObjectArray[j]);
}
}
}
}
return _187;
};
SpatialAceMap.prototype.createObjectSelectionList=function(_18a,_18b){
var _18c=document.createElement("div");
for(var i=0;i<_18a.length;i++){
var _18e=_18a[i].createInfo(false);
_18e.className="rwcListInfoBox";
_18e.style.position="relative";
_18e.style.lineHeight="18px";
if(_18b&&_18a[i].type=="point"){
var _18f=document.createElement("img");
_18f.src=_18a[i].icon.image;
_18e.insertBefore(_18f,_18e.firstChild);
}
_18c.appendChild(_18e);
}
return _18c;
};
SpatialAceMap.prototype.setDefaultTool=function(_190){
this.setDragTool(_190,true);
};
SpatialAceMap.prototype.setDragTool=function(_191,_192){
if(this.manipulationActive==true){
this.currentTool.cancelManipulation();
}
this.manipulationActive=false;
if(this.currentTool&&this.currentTool.deactivate){
this.currentTool.deactivate();
}
switch(_191){
case ("select"):
this.defaultTool=this.selectionTool;
this.shiftTool=this.zoomTool;
this.altTool=this.panTool;
break;
case ("zoom"):
this.defaultTool=this.zoomTool;
if(_192){
this.shiftTool=this.panTool;
}
this.altTool=this.selectionTool;
break;
case ("pan"):
this.defaultTool=this.panTool;
if(_192){
this.shiftTool=this.zoomTool;
}
this.altTool=this.selectionTool;
break;
default:
if(typeof (top[_191])=="function"){
this.defaultTool=new top[_191](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(!_192){
this.shiftTool=null;
this.altTool=null;
}
this.setTool(this.defaultTool);
};
SpatialAceMap.prototype.printMap=function(_193,_194,_195){
if(!this.initialized){
return;
}
destroyNode(this.printArea);
destroyNode(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";
destroyNode(this.printImage);
document.body.appendChild(this.printArea);
var _196=this.getGeoObjectsBySelection(this.mapWidth,this.mapHeight,0,0);
for(var i=0;i<this.view.overlayArray.length;i++){
var _198=document.createElement("span");
_198.innerHTML=this.view.overlayArray[i].name+"<br>";
var _199=this.createLayerLegend(this.view.overlayArray[i],false);
_199.className="rwcPrintLegend";
this.printArea.appendChild(_198);
this.printArea.appendChild(_199);
}
if(_194){
var _19a=this.createObjectSelectionList(_196,false);
}
if((isMozilla||isFireFox)&&this.view.overlayArray.length>0){
var _19b="&layers=";
for(var i=0;i<this.view.layerArray.length;i++){
if(_19b!="&layers="){
_19b+=",";
}
if(!this.view.layerArray[i].isHidden){
_19b+=this.view.layerArray[i].id;
}
}
for(var i=0;i<this.view.overlayArray.length;i++){
if(!this.view.overlayArray[i].isHidden){
if(_19b!="&layers="){
_19b+=",";
}
_19b+=this.view.overlayArray[i].id;
}
}
var _19c=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 _19d=this.getMapCenter();
this.printImage.src=this.mapServerUrl+"RWCInterface.axd?view="+this.viewName+"&format=gif&transparent=true"+"&width="+this.mapWidth+"&height="+this.mapHeight+"&scale="+_19c+"&x="+_19d.x+"&y="+_19d.y;
this.mapContainer.insertBefore(this.printImage,this.view.overlayArray[0].container);
}else{
if(isIe6){
destroyNode(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<_196.length;i++){
if(_196[i].type=="point"){
var _19e=document.createElement("img");
_19e.src=_196[i].icon.image;
_19e.className="rwcMarker";
_19e.style.height=_196[i].icon.height;
_19e.style.width=_196[i].icon.width;
setX(_19e,_196[i].viewX-_196[i].iconOffsetX/2);
setY(_19e,_196[i].viewY-_196[i].iconOffsetY/2);
this.printOverlay.appendChild(_19e);
}
}
this.mapContainer.insertBefore(this.printOverlay,this.view.overlayArray[0].container);
}
}
if(_194){
this.printArea.appendChild(_19a);
}
window.print();
};
SpatialAceMap.prototype.zoomToObjects=function(_19f,_1a0,_1a1){
if(!this.initialized||_19f==null||_19f.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<_19f.length;i++){
if(_19f[i].type=="point"){
if(_19f[i].point.x>xMax){
xMax=_19f[i].point.x;
}
if(_19f[i].point.y>yMax){
yMax=_19f[i].point.y;
}
if(_19f[i].point.x<xMin){
xMin=_19f[i].point.x;
}
if(_19f[i].point.y<yMin){
yMin=_19f[i].point.y;
}
}else{
if(_19f[i].type=="poly"||_19f[i].type=="line"||_19f[i].type=="multipoint"){
for(var j=0;j<_19f[i].points.length;j++){
if(_19f[i].points[j].x>xMax){
xMax=_19f[i].points[j].x;
}
if(_19f[i].points[j].y>yMax){
yMax=_19f[i].points[j].y;
}
if(_19f[i].points[j].x<xMin){
xMin=_19f[i].points[j].x;
}
if(_19f[i].points[j].y<yMin){
yMin=_19f[i].points[j].y;
}
}
}else{
for(var k=0;k<_19f[i].points.length;k++){
for(var j=0;j<_19f[i].points[k].length;j++){
if(_19f[i].points[k][j].x>xMax){
xMax=_19f[i].points[k][j].x;
}
if(_19f[i].points[k][j].y>yMax){
yMax=_19f[i].points[k][j].y;
}
if(_19f[i].points[k][j].x<xMin){
xMin=_19f[i].points[k][j].x;
}
if(_19f[i].points[k][j].y<yMin){
yMin=_19f[i].points[k][j].y;
}
}
}
}
}
}
var _1a9=xMax-xMin;
var _1aa=yMax-yMin;
var _1ab=xMax-_1a9/2;
var _1ac=yMax-_1aa/2;
if(_1a0){
var _1ad=this.tileGeoWidth/this.tileSize;
var xMod=(_1a0*2);
var yMod=(_1a0*2);
}else{
var xMod=0;
var yMod=0;
}
var _1b0=this.tileSize/this.mapContainer.offsetHeight;
var _1b1=this.tileSize+(_1b0*xMod);
var _1b2=this.tileSize+(_1b0*yMod);
var _1b3=_1a9*(_1b1/this.mapContainer.offsetWidth);
var _1b4=_1b3/this.scaleToGeoWidth;
var _1b5=_1aa*(_1b2/this.mapContainer.offsetHeight);
var _1b6=_1b5/this.scaleToGeoWidth;
var _1b7=Math.max(_1b4,_1b6);
if(typeof (_1a1)!="undefined"&&_1a1!=null&&!isNaN(_1a1)){
_1b7=Math.max(_1a1,_1b7);
}
this.setArea(_1ab,_1ac,_1b7);
};
SpatialAceMap.prototype.setArea=function(x,y,_1ba){
if(!this.initialized){
return;
}
var _1bb=_1ba;
if(this.fixedScales){
_1bb=this.fixedScaleSteps[this.fixedScaleSteps.length-1];
for(var i=this.fixedScaleSteps.length-1;i>=0;i--){
if(this.fixedScaleSteps[i]>=_1ba){
_1bb=this.fixedScaleSteps[i];
}else{
break;
}
}
}else{
var _1bd=this.tileGeoWidth/this.scaleToGeoWidth;
if(_1bb/_1bd<0.05){
_1bb=0.05*_1bd;
}
}
var _1be=this.tileGeoWidth;
this.tileGeoWidth=_1bb*this.scaleToGeoWidth;
this.view.setTileGeoWidth(this.tileGeoWidth);
var _1bf=this.tileSize/this.tileGeoWidth;
var _1c0=this.totalOffsetX;
var _1c1=this.totalOffsetY;
this.totalOffsetX=-(x-this.initialGeoCenterX)*_1bf;
this.totalOffsetY=(y-this.initialGeoCenterY)*_1bf;
if(this.totalOffsetX!=_1c0||this.totalOffsetY!=_1c1){
this.view.offset(Math.round(this.totalOffsetX),Math.round(this.totalOffsetY));
}
if(this.zoomControl){
this.zoomControl.refreshZoomLevel(this.tileGeoWidth);
}
if(this.totalOffsetX!=_1c0||this.totalOffsetY!=_1c1||this.tileGeoWidth!=_1be){
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();
}
}
for(var i=0;i<this.onNewGeoRectEventHandlers.length;i++){
this.onNewGeoRectEventHandlers[i](this);
}
};
SpatialAceMap.prototype.setClickCallback=function(func){
this.clickCallback=func;
};
SpatialAceMap.prototype.registerOnClickEventHandler=function(_1c3){
if(typeof (_1c3)=="function"){
this.onClickEventHandlers.push(_1c3);
}
};
SpatialAceMap.prototype.registerOnBeforeUpdateEventHandler=function(_1c4){
if(typeof (_1c4)=="function"){
this.onBeforeUpdateEventHandlers.push(_1c4);
}
};
SpatialAceMap.prototype.registerOnAfterUpdateEventHandler=function(_1c5){
if(typeof (_1c5)=="function"){
this.onAfterUpdateEventHandlers.push(_1c5);
}
};
SpatialAceMap.prototype.registerOnNewGeoRectEventHandler=function(_1c6){
if(typeof (_1c6)=="function"){
this.onNewGeoRectEventHandlers.push(_1c6);
}
};
SpatialAceMap.prototype.registerOnClientSearchEventHandler=function(_1c7){
if(typeof (_1c7)=="function"){
this.onClientSearchEventHandlers.push(_1c7);
}
};
SpatialAceMap.prototype.registerOnMouseOverEventHandler=function(_1c8){
if(typeof (_1c8)=="function"){
this.onMouseOverEventHandlers.push(_1c8);
}
if(isOpera||!this.mouseMovePositionDelegate){
this.mouseMovePositionDelegate=associateObjWithEvent(this,"onMouseMovePosition");
Evt.addEventListener(document,"mousemove",this.mouseMovePositionDelegate);
}
};
SpatialAceMap.prototype.registerOnMouseOutEventHandler=function(_1c9){
if(typeof (_1c9)=="function"){
this.onMouseOutEventHandlers.push(_1c9);
}
if(isOpera||!this.mouseMovePositionDelegate){
this.mouseMovePositionDelegate=associateObjWithEvent(this,"onMouseMovePosition");
Evt.addEventListener(document,"mousemove",this.mouseMovePositionDelegate);
}
};
SpatialAceMap.prototype.registerOnFullyUpdatedEventHandler=function(_1ca){
if(typeof (_1ca)=="function"){
this.onFullyUpdatedEventHandlers.push(_1ca);
}
};
SpatialAceMap.prototype.registerOnObjectUpdatedEventHandler=function(_1cb){
if(typeof (_1cb)=="function"){
this.onObjectUpdatedEventHandlers.push(_1cb);
}
};
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 _1ce=this.getMapCenter();
var _1cf=this.tileGeoWidth/this.tileSize;
return new GeoRectangle(_1ce.x+_1cf*(this.embedDiv.offsetWidth/2),_1ce.y+_1cf*(this.embedDiv.offsetHeight/2),_1ce.x-_1cf*(this.embedDiv.offsetWidth/2),_1ce.y-_1cf*(this.embedDiv.offsetHeight/2));
};
SpatialAceMap.prototype.getAllLayers=function(){
if(!this.initialized){
return;
}
var _1d0=new Array();
if(this.view.layerArray){
_1d0=_1d0.concat(this.view.layerArray);
}
if(this.view.overlayArray){
_1d0=_1d0.concat(this.view.overlayArray);
}
return _1d0;
};
SpatialAceMap.prototype.initiateGeoCodingComponent=function(_1d1){
this.geoCodingLayer=this.addObjectLayer(this.prefix+"GeoCoding","geoCoding",_1d1);
};
SpatialAceMap.prototype.geoCodingQuery=function(_1d2,_1d3,_1d4,_1d5,_1d6,_1d7){
if(!this.geoCodingLayer){
this.initiateGeoCodingComponent(false);
}
if(_1d2){
var _1d8="&address="+encodeURIComponent(_1d2);
}else{
return;
}
if(_1d3){
countryString="&country="+_1d3;
}else{
countryString="";
}
if(_1d4){
var _1d9="&bbox="+_1d4.xMin+","+_1d4.yMin+","+_1d4.xMax+","+_1d4.yMax;
}else{
var _1d9="";
}
if(_1d5){
var _1da="max="+_1da;
}else{
var _1da="";
}
if(_1d6){
}
this.gcXmlHttp=new XMLHttpRequest();
this.gcXmlHttp.open("GET",mapServerUrl+"RWCProxy.axd?proxy=geoCoding&request=locate&return=json"+_1d8+countryString+_1d9+_1da,true);
this.gcXmlHttp.onreadystatechange=associateObjWithCallback(this.geoCodingLayer,this.geoCodingLayer.onGetGeoObjectsResponse);
this.gcXmlHttp.send("");
};
SpatialAceMap.prototype.updatePrintImage=function(_1db,_1dc,_1dd){
destroyNode(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 _1de="&format="+this.config.viewSettings.imageFormat;
var _1df;
var _1e0=Math.round((this.tileGeoWidth*this.geoWidthToScale)-2);
_1df="&scale="+_1e0;
var _1e1=this.getAllLayers();
var _1e2="";
for(var i=0;i<_1e1.length;i++){
if(!_1e1[i].isHidden){
if(_1e1[i].type=="combinedImage"){
for(var j=0;j<_1e1[i].sublayerID.length;j++){
if(!_1e1[i].sublayerID[j].isHidden){
if(_1e2!=""){
_1e2+=",";
}
_1e2+=_1e1[i].sublayerID[j].id;
}
}
}else{
if(_1db||_1e1[i].type!="objects"){
if(_1e2!=""){
_1e2+=",";
}
_1e2+=_1e1[i].id;
}
}
}
this.mapRequestString="";
if(_1dc){
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];
}
}
}
}
}
_1e2="&layers="+_1e2;
var _1e5=this.getMapCenter();
var _1e6=this.mapServerUrl+"RWCInterface.axd?view="+this.viewName+_1de+"&transparent=false"+_1e2+"&width="+this.mapContainer.offsetWidth+"&height="+this.mapContainer.offsetHeight+_1df+"&x="+_1e5.x+"&y="+_1e5.y+this.mapRequestString;
var _1e7="";
if(_1dd){
var _1e8;
var _1e9=Math.floor((this.config.viewSettings.requestMaxLength-_1e6.length)/8);
if(_1e9>0){
_1e7=this.encodeClientObjects(_1dd,this.screenBounds,_1e9);
}
}
this.printImage.src=_1e6+_1e7;
};
SpatialAceMap.prototype.encodeClientObjects=function(_1ea,_1eb,_1ec){
if(!_1ea){
return;
}
clientObjectString="";
var _1ed=0;
var _1ee=0;
var _1ef=0;
for(var i=0;i<_1ea.length;i++){
if(_1ea[i].points){
if(_1ea[i].points){
var _1f1=_1ea[i].points;
}else{
var _1f1=_1ea[i].point;
}
var _1f1=RWCClipToRectangle(_1ea[i],_1eb,_1ec,2);
var _1f2=new Object();
if(_1f1&&_1f1.length>0){
if(_1ea[i].type=="poly"){
var _1f3=_1ea[i].type+_1ee;
_1ee++;
}else{
if(_1ea[i].type=="line"){
var _1f3=_1ea[i].type+_1ed;
_1ed++;
}else{
if(_1ea[i].type=="point"){
var _1f3=_1ea[i].type+_1ef;
_1ef++;
}
}
}
clientObjectString+="&"+_1f3+"="+RWCEncodePointList(_1f1,_1f2);
clientObjectString+="&sh="+_1f2.value;
}
}
}
return clientObjectString;
};
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){
}
if(this.getDistancesXmlHttp){
disposeXMLHttpObject(this.getDistancesXmlHttp);
this.getDistancesXmlHttp=null;
}
if(this.getViewsXmlHttp){
disposeXMLHttpObject(this.getViewsXmlHttp);
this.getViewsXmlHttp=null;
}
};
RWCBuiltInOnNewGeoRect=function(map){
map.geoRect=map.getGeoRect();
var _1f6=new Array();
_1f6.push(map.point(map.geoRect.xMax,map.geoRect.yMax));
_1f6.push(map.point(map.geoRect.xMin,map.geoRect.yMax));
_1f6.push(map.point(map.geoRect.xMin,map.geoRect.yMin));
_1f6.push(map.point(map.geoRect.xMax,map.geoRect.yMin));
map.screenBounds=new BoundingArea(null,_1f6,"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;
destroyNode(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;
}
}
destroyNode(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){
}
destroyNode(this.node);
this.node=null;
}
destroyNode(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()){
destroyNode(_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 destroyNode(o){
if(typeof (o)!="undefined"&&o!=null&&o.parentNode){
if(isIe6||isIe7){
var gb=document.getElementById("leakPatchDiv");
if(!gb){
gb=document.createElement("DIV");
gb.id="leakPatchDiv";
gb.style.display="none";
document.body.appendChild(gb);
}
gb.appendChild(o);
gb.innerHTML="";
}else{
o.parentNode.removeChild(o);
}
o=null;
}
}
function RWCEncodeSignedNumber(n){
var sn=n<<1;
if(n<0){
sn=~(sn);
}
return (RWCEncodeNumber(sn));
}
function RWCEncodeNumber(num){
var _69="";
while(num>=32){
_69+=(String.fromCharCode((32|(num&31))+63));
num>>=5;
}
_69+=(String.fromCharCode(num+63));
return _69;
}
function RWCClipToRectangle(_6a,_6b,_6c,_6d){
var _6e=new Array();
if(!_6a.boundingArea.boundingAreaInside(_6b)){
return _6e;
}
if(!_6a.points){
return _6a.point;
}else{
if(_6a.points.length<2){
return _6a.points;
}
}
if(_6a.type=="line"){
var _6f=_6b.lineInside(_6a.points,false);
if(_6f==-1){
return null;
}
var _70=_6b.lineInside(_6a.points,true);
_6e=_6a.points.slice(_6f,_70+1);
}else{
if(_6a.type=="poly"){
_6e=_6a.points;
}
}
var _71=Math.max((_6b.maxX-_6b.minX),(_6b.maxY-_6b.minY));
var _72=_6d;
var _73=_71/(_6c*_72);
while(_6e.length>_6c&&_6e.length>4){
tmppoints=new Array();
var n=_6e.length;
tmppoints.push(_6e[0]);
for(var i=1;i<n-1;i++){
var _76=_6e[i];
tmppoints.push(_6e[i]);
while(i<(n-2)){
var _77=distance2D(_76,_6e[i+1]);
if(_77<_73){
i++;
}else{
break;
}
}
}
tmppoints.push(_6e[n-1]);
_6e=tmppoints;
_72=_72/1.4;
_73=_71/(_6c*_72);
}
return _6e;
}
function disposeXMLHttpObject(obj){
if(obj){
delete obj["onreadystatechange"];
if(isFireFox||isMozilla){
obj.onreadystatechange=null;
}
}
obj=null;
if(top["CollectGarbage"]){
CollectGarbage();
}
}
if(!window.XMLHttpRequest){
XMLHttpRequest=function(){
var _79=null;
try{
_79=new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e){
try{
_79=new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e){
}
}
return _79;
};
}

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 ("WFS"):
case ("objects"):
if(!this.saMap.config.viewSettings.disableObjectLayers){
var _12=new OverlayLayer(id,_8,i,this.saMap,_a,_b,_e,_d);
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&&this.overlayArray[i].geoObjectArray[j].id==this.lastSelectedGeoObject.id){
return;
}
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(){
destroyNode(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++){
destroyNode(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>";
disposeXMLHttpObject(this.getViewsXmlHttp);
this.getViewsXmlHttp=null;
return;
}
try{
this.json=eval("("+this.getViewXmlHttp.responseText+")");
}
catch(e){
disposeXMLHttpObject(this.getViewsXmlHttp);
this.getViewsXmlHttp=null;
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="";
}
disposeXMLHttpObject(this.getViewsXmlHttp);
this.getViewsXmlHttp=null;
}
};
ViewList.prototype.unload=function(){
if(this.getViewsXmlHttp){
disposeXMLHttpObject(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){
destroyNode(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);
}
destroyNode(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);
}
destroyNode(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();
destroyNode(this.container);
this.container=null;
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(){
destroyNode(this.container);
this.container=null;
};
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();
}
destroyNode(this.container);
this.container=null;
};
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;
}

function ReferenceSystem(_1){
var _2=_1.split(":");
if(_2.length==2){
this.code=_2[1];
}else{
if(_2.length==7){
this.code=_2[6];
}else{
this.code=4326;
}
}
this.CalculateAxisOrder();
}
ReferenceSystem.prototype.CalculateAxisOrder=function(){
if((this.code>32600&&this.code<32661)||(this.code>32700&&this.code<32761)){
this.axisDirection="EN";
}else{
switch(this.code){
case 2400:
case 3006:
case 3019:
case 3034:
case 4124:
case 4326:
case 51004:
case 51005:
case 51006:
this.axisDirection="NE";
break;
case 3395:
case 3785:
this.axisDirection="EN";
break;
case 32661:
case 32761:
this.axisDirection="NE";
break;
default:
this.axisDirection="NE";
break;
}
}
};
ReferenceSystem.prototype.HaveXYAxisOrder=function(){
if(this.axisDirection=="EN"){
return true;
}else{
return false;
}
};
ReferenceSystem.prototype.ConvertToXyOrder=function(a,b){
if(this.HaveXYAxisOrder()){
return new Array(a,b);
}else{
return new Array(b,a);
}
};
ReferenceSystem.prototype.ConvertToKVPOrder=function(x,y){
if(this.HaveXYAxisOrder()){
return new Array(x,y);
}else{
return new Array(y,x);
}
};

// position.js: make edge-positioning work on IE/Win
// version 0.5, 15-Jul-2003
// written by Andrew Clover <and@doxdesk.com>, use freely

/*@cc_on
@if (@_win32 && @_jscript_version>4)

var position_h= new Array();
var position_v= new Array();
var position_viewport;
var position_width= 0;
var position_height= 0;
var position_fontsize= 0;
var position_ARBITRARY= 200;

// Binding. Called on each new element; if the it's <body>, initialise script.
// Check all new elements to see if they need our help, make lists of them

function position_bind(el) {
  if (!position_viewport) {
    if (!document.body) return;
    // initialisation
    position_viewport= (document.compatMode=='CSS1Compat') ?
      document.documentElement : document.body;
    window.attachEvent('onresize', position_delayout);
    var em= document.createElement('div');
    em.setAttribute('id', 'position_em');
    em.style.position= 'absolute'; em.style.visibility= 'hidden';
    em.style.fontSize= 'xx-large'; em.style.height= '5em';
    em.style.top='-5em'; em.style.left= '0';
    em.style.width = position_checkFont();
    document.body.appendChild(em);
  }

  // check for absolute edge-positioned elements (ignore ones from fixed.js!)
  var st= el.style; var cs= el.currentStyle;
  if (cs.position=='absolute' && !st.fixedPWidth) {
    if (cs.left!='auto' && cs.right!='auto') {
      position_h[position_h.length]= el;
      st.position_width= position_ARBITRARY;
      st.width= st.position_width+'px';
      position_delayout();
    }
    if (cs.top!='auto' && cs.bottom!='auto') {
      position_v[position_v.length]= el;
      st.position_height= position_ARBITRARY;
      st.height= st.position_height+'px';
      position_delayout();
  } }
}

function position_checkFont() { position_delayout(); return '1em'; }

// Layout. For each edge-positioned axis, measure difference between min-edge
// and max-edge positioning, set size to the difference

// Request re-layout at next available moment
var position_delaying= false;
function position_delayout() {
  if (position_delaying) return;
  position_delaying= true;
  window.setTimeout(position_layout, 0);
}

function position_layout() {
  position_delaying= false;
  var i, el, st, pos, tmp;
  var fs= document.all['position_em'].offsetWidth;
  var newfs= (position_fontsize!=fs && position_fontsize!=0);
  position_fontsize= fs;

  // horizontal axis
  if (position_viewport.clientWidth!=position_width || newfs) {
    position_width= position_viewport.clientWidth;
    for (i= position_h.length; i-->0;) {
      el= position_h[i]; st= el.style; cs= el.currentStyle;
      pos= el.offsetLeft; tmp= cs.left; st.left= 'auto';
      st.position_width+= el.offsetLeft-pos; st.left= tmp;
      if (st.position_width<1) st.position_width= 1;
      st.width= st.position_width+'px';
  } }
  // vertical axis
  if (position_viewport.clientHeight!=position_height || newfs) {
    position_height= position_viewport.clientHeight;
    for (i= position_v.length; i-->0;) {
      el= position_v[i]; st= el.style; cs= el.currentStyle;
      pos= el.offsetTop; tmp= cs.top; st.top= 'auto';
      st.position_height+= el.offsetTop-pos; st.top= tmp;
      if (st.position_height<1) st.position_height= 1;
      st.height= st.position_height+'px';
  } }
}

// Scanning. Check document every so often until it has finished loading. Do
// nothing until <body> arrives, then call main init. Pass any new elements
// found on each scan to be bound   

var position_SCANDELAY= 500;

var position_nscanned= 0;
function position_scan() {
  var nall= document.all.length;
  for (var i= position_nscanned; i<nall; i++)
    position_bind(document.all[i]);
  position_nscanned= nall;
}

var position_scanner;
function position_stop() {
  window.clearInterval(position_scanner);
  position_scan();
}

position_scan();
position_scanner= window.setInterval(position_scan, position_SCANDELAY);
window.attachEvent('onload', position_stop);

@end @*/
