Setting cartocss in internal style

This commit is contained in:
xavijam 2016-09-22 11:51:33 +02:00
parent ddf487f56d
commit 35251805bf

View File

@ -77,7 +77,7 @@ var CartoDatasource = require('./datasource');
this.TILE_SIZE = 256;
this._style = null;
this._gradients = {};
this._forcePoints = false;
}
@ -111,6 +111,9 @@ var CartoDatasource = require('./datasource');
//
setCartoCSS: function(cartocss, callback) {
var self = this;
this.style = cartocss;
if (PointRenderer.isTurboCarto(cartocss)) {
var datasource = new CartoDatasource(self.layer._tiles);
turbocarto(cartocss, datasource, function (err, parsedCartoCSS) {
@ -198,7 +201,7 @@ var CartoDatasource = require('./datasource');
i.src = canvas.toDataURL();
return i;
}
return canvas;
},
@ -234,7 +237,7 @@ var CartoDatasource = require('./datasource');
}
}
}
prof.end(true);
return callback && callback(null);
@ -278,7 +281,7 @@ var CartoDatasource = require('./datasource');
},
//
// renders a tile in the canvas for key defined in
// renders a tile in the canvas for key defined in
// the torque tile
//
_renderTile: function(tile, key, frame_offset, sprites, shader, shaderVars) {
@ -315,7 +318,7 @@ var CartoDatasource = require('./datasource');
}
}
}
prof.end(true);
},
@ -483,7 +486,7 @@ var CartoDatasource = require('./datasource');
}
gradient = {};
var colorize = this._style['image-filters'].args;
var increment = 1/colorize.length;
for (var i = 0; i < colorize.length; i++){
var key = increment * i + increment;