-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tile generation, scaling, and positioning now works for all zoom levels
- Loading branch information
Showing
7 changed files
with
674 additions
and
598 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
src/app/d3Bindings/eventDistribution/distributionCommon.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/** | ||
* Created by Anthony. | ||
* | ||
* Provides methods common to the distribution controls. | ||
*/ | ||
angular | ||
.module("bawApp.d3.eventDistribution.distributionCommon", []) | ||
.factory( | ||
"distributionCommon", | ||
[ | ||
"d3", | ||
function (d3) { | ||
|
||
/** | ||
* Order tiles based on their date. This allows elements to be painted in the | ||
* DOM in the right order | ||
* @param tileA | ||
* @param tileB | ||
*/ | ||
function sortTiles(tileA, tileB) { | ||
return tileA.offset - tileB.offset; | ||
} | ||
|
||
return { | ||
and(a, b, d) { | ||
return a(d) && b(d); | ||
}, | ||
|
||
isInCategory(getCategory, category, d) { | ||
return getCategory(d) === category; | ||
}, | ||
|
||
isItemVisible(getLow, getHigh, filterExtent, d) { | ||
return getLow(d) < filterExtent[1] && | ||
getHigh(d) >= filterExtent[0]; | ||
}, | ||
|
||
/** | ||
* Select tiles that are the correct size and | ||
* have the bounds within the provided visible extent. | ||
* @param visibleExtent {number[]} | ||
* @param tileSizeSeconds {number} | ||
* @param d - a tile item | ||
* @returns {boolean} | ||
*/ | ||
isTileVisible(visibleExtent, d) { | ||
return d && | ||
d.offset < visibleExtent[1] && | ||
d.offsetEnd >= visibleExtent[0]; | ||
}, | ||
sortTiles | ||
|
||
}; | ||
} | ||
] | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.