|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bbn.openmap.omGraphics.geom.BasicGeometry
com.bbn.openmap.omGraphics.OMGraphicAdapter
com.bbn.openmap.omGraphics.OMWarpingImage
public class OMWarpingImage
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();
}
| 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 |
| 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.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.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 |
|---|
protected ImageWarp warp
protected OMRaster raster
protected Projection lastProjection
| Constructor Detail |
|---|
public OMWarpingImage(java.lang.String imagePath)
throws java.net.MalformedURLException,
java.lang.InterruptedException
imagePath -
java.net.MalformedURLException
java.lang.InterruptedException
public OMWarpingImage(java.lang.String imagePath,
GeoCoordTransformation transform,
DataBounds imageBounds)
throws java.net.MalformedURLException,
java.lang.InterruptedException
imagePath - transform - the transform describing the image's projection.imageBounds - the bounds of the image, in its coordinate system.
java.net.MalformedURLException
java.lang.InterruptedException
public OMWarpingImage(java.lang.String imagePath,
GeoCoordTransformation transform,
WorldFile worldfile)
throws java.net.MalformedURLException,
java.lang.InterruptedException
imagePath - transform - transform the transform describing the image's
projection.worldfile - The WorldFile describing the image's location.
java.net.MalformedURLException
java.lang.InterruptedExceptionpublic OMWarpingImage(java.awt.image.BufferedImage bi)
bi -
public OMWarpingImage(java.awt.image.BufferedImage bi,
GeoCoordTransformation transform,
DataBounds imageBounds)
bi - a BufferedImagetransform - the transform describing the image's projection.imageBounds - the bounds of the image, in its coordinate system.
public OMWarpingImage(java.awt.image.BufferedImage bi,
GeoCoordTransformation transform,
WorldFile worldfile)
bi - BufferedImagetransform - transform the transform describing the image's
projection.worldfile - The WorldFile describing the image's location.
public OMWarpingImage(int[] pix,
int width,
int height)
pix - int[] ARGB pixel array for imagewidth - pixel width of imageheight - pixel height of image
public OMWarpingImage(int[] pix,
int width,
int height,
GeoCoordTransformation transform,
DataBounds imageBounds)
pix - int[] ARGB pixel array for imagewidth - pixel width of imageheight - pixel height of imagetransform - the transform describing the image's projection.imageBounds - the bounds of the image, in its coordinate system.
public OMWarpingImage(int[] pix,
int width,
int height,
GeoCoordTransformation transform,
WorldFile worldfile)
pix - int[] ARGB pixel array for imagewidth - pixel width of imageheight - pixel height of imagetransform - transform the transform describing the image's
projection.worldfile - The WorldFile describing the image's location.
public OMWarpingImage(OMScalingRaster omsr,
GeoCoordTransformation transform)
omsr - OMScalingRastertransform - a GeoCoordTransform if the OMScalingRaster image isn't a
WGS84 image.| Method Detail |
|---|
public void setWarp(java.lang.String imagePath,
GeoCoordTransformation transform,
DataBounds imageBounds)
throws java.net.MalformedURLException,
java.lang.InterruptedException
imagePath - transform - imageBounds -
java.net.MalformedURLException
java.lang.InterruptedException
public void setWarp(java.lang.String imagePath,
GeoCoordTransformation transform,
WorldFile worldfile)
throws java.net.MalformedURLException,
java.lang.InterruptedException
java.net.MalformedURLException
java.lang.InterruptedException
public void setWarp(int[] pix,
int width,
int height,
GeoCoordTransformation transform,
DataBounds imageBounds)
pix - int[] ARGB pixel array for imagewidth - pixel width of imageheight - pixel height of imagetransform - imageBounds -
public void setWarp(int[] pix,
int width,
int height,
GeoCoordTransformation transform,
WorldFile worldfile)
pix - int[] ARGB pixel array for imagewidth - pixel width of imageheight - pixel height of imagetransform - worldfile - describes projection of image
public void setWarp(java.awt.image.BufferedImage bi,
GeoCoordTransformation transform,
DataBounds imageBounds)
public void setWarp(java.awt.image.BufferedImage bi,
GeoCoordTransformation transform,
WorldFile worldfile)
public void setWarp(ImageWarp wrp)
public ImageWarp getWarp()
public boolean generate(Projection proj)
OMGraphicAdapterrender()! 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.
generate in interface OMGeometrygenerate in class OMGraphicAdapterproj - Projection
OMGraphicAdapter.regenerate(com.bbn.openmap.proj.Projection)protected boolean updateImageForProjection(Projection proj)
proj - current projection.
public void render(java.awt.Graphics g)
OMGraphicAdapterpaint() 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.
render in interface OMGeometryrender in class OMGraphicAdapterg - Graphics2D context to render into.
public float distance(double x,
double y)
OMGraphicAdapterThis 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.
distance in interface OMGeometrydistance in class OMGraphicAdapterx - X coordinate of the point.y - Y coordinate of the point.
public float distanceToEdge(double x,
double y)
BasicGeometry
distanceToEdge in interface OMGeometrydistanceToEdge in class BasicGeometryx - X coordinate of the point.y - Y coordinate of the point.
public boolean contains(double x,
double y)
BasicGeometryThis 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.
contains in interface OMGeometrycontains in class BasicGeometryx - X pixel coordinate of the point.y - Y pixel coordinate of the point.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||