Omaha #3429 Replace Raytheon plugin calls to deprecated IGraphicsTarget.drawLine()
Change-Id: If0ada7c887b532e98c7d0d6df56c5b1b195c9d8b Former-commit-id: 3bae11d54bee5bf3b4a650bce02b85902ced1cbc
This commit is contained in:
parent
45c070c2d9
commit
dbc0015671
2 changed files with 34 additions and 29 deletions
|
@ -22,6 +22,7 @@ package com.raytheon.uf.viz.ncwf.rsc;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.swt.graphics.RGB;
|
import org.eclipse.swt.graphics.RGB;
|
||||||
|
@ -102,6 +103,10 @@ public class NcwfMovementResource extends
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<DrawableLine> lines = new ArrayList<DrawableLine>(
|
||||||
|
curRecords.size() * 2);
|
||||||
|
List<DrawableString> strings = new ArrayList<DrawableString>(
|
||||||
|
curRecords.size() * 2);
|
||||||
for (BUFRncwf record : curRecords) {
|
for (BUFRncwf record : curRecords) {
|
||||||
RGB color = getCapability(ColorableCapability.class).getColor();
|
RGB color = getCapability(ColorableCapability.class).getColor();
|
||||||
// This should adjust the direction so 0 is north
|
// This should adjust the direction so 0 is north
|
||||||
|
@ -117,7 +122,9 @@ public class NcwfMovementResource extends
|
||||||
double[] or_centerPixel = descriptor.worldToPixel(new double[] {
|
double[] or_centerPixel = descriptor.worldToPixel(new double[] {
|
||||||
or_centerll.x, or_centerll.y, or_centerll.z });
|
or_centerll.x, or_centerll.y, or_centerll.z });
|
||||||
// 90 are added to dir so that 0 is now on the right
|
// 90 are added to dir so that 0 is now on the right
|
||||||
paintArrowHead(target, centerPixel, spd, dir + 90, color);
|
DrawableLine arrowhead = createArrowHead(target, centerPixel, spd,
|
||||||
|
dir + 90, color);
|
||||||
|
lines.add(arrowhead);
|
||||||
|
|
||||||
// Get the string objects.
|
// Get the string objects.
|
||||||
DrawableString topStr = new DrawableString(String.format("%.0f",
|
DrawableString topStr = new DrawableString(String.format("%.0f",
|
||||||
|
@ -156,22 +163,25 @@ public class NcwfMovementResource extends
|
||||||
spdStr.horizontalAlignment = HorizontalAlignment.LEFT;
|
spdStr.horizontalAlignment = HorizontalAlignment.LEFT;
|
||||||
}
|
}
|
||||||
// Draw the tops string
|
// Draw the tops string
|
||||||
target.drawStrings(topStr);
|
strings.add(topStr);
|
||||||
|
|
||||||
// Draw the body of the arrow
|
// Draw the body of the arrow
|
||||||
DrawableLine line = new DrawableLine();
|
DrawableLine line = new DrawableLine();
|
||||||
line.setCoordinates(centerPixel[0], centerPixel[1], centerPixel[2]);
|
line.setCoordinates(centerPixel[0], centerPixel[1], centerPixel[2]);
|
||||||
line.addPoint(or_centerPixel[0], or_centerPixel[1], or_centerPixel[2]);
|
line.addPoint(or_centerPixel[0], or_centerPixel[1], or_centerPixel[2]);
|
||||||
line.basics.color = color;
|
line.basics.color = color;
|
||||||
line.width = 1.5f;
|
line.width = 1.5f;
|
||||||
target.drawLine(line);
|
lines.add(line);
|
||||||
|
|
||||||
// Draw the wind speed string
|
// Draw the wind speed string
|
||||||
target.drawStrings(spdStr);
|
strings.add(spdStr);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
target.drawLine(lines.toArray(new DrawableLine[0]));
|
||||||
|
target.drawStrings(strings);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void paintArrowHead(IGraphicsTarget target, double[] center,
|
private DrawableLine createArrowHead(IGraphicsTarget target,
|
||||||
|
double[] center,
|
||||||
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);
|
||||||
|
@ -180,12 +190,13 @@ public class NcwfMovementResource extends
|
||||||
line = new DrawableLine();
|
line = new DrawableLine();
|
||||||
line.setCoordinates(pointPixel[0], pointPixel[1], pointPixel[2]);
|
line.setCoordinates(pointPixel[0], pointPixel[1], pointPixel[2]);
|
||||||
line.addPoint(center[0], center[1], center[2]);
|
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);
|
||||||
line.addPoint(pointPixel[0], pointPixel[1], pointPixel[2]);
|
line.addPoint(pointPixel2[0], pointPixel2[1], pointPixel2[2]);
|
||||||
line.basics.color = color;
|
line.basics.color = color;
|
||||||
line.width = 1.5f;
|
line.width = 1.5f;
|
||||||
target.drawLine(line);
|
return line;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateRecords(DataTime displayedDataTime) throws VizException {
|
private void updateRecords(DataTime displayedDataTime) throws VizException {
|
||||||
|
|
|
@ -110,22 +110,24 @@ public class CellTrendGraph extends XYGraph {
|
||||||
* Paint the data series
|
* Paint the data series
|
||||||
*/
|
*/
|
||||||
target.setupClippingPlane(this.worldExtent);
|
target.setupClippingPlane(this.worldExtent);
|
||||||
double previousScreenX = 0.0;
|
|
||||||
double previousScreenY = 0.0;
|
|
||||||
|
|
||||||
// Paint each series in the xyData
|
// Paint each series in the xyData
|
||||||
boolean first;
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
LineStyle currLineStyle;
|
LineStyle currLineStyle;
|
||||||
PointType currPointType;
|
PointType currPointType;
|
||||||
List<DrawableCircle> circles = new ArrayList<DrawableCircle>();
|
List<DrawableCircle> circles = new ArrayList<DrawableCircle>();
|
||||||
List<DrawableLine> lines = new ArrayList<DrawableLine>();
|
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;
|
DrawableLine line = new DrawableLine();
|
||||||
|
line.basics.color = colorCap.getColor();
|
||||||
|
line.width = outlineCap.getOutlineWidth();
|
||||||
|
line.lineStyle = currLineStyle;
|
||||||
|
|
||||||
for (XYData currPoint : currSeries.getData()) {
|
for (XYData currPoint : currSeries.getData()) {
|
||||||
double x = ((Number) currPoint.getX()).doubleValue();
|
double x = ((Number) currPoint.getX()).doubleValue();
|
||||||
double y = ((Number) currPoint.getY()).doubleValue();
|
double y = ((Number) currPoint.getY()).doubleValue();
|
||||||
|
@ -137,7 +139,7 @@ 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);
|
||||||
|
|
||||||
AbstractDrawableObject object = drawPoint(target,
|
AbstractDrawableObject object = createPoint(target,
|
||||||
screenX, screenY, currPointType);
|
screenX, screenY, currPointType);
|
||||||
// Add the point to its corresponding list
|
// Add the point to its corresponding list
|
||||||
if (object instanceof DrawableCircle) {
|
if (object instanceof DrawableCircle) {
|
||||||
|
@ -146,19 +148,10 @@ public class CellTrendGraph extends XYGraph {
|
||||||
lines.add((DrawableLine) object);
|
lines.add((DrawableLine) object);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (first) {
|
line.addPoint(screenX, screenY);
|
||||||
first = false;
|
}
|
||||||
} else {
|
if (line.points.size() > 0) {
|
||||||
DrawableLine line = new DrawableLine();
|
lines.add(line);
|
||||||
line.setCoordinates(screenX, screenY);
|
|
||||||
line.addPoint(previousScreenX, previousScreenY);
|
|
||||||
line.basics.color = colorCap.getColor();
|
|
||||||
line.width = outlineCap.getOutlineWidth();
|
|
||||||
line.lineStyle = currLineStyle;
|
|
||||||
lines.add(line);
|
|
||||||
}
|
|
||||||
previousScreenX = screenX;
|
|
||||||
previousScreenY = screenY;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
target.drawLine(lines.toArray(new DrawableLine[0]));
|
target.drawLine(lines.toArray(new DrawableLine[0]));
|
||||||
|
@ -169,7 +162,8 @@ public class CellTrendGraph extends XYGraph {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private AbstractDrawableObject drawPoint(IGraphicsTarget target, double x, double y,
|
private AbstractDrawableObject createPoint(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();
|
||||||
|
@ -239,7 +233,7 @@ public class CellTrendGraph extends XYGraph {
|
||||||
for (int i = 0; i < dataSeriesLabels.size(); i++) {
|
for (int i = 0; i < dataSeriesLabels.size(); i++) {
|
||||||
// Point type
|
// Point type
|
||||||
PointType pt = dataSeriesPointTypes.get(i);
|
PointType pt = dataSeriesPointTypes.get(i);
|
||||||
AbstractDrawableObject object = drawPoint(target, labelx[i],
|
AbstractDrawableObject object = createPoint(target, labelx[i],
|
||||||
labely[i], pt);
|
labely[i], pt);
|
||||||
//Add the point to its corresponding list
|
//Add the point to its corresponding list
|
||||||
if (object instanceof DrawableCircle) {
|
if (object instanceof DrawableCircle) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue