Package com.bbn.openmap.image

Examples of com.bbn.openmap.image.AcmeGifFormatter


    protected ImageFormatter formatter;

    protected Dimension imageDimension;

    public SVG2GIF() {
        formatter = new AcmeGifFormatter();
    }
View Full Code Here


* A JMenuItem that uses the MapHandler to find the MapBean and save
* an image of it in the GIF format.
*/
public class SaveAsGifMenuItem extends SaveAsImageMenuItem {
    public SaveAsGifMenuItem() {
        super("GIF", new AcmeGifFormatter());
    }
View Full Code Here

        int box_height = max + (box_height_buffer * 2);
        int box_width = distance;
        int gif_height = box_height + (gif_height_buffer * 2);
        int gif_width = box_width + (gif_width_buffer * 2) + text_width;

        AcmeGifFormatter formatter = new AcmeGifFormatter();
        java.awt.Graphics graphics = formatter.getGraphics(gif_width,
                gif_height);

//        Color gray10 = new Color(25, 25, 25);
        Color gray50 = new Color(128, 128, 128);
//        Color gray75 = new Color(191, 191, 191);
        Color gray90 = new Color(230, 230, 230);

        Debug.message("terrain",
                "ProfileGenerator gif creation: drawing boundaries");
        /* Fill in the generic colors */
        graphics.setColor(gray90);
        graphics.fillRect(0, 0, gif_width, gif_height);

        graphics.setColor(gray50);
        graphics.fillRect(gif_width_buffer,
                gif_height_buffer,
                box_width,
                box_height);

        Debug.message("terrain", "ProfileGenerator gif creation: drawing edges");
        // outside edge
        graphics.setColor(Color.black);
        graphics.drawRect(0, 0, gif_width - 1, gif_height - 1);
        // inside edge
        graphics.drawRect(gif_width_buffer,
                gif_height_buffer,
                box_width,
                box_height);

        graphics.setColor(Color.yellow);
        // 0 height line
        graphics.drawLine(gif_width_buffer + 1,
                gif_height_buffer + box_height - box_height_buffer,
                gif_width_buffer + box_width - 1,
                gif_height_buffer + box_height - box_height_buffer);

        // These are the horizontal reference lines in the image.
        graphics.setColor(Color.black);
        FontMetrics f = graphics.getFontMetrics();

        Debug.message("terrain",
                "ProfileGenerator gif creation: drawing level lines");
        for (int i = 1; i < 9; i++) {

            graphics.drawLine(gif_width_buffer, gif_height_buffer + box_height
                    - box_height_buffer - (max * i / 8), gif_width_buffer
                    + box_width + 5, gif_height_buffer + box_height
                    - box_height_buffer - (max * i / 8));

            int meters = max * i / 8;
            int feet = (int) (meters * 3.2);
            String lineLabel = meters + "m / " + feet + "ft";
//            byte[] lineLabelBytes = lineLabel.getBytes();

            graphics.drawString(lineLabel,
                    gif_width_buffer + box_width + 10,
                    gif_height_buffer + box_height - box_height_buffer
                            - (max * i / 8) + (f.getAscent() / 2));
        }

//        int last_x = gif_width_buffer + 1;
//        int last_height = gif_height_buffer + box_height - box_height_buffer
//                - post_height[0];

        int total_distance = 0;
        Debug.message("terrain",
                "ProfileGenerator gif creation: drawing profile");

        graphics.setColor(Color.red);
        for (int i = 1; i < post_height.length; i++) {
            graphics.drawLine(gif_width_buffer + total_distance,
                    gif_height_buffer + box_height - box_height_buffer
                            - post_height[i - 1],
                    gif_width_buffer + post_dist[i] + total_distance,
                    gif_height_buffer + box_height - box_height_buffer
                            - post_height[i]);

            total_distance += post_dist[i];
        }

        javax.swing.ImageIcon ii = new javax.swing.ImageIcon(formatter.getBufferedImage());
        javax.swing.JFrame jf = com.bbn.openmap.util.PaletteHelper.getPaletteWindow(new javax.swing.JLabel(ii),
                "Path Profile",
                (ComponentListener) null);

        jf.setVisible(true);
View Full Code Here

                        0,
                        0,
                        (int) d.getWidth(),
                        (int) d.getHeight(),
                        BufferedImage.TYPE_INT_ARGB);
                ImageFormatter formatter = new AcmeGifFormatter();
                byte[] imageBytes = formatter.formatImage(bi);
                String newFileName = FileUtils.getFilePathToSaveFromUser("Create File To Save");
                if (newFileName != null) {
                    FileOutputStream fos = new FileOutputStream(newFileName);
                    fos.write(imageBytes);
                    fos.flush();
View Full Code Here

        }

        int pwidth = 512;
        int pheight = 512;

        AcmeGifFormatter formatter = new AcmeGifFormatter();
        Graphics graphics = formatter.getGraphics(pwidth, pheight);

        Paint background;
        if (map == null) {
            background = MapBean.DEFAULT_BACKGROUND_COLOR;
        } else {
            background = map.getBckgrnd();
        }
        proj.drawBackground((Graphics2D) graphics, background);

        layerHandler = (LayerHandler) mapHandler.get("com.bbn.openmap.LayerHandler");
        if (layerHandler != null) {
            Debug.message("3d",
                    "LayerMapContent: putting layer graphics on the map.");
            Layer[] layers = layerHandler.getLayers();
            int size = layers.length;

            for (int i = size - 1; i >= 0; i--) {
                Layer layer = layers[i];

                if (layer.isVisible() && !(layer instanceof OM3DGraphicHandler)) {

                    layer.renderDataForProjection(proj, graphics);
                }
            }
        }

        BufferedImage bimage = formatter.getBufferedImage();

        // Now we have our textured image.

        QuadArray plane = new QuadArray(4, GeometryArray.COORDINATES
                | GeometryArray.TEXTURE_COORDINATE_2);
View Full Code Here

TOP

Related Classes of com.bbn.openmap.image.AcmeGifFormatter

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.