Skip to content

Commit

Permalink
TileLayout should contain only non negative fields in ints constructor.
Browse files Browse the repository at this point in the history
Signed-off-by: Grigory Pomadchin <gr.pomadchin@gmail.com>
  • Loading branch information
pomadchin committed Feb 24, 2017
1 parent 67e93c6 commit eb83f7c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions raster/src/main/scala/geotrellis/raster/TileLayout.scala
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ object TileLayout {
* @param tileRows number of pixel rows in each tile, North to South
*/
case class TileLayout(layoutCols: Int, layoutRows: Int, tileCols: Int, tileRows: Int) {

assert(
layoutCols >= 0 && layoutRows >= 0 && tileCols >= 0 && tileRows >= 0,
s"TileLayout should contain cols and rows >= 0: " +
s"TileLayout(layoutCols = $layoutCols, layoutRows = $layoutRows, tileCols = $tileCols, tileRows = $tileRows)"
)

def isTiled = layoutCols > 1 || layoutRows > 1

/**
Expand Down

0 comments on commit eb83f7c

Please sign in to comment.