Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@
*/
public class MultiSemUtilities {

/**
* @return scan005 for w60_magc0399_scan005_m0013_r46_s01
*/
public static String getScanStringForTileId(final String tileId)
throws IllegalArgumentException {
final int magcIndex = tileId.indexOf("magc");
Comment thread
trautmane marked this conversation as resolved.
if ((magcIndex < 0) || (tileId.length() < (magcIndex + 16))) {
throw new IllegalArgumentException("scan string cannot be derived from tileId " + tileId);
}
return tileId.substring((magcIndex + 9), (magcIndex + 16)); // scan005;
}

/**
* @return m0013 for w60_magc0399_scan005_m0013_r46_s01
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public void testTileIdParsers() {
"m0013_s01", MultiSemUtilities.getMfovSfovForTileId(tileId));
Assert.assertEquals("invalid SFOVIndexForTileId",
"01", MultiSemUtilities.getSFOVIndexForTileId(tileId));
Assert.assertEquals("invalid ScanStringForTileId",
"scan005", MultiSemUtilities.getScanStringForTileId(tileId));

final String manyScanTileId = "w66_magc0000_sc09876_m0005_r65_s16";
Assert.assertEquals("invalid MagcMfov",
Expand All @@ -31,6 +33,8 @@ public void testTileIdParsers() {
"m0005_s16", MultiSemUtilities.getMfovSfovForTileId(manyScanTileId));
Assert.assertEquals("invalid SFOVIndexForTileId",
"16", MultiSemUtilities.getSFOVIndexForTileId(manyScanTileId));
Assert.assertEquals("invalid ScanStringForTileId",
"sc09876", MultiSemUtilities.getScanStringForTileId(manyScanTileId));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,34 @@ public Bounds getLayerBounds(final String stack,
return httpClient.execute(httpGet, responseHandler);
}

/**
* @param stack name of stack.
* @param z z value for layer.
*
* @return ids for all tiles in the specified layer of the specified stack.
*
* @throws IOException
* if the request fails for any reason.
*/
public List<String> getTileIdsForZ(final String stack,
final Double z)
throws IOException {

final URIBuilder builder = new URIBuilder(getUri(urls.getStackUrlString(stack) + "/tileIds"));
final URI uri = getUriWithZRangeParameters(z, z, builder);

final HttpGet httpGet = new HttpGet(uri);
final String requestContext = "GET " + uri;
final TypeReference<List<String>> typeReference = new TypeReference<>() {
};
final JsonUtils.GenericHelper<List<String>> helper = new JsonUtils.GenericHelper<>(typeReference);
final JsonResponseHandler<List<String>> responseHandler = new JsonResponseHandler<>(requestContext, helper);

LOG.info("getTileIdsForZ: submitting {}", requestContext);

return httpClient.execute(httpGet, responseHandler);
}

/**
* @param stack name of stack.
* @param z z value for layer.
Expand Down
Loading