[Mapbender-commits] r2425 - branches/darndt_dev/http/javascripts
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue May 6 08:58:00 EDT 2008
Author: darndt
Date: 2008-05-06 08:58:00 -0400 (Tue, 06 May 2008)
New Revision: 2425
Modified:
branches/darndt_dev/http/javascripts/map.js
Log:
Modified: branches/darndt_dev/http/javascripts/map.js
===================================================================
--- branches/darndt_dev/http/javascripts/map.js 2008-05-01 11:20:15 UTC (rev 2424)
+++ branches/darndt_dev/http/javascripts/map.js 2008-05-06 12:58:00 UTC (rev 2425)
@@ -633,33 +633,67 @@
wms = another_new_wmsarray;
}
function setExtent(width,height,epsg){
- for(var i=0; i < wms[0].gui_epsg.length; i++){
- if(wms[0].gui_epsg[i] == epsg){
- var bbox_minx = parseFloat(wms[0].gui_minx[i]);
- var bbox_miny = parseFloat(wms[0].gui_miny[i]);
- var bbox_maxx = parseFloat(wms[0].gui_maxx[i]);
- var bbox_maxy = parseFloat(wms[0].gui_maxy[i]);
-
- var extenty = bbox_maxy - bbox_miny;
- var extentx = bbox_maxx - bbox_minx;
-
- var relation_px_x = width / height;
- var relation_px_y = height / width;
- var relation_bbox_x = extentx / extenty;
- var centerx = bbox_minx + (extentx/2);
- var centery = bbox_miny + (extenty/2);
- if(relation_bbox_x <= relation_px_x){
- bbox_minx = centerx - relation_px_x * extenty / 2;
- bbox_maxx = centerx + relation_px_x * extenty / 2;
- }
-
- if(relation_bbox_x > relation_px_x){
- bbox_miny = centery - relation_px_y * extentx / 2;
- bbox_maxy = centery + relation_px_y * extentx / 2;
- }
- return bbox_minx +","+ bbox_miny +","+ bbox_maxx +","+ bbox_maxy;
- }
- }
+ for(var i=0;i<wms[0].gui_epsg.length;i++){
+ if(wms[0].gui_epsg[i]==epsg){
+ var bbox_minx=parseFloat(wms[0].gui_minx[i]);
+ var bbox_miny=parseFloat(wms[0].gui_miny[i]);
+ var bbox_maxx=parseFloat(wms[0].gui_maxx[i]);
+ var bbox_maxy=parseFloat(wms[0].gui_maxy[i]);
+ var extenty=bbox_maxy-bbox_miny;
+ var extentx=bbox_maxx-bbox_minx;
+ var relation_px_x=width/height;
+ var relation_px_y=height/width;
+ var relation_bbox_x=extentx/extenty;
+ var centerx=bbox_minx+(extentx/2);
+ var centery=bbox_miny+(extenty/2);
+ if(relation_bbox_x<=relation_px_x){
+ bbox_minx=centerx-relation_px_x*extenty/2;
+ bbox_maxx=centerx+relation_px_x*extenty/2;
+ }
+ if(relation_bbox_x>relation_px_x){
+ bbox_miny=centery-relation_px_y*extentx/2;
+ bbox_maxy=centery+relation_px_y*extentx/2;
+ }
+ return bbox_minx+","+bbox_miny+","+bbox_maxx+","+bbox_maxy;
+ }
+ if(wms[0].gui_epsg[i]!=epsg && wms[0].gui_epsg[i]!= "EPSG:4326"){
+ epsg_gui = wms[0].gui_epsg[i].substring(5, wms[0].gui_epsg[i].length);
+ epsg_neu = epsg.substring(5, epsg.length);
+ if (window.XMLHttpRequest) {
+ http = new XMLHttpRequest();
+ } else if (window.ActiveXObject) {
+ http = new ActiveXObject("Microsoft.XMLHTTP");
+ }
+ if (http != null) {
+ http.open("POST", "../php/mod_zoomfull_projection.php", false);
+ http.setRequestHeader(
+ "Content-Type",
+ "application/x-www-form-urlencoded");
+ http.send("epsg=" + epsg_neu + "&epsg_gui=" + epsg_gui + "&minx=" + wms[0].gui_minx[i] + "&miny=" + wms[0].gui_miny[i] + "&maxx=" + wms[0].gui_maxx[i] + "&maxy=" + wms[0].gui_maxy[i]);
+ text = eval("(" + http.responseText + ")");
+ bbox_minx = parseFloat(text.minx);
+ bbox_miny = parseFloat(text.miny);
+ bbox_maxx = parseFloat(text.maxx);
+ bbox_maxy = parseFloat(text.maxy);
+ var extenty=bbox_maxy-bbox_miny;
+ var extentx=bbox_maxx-bbox_minx;
+ var relation_px_x=width/height;
+ var relation_px_y=height/width;
+ var relation_bbox_x=extentx/extenty;
+ var centerx=bbox_minx+(extentx/2);
+ var centery=bbox_miny+(extenty/2);
+ if(relation_bbox_x<=relation_px_x){
+ bbox_minx=centerx-relation_px_x*extenty/2;
+ bbox_maxx=centerx+relation_px_x*extenty/2;
+ }
+ if(relation_bbox_x>relation_px_x){
+ bbox_miny=centery-relation_px_y*extentx/2;
+ bbox_maxy=centery+relation_px_y*extentx/2;
+ }
+ return bbox_minx+","+bbox_miny+","+bbox_maxx+","+bbox_maxy;
+ }
+ }
+ }
}
function setMapRequest(frameName){
var functionName = 'setMapRequest';
More information about the Mapbender_commits
mailing list