Package org.opentripplanner.api.parameter

Examples of org.opentripplanner.api.parameter.MIMEImageFormat


        Envelope2D env = SlippyTile.tile2Envelope(x, y, z);
        TileRequest tileRequest = new TileRequest(routerId, env, 256, 256);

        BufferedImage image = otpServer.tileRendererManager.renderTile(tileRequest, layer);

        MIMEImageFormat format = new MIMEImageFormat("image/" + ext);
        ByteArrayOutputStream baos = new ByteArrayOutputStream(image.getWidth() * image.getHeight() / 4);
        ImageIO.write(image, format.type, baos);
        CacheControl cc = new CacheControl();
        cc.setMaxAge(3600);
        cc.setNoCache(false);
        return Response.ok(baos.toByteArray()).type(format.toString()).cacheControl(cc).build();
    }
View Full Code Here


        TimeSurface surfA = server.surfaceCache.get(surfaceId);
        if (surfA == null) return badRequest("Unrecognized surface ID.");
         
        TileRequest tileRequest = new TileRequest(surfA.routerId, env, 256, 256);
      
        MIMEImageFormat imageFormat = new MIMEImageFormat("image/png");
        RenderRequest renderRequest =
                new RenderRequest(imageFormat, Layer.TRAVELTIME, Style.COLOR30, true, false);
        // TODO why can't the renderer be static?
        return server.renderer.getResponse(tileRequest, surfA, null, renderRequest);
    }
View Full Code Here

    @GET @Produces("image/*")
    public Response tileGet() throws Exception {
      if (format.equals("jpg"))
        format = "jpeg";
        MIMEImageFormat mimeFormat = new MIMEImageFormat("image/" + format);
        Style style = styles.get(0);
        BufferedImage image = Tile.getLegend(style, width, height);
        return Renderer.generateStreamingImageResponse(image, mimeFormat);
    }
View Full Code Here

TOP

Related Classes of org.opentripplanner.api.parameter.MIMEImageFormat

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.