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 158 159 160 161 162 163 164 165
|
<!DOCTYPE html>
<html>
<head>
<title>Visualisation</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<style type="text/css">
<!--
div#GeoportalVisuDiv {
}
-->
</style>
</head>
<body>
<div id="GeoportalVisuDiv"></div>
<script type="text/javascript">
<!--
VISU= null;
function changeRenderIntent(o) {
if (o && o.feature) {
o.feature.renderIntent= o.feature.renderIntent=="default"?
"select"
: "default";
}
}
function initGeoportalMap() {
var gvd= OpenLayers.Util.getElement("GeoportalVisuDiv");
gvd.style.width= (screen.width - 45)+"px";
gvd.style.height= (screen.height - 60)+"px";
geoportalLoadVISU(gvd);
if (VISU) {
if (VISU.getMap().allowedGeoportalLayers) {
for (var i= 0; i<VISU.getMap().allowedGeoportalLayers.length; i++) {
var overloaded_options= null;
var couche= VISU.getMap().allowedGeoportalLayers[i];
if (couche.match(/^GEOGRAPHICALGRIDSYSTEMS.MAPS/)) {// maps
overloaded_options= {
opacity: 1.0
};
} else if (couche.match(/^ORTHOIMAGERY.ORTHOPHOTOS/)) {// orthophotos
overloaded_options= {
visibility: false
};
}
VISU.addGeoportalLayer(couche,overloaded_options);
}
}
}
VISU.getMap().setCenter(VISU.viewerOptions.defaultCenter,10);
VISU.getMap().addLayer("GPX","Template","../GPX/Template", {
visibility:true,
minZoomLevel:1,
maxZoomLevel:20,
styleMap:new OpenLayers.StyleMap({
"default": new OpenLayers.Style(
OpenLayers.Util.applyDefaults({
fillColor: "#FF9900",
fillOpacity: 1,
strokeColor: "#FFFF00",
strokeWidth: 4,
graphicName: "triangle",
pointRadius: 8
},OpenLayers.Feature.Vector.style["default"])),
"select": new OpenLayers.Style(
OpenLayers.Util.applyDefaults({
fillColor: "#FF9900",
fillOpacity: 0.6,
strokeColor: "#FFFF00",
strokeWidth: 4,
pointRadius: 12
},OpenLayers.Feature.Vector.style["select"]))
}),
eventListeners:{
"loadend" : function() {
var bounds= this.getDataExtent();
if (bounds) {
if (bounds.getWidth()==0 || bounds.getHeight()==0) {
// reduced to 1 point ?
if (this.features.length==1) {
this.map.setCenterAtLonLat(bounds.left, bounds.bottom, 10);
} else {//no point in GPX
;
}
} else {
this.map.zoomToExtent(bounds);
}
}
},
"beforefeatureselected": changeRenderIntent,
"featureunselected" : changeRenderIntent
}
},
{
});
}
if (window.__Geoportal$timer===undefined) {
var __Geoportal$timer= null;
}
function checkApiLoading(retryClbk,clss) {
if (__Geoportal$timer!=null) {
//clearTimeout: annule le minuteur "__Geoportal$timer" avant sa
//fin
window.clearTimeout(__Geoportal$timer);
__Geoportal$timer= null;
}
/**
* Il se peut que l'init soit exécuté avant que l'API ne soit chargée
* Ajout d'un code temporisateur qui attend 300 ms avant de relancer
* l'init
*/
var f;
for (var i=0, l= clss.length; i<l; i++) {
try {
f= eval(clss[i]);
} catch (e) {
f= undefined;
}
if (typeof(f)==='undefined') {
__Geoportal$timer= window.setTimeout(retryClbk, 300);
return false;
}
}
return true;
}
function geoportalLoadVISU(idDivMap, mode, territoire, crs, dispcrs, proxy) {
var options= {};
if(mode) {options.mode= mode;}
if(territoire) {options.territory= territoire;}
if(crs) {options.projection= crs;}
if(dispcrs) {options.displayProjection= dispcrs;}
if(proxy) {options.proxy= proxy;}
options.nameInstance= 'VISU';
OpenLayers.Util.extend(options, gGEOPORTALRIGHTSMANAGEMENT || {});
VISU= new Geoportal.Viewer.Default(idDivMap, options);
return VISU;
}
function loadAPI() {
// on attend que les classes soient chargées
if (checkApiLoading(loadAPI,['OpenLayers','Geoportal','Geoportal.Viewer','Geoportal.Viewer.Default'])===false) {
return;
}
// on charge la configuration de la clef API, puis on charge
// l'application
Geoportal.GeoRMHandler.getConfig(['1807360623060565129'], null, null, {
onContractsComplete: initGeoportalMap
});
}
window.onload= loadAPI;
-->
</script>
<script type="text/javascript" src="http://api.ign.fr/geoportail/api/js/1.2/Geoportal.js">
<!-- -->
</script>
</body>
</html> |
Partager