/** * Draws text for subsequent Label ordered renderables in the ordered renderable list. This method * is called after the text renderer has been set up (after beginRendering has been called), so * this method can only draw text for subsequent labels that use the same font and rotation as * this label. This method differs from {@link #drawBatched(gov.nasa.worldwind.render.DrawContext) * drawBatched} in that this method reuses the active text renderer context to draw as many labels * as possible without switching text renderer state. * * @param dc the current draw context. * @param textRenderer Text renderer used to draw the label. */ protected void drawBatchedText(DrawContext dc, TextRenderer textRenderer) { // 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; boolean sameFont = this.font.equals(nextLabel.getFont()); boolean sameRotation = (this.rotation == null && nextLabel.rotation == null) || (this.rotation != null && this.rotation.equals(nextLabel.rotation)); boolean drawInterior = nextLabel.isDrawInterior(); // We've already set up the text renderer state, so we can can't change the font or text // rotation. // Also can't batch render if the next label needs an interior since that will require // tearing down the // text renderer context. if (!sameFont || !sameRotation || drawInterior) break; dc.pollOrderedRenderables(); // take it off the queue nextLabel.doDrawText(textRenderer); nextItem = dc.peekOrderedRenderables(); } } }