Omaha #3429 Replace Raytheon plugin calls to deprecated IGraphicsTarget.drawLine()

Change-Id: I9de68a9a047a2d6c3744b29de292efb7cfb44bbf

Former-commit-id: a222b29ff24bf81d1c8aefd54fa33f52461c9c25
This commit is contained in:
Mark Peters 2014-07-25 09:53:23 -05:00
parent a20ba0ba14
commit 437e127ebc
25 changed files with 673 additions and 952 deletions

View file

@ -23,6 +23,7 @@ import java.util.Formatter;
import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.graphics.RGB;
import com.raytheon.uf.viz.core.DrawableLine;
import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.map.MapDescriptor; import com.raytheon.uf.viz.core.map.MapDescriptor;
@ -38,7 +39,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 09/25/2009 jsanchez Initial creation. * 09/25/2009 jsanchez Initial creation.
* * 07/24/2014 3429 mapeters Updated deprecated drawLine() calls.
* *
* </pre> * </pre>
* *
@ -79,13 +80,15 @@ public class SigWxCommon {
Double length, Double dir, RGB color) throws VizException { Double length, Double dir, RGB color) throws VizException {
double[] pointPixel = target.getPointOnCircle(center[0], center[1], double[] pointPixel = target.getPointOnCircle(center[0], center[1],
center[2], length, dir + 210); center[2], length, dir + 210);
target.drawLine(pointPixel[0], pointPixel[1], pointPixel[2], DrawableLine line = new DrawableLine();
center[0], line.setCoordinates(pointPixel[0], pointPixel[1], pointPixel[2]);
center[1], center[2], color, 1.5f); line.addPoint(center[0], center[1], center[2]);
pointPixel = target.getPointOnCircle(center[0], center[1], center[2], double[] pointPixel2 = target.getPointOnCircle(center[0], center[1],
center[2],
length, dir + 150); length, dir + 150);
target.drawLine(pointPixel[0], pointPixel[1], pointPixel[2], line.addPoint(pointPixel2[0], pointPixel2[1], pointPixel2[2]);
center[0], line.basics.color = color;
center[1], center[2], color, 1.5f); line.width = 1.5f;
target.drawLine(line);
} }
} }

View file

@ -66,6 +66,7 @@ import com.vividsolutions.jts.geom.Point;
* Apr 22, 2013 1926 njensen Faster rendering * Apr 22, 2013 1926 njensen Faster rendering
* May 09, 2014 3145 mpduff Add getter for font so it can be disposed, javadoc fix * May 09, 2014 3145 mpduff Add getter for font so it can be disposed, javadoc fix
* Jul 22, 2014 3422 mapeters Updated deprecated drawArc() call. * Jul 22, 2014 3422 mapeters Updated deprecated drawArc() call.
* Jul 23, 2014 3429 mapeters Updated deprecated drawLine() call.
* </pre> * </pre>
* *
* @author dhladky * @author dhladky
@ -74,9 +75,7 @@ import com.vividsolutions.jts.geom.Point;
public class ScanDrawer { public class ScanDrawer {
private static final int HEX_ANGLE = 60; private static final double SIN_HEX_ANGLE = Math.sin(60);
private static final double SIN_HEX_ANGLE = Math.sin(HEX_ANGLE);
public static final RGB red = new RGB(255, 0, 0); public static final RGB red = new RGB(255, 0, 0);
@ -394,18 +393,37 @@ public class ScanDrawer {
circle.lineWidth = outlineWidth * 4; circle.lineWidth = outlineWidth * 4;
aTarget.drawCircle(circle); aTarget.drawCircle(circle);
} }
DrawableLine[] lines = new DrawableLine[4];
// top spike // top spike
aTarget.drawLine(center[0], topY, 0.0, center[0], topY - size, lines[0] = new DrawableLine();
0.0, getResourceColor(), outlineWidth * 4); lines[0].setCoordinates(center[0], topY);
lines[0].addPoint(center[0], topY - size);
lines[0].basics.color = getResourceColor();
lines[0].width = outlineWidth * 4;
// bottom spike // bottom spike
aTarget.drawLine(center[0], bottomY, 0.0, center[0], bottomY lines[1] = new DrawableLine();
+ size, 0.0, getResourceColor(), outlineWidth * 4); lines[1].setCoordinates(center[0], bottomY);
lines[1].addPoint(center[0], bottomY + size);
lines[1].basics.color = getResourceColor();
lines[1].width = outlineWidth * 4;
// right spike // right spike
aTarget.drawLine(wRightX, center[1], 0.0, wRightX + size, lines[2] = new DrawableLine();
center[1], 0.0, getResourceColor(), outlineWidth * 4); lines[2].setCoordinates(wRightX, center[1]);
lines[2].addPoint(wRightX + size, center[1]);
lines[2].basics.color = getResourceColor();
lines[2].width = outlineWidth * 4;
// left spike // left spike
aTarget.drawLine(wLeftX, center[1], 0.0, wLeftX - size, lines[3] = new DrawableLine();
center[1], 0.0, getResourceColor(), outlineWidth * 4); lines[3].setCoordinates(wLeftX, center[1]);
lines[3].addPoint(wLeftX - size, center[1]);
lines[3].basics.color = getResourceColor();
lines[3].width = outlineWidth * 4;
aTarget.drawLine(lines);
} }
double zoomLevel = this.descriptor.getRenderableDisplay().getZoom(); double zoomLevel = this.descriptor.getRenderableDisplay().getZoom();
@ -472,9 +490,14 @@ public class ScanDrawer {
dir, totalLength / 1.25); dir, totalLength / 1.25);
// draw it // draw it
if (sdc.getArrowMode()) { DrawableLine[] lines = null;
aTarget.drawLine(center[0], center[1], 0, end[0], end[1], 0, DrawableLine line = null;
getColor(), outlineWidth); int size;
if (sdc.getArrowMode()) {
line = new DrawableLine();
line.setCoordinates(center[0], center[1]);
line.addPoint(end[0], end[1]);
line.basics.color = getColor();
} else { } else {
// Find the intersection to use instead of the center point. // Find the intersection to use instead of the center point.
Point intersectPoint = null; Point intersectPoint = null;
@ -509,16 +532,28 @@ public class ScanDrawer {
totalLength / 1.25); totalLength / 1.25);
labelEnd = getPixelRelativeCoordinate(intersectPoint, labelEnd = getPixelRelativeCoordinate(intersectPoint,
totalLength + 1, dir); totalLength + 1, dir);
size = ears.size();
lines = new DrawableLine[size + 1];
lines[size] = new DrawableLine();
lines[size].setCoordinates(end[0], end[1]);
lines[size].addPoint(intersect[0], intersect[1]);
lines[size].addPoint(center[0], center[1]);
lines[size].basics.color = getColor();
aTarget.drawLine(intersect[0], intersect[1], 0, end[0], end[1],
0, getColor(), outlineWidth);
aTarget.drawLine(center[0], center[1], 0, intersect[0],
intersect[1], 0, getColor(), outlineWidth);
} }
for (double[] ear : ears) { size = ears.size();
aTarget.drawLine(end[0], end[1], 0, ear[0], ear[1], 0, if(lines == null) {
getColor(), outlineWidth); lines = new DrawableLine[size + 1];
lines[size] = line;
} }
for (int i = 0; i < size; i++) {
lines[i] = new DrawableLine();
lines[i].setCoordinates(end[0], end[1]);
lines[i].addPoint(ears.get(i)[0], ears.get(i)[1]);
lines[i].basics.color = getColor();
}
aTarget.drawLine(lines);
drawArrowLabel(labelEnd[0], labelEnd[1], drawArrowLabel(labelEnd[0], labelEnd[1],
new Integer((int) speed).toString()); new Integer((int) speed).toString());
@ -909,13 +944,15 @@ public class ScanDrawer {
*/ */
public void drawDMDTrack(DMDTableDataRow dtdr) throws VizException { public void drawDMDTrack(DMDTableDataRow dtdr) throws VizException {
List<DrawableLine> lines = new ArrayList<DrawableLine>();
if ((dtdr.getFcstLat() != null) && (dtdr.getFcstLon() != null)) { if ((dtdr.getFcstLat() != null) && (dtdr.getFcstLon() != null)) {
double[] futurePoint = null; double[] futurePoint = null;
double[] pastPoint = null; double[] pastPoint = null;
int count = Math.min(dtdr.getFcstLon().size(), dtdr.getFcstLat() int count = Math.min(dtdr.getFcstLon().size(), dtdr.getFcstLat()
.size()); .size());
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
futurePoint = descriptor.worldToPixel(new double[] { futurePoint = descriptor.worldToPixel(new double[] {
dtdr.getFcstLon().get(i), dtdr.getFcstLat().get(i) }); dtdr.getFcstLon().get(i), dtdr.getFcstLat().get(i) });
@ -924,9 +961,12 @@ public class ScanDrawer {
pastPoint = center; pastPoint = center;
} }
aTarget.drawLine(pastPoint[0], pastPoint[1], 0.0, DrawableLine line = new DrawableLine();
futurePoint[0], futurePoint[1], 0.0, line.setCoordinates(pastPoint[0], pastPoint[1]);
getResourceColor(), outlineWidth); line.addPoint(futurePoint[0], futurePoint[1]);
line.basics.color = getResourceColor();
lines.add(line);
drawPlus(futurePoint, getResourceColor()); drawPlus(futurePoint, getResourceColor());
pastPoint = futurePoint; pastPoint = futurePoint;
} }
@ -938,7 +978,7 @@ public class ScanDrawer {
double[] pastPoint = null; double[] pastPoint = null;
int count = Math.min(dtdr.getPastLon().size(), dtdr.getPastLat() int count = Math.min(dtdr.getPastLon().size(), dtdr.getPastLat()
.size()); .size());
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
try { try {
futurePoint = descriptor futurePoint = descriptor
@ -949,10 +989,13 @@ public class ScanDrawer {
if (pastPoint == null) { if (pastPoint == null) {
pastPoint = center; pastPoint = center;
} }
DrawableLine line = new DrawableLine();
line.setCoordinates(pastPoint[0], pastPoint[1]);
line.addPoint(futurePoint[0], futurePoint[1]);
line.basics.color = getResourceColor();
lines.add(line);
aTarget.drawLine(pastPoint[0], pastPoint[1], 0.0,
futurePoint[0], futurePoint[1], 0.0,
getResourceColor(), outlineWidth);
drawFilledCircle(futurePoint, getResourceColor()); drawFilledCircle(futurePoint, getResourceColor());
pastPoint = futurePoint; pastPoint = futurePoint;
} catch (Exception e) { } catch (Exception e) {
@ -960,6 +1003,7 @@ public class ScanDrawer {
} }
} }
} }
aTarget.drawLine(lines.toArray(new DrawableLine[0]));
} }
public void drawCellTrack(CellTableDataRow ctdr) throws VizException { public void drawCellTrack(CellTableDataRow ctdr) throws VizException {
@ -1056,35 +1100,19 @@ public class ScanDrawer {
*/ */
public void drawPlus(double[] point, RGB color) throws VizException { public void drawPlus(double[] point, RGB color) throws VizException {
// bottom to top // bottom to top
aTarget.drawLine(point[0], (point[1] - 4.0 / screenToWorldRatio), 0.0, DrawableLine[] lines = new DrawableLine[2];
point[0], (point[1] + 4.0 / screenToWorldRatio), 0.0, color, lines[0] = new DrawableLine();
outlineWidth); lines[0].setCoordinates(point[0], (point[1] - 4.0 / screenToWorldRatio));
lines[0].addPoint(point[0], (point[1] + 4.0 / screenToWorldRatio));
lines[0].basics.color = color;
// left to right // left to right
aTarget.drawLine((point[0] - 4.0 / screenToWorldRatio), point[1], 0.0, lines[1] = new DrawableLine();
(point[0] + 4.0 / screenToWorldRatio), point[1], 0.0, color, lines[1].setCoordinates((point[0] - 4.0 / screenToWorldRatio), point[1]);
outlineWidth); lines[1].addPoint((point[0] + 4.0 / screenToWorldRatio), point[1]);
lines[1].basics.color = color;
} aTarget.drawLine(lines);
/**
* draws the X sign
*
* @param point
* @throws VizException
*/
public void drawX(double[] point) throws VizException {
// uppe left to lower right
aTarget.drawLine((point[0] - 4.0 / screenToWorldRatio),
(point[1] + 4.0 / screenToWorldRatio), 0.0,
(point[0] + 4.0 / screenToWorldRatio),
(point[1] - 4.0 / screenToWorldRatio), 0.0, getResourceColor(),
outlineWidth);
// lower left to upper right
aTarget.drawLine((point[0] - 4.0 / screenToWorldRatio),
(point[1] - 4.0 / screenToWorldRatio), 0.0,
(point[0] + 4.0 / screenToWorldRatio),
(point[1] + 4.0 / screenToWorldRatio), 0.0, getResourceColor(),
outlineWidth);
} }
/** /**

View file

@ -33,6 +33,7 @@ import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintTyp
import com.raytheon.uf.common.pointdata.PointDataContainer; import com.raytheon.uf.common.pointdata.PointDataContainer;
import com.raytheon.uf.common.pointdata.PointDataView; import com.raytheon.uf.common.pointdata.PointDataView;
import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.DrawableLine;
import com.raytheon.uf.viz.core.DrawableString; import com.raytheon.uf.viz.core.DrawableString;
import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.IGraphicsTarget.HorizontalAlignment; import com.raytheon.uf.viz.core.IGraphicsTarget.HorizontalAlignment;
@ -53,6 +54,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Sep 16, 2009 bsteffen Initial creation * Sep 16, 2009 bsteffen Initial creation
* Jul 24, 2014 3429 mapeters Updated deprecated drawLine() calls.
* *
* </pre> * </pre>
* *
@ -156,9 +158,13 @@ public class NcwfMovementResource extends
// Draw the tops string // Draw the tops string
target.drawStrings(topStr); target.drawStrings(topStr);
// Draw the body of the arrow // Draw the body of the arrow
target.drawLine(centerPixel[0], centerPixel[1], centerPixel[2], DrawableLine line = new DrawableLine();
or_centerPixel[0], or_centerPixel[1], or_centerPixel[2], line.setCoordinates(centerPixel[0], centerPixel[1], centerPixel[2]);
color, 1.5f); line.addPoint(or_centerPixel[0], or_centerPixel[1], or_centerPixel[2]);
line.basics.color = color;
line.width = 1.5f;
target.drawLine(line);
// Draw the wind speed string // Draw the wind speed string
target.drawStrings(spdStr); target.drawStrings(spdStr);
@ -169,12 +175,17 @@ public class NcwfMovementResource extends
Double length, Double dir, RGB color) throws VizException { Double length, Double dir, RGB color) throws VizException {
double[] pointPixel = target.getPointOnCircle(center[0], center[1], double[] pointPixel = target.getPointOnCircle(center[0], center[1],
center[2], length, dir + 210); center[2], length, dir + 210);
target.drawLine(pointPixel[0], pointPixel[1], pointPixel[2], center[0],
center[1], center[2], color, 1.5f); DrawableLine line = new DrawableLine();
line = new DrawableLine();
line.setCoordinates(pointPixel[0], pointPixel[1], pointPixel[2]);
line.addPoint(center[0], center[1], center[2]);
pointPixel = target.getPointOnCircle(center[0], center[1], center[2], pointPixel = target.getPointOnCircle(center[0], center[1], center[2],
length, dir + 150); length, dir + 150);
target.drawLine(pointPixel[0], pointPixel[1], pointPixel[2], center[0], line.addPoint(pointPixel[0], pointPixel[1], pointPixel[2]);
center[1], center[2], color, 1.5f); line.basics.color = color;
line.width = 1.5f;
target.drawLine(line);
} }
private void updateRecords(DataTime displayedDataTime) throws VizException { private void updateRecords(DataTime displayedDataTime) throws VizException {

View file

@ -37,9 +37,12 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.DrawableLine;
import com.raytheon.uf.viz.core.DrawableString; import com.raytheon.uf.viz.core.DrawableString;
import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.IGraphicsTarget.HorizontalAlignment;
import com.raytheon.uf.viz.core.IGraphicsTarget.TextStyle; import com.raytheon.uf.viz.core.IGraphicsTarget.TextStyle;
import com.raytheon.uf.viz.core.IGraphicsTarget.VerticalAlignment;
import com.raytheon.uf.viz.core.PixelCoverage; import com.raytheon.uf.viz.core.PixelCoverage;
import com.raytheon.uf.viz.core.drawables.ColorMapLoader; import com.raytheon.uf.viz.core.drawables.ColorMapLoader;
import com.raytheon.uf.viz.core.drawables.IFont; import com.raytheon.uf.viz.core.drawables.IFont;
@ -75,7 +78,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* AWIPS2 DR Work * AWIPS2 DR Work
* 08/10/2012 1035 jkorman Changed number of 'staffs' from 12 to 13 and changed time * 08/10/2012 1035 jkorman Changed number of 'staffs' from 12 to 13 and changed time
* display to match AWIPS I. * display to match AWIPS I.
* 08/13/2012 1046 jkorman Changed to load colorMap file. * 08/13/2012 1046 jkorman Changed to load colorMap file.
* 07/25/2014 3429 mapeters Updated deprecated drawLine() calls.
* </pre> * </pre>
* *
* @author dhladky * @author dhladky
@ -447,55 +451,67 @@ public class ProfilerResource extends
public void drawXAxis(PaintProperties paintProps, Double magnification) public void drawXAxis(PaintProperties paintProps, Double magnification)
throws VizException { throws VizException {
// left edge of graph // left edge of graph
target.drawLine( DrawableLine[] lines = new DrawableLine[2];
ProfilerUtils.profilerRectangle.x, lines[0] = new DrawableLine();
(ProfilerUtils.profilerRectangle.y + ProfilerUtils.profilerRectangle.height), lines[0].setCoordinates(ProfilerUtils.profilerRectangle.x,
0.0, ProfilerUtils.profilerRectangle.x, (ProfilerUtils.profilerRectangle.y + ProfilerUtils.profilerRectangle.height));
ProfilerUtils.profilerRectangle.y, 0.0, lines[0].addPoint(ProfilerUtils.profilerRectangle.x,
ProfilerUtils.GRAPH_COLOR, ProfilerUtils.GRAPH_LINE_WIDTH, ProfilerUtils.profilerRectangle.y);
IGraphicsTarget.LineStyle.SOLID); lines[0].basics.color = ProfilerUtils.GRAPH_COLOR;
lines[0].width = ProfilerUtils.GRAPH_LINE_WIDTH;
DrawableString[] parameters = null;
if (paintProps.getDataTime() != null) { if (paintProps.getDataTime() != null) {
DrawableString parameters = new DrawableString("", parameters = new DrawableString[NUM_PROFILE_STAFFS];
ProfilerUtils.GRAPH_COLOR);
parameters.textStyle = TextStyle.BLANKED; VerticalAlignment verticalAlignment = IGraphicsTarget.VerticalAlignment.MIDDLE;
parameters.font = font; double y = ProfilerUtils.profilerRectangle.y
parameters.horizontalAlignment = IGraphicsTarget.HorizontalAlignment.CENTER;
parameters.verticallAlignment = IGraphicsTarget.VerticalAlignment.MIDDLE;
parameters.basics.y = ProfilerUtils.profilerRectangle.y
+ ProfilerUtils.profilerRectangle.height + ProfilerUtils.profilerRectangle.height
+ ProfilerUtils.LABEL_OFFSET; + ProfilerUtils.LABEL_OFFSET;
parameters.magnification = magnification;
double maxY = paintProps.getView().getExtent().getMaxY();
Rectangle2D rect = target.getStringsBounds(parameters);
if (parameters.basics.y + (rect.getHeight() / 2) > maxY) {
parameters.basics.y = maxY;
parameters.verticallAlignment = IGraphicsTarget.VerticalAlignment.BOTTOM;
}
Calendar c = paintProps.getDataTime().getValidTime(); Calendar c = paintProps.getDataTime().getValidTime();
for (int i = 0; i < NUM_PROFILE_STAFFS; i++) { for (int i = 0; i < NUM_PROFILE_STAFFS; i++) {
// String d = String.format("%1$tH:%1$tM", c); parameters[i] = new DrawableString("",
ProfilerUtils.GRAPH_COLOR);
parameters[i].textStyle = TextStyle.BLANKED;
parameters[i].font = font;
parameters[i].horizontalAlignment = IGraphicsTarget.HorizontalAlignment.CENTER;
parameters[i].verticallAlignment = verticalAlignment;
parameters[i].basics.y = y;
parameters[i].magnification = magnification;
if (i == 0) {
double maxY = paintProps.getView().getExtent().getMaxY();
Rectangle2D rect = target.getStringsBounds(parameters[i]);
if (y + (rect.getHeight() / 2) > maxY) {
y = maxY;
verticalAlignment = IGraphicsTarget.VerticalAlignment.BOTTOM;
}
}
// String d = String.format("%1$tH:%1$tM", c);
String d = String.format("%1$tH", c); String d = String.format("%1$tH", c);
parameters.setText(d, ProfilerUtils.GRAPH_COLOR); parameters[i].setText(d, ProfilerUtils.GRAPH_COLOR);
parameters.basics.x = ProfilerUtils.profilerRectangle.x parameters[i].basics.x = ProfilerUtils.profilerRectangle.x
+ (i * incX) + (incX / 2); + (i * incX) + (incX / 2);
target.drawStrings(parameters);
c.add(Calendar.HOUR, -1); c.add(Calendar.HOUR, -1);
} }
} }
// draw right edge // draw right edge
target.drawLine( lines[1] = new DrawableLine();
(ProfilerUtils.profilerRectangle.x + ProfilerUtils.profilerRectangle.width), lines[1].setCoordinates((ProfilerUtils.profilerRectangle.x + ProfilerUtils.profilerRectangle.width),
(ProfilerUtils.profilerRectangle.y + ProfilerUtils.profilerRectangle.height), (ProfilerUtils.profilerRectangle.y + ProfilerUtils.profilerRectangle.height));
0.0, lines[1].addPoint((ProfilerUtils.profilerRectangle.x + ProfilerUtils.profilerRectangle.width),
(ProfilerUtils.profilerRectangle.x + ProfilerUtils.profilerRectangle.width), ProfilerUtils.profilerRectangle.y);
ProfilerUtils.profilerRectangle.y, 0.0, lines[1].basics.color = ProfilerUtils.GRAPH_COLOR;
ProfilerUtils.GRAPH_COLOR, ProfilerUtils.GRAPH_LINE_WIDTH, lines[1].width = ProfilerUtils.GRAPH_LINE_WIDTH;
IGraphicsTarget.LineStyle.SOLID); target.drawLine(lines);
if (parameters != null) {
target.drawStrings(parameters);
}
} }
/** /**
@ -504,60 +520,78 @@ public class ProfilerResource extends
*/ */
public void drawYAxis(PaintProperties paintProps, Double magnification) public void drawYAxis(PaintProperties paintProps, Double magnification)
throws VizException { throws VizException {
DrawableString parameters = new DrawableString("18km", ArrayList<DrawableString> parameters = new ArrayList<DrawableString>();
DrawableString string1 = new DrawableString("18km",
ProfilerUtils.GRAPH_COLOR); ProfilerUtils.GRAPH_COLOR);
parameters.textStyle = TextStyle.BLANKED; string1.textStyle = TextStyle.BLANKED;
parameters.font = font; string1.font = font;
parameters.horizontalAlignment = IGraphicsTarget.HorizontalAlignment.RIGHT; string1.horizontalAlignment = IGraphicsTarget.HorizontalAlignment.RIGHT;
parameters.verticallAlignment = IGraphicsTarget.VerticalAlignment.MIDDLE; string1.verticallAlignment = IGraphicsTarget.VerticalAlignment.MIDDLE;
parameters.basics.x = ProfilerUtils.profilerRectangle.x string1.basics.x = ProfilerUtils.profilerRectangle.x
- ProfilerUtils.LABEL_OFFSET; - ProfilerUtils.LABEL_OFFSET;
parameters.basics.y = ProfilerUtils.profilerRectangle.y; string1.basics.y = ProfilerUtils.profilerRectangle.y;
double minX = paintProps.getView().getExtent().getMinX(); double minX = paintProps.getView().getExtent().getMinX();
double maxX = paintProps.getView().getExtent().getMaxX(); double maxX = paintProps.getView().getExtent().getMaxX();
// top of graph // top of graph
target.drawLine(ProfilerUtils.profilerRectangle.x, List<DrawableLine> lines = new ArrayList<DrawableLine>();
ProfilerUtils.profilerRectangle.y, 0.0, DrawableLine top = new DrawableLine();
ProfilerUtils.profilerRectangle.x top.setCoordinates(ProfilerUtils.profilerRectangle.x,
+ ProfilerUtils.profilerRectangle.width, ProfilerUtils.profilerRectangle.y);
ProfilerUtils.profilerRectangle.y, 0.0, top.addPoint(ProfilerUtils.profilerRectangle.x
ProfilerUtils.GRAPH_COLOR, ProfilerUtils.GRAPH_LINE_WIDTH, + ProfilerUtils.profilerRectangle.width,
IGraphicsTarget.LineStyle.SOLID); ProfilerUtils.profilerRectangle.y);
top.basics.color = ProfilerUtils.GRAPH_COLOR;
top.width = ProfilerUtils.GRAPH_LINE_WIDTH;
lines.add(top);
Rectangle2D rect = target.getStringsBounds(parameters); Rectangle2D rect = target.getStringsBounds(string1);
if (parameters.basics.x - rect.getWidth() < minX) { if (string1.basics.x - rect.getWidth() < minX) {
parameters.basics.x = minX; string1.basics.x = minX;
parameters.horizontalAlignment = IGraphicsTarget.HorizontalAlignment.LEFT; string1.horizontalAlignment = IGraphicsTarget.HorizontalAlignment.LEFT;
} }
target.drawStrings(parameters);
parameters.add(string1);
double x = string1.basics.x;
HorizontalAlignment horizontalAlignment = string1.horizontalAlignment;
// loop for heights in meters // loop for heights in meters
boolean changed = false;
for (int i = 0; i < ProfilerUtils.HEIGHTS; i += 2) { for (int i = 0; i < ProfilerUtils.HEIGHTS; i += 2) {
// draw Y labels // draw Y labels
parameters.setText( DrawableString string = new DrawableString(
ProfilerUtils.decimalFormat.format(new Double(i)) + " km", ProfilerUtils.decimalFormat.format(new Double(i)) + " km",
ProfilerUtils.GRAPH_COLOR); ProfilerUtils.GRAPH_COLOR);
parameters.basics.y = calcY(i * 1000); string.textStyle = TextStyle.BLANKED;
rect = target.getStringsBounds(parameters); string.font = font;
if (parameters.basics.x - rect.getWidth() < minX) { string.verticallAlignment = IGraphicsTarget.VerticalAlignment.MIDDLE;
parameters.basics.x = minX; string.basics.y = calcY(i * 1000);
parameters.horizontalAlignment = IGraphicsTarget.HorizontalAlignment.LEFT; rect = target.getStringsBounds(string);
// Once changed once, these variables stay the same
if (!changed && x - rect.getWidth() < minX) {
x = minX;
horizontalAlignment = IGraphicsTarget.HorizontalAlignment.LEFT;
changed = true;
} }
target.drawLine( string.basics.x = x;
ProfilerUtils.profilerRectangle.x, string.horizontalAlignment = horizontalAlignment;
calcY(i * 1000),
0.0,
(ProfilerUtils.profilerRectangle.x + ProfilerUtils.profilerRectangle.width),
calcY(i * 1000), 0.0, ProfilerUtils.GRAPH_COLOR,
ProfilerUtils.GRAPH_LINE_WIDTH,
IGraphicsTarget.LineStyle.SOLID);
// draw after line so it draws on top
target.drawStrings(parameters);
parameters.add(string);
DrawableLine yLabel = new DrawableLine();
yLabel.setCoordinates(ProfilerUtils.profilerRectangle.x,
calcY(i * 1000));
yLabel.addPoint(
(ProfilerUtils.profilerRectangle.x + ProfilerUtils.profilerRectangle.width),
calcY(i * 1000));
yLabel.basics.color = ProfilerUtils.GRAPH_COLOR;
yLabel.width = ProfilerUtils.GRAPH_LINE_WIDTH;
lines.add(yLabel);
} }
double stationElevation = 0; double stationElevation = 0;
if (!getResourceData().records.isEmpty()) { if (!getResourceData().records.isEmpty()) {
@ -565,46 +599,66 @@ public class ProfilerResource extends
.getElevation(); .getElevation();
} }
// Draw the surface line. // Draw the surface line.
target.drawLine( DrawableLine surface = new DrawableLine();
ProfilerUtils.profilerRectangle.x, surface.setCoordinates(ProfilerUtils.profilerRectangle.x,
calcY(stationElevation), calcY(stationElevation));
0.0, surface.addPoint(
(ProfilerUtils.profilerRectangle.x + ProfilerUtils.profilerRectangle.width), (ProfilerUtils.profilerRectangle.x + ProfilerUtils.profilerRectangle.width),
calcY(stationElevation), 0.0, ProfilerUtils.GRAPH_COLOR, calcY(stationElevation));
ProfilerUtils.GRAPH_LINE_WIDTH, IGraphicsTarget.LineStyle.SOLID); surface.basics.color = ProfilerUtils.GRAPH_COLOR;
surface.width = ProfilerUtils.GRAPH_LINE_WIDTH;
lines.add(surface);
// loop for pressure levels and labels x = ProfilerUtils.profilerRectangle.x
parameters.horizontalAlignment = IGraphicsTarget.HorizontalAlignment.LEFT;
parameters.basics.x = ProfilerUtils.profilerRectangle.x
+ ProfilerUtils.profilerRectangle.width + ProfilerUtils.profilerRectangle.width
+ ProfilerUtils.LABEL_OFFSET; + ProfilerUtils.LABEL_OFFSET;
horizontalAlignment = IGraphicsTarget.HorizontalAlignment.LEFT;
// loop for pressure levels and labels
changed = false;
for (int i = 0; i < ProfilerUtils.PRESSURES.length; i++) { for (int i = 0; i < ProfilerUtils.PRESSURES.length; i++) {
double height = WxMath.pressureToHeight(ProfilerUtils.PRESSURES[i]); double height = WxMath.pressureToHeight(ProfilerUtils.PRESSURES[i]);
if (height <= MAX_Y) { if (height <= MAX_Y) {
parameters.setText( DrawableString string = new DrawableString(
ProfilerUtils.decimalFormat.format(new Double( ProfilerUtils.decimalFormat.format(new Double(
ProfilerUtils.PRESSURES[i])) + " mb", ProfilerUtils.PRESSURES[i])) + " mb",
ProfilerUtils.GRAPH_COLOR); ProfilerUtils.GRAPH_COLOR);
parameters.basics.y = calcY(height); string.textStyle = TextStyle.BLANKED;
rect = target.getStringsBounds(parameters); string.font = font;
if (parameters.basics.x + rect.getWidth() > maxX) { string.verticallAlignment = IGraphicsTarget.VerticalAlignment.MIDDLE;
parameters.basics.x = maxX; string.basics.y = calcY(height);
parameters.horizontalAlignment = IGraphicsTarget.HorizontalAlignment.RIGHT; rect = target.getStringsBounds(string);
// Once changed once, these variables stay the same
if (!changed && x + rect.getWidth() > maxX) {
x = maxX;
horizontalAlignment = IGraphicsTarget.HorizontalAlignment.RIGHT;
changed = true;
} }
target.drawStrings(parameters);
string.basics.x = x;
string.horizontalAlignment = horizontalAlignment;
parameters.add(string);
} }
} }
// bottom of graph // bottom of graph
target.drawLine( DrawableLine bottom = new DrawableLine();
bottom.setCoordinates(
ProfilerUtils.profilerRectangle.x, ProfilerUtils.profilerRectangle.x,
(ProfilerUtils.profilerRectangle.y + ProfilerUtils.profilerRectangle.height), (ProfilerUtils.profilerRectangle.y + ProfilerUtils.profilerRectangle.height));
0.0, bottom.addPoint(
(ProfilerUtils.profilerRectangle.x + ProfilerUtils.profilerRectangle.width), (ProfilerUtils.profilerRectangle.x + ProfilerUtils.profilerRectangle.width),
(ProfilerUtils.profilerRectangle.y + ProfilerUtils.profilerRectangle.height), (ProfilerUtils.profilerRectangle.y + ProfilerUtils.profilerRectangle.height));
0.0, ProfilerUtils.GRAPH_COLOR, ProfilerUtils.GRAPH_LINE_WIDTH, bottom.basics.color = ProfilerUtils.GRAPH_COLOR;
IGraphicsTarget.LineStyle.SOLID); bottom.width = ProfilerUtils.GRAPH_LINE_WIDTH;
lines.add(bottom);
target.drawLine(lines.toArray(new DrawableLine[0]));
// draw strings after lines so they draw on top
target.drawStrings(parameters);
} }
/** /**

View file

@ -115,6 +115,7 @@ import com.raytheon.uf.viz.remote.graphics.objects.DispatchingWireframeShape;
* Apr 04, 2014 2920 bsteffen Allow strings to use mulitple styles. * Apr 04, 2014 2920 bsteffen Allow strings to use mulitple styles.
* May 16, 2014 3163 bsteffen Remove references to deprecated * May 16, 2014 3163 bsteffen Remove references to deprecated
* {@link IGraphicsTarget} methods. * {@link IGraphicsTarget} methods.
* Jul 28, 2014 3429 mapeters Updated deprecated drawLine() calls.
* *
* </pre> * </pre>
* *
@ -1278,7 +1279,13 @@ public class DispatchGraphicsTarget extends DispatchingObject<IGraphicsTarget>
@Deprecated @Deprecated
public void drawLine(double x1, double y1, double z1, double x2, double y2, public void drawLine(double x1, double y1, double z1, double x2, double y2,
double z2, RGB color, float width) throws VizException { double z2, RGB color, float width) throws VizException {
drawLine(x1, y1, z1, x2, y2, z2, color, width, LineStyle.DEFAULT); DrawableLine line = new DrawableLine();
line.setCoordinates(x1, y1, z1);
line.addPoint(x2, y2, z2);
line.basics.color = color;
line.width = width;
line.lineStyle = LineStyle.DEFAULT;
drawLine(line);
} }
/* /*

View file

@ -21,6 +21,8 @@
package com.raytheon.viz.awipstools.common; package com.raytheon.viz.awipstools.common;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
import javax.measure.converter.UnitConverter; import javax.measure.converter.UnitConverter;
import javax.measure.quantity.Length; import javax.measure.quantity.Length;
@ -35,6 +37,7 @@ import org.opengis.referencing.crs.CoordinateReferenceSystem;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.DrawableLine;
import com.raytheon.uf.viz.core.IExtent; import com.raytheon.uf.viz.core.IExtent;
import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.IGraphicsTarget.HorizontalAlignment; import com.raytheon.uf.viz.core.IGraphicsTarget.HorizontalAlignment;
@ -63,6 +66,7 @@ import com.raytheon.uf.viz.core.rsc.tools.GenericToolsResourceData;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 1/10/08 562 bphillip Initial Creation. * 1/10/08 562 bphillip Initial Creation.
* 7/23/14 3429 mapeters Updated deprecated drawLine() calls.
* *
* </pre> * </pre>
* *
@ -170,30 +174,54 @@ public class DistanceTool extends
DecimalFormat df = new DecimalFormat("0.###"); DecimalFormat df = new DecimalFormat("0.###");
IFont font = target.getDefaultFont(); IFont font = target.getDefaultFont();
target.drawLine(x0, y0 - yOff, 0.0, x0, y0 + yOff, 0.0, color, 1); int max = Math.max(0, selectedIndex - 3);
List<DrawableLine> lines = new ArrayList<DrawableLine>(selectedIndex
- max + 3);
DrawableLine line1 = new DrawableLine();
line1.setCoordinates(x0, y0 - yOff);
line1.addPoint(x0, y0 + yOff);
line1.basics.color = color;
lines.add(line1);
target.drawString(font, "0", x0, y0 - yOff, 0.0, TextStyle.NORMAL, target.drawString(font, "0", x0, y0 - yOff, 0.0, TextStyle.NORMAL,
color, HorizontalAlignment.CENTER, VerticalAlignment.BOTTOM, color, HorizontalAlignment.CENTER, VerticalAlignment.BOTTOM,
null); null);
for (int i = Math.max(0, selectedIndex - 3); i < selectedIndex; i++) { for (int i = max; i < selectedIndex; i++) {
double l = length * scales[i] / scales[selectedIndex]; double l = length * scales[i] / scales[selectedIndex];
String s = df.format(scales[i]); String s = df.format(scales[i]);
target.drawLine(x0 + l, y0 - yOff, 0.0, x0 + l, y0 + yOff, 0.0,
color, 1); DrawableLine line2 = new DrawableLine();
line2.setCoordinates(x0 + l, y0 - yOff);
line2.addPoint(x0 + l, y0 + yOff);
line2.basics.color = color;
lines.add(line2);
target.drawString(font, s, x0 + l, y0 - yOff, 0.0, target.drawString(font, s, x0 + l, y0 - yOff, 0.0,
TextStyle.NORMAL, color, HorizontalAlignment.CENTER, TextStyle.NORMAL, color, HorizontalAlignment.CENTER,
VerticalAlignment.BOTTOM, null); VerticalAlignment.BOTTOM, null);
} }
target.drawLine(x0 + length, y0 - yOff, 0.0, x0 + length, y0 + yOff, DrawableLine line3 = new DrawableLine();
0.0, color, 1); line3.setCoordinates(x0 + length, y0 - yOff);
line3.addPoint(x0 + length, y0 + yOff);
line3.basics.color = color;
lines.add(line3);
target.drawString(font, target.drawString(font,
df.format(scales[selectedIndex]) + displayUnit.toString(), x0 df.format(scales[selectedIndex]) + displayUnit.toString(), x0
+ length, y0 - yOff, 0.0, TextStyle.NORMAL, color, + length, y0 - yOff, 0.0, TextStyle.NORMAL, color,
HorizontalAlignment.CENTER, VerticalAlignment.BOTTOM, null); HorizontalAlignment.CENTER, VerticalAlignment.BOTTOM, null);
target.drawLine(x0, y0, 0.0, x0 + length, y0, 0.0, color, 1); DrawableLine line4 = new DrawableLine();
line4.setCoordinates(x0, y0);
line4.addPoint(x0 + length, y0);
line4.basics.color = color;
lines.add(line4);
target.drawLine(lines.toArray(new DrawableLine[0]));
target.setupClippingPlane(screenExtent); target.setupClippingPlane(screenExtent);
} }

View file

@ -40,6 +40,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.SimulatedTime; import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.viz.core.DrawableCircle; import com.raytheon.uf.viz.core.DrawableCircle;
import com.raytheon.uf.viz.core.DrawableLine;
import com.raytheon.uf.viz.core.DrawableString; import com.raytheon.uf.viz.core.DrawableString;
import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.IGraphicsTarget.HorizontalAlignment; import com.raytheon.uf.viz.core.IGraphicsTarget.HorizontalAlignment;
@ -106,6 +107,7 @@ import com.vividsolutions.jts.geom.LineString;
* 06-03-14 3191 njensen Fix postData to not retrieve * 06-03-14 3191 njensen Fix postData to not retrieve
* 06-17-2014 DR17409 mgamazaychikov Fix futurePoints calculation in generateNewTrackInfo() * 06-17-2014 DR17409 mgamazaychikov Fix futurePoints calculation in generateNewTrackInfo()
* and generateExistingTrackInfo() * and generateExistingTrackInfo()
* 07-24-2014 3429 mapeters Updated deprecated drawLine() calls.
* *
* </pre> * </pre>
* *
@ -454,7 +456,7 @@ public class StormTrackDisplay implements IRenderable {
* @param editable * @param editable
* if the line is editable * if the line is editable
* @throws VizException * @throws VizException
*/ */
private void paintLine(IGraphicsTarget target, Coordinate[] coords, private void paintLine(IGraphicsTarget target, Coordinate[] coords,
RGB color, float lineWidth, boolean editable, double circleSize, LineStyle style) RGB color, float lineWidth, boolean editable, double circleSize, LineStyle style)
throws VizException { throws VizException {
@ -463,7 +465,11 @@ public class StormTrackDisplay implements IRenderable {
circle.radius = circleSize; circle.radius = circleSize;
circle.filled = true; circle.filled = true;
Coordinate lastCoord = null; DrawableLine line = new DrawableLine();
line.basics.color = color;
line.width = lineWidth;
line.lineStyle = style;
double[] p1;
for (int i = 0; i < coords.length; ++i) { for (int i = 0; i < coords.length; ++i) {
Coordinate currCoord = coords[i]; Coordinate currCoord = coords[i];
if (currCoord != null) { if (currCoord != null) {
@ -471,25 +477,18 @@ public class StormTrackDisplay implements IRenderable {
if (editable) { if (editable) {
paintPoint(target, currCoord, color, circleSize); paintPoint(target, currCoord, color, circleSize);
} else { } else {
double[] p1 = descriptor.worldToPixel(new double[] { p1 = descriptor.worldToPixel(new double[] {
currCoord.x, currCoord.y }); currCoord.x, currCoord.y });
circle.setCoordinates(p1[0], p1[1]); circle.setCoordinates(p1[0], p1[1]);
target.drawCircle(circle); target.drawCircle(circle);
} }
// paint line if lastCoord not null p1 = descriptor.worldToPixel(new double[] {
if (lastCoord != null) { currCoord.x, currCoord.y });
double[] p1 = descriptor.worldToPixel(new double[] { line.addPoint(p1[0], p1[1]);
currCoord.x, currCoord.y });
double[] p2 = descriptor.worldToPixel(new double[] {
lastCoord.x, lastCoord.y });
target.drawLine(p1[0], p1[1], 0.0, p2[0], p2[1], 0.0,
color, lineWidth, style);
}
} }
lastCoord = currCoord;
} }
target.drawLine(line);
} }
/** /**

View file

@ -34,6 +34,7 @@ import org.opengis.referencing.FactoryException;
import org.opengis.referencing.operation.TransformException; import org.opengis.referencing.operation.TransformException;
import com.raytheon.uf.common.geospatial.ReferencedCoordinate; import com.raytheon.uf.common.geospatial.ReferencedCoordinate;
import com.raytheon.uf.viz.core.DrawableLine;
import com.raytheon.uf.viz.core.DrawableString; import com.raytheon.uf.viz.core.DrawableString;
import com.raytheon.uf.viz.core.IDisplayPaneContainer; import com.raytheon.uf.viz.core.IDisplayPaneContainer;
import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.IGraphicsTarget;
@ -70,6 +71,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* 15Jan2007 ebabin Update for lat/lon put home cursor bug. * 15Jan2007 ebabin Update for lat/lon put home cursor bug.
* 10-21-09 #1049 bsteffen Refactor to common MovableTool model * 10-21-09 #1049 bsteffen Refactor to common MovableTool model
* 15Mar2013 15693 mgamazaychikov Added magnification capability. * 15Mar2013 15693 mgamazaychikov Added magnification capability.
* 23Jul2014 3429 mapeters Updated deprecated drawLine() calls.
* 28Jul2014 3430 mapeters Updated move function to prevent errors when * 28Jul2014 3430 mapeters Updated move function to prevent errors when
* MB3 clicking off the map in editable mode. * MB3 clicking off the map in editable mode.
* </pre> * </pre>
@ -159,10 +161,18 @@ public class HomeToolLayer extends AbstractMovableToolLayer<Coordinate>
radius, 45); radius, 45);
double[] p2 = target.getPointOnCircle(center[0], center[1], 0.0, double[] p2 = target.getPointOnCircle(center[0], center[1], 0.0,
radius, 225); radius, 225);
target.drawLine(p1[0], p1[1], 0, p2[0], p2[1], 0, color, 1.0f); DrawableLine[] lines = new DrawableLine[2];
lines[0] = new DrawableLine();
lines[0].setCoordinates(p1[0], p1[1]);
lines[0].addPoint(p2[0], p2[1]);
lines[0].basics.color = color;
p1 = target.getPointOnCircle(center[0], center[1], 0.0, radius, 135); p1 = target.getPointOnCircle(center[0], center[1], 0.0, radius, 135);
p2 = target.getPointOnCircle(center[0], center[1], 0.0, radius, 315); p2 = target.getPointOnCircle(center[0], center[1], 0.0, radius, 315);
target.drawLine(p1[0], p1[1], 0, p2[0], p2[1], 0, color, 1.0f); lines[1] = new DrawableLine();
lines[1].setCoordinates(p1[0], p1[1]);
lines[1].addPoint(p2[0], p2[1]);
lines[1].basics.color = color;
target.drawLine(lines);
double labelLoc[] = target.getPointOnCircle(center[0], center[1], 0.0, double labelLoc[] = target.getPointOnCircle(center[0], center[1], 0.0,
radius, 0); radius, 0);
DrawableString dString = new DrawableString("Home", color); DrawableString dString = new DrawableString("Home", color);

View file

@ -19,9 +19,6 @@
**/ **/
package com.raytheon.viz.core.graphing; package com.raytheon.viz.core.graphing;
import org.eclipse.swt.graphics.RGB;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Coordinate;
/** /**
@ -33,6 +30,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 06 Nov 2006 jkorman Initial Coding * 06 Nov 2006 jkorman Initial Coding
* 28 Jul 2014 3429 mapeters Removed unused render() method.
* </pre> * </pre>
* *
* @author jkorman * @author jkorman
@ -180,27 +178,6 @@ public class LineStroke {
} }
} }
/**
* Render the stroke.
*
* @param world
* The world graphics system.
* @param drawColor
* The color to draw with.
*/
public void render(IGraphicsTarget target, WGraphics world, RGB drawColor) {
switch (type) {
case MOVETO: {
world.moveTo(point.x, point.y);
break;
}
case DRAWTO: {
world.drawTo(target, point.x, point.y, drawColor);
break;
}
}
}
/** /**
* Create a string representation of this stroke. * Create a string representation of this stroke.
* *

View file

@ -19,14 +19,12 @@
**/ **/
package com.raytheon.viz.core.graphing; package com.raytheon.viz.core.graphing;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.graphics.Rectangle;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.IGraphicsTarget.LineStyle;
import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Coordinate;
/** /**
* @Deprecated TODO
* Implements a world coordinate to graphics viewport transform. * Implements a world coordinate to graphics viewport transform.
* *
* <pre> * <pre>
@ -35,17 +33,17 @@ import com.vividsolutions.jts.geom.Coordinate;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 06 Nov 2006 jkorman Initial Coding * 06 Nov 2006 jkorman Initial Coding
* 24 Jul 2014 mapeters Removed unused methods/fields/imports
* and marked as deprecated.
*
* </pre> * </pre>
* *
* @author jkorman * @author jkorman
* @version 1.0 * @version 1.0
*/ */
@Deprecated
public class WGraphics { public class WGraphics {
private double cursorX = 0;
private double cursorY = 0;
private double worldXmin = -1; private double worldXmin = -1;
/** /**
@ -96,9 +94,6 @@ public class WGraphics {
// private IGraphicsTarget graphicsContext; // private IGraphicsTarget graphicsContext;
/** Default text color */
private RGB textColor = new RGB(255, 255, 255);
/** /**
* Create a World coordinates graph * Create a World coordinates graph
* *
@ -211,77 +206,19 @@ public class WGraphics {
return dataPoint; return dataPoint;
} }
/**
* Move the drawing cursor to point x1, y1.
*
* @param x1
* The world x value.
* @param y1
* The world y value.
*/
public void moveTo(double x, double y) {
cursorX = mapX(x);
cursorY = mapY(y);
} // moveTo()
/**
* Draw to point x1, y1 using a specified color.
*
* @param x1
* The world x value.
* @param y1
* The world y value.
* @param color
* The drawing color.
*/
public void drawTo(IGraphicsTarget target, double x, double y, RGB color) {
this.drawTo(target, x, y, color, LineStyle.SOLID);
} // drawTo()
public void drawTo(IGraphicsTarget target, double x, double y, RGB color,
LineStyle lineStyle) {
try {
double mx = mapX(x);
double my = mapY(y);
target.drawLine(cursorX, cursorY, 0.0, mx, my, 0.0, color, 1,
lineStyle);
cursorX = mx;
cursorY = my;
} catch (Exception e) {
e.printStackTrace();
}
} // drawTo()
public double getViewXmin() { public double getViewXmin() {
return viewXmin; return viewXmin;
} }
public void setViewXmin(double viewX1) {
this.viewXmin = viewX1;
}
public double getViewYmin() { public double getViewYmin() {
return viewYmin; return viewYmin;
} }
public void setViewYmin(double viewY1) {
this.viewYmin = viewY1;
}
public double getViewXmax() { public double getViewXmax() {
return viewXmax; return viewXmax;
} }
public void setViewXmax(double viewX2) {
this.viewXmax = viewX2;
}
public double getViewYmax() { public double getViewYmax() {
return viewYmax; return viewYmax;
} }
public void setViewYmax(double viewY2) {
this.viewYmax = viewY2;
}
} }

View file

@ -21,27 +21,6 @@
package com.raytheon.viz.core.graphing.axis; package com.raytheon.viz.core.graphing.axis;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Calendar;
import java.util.HashMap;
import javax.measure.unit.Unit;
import org.eclipse.swt.graphics.RGB;
import com.raytheon.uf.common.style.graph.AxisScale;
import com.raytheon.uf.common.style.graph.GraphPreferences;
import com.raytheon.uf.common.style.level.SingleLevel;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.viz.core.ColorUtil;
import com.raytheon.viz.core.graphing.DataAxisInfo;
import com.raytheon.viz.core.graphing.GraphUtil;
import com.raytheon.viz.core.graphing.util.GraphPrefsFactory;
import com.raytheon.viz.core.graphing.util.GraphUtilPorted;
import com.raytheon.viz.core.slice.request.HeightScale;
import com.raytheon.viz.core.slice.request.HeightScale.ScaleType;
/** /**
* Factory methods for generating axes. * Factory methods for generating axes.
@ -51,6 +30,8 @@ import com.raytheon.viz.core.slice.request.HeightScale.ScaleType;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Oct 4, 2007 njensen Initial creation * Oct 4, 2007 njensen Initial creation
* Jul 28, 2014 3429 mapeters Removed unused methods, variables,
* and imports
* *
* </pre> * </pre>
* *
@ -73,61 +54,10 @@ public class AxisFactory {
protected static final SimpleDateFormat FCST_TIME_FORMAT = new SimpleDateFormat( protected static final SimpleDateFormat FCST_TIME_FORMAT = new SimpleDateFormat(
"HH'Z' EEE"); "HH'Z' EEE");
// never really figured out what absMin should be from the
// ported code
private static float ABS_MIN = Float.NEGATIVE_INFINITY;
private AxisFactory() { private AxisFactory() {
} }
/**
* Builds a number axis from style rules
*
* @param parameter
* the parameter of the data
* @param level
* the level of the parameter
* @param orientation
* the orientation of the axis
* @param dataMinValue
* the minimum value of the data to be graphed
* @param dataMaxValue
* the maximum value of the data to be graphed
* @param zeroYes
* if the data has a point at zero
* @return
* @throws VizException
*/
public static NumberAxis buildNumberAxis(GraphPreferences preferences,
IAxis.Orientation orientation, double dataMinValue,
double dataMaxValue, boolean zeroYes, int numberOfGraphs,
Unit<?> fallbackUnits) throws VizException {
NumberAxis axis = null;
String units = "";
if (preferences.getDisplayUnits() != null) {
units = preferences.getDisplayUnits().toString();
} else if (fallbackUnits != null) {
units = fallbackUnits.toString();
}
DataAxisInfo info = GraphUtilPorted.initDataAxisInfo(
(float) dataMinValue, zeroYes, ABS_MIN, (float) dataMaxValue,
units, preferences);
AxisLabeling labeling = AxisUtil.makeYaxis(info, numberOfGraphs, false);
axis = new NumberAxis(orientation, units);
axis.setLabeling(labeling);
axis.setRange((double) info.getDivMin(), (double) info.getDivMax());
if (preferences.getAxisScale().getScaleType() == AxisScale.Type.LOG) {
axis.setLogarithmic(true);
}
axis.setInfo(info);
return axis;
}
/** /**
* Builds a linear number axis * Builds a linear number axis
* *
@ -149,143 +79,4 @@ public class AxisFactory {
return axis; return axis;
} }
public static boolean axisIsCompatible(DataAxisInfo firstInfo,
boolean dataAtZero, String units, DataAxisInfo secondInfo) {
boolean compatible = false;
if (firstInfo == null && secondInfo == null) {
// primarily axes that hold images (e.g. wind barbs)
compatible = true;
} else if (firstInfo == null || secondInfo == null) {
compatible = false;
} else {
compatible = GraphUtilPorted.verifyDataAxisInfo(
firstInfo.getDataMin(), dataAtZero, ABS_MIN,
firstInfo.getDataMax(), units, firstInfo.getStyle(),
secondInfo, true);
}
return compatible;
}
/**
* Builds a date axis
*
* @param orientation
* the orientation
* @param times
* the times to label
* @param minTime
* the start time in milliseconds
* @param maxTime
* the end time in milliseconds
* @return the date axis
*/
public static DateAxis buildDateAxis(IAxis.Orientation orientation,
Object[] times, double minTime, double maxTime) {
DateAxis axis = new DateAxis(orientation);
AxisLabeling labeling = new AxisLabeling();
HashMap<Double, String> labels = new HashMap<Double, String>();
if (times[0] instanceof Calendar) {
for (Object time : times) {
Calendar cTime = (Calendar) time;
double millis = cTime.getTimeInMillis();
String label = TIME_FORMAT.format(cTime.getTime());
if (millis == minTime || millis == maxTime) {
label += DateAxis.LABEL_LINEBREAK
+ DAY_OF_WEEK_FORMAT.format(cTime.getTime());
label += DateAxis.LABEL_LINEBREAK
+ DATE_FORMAT.format(cTime.getTime());
}
labels.put(millis, label);
}
} else if (times[0] instanceof DataTime) {
for (Object time : times) {
DataTime dTime = (DataTime) time;
double millis = GraphUtil.getNumberRepresentation(dTime);
String label = REF_TIME_FORMAT.format(dTime.getRefTime()
.getTime());
label += DateAxis.LABEL_LINEBREAK
+ (dTime.getFcstTime() / 3600) + "HR";
label += DateAxis.LABEL_LINEBREAK
+ FCST_TIME_FORMAT.format(dTime.getValidTime()
.getTime());
if (millis == minTime || millis == maxTime) {
label += DateAxis.LABEL_LINEBREAK
+ DATE_FORMAT
.format(dTime.getValidTime().getTime());
}
labels.put(millis, label);
}
}
labeling.setLabels(labels);
axis.setLabeling(labeling);
axis.setRange(minTime, maxTime);
return axis;
}
public static NumberAxis buildVerticalHeightAxis(RGB color,
SingleLevel[] levels, HeightScale scale) {
if (color == null) {
color = ColorUtil.DEFAULT_ITEM_COLOR;
}
// TODO support more level types
NumberAxis rangeAxis = new NumberAxis(IAxis.Orientation.VERTICAL, "mb");
rangeAxis.addTitle("Millibars", color);
rangeAxis.setShowTitle(true);
Arrays.sort(levels);
double minLevel = levels[0].getValue();
double maxLevel = levels[levels.length - 1].getValue();
rangeAxis.setRange(minLevel, maxLevel);
// TODO should be configurable
GraphPreferences style = GraphPrefsFactory.buildSimplePreferences(
scale.getScale() == ScaleType.LOG, minLevel, maxLevel);
style.getAxisScale().setMaxValue(maxLevel);
style.getAxisScale().setMinValue(minLevel);
DataAxisInfo info = GraphUtilPorted.initDataAxisInfo((float) minLevel,
false, (float) minLevel, (float) maxLevel, "mb", style);
rangeAxis.setInfo(info);
rangeAxis.setLogarithmic(scale.getScale() == ScaleType.LOG);
rangeAxis.setLabeling(generateVerticalLabels(levels, scale));
rangeAxis.setDrawLinesAtLabels(true);
rangeAxis.setLabelLineStyle(IGraphicsTarget.LineStyle.SOLID);
return rangeAxis;
}
private static AxisLabeling generateVerticalLabels(SingleLevel[] levels,
HeightScale scale) {
AxisLabeling labeling = new AxisLabeling();
HashMap<Double, String> labelMap = new HashMap<Double, String>();
if (levels.length < 11) {
for (SingleLevel level : levels) {
double val = level.getValue();
labelMap.put(val, Double.toString(val));
}
} else {
if (scale.getScale() == ScaleType.LOG && levels.length > 20) {
for (int i = 0; i < levels.length / 2; i += 4) {
double val = levels[i].getValue();
labelMap.put(val, Double.toString(val));
}
for (int i = levels.length / 2; i < levels.length; i += 2) {
double val = levels[i].getValue();
labelMap.put(val, Double.toString(val));
}
double val = levels[levels.length - 1].getValue();
labelMap.put(val, Double.toString(val));
} else {
for (int i = 0; i < levels.length; i += 2) {
double val = levels[i].getValue();
labelMap.put(val, Double.toString(val));
}
}
}
labeling.setLabels(labelMap);
return labeling;
}
} }

View file

@ -1,256 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.viz.core.graphing.axis;
import java.util.Arrays;
import java.util.GregorianCalendar;
import java.util.Set;
import java.util.Stack;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle;
import com.raytheon.uf.viz.core.IExtent;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.IGraphicsTarget.HorizontalAlignment;
import com.raytheon.uf.viz.core.IGraphicsTarget.TextStyle;
import com.raytheon.uf.viz.core.IGraphicsTarget.VerticalAlignment;
import com.raytheon.uf.viz.core.drawables.PaintProperties;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.viz.core.graphing.GraphProperties;
import com.raytheon.viz.core.graphing.GraphUtil;
import com.vividsolutions.jts.geom.Coordinate;
/**
* Graph axis which uses dates.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 2006 Phillipe Initial creation
* Oct 2007 njensen Major refactor
*
* </pre>
*
* @author bphillip
* @version 1
*/
public class DateAxis extends Axis {
protected static final String LABEL_LINEBREAK = "\n";
protected static final int LABEL_SEPARATION = 100;
protected static double MARK_LENGTH = 5.0;
protected Stack<AxisLabeling> zoomedAxes = new Stack<AxisLabeling>();
public DateAxis(IAxis.Orientation orientation) {
this.orientation = orientation;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.core.graphing.IGraphRenderable#paint()
*/
public void paint(IGraphicsTarget target, PaintProperties paintProps)
throws VizException {
IExtent extent = ((GraphProperties) paintProps).getGraph()
.getWorldExtent();
Rectangle bounds = GraphUtil.getBounds(extent);
graphArea = GraphUtil.getDrawingArea(extent);
// Draws the axes
// target.drawRect(new PixelExtent(graphArea), DEFAULT_AXIS_COLOR, 1.0f,
// 1.0);
if (orientation == IAxis.Orientation.VERTICAL) {
// TODO not up to date with latest changes
} else {
double boundsGraphDiff = bounds.y + bounds.height - graphArea.y
- graphArea.height;
double y = graphArea.y + graphArea.height + boundsGraphDiff * THIRD;
Set<Double> keys = labeling.getLabels().keySet();
RGB[] colors = new RGB[4];
for (int i = 0; i < colors.length; i++) {
colors[i] = color;
}
// we need to draw the labels in order so we can remove drawing
// some if there's too many too close together
double[] times = new double[keys.size()];
int i = 0;
for (double time : keys) {
times[i] = time;
i++;
}
Arrays.sort(times);
double previousLabelX = 0;
double startLabelX = valueToCoordinate(times[0]);
double endLabelX = valueToCoordinate(times[times.length - 1]);
for (double time : times) {
double x = valueToCoordinate(time);
y = graphArea.y + graphArea.height;
target.drawLine(x - MARK_LENGTH, y + MARK_LENGTH, 0.0, x, y,
0.0, color, lineWeight);
target.drawLine(x, y, 0.0, x + MARK_LENGTH, y + MARK_LENGTH,
0.0, color, lineWeight);
if (x == startLabelX
|| x == endLabelX
|| (Math.abs(x - previousLabelX) > LABEL_SEPARATION
&& Math.abs(x - startLabelX) > LABEL_SEPARATION && Math
.abs(x - endLabelX) > LABEL_SEPARATION)) {
String label = labeling.getLabel(time);
String[] split = label.split(LABEL_LINEBREAK);
target.drawStrings(null, split, x, y, 0.0,
TextStyle.NORMAL, colors,
HorizontalAlignment.CENTER, VerticalAlignment.TOP);
previousLabelX = x;
}
}
}
}
@Override
public double valueToCoordinate(Object aValue) {
double val = GraphUtil.getNumberRepresentation(aValue);
return doubleValueToCoordinate(val);
}
/**
* Gets the minimum value of the axis
*
* @return The minimum value of the axis
*/
public GregorianCalendar getBeginDate() {
GregorianCalendar retVal = new GregorianCalendar();
retVal.setTimeInMillis(minVal.longValue());
return retVal;
}
/**
* Gets the maximum value of the axis
*
* @return The maximum value of the axis
*/
public GregorianCalendar getEndDate() {
GregorianCalendar retVal = new GregorianCalendar();
retVal.setTimeInMillis(maxVal.longValue());
return retVal;
}
public double coordinateToValue(Coordinate aCoordinate) {
double retVal = Double.NaN;
double range = getMaxVal() - getMinVal();
if (orientation == IAxis.Orientation.HORIZONTAL) {
retVal = getMinVal()
+ ((range * (aCoordinate.x - graphArea.x) / graphArea.width));
} else {
retVal = getMaxVal()
- ((range * (aCoordinate.y - graphArea.y) / graphArea.height));
}
return retVal;
}
@Override
public boolean zoom(double x, double y, double zoom) {
// this may not be a good solution, let's ensure there's always
// two points on the axis
if (zoom > 1) {
if (labeling.getLabels().size() > 2) {
zoomedAxes.push(this.labeling);
// if you're closer one end, drop the time on that end
double val = coordinateToValue(new Coordinate(x, y));
double maxDiff = getMaxVal() - val;
double minDiff = val - getMinVal();
AxisLabeling zoomedLabeling = new AxisLabeling();
zoomedLabeling.setSampleFormat(labeling.getSampleFormat());
boolean removeFirst = false;
boolean removeLast = false;
if (minDiff < maxDiff) {
// zoom towards the min
removeLast = true;
} else {
// zoom towards the max
removeFirst = true;
}
Set<Double> keys = this.labeling.getLabels().keySet();
for (Double key : keys) {
zoomedLabeling.getLabels().put(key, labeling.getLabel(key));
}
double[] minMax = getLabelRanges(zoomedLabeling);
if (removeFirst) {
zoomedLabeling.getLabels().remove(minMax[0]);
} else if (removeLast) {
zoomedLabeling.getLabels().remove(minMax[1]);
}
minMax = getLabelRanges(zoomedLabeling);
this.setRange(minMax[0], minMax[1]);
labeling = zoomedLabeling;
}
} else if (zoom < 0) {
if (zoomedAxes.size() > 0) {
labeling = zoomedAxes.pop();
double[] minMax = getLabelRanges(labeling);
this.setRange(minMax[0], minMax[1]);
}
}
return true;
}
private static double[] getLabelRanges(AxisLabeling labels) {
Set<Double> keys = labels.getLabels().keySet();
double min = Double.MAX_VALUE;
double max = Double.MIN_VALUE;
for (Double key : keys) {
min = Math.min(min, key);
max = Math.max(max, key);
}
return new double[] { min, max };
}
@Override
public void updateLabeling(int numberOfGraphs) {
// currently not necessary
}
}

View file

@ -20,13 +20,16 @@
package com.raytheon.viz.core.graphing.axis; package com.raytheon.viz.core.graphing.axis;
import java.util.ArrayList;
import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.Stack; import java.util.Stack;
import com.raytheon.uf.viz.core.DrawableLine;
import com.raytheon.uf.viz.core.IExtent; import com.raytheon.uf.viz.core.IExtent;
import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.PixelExtent;
import com.raytheon.uf.viz.core.IGraphicsTarget.HorizontalAlignment; import com.raytheon.uf.viz.core.IGraphicsTarget.HorizontalAlignment;
import com.raytheon.uf.viz.core.PixelExtent;
import com.raytheon.uf.viz.core.drawables.IFont; import com.raytheon.uf.viz.core.drawables.IFont;
import com.raytheon.uf.viz.core.drawables.PaintProperties; import com.raytheon.uf.viz.core.drawables.PaintProperties;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
@ -47,6 +50,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 24Oct2006 Phillippe Initial Creation * 24Oct2006 Phillippe Initial Creation
* Oct 2007 njensen Major refactor * Oct 2007 njensen Major refactor
* 24Jul2014 3429 mapeters Updated deprecated drawLine() calls.
* *
* </pre> * </pre>
* *
@ -119,7 +123,8 @@ public class NumberAxis extends Axis {
// Draws the axes // Draws the axes
target.drawRect(new PixelExtent(graphArea), DEFAULT_AXIS_COLOR, 1.0f, target.drawRect(new PixelExtent(graphArea), DEFAULT_AXIS_COLOR, 1.0f,
1.0); 1.0);
List<DrawableLine> lines = new ArrayList<DrawableLine>();
if (orientation == IAxis.Orientation.VERTICAL) { if (orientation == IAxis.Orientation.VERTICAL) {
double maxLabelWidth = 0.0; double maxLabelWidth = 0.0;
@ -154,9 +159,13 @@ public class NumberAxis extends Axis {
double x = graphArea.x; double x = graphArea.x;
double x2 = graphArea.x + graphArea.width; double x2 = graphArea.x + graphArea.width;
target.drawLine(x, y, 0.0, x2, y, 0.0, DrawableLine line = new DrawableLine();
DEFAULT_AXIS_COLOR, lineWeight, line.setCoordinates(x, y);
labelLineStyle); line.addPoint(x2, y);
line.basics.color = DEFAULT_AXIS_COLOR;
line.width = lineWeight;
line.lineStyle = labelLineStyle;
lines.add(line);
} }
yPos = y yPos = y
@ -169,9 +178,13 @@ public class NumberAxis extends Axis {
labeling.getLabel(labelVal)) labeling.getLabel(labelVal))
.getWidth(); .getWidth();
target.drawLine(x, y, 0.0, x2, y, 0.0, DrawableLine line = new DrawableLine();
DEFAULT_AXIS_COLOR, lineWeight, line.setCoordinates(x, y);
labelLineStyle); line.addPoint(x2, y);
line.basics.color = DEFAULT_AXIS_COLOR;
line.width = lineWeight;
line.lineStyle = labelLineStyle;
lines.add(line);
} }
target.drawString(font, labeling.getLabel(labelVal), target.drawString(font, labeling.getLabel(labelVal),
@ -221,17 +234,27 @@ public class NumberAxis extends Axis {
if (drawLinesAtLabels) { if (drawLinesAtLabels) {
double y = graphArea.y; double y = graphArea.y;
target.drawLine(x, y, 0.0, x, yEnd, 0.0, DrawableLine line = new DrawableLine();
DEFAULT_AXIS_COLOR, lineWeight, labelLineStyle); line.setCoordinates(x, y);
line.addPoint(x, yEnd);
line.basics.color = DEFAULT_AXIS_COLOR;
line.width = lineWeight;
line.lineStyle = labelLineStyle;
lines.add(line);
} }
if (drawTickmarksAtLabels) { if (drawTickmarksAtLabels) {
double y = yPos double y = yPos
- target.getStringBounds(null, - target.getStringBounds(null,
labeling.getLabel(labelVal)) labeling.getLabel(labelVal))
.getHeight(); .getHeight();
target.drawLine(x, y, 0.0, x, yEnd, 0.0, DrawableLine line = new DrawableLine();
DEFAULT_AXIS_COLOR, lineWeight, labelLineStyle); line.setCoordinates(x, y);
line.addPoint(x, yEnd);
line.basics.color = DEFAULT_AXIS_COLOR;
line.width = lineWeight;
line.lineStyle = labelLineStyle;
lines.add(line);
} }
target.drawString(font, labeling.getLabel(labelVal), xPos, target.drawString(font, labeling.getLabel(labelVal), xPos,
@ -241,7 +264,8 @@ public class NumberAxis extends Axis {
} }
} }
target.drawLine(lines.toArray(new DrawableLine[0]));
if (font != target.getDefaultFont()) { if (font != target.getDefaultFont()) {
font.dispose(); font.dispose();
} }

View file

@ -25,6 +25,7 @@ import java.util.List;
import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.graphics.RGB;
import com.raytheon.uf.viz.core.DrawableLine;
import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.RGBColors; import com.raytheon.uf.viz.core.RGBColors;
import com.raytheon.uf.viz.core.drawables.IDescriptor; import com.raytheon.uf.viz.core.drawables.IDescriptor;
@ -44,6 +45,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 04/10/2008 chammack Initial Creation. * 04/10/2008 chammack Initial Creation.
* 04/14/2009 #2058 rjpeter Ensured nulls couldn't be added to polyLineVis. * 04/14/2009 #2058 rjpeter Ensured nulls couldn't be added to polyLineVis.
* 07/23/2014 #3429 mapeters Updated deprecated drawLine() call.
* </pre> * </pre>
* *
* @author chammack * @author chammack
@ -107,16 +109,21 @@ public class FreeformRenderable implements IRenderable {
if (descriptor != null) { if (descriptor != null) {
double[] last = null; double[] last = null;
double[] nextCoord = new double[2]; double[] nextCoord = new double[2];
List<DrawableLine> lines = new ArrayList<DrawableLine>();
for (Coordinate coord : polyLineVis) { for (Coordinate coord : polyLineVis) {
nextCoord[0] = coord.x; nextCoord[0] = coord.x;
nextCoord[1] = coord.y; nextCoord[1] = coord.y;
double[] out = descriptor.worldToPixel(nextCoord); double[] out = descriptor.worldToPixel(nextCoord);
if ((last != null) && (out != null)) { if ((last != null) && (out != null)) {
target.drawLine(last[0], last[1], 0.0, out[0], out[1], 0.0, DrawableLine line = new DrawableLine();
drawingColor, 1.0f); line.setCoordinates(last[0], last[1]);
line.addPoint(out[0], out[1]);
line.basics.color = drawingColor;
lines.add(line);
} }
last = out; last = out;
} }
target.drawLine(lines.toArray(new DrawableLine[0]));
} }
} }

View file

@ -37,6 +37,7 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.SimulatedTime; import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.viz.core.DrawableLine;
import com.raytheon.uf.viz.core.DrawableString; import com.raytheon.uf.viz.core.DrawableString;
import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.IGraphicsTarget.HorizontalAlignment; import com.raytheon.uf.viz.core.IGraphicsTarget.HorizontalAlignment;
@ -71,6 +72,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* calcGridLabels(). * calcGridLabels().
* 11/05/2012 #14566 jzeng Paint the sample points with the order of grids * 11/05/2012 #14566 jzeng Paint the sample points with the order of grids
* in calcGridLabels () * in calcGridLabels ()
* 07/24/2014 #3429 mapeters Updated deprecated drawLine() calls.
* </pre> * </pre>
* *
* @author chammack * @author chammack
@ -205,12 +207,19 @@ public class SamplePainter {
if (showDataValues) { if (showDataValues) {
double tickMarkExtent = ratio * 3; double tickMarkExtent = ratio * 3;
target.drawLine(screenloc[0] - tickMarkExtent, screenloc[1], DrawableLine[] lines = new DrawableLine[2];
0.0, screenloc[0] + tickMarkExtent, screenloc[1], 0.0, lines[0] = new DrawableLine();
llPlusColor, 2.0f); lines[0].setCoordinates(screenloc[0] - tickMarkExtent, screenloc[1]);
target.drawLine(screenloc[0], screenloc[1] - tickMarkExtent, lines[0].addPoint(screenloc[0] + tickMarkExtent, screenloc[1]);
0.0, screenloc[0], screenloc[1] + tickMarkExtent, 0.0, lines[0].basics.color = llPlusColor;
llPlusColor, 2.0f); lines[0].width = 2.0f;
lines[1] = new DrawableLine();
lines[1].setCoordinates(screenloc[0], screenloc[1] - tickMarkExtent);
lines[1].addPoint(screenloc[0], screenloc[1] + tickMarkExtent);
lines[1].basics.color = llPlusColor;
lines[1].width = 2.0f;
target.drawLine(lines);
} }

View file

@ -48,6 +48,7 @@ import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.TimeRange; import com.raytheon.uf.common.time.TimeRange;
import com.raytheon.uf.viz.core.DrawableLine;
import com.raytheon.uf.viz.core.DrawableString; import com.raytheon.uf.viz.core.DrawableString;
import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.IGraphicsTarget.HorizontalAlignment; import com.raytheon.uf.viz.core.IGraphicsTarget.HorizontalAlignment;
@ -97,6 +98,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* on discrete color bar when no grid exists * on discrete color bar when no grid exists
* Feb 12, 2013 15719 jdynina Fixed out of bounds error in calcGridColorTable * Feb 12, 2013 15719 jdynina Fixed out of bounds error in calcGridColorTable
* Oct 31, 2013 #2508 randerso Change to use DiscreteGridSlice.getKeys() * Oct 31, 2013 #2508 randerso Change to use DiscreteGridSlice.getKeys()
* Jul 23, 2014 #3429 mapeters Updated deprecated drawLine() calls
* *
* </pre> * </pre>
* *
@ -529,11 +531,14 @@ public class DiscreteColorbar implements IColorBarDisplay,
dstring.horizontalAlignment = HorizontalAlignment.CENTER; dstring.horizontalAlignment = HorizontalAlignment.CENTER;
dstring.verticallAlignment = VerticalAlignment.MIDDLE; dstring.verticallAlignment = VerticalAlignment.MIDDLE;
DrawableLine[] lines = new DrawableLine[colorTable.size()];
i = 0; i = 0;
for (ColorEntry colorEntry : colorTable) { for (ColorEntry colorEntry : colorTable) {
double ikeywidth = i * keywidth; double ikeywidth = i * keywidth;
target.drawLine(minX + ikeywidth, minY, 0.0, minX + ikeywidth, lines[i] = new DrawableLine();
maxY, 0.0, seColorBarTickColor, 1.0f); lines[i].setCoordinates(minX + ikeywidth, minY);
lines[i].addPoint(minX + ikeywidth, maxY);
lines[i].basics.color = seColorBarTickColor;
String keyName = colorEntry.getValue().toString(); String keyName = colorEntry.getValue().toString();
labelLoc = (float) (minX + ikeywidth) + ((float) keywidth / 2); labelLoc = (float) (minX + ikeywidth) + ((float) keywidth / 2);
@ -556,6 +561,7 @@ public class DiscreteColorbar implements IColorBarDisplay,
} }
i++; i++;
} }
target.drawLine(lines);
} }
/** /**

View file

@ -22,6 +22,7 @@ package com.raytheon.viz.mpe.ui.rsc;
import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.graphics.RGB;
import com.raytheon.uf.viz.core.DrawableCircle; import com.raytheon.uf.viz.core.DrawableCircle;
import com.raytheon.uf.viz.core.DrawableLine;
import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.drawables.PaintProperties; import com.raytheon.uf.viz.core.drawables.PaintProperties;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
@ -42,6 +43,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Sep 22, 2009 snaples Initial creation * Sep 22, 2009 snaples Initial creation
* Jul 22, 2014 #3422 mapeters Updated deprecated drawFilledCircle() call. * Jul 22, 2014 #3422 mapeters Updated deprecated drawFilledCircle() call.
* Jul 24, 2014 #3429 mapeters Updated deprecated drawLine() calls.
* </pre> * </pre>
* *
* @author snaples * @author snaples
@ -98,15 +100,20 @@ public abstract class HydroPointResource <T extends HydroPointResourceData<?>> e
if (pixels != null) { if (pixels != null) {
RGB color = getCapability(ColorableCapability.class).getColor(); RGB color = getCapability(ColorableCapability.class).getColor();
if (getStyle() == Style.STAR) { if (getStyle() == Style.STAR) {
target.drawLine(pixels[0], pixels[1] - LINE_LENGTH, 0.0, DrawableLine[] lines = new DrawableLine[3];
pixels[0], pixels[1] + LINE_LENGTH, 0.0, color, lines[0] = new DrawableLine();
getLineWidth()); lines[0].setCoordinates(pixels[0], pixels[1] - LINE_LENGTH);
target.drawLine(pixels[0] - LINE_LENGTH, pixels[1] lines[0].addPoint(pixels[0], pixels[1] + LINE_LENGTH);
+ LINE_LENGTH, 0.0, pixels[0] + LINE_LENGTH, pixels[1] lines[0].basics.color = color;
- LINE_LENGTH, 0.0, color, getLineWidth()); lines[1] = new DrawableLine();
target.drawLine(pixels[0] - LINE_LENGTH, pixels[1] lines[1].setCoordinates(pixels[0] - LINE_LENGTH, pixels[1] + LINE_LENGTH);
- LINE_LENGTH, 0.0, pixels[0] + LINE_LENGTH, pixels[1] lines[1].addPoint(pixels[0] + LINE_LENGTH, pixels[1] - LINE_LENGTH);
+ LINE_LENGTH, 0.0, color, getLineWidth()); lines[1].basics.color = color;
lines[2] = new DrawableLine();
lines[2].setCoordinates(pixels[0] - LINE_LENGTH, pixels[1] - LINE_LENGTH);
lines[2].addPoint(pixels[0] + LINE_LENGTH, pixels[1] + LINE_LENGTH);
lines[2].basics.color = color;
target.drawLine(lines);
} else if (getStyle() == Style.RECTANGLE) { } else if (getStyle() == Style.RECTANGLE) {
target.drawShadedRect(paintProps.getView().getExtent(), color, target.drawShadedRect(paintProps.getView().getExtent(), color,
1.0, null); 1.0, null);

View file

@ -41,6 +41,7 @@ import com.raytheon.uf.common.hydro.spatial.HRAPSubGrid;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.DrawableLine;
import com.raytheon.uf.viz.core.IDisplayPaneContainer; import com.raytheon.uf.viz.core.IDisplayPaneContainer;
import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.drawables.IDescriptor; import com.raytheon.uf.viz.core.drawables.IDescriptor;
@ -72,7 +73,7 @@ import com.vividsolutions.jts.geom.Polygon;
* Jun 30, 2009 2685 mpduff Initial creation. * Jun 30, 2009 2685 mpduff Initial creation.
* Sep 23, 2009 3069 mpduff Changed the parent class to HydroPointResource. * Sep 23, 2009 3069 mpduff Changed the parent class to HydroPointResource.
* Feb 07, 2011 5535 mschenke Rewrote resource to fix numerous issues and follow viz standards * Feb 07, 2011 5535 mschenke Rewrote resource to fix numerous issues and follow viz standards
* * Jul 24, 2014 3429 mapeters Updated deprecated drawLine() calls.
* </pre> * </pre>
* *
* @author mpduff * @author mpduff
@ -229,21 +230,18 @@ public class MPEPolygonResource extends
private void paintCoordinates(IGraphicsTarget target, private void paintCoordinates(IGraphicsTarget target,
PaintProperties paintProps, Coordinate[] coords) PaintProperties paintProps, Coordinate[] coords)
throws VizException { throws VizException {
Coordinate prev = coords[0]; double[] startPixels = descriptor.worldToPixel(new double[] {
double[] prevPixels = descriptor.worldToPixel(new double[] { prev.x, coords[0].x, coords[0].y });
prev.y }); DrawableLine line = new DrawableLine();
line.basics.color = getCapability(ColorableCapability.class).getColor();
line.setCoordinates(startPixels[0], startPixels[1]);
for (int i = 1; i < coords.length; ++i) { for (int i = 1; i < coords.length; ++i) {
Coordinate curr = coords[i]; Coordinate curr = coords[i];
double[] currPixels = descriptor.worldToPixel(new double[] { double[] currPixels = descriptor.worldToPixel(new double[] {
curr.x, curr.y }); curr.x, curr.y });
line.addPoint(currPixels[0], currPixels[1]);
target.drawLine(prevPixels[0], prevPixels[1], 0.0, currPixels[0],
currPixels[1], 0.0,
getCapability(ColorableCapability.class).getColor(), 1.0f);
prev = curr;
prevPixels = currPixels;
} }
target.drawLine(line);
} }
/* /*

View file

@ -48,6 +48,7 @@ import com.raytheon.uf.common.colormap.prefs.DataMappingPreferences;
import com.raytheon.uf.common.colormap.prefs.DataMappingPreferences.DataMappingEntry; import com.raytheon.uf.common.colormap.prefs.DataMappingPreferences.DataMappingEntry;
import com.raytheon.uf.common.dataplugin.shef.tables.Colorvalue; import com.raytheon.uf.common.dataplugin.shef.tables.Colorvalue;
import com.raytheon.uf.common.geospatial.ReferencedCoordinate; import com.raytheon.uf.common.geospatial.ReferencedCoordinate;
import com.raytheon.uf.viz.core.DrawableLine;
import com.raytheon.uf.viz.core.DrawableString; import com.raytheon.uf.viz.core.DrawableString;
import com.raytheon.uf.viz.core.IExtent; import com.raytheon.uf.viz.core.IExtent;
import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.IGraphicsTarget;
@ -86,7 +87,7 @@ import com.vividsolutions.jts.index.strtree.STRtree;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jul 8, 2009 2589 snaples Initial creation * Jul 8, 2009 2589 snaples Initial creation
* Mar 3, 2014 2804 mschenke Set back up clipping pane * Mar 3, 2014 2804 mschenke Set back up clipping pane
* * Jul 24, 2014 3429 mapeters Updated deprecated drawLine() calls.
* </pre> * </pre>
* *
* @author snaples * @author snaples
@ -532,7 +533,7 @@ public class PointFreezePlotResource extends
} }
} }
private void drawQCLegend() { private void drawQCLegend() throws VizException {
// TODO this screen location code is borrowed from MPELegendResource... // TODO this screen location code is borrowed from MPELegendResource...
// should it be put into a shared class, possibly a paint // should it be put into a shared class, possibly a paint
// properties method? // properties method?
@ -553,30 +554,29 @@ public class PointFreezePlotResource extends
int[] funct = DailyQcUtils.funct; int[] funct = DailyQcUtils.funct;
int temp = 0; int temp = 0;
DrawableLine[] lines = new DrawableLine[4];
for (int i = 0; i < typename.length; i++) { for (int i = 0; i < typename.length; i++) {
if (i != 0 && i != 6 && i != 7 && i != 3) { if (i != 0 && i != 6 && i != 7 && i != 3) {
continue; continue;
} }
try { color = RGBColors.getRGBColor(color_map_a[funct[i]]);
color = RGBColors.getRGBColor(color_map_a[funct[i]]); lines[temp] = new DrawableLine();
target.drawLine(x1, y1 + temp * textSpace, 0.0, x1 lines[temp].setCoordinates(x1, y1 + temp * textSpace);
+ (2.5 * padding), y1 + temp * textSpace, 0.0, color, lines[temp].addPoint(x1 + (2.5 * padding), y1 + temp * textSpace);
35); lines[temp].basics.color = color;
label = typename[i]; lines[temp].width = 35;
color = RGBColors.getRGBColor(color_map_n[15]); label = typename[i];
double xLoc = x1 + (4 * padding); color = RGBColors.getRGBColor(color_map_n[15]);
double yLoc = y1 + (temp + .5) * textSpace; double xLoc = x1 + (4 * padding);
string.setText(label, color); double yLoc = y1 + (temp + .5) * textSpace;
string.setCoordinates(xLoc, yLoc); string.setText(label, color);
string.horizontalAlignment = HorizontalAlignment.LEFT; string.setCoordinates(xLoc, yLoc);
string.verticallAlignment = VerticalAlignment.BOTTOM; string.horizontalAlignment = HorizontalAlignment.LEFT;
target.drawStrings(string); string.verticallAlignment = VerticalAlignment.BOTTOM;
temp++; target.drawStrings(string);
} catch (VizException e) { temp++;
// TODO Auto-generated catch block
e.printStackTrace();
}
} }
target.drawLine(lines);
} }
/** /**

View file

@ -48,6 +48,7 @@ import com.raytheon.uf.common.colormap.prefs.DataMappingPreferences;
import com.raytheon.uf.common.colormap.prefs.DataMappingPreferences.DataMappingEntry; import com.raytheon.uf.common.colormap.prefs.DataMappingPreferences.DataMappingEntry;
import com.raytheon.uf.common.dataplugin.shef.tables.Colorvalue; import com.raytheon.uf.common.dataplugin.shef.tables.Colorvalue;
import com.raytheon.uf.common.geospatial.ReferencedCoordinate; import com.raytheon.uf.common.geospatial.ReferencedCoordinate;
import com.raytheon.uf.viz.core.DrawableLine;
import com.raytheon.uf.viz.core.DrawableString; import com.raytheon.uf.viz.core.DrawableString;
import com.raytheon.uf.viz.core.IExtent; import com.raytheon.uf.viz.core.IExtent;
import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.IGraphicsTarget;
@ -88,7 +89,7 @@ import com.vividsolutions.jts.index.strtree.STRtree;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Nov 24, 2008 1748 snaples Initial creation * Nov 24, 2008 1748 snaples Initial creation
* Mar 3, 2014 2804 mschenke Set back up clipping pane * Mar 3, 2014 2804 mschenke Set back up clipping pane
* * Jul 24, 2014 3429 mapeters Updated deprecated drawLine() calls.
* </pre> * </pre>
* *
* @author snaples * @author snaples
@ -765,7 +766,7 @@ public class PointPrecipPlotResource extends
} }
} }
private void drawQCLegend() { private void drawQCLegend() throws VizException {
// TODO this screen location code is borrowed from MPELegendResource... // TODO this screen location code is borrowed from MPELegendResource...
// should it be put into a shared class, possibly a paint // should it be put into a shared class, possibly a paint
// properties method? // properties method?
@ -784,26 +785,25 @@ public class PointPrecipPlotResource extends
RGB color = null; RGB color = null;
String label = ""; String label = "";
int[] funct = DailyQcUtils.funct; int[] funct = DailyQcUtils.funct;
DrawableLine[] lines = new DrawableLine[typename.length];
for (int i = 0; i < typename.length; i++) { for (int i = 0; i < typename.length; i++) {
color = RGBColors.getRGBColor(color_map_a[funct[i]]);
try { lines[i] = new DrawableLine();
color = RGBColors.getRGBColor(color_map_a[funct[i]]); lines[i].setCoordinates(x1, y1 + i * textSpace);
target.drawLine(x1, y1 + i * textSpace, 0.0, x1 lines[i].addPoint(x1 + (2.5 * padding), y1 + i * textSpace);
+ (2.5 * padding), y1 + i * textSpace, 0.0, color, 35); lines[i].basics.color = color;
label = typename[i]; lines[i].width = 35;
color = RGBColors.getRGBColor(color_map_n[15]); label = typename[i];
double xLoc = x1 + (4 * padding); color = RGBColors.getRGBColor(color_map_n[15]);
double yLoc = y1 + (i + .45) * textSpace; double xLoc = x1 + (4 * padding);
string.setText(label, color); double yLoc = y1 + (i + .45) * textSpace;
string.setCoordinates(xLoc, yLoc); string.setText(label, color);
string.horizontalAlignment = HorizontalAlignment.LEFT; string.setCoordinates(xLoc, yLoc);
string.verticallAlignment = VerticalAlignment.BOTTOM; string.horizontalAlignment = HorizontalAlignment.LEFT;
target.drawStrings(string); string.verticallAlignment = VerticalAlignment.BOTTOM;
} catch (VizException e) { target.drawStrings(string);
// TODO Auto-generated catch block
e.printStackTrace();
}
} }
target.drawLine(lines);
} }

View file

@ -48,6 +48,7 @@ import com.raytheon.uf.common.colormap.prefs.DataMappingPreferences;
import com.raytheon.uf.common.colormap.prefs.DataMappingPreferences.DataMappingEntry; import com.raytheon.uf.common.colormap.prefs.DataMappingPreferences.DataMappingEntry;
import com.raytheon.uf.common.dataplugin.shef.tables.Colorvalue; import com.raytheon.uf.common.dataplugin.shef.tables.Colorvalue;
import com.raytheon.uf.common.geospatial.ReferencedCoordinate; import com.raytheon.uf.common.geospatial.ReferencedCoordinate;
import com.raytheon.uf.viz.core.DrawableLine;
import com.raytheon.uf.viz.core.DrawableString; import com.raytheon.uf.viz.core.DrawableString;
import com.raytheon.uf.viz.core.IExtent; import com.raytheon.uf.viz.core.IExtent;
import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.IGraphicsTarget;
@ -87,6 +88,7 @@ import com.vividsolutions.jts.index.strtree.STRtree;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jun 24, 2009 2524 snaples Initial creation * Jun 24, 2009 2524 snaples Initial creation
* Mar 3, 2014 2804 mschenke Set back up clipping pane * Mar 3, 2014 2804 mschenke Set back up clipping pane
* Jul 24, 2014 3429 mapeters Updated deprecated drawLine() calls.
* *
* </pre> * </pre>
* *
@ -606,7 +608,7 @@ public class PointTempPlotResource extends
} }
} }
private void drawQCLegend() { private void drawQCLegend() throws VizException {
// TODO this screen location code is borrowed from MPELegendResource... // TODO this screen location code is borrowed from MPELegendResource...
// should it be put into a shared class, possibly a paint // should it be put into a shared class, possibly a paint
// properties method? // properties method?
@ -626,33 +628,30 @@ public class PointTempPlotResource extends
String label = ""; String label = "";
int[] funct = DailyQcUtils.funct; int[] funct = DailyQcUtils.funct;
int temp = 0; int temp = 0;
int x = 0;
DrawableLine[] lines = new DrawableLine[typename.length - 1];
for (int i = 0; i < typename.length; i++) { for (int i = 0; i < typename.length; i++) {
if (i == 5) { if (i == 5) {
continue; continue;
} }
color = RGBColors.getRGBColor(color_map_a[funct[i]]);
try { lines[x] = new DrawableLine();
color = RGBColors.getRGBColor(color_map_a[funct[i]]); lines[x].setCoordinates(x1, y1 + temp * textSpace);
target.drawLine(x1, y1 + temp * textSpace, 0.0, x1 lines[x].addPoint(x1 + (2.5 * padding), y1 + temp * textSpace);
+ (2.5 * padding), y1 + temp * textSpace, 0.0, color, lines[x].basics.color = color;
35); lines[x++].width = 35;
label = typename[i]; label = typename[i];
color = RGBColors.getRGBColor(color_map_n[15]); color = RGBColors.getRGBColor(color_map_n[15]);
double xLoc = x1 + (4 * padding); double xLoc = x1 + (4 * padding);
double yLoc = y1 + (temp + .5) * textSpace; double yLoc = y1 + (temp + .5) * textSpace;
string.setText(label, color); string.setText(label, color);
string.setCoordinates(xLoc, yLoc); string.setCoordinates(xLoc, yLoc);
string.horizontalAlignment = HorizontalAlignment.LEFT; string.horizontalAlignment = HorizontalAlignment.LEFT;
string.verticallAlignment = VerticalAlignment.BOTTOM; string.verticallAlignment = VerticalAlignment.BOTTOM;
target.drawStrings(string); target.drawStrings(string);
temp++; temp++;
} catch (VizException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} }
target.drawLine(lines);
} }
/** /**

View file

@ -26,7 +26,9 @@ import java.util.List;
import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.graphics.Rectangle;
import com.raytheon.uf.viz.core.AbstractDrawableObject;
import com.raytheon.uf.viz.core.DrawableCircle; import com.raytheon.uf.viz.core.DrawableCircle;
import com.raytheon.uf.viz.core.DrawableLine;
import com.raytheon.uf.viz.core.IExtent; import com.raytheon.uf.viz.core.IExtent;
import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.IGraphicsTarget.HorizontalAlignment; import com.raytheon.uf.viz.core.IGraphicsTarget.HorizontalAlignment;
@ -58,6 +60,8 @@ import com.raytheon.viz.radar.ui.xy.RadarGraphResource.GraphPosition;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Apr 8, 2009 askripsk Initial creation * Apr 8, 2009 askripsk Initial creation
* 07-21-14 #3412 mapeters Updated deprecated drawCircle call. * 07-21-14 #3412 mapeters Updated deprecated drawCircle call.
* 07-24-14 #3429 mapeters Updated deprecated drawLine() calls.
*
* </pre> * </pre>
* *
* @author askripsk * @author askripsk
@ -111,15 +115,17 @@ public class CellTrendGraph extends XYGraph {
double previousScreenY = 0.0; double previousScreenY = 0.0;
// Paint each series in the xyData // Paint each series in the xyData
boolean first = true; boolean first;
int i = 0; int i = 0;
LineStyle currLineStyle; LineStyle currLineStyle;
PointType currPointType; PointType currPointType;
List<DrawableCircle> circles = new ArrayList<DrawableCircle>();
List<DrawableLine> lines = new ArrayList<DrawableLine>();
for (XYDataList currSeries : dataSeries) { for (XYDataList currSeries : dataSeries) {
currLineStyle = dataSeriesLineTypes.get(i); currLineStyle = dataSeriesLineTypes.get(i);
currPointType = dataSeriesPointTypes.get(i++); currPointType = dataSeriesPointTypes.get(i++);
first = true; first = true;
for (XYData currPoint : currSeries.getData()) { for (XYData currPoint : currSeries.getData()) {
double x = ((Number) currPoint.getX()).doubleValue(); double x = ((Number) currPoint.getX()).doubleValue();
@ -132,53 +138,75 @@ public class CellTrendGraph extends XYGraph {
double screenX = domainAxis.valueToCoordinate(x); double screenX = domainAxis.valueToCoordinate(x);
double screenY = rangeAxis.valueToCoordinate(y); double screenY = rangeAxis.valueToCoordinate(y);
// Draw the cooresponding type of point AbstractDrawableObject object = drawPoint(target,
drawPoint(target, screenX, screenY, currPointType); screenX, screenY, currPointType);
// Add the point to its corresponding list
if (object instanceof DrawableCircle) {
circles.add((DrawableCircle) object);
} else if (object instanceof DrawableLine) {
lines.add((DrawableLine) object);
}
// Don't draw a line for the first
if (first) { if (first) {
first = false; first = false;
previousScreenX = screenX;
previousScreenY = screenY;
} else { } else {
target.drawLine(screenX, screenY, 0, DrawableLine line = new DrawableLine();
previousScreenX, previousScreenY, 0, line.setCoordinates(screenX, screenY);
colorCap.getColor(), outlineCap line.addPoint(previousScreenX, previousScreenY);
.getOutlineWidth(), currLineStyle); line.basics.color = colorCap.getColor();
line.width = outlineCap.getOutlineWidth();
line.lineStyle = currLineStyle;
lines.add(line);
} }
previousScreenX = screenX; previousScreenX = screenX;
previousScreenY = screenY; previousScreenY = screenY;
} }
} }
target.drawLine(lines.toArray(new DrawableLine[0]));
target.drawCircle(circles.toArray(new DrawableCircle[0]));
target.clearClippingPlane(); target.clearClippingPlane();
} }
} }
} }
private void drawPoint(IGraphicsTarget target, double x, double y, private AbstractDrawableObject drawPoint(IGraphicsTarget target, double x, double y,
PointType currPointType) throws VizException { PointType currPointType) throws VizException {
if (currPointType.equals(PointType.CIRCLE)) { if (currPointType.equals(PointType.CIRCLE)) {
DrawableCircle circle = new DrawableCircle(); DrawableCircle circle = new DrawableCircle();
circle = new DrawableCircle();
circle.setCoordinates(x, y); circle.setCoordinates(x, y);
circle.radius = 3.0; circle.radius = 3.0;
circle.basics.color = colorCap.getColor(); circle.basics.color = colorCap.getColor();
target.drawCircle(circle); return circle;
} else if (currPointType.equals(PointType.X)) { } else if (currPointType.equals(PointType.X)) {
target.drawLine(x - 3, y - 3, 0.0, x + 3, y + 3, 0.0, colorCap DrawableLine line = new DrawableLine();
.getColor(), 1.0f); line = new DrawableLine();
target.drawLine(x - 3, y + 3, 0.0, x + 3, y - 3, 0.0, colorCap line.setCoordinates(x - 3, y - 3);
.getColor(), 1.0f); line.addPoint(x + 3, y + 3);
line.addPoint(x, y);
line.addPoint(x - 3, y + 3);
line.addPoint(x + 3, y - 3);
line.basics.color = colorCap.getColor();
return line;
} else if (currPointType.equals(PointType.UP_ARROW)) { } else if (currPointType.equals(PointType.UP_ARROW)) {
target.drawLine(x - 3, y + 3, 0.0, x, y - 3, 0.0, colorCap DrawableLine line = new DrawableLine();
.getColor(), 1.0f); line = new DrawableLine();
target.drawLine(x, y - 3, 0.0, x + 3, y + 3, 0.0, colorCap line.setCoordinates(x - 3, y + 3);
.getColor(), 1.0f); line.addPoint(x, y - 3);
line.addPoint(x + 3, y + 3);
line.basics.color = colorCap.getColor();
return line;
} else if (currPointType.equals(PointType.DOWN_ARROW)) { } else if (currPointType.equals(PointType.DOWN_ARROW)) {
target.drawLine(x - 3, y - 3, 0.0, x, y + 3, 0.0, colorCap DrawableLine line = new DrawableLine();
.getColor(), 1.0f); line = new DrawableLine();
target.drawLine(x, y + 3, 0.0, x + 3, y - 3, 0.0, colorCap line.setCoordinates(x - 3, y - 3);
.getColor(), 1.0f); line.addPoint(x, y + 3);
line.addPoint(x + 3, y - 3);
line.basics.color = colorCap.getColor();
return line;
} else {
return null;
} }
} }
@ -205,15 +233,28 @@ public class CellTrendGraph extends XYGraph {
double offset = (labelX1 - labelX0) * 1 / 4; double offset = (labelX1 - labelX0) * 1 / 4;
List<DrawableCircle> circles = new ArrayList<DrawableCircle>();
List<DrawableLine> lines = new ArrayList<DrawableLine>();
// Write legend from left to right and top to bottom // Write legend from left to right and top to bottom
for (int i = 0; i < dataSeriesLabels.size(); i++) { for (int i = 0; i < dataSeriesLabels.size(); i++) {
// Point type // Point type
drawPoint(target, labelx[i], labely[i], dataSeriesPointTypes.get(i)); PointType pt = dataSeriesPointTypes.get(i);
AbstractDrawableObject object = drawPoint(target, labelx[i],
labely[i], pt);
//Add the point to its corresponding list
if (object instanceof DrawableCircle) {
circles.add((DrawableCircle) object);
} else if (object instanceof DrawableLine) {
lines.add((DrawableLine) object);
}
// Draw line sample // Draw line sample
target.drawLine(labelx[i], labely[i], 0, labelx[i] DrawableLine line = new DrawableLine();
+ (offset * 3 / 4), labely[i], 0, colorCap.getColor(), 1, line.setCoordinates(labelx[i], labely[i]);
dataSeriesLineTypes.get(i)); line.addPoint(labelx[i] + (offset * 3 / 4), labely[i]);
line.basics.color = colorCap.getColor();
line.lineStyle = dataSeriesLineTypes.get(i);
lines.add(line);
// Label Text // Label Text
target.drawString(null, dataSeriesLabels.get(i), target.drawString(null, dataSeriesLabels.get(i),
@ -221,6 +262,9 @@ public class CellTrendGraph extends XYGraph {
colorCap.getColor(), HorizontalAlignment.LEFT, colorCap.getColor(), HorizontalAlignment.LEFT,
VerticalAlignment.MIDDLE, 0.0); VerticalAlignment.MIDDLE, 0.0);
} }
target.drawLine(lines.toArray(new DrawableLine[0]));
target.drawCircle(circles.toArray(new DrawableCircle[0]));
} }
private void createAxes() { private void createAxes() {

View file

@ -29,6 +29,7 @@ import org.eclipse.swt.graphics.RGB;
import com.raytheon.uf.common.dataplugin.radar.RadarRecord; import com.raytheon.uf.common.dataplugin.radar.RadarRecord;
import com.raytheon.uf.common.dataplugin.radar.level3.GSMBlock.GSMMessage; import com.raytheon.uf.common.dataplugin.radar.level3.GSMBlock.GSMMessage;
import com.raytheon.uf.viz.core.DrawableLine;
import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.IGraphicsTarget.HorizontalAlignment; import com.raytheon.uf.viz.core.IGraphicsTarget.HorizontalAlignment;
import com.raytheon.uf.viz.core.IGraphicsTarget.TextStyle; import com.raytheon.uf.viz.core.IGraphicsTarget.TextStyle;
@ -54,7 +55,8 @@ import com.raytheon.viz.radar.rsc.RadarResourceData;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* May 13, 2010 mnash Initial creation * May 13, 2010 mnash Initial creation
* 03/01/2013 DR 15496 zwang Handled expanded GSM, display more status * 03/01/2013 DR 15496 zwang Handled expanded GSM, display more status
* 07/24/2014 #3429 mapeters Updated deprecated drawLine() calls.
* *
* </pre> * </pre>
* *
@ -328,9 +330,14 @@ public class RadarGSMResource extends AbstractRadarResource<RadarXYDescriptor> {
} }
int height = 780; int height = 780;
List<DrawableLine> lines = new ArrayList<DrawableLine>(
theTemp.size() + 8);
for (int i = 0; i < theTemp.size(); i++) { for (int i = 0; i < theTemp.size(); i++) {
target.drawLine(xOffset + 50, height, 0, 800, height - i DrawableLine line = new DrawableLine();
* lineSpace, 0, color, 1); line.setCoordinates(xOffset + 50, height);
line.addPoint(800, height - i * lineSpace);
line.basics.color = color;
lines.add(line);
drawNexradString( drawNexradString(
String.valueOf(theTemp.get(theTemp.size() - 1 - i)), String.valueOf(theTemp.get(theTemp.size() - 1 - i)),
800, height - i * lineSpace - 10, target, color); 800, height - i * lineSpace - 10, target, color);
@ -340,14 +347,14 @@ public class RadarGSMResource extends AbstractRadarResource<RadarXYDescriptor> {
yOffset = height + lineSpace; yOffset = height + lineSpace;
// first box // first box
target.drawLine(xOffset, yOffset, 0, xOffset + 200, yOffset, 0, DrawableLine box1 = new DrawableLine();
color, 1); box1.setCoordinates(xOffset, yOffset);
target.drawLine(xOffset, yOffset, 0, xOffset, yOffset + boxHeight, box1.addPoint(xOffset + 200, yOffset);
0, color, 1); box1.addPoint(xOffset + 200, yOffset + boxHeight);
target.drawLine(xOffset + 200, yOffset, 0, xOffset + 200, yOffset box1.addPoint(xOffset, yOffset + boxHeight);
+ boxHeight, 0, color, 1); box1.addPoint(xOffset, yOffset);
target.drawLine(xOffset, yOffset + boxHeight, 0, xOffset + 200, box1.basics.color = color;;
yOffset + boxHeight, 0, color, 1); lines.add(box1);
drawNexradString(rda_tdwr, xOffset + 85, yOffset + halfHeight, drawNexradString(rda_tdwr, xOffset + 85, yOffset + halfHeight,
target, color); target, color);
@ -361,24 +368,29 @@ public class RadarGSMResource extends AbstractRadarResource<RadarXYDescriptor> {
|| (message.getRdaStatus() & RDA_STATUS_OFFLINE) != 0) || (message.getRdaStatus() & RDA_STATUS_OFFLINE) != 0)
rdaDown = true; rdaDown = true;
if (!rdaDown) { if (!rdaDown) {
target.drawLine(xOffset + 200, yOffset + halfHeight, 0, DrawableLine arrow1line = new DrawableLine();
xOffset + 300, yOffset + halfHeight, 0, color, 1); arrow1line.setCoordinates(xOffset + 200, yOffset + halfHeight);
target.drawLine(xOffset + 300, yOffset + halfHeight, 0, arrow1line.addPoint(xOffset + 300, yOffset + halfHeight);
xOffset + 280, yOffset + halfHeight - 10, 0, color, 1); arrow1line.basics.color = color;
target.drawLine(xOffset + 300, yOffset + halfHeight, 0, DrawableLine arrow1head = new DrawableLine();
xOffset + 280, yOffset + halfHeight + 10, 0, color, 1); arrow1head.setCoordinates(xOffset + 280, yOffset + halfHeight - 10);
arrow1head.addPoint(xOffset + 300, yOffset + halfHeight);
arrow1head.addPoint(xOffset + 280, yOffset + halfHeight + 10);
arrow1head.basics.color = color;
lines.add(arrow1line);
lines.add(arrow1head);
} }
xOffset += 300; xOffset += 300;
// second box // second box
target.drawLine(xOffset, yOffset, 0, xOffset + 200, yOffset, 0, DrawableLine box2 = new DrawableLine();
color, 1); box2.setCoordinates(xOffset, yOffset);
target.drawLine(xOffset, yOffset, 0, xOffset, yOffset + boxHeight, box2.addPoint(xOffset + 200, yOffset);
0, color, 1); box2.addPoint(xOffset + 200, yOffset + boxHeight);
target.drawLine(xOffset + 200, yOffset, 0, xOffset + 200, yOffset box2.addPoint(xOffset, yOffset + boxHeight);
+ boxHeight, 0, color, 1); box2.addPoint(xOffset, yOffset);
target.drawLine(xOffset, yOffset + boxHeight, 0, xOffset + 200, box2.basics.color = color;;
yOffset + boxHeight, 0, color, 1); lines.add(box2);
drawNexradString(rpg_spg, xOffset + 85, yOffset + halfHeight, drawNexradString(rpg_spg, xOffset + 85, yOffset + halfHeight,
target, color); target, color);
@ -386,29 +398,37 @@ public class RadarGSMResource extends AbstractRadarResource<RadarXYDescriptor> {
|| dedicatedComms.equals("Disconnected")) || dedicatedComms.equals("Disconnected"))
rpgDown = true; rpgDown = true;
if (!rpgDown) { if (!rpgDown) {
target.drawLine(xOffset + 200, yOffset + halfHeight, 0, DrawableLine arrow2line = new DrawableLine();
xOffset + 300, yOffset + halfHeight, 0, color, 1); arrow2line.setCoordinates(xOffset + 200, yOffset + halfHeight);
target.drawLine(xOffset + 300, yOffset + halfHeight, 0, arrow2line.addPoint(xOffset + 300, yOffset + halfHeight);
xOffset + 280, yOffset + halfHeight - 10, 0, color, 1); arrow2line.basics.color = color;
target.drawLine(xOffset + 300, yOffset + halfHeight, 0, DrawableLine arrow2head1 = new DrawableLine();
xOffset + 280, yOffset + halfHeight + 10, 0, color, 1); arrow2head1.setCoordinates(xOffset + 280, yOffset + halfHeight - 10);
arrow2head1.addPoint(xOffset + 300, yOffset + halfHeight);
target.drawLine(xOffset + 200, yOffset + halfHeight, 0, arrow2head1.addPoint(xOffset + 280, yOffset + halfHeight + 10);
xOffset + 220, yOffset + halfHeight - 10, 0, color, 1); arrow2head1.basics.color = color;
target.drawLine(xOffset + 200, yOffset + halfHeight, 0, DrawableLine arrow2head2 = new DrawableLine();
xOffset + 220, yOffset + halfHeight + 10, 0, color, 1); arrow2head2.setCoordinates(xOffset + 220, yOffset + halfHeight - 10);
arrow2head2.addPoint(xOffset + 200, yOffset + halfHeight);
arrow2head2.addPoint(xOffset + 220, yOffset + halfHeight + 10);
arrow2head2.basics.color = color;
lines.add(arrow2line);
lines.add(arrow2head1);
lines.add(arrow2head2);
} }
xOffset += 300; xOffset += 300;
// third box // third box
target.drawLine(xOffset, yOffset, 0, xOffset + 200, yOffset, 0, DrawableLine box3 = new DrawableLine();
color, 1); box3.setCoordinates(xOffset, yOffset);
target.drawLine(xOffset, yOffset, 0, xOffset, yOffset + boxHeight, box3.addPoint(xOffset + 200, yOffset);
0, color, 1); box3.addPoint(xOffset + 200, yOffset + boxHeight);
target.drawLine(xOffset + 200, yOffset, 0, xOffset + 200, yOffset box3.addPoint(xOffset, yOffset + boxHeight);
+ boxHeight, 0, color, 1); box3.addPoint(xOffset, yOffset);
target.drawLine(xOffset, yOffset + boxHeight, 0, xOffset + 200, box3.basics.color = color;;
yOffset + boxHeight, 0, color, 1); lines.add(box3);
target.drawLine(lines.toArray(new DrawableLine[0]));
drawNexradString("WFO", xOffset + 85, yOffset + 58, target, color); drawNexradString("WFO", xOffset + 85, yOffset + 58, target, color);
} }
} }

View file

@ -44,6 +44,7 @@ import com.raytheon.uf.common.dataplugin.radar.level3.UnlinkedVectorPacket;
import com.raytheon.uf.common.dataplugin.radar.level3.WindBarbPacket; import com.raytheon.uf.common.dataplugin.radar.level3.WindBarbPacket;
import com.raytheon.uf.common.dataplugin.radar.level3.WindBarbPacket.WindBarbPoint; import com.raytheon.uf.common.dataplugin.radar.level3.WindBarbPacket.WindBarbPoint;
import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.DrawableLine;
import com.raytheon.uf.viz.core.DrawableString; import com.raytheon.uf.viz.core.DrawableString;
import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.IGraphicsTarget.HorizontalAlignment; import com.raytheon.uf.viz.core.IGraphicsTarget.HorizontalAlignment;
@ -83,7 +84,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Mar 19, 2013 1804 bsteffen Remove empty data structures from radar * Mar 19, 2013 1804 bsteffen Remove empty data structures from radar
* hdf5. * hdf5.
* Sep 23, 2013 2363 bsteffen Add more vector configuration options. * Sep 23, 2013 2363 bsteffen Add more vector configuration options.
* * Jul 23, 2014 3429 mapeters Updated deprecated drawLine() calls.
* </pre> * </pre>
* *
* @author askripsk * @author askripsk
@ -220,22 +221,29 @@ public class RadarXYResource extends RadarImageResource<RadarXYDescriptor> {
.getMagnification().floatValue(); .getMagnification().floatValue();
// Paint unlinked lines // Paint unlinked lines
DrawableLine[] lines = new DrawableLine[this.unlinkedLines.size() + this.linkedLines.size()];
int i = 0;
for (UnlinkedVector currVec : this.unlinkedLines) { for (UnlinkedVector currVec : this.unlinkedLines) {
target.drawLine((currVec.i1 + X_OFFSET_NWP) * SCALAR, lines[i] = new DrawableLine();
(currVec.j1 + Y_OFFSET_NWP) * SCALAR, 0, lines[i].setCoordinates((currVec.i1 + X_OFFSET_NWP) * SCALAR,
(currVec.i2 + X_OFFSET_NWP) * SCALAR, (currVec.j1 + Y_OFFSET_NWP) * SCALAR);
(currVec.j2 + Y_OFFSET_NWP) * SCALAR, 0, lines[i].addPoint((currVec.i2 + X_OFFSET_NWP) * SCALAR,
getVectorColor(currVec), 1 * magnification); (currVec.j2 + Y_OFFSET_NWP) * SCALAR);
lines[i].basics.color = getVectorColor(currVec);
lines[i++].width = 1 * magnification;
} }
// Paint linked lines // Paint linked lines
for (LinkedVector currVec : this.linkedLines) { for (LinkedVector currVec : this.linkedLines) {
target.drawLine((currVec.i1 + X_OFFSET_NWP) * SCALAR, lines[i] = new DrawableLine();
(currVec.j1 + Y_OFFSET_NWP) * SCALAR, 0, lines[i].setCoordinates((currVec.i1 + X_OFFSET_NWP) * SCALAR,
(currVec.i2 + X_OFFSET_NWP) * SCALAR, (currVec.j1 + Y_OFFSET_NWP) * SCALAR);
(currVec.j2 + Y_OFFSET_NWP) * SCALAR, 0, lines[i].addPoint((currVec.i2 + X_OFFSET_NWP) * SCALAR,
getVectorColor(currVec), 1 * magnification); (currVec.j2 + Y_OFFSET_NWP) * SCALAR);
lines[i].basics.color = getVectorColor(currVec);
lines[i++].width = 1 * magnification;
} }
target.drawLine(lines);
} }
private void paintPoints(IGraphicsTarget target, PaintProperties paintProps) private void paintPoints(IGraphicsTarget target, PaintProperties paintProps)

View file

@ -79,6 +79,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.SimulatedTime; import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.viz.core.DrawableLine;
import com.raytheon.uf.viz.core.DrawableString; import com.raytheon.uf.viz.core.DrawableString;
import com.raytheon.uf.viz.core.IDisplayPane; import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.IDisplayPaneContainer; import com.raytheon.uf.viz.core.IDisplayPaneContainer;
@ -212,6 +213,7 @@ import com.vividsolutions.jts.io.WKTReader;
* 04/23/2014 DR 16356 Qinglu Lin Updated initializeState() and added reset(). * 04/23/2014 DR 16356 Qinglu Lin Updated initializeState() and added reset().
* 04/28,2014 3033 jsanchez Properly handled back up configuration (*.xml) files. Set backupSite to null when backup site is not selected. * 04/28,2014 3033 jsanchez Properly handled back up configuration (*.xml) files. Set backupSite to null when backup site is not selected.
* 05/16/2014 DR 17365 D. Friedman Check if moved vertex results in polygon valid in both lat/lon and local coordinates. * 05/16/2014 DR 17365 D. Friedman Check if moved vertex results in polygon valid in both lat/lon and local coordinates.
* 07/24/2014 3429 mapeters Updated deprecated drawLine() calls.
* </pre> * </pre>
* *
* @author mschenke * @author mschenke
@ -1017,6 +1019,8 @@ public class WarngenLayer extends AbstractStormTrackResource {
double[] in1 = new double[2]; double[] in1 = new double[2];
double[] in2 = new double[2]; double[] in2 = new double[2];
List<DrawableLine> lines = new ArrayList<DrawableLine>(
(c.length - 1) * 2);
for (int i = 0; i < (c.length - 1); i++) { for (int i = 0; i < (c.length - 1); i++) {
in1[0] = c[i].x; in1[0] = c[i].x;
in1[1] = c[i].y; in1[1] = c[i].y;
@ -1025,8 +1029,13 @@ public class WarngenLayer extends AbstractStormTrackResource {
double[] out1 = this.descriptor.worldToPixel(in1); double[] out1 = this.descriptor.worldToPixel(in1);
double[] out2 = this.descriptor.worldToPixel(in2); double[] out2 = this.descriptor.worldToPixel(in2);
target.drawLine(out1[0], out1[1], 0.0, out2[0], out2[1], 0.0,
color, LINE_WIDTH); DrawableLine line = new DrawableLine();
line.setCoordinates(out1[0], out1[1]);
line.addPoint(out2[0], out2[1]);
line.basics.color = color;
line.width = LINE_WIDTH;
lines.add(line);
double delta; double delta;
@ -1043,15 +1052,16 @@ public class WarngenLayer extends AbstractStormTrackResource {
double[] triRight = new double[] { out1[0] + delta, double[] triRight = new double[] { out1[0] + delta,
out1[1] + delta }; out1[1] + delta };
target.drawLine(triTop[0], triTop[1], 0.0, triLeft[0], DrawableLine line2 = new DrawableLine();
triLeft[1], 0.0, color, LINE_WIDTH); line2.setCoordinates(triLeft[0], triLeft[1]);
target.drawLine(triTop[0], triTop[1], 0.0, triRight[0], line2.addPoint(triTop[0], triTop[1]);
triRight[1], 0.0, color, LINE_WIDTH); line2.addPoint(triRight[0], triRight[1]);
target.drawLine(triLeft[0], triLeft[1], 0.0, triRight[0], line2.addPoint(triLeft[0], triLeft[1]);
triRight[1], 0.0, color, LINE_WIDTH); line2.basics.color = color;
line2.width = LINE_WIDTH;
lines.add(line2);
} }
target.drawLine(lines.toArray(new DrawableLine[0]));
} }
} }