var RaveGeoAppletMap;
(function(){
function RaveGeoAppletMap_updateExpireDate(_1){
if(_1._expireDate<new Date()){
var _2=_1;
RaveGeoUtils.asyncJSONReq(_1.handleURL,function(_3){
if(_3.error){
_2._errorOccurred(_3.error.code,_3.error.message);
return;
}
var _4=_3.timeout;
_2._expireDate=new Date();
_2._expireDate.setTime(_2._expireDate.getTime()+_4);
},RaveGeoUtils.getHandleTimeout);
}
}
RaveGeoAppletMap=function(_5){
var _6=this.applet=document.getElementById(_5.appletId);
this.handleURL=_5.url+"GetHandle?isApplet=true&name="+_5.name;
this.callback=_5.callback;
this.userDiv=document.getElementById(_5.userDivId);
this._expireDate=new Date();
this._expireDate.setTime(0);
RaveGeoAppletMap_updateExpireDate(this);
RaveGeoAppletMap.appletMaps[this.applet.id]=this;
if(!RaveGeoUtils.isJavaEnabled()){
throw new Error("Java does not seem to be enabled.");
}
try{
this.applet.isInitializedOk();
}
catch(e){
throw new Error("Java does not seem to be enabled.");
}
var _7=RaveGeoUtils.defaultInteractionDelay;
if(typeof (_5.interactionDelay)!="undefined"){
_7=_5.interactionDelay;
if(_7>RaveGeoUtils.maxInteractionDelay||_7<0){
_7=RaveGeoUtils.maxInteractionDelay;
}
}
this._params=_5;
this.applet.setCallbackId(this.applet.id,_7);
};
RaveGeoAppletMap.prototype._mapLoaded=function(){
var _8=this._params;
delete this._params;
if(_8.labelStyle){
var _9=_8.labelStyle;
if(!_9.borderColor){
_9.borderColor="";
}
if(!_9.backgroundColor){
_9.backgroundColor="";
}
if(!_9.textColor){
_9.textColor="";
}
this.applet.setLabelStyle(_9.borderColor,_9.backgroundColor,_9.textColor);
}
if(_8.textStyle){
var _9=_8.textStyle;
if(!_9.borderColor){
_9.borderColor="";
}
if(!_9.backgroundColor){
_9.backgroundColor="";
}
if(!_9.textColor){
_9.textColor="";
}
this.applet.setTextStyle(_9.borderColor,_9.backgroundColor,_9.textColor);
}
if(_8.highlightColor){
this.applet.setHighlightColor(_8.highlightColor);
}
if(_8.copyright){
this.applet.setCopyright(_8.copyright);
}
if(_8.initialViewArea){
this.applet.setViewArea(_8.initialViewArea.x,_8.initialViewArea.y,_8.initialViewArea.scale);
}
this.applet.style.width=this.userDiv.clientWidth+"px";
this.applet.style.height=this.userDiv.clientHeight+"px";
RaveGeoUtils.removeChildren(this.userDiv,this.applet);
if(_8.initialSymbols){
var _a=_8.initialSymbols;
for(var id in _a){
var _c=_a[id];
this.addSymbol(_c,true);
}
this.redraw();
}
if(this.callback&&this.callback.mapLoaded){
this.callback.mapLoaded(this);
}
};
RaveGeoAppletMap.prototype._errorOccurred=function(_d,_e){
this.userDiv.innerHTML="Fatal error: "+_d+"<br>"+_e;
if(this.callback&&this.callback.errorOccurred){
this.callback.errorOccurred(_d,_e);
}
};
RaveGeoAppletMap.prototype._symbolClicked=function(id){
if(this.callback&&this.callback.symbolClicked){
this.callback.symbolClicked(this,id);
}
};
RaveGeoAppletMap.prototype._mapClicked=function(x,y){
if(this.callback&&this.callback.mapClicked){
this.callback.mapClicked(this,x,y);
}
};
RaveGeoAppletMap.prototype._interactionEnded=function(){
RaveGeoAppletMap_updateExpireDate(this);
if(this.callback&&this.callback.interactionEnded){
this.callback.interactionEnded(this);
}
};
RaveGeoAppletMap.prototype.getCenterX=function(){
return this.applet.getCenterX();
};
RaveGeoAppletMap.prototype.getCenterY=function(){
return this.applet.getCenterY();
};
RaveGeoAppletMap.prototype.getScale=function(){
return this.applet.getScale();
};
RaveGeoAppletMap.prototype.getGeoBounds=function(){
return eval("("+this.applet.getGeoBounds()+")");
};
RaveGeoAppletMap.prototype.getRecommendedScales=function(){
return eval("("+this.applet.getRecommendedScales()+")");
};
RaveGeoAppletMap.prototype.setViewArea=function(x,y,_14){
this.applet.setViewArea(x,y,_14);
};
RaveGeoAppletMap.prototype.clearSymbols=function(){
this.applet.clearSymbols();
};
RaveGeoAppletMap.prototype.addSymbol=function(sym,_16){
if(typeof (sym.symbol)=="undefined"){
sym.symbol=null;
}
if(!(typeof sym.text=="string")){
sym.text=null;
}
if(!(typeof sym.label=="string")){
sym.label=null;
}
_16=_16?true:false;
this.applet.addSymbol(sym.id,sym.x,sym.y,sym.symbol,sym.text,sym.label,_16);
};
RaveGeoAppletMap.prototype.redraw=function(){
this.applet.redraw();
};
RaveGeoAppletMap.prototype.getSymbolIds=function(_17){
return eval("("+this.applet.getSymbolIds(_17?true:false)+")");
};
RaveGeoAppletMap.prototype.getSymbol=function(id){
return eval("("+this.applet.getSymbol(id)+")");
};
RaveGeoAppletMap.prototype.removeSymbol=function(id,_1a){
_1a=_1a?true:false;
this.applet.removeSymbol(id,_1a);
};
RaveGeoAppletMap.prototype.zoom=function(_1b){
this.applet.zoom(_1b);
};
RaveGeoAppletMap.prototype.zoomTo=function(_1c){
this.applet.zoomTo(_1c);
};
RaveGeoAppletMap.prototype.pan=function(dx,dy){
this.applet.pan(dx,dy);
};
RaveGeoAppletMap.prototype.moveTo=function(x,y,_21){
this.applet.moveTo(x,y,_21);
};
RaveGeoAppletMap.prototype.showSymbols=function(_22){
this.applet.showSymbols(_22);
};
RaveGeoAppletMap.prototype.highlightSymbol=function(id,_24){
if(typeof (_24)=="undefined"){
_24={};
}
if(typeof (_24.center)=="undefined"){
_24.center="";
}
if(typeof (_24.showText)=="undefined"){
_24.showText=false;
}
if(typeof (_24.showHighlight)=="undefined"){
_24.showHighlight=false;
}
this.applet.highlightSymbol(id,_24.center,_24.showText,_24.showHighlight);
};
RaveGeoAppletMap.prototype.resize=function(_25,_26){
this.applet.style.width=_25+"px";
this.applet.style.height=_26+"px";
this.userDiv.style.width=_25+"px";
this.userDiv.style.height=_26+"px";
};
RaveGeoAppletMap.initiateCreation=function(_27){
new RaveGeoAppletMap(_27);
};
RaveGeoAppletMap.appletMaps={};
})();

