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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
|
// Bouton RECHERCHE PAR NOM DE COMMUNES
if (P_Pltf != "ACCUEIL") // ON DESACTIVE LA RECHERCHE SUR LA PAGE D'ACCUEIL
{
var tbx5 = viewer.getMap().getControlsByClass('Geoportal.Control.ToolBox')[0];
WCoRech = tbx5.id+'_search';
var B_Recherche = new Geoportal.Control.Panel({
div:OpenLayers.Util.getElement(WCoRech)
});
// style pour afficher le nom de la ville sélectionnée
var style_geocoded = new OpenLayers.StyleMap(
{
"default": new OpenLayers.Style(
{
externalGraphic : './Images/Recherche2_32x32.png',
pointRadius:20,
fillText:'black',
label:'${labelg}',
// labelBackgroundColor:'black',
fontFamily:'Comic Sans MS',
fontSize:'12',
fontWeight:'bold',
fontColor:'white',
labelOutlineColor: "#000000", // Police blanche avec contour noir
labelOutlineWidth: 3 // Police blanche avec contour noir
},
{
context: {
labelg: function(f)
{
return f.data.address.places[0].name+', ('+f.data.address.postalCode.name+')';
}
}
}
)
}
);
//FIN
//Ajout du contrôle de recherche avec VILLE
var GeoNames = new Geoportal.Control.LocationUtilityService.GeoNames(
new Geoportal.Layer.OpenLS.Core.LocationUtilityService(
"PositionOfInterest:OPENLS;Geocode",//layer name
{
formatOptions: {},
styleMap:style_geocoded, //Application du style pour le nom de la ville sélectionnée.
marker: "./Images/Recherche2_32x32.png",/* entrer ici l'URL de l'image */
radius: 20 // redéfinition de la taille de l'image (optionnel)
}
),
{
drawLocation:true,
// setZoom: Geoportal.Control.LocationUtilityService.GeoNames.setZoomForBDNyme,
uiOptions:{title: 'gpControlLocationUtilityService.GeoNames.title'},
setZoom:function(f)
{
var z = 11;// Initialisation du ZOOM en cas de résultat positif
return z;
},
autoCompleteOptions:
{
// Permet d'empêcher la sélection automatique d'une ville au survol de la liste de présélections.
highlightOver: function(index) {
this.highlightIndex= index+1;
this.highlightProposal(false); // annule la transmission à l'input
}
}
}
);
nv.addControls([GeoNames]);
// Application d'un style au bouton
WIconeRech = "./Images/Recherche2.png";
// var B_RechHTML = document.getElementsByClassName("gpControlLocationUtilityServiceGeocodeItemInactive")[0]; // POUR VILLE, ADRESSE, CP
var B_RechHTML = document.getElementsByClassName("gpControlLocationUtilityServiceGeoNamesItemInactive")[0]; // POUR VILLE UNIQUEMENT
B_RechHTML.style.background = 'none'; // Permet de ne pas afficher l'image avec le fond de type "bouton"
B_RechHTML.style.border = 'none'; // Permet de ne pas afficher l'image avec le fond de type "bouton"
B_RechHTML.style.backgroundImage = 'url("'+WIconeRech+'")';
B_RechHTML.style.width = "16px";
B_RechHTML.style.height = "16px";
B_RechHTML.style.position = "absolute";
B_RechHTML.style.left = XRech;//"104px";
B_RechHTML.style.top = YRech;//"5px";
B_RechHTML.style.cursor = "Pointer";
}; |
Partager