Exemplo n.º 1
0
  /*
   * (non-Javadoc)
   *
   * @see pt.up.fe.dceg.neptus.consolebase.SubPanelChangeListener#subPanelChanged(pt.up.fe.dceg.neptus.consolebase.
   * SubPanelChangeEvent)
   */
  @Override
  public void subPanelChanged(SubPanelChangeEvent panelChange) {

    if (panelChange == null) return;

    renderersPopups = getConsole().getSubPanelsOfInterface(IMapPopup.class);

    if (ReflectionUtil.hasInterface(panelChange.getPanel().getClass(), IMapPopup.class)) {

      IMapPopup sub = (IMapPopup) panelChange.getPanel();

      if (panelChange.added()) {
        renderersPopups.add(sub);
        IMapPopup str2d = sub;
        if (str2d != null) {
          str2d.addMenuExtension(this);
        }
      }

      if (panelChange.removed()) {
        renderersPopups.remove(sub);
        IMapPopup str2d = sub;
        if (str2d != null) {
          str2d.removeMenuExtension(this);
        }
      }
    }

    if (ReflectionUtil.hasInterface(panelChange.getPanel().getClass(), ILayerPainter.class)) {

      ILayerPainter sub = (ILayerPainter) panelChange.getPanel();

      if (panelChange.added()) {
        renderers.add(sub);
        ILayerPainter str2d = sub;
        if (str2d != null) {
          str2d.addPostRenderPainter(this, "My location");
        }
      }

      if (panelChange.removed()) {
        renderers.remove(sub);
        ILayerPainter str2d = sub;
        if (str2d != null) {
          str2d.removePostRenderPainter(this);
        }
      }
    }
  }
Exemplo n.º 2
0
  /**
   * Remove all painters which extend the given class
   *
   * @param c The class / superclass of the painters to be removed
   */
  public void removePaintersOfType(Class<?> c) {
    Vector<String> namesToRemove = new Vector<String>();
    for (String name : paintersByName.keySet()) {
      if (ReflectionUtil.isSubclass(paintersByName.get(name).getClass(), c))
        namesToRemove.add(name);
    }

    for (String name : namesToRemove) removePainter(name);
  }