adds getValueForBbox
This commit is contained in:
parent
d81bb5855c
commit
f04b149b23
23
Makefile
23
Makefile
@ -9,28 +9,31 @@ JS_CLIENT_FILES= lib/torque/*.js \
|
||||
lib/torque/leaflet/canvas_layer.js \
|
||||
lib/torque/leaflet/torque.js
|
||||
|
||||
all: dist/torque.js dist/torque.full.js
|
||||
|
||||
dist/torque.full.uncompressed.js: dist_folder dist/torque.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:
|
||||
mkdir -p dist
|
||||
|
||||
dist: dist_folder dist/torque.js
|
||||
|
||||
clean-results:
|
||||
-@rm test/results/*.png
|
||||
|
||||
prepare-test-suite:
|
||||
browserify test/suite.js > test/suite-bundle.js
|
||||
|
||||
test: prepare-test-suite
|
||||
@echo "***tests***"
|
||||
./node_modules/node-qunit-phantomjs/bin/node-qunit-phantomjs test/suite.html
|
||||
|
||||
test-acceptance: clean-results
|
||||
@echo "***acceptance***"
|
||||
./node_modules/.bin/qunit -c lib/torque/ -t `find test/acceptance/ -name *.js`
|
||||
|
||||
test-all: test test-acceptance
|
||||
|
||||
clean:
|
||||
rm -rf dist
|
||||
|
||||
|
@ -384,6 +384,27 @@ L.TorqueLayer = L.CanvasLayer.extend({
|
||||
return null;
|
||||
},
|
||||
|
||||
getValueForBBox: function(x, y, w, h) {
|
||||
var xf = x + w, yf = y + h;
|
||||
var sum = 0;
|
||||
while(y<yf){
|
||||
while(x<xf){
|
||||
var thisValue = this.getValueForPos(x,y);
|
||||
if (thisValue){
|
||||
var bb = thisValue.bbox;
|
||||
var ex = this._map.latLngToContainerPoint([bb[1].lat, bb[1].lon]).x;
|
||||
var ey = this._map.latLngToContainerPoint([bb[1].lat, bb[1].lon]).y;
|
||||
if(ex < xf && ey < yf){
|
||||
sum += thisValue.value;
|
||||
}
|
||||
}
|
||||
x += this.options.resolution;
|
||||
}
|
||||
y += this.options.resolution;
|
||||
}
|
||||
return sum;
|
||||
},
|
||||
|
||||
invalidate: function() {
|
||||
this.provider.reload();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user