OMWarpingImage (OpenMap API)
Date: 2016-12-09

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bbn.openmap.omGraphics
Class OMWarpingImage

    java.lang.Object
      com.bbn.openmap.omGraphics.geom.BasicGeometry
          com.bbn.openmap.omGraphics.OMGraphicAdapter
              com.bbn.openmap.omGraphics.OMWarpingImage

All Implemented Interfaces:
  OMGeometry, OMGraphic, OMGraphicConstants, java.io.Serializable, java.lang.Cloneable

    public class OMWarpingImage

extends OMGraphicAdapter
implements OMGraphic

An OMGraphic that wraps an ImageWarp object to display the resulting OMRaster, in any projection. For use as a background object, doesn't react to mouse events, distance queries, etc.

     try {
         String imageFile = "/data/geoimages/NBenguela.2004357.aqua.250m.jpg";
         WorldFile worldFile = WorldFile.get(PropUtils.getResourceOrFileOrURL(imageFile));
         OMWarpingImage omwi = new OMWarpingImage(imageFile, LatLonGCT.INSTANCE, worldFile);
         omList.add(omwi);
     } catch (MalformedURLException e) {
         e.printStackTrace();
     } catch (InterruptedException e) {
         e.printStackTrace();
     }

     try {
         String imageFile = "/data/images/earthmap4k.jpg";
         OMWarpingImage omwi = new OMWarpingImage(imageFile);
         omList.add(omwi);
     } catch (MalformedURLException e) {
         e.printStackTrace();
     } catch (InterruptedException e) {
         e.printStackTrace();
     }

Author:
  dietrick
See Also:
  Serialized Form

Field Summary
`protected Projection` | `lastProjection`
`protected OMRaster` | `raster`
`protected ImageWarp` | `warp`

Fields inherited from class com.bbn.openmap.omGraphics.OMGraphicAdapter
`declutterType, displayPaint, edgeMatchesFill, fillPaint, hasLabel, linePaint, matted, mattingPaint, renderType, selected, selectPaint, showEditablePalette, stroke, textureMask`

Fields inherited from class com.bbn.openmap.omGraphics.geom.BasicGeometry
`attributes, lineType, needToRegenerate, shape, visible`

Fields inherited from interface com.bbn.openmap.omGraphics.OMGraphicConstants
`ADD_GRAPHIC_MASK, APP_OBJECT, BASIC_STROKE, CHANGE_APPEARANCE, clear, DECIMAL_DEGREES, DECLUTTERTYPE_LINE, DECLUTTERTYPE_MOVE, DECLUTTERTYPE_NONE, DECLUTTERTYPE_SPACE, DEFAULT_ROTATIONANGLE, DELETE_GRAPHIC_MASK, DESELECT_GRAPHIC_MASK, DESELECTALL_GRAPHIC_MASK, GRAPHICTYPE_ARC, GRAPHICTYPE_BITMAP, GRAPHICTYPE_CIRCLE, GRAPHICTYPE_ELLIPSE, GRAPHICTYPE_GRAPHIC, GRAPHICTYPE_GRID, GRAPHICTYPE_LINE, GRAPHICTYPE_POINT, GRAPHICTYPE_POLY, GRAPHICTYPE_RASTER, GRAPHICTYPE_RECTANGLE, GRAPHICTYPE_TEXT, INDEX, INFOLINE, LABEL, LINETYPE_GREATCIRCLE, LINETYPE_RHUMB, LINETYPE_STRAIGHT, LINETYPE_UNKNOWN, LOWER_GRAPHIC_MASK, LOWER_TO_BOTTOM_GRAPHIC_MASK, NO_ROTATE, OMGRAPHIC_ELT, OMGRAPHIC_TYPE_ATTR, RADIANS, RAISE_GRAPHIC_MASK, RAISE_TO_TOP_GRAPHIC_MASK, REMOVABLE, RENDERTYPE_LATLON, RENDERTYPE_OFFSET, RENDERTYPE_UNKNOWN, RENDERTYPE_XY, SELECT_GRAPHIC_MASK, SORT_GRAPHICS_MASK, TOOLTIP, UPDATE_GRAPHIC_MASK, UPDATED`

Constructor Summary
`OMWarpingImage(java.awt.image.BufferedImage bi)` Takes an image, assumed to be a world image in the LLXY projection (equal arc) covering -180, 180 longitude to -90, 90 latitude.
`OMWarpingImage(java.awt.image.BufferedImage bi, GeoCoordTransformation transform, DataBounds imageBounds)` Create an OMWarpingImage from a BufferedImage.
`OMWarpingImage(java.awt.image.BufferedImage bi, GeoCoordTransformation transform, WorldFile worldfile)` Create an OMWarpingImage from a BufferedImage.
`OMWarpingImage(int[] pix, int width, int height)` Takes an array of ARGB integer values representing an image, assumed to be a world image in the LLXY projection (equal arc) covering -180, 180 longitude to -90, 90 latitude.
`OMWarpingImage(int[] pix, int width, int height, GeoCoordTransformation transform, DataBounds imageBounds)` Create an OMWarpingImage from a BufferedImage.
`OMWarpingImage(int[] pix, int width, int height, GeoCoordTransformation transform, WorldFile worldfile)` Create an OMWarpingImage from a BufferedImage.
`OMWarpingImage(OMScalingRaster omsr, GeoCoordTransformation transform)` Create an OMWarpingImage from an OMScalingRaster - useful for when the projection being used on the map doesn't match the projection of the raster, and it needs to be transformed.
`OMWarpingImage(java.lang.String imagePath)` Create an OMWarpingImage from path to image (resource, file or URL).
`OMWarpingImage(java.lang.String imagePath, GeoCoordTransformation transform, DataBounds imageBounds)` Create an OMWarpingImage from path to image (resource, file or URL).
`OMWarpingImage(java.lang.String imagePath, GeoCoordTransformation transform, WorldFile worldfile)` Create an OMWarpingImage from path to image (resource, file or URL).

Method Summary
`boolean` | `contains(double x, double y)` Answers the question whether or not the OMGeometry contains the given pixel point.
`float` | `distance(double x, double y)` Return the shortest distance from the graphic to an XY-point.
`float` | `distanceToEdge(double x, double y)` Return the shortest distance from the edge of a graphic to an XY-point.
`boolean` | `generate(Projection proj)` Prepare the graphic for rendering.
`ImageWarp` | `getWarp()`
`void` | `render(java.awt.Graphics g)` Paint the graphic.
`void` | `setWarp(java.awt.image.BufferedImage bi, GeoCoordTransformation transform, DataBounds imageBounds)`
`void` | `setWarp(java.awt.image.BufferedImage bi, GeoCoordTransformation transform, WorldFile worldfile)`
`void` | `setWarp(ImageWarp wrp)`
`void` | `setWarp(int[] pix, int width, int height, GeoCoordTransformation transform, DataBounds imageBounds)` Set all the information needed.
`void` | `setWarp(int[] pix, int width, int height, GeoCoordTransformation transform, WorldFile worldfile)` Set all the information needed.
`void` | `setWarp(java.lang.String imagePath, GeoCoordTransformation transform, DataBounds imageBounds)` Set all the information needed.
`void` | `setWarp(java.lang.String imagePath, GeoCoordTransformation transform, WorldFile worldfile)`
`protected boolean` | `updateImageForProjection(Projection proj)` Called from within generate.

Methods inherited from class com.bbn.openmap.omGraphics.OMGraphicAdapter
`clone, deselect, getDeclutterType, getDisplayColor, getDisplayPaint, getEdgeMatchesFill, getFillColor, getFillPaint, getHasLabel, getLineColor, getLinePaint, getMattingPaint, getRenderType, getSelectColor, getSelectPaint, getShowEditablePalette, getStroke, getTextureMask, hasLineTypeChoice, initLabelingDuringGenerate, isClear, isMatted, isSelected, normalizeDistanceForLineWidth, readStroke, readTextureMask, regenerate, renderLabel, renderShape, restore, select, setDeclutterType, setEdgeMatchesFill, setFillColor, setFillPaint, setGraphicsColor, setGraphicsForEdge, setGraphicsForFill, setHasLabel, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLineColor, setLinePaint, setMatted, setMattingPaint, setRenderType, setSelectColor, setSelected, setSelectPaint, setShowEditablePalette, setStroke, setTextureMask, shouldRenderEdge, shouldRenderFill, writeStroke, writeTextureMask`

Methods inherited from class com.bbn.openmap.omGraphics.geom.BasicGeometry
`_distance, appendShapeEdge, appendShapeEdge, appendShapeEdge, appendShapeEdge, clearAttributes, createAttributeMap, createBoxShape, createShape, createShape, describeShapeDetail, describeShapeDetail, distanceToEdge, draw, draw, fill, fill, getAppObject, getAttribute, getAttributes, getDescription, getLineType, getNeedToRegenerate, getShape, isRenderable, isRenderable, isVisible, putAttribute, removeAttribute, setAppObject, setAttributes, setLineType, setNeedToRegenerate, setShape, setVisible`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface com.bbn.openmap.omGraphics.OMGraphic
`clone, deselect, getDeclutterType, getDisplayColor, getDisplayPaint, getFillColor, getFillPaint, getLineColor, getLinePaint, getMattingPaint, getRenderType, getSelectColor, getSelectPaint, getShowEditablePalette, getStroke, getTextureMask, hasLineTypeChoice, isMatted, isSelected, normalizeDistanceForLineWidth, regenerate, renderLabel, select, setDeclutterType, setFillPaint, setGraphicsColor, setGraphicsForEdge, setGraphicsForFill, setLabelLocation, setLabelLocation, setLabelLocation, setLinePaint, setMatted, setMattingPaint, setRenderType, setSelected, setSelectPaint, setShowEditablePalette, setStroke, setTextureMask, shouldRenderEdge, shouldRenderFill`

Methods inherited from interface com.bbn.openmap.omGraphics.OMGeometry
`clearAttributes, draw, draw, fill, fill, getAppObject, getAttribute, getAttributes, getDescription, getLineType, getNeedToRegenerate, getShape, isRenderable, isRenderable, isVisible, putAttribute, removeAttribute, restore, setAppObject, setAttributes, setLineType, setNeedToRegenerate, setShape, setVisible`

Field Detail

### warp

    protected ImageWarp warp

### raster

    protected OMRaster raster

### lastProjection

    protected Projection lastProjection

Constructor Detail

### OMWarpingImage

    public OMWarpingImage(java.lang.String imagePath)
                   throws java.net.MalformedURLException,
                          java.lang.InterruptedException

  Create an OMWarpingImage from path to image (resource, file or URL).

  Parameters:
    `imagePath` -
  Throws:
    `java.net.MalformedURLException`
    `java.lang.InterruptedException`

### OMWarpingImage

    public OMWarpingImage(java.lang.String imagePath,
                          GeoCoordTransformation transform,
                          DataBounds imageBounds)
                   throws java.net.MalformedURLException,
                          java.lang.InterruptedException

  Create an OMWarpingImage from path to image (resource, file or URL).

  Parameters:
    `imagePath` -
    `transform` - the transform describing the image's projection.
    `imageBounds` - the bounds of the image, in its coordinate system.
  Throws:
    `java.net.MalformedURLException`
    `java.lang.InterruptedException`

### OMWarpingImage

    public OMWarpingImage(java.lang.String imagePath,
                          GeoCoordTransformation transform,
                          WorldFile worldfile)
                   throws java.net.MalformedURLException,
                          java.lang.InterruptedException

  Create an OMWarpingImage from path to image (resource, file or URL).

  Parameters:
    `imagePath` -
    `transform` - transform the transform describing the image's projection.
    `worldfile` - The WorldFile describing the image's location.
  Throws:
    `java.net.MalformedURLException`
    `java.lang.InterruptedException`

### OMWarpingImage

    public OMWarpingImage(java.awt.image.BufferedImage bi)

  Takes an image, assumed to be a world image in the LLXY projection (equal arc) covering -180, 180 longitude to -90, 90 latitude.

  Parameters:
    `bi` -

### OMWarpingImage

    public OMWarpingImage(java.awt.image.BufferedImage bi,
                          GeoCoordTransformation transform,
                          DataBounds imageBounds)

  Create an OMWarpingImage from a BufferedImage.

  Parameters:
    `bi` - a BufferedImage
    `transform` - the transform describing the image's projection.
    `imageBounds` - the bounds of the image, in its coordinate system.

### OMWarpingImage

    public OMWarpingImage(java.awt.image.BufferedImage bi,
                          GeoCoordTransformation transform,
                          WorldFile worldfile)

  Create an OMWarpingImage from a BufferedImage.

  Parameters:
    `bi` - BufferedImage
    `transform` - transform the transform describing the image's projection.
    `worldfile` - The WorldFile describing the image's location.

### OMWarpingImage

    public OMWarpingImage(int[] pix,
                          int width,
                          int height)

  Takes an array of ARGB integer values representing an image, assumed to be a world image in the LLXY projection (equal arc) covering -180, 180 longitude to -90, 90 latitude.

  Parameters:
    `pix` - int[] ARGB pixel array for image
    `width` - pixel width of image
    `height` - pixel height of image

### OMWarpingImage

    public OMWarpingImage(int[] pix,
                          int width,
                          int height,
                          GeoCoordTransformation transform,
                          DataBounds imageBounds)

  Create an OMWarpingImage from a BufferedImage.

  Parameters:
    `pix` - int[] ARGB pixel array for image
    `width` - pixel width of image
    `height` - pixel height of image
    `transform` - the transform describing the image's projection.
    `imageBounds` - the bounds of the image, in its coordinate system.

### OMWarpingImage

    public OMWarpingImage(int[] pix,
                          int width,
                          int height,
                          GeoCoordTransformation transform,
                          WorldFile worldfile)

  Create an OMWarpingImage from a BufferedImage.

  Parameters:
    `pix` - int[] ARGB pixel array for image
    `width` - pixel width of image
    `height` - pixel height of image
    `transform` - transform the transform describing the image's projection.
    `worldfile` - The WorldFile describing the image's location.

### OMWarpingImage

    public OMWarpingImage(OMScalingRaster omsr,
                          GeoCoordTransformation transform)

  Create an OMWarpingImage from an OMScalingRaster - useful for when the projection being used on the map doesn't match the projection of the raster, and it needs to be transformed.

  Parameters:
    `omsr` - OMScalingRaster
    `transform` - a GeoCoordTransform if the OMScalingRaster image isn't a WGS84 image.

Method Detail

### setWarp

    public void setWarp(java.lang.String imagePath,
                        GeoCoordTransformation transform,
                        DataBounds imageBounds)
                 throws java.net.MalformedURLException,
                        java.lang.InterruptedException

  Set all the information needed.

  Parameters:
    `imagePath` -
    `transform` -
    `imageBounds` -
  Throws:
    `java.net.MalformedURLException`
    `java.lang.InterruptedException`

### setWarp

    public void setWarp(java.lang.String imagePath,
                        GeoCoordTransformation transform,
                        WorldFile worldfile)
                 throws java.net.MalformedURLException,
                        java.lang.InterruptedException

  Throws:
    `java.net.MalformedURLException`
    `java.lang.InterruptedException`

### setWarp

    public void setWarp(int[] pix,
                        int width,
                        int height,
                        GeoCoordTransformation transform,
                        DataBounds imageBounds)

  Set all the information needed.

  Parameters:
    `pix` - int[] ARGB pixel array for image
    `width` - pixel width of image
    `height` - pixel height of image
    `transform` -
    `imageBounds` -

### setWarp

    public void setWarp(int[] pix,
                        int width,
                        int height,
                        GeoCoordTransformation transform,
                        WorldFile worldfile)

  Set all the information needed.

  Parameters:
    `pix` - int[] ARGB pixel array for image
    `width` - pixel width of image
    `height` - pixel height of image
    `transform` -
    `worldfile` - describes projection of image

### setWarp

    public void setWarp(java.awt.image.BufferedImage bi,
                        GeoCoordTransformation transform,
                        DataBounds imageBounds)

### setWarp

    public void setWarp(java.awt.image.BufferedImage bi,
                        GeoCoordTransformation transform,
                        WorldFile worldfile)

### setWarp

    public void setWarp(ImageWarp wrp)

### getWarp

    public ImageWarp getWarp()

### generate

    public boolean generate(Projection proj)

  Description copied from class: `OMGraphicAdapter`
  Prepare the graphic for rendering. This must be done before calling `render()`! If a vector graphic has lat-lon components, then we project these vertices into x-y space. For raster graphics we prepare in a different fashion.

  If the generate is unsuccessful, it's usually because of some oversight, (for instance if `proj` is null), and if debugging is enabled, a message may be output to the controlling terminal.

  Specified by:
    `generate` in interface `OMGeometry`
  Specified by:
    `generate` in class `OMGraphicAdapter`
  Parameters:
    `proj` - Projection
  Returns:
    boolean true if successful, false if not.
  See Also:
    `OMGraphicAdapter.regenerate(com.bbn.openmap.proj.Projection)`

### updateImageForProjection

    protected boolean updateImageForProjection(Projection proj)

  Called from within generate. Some render buffering calls generate to make sure the latest projection is called on an OMGraphic before it's put into a buffer. We're keeping track of the last projection used to generate the warped image, and if it's the same, don't bother regenerating, use the raster we have.

  Parameters:
    `proj` - current projection.
  Returns:
    false if the rest of generate() should be skipped.

### render

    public void render(java.awt.Graphics g)

  Description copied from class: `OMGraphicAdapter`
  Paint the graphic. This paints the graphic into the Graphics context. This is similar to `paint()` function of java.awt.Components. Note that if the graphic has not been generated, it will not be rendered.

  This method used to be abstract, but with the conversion of OMGraphics to internally represent themselves as java.awt.Shape objects, it's a more generic method. If the OMGraphic hasn't been updated to use Shape objects, it should have its own render method.

  Specified by:
    `render` in interface `OMGeometry`
  Overrides:
    `render` in class `OMGraphicAdapter`
  Parameters:
    `g` - Graphics2D context to render into.

### distance

    public float distance(double x,
                          double y)

  Description copied from class: `OMGraphicAdapter`
  Return the shortest distance from the graphic to an XY-point.

  This method used to be abstract, but with the conversion of OMGraphics to internally represent themselves as java.awt.Shape objects, it's a more generic method. If the OMGraphic hasn't been updated to use Shape objects, it should have its own distance method.

  Specified by:
    `distance` in interface `OMGeometry`
  Overrides:
    `distance` in class `OMGraphicAdapter`
  Parameters:
    `x` - X coordinate of the point.
    `y` - Y coordinate of the point.
  Returns:
    float distance, in pixels, from graphic to the point. Returns Float.POSITIVE_INFINITY if the graphic isn't ready (ungenerated).

### distanceToEdge

    public float distanceToEdge(double x,
                                double y)

  Description copied from class: `BasicGeometry`
  Return the shortest distance from the edge of a graphic to an XY-point.

  Specified by:
    `distanceToEdge` in interface `OMGeometry`
  Overrides:
    `distanceToEdge` in class `BasicGeometry`
  Parameters:
    `x` - X coordinate of the point.
    `y` - Y coordinate of the point.
  Returns:
    float distance, in pixels, from graphic to the point. Returns Float.POSITIVE_INFINITY if the graphic isn't ready (ungenerated).

### contains

    public boolean contains(double x,
                            double y)

  Description copied from class: `BasicGeometry`
  Answers the question whether or not the OMGeometry contains the given pixel point.

  This method used to be abstract, but with the conversion of OMGeometrys to internally represent themselves as java.awt.Shape objects, it's a more generic method. If the OMGeometry hasn't been updated to use Shape objects, it should have its own contains method.

  This method duplicates a java.awt.Shape method, with some protection wrapped around it. If you have other queries for the internal Shape object, just ask for it and then ask it directly. This method is provided because it is the most useful, used when determining if a mouse event is occurring over an object on the map.

  Specified by:
    `contains` in interface `OMGeometry`
  Overrides:
    `contains` in class `BasicGeometry`
  Parameters:
    `x` - X pixel coordinate of the point.
    `y` - Y pixel coordinate of the point.
  Returns:
    getShape().contains(x, y), false if the OMGraphic hasn't been generated yet.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details