eventInit.register(function () { var targetArray = targetString.split(","); var bboxString = "get("mb_myBBOX") ?>"; var srs = "get("mb_myBBOXEpsg") ?>"; var performTransformation = ("get("mb_myBBOXEpsg_transform") ?>" === "1") ? true : false; // // the user wants to set an SRS that is different from the // application's SRS! // OR // the user wants to set a bounding box specified in // another SRS to be displayed in the current SRS // if (typeof Mapbender.modules[targetArray[0]] === "object" && srs !== "" && srs !== Mapbender.modules[targetArray[0]].epsg) { if (typeof Mapbender.modules.changeEPSG !== "object") { new Mb_exception("setBBOX requires changeEPSG!"); return; } if (performTransformation || bboxString === "") { Mapbender.modules.changeEPSG.setSrs({ srs: srs, callback: function () { setBbox(targetArray, bboxString); } }); } else { var bboxArray = bboxString.split(","); Mapbender.modules.changeEPSG.setSrs({ srs: srs, recalculateExtentOnly : { target : targetArray[0], extent : new Mapbender.Extent( bboxArray[0], bboxArray[1], bboxArray[2], bboxArray[3] ) } }); } } // // the user doesn't want to change the SRS. // else { setBbox(targetArray, bboxString); } }); var setBbox = function (targetArray, bboxString) { for (var i = 0; i < targetArray.length; i++) { var currentTarget = targetArray[i]; var mapObj = getMapObjByName(currentTarget); if (mapObj === null) { var e = new Mb_exception("setBBOX: unknown map object: " + currentTarget); continue; } if (bboxString === "") { var e = new Mapbender.Notice("setBBOX: no bounding box found."); continue; } else { var coord = bboxString.split(","); var newExtent = new Mapbender.Extent( parseFloat(coord[0]), parseFloat(coord[1]), parseFloat(coord[2]), parseFloat(coord[3]) ); } // if the restrictedExtent attribute exists, it has been // configured by the user in the element variable. // This is an indicator, that the administrator wants to // set the restricted extent coming from request variables. if (mapObj.restrictedExtent) { mapObj.setRestrictedExtent(newExtent); } mapObj.calculateExtent(newExtent); mapObj.setMapRequest(); } };