diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/IGraphicsTarget.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/IGraphicsTarget.java index b7e3285ee1..115183b8c7 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/IGraphicsTarget.java +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/IGraphicsTarget.java @@ -79,7 +79,7 @@ public interface IGraphicsTarget extends IImagingExtension { /** Defines text characteristics */ public static enum TextStyle { - NORMAL, BLANKED, BOXED, WORD_WRAP, DROP_SHADOW, OUTLINE + NORMAL, BLANKED, BOXED, WORD_WRAP, DROP_SHADOW, OUTLINE, UNDERLINE, OVERLINE, STRIKETHROUGH; }; /** diff --git a/cave/com.raytheon.viz.core.gl/src/com/raytheon/viz/core/gl/internal/GLTarget.java b/cave/com.raytheon.viz.core.gl/src/com/raytheon/viz/core/gl/internal/GLTarget.java index 010c6c9819..b9b03e7f5e 100644 --- a/cave/com.raytheon.viz.core.gl/src/com/raytheon/viz/core/gl/internal/GLTarget.java +++ b/cave/com.raytheon.viz.core.gl/src/com/raytheon/viz/core/gl/internal/GLTarget.java @@ -1854,9 +1854,12 @@ public class GLTarget extends AbstractGraphicsTarget implements IGLTarget { // This loop just draws the box or a blank rectangle. for (DrawableString dString : parameters) { - float[] rotatedPoint = null; - if (dString.textStyle == TextStyle.BOXED - || dString.textStyle == TextStyle.BLANKED) { + switch (dString.textStyle) { + case BOXED: + case BLANKED: + case UNDERLINE: + case OVERLINE: + case STRIKETHROUGH: double yPos = dString.basics.y; VerticalAlignment verticalAlignment = dString.verticallAlignment; double fontPercentage = this @@ -1874,6 +1877,7 @@ public class GLTarget extends AbstractGraphicsTarget implements IGLTarget { double scaleX = stringScaleX; double scaleY = stringScaleY; + float[] rotatedPoint = null; if (dString.rotation != 0.0) { rotatedPoint = getUpdatedCoordinates( new java.awt.Rectangle(0, 0, 0, 0), @@ -1897,18 +1901,6 @@ public class GLTarget extends AbstractGraphicsTarget implements IGLTarget { dString.basics.x, yPos, dString.basics.z, dString.rotation, fontPercentage); - gl.glPolygonMode(GL.GL_BACK, GL.GL_FILL); - if (dString.textStyle == TextStyle.BOXED - && dString.boxColor != null) { - gl.glColor4d(dString.boxColor.red / 255.0, - dString.boxColor.green / 255.0, - dString.boxColor.blue / 255.0, alpha); - } else { - gl.glColor4d(backgroundColor.red / 255.0, - backgroundColor.green / 255.0, - backgroundColor.blue / 255.0, alpha); - } - double width = textBounds.getWidth(); double height = textBounds.getHeight(); double diff = height + textBounds.getY(); @@ -1918,38 +1910,78 @@ public class GLTarget extends AbstractGraphicsTarget implements IGLTarget { double x2 = xy[0] + width + scaleX; double y2 = (xy[1] - diff) + height + scaleY; - gl.glRectd(x1, y2, x2, y1); + if (dString.textStyle == TextStyle.BOXED + || dString.textStyle == TextStyle.BLANKED) { + gl.glPolygonMode(GL.GL_BACK, GL.GL_FILL); + if (dString.textStyle == TextStyle.BOXED + && dString.boxColor != null) { + gl.glColor4d(dString.boxColor.red / 255.0, + dString.boxColor.green / 255.0, + dString.boxColor.blue / 255.0, alpha); + } else { + gl.glColor4d(backgroundColor.red / 255.0, + backgroundColor.green / 255.0, + backgroundColor.blue / 255.0, alpha); + } + + gl.glRectd(x1, y2, x2, y1); + } + + if (dString.textStyle == TextStyle.BOXED + || dString.textStyle == TextStyle.UNDERLINE + || dString.textStyle == TextStyle.OVERLINE + || dString.textStyle == TextStyle.STRIKETHROUGH) { + gl.glPolygonMode(GL.GL_BACK, GL.GL_LINE); - if (dString.textStyle == TextStyle.BOXED) { RGB color = dString.getColors()[c]; if (color == null) { color = DEFAULT_LABEL_COLOR; } - gl.glPolygonMode(GL.GL_BACK, GL.GL_LINE); gl.glColor4d(color.red / 255.0, color.green / 255.0, color.blue / 255.0, alpha); - gl.glLineWidth(2); - gl.glRectd(x1, y2, x2, y1); + if (dString.textStyle == TextStyle.BOXED) { + gl.glLineWidth(2); + gl.glRectd(x1, y2, x2, y1); + } else { + gl.glLineWidth(1); + double percent; + if (dString.textStyle == TextStyle.UNDERLINE) { + percent = .2; + } else if (dString.textStyle == TextStyle.OVERLINE) { + percent = 1.; + } else { // TextStyle.STRIKETHROUGH + percent = .5; + } + double lineY = y1 + (y2 - y1) * percent; + gl.glBegin(GL.GL_LINES); + gl.glVertex2d(x1, lineY); + gl.glVertex2d(x2, lineY); + gl.glEnd(); + } } - gl.glPolygonMode(GL.GL_BACK, GL.GL_FILL); if (verticalAlignment == VerticalAlignment.TOP) { yPos += textBounds.getHeight(); } else { yPos -= textBounds.getHeight(); - } } - } - if (rotatedPoint != null) { - gl.glTranslated(rotatedPoint[0], rotatedPoint[1], 0.0); - gl.glRotated(-dString.rotation, 0.0, 0.0, 1.0); - gl.glTranslated(-rotatedPoint[0], -rotatedPoint[1], 0.0); + if (rotatedPoint != null) { + gl.glTranslated(rotatedPoint[0], rotatedPoint[1], 0.0); + gl.glRotated(-dString.rotation, 0.0, 0.0, 1.0); + gl.glTranslated(-rotatedPoint[0], -rotatedPoint[1], 0.0); + } + break; + default: + break; } } + + gl.glPolygonMode(GL.GL_BACK, GL.GL_FILL); + IFont font = null; double magnification = -1.0; double fontPercentage = -1.0;