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
| var map,
test,
marqueurs,
layerSwitcher,
zones,
projSpherique = new OpenLayers.Projection('EPSG:4326'),
projCarte,
REGION = 'NORD',
icon = new OpenLayers.Icon(
//l'image des marqueurs
getAttribute('icone_marqueur'), new OpenLayers.Size(parseInt(getAttribute('icone_marqueur_largeur')), parseInt(getAttribute('icone_marqueur_hauteur'))), null),
url = '/transferKimSufi.php',
options={
minScale: parseInt(getAttribute('zoom_max')),
maxExtent: new OpenLayers.Bounds(-180, -90, 180, 90),
maxScale: parseInt(getAttribute('zoom_min')),
minExtent: new OpenLayers.Bounds(-1, -1, 1, 1),
numZoomLevels: parseInt(getAttribute('zoom_nombre_niveaux'))
};
//désactive les console.info si demander dans la config
if(getAttribute('console_information')!='true'){console.info = function() {}};
function init(champignon, departement,commune) {
map = new OpenLayers.Map('macarte',options);
document.getElementById('macarte').style.width='auto';
document.getElementById('macarte').style.height='60%';
document.getElementById('macarte').style.border='10px solid #555555';
map.tileSize=map.size;
map.removeControl(map.controls[1]);
marqueurs = new OpenLayers.Layer.Markers('Marqueurs',
{
'calculateInRange': function(){return true;},
minScale:250,//pour scale en fonction du zoom
maxScale:250000,
'displayInLayerSwitcher':false
});
map.addLayer(marqueurs);
//indice pour que les marqueurs soient au premier plan
marqueurs.setZIndex(700);
//ajout du layer des zones de récolte
zones = new OpenLayers.Layer.Vector("Zones",
{
'displayInLayerSwitcher':false
});
zones.setZIndex(699);
map.addLayer(zones);
//infos
document.getElementById('region_nom').innerHTML=window.areaName;
document.getElementById('region_superficie').innerHTML=(Math.floor((distance(0,window.area[0],0,window.area[1])*distance(window.area[2],0,window.area[3],0)/1000000)*100000))/100000+" km² ";
//"1° = "+(Math.floor((distance(0,0,1,0)/1000)*100000))/100000+" m\n"));
switch (REGION) {
case 'NORD':
addLayerNord();
break;
case 'FRANCE':
addLayerFrance();
break;
}
addControler();
drawLogo();drawZoom();drawScale();
//getHarvests(champignon, departement,commune);
//pas tant que ce fichier sera sous un autre nom de domaine
//setTimeout(function(){scrollTo(10,10,1000)},3000);
} |
Partager