reindenting
This commit is contained in:
parent
9ad0ce8582
commit
219178a8f2
@ -17,36 +17,39 @@ function IsoRenderer (canvas, options) {
|
||||
|
||||
torque.extend(IsoRenderer.prototype, torque.Event, {
|
||||
setCartoCSS: function(cartocss) {
|
||||
// clean sprites
|
||||
this.setShader(new carto.RendererJS().render(cartocss));
|
||||
},
|
||||
// clean sprites
|
||||
this.setShader(new carto.RendererJS().render(cartocss));
|
||||
},
|
||||
|
||||
setShader: function(shader) {
|
||||
// clean sprites
|
||||
this._sprites = [];
|
||||
this._shader = shader;
|
||||
this._Map = this._shader.getDefault().getStyle({}, { zoom: 0 });
|
||||
},
|
||||
|
||||
setShader: function(shader) {
|
||||
// clean sprites
|
||||
this._sprites = [];
|
||||
this._shader = shader;
|
||||
this._Map = this._shader.getDefault().getStyle({}, { zoom: 0 });
|
||||
},
|
||||
clearCanvas: function() {
|
||||
var canvas = this._canvas;
|
||||
var color = this._Map['-torque-clear-color']
|
||||
// shortcut for the default value
|
||||
if (color === "rgba(255, 255, 255, 0)" || !color) {
|
||||
this._canvas.width = this._canvas.width;
|
||||
} else {
|
||||
var ctx = this._ctx;
|
||||
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
||||
var compop = this._Map['comp-op']
|
||||
ctx.globalCompositeOperation = compop2canvas(compop);
|
||||
ctx.fillStyle = color;
|
||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||
}
|
||||
},
|
||||
_createCanvas: function() {
|
||||
return this.options.canvasClass
|
||||
? new this.options.canvasClass()
|
||||
: document.createElement('canvas');
|
||||
},
|
||||
var canvas = this._canvas;
|
||||
var color = this._Map['-torque-clear-color']
|
||||
// shortcut for the default value
|
||||
if (color === "rgba(255, 255, 255, 0)" || !color) {
|
||||
this._canvas.width = this._canvas.width;
|
||||
} else {
|
||||
var ctx = this._ctx;
|
||||
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
||||
var compop = this._Map['comp-op']
|
||||
ctx.globalCompositeOperation = compop2canvas(compop);
|
||||
ctx.fillStyle = color;
|
||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||
}
|
||||
},
|
||||
|
||||
_createCanvas: function() {
|
||||
return this.options.canvasClass
|
||||
? new this.options.canvasClass()
|
||||
: document.createElement('canvas');
|
||||
},
|
||||
|
||||
renderTile: function(tile, key, pos) {
|
||||
var layers = this._shader.getLayers();
|
||||
for (var i = 0, n = layers.length; i < n; ++i) {
|
||||
@ -87,27 +90,27 @@ torque.extend(IsoRenderer.prototype, torque.Event, {
|
||||
},
|
||||
|
||||
_getPipe: function(cell, contour){
|
||||
var parsedCell = cell.map(function(cornerValue){
|
||||
if (cornerValue >= contour){
|
||||
return "1";
|
||||
}
|
||||
return "0";
|
||||
}).join("");
|
||||
var type = parseInt(parsedCell, 2);
|
||||
var interpolated = true;
|
||||
var N = interpolated? [this._lerp(cell[1], cell[0], contour), 0]: [0.5,0],
|
||||
S = interpolated? [this._lerp(cell[2], cell[3], contour), 1]: [0.5,1],
|
||||
E = interpolated? [1, this._lerp(cell[2], cell[1], contour)]: [1,0.5],
|
||||
W = interpolated? [0, this._lerp(cell[3], cell[0], contour)]: [0,0.5]
|
||||
if (type === 0 || type === 15) return null;
|
||||
if (type === 1 || type === 14) return [W, S]
|
||||
if (type === 2 || type === 13) return [S, E]
|
||||
if (type === 3 || type === 12) return [W, E]
|
||||
if (type === 4 || type === 11) return [N, E]
|
||||
if (type === 6 || type === 9) return [N, S]
|
||||
if (type === 7 || type === 8) return [W, N]
|
||||
if (type === 5) return [W, N, S, E]
|
||||
if (type === 10) return [W, S, N, E]
|
||||
var parsedCell = cell.map(function(cornerValue){
|
||||
if (cornerValue >= contour){
|
||||
return "1";
|
||||
}
|
||||
return "0";
|
||||
}).join("");
|
||||
var type = parseInt(parsedCell, 2);
|
||||
var interpolated = true;
|
||||
var N = interpolated? [this._lerp(cell[1], cell[0], contour), 0]: [0.5,0],
|
||||
S = interpolated? [this._lerp(cell[2], cell[3], contour), 1]: [0.5,1],
|
||||
E = interpolated? [1, this._lerp(cell[2], cell[1], contour)]: [1,0.5],
|
||||
W = interpolated? [0, this._lerp(cell[3], cell[0], contour)]: [0,0.5]
|
||||
if (type === 0 || type === 15) return null;
|
||||
if (type === 1 || type === 14) return [W, S]
|
||||
if (type === 2 || type === 13) return [S, E]
|
||||
if (type === 3 || type === 12) return [W, E]
|
||||
if (type === 4 || type === 11) return [N, E]
|
||||
if (type === 6 || type === 9) return [N, S]
|
||||
if (type === 7 || type === 8) return [W, N]
|
||||
if (type === 5) return [W, N, S, E]
|
||||
if (type === 10) return [W, S, N, E]
|
||||
},
|
||||
|
||||
_lerp: function(valueA, valueB, contourValue){
|
||||
|
Loading…
Reference in New Issue
Block a user