Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor issues fixes #2027

Merged
merged 6 commits into from
Feb 24, 2017
Merged

Conversation

pomadchin
Copy link
Member

@pomadchin pomadchin commented Feb 22, 2017

Resolves #2022
Resolves #2012
Resolves #2026

Signed-off-by: Grigory Pomadchin <gr.pomadchin@gmail.com>
Signed-off-by: Grigory Pomadchin <gr.pomadchin@gmail.com>
@pomadchin pomadchin changed the title Minor issues fixes [WIP] Minor issues fixes Feb 22, 2017
@@ -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(
Copy link
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
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
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.

@@ -116,15 +116,23 @@ class ZoomedLayoutScheme(val crs: CRS, val tileSize: Int, resolutionThreshold: D

def zoomOut(level: LayoutLevel) = {
val layout = level.layout

if(layout.layoutCols < 2 || layout.layoutRows < 2)
sys.error(
Copy link
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.

@@ -46,6 +46,12 @@ 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) {

require(
layoutCols >= 0 && layoutRows >= 0 && tileCols >= 0 && tileRows >= 0,
Copy link
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.

Signed-off-by: Grigory Pomadchin <gr.pomadchin@gmail.com>
Signed-off-by: Grigory Pomadchin <gr.pomadchin@gmail.com>
Signed-off-by: Grigory Pomadchin <gr.pomadchin@gmail.com>
@pomadchin pomadchin force-pushed the fix/api-improvements branch 2 times, most recently from feee027 to e504cad Compare February 24, 2017 19:17
Signed-off-by: Grigory Pomadchin <gr.pomadchin@gmail.com>
@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
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