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
|
,createMap: function() {
if (typeof(OpenLayers)==='undefined' || typeof(Geoportal)==='undefined') {
setTimeout('application.createMap();',300);
return;
}
var map;
/**
* 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);
}
function createIgnLayer(couche,opacite,LayerBase,extentMax){
couche.options.opacity = opacite;
couche.options.isBaseLayer = LayerBase;
couche.options.maxExtent = extentMax;
couche.options["GeoRM"] = setGeoRM();
couche.transitionEffect= 'resize';
var ignLayer = new couche.classLayer(
OpenLayers.i18n(couche.options.name),
couche.url,
couche.params,
couche.options);
return ignLayer
};
var epsg4171= new OpenLayers.Projection("EPSG:4171");
var ignfxx= new OpenLayers.Projection("IGNF:GEOPORTALFXX");
var monExtentMax = new OpenLayers.Bounds(360000, 4783000,600000, 5200000)
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: 1024
,numZoomLevels: 15
,projection: ignfxx
// ,displayProjection:epsg4171
,units: ignfxx.getUnits()
,maxExtent: monExtentMax
,controls:[
new Geoportal.Control.TermsOfService()
,new Geoportal.Control.PermanentLogo()
,new OpenLayers.Control.ScaleLine()
,new OpenLayers.Control.MousePosition({
prefix: "Lambert 93 : x = "
,suffix: " m"
,separator: " m, y = "
,displayProjection: new OpenLayers.Projection("IGNF:LAMB93")
,numDigits: 0
,emptyString: ''
})
,new OpenLayers.Control.KeyboardDefaults()
,new OpenLayers.Control.Attribution()
,new OpenLayers.Control.Navigation()
]
}
,gGEOPORTALRIGHTSMANAGEMENT)
);
maMap = map;//debug
// get IGNF's catalogue :
var cat = new Geoportal.Catalogue(map,gGEOPORTALRIGHTSMANAGEMENT);
var zon = cat.getTerritory('EUE');
// get Geoportail layer's parameters :
var scanOpts= cat.getLayerParameters(zon, 'GEOGRAPHICALGRIDSYSTEMS.MAPS:WMSC');
var orthoOpts= cat.getLayerParameters(zon, 'ORTHOIMAGERY.ORTHOPHOTOS:WMSC');
var cadastreOpts= cat.getLayerParameters(zon, 'CADASTRALPARCELS.PARCELS:WMSC');
var etatmajorOpts= cat.getLayerParameters(zon, 'GEOGRAPHICALGRIDSYSTEMS.ETATMAJOR40:WMSC');
//create layers
var scan = createIgnLayer(scanOpts,1.0,true,monExtentMax);
var ortho = createIgnLayer(orthoOpts,1.0,false,monExtentMax);
var cadastre = createIgnLayer(cadastreOpts,null,false,monExtentMax);
var etatmajor = createIgnLayer(etatmajorOpts,1.0,false,monExtentMax);
// reproject maxExtent (Geoportal's API standard and extended do it automagically :
// scanOpts.options.maxExtent.transform(scanOpts.options.projection, map.getProjection(), true);
// add it to the map :
map.addLayers([scan,ortho,cadastre,etatmajor]);
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: epsg4171
,units: 'degrees'
,maxResolution: 1024
,maxExtent: monExtentMax
,statuscode: application.user.statuscode
,indexzp: 0
}
,{singleTile: true}
);
map.addLayers([overlay]);
return map;
}
}
}(); |
Partager