com.bbn.openmap.tools.symbology.milStd2525
Class SymbolReferenceLibrary

java.lang.Object
  extended by com.bbn.openmap.MapHandlerChild
      extended by com.bbn.openmap.OMComponent
          extended by com.bbn.openmap.tools.symbology.milStd2525.SymbolReferenceLibrary
All Implemented Interfaces:
LightMapHandlerChild, PropertyConsumer, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.util.EventListener

public class SymbolReferenceLibrary
extends OMComponent

The SymbolReferenceLibrary is a organizational class for creating and managing a SymbolPart tree. It can handle requests for decoding a Symbol code and providing a SymbolPart for that code, and can fetch ImageIcons for codes and SymbolParts. This is the class you can put in the MapHandler for other components to use in order to create symbols. The DemoLayer, for instance, uses the MapHandler.findAndInit() method to find it and create a space shuttle icon.

This SymbolReferenceLibrary has one property that lets you specify the SymbolImageMaker it should use to create image icons.

  
   
   symbolreferencelibrary.class=com.bbn.openmap.tools.symbology.milStd2525.SymbolReferenceLibrary
   
   # properties to use for GIF image data files
   symbolreferencelibrary.imageMakerClass=com.bbn.openmap.tools.symbology.milStd2525.GIFSymbolImageMaker
   # optional property used as a path to the parent of the data files if it's not in the classpath.
   symbolreferencelibrary.path=<path to image data file directory>
   # optional background color for icons if you want something other than clear.
   symbolreferencelibrary.background=AAGGRRBB
   
   # properties to use for SVG image data files obtained from DISA.  You need to have Batik jars in 
   # your classpath to use the SVG files, as well as the omsvg.jar file
   symbolreferencelibrary.imageMakerClass=com.bbn.openmap.tools.symbology.milStd2525.SVGSymbolImageMaker
   # optional property used as a path to the parent of the data files if it's not in the classpath.
   symbolreferencelibrary.path=<path to image data file directory>
   # optional background color for icons if you want something other than clear.
   symbolreferencelibrary.background=AAGGRRBB
  
 


Field Summary
protected  SymbolPart head
           
protected static SymbolReferenceLibrary library
           
protected  CodePositionTree positionTree
           
protected  CodeOptions symbolAttributes
           
protected  SymbolImageMaker symbolImageMaker
           
static java.lang.String SymbolImageMakerClassProperty
           
 
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
SymbolReferenceLibrary()
          A constructor used when the SymbolImageMaker will be set later, either via the setProperties method or programmatically.
SymbolReferenceLibrary(SymbolImageMaker sim)
          Create a SymbolReferenceLibrary with a SymbolImageMaker to use to create images from a data source.
 
Method Summary
 java.util.Properties findAndLoadProperties(java.lang.String propertiesResource)
           
 CodeOptions getCodeOptions()
           
 CodeOptions getCodeOptions(SymbolPart sp, CodeOptions co)
          Given a SymbolPart, return what options are available for it.
 java.lang.String getDescription()
          Returns a huge, multi-line string listing all of the symbols, their names and their relation to each other.
 SymbolPart getHead()
          The SymbolParts in the library are stored in a tree hierarchy, and this method gets the top level one representing the MIL-STD-2525 tree.
 javax.swing.ImageIcon getIcon(java.lang.String symbolCode, java.awt.Dimension di)
          Return an image given a SymbolCode and dimension.
 javax.swing.ImageIcon getIcon(SymbolPart sp, CodeOptions co, java.awt.Dimension di)
          Return an image for a particular SymbolPart, its options and dimensions.
 java.lang.String getSymbolCode(SymbolPart sp, CodeOptions co)
          Return the 15 character character string representing a SymbolPart with CodeOptions.
 SymbolImageMaker getSymbolImageMaker()
           
 SymbolPart getSymbolPartForCode(java.lang.String code)
          Check to see if code exists, if it's valid.
protected  SymbolPart getSymbolPartForCodeStartingAt(SymbolPart node, java.lang.String code)
           
protected  void initialize(java.util.Properties props, SymbolImageMaker sim)
           
static void main(java.lang.String[] argv)
           
 void setProperties(java.lang.String prefix, java.util.Properties props)
          Sets the properties for the OMComponent.
 SymbolImageMaker setSymbolImageMaker(java.lang.String classname)
           
 void setSymbolImageMaker(SymbolImageMaker symbolImageMaker)
           
 
Methods inherited from class com.bbn.openmap.OMComponent
getProperties, getPropertyInfo, getPropertyPrefix, setProperties, setPropertyPrefix
 
Methods inherited from class com.bbn.openmap.MapHandlerChild
addPropertyChangeListener, addVetoableChangeListener, childrenAdded, childrenRemoved, findAndInit, findAndInit, findAndUndo, 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

SymbolImageMakerClassProperty

public static final java.lang.String SymbolImageMakerClassProperty
See Also:
Constant Field Values

head

protected SymbolPart head

positionTree

protected CodePositionTree positionTree

library

protected static SymbolReferenceLibrary library

symbolAttributes

protected CodeOptions symbolAttributes

symbolImageMaker

protected SymbolImageMaker symbolImageMaker
Constructor Detail

SymbolReferenceLibrary

public SymbolReferenceLibrary()
A constructor used when the SymbolImageMaker will be set later, either via the setProperties method or programmatically.


SymbolReferenceLibrary

public SymbolReferenceLibrary(SymbolImageMaker sim)
Create a SymbolReferenceLibrary with a SymbolImageMaker to use to create images from a data source. It's expected that the SymbolImageMaker is ready to go, configured to create images given a code. The SRL will use the hierarchy.properties file found as a resource as the reference for the symbol hierarchy.

Parameters:
sim -
Method Detail

findAndLoadProperties

public java.util.Properties findAndLoadProperties(java.lang.String propertiesResource)

initialize

protected void initialize(java.util.Properties props,
                          SymbolImageMaker sim)

setProperties

public void setProperties(java.lang.String prefix,
                          java.util.Properties props)
Description copied from class: OMComponent
Sets the properties for the OMComponent.

Specified by:
setProperties in interface PropertyConsumer
Overrides:
setProperties in class OMComponent
Parameters:
prefix - the token to prefix the property names
props - the Properties object

setSymbolImageMaker

public SymbolImageMaker setSymbolImageMaker(java.lang.String classname)

getCodeOptions

public CodeOptions getCodeOptions()

getCodeOptions

public CodeOptions getCodeOptions(SymbolPart sp,
                                  CodeOptions co)
Given a SymbolPart, return what options are available for it. This depends on what scheme the SymbolPart inherits from. Not implemented.

Parameters:
sp - The SymbolPart in question.
co - Current settings that may be in use.

getIcon

public javax.swing.ImageIcon getIcon(java.lang.String symbolCode,
                                     java.awt.Dimension di)
Return an image given a SymbolCode and dimension.


getIcon

public javax.swing.ImageIcon getIcon(SymbolPart sp,
                                     CodeOptions co,
                                     java.awt.Dimension di)
Return an image for a particular SymbolPart, its options and dimensions. Not implemented.


getSymbolCode

public java.lang.String getSymbolCode(SymbolPart sp,
                                      CodeOptions co)
Return the 15 character character string representing a SymbolPart with CodeOptions. Not implemented.


getHead

public SymbolPart getHead()
The SymbolParts in the library are stored in a tree hierarchy, and this method gets the top level one representing the MIL-STD-2525 tree.


getDescription

public java.lang.String getDescription()
Returns a huge, multi-line string listing all of the symbols, their names and their relation to each other.


getSymbolPartForCode

public SymbolPart getSymbolPartForCode(java.lang.String code)
Check to see if code exists, if it's valid. If you get a SymbolPart back from this query, then you can call getIcon.

Parameters:
code -
Returns:
SymbolPart for the 15 character code of a symbol.

getSymbolPartForCodeStartingAt

protected SymbolPart getSymbolPartForCodeStartingAt(SymbolPart node,
                                                    java.lang.String code)

main

public static void main(java.lang.String[] argv)

getSymbolImageMaker

public SymbolImageMaker getSymbolImageMaker()
Returns:
Returns the symbolImageMaker.

setSymbolImageMaker

public void setSymbolImageMaker(SymbolImageMaker symbolImageMaker)
Parameters:
symbolImageMaker - The symbolImageMaker to set.


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