Package edu.cnu.mdi.mapping.milsym
Class MilSymbolDescriptor
java.lang.Object
edu.cnu.mdi.mapping.milsym.MilSymbolDescriptor
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MilSymbolDescriptorfromResourcePath(String resourcePath, ImageIcon icon) Factory method to create a symbol descriptor from a resource path.getIcon()getId()toString()
-
Constructor Details
-
MilSymbolDescriptor
public MilSymbolDescriptor(String id, String displayName, String category, String resourcePath, ImageIcon icon) Creates a new symbol descriptor.- Parameters:
id- unique internal iddisplayName- label shown in the palette and tooltipscategory- category label such as "Ground", "Air", or "Support"resourcePath- classpath resource path to the icon imageicon- the cached icon, ornullif not yet loaded
-
-
Method Details
-
getId
- Returns:
- unique internal symbol identifier
-
getDisplayName
- Returns:
- user-facing symbol name
-
getCategory
- Returns:
- palette category containing the symbol
-
getResourcePath
- Returns:
- classpath path from which the symbol icon was loaded
-
getIcon
- Returns:
- cached symbol icon, which may be
null
-
toString
-
fromResourcePath
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 imageicon- the icon to associate with the descriptor, ornullif not yet loaded- Returns:
- a symbol descriptor for the given resource path
-