Omaha #3242 support ensemble id in time series legends

Change-Id: I7f8435d274d3981e4871a5cf726bbf69e22a0d08

Former-commit-id: 453c1eecf4f08203b4c6e2a74ad5dc366d85d359
This commit is contained in:
Nate Jensen 2014-06-18 15:37:14 -05:00
parent bc9e7f1cb3
commit e10a73c17b
6 changed files with 54 additions and 30 deletions

View file

@ -30,7 +30,6 @@ import java.util.WeakHashMap;
import javax.measure.unit.Unit;
import com.raytheon.uf.common.inventory.exception.DataCubeException;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.grid.GridRecord;
import com.raytheon.uf.common.dataplugin.grid.util.GridLevelTranslator;
@ -42,6 +41,7 @@ import com.raytheon.uf.common.geospatial.ISpatialObject;
import com.raytheon.uf.common.geospatial.MapUtil;
import com.raytheon.uf.common.geospatial.PointUtil;
import com.raytheon.uf.common.gridcoverage.GridCoverage;
import com.raytheon.uf.common.inventory.exception.DataCubeException;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
@ -67,6 +67,7 @@ import com.raytheon.viz.core.graphing.xy.XYWindImageData;
* ------------- -------- ----------- --------------------------
* May 07, 2010 bsteffen Initial creation
* Feb 17, 2014 2661 bsteffen Use only u,v for vectors.
* Jun 18, 2014 3242 njensen Overrode getEnsembleId()
*
* </pre>
*
@ -92,11 +93,13 @@ public class GridTimeSeriesAdapter extends
/** a map of levels to units for quick lookup **/
protected Map<Level, Unit<?>> levelUnitMap = new HashMap<Level, Unit<?>>();
/** first recieved parameter name **/
/** first received parameter name **/
protected String parameterName = "";
protected String parameterAbbreviation = "";
protected String ensembleId;
/*
* (non-Javadoc)
*
@ -223,6 +226,7 @@ public class GridTimeSeriesAdapter extends
}
parameterName = parameterAbbreviation;
}
ensembleId = record.getEnsembleId();
}
// add Unit to levelUnitMap if needed ( quick look-ups )
@ -301,23 +305,21 @@ public class GridTimeSeriesAdapter extends
DataTime time = rec.getDataTime();
XYData dataPoint = null;
if(records.length == 2){
if (records.length == 2) {
double u = getValue(records[0]);
double v = getValue(records[1]);
double speed = Math.hypot(u, v);
double dir = Math.toDegrees(Math.atan2(-u, -v));
if (!Double.isNaN(speed)) {
dataPoint = new XYWindImageData(time, speed,
speed, dir);
dataPoint = new XYWindImageData(time, speed, speed, dir);
}
}else{
} else {
double value = getValue(records[0]);
if (Double.isNaN(value)) {
continue;
} else if (isIcon) {
dataPoint = new XYIconImageData(time,
value, (int) value);
dataPoint = new XYIconImageData(time, value, (int) value);
} else {
dataPoint = new XYData(time, value);
}
@ -348,4 +350,9 @@ public class GridTimeSeriesAdapter extends
recordsByTime.remove(time);
}
}
@Override
public String getEnsembleId() {
return ensembleId;
}
}

View file

@ -1,7 +0,0 @@
#Fri Oct 16 14:50:20 CDT 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6

View file

@ -2,9 +2,9 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Timeseries Plug-in
Bundle-SymbolicName: com.raytheon.uf.viz.xy.timeseries;singleton:=true
Bundle-Version: 1.13.0.qualifier
Bundle-Version: 1.14.0.qualifier
Bundle-Vendor: RAYTHEON
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
Require-Bundle: com.raytheon.uf.common.dataplugin,
com.raytheon.uf.common.geospatial,

View file

@ -43,7 +43,8 @@ import com.raytheon.viz.core.graphing.xy.XYDataList;
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 7, 2010 bsteffen Initial creation
* May 07, 2010 bsteffen Initial creation
* Jun 18, 2014 3242 njensen Added getEnsembleId()
*
* </pre>
*
@ -103,9 +104,8 @@ public abstract class AbstractTimeSeriesAdapter<T extends PluginDataObject> {
}
}
@SuppressWarnings("unchecked")
public boolean hasRecord(PluginDataObject pdo) {
return records.contains((T) pdo);
return records.contains(pdo);
}
public void remove(DataTime time) {
@ -119,4 +119,13 @@ public abstract class AbstractTimeSeriesAdapter<T extends PluginDataObject> {
}
}
/**
* Get the ensemble id if applicable, otherwise return null
*
* @return
*/
public String getEnsembleId() {
return null;
}
}

View file

@ -58,6 +58,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Oct 16, 2009 mschenke Initial creation
* Feb 10, 2011 8244 bkowal replaced deprecated method calls;
* magnitude influences axis label font.
* Jun 18, 2014 3242 njensen Replaced deprecated calls
*
* </pre>
*
@ -115,11 +116,13 @@ public class TimeSeriesGraph extends AbstractGraph {
}
}
@Override
protected boolean canHandleResoruce(IGraphableResource<?, ?> rsc) {
// Can only handle graphing of TimeSeriesResources
return (rsc instanceof TimeSeriesResource);
}
@Override
protected void paintTitles(IGraphicsTarget target,
PaintProperties paintProps) throws VizException {
@ -171,7 +174,7 @@ public class TimeSeriesGraph extends AbstractGraph {
DrawableString parameters = new DrawableString("",
colorToUse);
parameters.font = unitsFont;
parameters.textStyle = TextStyle.DROP_SHADOW;
parameters.addTextStyle(TextStyle.DROP_SHADOW);
parameters.horizontalAlignment = HorizontalAlignment.RIGHT;
parameters.magnification = this.currentMagnification;

View file

@ -50,6 +50,7 @@ import com.raytheon.uf.common.style.StyleException;
import com.raytheon.uf.common.style.graph.GraphPreferences;
import com.raytheon.uf.common.style.level.SingleLevel;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.DrawableLine;
import com.raytheon.uf.viz.core.IExtent;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.PixelCoverage;
@ -97,6 +98,7 @@ import com.vividsolutions.jts.geom.Geometry;
* capability.
* Feb 14, 2011 8244 bkowal enabled magnification for wind barbs.
* Dec 19, 2013 DR 16795 D. Friedman Transform pixel coordinate in inspect
* Jun 18, 2014 3242 njensen Added ensembleId to legend
*
* </pre>
*
@ -359,9 +361,13 @@ public class TimeSeriesResource extends
// Connects adjacent data points with a line
if (prevScreen != null) {
OutlineCapability lineCap = getCapability(OutlineCapability.class);
target.drawLine(screen[0], screen[1], 0.0, prevScreen[0],
prevScreen[1], 0.0, color, lineCap.getOutlineWidth(),
lineCap.getLineStyle());
DrawableLine line = new DrawableLine();
line.addPoint(screen[0], screen[1]);
line.addPoint(prevScreen[0], prevScreen[1]);
line.basics.color = color;
line.width = lineCap.getOutlineWidth();
line.lineStyle = lineCap.getLineStyle();
target.drawLine(line);
}
prevScreen = screen;
@ -501,6 +507,11 @@ public class TimeSeriesResource extends
"TSer", units != null && units.equals("") == false ? "("
+ units + ")" : ""));
if (adapter.getEnsembleId() != null) {
sb.append(" Perturbation ");
sb.append(adapter.getEnsembleId());
}
if (secondaryResource != null) {
return ICombinedResourceData.CombineUtil.getName(sb.toString(),
secondaryResource.getName(), combineOperation);
@ -533,6 +544,7 @@ public class TimeSeriesResource extends
return (units != null ? units : adapter.getParameterName());
}
@Override
public void redraw() {
// Only used if wireframe shapes are constructed
}
@ -583,10 +595,10 @@ public class TimeSeriesResource extends
@Override
public String inspect(ReferencedCoordinate coord) throws VizException {
String inspect = null;
double[] worldCoord = descriptor.pixelToWorld(
new double[] { coord.getObject().x, coord.getObject().y });
Coordinate c = descriptor.getGraphCoordiante(this,
new Coordinate(worldCoord[0], worldCoord[1]));
double[] worldCoord = descriptor.pixelToWorld(new double[] {
coord.getObject().x, coord.getObject().y });
Coordinate c = descriptor.getGraphCoordiante(this, new Coordinate(
worldCoord[0], worldCoord[1]));
if (c != null && data != null) {
double[] vals = data.inspectXY(c);
NumberFormat nf = NumberFormat.getInstance();