Skip to content

Minor issues fixes - #2027

Merged
echeipesh merged 6 commits into
locationtech:masterfrom
pomadchin:fix/api-improvements
Feb 24, 2017
Merged

echeipesh merged 6 commits into
locationtech:masterfrom
pomadchin:fix/api-improvements

Conversation

@pomadchin

@pomadchin pomadchin commented Feb 22, 2017 •

Copy link
Copy Markdown
Member

Resolves #2022
Resolves #2012
Resolves #2026

Signed-off-by: Grigory Pomadchin <[email protected]>
@pomadchin
pomadchin force-pushed the fix/api-improvements branch from cb110f1 to 67e93c6 Compare February 22, 2017 10:52
@pomadchin pomadchin changed the title Minor issues fixes [WIP] Minor issues fixes Feb 22, 2017
*/
case class TileLayout(layoutCols: Int, layoutRows: Int, tileCols: Int, tileRows: Int) {

assert(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should use require in these cases, that gives more relevant exception.

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)"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think its fine to use .toString in these cases even though it doesn't have field labels its a little more tenable as a pattern.

@pomadchin pomadchin changed the title [WIP] Minor issues fixes Minor issues fixes Feb 22, 2017
@pomadchin

Copy link
Copy Markdown
Member Author

#2021 work would be done in a separate PR; only descriptive failure messages were introduced in this PR at least to reduce pain.

val layout = level.layout

if(layout.layoutCols < 2 || layout.layoutRows < 2)
sys.error(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is too late to give this exception. At this point a couple of pyramid levels would have already been saved and all that work would have been wasted.

Its possible to give this exception before we start the pyramid but now the nature of this error depends on work in the broken out PR. I would say lets remove this exception here and deal with the issue fully in separate PR.

@pomadchin
pomadchin force-pushed the fix/api-improvements branch from 11339f6 to 3632a61 Compare February 24, 2017 16:56
case class TileLayout(layoutCols: Int, layoutRows: Int, tileCols: Int, tileRows: Int) {

require(
layoutCols >= 0 && layoutRows >= 0 && tileCols >= 0 && tileRows >= 0,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

> not >=, need at least one pixel or a tile in the tile/layout.

@pomadchin
pomadchin force-pushed the fix/api-improvements branch 2 times, most recently from feee027 to e504cad Compare February 24, 2017 19:17
@echeipesh
echeipesh merged commit ac1a460 into locationtech:master Feb 24, 2017
@lossyrob lossyrob added this to the 1.1 milestone Mar 12, 2017
@echeipesh

Copy link
Copy Markdown
Contributor

This seems fine for 1.1, moving TestEnvironment from test projects to testkit is addition, other stuff changes implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants