svn commit: r953 - trunk/mapbender/http/javascripts/point.js

christoph at osgeo.org christoph at osgeo.org
Thu Nov 23 09:39:50 EST 2006


Author: christoph
Date: 2006-11-23 14:39:50+0000
New Revision: 953

Modified:
   trunk/mapbender/http/javascripts/point.js

Log:
removed obsolete code

Modified: trunk/mapbender/http/javascripts/point.js
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/javascripts/point.js?view=diff&rev=953&p1=trunk/mapbender/http/javascripts/point.js&p2=trunk/mapbender/http/javascripts/point.js&r1=952&r2=953
==============================================================================
--- trunk/mapbender/http/javascripts/point.js	(original)
+++ trunk/mapbender/http/javascripts/point.js	2006-11-23 14:39:50+0000
@@ -8,40 +8,32 @@
 	this.dist = function(p){
 		return Math.sqrt(Math.pow(this.y-p.y,2) + Math.pow(this.x-p.x,2)) ;
 	}
-	
 	this.equals = function(p){
 		if (this.x == p.x && this.y == p.y) {return true;}
 		return false;
 	}
-	
 	this.minus = function(p){
 		return new Point(this.x-p.x, this.y-p.y);
 	}
-
 	this.plus = function(p){
 		return new Point(this.x+p.x, this.y+p.y);
 	}
-
 	this.dividedBy = function(c){
 		if (c != 0) {return new Point(this.x/c, this.y/c);}
 		alert("Exception: Division by zero");
 		return false;
 	}
-	
 	this.times = function(c){
 		return new Point(this.x*c, this.y*c);
 	}
-	
 	this.round = function(numOfDigits){
 		var tmpX = Math.round(this.x*Math.pow(10, parseInt(numOfDigits)))/Math.pow(10, parseInt(numOfDigits));
 		var tmpY = Math.round(this.y*Math.pow(10, parseInt(numOfDigits)))/Math.pow(10, parseInt(numOfDigits));
 		return new Point(tmpX, tmpY);
 	}
-
 	this.toString = function(){
 		return "(" + this.x + ", " + this.y + ")";
 	}
-
 	this.x = x;
 	this.y = y;
 }
@@ -56,7 +48,6 @@
 	else alert('where am i?');
 	return new Point(v[0], v[1]);
 }
-
 function realToMap(frameName, aPoint) {
 	var v;
 	if (typeof(mb_mapObj) == 'object') v = makeRealWorld2mapPos(frameName, aPoint.x, aPoint.y);
@@ -64,30 +55,11 @@
 	else alert('where am i?');
 	return new Point(v[0], v[1]);
 }
-
 function mb_calcExtent(frameName, min, max) {
-	var ind = parent.getMapObjIndexByName(frameName);
-	var extent = max.minus(min);
-	var center = extent.dividedBy(2).plus(min);
-	
-	var relation_px_x = mb_mapObj[ind].width / mb_mapObj[ind].height;
-	var relation_px_y = mb_mapObj[ind].height / mb_mapObj[ind].width;
-	var relation_bbox_x = extent.x / extent.y;     
-	
-	var new_min;
-	var new_max;
-	
-	if(relation_bbox_x <= relation_px_x){                
-		new_min = new Point(center.x - relation_px_x * extent.y / 2, min.y);
-		new_max = new Point(center.x + relation_px_x * extent.y / 2, max.y);
-	}
-	else if(relation_bbox_x > relation_px_x){                
-		new_min = new Point(min.x, center.y - relation_px_y * extent.x / 2);
-		new_max = new Point(max.x, center.y + relation_px_y * extent.x / 2);
-	}
-	mb_mapObj[ind].extent = new_min.x +","+ new_min.y +","+ new_max.x  +","+ new_max.y;
+	if (typeof(mb_calculateExtent) == 'function') mb_calculateExtent(frameName, min.x, min.y, max.x, max.y);
+	else if (typeof(parent.mb_calculateExtent) == 'function') parent.mb_calculateExtent(frameName, min.x, min.y, max.x, max.y);
+	else alert('mb_calc_extent not found');
 }
-
 function cloneObject(a){
 	var z = new Array();
 	




More information about the Mapbender_commits mailing list