[Mapbender-commits] r2521 -
branches/beck_dev/mapbender/http/javascripts
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Fri Jun 20 11:28:20 EDT 2008
Author: greq
Date: 2008-06-20 11:28:20 -0400 (Fri, 20 Jun 2008)
New Revision: 2521
Modified:
branches/beck_dev/mapbender/http/javascripts/map.js
Log:
http://trac.osgeo.org/mapbender/ticket/246
Modified: branches/beck_dev/mapbender/http/javascripts/map.js
===================================================================
--- branches/beck_dev/mapbender/http/javascripts/map.js 2008-06-20 13:45:33 UTC (rev 2520)
+++ branches/beck_dev/mapbender/http/javascripts/map.js 2008-06-20 15:28:20 UTC (rev 2521)
@@ -120,6 +120,10 @@
}
}
}
+
+var writeMapTimeout;
+var imagesToLoad = 0;
+
function setMapRequest(frameName){
var functionName = 'setMapRequest';
@@ -136,6 +140,8 @@
continue;
}
+ imagesToLoad += currentMapObject.wms.length;
+
var newMapRequest = "";
for (var ii = 0; ii < currentMapObject.wms.length; ii++){
var currentWms = currentMapObject.wms[ii];
@@ -144,15 +150,42 @@
}
myMapIds.push("map_"+ii);
- newMapRequest += getLayerHtmlCode(frameName, i, ii);
+// newMapRequest += getLayerHtmlCode(frameName, i, ii);
+ var currentRequest = getLayerHtmlCode(frameName, i, ii);
+ img = new Image();
+ img.src = mb_mapObj[i].getMapUrl(i, ii);
+
+ var frameName = mb_mapObj[i].frameName;
+ var elementName = mb_mapObj[i].elementName;
+
+ writeMapTimeout = setTimeout(function () {
+ writeMap(img, frameName, elementName, currentRequest);
+ }, 100);
}
- writeTag(mb_mapObj[i].frameName, mb_mapObj[i].elementName, newMapRequest);
+// writeTag(mb_mapObj[i].frameName, mb_mapObj[i].elementName, newMapRequest);
}
eventAfterMapRequest.trigger({
"frameName": frameName,
"myMapIds": myMapIds.join(",")
});
+
+
+ function writeMap (image, frameName, elementName, html) {
+ if (image.complete) {
+ writeTag(frameName, elementName, html);
+ imagesToLoad --;
+ if (imagesToLoad === 0) {
+ eventAfterMapImagesReady.trigger();
+
+ }
+ }
+ else {
+ writeMapTimeout = setTimeout(function () {
+ writeMap(image, frameName, elementName, html);
+ }, 100);
+ }
+ }
/*
for(var i=0; i<mb_MapRequestSubFunctions.length; i++){
eval(mb_MapRequestSubFunctions[i]);
More information about the Mapbender_commits
mailing list