Merge branch 'development' into development_on_RHEL6

Conflicts:
	cots/org.jep.linux64/libjep.so

Change-Id: Ib01663f1b3be2671b90a35af2fcfc73cc6b0635d

Former-commit-id: 81a1af882e3fa8703e3b4b6bb687a1ab9710b386
This commit is contained in:
Richard Peter 2013-10-23 15:50:25 -05:00
commit cb33f5ada7
81 changed files with 1695 additions and 1490 deletions

View file

@ -82,8 +82,6 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.Bundle;
import com.google.common.eventbus.Subscribe;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
import com.raytheon.uf.viz.collaboration.comm.identity.event.IRosterChangeEvent;
import com.raytheon.uf.viz.collaboration.comm.provider.event.UserNicknameChangedEvent;
@ -132,6 +130,7 @@ import com.raytheon.viz.ui.views.CaveFloatingView;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 1, 2012 rferrel Initial creation
* Oct 22, 2013 #2483 lvenable Fixed image memory leak.
*
* </pre>
*
@ -142,13 +141,8 @@ public class CollaborationGroupView extends CaveFloatingView implements
LocalGroupListener, IUserSelector {
public static final String ID = "com.raytheon.uf.viz.collaboration.ui.CollaborationGroupView";
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(CollaborationGroupView.class);
private TreeViewer usersTreeViewer;
// private List<CustomRosterGroup> groups;
private UsersTreeFilter usersTreeFilter;
private CollaborationGroupContainer topLevel;
@ -159,14 +153,18 @@ public class CollaborationGroupView extends CaveFloatingView implements
private DisplayFeedAction displayFeedAction;
// private Action pgenAction;
private Action collapseAllAction;
private TreeEditor treeEditor;
private Composite parent;
private Image inactiveImage = null;
private Image activeImage = null;
private Image pressedImage = null;
/**
* @param parent
*/
@ -175,6 +173,9 @@ public class CollaborationGroupView extends CaveFloatingView implements
super.createPartControl(parent);
this.parent = parent;
this.parent.setLayout(new GridLayout());
createImages();
// build the necessary actions for the view
createActions();
@ -186,6 +187,20 @@ public class CollaborationGroupView extends CaveFloatingView implements
openConnection();
}
/**
* Create images.
*/
private void createImages() {
inactiveImage = AbstractUIPlugin.imageDescriptorFromPlugin(
PlatformUI.PLUGIN_ID, "$nl$/icons/full/dtool16/clear_co.gif")
.createImage();
activeImage = AbstractUIPlugin.imageDescriptorFromPlugin(
PlatformUI.PLUGIN_ID, "$nl$/icons/full/etool16/clear_co.gif")
.createImage();
pressedImage = new Image(Display.getCurrent(), activeImage,
SWT.IMAGE_GRAY);
}
private void openConnection() {
CollaborationConnection connection = CollaborationConnection
.getConnection();
@ -221,6 +236,10 @@ public class CollaborationGroupView extends CaveFloatingView implements
connection.getContactsManager().removeLocalGroupListener(this);
}
super.dispose();
inactiveImage.dispose();
activeImage.dispose();
pressedImage.dispose();
}
/**
@ -554,14 +573,6 @@ public class CollaborationGroupView extends CaveFloatingView implements
// only create the button if the text widget doesn't support one
// natively
final Image inactiveImage = AbstractUIPlugin.imageDescriptorFromPlugin(
PlatformUI.PLUGIN_ID, "$nl$/icons/full/dtool16/clear_co.gif")
.createImage();
final Image activeImage = AbstractUIPlugin.imageDescriptorFromPlugin(
PlatformUI.PLUGIN_ID, "$nl$/icons/full/etool16/clear_co.gif")
.createImage();
final Image pressedImage = new Image(Display.getCurrent(), activeImage,
SWT.IMAGE_GRAY);
final Label clearButton = new Label(comp, SWT.NONE);
clearButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER,
false, false));

View file

@ -27,12 +27,16 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.measure.unit.Unit;
import javax.measure.unit.UnitFormat;
import org.geotools.coverage.grid.GridEnvelope2D;
import org.geotools.coverage.grid.GridGeometry2D;
import org.geotools.geometry.Envelope2D;
import org.opengis.coverage.grid.GridEnvelope;
import com.raytheon.uf.common.colormap.image.ColorMapData;
import com.raytheon.uf.common.colormap.prefs.ColorMapParameters;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.datastorage.DataStoreFactory;
import com.raytheon.uf.common.geospatial.ISpatialObject;
@ -55,6 +59,7 @@ import com.raytheon.uf.viz.core.map.IMapMeshExtension;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability;
import com.raytheon.uf.viz.core.rsc.capabilities.ImagingCapability;
import com.vividsolutions.jts.geom.Coordinate;
/**
* {@link TileSetRenderable} for 2D {@link PluginDataObject}s. Groups adjacent
@ -68,7 +73,9 @@ import com.raytheon.uf.viz.core.rsc.capabilities.ImagingCapability;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 19, 2013 2122 mschenke Initial creation.
* Jun 19, 2013 2122 mschenke Initial creation.
* Oct 16, 2013 2333 mschenke Added method for auto-unit conversion
* interrogating
*
* </pre>
*
@ -199,7 +206,7 @@ public class RecordTileSetRenderable extends TileSetRenderable {
BufferSlicer.slice(data.getBuffer(),
tileRect, bigTileRect), new int[] {
tileRect.width, tileRect.height },
data.getDataType());
data.getDataType(), data.getDataUnit());
callbacks.get(i).setRetrievedData(subData);
try {
@ -353,6 +360,69 @@ public class RecordTileSetRenderable extends TileSetRenderable {
tile.getRectangle()).getColorMapData();
}
@Override
public double interrogate(Coordinate coordinate) throws VizException {
ColorMapParameters parameters = colormapping.getColorMapParameters();
return interrogate(coordinate, parameters.getNoDataValue());
}
/**
* Returns the raw image value from tile image that contains the lat/lon
* coordinate in units of desiredUnit
*
* @param coordinate
* in lat/lon space
* @param desiredUnit
* unit to convert data value to if not nanValue
* @return
* @throws VizException
*/
public double interrogate(Coordinate coordinate, Unit<?> desiredUnit)
throws VizException {
ColorMapParameters parameters = colormapping.getColorMapParameters();
return interrogate(coordinate, parameters.getNoDataValue(), desiredUnit);
}
/**
* Returns the raw image value from tile image that contains the lat/lon
* coordinate in units of desiredUnit
*
* @param coordinate
* in lat/lon space
* @param nanValue
* if interrogated value is equal to nanValue, {@link Double#NaN}
* will be returned
* @param desiredUnit
* unit to convert data value to if not nanValue
* @return
* @throws VizException
*/
public double interrogate(Coordinate coordinate, double nanValue,
Unit<?> desiredUnit) throws VizException {
double dataValue = super.interrogate(coordinate, nanValue);
if (Double.isNaN(dataValue) == false) {
ColorMapParameters params = colormapping.getColorMapParameters();
Unit<?> dataUnit = params.getDataUnit();
if (dataUnit != null && desiredUnit != null
&& dataUnit != desiredUnit) {
if (dataUnit.isCompatible(desiredUnit)) {
dataValue = dataUnit.getConverterTo(desiredUnit).convert(
dataValue);
} else {
throw new IllegalArgumentException(
"Unable to interrogate tile set. "
+ String.format(
"Desired unit (%s) is not compatible with data unit (%s).",
UnitFormat.getUCUMInstance()
.format(desiredUnit),
UnitFormat.getUCUMInstance()
.format(dataUnit)));
}
}
}
return dataValue;
}
/**
* @param target
*/

View file

@ -62,11 +62,12 @@ import com.vividsolutions.jts.geom.Coordinate;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 8, 2012 mschenke Initial creation
* May 28, 2013 2037 njensen Made imageMap concurrent to fix leak
* Jun 20, 2013 2122 mschenke Fixed null pointer in interrogate and made
* canceling jobs safer
*
* Aug 8, 2012 mschenke Initial creation
* May 28, 2013 2037 njensen Made imageMap concurrent to fix leak
* Jun 20, 2013 2122 mschenke Fixed null pointer in interrogate and made
* canceling jobs safer
* Oct 16, 2013 2333 mschenke Added auto NaN checking for interrogation
*
* </pre>
*
* @author mschenke
@ -474,6 +475,24 @@ public class TileSetRenderable implements IRenderable {
* @throws VizException
*/
public double interrogate(Coordinate coordinate) throws VizException {
return interrogate(coordinate, Double.NaN);
}
/**
* Returns the raw image value from tile image that contains the lat/lon
* coordinate. Any values matching nanValue will return {@link Double#NaN}
*
* @param coordinate
* in lat/lon space
* @param nanValue
* if interrogated value is equal to nanValue, {@link Double#NaN}
* will be returned
* @return
* @throws VizException
*/
public double interrogate(Coordinate coordinate, double nanValue)
throws VizException {
double dataValue = Double.NaN;
try {
double[] local = new double[2];
llToLocalProj
@ -490,15 +509,20 @@ public class TileSetRenderable implements IRenderable {
if (di != null) {
IImage image = di.getImage();
if (image instanceof IColormappedImage) {
return ((IColormappedImage) image).getValue(
IColormappedImage cmapImage = (IColormappedImage) image;
dataValue = cmapImage.getValue(
(int) grid[0] % tileSize, (int) grid[1]
% tileSize);
if (dataValue == nanValue) {
dataValue = Double.NaN;
}
}
}
}
} catch (TransformException e) {
throw new VizException("Error interrogating ", e);
}
return Double.NaN;
return dataValue;
}
}

View file

@ -163,6 +163,9 @@ public class BandwidthComposite extends Composite implements IApplyCancelAction
Set<String> unscheduledSubscriptions = SystemRuleManager
.setAvailableBandwidth(Network.OPSNET, bandwidth);
if (unscheduledSubscriptions == null) {
return changesApplied;
}
if (unscheduledSubscriptions.isEmpty()) {
changesApplied = true;
} else {

View file

@ -117,7 +117,7 @@ public class GLTrueColorImagingExtension extends AbstractGLSLImagingExtension
GLOffscreenRenderingExtension extension = target
.getExtension(GLOffscreenRenderingExtension.class);
try {
extension.renderOffscreen(trueColorImage,
extension.beginOffscreenRendering(trueColorImage,
trueColorImage.getImageExtent());
boolean allPainted = true;
for (Channel channel : Channel.values()) {
@ -145,7 +145,8 @@ public class GLTrueColorImagingExtension extends AbstractGLSLImagingExtension
}
}
} catch (VizException e) {
extension.renderOnscreen();
// Exception: end rendering now instead of postImageRender
extension.endOffscreenRendering();
throw e;
}
renderingChannel = null;
@ -180,7 +181,7 @@ public class GLTrueColorImagingExtension extends AbstractGLSLImagingExtension
AbstractGLImage image, Object data) throws VizException {
if (image instanceof GLTrueColorImage) {
target.getExtension(GLOffscreenRenderingExtension.class)
.renderOnscreen();
.endOffscreenRendering();
target.drawRasters(paintProps, new DrawableImage(
((GLTrueColorImage) image).getWrappedImage(),
(PixelCoverage) data));

View file

@ -32,7 +32,8 @@ import javax.media.opengl.GL;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 21, 2011 mschenke Initial creation
* Nov 21, 2011 mschenke Initial creation
* Oct 16, 2013 2333 mschenke Removed Buffer from GLColorMapData
*
* </pre>
*
@ -83,6 +84,16 @@ public abstract class AbstractGLColorMapDataFormat {
*/
public abstract double getDataFormatMax();
/**
* Returns true if the data format is a signed data format (values in format
* can be less than 0), false otherwise
*
* @return true if signed format
*/
public boolean isSignedFormat() {
return getDataFormatMin() < 0;
}
/**
* Create a buffer object for specified data for copying data from out of GL
*
@ -93,8 +104,7 @@ public abstract class AbstractGLColorMapDataFormat {
/**
* Specifies if the data format type's values are scaled when copied to GL
* and referenced in shader. True means the values will by default be scaled
* to -1 to 1, false indicates shader will receive values as is
* and referenced in shader.
*
* @return
*/
@ -108,9 +118,11 @@ public abstract class AbstractGLColorMapDataFormat {
* @param x
* @param y
* @param data
* @param dataBuffer
* @return
*/
public abstract Number getValue(int x, int y, GLColorMapData data);
public abstract Number getValue(int x, int y, GLColorMapData data,
Buffer dataBuffer);
/**
* Get the number of bytes each pixel takes up

View file

@ -0,0 +1,102 @@
/**
* 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.gl.dataformat;
import java.nio.Buffer;
import javax.measure.unit.Unit;
import com.raytheon.uf.common.colormap.image.ColorMapData;
/**
* GLColorMapData backed by a java Buffer
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 16, 2013 2333 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
public class GLBufferColorMapData extends GLColorMapData {
private Buffer data;
private int textureType;
private Unit<?> dataUnit;
public GLBufferColorMapData(ColorMapData cmData,
AbstractGLColorMapDataFormat dataFormat) {
super(dataFormat, cmData.getDataType(), cmData.getDimensions());
this.textureType = dataFormat.getTextureType();
this.data = dataFormat.formatForGL(cmData.getBuffer(), this);
this.dataUnit = cmData.getDataUnit();
}
public Buffer getData() {
return data;
}
public void setData(Buffer data) {
this.data = data;
}
public Buffer getCopybackBuffer() {
return dataFormat.getCopybackBuffer(this);
}
public int getCopyBackTextureType() {
return dataFormat.getCopyBackTextureType();
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.core.gl.dataformat.GLColorMapData#getTextureType()
*/
@Override
public int getTextureType() {
return textureType;
}
public void setTextureType(int textureType) {
this.textureType = textureType;
}
public Number getValue(int x, int y) {
return dataFormat.getValue(x, y, this, data);
}
/**
* @return
*/
public Unit<?> getDataUnit() {
return dataUnit;
}
}

View file

@ -110,8 +110,7 @@ public class GLByteDataFormat extends AbstractGLColorMapDataFormat {
* (int, int, java.nio.Buffer)
*/
@Override
public Short getValue(int x, int y, GLColorMapData data) {
Buffer dataBuffer = data.getData();
public Short getValue(int x, int y, GLColorMapData data, Buffer dataBuffer) {
if (data.getTextureType() != GL.GL_UNSIGNED_BYTE) {
throw new IllegalArgumentException(
"Cannot process texture of type " + data.getTextureType());

View file

@ -19,10 +19,7 @@
**/
package com.raytheon.viz.core.gl.dataformat;
import java.nio.Buffer;
import com.raytheon.uf.common.colormap.image.ColorMapData;
import com.raytheon.uf.common.colormap.image.ColorMapData.ColorMapDataType;
/**
*
@ -34,7 +31,8 @@ import com.raytheon.uf.common.colormap.image.ColorMapData.ColorMapDataType;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 10, 2011 bsteffen Initial creation
* Aug 10, 2011 bsteffen Initial creation
* Oct 16, 2013 2333 mschenke Removed Buffer from this object
*
* </pre>
*
@ -43,31 +41,17 @@ import com.raytheon.uf.common.colormap.image.ColorMapData.ColorMapDataType;
*/
public class GLColorMapData {
private final AbstractGLColorMapDataFormat dataFormat;
protected final AbstractGLColorMapDataFormat dataFormat;
private Buffer data;
private final int[] dimensions;
private int[] dimensions;
private final ColorMapData.ColorMapDataType dataType;
private ColorMapData.ColorMapDataType dataType;
private int textureType;
public GLColorMapData(ColorMapData cmData,
AbstractGLColorMapDataFormat dataFormat) {
public GLColorMapData(AbstractGLColorMapDataFormat dataFormat,
ColorMapData.ColorMapDataType dataType, int[] dimensions) {
this.dataFormat = dataFormat;
this.dimensions = cmData.getDimensions();
this.dataType = cmData.getDataType();
this.textureType = dataFormat.getTextureType();
this.data = dataFormat.formatForGL(cmData.getBuffer(), this);
}
public Buffer getData() {
return data;
}
public void setData(Buffer data) {
this.data = data;
this.dataType = dataType;
this.dimensions = dimensions;
}
public int getTextureFormat() {
@ -79,21 +63,13 @@ public class GLColorMapData {
}
public int getTextureType() {
return textureType;
}
public void setTextureType(int textureType) {
this.textureType = textureType;
return dataFormat.getTextureType();
}
public ColorMapData.ColorMapDataType getDataType() {
return dataType;
}
public int getCopyBackTextureType() {
return dataFormat.getCopyBackTextureType();
}
public double getDataFormatMin() {
return dataFormat.getDataFormatMin();
}
@ -106,12 +82,8 @@ public class GLColorMapData {
return dataFormat.isScaled();
}
public Buffer getCopybackBuffer() {
return dataFormat.getCopybackBuffer(this);
}
public Number getValue(int x, int y) {
return dataFormat.getValue(x, y, this);
public boolean isDataFormatSigned() {
return dataFormat.isSignedFormat();
}
public int getDimensionSize(int index) {

View file

@ -107,18 +107,18 @@ public class GLFloatDataFormat extends AbstractGLColorMapDataFormat {
* (int, int, com.raytheon.viz.core.gl.dataprep.GLColorMapData)
*/
@Override
public Float getValue(int x, int y, GLColorMapData data) {
public Float getValue(int x, int y, GLColorMapData data, Buffer dataBuffer) {
if (data.getTextureType() != GL.GL_FLOAT) {
throw new IllegalArgumentException(
"Cannot process texture of type " + data.getTextureType());
} else if (!(data.getData() instanceof FloatBuffer)) {
} else if (!(dataBuffer instanceof FloatBuffer)) {
throw new IllegalArgumentException(
"Expecting data to contain a FloatBuffer but instead it is a "
+ data.getData().getClass().getSimpleName());
+ dataBuffer.getClass().getSimpleName());
}
int width = data.getDimensionSize(0);
int index = y * width + x;
FloatBuffer buffer = (FloatBuffer) data.getData();
FloatBuffer buffer = (FloatBuffer) dataBuffer;
return buffer.get(index);
}

View file

@ -121,18 +121,18 @@ public class GLHalfFloatDataFormat extends AbstractGLColorMapDataFormat {
* (int, int, com.raytheon.viz.core.gl.dataprep.GLColorMapData)
*/
@Override
public Float getValue(int x, int y, GLColorMapData data) {
public Float getValue(int x, int y, GLColorMapData data, Buffer dataBuffer) {
if (data.getTextureType() != GL.GL_HALF_FLOAT_ARB) {
throw new IllegalArgumentException(
"Cannot process texture of type " + data.getTextureType());
} else if (!(data.getData() instanceof ShortBuffer)) {
} else if (!(dataBuffer instanceof ShortBuffer)) {
throw new IllegalArgumentException(
"Expecting data to contain a ShortBuffer but instead it is a "
+ data.getData().getClass().getSimpleName());
+ dataBuffer.getClass().getSimpleName());
}
int width = getAlignedWidth(data.getDimensionSize(0));
int index = y * width + x;
ShortBuffer buffer = (ShortBuffer) data.getData();
ShortBuffer buffer = (ShortBuffer) dataBuffer;
return convertFromFloat16(buffer.get(index));
}

View file

@ -100,15 +100,15 @@ public class GLIntDataFormat extends AbstractGLColorMapDataFormat {
* (int, int, com.raytheon.viz.core.gl.dataprep.GLColorMapData)
*/
@Override
public Integer getValue(int x, int y, GLColorMapData data) {
if (!(data.getData() instanceof IntBuffer)) {
public Integer getValue(int x, int y, GLColorMapData data, Buffer dataBuffer) {
if (!(dataBuffer instanceof IntBuffer)) {
throw new IllegalArgumentException(
"Expecting data to contain a IntBuffer but instead it is a "
+ data.getData().getClass().getSimpleName());
+ dataBuffer.getClass().getSimpleName());
}
int width = data.getDimensionSize(0);
int index = y * width + x;
IntBuffer buffer = (IntBuffer) data.getData();
IntBuffer buffer = (IntBuffer) dataBuffer;
int value = buffer.get(index);
switch (data.getTextureType()) {
case GL.GL_INT:

View file

@ -105,15 +105,15 @@ public class GLShortDataFormat extends AbstractGLColorMapDataFormat {
* (int, int, com.raytheon.viz.core.gl.dataprep.GLColorMapData)
*/
@Override
public Number getValue(int x, int y, GLColorMapData data) {
if (!(data.getData() instanceof ShortBuffer)) {
public Number getValue(int x, int y, GLColorMapData data, Buffer dataBuffer) {
if (!(dataBuffer instanceof ShortBuffer)) {
throw new IllegalArgumentException(
"Expecting data to contain a ShortBuffer but instead it is a "
+ data.getData().getClass().getSimpleName());
+ dataBuffer.getClass().getSimpleName());
}
int width = getAlignedWidth(data.getDimensionSize(0));
int index = y * width + x;
ShortBuffer buffer = (ShortBuffer) data.getData();
ShortBuffer buffer = (ShortBuffer) dataBuffer;
short value = buffer.get(index);
switch (data.getTextureType()) {
case GL.GL_SHORT:

View file

@ -19,6 +19,7 @@
**/
package com.raytheon.viz.core.gl.dataformat;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import javax.media.opengl.GL;
@ -49,15 +50,15 @@ public class GLSignedByteDataFormat extends GLByteDataFormat {
* int, com.raytheon.viz.core.gl.dataprep.GLColorMapData)
*/
@Override
public Short getValue(int x, int y, GLColorMapData data) {
if (!(data.getData() instanceof ByteBuffer)) {
public Short getValue(int x, int y, GLColorMapData data, Buffer dataBuffer) {
if (!(dataBuffer instanceof ByteBuffer)) {
throw new IllegalArgumentException(
"Expecting data to contain a ByteBuffer but instead it is a "
+ data.getData().getClass().getSimpleName());
+ dataBuffer.getClass().getSimpleName());
}
int width = getAlignedWidth(data.getDimensionSize(0));
int index = y * width + x;
ByteBuffer buffer = (ByteBuffer) data.getData();
ByteBuffer buffer = (ByteBuffer) dataBuffer;
byte value = buffer.get(index);
switch (data.getTextureType()) {
case GL.GL_BYTE:

View file

@ -19,6 +19,7 @@
**/
package com.raytheon.viz.core.gl.dataformat;
import java.nio.Buffer;
import java.nio.ShortBuffer;
import javax.media.opengl.GL;
@ -82,15 +83,15 @@ public class GLUnsignedShortDataFormat extends GLShortDataFormat {
* int, com.raytheon.viz.core.gl.dataformat.GLColorMapData)
*/
@Override
public Number getValue(int x, int y, GLColorMapData data) {
if (!(data.getData() instanceof ShortBuffer)) {
public Number getValue(int x, int y, GLColorMapData data, Buffer dataBuffer) {
if (!(dataBuffer instanceof ShortBuffer)) {
throw new IllegalArgumentException(
"Expecting data to contain a ShortBuffer but instead it is a "
+ data.getData().getClass().getSimpleName());
+ dataBuffer.getClass().getSimpleName());
}
int width = getAlignedWidth(data.getDimensionSize(0));
int index = y * width + x;
ShortBuffer buffer = (ShortBuffer) data.getData();
ShortBuffer buffer = (ShortBuffer) dataBuffer;
return (buffer.get(index) & 0xFFFF);
}

View file

@ -53,7 +53,7 @@ public interface IGLColorMapDataFormatProvider {
public AbstractGLColorMapDataFormat getGLColorMapDataFormat(
ColorMapData colorMapData) {
return GLColorMapDataFormatFactory
.getGLColorMapDataFormat(colorMapData);
.getGLColorMapDataFormat(colorMapData.getDataType());
}
};

View file

@ -22,18 +22,14 @@ package com.raytheon.viz.core.gl.ext;
import java.awt.Rectangle;
import java.awt.image.BufferedImage;
import java.awt.image.RenderedImage;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.util.Stack;
import javax.media.opengl.GL;
import com.raytheon.uf.common.colormap.image.ColorMapData;
import com.raytheon.uf.common.colormap.image.ColorMapData.ColorMapDataType;
import com.raytheon.uf.common.colormap.prefs.ColorMapParameters;
import com.raytheon.uf.viz.core.IExtent;
import com.raytheon.uf.viz.core.IView;
import com.raytheon.uf.viz.core.data.IColorMapDataRetrievalCallback;
import com.raytheon.uf.viz.core.data.IRenderedImageCallback;
import com.raytheon.uf.viz.core.drawables.IImage;
import com.raytheon.uf.viz.core.drawables.ext.GraphicsExtension;
@ -42,11 +38,13 @@ import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.viz.core.gl.IGLTarget;
import com.raytheon.viz.core.gl.dataformat.AbstractGLColorMapDataFormat;
import com.raytheon.viz.core.gl.dataformat.GLByteDataFormat;
import com.raytheon.viz.core.gl.dataformat.GLColorMapData;
import com.raytheon.viz.core.gl.dataformat.GLColorMapDataFormatFactory;
import com.raytheon.viz.core.gl.dataformat.IGLColorMapDataFormatProvider;
import com.raytheon.viz.core.gl.ext.imaging.GLColormappedImageExtension;
import com.raytheon.viz.core.gl.ext.imaging.GLDefaultImagingExtension;
import com.raytheon.viz.core.gl.images.AbstractGLImage;
import com.raytheon.viz.core.gl.images.GLColormappedImage;
import com.raytheon.viz.core.gl.images.GLImage;
import com.raytheon.viz.core.gl.images.GLOffscreenColormappedImage;
import com.raytheon.viz.core.gl.internal.GLView2D;
/**
@ -97,17 +95,29 @@ public class GLOffscreenRenderingExtension extends GraphicsExtension<IGLTarget>
private ViewInfo currentInfo = null;
public void renderOffscreen(IImage offscreenImage) throws VizException {
renderOffscreen(offscreenImage, target.getView().getExtent());
/**
* Begins offscreen rendering to the glImage. All rendering after this call
* will occur on the image until {@link #endOffscreenRendering()} is called.
* Render area will be set to the current view's extent
*
* @param glImage
* @throws VizException
*/
public void beginOffscreenRendering(AbstractGLImage glImage)
throws VizException {
beginOffscreenRendering(glImage, target.getView().getExtent());
}
public void renderOffscreen(IImage offscreenImage, IExtent offscreenExtent)
throws VizException {
if (!(offscreenImage instanceof AbstractGLImage)) {
throw new VizException(
"Can only use GLImages as offscreen frameBuffer on GLTarget");
}
AbstractGLImage glImage = (AbstractGLImage) offscreenImage;
/**
* Begins offscreen rendering to the glImage. All rendering after this call
* will occur on the image until {@link #endOffscreenRendering()} is called.
* Render area will be set to the offscreenExtent provided
*
* @param glImage
* @throws VizException
*/
public void beginOffscreenRendering(AbstractGLImage glImage,
IExtent offscreenExtent) throws VizException {
if (glImage.getStatus() == IImage.Status.UNLOADED
|| glImage.getStatus() == IImage.Status.LOADING) {
glImage.setStatus(IImage.Status.LOADING);
@ -129,8 +139,16 @@ public class GLOffscreenRenderingExtension extends GraphicsExtension<IGLTarget>
setCurrentView(new ViewInfo(view, glImage));
}
public void renderOnscreen() throws VizException {
if (viewStack.size() > 0) {
/**
* Ends offscreen rendering. Should only be called if a call to
* {@link #beginOffscreenRendering(AbstractGLImage)} or
* {@link #beginOffscreenRendering(AbstractGLImage, IExtent)} was
* successfully called first first
*
* @throws VizException
*/
public void endOffscreenRendering() throws VizException {
if (viewStack.isEmpty() == false) {
setCurrentView(viewStack.pop());
}
}
@ -167,60 +185,84 @@ public class GLOffscreenRenderingExtension extends GraphicsExtension<IGLTarget>
return Compatibilty.TARGET_COMPATIBLE;
}
public IImage constructOffscreenImage(final int[] dimensions)
/**
* Creates an RGB based image for use in offscreen rendering
*
* @param dimensions
* @return
* @throws VizException
*/
public AbstractGLImage constructOffscreenImage(final int[] dimensions)
throws VizException {
return target.initializeRaster(new IRenderedImageCallback() {
return new GLImage(new IRenderedImageCallback() {
@Override
public RenderedImage getImage() throws VizException {
return new BufferedImage(dimensions[0], dimensions[1],
BufferedImage.TYPE_INT_RGB);
}
});
}, GLDefaultImagingExtension.class);
}
public GLColormappedImage constructOffscreenImage(
/**
* Creates a colormapped offscreen image with the specified dataType and
* dimensions
*
* @param dataType
* @param dimensions
* @return
* @throws VizException
*/
public GLOffscreenColormappedImage constructOffscreenImage(
ColorMapDataType dataType, int[] dimensions) throws VizException {
return constructOffscreenImage(dataType, dimensions, null);
}
public GLColormappedImage constructOffscreenImage(
/**
* Creates a colormapped offscreen image with the specified dataType and
* dimensions and default colormap parameters
*
* @param dataType
* @param dimensions
* @param parameters
* @return
* @throws VizException
*/
public GLOffscreenColormappedImage constructOffscreenImage(
final ColorMapDataType dataType, final int[] dimensions,
ColorMapParameters parameters) throws VizException {
GLColormappedImageExtension cmapExt = target
.getExtension(GLColormappedImageExtension.class);
if (!supportsLuminance) {
return cmapExt.initializeRaster(new NoLuminanceDataCallback(
dimensions, dataType), parameters);
} else {
GLColormappedImage image = cmapExt.initializeRaster(
new IColorMapDataRetrievalCallback() {
AbstractGLColorMapDataFormat format = null;
@Override
public ColorMapData getColorMapData()
throws VizException {
return new ColorMapData(dataType, dimensions);
}
}, parameters);
if (!checkedLuminance) {
checkedLuminance = true;
try {
renderOffscreen(image);
} catch (VizException e) {
// Log this so it is easy to see in the console logs.
new VizException(
"Graphics card does not support luminance textures.",
e).printStackTrace(System.out);
// assume we don't support luminance
supportsLuminance = false;
// Reconstruct image
image = constructOffscreenImage(dataType, dimensions,
parameters);
} finally {
renderOnscreen();
}
}
return image;
if (supportsLuminance) {
format = GLColorMapDataFormatFactory
.getGLColorMapDataFormat(dataType);
} else {
format = new NoLuminanceDataFormat(dataType);
}
GLOffscreenColormappedImage image = new GLOffscreenColormappedImage(
new GLColorMapData(format, dataType, dimensions), parameters,
GLColormappedImageExtension.class);
if (!checkedLuminance) {
checkedLuminance = true;
try {
beginOffscreenRendering(image);
} catch (VizException e) {
// Log this so it is easy to see in the console logs.
new VizException(
"Graphics card does not support luminance textures.", e)
.printStackTrace(System.out);
// assume we don't support luminance
supportsLuminance = false;
// Reconstruct image
image = constructOffscreenImage(dataType, dimensions,
parameters);
} finally {
endOffscreenRendering();
}
}
return image;
}
private static final class NoLuminanceDataFormat extends GLByteDataFormat {
@ -228,10 +270,11 @@ public class GLOffscreenRenderingExtension extends GraphicsExtension<IGLTarget>
// Used to get the original min/max which makes signed bytes work and
// theoretically will give better looking results for other integer data
// types.
private final ColorMapDataType originalType;
private final AbstractGLColorMapDataFormat originalFormat;
private NoLuminanceDataFormat(ColorMapDataType originalType) {
this.originalType = originalType;
this.originalFormat = GLColorMapDataFormatFactory
.getGLColorMapDataFormat(originalType);
}
@Override
@ -251,46 +294,14 @@ public class GLOffscreenRenderingExtension extends GraphicsExtension<IGLTarget>
@Override
public double getDataFormatMin() {
return getOriginalGLColorMapDataFormat().getDataFormatMin();
return originalFormat.getDataFormatMin();
}
@Override
public double getDataFormatMax() {
return getOriginalGLColorMapDataFormat().getDataFormatMax();
return originalFormat.getDataFormatMax();
}
private AbstractGLColorMapDataFormat getOriginalGLColorMapDataFormat() {
return GLColorMapDataFormatFactory
.getGLColorMapDataFormat(originalType);
}
}
private static final class NoLuminanceDataCallback implements
IColorMapDataRetrievalCallback, IGLColorMapDataFormatProvider {
private int[] dimensions;
private final ColorMapDataType originalType;
private NoLuminanceDataCallback(int[] dimensions,
ColorMapDataType type) {
this.dimensions = dimensions;
this.originalType = type;
}
@Override
public AbstractGLColorMapDataFormat getGLColorMapDataFormat(
ColorMapData colorMapData) {
return new NoLuminanceDataFormat(originalType);
}
@Override
public ColorMapData getColorMapData() throws VizException {
Buffer buffer = ByteBuffer.allocate(dimensions[0] * dimensions[1]
* 3);
return new ColorMapData(buffer, dimensions, originalType);
}
}
}

View file

@ -34,6 +34,7 @@ import com.raytheon.uf.viz.core.drawables.ext.colormap.IColormappedImageExtensio
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.viz.core.gl.glsl.AbstractGLSLImagingExtension;
import com.raytheon.viz.core.gl.glsl.GLShaderProgram;
import com.raytheon.viz.core.gl.images.AbstractGLColormappedImage;
import com.raytheon.viz.core.gl.images.AbstractGLImage;
import com.raytheon.viz.core.gl.images.GLColormappedImage;
import com.raytheon.viz.core.gl.objects.GLTextureObject;
@ -48,10 +49,11 @@ import com.raytheon.viz.core.gl.objects.GLTextureObject;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 18, 2011 mschenke Initial creation
* Nov 18, 2011 mschenke Initial creation
* Feb 14, 2013 1616 bsteffen Add option for interpolation of colormap
* parameters, disable colormap interpolation
* by default.
* Oct 16, 2013 2333 mschenke Cleaned up load shader method, used isScaled
*
* </pre>
*
@ -94,10 +96,10 @@ public class GLColormappedImageExtension extends AbstractGLSLImagingExtension
public Object preImageRender(PaintProperties paintProps,
AbstractGLImage image, PixelCoverage coverage) throws VizException {
GLColormappedImageExtensionData data = null;
if (image instanceof GLColormappedImage) {
if (image instanceof AbstractGLColormappedImage) {
data = new GLColormappedImageExtensionData();
GL gl = target.getGl();
GLColormappedImage glImage = (GLColormappedImage) image;
AbstractGLColormappedImage glImage = (AbstractGLColormappedImage) image;
// First see if the colormap has been loaded
ColorMapParameters usedColorMapParameters = ((IColormappedImage) glImage)
.getColorMapParameters();
@ -199,31 +201,30 @@ public class GLColormappedImageExtension extends AbstractGLSLImagingExtension
public void loadShaderData(GLShaderProgram program, IImage iimage,
PaintProperties paintProps) throws VizException {
// Get image as AbstractGLImage
GLColormappedImage image = null;
if (iimage instanceof GLColormappedImage == false) {
AbstractGLColormappedImage image = null;
if (iimage instanceof AbstractGLColormappedImage == false) {
throw new VizException(
"Cannot apply glsl colormap raster shader to non gl colormap image");
}
image = (GLColormappedImage) iimage;
image = (AbstractGLColormappedImage) iimage;
GLColormappedImage colormappedImg = (GLColormappedImage) image;
ColorMapParameters colorMapParameters = colormappedImg
.getColorMapParameters();
ColorMapParameters colorMapParameters = image.getColorMapParameters();
program.setUniform("colorMapSz", colorMapParameters.getColorMap()
.getSize());
int textureType = image.getTextureType();
boolean isFloat = textureType == GL.GL_FLOAT
|| textureType == GL.GL_HALF_FLOAT_ARB;
boolean isScaled = image.isImageFormatScaled();
double dataMin = colorMapParameters.getDataMin();
double dataMax = colorMapParameters.getDataMax();
if (isFloat == false) {
if (isScaled) {
// get format from image and get data min/max from it
dataMin = image.getDataMin();
dataMax = image.getDataMax();
}
program.setUniform("isFloat", isFloat);
double cmapMin = colorMapParameters.getColorMapMin();
double cmapMax = colorMapParameters.getColorMapMax();
program.setUniform("isFloat", !isScaled);
program.setUniform("logarithmic",
colorMapParameters.isLogarithmic() ? 1 : 0);
program.setUniform("logFactor", colorMapParameters.getLogFactor());
@ -233,8 +234,8 @@ public class GLColormappedImageExtension extends AbstractGLSLImagingExtension
program.setUniform("naturalMin", dataMin);
program.setUniform("naturalMax", dataMax);
program.setUniform("cmapMin", colorMapParameters.getColorMapMin());
program.setUniform("cmapMax", colorMapParameters.getColorMapMax());
program.setUniform("cmapMin", cmapMin);
program.setUniform("cmapMax", cmapMax);
program.setUniform("alphaMask", 2);
program.setUniform("colorMap", 1);

View file

@ -0,0 +1,280 @@
/**
* 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.gl.images;
import javax.media.opengl.GL;
import com.raytheon.uf.common.colormap.image.ColorMapData.ColorMapDataType;
import com.raytheon.uf.common.colormap.prefs.ColorMapParameters;
import com.raytheon.uf.viz.core.drawables.IColormappedImage;
import com.raytheon.uf.viz.core.drawables.ext.IImagingExtension;
import com.raytheon.uf.viz.core.exception.VizException;
import com.sun.opengl.util.texture.TextureCoords;
/**
* Base implementation of a gl colormapped image.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 16, 2013 2333 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
public abstract class AbstractGLColormappedImage extends AbstractGLImage
implements IColormappedImage {
protected ColorMapParameters colorMapParameters;
protected GLCMTextureData data;
public AbstractGLColormappedImage(GLCMTextureData data,
ColorMapParameters params,
Class<? extends IImagingExtension> extensionClass) {
super(extensionClass);
this.data = data;
this.colorMapParameters = params;
if (data.isLoaded()) {
setStatus(Status.LOADED);
} else if (data.isStaged()) {
setStatus(Status.STAGED);
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.core.gl.images.AbstractGLImage#stageTexture()
*/
@Override
public boolean stageTexture() throws VizException {
if (data == null) {
throw new VizException(
"Cannot stage texture, image has been disposed");
}
return data.stageTexture();
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.core.gl.internal.GLImage#loadTexture(javax.media.opengl
* .GLContext)
*/
@Override
public void loadTexture(GL gl) throws VizException {
if (data.loadTexture(gl)) {
// Add to texture cache
setStatus(Status.LOADED);
} else {
setStatus(Status.FAILED);
}
}
/**
* Return the texture's data type
*
* Example: GL.GL_FLOAT
*
* @return the data type of the texture
*
*/
public int getTextureType() {
return data.getTextureType();
}
public ColorMapDataType getColorMapDataType() {
return data.getColorMapDataType();
}
/**
* Return the texture's format
*
* Example: GL.GL_LUMINANCE
*
* @return the texture format
*/
public int getTextureFormat() {
return data.getTextureFormat();
}
/**
* Return the texture's internal format
*
* This is the format of the texture after driver manipulation
*
* Example: GL.GL_LUMINANCE8
*
* @return the texture internal format
*/
public int getTextureInternalFormat() {
return data.getTextureInternalFormat();
}
/**
* @return the textureid
*/
public int getTextureid() {
return data.getTexId();
}
/**
* the absolute minimum value of a pixel in this image. {@link Double#NaN}
* if no absolute minimum exists
*
* @return
*/
public double getDataMin() {
return data.getDataMin();
}
/**
* the absolute maximum value of a pixel in this image. {@link Double#NaN}
* if no absolute maximum exists
*
* @return
*/
public double getDataMax() {
return data.getDataMax();
}
/**
* Returns true if the image values will be scaled when loaded into GL
*
* @return
*/
public boolean isImageFormatScaled() {
return data.isDataFormatScaled();
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.core.drawables.IColormappedImage#getColorMapParameters()
*/
@Override
public ColorMapParameters getColorMapParameters() {
return this.colorMapParameters;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.core.drawables.IColormappedImage#setColorMapParameters
* (com.raytheon.viz.core.drawables.ColorMapParameters)
*/
@Override
public void setColorMapParameters(ColorMapParameters params) {
this.colorMapParameters = params;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.core.gl.internal.images.GLImage#getTextureStorageType()
*/
@Override
public int getTextureStorageType() {
return data.getTextureStorageType();
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.core.gl.internal.images.GLImage#getHeight()
*/
@Override
public int getHeight() {
return data.getDimensionSize(1);
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.core.gl.internal.images.GLImage#getWidth()
*/
@Override
public int getWidth() {
return data.getDimensionSize(0);
}
@Override
public void dispose() {
super.dispose();
if (data != null) {
data.dispose();
data = null;
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.core.gl.images.AbstractGLImage#getStatus()
*/
@Override
public Status getStatus() {
Status status = super.getStatus();
if (data == null) {
if (status != Status.UNLOADED) {
setStatus(Status.UNLOADED);
}
} else if (data.isLoaded()) {
if (status != Status.LOADED) {
setStatus(Status.LOADED);
}
} else if (data.isStaged()) {
if (status != Status.STAGED) {
setStatus(Status.STAGED);
}
} else if (data.isLoaded() == false && status == Status.LOADED) {
if (data.isStaged()) {
setStatus(Status.STAGED);
} else {
setStatus(Status.UNLOADED);
}
} else if (data.isStaged() == false && status == Status.STAGED) {
setStatus(Status.UNLOADED);
}
return super.getStatus();
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.core.gl.images.AbstractGLImage#getTextureCoords()
*/
@Override
public TextureCoords getTextureCoords() {
return new TextureCoords(0, 1, 1, 0);
}
}

View file

@ -41,7 +41,8 @@ import com.sun.opengl.util.texture.TextureCoords;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 2, 2011 bsteffen Initial creation
* Aug 2, 2011 bsteffen Initial creation
* Oct 16, 2013 2333 mschenke Cleaned up usaAsFrameBuffer for clearer logic
*
* </pre>
*
@ -171,55 +172,61 @@ public abstract class AbstractGLImage implements IImage {
public void usaAsFrameBuffer() throws VizException {
GL gl = GLU.getCurrentGL();
if (fbo != null && fbo.isValid()) {
fbo.bind(gl);
gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
if (rbuf != null && rbuf.isValid()) {
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
if (fbo == null || fbo.isValid() == false) {
gl.glBindTexture(getTextureStorageType(), 0);
fbo = new GLFrameBufferObject(this);
if (fbo.isValid()) {
fbo.bind(gl);
if ((rbuf == null || rbuf.isValid() == false)
&& gl.glIsEnabled(GL.GL_DEPTH_TEST)) {
// Generate and bind a render buffer for the depth component
rbuf = new GLRenderBuffer(this);
rbuf.bind(gl);
rbuf.createStorage(gl, GL.GL_DEPTH_COMPONENT, getWidth(),
getHeight());
gl.glBindRenderbufferEXT(GL.GL_RENDERBUFFER_EXT, 0);
// Attach render buffer to depth of fbo
gl.glFramebufferRenderbufferEXT(GL.GL_FRAMEBUFFER_EXT,
GL.GL_DEPTH_ATTACHMENT_EXT, GL.GL_RENDERBUFFER_EXT,
rbuf.getId());
}
// Attach texture to color attachement on fbo
gl.glFramebufferTexture2DEXT(GL.GL_FRAMEBUFFER_EXT,
GL.GL_COLOR_ATTACHMENT0_EXT, getTextureStorageType(),
getTextureid(), 0);
String errorMessage = fbo.checkStatus(gl);
// use the window buffer
if (errorMessage != null) {
gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, 0);
if (fbo != null) {
fbo.dispose();
fbo = null;
}
if (rbuf != null) {
rbuf.dispose();
rbuf = null;
}
throw new VizException(errorMessage);
}
} else {
gl.glClear(GL.GL_COLOR_BUFFER_BIT);
throw new VizException("Error generating Frame Buffer Object");
}
return;
} else {
// Bind the fbo for use
fbo.bind(gl);
}
gl = GLU.getCurrentGL();
gl.glBindTexture(getTextureStorageType(), 0);
fbo = new GLFrameBufferObject(this);
fbo.bind(gl);
if (gl.glIsEnabled(GL.GL_DEPTH_TEST)) {
// Generate and bind a render buffer for the depth component
rbuf = new GLRenderBuffer(this);
rbuf.bind(gl);
rbuf.createStorage(gl, GL.GL_DEPTH_COMPONENT, getWidth(),
getHeight());
gl.glBindRenderbufferEXT(GL.GL_RENDERBUFFER_EXT, 0);
// Attach render buffer to depth of fbo
gl.glFramebufferRenderbufferEXT(GL.GL_FRAMEBUFFER_EXT,
GL.GL_DEPTH_ATTACHMENT_EXT, GL.GL_RENDERBUFFER_EXT,
rbuf.getId());
gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
if (rbuf != null && rbuf.isValid()) {
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
} else {
gl.glClear(GL.GL_COLOR_BUFFER_BIT);
}
// Attach texture to color attachement on fbo
gl.glFramebufferTexture2DEXT(GL.GL_FRAMEBUFFER_EXT,
GL.GL_COLOR_ATTACHMENT0_EXT, getTextureStorageType(),
getTextureid(), 0);
String errorMessage = fbo.checkStatus(gl);
// use the window buffer
if (errorMessage != null) {
gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, 0);
if (fbo != null) {
fbo.dispose();
fbo = null;
}
if (rbuf != null) {
rbuf.dispose();
rbuf = null;
}
throw new VizException(errorMessage);
}
}
/*
@ -265,7 +272,7 @@ public abstract class AbstractGLImage implements IImage {
}
return false;
}
/*
* (non-Javadoc)
*

View file

@ -19,29 +19,15 @@
**/
package com.raytheon.viz.core.gl.images;
import java.nio.Buffer;
import java.util.HashMap;
import java.util.Map;
import javax.media.opengl.GL;
import javax.media.opengl.glu.GLU;
import com.raytheon.uf.common.colormap.image.ColorMapData;
import com.raytheon.uf.common.colormap.image.ColorMapData.ColorMapDataType;
import com.raytheon.uf.viz.core.data.IColorMapDataRetrievalCallback;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.viz.core.gl.GLContextBridge;
import com.raytheon.viz.core.gl.dataformat.GLColorMapData;
import com.raytheon.viz.core.gl.dataformat.IGLColorMapDataFormatProvider;
import com.raytheon.viz.core.gl.internal.cache.IImageCacheable;
import com.raytheon.viz.core.gl.internal.cache.ImageCache;
import com.raytheon.viz.core.gl.internal.cache.ImageCache.CacheType;
import com.raytheon.viz.core.gl.objects.GLTextureObject;
/**
*
* TODO Make use new ColorMapData retrieval callback stuff.... Keep old
* CMDataPreparer stuff working
* Colormappable texture data object. Does not provide source of data
*
* <pre>
*
@ -49,87 +35,77 @@ import com.raytheon.viz.core.gl.objects.GLTextureObject;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 2, 2011 bsteffen Initial creation
* Aug 2, 2011 bsteffen Initial creation
* Mar 21, 2013 1806 bsteffen Update GL mosaicing to use dynamic data
* format for offscreen textures.
* Oct 16, 2013 2333 mschenke Moved retrievable/Buffer parts out and
* into separate class.
*
* </pre>
*
* @author bsteffen
* @version 1.0
*/
public class GLCMTextureData implements IImageCacheable {
public class GLCMTextureData {
private GLTextureObject tex;
protected GLTextureObject tex;
private final IColorMapDataRetrievalCallback callback;
protected GLColorMapData data;
private int refCount = 0;
private GLColorMapData data = null;
private GLCMTextureData(IColorMapDataRetrievalCallback callback) {
this.callback = callback;
}
public void use() {
refCount += 1;
}
public void dispose() {
synchronized (texMap) {
refCount -= 1;
if (refCount == 0) {
texMap.remove(callback);
ImageCache.getInstance(CacheType.MEMORY).remove(this);
ImageCache.getInstance(CacheType.TEXTURE).remove(this);
}
/**
* Constructs a GLCMTextureData with the specified GLColorMapData.
*
* @param data
*/
public GLCMTextureData(GLColorMapData data) {
this.data = data;
if (data == null && getClass().equals(GLCMTextureData.class)) {
// If null data and class is not overridden, throw exception
throw new IllegalArgumentException(
"null GLColorMapData is not allowed for GLCMTextureData");
}
}
public synchronized void disposeTexture(GL gl) {
protected GLColorMapData getDataObject() {
return data;
}
/**
* Disposes the texture data object
*/
public void dispose() {
// Dispose the texture
disposeTexture();
}
/**
* Disposes the underlying texture in the texture data
*/
public synchronized void disposeTexture() {
if (isLoaded()) {
tex.dispose();
tex = null;
}
ImageCache.getInstance(CacheType.TEXTURE).remove(this);
}
public synchronized void disposeTextureData() {
if (isStaged()) {
data.setData(null);
}
ImageCache.getInstance(CacheType.MEMORY).remove(this);
}
/**
* Stages the texture data for use.
*
* @return true if successfully staged, false otherwise
* @throws VizException
*/
public synchronized boolean stageTexture() throws VizException {
// Don't need to stage if we are already in gpu
if (isLoaded()) {
return true;
}
// Don't need to stage if we already have data
if (isStaged()) {
return true;
}
// OK, Fetch the data
ColorMapData cmData = callback.getColorMapData();
if (cmData != null) {
IGLColorMapDataFormatProvider glDataFormatCallback = IGLColorMapDataFormatProvider.defaultCallback;
if (callback instanceof IGLColorMapDataFormatProvider) {
glDataFormatCallback = (IGLColorMapDataFormatProvider) callback;
}
data = new GLColorMapData(cmData,
glDataFormatCallback.getGLColorMapDataFormat(cmData));
if (isStaged()) {
ImageCache.getInstance(CacheType.MEMORY).put(this);
return true;
}
}
// The data fetch didn't go well
return false;
// There is no data to stage
return isStaged();
}
/**
* Loads the texture object into GL
*
* @param gl
* @return true if texture is loaded, false otherwise
* @throws VizException
*/
public synchronized boolean loadTexture(GL gl) throws VizException {
// Don't need to load if we are already loaded
if (isLoaded()) {
@ -149,8 +125,7 @@ public class GLCMTextureData implements IImageCacheable {
gl.glTexParameteri(type, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR);
gl.glTexParameteri(type, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR);
if (getTextureType() == GL.GL_SHORT || getTextureType() == GL.GL_INT
|| getTextureType() == GL.GL_BYTE) {
if (isDataFormatScaled() && isDataFormatSigned()) {
// GL maps signed data into the range -1 to 1, but gl trims
// this to a valid range of 0 to 1, essentially removing
// negative values. Adding a scale and bias remaps this from
@ -160,120 +135,156 @@ public class GLCMTextureData implements IImageCacheable {
gl.glPixelTransferf(GL.GL_RED_BIAS, 0.5f);
}
int w = data.getDimensionSize(0);
int h = data.getDimensionSize(1);
int w = getDimensionSize(0);
int h = getDimensionSize(1);
createTexture2D(gl, type, w, h);
gl.glTexImage2D(type, 0, getTextureInternalFormat(), w, h, 0,
getTextureFormat(), getTextureType(), data.getData().rewind());
gl.glPixelTransferf(GL.GL_RED_SCALE, 1.0f);
gl.glPixelTransferf(GL.GL_RED_BIAS, 0.0f);
ImageCache.getInstance(CacheType.TEXTURE).put(this);
return true;
}
public boolean isStaged() {
return data != null && data.getData() != null;
/**
* Creates a 2D texture for type, with width/height w/h. Texture object must
* be bound for this call to work using
* {@link GLTextureObject#bind(GL, int)}
*
* @param gl
* @param type
* @param w
* @param h
*/
protected void createTexture2D(GL gl, int type, int w, int h) {
// Allocate our space on the graphics card, no buffer to upload so it
// will be filled with default values initially (0s)
gl.glTexImage2D(type, 0, getTextureInternalFormat(), w, h, 0,
getTextureFormat(), getTextureType(), null);
}
/**
* Checks if texture data is staged. If false, a call to
* {@link #stageTexture()} is needed before texture can be loaded
*
* @return true if staged
*/
public boolean isStaged() {
// There is nothing to stage, so we are good if data != null
return getDataObject() != null;
}
/**
* Checks if texture data is loaded. If false, a call to
* {@link #loadTexture(GL)} is needed before the texture can be used in GL
*
* @return true if staged
*/
public boolean isLoaded() {
return tex != null && tex.isValid();
}
/**
* Returns the size of the dimension index passed in (0=width,1=height)
*
* @param dimension
* @return
*/
public int getDimensionSize(int dimension) {
return data.getDimensionSize(dimension);
}
/**
* Returns the texture type of the data (FLOAT,INT,SHORT,etc).
*
* @return
*/
public int getTextureType() {
return data.getTextureType();
}
/**
* Returns texture format (LUMINANCE,RGB)
*
* @return
*/
public int getTextureFormat() {
return data.getTextureFormat();
}
/**
* Returns texture gl internal format (number of bits: LUMINANCE8/16/32)
*
* @return
*/
public int getTextureInternalFormat() {
return data.getTextureInternalFormat();
}
/**
* Returns the minimum valid data value for the texture format. (0 for
* unsigned byte, -128 for signed byte, etc)
*
* @return
*/
public double getDataMin() {
return data.getDataFormatMin();
}
/**
* Returns the maximium valid data value for the texture format. ( 255 for
* usnigned byte, 127 for signed byte, etc)
*
* @return
*/
public double getDataMax() {
return data.getDataFormatMax();
}
/**
* Returns true if the data values when uploaded to GL are in a scaled
* format and need to be converted to get actual data value
*
* @return
*/
public boolean isDataFormatScaled() {
return data.isDataFormatScaled();
}
/**
* Returns true if the data format is a signed data format (values in format
* can be less than 0), false otherwise
*
* @return true if signed format
*/
public boolean isDataFormatSigned() {
return data.isDataFormatSigned();
}
/**
* The id of the texture in GL. Will not work if {@link #isLoaded()} returns
* false
*
* @return
*/
public int getTexId() {
if (isLoaded()) {
ImageCache.getInstance(CacheType.TEXTURE).put(this);
}
return tex.getId();
}
/**
* The texture storage type of the data (TEXTURE_2D)
*
* @return
*/
public int getTextureStorageType() {
return GL.GL_TEXTURE_2D;
}
public double getValue(int x, int y) {
double value = Double.NaN;
if (!isStaged() && isLoaded()) {
GLContextBridge.makeMasterContextCurrent();
GL gl = GLU.getCurrentGL();
int textureStorageType = getTextureStorageType();
int copybackTextureType = data.getCopyBackTextureType();
Buffer copybackBuffer = data.getCopybackBuffer();
gl.glEnable(textureStorageType);
gl.glActiveTexture(GL.GL_TEXTURE0);
tex.bind(gl, textureStorageType);
gl.glGetTexImage(textureStorageType, 0, getTextureFormat(),
copybackTextureType, copybackBuffer.rewind());
gl.glActiveTexture(GL.GL_TEXTURE0);
gl.glBindTexture(textureStorageType, 0);
gl.glDisable(textureStorageType);
data.setTextureType(copybackTextureType);
data.setData(copybackBuffer);
GLContextBridge.releaseMasterContext();
}
if (data != null) {
ImageCache.getInstance(CacheType.MEMORY).put(this);
value = data.getValue(x, y).doubleValue();
}
return value;
}
private static Map<IColorMapDataRetrievalCallback, GLCMTextureData> texMap = new HashMap<IColorMapDataRetrievalCallback, GLCMTextureData>();
public static GLCMTextureData getGlTextureId(
IColorMapDataRetrievalCallback callback) {
synchronized (texMap) {
GLCMTextureData data = texMap.get(callback);
if (data == null) {
data = new GLCMTextureData(callback);
texMap.put(callback, data);
}
data.use();
return data;
}
}
@Override
public int getSize() {
if (data != null) {
int[] dimensions = data.getDimensions();
int totalSize = data.getBytesPerPixel();
for (int i = 0; i < dimensions.length; ++i) {
totalSize *= dimensions[i];
}
return totalSize;
}
return 0;
}
/**
* Returns the {@link ColorMapDataType} for the texture
*
* @return
*/
public ColorMapDataType getColorMapDataType() {
return data.getDataType();
}

View file

@ -24,10 +24,8 @@ import javax.media.opengl.GL;
import com.raytheon.uf.common.colormap.image.ColorMapData.ColorMapDataType;
import com.raytheon.uf.common.colormap.prefs.ColorMapParameters;
import com.raytheon.uf.viz.core.data.IColorMapDataRetrievalCallback;
import com.raytheon.uf.viz.core.drawables.IColormappedImage;
import com.raytheon.uf.viz.core.drawables.ext.IImagingExtension;
import com.raytheon.uf.viz.core.exception.VizException;
import com.sun.opengl.util.texture.TextureCoords;
/**
*
@ -39,46 +37,25 @@ import com.sun.opengl.util.texture.TextureCoords;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 27, 2009 mschenke Initial creation
* Jul 27, 2009 mschenke Initial creation
* Mar 21, 2013 1806 bsteffen Update GL mosaicing to use dynamic data
* format for offscreen textures.
* Oct 16, 2013 2333 mschenke Moved shared logic into base class
*
* </pre>
*
* @author mschenke
*/
public class GLColormappedImage extends AbstractGLImage implements
IColormappedImage {
public class GLColormappedImage extends AbstractGLColormappedImage {
protected ColorMapParameters colorMapParameters;
protected GLCMTextureData data;
protected GLRetrievableCMTextureData data;
public GLColormappedImage(IColorMapDataRetrievalCallback dataCallback,
ColorMapParameters params,
Class<? extends IImagingExtension> extensionClass) {
super(extensionClass);
this.data = GLCMTextureData.getGlTextureId(dataCallback);
this.colorMapParameters = params;
if (data.isLoaded()) {
setStatus(Status.LOADED);
} else if (data.isStaged()) {
setStatus(Status.STAGED);
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.core.gl.images.AbstractGLImage#stageTexture()
*/
@Override
public boolean stageTexture() throws VizException {
if (data == null) {
throw new VizException(
"Cannot stage texture, image has been disposed");
}
return data.stageTexture();
super(GLRetrievableCMTextureData.getGlTextureId(dataCallback), params,
extensionClass);
this.data = (GLRetrievableCMTextureData) super.data;
}
/*
@ -90,117 +67,15 @@ public class GLColormappedImage extends AbstractGLImage implements
*/
@Override
public void loadTexture(GL gl) throws VizException {
if (data.loadTexture(gl)) {
// Add to texture cache
setStatus(Status.LOADED);
data.disposeTextureData();
} else {
setStatus(Status.FAILED);
data.disposeTextureData();
}
}
/**
* Return the texture's data type
*
* Example: GL.GL_FLOAT
*
* @return the data type of the texture
*
*/
public int getTextureType() {
return data.getTextureType();
super.loadTexture(gl);
// No need to keep around texture data after loading
data.disposeTextureData();
}
public ColorMapDataType getColorMapDataType() {
return data.getColorMapDataType();
}
/**
* Return the texture's format
*
* Example: GL.GL_LUMINANCE
*
* @return the texture format
*/
public int getTextureFormat() {
return data.getTextureFormat();
}
/**
* Return the texture's internal format
*
* This is the format of the texture after driver manipulation
*
* Example: GL.GL_LUMINANCE8
*
* @return the texture internal format
*/
public int getTextureInternalFormat() {
return data.getTextureInternalFormat();
}
/**
* @return the textureid
*/
public int getTextureid() {
return data.getTexId();
}
/**
* the absolute minimum value of a pixel in this image. {@link Double#NaN}
* if no absolute minimum exists
*
* @return
*/
public double getDataMin() {
return data.getDataMin();
}
/**
* the absolute maximum value of a pixel in this image. {@link Double#NaN}
* if no absolute maximum exists
*
* @return
*/
public double getDataMax() {
return data.getDataMax();
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.core.drawables.IColormappedImage#getColorMapParameters()
*/
@Override
public ColorMapParameters getColorMapParameters() {
return this.colorMapParameters;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.core.drawables.IColormappedImage#setColorMapParameters
* (com.raytheon.viz.core.drawables.ColorMapParameters)
*/
@Override
public void setColorMapParameters(ColorMapParameters params) {
this.colorMapParameters = params;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.core.gl.internal.images.GLImage#getTextureStorageType()
*/
@Override
public int getTextureStorageType() {
return data.getTextureStorageType();
}
@Override
public double getValue(int x, int y) {
double val = Double.NaN;
@ -210,33 +85,10 @@ public class GLColormappedImage extends AbstractGLImage implements
return val;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.core.gl.internal.images.GLImage#getHeight()
*/
@Override
public int getHeight() {
return data.getDimensionSize(1);
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.core.gl.internal.images.GLImage#getWidth()
*/
@Override
public int getWidth() {
return data.getDimensionSize(0);
}
@Override
public void dispose() {
super.dispose();
if (data != null) {
data.dispose();
data = null;
}
data = null;
}
/*
@ -250,46 +102,4 @@ public class GLColormappedImage extends AbstractGLImage implements
super.usaAsFrameBuffer();
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.core.gl.images.AbstractGLImage#getStatus()
*/
@Override
public Status getStatus() {
Status status = super.getStatus();
if (data == null) {
if (status != Status.UNLOADED) {
setStatus(Status.UNLOADED);
}
} else if (data.isLoaded()) {
if (status != Status.LOADED) {
setStatus(Status.LOADED);
}
} else if (data.isStaged()) {
if (status != Status.STAGED) {
setStatus(Status.STAGED);
}
} else if (data.isLoaded() == false && status == Status.LOADED) {
if (data.isStaged()) {
setStatus(Status.STAGED);
} else {
setStatus(Status.UNLOADED);
}
} else if (data.isStaged() == false && status == Status.STAGED) {
setStatus(Status.UNLOADED);
}
return super.getStatus();
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.core.gl.images.AbstractGLImage#getTextureCoords()
*/
@Override
public TextureCoords getTextureCoords() {
return new TextureCoords(0, 1, 1, 0);
}
}

View file

@ -105,7 +105,7 @@ public class GLImage extends AbstractGLImage implements IImageCacheable {
ImageCache.getInstance(CacheType.TEXTURE).remove(this);
}
public void disposeTexture(GL gl) {
public void disposeTexture() {
synchronized (this) {
if (theTexture == null) {
return;

View file

@ -0,0 +1,69 @@
/**
* 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.gl.images;
import com.raytheon.uf.common.colormap.prefs.ColorMapParameters;
import com.raytheon.uf.viz.core.drawables.ext.IImagingExtension;
import com.raytheon.viz.core.gl.dataformat.GLColorMapData;
/**
* Colormappable image that is writeable to in GL/GLSL but is not back by a
* Buffer and therefore not preinitialized or inspectable
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 16, 2013 2333 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
public class GLOffscreenColormappedImage extends AbstractGLColormappedImage {
/**
* @param data
* @param params
* @param extensionClass
*/
public GLOffscreenColormappedImage(GLColorMapData data,
ColorMapParameters params,
Class<? extends IImagingExtension> extensionClass) {
super(new GLCMTextureData(data), params, extensionClass);
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.drawables.IColormappedImage#getValue(int,
* int)
*/
@Override
public double getValue(int x, int y) {
// TODO: Read value off of graphics card?
return Double.NaN;
}
}

View file

@ -0,0 +1,291 @@
/**
* 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.gl.images;
import java.nio.Buffer;
import java.util.HashMap;
import java.util.Map;
import javax.measure.unit.Unit;
import javax.media.opengl.GL;
import javax.media.opengl.glu.GLU;
import com.raytheon.uf.common.colormap.image.ColorMapData;
import com.raytheon.uf.viz.core.data.IColorMapDataRetrievalCallback;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.viz.core.gl.GLContextBridge;
import com.raytheon.viz.core.gl.dataformat.GLBufferColorMapData;
import com.raytheon.viz.core.gl.dataformat.IGLColorMapDataFormatProvider;
import com.raytheon.viz.core.gl.internal.cache.IImageCacheable;
import com.raytheon.viz.core.gl.internal.cache.ImageCache;
import com.raytheon.viz.core.gl.internal.cache.ImageCache.CacheType;
/**
* Object that represents a colormapped texture that can be unloaded and
* reloaded from main/graphics memory using a retrieval callback
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 24, 2013 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
public class GLRetrievableCMTextureData extends GLCMTextureData implements
IImageCacheable {
private static Map<IColorMapDataRetrievalCallback, GLRetrievableCMTextureData> texMap = new HashMap<IColorMapDataRetrievalCallback, GLRetrievableCMTextureData>();
/**
* Gets a {@link GLRetrievableCMTextureData} for the callback. These
* TextureData objects can be shared among callbacks
*
* @param callback
* @return
*/
public static GLRetrievableCMTextureData getGlTextureId(
IColorMapDataRetrievalCallback callback) {
synchronized (texMap) {
GLRetrievableCMTextureData data = texMap.get(callback);
if (data == null) {
data = new GLRetrievableCMTextureData(callback);
texMap.put(callback, data);
}
data.use();
return data;
}
}
private final IColorMapDataRetrievalCallback callback;
private int refCount = 0;
/**
* Private constructor, access only allowed through
* {@link #getGlTextureId(IColorMapDataRetrievalCallback)}
*
* @param callback
*/
private GLRetrievableCMTextureData(IColorMapDataRetrievalCallback callback) {
super(null);
this.callback = callback;
}
@Override
protected GLBufferColorMapData getDataObject() {
return (GLBufferColorMapData) super.getDataObject();
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.core.gl.images.GLCMTextureData#stageTexture()
*/
@Override
public synchronized boolean stageTexture() throws VizException {
// Don't need to stage if we are already in GL
if (isLoaded()) {
return true;
}
// Don't need to stage if we already have data locally
if (isStaged()) {
return true;
}
// OK, Fetch the data
ColorMapData cmData = callback.getColorMapData();
if (cmData != null) {
IGLColorMapDataFormatProvider glDataFormatCallback = IGLColorMapDataFormatProvider.defaultCallback;
if (callback instanceof IGLColorMapDataFormatProvider) {
glDataFormatCallback = (IGLColorMapDataFormatProvider) callback;
}
this.data = new GLBufferColorMapData(cmData,
glDataFormatCallback.getGLColorMapDataFormat(cmData));
if (isStaged()) {
ImageCache.getInstance(CacheType.MEMORY).put(this);
return true;
}
}
// The data fetch didn't go well
return false;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.core.gl.images.GLCMTextureData#loadTexture(javax.media
* .opengl.GL)
*/
@Override
public synchronized boolean loadTexture(GL gl) throws VizException {
if (super.loadTexture(gl)) {
ImageCache.getInstance(CacheType.TEXTURE).put(this);
return true;
}
return false;
}
@Override
public synchronized void disposeTexture() {
super.disposeTexture();
ImageCache.getInstance(CacheType.TEXTURE).remove(this);
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.core.gl.internal.cache.IImageCacheable#disposeTextureData
* ()
*/
@Override
public void disposeTextureData() {
if (isStaged()) {
getDataObject().setData(null);
}
ImageCache.getInstance(CacheType.MEMORY).remove(this);
}
public void use() {
refCount += 1;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.core.gl.images.GLCMTextureData#dispose()
*/
@Override
public void dispose() {
synchronized (texMap) {
refCount -= 1;
if (refCount == 0) {
texMap.remove(callback);
ImageCache.getInstance(CacheType.TEXTURE).remove(this);
ImageCache.getInstance(CacheType.MEMORY).remove(this);
}
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.core.gl.images.GLCMTextureData#getTexId()
*/
@Override
public int getTexId() {
if (isLoaded()) {
ImageCache.getInstance(CacheType.TEXTURE).put(this);
}
return super.getTexId();
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.common.util.cache.ICacheObject#getSize()
*/
@Override
public int getSize() {
GLBufferColorMapData data = getDataObject();
if (data != null) {
int[] dimensions = data.getDimensions();
int totalSize = data.getBytesPerPixel();
for (int i = 0; i < dimensions.length; ++i) {
totalSize *= dimensions[i];
}
return totalSize;
}
return 0;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.core.gl.images.GLCMTextureData#isStaged()
*/
@Override
public boolean isStaged() {
GLBufferColorMapData data = getDataObject();
// Override since we have our required data
return data != null && data.getData() != null;
}
public double getValue(int x, int y) {
GLBufferColorMapData data = getDataObject();
double value = Double.NaN;
if (!isStaged() && isLoaded()) {
GLContextBridge.makeMasterContextCurrent();
GL gl = GLU.getCurrentGL();
int textureStorageType = getTextureStorageType();
int copybackTextureType = data.getCopyBackTextureType();
Buffer copybackBuffer = data.getCopybackBuffer();
gl.glEnable(textureStorageType);
gl.glActiveTexture(GL.GL_TEXTURE0);
tex.bind(gl, textureStorageType);
gl.glGetTexImage(textureStorageType, 0, getTextureFormat(),
copybackTextureType, copybackBuffer.rewind());
gl.glActiveTexture(GL.GL_TEXTURE0);
gl.glBindTexture(textureStorageType, 0);
gl.glDisable(textureStorageType);
data.setTextureType(copybackTextureType);
data.setData(copybackBuffer);
GLContextBridge.releaseMasterContext();
}
if (data != null) {
ImageCache.getInstance(CacheType.MEMORY).put(this);
value = data.getValue(x, y).doubleValue();
}
return value;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.core.gl.images.GLCMTextureData#uploadTexture2D(javax
* .media.opengl.GL, int, int, int)
*/
@Override
protected void createTexture2D(GL gl, int type, int w, int h) {
gl.glTexImage2D(type, 0, getTextureInternalFormat(), w, h, 0,
getTextureFormat(), getTextureType(), getDataObject().getData()
.rewind());
}
/**
* Returns the {@link Unit} associated with the data
*
* @return the dataUnit
*/
public Unit<?> getDataUnit() {
GLBufferColorMapData data = getDataObject();
return data != null ? data.getDataUnit() : null;
}
}

View file

@ -19,8 +19,6 @@
**/
package com.raytheon.viz.core.gl.internal.cache;
import javax.media.opengl.GL;
import com.raytheon.uf.common.util.cache.ICacheObject;
/**
@ -44,6 +42,6 @@ public interface IImageCacheable extends ICacheObject {
public abstract void disposeTextureData();
public abstract void disposeTexture(GL gl);
public abstract void disposeTexture();
}

View file

@ -130,7 +130,7 @@ public class ImageCache extends LRUCache<Object, IImageCacheable> implements
new GLDisposer() {
@Override
protected void dispose(GL gl) {
i.disposeTexture(gl);
i.disposeTexture();
}
}.dispose();
}

View file

@ -24,8 +24,8 @@ import com.raytheon.uf.viz.core.DrawableImage;
import com.raytheon.uf.viz.core.IExtent;
import com.raytheon.uf.viz.core.drawables.ext.IMosaicImageExtension;
import com.raytheon.uf.viz.core.drawables.ext.IMosaicImageExtension.IMosaicImage;
import com.raytheon.viz.core.gl.images.GLColormappedImage;
import com.raytheon.viz.core.gl.images.GLDelegateImage;
import com.raytheon.viz.core.gl.images.GLOffscreenColormappedImage;
/**
* GL implementation of IMosaicImage, wraps an offscreen image and contains
@ -47,7 +47,7 @@ import com.raytheon.viz.core.gl.images.GLDelegateImage;
* @version 1.0
*/
public class GLMosaicImage extends GLDelegateImage<GLColormappedImage>
public class GLMosaicImage extends GLDelegateImage<GLOffscreenColormappedImage>
implements IMosaicImage {
private DrawableImage[] images;
@ -63,7 +63,7 @@ public class GLMosaicImage extends GLDelegateImage<GLColormappedImage>
* @param image
* @param extensionClass
*/
public GLMosaicImage(GLColormappedImage image, int[] bounds,
public GLMosaicImage(GLOffscreenColormappedImage image, int[] bounds,
IExtent imageExtent,
Class<? extends IMosaicImageExtension> extensionClass) {
super(image, extensionClass);
@ -167,7 +167,7 @@ public class GLMosaicImage extends GLDelegateImage<GLColormappedImage>
return image.getValue(x, y);
}
public void setWrappedImage(GLColormappedImage wrappedImage) {
public void setWrappedImage(GLOffscreenColormappedImage wrappedImage) {
this.image.dispose();
this.image = wrappedImage;
}

View file

@ -37,6 +37,7 @@ import com.raytheon.viz.core.gl.glsl.AbstractGLSLImagingExtension;
import com.raytheon.viz.core.gl.glsl.GLShaderProgram;
import com.raytheon.viz.core.gl.images.AbstractGLImage;
import com.raytheon.viz.core.gl.images.GLColormappedImage;
import com.raytheon.viz.core.gl.images.GLOffscreenColormappedImage;
/**
* Extension used for rendering radar mosaic images
@ -47,9 +48,11 @@ import com.raytheon.viz.core.gl.images.GLColormappedImage;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 16, 2011 mschenke Initial creation
* Dec 16, 2011 mschenke Initial creation
* Mar 21, 2013 1806 bsteffen Update GL mosaicing to use dynamic data
* format for offscreen textures.
* Oct 16, 2013 2333 mschenke Cleaned up render logic, switched to
* use GLOffscreenColormappedImage
*
* </pre>
*
@ -60,11 +63,12 @@ import com.raytheon.viz.core.gl.images.GLColormappedImage;
public class GLMosaicImageExtension extends AbstractGLSLImagingExtension
implements IMosaicImageExtension {
private GLColormappedImage writeToImage;
private GLOffscreenColormappedImage writeToImage;
public GLMosaicImage initializeRaster(int[] imageBounds,
IExtent imageExtent, ColorMapParameters params) throws VizException {
// Since byte is the most common type of mosaic start with a byte image. It might switch later if needed.
// Since byte is the most common type of mosaic start with a byte image.
// It might switch later if needed when images to mosaic are set
return new GLMosaicImage(target.getExtension(
GLOffscreenRenderingExtension.class).constructOffscreenImage(
ColorMapDataType.BYTE, imageBounds, params), imageBounds,
@ -80,6 +84,7 @@ public class GLMosaicImageExtension extends AbstractGLSLImagingExtension
*/
@Override
public String getShaderProgramName() {
// Default mosaicing algorithm glsl program
return "mosaicOrdered";
}
@ -96,36 +101,47 @@ public class GLMosaicImageExtension extends AbstractGLSLImagingExtension
AbstractGLImage image, PixelCoverage coverage) throws VizException {
if (image instanceof GLMosaicImage) {
GLMosaicImage mosaicImage = (GLMosaicImage) image;
boolean drawMosaic = true;
if (mosaicImage.isRepaint()) {
writeToImage = getWriteToImage(mosaicImage);
GLOffscreenRenderingExtension extension = target
.getExtension(GLOffscreenRenderingExtension.class);
try {
extension.renderOffscreen(mosaicImage,
mosaicImage.getImageExtent());
DrawableImage[] imagesToMosaic = mosaicImage
.getImagesToMosaic();
// Make sure images are staged before we mosaic them
ImagingSupport.prepareImages(target, imagesToMosaic);
DrawableImage[] imagesToMosaic = mosaicImage
.getImagesToMosaic();
// Make sure images are staged before we mosaic them
ImagingSupport.prepareImages(target, imagesToMosaic);
boolean allPainted = true;
// Each image needs to draw separately due to gl issues when
// zoomed in very far, rendered parts near the corners don't
// show all the pixels for each image. Pushing and popping
// GL_TEXTURE_BIT before/after each render fixes this issue
for (DrawableImage di : imagesToMosaic) {
allPainted &= drawRasters(paintProps, di);
writeToImage = getWriteToImage(mosaicImage);
if (writeToImage != null) {
GLOffscreenRenderingExtension extension = target
.getExtension(GLOffscreenRenderingExtension.class);
try {
extension.beginOffscreenRendering(mosaicImage,
mosaicImage.getImageExtent());
boolean allPainted = true;
// Each image needs to draw separately due to gl issues
// when zoomed in very far, rendered parts near the
// corners don't show all the pixels for each image.
// Pushing and popping GL_TEXTURE_BIT before/after each
// render fixes this issue
for (DrawableImage di : imagesToMosaic) {
allPainted &= drawRasters(paintProps, di);
}
// Need to set repaint based on if drawing completed.
mosaicImage.setRepaint(allPainted == false);
} finally {
extension.endOffscreenRendering();
}
// Need to set repaint based on if drawing completed.
mosaicImage.setRepaint(allPainted == false);
} finally {
extension.renderOnscreen();
writeToImage = null;
} else {
drawMosaic = false;
mosaicImage.setRepaint(true);
}
writeToImage = null;
}
target.drawRasters(paintProps,
new DrawableImage(mosaicImage.getWrappedImage(), coverage));
if (drawMosaic) {
target.drawRasters(paintProps,
new DrawableImage(mosaicImage.getWrappedImage(),
coverage));
}
// Don't actually render this image now since we just did it
return null;
} else {
@ -138,12 +154,13 @@ public class GLMosaicImageExtension extends AbstractGLSLImagingExtension
}
}
private GLColormappedImage getWriteToImage(GLMosaicImage mosaicImage)
throws VizException {
private GLOffscreenColormappedImage getWriteToImage(
GLMosaicImage mosaicImage) throws VizException {
ColorMapDataType neededType = null;
for (DrawableImage di : mosaicImage.getImagesToMosaic()) {
IImage image = di.getImage();
if (image.getStatus() != Status.LOADED) {
if (image.getStatus() != Status.LOADED
&& image.getStatus() != Status.STAGED) {
continue;
}
if (image instanceof GLColormappedImage) {
@ -158,11 +175,17 @@ public class GLMosaicImageExtension extends AbstractGLSLImagingExtension
}
}
}
GLColormappedImage writeTo = mosaicImage.getWrappedImage();
if (neededType == null) {
return null;
}
GLOffscreenColormappedImage writeTo = mosaicImage.getWrappedImage();
if (neededType != null && neededType != writeTo.getColorMapDataType()) {
GLOffscreenRenderingExtension offscreenExt = target
.getExtension(GLOffscreenRenderingExtension.class);
int[] dimensions = { writeTo.getWidth(), writeTo.getHeight() };
writeTo.dispose();
writeTo = offscreenExt.constructOffscreenImage(neededType,
dimensions, writeTo.getColorMapParameters());
mosaicImage.setWrappedImage(writeTo);

View file

@ -220,8 +220,8 @@ public class SatResource extends
InterrogationResult result = null;
synchronized (tileMap) {
for (SatTileSetRenderable renderable : tileMap.values()) {
double rValue = renderable.interrogate(latLon);
if (Double.isNaN(rValue) == false && rValue != fillValue) {
double rValue = renderable.interrogate(latLon, fillValue);
if (Double.isNaN(rValue) == false) {
result = new InterrogationResult(
renderable.getSatelliteRecord(), rValue);
}

View file

@ -19,8 +19,6 @@
**/
package com.raytheon.viz.ui.personalities.awips;
import com.raytheon.uf.viz.core.maps.MapStore;
/**
* This is the default component for CAVE that is the standard workbench with
* all the perspectives.
@ -30,8 +28,9 @@ import com.raytheon.uf.viz.core.maps.MapStore;
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 9, 2010 mschenke Initial creation
* Jul 1, 2013 2139 jsanchez Loaded map tree at cave start up.
* Aug 09, 2010 mschenke Initial creation
* Jul 01, 2013 2139 jsanchez Loaded map tree at cave start up.
* Oct 22, 2013 2361 njensen Undid 2139 fix since 2158 fixes it more efficiently
*
* </pre>
*
@ -54,11 +53,7 @@ public class CAVE extends AbstractCAVEComponent {
*/
@Override
protected void startInternal(String componentName) throws Exception {
// Loading Map Tree
long t = System.currentTimeMillis();
MapStore.getMapTree();
System.out.println("Loading Map Tree: "
+ (System.currentTimeMillis() - t));
}
}

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,5 @@
#!/bin/bash
PSQL=/awips2/psql/bin/psql
DIR=`dirname $0`
${PSQL} -U awips -d metadata -f ${DIR}/updateQueriesSql.sql

View file

@ -0,0 +1,26 @@
delete from ebxml.taxonomyelementtype_classificationnode where classificationnode_id='urn:oasis:names:tc:ebxml-regrep:QueryLanguage:SPARQL';
delete from ebxml.classificationnode where id= 'urn:oasis:names:tc:ebxml-regrep:QueryLanguage:SPARQL';
delete from ebxml.taxonomyelementtype_classificationnode where classificationnode_id='urn:oasis:names:tc:ebxml-regrep:QueryLanguage:SQL-92';
delete from ebxml.classificationnode where id= 'urn:oasis:names:tc:ebxml-regrep:QueryLanguage:SQL-92';
delete from ebxml.taxonomyelementtype_classificationnode where classificationnode_id='urn:oasis:names:tc:ebxml-regrep:QueryLanguage:XQuery';
delete from ebxml.classificationnode where id= 'urn:oasis:names:tc:ebxml-regrep:QueryLanguage:XQuery';
delete from ebxml.taxonomyelementtype_classificationnode where classificationnode_id='urn:oasis:names:tc:ebxml-regrep:QueryLanguage:EJBQL';
delete from ebxml.classificationnode where id= 'urn:oasis:names:tc:ebxml-regrep:QueryLanguage:EJBQL';
INSERT INTO ebxml.classificationnode (id,lid,objecttype,owner,versionname,code,parent,path) VALUES
('urn:oasis:names:tc:ebxml-regrep:QueryLanguage:HQL','urn:oasis:names:tc:ebxml-regrep:QueryLanguage:HQL',
'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:ClassificationNode','NCF','1','HQL',
'urn:oasis:names:tc:ebxml-regrep:classificationScheme:QueryLanguage','/urn:oasis:names:tc:ebxml-regrep:classificationScheme:QueryLanguage/HQL');
INSERT INTO ebxml.taxonomyelementtype_classificationnode(taxonomyelementtype_id,classificationnode_id) VALUES('urn:oasis:names:tc:ebxml-regrep:classificationScheme:QueryLanguage','urn:oasis:names:tc:ebxml-regrep:QueryLanguage:HQL');
delete from ebxml.taxonomyelementtype_classificationnode where classificationnode_id='urn:oasis:names:tc:ebxml-regrep:query:ExportObject';
delete from ebxml.classificationnode where id= 'urn:oasis:names:tc:ebxml-regrep:query:ExportObject';
delete from ebxml.taxonomyelementtype_classificationnode where classificationnode_id='urn:oasis:names:tc:ebxml-regrep:query:FindAllMyObjects';
delete from ebxml.classificationnode where id= 'urn:oasis:names:tc:ebxml-regrep:query:FindAllMyObjects';
delete from ebxml.taxonomyelementtype_classificationnode where classificationnode_id='urn:oasis:names:tc:ebxml-regrep:query:ExtrinsicObjectQuery';
delete from ebxml.classificationnode where id= 'urn:oasis:names:tc:ebxml-regrep:query:ExtrinsicObjectQuery';

View file

@ -58,6 +58,7 @@ import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.localization.exception.LocalizationException;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.serialization.SingleTypeJAXBManager;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
@ -81,7 +82,8 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
import com.vividsolutions.jts.simplify.TopologyPreservingSimplifier;
/**
* TODO Add Description
* Saves off geospatial data from the maps database using the warngen
* configurations to improve performance of various operations in warngen.
*
* <pre>
*
@ -93,6 +95,7 @@ import com.vividsolutions.jts.simplify.TopologyPreservingSimplifier;
* Mar 29, 2012 #14691 Qinglu Lin Added returned value of getFeArea() of
* AreaConfiguration to areaFields List.
* May 7, 2013 15690 Qinglu Lin Added convertToMultiPolygon() and updated queryGeospatialData().
* Oct 22, 2013 2361 njensen Use JAXBManager for XML
* </pre>
*
* @author rjpeter
@ -100,9 +103,13 @@ import com.vividsolutions.jts.simplify.TopologyPreservingSimplifier;
*/
public class GeospatialDataGenerator {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(GeospatialDataGenerator.class);
private static final SingleTypeJAXBManager<GeospatialTimeSet> jaxb = SingleTypeJAXBManager
.createWithoutException(GeospatialTimeSet.class);
public static void generateUniqueGeospatialMetadataGeometries() {
String mySite = SiteUtil.getSite();
DialogConfiguration dialogConfig = null;
@ -394,23 +401,27 @@ public class GeospatialDataGenerator {
// clip against County Warning Area
if (!areaSource.equalsIgnoreCase(WarningConstants.MARINE)) {
String cwaSource = "cwa";
List<String> cwaAreaFields = new ArrayList<String>(Arrays.asList("wfo", "gid"));
List<String> cwaAreaFields = new ArrayList<String>(Arrays.asList(
"wfo", "gid"));
HashMap<String, RequestConstraint> cwaMap = new HashMap<String, RequestConstraint>(
2);
cwaMap.put("wfo", new RequestConstraint(site, ConstraintType.LIKE));
SpatialQueryResult[] cwaFeatures = SpatialQueryFactory.create().query(
cwaSource, cwaAreaFields.toArray(new String[cwaAreaFields.size()]),
null, cwaMap, SearchMode.WITHIN);
SpatialQueryResult[] cwaFeatures = SpatialQueryFactory.create()
.query(cwaSource,
cwaAreaFields.toArray(new String[cwaAreaFields
.size()]), null, cwaMap, SearchMode.WITHIN);
Geometry multiPolygon = null;
Geometry clippedGeom = null;
for (int i = 0; i < features.length; i++) {
multiPolygon = null;
for (int j = 0; j < cwaFeatures.length; j++) {
clippedGeom = features[i].geometry.intersection(cwaFeatures[j].geometry);
clippedGeom = features[i].geometry
.intersection(cwaFeatures[j].geometry);
if (clippedGeom instanceof GeometryCollection) {
GeometryCollection gc = (GeometryCollection)clippedGeom;
GeometryCollection gc = (GeometryCollection) clippedGeom;
if (multiPolygon != null)
multiPolygon = multiPolygon.union(convertToMultiPolygon(gc));
multiPolygon = multiPolygon
.union(convertToMultiPolygon(gc));
else
multiPolygon = convertToMultiPolygon(gc);
}
@ -440,7 +451,8 @@ public class GeospatialDataGenerator {
/**
* Convert a GeometryCollection to a MultiPolygon.
* @param gc
*
* @param gc
*/
private static MultiPolygon convertToMultiPolygon(GeometryCollection gc) {
GeometryCollectionIterator iter = new GeometryCollectionIterator(gc);
@ -451,11 +463,11 @@ public class GeospatialDataGenerator {
Object o = iter.next();
if (o instanceof MultiPolygon) {
if (mp == null)
mp = (MultiPolygon)o;
mp = (MultiPolygon) o;
else
mp = (MultiPolygon)mp.union((MultiPolygon)o);
mp = (MultiPolygon) mp.union((MultiPolygon) o);
} else if (o instanceof Polygon) {
polygons.add((Polygon)o);
polygons.add((Polygon) o);
} else if (o instanceof LineString || o instanceof Point) {
LinearRing lr = null;
Coordinate[] coords = null;
@ -463,12 +475,12 @@ public class GeospatialDataGenerator {
Coordinate[] cs = ((LineString) o).getCoordinates();
if (cs.length < 4) {
coords = new Coordinate[4];
for (int j = 0; j< cs.length; j++)
for (int j = 0; j < cs.length; j++)
coords[j] = new Coordinate(cs[j]);
for (int j = cs.length; j < 4; j++)
coords[j] = new Coordinate(cs[3-j]);
coords[j] = new Coordinate(cs[3 - j]);
} else {
coords = new Coordinate[cs.length+1];
coords = new Coordinate[cs.length + 1];
for (int j = 0; j < cs.length; j++)
coords[j] = new Coordinate(cs[j]);
coords[cs.length] = new Coordinate(cs[0]);
@ -476,14 +488,15 @@ public class GeospatialDataGenerator {
} else {
coords = new Coordinate[4];
for (int i = 0; i < 4; i++)
coords[i] = ((Point)o).getCoordinate();
coords[i] = ((Point) o).getCoordinate();
}
lr = (((Geometry)o).getFactory()).createLinearRing(coords);
lr = (((Geometry) o).getFactory()).createLinearRing(coords);
Polygon poly = (new GeometryFactory()).createPolygon(lr, null);
polygons.add((Polygon)poly);
polygons.add((Polygon) poly);
} else {
statusHandler.handle(Priority.WARN,
"Unprocessed Geometry object: " + o.getClass().getName());
"Unprocessed Geometry object: "
+ o.getClass().getName());
}
}
if (mp == null && polygons.size() == 0)
@ -491,7 +504,8 @@ public class GeospatialDataGenerator {
if (polygons.size() > 0) {
Polygon[] p = polygons.toArray(new Polygon[0]);
if (mp != null)
mp = (MultiPolygon)mp.union(new MultiPolygon(p, gc.getFactory()));
mp = (MultiPolygon) mp.union(new MultiPolygon(p, gc
.getFactory()));
else
mp = new MultiPolygon(p, gc.getFactory());
}
@ -560,7 +574,7 @@ public class GeospatialDataGenerator {
.query(timezonePathcastTable,
new String[] { timezonePathcastField }, hull, null,
false, SearchMode.INTERSECTS);
rval = new GeospatialData[timeZoneResults.length];
for (int i = 0; i < timeZoneResults.length; i++) {
SpatialQueryResult result = timeZoneResults[i];
@ -569,7 +583,7 @@ public class GeospatialDataGenerator {
data.attributes = result.attributes;
rval[i] = data;
}
// set time zone and area field
if (timeZoneResults.length == 1) {
SpatialQueryResult tz = timeZoneResults[0];
@ -651,7 +665,7 @@ public class GeospatialDataGenerator {
GeospatialTimeSet set = new GeospatialTimeSet();
set.setData(new ArrayList<GeospatialTime>(times.values()));
String xml = SerializationUtil.marshalToXml(set);
String xml = jaxb.marshalToXml(set);
lf = pathMgr.getLocalizationFile(context,
GeospatialFactory.METADATA_FILE);

View file

@ -25,6 +25,8 @@ import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.nio.ShortBuffer;
import javax.measure.unit.Unit;
/**
*
* Container for colormap data.
@ -36,6 +38,7 @@ import java.nio.ShortBuffer;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 28, 2013 bsteffen Seperate from IColorMapDataRetrievalCallback
* Oct 16, 2013 2333 mschenke Added field for specifying the unit of the data
*
* </pre>
*
@ -48,11 +51,13 @@ public class ColorMapData {
BYTE, SIGNED_BYTE, UNSIGNED_SHORT, SHORT, INT, FLOAT;
}
private Buffer buffer;
private final Buffer buffer;
private int[] dimensions;
private final int[] dimensions;
private ColorMapData.ColorMapDataType dataType;
private final ColorMapData.ColorMapDataType dataType;
private final Unit<?> dataUnit;
/**
*
@ -63,6 +68,14 @@ public class ColorMapData {
this(buffer, dimensions, getDataType(buffer));
}
/**
* @param dataType
* @param dataBounds
*/
public ColorMapData(ColorMapDataType dataType, int[] dimensions) {
this(getBuffer(dataType, dimensions), dimensions, dataType);
}
/**
* @param buffer
* @param dataBounds
@ -70,19 +83,20 @@ public class ColorMapData {
*/
public ColorMapData(Buffer buffer, int[] dimensions,
ColorMapData.ColorMapDataType dataType) {
this.buffer = buffer;
this.dimensions = dimensions;
this.dataType = dataType;
this(buffer, dimensions, dataType, null);
}
/**
* @param dataType
* @param buffer
* @param dataBounds
* @param dataType
*/
public ColorMapData(ColorMapDataType dataType, int[] dimensions) {
this.buffer = getBuffer(dataType, dimensions);
public ColorMapData(Buffer buffer, int[] dimensions,
ColorMapData.ColorMapDataType dataType, Unit<?> dataUnit) {
this.buffer = buffer;
this.dimensions = dimensions;
this.dataType = dataType;
this.dataUnit = dataUnit;
}
public Buffer getBuffer() {
@ -97,6 +111,10 @@ public class ColorMapData {
return dataType;
}
public Unit<?> getDataUnit() {
return dataUnit;
}
public static ColorMapData.ColorMapDataType getDataType(Buffer buffer) {
if (buffer instanceof FloatBuffer) {
return ColorMapData.ColorMapDataType.FLOAT;

View file

@ -1,3 +0,0 @@
com.raytheon.uf.common.dataplugin.acarssounding.ACARSSoundingRecord
com.raytheon.uf.common.dataplugin.acarssounding.ACARSSoundingLayer
com.raytheon.uf.common.dataplugin.acarssounding.tools.Airports

View file

@ -30,22 +30,17 @@ import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import com.raytheon.uf.common.geospatial.ISpatialEnabled;
import com.raytheon.uf.common.geospatial.ISpatialObject;
import com.raytheon.uf.common.pointdata.spatial.AircraftObsLocation;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.Point;
/**
* TODO Add Description
* Layer for an ACARS Sounding
*
* <pre>
*
@ -53,6 +48,7 @@ import com.vividsolutions.jts.geom.Point;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 30, 2009 jkorman Initial creation
* Oct 22, 2013 2361 njensen Remove XML annotations
*
* </pre>
*
@ -62,10 +58,8 @@ import com.vividsolutions.jts.geom.Point;
@Entity
@Table(name = "acarssoundinglayer")
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class ACARSSoundingLayer implements Serializable, ISerializableObject,
ISpatialEnabled {
public class ACARSSoundingLayer implements Serializable, ISpatialEnabled {
private static final long serialVersionUID = 1L;
@ -81,103 +75,86 @@ public class ACARSSoundingLayer implements Serializable, ISerializableObject,
// Time of the observation.
@Column
@DynamicSerializeElement
@XmlAttribute
private Calendar timeObs;
@Column(length = 32)
@DynamicSerializeElement
@XmlElement
private String tailNumber;
@Embedded
@XmlElement
@DynamicSerializeElement
private AircraftObsLocation location;
// Flight phase
@Column
@DynamicSerializeElement
@XmlElement
private Integer flightPhase;
// Observation air temperature in degrees Kelvin.
@Column
@DynamicSerializeElement
@XmlElement
private Double temp;
// Observation dewpoint temperature in degrees Kelvin.
// Decimal(5,2)
@Column
@DynamicSerializeElement
@XmlElement
private Double dwpt;
// Relative Humidity in percent. Decimal(5,2)
@Column
@DynamicSerializeElement
@XmlElement
private Double humidity;
// Mixing ratio in Kg/Kg
@Column
@DynamicSerializeElement
@XmlElement
private Double mixingRatio;
// Observation wind direction in angular degrees. Integer
@Column
@DynamicSerializeElement
@XmlElement
private Integer windDirection;
// Observation wind speed in meters per second.
// Decimal(5,2)
@Column
@DynamicSerializeElement
@XmlElement
private Double windSpeed;
// Base height of reported icing.
@Column
@DynamicSerializeElement
@XmlElement
private Integer iceBaseHgt;
// Top height of reported icing.
@Column
@DynamicSerializeElement
@XmlElement
private Integer iceTopHgt;
// Intensity of reported icing.
@Column
@DynamicSerializeElement
@XmlElement
private Integer icing;
// Base height of reported turbulence.
@Column
@DynamicSerializeElement
@XmlElement
private Integer turbBaseHgt;
// Top height of reported turbulence.
@Column
@DynamicSerializeElement
@XmlElement
private Integer turbTopHgt;
// Intensity of reported turbulence.
@Column
@DynamicSerializeElement
@XmlElement
private Integer turbulence;
// Indicated or calculated pressure.
@Column
@DynamicSerializeElement
@XmlElement
private Double pressure;
/**
@ -608,29 +585,27 @@ public class ACARSSoundingLayer implements Serializable, ISerializableObject,
return false;
return true;
}
public static final void main(String [] args) {
public static final void main(String[] args) {
ACARSSoundingLayer layerA = new ACARSSoundingLayer();
AircraftObsLocation locA = new AircraftObsLocation();
locA.setLocation(40.2, -101.5);
locA.setFlightLevel(1052);
layerA.setLocation(locA);
layerA.setTailNumber("ABCDEF");
ACARSSoundingLayer layerB = new ACARSSoundingLayer();
AircraftObsLocation locB = new AircraftObsLocation();
locB.setLocation(40.2, -101.5);
locB.setFlightLevel(1052);
layerB.setLocation(locB);
layerB.setTailNumber("ABCDEF");
System.out.println(layerA.hashCode());
System.out.println(layerB.hashCode());
}
}

View file

@ -20,8 +20,6 @@
package com.raytheon.uf.common.dataplugin.acarssounding;
import java.util.Calendar;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
@ -39,15 +37,9 @@ import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import org.hibernate.annotations.Index;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.geospatial.ISpatialEnabled;
@ -71,6 +63,7 @@ import com.vividsolutions.jts.geom.Geometry;
* May 07, 2013 1869 bsteffen Remove dataURI column from
* PluginDataObject.
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
* Oct 22, 2013 2361 njensen Remove XML annotations and IDecoderGettable
*
* </pre>
*
@ -86,61 +79,46 @@ import com.vividsolutions.jts.geom.Geometry;
*/
@org.hibernate.annotations.Table(appliesTo = "acarssounding", indexes = { @Index(name = "acarssounding_refTimeIndex", columnNames = {
"refTime", "forecastTime" }) })
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class ACARSSoundingRecord extends PluginDataObject implements
ISpatialEnabled, IDecoderGettable {
ISpatialEnabled {
private static final long serialVersionUID = 1L;
public static final Unit<Angle> LOCATION_UNIT = NonSI.DEGREE_ANGLE;
private static final HashMap<String, String> PARM_MAP = new HashMap<String, String>();
static {
PARM_MAP.put("NLAT", STA_LAT);
PARM_MAP.put("NLON", STA_LON);
}
// Time of the observation.
@Column
@DataURI(position = 1, embedded = true)
@DynamicSerializeElement
@XmlAttribute
private Calendar timeObs;
@Embedded
@DataURI(position = 2, embedded = true)
@XmlElement
@DynamicSerializeElement
private SurfaceObsLocation location;
@Column(length = 32)
@DynamicSerializeElement
@XmlElement
private String tailNumber;
// Flight phase (A[scending] D[escending])
@Column(length = 1)
@DynamicSerializeElement
@XmlElement
private String phase = null;
// oldest observation time in this sounding
@Column
@DynamicSerializeElement
@XmlElement
private Long oldestTime = Long.MAX_VALUE;
// newest observation time in this sounding
@Column
@DynamicSerializeElement
@XmlElement
private Long newestTime = Long.MIN_VALUE;
// The level data for this observation.
@OneToMany(cascade = CascadeType.ALL, mappedBy = "parent", fetch = FetchType.EAGER)
@XmlElement
@DynamicSerializeElement
private Set<ACARSSoundingLayer> levels;
@ -345,42 +323,6 @@ public class ACARSSoundingRecord extends PluginDataObject implements
}
}
/**
* This class does not implement IDecoderGettable so return null.
*
* @return Always null for this class.
*/
@Override
public IDecoderGettable getDecoderGettable() {
return null;
}
@Override
public Amount getValue(String pName) {
Amount a = null;
if ("NLAT".equals(pName)) {
a = new Amount(getLatitude(), LOCATION_UNIT);
} else if ("NLON".equals(pName)) {
a = new Amount(getLongitude(), LOCATION_UNIT);
}
return a;
}
@Override
public Collection<Amount> getValues(String paramName) {
return null;
}
@Override
public String getString(String paramName) {
return null;
}
@Override
public String[] getStrings(String paramName) {
return null;
}
@Override
@Column
@Access(AccessType.PROPERTY)

View file

@ -32,13 +32,11 @@ import javax.xml.bind.annotation.XmlRootElement;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.serialization.SingleTypeJAXBManager;
import com.raytheon.uf.edex.decodertools.core.LatLonPoint;
/**
* TODO Add Description
* Container for a list of airports read from an XML file
*
* <pre>
*
@ -46,6 +44,7 @@ import com.raytheon.uf.edex.decodertools.core.LatLonPoint;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 16, 2009 jkorman Initial creation
* Oct 22, 2013 2361 njensen Use JAXBManager for XML
*
* </pre>
*
@ -55,7 +54,7 @@ import com.raytheon.uf.edex.decodertools.core.LatLonPoint;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
public class Airports implements ISerializableObject {
public class Airports {
private Log logger = LogFactory.getLog(getClass());
@ -175,13 +174,14 @@ public class Airports implements ISerializableObject {
Airports airports = null;
try {
airports = (Airports) SerializationUtil
.jaxbUnmarshalFromXmlFile(filePath + File.separator
+ fileName);
SingleTypeJAXBManager<Airports> jaxb = new SingleTypeJAXBManager<Airports>(
Airports.class);
airports = jaxb.unmarshalFromXmlFile(filePath + File.separator
+ fileName);
logger.info(String.format("%4d airports read from config.",
airports.getAirport().size()));
} catch (SerializationException e) {
} catch (Exception e) {
logger.error("Error unmarshaling airports ", e);
}
airports.createMapping();

View file

@ -1 +0,0 @@
com.raytheon.uf.common.dataplugin.binlightning.BinLightningRecord

View file

@ -29,14 +29,9 @@ import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.UniqueConstraint;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import org.hibernate.annotations.Index;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.binlightning.impl.LightningStrikePoint;
@ -83,6 +78,7 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools;
* May 07, 2013 1869 bsteffen Remove dataURI column from
* PluginDataObject.
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
* Oct 22, 2013 2361 njensen Removed XML annotations
*
* </pre>
*
@ -98,9 +94,7 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools;
*/
@org.hibernate.annotations.Table(appliesTo = BinLightningRecord.PLUGIN_NAME, indexes = { @Index(name = "binlightning_refTimeIndex", columnNames = {
"refTime", "forecastTime" }) })
@XmlRootElement
@DynamicSerialize
@XmlAccessorType(XmlAccessType.NONE)
public class BinLightningRecord extends PersistablePluginDataObject implements
IPersistable {
@ -151,20 +145,17 @@ public class BinLightningRecord extends PersistablePluginDataObject implements
@DataURI(position = 1)
@Column
@DynamicSerializeElement
@XmlAttribute
private Calendar startTime;
// Persisted value - Latest strike time in the collection.
@DataURI(position = 2)
@Column
@DynamicSerializeElement
@XmlAttribute
private Calendar stopTime;
// JJG - source of lightning data
@Column(length = 5)
@DataURI(position = 3)
@XmlAttribute
@DynamicSerializeElement
private String lightSource;
@ -448,17 +439,6 @@ public class BinLightningRecord extends PersistablePluginDataObject implements
this.lightSource = lightSource;
}
/**
* Get the IDecoderGettable reference for this record.
*
* @return The IDecoderGettable reference for this record. Null for this
* class.
*/
@Override
public IDecoderGettable getDecoderGettable() {
return null;
}
/**
* Sets the data arrays from the store.
*

View file

@ -1,2 +0,0 @@
com.raytheon.uf.common.dataplugin.bufrua.UAObs
com.raytheon.uf.common.dataplugin.bufrua.UAObsLevel

View file

@ -20,21 +20,10 @@
package com.raytheon.uf.common.dataplugin.bufrua;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.measure.quantity.Angle;
import javax.measure.quantity.Length;
import javax.measure.quantity.Temperature;
import javax.measure.quantity.Velocity;
import javax.measure.unit.NonSI;
import javax.measure.unit.SI;
import javax.measure.unit.Unit;
import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Column;
@ -44,15 +33,9 @@ import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.UniqueConstraint;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import org.hibernate.annotations.Index;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
@ -63,7 +46,6 @@ import com.raytheon.uf.common.pointdata.PointDataView;
import com.raytheon.uf.common.pointdata.spatial.SurfaceObsLocation;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.edex.decodertools.core.IDecoderConstants;
import com.vividsolutions.jts.geom.Geometry;
/**
@ -95,6 +77,7 @@ import com.vividsolutions.jts.geom.Geometry;
* Jul 19, 2013 1992 bsteffen Remove redundant time columns from
* bufrua.
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
* Oct 22, 2013 2361 njensen Remove XML annotations and IDecoderGettable
*
* </pre>
*
@ -110,11 +93,9 @@ import com.vividsolutions.jts.geom.Geometry;
*/
@org.hibernate.annotations.Table(appliesTo = UAObs.PLUGIN_NAME, indexes = { @Index(name = "bufrua_refTimeIndex", columnNames = {
"refTime", "forecastTime" }) })
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class UAObs extends PersistablePluginDataObject implements
ISpatialEnabled, IDecoderGettable, IPointData, IPersistable {
ISpatialEnabled, IPointData, IPersistable {
private static final long serialVersionUID = 1L;
@ -139,33 +120,6 @@ public class UAObs extends PersistablePluginDataObject implements
public static final String PLUGIN_NAME = "bufrua";
public static final Unit<Length> DISTANCE_UNIT = SI.METER;
public static final Unit<Temperature> TEMPERATURE_UNIT = SI.KELVIN;
public static final Unit<Velocity> WIND_SPEED_UNIT = SI.METERS_PER_SECOND;
public static final Unit<Angle> WIND_DIR_UNIT = NonSI.DEGREE_ANGLE;
public static final Unit<Angle> LOCATION_UNIT = NonSI.DEGREE_ANGLE;
private static final HashMap<String, String> PARM_MAP = new HashMap<String, String>();
static {
PARM_MAP.put("GH", UA_GEOHGT);
PARM_MAP.put("Px", UA_PRESSURE);
PARM_MAP.put("T", SFC_TEMP);
PARM_MAP.put("DpT", SFC_DWPT);
PARM_MAP.put("WS", SFC_WNDSPD);
PARM_MAP.put("WD", SFC_WNDDIR);
PARM_MAP.put("NLAT", STA_LAT);
PARM_MAP.put("NLON", STA_LON);
}
public static final String UA_PARAM_PTRN = ".*:PRESS=\\d{2,4}";
// Non persisted value. Hold the last requested parameter name.
@Transient
private String parameterName = null;
@ -177,20 +131,17 @@ public class UAObs extends PersistablePluginDataObject implements
// The observation report type.
@DataURI(position = 1)
@Column
@XmlAttribute
@DynamicSerializeElement
private Integer reportType;
@Embedded
@DataURI(position = 4, embedded = true)
@XmlElement
@DynamicSerializeElement
private SurfaceObsLocation location;
// Correction indicator from wmo header
@DataURI(position = 2)
@Column
@XmlAttribute
@DynamicSerializeElement
private String corIndicator;
@ -201,48 +152,40 @@ public class UAObs extends PersistablePluginDataObject implements
// Text of the WMO header
@DataURI(position = 3)
@Column
@XmlAttribute
@DynamicSerializeElement
private String wmoHeader;
// Station pressure in Pascals.
@Column
@XmlAttribute
@DynamicSerializeElement
private Integer pressure_station;
// The total cloud cover in 1/8s coverage.
@Column
@XmlAttribute
@DynamicSerializeElement
private Integer totalCloudCover;
// The platform directio in angular degrees.
@Column
@XmlAttribute
@DynamicSerializeElement
private Integer platformDirection;
// The platform movement in meters per second.
@Column
@XmlAttribute
@DynamicSerializeElement
private Double platformMovement;
// ICAO of station if known.
@Column
@XmlAttribute
@DynamicSerializeElement
private String stationName;
// The level data for this observation.
@Transient
@XmlElement
@DynamicSerializeElement
private List<UAObsLevel> levels;
@Column(insertable = false, updatable = false)
@XmlAttribute
@DynamicSerializeElement
private Integer idx;
@ -543,16 +486,6 @@ public class UAObs extends PersistablePluginDataObject implements
identifier = dataURI;
}
/**
* Get the IDecoderGettable reference for this record.
*
* @return The IDecoderGettable reference for this record.
*/
@Override
public IDecoderGettable getDecoderGettable() {
return this;
}
/**
*
*/
@ -569,203 +502,6 @@ public class UAObs extends PersistablePluginDataObject implements
this.pointDataView = pointDataView;
}
/**
* Get the value of a parameter that is represented as a String.
*
* @param paramName
* The name of the parameter value to retrieve.
* @return The String value of the parameter. If the parameter is unknown, a
* null reference is returned.
*/
@Override
public String getString(String paramName) {
if ("STA".matches(paramName)) {
return this.getStationId();
}
return null;
}
/**
* Get the value and units of a named parameter within this observation. The
* parameter name may include level information for these observation data.
* The format for parameter is:
*
* <pre>
* &quot;parameterName&quot; may be one of
* &quot;GH&quot; geopotential height
* &quot;Px&quot; pressure
* &quot;T&quot; temperature
* &quot;DpT&quot; dewpoint
* &quot;WS&quot; wind speed
* &quot;WD&quot; wind direction
* followed by a level specification &quot;:PRESS=xxxx&quot; where xxxx is a level
* in hPa (millibars). To retrieve the temperature from the 850hPa level
* use the following getValue(&quot;T:PRESS=850&quot;);
*
* Some data is specific to the observation, latitude/longitude for
* example. These data may be retrieved using the parameter minus any level
* information as follows
* &quot;NLAT&quot; station latitude
* &quot;NLON&quot; station longitude
* </pre>
*
* If the sounding data defines a surface level, and a request for a level
* below surface is requested, a null value is returned.
*
* @param paramName
* The name of the parameter value to retrieve.
* @return An Amount with value and units. If the parameter is unknown, a
* null reference is returned.
*/
@Override
public Amount getValue(String paramName) {
Amount a = null;
if (parseParameter(paramName)) {
String pName = PARM_MAP.get(parameterName);
if ((pName != null) && (levels != null) && (levels.size() > 0)) {
UAObsLevel obsLevel = getLevel(levelId);
if (obsLevel != null) {
Integer iValue = null;
Double dValue = null;
if (UA_GEOHGT.equals(pName)) {
iValue = obsLevel.getGeoHeight();
if (iValue != null) {
a = new Amount(iValue, DISTANCE_UNIT);
}
} else if (SFC_TEMP.equals(pName)) {
dValue = obsLevel.getTemp();
if (dValue != null) {
a = new Amount(dValue, TEMPERATURE_UNIT);
}
} else if (SFC_DWPT.equals(pName)) {
dValue = obsLevel.getDwpt();
if (dValue != null) {
a = new Amount(dValue, TEMPERATURE_UNIT);
}
} else if (SFC_WNDSPD.equals(pName)) {
dValue = obsLevel.getWindSpeed();
if (dValue != null) {
a = new Amount(dValue, WIND_SPEED_UNIT);
}
} else if (SFC_WNDDIR.equals(pName)) {
iValue = obsLevel.getWindDirection();
if (iValue != null) {
a = new Amount(iValue, WIND_DIR_UNIT);
}
}
}
}
} else {
// Assume we are trying to get an observation attribute.
String pName = PARM_MAP.get(paramName);
if (STA_LAT.equals(pName)) {
a = new Amount(this.getLatitude(), LOCATION_UNIT);
} else if (STA_LON.equals(pName)) {
a = new Amount(this.getLongitude(), LOCATION_UNIT);
}
}
return a;
}
/**
* Get the value of a parameter that is represented as a String.
*
* @param paramName
* The name of the parameter value to retrieve.
* @return The String value of the parameter. If the parameter is unknown, a
* null reference is returned.
*/
@Override
public Collection<Amount> getValues(String paramName) {
return null;
}
/**
* Determine if the parameter is a level request, and parse out the pressure
* level and parameter name if so.
*
* @param parameter
* The parameter string to parse.
* @return This is a level parameter.
*/
private boolean parseParameter(String parameter) {
boolean goodParse = false;
Pattern p = Pattern.compile(UA_PARAM_PTRN);
Matcher m = p.matcher(parameter);
if (m.find()) {
int start = parameter.indexOf(":PRESS=");
if (start > 0) {
parameterName = parameter.substring(0, start);
start += ":PRESS=".length();
levelId = Integer.parseInt(parameter.substring(start));
}
goodParse = true;
}
return goodParse;
}
/**
* Get a specified pressure level data if it exists. If the specified level
* is below the declared surface pressure a null reference is returned.
*
* @param level
* A pressure level to get.
* @return The requested level, if found, null reference if not.
*/
private UAObsLevel getLevel(Integer level) {
UAObsLevel retValue = null;
if (level != null) {
level = level * 100;
for (UAObsLevel l : levels) {
if (IDecoderConstants.MANPRE_LEVEL.equals(l.getVertSig())
|| IDecoderConstants.SIGPRE_LEVEL
.equals(l.getVertSig())) {
if (level.equals(l.getPressure())) {
retValue = l;
break;
}
}
}
}
if (retValue != null) {
UAObsLevel sfc = getSurfaceLevel();
if (sfc != null) {
if (LayerTools.isLowerThan(sfc, retValue)) {
retValue = null;
}
}
}
return retValue;
}
/**
* Get the defined surface level. If a surface level cannot be found, then
* return null.
*
* @return The surface level found, or null.
*/
private UAObsLevel getSurfaceLevel() {
UAObsLevel retValue = null;
if (levels != null) {
for (UAObsLevel level : levels) {
if (IDecoderConstants.SFC_LEVEL.equals(level.getVertSig())) {
retValue = level;
break;
}
}
}
return retValue;
}
@Override
public String[] getStrings(String paramName) {
// TODO Auto-generated method stub
return null;
}
@Override
public SurfaceObsLocation getSpatialObject() {
return location;
@ -850,7 +586,6 @@ public class UAObs extends PersistablePluginDataObject implements
return wmoHeader;
}
@Override
@Column
@Access(AccessType.PROPERTY)

View file

@ -21,11 +21,6 @@ package com.raytheon.uf.common.dataplugin.bufrua;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@ -42,14 +37,14 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* ------------ ---------- ----------- --------------------------
* 20071127 382 jkorman Initial Coding.
* 20080630 1215 jkorman Implemented Serializable.
* 20131022 2361 njensen Remove XML annotations
* </pre>
*
* @author jkorman
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class UAObsLevel implements Serializable, ISerializableObject {
public class UAObsLevel implements Serializable {
private static final long serialVersionUID = 1L;
@ -63,50 +58,41 @@ public class UAObsLevel implements Serializable, ISerializableObject {
// 5 Significant level, temperature and/or relative humidity
// 6 Significant level, wind
// All 7 Missing value
@XmlAttribute
@DynamicSerializeElement
private Integer vertSig = null;
// Observation pressure in Pascals
@XmlAttribute
@DynamicSerializeElement
private Integer pressure = null;
// Observation geopotential height in meters.
@XmlAttribute
@DynamicSerializeElement
private Integer geoHeight = null;
// Observation dry air temperature in degrees Kelvin.
@XmlAttribute
@DynamicSerializeElement
private Double temp = null;
// Observation dewpoint temperature in degrees Kelvin.
@XmlAttribute
@DynamicSerializeElement
private Double dwpt = null;
// Observation wind direction in angular degrees. Integer
@XmlAttribute
@DynamicSerializeElement
private Integer windDirection = null;
// Observation wind speed in meters per second.
// Decimal(5,2)
@XmlAttribute
@DynamicSerializeElement
private Double windSpeed = null;
// Observation 1 KM below level wind shear in meters per second.
// Decimal(5,2)
@XmlAttribute
@DynamicSerializeElement
private Double loShear = null;
// Observation 1 KM above level wind shear in meters per second.
// Decimal(5,2)
@XmlAttribute
@DynamicSerializeElement
private Double hiShear = null;

View file

@ -1,9 +0,0 @@
com.raytheon.uf.common.dataplugin.gfe.config.ProjectionData
com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID
com.raytheon.uf.common.dataplugin.gfe.db.objects.GFERecord
com.raytheon.uf.common.dataplugin.gfe.db.objects.GridLocation
com.raytheon.uf.common.dataplugin.gfe.db.objects.GridParmInfo
com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID
com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmStorageInfo
com.raytheon.uf.common.dataplugin.gfe.server.lock.Lock
com.raytheon.uf.common.dataplugin.gfe.GridDataHistory

View file

@ -27,11 +27,6 @@ import javax.persistence.Embeddable;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Transient;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.geotools.coverage.grid.GeneralGridEnvelope;
import org.geotools.coverage.grid.GridGeometry2D;
@ -44,9 +39,6 @@ import org.opengis.referencing.datum.PixelInCell;
import org.opengis.referencing.operation.MathTransform;
import com.raytheon.uf.common.geospatial.MapUtil;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.adapters.CoordAdapter;
import com.raytheon.uf.common.serialization.adapters.PointAdapter;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.common.status.IUFStatusHandler;
@ -65,6 +57,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* 04/24/13 #1935 randerso Fixed date line spanning issue
* 08/06/13 #1571 randerso Added hibernate annotations
* Removed constructor with int for ProjectionType
* 10/22/13 #2361 njensen Remove XML annotations
*
* </pre>
*
@ -72,9 +65,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* @version 1.0
*/
@Embeddable
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class ProjectionData implements ISerializableObject {
public class ProjectionData {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(ProjectionData.class);
@ -101,68 +93,51 @@ public class ProjectionData implements ISerializableObject {
};
@Column(length = 32, nullable = false)
@XmlAttribute
@DynamicSerializeElement
private String projectionID;
@Column(length = 20, nullable = false)
@Enumerated(EnumType.STRING)
@XmlAttribute
@DynamicSerializeElement
private ProjectionType projectionType;
@Column(nullable = false)
@XmlElement
@XmlJavaTypeAdapter(value = CoordAdapter.class)
@DynamicSerializeElement
private Coordinate latLonLL;
@Column(nullable = false)
@XmlElement
@XmlJavaTypeAdapter(value = CoordAdapter.class)
@DynamicSerializeElement
private Coordinate latLonUR;
@Column(nullable = false)
@XmlElement
@XmlJavaTypeAdapter(value = CoordAdapter.class)
@DynamicSerializeElement
private Coordinate latLonOrigin;
@Column(nullable = false)
@XmlAttribute
@DynamicSerializeElement
private double stdParallelOne;
@Column(nullable = false)
@XmlAttribute
@DynamicSerializeElement
private double stdParallelTwo;
@Column(nullable = false)
@XmlElement
@XmlJavaTypeAdapter(value = PointAdapter.class)
@DynamicSerializeElement
private Point gridPointLL;
@Column(nullable = false)
@XmlElement
@XmlJavaTypeAdapter(value = PointAdapter.class)
@DynamicSerializeElement
private Point gridPointUR;
@Column(nullable = false)
@XmlAttribute
@DynamicSerializeElement
private double latIntersect;
@Column(nullable = false)
@XmlAttribute
@DynamicSerializeElement
private double lonCenter;
@Column(nullable = false)
@XmlAttribute
@DynamicSerializeElement
private double lonOrigin;

View file

@ -36,11 +36,6 @@ import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.UniqueConstraint;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import jep.INumpyable;
@ -73,9 +68,6 @@ import com.raytheon.uf.common.geospatial.CRSCache;
import com.raytheon.uf.common.geospatial.IGridGeometryProvider;
import com.raytheon.uf.common.geospatial.ISpatialObject;
import com.raytheon.uf.common.geospatial.MapUtil;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.adapters.CoordAdapter;
import com.raytheon.uf.common.serialization.adapters.GeometryAdapter;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.common.status.IUFStatusHandler;
@ -106,6 +98,7 @@ import com.vividsolutions.jts.simplify.TopologyPreservingSimplifier;
* 08/06/13 #1571 randerso Added hibernate annotations, javadoc cleanup,
* made init method public for use in GFEDao
* 09/30/13 #2333 mschenke Added method to construct from {@link IGridGeometryProvider}
* 10/22/13 #2361 njensen Remove XML annotations
*
*
* </pre>
@ -115,10 +108,9 @@ import com.vividsolutions.jts.simplify.TopologyPreservingSimplifier;
*/
@Entity
@Table(name = "gfe_gridlocation", uniqueConstraints = { @UniqueConstraint(columnNames = { "dbId_id" }) })
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class GridLocation extends PersistableDataObject<String> implements
ISpatialObject, ISerializableObject {
ISpatialObject {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(GridLocation.class);
@ -177,24 +169,20 @@ public class GridLocation extends PersistableDataObject<String> implements
private DatabaseID dbId;
@Column(length = 8, nullable = false)
@XmlAttribute
@DynamicSerializeElement
private String siteId;
/** Number of points along the x-axis */
@Column(nullable = false)
@XmlAttribute
@DynamicSerializeElement
protected Integer nx;
/** Number of points along the y-axis */
@Column(nullable = false)
@XmlAttribute
@DynamicSerializeElement
protected Integer ny;
@Column(length = 32, nullable = false)
@XmlAttribute
@DynamicSerializeElement
private String timeZone;
@ -202,30 +190,22 @@ public class GridLocation extends PersistableDataObject<String> implements
private Coordinate gridCellSize;
@Embedded
@XmlElement
@DynamicSerializeElement
private ProjectionData projection;
@Column(nullable = false)
@XmlElement
@XmlJavaTypeAdapter(value = CoordAdapter.class)
@DynamicSerializeElement
private Coordinate origin;
@Column(nullable = false)
@XmlElement
@XmlJavaTypeAdapter(value = CoordAdapter.class)
@DynamicSerializeElement
private Coordinate extent;
@Transient
@XmlElement
@XmlJavaTypeAdapter(value = GeometryAdapter.class)
@DynamicSerializeElement
private Polygon geometry;
@Transient
@XmlElement
@DynamicSerializeElement
private String crsWKT;

View file

@ -45,7 +45,6 @@ import org.hibernate.annotations.OnDeleteAction;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.GFERecord.GridType;
import com.raytheon.uf.common.dataplugin.gfe.discrete.DiscreteKey;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.common.status.IUFStatusHandler;
@ -67,6 +66,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* added isValid method to match A1
* 04/02/2013 #1774 randerso Improved error message in validCheck
* 08/06/13 #1571 randerso Added hibernate annotations, javadoc cleanup
* 10/22/2013 #2361 njensen Remove ISerializableObject
*
* </pre>
*
@ -76,9 +76,11 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
@Embeddable
@DynamicSerialize
public class GridParmInfo implements Cloneable, ISerializableObject {
public class GridParmInfo implements Cloneable {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(GridParmInfo.class);
static {
// TODO: is this the right place for these?

View file

@ -31,8 +31,6 @@ import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import com.raytheon.uf.common.serialization.ISerializableObject;
/**
* Derived class that consolidates storage info for a Parm.
*
@ -44,6 +42,7 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
* 08/05/2013 #1571 randerso Moved to com.raytheon.uf.common.dataplugin
* Added GridParmInfo as a field.
* Added hibernate annotations
* 10/22/2013 #2361 njensen Remove ISerializableObject
*
* </pre>
*
@ -53,7 +52,7 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
@Entity
@Table(name = "gfe_parminfo", uniqueConstraints = { @UniqueConstraint(columnNames = { "parmId_id" }) })
public class ParmStorageInfo implements ISerializableObject {
public class ParmStorageInfo {
/**
* Auto-generated surrogate key

View file

@ -27,7 +27,6 @@ import javax.persistence.Column;
import javax.persistence.Embeddable;
import com.raytheon.uf.common.dataplugin.gfe.serialize.TimeConstraintsAdapter;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeTypeAdapter;
@ -47,6 +46,7 @@ import com.raytheon.uf.common.time.util.TimeUtil;
* 03/20/2013 #1774 randerso Added isValid method, use TimeUtil constants,
* added serialization adapter, removed setters.
* 08/06/13 #1571 randerso Added hibernate annotations, javadoc cleanup
* 10/22/2013 #2361 njensen Remove ISerializableObject
*
* </pre>
*
@ -57,7 +57,8 @@ import com.raytheon.uf.common.time.util.TimeUtil;
@Embeddable
@DynamicSerialize
@DynamicSerializeTypeAdapter(factory = TimeConstraintsAdapter.class)
public class TimeConstraints implements ISerializableObject {
public class TimeConstraints {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(TimeConstraints.class);

View file

@ -1,2 +0,0 @@
com.raytheon.uf.common.dataplugin.goessounding.GOESSounding
com.raytheon.uf.common.dataplugin.goessounding.GOESSoundingLevel

View file

@ -22,11 +22,7 @@ package com.raytheon.uf.common.dataplugin.goessounding;
import java.io.Serializable;
import javax.persistence.Column;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@ -37,7 +33,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 20080414 1077 jkorman Initial implementation.
* 20080414 1077 jkorman Initial implementation.'
* 20132022 2361 njensen Remove XML annotations
*
* </pre>
*
@ -45,28 +42,23 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* @version 1.0
*/
@DynamicSerialize
@XmlAccessorType(XmlAccessType.NONE)
public class GOESSoundingLevel implements Serializable, ISerializableObject {
public class GOESSoundingLevel implements Serializable {
private static final long serialVersionUID = 1L;
@Column
@XmlAttribute
@DynamicSerializeElement
private Integer pressure;
@Column
@XmlAttribute
@DynamicSerializeElement
private Double temperature;
@Column
@XmlAttribute
@DynamicSerializeElement
private Double dewpoint;
@Column
@XmlAttribute
@DynamicSerializeElement
private Integer height;

View file

@ -1,2 +0,0 @@
com.raytheon.uf.common.dataplugin.poessounding.POESSounding
com.raytheon.uf.common.dataplugin.poessounding.POESSoundingLevel

View file

@ -21,11 +21,6 @@ package com.raytheon.uf.common.dataplugin.poessounding;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@ -37,6 +32,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 20080303 1026 jkorman Initial implementation.
* 20131022 2361 njensen Remove XML annotations
*
* </pre>
*
@ -44,20 +40,16 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* @version 1.0
*/
@DynamicSerialize
@XmlAccessorType(XmlAccessType.NONE)
public class POESSoundingLevel implements Serializable, ISerializableObject {
public class POESSoundingLevel implements Serializable {
private static final long serialVersionUID = 1L;
@XmlAttribute
@DynamicSerializeElement
private Integer pressure;
@XmlAttribute
@DynamicSerializeElement
private Double temperature;
@XmlAttribute
@DynamicSerializeElement
private Double mixingRatio;

View file

@ -1 +0,0 @@
com.raytheon.uf.common.dataplugin.tcs.TropicalCycloneSummary

View file

@ -31,14 +31,9 @@ import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.UniqueConstraint;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import org.hibernate.annotations.Index;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject;
@ -65,6 +60,7 @@ import com.vividsolutions.jts.geom.Geometry;
* May 07, 2013 1869 bsteffen Remove dataURI column from
* PluginDataObject.
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
* Oct 22, 2013 2361 njensen Remove XML annotations
*
* </pre>
*
@ -80,8 +76,6 @@ import com.vividsolutions.jts.geom.Geometry;
*/
@org.hibernate.annotations.Table(appliesTo = "tcs", indexes = { @Index(name = "tcs_refTimeIndex", columnNames = {
"refTime", "forecastTime" }) })
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class TropicalCycloneSummary extends PersistablePluginDataObject
implements ISpatialEnabled, IPointData {
@ -94,11 +88,9 @@ public class TropicalCycloneSummary extends PersistablePluginDataObject
// Text of the WMO header
@Transient
@XmlElement
@DynamicSerializeElement
private String wmoHeader = "";
@XmlElement
@DynamicSerializeElement
@Column
@DataURI(position = 1)
@ -106,36 +98,29 @@ public class TropicalCycloneSummary extends PersistablePluginDataObject
@Embedded
@DataURI(position = 2, embedded = true)
@XmlElement
@DynamicSerializeElement
private SurfaceObsLocation location;
@XmlElement
@DynamicSerializeElement
@Transient
protected String name;
@XmlElement
@DynamicSerializeElement
@Transient
private boolean tropical;
@XmlElement
@DynamicSerializeElement
@Transient
private String displayTime;
@XmlElement
@DynamicSerializeElement
@Transient
private int pressure;
@XmlElement
@DynamicSerializeElement
@Transient
protected int windSpeed;
@XmlElement
@DynamicSerializeElement
@Transient
protected ArrayList<Radius> radiusList;
@ -199,11 +184,6 @@ public class TropicalCycloneSummary extends PersistablePluginDataObject
identifier = dataURI;
}
@Override
public IDecoderGettable getDecoderGettable() {
return null;
}
@Override
public SurfaceObsLocation getSpatialObject() {
return location;

View file

@ -1,3 +0,0 @@
com.raytheon.uf.common.dataplugin.vaa.VAARecord
com.raytheon.uf.common.dataplugin.vaa.VAASubPart
com.raytheon.uf.common.dataplugin.vaa.VAALocation

View file

@ -28,64 +28,56 @@ import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* TODO Add Description
* Location for a VAARecord
*
* <pre>
*
*
* SOFTWARE HISTORY
*
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 17, 2009 jkorman Initial creation
*
* Oct 22, 2013 2361 njensen Remove XML annotations
*
* </pre>
*
*
* @author jkorman
* @version 1.0
* @version 1.0
*/
@Entity
@Table(name="vaa_location")
@XmlAccessorType(XmlAccessType.NONE)
@Table(name = "vaa_location")
@DynamicSerialize
public class VAALocation implements Serializable, ISerializableObject {
public class VAALocation implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
private Integer recordId = null;
//
//
@ManyToOne
@JoinColumn(name="parentId", nullable=false)
@JoinColumn(name = "parentId", nullable = false)
private VAASubPart parentId;
// Point latitude
@Column
@XmlElement
@DynamicSerializeElement
private double latitude;
// Point longitude
@Column
@XmlElement
@DynamicSerializeElement
private double longitude;
private double longitude;
// Position index. These points are kept in a set. Order
// is not preserved.
@Column
@XmlElement
@DynamicSerializeElement
private Integer index;
@ -95,50 +87,52 @@ public class VAALocation implements Serializable, ISerializableObject {
public VAALocation() {
// Empty constructor for bean operations
}
/**
*
* @param lat
* @param lon
* @param index
*/
public VAALocation(double lat, double lon,int index, VAASubPart parent) {
public VAALocation(double lat, double lon, int index, VAASubPart parent) {
latitude = lat;
longitude = lon;
this.index = index;
parentId = parent;
}
/**
* Get the record id.
*
*
* @return The recordId. If not set returns null.
*/
public Integer getRecordId() {
public Integer getRecordId() {
return recordId;
}
/**
* Set the record id.
* @param record
*/
public void setRecordId(Integer recordId) {
/**
* Set the record id.
*
* @param record
*/
public void setRecordId(Integer recordId) {
this.recordId = recordId;
}
/**
* @return the parentID
*/
public VAASubPart getParentId() {
return parentId;
}
/**
* @return the parentID
*/
public VAASubPart getParentId() {
return parentId;
}
/**
* @param parentID the parentID to set
*/
public void setParentId(VAASubPart parent) {
this.parentId = parent;
}
/**
* @param parentID
* the parentID to set
*/
public void setParentId(VAASubPart parent) {
this.parentId = parent;
}
/**
* @return the latitude
@ -148,7 +142,8 @@ public class VAALocation implements Serializable, ISerializableObject {
}
/**
* @param latitude the latitude to set
* @param latitude
* the latitude to set
*/
public void setLatitude(double latitude) {
this.latitude = latitude;
@ -162,7 +157,8 @@ public class VAALocation implements Serializable, ISerializableObject {
}
/**
* @param longitude the longitude to set
* @param longitude
* the longitude to set
*/
public void setLongitude(double longitude) {
this.longitude = longitude;
@ -176,7 +172,8 @@ public class VAALocation implements Serializable, ISerializableObject {
}
/**
* @param index the index to set
* @param index
* the index to set
*/
public void setIndex(Integer index) {
this.index = index;

View file

@ -33,14 +33,9 @@ import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import org.hibernate.annotations.Index;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.geospatial.ISpatialEnabled;
@ -50,7 +45,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.vividsolutions.jts.geom.Geometry;
/**
*
* Record for Volcanic Ash Advisory
*
* <pre>
*
@ -64,8 +59,8 @@ import com.vividsolutions.jts.geom.Geometry;
* Apr 12, 2013 1857 bgonzale Added SequenceGenerator annotation.
* May 07, 2013 1869 bsteffen Remove dataURI column from
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
*
* PluginDataObject.
* Oct 22, 2013 2361 njensen Remove XML annotations
*
* </pre>
*
@ -82,8 +77,6 @@ import com.vividsolutions.jts.geom.Geometry;
*/
@org.hibernate.annotations.Table(appliesTo = "vaa", indexes = { @Index(name = "vaa_refTimeIndex", columnNames = {
"refTime", "forecastTime" }) })
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class VAARecord extends PluginDataObject implements ISpatialEnabled {
@ -91,7 +84,6 @@ public class VAARecord extends PluginDataObject implements ISpatialEnabled {
@Embedded
@DataURI(position = 1, embedded = true)
@XmlElement
@DynamicSerializeElement
private SurfaceObsLocation location;
@ -100,7 +92,6 @@ public class VAARecord extends PluginDataObject implements ISpatialEnabled {
*/
@Column(length = 8)
@DataURI(position = 2)
@XmlElement
@DynamicSerializeElement
private String recordType;
@ -109,19 +100,16 @@ public class VAARecord extends PluginDataObject implements ISpatialEnabled {
*/
@Column(length = 16)
@DataURI(position = 3)
@XmlElement
@DynamicSerializeElement
private String advisoryNumber;
// Correction indicator from wmo header
@DataURI(position = 4)
@Column(length = 8)
@XmlElement
@DynamicSerializeElement
private String corIndicator;
@Column(length = 32)
@XmlElement
@DynamicSerializeElement
private String centerId;
@ -129,7 +117,6 @@ public class VAARecord extends PluginDataObject implements ISpatialEnabled {
*
*/
@Column(length = 2048)
@XmlElement
@DynamicSerializeElement
private String message;
@ -137,7 +124,6 @@ public class VAARecord extends PluginDataObject implements ISpatialEnabled {
*
*/
@Column(length = 512)
@XmlElement
@DynamicSerializeElement
private String anal00Hr;
@ -145,7 +131,6 @@ public class VAARecord extends PluginDataObject implements ISpatialEnabled {
*
*/
@Column(length = 512)
@XmlElement
@DynamicSerializeElement
private String fcst06Hr;
@ -153,7 +138,6 @@ public class VAARecord extends PluginDataObject implements ISpatialEnabled {
*
*/
@Column(length = 512)
@XmlElement
@DynamicSerializeElement
private String fcst12Hr;
@ -161,18 +145,15 @@ public class VAARecord extends PluginDataObject implements ISpatialEnabled {
*
*/
@Column(length = 512)
@XmlElement
@DynamicSerializeElement
private String fcst18Hr;
// Text of the WMO header
@Column(length = 64)
@XmlElement
@DynamicSerializeElement
private String wmoHeader = "";
@DynamicSerializeElement
@XmlElement
@OneToMany(cascade = CascadeType.ALL, mappedBy = "parentId", fetch = FetchType.EAGER)
private Set<VAASubPart> subParts = new HashSet<VAASubPart>();
@ -236,11 +217,6 @@ public class VAARecord extends PluginDataObject implements ISpatialEnabled {
this.wmoHeader = wmoHeader;
}
@Override
public IDecoderGettable getDecoderGettable() {
return null;
}
@Override
public SurfaceObsLocation getSpatialObject() {
return location;

View file

@ -33,72 +33,62 @@ import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* TODO Add Description
* SubPart of a VAARecord
*
* <pre>
*
*
* SOFTWARE HISTORY
*
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 17, 2009 jkorman Initial creation
*
* Oct 22, 2013 2361 njensen Remove XML annotations
*
* </pre>
*
*
* @author jkorman
* @version 1.0
* @version 1.0
*/
@Entity
@Table(name="vaa_subpart")
@XmlAccessorType(XmlAccessType.NONE)
@Table(name = "vaa_subpart")
@DynamicSerialize
public class VAASubPart implements Serializable, ISerializableObject {
public class VAASubPart implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
private Integer recordId = null;
// The record this object belongs to
// The record this object belongs to
@ManyToOne
@JoinColumn(name="parentId", nullable=false)
@JoinColumn(name = "parentId", nullable = false)
private VAARecord parentId;
@Column(length = 32)
@XmlElement
@DynamicSerializeElement
private String subText;
private String subText;
/**
* Shape of ash area
* "LINE" :
* "AREA"
*
* Shape of ash area "LINE" : "AREA"
*
*/
@Column(length = 8)
@XmlElement
@DynamicSerializeElement
private String shapeType;
/**
private String shapeType;
/**
* Vertex locations
*/
@DynamicSerializeElement
@XmlElement
@OneToMany(cascade = CascadeType.ALL, mappedBy = "parentId", fetch = FetchType.EAGER)
private Set<VAALocation> locations = new HashSet<VAALocation>();
/**
* @return the parentID
*/
@ -107,7 +97,8 @@ public class VAASubPart implements Serializable, ISerializableObject {
}
/**
* @param parentID the parentID to set
* @param parentID
* the parentID to set
*/
public void setParentId(VAARecord parentID) {
this.parentId = parentID;
@ -115,21 +106,22 @@ public class VAASubPart implements Serializable, ISerializableObject {
/**
* Get the record id.
*
*
* @return The recordId. If not set returns null.
*/
public Integer getRecordId() {
public Integer getRecordId() {
return recordId;
}
/**
* Set the record id.
* @param record
*/
/**
* Set the record id.
*
* @param record
*/
public void setRecordId(Integer recordId) {
this.recordId = recordId;
}
/**
* @return the subText
*/
@ -138,7 +130,8 @@ public class VAASubPart implements Serializable, ISerializableObject {
}
/**
* @param subText the subText to set
* @param subText
* the subText to set
*/
public void setSubText(String subText) {
this.subText = subText;
@ -152,17 +145,18 @@ public class VAASubPart implements Serializable, ISerializableObject {
}
/**
* @param shapeType the shapeType to set
* @param shapeType
* the shapeType to set
*/
public void setShapeType(String shapeType) {
this.shapeType = shapeType;
}
public void addVertex(double lat, double lon, int index) {
if(locations == null) {
if (locations == null) {
locations = new HashSet<VAALocation>();
}
locations.add(new VAALocation(lat,lon,index,this));
locations.add(new VAALocation(lat, lon, index, this));
}
/**
@ -173,10 +167,11 @@ public class VAASubPart implements Serializable, ISerializableObject {
}
/**
* @param locations the locations to set
* @param locations
* the locations to set
*/
public void setLocations(Set<VAALocation> locations) {
for(VAALocation loc : locations) {
for (VAALocation loc : locations) {
loc.setParentId(this);
}
this.locations = locations;

View file

@ -1,8 +0,0 @@
com.raytheon.uf.common.dataplugin.warning.AbstractWarningRecord
com.raytheon.uf.common.dataplugin.warning.WarningRecord
com.raytheon.uf.common.dataplugin.warning.PracticeWarningRecord
com.raytheon.uf.common.dataplugin.warning.config.WarngenConfiguration
com.raytheon.uf.common.dataplugin.warning.config.DialogConfiguration
com.raytheon.uf.common.dataplugin.warning.gis.GeospatialMetadata
com.raytheon.uf.common.dataplugin.warning.gis.GeospatialTime
com.raytheon.uf.common.dataplugin.warning.gis.GeospatialTimeSet

View file

@ -10,12 +10,33 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.dataplugin.warning.util.FileUtil;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.serialization.SingleTypeJAXBManager;
/**
*
* Configuration for warngen dialog
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* --/--/---- Initial creation
* 10/22/2013 2361 njensen Use JAXBManager for XML
*
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement(name = "configuration")
public class DialogConfiguration implements ISerializableObject {
public class DialogConfiguration {
private static final SingleTypeJAXBManager<DialogConfiguration> jaxb = SingleTypeJAXBManager
.createWithoutException(DialogConfiguration.class);
@XmlElement
private String warngenOfficeShort;
@ -39,14 +60,14 @@ public class DialogConfiguration implements ISerializableObject {
@XmlElement
private long followupListRefeshDelay;
@XmlElement
private GridSpacing gridSpacing;
public static DialogConfiguration loadDialogConfig(String localSite)
throws FileNotFoundException, IOException, JAXBException {
String xml = FileUtil.open("config.xml", localSite);
return (DialogConfiguration) SerializationUtil.unmarshalFromXml(xml);
return (DialogConfiguration) jaxb.unmarshalFromXml(xml);
}
public String getWarngenOfficeShort() {
@ -120,5 +141,5 @@ public class DialogConfiguration implements ISerializableObject {
public void setGridSpacing(GridSpacing gridSpacing) {
this.gridSpacing = gridSpacing;
}
}

View file

@ -41,8 +41,7 @@ import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.dataplugin.warning.WarningRecord.WarningAction;
import com.raytheon.uf.common.dataplugin.warning.config.AreaSourceConfiguration.AreaType;
import com.raytheon.uf.common.dataplugin.warning.util.FileUtil;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.serialization.SingleTypeJAXBManager;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
@ -60,6 +59,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* Aug 26, 2008 #1502 bclement Added JAXB annotations
* May 26, 2010 #4649 Qinglu Lin Made including TO.A and SV.A mandatory
* Apr 24, 2013 1943 jsanchez Marked areaConfig as Deprecated.
* Oct 22, 2013 2361 njensen Removed ISerializableObject
*
* </pre>
*
@ -68,11 +68,15 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
*/
@XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement(name = "warngenConfig")
public class WarngenConfiguration implements ISerializableObject {
public class WarngenConfiguration {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(WarngenConfiguration.class);
private static Pattern p = Pattern
private static final SingleTypeJAXBManager<WarngenConfiguration> jaxb = SingleTypeJAXBManager
.createWithoutException(WarngenConfiguration.class);
private static final Pattern p = Pattern
.compile("<\\s{0,}include\\s{1,}file\\s{0,}=\\s{0,}\"(.*)\"\\s{0,}/>");
@XmlElement
@ -178,7 +182,7 @@ public class WarngenConfiguration implements ISerializableObject {
+ " in template " + templateName, e);
}
config = (WarngenConfiguration) SerializationUtil.unmarshalFromXml(xml);
config = (WarngenConfiguration) jaxb.unmarshalFromXml(xml);
// Sets the lists of bullets and dam bullets
if (config.getBulletActionGroups() != null) {
@ -204,7 +208,8 @@ public class WarngenConfiguration implements ISerializableObject {
}
// AreaConfiguration is deprecated. This is only meant for backwards
// compatibility while areaConfig is phased out with updated templates from the template team.
// compatibility while areaConfig is phased out with updated templates
// from the template team.
if (config.getAreaConfig() != null) {
ArrayList<AreaSourceConfiguration> areaSources = null;

View file

@ -38,6 +38,7 @@ import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.localization.exception.LocalizationException;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.serialization.SingleTypeJAXBManager;
import com.raytheon.uf.common.serialization.comm.RequestRouter;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
@ -45,7 +46,8 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
/**
* TODO Add Description
* Retrieves geospatial data from disk if present, otherwise forwards request to
* maps database
*
* <pre>
*
@ -60,6 +62,7 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
* So, do not add the returned value of getFeAreaField()
* to areaFields.
* Jan 9, 2013 15600 Qinglu Lin Execute "timezones = myTimeZones;" even if timezones != null.
* Oct 22, 2013 2361 njensen Use JAXBManager for XML
*
* </pre>
*
@ -68,6 +71,7 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
*/
public class GeospatialFactory {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(GeospatialFactory.class);
@ -77,6 +81,9 @@ public class GeospatialFactory {
private static GeospatialData[] timezones;
private static SingleTypeJAXBManager<GeospatialTimeSet> jaxb = SingleTypeJAXBManager
.createWithoutException(GeospatialTimeSet.class);
public static GeospatialData[] getGeoSpatialList(String site,
GeospatialMetadata metaData) throws SpatialException {
Map<GeospatialMetadata, GeospatialTime> lastRunTimeMap = loadLastRunGeoTimeSet(site);
@ -171,9 +178,7 @@ public class GeospatialFactory {
METADATA_FILE);
if (lf.exists()) {
try {
rval = ((GeospatialTimeSet) SerializationUtil
.jaxbUnmarshalFromInputStream(lf.openInputStream()))
.getDataAsMap();
rval = jaxb.unmarshalFromXmlFile(lf.getFile()).getDataAsMap();
} catch (Exception e) {
statusHandler
.handle(Priority.WARN,
@ -248,8 +253,8 @@ public class GeospatialFactory {
if (lf.exists()) {
byte[] data = lf.read();
return (GeospatialDataSet) SerializationUtil
.transformFromThrift(data);
return SerializationUtil.transformFromThrift(
GeospatialDataSet.class, data);
} else {
System.out.println("Attempted to load: " + lf.getName()
+ " for site " + site + ", but file does not exist.");

View file

@ -30,7 +30,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* TODO Add Description
* Geospatial data for a warngen configuration
*
* <pre>
*
@ -48,6 +48,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class GeospatialMetadata {
@XmlAttribute
@DynamicSerializeElement
private String areaSource;

View file

@ -25,7 +25,8 @@ import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
/**
* TODO Add Description
* Wrapper for GeospatialConfiguration representing last time a the geometry
* data was created for a warngen configuration
*
* <pre>
*

View file

@ -29,7 +29,8 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/**
* TODO Add Description
* Collection of GeospatialTime representing a set of generated geospatial data
* for warngen configurations
*
* <pre>
*

View file

@ -1,5 +0,0 @@
com.raytheon.uf.common.gridcoverage.LatLonGridCoverage
com.raytheon.uf.common.gridcoverage.MercatorGridCoverage
com.raytheon.uf.common.gridcoverage.PolarStereoGridCoverage
com.raytheon.uf.common.gridcoverage.LambertConformalGridCoverage
com.raytheon.uf.common.gridcoverage.StereographicGridCoverage

View file

@ -0,0 +1,2 @@
ebxml-http-receive-timeout=40000
ebxml-http-connection-timeout=30000

View file

@ -114,8 +114,25 @@ public class RegistrySOAPServices {
static {
proxyConfig = getProxyConfiguration();
httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setReceiveTimeout(15000);
httpClientPolicy.setConnectionTimeout(10000);
try {
httpClientPolicy.setReceiveTimeout(Long.parseLong(System
.getProperty("ebxml-http-receive-timeout")));
} catch (NumberFormatException e) {
statusHandler
.error("ebxml-http-receive-timeout not specified. Using default value of 1 minute",
e);
httpClientPolicy.setReceiveTimeout(60000);
}
try {
httpClientPolicy.setConnectionTimeout(Long.parseLong(System
.getProperty("ebxml-http-connection-timeout")));
} catch (NumberFormatException e) {
statusHandler
.error("ebxml-http-connection-timeout not specified. Using default value of 10 seconds",
e);
httpClientPolicy.setReceiveTimeout(10000);
}
httpClientPolicy.setConnection(ConnectionType.KEEP_ALIVE);
httpClientPolicy.setMaxRetransmits(5);
if (proxyConfig != null) {

View file

@ -47,13 +47,14 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader;
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 03, 2008 969 jkorman Initial implementation.
* Jul 06, 2009 2538 jsanchez Added latitude,longitude to point data.
* May 17, 2013 1869 bsteffen Remove DataURI column from sat plot
* types.
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Mar 03, 2008 969 jkorman Initial implementation.
* Jul 06, 2009 2538 jsanchez Added latitude,longitude to point data.
* May 17, 2013 1869 bsteffen Remove DataURI column from sat plot
* types.
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
* Oct 21, 2013 2379 bsteffen Fix a null pointer exception.
*
* </pre>
*
@ -154,10 +155,9 @@ public class SSMIDataAdapter extends BUFRPointDataAdapter<SSMIScanData> {
// Extract the header data.
obsData = getHeaderData(dataList);
obsData.setWmoHeader(wmoHeader.getWmoHeader());
if (obsData != null) {
obsData.setWmoHeader(wmoHeader.getWmoHeader());
obsList = new ArrayList<SSMIScanData>();
logger.debug("Created master observation for scanline");
// Now go get the point data for this obs

View file

@ -1,2 +0,0 @@
com.raytheon.uf.edex.plugin.mesowest.common.MESOWestRecord
com.raytheon.uf.edex.plugin.mesowest.MESOWestFilter

View file

@ -24,10 +24,6 @@ import static com.raytheon.uf.common.localization.LocalizationContext.Localizati
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import javax.xml.bind.JAXBContext;
@ -45,14 +41,15 @@ import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.serialization.JAXBManager;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.edex.decodertools.core.filterimpl.AbstractFilterElement;
import com.raytheon.uf.edex.decodertools.core.filterimpl.AbstractObsFilter;
import com.raytheon.uf.edex.decodertools.core.filterimpl.PluginDataObjectFilter;
import com.raytheon.uf.edex.decodertools.core.filterimpl.RectFilterElement;
/**
*
* A filter for mesowest data that is configured through XML.
*
* <pre>
*
@ -61,6 +58,8 @@ import com.raytheon.uf.edex.decodertools.core.filterimpl.RectFilterElement;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 23, 2009 jkorman Initial creation
* Oct 22, 2013 2361 njensen Use JAXBManager for XML
*
*
* </pre>
*
@ -88,22 +87,14 @@ public class MESOWestFilter extends AbstractObsFilter {
File siteDir = manager.getFile(siteContext, "");
if (siteDir.exists()) {
File srcFile = new File(siteDir, FILTER_CONFIG);
byte[] data = new byte[(int) srcFile.length()];
InputStream stream = getInputStream(srcFile);
try {
stream.read(data);
stream.close();
AbstractObsFilter filter = (AbstractObsFilter) SerializationUtil
.unmarshalFromXml(new String(data));
setFilterElements(filter.getFilterElements());
setFilterName(filter.getFilterName());
} catch (IOException e) {
logger.error("Unable to read filter config", e);
File srcFile = new File(siteDir, FILTER_CONFIG);
JAXBManager jaxb = new JAXBManager(MESOWestFilter.class,
PluginDataObjectFilter.class);
AbstractObsFilter filter = jaxb.unmarshalFromXmlFile(
AbstractObsFilter.class, srcFile);
this.setFilterElements(filter.getFilterElements());
this.setFilterName(filter.getFilterName());
} catch (JAXBException e) {
logger.error("Unable to unmarshall filter config", e);
}
@ -218,20 +209,4 @@ public class MESOWestFilter extends AbstractObsFilter {
}
}
/**
*
* @param file
* @return
*/
private static FileInputStream getInputStream(File file) {
FileInputStream fis = null;
try {
fis = new FileInputStream(file);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
return fis;
}
}

View file

@ -39,11 +39,6 @@ import javax.persistence.Entity;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
@ -55,7 +50,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.vividsolutions.jts.geom.Geometry;
/**
*
* Record for mesowest data
*
* <pre>
*
@ -68,6 +63,7 @@ import com.vividsolutions.jts.geom.Geometry;
* May 07, 2013 1869 bsteffen Remove dataURI column from
* PluginDataObject.
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
* Oct 22, 2013 2361 njensen Remove XML annotations
*
* </pre>
*
@ -77,8 +73,6 @@ import com.vividsolutions.jts.geom.Geometry;
@Entity
@SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "mesowestseq")
@Table(name = "mesowest", uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) })
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class MESOWestRecord extends PluginDataObject implements
ISpatialEnabled, IDecoderGettable {
@ -117,152 +111,127 @@ public class MESOWestRecord extends PluginDataObject implements
}
@DataURI(position = 1)
@XmlElement
@DynamicSerializeElement
private String networkType;
// Time of the observation.
@DataURI(position = 2)
@XmlAttribute
@DynamicSerializeElement
private Calendar timeObs;
@Embedded
@DataURI(position = 3, embedded = true)
@XmlElement
@DynamicSerializeElement
private SurfaceObsLocation location;
// Observation air temperature in degrees Kelvin.
@Column
@DynamicSerializeElement
@XmlElement
private Double temp;
// Observation dewpoint temperature in degrees Kelvin.
@Column
@DynamicSerializeElement
@XmlElement
private Double dwpt;
// 24 Hour maximum temperature in degrees Kelvin.
@Column
@DynamicSerializeElement
@XmlElement
private Double maxT24;
// 24 Hour minimum temperature in degrees Kelvin.
@Column
@DynamicSerializeElement
@XmlElement
private Double minT24;
// Relative Humidity in percent.
@Column
@DynamicSerializeElement
@XmlElement
private Double humidity;
// Observation wind direction in angular degrees. Integer
@Column
@DynamicSerializeElement
@XmlElement
private Double windDirection;
// Observation wind speed in meters per second.
@Column
@DynamicSerializeElement
@XmlElement
private Double windSpeed;
// Observation wind gust in meters per second.
@Column
@DynamicSerializeElement
@XmlElement
private Double windGust;
// Observation pressure in Pa.
@Column
@DynamicSerializeElement
@XmlElement
private Double pressure;
// Observation pressure in Pa.
@Column
@DynamicSerializeElement
@XmlElement
private Double seaLevelPressure;
// Observation pressure in Pa.
@Column
@DynamicSerializeElement
@XmlElement
private Double altimeter;
// Observation precip in mm.
@Column
@DynamicSerializeElement
@XmlElement
private Double precip;
// 1 minute precip in inches.
@Column
@DynamicSerializeElement
@XmlElement
private Double precip_01M;
// 5 minute precip in inches.
@Column
@DynamicSerializeElement
@XmlElement
private Double precip_05M;
// 10 minute precip in inches.
@Column
@DynamicSerializeElement
@XmlElement
private Double precip_10M;
// 15 minute precip in inches.
@Column
@DynamicSerializeElement
@XmlElement
private Double precip_15M;
// 30 minute precip in inches.
@Column
@DynamicSerializeElement
@XmlElement
private Double precip_30M;
// 1 hour precip in inches.
@Column
@DynamicSerializeElement
@XmlElement
private Double precip_01H;
// 3 hour precip in inches.
@Column
@DynamicSerializeElement
@XmlElement
private Double precip_03H;
// 6 hour precip in inches.
@Column
@DynamicSerializeElement
@XmlElement
private Double precip_06H;
// 24 hour precip in inches.
@Column
@DynamicSerializeElement
@XmlElement
private Double precip_24H;
// Raw observation text
@Column
@DynamicSerializeElement
@XmlElement
private String obsText;
/**

View file

@ -5,7 +5,7 @@
<fromAddress>Nathan.Jensen@raytheon.com</fromAddress>
<smtpHost>mk2-msg10.raymail.ray.com</smtpHost>
<smtpPort>143</smtpPort>
<!-- toAddress>awipsctl@list.app.ray.com</toAddress-->
<toAddress>Nathan.Jensen@raytheon.com</toAddress>
<toAddress>awipsctl@list.app.ray.com, awipstest@list.app.ray.com, david_j_hladky@raytheon.com</toAddress>
<!-- >toAddress>Nathan.Jensen@raytheon.com</toAddress-->
<timeToSend>01:30</timeToSend>
</logSrvConfig>

View file

@ -448,7 +448,6 @@ PyObject* pyjmethod_call_internal(PyJmethod_Object *self,
JNIEnv *env = NULL;
int pos = 0;
jvalue *jargs = NULL;
int *jargTypes = NULL; // added by njensen
int foundArray = 0; /* if params includes pyjarray instance */
PyThreadState *_save;
@ -478,10 +477,11 @@ PyObject* pyjmethod_call_internal(PyJmethod_Object *self,
}
jargs = (jvalue *) PyMem_Malloc(sizeof(jvalue) * self->lenParameters);
jargTypes = (int *) PyMem_Malloc(sizeof(int) * self->lenParameters);
// ------------------------------ build jargs off python values
// added by njensen, hopefully 40 local references are enough per method call
(*env)->PushLocalFrame(env, 40);
for(pos = 0; pos < self->lenParameters; pos++) {
PyObject *param = NULL;
int paramTypeId = -1;
@ -493,16 +493,14 @@ PyObject* pyjmethod_call_internal(PyJmethod_Object *self,
param = PyTuple_GetItem(args, pos); /* borrowed */
if(PyErr_Occurred()) { /* borrowed */
PyMem_Free(jargs);
PyMem_Free(jargTypes);
return NULL;
// changed by njensen
goto EXIT_ERROR;
}
pclazz = (*env)->GetObjectClass(env, paramType);
if(process_java_exception(env) || !pclazz) {
PyMem_Free(jargs);
PyMem_Free(jargTypes);
return NULL;
// changed by njensen
goto EXIT_ERROR;
}
paramTypeId = get_jtype(env, paramType, pclazz);
@ -511,16 +509,14 @@ PyObject* pyjmethod_call_internal(PyJmethod_Object *self,
if(paramTypeId == JARRAY_ID)
foundArray = 1;
jargTypes[pos] = paramTypeId;
jargs[pos] = convert_pyarg_jvalue(env,
param,
paramType,
paramTypeId,
pos);
if(PyErr_Occurred()) { /* borrowed */
PyMem_Free(jargs);
PyMem_Free(jargTypes);
return NULL;
// changed by njensen
goto EXIT_ERROR;
}
(*env)->DeleteLocalRef(env, paramType);
@ -597,10 +593,6 @@ PyObject* pyjmethod_call_internal(PyJmethod_Object *self,
if(!process_java_exception(env) && obj != NULL)
result = pyjarray_new(env, obj);
// added by njensen to keep memory down
if(obj != NULL)
(*env)->DeleteLocalRef(env, obj);
break;
}
@ -631,10 +623,6 @@ PyObject* pyjmethod_call_internal(PyJmethod_Object *self,
if(!process_java_exception(env) && obj != NULL)
result = pyjobject_new_class(env, obj);
// added by njensen to keep memory down
if(obj != NULL)
(*env)->DeleteLocalRef(env, obj);
break;
}
@ -665,10 +653,6 @@ PyObject* pyjmethod_call_internal(PyJmethod_Object *self,
if(!process_java_exception(env) && obj != NULL)
result = pyjobject_new(env, obj);
// added by njensen to keep memory down
if(obj != NULL)
(*env)->DeleteLocalRef(env, obj);
break;
}
@ -934,16 +918,8 @@ PyObject* pyjmethod_call_internal(PyJmethod_Object *self,
process_java_exception(env);
}
// added by njensen to keep memory usage down
for(pos = 0; pos < self->lenParameters; pos++) {
if(jargs[pos].l != NULL && jargTypes[pos] != JARRAY_ID)
{
(*env)->DeleteLocalRef(env, jargs[pos].l);
}
}
PyMem_Free(jargs);
PyMem_Free(jargTypes);
(*env)->PopLocalFrame(env, NULL); // added by njensen
if(PyErr_Occurred())
return NULL;
@ -963,6 +939,12 @@ PyObject* pyjmethod_call_internal(PyJmethod_Object *self,
}
return result;
// added by njensen
EXIT_ERROR:
PyMem_Free(jargs);
(*env)->PopLocalFrame(env, NULL);
return NULL;
}

View file

@ -779,11 +779,15 @@ static PyObject* pyjobject_numpy(PyJobject_Object *obj) {
initNumpy();
resultList = PyList_New(listSize);
floatarrayclass = (*env)->FindClass(env, "[F");
bytearrayclass = (*env)->FindClass(env, "[B");
intarrayclass = (*env)->FindClass(env, "[I");
stringclass = (*env)->FindClass(env, "java/lang/String");
if(floatarrayclass == NULL)
floatarrayclass = (*env)->FindClass(env, "[F");
if(bytearrayclass == NULL)
bytearrayclass = (*env)->FindClass(env, "[B");
if(intarrayclass == NULL)
intarrayclass = (*env)->FindClass(env, "[I");
if(stringclass == NULL)
stringclass = (*env)->FindClass(env, "java/lang/String");
for(i=0; i < listSize; i=i+1)
{
@ -821,6 +825,7 @@ static PyObject* pyjobject_numpy(PyJobject_Object *obj) {
}
else
{
Py_INCREF(Py_None);
pyjob = Py_None;
}
PyList_SetItem(resultList, i, pyjob);

View file

@ -80,6 +80,8 @@ import com.raytheon.uf.common.datastorage.records.AbstractStorageRecord;
import com.raytheon.uf.common.datastorage.records.ByteDataRecord;
import com.raytheon.uf.common.datastorage.records.IDataRecord;
import com.raytheon.uf.common.geospatial.ISpatialEnabled;
import com.raytheon.uf.common.geospatial.interpolation.data.ByteBufferWrapper;
import com.raytheon.uf.common.geospatial.interpolation.data.UnsignedByteBufferWrapper;
//import com.raytheon.viz.core.gl.dataprep.ByteDataPreparer;
//import com.raytheon.viz.core.gl.dataprep.GlNumericImageData;
import com.raytheon.viz.core.gl.dataformat.GLByteDataFormat;
@ -845,15 +847,11 @@ SoundingModelReader sndingMdlRdr = new SoundingModelReader(
double tempDbl = Double.NaN;
if (retriever != null ){
/* Wrap the raw data of bytes into a GLByteDataFormat object */
//TODO? GLColorMapDataFormatFactory bdff = new GLColorMapDataFormatFactory();
//TODO? GLByteDataFormat bdf = bdff.getGLColorMapDataFormat(byteBuffer, retriever, rectangle, new int[] {maxX,maxY});
GLByteDataFormat bdf = new GLByteDataFormat();
ColorMapData cmd = new ColorMapData(byteBuffer, new int[] {maxX,maxY});
GLColorMapData glColorMapData = new GLColorMapData(cmd, bdf);
/* Wrap the raw data of bytes into a ByteBufferWrapper object */
UnsignedByteBufferWrapper bdf = new UnsignedByteBufferWrapper(byteBuffer, maxX, maxY);
/*Get the actual pixel value information from the byte array */
tempDbl = bdf.getValue( ( int )( outCoord[ 0 ] ), ( int ) ( outCoord[ 1 ] ), glColorMapData );
tempDbl = bdf.getDataValue( ( int )( outCoord[ 0 ] ), ( int ) ( outCoord[ 1 ] ));
if ( isSinglePixelNeeded ){
pixVal = new Double( (tempDbl) );
@ -880,7 +878,7 @@ SoundingModelReader sndingMdlRdr = new SoundingModelReader(
/*Generate the NxN array of pixel values*/
for ( int i = 0 ; i < newArrDimensions ; i++){
for ( int j = 0 ; j < newArrDimensions ; j++){
arrayOfPixVal[i][j] = bdf.getValue( ( int )( squarePixelArea[i][j].xCoord ), ( int ) ( squarePixelArea[i][j].yCoord ), glColorMapData );
arrayOfPixVal[i][j] = bdf.getDataValue( ( int )( squarePixelArea[i][j].xCoord ), ( int ) ( squarePixelArea[i][j].yCoord ));
}
}