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

public interface IDrawable
A drawable object that can render itself into a 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 Type
    Method
    Description
    void
    draw(Graphics2D g2, IContainer container)
    Render this drawable.
    default String
    Get a human-readable name for this drawable.
    default boolean
    Whether this drawable is currently enabled.
    default boolean
    Whether this drawable is currently visible.
    default void
    Called before this drawable is removed from a list or registry.
    default void
    setDirty(boolean dirty)
    Mark this drawable as "dirty".
    default void
    setEnabled(boolean enabled)
    Set whether this drawable is enabled.
    default void
    setVisible(boolean visible)
    Set whether this drawable should be visible.
  • Method Details

    • draw

      void draw(Graphics2D g2, IContainer container)
      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 - true if 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 is true.

      Returns:
      true if the object should be rendered; false otherwise.
    • 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:
      true if the object is enabled; false otherwise.
    • 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

      default String 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.