Class AMapItem

java.lang.Object
edu.cnu.mdi.item.AItem
edu.cnu.mdi.mapping.item.AMapItem
All Implemented Interfaces:
IFeedbackProvider, IDrawable, EventListener
Direct Known Subclasses:
AMapMultiPointItem, MapLineItem, MapPointItem, MapTextItem

public abstract class AMapItem extends AItem
Abstract base class for map-native items whose geometry is stored in geographic coordinates (longitude/latitude in radians) rather than in the container's affine-transform world coordinate system.

Coordinate convention

All geographic points follow the MDI mapping convention: a Point2D.Double where x = λ (longitude) and y = φ (latitude), both in radians. Longitude is wrapped to the half-open range (-π, π].

Focus semantics

The AItem._focus field inherited from AItem is repurposed to hold a geographic point rather than a world (projection-space) point. Subclasses are responsible for keeping _focus updated (typically in updateFocus()) to a meaningful geographic reference point such as the arc midpoint or the polygon centroid.

Screen-space focus

getFocusPoint(IContainer) is overridden to convert the geographic focus through the active map projection rather than through the container's plain affine transform. If the container is not a MapContainer, or if the geographic focus projects to a non-finite point (e.g. the far hemisphere on an orthographic projection), the method returns null.

Subclass responsibilities

  • Constructor Details

    • AMapItem

      public AMapItem(Layer layer, Object... keyVals)
      Constructs a new map item on the given layer.
      Parameters:
      layer - the layer this item belongs to; must not be null
      keyVals - optional alternating PropertyUtils key/value pairs applied to behavior flags and style
  • Method Details

    • getFocusPoint

      public Point getFocusPoint(IContainer container)
      Returns the screen-coordinate pixel position of this item's geographic focus point.

      The conversion path is: geographic focus → projection-space (x, y) via the active IMapProjection → device pixels via BaseContainer.worldToLocal.

      Returns null if:

      • container is not a MapContainer,
      • the geographic focus is null, or
      • the focus projects to a non-finite coordinate (e.g. behind the globe in an orthographic projection).

      Overrides:
      getFocusPoint in class AItem
      Parameters:
      container - the container rendering this item
      Returns:
      the device-space focus position, or null
    • updateFocus

      protected void updateFocus()
      Hook called when geometry changes and the geographic focus should be recomputed.

      The default implementation is a no-op. Subclasses that maintain a derived focus (e.g. the geodesic midpoint of a great-circle arc, or the geographic centroid of a polygon) should override this to recompute AItem._focus from the current geometry.

      Overrides:
      updateFocus in class AItem