Class MapMilSymbolItem

All Implemented Interfaces:
IFeedbackProvider, IDrawable, EventListener

public class MapMilSymbolItem extends MapPointItem
Map-native military symbol item.

The anchor position is stored geographically as longitude/latitude in radians, so the item stays attached to the same location when the map projection changes. The icon itself is drawn at a fixed pixel size for readability.

Context menu

In addition to the standard ordering/lock items inherited from AItem, the right-click menu includes an Edit Location… entry (after a separator) that opens a LatLongEditorDialog. If the user saves a new position the item is moved there and the map is refreshed; cancelling the dialog leaves the item unchanged.

  • Field Details

    • DEFAULT_DRAW_SIZE

      public static final int DEFAULT_DRAW_SIZE
      Default drawn size in pixels.
      See Also:
  • Constructor Details

    • MapMilSymbolItem

      public MapMilSymbolItem(Layer layer, Point2D.Double location, MilSymbolDescriptor descriptor, ImageIcon icon)
      Creates a new geolocated military symbol item.
      Parameters:
      layer - annotation layer
      location - geographic location in radians (.x=lon, .y=lat)
      descriptor - symbol metadata
      icon - rendered icon image
  • Method Details

    • getDescriptor

      public MilSymbolDescriptor getDescriptor()
      Gets the symbol descriptor.
      Returns:
      descriptor; may be null if none was supplied
    • setDrawSize

      public void setDrawSize(int drawSize)
      Sets the on-screen icon size in pixels.
      Parameters:
      drawSize - new draw size, clamped to at least 8 pixels
    • getDrawSize

      public int getDrawSize()
      Gets the on-screen icon size in pixels.
      Returns:
      draw size
    • drawItem

      public void drawItem(Graphics2D g2, IContainer container)
      Description copied from class: MapPointItem
      Draws the point at its projected screen location.

      The item is not drawn if the focus is unplaced (NaN) or projects to a non-finite coordinate. Icon drawing takes priority over symbol drawing.

      Overrides:
      drawItem in class MapPointItem
      Parameters:
      g2 - the graphics context
      container - the rendering container; must be a MapContainer
    • getBounds

      public Rectangle getBounds(IContainer container)
      Description copied from class: MapPointItem
      Returns the device-space bounding rectangle for this point item.

      For icon items: the rectangle is positioned according to the alignment settings. For symbol items: a square of size style.getSymbolSize() centred on the focus point.

      Returns null if the focus is unplaced or off-map.

      Overrides:
      getBounds in class MapPointItem
      Parameters:
      container - the rendering container
      Returns:
      bounding rectangle in device coordinates, or null
    • contains

      public boolean contains(IContainer container, Point screenPoint)
      Description copied from class: AItem
      Test whether this item, as rendered, contains the given screen point.

      Priority order:

      1. AItem._lastDrawnPolygon — exact hit test.
      2. AItem.getBounds(IContainer) — axis-aligned bounding rectangle.
      3. AItem.inASelectRect(edu.cnu.mdi.container.IContainer, java.awt.Point) — selection/rotation handle rectangles.
      Overrides:
      contains in class AItem
      Parameters:
      container - the container rendering this item
      screenPoint - the pixel point to test
      Returns:
      true if the item contains screenPoint
    • createPopupMenu

      protected JPopupMenu createPopupMenu()
      Builds the popup menu for this item.

      Calls the superclass implementation to get the standard ordering and lock items, then appends a separator followed by an Edit Location… menu item.

      Overrides:
      createPopupMenu in class AItem
      Returns:
      the fully populated popup menu
    • getFeedbackStrings

      public void getFeedbackStrings(IContainer container, Point pp, Point2D.Double wp, List<String> feedbackStrings)
      Populate the feedback string list with information about this item. The default implementation is a no-op.

      Reports the geographic coordinates of this point when the cursor is near it.

      Reports the geographic coordinates of this point when the cursor is near it.

      Specified by:
      getFeedbackStrings in interface IFeedbackProvider
      Overrides:
      getFeedbackStrings in class MapPointItem
      Parameters:
      container - the container rendering this item
      pp - the current mouse position in screen coordinates
      wp - the corresponding world-coordinate position
      feedbackStrings - the list to add strings to