Merge branch 'master' of github.com:developmentseed/mess.js

This commit is contained in:
Tom MacWright 2011-01-26 12:51:42 -05:00
commit 155438fe7c
4 changed files with 19 additions and 19 deletions

View File

@ -775,7 +775,7 @@ mess.Parser = function Parser(env) {
elements.push(e);
} else if (z) {
if (zoom) {
zoom.intersect(z);
zoom.intersection(z);
} else {
zoom = z;
}

View File

@ -41,7 +41,7 @@ mess.Renderer = function Renderer(env) {
var group = this.group();
var autodetect = _.filter(m.Layer, function(l) { return !l.srs; });
_.each(autodetect, function(l) {
var finish = group();
var next = group();
Step(
function() {
fs.readdir(path.dirname(l.Datasource.file), this);
@ -61,11 +61,9 @@ mess.Renderer = function Renderer(env) {
if (!err) {
try {
l.srs = require('srs').parse(srs).proj4;
} catch (err) {
finish(err);
}
} catch (err) {}
}
finish(err);
next(err);
}
);
});
@ -183,6 +181,7 @@ mess.Renderer = function Renderer(env) {
var options = {},
group = this.group();
for (var i = 0, l = results.length; i < l; i++) {
var next = group();
new mess.Parser(_.extend(_.extend({
filename: results[i][0]
}, that.env), this.env)).parse(results[i][1],
@ -192,7 +191,7 @@ mess.Renderer = function Renderer(env) {
throw err;
} else {
try {
group()(err, [
next(err, [
results[i][0],
tree]);
return;

View File

@ -125,17 +125,7 @@ tree.Ruleset.prototype = {
// Create a new object for each so that we can have different
// elements and filters in the selector.
var instance = new tree.Selector();
instance.elements = parent.elements.concat(selector.elements);
instance.filters = parent.filters.concat(selector.filters);
if (parent.zoom && selector.zoom) {
instance.zoom = parent.zoom.clone().intersection(selector.zoom);
} else if (parent.zoom || selector.zoom) {
instance.zoom = (parent.zoom || selector.zoom).clone()
}
instance.attachment = selector.attachment;
instance.index = selector.index;
var instance = parent.clone().merge(selector);
selectors.push(instance);
}
}

View File

@ -18,7 +18,18 @@ tree.Selector.prototype.clone = function() {
obj.zoom = this.zoom.clone();
}
return obj;
}
};
tree.Selector.prototype.merge = function(obj) {
Array.prototype.push.apply(this.elements, obj.elements);
Array.prototype.push.apply(this.filters, obj.filters);
if (obj.attachment) this.attachment = obj.attachment;
this.index = obj.index;
if (this.zoom && obj.zoom) this.zoom.intersection(obj.zoom);
else if (obj.zoom) this.zoom = obj.zoom.clone();
return this;
};
/**
* Determine the specificity of this selector