adds dists for 2.12
This commit is contained in:
parent
5767ed7f35
commit
1bdaed7bcb
14
dist/torque.full.js
vendored
14
dist/torque.full.js
vendored
File diff suppressed because one or more lines are too long
522
dist/torque.full.uncompressed.js
vendored
522
dist/torque.full.uncompressed.js
vendored
@ -604,7 +604,7 @@ TorqueLayer.optionsFromCartoCSS = function(cartocss) {
|
||||
module.exports.TorqueLayer = TorqueLayer;
|
||||
|
||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{"carto":36}],4:[function(require,module,exports){
|
||||
},{"carto":37}],4:[function(require,module,exports){
|
||||
(function (global){
|
||||
var Event = {};
|
||||
Event.on = function(evt, callback) {
|
||||
@ -1567,6 +1567,8 @@ function GMapsTorqueLayer(options) {
|
||||
torque.common.TorqueLayer.optionsFromCartoCSS(options.cartocss));
|
||||
}
|
||||
|
||||
if(options.tileJSON) this.options.provider = "tileJSON";
|
||||
|
||||
this.hidden = !this.options.visible;
|
||||
|
||||
this.animator = new torque.Animator(function(time) {
|
||||
@ -1574,7 +1576,17 @@ function GMapsTorqueLayer(options) {
|
||||
if(self.key !== k) {
|
||||
self.setKey(k);
|
||||
}
|
||||
}, torque.clone(this.options));
|
||||
}, torque.extend(torque.clone(this.options), {
|
||||
onPause: function() {
|
||||
self.fire('pause');
|
||||
},
|
||||
onStop: function() {
|
||||
self.fire('stop');
|
||||
},
|
||||
onStart: function() {
|
||||
self.fire('play');
|
||||
}
|
||||
}));
|
||||
|
||||
this.play = this.animator.start.bind(this.animator);
|
||||
this.stop = this.animator.stop.bind(this.animator);
|
||||
@ -1606,7 +1618,8 @@ GMapsTorqueLayer.prototype = torque.extend({},
|
||||
providers: {
|
||||
'sql_api': torque.providers.json,
|
||||
'url_template': torque.providers.JsonArray,
|
||||
'windshaft': torque.providers.windshaft
|
||||
'windshaft': torque.providers.windshaft,
|
||||
'tileJSON': torque.providers.tileJSON
|
||||
},
|
||||
|
||||
renderers: {
|
||||
@ -1707,6 +1720,7 @@ GMapsTorqueLayer.prototype = torque.extend({},
|
||||
// don't load tiles that are not being shown
|
||||
if (t.zoom !== self.options.map.getZoom()) return;
|
||||
self._tileLoaded(t, tileData);
|
||||
self.fire('tileLoaded');
|
||||
if (tileData) {
|
||||
self.redraw();
|
||||
}
|
||||
@ -1848,6 +1862,20 @@ GMapsTorqueLayer.prototype = torque.extend({},
|
||||
google.maps.event.removeListener(this._cacheListener);
|
||||
},
|
||||
|
||||
/**
|
||||
* return an array with the values for all the pixels active for the step
|
||||
*/
|
||||
getValues: function(step) {
|
||||
var values = [];
|
||||
step = step === undefined ? this.key: step;
|
||||
var t, tile;
|
||||
for(t in this._tiles) {
|
||||
tile = this._tiles[t];
|
||||
this.renderer.getValues(tile, step, values);
|
||||
}
|
||||
return values;
|
||||
},
|
||||
|
||||
getValueForPos: function(x, y, step) {
|
||||
step = step === undefined ? this.key: step;
|
||||
var t, tile, pos, value = null, xx, yy;
|
||||
@ -1974,7 +2002,7 @@ module.exports = {
|
||||
};
|
||||
|
||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{"../":10,"./CanvasLayer":5,"./canvas_tile_layer":6,"./gmaps_tileloader_mixin":7,"carto":36}],10:[function(require,module,exports){
|
||||
},{"../":10,"./CanvasLayer":5,"./canvas_tile_layer":6,"./gmaps_tileloader_mixin":7,"carto":37}],10:[function(require,module,exports){
|
||||
module.exports = require('./core');
|
||||
|
||||
module.exports.Animator = require('./animator');
|
||||
@ -1993,7 +2021,7 @@ module.exports.GMapsTileLoader = gmaps.GMapsTileLoader;
|
||||
module.exports.GMapsTorqueLayer = gmaps.GMapsTorqueLayer;
|
||||
module.exports.GMapsTiledTorqueLayer = gmaps.GMapsTiledTorqueLayer;
|
||||
|
||||
},{"./animator":1,"./cartocss_reference":2,"./common":3,"./core":4,"./gmaps":8,"./leaflet":12,"./math":15,"./mercator":16,"./provider":18,"./renderer":23,"./request":27}],11:[function(require,module,exports){
|
||||
},{"./animator":1,"./cartocss_reference":2,"./common":3,"./core":4,"./gmaps":8,"./leaflet":12,"./math":15,"./mercator":16,"./provider":18,"./renderer":24,"./request":28}],11:[function(require,module,exports){
|
||||
require('./leaflet_tileloader_mixin');
|
||||
|
||||
/**
|
||||
@ -2418,7 +2446,8 @@ L.TorqueLayer = L.CanvasLayer.extend({
|
||||
providers: {
|
||||
'sql_api': torque.providers.json,
|
||||
'url_template': torque.providers.JsonArray,
|
||||
'windshaft': torque.providers.windshaft
|
||||
'windshaft': torque.providers.windshaft,
|
||||
'tileJSON': torque.providers.tileJSON
|
||||
},
|
||||
|
||||
renderers: {
|
||||
@ -2473,6 +2502,8 @@ L.TorqueLayer = L.CanvasLayer.extend({
|
||||
this.options.renderer = this.options.renderer || 'point';
|
||||
this.options.provider = this.options.provider || 'windshaft';
|
||||
|
||||
if (this.options.tileJSON) this.options.provider = 'tileJSON';
|
||||
|
||||
this.provider = new this.providers[this.options.provider](options);
|
||||
this.renderer = new this.renderers[this.options.renderer](this.getCanvas(), options);
|
||||
|
||||
@ -2501,6 +2532,7 @@ L.TorqueLayer = L.CanvasLayer.extend({
|
||||
if (tileData) {
|
||||
self.redraw();
|
||||
}
|
||||
self.fire('tileLoaded');
|
||||
});
|
||||
}, this);
|
||||
|
||||
@ -2776,6 +2808,20 @@ L.TorqueLayer = L.CanvasLayer.extend({
|
||||
return positions;
|
||||
},
|
||||
|
||||
/**
|
||||
* return an array with the values for all the pixels active for the step
|
||||
*/
|
||||
getValues: function(step) {
|
||||
var values = [];
|
||||
step = step === undefined ? this.key: step;
|
||||
var t, tile;
|
||||
for(t in this._tiles) {
|
||||
tile = this._tiles[t];
|
||||
this.renderer.getValues(tile, step, values);
|
||||
}
|
||||
return values;
|
||||
},
|
||||
|
||||
/**
|
||||
* return the value for position relative to map coordinates. null for no value
|
||||
*/
|
||||
@ -2821,7 +2867,7 @@ L.TorqueLayer = L.CanvasLayer.extend({
|
||||
});
|
||||
|
||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{"../":10,"./canvas_layer":11,"carto":36}],15:[function(require,module,exports){
|
||||
},{"../":10,"./canvas_layer":11,"carto":37}],15:[function(require,module,exports){
|
||||
function clamp(a, b) {
|
||||
return function(t) {
|
||||
return Math.max(Math.min(t, b), a);
|
||||
@ -3095,10 +3141,11 @@ module.exports = Profiler;
|
||||
module.exports = {
|
||||
json: require('./json'),
|
||||
JsonArray: require('./jsonarray'),
|
||||
windshaft: require('./windshaft')
|
||||
windshaft: require('./windshaft'),
|
||||
tileJSON: require('./tilejson')
|
||||
};
|
||||
|
||||
},{"./json":19,"./jsonarray":20,"./windshaft":21}],19:[function(require,module,exports){
|
||||
},{"./json":19,"./jsonarray":20,"./tilejson":21,"./windshaft":22}],19:[function(require,module,exports){
|
||||
var torque = require('../');
|
||||
var Profiler = require('../profiler');
|
||||
|
||||
@ -3909,6 +3956,344 @@ var Profiler = require('../profiler');
|
||||
|
||||
},{"../":10,"../profiler":17}],21:[function(require,module,exports){
|
||||
var torque = require('../');
|
||||
|
||||
var Uint8Array = torque.types.Uint8Array;
|
||||
var Int32Array = torque.types.Int32Array;
|
||||
var Uint32Array = torque.types.Uint32Array;
|
||||
var Uint8ClampedArray = torque.types.Uint8ClampedArray;
|
||||
|
||||
// format('hello, {0}', 'rambo') -> "hello, rambo"
|
||||
function format(str) {
|
||||
for(var i = 1; i < arguments.length; ++i) {
|
||||
var attrs = arguments[i];
|
||||
for(var attr in attrs) {
|
||||
str = str.replace(RegExp('\\{' + attr + '\\}', 'g'), attrs[attr]);
|
||||
}
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
var tileJSON = function (options) {
|
||||
this._ready = false;
|
||||
this._tileQueue = [];
|
||||
this.options = options;
|
||||
|
||||
this.options.coordinates_data_type = this.options.coordinates_data_type || Uint8Array;
|
||||
|
||||
if (this.options.data_aggregation) {
|
||||
this.options.cumulative = this.options.data_aggregation === 'cumulative';
|
||||
}
|
||||
if (this.options.auth_token) {
|
||||
var e = this.options.extra_params || (this.options.extra_params = {});
|
||||
e.auth_token = this.options.auth_token;
|
||||
}
|
||||
if (!this.options.no_fetch_map) {
|
||||
this._fetchMap();
|
||||
}
|
||||
};
|
||||
|
||||
tileJSON.prototype = {
|
||||
|
||||
NAME: "tileJSON",
|
||||
|
||||
/**
|
||||
* return the torque tile encoded in an efficient javascript
|
||||
* structure:
|
||||
* {
|
||||
* x:Uint8Array x coordinates in tile reference system, normally from 0-255
|
||||
* y:Uint8Array y coordinates in tile reference system
|
||||
* Index: Array index to the properties
|
||||
* }
|
||||
*/
|
||||
proccessTile: function(rows, coord, zoom) {
|
||||
var r;
|
||||
var x = new this.options.coordinates_data_type(rows.length);
|
||||
var y = new this.options.coordinates_data_type(rows.length);
|
||||
|
||||
// count number of dates
|
||||
var dates = 0;
|
||||
var maxDateSlots = -1;
|
||||
for (r = 0; r < rows.length; ++r) {
|
||||
var row = rows[r];
|
||||
dates += row.dates__uint16.length;
|
||||
for(var d = 0; d < row.dates__uint16.length; ++d) {
|
||||
maxDateSlots = Math.max(maxDateSlots, row.dates__uint16[d]);
|
||||
}
|
||||
}
|
||||
|
||||
if(this.options.cumulative) {
|
||||
dates = (1 + maxDateSlots) * rows.length;
|
||||
}
|
||||
|
||||
var type = this.options.cumulative ? Uint32Array: Uint8ClampedArray;
|
||||
|
||||
// reserve memory for all the dates
|
||||
var timeIndex = new Int32Array(maxDateSlots + 1); //index-size
|
||||
var timeCount = new Int32Array(maxDateSlots + 1);
|
||||
var renderData = new (this.options.valueDataType || type)(dates);
|
||||
var renderDataPos = new Uint32Array(dates);
|
||||
|
||||
var rowsPerSlot = {};
|
||||
|
||||
// precache pixel positions
|
||||
for (var r = 0; r < rows.length; ++r) {
|
||||
var row = rows[r];
|
||||
x[r] = row.x__uint8 * this.options.resolution;
|
||||
y[r] = row.y__uint8 * this.options.resolution;
|
||||
|
||||
var dates = row.dates__uint16;
|
||||
var vals = row.vals__uint8;
|
||||
if (!this.options.cumulative) {
|
||||
for (var j = 0, len = dates.length; j < len; ++j) {
|
||||
var rr = rowsPerSlot[dates[j]] || (rowsPerSlot[dates[j]] = []);
|
||||
if(this.options.cumulative) {
|
||||
vals[j] += prev_val;
|
||||
}
|
||||
prev_val = vals[j];
|
||||
rr.push([r, vals[j]]);
|
||||
}
|
||||
} else {
|
||||
var valByDate = {}
|
||||
for (var j = 0, len = dates.length; j < len; ++j) {
|
||||
valByDate[dates[j]] = vals[j];
|
||||
}
|
||||
var accum = 0;
|
||||
|
||||
// extend the latest to the end
|
||||
for (var j = dates[0]; j <= maxDateSlots; ++j) {
|
||||
var rr = rowsPerSlot[j] || (rowsPerSlot[j] = []);
|
||||
var v = valByDate[j];
|
||||
if (v) {
|
||||
accum += v;
|
||||
}
|
||||
rr.push([r, accum]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// for each timeslot search active buckets
|
||||
var renderDataIndex = 0;
|
||||
var timeSlotIndex = 0;
|
||||
var i = 0;
|
||||
for(var i = 0; i <= maxDateSlots; ++i) {
|
||||
var c = 0;
|
||||
var slotRows = rowsPerSlot[i]
|
||||
if(slotRows) {
|
||||
for (var r = 0; r < slotRows.length; ++r) {
|
||||
var rr = slotRows[r];
|
||||
++c;
|
||||
renderDataPos[renderDataIndex] = rr[0]
|
||||
renderData[renderDataIndex] = rr[1];
|
||||
++renderDataIndex;
|
||||
}
|
||||
}
|
||||
timeIndex[i] = timeSlotIndex;
|
||||
timeCount[i] = c;
|
||||
timeSlotIndex += c;
|
||||
}
|
||||
|
||||
return {
|
||||
x: x,
|
||||
y: y,
|
||||
z: zoom,
|
||||
coord: {
|
||||
x: coord.x,
|
||||
y: coord.y,
|
||||
z: zoom
|
||||
},
|
||||
timeCount: timeCount,
|
||||
timeIndex: timeIndex,
|
||||
renderDataPos: renderDataPos,
|
||||
renderData: renderData,
|
||||
maxDate: maxDateSlots
|
||||
};
|
||||
},
|
||||
|
||||
setSteps: function(steps, opt) {
|
||||
opt = opt || {};
|
||||
if (this.options.steps !== steps) {
|
||||
this.options.steps = steps;
|
||||
this.options.step = (this.options.end - this.options.start)/this.getSteps();
|
||||
this.options.step = this.options.step || 1;
|
||||
if (!opt.silent) this.reload();
|
||||
}
|
||||
},
|
||||
|
||||
setOptions: function(opt) {
|
||||
var refresh = false;
|
||||
|
||||
if(opt.resolution !== undefined && opt.resolution !== this.options.resolution) {
|
||||
this.options.resolution = opt.resolution;
|
||||
refresh = true;
|
||||
}
|
||||
|
||||
if(opt.steps !== undefined && opt.steps !== this.options.steps) {
|
||||
this.setSteps(opt.steps, { silent: true });
|
||||
refresh = true;
|
||||
}
|
||||
|
||||
if(opt.column !== undefined && opt.column !== this.options.column) {
|
||||
this.options.column = opt.column;
|
||||
refresh = true;
|
||||
}
|
||||
|
||||
if(opt.countby !== undefined && opt.countby !== this.options.countby) {
|
||||
this.options.countby = opt.countby;
|
||||
refresh = true;
|
||||
}
|
||||
|
||||
if(opt.data_aggregation !== undefined) {
|
||||
var c = opt.data_aggregation === 'cumulative';
|
||||
if (this.options.cumulative !== c) {
|
||||
this.options.cumulative = c;
|
||||
refresh = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (refresh) this.reload();
|
||||
return refresh;
|
||||
},
|
||||
|
||||
_extraParams: function(e) {
|
||||
e = torque.extend(torque.extend({}, e), this.options.extra_params);
|
||||
if (e) {
|
||||
var p = [];
|
||||
for(var k in e) {
|
||||
var v = e[k];
|
||||
if (v) {
|
||||
if (torque.isArray(v)) {
|
||||
for (var i = 0, len = v.length; i < len; i++) {
|
||||
p.push(k + "[]=" + encodeURIComponent(v[i]));
|
||||
}
|
||||
} else {
|
||||
p.push(k + "=" + encodeURIComponent(v));
|
||||
}
|
||||
}
|
||||
}
|
||||
return p.join('&');
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
getTileData: function(coord, zoom, callback) {
|
||||
if(!this._ready) {
|
||||
this._tileQueue.push([coord, zoom, callback]);
|
||||
} else {
|
||||
this._getTileData(coord, zoom, callback);
|
||||
}
|
||||
},
|
||||
|
||||
_setReady: function(ready) {
|
||||
this._ready = true;
|
||||
this._processQueue();
|
||||
this.options.ready && this.options.ready();
|
||||
},
|
||||
|
||||
_processQueue: function() {
|
||||
var item;
|
||||
while (item = this._tileQueue.pop()) {
|
||||
this._getTileData.apply(this, item);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* `coord` object like {x : tilex, y: tiley }
|
||||
* `zoom` quadtree zoom level
|
||||
*/
|
||||
_getTileData: function(coord, zoom, callback) {
|
||||
var self = this;
|
||||
var subdomains = this.options.subdomains || '0123';
|
||||
var limit_x = Math.pow(2, zoom);
|
||||
var corrected_x = ((coord.x % limit_x) + limit_x) % limit_x;
|
||||
var index = Math.abs(corrected_x + coord.y) % subdomains.length;
|
||||
var url = this.templateUrl
|
||||
.replace('{x}', corrected_x)
|
||||
.replace('{y}', coord.y)
|
||||
.replace('{z}', zoom)
|
||||
.replace('{s}', subdomains[index])
|
||||
torque.net.get( url , function (data) {
|
||||
if (data && data.responseText) {
|
||||
var rows = JSON.parse(data.responseText);
|
||||
callback(self.proccessTile(rows, coord, zoom));
|
||||
} else {
|
||||
callback(null);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
getKeySpan: function() {
|
||||
return {
|
||||
start: this.options.start,
|
||||
end: this.options.end,
|
||||
step: this.options.step,
|
||||
steps: this.options.steps,
|
||||
columnType: this.options.column_type
|
||||
};
|
||||
},
|
||||
|
||||
setColumn: function(column, isTime) {
|
||||
this.options.column = column;
|
||||
this.options.is_time = isTime === undefined ? true: false;
|
||||
this.reload();
|
||||
},
|
||||
|
||||
reload: function() {
|
||||
this._ready = false;
|
||||
this._fetchMap();
|
||||
},
|
||||
|
||||
getSteps: function() {
|
||||
return Math.min(this.options.steps, this.options.data_steps);
|
||||
},
|
||||
|
||||
getBounds: function() {
|
||||
return this.options.bounds;
|
||||
},
|
||||
|
||||
getSQL: function() {
|
||||
return this.options.sql || "select * from " + this.options.table;
|
||||
},
|
||||
|
||||
setSQL: function(sql) {
|
||||
if (this.options.sql != sql) {
|
||||
this.options.sql = sql;
|
||||
this.reload();
|
||||
}
|
||||
},
|
||||
|
||||
_isUserTemplateUrl: function(t) {
|
||||
return t && t.indexOf('{user}') !== -1;
|
||||
},
|
||||
|
||||
isHttps: function() {
|
||||
return this.options.maps_api_template.indexOf('https') === 0;
|
||||
},
|
||||
|
||||
_fetchMap: function(callback) {
|
||||
var self = this;
|
||||
torque.net.get(this.options.tileJSON, function (data) {
|
||||
data = JSON.parse(data.response);
|
||||
if (data) {
|
||||
if (data.errors){
|
||||
self.options.errorCallback && self.options.errorCallback(data.errors);
|
||||
return;
|
||||
}
|
||||
for(var k in data) {
|
||||
self.options[k] = data[k];
|
||||
}
|
||||
self.templateUrl = data.tiles[0];
|
||||
if (self.templateUrl.indexOf("http") !== 0){
|
||||
self.templateUrl = self.options.tileJSON.substring(0, self.options.tileJSON.lastIndexOf("/") + 1) + self.templateUrl;
|
||||
}
|
||||
self._setReady(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = tileJSON;
|
||||
},{"../":10}],22:[function(require,module,exports){
|
||||
var torque = require('../');
|
||||
var Profiler = require('../profiler');
|
||||
|
||||
var Uint8Array = torque.types.Uint8Array;
|
||||
@ -4397,7 +4782,7 @@ var Profiler = require('../profiler');
|
||||
|
||||
module.exports = windshaft;
|
||||
|
||||
},{"../":10,"../profiler":17}],22:[function(require,module,exports){
|
||||
},{"../":10,"../profiler":17}],23:[function(require,module,exports){
|
||||
var TAU = Math.PI*2;
|
||||
// min value to render a line.
|
||||
// it does not make sense to render a line of a width is not even visible
|
||||
@ -4490,13 +4875,13 @@ module.exports = {
|
||||
MAX_SPRITE_RADIUS: MAX_SPRITE_RADIUS
|
||||
};
|
||||
|
||||
},{}],23:[function(require,module,exports){
|
||||
},{}],24:[function(require,module,exports){
|
||||
module.exports = {
|
||||
cartocss: require('./cartocss_render'),
|
||||
Point: require('./point'),
|
||||
Rectangle: require('./rectangle')
|
||||
};
|
||||
},{"./cartocss_render":22,"./point":24,"./rectangle":25}],24:[function(require,module,exports){
|
||||
},{"./cartocss_render":23,"./point":25,"./rectangle":26}],25:[function(require,module,exports){
|
||||
(function (global){
|
||||
var torque = require('../');
|
||||
var cartocss = require('./cartocss_render');
|
||||
@ -4813,6 +5198,23 @@ var Filters = require('./torque_filters');
|
||||
return positions;
|
||||
},
|
||||
|
||||
/**
|
||||
* returns an array with all the values for the active pixels
|
||||
* @tile tile object
|
||||
* @step integer with the step
|
||||
* @values (optional) an array where the values will be placed
|
||||
*/
|
||||
getValues: function(tile, step, values) {
|
||||
values = values || [];
|
||||
var activePixels = tile.timeCount[step];
|
||||
var pixelIndex = tile.timeIndex[step];
|
||||
for(var p = 0; p < activePixels; ++p) {
|
||||
var posIdx = tile.renderDataPos[pixelIndex + p];
|
||||
values.push(tile.renderData[pixelIndex + p]);
|
||||
}
|
||||
return values;
|
||||
},
|
||||
|
||||
// return the value for x, y (tile coordinates)
|
||||
// null for no value
|
||||
getValueFor: function(tile, step, px, py) {
|
||||
@ -4947,7 +5349,7 @@ var Filters = require('./torque_filters');
|
||||
module.exports = PointRenderer;
|
||||
|
||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{"../":10,"../profiler":17,"./cartocss_render":22,"./torque_filters":26,"carto":36}],25:[function(require,module,exports){
|
||||
},{"../":10,"../profiler":17,"./cartocss_render":23,"./torque_filters":27,"carto":37}],26:[function(require,module,exports){
|
||||
(function (global){
|
||||
var carto = global.carto || require('carto');
|
||||
|
||||
@ -5111,7 +5513,7 @@ var carto = global.carto || require('carto');
|
||||
module.exports = RectanbleRenderer;
|
||||
|
||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{"carto":36}],26:[function(require,module,exports){
|
||||
},{"carto":37}],27:[function(require,module,exports){
|
||||
/*
|
||||
Based on simpleheat, a tiny JavaScript library for drawing heatmaps with Canvas,
|
||||
by Vladimir Agafonkin
|
||||
@ -5203,7 +5605,7 @@ torque_filters.prototype = {
|
||||
|
||||
module.exports = torque_filters;
|
||||
|
||||
},{}],27:[function(require,module,exports){
|
||||
},{}],28:[function(require,module,exports){
|
||||
(function (global){
|
||||
var torque = require('./core');
|
||||
|
||||
@ -5307,9 +5709,9 @@ module.exports = {
|
||||
};
|
||||
|
||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{"./core":4}],28:[function(require,module,exports){
|
||||
},{"./core":4}],29:[function(require,module,exports){
|
||||
|
||||
},{}],29:[function(require,module,exports){
|
||||
},{}],30:[function(require,module,exports){
|
||||
// http://wiki.commonjs.org/wiki/Unit_Testing/1.0
|
||||
//
|
||||
// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!
|
||||
@ -5671,7 +6073,7 @@ var objectKeys = Object.keys || function (obj) {
|
||||
return keys;
|
||||
};
|
||||
|
||||
},{"util/":34}],30:[function(require,module,exports){
|
||||
},{"util/":35}],31:[function(require,module,exports){
|
||||
if (typeof Object.create === 'function') {
|
||||
// implementation from standard node.js 'util' module
|
||||
module.exports = function inherits(ctor, superCtor) {
|
||||
@ -5696,7 +6098,7 @@ if (typeof Object.create === 'function') {
|
||||
}
|
||||
}
|
||||
|
||||
},{}],31:[function(require,module,exports){
|
||||
},{}],32:[function(require,module,exports){
|
||||
(function (process){
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
@ -5924,7 +6326,7 @@ var substr = 'ab'.substr(-1) === 'b'
|
||||
;
|
||||
|
||||
}).call(this,require('_process'))
|
||||
},{"_process":32}],32:[function(require,module,exports){
|
||||
},{"_process":33}],33:[function(require,module,exports){
|
||||
// shim for using process in browser
|
||||
|
||||
var process = module.exports = {};
|
||||
@ -6012,14 +6414,14 @@ process.chdir = function (dir) {
|
||||
throw new Error('process.chdir is not supported');
|
||||
};
|
||||
|
||||
},{}],33:[function(require,module,exports){
|
||||
},{}],34:[function(require,module,exports){
|
||||
module.exports = function isBuffer(arg) {
|
||||
return arg && typeof arg === 'object'
|
||||
&& typeof arg.copy === 'function'
|
||||
&& typeof arg.fill === 'function'
|
||||
&& typeof arg.readUInt8 === 'function';
|
||||
}
|
||||
},{}],34:[function(require,module,exports){
|
||||
},{}],35:[function(require,module,exports){
|
||||
(function (process,global){
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
@ -6609,7 +7011,7 @@ function hasOwnProperty(obj, prop) {
|
||||
}
|
||||
|
||||
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{"./support/isBuffer":33,"_process":32,"inherits":30}],35:[function(require,module,exports){
|
||||
},{"./support/isBuffer":34,"_process":33,"inherits":31}],36:[function(require,module,exports){
|
||||
(function (tree) {
|
||||
|
||||
tree.functions = {
|
||||
@ -6822,7 +7224,7 @@ function clamp(val) {
|
||||
|
||||
})(require('./tree'));
|
||||
|
||||
},{"./tree":41}],36:[function(require,module,exports){
|
||||
},{"./tree":42}],37:[function(require,module,exports){
|
||||
(function (process,__dirname){
|
||||
var util = require('util'),
|
||||
fs = require('fs'),
|
||||
@ -6942,7 +7344,7 @@ function stylize(str, style) {
|
||||
}
|
||||
|
||||
}).call(this,require('_process'),"/node_modules/carto/lib/carto")
|
||||
},{"../../package.json":72,"./functions":35,"./parser":37,"./renderer":38,"./renderer_js":39,"./torque-reference":40,"./tree":41,"./tree/call":42,"./tree/color":43,"./tree/comment":44,"./tree/definition":45,"./tree/dimension":46,"./tree/element":47,"./tree/expression":48,"./tree/field":49,"./tree/filter":50,"./tree/filterset":51,"./tree/fontset":52,"./tree/frame_offset":53,"./tree/imagefilter":54,"./tree/invalid":55,"./tree/keyword":56,"./tree/layer":57,"./tree/literal":58,"./tree/operation":59,"./tree/quoted":60,"./tree/reference":61,"./tree/rule":62,"./tree/ruleset":63,"./tree/selector":64,"./tree/style":65,"./tree/url":66,"./tree/value":67,"./tree/variable":68,"./tree/zoom":69,"_process":32,"fs":28,"path":31,"util":34}],37:[function(require,module,exports){
|
||||
},{"../../package.json":73,"./functions":36,"./parser":38,"./renderer":39,"./renderer_js":40,"./torque-reference":41,"./tree":42,"./tree/call":43,"./tree/color":44,"./tree/comment":45,"./tree/definition":46,"./tree/dimension":47,"./tree/element":48,"./tree/expression":49,"./tree/field":50,"./tree/filter":51,"./tree/filterset":52,"./tree/fontset":53,"./tree/frame_offset":54,"./tree/imagefilter":55,"./tree/invalid":56,"./tree/keyword":57,"./tree/layer":58,"./tree/literal":59,"./tree/operation":60,"./tree/quoted":61,"./tree/reference":62,"./tree/rule":63,"./tree/ruleset":64,"./tree/selector":65,"./tree/style":66,"./tree/url":67,"./tree/value":68,"./tree/variable":69,"./tree/zoom":70,"_process":33,"fs":29,"path":32,"util":35}],38:[function(require,module,exports){
|
||||
(function (global){
|
||||
var carto = exports,
|
||||
tree = require('./tree'),
|
||||
@ -7727,7 +8129,7 @@ carto.Parser = function Parser(env) {
|
||||
};
|
||||
|
||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{"./tree":41,"underscore":71}],38:[function(require,module,exports){
|
||||
},{"./tree":42,"underscore":72}],39:[function(require,module,exports){
|
||||
(function (global){
|
||||
var _ = global._ || require('underscore');
|
||||
var carto = require('./index');
|
||||
@ -8133,7 +8535,7 @@ module.exports.inheritDefinitions = inheritDefinitions;
|
||||
module.exports.sortStyles = sortStyles;
|
||||
|
||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{"./index":36,"underscore":71}],39:[function(require,module,exports){
|
||||
},{"./index":37,"underscore":72}],40:[function(require,module,exports){
|
||||
(function (global){
|
||||
(function(carto) {
|
||||
var tree = require('./tree');
|
||||
@ -8425,7 +8827,7 @@ if(typeof(module) !== 'undefined') {
|
||||
})(require('../carto'));
|
||||
|
||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{"../carto":36,"./torque-reference":40,"./tree":41,"underscore":71}],40:[function(require,module,exports){
|
||||
},{"../carto":37,"./torque-reference":41,"./tree":42,"underscore":72}],41:[function(require,module,exports){
|
||||
var _mapnik_reference_latest = {
|
||||
"version": "2.1.1",
|
||||
"style": {
|
||||
@ -10339,7 +10741,7 @@ module.exports = {
|
||||
}
|
||||
};
|
||||
|
||||
},{}],41:[function(require,module,exports){
|
||||
},{}],42:[function(require,module,exports){
|
||||
/**
|
||||
* TODO: document this. What does this do?
|
||||
*/
|
||||
@ -10352,7 +10754,7 @@ if(typeof(module) !== "undefined") {
|
||||
};
|
||||
}
|
||||
|
||||
},{}],42:[function(require,module,exports){
|
||||
},{}],43:[function(require,module,exports){
|
||||
(function (global){
|
||||
(function(tree) {
|
||||
var _ = global._ || require('underscore');
|
||||
@ -10468,7 +10870,7 @@ tree.Call.prototype = {
|
||||
})(require('../tree'));
|
||||
|
||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{"../tree":41,"underscore":71}],43:[function(require,module,exports){
|
||||
},{"../tree":42,"underscore":72}],44:[function(require,module,exports){
|
||||
(function(tree) {
|
||||
// RGB Colors - #ff0014, #eee
|
||||
// can be initialized with a 3 or 6 char string or a 3 or 4 element
|
||||
@ -10565,7 +10967,7 @@ tree.Color.prototype = {
|
||||
|
||||
})(require('../tree'));
|
||||
|
||||
},{"../tree":41}],44:[function(require,module,exports){
|
||||
},{"../tree":42}],45:[function(require,module,exports){
|
||||
(function(tree) {
|
||||
|
||||
tree.Comment = function Comment(value, silent) {
|
||||
@ -10582,7 +10984,7 @@ tree.Comment.prototype = {
|
||||
|
||||
})(require('../tree'));
|
||||
|
||||
},{"../tree":41}],45:[function(require,module,exports){
|
||||
},{"../tree":42}],46:[function(require,module,exports){
|
||||
(function (global){
|
||||
(function(tree) {
|
||||
var assert = require('assert'),
|
||||
@ -10845,7 +11247,7 @@ tree.Definition.prototype.toJS = function(env) {
|
||||
})(require('../tree'));
|
||||
|
||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{"../tree":41,"assert":29,"underscore":71}],46:[function(require,module,exports){
|
||||
},{"../tree":42,"assert":30,"underscore":72}],47:[function(require,module,exports){
|
||||
(function (global){
|
||||
(function(tree) {
|
||||
var _ = global._ || require('underscore');
|
||||
@ -10948,7 +11350,7 @@ tree.Dimension.prototype = {
|
||||
})(require('../tree'));
|
||||
|
||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{"../tree":41,"underscore":71}],47:[function(require,module,exports){
|
||||
},{"../tree":42,"underscore":72}],48:[function(require,module,exports){
|
||||
(function(tree) {
|
||||
|
||||
// An element is an id or class selector
|
||||
@ -10980,7 +11382,7 @@ tree.Element.prototype.toString = function() { return this.value; };
|
||||
|
||||
})(require('../tree'));
|
||||
|
||||
},{"../tree":41}],48:[function(require,module,exports){
|
||||
},{"../tree":42}],49:[function(require,module,exports){
|
||||
(function(tree) {
|
||||
|
||||
tree.Expression = function Expression(value) {
|
||||
@ -11008,7 +11410,7 @@ tree.Expression.prototype = {
|
||||
|
||||
})(require('../tree'));
|
||||
|
||||
},{"../tree":41}],49:[function(require,module,exports){
|
||||
},{"../tree":42}],50:[function(require,module,exports){
|
||||
(function(tree) {
|
||||
|
||||
tree.Field = function Field(content) {
|
||||
@ -11027,7 +11429,7 @@ tree.Field.prototype = {
|
||||
|
||||
})(require('../tree'));
|
||||
|
||||
},{"../tree":41}],50:[function(require,module,exports){
|
||||
},{"../tree":42}],51:[function(require,module,exports){
|
||||
(function(tree) {
|
||||
|
||||
tree.Filter = function Filter(key, op, val, index, filename) {
|
||||
@ -11097,7 +11499,7 @@ tree.Filter.prototype.toString = function() {
|
||||
|
||||
})(require('../tree'));
|
||||
|
||||
},{"../tree":41}],51:[function(require,module,exports){
|
||||
},{"../tree":42}],52:[function(require,module,exports){
|
||||
(function (global){
|
||||
var tree = require('../tree');
|
||||
var _ = global._ || require('underscore');
|
||||
@ -11368,7 +11770,7 @@ tree.Filterset.prototype.add = function(filter, env) {
|
||||
};
|
||||
|
||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{"../tree":41,"underscore":71}],52:[function(require,module,exports){
|
||||
},{"../tree":42,"underscore":72}],53:[function(require,module,exports){
|
||||
(function(tree) {
|
||||
|
||||
tree._getFontSet = function(env, fonts) {
|
||||
@ -11401,7 +11803,7 @@ tree.FontSet.prototype.toXML = function(env) {
|
||||
|
||||
})(require('../tree'));
|
||||
|
||||
},{"../tree":41}],53:[function(require,module,exports){
|
||||
},{"../tree":42}],54:[function(require,module,exports){
|
||||
var tree = require('../tree');
|
||||
|
||||
// Storage for Frame offset value
|
||||
@ -11430,7 +11832,7 @@ tree.FrameOffset.max = 32;
|
||||
tree.FrameOffset.none = 0;
|
||||
|
||||
|
||||
},{"../tree":41}],54:[function(require,module,exports){
|
||||
},{"../tree":42}],55:[function(require,module,exports){
|
||||
(function(tree) {
|
||||
|
||||
tree.ImageFilter = function ImageFilter(filter, args) {
|
||||
@ -11454,7 +11856,7 @@ tree.ImageFilter.prototype = {
|
||||
|
||||
})(require('../tree'));
|
||||
|
||||
},{"../tree":41}],55:[function(require,module,exports){
|
||||
},{"../tree":42}],56:[function(require,module,exports){
|
||||
(function (tree) {
|
||||
tree.Invalid = function Invalid(chunk, index, message) {
|
||||
this.chunk = chunk;
|
||||
@ -11478,7 +11880,7 @@ tree.Invalid.prototype.ev = function(env) {
|
||||
};
|
||||
})(require('../tree'));
|
||||
|
||||
},{"../tree":41}],56:[function(require,module,exports){
|
||||
},{"../tree":42}],57:[function(require,module,exports){
|
||||
(function(tree) {
|
||||
|
||||
tree.Keyword = function Keyword(value) {
|
||||
@ -11497,7 +11899,7 @@ tree.Keyword.prototype = {
|
||||
|
||||
})(require('../tree'));
|
||||
|
||||
},{"../tree":41}],57:[function(require,module,exports){
|
||||
},{"../tree":42}],58:[function(require,module,exports){
|
||||
(function(tree) {
|
||||
|
||||
tree.LayerXML = function(obj, styles) {
|
||||
@ -11536,7 +11938,7 @@ tree.LayerXML = function(obj, styles) {
|
||||
|
||||
})(require('../tree'));
|
||||
|
||||
},{"../tree":41}],58:[function(require,module,exports){
|
||||
},{"../tree":42}],59:[function(require,module,exports){
|
||||
// A literal is a literal string for Mapnik - the
|
||||
// result of the combination of a `tree.Field` with any
|
||||
// other type.
|
||||
@ -11558,7 +11960,7 @@ tree.Literal.prototype = {
|
||||
|
||||
})(require('../tree'));
|
||||
|
||||
},{"../tree":41}],59:[function(require,module,exports){
|
||||
},{"../tree":42}],60:[function(require,module,exports){
|
||||
// An operation is an expression with an op in between two operands,
|
||||
// like 2 + 1.
|
||||
(function(tree) {
|
||||
@ -11657,7 +12059,7 @@ tree.operate = function(op, a, b) {
|
||||
|
||||
})(require('../tree'));
|
||||
|
||||
},{"../tree":41}],60:[function(require,module,exports){
|
||||
},{"../tree":42}],61:[function(require,module,exports){
|
||||
(function(tree) {
|
||||
|
||||
tree.Quoted = function Quoted(content) {
|
||||
@ -11689,7 +12091,7 @@ tree.Quoted.prototype = {
|
||||
|
||||
})(require('../tree'));
|
||||
|
||||
},{"../tree":41}],61:[function(require,module,exports){
|
||||
},{"../tree":42}],62:[function(require,module,exports){
|
||||
(function (global){
|
||||
// Carto pulls in a reference from the `mapnik-reference`
|
||||
// module. This file builds indexes from that file for its various
|
||||
@ -11912,7 +12314,7 @@ tree.Reference = ref;
|
||||
})(require('../tree'));
|
||||
|
||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{"../tree":41,"mapnik-reference":70,"underscore":71}],62:[function(require,module,exports){
|
||||
},{"../tree":42,"mapnik-reference":71,"underscore":72}],63:[function(require,module,exports){
|
||||
(function(tree) {
|
||||
// a rule is a single property and value combination, or variable
|
||||
// name and value combination, like
|
||||
@ -12034,7 +12436,7 @@ tree.Rule.prototype.ev = function(context) {
|
||||
|
||||
})(require('../tree'));
|
||||
|
||||
},{"../tree":41}],63:[function(require,module,exports){
|
||||
},{"../tree":42}],64:[function(require,module,exports){
|
||||
(function(tree) {
|
||||
|
||||
tree.Ruleset = function Ruleset(selectors, rules) {
|
||||
@ -12213,7 +12615,7 @@ tree.Ruleset.prototype = {
|
||||
};
|
||||
})(require('../tree'));
|
||||
|
||||
},{"../tree":41}],64:[function(require,module,exports){
|
||||
},{"../tree":42}],65:[function(require,module,exports){
|
||||
(function(tree) {
|
||||
|
||||
tree.Selector = function Selector(filters, zoom, frame_offset, elements, attachment, conditions, index) {
|
||||
@ -12242,7 +12644,7 @@ tree.Selector.prototype.specificity = function() {
|
||||
|
||||
})(require('../tree'));
|
||||
|
||||
},{"../tree":41}],65:[function(require,module,exports){
|
||||
},{"../tree":42}],66:[function(require,module,exports){
|
||||
(function (global){
|
||||
(function(tree) {
|
||||
var _ = global._ || require('underscore');
|
||||
@ -12314,7 +12716,7 @@ tree.StyleXML = function(name, attachment, definitions, env) {
|
||||
})(require('../tree'));
|
||||
|
||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{"../tree":41,"underscore":71}],66:[function(require,module,exports){
|
||||
},{"../tree":42,"underscore":72}],67:[function(require,module,exports){
|
||||
(function(tree) {
|
||||
|
||||
tree.URL = function URL(val, paths) {
|
||||
@ -12334,7 +12736,7 @@ tree.URL.prototype = {
|
||||
|
||||
})(require('../tree'));
|
||||
|
||||
},{"../tree":41}],67:[function(require,module,exports){
|
||||
},{"../tree":42}],68:[function(require,module,exports){
|
||||
(function(tree) {
|
||||
|
||||
tree.Value = function Value(value) {
|
||||
@ -12387,7 +12789,7 @@ tree.Value.prototype = {
|
||||
|
||||
})(require('../tree'));
|
||||
|
||||
},{"../tree":41}],68:[function(require,module,exports){
|
||||
},{"../tree":42}],69:[function(require,module,exports){
|
||||
(function(tree) {
|
||||
|
||||
tree.Variable = function Variable(name, index, filename) {
|
||||
@ -12430,7 +12832,7 @@ tree.Variable.prototype = {
|
||||
|
||||
})(require('../tree'));
|
||||
|
||||
},{"../tree":41}],69:[function(require,module,exports){
|
||||
},{"../tree":42}],70:[function(require,module,exports){
|
||||
var tree = require('../tree');
|
||||
|
||||
// Storage for zoom ranges. Only supports continuous ranges,
|
||||
@ -12550,7 +12952,7 @@ tree.Zoom.prototype.toString = function() {
|
||||
return str;
|
||||
};
|
||||
|
||||
},{"../tree":41}],70:[function(require,module,exports){
|
||||
},{"../tree":42}],71:[function(require,module,exports){
|
||||
(function (__dirname){
|
||||
var fs = require('fs'),
|
||||
path = require('path'),
|
||||
@ -12579,7 +12981,7 @@ refs.map(function(version) {
|
||||
});
|
||||
|
||||
}).call(this,"/node_modules/carto/node_modules/mapnik-reference")
|
||||
},{"fs":28,"path":31}],71:[function(require,module,exports){
|
||||
},{"fs":29,"path":32}],72:[function(require,module,exports){
|
||||
// Underscore.js 1.6.0
|
||||
// http://underscorejs.org
|
||||
// (c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||||
@ -13924,7 +14326,7 @@ refs.map(function(version) {
|
||||
}
|
||||
}).call(this);
|
||||
|
||||
},{}],72:[function(require,module,exports){
|
||||
},{}],73:[function(require,module,exports){
|
||||
module.exports={
|
||||
"name": "carto",
|
||||
"version": "0.15.1-cdb1",
|
||||
|
6
dist/torque.js
vendored
6
dist/torque.js
vendored
File diff suppressed because one or more lines are too long
426
dist/torque.uncompressed.js
vendored
426
dist/torque.uncompressed.js
vendored
@ -1574,6 +1574,8 @@ function GMapsTorqueLayer(options) {
|
||||
torque.common.TorqueLayer.optionsFromCartoCSS(options.cartocss));
|
||||
}
|
||||
|
||||
if(options.tileJSON) this.options.provider = "tileJSON";
|
||||
|
||||
this.hidden = !this.options.visible;
|
||||
|
||||
this.animator = new torque.Animator(function(time) {
|
||||
@ -1581,7 +1583,17 @@ function GMapsTorqueLayer(options) {
|
||||
if(self.key !== k) {
|
||||
self.setKey(k);
|
||||
}
|
||||
}, torque.clone(this.options));
|
||||
}, torque.extend(torque.clone(this.options), {
|
||||
onPause: function() {
|
||||
self.fire('pause');
|
||||
},
|
||||
onStop: function() {
|
||||
self.fire('stop');
|
||||
},
|
||||
onStart: function() {
|
||||
self.fire('play');
|
||||
}
|
||||
}));
|
||||
|
||||
this.play = this.animator.start.bind(this.animator);
|
||||
this.stop = this.animator.stop.bind(this.animator);
|
||||
@ -1613,7 +1625,8 @@ GMapsTorqueLayer.prototype = torque.extend({},
|
||||
providers: {
|
||||
'sql_api': torque.providers.json,
|
||||
'url_template': torque.providers.JsonArray,
|
||||
'windshaft': torque.providers.windshaft
|
||||
'windshaft': torque.providers.windshaft,
|
||||
'tileJSON': torque.providers.tileJSON
|
||||
},
|
||||
|
||||
renderers: {
|
||||
@ -1714,6 +1727,7 @@ GMapsTorqueLayer.prototype = torque.extend({},
|
||||
// don't load tiles that are not being shown
|
||||
if (t.zoom !== self.options.map.getZoom()) return;
|
||||
self._tileLoaded(t, tileData);
|
||||
self.fire('tileLoaded');
|
||||
if (tileData) {
|
||||
self.redraw();
|
||||
}
|
||||
@ -1855,6 +1869,20 @@ GMapsTorqueLayer.prototype = torque.extend({},
|
||||
google.maps.event.removeListener(this._cacheListener);
|
||||
},
|
||||
|
||||
/**
|
||||
* return an array with the values for all the pixels active for the step
|
||||
*/
|
||||
getValues: function(step) {
|
||||
var values = [];
|
||||
step = step === undefined ? this.key: step;
|
||||
var t, tile;
|
||||
for(t in this._tiles) {
|
||||
tile = this._tiles[t];
|
||||
this.renderer.getValues(tile, step, values);
|
||||
}
|
||||
return values;
|
||||
},
|
||||
|
||||
getValueForPos: function(x, y, step) {
|
||||
step = step === undefined ? this.key: step;
|
||||
var t, tile, pos, value = null, xx, yy;
|
||||
@ -2000,7 +2028,7 @@ module.exports.GMapsTileLoader = gmaps.GMapsTileLoader;
|
||||
module.exports.GMapsTorqueLayer = gmaps.GMapsTorqueLayer;
|
||||
module.exports.GMapsTiledTorqueLayer = gmaps.GMapsTiledTorqueLayer;
|
||||
|
||||
},{"./animator":1,"./cartocss_reference":2,"./common":3,"./core":4,"./gmaps":8,"./leaflet":12,"./math":15,"./mercator":16,"./provider":18,"./renderer":23,"./request":27}],11:[function(require,module,exports){
|
||||
},{"./animator":1,"./cartocss_reference":2,"./common":3,"./core":4,"./gmaps":8,"./leaflet":12,"./math":15,"./mercator":16,"./provider":18,"./renderer":24,"./request":28}],11:[function(require,module,exports){
|
||||
require('./leaflet_tileloader_mixin');
|
||||
|
||||
/**
|
||||
@ -2425,7 +2453,8 @@ L.TorqueLayer = L.CanvasLayer.extend({
|
||||
providers: {
|
||||
'sql_api': torque.providers.json,
|
||||
'url_template': torque.providers.JsonArray,
|
||||
'windshaft': torque.providers.windshaft
|
||||
'windshaft': torque.providers.windshaft,
|
||||
'tileJSON': torque.providers.tileJSON
|
||||
},
|
||||
|
||||
renderers: {
|
||||
@ -2480,6 +2509,8 @@ L.TorqueLayer = L.CanvasLayer.extend({
|
||||
this.options.renderer = this.options.renderer || 'point';
|
||||
this.options.provider = this.options.provider || 'windshaft';
|
||||
|
||||
if (this.options.tileJSON) this.options.provider = 'tileJSON';
|
||||
|
||||
this.provider = new this.providers[this.options.provider](options);
|
||||
this.renderer = new this.renderers[this.options.renderer](this.getCanvas(), options);
|
||||
|
||||
@ -2508,6 +2539,7 @@ L.TorqueLayer = L.CanvasLayer.extend({
|
||||
if (tileData) {
|
||||
self.redraw();
|
||||
}
|
||||
self.fire('tileLoaded');
|
||||
});
|
||||
}, this);
|
||||
|
||||
@ -2783,6 +2815,20 @@ L.TorqueLayer = L.CanvasLayer.extend({
|
||||
return positions;
|
||||
},
|
||||
|
||||
/**
|
||||
* return an array with the values for all the pixels active for the step
|
||||
*/
|
||||
getValues: function(step) {
|
||||
var values = [];
|
||||
step = step === undefined ? this.key: step;
|
||||
var t, tile;
|
||||
for(t in this._tiles) {
|
||||
tile = this._tiles[t];
|
||||
this.renderer.getValues(tile, step, values);
|
||||
}
|
||||
return values;
|
||||
},
|
||||
|
||||
/**
|
||||
* return the value for position relative to map coordinates. null for no value
|
||||
*/
|
||||
@ -3102,10 +3148,11 @@ module.exports = Profiler;
|
||||
module.exports = {
|
||||
json: require('./json'),
|
||||
JsonArray: require('./jsonarray'),
|
||||
windshaft: require('./windshaft')
|
||||
windshaft: require('./windshaft'),
|
||||
tileJSON: require('./tilejson')
|
||||
};
|
||||
|
||||
},{"./json":19,"./jsonarray":20,"./windshaft":21}],19:[function(require,module,exports){
|
||||
},{"./json":19,"./jsonarray":20,"./tilejson":21,"./windshaft":22}],19:[function(require,module,exports){
|
||||
var torque = require('../');
|
||||
var Profiler = require('../profiler');
|
||||
|
||||
@ -3916,6 +3963,344 @@ var Profiler = require('../profiler');
|
||||
|
||||
},{"../":10,"../profiler":17}],21:[function(require,module,exports){
|
||||
var torque = require('../');
|
||||
|
||||
var Uint8Array = torque.types.Uint8Array;
|
||||
var Int32Array = torque.types.Int32Array;
|
||||
var Uint32Array = torque.types.Uint32Array;
|
||||
var Uint8ClampedArray = torque.types.Uint8ClampedArray;
|
||||
|
||||
// format('hello, {0}', 'rambo') -> "hello, rambo"
|
||||
function format(str) {
|
||||
for(var i = 1; i < arguments.length; ++i) {
|
||||
var attrs = arguments[i];
|
||||
for(var attr in attrs) {
|
||||
str = str.replace(RegExp('\\{' + attr + '\\}', 'g'), attrs[attr]);
|
||||
}
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
var tileJSON = function (options) {
|
||||
this._ready = false;
|
||||
this._tileQueue = [];
|
||||
this.options = options;
|
||||
|
||||
this.options.coordinates_data_type = this.options.coordinates_data_type || Uint8Array;
|
||||
|
||||
if (this.options.data_aggregation) {
|
||||
this.options.cumulative = this.options.data_aggregation === 'cumulative';
|
||||
}
|
||||
if (this.options.auth_token) {
|
||||
var e = this.options.extra_params || (this.options.extra_params = {});
|
||||
e.auth_token = this.options.auth_token;
|
||||
}
|
||||
if (!this.options.no_fetch_map) {
|
||||
this._fetchMap();
|
||||
}
|
||||
};
|
||||
|
||||
tileJSON.prototype = {
|
||||
|
||||
NAME: "tileJSON",
|
||||
|
||||
/**
|
||||
* return the torque tile encoded in an efficient javascript
|
||||
* structure:
|
||||
* {
|
||||
* x:Uint8Array x coordinates in tile reference system, normally from 0-255
|
||||
* y:Uint8Array y coordinates in tile reference system
|
||||
* Index: Array index to the properties
|
||||
* }
|
||||
*/
|
||||
proccessTile: function(rows, coord, zoom) {
|
||||
var r;
|
||||
var x = new this.options.coordinates_data_type(rows.length);
|
||||
var y = new this.options.coordinates_data_type(rows.length);
|
||||
|
||||
// count number of dates
|
||||
var dates = 0;
|
||||
var maxDateSlots = -1;
|
||||
for (r = 0; r < rows.length; ++r) {
|
||||
var row = rows[r];
|
||||
dates += row.dates__uint16.length;
|
||||
for(var d = 0; d < row.dates__uint16.length; ++d) {
|
||||
maxDateSlots = Math.max(maxDateSlots, row.dates__uint16[d]);
|
||||
}
|
||||
}
|
||||
|
||||
if(this.options.cumulative) {
|
||||
dates = (1 + maxDateSlots) * rows.length;
|
||||
}
|
||||
|
||||
var type = this.options.cumulative ? Uint32Array: Uint8ClampedArray;
|
||||
|
||||
// reserve memory for all the dates
|
||||
var timeIndex = new Int32Array(maxDateSlots + 1); //index-size
|
||||
var timeCount = new Int32Array(maxDateSlots + 1);
|
||||
var renderData = new (this.options.valueDataType || type)(dates);
|
||||
var renderDataPos = new Uint32Array(dates);
|
||||
|
||||
var rowsPerSlot = {};
|
||||
|
||||
// precache pixel positions
|
||||
for (var r = 0; r < rows.length; ++r) {
|
||||
var row = rows[r];
|
||||
x[r] = row.x__uint8 * this.options.resolution;
|
||||
y[r] = row.y__uint8 * this.options.resolution;
|
||||
|
||||
var dates = row.dates__uint16;
|
||||
var vals = row.vals__uint8;
|
||||
if (!this.options.cumulative) {
|
||||
for (var j = 0, len = dates.length; j < len; ++j) {
|
||||
var rr = rowsPerSlot[dates[j]] || (rowsPerSlot[dates[j]] = []);
|
||||
if(this.options.cumulative) {
|
||||
vals[j] += prev_val;
|
||||
}
|
||||
prev_val = vals[j];
|
||||
rr.push([r, vals[j]]);
|
||||
}
|
||||
} else {
|
||||
var valByDate = {}
|
||||
for (var j = 0, len = dates.length; j < len; ++j) {
|
||||
valByDate[dates[j]] = vals[j];
|
||||
}
|
||||
var accum = 0;
|
||||
|
||||
// extend the latest to the end
|
||||
for (var j = dates[0]; j <= maxDateSlots; ++j) {
|
||||
var rr = rowsPerSlot[j] || (rowsPerSlot[j] = []);
|
||||
var v = valByDate[j];
|
||||
if (v) {
|
||||
accum += v;
|
||||
}
|
||||
rr.push([r, accum]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// for each timeslot search active buckets
|
||||
var renderDataIndex = 0;
|
||||
var timeSlotIndex = 0;
|
||||
var i = 0;
|
||||
for(var i = 0; i <= maxDateSlots; ++i) {
|
||||
var c = 0;
|
||||
var slotRows = rowsPerSlot[i]
|
||||
if(slotRows) {
|
||||
for (var r = 0; r < slotRows.length; ++r) {
|
||||
var rr = slotRows[r];
|
||||
++c;
|
||||
renderDataPos[renderDataIndex] = rr[0]
|
||||
renderData[renderDataIndex] = rr[1];
|
||||
++renderDataIndex;
|
||||
}
|
||||
}
|
||||
timeIndex[i] = timeSlotIndex;
|
||||
timeCount[i] = c;
|
||||
timeSlotIndex += c;
|
||||
}
|
||||
|
||||
return {
|
||||
x: x,
|
||||
y: y,
|
||||
z: zoom,
|
||||
coord: {
|
||||
x: coord.x,
|
||||
y: coord.y,
|
||||
z: zoom
|
||||
},
|
||||
timeCount: timeCount,
|
||||
timeIndex: timeIndex,
|
||||
renderDataPos: renderDataPos,
|
||||
renderData: renderData,
|
||||
maxDate: maxDateSlots
|
||||
};
|
||||
},
|
||||
|
||||
setSteps: function(steps, opt) {
|
||||
opt = opt || {};
|
||||
if (this.options.steps !== steps) {
|
||||
this.options.steps = steps;
|
||||
this.options.step = (this.options.end - this.options.start)/this.getSteps();
|
||||
this.options.step = this.options.step || 1;
|
||||
if (!opt.silent) this.reload();
|
||||
}
|
||||
},
|
||||
|
||||
setOptions: function(opt) {
|
||||
var refresh = false;
|
||||
|
||||
if(opt.resolution !== undefined && opt.resolution !== this.options.resolution) {
|
||||
this.options.resolution = opt.resolution;
|
||||
refresh = true;
|
||||
}
|
||||
|
||||
if(opt.steps !== undefined && opt.steps !== this.options.steps) {
|
||||
this.setSteps(opt.steps, { silent: true });
|
||||
refresh = true;
|
||||
}
|
||||
|
||||
if(opt.column !== undefined && opt.column !== this.options.column) {
|
||||
this.options.column = opt.column;
|
||||
refresh = true;
|
||||
}
|
||||
|
||||
if(opt.countby !== undefined && opt.countby !== this.options.countby) {
|
||||
this.options.countby = opt.countby;
|
||||
refresh = true;
|
||||
}
|
||||
|
||||
if(opt.data_aggregation !== undefined) {
|
||||
var c = opt.data_aggregation === 'cumulative';
|
||||
if (this.options.cumulative !== c) {
|
||||
this.options.cumulative = c;
|
||||
refresh = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (refresh) this.reload();
|
||||
return refresh;
|
||||
},
|
||||
|
||||
_extraParams: function(e) {
|
||||
e = torque.extend(torque.extend({}, e), this.options.extra_params);
|
||||
if (e) {
|
||||
var p = [];
|
||||
for(var k in e) {
|
||||
var v = e[k];
|
||||
if (v) {
|
||||
if (torque.isArray(v)) {
|
||||
for (var i = 0, len = v.length; i < len; i++) {
|
||||
p.push(k + "[]=" + encodeURIComponent(v[i]));
|
||||
}
|
||||
} else {
|
||||
p.push(k + "=" + encodeURIComponent(v));
|
||||
}
|
||||
}
|
||||
}
|
||||
return p.join('&');
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
getTileData: function(coord, zoom, callback) {
|
||||
if(!this._ready) {
|
||||
this._tileQueue.push([coord, zoom, callback]);
|
||||
} else {
|
||||
this._getTileData(coord, zoom, callback);
|
||||
}
|
||||
},
|
||||
|
||||
_setReady: function(ready) {
|
||||
this._ready = true;
|
||||
this._processQueue();
|
||||
this.options.ready && this.options.ready();
|
||||
},
|
||||
|
||||
_processQueue: function() {
|
||||
var item;
|
||||
while (item = this._tileQueue.pop()) {
|
||||
this._getTileData.apply(this, item);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* `coord` object like {x : tilex, y: tiley }
|
||||
* `zoom` quadtree zoom level
|
||||
*/
|
||||
_getTileData: function(coord, zoom, callback) {
|
||||
var self = this;
|
||||
var subdomains = this.options.subdomains || '0123';
|
||||
var limit_x = Math.pow(2, zoom);
|
||||
var corrected_x = ((coord.x % limit_x) + limit_x) % limit_x;
|
||||
var index = Math.abs(corrected_x + coord.y) % subdomains.length;
|
||||
var url = this.templateUrl
|
||||
.replace('{x}', corrected_x)
|
||||
.replace('{y}', coord.y)
|
||||
.replace('{z}', zoom)
|
||||
.replace('{s}', subdomains[index])
|
||||
torque.net.get( url , function (data) {
|
||||
if (data && data.responseText) {
|
||||
var rows = JSON.parse(data.responseText);
|
||||
callback(self.proccessTile(rows, coord, zoom));
|
||||
} else {
|
||||
callback(null);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
getKeySpan: function() {
|
||||
return {
|
||||
start: this.options.start,
|
||||
end: this.options.end,
|
||||
step: this.options.step,
|
||||
steps: this.options.steps,
|
||||
columnType: this.options.column_type
|
||||
};
|
||||
},
|
||||
|
||||
setColumn: function(column, isTime) {
|
||||
this.options.column = column;
|
||||
this.options.is_time = isTime === undefined ? true: false;
|
||||
this.reload();
|
||||
},
|
||||
|
||||
reload: function() {
|
||||
this._ready = false;
|
||||
this._fetchMap();
|
||||
},
|
||||
|
||||
getSteps: function() {
|
||||
return Math.min(this.options.steps, this.options.data_steps);
|
||||
},
|
||||
|
||||
getBounds: function() {
|
||||
return this.options.bounds;
|
||||
},
|
||||
|
||||
getSQL: function() {
|
||||
return this.options.sql || "select * from " + this.options.table;
|
||||
},
|
||||
|
||||
setSQL: function(sql) {
|
||||
if (this.options.sql != sql) {
|
||||
this.options.sql = sql;
|
||||
this.reload();
|
||||
}
|
||||
},
|
||||
|
||||
_isUserTemplateUrl: function(t) {
|
||||
return t && t.indexOf('{user}') !== -1;
|
||||
},
|
||||
|
||||
isHttps: function() {
|
||||
return this.options.maps_api_template.indexOf('https') === 0;
|
||||
},
|
||||
|
||||
_fetchMap: function(callback) {
|
||||
var self = this;
|
||||
torque.net.get(this.options.tileJSON, function (data) {
|
||||
data = JSON.parse(data.response);
|
||||
if (data) {
|
||||
if (data.errors){
|
||||
self.options.errorCallback && self.options.errorCallback(data.errors);
|
||||
return;
|
||||
}
|
||||
for(var k in data) {
|
||||
self.options[k] = data[k];
|
||||
}
|
||||
self.templateUrl = data.tiles[0];
|
||||
if (self.templateUrl.indexOf("http") !== 0){
|
||||
self.templateUrl = self.options.tileJSON.substring(0, self.options.tileJSON.lastIndexOf("/") + 1) + self.templateUrl;
|
||||
}
|
||||
self._setReady(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = tileJSON;
|
||||
},{"../":10}],22:[function(require,module,exports){
|
||||
var torque = require('../');
|
||||
var Profiler = require('../profiler');
|
||||
|
||||
var Uint8Array = torque.types.Uint8Array;
|
||||
@ -4404,7 +4789,7 @@ var Profiler = require('../profiler');
|
||||
|
||||
module.exports = windshaft;
|
||||
|
||||
},{"../":10,"../profiler":17}],22:[function(require,module,exports){
|
||||
},{"../":10,"../profiler":17}],23:[function(require,module,exports){
|
||||
var TAU = Math.PI*2;
|
||||
// min value to render a line.
|
||||
// it does not make sense to render a line of a width is not even visible
|
||||
@ -4497,13 +4882,13 @@ module.exports = {
|
||||
MAX_SPRITE_RADIUS: MAX_SPRITE_RADIUS
|
||||
};
|
||||
|
||||
},{}],23:[function(require,module,exports){
|
||||
},{}],24:[function(require,module,exports){
|
||||
module.exports = {
|
||||
cartocss: require('./cartocss_render'),
|
||||
Point: require('./point'),
|
||||
Rectangle: require('./rectangle')
|
||||
};
|
||||
},{"./cartocss_render":22,"./point":24,"./rectangle":25}],24:[function(require,module,exports){
|
||||
},{"./cartocss_render":23,"./point":25,"./rectangle":26}],25:[function(require,module,exports){
|
||||
(function (global){
|
||||
var torque = require('../');
|
||||
var cartocss = require('./cartocss_render');
|
||||
@ -4820,6 +5205,23 @@ var Filters = require('./torque_filters');
|
||||
return positions;
|
||||
},
|
||||
|
||||
/**
|
||||
* returns an array with all the values for the active pixels
|
||||
* @tile tile object
|
||||
* @step integer with the step
|
||||
* @values (optional) an array where the values will be placed
|
||||
*/
|
||||
getValues: function(tile, step, values) {
|
||||
values = values || [];
|
||||
var activePixels = tile.timeCount[step];
|
||||
var pixelIndex = tile.timeIndex[step];
|
||||
for(var p = 0; p < activePixels; ++p) {
|
||||
var posIdx = tile.renderDataPos[pixelIndex + p];
|
||||
values.push(tile.renderData[pixelIndex + p]);
|
||||
}
|
||||
return values;
|
||||
},
|
||||
|
||||
// return the value for x, y (tile coordinates)
|
||||
// null for no value
|
||||
getValueFor: function(tile, step, px, py) {
|
||||
@ -4954,7 +5356,7 @@ var Filters = require('./torque_filters');
|
||||
module.exports = PointRenderer;
|
||||
|
||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{"../":10,"../profiler":17,"./cartocss_render":22,"./torque_filters":26,"carto":undefined}],25:[function(require,module,exports){
|
||||
},{"../":10,"../profiler":17,"./cartocss_render":23,"./torque_filters":27,"carto":undefined}],26:[function(require,module,exports){
|
||||
(function (global){
|
||||
var carto = global.carto || require('carto');
|
||||
|
||||
@ -5118,7 +5520,7 @@ var carto = global.carto || require('carto');
|
||||
module.exports = RectanbleRenderer;
|
||||
|
||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{"carto":undefined}],26:[function(require,module,exports){
|
||||
},{"carto":undefined}],27:[function(require,module,exports){
|
||||
/*
|
||||
Based on simpleheat, a tiny JavaScript library for drawing heatmaps with Canvas,
|
||||
by Vladimir Agafonkin
|
||||
@ -5210,7 +5612,7 @@ torque_filters.prototype = {
|
||||
|
||||
module.exports = torque_filters;
|
||||
|
||||
},{}],27:[function(require,module,exports){
|
||||
},{}],28:[function(require,module,exports){
|
||||
(function (global){
|
||||
var torque = require('./core');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user