Class MilSymbolDescriptor

java.lang.Object
edu.cnu.mdi.mapping.milsym.MilSymbolDescriptor

public class MilSymbolDescriptor extends Object
Immutable descriptor for a palette military symbol.

This class intentionally stays simple for the proof-of-concept phase. It identifies a symbol by an internal id, a user-facing display name, a category used by the palette UI, and a classpath image resource.

  • Constructor Details

    • MilSymbolDescriptor

      public MilSymbolDescriptor(String id, String displayName, String category, String resourcePath, ImageIcon icon)
      Creates a new symbol descriptor.
      Parameters:
      id - unique internal id
      displayName - label shown in the palette and tooltips
      category - category label such as "Ground", "Air", or "Support"
      resourcePath - classpath resource path to the icon image
      icon - the cached icon, or null if not yet loaded
  • Method Details

    • getId

      public String getId()
      Returns:
      unique internal symbol identifier
    • getDisplayName

      public String getDisplayName()
      Returns:
      user-facing symbol name
    • getCategory

      public String getCategory()
      Returns:
      palette category containing the symbol
    • getResourcePath

      public String getResourcePath()
      Returns:
      classpath path from which the symbol icon was loaded
    • getIcon

      public ImageIcon getIcon()
      Returns:
      cached symbol icon, which may be null
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Returns:
      the user-facing symbol name
    • fromResourcePath

      public static MilSymbolDescriptor fromResourcePath(String resourcePath, ImageIcon icon)
      Factory method to create a symbol descriptor from a resource path.

      In a real implementation, this would look up the symbol by resource path and return a fully populated descriptor. For this demo, we just create a dummy descriptor with the resource path as the id and display name.

      Parameters:
      resourcePath - the classpath resource path to the icon image
      icon - the icon to associate with the descriptor, or null if not yet loaded
      Returns:
      a symbol descriptor for the given resource path