## com.bbn.openmap.tools.symbology.milStd2525
Class SymbolPart

    java.lang.Object
      com.bbn.openmap.tools.symbology.milStd2525.SymbolPart

Direct Known Subclasses:
  SymbolPartTree

public class SymbolPart
extends java.lang.Object

The SymbolPart class represents one part in a hierarchy of pieces needed to represent an actual symbol. A symbol may require geometries from its parents, as each piece further down the hierarchy makes each symbol's meaning more specific, or scoped for a particular task. The top-level SymbolPart represents the entire symbology tree. Descending down through the tree, a SymbolPart representing one of the 5 Scheme sections is next, with the lower levels dependent on the Scheme definitions.

The SymbolPart is smart enough to use the hierarchy.properties file that defines the symbol set and create the symbol tree using the appropriate Code classes. Not all Code classes help define the tree, because some aspects of a symbol are flexible, like the Affiliation (enemy, friend, etc). The SymbolPart tree only defines some aspects of the symbol. Other parts of the symbol are dependent on these flexible variations that are provided to the SymbolPart at the time icons are created.

Field Summary
`protected CGM` `cgm` The symbol geometery object for this SymbolPart.
`protected java.lang.String` `cgmName` The file containing the symbol geometry for this SymbolPart.
`static java.lang.String` `CGMProperty` Property file property for cgm file too represent the symbol.
`protected java.lang.String` `code` The part of the symbol code unique to this symbol part.
`protected CodePosition` `codePosition` The Object that describes the location of this symbol part in the symbol hierarchy as defined by the 15 digit symbol code.
`protected static boolean` `DEBUG`
`static java.lang.String` `DEFAULT_SYMBOL_CODE`
`static java.lang.String` `NameProperty` Property file property for pretty name 'name'
`protected SymbolPart` `parent` The parent SymbolPart to this one.
`protected int` `positionShift` Some positions need to shift for entries that don't follow the conventions on the specification.
`protected java.lang.String` `prettyName` The pretty name for a symbol represented by this SymbolPart at this point in the hierarchy.
`protected java.util.List` `subs` A list of children SymbolParts relative to this one.
`char` `UNUSED`
`char` `WILD`

Constructor Summary
`protected` `SymbolPart()`
`` `SymbolPart(CodePosition codePosition, java.lang.String symbolCode, java.util.Properties props, SymbolPart parent)` The most-used constructor, used by CodePosition objects to create the different levels of the SymbolPart tree.
`` `SymbolPart(CodePosition codePosition, java.lang.String symbolCode, java.util.Properties props, SymbolPart parent, int start, int end, boolean shiftIfNecessary)` A different constructor used by OptionPositions.

Method Summary
`boolean` `codeMatches(java.lang.String queryCode)` A query method that answers if the given 15 digit code applies to this symbol part.
`java.lang.String` `getCode()` Gets the part of the SymbolCode that is unique to this SymbolPart.
`CodeOptions` `getCodeOptions()`
`CodePosition` `getCodePosition()`
`CodeScheme` `getCodeScheme()`
`java.lang.String` `getDescription()` The starting command for retrieving the description with this SymbolPart being the top of the tree.
`java.lang.String` `getDescription(int level)` A method used by the tree to provide a string representation of how all the SymbolParts are connected.
`SymbolPart` `getParent()` Retrieves the SymbolPart's parent in the SymbolPart tree.
`java.lang.String` `getPrettyName()` Sets the descriptive name if this SymbolPart.
`java.util.List` `getSubs()` Gets a list of SymbolPart tree for more specific representations of what this SymbolPart represents.
`java.lang.String` `getSymbolCode()` Retrieves the 15 character symbol code for this SymbolPart.
`protected java.lang.StringBuffer` `getSymbolCode(java.lang.StringBuffer symbolCode)` A SymbolPart tree method that gets the SymbolPart's parents contribution for the symbol code.
`java.lang.StringBuffer` `getSymbolCodeMask()` A 15 character string of spaces, where spaces won't overwrite the current character when this symbol writes to a getSymbolCode() string.
`void` `paintIcon(java.awt.Graphics2D g, CodeOptions co, java.awt.Dimension di)`
`void` `setCode(java.lang.String c)` Sets the part of the SymbolCode that is unique to this SymbolPart.
`void` `setParent(SymbolPart par)` Sets the SymbolPart's parent in the SymbolPart tree.
`void` `setPrettyName(java.lang.String pn)` Sets the descriptive name if this SymbolPart.
`void` `setSubs(java.util.List set)` Sets a list of SymbolPart tree for more specific representations of what this SymbolPart represents.
`java.lang.String` `toString()` Get a simple string representation of this SymbolPart, including the 15 digit code and the pretty name.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### DEFAULT_SYMBOL_CODE

    public static final java.lang.String DEFAULT_SYMBOL_CODE

See Also:
  Constant Field Values

### NameProperty

    public static final java.lang.String NameProperty

  Property file property for pretty name 'name'

  See Also:
    Constant Field Values

### CGMProperty

    public static final java.lang.String CGMProperty

  Property file property for cgm file too represent the symbol.

  See Also:
    Constant Field Values

### codePosition

    protected CodePosition codePosition

  The Object that describes the location of this symbol part in the symbol hierarchy as defined by the 15 digit symbol code.

### code

    protected java.lang.String code

  The part of the symbol code unique to this symbol part. Parents and children will make up the other parts of the code.

### prettyName

    protected java.lang.String prettyName

  The pretty name for a symbol represented by this SymbolPart at this point in the hierarchy.

### cgmName

    protected java.lang.String cgmName

  The file containing the symbol geometry for this SymbolPart.

### cgm

    protected CGM cgm

  The symbol geometery object for this SymbolPart.

### subs

    protected java.util.List subs

  A list of children SymbolParts relative to this one.

### parent

    protected SymbolPart parent

  The parent SymbolPart to this one.

### positionShift

    protected int positionShift

  Some positions need to shift for entries that don't follow the conventions on the specification.

### DEBUG

    protected static boolean DEBUG

### UNUSED

    public final char UNUSED

See Also:
  Constant Field Values

### WILD

    public final char WILD

See Also:
  Constant Field Values

Constructor Detail

### SymbolPart

    protected SymbolPart()

### SymbolPart

    public SymbolPart(CodePosition codePosition,
                      java.lang.String symbolCode,
                      java.util.Properties props,
                      SymbolPart parent)

  The most-used constructor, used by CodePosition objects to create the different levels of the SymbolPart tree. The SymbolPart uses the parameters and the Properties to define its name and get the cgm file holding the geometry for the symbol. This constructor focuses on the Scheme, Dimension and FunctionID symbol parts.

Parameters:
  `codePosition` - CodePosition object that corresponds to the SymbolPart. CodePosition object with lower position numbers tend to define more general symbols.
  `symbolCode` - the 15 character symbol string that defines this SymbolPart. This string is associated with a hierarchy number in the Properties.
  `props` - the Properties object contains all the information about the symbol tree.
  `parent` - the SymbolPart that is above this one in the SymbolPart tree.

### SymbolPart

    public SymbolPart(CodePosition codePosition,
                      java.lang.String symbolCode,
                      java.util.Properties props,
                      SymbolPart parent,
                      int start,
                      int end,
                      boolean shiftIfNecessary)

  A different constructor used by OptionPositions. The SymbolPart uses the parameters and the Properties to define its name and get the cgm file holding the geometry for the symbol. This constructor focuses on the Scheme, Dimension and FunctionID symbol parts.

Parameters:
  `codePosition` - CodePosition object that corresponds to the SymbolPart. CodePosition object with lower position numbers tend to define more general symbols.
  `symbolCode` - the 15 character symbol string that defines this SymbolPart. This string is associated with a hierarchy number in the Properties.
  `props` - the Properties object contains all the information about the symbol tree.
  `parent` - the SymbolPart that is above this one in the SymbolPart tree.

Method Detail

### setCode

    public void setCode(java.lang.String c)

  Sets the part of the SymbolCode that is unique to this SymbolPart.

### getCode

    public java.lang.String getCode()

  Gets the part of the SymbolCode that is unique to this SymbolPart.

### setPrettyName

    public void setPrettyName(java.lang.String pn)

  Sets the descriptive name if this SymbolPart.

### getPrettyName

    public java.lang.String getPrettyName()

  Sets the descriptive name if this SymbolPart.

### setParent

    public void setParent(SymbolPart par)

  Sets the SymbolPart's parent in the SymbolPart tree.

### getParent

    public SymbolPart getParent()

  Retrieves the SymbolPart's parent in the SymbolPart tree.

### setSubs

    public void setSubs(java.util.List set)

  Sets a list of SymbolPart tree for more specific representations of what this SymbolPart represents.

### getSubs

    public java.util.List getSubs()

  Gets a list of SymbolPart tree for more specific representations of what this SymbolPart represents.

### toString

    public java.lang.String toString()

  Get a simple string representation of this SymbolPart, including the 15 digit code and the pretty name.

### getDescription

    public java.lang.String getDescription(int level)

  A method used by the tree to provide a string representation of how all the SymbolParts are connected.

### getDescription

    public java.lang.String getDescription()

  The starting command for retrieving the description with this SymbolPart being the top of the tree.

### getSymbolCode

    public java.lang.String getSymbolCode()

  Retrieves the 15 character symbol code for this SymbolPart. Calling this method will cause the SymbolPart to ask all of it's parents to contribute their part of the code as well.

### getSymbolCodeMask

    public java.lang.StringBuffer getSymbolCodeMask()

  A 15 character string of spaces, where spaces won't overwrite the current character when this symbol writes to a getSymbolCode() string.

### getSymbolCode

    protected java.lang.StringBuffer getSymbolCode(java.lang.StringBuffer symbolCode)

  A SymbolPart tree method that gets the SymbolPart's parents contribution for the symbol code.

### getCodePosition

    public CodePosition getCodePosition()

### getCodeOptions

    public CodeOptions getCodeOptions()

### getCodeScheme

    public CodeScheme getCodeScheme()

### codeMatches

    public boolean codeMatches(java.lang.String queryCode)

  A query method that answers if the given 15 digit code applies to this symbol part.

  Parameters:
    `queryCode` -
  Returns:
    true if the code applies to this position.

### paintIcon

    public void paintIcon(java.awt.Graphics2D g,
                          CodeOptions co,
                          java.awt.Dimension di)

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