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

christoph at osgeo.org christoph at osgeo.org
Tue Nov 21 07:28:11 EST 2006


Author: christoph
Date: 2006-11-21 12:28:11+0000
New Revision: 925

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

Log:
added check if mb_mapObj is in parent or not

Modified: trunk/mapbender/http/javascripts/point.js
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/javascripts/point.js?view=diff&rev=925&p1=trunk/mapbender/http/javascripts/point.js&p2=trunk/mapbender/http/javascripts/point.js&r1=924&r2=925
==============================================================================
--- trunk/mapbender/http/javascripts/point.js	(original)
+++ trunk/mapbender/http/javascripts/point.js	2006-11-21 12:28:11+0000
@@ -50,13 +50,19 @@
 // possible improvement: point has flag: map OR real. additional functions: toReal, toMap
 
 function mapToReal(frameName, aPoint) {
-	var v = parent.makeClickPos2RealWorldPos(frameName, aPoint.x, aPoint.y);
+	var v;
+	if (typeof(mb_mapObj) == 'object') v = makeClickPos2RealWorldPos(frameName, aPoint.x, aPoint.y);
+	else if (typeof(parent.mb_mapObj) == 'object') v = parent.makeClickPos2RealWorldPos(frameName, aPoint.x, aPoint.y);
+	else alert('where am i?');
 	return new Point(v[0], v[1]);
 }
 
 function realToMap(frameName, aPoint) {
-	var v = parent.makeRealWorld2mapPos(frameName, aPoint.x, aPoint.y);
-	return new Point(Math.round(v[0]), Math.round(v[1]));
+	var v;
+	if (typeof(mb_mapObj) == 'object') v = makeRealWorld2mapPos(frameName, aPoint.x, aPoint.y);
+	else if (typeof(parent.mb_mapObj) == 'object') v = parent.makeRealWorld2mapPos(frameName, aPoint.x, aPoint.y);
+	else alert('where am i?');
+	return new Point(v[0], v[1]);
 }
 
 function mb_calcExtent(frameName, min, max) {




More information about the Mapbender_commits mailing list