
OpenLayers.GreaseOl.Layer.GreaseLayer=OpenLayers.Class(OpenLayers.Layer,{greaseId:null,imgContdiv:null,initialize:function(name,greaseId,options){var newArguments=arguments;newArguments=[name,options];OpenLayers.Layer.prototype.initialize.apply(this,newArguments);this.greaseId=greaseId;this.imgContdiv=document.createElement('div');this.imgContdiv.id=OpenLayers.Util.createUniqueID("OpenLayersDivCnt-"+this.greaseId);this.imgContdiv.style.top=(0)+"px";this.imgContdiv.style.left=(0)+"px";this.imgContdiv.style.position="absolute";this.div.appendChild(this.imgContdiv);},destroy:function(){this.greaseId=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments);this.imgContdiv=null;},clone:function(obj){if(obj==null){obj=new OpenLayers.GreaseOl.Layer.GreaseLayer(this.name,this.greaseId,this.options);}
obj=OpenLayers.Layer.prototype.clone.apply(this,[obj]);return obj;},clearImages:function(){this.imgContdiv.innerHTML="";},updateImages:function(servizioCorrente){this.clearImages();var leftN=parseInt(this.map.layerContainerDiv.style.left);var topN=parseInt(this.map.layerContainerDiv.style.top);var ret='ko';if(servizioCorrente==null||servizioCorrente.images==null||servizioCorrente.images.length<=0)return ret;var size=this.map.getSize();this.imgContdiv.style.top=(0-topN-size.h)+"px";this.imgContdiv.style.left=(0-leftN-size.w)+"px";this.imgContdiv.style.width=(size.w*3)+"px";this.imgContdiv.style.height=(size.h*3)+"px";for(var i=0;i<servizioCorrente.images.length;i++){if(servizioCorrente.images[i]!=null&&servizioCorrente.images[i].imageUrl!=null){ret='ok';var newImager=document.createElement('img');newImager.id=OpenLayers.Util.createUniqueID("OpenLayersDivImg-"+this.greaseId);newImager.style.top=(size.h+servizioCorrente.images[i].offsetTop)+"px";newImager.style.left=(size.w+servizioCorrente.images[i].offsetLeft)+"px";newImager.style.width=servizioCorrente.images[i].dimx;newImager.style.height=servizioCorrente.images[i].dimy;newImager.style.position="absolute";newImager.style.overflow="visible";newImager.src=servizioCorrente.images[i].imageUrl;this.imgContdiv.appendChild(newImager);}}
this.setOpacity(parseFloat(servizioCorrente.opacity)+0.001);return ret;},setOpacity:function(opacity){if(opacity!=this.opacity){this.opacity=opacity;OpenLayers.Util.modifyDOMElement(this.imgContdiv,null,null,null,null,null,null,opacity);}},CLASS_NAME:"OpenLayers.GreaseOl.Layer.GreaseLayer"});
