From feea9d9360409e6bd3cd0d874c7773523e47a7a4 Mon Sep 17 00:00:00 2001 From: cjd24 Date: Thu, 29 Mar 2018 09:33:23 +0100 Subject: v basic and slow working version of final tile builder - Be Wary, this commit might break the old czi.ts builder --- src/conversion/czi/tileExtraction.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/conversion/czi/tileExtraction.ts') diff --git a/src/conversion/czi/tileExtraction.ts b/src/conversion/czi/tileExtraction.ts index 9c87dd9..be8bd3c 100644 --- a/src/conversion/czi/tileExtraction.ts +++ b/src/conversion/czi/tileExtraction.ts @@ -44,7 +44,7 @@ export const isTileRelated:Function = function(origCoords: TileBounds, desired: * to calculate the region within the base tile that is overlapping the new tile * to be extracted. */ -export const regionToExtract: Function = function(baseBounds: TileBounds, desired: TileBounds): TileBounds { +export const regionToExtract: Function = function(baseBounds: TileBounds, desired: TileBounds, zoomLevel: number): TileBounds { //get the base tile area and create an object for the chunk to extract let chunkToExtract: TileBounds = new TileBounds(-1, -1, -1, -1); @@ -81,6 +81,11 @@ export const regionToExtract: Function = function(baseBounds: TileBounds, desire throw new Error("Chunk to extract from base tile has invalid bound (< 0)."); } + chunkToExtract.left = Math.ceil(chunkToExtract.left / zoomLevel); + chunkToExtract.right = Math.ceil(chunkToExtract.right / zoomLevel); + chunkToExtract.top = Math.ceil(chunkToExtract.top / zoomLevel); + chunkToExtract.bottom = Math.ceil(chunkToExtract.bottom / zoomLevel); + //return the slice within the base tile for extraction return chunkToExtract; }; -- cgit v1.2.1