var iugisSlider=null;
var serviziConfigurati=new Array();
var popupIdentify=null;
function zoomIndirizzoIugis(currentPosizioneIndirizzo) {
//alert("zoomIndirizzo: " + currentPosizioneIndirizzo.posizioneX + " " + currentPosizioneIndirizzo.posizioneY);
//#{action.currentPosizioneIndirizzo.posizioneX}, #{action.currentPosizioneIndirizzo.posizioneY}
/*var bounds = new OpenLayers.Bounds();
bounds.extend(new OpenLayers.LonLat(currentPosizioneIndirizzo.posizioneX-200,currentPosizioneIndirizzo.posizioneY-200));
bounds.extend(new OpenLayers.LonLat(currentPosizioneIndirizzo.posizioneX+200,currentPosizioneIndirizzo.posizioneY+200));
bounds.toBBOX();*/
if (currentPosizioneIndirizzo==null ||
currentPosizioneIndirizzo.posizioneX == null ||
currentPosizioneIndirizzo.posizioneY == null ||
currentPosizioneIndirizzo.posizioneX == 0 ||
currentPosizioneIndirizzo.posizioneY==0 ) return 444;
try {
var xmin=currentPosizioneIndirizzo.posizioneX-200;
var ymin=currentPosizioneIndirizzo.posizioneY-200;
var xmax=currentPosizioneIndirizzo.posizioneX+200;
var ymax=currentPosizioneIndirizzo.posizioneY+200;
mappe[0].zoomToExtents(xmin,ymin,xmax,ymax);
} catch (err) {
//console.error(err);
}
try {
var centrox=currentPosizioneIndirizzo.posizioneX;
var centroy=currentPosizioneIndirizzo.posizioneY;
var indirizzoLayer=null;
var lll=mappe[0].mappaOl.getLayersByName("indirizzoLayer");
if (lll!=null && lll.length>0) {
for (var markerCount=0;markerCount",newlev);
url=url.replace("",x);
url=url.replace("",y);
return url;
}
function extendRefreshMap () {
OpenLayers.GreaseOl.MainMapOL.prototype.refreshMap = (function (old) {
return function () {
var result=3;
var a=document.getElementById(this.getIdForm()+":elencoServiziId_"+this.getIdMappa()).value;
this.serviziToRefresh=a.split('|');
var accesi=new Array();
var almenoUnaChiamataAjax=false;
for (var i=0;i//.jpg"
,{ 'type':'jpg', 'getURL':getUrlFromCfg
,projection: new OpenLayers.Projection("EPSG:32632")
,units: 'm'
,numZoomLevels: 2
,maxResolution: 1831.0546875
,maxExtent: new OpenLayers.Bounds(185625,4779625,654375,5248375)
})
]});
this.mappaOl.addControl(panel_overview);
//coordinate del mounse
this.mappaOl.addControl(new OpenLayers.Control.MousePosition({numDigits:0,prefix:"[UTM-WGS84] "}));
// scala
this.mappaOl.addControl(new OpenLayers.Control.ScaleLine());
fullToggleControl('PAN',defaultMapCmdOptions['PAN']);
if (regionePiemonte==true) attivaEventiPopUp();
else attivaEventiPopUp();
//TODO aggiungere altre eventuali customizzazioni
return result;
};
})(OpenLayers.GreaseOl.MainMapOL.prototype.initMap);
}
function extendToggleCtrl() {
OpenLayers.GreaseOl.MainMapOL.prototype.toggleControl = (function (old) {
return function (baseType,extendedType) {
//var result = old.apply(this, arguments);
var result="asd";
var keyToActivate=null;
var options=extendedType;
//console.debug(baseType +"--->"+extendedType);
for(var key in this.olcontrolli) {
//console.debug(" "+key);
var control = this.olcontrolli[key];
//if(key!=null && key.indexOf(attivato+"_mapNO")==0) {
//var options=defaultMapCmdOptions[extendedType];
if(key!=null && key.indexOf(baseType)==0) {
keyToActivate=key;
} else {
try {
control.deactivate();
} catch (err) {
//console.debug(key+"++"+err);
}
}
}
alert(keyToActivate);
if (null!=keyToActivate) {
alert(keyToActivate);
if (options!=null) {
document.getElementById(this.getIdForm()+":comando").value=options.command;
try { var tmpRet=this.olcontrolli[keyToActivate].setGreaseOptions(options); } catch (errA) { }
var cssStyle=null;
if (options.cursorClass !==undefined && options.cursorClass!=null) cssStyle= options.cursorClass;
else if (this.olcontrolli[keyToActivate].cssStyle && this.olcontrolli[keyToActivate].cssStyle!=null) cssStyle=this.olcontrolli[keyToActivate].cssStyle;
this.mappaOl.div.style.cursor='';
if (this.prevCssStyle!=null) gisJQuery(this.mappaOl.div).removeClass(this.prevCssStyle);
if (cssStyle!=null) gisJQuery(this.mappaOl.div).addClass(cssStyle);
this.prevCssStyle=cssStyle;
}
if (keyToActivate!="DRAW_MODIFY") {
this.lastControlKey=keyToActivate;
this.lastControlOption=options;
}
this.olcontrolli[keyToActivate].activate();
}
return result;
};
})(OpenLayers.GreaseOl.MainMapOL.prototype.toggleControl);
}
function extendOlLayer() {
OpenLayers.GreaseOl.Layer.GreaseLayer.prototype.updateImages = (function (old) {
return function (servizioCorrente) {
var res=111;
// alert("updateImages");
this.clearImages();
progressBars[0].hideProgress(servizioCorrente.idServizio);
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;
//this.setOpacity(parseFloat(servizioCorrente.opacity));
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 cntImages=0;cntImages"+progressBars[i].getIdMap());
progressBars[i].progressReset();
}
}
}
OpenLayers.GreaseOl.GreaseProgressBar=OpenLayers.Class ({},{
idForm:null,
idBar:null,
idMap:null,
timeout:null,
serviziToRefresh:new Array(),
timeoutID:null,
initialize: function(idFormIn,idBarIn,idMapIn,timeoutIn) {
this.idForm=idFormIn;
this.idBar=idBarIn;
this.idMap=idMapIn;
this.timeout=timeoutIn;
this.serviziToRefresh=new Array();
this.timeoutID=null;
},
destroy: function() {
this.idForm=null;
this.idBar=null;
this.idMap=null;
this.timeout=null;
this.serviziToRefresh=null;
this.timeoutID=null;
},
clone: function (obj) {
obj = new OpenLayers.GreaseOl.GreaseProgressBar(this.idForm,this.idBar,this.idMap,this.timeout);
return obj;
},
forceHideProgress: function () {
// gisJQuery(document.getElementById(this.idForm+":"+this.idBar+"_progressBarBlock")).hide();
// this.serviziToRefresh=new Array();
// if (this.timeout>0) {
// window.clearTimeout(this.timeoutID);
// }
// this.proressOn=true;
},
getIdMap: function () {
return this.idMap;
},
accendiProgress: function () {
//var elemento=document.getElementById(this.idForm+":"+this.idBar+"_progressBarBlock");
var elemento=document.getElementById("loadmappa");
if (gisJQuery(elemento).css('display')=='none') {
try {
gisJQuery("#loadmappa").css('display','block');
} catch (err) {
//console.error(err);
}
if (this.timeout>0) {
this.timeoutID=window.setTimeout(
'resetProgressBars(\''+this.idMap+'\');'
, this.timeout);
}
}
},
showProgress : function () {
/*
var a=document.getElementById(this.idForm+":elencoServiziId_"+this.idMap).value;
var tmpToRefresh=new Array();
if (a== undefined || a==null || a.trim()=="") {
tmpToRefresh=new Array();
} else {
tmpToRefresh=a.split('|');
}
for (var countRfh=0;countRfh0) this.accendiProgress();
*/
},
progressReset: function (){
// this.forceHideProgressB();
//gisJQuery(document.getElementById(this.idForm+":"+this.idBar+"_progressBarBlock")).hide();
gisJQuery("#loadmappa").css('display','none');
this.serviziToRefresh=new Array();
if (this.timeout>0) {
window.clearTimeout(this.timeoutID);
}
this.proressOn=true;
},
addClientService : function (idClientService) {
this.serviziToRefresh[this.serviziToRefresh.length]=idClientService;
if (this.serviziToRefresh.length>0) this.accendiProgress();
},
hideProgress : function (idServizio) {
var serviziTMP=new Array();
for (var i=0;i"+servizioCorrente);
//alert("aggiornaLayerGrease");
var stato='ko';
var mappaCur=null;
for (var i =0;i0) {
for (var markerCount=0;markerCount0) {
for (var markerCount=0;markerCountprova
';
if (idResult!=null) {
feature.data.popupContentHTML = document.getElementById(idResult).innerHTML;
}
feature.data.icon=icon.clone();
feature.popupClass=OpenLayers.Class(OpenLayers.Popup.FramedCloud, {
'autoSize': true,
'panMapIfOutOfView': false,
'minSize': new OpenLayers.Size(200,200),
'maxSize': new OpenLayers.Size(400,400)
});
indirizzoLayer.events.registerPriority("click", feature, markerClick);
//feature.popup.show();
var marker = feature.createMarker();
indirizzoLayer.addMarker(marker);
feature.popup = feature.createPopup(true);
mappe[0].mappaOl.addPopup(feature.popup);
} catch(ess) {
//console.error(ess);
}
}
/*
function addMarkerAzienda(envelopeWeb) {
try {
if (envelopeWeb==undefined || envelopeWeb==null ) return -1;
var style_blue = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']);
var centrox=envelopeWeb.sudovest.coordX+((envelopeWeb.nordest.coordX-envelopeWeb.sudovest.coordX)/2);
var centroy=envelopeWeb.sudovest.coordY+((envelopeWeb.nordest.coordY-envelopeWeb.sudovest.coordY)/2);
var indirizzoLayer=null;
clearMarkerIndirizzo();
var markerClick = function (evt) {
if (this.popup == null) {
this.popup = this.createPopup(this.closeBox);
mappe[0].mappaOl.addPopup(this.popup);
this.popup.show();
} else {
this.popup.toggle();
}
currentPopup = this.popup;
OpenLayers.Event.stop(evt);
};
indirizzoLayer = new OpenLayers.Layer.Markers( "indirizzoLayer" );
mappe[0].mappaOl.addLayer(indirizzoLayer);
var sizeOrig = new OpenLayers.Size(21,41);
var size = new OpenLayers.Size(42,42);
var offset = new OpenLayers.Pixel(-(sizeOrig.w/2), -sizeOrig.h);
//var icon = new OpenLayers.Icon(OpenLayers.ImgPath+"puntatore_giallo.gif",size,offset);
var icon = new OpenLayers.Icon(OpenLayers.ImgPath+"marker_yellow.png",size,offset);
//var icon = new OpenLayers.Icon("./marker_shadow.png",size,offset);
var feature = new OpenLayers.Feature(indirizzoLayer,new OpenLayers.LonLat(centrox,centroy));
feature.closeBox = true;
feature.data.overflow='auto';
//feature.data.popupContentHTML = 'prova
';
//feature.data.popupContentHTML = document.getElementById(idResult).innerHTML;
feature.data.icon=icon.clone();
feature.popupClass=OpenLayers.Class(OpenLayers.Popup.FramedCloud, {
'autoSize': true,
'panMapIfOutOfView': false,
'minSize': new OpenLayers.Size(200,200),
'maxSize': new OpenLayers.Size(400,400)
});
indirizzoLayer.events.registerPriority("click", feature, markerClick);
//feature.popup.show();
var marker = feature.createMarker();
indirizzoLayer.addMarker(marker);
//feature.popup = feature.createPopup(true);
//mappe[0].mappaOl.addPopup(feature.popup);
} catch(ess) {
//console.error(ess);
}
}
*/
Richfaces.PanelBar.Slide.prototype.showContent = (function (old) {
return function () {
var res=old.apply(this, arguments);
if (this.item.id=="mappaForm:tabLivelliTrasparenze") {
rerenderTabtrasparenze();
}
return res;
};
})(Richfaces.PanelBar.Slide.prototype.showContent);
/*
Richfaces.PanelBar.prototype.initialize = (function (old) {
return function (panelId, options) {
var res=old.apply(this, arguments);
iugisSlider=this;
return res;
};
})(Richfaces.PanelBar.prototype.initialize);
Richfaces.PanelBar.prototype.showSlideById = (function (old) {
return function (panelId) {
for(var i = 0; i