addOverlay method

void addOverlay(
  1. Imagery imagery
)

Adds an overlay layer. You only need to specify the Imagery.id and Imagery.buildLayer, but also set the Imagery.overlay to true. For plugins, it would make sense to either use the metadata static file, or to instantiate ExtOverlay.

Unlike the specific mode-bound overlays, those appear everywhere, even in map-opening fields. If you want to add an overlay just to the main map, see PluginEvents.onModeCreated and BaseModeDefinition.addOverlay.

Implementation

void addOverlay(Imagery imagery) {
  if (!imagery.overlay) {
    throw ArgumentError("Imagery should be an overlay");
  }
}