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 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
|
,createMap: function() {
if (typeof(OpenLayers)==='undefined' || typeof(Geoportal)==='undefined') {
setTimeout('application.createMap();',300);
return;
}
var map;
OpenLayers.ProxyHost= "http://integration.vttrack.fr/proxy.php";
Proj4js.ProxyHost= OpenLayers.ProxyHost;
if (window.gGEOPORTALRIGHTSMANAGEMENT===undefined) {
var gGEOPORTALRIGHTSMANAGEMENT= {apiKey:['xxxma_clefxxx']};
}
/**
* Function: setGeoRM
* Assign Geoportal's GeoRM token to an Object.
*
* Returns:
* {Object} the rightsManagement key
*/
function setGeoRM() {
return Geoportal.GeoRMHandler.addKey(
gGEOPORTALRIGHTSMANAGEMENT.apiKey,
gGEOPORTALRIGHTSMANAGEMENT[gGEOPORTALRIGHTSMANAGEMENT.apiKey[0]].tokenServer.url,
gGEOPORTALRIGHTSMANAGEMENT[gGEOPORTALRIGHTSMANAGEMENT.apiKey[0]].tokenServer.ttl,
map);
}
var epsg4258= new OpenLayers.Projection("EPSG:4258");
var id = Ext.id();
Ext.DomHelper.append(Ext.getBody(), {tag: 'div', cn: {tag: 'div', id: id}, style:'visibility: hidden'});
map = new OpenLayers.Map(id
,OpenLayers.Util.extend({
// maxResolution: 200
maxResolution: 1.40625
,numZoomLevels: 21
,projection: epsg4258
,units: epsg4258.getUnits()
// ,maxExtent: new OpenLayers.Bounds(872150, 1942230, 943685, 2030790)
,maxExtent: new OpenLayers.Bounds(4.6, 43.5, 7.15, 46)
,controls:[
new OpenLayers.Control.PanZoomBar()
,new OpenLayers.Control.NavToolbar()
// ,new OpenLayers.Control.LayerSwitcher({'ascending':false})
,new OpenLayers.Control.ScaleLine()
,new OpenLayers.Control.MousePosition()
,new OpenLayers.Control.KeyboardDefaults()
,new OpenLayers.Control.Attribution()
,new Geoportal.Control.PermanentLogo()
,new Geoportal.Control.TermsOfService()
]
}
,gGEOPORTALRIGHTSMANAGEMENT)
);
maMap = map;//debug
// get IGNF's catalogue :
var cat = new Geoportal.Catalogue(map,gGEOPORTALRIGHTSMANAGEMENT);
// prepare CRS :
var zon = cat.getTerritory('EUE');
map.addLayers([
new OpenLayers.Layer(
'__PlateCarre__',
{
isBaseLayer: true,
displayInLayerSwitcher: false,
projection: new OpenLayers.Projection('EPSG:4326'),
units: 'degrees',
// maxResolution: 200,
maxResolution: 1.40625,
numZoomLevels: 21,
// maxExtent: new OpenLayers.Bounds(872150, 1942230, 943685, 2030790),
maxExtent: new OpenLayers.Bounds(4.6, 43.5, 7.15, 46),
minZoomLevel:5,
maxZoomLevel:18,
territory:'EUE'
})
]);
// get Geoportail layer's parameters :
var europeanMapOpts= cat.getLayerParameters(zon, 'GEOGRAPHICALGRIDSYSTEMS.MAPS:WMSC');
// overwrite some :
europeanMapOpts.options.opacity= 1.0;
// link with GeoRM :
europeanMapOpts.options["GeoRM"]= setGeoRM();
europeanMapOpts.transitionEffect= 'resize';
// build map :
var europeanMap= new europeanMapOpts.classLayer(
OpenLayers.i18n(europeanMapOpts.options.name),
europeanMapOpts.url,
europeanMapOpts.params,
europeanMapOpts.options);
// reproject maxExtent (Geoportal's API standard and extended do it automagically :
europeanMapOpts.options.maxExtent.transform(europeanMapOpts.options.projection, map.getProjection(), true);
// add it to the map :
map.addLayers([europeanMap]);
var overlay = new OpenLayers.Layer.WMS("overlay",
"/flor/flor",
{
layers: [
'coeur', 'aireadhesion',
'zones2', 'zones3', 'zones4', 'zones5',
'zones6', 'zones8', 'zones9',
'zones10', 'zones11', 'zones12',
'ap', 'zp_pasrelue', 'zp_relue', 'secteurs', 'communes', 'zp_Selected'
],
transparent: true,
projection: new OpenLayers.Projection("EPSG:4326"),
statuscode: application.user.statuscode,
indexzp: 0
},
{
singleTile: true
}
);
map.addLayers([overlay]);
// center map (otherwise : centered at (0,0), zoom 0 :
map.setCenter(new OpenLayers.LonLat(6.1,44.75),9);
return map;
} |
Partager