[Mapbender-commits] r2528 -
branches/beck_dev/mapbender/http/javascripts
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Fri Jun 20 13:18:58 EDT 2008
Author: greq
Date: 2008-06-20 13:18:58 -0400 (Fri, 20 Jun 2008)
New Revision: 2528
Modified:
branches/beck_dev/mapbender/http/javascripts/map.js
Log:
map dragging / zooming doesn't works fine !!!
ToDo: testing, analysing, ...
Modified: branches/beck_dev/mapbender/http/javascripts/map.js
===================================================================
--- branches/beck_dev/mapbender/http/javascripts/map.js 2008-06-20 15:43:25 UTC (rev 2527)
+++ branches/beck_dev/mapbender/http/javascripts/map.js 2008-06-20 17:18:58 UTC (rev 2528)
@@ -121,9 +121,9 @@
}
}
-var writeMapTimeout;
var imagesToLoad = 0;
+
function setMapRequest(frameName){
var functionName = 'setMapRequest';
@@ -141,6 +141,7 @@
}
imagesToLoad += currentMapObject.wms.length;
+ currentMapObject.firstWmsLoaded = false;
var newMapRequest = "";
for (var ii = 0; ii < currentMapObject.wms.length; ii++){
@@ -151,17 +152,21 @@
myMapIds.push("map_"+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);
+// console.log("frameName: %s, wms: %s", i, ii);
+ (function () {
+ var img = new Image();
+ img.src = mb_mapObj[i].getMapUrl(i, ii);
+ var frameName = mb_mapObj[i].frameName;
+ var elementName = mb_mapObj[i].elementName;
+ var currentRequest = getLayerHtmlCode(frameName, i, ii);
+ var mapIndex = i;
+ var wmsIndex = ii;
+ mb_mapObj[i].wms[ii].writeMapTimeout = setTimeout(function () {
+ writeMap(img, frameName, elementName, currentRequest, mapIndex, wmsIndex);
+ }, 100);
+ })();
}
// writeTag(mb_mapObj[i].frameName, mb_mapObj[i].elementName, newMapRequest);
}
@@ -171,18 +176,33 @@
});
- function writeMap (image, frameName, elementName, html) {
+ function writeMap (image, frameName, elementName, html, i, ii) {
+// console.log("wms URL %s (%s)", image.src, frameName);
if (image.complete) {
- writeTag(frameName, elementName, html);
+// console.log("success!");
+// mb_mapObj[i].completeHtml += html;
imagesToLoad --;
+// console.log("searching for %s in frame %s", "#"+elementName, "window.frames['"+frameName+"']")
+// console.log("found #%s elements.", $("#"+elementName, window.frames[frameName].document).size());
+ if (!mb_mapObj[i].firstWmsLoaded) {
+ mb_mapObj[i].firstWmsLoaded = true;
+ $("#"+elementName, window.frames[frameName].document).children().remove();
+ $("#"+elementName, window.frames[frameName].document).append($(html));
+ }
+ else {
+ $("#"+elementName, window.frames[frameName].document).append($(html));
+ }
if (imagesToLoad === 0) {
+// console.log("all images loaded (%s)", frameName);
+// writeTag(frameName, elementName, completeHtml);
+// completeHtml = "";
eventAfterMapImagesReady.trigger();
-
}
}
else {
- writeMapTimeout = setTimeout(function () {
- writeMap(image, frameName, elementName, html);
+// console.log("failed, will retry...");
+ mb_mapObj[i].wms[ii].writeMapTimeout = setTimeout(function () {
+ writeMap(image, frameName, elementName, html, i, ii);
}, 100);
}
}
More information about the Mapbender_commits
mailing list