|
|||||||||||
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.OMGraphic
com.bbn.openmap.layer.location.Location
A Location is a place. It can be thought of as a lat/lon place, with or without an pixel offset, or a place on the screen. A location is basically thought of as having a name, which get represented as a label, and some graphical represenation. It is abstract because it doesn't really know what kind of markers or labels are being used or how they are being positioned around the particular point. Therefore, it should be extended, and the setGraphicLocations methods implemented to position the marker and text as desired.
Field Summary | |
protected boolean |
allowDecluttering
Set whether you want this location label decluttered. |
protected int |
currentFontDescent
|
static int |
DECLUTTER_ANYWHERE
|
static int |
DECLUTTER_LOCALLY
|
protected int |
declutterLimit
The pixel limit where the delcutter matrix won't draw the name, if it can't put the name at least this close to the original place. |
static int |
DEFAULT_SPACING
the default distance away a label should be placed from a location marker. |
protected java.lang.String |
details
The URL to display when the object is gestured upon. |
LocationHandler |
handler
The LocationHandler that is handling the location. |
protected int |
horizontalLabelBuffer
The horizontal pixel distance you want to place the text away from the actual location - to put space between the graphic. |
protected OMText |
label
The Label of the object. |
float |
lat
The main latitude of object, in decimal degrees, for RENDERTYPE_LATLON and RENDERTYPE_OFFSET locations. |
protected OMGraphic |
location
The simple location marker of the object. |
float |
lon
The main longitude of object, in decimal degrees, for RENDERTYPE_LATLON and RENDERTYPE_OFFSET locations. |
java.lang.String |
name
The name of the location. |
int |
origXLabelOffset
The original offset/x location, kept for resetting the placement of the label after decluttering and/or location placement. |
int |
origYLabelOffset
The original offset/y location, kept for resetting the placement of the label after decluttering and/or location placement. |
protected boolean |
showLocation
The flag for displaying the location marker. |
protected boolean |
showName
The flag for displaying the name label. |
int |
x
The x object location, in pixels, for RENDERTYPE_XY locations. |
int |
xOffset
The x pixel offset from the longitude, for RENDERTYPE_OFFSET locations. |
int |
y
The y object location, in pixels, for RENDERTYPE_XY locations. |
int |
yOffset
The y pixel offset from the latitude, for RENDERTYPE_OFFSET locations. |
Fields inherited from class com.bbn.openmap.omGraphics.OMGraphic |
declutterType, displayPaint, edgeMatchesFill, fillPaint, hasLabel, linePaint, matted, mattingPaint, renderType, selected, selectPaint, showEditablePalette, stroke, textureMask |
Fields inherited from class com.bbn.openmap.omGraphics.geom.BasicGeometry |
APP_OBJECT_KEY, appObject, ATT_MAP_KEY, lineType, needToRegenerate, shape, visible |
Constructor Summary | |
Location()
A plain contructor if you are planning on setting everything yourself. |
|
Location(float latitude,
float longitude,
int xOffset,
int yOffset,
java.lang.String name,
OMGraphic locationMarker)
Create a location at a pixel offset from a latitude/longitude. |
|
Location(float latitude,
float longitude,
java.lang.String name,
OMGraphic locationMarker)
Create a location at a latitude/longitude. |
|
Location(int x,
int y,
java.lang.String name,
OMGraphic locationMarker)
Create a location at a map location. |
Method Summary | |
static float |
convertCoordinateString(java.lang.String coord)
A simple conversion method for the common String represention of decimal degree coordinates, which is a letter denoting the globle hemisphere (N or S for latitudes, W or E for longitudes, and then a number string. |
protected void |
declutterLabel(DeclutterMatrix declutter,
Projection proj)
Given the label is this location has a height and width, find a clean place on the map for it. |
float |
distance(int x,
int y)
Return the shortest distance from the graphic to an XY-point. |
boolean |
generate(Projection proj)
Prepare the graphic for rendering. |
boolean |
generate(Projection proj,
DeclutterMatrix declutterMatrix)
Generate the location, and use the declutter matrix to place the label is a spot so that it doesn't interset with other labels. |
int |
getDeclutterLimit()
Get the declutter pixel distance limit. |
java.lang.String |
getDetails()
Get the details for the location. |
int |
getHorizontalLabelBuffer()
Get the pixel distance that the label will be moved to the right, to clear space for the graphic marking the location. |
OMText |
getLabel()
Get the label for the location. |
LocationHandler |
getLocationHandler()
Get the location handler for the location. |
OMGraphic |
getLocationMarker()
Get the location marker for this location. |
java.lang.String |
getName()
Get the name of the location. |
boolean |
isAllowDecluttering()
Get the decluttering allowance setting for this label. |
boolean |
isShowLocation()
See of the location is displaying it's location. |
boolean |
isShowName()
See if the location is displaying it's label. |
static void |
main(java.lang.String[] args)
We're using the main function for Location to test the convertCoordinateString function. |
void |
render(java.awt.Graphics g)
Paint the graphic and the name of the location. |
void |
renderLocation(java.awt.Graphics g)
Paint the graphic location graphic only. |
void |
renderName(java.awt.Graphics g)
Paint the graphic label (name) only. |
void |
setAllowDecluttering(boolean allow)
Set whether you want to allow the label for this location to be decluttered. |
void |
setDeclutterLimit(int value)
Set the pixel distance that us used by the declutter matrix in trying to find a place for the label. |
void |
setDetails(java.lang.String det)
Set the details for the location. |
abstract void |
setGraphicLocations(float latitude,
float longitude)
|
abstract void |
setGraphicLocations(float latitude,
float longitude,
int offsetX,
int offsetY)
|
abstract void |
setGraphicLocations(int x,
int y)
|
void |
setHorizontalLabelBuffer(int buffer)
Set the pixel distance that the label will be moved to the right, to clear space for the graphic marking the location. |
void |
setLabel(OMText lable)
Set the label for the location. |
void |
setLocation(float latitude,
float longitude)
Set the placement of the location. |
void |
setLocation(float latitude,
float longitude,
int xOffset,
int yOffset)
Set the placement of the location. |
void |
setLocation(int x,
int y)
Set the placement of the location. |
void |
setLocation(int x,
int y,
Projection proj)
Convenience method that lets you provide a screen x, y and a projection to the location, and let the location hash out how to place itself based on it's rendertype. |
void |
setLocationHandler(LocationHandler lh)
Set the location handler for the location. |
void |
setLocationMarker(OMGraphic graphic)
Set the graphic for the location. |
void |
setLocationPaint(java.awt.Paint locationPaint)
Set the edge java.awt.Paint for the marker graphic. |
void |
setName(java.lang.String name)
Set the name of this location. |
void |
setShowLocation(boolean showLocations)
Set whether this location should be shown on an individual basis. |
void |
setShowName(boolean showNames)
Set the location to display it's label. |
protected boolean |
shouldRenderLocation()
Convenience method to see if handler/global settings dictate that the location icon should be rendered. |
protected boolean |
shouldRenderName()
Convenience method to see if handler/global settings dictate that the location label should be rendered. |
void |
showDetails(Layer layer)
Fire a browser to display the location details. |
Methods inherited from class com.bbn.openmap.omGraphics.geom.BasicGeometry |
_distance, appendShapeEdge, appendShapeEdge, appendShapeEdge, appendShapeEdge, checkAttributeMap, checkAttributeMap, clearAttributes, contains, createAttributeMap, createBoxShape, createShape, createShape, describeShapeDetail, describeShapeDetail, distanceToEdge, draw, fill, getAppObject, getAppObject, getAttribute, getAttributeMap, getAttributes, getLineType, getNeedToRegenerate, getShape, isRenderable, isVisible, putAttribute, removeAttribute, replaceAppObjectWithAttributeMap, setAppObject, setAppObject, setAttributes, setLineType, setNeedToRegenerate, 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, contains, draw, fill, getAppObject, getAttribute, getAttributes, getLineType, getNeedToRegenerate, getShape, isRenderable, isVisible, putAttribute, removeAttribute, setAppObject, setAttributes, setLineType, setNeedToRegenerate, setVisible |
Field Detail |
public float lat
public float lon
public int xOffset
public int yOffset
public int x
public int y
public java.lang.String name
public LocationHandler handler
public static final int DECLUTTER_LOCALLY
public static final int DECLUTTER_ANYWHERE
protected OMText label
protected OMGraphic location
protected java.lang.String details
protected boolean showLocation
protected boolean showName
public int origYLabelOffset
public int origXLabelOffset
public static final int DEFAULT_SPACING
protected int declutterLimit
protected boolean allowDecluttering
protected int horizontalLabelBuffer
protected int currentFontDescent
Constructor Detail |
public Location()
public Location(float latitude, float longitude, java.lang.String name, OMGraphic locationMarker)
latitude
- the latitude, in decimal degrees, of the
location.longitude
- the longitude, in decimal degrees, of the
location.name
- the name of the location, also used in the label.locationMarker
- the OMGraphic to use for the location
mark.public Location(int x, int y, java.lang.String name, OMGraphic locationMarker)
x
- the pixel location of the object from the let of the
map.y
- the pixel location of the object from the top of the
mapname
- the name of the location, also used in the label.locationMarker
- the OMGraphic to use for the location
mark.public Location(float latitude, float longitude, int xOffset, int yOffset, java.lang.String name, OMGraphic locationMarker)
latitude
- the latitude, in decimal degrees, of the
location.longitude
- the longitude, in decimal degrees, of the
location.xOffset
- the pixel location of the object from the
longitude.yOffset
- the pixel location of the object from the
latitude.name
- the name of the location, also used in the label.locationMarker
- the OMGraphic to use for the location
mark.Method Detail |
public void setLocation(float latitude, float longitude)
public void setLocation(int x, int y)
public void setLocation(float latitude, float longitude, int xOffset, int yOffset)
public void setLocation(int x, int y, Projection proj)
public abstract void setGraphicLocations(float latitude, float longitude)
public abstract void setGraphicLocations(int x, int y)
public abstract void setGraphicLocations(float latitude, float longitude, int offsetX, int offsetY)
public void setLocationHandler(LocationHandler lh)
public LocationHandler getLocationHandler()
public void setLocationPaint(java.awt.Paint locationPaint)
public OMText getLabel()
public void setLabel(OMText lable)
public OMGraphic getLocationMarker()
public void setLocationMarker(OMGraphic graphic)
public void setShowLocation(boolean showLocations)
public boolean isShowLocation()
public void setShowName(boolean showNames)
public boolean isShowName()
public java.lang.String getName()
public void setName(java.lang.String name)
public void setDetails(java.lang.String det)
public java.lang.String getDetails()
public void showDetails(Layer layer)
public void setAllowDecluttering(boolean allow)
allow
- if true, label will be decluttered if declutter
matrix is available.public boolean isAllowDecluttering()
public void setHorizontalLabelBuffer(int buffer)
public int getHorizontalLabelBuffer()
public boolean generate(Projection proj, DeclutterMatrix declutterMatrix)
proj
- projection of the map.declutterMatrix
- DeclutterMatrix for the map.public void setDeclutterLimit(int value)
public int getDeclutterLimit()
public boolean generate(Projection proj)
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.
generate
in interface OMGeometry
generate
in class OMGraphic
proj
- Projection
OMGraphic.regenerate(com.bbn.openmap.proj.Projection)
public void render(java.awt.Graphics g)
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 render will take into
account the layer showNames and showLocations settings.
render
in class OMGraphic
g
- Graphics context to render into.public void renderName(java.awt.Graphics g)
paint()
function of java.awt.Components. Note
that if the graphic has not been generated, it will not be
rendered. This render will take into account the layer
showNames and showLocations settings.
g
- Graphics context to render into.public void renderLocation(java.awt.Graphics g)
paint()
function of java.awt.Components. Note
that if the graphic has not been generated, it will not be
rendered. This render will take into account the layer
showNames and showLocations settings.
g
- Graphics context to render into.protected boolean shouldRenderName()
protected boolean shouldRenderLocation()
public float distance(int x, int y)
distance
in interface OMGeometry
distance
in class OMGraphic
x
- X coordinate of the point.y
- Y coordinate of the point.
protected void declutterLabel(DeclutterMatrix declutter, Projection proj)
declutter
- the DeclutterMatrix for the map.public static float convertCoordinateString(java.lang.String coord) throws java.lang.NumberFormatException
coord
- the coordinate string representing the decimal
degree value, following the format [NSEW]XXXXXXXXX.
java.lang.NumberFormatException
public static void main(java.lang.String[] args)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |