fix MSS standalone renderer, fixing failing error handling tests after f6c07afee6

This commit is contained in:
Dane Springmeyer 2012-12-21 17:36:18 -08:00
parent 800122e1af
commit 16db1c5b03

View File

@ -26,38 +26,36 @@ carto.Renderer.prototype.renderMSS = function render(data, callback) {
} }
var output = []; var output = [];
var styles = [];
var time = +new Date(); var time = +new Date();
var parser = (carto.Parser(env)).parse(data); var parser = (carto.Parser(env)).parse(data);
if (env.benchmark) { if (env.benchmark) {
console.warn('Parsing time: ' + (new Date() - time) + 'ms'); console.warn('Parsing time: ' + (new Date() - time) + 'ms');
} }
var time = +new Date(); time = +new Date();
var rules = parser.toList(env); var rule_list = parser.toList(env);
var rules = inheritRules(rule_list,env);
if (env.benchmark) { if (env.benchmark) {
console.warn('Rule generation time: ' + (new Date() - time) + 'ms'); console.warn('Rule generation time: ' + (new Date() - time) + 'ms');
} }
var inherited = carto.inheritRules(rules,env); time = +new Date();
var time = +new Date(); var sorted = sortStyles(rules,env);
var sorted = carto.sortStyles(inherited,env);
if (env.benchmark) { if (env.benchmark) {
console.warn('Sorted time: ' + (new Date() - time) + 'ms'); console.warn('Sorted time: ' + (new Date() - time) + 'ms');
} }
var time = +new Date(); var time = +new Date();
_(sorted).each(function(rule,idx) { for (var k = 0, rule, style_name; k < sorted.length; k++) {
var time_sty = +new Date(); rule = sorted[k];
var style = new carto.tree.Style('style', rule.attachment, rule); style_name = 'layer' + (rule.attachment !== '__default__' ? '-' + rule.attachment : '');
styles.push(style_name);
var time_to_xml = +new Date();
// env.effects can be modified by this call
output.push(carto.tree.Style.toXML(style_name, rule.attachment, rule, env));
if (env.benchmark) { if (env.benchmark) {
console.warn('Create style "' + idx + '": ' + (new Date() - time_sty) + 'ms'); console.warn('Calling toXML for style "' + style_name + '" (#'+k + '): ' + (new Date() - time_to_xml) + 'ms');
} }
if (style) { }
// env.effects can be modified by this call
var time_to_xml = +new Date();
output.push(style.toXML(env));
if (env.benchmark) {
console.warn('Calling toXML for style "' + idx + '": ' + (new Date() - time_to_xml) + 'ms');
}
}
});
if (env.benchmark) { if (env.benchmark) {
console.warn('Total Style toXML time: ' + (new Date() - time) + 'ms'); console.warn('Total Style toXML time: ' + (new Date() - time) + 'ms');
} }