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
|
/*
* Copyright (c) 2008-2011 Institut Geographique National France, released under the
* BSD license.
*/
/**
* Property: viewer
* {<Geoportal.Viewer>} the viewer global instance.
*/
viewer= null;
/**
* Function: initMap
* Load the application. Called when all information have been loaded by
* <loadAPI>().
*/
function initMap() {
// ----- Traduction
translate();
// ----- Options
var options= {
mode:'normal',
territory:'FXX',
};
viewer= new Geoportal.Viewer.Default('viewerDiv', OpenLayers.Util.extend(
options,
// API keys configuration variable set by <Geoportal.GeoRMHandler.getConfig>
// variable contenant la configuration des clefs API remplie par <Geoportal.GeoRMHandler.getConfig>
window.gGEOPORTALRIGHTSMANAGEMENT===undefined? {'apiKey':'votre_clé'} : gGEOPORTALRIGHTSMANAGEMENT)
);
if (!viewer) {
// problem ...
OpenLayers.Console.error(OpenLayers.i18n('new.instance.failed'));
return;
}
// ----- Layers
viewer.addGeoportalLayers(['ORTHOIMAGERY.ORTHOPHOTOS','GEOGRAPHICALGRIDSYSTEMS.MAPS']);
// ----- Autres
viewer.getMap().setCenterAtLonLat(2.418611,48.842222,10);
}
/**
* Function: loadAPI
* Load the configuration related with the API keys.
* Called on "onload" event.
* Call <initMap>() function to load the interface.
*/
function loadAPI() {
// wait for all classes to be loaded
// on attend que les classes soient chargées
if (checkApiLoading('loadAPI();',['OpenLayers','Geoportal','Geoportal.Viewer','Geoportal.Viewer.Default'])===false) {
return;
}
Geoportal.GeoRMHandler.getConfig(['votre clé'], null,null, {
onContractsComplete: initMap
});
}
// assign callback when "onload" event is fired
// assignation de la fonction à appeler lors de la levée de l'évènement "onload"
window.onload= loadAPI; |
Partager