Jesus Loves GRASS

Technical blog about GRASS/GIS,open source geoinformatics and MAPSERVER.

Sunday, April 15, 2007

_map / _layer object and new methods/properties

The previous post passed the metadadata to a php variable that contains the properties of the layers, later these values are passed to the object it self when is created by the constructor funcion.

The layer object contains several important methods and properties that will be used mainly by kaLegend to draw everything that is needed to download the layer

The layer object is defined in the kaMap.js and in the "contructor" function (is it correct to call it constructor ?! ) It was added:

this.download = (typeof(o.download) != 'undefined') ? o.download : false;

This is necessary to be certain that the layer always has this property as true or false

The next step is to create a member that returns is a layer is donwloable or not

_layer.prototype.isDownload = function() {
return this.download;
}

the member isDownload will be usefull in the _map object, since this object need a method that gives the list of downloadable layers

_map.prototype.getDownloadLayers = function() {
var r = [];
var l = this.getLayers();
for( var i=0; i<l.length; i++) {
if (l[i].isDownload()) {
r.push(l[i]);
}
}
return r;
};

Labels: , , ,

0 Comments:

Post a Comment

<< Home