-
-
Notifications
You must be signed in to change notification settings - Fork 118
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
Convert get all tile coords to iterator #463
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
bfafce1
convert get all tile coords to iterator
msbarry 1940e02
typo
msbarry f1781db
pull up backwards-compatible method
msbarry f66154a
a little safer
msbarry 4159f24
Extract readable tile archive interface
msbarry 25ff351
invoke log messages conditionally
msbarry b8b9884
typo
msbarry File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
4 changes: 2 additions & 2 deletions
4
...benchmarks/src/main/java/com/onthegomap/planetiler/benchmarks/BenchmarkMbtilesWriter.java
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
44 changes: 44 additions & 0 deletions
44
planetiler-core/src/main/java/com/onthegomap/planetiler/archive/ReadableTileArchive.java
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,44 @@ | ||
package com.onthegomap.planetiler.archive; | ||
|
||
import com.onthegomap.planetiler.geo.TileCoord; | ||
import com.onthegomap.planetiler.util.CloseableIterator; | ||
import java.io.Closeable; | ||
|
||
/** | ||
* Read API for on-disk representation of a tileset in a portable format. Example: MBTiles, a sqlite-based archive | ||
* format. | ||
* <p> | ||
* See {@link WriteableTileArchive} for the write API. | ||
*/ | ||
public interface ReadableTileArchive extends Closeable { | ||
|
||
/** Returns the raw tile data associated with the tile at {@code coord}. */ | ||
default byte[] getTile(TileCoord coord) { | ||
return getTile(coord.x(), coord.y(), coord.z()); | ||
} | ||
|
||
/** Returns the raw tile data associated with the tile at coordinate {@code x, y, z}. */ | ||
byte[] getTile(int x, int y, int z); | ||
|
||
/** | ||
* Returns an iterator over the coordinates of tiles in this archive. | ||
* <p> | ||
* The order should respect {@link WriteableTileArchive#tileOrder()} of the corresponding writer. | ||
* <p> | ||
* Clients should be sure to close the iterator after iterating through it, for example: | ||
* | ||
* <pre> | ||
* {@code | ||
* try (var iter = archive.getAllTileCoords()) { | ||
* while (iter.hasNext()) { | ||
* var coord = iter.next(); | ||
* ... | ||
* } | ||
* } | ||
* } | ||
* </pre> | ||
*/ | ||
CloseableIterator<TileCoord> getAllTileCoords(); | ||
|
||
// TODO access archive metadata | ||
} |
2 changes: 1 addition & 1 deletion
2
...lanetiler/writer/TileArchiveMetadata.java → ...anetiler/archive/TileArchiveMetadata.java
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
2 changes: 1 addition & 1 deletion
2
...planetiler/writer/TileEncodingResult.java → ...lanetiler/archive/TileEncodingResult.java
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
5 changes: 3 additions & 2 deletions
5
planetiler-core/src/main/java/com/onthegomap/planetiler/geo/TileOrder.java
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How should this handle the case of the tile not existing? should it be an option return type? It doesn't seem exceptional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah sorry the javadoc should indicate this, but it should return
null
if not found.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened #486 to fix the javadoc.