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 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
|
,init:function(monprotocole){
// on attend que les classes soient chargées
if (typeof(OpenLayers)==='undefined' || typeof(Geoportal)==='undefined') {
setTimeout('application.cf.init('+monprotocole+');',300);
return;
}
// on charge la configuration de la clef API, puis on charge l'application
Geoportal.GeoRMHandler.getConfig([ign_api_key], null,null, {
onContractsComplete: this.ziva(monprotocole)
});
}
,createMap: function() {
// var map;
// var epsg4171= new OpenLayers.Projection("EPSG:4171");
// var ignfxx= new OpenLayers.Projection("IGNF:GEOPORTALFXX");
// var epsg310024001= new OpenLayers.Projection("EPSG:310024001");
/**
* 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){
if(couche==null){
setTimeout('createIgnLayer('+couche+','+opacite+','+LayerBase+','+extentMax+');',300);
return;
}
couche.options.opacity = opacite;
couche.options.isBaseLayer = LayerBase;
couche.options.maxExtent = extentMax;
// couche.options.projection = epsg310024001;
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 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: resolution_max
,numZoomLevels: num_zoom_levels
,projection: 'EPSG:310024001'
// ,displayProjection:epsg4171
,units: 'meters'
,maxExtent: extent_max
,controls:[
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()
,new Geoportal.Control.PermanentLogo()
,new Geoportal.Control.TermsOfService()
]
}
,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,extent_max);
var ortho = createIgnLayer(orthoOpts,1.0,false,extent_max);
var cadastre = createIgnLayer(cadastreOpts,null,false,extent_max);
var etatmajor = createIgnLayer(etatmajorOpts,1.0,false,extent_max);
// scanOpts.options.projection = new OpenLayers.Projection("EPSG:310024001");
// 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",
"/faun/faun"
,{
layers: [
'znieff2'
, 'znieff1'
,'coeur'
, 'ab'
,'reservesnat'
, 'reserveschasse'
, 'sitesinscrits'
, 'sitesclasses'
, 'n2000'
,'communes'
,'secteurs'
,'unitesgeo'
]
,transparent: true
,projection:'EPSG:310024001'
,units: 'meters'
,maxResolution: resolution_max
,maxExtent: extent_max
// ,version: '1.3.0'
,statuscode: application.cf.user.statuscode
// ,territory:'EUE'
}
,{singleTile: true}
);
map.addLayers([overlay]);
this.searchVectorLayer = new OpenLayers.Layer.Vector('search_vector_layer', {
style: {
fillColor: "#000000"
,strokeColor: "#ff0000"
,cursor: "pointer"
,fillOpacity: 0.1
,strokeOpacity: 1
,strokeWidth: 2
,pointRadius: 8
}
,styleMap: new OpenLayers.StyleMap({
temporary: new OpenLayers.Style({
strokeWidth: 2
,strokeColor: "#ffa500"
,fillOpacity: 0.2
})
})
});
map.addLayers([this.searchVectorLayer]);
this.selectFeatureControl = new OpenLayers.Control.SelectFeature(this.searchVectorLayer, {});
map.addControl(this.selectFeatureControl);
this.selectFeatureControl.activate();
return map;
} |
Partager