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

Feature branch for tiles xy-to-quadkey conversion #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

beauof
Copy link

@beauof beauof commented Feb 28, 2020

This feature branch implements functionality to convert tile x/y indices to quadkey and vice-versa.

More features:

  • tile x/y from tile number and vice-versa
  • get midpoint between NDSCoordinate and supplied point
  • flood fill algorithm to get map tiles covered by a given polygon
  • NDSEnvelope to get master tile that fully encloses a given polygon

@rondiplomatico
Copy link
Owner

Rebase with squash to 1 commit please

…nd quadkey

- add new functionality and a whole bunch of unit tests
- add polygon refinement functionality
- add polygon refinement and polygon to map test
@beauof beauof force-pushed the feature-tiles-xy-quadkey branch from 6c81ecb to 1a3ca83 Compare February 28, 2020 11:59
Copy link
Owner

@rondiplomatico rondiplomatico left a comment

Choose a reason for hiding this comment

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

Still a way to go :-)

src/main/java/de/rondiplomatico/nds/NDSBBox.java Outdated Show resolved Hide resolved
src/main/java/de/rondiplomatico/nds/NDSBBox.java Outdated Show resolved Hide resolved
src/main/java/de/rondiplomatico/nds/NDSCoordinate.java Outdated Show resolved Hide resolved
src/main/java/de/rondiplomatico/nds/NDSCoordinate.java Outdated Show resolved Hide resolved
src/main/java/de/rondiplomatico/nds/NDSEnvelope.java Outdated Show resolved Hide resolved
* Get flood filled image
*
*/
public int[][] getFloodFill(){
Copy link
Owner

Choose a reason for hiding this comment

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

if i run

 floodFill f = new floodFill();
 int[][] ff = f.getFloodFill();
 int a = ff.length; //-> NullPointerException.

Always return useful values for public access methods or state what to expect. what needs to be called first before this contains useful values? et

Copy link
Author

Choose a reason for hiding this comment

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

The first line will cause a compile-time error because there's not constructor without arguments. So this should never happen? I've added a comment in the constructor that we expect a non-empty image to be supplied.

src/main/java/de/rondiplomatico/nds/floodFill.java Outdated Show resolved Hide resolved
import java.util.Map;
import java.util.stream.IntStream;

public class polygon {
Copy link
Owner

Choose a reason for hiding this comment

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

CamelCase! -> Polygon.
Also, if this is a polygon composed of NDSCoordinates, it should be named "NDSPolygon"
also, it has a main method. add a separate Class "NDSPolyFillDemo" with it, and put the polygon logic into the NDSPolygon class

Copy link
Author

Choose a reason for hiding this comment

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

I've moved the demo away from the class - still not sure if that's organized well. Might have to revisit the files later.

src/main/java/de/rondiplomatico/nds/polygon.java Outdated Show resolved Hide resolved
@@ -298,6 +300,222 @@ public void testCenterWorks() {
}
}

@Test
Copy link
Owner

Choose a reason for hiding this comment

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

What is the test coverage of these tests?

Copy link
Author

Choose a reason for hiding this comment

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

NDSTile - 94 %.
nds-tiles repo - 82.9 %.

Copy link
Owner

@rondiplomatico rondiplomatico left a comment

Choose a reason for hiding this comment

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

Repeated Review with current rebase

beauof added a commit to beauof/nds-tiles that referenced this pull request Feb 28, 2020
@beauof beauof force-pushed the feature-tiles-xy-quadkey branch from b7423fb to e82a2b5 Compare March 2, 2020 09:11
@beauof beauof requested a review from rondiplomatico March 2, 2020 09:11
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.

2 participants