fills grid with nulls instead of zeroes

This commit is contained in:
Francisco Dans 2015-10-05 12:39:16 +02:00
parent 1696e524c1
commit 642f1c2a1d
3 changed files with 4 additions and 17 deletions

View File

@ -9,20 +9,10 @@ JS_CLIENT_FILES= lib/torque/*.js \
lib/torque/leaflet/canvas_layer.js \ lib/torque/leaflet/canvas_layer.js \
lib/torque/leaflet/torque.js lib/torque/leaflet/torque.js
all: dist/torque.js dist/torque.full.js add-header
dist/torque.full.uncompressed.js: dist_folder dist/torque.uncompressed.js dist/torque.full.uncompressed.js: dist_folder dist/torque.uncompressed.js
$(BROWSERIFY) lib/torque/index.js --standalone torque > dist/torque.full.uncompressed.js $(BROWSERIFY) lib/torque/index.js --standalone torque > dist/torque.full.uncompressed.js
dist/torque.full.js: dist_folder dist/torque.full.uncompressed.js
$(UGLIFYJS) dist/torque.full.uncompressed.js > dist/torque.full.js
dist/torque.uncompressed.js: dist_folder $(JS_CLIENT_FILES)
$(BROWSERIFY) lib/torque/index.js --no-bundle-external --standalone torque > dist/torque.uncompressed.js
dist/torque.js: dist_folder dist/torque.uncompressed.js
$(UGLIFYJS) dist/torque.uncompressed.js > dist/torque.js
dist_folder: dist_folder:
mkdir -p dist mkdir -p dist
@ -31,9 +21,6 @@ dist: dist_folder dist/torque.js
clean-results: clean-results:
-@rm test/results/*.png -@rm test/results/*.png
add-header:
node lib/header.js
prepare-test-suite: prepare-test-suite:
browserify test/suite.js > test/suite-bundle.js browserify test/suite.js > test/suite-bundle.js

View File

@ -233,9 +233,9 @@ L.TorqueLayer = L.CanvasLayer.extend({
this.renderer.firstTileCoords = {coord: this._tiles[min.k].coord, pos:this.getTilePos(this._tiles[min.k].coord)}; this.renderer.firstTileCoords = {coord: this._tiles[min.k].coord, pos:this.getTilePos(this._tiles[min.k].coord)};
var valsPerTile = 256/this.options.resolution; var valsPerTile = 256/this.options.resolution;
this.renderer.globalGrid = Array.apply(null, Array(this.renderer.tileDimensions.h * valsPerTile)).map(Number.prototype.valueOf,0); this.renderer.globalGrid = new Array(this.renderer.tileDimensions.h * valsPerTile).fill(null);
for (var i = 0; i < this.renderer.globalGrid.length; i++){ for (var i = 0; i < this.renderer.globalGrid.length; i++){
this.renderer.globalGrid[i] = Array.apply(null, Array(this.renderer.tileDimensions.w * valsPerTile)).map(Number.prototype.valueOf,0); this.renderer.globalGrid[i] = new Array(this.renderer.tileDimensions.w * valsPerTile).fill(null);
} }
} }
for(t in this._tiles) { for(t in this._tiles) {

View File

@ -483,11 +483,11 @@ torque.extend(IsoRenderer.prototype, torque.Event, {
var contourValues = this.contourValues; var contourValues = this.contourValues;
for (var c = 0; c < this.lines.length; c++){ for (var c = 0; c < this.lines.length; c++){
var thisContour = this.lines[c]; var thisContour = this.lines[c];
if(style["-isoline-line-decay"]){ if (style["-isoline-line-decay"]){
var max = contourValues[contourValues.length - 1]; var max = contourValues[contourValues.length - 1];
ctx.globalAlpha = (contourValues[c]/max)*(style["-isoline-line-opacity"] || 0.8); ctx.globalAlpha = (contourValues[c]/max)*(style["-isoline-line-opacity"] || 0.8);
} }
if(grad){ if (grad){
ctx.strokeStyle = "rgb("+grad[4*contourValues[c]]+","+grad[4*contourValues[c]+1]+","+grad[4*contourValues[c]+2]+")"; ctx.strokeStyle = "rgb("+grad[4*contourValues[c]]+","+grad[4*contourValues[c]+1]+","+grad[4*contourValues[c]+2]+")";
ctx.fillStyle = "rgb("+grad[4*contourValues[c]]+","+grad[4*contourValues[c]+1]+","+grad[4*contourValues[c]+2]+")"; ctx.fillStyle = "rgb("+grad[4*contourValues[c]]+","+grad[4*contourValues[c]+1]+","+grad[4*contourValues[c]+2]+")";
} }