Merge pull request #256 from CartoDB/pointcount
Added pointCount method
This commit is contained in:
commit
178eb5700f
@ -241,7 +241,7 @@ GMapsTorqueLayer.prototype = torque.extend({},
|
||||
this.setKeys([key]);
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* returns the array of keys being rendered
|
||||
*/
|
||||
getKeys: function() {
|
||||
@ -388,6 +388,21 @@ GMapsTorqueLayer.prototype = torque.extend({},
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
/** return the number of points for a step */
|
||||
pointCount: function(step) {
|
||||
var t, tile;
|
||||
step = step === undefined ? this.key: step;
|
||||
var c = 0;
|
||||
for(t in this._tiles) {
|
||||
tile = this._tiles[t];
|
||||
if (tile) {
|
||||
c += tile.timeCount[step];
|
||||
}
|
||||
}
|
||||
return c;
|
||||
},
|
||||
|
||||
getValueForBBox: function(x, y, w, h) {
|
||||
var xf = x + w, yf = y + h;
|
||||
var sum = 0;
|
||||
|
@ -286,7 +286,7 @@ L.TorqueLayer = L.CanvasLayer.extend({
|
||||
this.setKeys([key], options);
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* returns the array of keys being rendered
|
||||
*/
|
||||
getKeys: function() {
|
||||
@ -472,6 +472,20 @@ L.TorqueLayer = L.CanvasLayer.extend({
|
||||
return sum;
|
||||
},
|
||||
|
||||
/** return the number of points for a step */
|
||||
pointCount: function(step) {
|
||||
var t, tile;
|
||||
step = step === undefined ? this.key: step;
|
||||
var c = 0;
|
||||
for(t in this._tiles) {
|
||||
tile = this._tiles[t];
|
||||
if (tile) {
|
||||
c += tile.timeCount[step];
|
||||
}
|
||||
}
|
||||
return c;
|
||||
},
|
||||
|
||||
invalidate: function() {
|
||||
this.provider.reload();
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user