Class MapMilSymbolItem
- All Implemented Interfaces:
IFeedbackProvider,IDrawable,EventListener
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault drawn size in pixels.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
ConstructorsConstructorDescriptionMapMilSymbolItem(Layer layer, Point2D.Double location, MilSymbolDescriptor descriptor, ImageIcon icon) Creates a new geolocated military symbol item. -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(IContainer container, Point screenPoint) Test whether this item, as rendered, contains the given screen point.protected JPopupMenuBuilds the popup menu for this item.voiddrawItem(Graphics2D g2, IContainer container) Draws the point at its projected screen location.getBounds(IContainer container) Returns the device-space bounding rectangle for this point item.Gets the symbol descriptor.intGets the on-screen icon size in pixels.voidgetFeedbackStrings(IContainer container, Point pp, Point2D.Double wp, List<String> feedbackStrings) Populate the feedback string list with information about this item.voidsetDrawSize(int drawSize) Sets the on-screen icon size in pixels.Methods inherited from class edu.cnu.mdi.mapping.item.MapPointItem
getAlignmentH, getAlignmentV, getWorldBounds, modify, setAlignmentH, setAlignmentV, setFocus, shouldDraw, startModification, translateWorldMethods inherited from class edu.cnu.mdi.mapping.item.AMapItem
getFocusPoint, updateFocusMethods inherited from class edu.cnu.mdi.item.AItem
acceptModification, applyGeometryProperties, applyProperties, applyStyleProperties, doubleClicked, draw, drawSelections, enclosed, equals, focusFill, geometryChanged, getAzimuth, getContainer, getDisplayName, getFocus, getItemModification, getLastDrawnPolygon, getLayer, getLine, getPath, getPopupMenu, getResizePolicy, getRotatePoint, getSelectionPoints, getStyle, getStyleSafe, getView, hashCode, inASelectRect, inRotatePoint, inSelectPoint, isConnectable, isDeletable, isDirty, isDoubleClickable, isDraggable, isEnabled, isLocked, isResizable, isRightClickable, isRotatable, isSelectable, isSelected, isStyleEditable, isTrackable, isVisible, modificationRejected, prepareForPopup, prepareForRemoval, setAzimuth, setConnectable, setDeletable, setDirty, setDisplayName, setDoubleClickable, setDraggable, setEnabled, setFillFocus, setLocked, setModification, setResizable, setResizePolicy, setRightClickable, setRotatable, setSelectable, setSelected, setStyle, setStyleEditable, setVisible, stopModification, translateLocal
-
Field Details
-
DEFAULT_DRAW_SIZE
public static final int DEFAULT_DRAW_SIZEDefault 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 layerlocation- geographic location in radians (.x=lon, .y=lat)descriptor- symbol metadataicon- rendered icon image
-
-
Method Details
-
getDescriptor
Gets the symbol descriptor.- Returns:
- descriptor; may be
nullif 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
Description copied from class:MapPointItemDraws 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:
drawItemin classMapPointItem- Parameters:
g2- the graphics contextcontainer- the rendering container; must be aMapContainer
-
getBounds
Description copied from class:MapPointItemReturns 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
nullif the focus is unplaced or off-map.- Overrides:
getBoundsin classMapPointItem- Parameters:
container- the rendering container- Returns:
- bounding rectangle in device coordinates, or
null
-
contains
Description copied from class:AItemTest whether this item, as rendered, contains the given screen point.Priority order:
AItem._lastDrawnPolygon— exact hit test.AItem.getBounds(IContainer)— axis-aligned bounding rectangle.AItem.inASelectRect(edu.cnu.mdi.container.IContainer, java.awt.Point)— selection/rotation handle rectangles.
-
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:
createPopupMenuin classAItem- 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:
getFeedbackStringsin interfaceIFeedbackProvider- Overrides:
getFeedbackStringsin classMapPointItem- Parameters:
container- the container rendering this itempp- the current mouse position in screen coordinateswp- the corresponding world-coordinate positionfeedbackStrings- the list to add strings to
-