Omaha #3504 Replace Raytheon references to IODataPreparer

Change-Id: I376f430154996944bd49c2e72d89e57537b68084

Former-commit-id: 70a7f2215f [formerly ca0df210d9] [formerly 70a7f2215f [formerly ca0df210d9] [formerly 5b3893c56f [formerly 08621067f8046b4260e87583d16950fee1e741de]]]
Former-commit-id: 5b3893c56f
Former-commit-id: 4140e1cc8c [formerly 1ae1220e4a]
Former-commit-id: 02814f3400
This commit is contained in:
Mark Peters 2014-08-12 12:15:35 -05:00
parent 124f7429ad
commit ac75dda420
12 changed files with 247 additions and 332 deletions

View file

@ -21,6 +21,7 @@
package com.raytheon.uf.viz.profiler.ui;
import java.awt.image.BufferedImage;
import java.awt.image.RenderedImage;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.UUID;
@ -35,7 +36,7 @@ import com.raytheon.uf.common.dataplugin.profiler.ProfilerLevel;
import com.raytheon.uf.common.geospatial.ReferencedCoordinate;
import com.raytheon.uf.common.geospatial.ReferencedObject.Type;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.data.prep.IODataPreparer;
import com.raytheon.uf.viz.core.data.IRenderedImageCallback;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.drawables.IImage;
import com.raytheon.uf.viz.core.exception.VizException;
@ -55,6 +56,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* Apr 10, 2009 2219 dhladky Initial creation
* Feb 08, 2011 8036 bkowal Updated GRAPH_OFFSET to come
* close to centering the graph.
* Aug 11, 2014 3504 mapeters Replaced deprecated IODataPreparer
* instances with IRenderedImageCallback.
*
* </pre>
*
@ -252,7 +255,13 @@ public class ProfilerUtils {
*/
public static IImage convertBufferedImage(IGraphicsTarget target,
BufferedImage img, String name) throws VizException {
return target.initializeRaster(new IODataPreparer(img, name, 0), null);
final BufferedImage image = img;
return target.initializeRaster(new IRenderedImageCallback() {
@Override
public RenderedImage getImage() throws VizException {
return image;
}
});
}
/**

View file

@ -20,14 +20,13 @@
package com.raytheon.viz.core.graphing.xy;
import java.awt.image.BufferedImage;
import java.awt.image.RenderedImage;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.data.prep.IODataPreparer;
import com.raytheon.uf.viz.core.data.IRenderedImageCallback;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.status.StatusConstants;
import com.raytheon.viz.core.graphing.Activator;
import com.raytheon.viz.pointdata.PointIconFactory;
/**
@ -38,6 +37,8 @@ import com.raytheon.viz.pointdata.PointIconFactory;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 16, 2007 njensen Initial creation
* Aug 11, 2014 #3504 mapeters Replaced deprecated IODataPreparer
* instances with IRenderedImageCallback.
*
* </pre>
*
@ -66,14 +67,17 @@ public class XYIconImageData extends XYImageData {
try {
PointIconFactory iconFactory = new PointIconFactory(color,
XYWindImageData.IMAGE_SIZE);
BufferedImage iconImage = iconFactory.getIcon(iconValue);
image = target.initializeRaster(new IODataPreparer(iconImage,
"icon", 0), null);
final BufferedImage iconImage = iconFactory.getIcon(iconValue);
image = target.initializeRaster(new IRenderedImageCallback() {
@Override
public RenderedImage getImage() throws VizException {
return iconImage;
}
});
} catch (VizException e) {
statusHandler.handle(Priority.PROBLEM,
"Error generating icon: " + e.getLocalizedMessage(), e);
}
}
/*

View file

@ -20,10 +20,12 @@
package com.raytheon.viz.core.graphing.xy;
import java.awt.image.BufferedImage;
import java.awt.image.RenderedImage;
import javax.measure.converter.UnitConverter;
import com.raytheon.uf.viz.core.data.prep.IODataPreparer;
import com.raytheon.uf.viz.core.data.IRenderedImageCallback;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.viz.pointdata.PointWindDisplay;
/**
@ -34,7 +36,8 @@ import com.raytheon.viz.pointdata.PointWindDisplay;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 16, 2007 njensen Initial creation
*
* Aug 11, 2014 #3504 mapeters Replaced deprecated IODataPreparer
* instances with IRenderedImageCallback.
* </pre>
*
* @author njensen
@ -76,15 +79,19 @@ public class XYWindImageData extends XYImageData {
*/
@Override
protected void generateImage() {
PointWindDisplay windDisplay = new PointWindDisplay(IMAGE_SIZE * 0.4,
1.0, 0, IMAGE_SIZE / 32);
PointWindDisplay windDisplay = new PointWindDisplay(
IMAGE_SIZE * 0.4, 1.0, 0, IMAGE_SIZE / 32);
windDisplay.setImageParameters(IMAGE_SIZE, IMAGE_SIZE, color.red,
color.green, color.blue, 1);
windDisplay.setWind(windDir, windSpd, true);
BufferedImage windImage = windDisplay.getWindImage(false,
final BufferedImage windImage = windDisplay.getWindImage(false,
PointWindDisplay.DisplayType.BARB, 4.0);
image = target.initializeRaster(
new IODataPreparer(windImage, "wind", 0), null);
image = target.initializeRaster(new IRenderedImageCallback() {
@Override
public RenderedImage getImage() throws VizException {
return windImage;
}
});
}
/*

View file

@ -59,6 +59,14 @@ public abstract class HydroPointResource <T extends HydroPointResourceData<?>> e
private static final RGB DEFAULT_COLOR = new RGB(0, 255, 0);
protected static final int IMAGE_WIDTH = 10;
protected static final int IMAGE_HEIGHT = 10;
protected static final String[] typename = { "Verified", "Screened",
"Time Distributed", "Manual", "Questionable", "Partial",
"Estimated", "Bad", "Missing" };
public HydroPointResource(T resourceData,
LoadProperties loadProperties) {
super(resourceData, loadProperties);
@ -66,7 +74,6 @@ public abstract class HydroPointResource <T extends HydroPointResourceData<?>> e
this.getCapability(ColorableCapability.class).setColor(
DEFAULT_COLOR);
}
}
/*

View file

@ -24,6 +24,7 @@ import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.awt.image.RenderedImage;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Hashtable;
@ -36,8 +37,6 @@ import javax.measure.unit.NonSI;
import javax.measure.unit.Unit;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import org.opengis.referencing.FactoryException;
import org.opengis.referencing.operation.TransformException;
@ -57,7 +56,7 @@ import com.raytheon.uf.viz.core.IGraphicsTarget.VerticalAlignment;
import com.raytheon.uf.viz.core.PixelCoverage;
import com.raytheon.uf.viz.core.PixelExtent;
import com.raytheon.uf.viz.core.RGBColors;
import com.raytheon.uf.viz.core.data.prep.IODataPreparer;
import com.raytheon.uf.viz.core.data.IRenderedImageCallback;
import com.raytheon.uf.viz.core.drawables.IFont;
import com.raytheon.uf.viz.core.drawables.IImage;
import com.raytheon.uf.viz.core.drawables.PaintProperties;
@ -68,11 +67,9 @@ import com.raytheon.viz.hydrocommon.HydroConstants;
import com.raytheon.viz.mpe.ui.MPEDisplayManager;
import com.raytheon.viz.mpe.ui.MPEFontFactory;
import com.raytheon.viz.mpe.ui.actions.DrawDQCStations;
import com.raytheon.viz.mpe.ui.dialogs.EditFreezeStationsDialog;
import com.raytheon.viz.mpe.ui.dialogs.QcFreezeOptionsDialog;
import com.raytheon.viz.mpe.util.DailyQcUtils;
import com.raytheon.viz.mpe.util.DailyQcUtils.Station;
import com.raytheon.viz.mpe.util.DailyQcUtils.Zdata;
import com.raytheon.viz.mpe.util.DailyQcUtils.Ztn;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Envelope;
@ -88,6 +85,9 @@ import com.vividsolutions.jts.index.strtree.STRtree;
* Jul 8, 2009 2589 snaples Initial creation
* Mar 3, 2014 2804 mschenke Set back up clipping pane
* Jul 24, 2014 3429 mapeters Updated deprecated drawLine() calls.
* Aug 11, 2014 3504 mapeters Replaced deprecated IODataPreparer
* instances with IRenderedImageCallback.
* and removed unused modifyStation() method.
* </pre>
*
* @author snaples
@ -101,58 +101,26 @@ public class PointFreezePlotResource extends
private static STRtree strTree = null;
private static IGraphicsTarget target;
private PaintProperties paintProps;
private static Coordinate selectedCoordinate;
private MPEFontFactory fontFactory;
private IFont font = null;
private final DecimalFormat df = new DecimalFormat();
private RGB color = new RGB(255, 255, 255);
private double scaleWidthValue = 0.0;
private double scaleHeightValue = 0.0;
private Station gageData = null;
private static int imageWidth = 10;
private static int imageHeight = 10;
static String dqc_nodata_color = "black";
static final String[] color_map_a = { "Cyan1", "Salmon", "Orange1",
private static final String[] color_map_a = { "Cyan1", "Salmon", "Orange1",
"Yellow1", "Magenta1", "Green1", "Green4", "Gray74", "White",
"Cyan1" };
static final String[] color_map_n = { "Grey10", "Grey", "Blue",
private static final String[] color_map_n = { "Grey10", "Grey", "Blue",
"Aquamarine", "LightGreen", "DarkGreen", "Violet", "Purple",
"Blue", "Blue", "Yellow1", "Yellow", "Yellow2", "VioletRed", "Red",
"White" };
static final String[] typename = { "Verified", "Screened",
"Time Distributed", "Manual", "Questionable", "Partial",
"Estimated", "Bad", "Missing" };
Zdata zdata[];
ArrayList<Station> station;
Hashtable<String, Ztn> zdataMap;
ColorMapParameters parameters;
int pcpn_day = 0;
private final DailyQcUtils dc = new DailyQcUtils();
static int prevPcpnDay;
private Hashtable<String, Ztn> zdataMap;
/**
* Constructor.
@ -169,10 +137,6 @@ public class PointFreezePlotResource extends
public PointFreezePlotResource(PointFreezeResourceData resourceData,
LoadProperties props) {
super(resourceData, props);
pcpn_day = DailyQcUtils.pcpn_day;
station = DailyQcUtils.freezing_stations;
prevPcpnDay = 0;
df.setMaximumFractionDigits(2);
df.setMaximumIntegerDigits(4);
}
@ -194,7 +158,8 @@ public class PointFreezePlotResource extends
dataMap = new Hashtable<String, Station>();
zdataMap = new Hashtable<String, Ztn>();
strTree = new STRtree();
gageData = dc.new Station();
Station gageData = new DailyQcUtils().new Station();
ArrayList<Station> station = DailyQcUtils.freezing_stations;
if (!station.isEmpty()) {
int i = 0;
@ -212,7 +177,7 @@ public class PointFreezePlotResource extends
kv.append(pm);
dataMap.put(kv.toString(), gageData);
zdataMap.put(kv.toString(),
DailyQcUtils.zdata[pcpn_day].zstn[i]);
DailyQcUtils.zdata[DailyQcUtils.pcpn_day].zstn[i]);
/* Create a small envelope around the point */
Coordinate p1 = new Coordinate(xy.x + .02, xy.y + .02);
@ -227,7 +192,6 @@ public class PointFreezePlotResource extends
strTree.insert(env, data);
i++;
}
prevPcpnDay = DailyQcUtils.pcpn_day;
}
}
@ -287,7 +251,9 @@ public class PointFreezePlotResource extends
* @param gageData
* @throws VizException
*/
private void drawPlotInfo(Coordinate c, String key, Station station)
private void drawPlotInfo(Coordinate c, String key, Station station,
IGraphicsTarget target, PaintProperties paintProps, RGB color,
IFont font)
throws VizException {
if (MPEDisplayManager.getCurrent().isZflag() == true
@ -342,8 +308,15 @@ public class PointFreezePlotResource extends
&& DailyQcUtils.zdata[DailyQcUtils.pcpn_day].used[DailyQcUtils.pcpn_time] == 0) {
return;
}
IImage image = target.initializeRaster(new IODataPreparer(
drawMPECircle(color), "gage", 0), null);
final RGB circleColor = color;
IImage image = target
.initializeRaster(new IRenderedImageCallback() {
@Override
public RenderedImage getImage() throws VizException {
return drawMPECircle(circleColor);
}
});
target.drawRaster(image, getPixelCoverage(c), paintProps);
@ -433,7 +406,7 @@ public class PointFreezePlotResource extends
private void setScaleWidth(PaintProperties props) {
double screenToWorldWidthRatio = props.getCanvasBounds().width
/ props.getView().getExtent().getWidth();
scaleWidthValue = (imageWidth / 2.0) / screenToWorldWidthRatio;
scaleWidthValue = (IMAGE_WIDTH / 2.0) / screenToWorldWidthRatio;
}
/**
@ -463,7 +436,7 @@ public class PointFreezePlotResource extends
private void setScaleHeight(PaintProperties props) {
double screenToWorldHeightRatio = props.getCanvasBounds().height
/ props.getView().getExtent().getHeight();
scaleHeightValue = (imageHeight / 2.0) / screenToWorldHeightRatio;
scaleHeightValue = (IMAGE_HEIGHT / 2.0) / screenToWorldHeightRatio;
}
/**
@ -478,11 +451,9 @@ public class PointFreezePlotResource extends
@Override
protected void paintInternal(IGraphicsTarget target,
PaintProperties paintProps) throws VizException {
PointFreezePlotResource.target = target;
this.paintProps = paintProps;
MPEDisplayManager displayMgr = getResourceData().getMPEDisplayManager();
// Fonts are shared and cached, get from factory
font = fontFactory.getMPEFont(MPEDisplayManager.getFontId());
IFont font = fontFactory.getMPEFont(MPEDisplayManager.getFontId());
if (DailyQcUtils.points_flag == 1 && displayMgr.isZflag() == true) {
Iterator<String> iter = dataMap.keySet().iterator();
@ -502,7 +473,9 @@ public class PointFreezePlotResource extends
setScaleWidth(paintProps);
setScaleHeight(paintProps);
drawPlotInfo(c, key, dataMap.get(key));
RGB color = new RGB(255, 255, 255);
drawPlotInfo(c, key, dataMap.get(key), target,
paintProps, color, font);
if (getSelectedCoordinate() != null) {
Envelope env = new Envelope(getSelectedCoordinate());
@ -528,19 +501,21 @@ public class PointFreezePlotResource extends
}
}
target.clearClippingPlane();
drawQCLegend();
drawQCLegend(target, paintProps, font);
target.setupClippingPlane(paintProps.getClippingPane());
}
}
private void drawQCLegend() throws VizException {
private void drawQCLegend(IGraphicsTarget target,
PaintProperties paintProps, IFont font)
throws VizException {
// TODO this screen location code is borrowed from MPELegendResource...
// should it be put into a shared class, possibly a paint
// properties method?
IExtent screenExtent = paintProps.getView().getExtent();
double scale = (screenExtent.getHeight() / paintProps.getCanvasBounds().height);
DrawableString string = new DrawableString("0", color);
DrawableString string = new DrawableString("0");
string.font = font;
double textHeight = target.getStringsBounds(string).getHeight() * scale;
double padding = 3.2 * scale;
@ -630,41 +605,6 @@ public class PointFreezePlotResource extends
return null;
}
/**
* Modify station called when single mouse click on gage
*
* @param rcoord
*
*/
public static Map<String, Object> modifyStation(ReferencedCoordinate rcoord)
throws VizException {
Coordinate coord = new Coordinate();
try {
coord = rcoord.asLatLon();
} catch (TransformException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FactoryException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Envelope env = new Envelope(coord);
List<?> elements = strTree.query(env);
Iterator<?> iter = elements.iterator();
/* Take the first one in the list */
if (iter.hasNext()) {
setSelectedCoordinate(coord);
target.setNeedsRefresh(true);
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell();
EditFreezeStationsDialog epd = new EditFreezeStationsDialog(shell,
new ReferencedCoordinate(coord));
epd.open();
}
return null;
}
/**
* Interrogate method called when user clicks on a location
*
@ -711,7 +651,7 @@ public class PointFreezePlotResource extends
dmPref.getEntries().get(1).setLabel("");
ColorMapCapability cmc = getCapability(ColorMapCapability.class);
parameters = cmc.getColorMapParameters();
ColorMapParameters parameters = cmc.getColorMapParameters();
if (parameters == null) {
parameters = new ColorMapParameters();
cmc.setColorMapParameters(parameters);
@ -760,7 +700,7 @@ public class PointFreezePlotResource extends
*/
private static BufferedImage drawMPECircle(RGB color) {
// make circle in center
BufferedImage image = new BufferedImage(imageWidth, imageHeight,
BufferedImage image = new BufferedImage(IMAGE_WIDTH, IMAGE_HEIGHT,
BufferedImage.TYPE_INT_ARGB);
Graphics2D g = (Graphics2D) image.getGraphics();
@ -774,7 +714,7 @@ public class PointFreezePlotResource extends
RenderingHints.VALUE_ANTIALIAS_ON);
// always red
g.setColor(convertR(color));
g.fillOval(0, 0, imageWidth / 2, imageHeight / 2);
g.fillOval(0, 0, IMAGE_WIDTH / 2, IMAGE_HEIGHT / 2);
return image;
}

View file

@ -24,6 +24,7 @@ import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.awt.image.RenderedImage;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Hashtable;
@ -36,8 +37,6 @@ import javax.measure.unit.NonSI;
import javax.measure.unit.Unit;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import org.opengis.referencing.FactoryException;
import org.opengis.referencing.operation.TransformException;
@ -57,7 +56,7 @@ import com.raytheon.uf.viz.core.IGraphicsTarget.VerticalAlignment;
import com.raytheon.uf.viz.core.PixelCoverage;
import com.raytheon.uf.viz.core.PixelExtent;
import com.raytheon.uf.viz.core.RGBColors;
import com.raytheon.uf.viz.core.data.prep.IODataPreparer;
import com.raytheon.uf.viz.core.data.IRenderedImageCallback;
import com.raytheon.uf.viz.core.drawables.IFont;
import com.raytheon.uf.viz.core.drawables.IImage;
import com.raytheon.uf.viz.core.drawables.PaintProperties;
@ -69,7 +68,6 @@ import com.raytheon.viz.mpe.ui.MPEDisplayManager;
import com.raytheon.viz.mpe.ui.MPEFontFactory;
import com.raytheon.viz.mpe.ui.actions.DrawDQCStations;
import com.raytheon.viz.mpe.ui.actions.OtherPrecipOptions;
import com.raytheon.viz.mpe.ui.dialogs.EditPrecipStationsDialog;
import com.raytheon.viz.mpe.ui.dialogs.QcPrecipOptionsDialog;
import com.raytheon.viz.mpe.util.DailyQcUtils;
import com.raytheon.viz.mpe.util.DailyQcUtils.Pdata;
@ -90,6 +88,9 @@ import com.vividsolutions.jts.index.strtree.STRtree;
* Nov 24, 2008 1748 snaples Initial creation
* Mar 3, 2014 2804 mschenke Set back up clipping pane
* Jul 24, 2014 3429 mapeters Updated deprecated drawLine() calls.
* Aug 11, 2014 3504 mapeters Replaced deprecated IODataPreparer
* instances with IRenderedImageCallback
* and removed unused modifyStation() method.
* </pre>
*
* @author snaples
@ -103,58 +104,32 @@ public class PointPrecipPlotResource extends
private static STRtree strTree = null;
private static IGraphicsTarget target;
private PaintProperties paintProps;
private static Coordinate selectedCoordinate;
private MPEFontFactory fontFactory;
private IFont font = null;
private final DecimalFormat df = new DecimalFormat();
private final RGB gageColor = new RGB(255, 255, 255);
private RGB color = new RGB(255, 255, 255);
private double scaleWidthValue = 0.0;
private double scaleHeightValue = 0.0;
private Station gageData = null;
private static int imageWidth = 10;
private static final String[] color_map_a = { "Aquamarine", "OrangeRed",
"Orange", "Yellow", "VioletRed", "SpringGreen4", "Green3", "Grey",
"White" };
private static int imageHeight = 10;
private static final String[] color_map_n = { "Grey", "Grey", "Blue",
"Aquamarine", "LightGreen", "DarkGreen", "Violet", "Purple",
"Blue", "Blue", "Yellow", "Yellow", "Yellow2", "VioletRed", "Red",
"White" };
static String dqc_nodata_color = "black";
private int time_pos = 0;
static final String[] color_map_a = { "Aquamarine", "OrangeRed", "Orange",
"Yellow", "VioletRed", "SpringGreen4", "Green3", "Grey", "White" };
static final String[] color_map_n = { "Grey", "Grey", "Blue", "Aquamarine",
"LightGreen", "DarkGreen", "Violet", "Purple", "Blue", "Blue",
"Yellow", "Yellow", "Yellow2", "VioletRed", "Red", "White" };
static final String[] typename = { "Verified", "Screened",
"Time Distributed", "Manual", "Questionable", "Partial",
"Estimated", "Bad", "Missing" };
int time_pos = 0;
Pdata pdata[];
ArrayList<Station> station;
Hashtable<String, Stn> pdataMap;
ColorMapParameters parameters;
private final DailyQcUtils dc = new DailyQcUtils();
static int prevPcpnDay;
private Hashtable<String, Stn> pdataMap;
/**
* Constructor.
@ -171,10 +146,6 @@ public class PointPrecipPlotResource extends
public PointPrecipPlotResource(PointPrecipResourceData resourceData,
LoadProperties props) {
super(resourceData, props);
pdata = DailyQcUtils.pdata;
station = DailyQcUtils.precip_stations;
prevPcpnDay = 0;
df.setMaximumFractionDigits(2);
df.setMaximumIntegerDigits(4);
}
@ -196,10 +167,11 @@ public class PointPrecipPlotResource extends
dataMap = new Hashtable<String, Station>();
pdataMap = new Hashtable<String, Stn>();
strTree = new STRtree();
gageData = dc.new Station();
gageData = new DailyQcUtils().new Station();
ArrayList<Station> station = DailyQcUtils.precip_stations;
if (!station.isEmpty()) {
int i = 0;
Pdata[] pdata = DailyQcUtils.pdata;
for (ListIterator<Station> it = station.listIterator(); it
.hasNext();) {
gageData = it.next();
@ -228,7 +200,6 @@ public class PointPrecipPlotResource extends
strTree.insert(env, data);
i++;
}
prevPcpnDay = DailyQcUtils.pcpn_day;
}
// target.setNeedsRefresh(true);
}
@ -289,7 +260,9 @@ public class PointPrecipPlotResource extends
* @param gageData
* @throws VizException
*/
private void drawPlotInfo(Coordinate c, String key, Station station)
private void drawPlotInfo(Coordinate c, String key, Station station,
IGraphicsTarget target, PaintProperties paintProps, RGB color,
IFont font)
throws VizException {
if (MPEDisplayManager.getCurrent().isQpf() == true
@ -408,8 +381,14 @@ public class PointPrecipPlotResource extends
return;
}
IImage image = target.initializeRaster(new IODataPreparer(
drawMPECircle(color), "gage", 0), null);
final RGB circleColor = color;
IImage image = target
.initializeRaster(new IRenderedImageCallback() {
@Override
public RenderedImage getImage() throws VizException {
return drawMPECircle(circleColor);
}
});
Coordinate idCoor = new Coordinate(centerpixels[0]
+ this.getScaleWidth() / 3, centerpixels[1]
@ -605,9 +584,14 @@ public class PointPrecipPlotResource extends
target.drawStrings(dstr);
// draw the ID
image = target.initializeRaster(new IODataPreparer(
drawMPECircle(color), "gage", 0), null);
final BufferedImage gage2 = drawMPECircle(color);
IImage image2 = target
.initializeRaster(new IRenderedImageCallback() {
@Override
public RenderedImage getImage() throws VizException {
return gage2;
}
});
idCoor = new Coordinate(centerpixels[0] + this.getScaleWidth()
/ 3, centerpixels[1] - this.getScaleHeight());
@ -616,7 +600,7 @@ public class PointPrecipPlotResource extends
dstr.setText(gageData.hb5, gageColor);
dstr.horizontalAlignment = HorizontalAlignment.LEFT;
target.drawStrings(dstr);
target.drawRaster(image, getPixelCoverage(c), paintProps);
target.drawRaster(image2, getPixelCoverage(c), paintProps);
}
} else {
return;
@ -666,7 +650,7 @@ public class PointPrecipPlotResource extends
private void setScaleWidth(PaintProperties props) {
double screenToWorldWidthRatio = props.getCanvasBounds().width
/ props.getView().getExtent().getWidth();
scaleWidthValue = (imageWidth / 2.0) / screenToWorldWidthRatio;
scaleWidthValue = (IMAGE_WIDTH / 2.0) / screenToWorldWidthRatio;
}
/**
@ -696,7 +680,7 @@ public class PointPrecipPlotResource extends
private void setScaleHeight(PaintProperties props) {
double screenToWorldHeightRatio = props.getCanvasBounds().height
/ props.getView().getExtent().getHeight();
scaleHeightValue = (imageHeight / 2.0) / screenToWorldHeightRatio;
scaleHeightValue = (IMAGE_HEIGHT / 2.0) / screenToWorldHeightRatio;
}
/**
@ -711,11 +695,9 @@ public class PointPrecipPlotResource extends
@Override
protected void paintInternal(IGraphicsTarget target,
PaintProperties paintProps) throws VizException {
PointPrecipPlotResource.target = target;
this.paintProps = paintProps;
MPEDisplayManager displayMgr = getResourceData().getMPEDisplayManager();
// Fonts are shared and cached, no need to init or dispose
font = fontFactory.getMPEFont(MPEDisplayManager.getFontId());
IFont font = fontFactory.getMPEFont(MPEDisplayManager.getFontId());
if (DailyQcUtils.points_flag == 1 && displayMgr.isQpf() == true) {
Iterator<String> iter = dataMap.keySet().iterator();
@ -735,7 +717,9 @@ public class PointPrecipPlotResource extends
setScaleWidth(paintProps);
setScaleHeight(paintProps);
drawPlotInfo(c, key, dataMap.get(key));
RGB color = new RGB(255, 255, 255);
drawPlotInfo(c, key, dataMap.get(key), target,
paintProps, color, font);
if (getSelectedCoordinate() != null) {
Envelope env = new Envelope(getSelectedCoordinate());
@ -761,19 +745,21 @@ public class PointPrecipPlotResource extends
}
}
target.clearClippingPlane();
drawQCLegend();
drawQCLegend(target, paintProps, font);
target.setupClippingPlane(paintProps.getClippingPane());
}
}
private void drawQCLegend() throws VizException {
private void drawQCLegend(IGraphicsTarget target,
PaintProperties paintProps, IFont font)
throws VizException {
// TODO this screen location code is borrowed from MPELegendResource...
// should it be put into a shared class, possibly a paint
// properties method?
IExtent screenExtent = paintProps.getView().getExtent();
double scale = (screenExtent.getHeight() / paintProps.getCanvasBounds().height);
DrawableString string = new DrawableString("0", color);
DrawableString string = new DrawableString("0");
string.font = font;
double textHeight = target.getStringsBounds(string).getHeight() * scale;
double padding = 3.2 * scale;
@ -858,41 +844,6 @@ public class PointPrecipPlotResource extends
return null;
}
/**
* Modify station called when single mouse click on gage
*
* @param rcoord
*
*/
public static Map<String, Object> modifyStation(ReferencedCoordinate rcoord)
throws VizException {
Coordinate coord = new Coordinate();
try {
coord = rcoord.asLatLon();
} catch (TransformException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FactoryException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Envelope env = new Envelope(coord);
List<?> elements = strTree.query(env);
Iterator<?> iter = elements.iterator();
/* Take the first one in the list */
if (iter.hasNext()) {
setSelectedCoordinate(coord);
target.setNeedsRefresh(true);
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell();
EditPrecipStationsDialog epd = new EditPrecipStationsDialog(shell,
new ReferencedCoordinate(coord));
epd.open();
}
return null;
}
/**
* Interrogate method called when user clicks on a location
*
@ -939,7 +890,7 @@ public class PointPrecipPlotResource extends
dmPref.getEntries().get(1).setLabel("");
ColorMapCapability cmc = getCapability(ColorMapCapability.class);
parameters = cmc.getColorMapParameters();
ColorMapParameters parameters = cmc.getColorMapParameters();
if (parameters == null) {
parameters = new ColorMapParameters();
cmc.setColorMapParameters(parameters);
@ -988,7 +939,7 @@ public class PointPrecipPlotResource extends
*/
private static BufferedImage drawMPECircle(RGB color) {
// make circle in center
BufferedImage image = new BufferedImage(imageWidth, imageHeight,
BufferedImage image = new BufferedImage(IMAGE_WIDTH, IMAGE_HEIGHT,
BufferedImage.TYPE_INT_ARGB);
Graphics2D g = (Graphics2D) image.getGraphics();
@ -1002,7 +953,7 @@ public class PointPrecipPlotResource extends
RenderingHints.VALUE_ANTIALIAS_ON);
// always red
g.setColor(convertR(color));
g.fillOval(0, 0, imageWidth / 2, imageHeight / 2);
g.fillOval(0, 0, IMAGE_WIDTH / 2, IMAGE_HEIGHT / 2);
return image;
}

View file

@ -24,6 +24,7 @@ import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.awt.image.RenderedImage;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Hashtable;
@ -57,7 +58,7 @@ import com.raytheon.uf.viz.core.IGraphicsTarget.VerticalAlignment;
import com.raytheon.uf.viz.core.PixelCoverage;
import com.raytheon.uf.viz.core.PixelExtent;
import com.raytheon.uf.viz.core.RGBColors;
import com.raytheon.uf.viz.core.data.prep.IODataPreparer;
import com.raytheon.uf.viz.core.data.IRenderedImageCallback;
import com.raytheon.uf.viz.core.drawables.IFont;
import com.raytheon.uf.viz.core.drawables.IImage;
import com.raytheon.uf.viz.core.drawables.PaintProperties;
@ -89,6 +90,9 @@ import com.vividsolutions.jts.index.strtree.STRtree;
* Jun 24, 2009 2524 snaples Initial creation
* Mar 3, 2014 2804 mschenke Set back up clipping pane
* Jul 24, 2014 3429 mapeters Updated deprecated drawLine() calls.
* Aug 11, 2014 3504 mapeters Replaced deprecated IODataPreparer
* instances with IRenderedImageCallback
* and removed unused modifyStation() method.
*
* </pre>
*
@ -103,58 +107,28 @@ public class PointTempPlotResource extends
private static STRtree strTree = null;
private static IGraphicsTarget target;
private PaintProperties paintProps;
private static Coordinate selectedCoordinate;
private MPEFontFactory fontFactory;
private IFont font = null;
private final DecimalFormat df = new DecimalFormat();
private RGB color = new RGB(255, 255, 255);
private double scaleWidthValue = 0.0;
private double scaleHeightValue = 0.0;
private Station gageData = null;
private static int imageWidth = 10;
private static int imageHeight = 10;
static String dqc_nodata_color = "black";
static final String[] color_map_a = { "Cyan1", "Salmon", "Orange1",
private static final String[] color_map_a = { "Cyan1", "Salmon", "Orange1",
"Yellow1", "Magenta1", "Green1", "Green4", "Gray74", "White",
"Cyan1" };
static final String[] color_map_n = { "Grey10", "Grey", "Blue",
private static final String[] color_map_n = { "Grey10", "Grey", "Blue",
"Aquamarine", "LightGreen", "DarkGreen", "Violet", "Purple",
"Blue", "Blue", "Yellow1", "Yellow", "Yellow2", "VioletRed", "Red",
"White" };
static final String[] typename = { "Verified", "Screened",
"Time Distributed", "Manual", "Questionable", "Partial",
"Estimated", "Bad", "Missing" };
private int time_pos = 0;
int time_pos = 0;
Tdata tdata[];
ArrayList<Station> station;
Hashtable<String, Ttn> tdataMap;
private ColorMapParameters parameters;
private final DailyQcUtils dc = new DailyQcUtils();
static int prevPcpnDay;
private Hashtable<String, Ttn> tdataMap;
/**
* Constructor.
@ -171,10 +145,6 @@ public class PointTempPlotResource extends
public PointTempPlotResource(PointTempResourceData resourceData,
LoadProperties props) {
super(resourceData, props);
tdata = DailyQcUtils.tdata;
station = DailyQcUtils.temperature_stations;
prevPcpnDay = 0;
df.setMaximumFractionDigits(2);
df.setMaximumIntegerDigits(4);
}
@ -196,7 +166,9 @@ public class PointTempPlotResource extends
dataMap = new Hashtable<String, Station>();
tdataMap = new Hashtable<String, Ttn>();
strTree = new STRtree();
gageData = dc.new Station();
Station gageData = new DailyQcUtils().new Station();
ArrayList<Station> station = DailyQcUtils.temperature_stations;
Tdata[] tdata = DailyQcUtils.tdata;
if (!station.isEmpty()) {
int i = 0;
@ -229,7 +201,6 @@ public class PointTempPlotResource extends
strTree.insert(env, data);
i++;
}
prevPcpnDay = DailyQcUtils.pcpn_day;
}
}
@ -289,7 +260,9 @@ public class PointTempPlotResource extends
* @param gageData
* @throws VizException
*/
private void drawPlotInfo(Coordinate c, String key, Station station)
private void drawPlotInfo(Coordinate c, String key, Station station,
IGraphicsTarget target, PaintProperties paintProps, RGB color,
IFont font)
throws VizException {
if (MPEDisplayManager.getCurrent().isMaxmin() == true
@ -394,8 +367,15 @@ public class PointTempPlotResource extends
&& qflag[7] != 1) {
return;
}
IImage image = target.initializeRaster(new IODataPreparer(
drawMPECircle(color), "gage", 0), null);
final RGB circleColor = color;
IImage image = target
.initializeRaster(new IRenderedImageCallback() {
@Override
public RenderedImage getImage() throws VizException {
return drawMPECircle(circleColor);
}
});
target.drawRaster(image, getPixelCoverage(c), paintProps);
@ -477,7 +457,6 @@ public class PointTempPlotResource extends
string.font = font;
double textHeight = target.getStringsBounds(string).getHeight()
* scale;
int temp = 0;
Coordinate valCoor = new Coordinate(centerpixels[0]
+ this.getScaleWidth() / 3, centerpixels[1]
- this.getScaleHeight());
@ -508,7 +487,7 @@ public class PointTempPlotResource extends
private void setScaleWidth(PaintProperties props) {
double screenToWorldWidthRatio = props.getCanvasBounds().width
/ props.getView().getExtent().getWidth();
scaleWidthValue = (imageWidth / 2.0) / screenToWorldWidthRatio;
scaleWidthValue = (IMAGE_WIDTH / 2.0) / screenToWorldWidthRatio;
}
/**
@ -538,7 +517,7 @@ public class PointTempPlotResource extends
private void setScaleHeight(PaintProperties props) {
double screenToWorldHeightRatio = props.getCanvasBounds().height
/ props.getView().getExtent().getHeight();
scaleHeightValue = (imageHeight / 2.0) / screenToWorldHeightRatio;
scaleHeightValue = (IMAGE_HEIGHT / 2.0) / screenToWorldHeightRatio;
}
/**
@ -553,11 +532,9 @@ public class PointTempPlotResource extends
@Override
protected void paintInternal(IGraphicsTarget target,
PaintProperties paintProps) throws VizException {
PointTempPlotResource.target = target;
this.paintProps = paintProps;
MPEDisplayManager displayMgr = getResourceData().getMPEDisplayManager();
// Fonts are shared and cached, no need to init or dispose
font = fontFactory.getMPEFont(MPEDisplayManager.getFontId());
IFont font = fontFactory.getMPEFont(MPEDisplayManager.getFontId());
if (DailyQcUtils.points_flag == 1 && displayMgr.isMaxmin() == true) {
Iterator<String> iter = dataMap.keySet().iterator();
@ -577,7 +554,9 @@ public class PointTempPlotResource extends
setScaleWidth(paintProps);
setScaleHeight(paintProps);
drawPlotInfo(c, key, dataMap.get(key));
RGB color = new RGB(255, 255, 255);
drawPlotInfo(c, key, dataMap.get(key), target,
paintProps, color, font);
if (getSelectedCoordinate() != null) {
Envelope env = new Envelope(getSelectedCoordinate());
@ -603,19 +582,21 @@ public class PointTempPlotResource extends
}
}
target.clearClippingPlane();
drawQCLegend();
drawQCLegend(target, paintProps, font);
target.setupClippingPlane(paintProps.getClippingPane());
}
}
private void drawQCLegend() throws VizException {
private void drawQCLegend(IGraphicsTarget target,
PaintProperties paintProps, IFont font)
throws VizException {
// TODO this screen location code is borrowed from MPELegendResource...
// should it be put into a shared class, possibly a paint
// properties method?
IExtent screenExtent = paintProps.getView().getExtent();
double scale = (screenExtent.getHeight() / paintProps.getCanvasBounds().height);
DrawableString string = new DrawableString("0", color);
DrawableString string = new DrawableString("0");
string.font = font;
double textHeight = target.getStringsBounds(string).getHeight() * scale;
double padding = 3.2 * scale;
@ -705,41 +686,6 @@ public class PointTempPlotResource extends
return null;
}
/**
* Modify station called when single mouse click on gage
*
* @param rcoord
*
*/
public static Map<String, Object> modifyStation(ReferencedCoordinate rcoord)
throws VizException {
Coordinate coord = new Coordinate();
try {
coord = rcoord.asLatLon();
} catch (TransformException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FactoryException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Envelope env = new Envelope(coord);
List<?> elements = strTree.query(env);
Iterator<?> iter = elements.iterator();
/* Take the first one in the list */
if (iter.hasNext()) {
setSelectedCoordinate(coord);
target.setNeedsRefresh(true);
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell();
EditTempStationsDialog epd = new EditTempStationsDialog(shell,
new ReferencedCoordinate(coord));
epd.open();
}
return null;
}
/**
* Interrogate method called when user clicks on a location
*
@ -766,7 +712,7 @@ public class PointTempPlotResource extends
/* Take the first one in the list */
if (iter.hasNext()) {
setSelectedCoordinate(coord);
target.setNeedsRefresh(true);
this.issueRefresh();
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell();
EditTempStationsDialog epd = new EditTempStationsDialog(shell,
@ -809,7 +755,7 @@ public class PointTempPlotResource extends
dmPref.getEntries().get(1).setLabel("");
ColorMapCapability cmc = getCapability(ColorMapCapability.class);
parameters = cmc.getColorMapParameters();
ColorMapParameters parameters = cmc.getColorMapParameters();
if (parameters == null) {
parameters = new ColorMapParameters();
cmc.setColorMapParameters(parameters);
@ -858,7 +804,7 @@ public class PointTempPlotResource extends
*/
private static BufferedImage drawMPECircle(RGB color) {
// make circle in center
BufferedImage image = new BufferedImage(imageWidth, imageHeight,
BufferedImage image = new BufferedImage(IMAGE_WIDTH, IMAGE_HEIGHT,
BufferedImage.TYPE_INT_ARGB);
Graphics2D g = (Graphics2D) image.getGraphics();
@ -872,7 +818,7 @@ public class PointTempPlotResource extends
RenderingHints.VALUE_ANTIALIAS_ON);
// always red
g.setColor(convertR(color));
g.fillOval(0, 0, imageWidth / 2, imageHeight / 2);
g.fillOval(0, 0, IMAGE_WIDTH / 2, IMAGE_HEIGHT / 2);
return image;
}

View file

@ -22,6 +22,7 @@ package com.raytheon.viz.pointdata.util;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.awt.image.IndexColorModel;
import java.awt.image.RenderedImage;
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.HashMap;
@ -40,7 +41,7 @@ import org.w3c.dom.Text;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.data.prep.IODataPreparer;
import com.raytheon.uf.viz.core.data.IRenderedImageCallback;
import com.raytheon.uf.viz.core.drawables.IImage;
import com.raytheon.uf.viz.core.exception.VizException;
@ -55,6 +56,8 @@ import com.raytheon.uf.viz.core.exception.VizException;
* Sep 25, 2009 3099 bsteffen Initial creation
* Oct 20, 2010 6853 bgonzale Migrated common symbol loading code.
* Aug 09, 2013 2033 mschenke Switched File.separator to IPathManager.SEPARATOR
* Aug 11, 2014 3504 mapeters Replaced deprecated IODataPreparer
* instances with IRenderedImageCallback.
*
* </pre>
*
@ -118,7 +121,7 @@ public class SymbolLoader {
byte[] blue = { 0, (byte) color.blue };
IndexColorModel colorModel = new IndexColorModel(8, 2, red, green,
blue, 0);
BufferedImage bImage = new BufferedImage(12, 12,
final BufferedImage bImage = new BufferedImage(12, 12,
BufferedImage.TYPE_BYTE_INDEXED, colorModel);
Graphics2D g2d = bImage.createGraphics();
@ -127,8 +130,13 @@ public class SymbolLoader {
GraphicsNode gn = builder.build(this.bridgeContext, this.document);
gn.paint(g2d);
IImage iImage = target.initializeRaster(new IODataPreparer(bImage,
String.format("wxsym%x", (int) c), 0), null);
IImage iImage = target
.initializeRaster(new IRenderedImageCallback() {
@Override
public RenderedImage getImage() throws VizException {
return bImage;
}
});
images.put(c, iImage);

View file

@ -23,6 +23,7 @@ package com.raytheon.viz.radar.rsc.graphic;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.awt.image.IndexColorModel;
import java.awt.image.RenderedImage;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
@ -59,7 +60,7 @@ import com.raytheon.uf.common.geospatial.ReferencedCoordinate;
import com.raytheon.uf.common.geospatial.ReferencedObject.Type;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.data.prep.IODataPreparer;
import com.raytheon.uf.viz.core.data.IRenderedImageCallback;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.drawables.IImage;
import com.raytheon.uf.viz.core.exception.VizException;
@ -83,6 +84,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* Jan 13, 2009 chammack Initial creation
* Jan 20, 2010 DR 4059 Zihou Wang Display more GSM status and
* correct display features.
* Aug 11, 2014 3504 mapeters Replaced deprecated IODataPreparer
* instances with IRenderedImageCallback.
*
* </pre>
*
@ -878,7 +881,13 @@ public class RadarGraphicFunctions {
*/
public static IImage convertBufferedImage(IGraphicsTarget target,
BufferedImage img, String name) throws VizException {
return target.initializeRaster(new IODataPreparer(img, name, 0), null);
final BufferedImage image = img;
return target.initializeRaster(new IRenderedImageCallback() {
@Override
public RenderedImage getImage() throws VizException {
return image;
}
});
}
/**

View file

@ -20,11 +20,11 @@
package com.raytheon.viz.radar.rsc.graphic;
import java.awt.image.BufferedImage;
import java.awt.image.RenderedImage;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import javax.measure.converter.UnitConverter;
import javax.measure.unit.NonSI;
@ -66,10 +66,9 @@ import com.raytheon.uf.viz.core.DrawableString;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.IGraphicsTarget.LineStyle;
import com.raytheon.uf.viz.core.IGraphicsTarget.VerticalAlignment;
import com.raytheon.uf.viz.core.data.prep.IODataPreparer;
import com.raytheon.uf.viz.core.data.IRenderedImageCallback;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.drawables.IFont;
import com.raytheon.uf.viz.core.drawables.IImage;
import com.raytheon.uf.viz.core.drawables.IRenderable;
import com.raytheon.uf.viz.core.drawables.IWireframeShape;
import com.raytheon.uf.viz.core.drawables.PaintProperties;
@ -105,7 +104,8 @@ import com.vividsolutions.jts.geom.LineString;
* Jun 24, 2013 16162 zwang Remove "wind behind"
* Nov 20, 2013 2488 randerso Removed use of VeraMono font file
* Jun 04, 2014 3232 bsteffen Cleanup.
*
* Aug 11, 2014 3504 mapeters Replaced deprecated IODataPreparer
* instances with IRenderedImageCallback.
*
* </pre>
*
@ -921,11 +921,16 @@ public class RadarGraphicsPage implements IRenderable {
}
barb.setWind(pU, pV, false);
BufferedImage imgBuf = barb.getWindImage(false, DisplayType.ARROW,
final BufferedImage imgBuf = barb.getWindImage(false,
DisplayType.ARROW,
0.2);
IImage img = this.target.initializeRaster(new IODataPreparer(
imgBuf, UUID.randomUUID().toString(), 0), null);
poWind.image = img;
poWind.image = target
.initializeRaster(new IRenderedImageCallback() {
@Override
public RenderedImage getImage() throws VizException {
return imgBuf;
}
});
ReferencedCoordinate rc = referencedGfmCoord(wX, wY);
try {

View file

@ -22,6 +22,7 @@ package com.raytheon.viz.redbook.rsc;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.awt.image.IndexColorModel;
import java.awt.image.RenderedImage;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
@ -40,9 +41,24 @@ import org.w3c.dom.Text;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.data.prep.IODataPreparer;
import com.raytheon.uf.viz.core.data.IRenderedImageCallback;
import com.raytheon.uf.viz.core.drawables.IImage;
import com.raytheon.uf.viz.core.exception.VizException;
/**
* Create weather symbol images to be drawn on the target.
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Initial creation.
* Aug 11, 2014 3504 mapeters Replaced deprecated IODataPreparer
* instances with IRenderedImageCallback.
*
* </pre>
*/
public class WxSymbols {
private IGraphicsTarget target;
@ -120,7 +136,7 @@ public class WxSymbols {
// should use the bridge context to get the TextNode and change
// that instead of the origonal DOM and rebuild..
BufferedImage bufferedImage = new BufferedImage(12, 12,
final BufferedImage bufferedImage = new BufferedImage(12, 12,
BufferedImage.TYPE_BYTE_INDEXED, tm);
Graphics2D g2d = bufferedImage.createGraphics();
@ -140,8 +156,12 @@ public class WxSymbols {
* g2d.drawRect(0, 0, 13, 13);
*/
image = target.initializeRaster(new IODataPreparer(bufferedImage,
String.format("wxsym%x", (int) c), 0), null);
image = target.initializeRaster(new IRenderedImageCallback() {
@Override
public RenderedImage getImage() throws VizException {
return bufferedImage;
}
});
images.put(c, image);
g2d.dispose();

View file

@ -20,6 +20,7 @@
package com.raytheon.viz.redbookua.rsc;
import java.awt.image.BufferedImage;
import java.awt.image.RenderedImage;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
@ -55,7 +56,7 @@ import com.raytheon.uf.viz.core.IGraphicsTarget.RasterMode;
import com.raytheon.uf.viz.core.PixelCoverage;
import com.raytheon.uf.viz.core.PixelExtent;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.data.prep.IODataPreparer;
import com.raytheon.uf.viz.core.data.IRenderedImageCallback;
import com.raytheon.uf.viz.core.drawables.IFont;
import com.raytheon.uf.viz.core.drawables.IImage;
import com.raytheon.uf.viz.core.drawables.PaintProperties;
@ -87,6 +88,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* Mar 13, 2014 2907 njensen split edex.redbook plugin into common and
* edex redbook plugins
* Jul 29, 2014 3465 mapeters Updated deprecated drawString() calls.
* Aug 11, 2014 3504 mapeters Replaced deprecated IODataPreparer
* instances with IRenderedImageCallback.
*
* </pre>
*
@ -403,13 +406,19 @@ public class RedbookUpperAirResource extends
.getFloat(RedbookUpperAirDecoder.P_LONGITUDE);
PlotData pd = new PlotData();
pd.addData(pdv);
BufferedImage bImage = pmf.getStationPlot(pd, lat, lon);
final BufferedImage bImage = pmf.getStationPlot(pd,
lat, lon);
IImage image = null;
if (bImage != null)
image = target.initializeRaster(new IODataPreparer(
bImage, "rbua"/*
* UUID.randomUUID().toString()
*/, 0), null);
if (bImage != null) {
image = target
.initializeRaster(new IRenderedImageCallback() {
@Override
public RenderedImage getImage()
throws VizException {
return bImage;
}
});
}
images[i] = image;
}
}