Omaha #5073 - Fixed issue with Time Series Display.

Former-commit-id: ef723c22c0cb54c0a6448696455349d8b4195bca
This commit is contained in:
Slav Korolev 2015-11-18 13:04:23 -05:00
parent 2c30773ad0
commit 7c34074e52
2 changed files with 21 additions and 14 deletions

View file

@ -141,6 +141,8 @@ import com.raytheon.viz.hydrocommon.util.DbUtils;
* 29 May 2013 2016 mpduff Fix TS Toggle Traces.
* 05 Sep 2013 #2332 lvenable Fixed memory leaks.
* 24 Jan 2013 15959 lbousaidi Swap the corner points of the bounding box when zooming.
* Nov 18 2015 5073 skorolev Fixed drawing PP time series.
*
* @author lvenable
* @version 1.0
*
@ -841,7 +843,8 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
}
/* Precipitation physical element */
if (td.getPe().equalsIgnoreCase(HydroConstants.PP)) {
if (td.getPe().equalsIgnoreCase(HydroConstants.PP)
&& td.isTraceOn()) {
precipPE = true;
setBackgroundColor(td, j, gc);
int[] ia = new int[8];
@ -1242,12 +1245,12 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
}
Date xMin = pixel2x(gd, rubberBandX1 - GRAPHBORDER_LEFT);
Date xMax = pixel2x(gd, rubberBandX2 - GRAPHBORDER_LEFT);
//Swap the corner points of the bounding box when zooming
// Swap the corner points of the bounding box when zooming
if (xMin.after(xMax)) {
Date xtmp;
xtmp= xMin;
xMin=xMax;
xMax=xtmp;
xtmp = xMin;
xMin = xMax;
xMax = xtmp;
}
gd.setXMin(xMin);
gd.setXMax(xMax);
@ -1263,12 +1266,12 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
if (ymin < gd.getYmin()) {
ymin = gd.getYmin();
}
//Swap the corner points of the bounding box when zooming
// Swap the corner points of the bounding box when zooming
if (ymin > ymax) {
double ytmp;
ytmp= ymin;
ymin=ymax;
ymax=ytmp;
ytmp = ymin;
ymin = ymax;
ymax = ytmp;
}
gd.setYmin(ymin);
gd.setYmax(ymax);

View file

@ -70,6 +70,7 @@ import com.raytheon.viz.hydrocommon.HydroConstants;
* 06 Nov 2012 15399 wkwock Fix refine the plot algorithm and sampling algorithm
* May 06, 2013 1976 mpduff Code cleanup
* 05Sep2013 #2332 lvenable Fixed memory leaks.
* Nov 18, 2015 5073 skorolev Fixed y2pixel.
* </pre>
*
* @author mpduff
@ -624,9 +625,12 @@ public class TimeSeriesGraphCanvas extends Canvas {
}
double yDiff = gd.getYmax() - gd.getYmin();
double yValue = (graphAreaHeight / yDiff) * (y - gd.getYmin());
if (yValue < 0) {
return graphAreaHeight;
} else {
return (int) (graphAreaHeight - Math.round(yValue));
}
}
/**
* convert pixel value to real Y value