svn commit: r948 - trunk/mapbender/http/javascripts/mod_geometryArray.js

christoph at osgeo.org christoph at osgeo.org
Thu Nov 23 09:19:10 EST 2006


Author: christoph
Date: 2006-11-23 14:19:10+0000
New Revision: 948

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

Log:
added union operator

Modified: trunk/mapbender/http/javascripts/mod_geometryArray.js
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/javascripts/mod_geometryArray.js?view=diff&rev=948&p1=trunk/mapbender/http/javascripts/mod_geometryArray.js&p2=trunk/mapbender/http/javascripts/mod_geometryArray.js&r1=947&r2=948
==============================================================================
--- trunk/mapbender/http/javascripts/mod_geometryArray.js	(original)
+++ trunk/mapbender/http/javascripts/mod_geometryArray.js	2006-11-23 14:19:10+0000
@@ -5,9 +5,10 @@
 */
 // http://www.mapbender.org/index.php/GeometryArray.js
 
-<?php 
-require_once('point.js');
+<?php
+	require_once("point.js");
 ?>
+
 var geomTypePolygon = "polygon";
 var geomTypeLine = "line";
 var geomTypePoint = "point";
@@ -16,6 +17,17 @@
 var nameMultiGeometry = "MultiGeometry";
 var nameGeometry = "Geometry";
 
+function cloneObject(a){
+	var z = new Array();
+	
+	for (attr in a) {
+		var b = a[attr];
+		if (typeof(b) == "object") {z[attr] = cloneObject(b);}
+		else z[attr] = b;
+	}	
+	return z;
+}
+
 // ----------------------------------------------------
 // ----------- class: geometry array ------------------
 function GeometryArray(){
@@ -24,6 +36,10 @@
 		return this.m.length;
 	}
 
+	this.union = function(geomArray){
+		for (var i=0; i < geomArray.count(); i++) this.appendMember(geomArray.get(i));
+	}
+	
 	this.get = function(i){
 		i = this.getIndex(i);
 		if (i != null) return this.m[i];
@@ -487,11 +503,11 @@
 	
 		if (typeof(j) != 'undefined'){
 			if (typeof(i) != 'undefined'){
-				this.coord[cnt]['coord'] = realToMap(this.target, geom.getPoint(i,j,k));
+				this.coord[cnt]['coord'] = parent.realToMap(this.target, geom.getPoint(i,j,k));
 			}
-			else this.coord[cnt]['coord'] = realToMap(this.target, geom.getPoint(j,k));
+			else this.coord[cnt]['coord'] = parent.realToMap(this.target, geom.getPoint(j,k));
 		}
-		else this.coord[cnt]['coord'] = realToMap(this.target, geom.get(k));
+		else this.coord[cnt]['coord'] = parent.realToMap(this.target, geom.get(k));
 		
 		this.coord[cnt]['member'] = i;
 		this.coord[cnt]['geometry'] = j;




More information about the Mapbender_commits mailing list