Omaha #3009 make ffmp play nice with collaboration
Change-Id: Iccccec6dbe999d7677520a5b0f0464a2186f8174 Former-commit-id: ac15b82ed3c493a5ea8cca01ba304e95c965365e
This commit is contained in:
parent
3ae54c26c6
commit
e34c1a6fe8
2 changed files with 70 additions and 61 deletions
|
@ -196,6 +196,7 @@ import com.vividsolutions.jts.geom.Point;
|
|||
* Aug 13, 2014 3492 mapeters Updated deprecated createWireframeShape() calls.
|
||||
* Aug 14, 2014 3523 mapeters Updated deprecated {@link DrawableString#textStyle}
|
||||
* assignments.
|
||||
* Sep 23, 2014 3009 njensen Overrode recycleInternal()
|
||||
* </pre>
|
||||
*
|
||||
* @author dhladky
|
||||
|
@ -1110,19 +1111,6 @@ public class FFMPResource extends
|
|||
|
||||
@Override
|
||||
protected void disposeInternal() {
|
||||
IDisplayPaneContainer container = getResourceContainer();
|
||||
if (container != null) {
|
||||
container.unregisterMouseHandler(inspectAdapter);
|
||||
}
|
||||
|
||||
if (font != null) {
|
||||
font.dispose();
|
||||
}
|
||||
|
||||
if (xfont != null) {
|
||||
xfont.dispose();
|
||||
}
|
||||
|
||||
if (this.getName().indexOf("Table Display") > -1) {
|
||||
if (basinTableDlg != null) {
|
||||
closeDialog();
|
||||
|
@ -1135,25 +1123,7 @@ public class FFMPResource extends
|
|||
}
|
||||
}
|
||||
|
||||
// dispose of shapes
|
||||
if (smallBasinOverlayShape != null) {
|
||||
smallBasinOverlayShape.dispose();
|
||||
}
|
||||
if (streamShadedShape != null) {
|
||||
streamShadedShape.dispose();
|
||||
}
|
||||
if (streamOutlineShape != null) {
|
||||
streamOutlineShape.dispose();
|
||||
}
|
||||
shadedShapes.dispose();
|
||||
|
||||
// clear takes care of the drawables
|
||||
clear();
|
||||
resetRecords();
|
||||
for (PixelCoverage px : vgbDrawables.values()) {
|
||||
px.dispose();
|
||||
}
|
||||
vgbDrawables.clear();
|
||||
|
||||
if (monitor.getResourceListenerList().size() == 1) {
|
||||
// free up the monitor which holds most of the memory
|
||||
|
@ -1164,6 +1134,52 @@ public class FFMPResource extends
|
|||
monitor.removeResourceListener(this);
|
||||
}
|
||||
|
||||
recycleInternal();
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the mouse adapter and disposes of all the graphics objects.
|
||||
*/
|
||||
@Override
|
||||
protected void recycleInternal() {
|
||||
IDisplayPaneContainer container = getResourceContainer();
|
||||
if (container != null) {
|
||||
container.unregisterMouseHandler(inspectAdapter);
|
||||
}
|
||||
|
||||
if (font != null) {
|
||||
font.dispose();
|
||||
font = null;
|
||||
}
|
||||
|
||||
if (xfont != null) {
|
||||
xfont.dispose();
|
||||
xfont = null;
|
||||
}
|
||||
|
||||
// dispose of shapes
|
||||
if (smallBasinOverlayShape != null) {
|
||||
smallBasinOverlayShape.dispose();
|
||||
smallBasinOverlayShape = null;
|
||||
}
|
||||
if (streamShadedShape != null) {
|
||||
streamShadedShape.dispose();
|
||||
streamShadedShape = null;
|
||||
}
|
||||
if (streamOutlineShape != null) {
|
||||
streamOutlineShape.dispose();
|
||||
streamOutlineShape = null;
|
||||
}
|
||||
shadedShapes.dispose();
|
||||
|
||||
// clear takes care of the drawables
|
||||
clear();
|
||||
|
||||
for (PixelCoverage px : vgbDrawables.values()) {
|
||||
px.dispose();
|
||||
}
|
||||
vgbDrawables.clear();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1552,7 +1568,7 @@ public class FFMPResource extends
|
|||
public void project(CoordinateReferenceSystem mapData) throws VizException {
|
||||
|
||||
if (shadedShapes != null) {
|
||||
shadedShapes.clear();
|
||||
shadedShapes.dispose();
|
||||
}
|
||||
|
||||
if (streamShadedShape != null) {
|
||||
|
|
|
@ -20,8 +20,8 @@ package com.raytheon.uf.viz.monitor.ffmp.ui.rsc;
|
|||
* further licensing information.
|
||||
**/
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.colormap.IColormapShadedShapeExtension;
|
||||
|
@ -38,6 +38,8 @@ import com.raytheon.uf.viz.core.map.MapDescriptor;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* 15 Sept, 2011 10899 dhladky Initial creation
|
||||
* 27 June, 2013 2152 njensen Added dispose()
|
||||
* Sep 23, 2014 3009 njensen Cleaned up
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author dhladky
|
||||
|
@ -47,21 +49,22 @@ import com.raytheon.uf.viz.core.map.MapDescriptor;
|
|||
public class FFMPShapeContainer {
|
||||
|
||||
/** always the same vertexes, one for each CWA **/
|
||||
private ConcurrentHashMap<String, ConcurrentHashMap<String, IColormapShadedShape>> shadedShapes = null;
|
||||
private ConcurrentMap<String, ConcurrentMap<String, IColormapShadedShape>> shadedShapes = null;
|
||||
|
||||
// public constructor
|
||||
public FFMPShapeContainer() {
|
||||
shadedShapes = new ConcurrentHashMap<String, ConcurrentHashMap<String, IColormapShadedShape>>();
|
||||
shadedShapes = new ConcurrentHashMap<String, ConcurrentMap<String, IColormapShadedShape>>();
|
||||
}
|
||||
|
||||
/**
|
||||
* build the ones you need to draw all possible FFMP configs
|
||||
* Retrieves the shaded shape if it exists, or builds and caches it if it
|
||||
* does not exist
|
||||
*
|
||||
* @param cwa
|
||||
* @param huc
|
||||
* @param target
|
||||
* @param descriptor
|
||||
* @return
|
||||
* @return the shaded shape
|
||||
*/
|
||||
public IColormapShadedShape getShape(String cwa, String huc,
|
||||
IGraphicsTarget target, MapDescriptor descriptor)
|
||||
|
@ -74,7 +77,7 @@ public class FFMPShapeContainer {
|
|||
.createColormapShadedShape(descriptor.getGridGeometry(),
|
||||
true);
|
||||
|
||||
ConcurrentHashMap<String, IColormapShadedShape> cwaShapes = shadedShapes
|
||||
ConcurrentMap<String, IColormapShadedShape> cwaShapes = shadedShapes
|
||||
.get(cwa);
|
||||
|
||||
if (cwaShapes == null) {
|
||||
|
@ -89,43 +92,33 @@ public class FFMPShapeContainer {
|
|||
}
|
||||
|
||||
/**
|
||||
* return only drawable shape
|
||||
* Retrieves the shaded shape from the cache
|
||||
*
|
||||
* @param cwa
|
||||
* @param huc
|
||||
* @return
|
||||
* @return the shape if it exists, otherwise null
|
||||
*/
|
||||
public IColormapShadedShape getDrawableShape(String cwa, String huc) {
|
||||
|
||||
IColormapShadedShape shape = null;
|
||||
|
||||
try {
|
||||
shape = shadedShapes.get(cwa).get(huc);
|
||||
} catch (NullPointerException npe) {
|
||||
// System.out.println(cwa + " " + huc +
|
||||
// " Shape Not created yet!!!!");
|
||||
// do nothing
|
||||
if (cwa != null) {
|
||||
ConcurrentMap<String, IColormapShadedShape> innerMap = shadedShapes
|
||||
.get(cwa);
|
||||
if (innerMap != null && huc != null) {
|
||||
shape = innerMap.get(huc);
|
||||
}
|
||||
}
|
||||
|
||||
return shape;
|
||||
}
|
||||
|
||||
/**
|
||||
* clears the shapes
|
||||
*
|
||||
* @return
|
||||
* Disposes of each of the shaded shapes and clears the maps
|
||||
*/
|
||||
public void clear() {
|
||||
shadedShapes.clear();
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
for (String key : shadedShapes.keySet()) {
|
||||
ConcurrentHashMap<String, IColormapShadedShape> innerMap = shadedShapes
|
||||
.get(key);
|
||||
Iterator<IColormapShadedShape> itr = innerMap.values().iterator();
|
||||
while (itr.hasNext()) {
|
||||
itr.next().dispose();
|
||||
for (ConcurrentMap<String, IColormapShadedShape> innerMap : shadedShapes
|
||||
.values()) {
|
||||
for (IColormapShadedShape shp : innerMap.values()) {
|
||||
shp.dispose();
|
||||
}
|
||||
innerMap.clear();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue