Interface IDrawable
- All Known Implementing Classes:
AItem,AMapItem,AMapMultiPointItem,ConnectorItem,DeviceItem,DrawableAdapter,EllipseItem,GridDrawer,ImageItem,LineItem,MapLineItem,MapMilSymbolItem,MapPointItem,MapPolygonItem,MapPolylineItem,MapTextItem,PathBasedItem,PointItem,PolygonItem,PolylineItem,RadArcItem,RectangleItem,TextItem,VirtualWindowItem
IContainer.
Implementations are typically small, focused drawing helpers such as overlays, annotations, or extra user-supplied graphics that are rendered on top of a view's main content.
-
Method Summary
Modifier and TypeMethodDescriptionvoiddraw(Graphics2D g2, IContainer container) Render this drawable.default StringgetName()Get a human-readable name for this drawable.default booleanWhether this drawable is currently enabled.default booleanWhether this drawable is currently visible.default voidCalled before this drawable is removed from a list or registry.default voidsetDirty(boolean dirty) Mark this drawable as "dirty".default voidsetEnabled(boolean enabled) Set whether this drawable is enabled.default voidsetVisible(boolean visible) Set whether this drawable should be visible.
-
Method Details
-
draw
Render this drawable.- Parameters:
g2- the 2D graphics context to draw with. The caller is responsible for restoring any graphics state (transform, clip, composite, etc.) if needed.container- the container being rendered into; may be used to query coordinate transforms, world bounds, etc.
-
setDirty
default void setDirty(boolean dirty) Mark this drawable as "dirty".Implementations can use this to clear cached pixel-based data (e.g., precomputed polygons) so they will be recomputed on the next draw. The default implementation does nothing.
- Parameters:
dirty-trueif cached data should be considered invalid.
-
prepareForRemoval
default void prepareForRemoval()Called before this drawable is removed from a list or registry.Implementations can use this to release resources or unregister listeners. The default implementation does nothing.
-
isVisible
default boolean isVisible()Whether this drawable is currently visible.Callers should respect this flag and skip drawing when it returns
false. Default istrue.- Returns:
trueif the object should be rendered;falseotherwise.
-
setVisible
default void setVisible(boolean visible) Set whether this drawable should be visible.The default implementation ignores the flag. Implementations that track visibility should override this together with
isVisible().- Parameters:
visible- the new visibility state.
-
isEnabled
default boolean isEnabled()Whether this drawable is currently enabled."Enabled" can be used by callers to decide, for example, whether to process interaction or feedback for this drawable. Default is
true.- Returns:
trueif the object is enabled;falseotherwise.
-
setEnabled
default void setEnabled(boolean enabled) Set whether this drawable is enabled.The default implementation ignores the flag. Implementations that track enabled state should override this together with
isEnabled().- Parameters:
enabled- the new enabled state.
-
getName
Get a human-readable name for this drawable.The name can be used in visibility tables, debug logs, or UI lists. The default implementation returns this class's simple name.
- Returns:
- the name of the drawable.
-