Class AMapItem
- All Implemented Interfaces:
IFeedbackProvider,IDrawable,EventListener
- Direct Known Subclasses:
AMapMultiPointItem,MapLineItem,MapPointItem,MapTextItem
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
- Store geometry in geographic coordinates (radians).
- Override
updateFocus()to keepAItem._focuscurrent. - Override
AItem.drawItem(java.awt.Graphics2D, edu.cnu.mdi.container.IContainer),AItem.shouldDraw(java.awt.Graphics2D, edu.cnu.mdi.container.IContainer),AItem.contains(edu.cnu.mdi.container.IContainer, java.awt.Point),AItem.getBounds(edu.cnu.mdi.container.IContainer), andAItem.translateWorld(double, double)to operate in geographic space.
-
Field Summary
Fields inherited from class edu.cnu.mdi.item.AItem
_connectable, _deletable, _dirty, _displayName, _doubleClickable, _draggable, _enabled, _focus, _FOCUSFILL, _lastDrawnPolygon, _layer, _line, _locked, _modification, _path, _popupMenu, _resizable, _resizePolicy, _rightClickable, _rotatable, _selectable, _selected, _style, _styleEditable, _visible, rotateIcon, RPSIZE, RPSIZE2, SPSIZE, SPSIZE2 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetFocusPoint(IContainer container) Returns the screen-coordinate pixel position of this item's geographic focus point.protected voidHook called when geometry changes and the geographic focus should be recomputed.Methods inherited from class edu.cnu.mdi.item.AItem
acceptModification, applyGeometryProperties, applyProperties, applyStyleProperties, contains, createPopupMenu, doubleClicked, draw, drawItem, drawSelections, enclosed, equals, focusFill, geometryChanged, getAzimuth, getBounds, getContainer, getDisplayName, getFeedbackStrings, getFocus, getItemModification, getLastDrawnPolygon, getLayer, getLine, getPath, getPopupMenu, getResizePolicy, getRotatePoint, getSelectionPoints, getStyle, getStyleSafe, getView, getWorldBounds, hashCode, inASelectRect, inRotatePoint, inSelectPoint, isConnectable, isDeletable, isDirty, isDoubleClickable, isDraggable, isEnabled, isLocked, isResizable, isRightClickable, isRotatable, isSelectable, isSelected, isStyleEditable, isTrackable, isVisible, modificationRejected, modify, prepareForPopup, prepareForRemoval, setAzimuth, setConnectable, setDeletable, setDirty, setDisplayName, setDoubleClickable, setDraggable, setEnabled, setFillFocus, setFocus, setLocked, setModification, setResizable, setResizePolicy, setRightClickable, setRotatable, setSelectable, setSelected, setStyle, setStyleEditable, setVisible, shouldDraw, startModification, stopModification, translateLocal, translateWorld
-
Constructor Details
-
AMapItem
Constructs a new map item on the given layer.- Parameters:
layer- the layer this item belongs to; must not benullkeyVals- optional alternatingPropertyUtilskey/value pairs applied to behavior flags and style
-
-
Method Details
-
getFocusPoint
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 viaBaseContainer.worldToLocal.Returns
nullif:containeris not aMapContainer,- the geographic focus is
null, or - the focus projects to a non-finite coordinate (e.g. behind the globe in an orthographic projection).
- Overrides:
getFocusPointin classAItem- 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._focusfrom the current geometry.- Overrides:
updateFocusin classAItem
-