com.bbn.openmap.graphicLoader.scenario
Class ScenarioPoint

java.lang.Object
  |
  +--com.bbn.openmap.omGraphics.geom.BasicGeometry
        |
        +--com.bbn.openmap.omGraphics.OMGraphic
              |
              +--com.bbn.openmap.layer.location.Location
                    |
                    +--com.bbn.openmap.layer.location.URLRasterLocation
                          |
                          +--com.bbn.openmap.graphicLoader.scenario.ScenarioPoint
All Implemented Interfaces:
java.lang.Cloneable, OMGeometry, OMGraphicConstants, ScenarioGraphic, java.io.Serializable

public class ScenarioPoint
extends URLRasterLocation
implements ScenarioGraphic

A ScenarioPoint is a ScenarioGraphic representing an object on the map. It takes TimeStamps and works out its location for a specific time, or it can also represent its plan for the entire scenario. If the URL provided for the point is not available, it will describe itself as an OMPoint. ScenarioPoint is a Location, however, so any location marker OMGraphic can be used. Make sure setGraphicLocations is updated if the marker OMGraphic is something other than OMPoint or OMRaster.

See Also:
Serialized Form

Field Summary
protected  boolean DEBUG
           
protected  int pathStep
          The resolution of segments to use for interpolating between activity points.
protected  int radius
          The radius of OMPoints, if icons are not found.
 
Fields inherited from class com.bbn.openmap.layer.location.URLRasterLocation
SPACING
 
Fields inherited from class com.bbn.openmap.layer.location.Location
allowDecluttering, currentFontDescent, DECLUTTER_ANYWHERE, DECLUTTER_LOCALLY, declutterLimit, DEFAULT_SPACING, details, handler, horizontalLabelBuffer, label, lat, location, lon, name, origXLabelOffset, origYLabelOffset, showLocation, showName, x, xOffset, y, yOffset
 
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
 
Fields inherited from interface com.bbn.openmap.omGraphics.OMGraphicConstants
ADD_GRAPHIC_MASK, BASIC_STROKE, 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_GRAPHIC, GRAPHICTYPE_GRID, GRAPHICTYPE_LINE, GRAPHICTYPE_POINT, GRAPHICTYPE_POLY, GRAPHICTYPE_RASTER, GRAPHICTYPE_RECTANGLE, GRAPHICTYPE_TEXT, INFOLINE, LABEL, LINETYPE_GREATCIRCLE, LINETYPE_RHUMB, LINETYPE_STRAIGHT, LINETYPE_UNKNOWN, LOWER_GRAPHIC_MASK, LOWER_TO_BOTTOM_GRAPHIC_MASK, RADIANS, RAISE_GRAPHIC_MASK, RAISE_TO_TOP_GRAPHIC_MASK, RENDERTYPE_LATLON, RENDERTYPE_OFFSET, RENDERTYPE_UNKNOWN, RENDERTYPE_XY, SELECT_GRAPHIC_MASK, SORT_GRAPHICS_MASK, TOOLTIP, UPDATE_GRAPHIC_MASK
 
Constructor Summary
ScenarioPoint(java.lang.String name, java.lang.String iconURL)
          Create a ScenarioLocation at a latitude/longtude location.
ScenarioPoint(java.lang.String name, java.net.URL iconURL)
          Create a ScenarioLocation at a latitude/longtude location.
 
Method Summary
 void addTimeStamp(TimeStamp timeStamp)
          Add a TimeStamp to the point.
 void clearTimeStamps()
          Clear all time stamps.
 boolean generate(Projection p)
          Prepare the graphic for rendering.
 void generateSnapshot(Projection p, long time)
          Prepare the ScenarioPoint to be rendered in its position at a certain time.
 void generateTotalScenario(Projection p)
          Prepare the ScenarioPoint to render its entire scenario performance.
protected  void init()
           
 boolean removeTimeStamp(TimeStamp timeStamp)
          Remove a location at a certain time.
 void render(java.awt.Graphics g)
          Paint the graphic and the name of the location.
 void setGraphicLocations(float latitude, float longitude)
          Given a new latitude/longitude, reposition the graphic and label.
 void setPosition(long time)
          Given a time, figure out the location.
 boolean thisIsYou(java.lang.String n)
          Checks the internal name against the given string.
 
Methods inherited from class com.bbn.openmap.layer.location.URLRasterLocation
getIconRaster, getIconRaster, getIconRaster, getIconRaster, getIconRaster, getIconRaster, getIconRasterURL, setGraphicLocations, setGraphicLocations
 
Methods inherited from class com.bbn.openmap.layer.location.Location
convertCoordinateString, declutterLabel, distance, generate, getDeclutterLimit, getDetails, getHorizontalLabelBuffer, getLabel, getLocationHandler, getLocationMarker, getName, isAllowDecluttering, isShowLocation, isShowName, main, renderLocation, renderName, setAllowDecluttering, setDeclutterLimit, setDetails, setHorizontalLabelBuffer, setLabel, setLocation, setLocation, setLocation, setLocation, setLocationHandler, setLocationMarker, setLocationPaint, setName, setShowLocation, setShowName, showDetails
 
Methods inherited from class com.bbn.openmap.omGraphics.OMGraphic
clone, deselect, getDeclutterType, getDescription, getDescription, getDisplayColor, getDisplayPaint, getEdgeMatchesFill, getFillColor, getFillPaint, getHasLabel, getLineColor, getLinePaint, getMattingPaint, getRenderType, getSelectColor, getSelectPaint, getShowEditablePalette, getStroke, getTextureMask, hasLineTypeChoice, initLabelingDuringGenerate, isClear, isMatted, isSelected, normalizeDistanceForLineWidth, regenerate, renderLabel, select, setDeclutterType, setEdgeMatchesFill, setFillColor, setFillPaint, setGraphicsColor, setGraphicsForEdge, setGraphicsForFill, setHasLabel, setLabelLocation, setLabelLocation, setLabelLocation, setLineColor, setLinePaint, setMatted, setMattingPaint, setRenderType, setSelectColor, setSelected, setSelectPaint, setShape, setShowEditablePalette, setStroke, setTextureMask, shouldRenderEdge, shouldRenderFill
 
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

radius

protected int radius
The radius of OMPoints, if icons are not found.


pathStep

protected int pathStep
The resolution of segments to use for interpolating between activity points. Default is 100.


DEBUG

protected boolean DEBUG
Constructor Detail

ScenarioPoint

public ScenarioPoint(java.lang.String name,
                     java.lang.String iconURL)
Create a ScenarioLocation at a latitude/longtude location.

Parameters:
name - the identifier for the location.
iconURL - a string to a URL for an image

ScenarioPoint

public ScenarioPoint(java.lang.String name,
                     java.net.URL iconURL)
Create a ScenarioLocation at a latitude/longtude location.

Parameters:
name - the identifier for the location.
iconURL - a URL for an image
Method Detail

init

protected void init()

thisIsYou

public boolean thisIsYou(java.lang.String n)
Checks the internal name against the given string.

Specified by:
thisIsYou in interface ScenarioGraphic

addTimeStamp

public void addTimeStamp(TimeStamp timeStamp)
Add a TimeStamp to the point.

Specified by:
addTimeStamp in interface ScenarioGraphic

removeTimeStamp

public boolean removeTimeStamp(TimeStamp timeStamp)
Description copied from interface: ScenarioGraphic
Remove a location at a certain time.

Specified by:
removeTimeStamp in interface ScenarioGraphic

clearTimeStamps

public void clearTimeStamps()
Description copied from interface: ScenarioGraphic
Clear all time stamps.

Specified by:
clearTimeStamps in interface ScenarioGraphic

setPosition

public void setPosition(long time)
Given a time, figure out the location. If the time is before the earliest time or after the latest time, the location will be set to the first or last known location, but the marker will made invisible. If the time is in between the first and last time, the position will be interpolated.


generateSnapshot

public void generateSnapshot(Projection p,
                             long time)
Prepare the ScenarioPoint to be rendered in its position at a certain time.

Specified by:
generateSnapshot in interface ScenarioGraphic

setGraphicLocations

public void setGraphicLocations(float latitude,
                                float longitude)
Given a new latitude/longitude, reposition the graphic and label.

Overrides:
setGraphicLocations in class URLRasterLocation

generateTotalScenario

public void generateTotalScenario(Projection p)
Prepare the ScenarioPoint to render its entire scenario performance.

Specified by:
generateTotalScenario in interface ScenarioGraphic

generate

public boolean generate(Projection p)
Description copied from class: Location
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
Overrides:
generate in class Location
Parameters:
p - Projection
Returns:
boolean true if successful, false if not.

render

public void render(java.awt.Graphics g)
Description copied from class: Location
Paint the graphic and the name of the location. This should only be used if the locations are pretty spread out from each other. If you think you need to declutter, you should render all the graphics, and then render the names, so that the graphics don't cover up the names.

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.

Overrides:
render in class Location
Parameters:
g - Graphics context to render into.


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