|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent com.bbn.openmap.Layer com.bbn.openmap.layer.OMGraphicHandlerLayer com.bbn.openmap.layer.daynight.DayNightLayer
public class DayNightLayer
The DayNightLayer is a layer that draws the day/Night terminator on the map. When the layer is re-projected, it figures out the brightest point on the earth (closest to the sun), and creates an image that has daytime pixels clear and the nighttime pixels shaded. There are a couple of options available for the layer. The terminator can be faded from light to dark, and the width of the fading can be adjusted. The color of the shading can be changed. The shading can reflect the current time, or be set to display the shading of a specified time. A time interval can be set to have the layer automatically update at regular intervals.
The openmap.properties file can control the layer with the following settings:
# These are all optional, and can be omitted if you want to use the defaults. # draw terminator as poly (faster calculation than image, # defaults to true). daynight.doPolyTerminator=true # number of vertices for polygon terminator line. this is only valid # if doPolyTerminator is true... daynight.terminatorVerts=360 # termFade - the distance of the transition of fade, as a percentage of PI. daynight.termFade=.1 # currentTime - true to display the shading at the computer's current time. daynight.currentTime=true # overlayTime - time, in milliseconds from java/unix epoch, to set the layer # time being displayed. currentTime has to be false for this to be used. daynight.overlayTime=919453689000 # updateInterval - time in milliseconds between updates. currentTime has to be # true for this to be used. daynight.updateInterval=300000 # Color of the shading (32bit Hex ARGB) daynight.nighttimeColor=64000000
In addition, you can get this layer to work with the OpenMap viewer by editing your openmap.properties file:
# layers openmap.layers=daynight ... # class daynight.class=com.bbn.openmap.layer.daynight.DayNightLayer # name daynight.prettyName=Day/Night Shading
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected boolean |
currentTime
If true, the layer will set the darkness according to the current time. |
static java.lang.String |
CurrentTimeProperty
|
protected java.awt.Color |
daytimeColor
The color of daytime - default is white and clear. |
static java.lang.String |
DaytimeColorProperty
|
static float |
DEFAULT_TERM_FADE
Default value of fade to the terminator line, set to .10f. |
static int |
DO_NOT_UPDATE
Default update interval, which is never - updates occur on re-projections. |
protected boolean |
doPolyTerminator
Create the terminator line as a polygon. |
static java.lang.String |
DoPolyTerminatorProperty
|
protected java.awt.Color |
nighttimeColor
the color of darkness - default is black. |
static java.lang.String |
NighttimeColorProperty
|
protected long |
overlayTime
The time used to create the layer, in milliseconds from java/unix epoch. |
static java.lang.String |
OverlayTimeProperty
|
protected float |
termFade
Percentage of the distance from the horizon to the brightest point to start fading to darkness. |
static java.lang.String |
TermFadeProperty
|
protected int |
terminatorVerts
The number of vertices of the polygon terminator line. |
static java.lang.String |
TerminatorVertsProperty
|
protected javax.swing.Timer |
timer
Update timer. |
protected int |
updateInterval
Update interval to automatically update the layer, in milli-seconds |
static java.lang.String |
UpdateIntervalProperty
|
Fields inherited from class com.bbn.openmap.layer.OMGraphicHandlerLayer |
---|
consumeEvents, ConsumeEventsProperty, filter, interruptable, InterruptableProperty, layerWorker, LAYERWORKER_LOCK, layerWorkerQueue, logger, mouseEventInterpreter, mouseModeIDs, MouseModesProperty, projectionChangePolicy, ProjectionChangePolicyProperty, renderPolicy, RenderPolicyProperty, selectedList, TransparencyProperty |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface com.bbn.openmap.PropertyConsumer |
---|
EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
DayNightLayer()
The default constructor for the Layer. |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent ae)
Handle an ActionEvent from the Timer. |
protected OMGraphic |
createImage(Projection projection)
Create the OMGraphic that acts as an overlay showing the day/night terminator. |
boolean |
getCurrentTime()
Returns whether the layer will set the overlayTime to the time the image is created. |
long |
getOverlayTime()
Get the time of the overlay. |
java.util.Properties |
getProperties(java.util.Properties props)
Overrides Layer getProperties method., also calls that method on Layer. |
java.util.Properties |
getPropertyInfo(java.util.Properties props)
Overrides Layer getProperties method., also calls that method on Layer. |
javax.swing.Timer |
getTimer()
Get the timer being used for automatic updates. |
OMGraphicList |
prepare()
Prepares the graphics for the layer. |
void |
setCurrentTime(boolean ct)
Set whether the layer should set the overlayTime to the time the image is created. |
void |
setOverlayTime(long ot)
Set the time for the overlay. |
void |
setProperties(java.lang.String prefix,
java.util.Properties properties)
The properties and prefix are managed and decoded here, for the standard uses of the DayNightLayer. |
void |
setTimer(javax.swing.Timer t)
If you want the layer to update itself at certain intervals, you can set the timer to do that. |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, update, updateUI |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
action, add, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.bbn.openmap.event.ProjectionListener |
---|
projectionChanged |
Methods inherited from interface java.beans.beancontext.BeanContextChild |
---|
addPropertyChangeListener, removePropertyChangeListener |
Field Detail |
---|
public static final float DEFAULT_TERM_FADE
public static final int DO_NOT_UPDATE
protected java.awt.Color daytimeColor
protected java.awt.Color nighttimeColor
protected float termFade
protected boolean currentTime
protected long overlayTime
protected int updateInterval
protected javax.swing.Timer timer
protected boolean doPolyTerminator
protected int terminatorVerts
public static final java.lang.String DaytimeColorProperty
public static final java.lang.String NighttimeColorProperty
public static final java.lang.String TermFadeProperty
public static final java.lang.String CurrentTimeProperty
public static final java.lang.String OverlayTimeProperty
public static final java.lang.String UpdateIntervalProperty
public static final java.lang.String DoPolyTerminatorProperty
public static final java.lang.String TerminatorVertsProperty
Constructor Detail |
---|
public DayNightLayer()
Method Detail |
---|
public void setProperties(java.lang.String prefix, java.util.Properties properties)
setProperties
in interface PropertyConsumer
setProperties
in class OMGraphicHandlerLayer
prefix
- string prefix used in the properties file for
this layer.properties
- the properties set in the properties file.public java.util.Properties getProperties(java.util.Properties props)
OMGraphicHandlerLayer
getProperties
in interface PropertyConsumer
getProperties
in class OMGraphicHandlerLayer
props
- a Properties object to load the PropertyConsumer properties
into. If props equals null, then a new Properties object should be
created.
public java.util.Properties getPropertyInfo(java.util.Properties props)
OMGraphicHandlerLayer
getPropertyInfo
in interface PropertyConsumer
getPropertyInfo
in class OMGraphicHandlerLayer
props
- a Properties object to load the PropertyConsumer properties
into. If getList equals null, then a new Properties object should
be created.
public void actionPerformed(java.awt.event.ActionEvent ae)
actionPerformed
in interface java.awt.event.ActionListener
actionPerformed
in class OMGraphicHandlerLayer
ae
- action event from the timer.protected OMGraphic createImage(Projection projection)
projection
- the projection of the screen,
public OMGraphicList prepare()
Occasionally it is necessary to abort a prepare call. When this happens, the map will set the cancel bit in the LayerThread, (the thread that is running the prepare). If this Layer needs to do any cleanups during the abort, it should do so, but return out of the prepare asap.
prepare
in class OMGraphicHandlerLayer
public long getOverlayTime()
public void setOverlayTime(long ot)
public boolean getCurrentTime()
public void setCurrentTime(boolean ct)
public javax.swing.Timer getTimer()
public void setTimer(javax.swing.Timer t)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |