Issue #2223 fix melting layer memory leak
Change-Id: I2fbf4dbaea12e4bba560b27ba372df0c3f913fec Former-commit-id:194db9a9f9
[formerly88b2dd18e6
] [formerly194db9a9f9
[formerly88b2dd18e6
] [formerly7b5dcc09fa
[formerly 3909f42ee097dac541328f8dc85330c618583b3f]]] Former-commit-id:7b5dcc09fa
Former-commit-id:95aeee2fe6
[formerly8db7b7b5f6
] Former-commit-id:f6d5014c43
This commit is contained in:
parent
3c7ec48316
commit
8be1ed440a
1 changed files with 146 additions and 122 deletions
|
@ -69,7 +69,9 @@ import com.raytheon.viz.radar.rsc.RadarResourceData;
|
|||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Displays the melting layer as provided by radar (i.e. displays the levels at
|
||||
* which snow is turned to a mixture of snow and water and then in turn that is
|
||||
* changed to water only).
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -77,6 +79,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 16, 2010 mnash Initial creation
|
||||
* Jul 13, 2103 2223 njensen Overrode remove() to fix memory leak
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -148,8 +151,10 @@ public class RadarMLResource extends RadarGraphicsResource {
|
|||
protected void paintInternal(IGraphicsTarget target,
|
||||
PaintProperties paintProps) throws VizException {
|
||||
GeneralEnvelope generalEnvelope = new GeneralEnvelope(2);
|
||||
Map<Integer, IWireframeShape> shapeMap = shapes.get(paintProps
|
||||
.getDataTime());
|
||||
Map<Integer, IWireframeShape> shapeMap = null;
|
||||
synchronized (shapes) {
|
||||
shapeMap = shapes.get(paintProps.getDataTime());
|
||||
|
||||
if (shapeMap == null || refresh == true) {
|
||||
if (shapeMap != null) {
|
||||
for (IWireframeShape w : shapeMap.values()) {
|
||||
|
@ -181,13 +186,14 @@ public class RadarMLResource extends RadarGraphicsResource {
|
|||
File loc = HDF5Util.findHDF5Location(radarRecord);
|
||||
IDataStore dataStore = DataStoreFactory.getDataStore(loc);
|
||||
try {
|
||||
RadarDataRetriever.populateRadarRecord(dataStore, radarRecord);
|
||||
RadarDataRetriever.populateRadarRecord(dataStore,
|
||||
radarRecord);
|
||||
} catch (FileNotFoundException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||
e);
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
} catch (StorageException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||
e);
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
}
|
||||
|
||||
ProjectedCRS crs = radarRecord.getCRS();
|
||||
|
@ -211,26 +217,27 @@ public class RadarMLResource extends RadarGraphicsResource {
|
|||
if (block.getPacket(i, j) instanceof LinkedContourVectorPacket) {
|
||||
List<LinkedVector> vector = ((LinkedContourVectorPacket) block
|
||||
.getPacket(i, j)).getVectors();
|
||||
Coordinate[] coords = new Coordinate[vector.size() + 1];
|
||||
Coordinate[] coords = new Coordinate[vector
|
||||
.size() + 1];
|
||||
for (int l = 0; l < coords.length - 1; l++) {
|
||||
if (!coordinates.containsKey(vector.get(l)
|
||||
.getTheColor())) {
|
||||
coordinates.put(Integer.valueOf(vector.get(
|
||||
l).getTheColor()), coords);
|
||||
coordinates.put(Integer.valueOf(vector
|
||||
.get(l).getTheColor()), coords);
|
||||
}
|
||||
|
||||
// transform the coordinates to the correct
|
||||
// locations
|
||||
coordinate1 = new ReferencedCoordinate(
|
||||
rectifyCoordinate(new Coordinate(vector
|
||||
.get(l).getI1(), vector.get(l)
|
||||
.getJ1())), gg,
|
||||
Type.GRID_CENTER);
|
||||
rectifyCoordinate(new Coordinate(
|
||||
vector.get(l).getI1(),
|
||||
vector.get(l).getJ1())),
|
||||
gg, Type.GRID_CENTER);
|
||||
coordinate2 = new ReferencedCoordinate(
|
||||
rectifyCoordinate(new Coordinate(vector
|
||||
.get(l).getI2(), vector.get(l)
|
||||
.getJ2())), gg,
|
||||
Type.GRID_CENTER);
|
||||
rectifyCoordinate(new Coordinate(
|
||||
vector.get(l).getI2(),
|
||||
vector.get(l).getJ2())),
|
||||
gg, Type.GRID_CENTER);
|
||||
try {
|
||||
// coords[l] = coordinate1.asLatLon();
|
||||
coords[l] = coordinate2.asLatLon();
|
||||
|
@ -251,7 +258,8 @@ public class RadarMLResource extends RadarGraphicsResource {
|
|||
refresh = false;
|
||||
}
|
||||
|
||||
// looping through the coordinates in order to create a wireframe
|
||||
// looping through the coordinates in order to create a
|
||||
// wireframe
|
||||
// shape
|
||||
for (Integer num : coordinates.keySet()) {
|
||||
if (shapeMap.get(num) == null) {
|
||||
|
@ -271,12 +279,14 @@ public class RadarMLResource extends RadarGraphicsResource {
|
|||
lineStyle = getCapability(OutlineCapability.class)
|
||||
.getLineStyle();
|
||||
}
|
||||
target.drawWireframeShape(shapeMap.get(num),
|
||||
target.drawWireframeShape(
|
||||
shapeMap.get(num),
|
||||
getCapability(ColorableCapability.class).getColor(),
|
||||
getCapability(OutlineCapability.class)
|
||||
.getOutlineWidth(), lineStyle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// paint the legend for melting layer
|
||||
IExtent extent = paintProps.getView().getExtent();
|
||||
|
@ -379,4 +389,18 @@ public class RadarMLResource extends RadarGraphicsResource {
|
|||
c.y = 4096 - c.y;
|
||||
return c;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(DataTime dataTime) {
|
||||
synchronized (shapes) {
|
||||
Map<Integer, IWireframeShape> shapeMap = shapes.remove(dataTime);
|
||||
if (shapeMap != null) {
|
||||
for (IWireframeShape shp : shapeMap.values()) {
|
||||
shp.dispose();
|
||||
}
|
||||
shapeMap.clear();
|
||||
}
|
||||
}
|
||||
super.remove(dataTime);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue