This commit is contained in:
Stuart Lynn 2015-09-09 09:58:08 -04:00
parent b9bcb1b33f
commit e9bde54840
4 changed files with 24 additions and 66 deletions

12
dist/torque.full.js vendored

File diff suppressed because one or more lines are too long

View File

@ -2807,7 +2807,6 @@ L.TorqueLayer = L.CanvasLayer.extend({
var bb = thisValue.bbox; var bb = thisValue.bbox;
var xy = this._map.latLngToContainerPoint([bb[1].lat, bb[1].lon]); var xy = this._map.latLngToContainerPoint([bb[1].lat, bb[1].lon]);
if(xy.x < xf && xy.y < yf){ if(xy.x < xf && xy.y < yf){
console.log("just before sum value ", this.Value.value)
sum += thisValue.value; sum += thisValue.value;
} }
} }
@ -3435,7 +3434,6 @@ var Profiler = require('../profiler');
if(this.options.is_time) { if(this.options.is_time) {
column_conv = format("date_part('epoch', {column})", this.options); column_conv = format("date_part('epoch', {column})", this.options);
} }
console.log("columns are ", this.options.countby)
var sql = "" + var sql = "" +
"WITH " + "WITH " +
@ -3481,7 +3479,6 @@ var Profiler = require('../profiler');
_sql: this.getSQL() _sql: this.getSQL()
}); });
console.log("sql is ", query)
var self = this; var self = this;
this.sql(query, function (data) { this.sql(query, function (data) {
@ -3603,7 +3600,7 @@ var Profiler = require('../profiler');
"layers": [{ "layers": [{
"type": "cartodb", "type": "cartodb",
"options": { "options": {
"cartocss_version": "2.1.1", "cartocss_version": "2.1.1",
"cartocss": "#layer {}", "cartocss": "#layer {}",
"sql": this.getSQL() "sql": this.getSQL()
} }
@ -4152,7 +4149,7 @@ var Profiler = require('../profiler');
this.options.cartocss = c; this.options.cartocss = c;
},*/ },*/
setSteps: function(steps, opt) { setSteps: function(steps, opt) {
opt = opt || {}; opt = opt || {};
if (this.options.steps !== steps) { if (this.options.steps !== steps) {
this.options.steps = steps; this.options.steps = steps;
@ -4257,12 +4254,10 @@ var Profiler = require('../profiler');
.replace('{s}', subdomains[index]) .replace('{s}', subdomains[index])
var extra = this._extraParams(); var extra = this._extraParams();
torque.net.get( url + (extra ? "?" + extra: ''), function (data) { torque.net.get( url + (extra ? "?" + extra: ''), function (data) {
prof_fetch_time.end(); prof_fetch_time.end();
if (data && data.responseText) { if (data && data.responseText) {
var rows = JSON.parse(data.responseText); var rows = JSON.parse(data.responseText);
console.log("tile data ", rows)
callback(self.proccessTile(rows, coord, zoom)); callback(self.proccessTile(rows, coord, zoom));
} else { } else {
Profiler.metric('torque.provider.windshaft.tile.error').inc(); Profiler.metric('torque.provider.windshaft.tile.error').inc();
@ -4403,7 +4398,7 @@ var Profiler = require('../profiler');
}] }]
}; };
} }
if(this.options.stat_tag){ if(this.options.stat_tag){
allParams["stat_tag"] = this.options.stat_tag; allParams["stat_tag"] = this.options.stat_tag;
} }
@ -4453,9 +4448,9 @@ var Profiler = require('../profiler');
},{"../":10,"../profiler":17}],22:[function(require,module,exports){ },{"../":10,"../profiler":17}],22:[function(require,module,exports){
var TAU = Math.PI*2; var TAU = Math.PI*2;
// min value to render a line. // min value to render a line.
// it does not make sense to render a line of a width is not even visible // it does not make sense to render a line of a width is not even visible
var LINEWIDTH_MIN_VALUE = 0.05; var LINEWIDTH_MIN_VALUE = 0.05;
var MAX_SPRITE_RADIUS = 255; var MAX_SPRITE_RADIUS = 255;
function renderPoint(ctx, st) { function renderPoint(ctx, st) {
@ -4527,21 +4522,6 @@ var Profiler = require('../profiler');
} }
} }
function renderVector(ctx,img,st){
var markerWidth = st['maker-width']
var direction = st['vector-direction']
var mag = st['vector-mag']
var lineWidth = st['marker-line-width']
var strokeStyle = st['marker-line-color']
ctx.lineWidth = lineWidth
ctx.strokeStyle = strokeStyle
ctx.beginPath();
ctx.moveTo(0,0);
ctx.lineTo(300,150);
ctx.stroke();
}
function renderSprite(ctx, img, st) { function renderSprite(ctx, img, st) {
if(img.complete){ if(img.complete){
@ -4897,7 +4877,6 @@ var Filters = require('./torque_filters');
// return the value for x, y (tile coordinates) // return the value for x, y (tile coordinates)
// null for no value // null for no value
getValueFor: function(tile, step, px, py) { getValueFor: function(tile, step, px, py) {
// console.log('getting value for tile ', tile, step, px, py)
var mercator = new torque.Mercator(); var mercator = new torque.Mercator();
var res = this.options.resolution; var res = this.options.resolution;
var res2 = res >> 1; var res2 = res >> 1;
@ -4908,15 +4887,15 @@ var Filters = require('./torque_filters');
var pixelIndex = tile.timeIndex[step]; var pixelIndex = tile.timeIndex[step];
for(var p = 0; p < activePixels; ++p) { for(var p = 0; p < activePixels; ++p) {
var posIdx = tile.renderDataPos[pixelIndex + p]; var posIdx = tile.renderDataPos[pixelIndex + p];
var c = [tile.renderData[0][pixelIndex + p], tile.renderData[1][pixelIndex + p]]
// console.log("tile.renderData ", tile.renderData[pixelIndex + p] ) var c =tile.renderData.map(function(r){ return r[pixelIndex + p]})
if (c) { if (c) {
var x = tile.x[posIdx]; var x = tile.x[posIdx];
var y = tileMax - tile.y[posIdx]; var y = tileMax - tile.y[posIdx];
var dx = px + res2 - x; var dx = px + res2 - x;
var dy = py + res2 - y; var dy = py + res2 - y;
if (dx >= 0 && dx < res && dy >= 0 && dy < res) { if (dx >= 0 && dx < res && dy >= 0 && dy < res) {
// console.log('returning value ', c, " from ", tile.renderData[pixelIndex + p])
return { return {
value: c, value: c,
bbox: mercator.tilePixelBBox( bbox: mercator.tilePixelBBox(

4
dist/torque.js vendored

File diff suppressed because one or more lines are too long

View File

@ -2814,7 +2814,6 @@ L.TorqueLayer = L.CanvasLayer.extend({
var bb = thisValue.bbox; var bb = thisValue.bbox;
var xy = this._map.latLngToContainerPoint([bb[1].lat, bb[1].lon]); var xy = this._map.latLngToContainerPoint([bb[1].lat, bb[1].lon]);
if(xy.x < xf && xy.y < yf){ if(xy.x < xf && xy.y < yf){
console.log("just before sum value ", this.Value.value)
sum += thisValue.value; sum += thisValue.value;
} }
} }
@ -3442,7 +3441,6 @@ var Profiler = require('../profiler');
if(this.options.is_time) { if(this.options.is_time) {
column_conv = format("date_part('epoch', {column})", this.options); column_conv = format("date_part('epoch', {column})", this.options);
} }
console.log("columns are ", this.options.countby)
var sql = "" + var sql = "" +
"WITH " + "WITH " +
@ -3488,7 +3486,6 @@ var Profiler = require('../profiler');
_sql: this.getSQL() _sql: this.getSQL()
}); });
console.log("sql is ", query)
var self = this; var self = this;
this.sql(query, function (data) { this.sql(query, function (data) {
@ -3610,7 +3607,7 @@ var Profiler = require('../profiler');
"layers": [{ "layers": [{
"type": "cartodb", "type": "cartodb",
"options": { "options": {
"cartocss_version": "2.1.1", "cartocss_version": "2.1.1",
"cartocss": "#layer {}", "cartocss": "#layer {}",
"sql": this.getSQL() "sql": this.getSQL()
} }
@ -4159,7 +4156,7 @@ var Profiler = require('../profiler');
this.options.cartocss = c; this.options.cartocss = c;
},*/ },*/
setSteps: function(steps, opt) { setSteps: function(steps, opt) {
opt = opt || {}; opt = opt || {};
if (this.options.steps !== steps) { if (this.options.steps !== steps) {
this.options.steps = steps; this.options.steps = steps;
@ -4264,12 +4261,10 @@ var Profiler = require('../profiler');
.replace('{s}', subdomains[index]) .replace('{s}', subdomains[index])
var extra = this._extraParams(); var extra = this._extraParams();
torque.net.get( url + (extra ? "?" + extra: ''), function (data) { torque.net.get( url + (extra ? "?" + extra: ''), function (data) {
prof_fetch_time.end(); prof_fetch_time.end();
if (data && data.responseText) { if (data && data.responseText) {
var rows = JSON.parse(data.responseText); var rows = JSON.parse(data.responseText);
console.log("tile data ", rows)
callback(self.proccessTile(rows, coord, zoom)); callback(self.proccessTile(rows, coord, zoom));
} else { } else {
Profiler.metric('torque.provider.windshaft.tile.error').inc(); Profiler.metric('torque.provider.windshaft.tile.error').inc();
@ -4410,7 +4405,7 @@ var Profiler = require('../profiler');
}] }]
}; };
} }
if(this.options.stat_tag){ if(this.options.stat_tag){
allParams["stat_tag"] = this.options.stat_tag; allParams["stat_tag"] = this.options.stat_tag;
} }
@ -4460,9 +4455,9 @@ var Profiler = require('../profiler');
},{"../":10,"../profiler":17}],22:[function(require,module,exports){ },{"../":10,"../profiler":17}],22:[function(require,module,exports){
var TAU = Math.PI*2; var TAU = Math.PI*2;
// min value to render a line. // min value to render a line.
// it does not make sense to render a line of a width is not even visible // it does not make sense to render a line of a width is not even visible
var LINEWIDTH_MIN_VALUE = 0.05; var LINEWIDTH_MIN_VALUE = 0.05;
var MAX_SPRITE_RADIUS = 255; var MAX_SPRITE_RADIUS = 255;
function renderPoint(ctx, st) { function renderPoint(ctx, st) {
@ -4534,21 +4529,6 @@ var Profiler = require('../profiler');
} }
} }
function renderVector(ctx,img,st){
var markerWidth = st['maker-width']
var direction = st['vector-direction']
var mag = st['vector-mag']
var lineWidth = st['marker-line-width']
var strokeStyle = st['marker-line-color']
ctx.lineWidth = lineWidth
ctx.strokeStyle = strokeStyle
ctx.beginPath();
ctx.moveTo(0,0);
ctx.lineTo(300,150);
ctx.stroke();
}
function renderSprite(ctx, img, st) { function renderSprite(ctx, img, st) {
if(img.complete){ if(img.complete){
@ -4904,7 +4884,6 @@ var Filters = require('./torque_filters');
// return the value for x, y (tile coordinates) // return the value for x, y (tile coordinates)
// null for no value // null for no value
getValueFor: function(tile, step, px, py) { getValueFor: function(tile, step, px, py) {
// console.log('getting value for tile ', tile, step, px, py)
var mercator = new torque.Mercator(); var mercator = new torque.Mercator();
var res = this.options.resolution; var res = this.options.resolution;
var res2 = res >> 1; var res2 = res >> 1;
@ -4915,15 +4894,15 @@ var Filters = require('./torque_filters');
var pixelIndex = tile.timeIndex[step]; var pixelIndex = tile.timeIndex[step];
for(var p = 0; p < activePixels; ++p) { for(var p = 0; p < activePixels; ++p) {
var posIdx = tile.renderDataPos[pixelIndex + p]; var posIdx = tile.renderDataPos[pixelIndex + p];
var c = [tile.renderData[0][pixelIndex + p], tile.renderData[1][pixelIndex + p]]
// console.log("tile.renderData ", tile.renderData[pixelIndex + p] ) var c =tile.renderData.map(function(r){ return r[pixelIndex + p]})
if (c) { if (c) {
var x = tile.x[posIdx]; var x = tile.x[posIdx];
var y = tileMax - tile.y[posIdx]; var y = tileMax - tile.y[posIdx];
var dx = px + res2 - x; var dx = px + res2 - x;
var dy = py + res2 - y; var dy = py + res2 - y;
if (dx >= 0 && dx < res && dy >= 0 && dy < res) { if (dx >= 0 && dx < res && dy >= 0 && dy < res) {
// console.log('returning value ', c, " from ", tile.renderData[pixelIndex + p])
return { return {
value: c, value: c,
bbox: mercator.tilePixelBBox( bbox: mercator.tilePixelBBox(