Пример #1
0
  /**
   * Draws this ordered renderable and all subsequent Label ordered renderables in the ordered
   * renderable list. This method differs from {@link
   * #drawBatchedText(gov.nasa.worldwind.render.DrawContext, TextRenderer) drawBatchedText} in that
   * this method re-initializes the text renderer to draw the next label, while {@code
   * drawBatchedText} re-uses the active text renderer context. That is, {@code drawBatchedText}
   * attempts to draw as many labels as possible that share same text renderer configuration as this
   * label, and this method attempts to draw as many labels as possible regardless of the text
   * renderer configuration of the subsequent labels.
   *
   * @param dc the current draw context.
   */
  protected void drawBatched(DrawContext dc) {
    // Draw as many as we can in a batch to save ogl state switching.
    Object nextItem = dc.peekOrderedRenderables();

    if (!dc.isPickingMode()) {
      while (nextItem != null && nextItem instanceof TacticalGraphicLabel) {
        TacticalGraphicLabel nextLabel = (TacticalGraphicLabel) nextItem;
        if (!nextLabel.isEnableBatchRendering()) break;

        dc.pollOrderedRenderables(); // take it off the queue
        nextLabel.doDrawOrderedRenderable(dc, this.pickSupport);

        nextItem = dc.peekOrderedRenderables();
      }
    } else if (this.isEnableBatchPicking()) {
      while (nextItem != null && nextItem instanceof TacticalGraphicLabel) {
        TacticalGraphicLabel nextLabel = (TacticalGraphicLabel) nextItem;
        if (!nextLabel.isEnableBatchRendering() || !nextLabel.isEnableBatchPicking()) break;

        if (nextLabel.pickLayer != this.pickLayer) // batch pick only within a single layer
        break;

        dc.pollOrderedRenderables(); // take it off the queue
        nextLabel.doDrawOrderedRenderable(dc, this.pickSupport);

        nextItem = dc.peekOrderedRenderables();
      }
    }
  }