// ********************************************************************** // ********************************************************************** package com.obrctm.openmap.editor; import java.awt.*; import java.awt.image.*; import java.io.Serializable; import javax.swing.ImageIcon; import com.bbn.openmap.omGraphics.*; import com.bbn.openmap.util.Debug; import com.bbn.openmap.proj.Projection; import com.bbn.openmap.MoreMath; /** * The OMRasterName object lets you create */ public class OMNamedRaster extends OMRaster implements Serializable { /** */ protected String name = "NoName"; /** * Constuct a blank OMRasterName, to be filled in with setX calls. */ public OMNamedRaster() { super(); } /** * Creates an OMRasterName images, Lat/Lon placement with a direct * colormodel. * * @param lt latitude of the top of the image. * @param ln longitude of the left side of the image. * @param w width of the image, in pixels. * @param h height of the image, in pixels. * @param pix color values for the pixels. * @see #setPixel */ public OMNamedRaster(float lt, float ln, int w, int h, int[] pix) { super(lt, ln, w, h, pix); } /** * Create an OMRasterName image, XY placement with a direct colormodel. * * @param x1 window location of the left side of the image. * @param y1 window location of the top of the image. * @param w width of the image, in pixels. * @param h height of the image, in pixels. * @param pix color values for the pixels. * @see #setPixel */ public OMNamedRaster(int x1, int y1, int w, int h, int[] pix) { super(x1, y1, w, h, pix); } /** * Create an OMRasterName, Lat/lon placement with XY offset with a * direct colormodel. * * @param lt latitude of the top of the image, before the offset. * @param ln longitude of the left side of the image, before the offset. * @param offset_x1 number of pixels to move image to the right. * @param offset_y1 number of pixels to move image down. * @param w width of the image, in pixels. * @param h height of the image, in pixels. * @param pix color values for the pixels. * @see #setPixel */ public OMNamedRaster(float lt, float ln, int offset_x1, int offset_y1, int w, int h, int[] pix) { super(lt, ln, offset_x1, offset_y1, w, h, pix); } ////////////////////////////////////// IMAGEICON /** * Create an OMRasterName, Lat/Lon placement with an ImageIcon. * * @param lt latitude of the top of the image. * @param ln longitude of the left side of the image. * @param ii ImageIcon used for the image. */ public OMNamedRaster(float lt, float ln, ImageIcon ii) { this (lt, ln, ii.getImage()); } /** * Create an OMRasterName, Lat/Lon placement with an Image. * * @param lt latitude of the top of the image. * @param ln longitude of the left side of the image. * @param ii Image used for the image. */ public OMNamedRaster(float lt, float ln, Image ii) { super(lt, ln, ii); } /** * Create an OMRasterName image, X/Y placement with an ImageIcon. * * @param x1 window location of the left side of the image. * @param y1 window location of the top of the image. * @param ii ImageIcon used for the image. */ public OMNamedRaster(int x1, int y1, ImageIcon ii) { this(x1, y1, ii.getImage()); } /** * Create an OMRasterName image, X/Y placement with an Image. * * @param x1 window location of the left side of the image. * @param y1 window location of the top of the image. * @param ii Image used for the image. */ public OMNamedRaster(int x1, int y1, Image ii) { super(x1, y1, ii); } /** * Create an OMRasterName, Lat/Lon with X/Y placement with an ImageIcon. * * @param lt latitude of the top of the image, before the offset. * @param ln longitude of the left side of the image, before the offset. * @param offset_x1 number of pixels to move image to the right. * @param offset_y1 number of pixels to move image down. * @param ii ImageIcon used for the image. */ public OMNamedRaster(float lt, float ln, int offset_x1, int offset_y1, ImageIcon ii) { this(lt, ln, offset_x1, offset_y1, ii.getImage()); } /** * Create an OMRasterName, Lat/Lon with X/Y placement with an Image. * Make sure that the Image is complete( if being loaded over the * internet) and ready to be drawn. Otherwise, you have to figure * out when the Image is complete, so that you can get the layer * to paint it! Use the ImageIcon constructor if you don't mind * blocking to wait for the pixels to arrive. * * @param lt latitude of the top of the image, before the offset. * @param ln longitude of the left side of the image, before the offset. * @param offset_x1 number of pixels to move image to the right. * @param offset_y1 number of pixels to move image down. * @param ii Image used for the image. */ public OMNamedRaster(float lt, float ln, int offset_x1, int offset_y1, Image ii) { super(lt, ln, offset_x1, offset_y1, ii); } ////////////////////////////////////// BYTE PIXELS with COLORTABLE /** * Lat/Lon placement with a indexed colormodel, which is using a * colortable and a byte array to contruct the int[] pixels. * * @param lt latitude of the top of the image. * @param ln longitude of the left side of the image. * @param w width of the image, in pixels. * @param h height of the image, in pixels. * @param bytes colortable index values for the pixels. * @param colorTable color array corresponding to bytes * @param trans transparency of image. * @see #setPixel */ public OMNamedRaster(float lt, float ln, int w, int h, byte[] bytes, Color[] colorTable, int trans) { super(lt, ln, w, h, bytes, colorTable, trans); } /** * XY placement with a indexed colormodel, which is using a * colortable and a byte array to contruct the int[] pixels. * * @param x1 window location of the left side of the image. * @param y1 window location of the top of the image. * @param w width of the image, in pixels. * @param h height of the image, in pixels. * @param bytes colortable index values for the pixels. * @param colorTable color array corresponding to bytes * @param trans transparency of image. * @see #setPixel */ public OMNamedRaster(int x1, int y1, int w, int h, byte[] bytes, Color[] colorTable, int trans) { super(x1, y1, w, h, bytes, colorTable, trans); } /** * Lat/lon placement with XY offset with a indexed colormodel, * which is using a colortable and a byte array to construct the * int[] pixels. * * @param lt latitude of the top of the image, before the offset. * @param ln longitude of the left side of the image, before the offset. * @param offset_x1 number of pixels to move image to the right. * @param offset_y1 number of pixels to move image down. * @param w width of the image, in pixels. * @param h height of the image, in pixels. * @param bytes colortable index values for the pixels. * @param colorTable color array corresponding to bytes * @param trans transparency of image. * @see #setPixel */ public OMNamedRaster(float lt, float ln, int offset_x1, int offset_y1, int w, int h, byte[] bytes, Color[] colorTable, int trans) { super(lt, ln, offset_x1, offset_y1, w, h, bytes, colorTable, trans); } public String getName() { return name; } public void setName(String newName) { name = newName;; } }