1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| //Options click sur établissement
var optionsClickEtab = {
hover: true,
clickout: true,
toggle: false,
overFeature: function(feature) {
popUP(feature);
},
clickoutFeature: function(feature) {
map.removePopup(popup);
}
};
function popUP(e) {
// Je verifie qu'aucun popup n'existe deja
if(typeof popup!='undefined'){
popup.destroy();
}
//je definis les params de mon popup
var htmlContent = "<b>Id : <a href='/AffichEtabl.php?objectid="+e.attributes.id_etab+"'>"+e.attributes.id_etab+"</a></b><br /> <b><i>Type : "+e.attributes.type_etab+"</b></i><br /><b><i>Commune : "+e.attributes.nom_communaute+"</b></i>";
var size = new OpenLayers.Size(20,34);
var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
//j'instancie mon popup
popup = new OpenLayers.Popup.FramedCloud(
e.fid,
e.geometry.getBounds().getCenterLonLat(),
null,
htmlContent,
null,
false,
null
);
//Je l'ajoute a la carte
map.addPopup(popup);
}
//Déclaration de l'évènement de sélection des établissements
var selectEgliseCat = new OpenLayers.Control.SelectFeature(eglise_cathedrale, optionsClickEtab);
selectEgliseCat.setMap(map);
selectEgliseCat.activate();
var selectEgliseCol = new OpenLayers.Control.SelectFeature(eglise_collegiale, optionsClickEtab);
selectEgliseCol.setMap(map);
selectEgliseCol.activate(); |
Partager