|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bbn.openmap.MapHandlerChild com.bbn.openmap.OMComponent com.bbn.openmap.image.MagicPlanetImageComponent
public class MagicPlanetImageComponent
The MagicPlanetImageComponent is an OpenMap Component designed to create images for Global Imagination's MagicPlanet Globe. This component, when added to an OpenMap MapHandler, will find the LayerHandler so it can find out when the Layer given to the MapBean change, so it knows which ones to use when creating an image file. This component also connects to the MapBean as a PropertyChangeListener to find out when the ocean color has changed. The MagicPlanet software (Storyteller) has the option of displaying images stored in a particular directory, either displaying the latest (lexically) image or cycling through a set of images in the directory to create a movie on the globe.
The class has options that change the format of the images created, where the images are stored, how often they are created, and the scale of the images. The scale of the image dictates its pixel size, since the proportion of the projection has to be constant for it to work on the globe. The projection used for the images is always the OpenMap LLXY projection, that's what the MagicPlanet expects.
The properties for this component are:
outputDirectory=path_to_directory_for_writing_images # Milliseconds between image creation, 60000 is the default, representing 1 minute updateInterval=60000 # Milliseconds after the timer is created before the MagicPlanetImageComponent takes # its first image and starts updating according to the updateInterval. Default is 0, # so the first image is taken as soon as the component finds the layers. initialDelay=180000 # The scale of the image, it determines the size of the image. This # may be important for certain layers to show particular details. # The default is 60000000F, which represents an image approximately 2kx1k scale=60000000F # Property to tell the component to create a new image and reset the timer if the # layers on the MapBean change. True by default. autoUpdate=true # Property to tell the component to remove old images, default is true cleanup=true # Property to set the wait time before deleting old images, represented # in milliseconds. The default is 86400000, representing one day. cleanupInterval=86400000 # Properties for setting the pixel width and height of the images. These properties # provide a more precise way to control the image size, and tell the component to # scale the image created with the scale setting set above. The closer you get # the scale to provide you the image size you want, the higher quality image # you will have. The default values for these properties are -1, which tells # the component to not change the size of the image resulting from the scale setting. width=-1 height=-1 # Property to set the name of the last image written in a file, so other programs # can more easily figure out what it was. The property should reflect the path # to the file to be written, which will contain 'MagicPlanet.lastFile=YYYYMMDDhhmmss.ext', # where YYYYMMDDhhmmss are year, month, day, hour, minute and second the file was created, # and ext is the extension for the image type. This information, combined with the directory # information stored above, will let you know where the file is. If this property is not set, # no text file will be written. lastImageFile=path_to_text_file # Property that describes a system command that should be run each time an image is created. # The property should contain exactly what would be typed into a command line for a script # to be run, in the same environment this component is being run in. There are special arguments # that can be inserted into this property string that the component will use to replace the current # image file name: # # %FILEPATH% gets replaced with the complete path of the new image file. # %FILENAME% gets replaced with the file name if the image file. # %FILENAME_WITHOUT_EXTENSION% gets replaced with the file name without a '.' or anything after that. # # The default is no value being set for the script, which means nothing will happen. Here is an example for # creating a .dds file from the current image, using nvidia's nvdxt script. postProcessingScript="c:/Program Files/NVIDIA Corporation/NVIDIA DDS Utilities/nvdxt.exe" -swap -dxt1c -file %FILEPATH% -output c:/%FILENAME_WITHOUT_EXTENSION%.dds
Field Summary | |
---|---|
protected boolean |
autoUpdate
|
static java.lang.String |
AutoUpdateProperty
|
protected java.awt.Paint |
background
|
protected boolean |
cleanup
|
protected int |
cleanupInterval
|
static java.lang.String |
CleanupIntervalProperty
|
static java.lang.String |
CleanupProperty
|
protected boolean |
DEBUG
|
protected int |
height
|
static java.lang.String |
HeightProperty
|
protected ImageFormatter |
imageFormatter
|
protected int |
initialDelay
|
static java.lang.String |
InitialDelayProperty
|
static java.lang.String |
LAST_IMAGE_FILE_KEY
|
protected java.lang.String |
lastImageFile
|
static java.lang.String |
LastImageFileProperty
|
protected LayerHandler |
layerHandler
|
protected Layer[] |
layers
|
protected MapBean |
mapBean
|
static java.lang.String |
OutputDirectoryProperty
|
protected java.lang.String |
outputDirectoryString
Parent directory for images. |
protected java.lang.String |
postProcessingScript
|
static java.lang.String |
PostProcessingScriptProperty
|
protected Projection |
proj
|
static java.lang.String |
REPLACE_FILENAME_MARKER
|
static java.lang.String |
REPLACE_FILENAME_WOEXT_MARKER
|
static java.lang.String |
REPLACE_FILEPATH_MARKER
|
protected float |
scale
|
static java.lang.String |
ScaleProperty
|
protected javax.swing.Timer |
timer
|
protected int |
updateInterval
|
static java.lang.String |
UpdateIntervalProperty
|
protected int |
width
|
static java.lang.String |
WidthProperty
|
Fields inherited from class com.bbn.openmap.OMComponent |
---|
i18n, propertyPrefix |
Fields inherited from class com.bbn.openmap.MapHandlerChild |
---|
beanContextChildSupport, isolated |
Fields inherited from interface com.bbn.openmap.PropertyConsumer |
---|
EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty |
Constructor Summary | |
---|---|
MagicPlanetImageComponent()
|
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
|
protected java.lang.String |
checkTrimAndNull(java.lang.String s)
|
void |
cleanup(boolean deleteAll)
Remove old files. |
void |
createImage()
Create a new image. |
void |
createTimer()
Creates a timer with the current updateInterval and calls setTimer(). |
void |
findAndInit(java.lang.Object someObj)
MapHandlerChild method extended through the OMComponent hierarchy. |
void |
findAndUndo(java.lang.Object someObj)
MapHandlerChild method extended through the OMComponent hierarchy. |
protected java.lang.String |
generatePostProcessingCmd(java.lang.String script,
java.lang.String filePath)
|
java.awt.Paint |
getBackground()
Return the 'ocean' color of the planet. |
int |
getCleanupInterval()
|
protected java.lang.String |
getFileNameForTime(long l)
|
int |
getHeight()
|
ImageFormatter |
getImageFormatter()
|
int |
getInitialDelay()
|
java.lang.String |
getLastImageFile()
Get the location of a file that can be read to find out the name of the last image to be created. |
protected LayerHandler |
getLayerHandler()
|
Layer[] |
getLayers()
|
protected MapBean |
getMapBean()
|
java.lang.String |
getOutputDirectoryString()
|
java.lang.String |
getPostProcessingScript()
|
Projection |
getProj()
Get the image projection. |
java.util.Properties |
getProperties(java.util.Properties props)
PropertyConsumer method, to fill in a Properties object, reflecting the current values of the OMComponent. |
java.util.Properties |
getPropertyInfo(java.util.Properties props)
Method to fill in a Properties object with values reflecting the properties able to be set on this PropertyConsumer. |
float |
getScale()
|
protected long |
getTimeForFileName(java.lang.String fileName)
Decode the file name to see what time the file was created. |
javax.swing.Timer |
getTimer()
Get the timer being used for automatic updates. |
int |
getUpdateInterval()
|
int |
getWidth()
|
void |
handleUpdate()
Checks to see if there is a timer, and if the component wants to automatically update the current image. |
boolean |
isAutoUpdate()
|
boolean |
isCleanup()
|
void |
propertyChange(java.beans.PropertyChangeEvent evt)
|
void |
setAutoUpdate(boolean autoUpdate)
Set whether a new image should be created immediately if the MapBean's layers change, or if the MapBean's background color changes. |
protected void |
setBackground(java.awt.Paint paint)
Set the 'ocean' color of the planet. |
void |
setCleanup(boolean cleanup)
Set whether the component should delete old images. |
void |
setCleanupInterval(int cleanupInterval)
Set the interval, in milliseconds, between the current time and the time old images were created before they are deleted. |
void |
setHeight(int height)
Set the scaled pixel height of the images.-1 maintains what the scale setting decides. |
void |
setImageFormatter(ImageFormatter iFormatter)
Set the ImageFormatter to use for creating the image files. |
void |
setInitialDelay(int initialDelay)
|
void |
setLastImageFile(java.lang.String lastImageFile)
Set the location of a file that can be read to find out the name of the last image to be created. |
protected void |
setLayerHandler(LayerHandler lh)
Set the LayerHandler, become a LayerListener object to it to know when the layers on the MapBean change. |
void |
setLayers(Layer[] layers)
|
void |
setLayers(LayerEvent evt)
|
protected void |
setMapBean(MapBean mb)
Set the MapBean, become a PropertyChangeListener object to it to know when the background color on the MapBean changes. |
void |
setOutputDirectoryString(java.lang.String outputDirectoryString)
Set the directory where the images should be written to. |
void |
setPostProcessingScript(java.lang.String postProcessingScript)
|
void |
setProj(Projection proj)
Set the image projection. |
void |
setProperties(java.lang.String prefix,
java.util.Properties props)
Sets the properties for the OMComponent. |
void |
setScale(float scale)
Sets the scale for the projection, which directly affects the size of the image. |
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. |
void |
setUpdateInterval(int delay)
The delay between timer pulses, in milliseconds. |
void |
setWidth(int width)
Set the scaled pixel width of the images. |
Methods inherited from class com.bbn.openmap.OMComponent |
---|
getPropertyPrefix, setProperties, setPropertyPrefix |
Methods inherited from class com.bbn.openmap.MapHandlerChild |
---|
addPropertyChangeListener, addVetoableChangeListener, childrenAdded, childrenRemoved, findAndInit, firePropertyChange, fireVetoableChange, getBeanContext, isIsolated, removePropertyChangeListener, removeVetoableChangeListener, setBeanContext, setIsolated |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String OutputDirectoryProperty
public static final java.lang.String UpdateIntervalProperty
public static final java.lang.String InitialDelayProperty
public static final java.lang.String ScaleProperty
public static final java.lang.String AutoUpdateProperty
public static final java.lang.String CleanupProperty
public static final java.lang.String CleanupIntervalProperty
public static final java.lang.String HeightProperty
public static final java.lang.String WidthProperty
public static final java.lang.String LastImageFileProperty
public static final java.lang.String PostProcessingScriptProperty
public static final java.lang.String LAST_IMAGE_FILE_KEY
public static final java.lang.String REPLACE_FILEPATH_MARKER
public static final java.lang.String REPLACE_FILENAME_MARKER
public static final java.lang.String REPLACE_FILENAME_WOEXT_MARKER
protected boolean DEBUG
protected LayerHandler layerHandler
protected MapBean mapBean
protected java.lang.String outputDirectoryString
protected int updateInterval
protected int initialDelay
protected float scale
protected Projection proj
protected java.awt.Paint background
protected Layer[] layers
protected boolean autoUpdate
protected ImageFormatter imageFormatter
protected boolean cleanup
protected int cleanupInterval
protected int height
protected int width
protected java.lang.String lastImageFile
protected java.lang.String postProcessingScript
protected javax.swing.Timer timer
Constructor Detail |
---|
public MagicPlanetImageComponent()
Method Detail |
---|
public void findAndInit(java.lang.Object someObj)
findAndInit
in interface LightMapHandlerChild
findAndInit
in class MapHandlerChild
public void findAndUndo(java.lang.Object someObj)
findAndUndo
in interface LightMapHandlerChild
findAndUndo
in class MapHandlerChild
public javax.swing.Timer getTimer()
public void setTimer(javax.swing.Timer t)
public void createTimer()
public void setUpdateInterval(int delay)
public int getUpdateInterval()
public int getInitialDelay()
public void setInitialDelay(int initialDelay)
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
protected LayerHandler getLayerHandler()
protected void setLayerHandler(LayerHandler lh)
lh
- LayerHandler.protected MapBean getMapBean()
protected void setMapBean(MapBean mb)
mb
- MapBean.public void setProperties(java.lang.String prefix, java.util.Properties props)
OMComponent
setProperties
in interface PropertyConsumer
setProperties
in class OMComponent
prefix
- the token to prefix the property namesprops
- the Properties
objectpublic java.util.Properties getProperties(java.util.Properties props)
OMComponent
getProperties
in interface PropertyConsumer
getProperties
in class OMComponent
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)
OMComponent
getPropertyInfo
in interface PropertyConsumer
getPropertyInfo
in class OMComponent
props
- a Properties object to load the PropertyConsumer properties
into. If getList equals null, then a new Properties object should
be created.
public void setLayers(LayerEvent evt)
setLayers
in interface LayerListener
public void handleUpdate()
public void createImage()
protected java.lang.String generatePostProcessingCmd(java.lang.String script, java.lang.String filePath)
protected java.lang.String getFileNameForTime(long l)
l
- unix time in milliseconds
protected long getTimeForFileName(java.lang.String fileName) throws java.lang.NumberFormatException
fileName
-
java.lang.NumberFormatException
- if the filename can't be decoded.public void cleanup(boolean deleteAll)
deleteAll
- if true, all images will be deleted, regardless of when
they were created.public void propertyChange(java.beans.PropertyChangeEvent evt)
propertyChange
in interface java.beans.PropertyChangeListener
protected void setBackground(java.awt.Paint paint)
paint
- public java.awt.Paint getBackground()
public Layer[] getLayers()
public void setLayers(Layer[] layers)
public java.lang.String getOutputDirectoryString()
public void setOutputDirectoryString(java.lang.String outputDirectoryString)
outputDirectoryString
- public Projection getProj()
public void setProj(Projection proj)
proj
- public float getScale()
public void setScale(float scale)
scale
- public boolean isAutoUpdate()
public void setAutoUpdate(boolean autoUpdate)
autoUpdate
- public ImageFormatter getImageFormatter()
public void setImageFormatter(ImageFormatter iFormatter)
iFormatter
- public boolean isCleanup()
public void setCleanup(boolean cleanup)
cleanup
- public int getCleanupInterval()
public void setCleanupInterval(int cleanupInterval)
cleanupInterval
- public int getHeight()
public void setHeight(int height)
height
- pixels.public int getWidth()
public void setWidth(int width)
width
- pixels.public java.lang.String getLastImageFile()
public void setLastImageFile(java.lang.String lastImageFile)
lastImageFile
- public java.lang.String getPostProcessingScript()
public void setPostProcessingScript(java.lang.String postProcessingScript)
protected java.lang.String checkTrimAndNull(java.lang.String s)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |