@Test public void testPointWithMultipleTiles() throws Exception { final List<TileCoordinates> localCoordinateList = service.getLocalCoordinates(stackId.getOwner(), stackId.getProject(), stackId.getStack(), 8000.0, 5900.0, Z); Assert.assertNotNull("null local list retrieved", localCoordinateList); Assert.assertEquals("invalid local list size", 2, localCoordinateList.size()); TileCoordinates localCoordinates = localCoordinateList.get(0); Assert.assertNotNull("null first coordinates", localCoordinates); Assert.assertFalse("first coordinates should NOT be marked as visible", localCoordinates.isVisible()); localCoordinates = localCoordinateList.get(1); Assert.assertNotNull("null second coordinates", localCoordinates); Assert.assertTrue("second coordinates should be marked as visible", localCoordinates.isVisible()); }
@SuppressWarnings("PathAnnotation") @Path("v1/owner/{owner}/world-to-local-coordinates/{x},{y}") @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Derive local coordinates for specified world coordinates using provided tile spec") @ApiResponses(value = { @ApiResponse(code = 500, message = "coordinates not invertible") }) public double[] getLocalCoordinates(@PathParam("x") final double x, @PathParam("y") final double y, @QueryParam("meshCellSize") final Double meshCellSize, final TileSpec tileSpec) { double[] localCoordinates = null; try { localCoordinates = tileSpec.getLocalCoordinates(x, y, meshCellSize == null ? tileSpec.getMeshCellSize() : meshCellSize ); } catch (final Throwable t) { RenderServiceUtil.throwServiceException(t); } return localCoordinates; }
CoordinateService { @SuppressWarnings("PathAnnotation") @Path("v1/owner/{owner}/world-to-local-coordinates/{x},{y}") @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Derive local coordinates for specified world coordinates using provided tile spec") @ApiResponses(value = { @ApiResponse(code = 500, message = "coordinates not invertible") }) public double[] getLocalCoordinates(@PathParam("x") final double x, @PathParam("y") final double y, @QueryParam("meshCellSize") final Double meshCellSize, final TileSpec tileSpec) { double[] localCoordinates = null; try { localCoordinates = tileSpec.getLocalCoordinates(x, y, meshCellSize == null ? tileSpec.getMeshCellSize() : meshCellSize ); } catch (final Throwable t) { RenderServiceUtil.throwServiceException(t); } return localCoordinates; } }
CoordinateService { @SuppressWarnings("PathAnnotation") @Path("v1/owner/{owner}/world-to-local-coordinates/{x},{y}") @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Derive local coordinates for specified world coordinates using provided tile spec") @ApiResponses(value = { @ApiResponse(code = 500, message = "coordinates not invertible") }) public double[] getLocalCoordinates(@PathParam("x") final double x, @PathParam("y") final double y, @QueryParam("meshCellSize") final Double meshCellSize, final TileSpec tileSpec) { double[] localCoordinates = null; try { localCoordinates = tileSpec.getLocalCoordinates(x, y, meshCellSize == null ? tileSpec.getMeshCellSize() : meshCellSize ); } catch (final Throwable t) { RenderServiceUtil.throwServiceException(t); } return localCoordinates; } @SuppressWarnings("UnusedDeclaration")  CoordinateService();   CoordinateService(final RenderDao renderDao); }
CoordinateService { @SuppressWarnings("PathAnnotation") @Path("v1/owner/{owner}/world-to-local-coordinates/{x},{y}") @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Derive local coordinates for specified world coordinates using provided tile spec") @ApiResponses(value = { @ApiResponse(code = 500, message = "coordinates not invertible") }) public double[] getLocalCoordinates(@PathParam("x") final double x, @PathParam("y") final double y, @QueryParam("meshCellSize") final Double meshCellSize, final TileSpec tileSpec) { double[] localCoordinates = null; try { localCoordinates = tileSpec.getLocalCoordinates(x, y, meshCellSize == null ? tileSpec.getMeshCellSize() : meshCellSize ); } catch (final Throwable t) { RenderServiceUtil.throwServiceException(t); } return localCoordinates; } @SuppressWarnings("UnusedDeclaration")  CoordinateService();   CoordinateService(final RenderDao renderDao); @Path("v1/owner/{owner}/project/{project}/stack/{stack}/z/{z}/tileIdsForCoordinates") @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @ApiOperation( value = "Map world coordinates in one layer to tileId(s)", notes = "Locates all tiles that contain each specified world coordinate. World coordinates need only identify x and y since z is provided.", response = TileCoordinates.class, responseContainer = "List") @ApiResponses(value = { @ApiResponse(code = 400, message = "problem with specified coordinates") }) Response getTileIdsForCoordinates(@PathParam("owner") final String owner,
                                             @PathParam("project") final String project,
                                             @PathParam("stack") final String stack,
                                             @PathParam("z") final Double z,
                                             final List<TileCoordinates> worldCoordinatesList); @Path("v1/owner/{owner}/project/{project}/stack/{stack}/tileIdsForCoordinates") @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @ApiOperation( value = "Map world coordinates in any layer to tileId(s)", notes = "Locates all tiles that contain each specified world coordinate. World coordinates must identify x, y, and z.", response = TileCoordinates.class, responseContainer = "List") @ApiResponses(value = { @ApiResponse(code = 400, message = "problem with specified coordinates") }) Response getTileIdsForCoordinatesAcrossZ(@PathParam("owner") final String owner,
                                                    @PathParam("project") final String project,
                                                    @PathParam("stack") final String stack,
                                                    final List<TileCoordinates> worldCoordinatesList); @SuppressWarnings("PathAnnotation") @Path("v1/owner/{owner}/local-to-world-coordinates/{x},{y}") @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Derive world coordinates for specified local coordinates using provided tile spec") double[] getWorldCoordinates(@PathParam("x") final double x,
                                        @PathParam("y") final double y,
                                        final TileSpec tileSpec); @SuppressWarnings("PathAnnotation") @Path("v1/owner/{owner}/world-to-local-coordinates/{x},{y}") @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Derive local coordinates for specified world coordinates using provided tile spec") @ApiResponses(value = { @ApiResponse(code = 500, message = "coordinates not invertible") }) double[] getLocalCoordinates(@PathParam("x") final double x,
                                        @PathParam("y") final double y,
                                        @QueryParam("meshCellSize") final Double meshCellSize,
                                        final TileSpec tileSpec); @Path("v1/owner/{owner}/project/{project}/stack/{stack}/tile/{tileId}/local-to-world-coordinates/{x},{y}") @GET @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Derive world coordinates for specified tile local coordinates") @ApiResponses(value = { @ApiResponse(code = 404, message = "tile not found") }) TileCoordinates getWorldCoordinates(@PathParam("owner") final String owner,
                                               @PathParam("project") final String project,
                                               @PathParam("stack") final String stack,
                                               @PathParam("tileId") final String tileId,
                                               @PathParam("x") final Double localX,
                                               @PathParam("y") final Double localY); @Path("v1/owner/{owner}/project/{project}/stack/{stack}/local-to-world-coordinates") @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Derive array of world coordinates for provided array of tile local coordinates") @ApiResponses(value = { @ApiResponse(code = 400, message = "missing tile or coordinate data"), @ApiResponse(code = 404, message = "tile not found") }) List<TileCoordinates> getWorldCoordinates(@PathParam("owner") final String owner,
                                                     @PathParam("project") final String project,
                                                     @PathParam("stack") final String stack,
                                                     final List<TileCoordinates> localCoordinatesList); @Path("v1/owner/{owner}/project/{project}/stack/{stack}/z/{z}/local-to-world-coordinates") @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @ApiOperation( value = "Derive array of world coordinates for provided array of tile local coordinates", notes = "The z path parameter is not used or checked." ) @ApiResponses(value = { @ApiResponse(code = 400, message = "missing tile or coordinate data"), @ApiResponse(code = 404, message = "tile not found") }) List<TileCoordinates> getWorldCoordinates(@PathParam("owner") final String owner,
                                                     @PathParam("project") final String project,
                                                     @PathParam("stack") final String stack,
                                                     @PathParam("z") final Double z,
                                                     final List<TileCoordinates> localCoordinatesList); @Path("v1/owner/{owner}/project/{project}/stack/{stack}/z/{z}/world-to-local-coordinates/{x},{y}") @GET @Produces(MediaType.APPLICATION_JSON) @ApiOperation( value = "Derive array of local coordinates for specified world coordinates", notes = "World coordinates can map to multiple (overlapping) tiles. An array of local coordinates, one element per tile, is returned with the visible (last drawn) tile marked.") @ApiResponses(value = { @ApiResponse(code = 400, message = "no tile exists at specified coordinates"), @ApiResponse(code = 500, message = "coordinates not invertible") }) List<TileCoordinates> getLocalCoordinates(@PathParam("owner") final String owner,
                                                     @PathParam("project") final String project,
                                                     @PathParam("stack") final String stack,
                                                     @PathParam("x") final Double worldX,
                                                     @PathParam("y") final Double worldY,
                                                     @PathParam("z") final Double z); @Path("v1/owner/{owner}/project/{project}/stack/{stack}/z/{z}/world-coordinates/{x},{y}/mapped-to-stack/{toStack}") @GET @Produces(MediaType.APPLICATION_JSON) @ApiOperation( value = "Map world coordinates in one stack to another") @ApiResponses(value = { @ApiResponse(code = 400, message = "no tile exists at specified coordinates"), @ApiResponse(code = 500, message = "coordinates not invertible") }) TileCoordinates mapWorldCoordinates(@PathParam("owner") final String owner,
                                               @PathParam("project") final String project,
                                               @PathParam("stack") final String stack,
                                               @PathParam("x") final Double worldX,
                                               @PathParam("y") final Double worldY,
                                               @PathParam("z") final Double z,
                                               @PathParam("toStack") final String toStack,
                                               @QueryParam("toOwner") final String toOwner,
                                               @QueryParam("toProject") final String toProject); @Path("v1/owner/{owner}/project/{project}/stack/{stack}/world-to-local-coordinates") @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @ApiOperation( value = "Derive array of arrays of local coordinates for provided array of arbitrary world coordinates", notes = "Each provided coordinate is expected to contain explicit [x, y, z] values. " + "World coordinates can map to multiple (overlapping) tiles. " + "For each provided world coordinate, an array of local coordinates, " + "one element per tile, is returned with the visible (last drawn) tile marked.") @ApiResponses(value = { @ApiResponse(code = 400, message = "missing tile or coordinate data"), @ApiResponse(code = 500, message = "coordinates not invertible") }) List<List<TileCoordinates>> getLocalCoordinates(@PathParam("owner") final String owner,
                                                           @PathParam("project") final String project,
                                                           @PathParam("stack") final String stack,
                                                           final List<TileCoordinates> worldCoordinatesList); @Path("v1/owner/{owner}/project/{project}/stack/{stack}/z/{z}/world-to-local-coordinates") @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @ApiOperation( value = "Derive array of arrays of local coordinates for provided array of world coordinates within a layer", notes = "Each provided coordinate is expected to contain explicit [x, y] values. " + "World coordinates can map to multiple (overlapping) tiles. " + "For each provided world coordinate, an array of local coordinates, " + "one element per tile, is returned with the visible (last drawn) tile marked.") @ApiResponses(value = { @ApiResponse(code = 400, message = "missing tile or coordinate data"), @ApiResponse(code = 500, message = "coordinates not invertible") }) List<List<TileCoordinates>> getLocalCoordinates(@PathParam("owner") final String owner,
                                                           @PathParam("project") final String project,
                                                           @PathParam("stack") final String stack,
                                                           @PathParam("z") final Double z,
                                                           final List<TileCoordinates> worldCoordinatesList); }
CoordinateService { @SuppressWarnings("PathAnnotation") @Path("v1/owner/{owner}/world-to-local-coordinates/{x},{y}") @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Derive local coordinates for specified world coordinates using provided tile spec") @ApiResponses(value = { @ApiResponse(code = 500, message = "coordinates not invertible") }) public double[] getLocalCoordinates(@PathParam("x") final double x, @PathParam("y") final double y, @QueryParam("meshCellSize") final Double meshCellSize, final TileSpec tileSpec) { double[] localCoordinates = null; try { localCoordinates = tileSpec.getLocalCoordinates(x, y, meshCellSize == null ? tileSpec.getMeshCellSize() : meshCellSize ); } catch (final Throwable t) { RenderServiceUtil.throwServiceException(t); } return localCoordinates; } @SuppressWarnings("UnusedDeclaration")  CoordinateService();   CoordinateService(final RenderDao renderDao); @Path("v1/owner/{owner}/project/{project}/stack/{stack}/z/{z}/tileIdsForCoordinates") @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @ApiOperation( value = "Map world coordinates in one layer to tileId(s)", notes = "Locates all tiles that contain each specified world coordinate. World coordinates need only identify x and y since z is provided.", response = TileCoordinates.class, responseContainer = "List") @ApiResponses(value = { @ApiResponse(code = 400, message = "problem with specified coordinates") }) Response getTileIdsForCoordinates(@PathParam("owner") final String owner,
                                             @PathParam("project") final String project,
                                             @PathParam("stack") final String stack,
                                             @PathParam("z") final Double z,
                                             final List<TileCoordinates> worldCoordinatesList); @Path("v1/owner/{owner}/project/{project}/stack/{stack}/tileIdsForCoordinates") @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @ApiOperation( value = "Map world coordinates in any layer to tileId(s)", notes = "Locates all tiles that contain each specified world coordinate. World coordinates must identify x, y, and z.", response = TileCoordinates.class, responseContainer = "List") @ApiResponses(value = { @ApiResponse(code = 400, message = "problem with specified coordinates") }) Response getTileIdsForCoordinatesAcrossZ(@PathParam("owner") final String owner,
                                                    @PathParam("project") final String project,
                                                    @PathParam("stack") final String stack,
                                                    final List<TileCoordinates> worldCoordinatesList); @SuppressWarnings("PathAnnotation") @Path("v1/owner/{owner}/local-to-world-coordinates/{x},{y}") @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Derive world coordinates for specified local coordinates using provided tile spec") double[] getWorldCoordinates(@PathParam("x") final double x,
                                        @PathParam("y") final double y,
                                        final TileSpec tileSpec); @SuppressWarnings("PathAnnotation") @Path("v1/owner/{owner}/world-to-local-coordinates/{x},{y}") @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Derive local coordinates for specified world coordinates using provided tile spec") @ApiResponses(value = { @ApiResponse(code = 500, message = "coordinates not invertible") }) double[] getLocalCoordinates(@PathParam("x") final double x,
                                        @PathParam("y") final double y,
                                        @QueryParam("meshCellSize") final Double meshCellSize,
                                        final TileSpec tileSpec); @Path("v1/owner/{owner}/project/{project}/stack/{stack}/tile/{tileId}/local-to-world-coordinates/{x},{y}") @GET @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Derive world coordinates for specified tile local coordinates") @ApiResponses(value = { @ApiResponse(code = 404, message = "tile not found") }) TileCoordinates getWorldCoordinates(@PathParam("owner") final String owner,
                                               @PathParam("project") final String project,
                                               @PathParam("stack") final String stack,
                                               @PathParam("tileId") final String tileId,
                                               @PathParam("x") final Double localX,
                                               @PathParam("y") final Double localY); @Path("v1/owner/{owner}/project/{project}/stack/{stack}/local-to-world-coordinates") @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Derive array of world coordinates for provided array of tile local coordinates") @ApiResponses(value = { @ApiResponse(code = 400, message = "missing tile or coordinate data"), @ApiResponse(code = 404, message = "tile not found") }) List<TileCoordinates> getWorldCoordinates(@PathParam("owner") final String owner,
                                                     @PathParam("project") final String project,
                                                     @PathParam("stack") final String stack,
                                                     final List<TileCoordinates> localCoordinatesList); @Path("v1/owner/{owner}/project/{project}/stack/{stack}/z/{z}/local-to-world-coordinates") @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @ApiOperation( value = "Derive array of world coordinates for provided array of tile local coordinates", notes = "The z path parameter is not used or checked." ) @ApiResponses(value = { @ApiResponse(code = 400, message = "missing tile or coordinate data"), @ApiResponse(code = 404, message = "tile not found") }) List<TileCoordinates> getWorldCoordinates(@PathParam("owner") final String owner,
                                                     @PathParam("project") final String project,
                                                     @PathParam("stack") final String stack,
                                                     @PathParam("z") final Double z,
                                                     final List<TileCoordinates> localCoordinatesList); @Path("v1/owner/{owner}/project/{project}/stack/{stack}/z/{z}/world-to-local-coordinates/{x},{y}") @GET @Produces(MediaType.APPLICATION_JSON) @ApiOperation( value = "Derive array of local coordinates for specified world coordinates", notes = "World coordinates can map to multiple (overlapping) tiles. An array of local coordinates, one element per tile, is returned with the visible (last drawn) tile marked.") @ApiResponses(value = { @ApiResponse(code = 400, message = "no tile exists at specified coordinates"), @ApiResponse(code = 500, message = "coordinates not invertible") }) List<TileCoordinates> getLocalCoordinates(@PathParam("owner") final String owner,
                                                     @PathParam("project") final String project,
                                                     @PathParam("stack") final String stack,
                                                     @PathParam("x") final Double worldX,
                                                     @PathParam("y") final Double worldY,
                                                     @PathParam("z") final Double z); @Path("v1/owner/{owner}/project/{project}/stack/{stack}/z/{z}/world-coordinates/{x},{y}/mapped-to-stack/{toStack}") @GET @Produces(MediaType.APPLICATION_JSON) @ApiOperation( value = "Map world coordinates in one stack to another") @ApiResponses(value = { @ApiResponse(code = 400, message = "no tile exists at specified coordinates"), @ApiResponse(code = 500, message = "coordinates not invertible") }) TileCoordinates mapWorldCoordinates(@PathParam("owner") final String owner,
                                               @PathParam("project") final String project,
                                               @PathParam("stack") final String stack,
                                               @PathParam("x") final Double worldX,
                                               @PathParam("y") final Double worldY,
                                               @PathParam("z") final Double z,
                                               @PathParam("toStack") final String toStack,
                                               @QueryParam("toOwner") final String toOwner,
                                               @QueryParam("toProject") final String toProject); @Path("v1/owner/{owner}/project/{project}/stack/{stack}/world-to-local-coordinates") @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @ApiOperation( value = "Derive array of arrays of local coordinates for provided array of arbitrary world coordinates", notes = "Each provided coordinate is expected to contain explicit [x, y, z] values. " + "World coordinates can map to multiple (overlapping) tiles. " + "For each provided world coordinate, an array of local coordinates, " + "one element per tile, is returned with the visible (last drawn) tile marked.") @ApiResponses(value = { @ApiResponse(code = 400, message = "missing tile or coordinate data"), @ApiResponse(code = 500, message = "coordinates not invertible") }) List<List<TileCoordinates>> getLocalCoordinates(@PathParam("owner") final String owner,
                                                           @PathParam("project") final String project,
                                                           @PathParam("stack") final String stack,
                                                           final List<TileCoordinates> worldCoordinatesList); @Path("v1/owner/{owner}/project/{project}/stack/{stack}/z/{z}/world-to-local-coordinates") @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @ApiOperation( value = "Derive array of arrays of local coordinates for provided array of world coordinates within a layer", notes = "Each provided coordinate is expected to contain explicit [x, y] values. " + "World coordinates can map to multiple (overlapping) tiles. " + "For each provided world coordinate, an array of local coordinates, " + "one element per tile, is returned with the visible (last drawn) tile marked.") @ApiResponses(value = { @ApiResponse(code = 400, message = "missing tile or coordinate data"), @ApiResponse(code = 500, message = "coordinates not invertible") }) List<List<TileCoordinates>> getLocalCoordinates(@PathParam("owner") final String owner,
                                                           @PathParam("project") final String project,
                                                           @PathParam("stack") final String stack,
                                                           @PathParam("z") final Double z,
                                                           final List<TileCoordinates> worldCoordinatesList);  }