Issue #2474 - Fixed font memory leak.

Former-commit-id: f3a9e541a1 [formerly a9b8c2a2fe [formerly a8a78efd01f8f3ed0ee533d4eeeb9e3463d3c0f2]]
Former-commit-id: a9b8c2a2fe
Former-commit-id: 7defe1efea
This commit is contained in:
Lee Venable 2013-10-14 12:41:20 -05:00
parent dcf275dbc3
commit 4d3e1ef28c

View file

@ -62,7 +62,8 @@ import com.raytheon.uf.viz.monitor.scan.commondialogs.EllipseData.EllipseType;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Mar 11, 2010 lvenable Initial creation * Mar 11, 2010 lvenable Initial creation
* Oct 14, 2013 #2474 lvenable Fixed font memory leak.
* *
* </pre> * </pre>
* *
@ -135,12 +136,12 @@ public class TimeHeightGraph {
* X coord of the ending time label. * X coord of the ending time label.
*/ */
private final int RIGHT_TIME_LBL_XCOORD = RIGHT_TIMELINE_XCOORD - 25; private final int RIGHT_TIME_LBL_XCOORD = RIGHT_TIMELINE_XCOORD - 25;
/** /**
* Kilometers to thousands of feet conversion. * Kilometers to thousands of feet conversion.
*/ */
private final double KM_TO_KFT = 3.2808; private final double KM_TO_KFT = 3.2808;
/** /**
* Nautical Miles to km conversion. * Nautical Miles to km conversion.
*/ */
@ -152,14 +153,14 @@ public class TimeHeightGraph {
* Used from CvtAzmRngToLatLon.H - RKmPerNm * Used from CvtAzmRngToLatLon.H - RKmPerNm
*/ */
private final double METERS_PER_SEC_TO_KTS = 3600 / 1.852 / 1000; private final double METERS_PER_SEC_TO_KTS = 3600 / 1.852 / 1000;
/** /**
* Time span convered by the graph. * Time span convered by the graph.
*/ */
private final int GRAPH_WIDTH_SECONDS = (60 + 2) * 60; private final int GRAPH_WIDTH_SECONDS = (60 + 2) * 60;
private final int GRAPH_RIGHT_MARGIN_SECONDS = 1 * 60; private final int GRAPH_RIGHT_MARGIN_SECONDS = 1 * 60;
/** /**
* Height per pixel increment. * Height per pixel increment.
*/ */
@ -236,8 +237,8 @@ public class TimeHeightGraph {
private EllipseData ellipseData; private EllipseData ellipseData;
/** /**
* Graph data that will be drawn. * Graph data that will be drawn. Volume Scan Time in millis ->
* Volume Scan Time in millis -> DMDTableDataRow * DMDTableDataRow
*/ */
private TreeMap<Long, DMDTableDataRow> graphData; private TreeMap<Long, DMDTableDataRow> graphData;
@ -271,7 +272,10 @@ public class TimeHeightGraph {
* suspend drawing while the data is being updated. * suspend drawing while the data is being updated.
*/ */
private boolean redrawFlag = true; private boolean redrawFlag = true;
/** No Data Available font. */
private Font noDataFont;
/** /**
* Constructor. * Constructor.
* *
@ -289,7 +293,7 @@ public class TimeHeightGraph {
this.timeHeightCB = timeHeightCB; this.timeHeightCB = timeHeightCB;
sdf.setTimeZone(TimeZone.getTimeZone("GMT")); sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
display = this.parentComp.getDisplay(); display = this.parentComp.getDisplay();
initData(); initData();
createCanvas(); createCanvas();
} }
@ -312,6 +316,7 @@ public class TimeHeightGraph {
// Create the text font // Create the text font
textFont = new Font(display, "Monospace", 10, SWT.BOLD); textFont = new Font(display, "Monospace", 10, SWT.BOLD);
noDataFont = new Font(display, "Monospace", 30, SWT.BOLD);
// Create the time labels and make other calculations // Create the time labels and make other calculations
createTimeLabels(); createTimeLabels();
@ -365,6 +370,7 @@ public class TimeHeightGraph {
@Override @Override
public void widgetDisposed(DisposeEvent e) { public void widgetDisposed(DisposeEvent e) {
textFont.dispose(); textFont.dispose();
noDataFont.dispose();
} }
}); });
} }
@ -380,7 +386,7 @@ public class TimeHeightGraph {
if (redrawFlag == false) { if (redrawFlag == false) {
return; return;
} }
gc.setAntialias(SWT.ON); gc.setAntialias(SWT.ON);
gc.setFont(textFont); gc.setFont(textFont);
@ -389,8 +395,7 @@ public class TimeHeightGraph {
gc.fillRectangle(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT); gc.fillRectangle(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT);
if (graphData == null) { if (graphData == null) {
Font tmpFont = new Font(display, "Monospace", 30, SWT.BOLD); gc.setFont(noDataFont);
gc.setFont(tmpFont);
gc.setForeground(display.getSystemColor(SWT.COLOR_WHITE)); gc.setForeground(display.getSystemColor(SWT.COLOR_WHITE));
gc.drawString("NO DATA AVAILABLE", 100, CANVAS_HEIGHT / 2, true); gc.drawString("NO DATA AVAILABLE", 100, CANVAS_HEIGHT / 2, true);
@ -464,12 +469,15 @@ public class TimeHeightGraph {
while (iter.hasNext()) { while (iter.hasNext()) {
long timeMillis = iter.next(); long timeMillis = iter.next();
DMDTableDataRow dataRow = graphData.get(timeMillis); DMDTableDataRow dataRow = graphData.get(timeMillis);
ArrayList<Double> timeList = dataRow.getTimeHeightTimes(); // seconds past midnight ArrayList<Double> timeList = dataRow.getTimeHeightTimes(); // seconds
// past
// midnight
ArrayList<Double> heightList = dataRow.getTimeHeightHeight(); ArrayList<Double> heightList = dataRow.getTimeHeightHeight();
ArrayList<Double> angleList = dataRow.getTimeHeightElevationIndexes(); ArrayList<Double> angleList = dataRow
.getTimeHeightElevationIndexes();
ArrayList<Double> llDiamList = dataRow.getTimeHeightDiam(); ArrayList<Double> llDiamList = dataRow.getTimeHeightDiam();
// Get the data // Get the data
if (attr.equalsIgnoreCase("llgtg")) { if (attr.equalsIgnoreCase("llgtg")) {
dataList = dataRow.getTimeHeightGtgMax(); dataList = dataRow.getTimeHeightGtgMax();
} else if (attr.equalsIgnoreCase("llShr")) { } else if (attr.equalsIgnoreCase("llShr")) {
@ -479,14 +487,14 @@ public class TimeHeightGraph {
dataList = new ArrayList<Double>(); dataList = new ArrayList<Double>();
tmp = dataRow.getTimeHeightRotvel(); tmp = dataRow.getTimeHeightRotvel();
// Convert to kts // Convert to kts
for (Double d: tmp) { for (Double d : tmp) {
long val = Math.round(d * METERS_PER_SEC_TO_KTS); long val = Math.round(d * METERS_PER_SEC_TO_KTS);
dataList.add(new Double(val)); dataList.add(new Double(val));
} }
} else if (attr.equalsIgnoreCase("llDiam")) { } else if (attr.equalsIgnoreCase("llDiam")) {
dataList = new ArrayList<Double>(); dataList = new ArrayList<Double>();
// Convert to nautical miles // Convert to nautical miles
for (Double d: llDiamList) { for (Double d : llDiamList) {
dataList.add(d * NAUTICAL_MILES_TO_KM); dataList.add(d * NAUTICAL_MILES_TO_KM);
} }
} else if (attr.equalsIgnoreCase("stRank")) { } else if (attr.equalsIgnoreCase("stRank")) {
@ -500,7 +508,7 @@ public class TimeHeightGraph {
if (timeList.size() < angleList.size()) { if (timeList.size() < angleList.size()) {
maxIdx = timeList.size(); maxIdx = timeList.size();
} }
volScanCal.setTimeInMillis(timeMillis); volScanCal.setTimeInMillis(timeMillis);
int volScanSecondPastMidnight = getSecondsPastMidnight(volScanCal); int volScanSecondPastMidnight = getSecondsPastMidnight(volScanCal);
volScanCal.set(Calendar.HOUR_OF_DAY, 0); volScanCal.set(Calendar.HOUR_OF_DAY, 0);
@ -508,7 +516,7 @@ public class TimeHeightGraph {
volScanCal.set(Calendar.SECOND, 0); volScanCal.set(Calendar.SECOND, 0);
volScanCal.set(Calendar.MILLISECOND, 0); volScanCal.set(Calendar.MILLISECOND, 0);
long volScanMidnight = volScanCal.getTimeInMillis(); long volScanMidnight = volScanCal.getTimeInMillis();
for (int i = 0; i < angleList.size(); i++) { for (int i = 0; i < angleList.size(); i++) {
Double angleIdx = angleList.get(i); Double angleIdx = angleList.get(i);
Double seconds = timeList.get(angleIdx.intValue()); Double seconds = timeList.get(angleIdx.intValue());
@ -517,12 +525,14 @@ public class TimeHeightGraph {
} }
if (seconds < volScanSecondPastMidnight) if (seconds < volScanSecondPastMidnight)
seconds += 86400; seconds += 86400;
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT")); Calendar cal = Calendar
.getInstance(TimeZone.getTimeZone("GMT"));
cal.setTimeInMillis(volScanMidnight + (long) (double) seconds * 1000);
cal.setTimeInMillis(volScanMidnight + (long) (double) seconds
* 1000);
double heightKft = heightList.get(idx) * KM_TO_KFT; double heightKft = heightList.get(idx) * KM_TO_KFT;
drawCirculation(gc, cal.getTimeInMillis(), drawCirculation(gc, cal.getTimeInMillis(), heightKft,
heightKft, dataList.get(idx), llDiamList.get(idx)); dataList.get(idx), llDiamList.get(idx));
idx++; idx++;
} }
} }
@ -571,7 +581,7 @@ public class TimeHeightGraph {
for (Long timeMillis : graphData.keySet()) { for (Long timeMillis : graphData.keySet()) {
// Invalid times have been removed by setGraphData() // Invalid times have been removed by setGraphData()
cal.setTimeInMillis(timeMillis); cal.setTimeInMillis(timeMillis);
timeMillisOffset = (cal.getTimeInMillis() - startingTimeMillis) timeMillisOffset = (cal.getTimeInMillis() - startingTimeMillis)
/ millisPerPixel; / millisPerPixel;
xCoord = (int) Math.round(timeMillisOffset + LEFT_TIME_LBL_XCOORD); xCoord = (int) Math.round(timeMillisOffset + LEFT_TIME_LBL_XCOORD);
@ -591,7 +601,7 @@ public class TimeHeightGraph {
private void drawElevationLinesAndAngles(GC gc) { private void drawElevationLinesAndAngles(GC gc) {
gc.setForeground(display.getSystemColor(SWT.COLOR_GRAY)); gc.setForeground(display.getSystemColor(SWT.COLOR_GRAY));
gc.setLineWidth(8); gc.setLineWidth(8);
for (double angle : elevLinesAngMap.keySet()) { for (double angle : elevLinesAngMap.keySet()) {
ArrayList<Integer> list = elevLinesAngMap.get(angle); ArrayList<Integer> list = elevLinesAngMap.get(angle);
if (list.size() == 0) { if (list.size() == 0) {
@ -599,7 +609,7 @@ public class TimeHeightGraph {
} }
int[] intArr = new int[list.size() + 4]; int[] intArr = new int[list.size() + 4];
int i = 0; int i = 0;
for (i = 0; i < intArr.length - 2; i++) { for (i = 0; i < intArr.length - 2; i++) {
if (i == 0) { if (i == 0) {
intArr[i] = list.get(i) - 40; intArr[i] = list.get(i) - 40;
i++; i++;
@ -608,18 +618,18 @@ public class TimeHeightGraph {
} }
intArr[i] = list.get(i - 2); intArr[i] = list.get(i - 2);
} }
int lastY = intArr[i - 1]; int lastY = intArr[i - 1];
intArr[i] = RIGHT_TIMELINE_XCOORD; intArr[i] = RIGHT_TIMELINE_XCOORD;
i++; i++;
intArr[i] = lastY; intArr[i] = lastY;
gc.drawPolyline(intArr); gc.drawPolyline(intArr);
} }
gc.setLineWidth(1); gc.setLineWidth(1);
/* /*
* Loop through the array of elevation lines. Use the first set of x,y * Loop through the array of elevation lines. Use the first set of x,y
* coords to draw the left side labels. Use the last one to draw the * coords to draw the left side labels. Use the last one to draw the
* right side labels. * right side labels.
*/ */
int newTextXCoord = 0; int newTextXCoord = 0;
@ -632,17 +642,19 @@ public class TimeHeightGraph {
if (elevLinesAngMap.get(angle).size() == 0) { if (elevLinesAngMap.get(angle).size() == 0) {
continue; continue;
} }
ArrayList<Integer> intList = elevLinesAngMap.get(angle); ArrayList<Integer> intList = elevLinesAngMap.get(angle);
newTextXCoord = intList.get(0) - (4 * textWidth) - 50; newTextXCoord = intList.get(0) - (4 * textWidth) - 50;
newTextYCoord = (int) Math.round(intList.get(1) - textHeight / 2.0); newTextYCoord = (int) Math.round(intList.get(1) - textHeight / 2.0);
gc.drawString(String.format("%4.1f", angle), newTextXCoord, gc.drawString(String.format("%4.1f", angle), newTextXCoord,
newTextYCoord, true); newTextYCoord, true);
lastTextXCoord = intList.get(intList.size() - 2) + (4 * textWidth) + 50; lastTextXCoord = intList.get(intList.size() - 2) + (4 * textWidth)
lastTextYCoord = (int) Math.round(intList.get(intList.size() - 1) - textHeight / 2.0); + 50;
lastTextYCoord = (int) Math.round(intList.get(intList.size() - 1)
- textHeight / 2.0);
gc.drawString(String.format("%4.1f", angle), newTextXCoord, gc.drawString(String.format("%4.1f", angle), newTextXCoord,
newTextYCoord, true); newTextYCoord, true);
lastMap.put(angle, new int[] { lastTextXCoord, lastTextYCoord }); lastMap.put(angle, new int[] { lastTextXCoord, lastTextYCoord });
@ -651,10 +663,10 @@ public class TimeHeightGraph {
/* /*
* Draw the elevation angles on the right side of the graph. * Draw the elevation angles on the right side of the graph.
*/ */
for (double angle: lastMap.keySet()) { for (double angle : lastMap.keySet()) {
int[] pts = lastMap.get(angle); int[] pts = lastMap.get(angle);
gc.drawString(String.format("%4.1f", angle), RIGHT_TIMELINE_XCOORD + 30, gc.drawString(String.format("%4.1f", angle),
pts[1], true); RIGHT_TIMELINE_XCOORD + 30, pts[1], true);
} }
} }
@ -688,7 +700,7 @@ public class TimeHeightGraph {
if (xyCoords.x >= RIGHT_TIMELINE_XCOORD) { if (xyCoords.x >= RIGHT_TIMELINE_XCOORD) {
return; return;
} }
// Check if the oval need to be drawn // Check if the oval need to be drawn
if (drawSettings.diamOverlay == true) { if (drawSettings.diamOverlay == true) {
gc.setBackground(threshColor); gc.setBackground(threshColor);
@ -818,11 +830,10 @@ public class TimeHeightGraph {
gc.dispose(); gc.dispose();
image.dispose(); image.dispose();
} }
private static int getSecondsPastMidnight(Calendar cal) { private static int getSecondsPastMidnight(Calendar cal) {
return cal.get(Calendar.HOUR_OF_DAY) * 3600 + return cal.get(Calendar.HOUR_OF_DAY) * 3600 + cal.get(Calendar.MINUTE)
cal.get(Calendar.MINUTE) * 60 + * 60 + cal.get(Calendar.SECOND);
cal.get(Calendar.SECOND);
} }
/** /**
@ -832,15 +843,18 @@ public class TimeHeightGraph {
Date d = timeHeightCB.getDialogTime(); Date d = timeHeightCB.getDialogTime();
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT")); Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
cal.setTime(d); cal.setTime(d);
if ((graphData != null) && ! graphData.isEmpty()) {
Map.Entry<Long, DMDTableDataRow> lastEntry = graphData.lastEntry();
Calendar volScanCal = Calendar.getInstance(TimeZone.getTimeZone("GMT")); if ((graphData != null) && !graphData.isEmpty()) {
Map.Entry<Long, DMDTableDataRow> lastEntry = graphData.lastEntry();
Calendar volScanCal = Calendar.getInstance(TimeZone
.getTimeZone("GMT"));
volScanCal.setTimeInMillis(lastEntry.getKey()); volScanCal.setTimeInMillis(lastEntry.getKey());
DMDTableDataRow dataRow = lastEntry.getValue(); DMDTableDataRow dataRow = lastEntry.getValue();
ArrayList<Double> timeList = dataRow.getTimeHeightTimes(); // seconds past midnight ArrayList<Double> timeList = dataRow.getTimeHeightTimes(); // seconds
// past
// midnight
if ((timeList != null) && (timeList.size() > 0)) { if ((timeList != null) && (timeList.size() > 0)) {
int seconds = (int) (double) timeList.get(timeList.size() - 1); int seconds = (int) (double) timeList.get(timeList.size() - 1);
@ -858,14 +872,14 @@ public class TimeHeightGraph {
cal.set(Calendar.SECOND, 0); cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0); cal.set(Calendar.MILLISECOND, 0);
cal.add(Calendar.SECOND, GRAPH_RIGHT_MARGIN_SECONDS); cal.add(Calendar.SECOND, GRAPH_RIGHT_MARGIN_SECONDS);
long endMillis = cal.getTimeInMillis(); long endMillis = cal.getTimeInMillis();
startingTimeMillis = endMillis - GRAPH_WIDTH_SECONDS * 1000; startingTimeMillis = endMillis - GRAPH_WIDTH_SECONDS * 1000;
millisPerPixel = (endMillis - startingTimeMillis) millisPerPixel = (endMillis - startingTimeMillis)
/ (RIGHT_TIME_LBL_XCOORD - LEFT_TIME_LBL_XCOORD); / (RIGHT_TIME_LBL_XCOORD - LEFT_TIME_LBL_XCOORD);
} }
/** /**
* Find the maximum height value for the graph. * Find the maximum height value for the graph.
@ -938,8 +952,10 @@ public class TimeHeightGraph {
invalidTimes.add(l); invalidTimes.add(l);
continue; continue;
} }
/* TODO: Was startingTimeMillis > graphData.get(l).getTime().getValidTime().getTimeInMillis(), /*
* but that is currently not the volume scan time. * TODO: Was startingTimeMillis >
* graphData.get(l).getTime().getValidTime().getTimeInMillis(), but
* that is currently not the volume scan time.
*/ */
if (startingTimeMillis > l) { if (startingTimeMillis > l) {
invalidTimes.add(l); invalidTimes.add(l);
@ -948,7 +964,7 @@ public class TimeHeightGraph {
DMDTableDataRow dataRow = graphData.get(l); DMDTableDataRow dataRow = graphData.get(l);
ArrayList<Double> heightList = dataRow.getTimeHeightHeight(); ArrayList<Double> heightList = dataRow.getTimeHeightHeight();
for (Double height: heightList) { for (Double height : heightList) {
if (height * KM_TO_KFT > maxHeight) { if (height * KM_TO_KFT > maxHeight) {
maxHeight = height * KM_TO_KFT; maxHeight = height * KM_TO_KFT;
} }
@ -962,7 +978,7 @@ public class TimeHeightGraph {
graphData.remove(l); graphData.remove(l);
} }
} }
recalcHeightVarables(maxHeight); recalcHeightVarables(maxHeight);
/* /*
@ -975,25 +991,30 @@ public class TimeHeightGraph {
for (Long timeSec : graphData.keySet()) { for (Long timeSec : graphData.keySet()) {
DMDTableDataRow dataRow = graphData.get(timeSec); DMDTableDataRow dataRow = graphData.get(timeSec);
ArrayList<Double> elevAngles = dataRow.getTimeHeightElevationAngles(); ArrayList<Double> elevAngles = dataRow
ArrayList<Double> elevAnglesIndices = dataRow.getTimeHeightElevationIndexes(); .getTimeHeightElevationAngles();
ArrayList<Double> timeList = dataRow.getTimeHeightTimes(); // seconds past midnight ArrayList<Double> elevAnglesIndices = dataRow
.getTimeHeightElevationIndexes();
ArrayList<Double> timeList = dataRow.getTimeHeightTimes(); // seconds
// past
// midnight
ArrayList<Double> heightList = dataRow.getTimeHeightHeight(); ArrayList<Double> heightList = dataRow.getTimeHeightHeight();
// ArrayList<Double> rankList = dataRow.getTimeHeightRank(); // ArrayList<Double> rankList = dataRow.getTimeHeightRank();
//System.out.println("=======================");
//System.out.println("timesec: " + timeSec + " " + sdf.format(new Date(timeSec)));
//System.out.println("Angles = " + elevAngles);
//System.out.println("Angle Indices = " + elevAnglesIndices);
//System.out.println("Times = " + timeList); // System.out.println("=======================");
//System.out.println("Height = " + heightList); // System.out.println("timesec: " + timeSec + " " + sdf.format(new
// Date(timeSec)));
// System.out.println("Angles = " + elevAngles);
// System.out.println("Angle Indices = " + elevAnglesIndices);
//System.out.println("RankList = " + rankList); // System.out.println("Times = " + timeList);
//System.out.println("Shear = " + dataRow.getTimeHeightShear()); // System.out.println("Height = " + heightList);
//System.out.println("Diam = " + dataRow.getTimeHeightDiam());
//System.out.println("GTGMax = " + dataRow.getTimeHeightGtgMax()); // System.out.println("RankList = " + rankList);
//System.out.println("Rotvel = " + dataRow.getTimeHeightRotvel()); // System.out.println("Shear = " + dataRow.getTimeHeightShear());
// System.out.println("Diam = " + dataRow.getTimeHeightDiam());
// System.out.println("GTGMax = " + dataRow.getTimeHeightGtgMax());
// System.out.println("Rotvel = " + dataRow.getTimeHeightRotvel());
Point xyCoord; Point xyCoord;
volScanPoints.clear(); volScanPoints.clear();
int idx = 0; int idx = 0;
@ -1001,7 +1022,7 @@ public class TimeHeightGraph {
if (timeList.size() < elevAnglesIndices.size()) { if (timeList.size() < elevAnglesIndices.size()) {
maxIdx = timeList.size(); maxIdx = timeList.size();
} }
volScanCal.setTimeInMillis(timeSec); volScanCal.setTimeInMillis(timeSec);
int volScanSecondPastMidnight = getSecondsPastMidnight(volScanCal); int volScanSecondPastMidnight = getSecondsPastMidnight(volScanCal);
volScanCal.set(Calendar.HOUR_OF_DAY, 0); volScanCal.set(Calendar.HOUR_OF_DAY, 0);
@ -1009,18 +1030,20 @@ public class TimeHeightGraph {
volScanCal.set(Calendar.SECOND, 0); volScanCal.set(Calendar.SECOND, 0);
volScanCal.set(Calendar.MILLISECOND, 0); volScanCal.set(Calendar.MILLISECOND, 0);
long volScanMidnight = volScanCal.getTimeInMillis(); long volScanMidnight = volScanCal.getTimeInMillis();
for (Double angleIdx : elevAnglesIndices) { for (Double angleIdx : elevAnglesIndices) {
if (idx >= maxIdx) { if (idx >= maxIdx) {
continue; continue;
} }
// Calculate the time offset of each angle by adding // Calculate the time offset of each angle by adding
// the time value to the midnite time value // the time value to the midnite time value
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT")); Calendar cal = Calendar
.getInstance(TimeZone.getTimeZone("GMT"));
Double seconds = timeList.get(angleIdx.intValue()); Double seconds = timeList.get(angleIdx.intValue());
if (seconds < volScanSecondPastMidnight) if (seconds < volScanSecondPastMidnight)
seconds += 86400; seconds += 86400;
cal.setTimeInMillis(volScanMidnight + (long) (double) seconds * 1000); cal.setTimeInMillis(volScanMidnight + (long) (double) seconds
* 1000);
xyCoord = calcTimeHeightToXY(cal.getTimeInMillis(), xyCoord = calcTimeHeightToXY(cal.getTimeInMillis(),
heightList.get(idx) * KM_TO_KFT); heightList.get(idx) * KM_TO_KFT);
if (xyCoord.x < RIGHT_TIMELINE_XCOORD) { if (xyCoord.x < RIGHT_TIMELINE_XCOORD) {
@ -1030,8 +1053,8 @@ public class TimeHeightGraph {
if (elevLinesAngMap.containsKey(angle) == false) { if (elevLinesAngMap.containsKey(angle) == false) {
elevLinesAngMap.put(angle, new ArrayList<Integer>()); elevLinesAngMap.put(angle, new ArrayList<Integer>());
} }
if (!elevLinesAngMap.get(angle).contains(xyCoord.x) && if (!elevLinesAngMap.get(angle).contains(xyCoord.x)
(xyCoord.x < RIGHT_TIMELINE_XCOORD)) { && (xyCoord.x < RIGHT_TIMELINE_XCOORD)) {
elevLinesAngMap.get(angle).add(xyCoord.x); elevLinesAngMap.get(angle).add(xyCoord.x);
elevLinesAngMap.get(angle).add(xyCoord.y); elevLinesAngMap.get(angle).add(xyCoord.y);
} }
@ -1049,7 +1072,7 @@ public class TimeHeightGraph {
volScanLines.add(tmpArray); volScanLines.add(tmpArray);
} }
/* /*
* Redraw the graph * Redraw the graph
*/ */
@ -1058,7 +1081,7 @@ public class TimeHeightGraph {
// printGraphData(); // printGraphData();
} }
/** /**
* Redraw the canvas. * Redraw the canvas.
*/ */
@ -1076,39 +1099,39 @@ public class TimeHeightGraph {
* structure of the data to be graphed * structure of the data to be graphed
*/ */
// System.out.println("*******************************************"); // System.out.println("*******************************************");
// System.out.println("***** SETTING TIME HEIGHT GRAPH DATA ******"); // System.out.println("***** SETTING TIME HEIGHT GRAPH DATA ******");
// System.out.println("*******************************************"); // System.out.println("*******************************************");
// //
// Calendar cal = Calendar.getInstance(); // Calendar cal = Calendar.getInstance();
// //
// TreeMap<Double, DMDTimeHeight> recordMap; // TreeMap<Double, DMDTimeHeight> recordMap;
// //
// Set<Long> millisKeys = graphData.keySet(); // Set<Long> millisKeys = graphData.keySet();
// //
// for (Long timeInMillis : millisKeys) { // for (Long timeInMillis : millisKeys) {
// cal.setTimeInMillis(timeInMillis); // cal.setTimeInMillis(timeInMillis);
// System.out.println("---" + timeInMillis); // System.out.println("---" + timeInMillis);
// System.out.println("---" + cal.getTime().toString()); // System.out.println("---" + cal.getTime().toString());
// //
// recordMap = graphData.get(timeInMillis); // recordMap = graphData.get(timeInMillis);
// //
// Set<Double> recordKeys = recordMap.keySet(); // Set<Double> recordKeys = recordMap.keySet();
// if (recordKeys.size() == 0) { // if (recordKeys.size() == 0) {
// System.out.println("++++++ NO DATA FOR: " + timeInMillis); // System.out.println("++++++ NO DATA FOR: " + timeInMillis);
// } // }
// //
// for (Double dbl : recordKeys) { // for (Double dbl : recordKeys) {
// System.out.println("++++++" + dbl); // System.out.println("++++++" + dbl);
// //
// DMDTimeHeight dth = recordMap.get(dbl); // DMDTimeHeight dth = recordMap.get(dbl);
// System.out.println("++++++ Hgt = " + dth.getHeight()); // System.out.println("++++++ Hgt = " + dth.getHeight());
// System.out.println("++++++ LLDiam = " + dth.getLlDiam()); // System.out.println("++++++ LLDiam = " + dth.getLlDiam());
// System.out.println("++++++ Offset = " + dth.getOffset()); // System.out.println("++++++ Offset = " + dth.getOffset());
// System.out.println("++++++ in Sec = " // System.out.println("++++++ in Sec = "
// + (dth.getOffset() / 1000.0)); // + (dth.getOffset() / 1000.0));
// System.out.println("++++++ Val = " + dth.getValue()); // System.out.println("++++++ Val = " + dth.getValue());
// } // }
// } // }
} }
} }