removes stuff to avoid more FUD
This commit is contained in:
parent
bbd8402281
commit
b719504d52
@ -108,77 +108,10 @@ var contour = require('./contour');
|
||||
this._sprites = [];
|
||||
},
|
||||
|
||||
|
||||
//
|
||||
// generate sprite based on cartocss style
|
||||
//
|
||||
generateSprite: function(shader, value, shaderVars) {
|
||||
var self = this;
|
||||
var prof = Profiler.metric('torque.renderer.point.generateSprite').start();
|
||||
var st = shader.getStyle({
|
||||
value: value
|
||||
}, shaderVars);
|
||||
if(this._style === null || this._style !== st){
|
||||
this._style = st;
|
||||
}
|
||||
|
||||
var pointSize = st['marker-width'];
|
||||
if (!pointSize) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (st['marker-opacity'] === 0 && !st['marker-line-opacity']) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var canvas = this._createCanvas();
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
var markerFile = st["marker-file"] || st["point-file"];
|
||||
var qualifiedUrl = markerFile && this._qualifyURL(markerFile);
|
||||
|
||||
if (qualifiedUrl && this._iconsToLoad <= 0 && this._icons[qualifiedUrl]) {
|
||||
var img = this._icons[qualifiedUrl];
|
||||
|
||||
var dWidth = Math.min(st['marker-width'] * 2 || img.width, cartocss.MAX_SPRITE_RADIUS * 2);
|
||||
var dHeight = Math.min((st['marker-height'] || dWidth) * (img.width / img.height), cartocss.MAX_SPRITE_RADIUS * 2);
|
||||
|
||||
canvas.width = ctx.width = dWidth;
|
||||
canvas.height = ctx.height = dHeight;
|
||||
|
||||
ctx.scale(dWidth/img.width, dHeight/img.height);
|
||||
|
||||
cartocss.renderSprite(ctx, img, st);
|
||||
} else {
|
||||
// take into account the exterior ring to calculate the size
|
||||
var canvasSize = (st['marker-line-width'] || 0) + pointSize*2;
|
||||
var w = ctx.width = canvas.width = ctx.height = canvas.height = Math.ceil(canvasSize);
|
||||
ctx.translate(w/2, w/2);
|
||||
|
||||
var mt = st['marker-type'];
|
||||
if (mt && mt === 'rectangle') {
|
||||
cartocss.renderRectangle(ctx, st);
|
||||
} else {
|
||||
cartocss.renderPoint(ctx, st);
|
||||
}
|
||||
}
|
||||
prof.end(true);
|
||||
if (torque.flags.sprites_to_images) {
|
||||
var i = this._createImage();
|
||||
i.src = canvas.toDataURL();
|
||||
return i;
|
||||
}
|
||||
|
||||
return canvas;
|
||||
},
|
||||
|
||||
//
|
||||
// renders all the layers (and frames for each layer) from cartocss
|
||||
//
|
||||
renderTile: function(tile, key, pos) {
|
||||
if(tile && !this.firstTileCoords){
|
||||
this.firstTileCoords = tile.coord;
|
||||
}
|
||||
if (this._iconsToLoad > 0) {
|
||||
this.on('allIconsLoaded', function() {
|
||||
this.renderTile.apply(this, [tile, key, callback]);
|
||||
@ -261,54 +194,21 @@ var contour = require('./contour');
|
||||
var activePixels = tile.timeCount[key];
|
||||
var anchor = this.options.resolution/2;
|
||||
|
||||
|
||||
if (activePixels) {
|
||||
|
||||
/*
|
||||
Torque Isolines
|
||||
To be moved somewhere else (ideally something link isolines.js within /renderer/)
|
||||
*/
|
||||
var isolines = true;
|
||||
if (isolines) {
|
||||
function getRandomColor() {
|
||||
var letters = '0123456789ABCDEF'.split('');
|
||||
var color = '#';
|
||||
for (var i = 0; i < 6; i++ ) {
|
||||
color += letters[Math.floor(Math.random() * 16)];
|
||||
}
|
||||
return color;
|
||||
}
|
||||
|
||||
var grid = this._gridData(tile);
|
||||
var res = this.options.resolution;
|
||||
// for (var y = 0; y < grid.length; y++){
|
||||
// for (var x = 0; x < grid[0].length; x++){
|
||||
// ctx.beginPath();
|
||||
// ctx.arc(anchor + x*res, anchor + y*res, 1, 0, 2 * Math.PI, false);
|
||||
// var value = grid[y][x];
|
||||
// ctx.fillStyle = "rgb("+0+", "+value * 50+", "+value * 50+")";
|
||||
// if(value === 0) ctx.fillStyle = "red";
|
||||
// ctx.fill();
|
||||
// }
|
||||
// }
|
||||
var isolines = true;
|
||||
if (isolines) {
|
||||
function getRandomColor() {
|
||||
var letters = '0123456789ABCDEF'.split('');
|
||||
var color = '#';
|
||||
for (var i = 0; i < 6; i++ ) {
|
||||
color += letters[Math.floor(Math.random() * 16)];
|
||||
}
|
||||
return color;
|
||||
}
|
||||
|
||||
// var pixelIndex = tile.timeIndex[key];
|
||||
// for(var p = 0; p < activePixels; ++p) {
|
||||
// var posIdx = tile.renderDataPos[pixelIndex + p];
|
||||
// var c = tile.renderData[pixelIndex + p];
|
||||
// if (c) {
|
||||
// var sp = sprites[c];
|
||||
// if (sp === undefined) {
|
||||
// sp = sprites[c] = this.generateSprite(shader, c, torque.extend({ zoom: tile.z, 'frame-offset': frame_offset }, shaderVars));
|
||||
// }
|
||||
// if (sp) {
|
||||
// var x = tile.x[posIdx]- (sp.width >> 1) + anchor;
|
||||
// var y = tileMax - tile.y[posIdx] + anchor; // flip mercator
|
||||
// ctx.drawImage(sp, x, y - (sp.height >> 1));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
this._gridData(tile);
|
||||
}
|
||||
prof.end(true);
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user