Merge branch 'omaha_14.2.2' of ssh://www.awips2omaha.com:29418/AWIPS2_baseline into master_14.2.2

Former-commit-id: 72e2882496 [formerly 72e2882496 [formerly 2c4c1a5babcfdcfadeb042a190bc79c7973e1a36]]
Former-commit-id: 9e94c2c571
Former-commit-id: 5a1fa755f9
This commit is contained in:
Brian.Dyke 2014-09-04 14:01:26 -04:00
commit 1c871eaf3d
2 changed files with 74 additions and 35 deletions

View file

@ -37,7 +37,6 @@ import org.opengis.referencing.crs.ProjectedCRS;
import com.raytheon.uf.common.dataplugin.radar.RadarDataKey; import com.raytheon.uf.common.dataplugin.radar.RadarDataKey;
import com.raytheon.uf.common.dataplugin.radar.RadarDataPoint; import com.raytheon.uf.common.dataplugin.radar.RadarDataPoint;
import com.raytheon.uf.common.dataplugin.radar.RadarDataPoint.RadarProductType;
import com.raytheon.uf.common.dataplugin.radar.RadarRecord; import com.raytheon.uf.common.dataplugin.radar.RadarRecord;
import com.raytheon.uf.common.dataplugin.radar.level3.GraphicBlock; import com.raytheon.uf.common.dataplugin.radar.level3.GraphicBlock;
import com.raytheon.uf.common.dataplugin.radar.level3.Layer; import com.raytheon.uf.common.dataplugin.radar.level3.Layer;
@ -70,6 +69,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jan 13, 2009 chammack Initial creation * Jan 13, 2009 chammack Initial creation
* 03/04/2013 DCS51 zwang Handle GFM product * 03/04/2013 DCS51 zwang Handle GFM product
* Sep 03, 2014 3574 njensen Properly dispose objects
* *
* </pre> * </pre>
* *
@ -79,11 +79,11 @@ import com.vividsolutions.jts.geom.Coordinate;
public class RadarGraphicsDisplay implements IRenderable { public class RadarGraphicsDisplay implements IRenderable {
private Map<Integer, RadarGraphicsPage> pageMap; private final Map<Integer, RadarGraphicsPage> pageMap;
private ArrayList<RadarGraphicsPage> symbologyPages; private final ArrayList<RadarGraphicsPage> symbologyPages;
private Map<RadarDataKey, RadarDataPoint> symbologyData; private final Map<RadarDataKey, RadarDataPoint> symbologyData;
private int currentPage; private int currentPage;
@ -108,9 +108,9 @@ public class RadarGraphicsDisplay implements IRenderable {
this.currentPage = 0; this.currentPage = 0;
// Only retrieve if this record has not been retrieved. // Only retrieve if this record has not been retrieved.
if ((radarRecord.getSymbologyData() == null || radarRecord if (((radarRecord.getSymbologyData() == null) || radarRecord
.getSymbologyData().isEmpty()) .getSymbologyData().isEmpty())
&& radarRecord.getGraphicBlock() == null) { && (radarRecord.getGraphicBlock() == null)) {
File loc = HDF5Util.findHDF5Location(radarRecord); File loc = HDF5Util.findHDF5Location(radarRecord);
IDataStore dataStore = DataStoreFactory.getDataStore(loc); IDataStore dataStore = DataStoreFactory.getDataStore(loc);
@ -135,9 +135,10 @@ public class RadarGraphicsDisplay implements IRenderable {
new GeneralGridEnvelope(new int[] { 0, 0 }, new int[] { 4096, new GeneralGridEnvelope(new int[] { 0, 0 }, new int[] { 4096,
4096 }, false), generalEnvelope); 4096 }, false), generalEnvelope);
IWireframeShape ws = target.createWireframeShape(true, mapDescriptor); IWireframeShape ws = target.createWireframeShape(true, mapDescriptor);
// Used for GFM forecast positions // Used for GFM forecast positions
IWireframeShape gfmWs = target.createWireframeShape(true, mapDescriptor); IWireframeShape gfmWs = target
.createWireframeShape(true, mapDescriptor);
symbologyData = radarRecord.getSymbologyData(); symbologyData = radarRecord.getSymbologyData();
if (symbologyData != null) { if (symbologyData != null) {
@ -162,8 +163,8 @@ public class RadarGraphicsDisplay implements IRenderable {
// logic in createSymbologyImages() // logic in createSymbologyImages()
rgp.addImages(currStorm, CoordinateSystem.LOCAL); rgp.addImages(currStorm, CoordinateSystem.LOCAL);
//Handle DMD table data // Handle DMD table data
if (radarRecord.getProductCode() == 149) { if (radarRecord.getProductCode() == 149) {
// Handle the tabular display data in the Generic Packet // Handle the tabular display data in the Generic Packet
String data = GraphicDataUtil.getDMDGraphicDataValue( String data = GraphicDataUtil.getDMDGraphicDataValue(
tableModifier, radarRecord, tableModifier, radarRecord,
@ -175,7 +176,7 @@ public class RadarGraphicsDisplay implements IRenderable {
addTableRow(tableData, featureData); addTableRow(tableData, featureData);
processTableData = true; processTableData = true;
} }
} }
} }
@ -211,7 +212,7 @@ public class RadarGraphicsDisplay implements IRenderable {
} }
// handle GFM product // handle GFM product
else { else {
this.currentPage = pageNum; this.currentPage = pageNum;
RadarGraphicsPage gab = this.pageMap.get(pageNum); RadarGraphicsPage gab = this.pageMap.get(pageNum);
if (gab == null) { if (gab == null) {
@ -223,7 +224,7 @@ public class RadarGraphicsDisplay implements IRenderable {
this.currentPage = 0; this.currentPage = 0;
} }
// Graphic block is organized into pages for display. The data for each // Graphic block is organized into pages for display. The data for each
// page is contained in packets. // page is contained in packets.
GraphicBlock gb = radarRecord.getGraphicBlock(); GraphicBlock gb = radarRecord.getGraphicBlock();
@ -249,7 +250,8 @@ public class RadarGraphicsDisplay implements IRenderable {
} }
} }
if ((symbologyData == null || symbologyData.isEmpty()) && gb == null) { if (((symbologyData == null) || symbologyData.isEmpty())
&& (gb == null)) {
String nullLegend = null; String nullLegend = null;
switch (radarRecord.getProductCode()) { switch (radarRecord.getProductCode()) {
case 139: case 139:
@ -295,7 +297,7 @@ public class RadarGraphicsDisplay implements IRenderable {
String[] values = sortValues.trim().split("\\s+"); String[] values = sortValues.trim().split("\\s+");
if (values.length > 0 && values[0].length() > 1) { if ((values.length > 0) && (values[0].length() > 1)) {
try { try {
strengthRank = Integer.parseInt(values[0].substring(1, strengthRank = Integer.parseInt(values[0].substring(1,
values[0].length())); values[0].length()));
@ -340,11 +342,15 @@ public class RadarGraphicsDisplay implements IRenderable {
} }
public void setMagnification(double magnification) { public void setMagnification(double magnification) {
for (RadarGraphicsPage page : symbologyPages) { synchronized (symbologyPages) {
page.setMagnification(magnification); for (RadarGraphicsPage page : symbologyPages) {
page.setMagnification(magnification);
}
} }
for (RadarGraphicsPage page : pageMap.values()) { synchronized (pageMap) {
page.setMagnification(magnification); for (RadarGraphicsPage page : pageMap.values()) {
page.setMagnification(magnification);
}
} }
} }
@ -358,32 +364,49 @@ public class RadarGraphicsDisplay implements IRenderable {
@Override @Override
public void paint(IGraphicsTarget target, PaintProperties paintProps) public void paint(IGraphicsTarget target, PaintProperties paintProps)
throws VizException { throws VizException {
if (currentPage < 0 || currentPage >= this.pageMap.size()) { synchronized (pageMap) {
return; if ((currentPage < 0) || (currentPage >= this.pageMap.size())) {
}
RadarGraphicsPage page = pageMap.get(currentPage);
if (page == null) {
return;
}
page.paint(target, paintProps);
for (RadarGraphicsPage currPage : symbologyPages) {
if (currPage == null) {
return; return;
} }
currPage.paint(target, paintProps); RadarGraphicsPage page = pageMap.get(currentPage);
if (page == null) {
return;
}
page.paint(target, paintProps);
}
synchronized (symbologyPages) {
for (RadarGraphicsPage currPage : symbologyPages) {
if (currPage == null) {
return;
}
currPage.paint(target, paintProps);
}
} }
} }
public int getNumPages() { public int getNumPages() {
return this.pageMap.size() > 0 ? this.pageMap.size() : 1; synchronized (pageMap) {
return this.pageMap.size() > 0 ? this.pageMap.size() : 1;
}
} }
public void dispose() { public void dispose() {
for (RadarGraphicsPage page : pageMap.values()) { synchronized (pageMap) {
page.dispose(); for (RadarGraphicsPage page : pageMap.values()) {
page.dispose();
}
pageMap.clear();
}
synchronized (symbologyPages) {
for (RadarGraphicsPage page : symbologyPages) {
page.dispose();
}
symbologyPages.clear();
} }
} }

View file

@ -120,6 +120,7 @@ import com.vividsolutions.jts.geom.LineString;
* 03/05/2013 DCS51 zwang Handle GFM product * 03/05/2013 DCS51 zwang Handle GFM product
* 06/24/2013 DR16162 zwang Remove "wind behind" * 06/24/2013 DR16162 zwang Remove "wind behind"
* 11/20/2013 2488 randerso Removed use of VeraMono font file * 11/20/2013 2488 randerso Removed use of VeraMono font file
* Sep 03, 2014 3574 njensen Properly dispose objects
* *
* </pre> * </pre>
* *
@ -1456,6 +1457,21 @@ public class RadarGraphicsPage implements IRenderable {
this.wireframeShape = null; this.wireframeShape = null;
} }
if (this.gfmFcstWireframeShape != null) {
this.gfmFcstWireframeShape.dispose();
this.gfmFcstWireframeShape = null;
}
if (plotObjects != null) {
for (PlotObject po : plotObjects) {
if (po != null) {
po.image.dispose();
po.image = null;
}
}
plotObjects.clear();
}
if (this.font != null) { if (this.font != null) {
this.font.dispose(); this.font.dispose();
} }