[Mapbender-commits] r3900 - in trunk/mapbender: http/javascripts lib
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue Apr 21 05:53:34 EDT 2009
Author: christoph
Date: 2009-04-21 05:53:33 -0400 (Tue, 21 Apr 2009)
New Revision: 3900
Modified:
trunk/mapbender/http/javascripts/geometry.js
trunk/mapbender/lib/basic.js
Log:
http://trac.osgeo.org/mapbender/ticket/418
Modified: trunk/mapbender/http/javascripts/geometry.js
===================================================================
--- trunk/mapbender/http/javascripts/geometry.js 2009-04-20 06:38:07 UTC (rev 3899)
+++ trunk/mapbender/http/javascripts/geometry.js 2009-04-21 09:53:33 UTC (rev 3900)
@@ -1359,7 +1359,7 @@
* @type Integer
*/
this.count = function(){
- return name.length;
+ return this.name.length;
};
/**
@@ -1370,7 +1370,7 @@
* @type String
*/
this.getName = function(i){
- if (isValidElementIndex(i)) {return name[i];}
+ if (this.isValidElementIndex(i)) {return this.name[i];}
return false;
};
@@ -1381,7 +1381,7 @@
* @return the value
*/
this.getValue = function(i){
- if (isValidElementIndex(i)) {return value[i];}
+ if (this.isValidElementIndex(i)) {return this.value[i];}
return false;
};
@@ -1394,8 +1394,8 @@
this.setElement = function(aName, aValue){
var i = this.getElementIndexByName(aName);
if (i === false) {i = this.count();}
- name[i] = aName;
- value[i] = aValue;
+ this.name[i] = aName;
+ this.value[i] = aValue;
};
/**
@@ -1406,8 +1406,8 @@
this.delElement = function(aName){
var i = this.getElementIndexByName(aName);
if (i !== false) {
- name.splice(i, 1);
- value.splice(i, 1);
+ this.name.splice(i, 1);
+ this.value.splice(i, 1);
}
}
@@ -1419,14 +1419,14 @@
* @return true if the index is valid; otherwise false
* @type Boolean
*/
- var isValidElementIndex = function(i){
- if (i>=0 && i<name.length) {return true;}
+ this.isValidElementIndex = function(i){
+ if (i>=0 && i<this.name.length) {return true;}
var e = new Mb_exception("class Wfs_element: function isValidElementIndex: illegal element index");
return false;
};
- var name = [];
- var value = [];
+ this.name = [];
+ this.value = [];
}
/**
Modified: trunk/mapbender/lib/basic.js
===================================================================
--- trunk/mapbender/lib/basic.js 2009-04-20 06:38:07 UTC (rev 3899)
+++ trunk/mapbender/lib/basic.js 2009-04-21 09:53:33 UTC (rev 3900)
@@ -47,31 +47,18 @@
window.frames[frameName].document.getElementById("highlight").style.visibility = 'hidden';
}
-function cloneObject(obj) {
- if (typeof obj !== 'object' || obj === null) {
- return obj;
- }
- var c = obj instanceof Array ? [] : {};
- for (var i in obj) {
- var prop = obj[i];
- if (typeof prop == 'object') {
- if (prop instanceof Array) {
- c[i] = [];
- for (var j = 0; j < prop.length; j++) {
- if (typeof prop[j] != 'object') {
- c[i].push(prop[j]);
- } else {
- c[i].push(cloneObject(prop[j]));
- }
- }
- } else {
- c[i] = cloneObject(prop);
- }
- } else {
- c[i] = prop;
- }
- }
- return c;
+function cloneObject (p, c) {
+ var c = c || {};
+ for (var i in p) {
+ if (typeof p[i] === 'object') {
+ c[i] = (p[i].constructor === Array) ? [] : {};
+ cloneObject(p[i], c[i]);
+ }
+ else {
+ c[i] = p[i];
+ }
+ }
+ return c;
}
function mb_timestamp(){
More information about the Mapbender_commits
mailing list