diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/AbstractParmManager.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/AbstractParmManager.java index 18b211209b..562099d419 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/AbstractParmManager.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/AbstractParmManager.java @@ -104,6 +104,7 @@ import com.raytheon.viz.gfe.core.parm.vcparm.VCModuleJobPool; * 04/11/2013 16028 ryu Fixed setParmsRemoveISCDeps() to not remove * modified parms. * 05/02/2013 #1969 randerso Cleaned up and optimized processing of DBInvChangedNotification + * 05/14/2013 #2004 randerso Improved error handling * * * @@ -1073,9 +1074,9 @@ public abstract class AbstractParmManager implements IParmManager { parmsToAdd.add(p); } } catch (GFEServerException e) { - statusHandler.handle(Priority.EVENTA, + statusHandler.handle(Priority.PROBLEM, "Failure to instantiate parm in createParmInternal: " - + addParm.getParmID().toString()); + + addParm.getParmID().toString(), e); } } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/ParmManager.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/ParmManager.java index cfcd866cbc..ce6708d3d4 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/ParmManager.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/ParmManager.java @@ -76,6 +76,7 @@ import com.raytheon.viz.gfe.types.MutableInteger; * 05/02/13 #1969 randerso Added code to explicitly create the mutable database * if it doesn't exist. Used to just happen by accident * when getParmList was called. + * 05/14/13 #2004 randerso Corrected logging levels * * * @author bphillip @@ -185,7 +186,7 @@ public class ParmManager extends AbstractParmManager { @Override public Parm addParm(ParmID pid, boolean mutableParm, boolean displayable) { if (!isParmInDatabase(pid)) { - statusHandler.handle(Priority.EVENTA, + statusHandler.handle(Priority.PROBLEM, "Attempt to load a nonexistent parm: " + pid); return null; } @@ -251,7 +252,7 @@ public class ParmManager extends AbstractParmManager { for (int i = 0; i < parms.length; i++) { if (!this.parms.contains(parms[i])) { statusHandler.handle( - Priority.EVENTA, + Priority.DEBUG, "Attempt to delete unknown parm:" + parms[i].getParmID()); continue; @@ -1170,7 +1171,7 @@ public class ParmManager extends AbstractParmManager { return createParmInternal(pid, mutableParm, displayable); } catch (GFEServerException e) { statusHandler - .handle(Priority.EVENTA, + .handle(Priority.PROBLEM, "Failure to instantiate parm in createParmInternal: " + pid, e); return null; diff --git a/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/dialogs/ChooseDataPeriodDialog.java b/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/dialogs/ChooseDataPeriodDialog.java index 75114f9e6f..b989664b0b 100644 --- a/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/dialogs/ChooseDataPeriodDialog.java +++ b/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/dialogs/ChooseDataPeriodDialog.java @@ -49,6 +49,7 @@ import com.raytheon.uf.viz.core.IDisplayPaneContainer; import com.raytheon.viz.mpe.core.MPEDataManager; import com.raytheon.viz.mpe.core.MPEDataManager.MPEDateInfo; import com.raytheon.viz.mpe.ui.MPEDisplayManager; +import com.raytheon.viz.mpe.ui.TransmitRFCBiasProvider; import com.raytheon.viz.ui.EditorUtil; import com.raytheon.viz.ui.dialogs.CaveJFACEDialog; import com.raytheon.viz.ui.editor.IMultiPaneEditor; @@ -299,6 +300,7 @@ public class ChooseDataPeriodDialog extends CaveJFACEDialog { } else { restore(); } + TransmitRFCBiasProvider.setEnabled(true); } }); diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/config/DbAreaSourceDataAdaptor.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/config/DbAreaSourceDataAdaptor.java index b490e54ae8..3e9e82b24f 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/config/DbAreaSourceDataAdaptor.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/config/DbAreaSourceDataAdaptor.java @@ -16,6 +16,7 @@ import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.geospatial.SpatialQueryResult; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.viz.warngen.PreferenceUtil; +import com.raytheon.viz.warngen.gis.Area; import com.raytheon.viz.warngen.gis.ClosestPoint; import com.raytheon.viz.warngen.gis.GisUtil; import com.raytheon.viz.warngen.gis.GisUtil.Direction; @@ -38,7 +39,7 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory; * Mar 25, 2013 1810 jsanchez Allowed other values to be accepted as a true value for useDirs. * Mar 25, 2013 1605 jsanchez Set ClosestPoint's prepGeom. * Apr 24, 2013 1944 jsanchez Updated calculateLocationPortion visibility to public. - * May 2, 2013 1963 jsanchez Referenced calculatePortion from GisUtil. + * May 2, 2013 1963 jsanchez Referenced calculatePortion from GisUtil if intersection less than DEFAULT_PORTION_TOLERANCE. * * * @@ -177,10 +178,17 @@ public class DbAreaSourceDataAdaptor extends AbstractDbSourceDataAdaptor { PreparedGeometry prepGeom = PreparedGeometryFactory.prepare(geom); if (prepGeom.intersects(searchArea) && !prepGeom.within(searchArea)) { Geometry intersection = searchArea.intersection(geom); - partOfArea = GisUtil.asStringList(GisUtil.calculatePortion( - geom, intersection, false, false)); - if (attributes.get(suppressedDirectionsField) != null) { + double areaIntersection = intersection.getArea(); + double tolerCheck = geom.getArea() + * Area.DEFAULT_PORTION_TOLERANCE; + if (areaIntersection < tolerCheck) { + partOfArea = GisUtil.asStringList(GisUtil.calculatePortion( + geom, intersection, false, false)); + } + + if ((partOfArea != null) + && (attributes.get(suppressedDirectionsField) != null)) { String suppressedDirections = String.valueOf( attributes.get(suppressedDirectionsField)) .toLowerCase(); diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/GisUtil.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/GisUtil.java index 47573626a5..cb1f698737 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/GisUtil.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/GisUtil.java @@ -50,7 +50,7 @@ import com.vividsolutions.jts.geom.Geometry; * Feb 29, 2012 #13596 Qinglu Lin Added restoreAlaskaLon(). * May 9, 2012 #14887 Qinglu Lin Change 0.1 to 0.16875f for PORTION_OF_CENTER; * 0.10 to 0.0625 for EXTREME_DELTA; Added/modified code. - * May 1, 2013 1963 jsanchez Refactored calculatePortion to match A1. + * May 1, 2013 1963 jsanchez Refactored calculatePortion to match A1. Do not allow 'Central' to be included if East and West is included. * * * @author chammack @@ -100,7 +100,8 @@ public class GisUtil { } // Test for central by not being near adjacent borders. - if (iQuad.centralGeom != null && iQuad.centralGeom.contains(warnedArea)) { + if (useCentral && iQuad.centralGeom != null + && iQuad.centralGeom.contains(warnedArea)) { portions.add(Direction.CENTRAL); return portions; } @@ -146,7 +147,7 @@ public class GisUtil { } // Three typical quadrants in use. - if (iQuad.q == 3 && iQuad.q != 3) { + if (iQuad.q == 3 && iQuad.qq != 3) { if (iQuad.ne != 1 && (iQuad.ssw || iQuad.wsw)) { portions.add(Direction.SOUTH); portions.add(Direction.WEST); @@ -240,9 +241,7 @@ public class GisUtil { portions.add(Direction.EAST); } else if (iQuad.wnw || iQuad.wsw) { portions.add(Direction.WEST); - } - - if (iQuad.cc) { + } else if (iQuad.cc) { portions.add(Direction.CENTRAL); } diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/ImpactedQuadrants.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/ImpactedQuadrants.java index 441315d797..f361cf584e 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/ImpactedQuadrants.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/ImpactedQuadrants.java @@ -78,15 +78,34 @@ public class ImpactedQuadrants { protected int sw; /** - * q is the accumulation of the quadrants, qq is the accumulation of the sub - * quadrants + * q is the accumulation of the quadrants, */ - protected int q, qq; + protected int q; /** - * Extreme portions for north, south, east, and west. + * qq is the accumulation of the sub quadrants */ - protected int nnx, ssx, eex, wwx; + protected int qq; + + /** + * Extreme portions for north. + */ + protected int nnx; + + /** + * Extreme portions for south. + */ + protected int ssx; + + /** + * Extreme portions for east. + */ + protected int eex; + + /** + * Extreme portions for west. + */ + protected int wwx; /** * Accumulation of extreme portions. diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java index 22a24b2d9a..c7dd126109 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java @@ -137,6 +137,8 @@ import com.vividsolutions.jts.geom.Polygon; * Mar 28, 2013 DR 15974 D. Friedman Do not track removed GIDs. * Apr 11, 2013 1894 jsanchez Removed the ability to load/unload maps via bullet selection. This will be resolved in a follow on ticket. * Apr 30, 2013 DR 16118 Qinglu Lin For reissue (followup NEW), called redrawFromWarned() in okPressed(). + * May 17, 2013 DR 16118 Qinglu Lin Copied the fix from 13.4.1. + * May 17, 2013 2012 jsanchez Preserved the warned area if the hatched area source is the same when changing templates. * * * @author chammack @@ -994,7 +996,7 @@ public class WarngenDialog extends CaveSWTDialog implements .getAct()) == WarningAction.NEW) { redrawFromWarned(); } - + if ((followupData == null || (WarningAction.valueOf(followupData .getAct()) == WarningAction.CON && warngenLayer .conWarnAreaChanged(followupData))) @@ -1406,7 +1408,7 @@ public class WarngenDialog extends CaveSWTDialog implements return; String lastAreaSource = warngenLayer.getConfiguration() - .getGeospatialConfig().getAreaSource(); + .getHatchedAreaSource().getAreaSource(); // reset values setPolygonLocked(false); @@ -1468,12 +1470,17 @@ public class WarngenDialog extends CaveSWTDialog implements warngenLayer.clearWarningGeometries(); } - boolean snapHatchedAreaToPolygon = !warngenLayer.getConfiguration() - .getGeospatialConfig().getAreaSource() + boolean isDifferentAreaSources = !warngenLayer.getConfiguration() + .getHatchedAreaSource().getAreaSource() .equalsIgnoreCase(lastAreaSource); - + boolean snapHatchedAreaToPolygon = isDifferentAreaSources; + boolean preservedSelection = !isDifferentAreaSources; + // If template has a different hatched area source from the previous + // template, then the warned area would be based on the polygon and not + // preserved. try { - warngenLayer.updateWarnedAreas(snapHatchedAreaToPolygon); + warngenLayer.updateWarnedAreas(snapHatchedAreaToPolygon, + preservedSelection); } catch (VizException e1) { statusHandler.handle(Priority.PROBLEM, "WarnGen Error", e1); } diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenLayer.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenLayer.java index d204edf65f..3b0354618a 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenLayer.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenLayer.java @@ -174,6 +174,8 @@ import com.vividsolutions.jts.io.WKTReader; * 04/12/1013 DR 16045 Qinglu Lin Updated AreaHatcher's run() by calling removeDuplicateCoordinate(). * 04/23/1013 DR 16064 Qinglu Lin Added removeDuplicateGid() and applies it in populateStrings(). * 04/24/2013 1943 jsanchez Replaced used of areaConfig with areaSource. + * 05/16/2013 2008 jsanchez Allowed warned areas for follow ups to be resized to less than 10% + * 05/17/2013 DR 16064 Qinglu Lin Merged the fix done in 13.4.1. * * * @author mschenke @@ -1505,11 +1507,12 @@ public class WarngenLayer extends AbstractStormTrackResource { // Snap back to polygon state.setWarningPolygon(localToLatLon((Polygon) oldWarningPolygon)); newHatchedArea = (Geometry) oldWarningArea.clone(); - } else if (areaPercent < 10 && state.isMarked()) { + } else if (oldWarningPolygon.intersects(warningPolygon) == false + && areaPercent < 10 && state.isMarked()) { // snap back to last valid user selected area state.setWarningPolygon((Polygon) state .getMarkedWarningPolygon().clone()); - newHatchedArea = latLonToLocal(state.getMarkedWarningArea()); + newHatchedArea = state.getMarkedWarningArea(); state.resetMarked(); } else if (warningPolygon != null) { // want intersection of warningPolygon and oldWarningArea @@ -2957,13 +2960,14 @@ public class WarngenLayer extends AbstractStormTrackResource { } return slope; } - + /** - * Some counties/forecast zones have two GIDs, one is for the large portion of that - * county and the other is for the small portion, e.g., inlets of a bay. Prince William - * County, Virginia is such an example. As WarnGen needs to mark a hatched county with - * only one W, one of the GIDs needs to be filtered out. The approach in the method is - * to remove the GID for the area of smaller size. + * Some counties/forecast zones have two GIDs, one is for the large portion + * of that county and the other is for the small portion, e.g., inlets of a + * bay. Prince William County, Virginia is such an example. As WarnGen needs + * to mark a hatched county with only one W, one of the GIDs needs to be + * filtered out. The approach in the method is to remove the GID for the + * area of smaller size. */ private Set removeDuplicateGid(Set prefixes) { @@ -2972,7 +2976,7 @@ public class WarngenLayer extends AbstractStormTrackResource { Map fipsSize = new HashMap(); Map namePrefix = new HashMap(); - Iterator iter = prefixes.iterator(); + Iterator iter = prefixes.iterator(); String fips = null; String prefix = null; while (iter.hasNext()) { @@ -2981,14 +2985,14 @@ public class WarngenLayer extends AbstractStormTrackResource { for (GeospatialData f : geoData.features) { fips = getFips(f); Geometry geom = f.geometry; - if(prefix.equals(GeometryUtil.getPrefix(geom.getUserData()))) { + if (prefix.equals(GeometryUtil.getPrefix(geom.getUserData()))) { size = geom.getArea(); if (fipsSize.containsKey(fips)) { if (fipsSize.get(fips) < size) { fipsSize.put(fips, size); namePrefix.put(fips, prefix); break; - } + } } else { fipsSize.put(fips, size); namePrefix.put(fips, prefix); @@ -2998,5 +3002,4 @@ public class WarngenLayer extends AbstractStormTrackResource { } return new HashSet(namePrefix.values()); } - } diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/res/spring/gfe-common.xml b/edexOsgi/com.raytheon.edex.plugin.gfe/res/spring/gfe-common.xml index 95e20d6c2e..66b5cd8c4c 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/res/spring/gfe-common.xml +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/res/spring/gfe-common.xml @@ -49,6 +49,9 @@ class="com.raytheon.edex.plugin.gfe.cache.d2dparms.D2DParmIdCache" factory-method="getInstance" /> + + @@ -94,5 +97,17 @@ + + + + + + + + java.lang.Throwable + + + + diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/cache/d2dparms/D2DParmIdCache.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/cache/d2dparms/D2DParmIdCache.java index 57695e597e..f56c8d9a14 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/cache/d2dparms/D2DParmIdCache.java +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/cache/d2dparms/D2DParmIdCache.java @@ -21,6 +21,7 @@ package com.raytheon.edex.plugin.gfe.cache.d2dparms; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashMap; @@ -40,11 +41,13 @@ import com.raytheon.edex.plugin.gfe.server.database.D2DSatDatabase; import com.raytheon.edex.plugin.gfe.server.database.D2DSatDatabaseManager; import com.raytheon.edex.plugin.gfe.server.database.GridDatabase; import com.raytheon.edex.plugin.gfe.server.notify.GfeIngestNotificationFilter; +import com.raytheon.edex.plugin.gfe.util.SendNotifications; import com.raytheon.uf.common.dataplugin.PluginException; import com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID; import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID; import com.raytheon.uf.common.dataplugin.gfe.exception.GfeException; import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse; +import com.raytheon.uf.common.dataplugin.gfe.server.notify.DBInvChangeNotification; import com.raytheon.uf.common.dataplugin.gfe.server.notify.GridUpdateNotification; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; @@ -68,6 +71,7 @@ import com.raytheon.uf.edex.site.SiteAwareRegistry; * GridUpdateNotifications. * Mar 20, 2013 #1774 randerso Changed to use GFDD2DDao * Apr 01, 2013 #1774 randerso Moved wind component checking to GfeIngestNotificaionFilter + * May 14, 2013 #2004 randerso Added DBInvChangeNotifications when D2D data is purged * * * @@ -342,9 +346,13 @@ public class D2DParmIdCache { putParmIDList(parmIds); List currentDbInventory = this.getDatabaseIDs(); dbsToRemove.removeAll(currentDbInventory); + List invChgList = new ArrayList( + dbsToRemove.size()); for (DatabaseID dbId : dbsToRemove) { - GridParmManager.removeDbFromMap(dbId); + invChgList.add(new DBInvChangeNotification(null, Arrays + .asList(dbId), siteID)); } + SendNotifications.send(invChgList); // inform GfeIngestNotificationFilter of removed dbs GfeIngestNotificationFilter.purgeDbs(dbsToRemove); diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/GridParmManager.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/GridParmManager.java index b9e52aef28..891a36b158 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/GridParmManager.java +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/GridParmManager.java @@ -92,12 +92,13 @@ import com.raytheon.uf.edex.database.purge.PurgeLogger; * smartInit hdf5 data * 03/07/13 #1773 njensen Logged commitGrid() times * 03/15/13 #1795 njensen Sped up commitGrid() - * 03/20/2013 #1774 randerso Removed dead method, changed to use new + * 03/20/13 #1774 randerso Removed dead method, changed to use new * D2DGridDatabase constructor - * 04/23/2013 #1949 rjpeter Added inventory retrieval for a given time range. - * 05/02/13 #1969 randerso Fixed possible null pointer in getParmList + * 04/23/13 #1949 rjpeter Added inventory retrieval for a given time range. + * 05/02/13 #1969 randerso Fixed possible null pointer in getParmList * Removed inventory from DBInvChangedNotification - * 05/03/13 #1974 randerso Fixed error logging to include stack trace + * 05/03/13 #1974 randerso Fixed error logging to include stack trace + * 05/14/13 #2004 randerso Added methods to synch GridParmManager across JVMs * * * @author bphillip @@ -1189,7 +1190,7 @@ public class GridParmManager { * * @param dbId * The database ID of the database to retrieve - * @return The Grid Database + * @return The Grid Database or null if database not available * @throws GfeException */ public static GridDatabase getDb(DatabaseID dbId) throws GfeException { @@ -1398,4 +1399,34 @@ public class GridParmManager { dbMap.remove(id); } + public static void processNotification(Object msg) { + if (msg instanceof List) { + for (Object obj : (List) msg) { + if (obj instanceof GfeNotification) { + handleGfeNotification((GfeNotification) obj); + } + } + } else if (msg instanceof GfeNotification) { + handleGfeNotification((GfeNotification) msg); + } + } + + private static void handleGfeNotification(GfeNotification notif) { + if (notif instanceof DBInvChangeNotification) { + DBInvChangeNotification invChanged = (DBInvChangeNotification) notif; + + for (DatabaseID dbId : invChanged.getAdditions()) { + try { + getDb(dbId); + } catch (GfeException e) { + statusHandler.handle(Priority.PROBLEM, + e.getLocalizedMessage(), e); + } + } + + for (DatabaseID dbId : invChanged.getDeletions()) { + removeDbFromMap(dbId); + } + } + } } diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.level/src/com/raytheon/uf/common/dataplugin/level/mapping/LevelMappingFactory.java b/edexOsgi/com.raytheon.uf.common.dataplugin.level/src/com/raytheon/uf/common/dataplugin/level/mapping/LevelMappingFactory.java index da3296fa38..58a42fed1c 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.level/src/com/raytheon/uf/common/dataplugin/level/mapping/LevelMappingFactory.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.level/src/com/raytheon/uf/common/dataplugin/level/mapping/LevelMappingFactory.java @@ -26,6 +26,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.concurrent.locks.ReentrantReadWriteLock; import javax.xml.bind.JAXB; @@ -50,8 +51,11 @@ import com.raytheon.uf.common.status.UFStatus.Priority; * 11/16/2009 #3120 rjpeter Initial version * 11/21/2009 #3576 rjpeter Added group capability * 04/17/2013 #1913 randerso Moved to common + * 05/16/2013 #2010 randerso Added read/write locking to mutable maps * - * @author rjpeter + * + * + * @author rjpeter * @version 1.0 */ public class LevelMappingFactory { @@ -65,11 +69,15 @@ public class LevelMappingFactory { private Map keyToLevelMappings = new HashMap(); - private boolean levelToLevelMappingsInitialized = false; + private volatile boolean levelToLevelMappingsInitialized = false; + + private ReentrantReadWriteLock levelToLevelLock = new ReentrantReadWriteLock(); private Map levelToLevelMappings = new HashMap(); - private boolean groupToMasterLevelsInitialized = false; + private volatile boolean groupToMasterLevelsInitialized = false; + + private ReentrantReadWriteLock groupToMasterLevelsLock = new ReentrantReadWriteLock(); private Map>> groupToMasterLevels = new HashMap>>(); @@ -110,6 +118,14 @@ public class LevelMappingFactory { } } + + try { + initializeLevelToLevelMappings(); + initializeGroupToMasterLevels(); + } catch (CommunicationException e) { + statusHandler.error("Error initializing LevelMappingFactory for: " + + filePath, e); + } long finish = System.currentTimeMillis(); System.out.println("LevelMappingFactory initialization took [" + (finish - start) + "] ms"); @@ -124,7 +140,14 @@ public class LevelMappingFactory { if (!levelToLevelMappingsInitialized) { initializeLevelToLevelMappings(); } - return levelToLevelMappings.get(level); + + levelToLevelLock.readLock().lock(); + try { + LevelMapping retVal = levelToLevelMappings.get(level); + return retVal; + } finally { + levelToLevelLock.readLock().unlock(); + } } public Collection getAllLevelMappings() { @@ -135,7 +158,14 @@ public class LevelMappingFactory { if (!levelToLevelMappingsInitialized) { initializeLevelToLevelMappings(); } - return levelToLevelMappings.keySet(); + + levelToLevelLock.readLock().lock(); + try { + Set retVal = levelToLevelMappings.keySet(); + return retVal; + } finally { + levelToLevelLock.readLock().unlock(); + } } public Map> getLevelMapForGroup(String group) @@ -143,61 +173,85 @@ public class LevelMappingFactory { if (!groupToMasterLevelsInitialized) { initializeGroupToMasterLevels(); } - return groupToMasterLevels.get(group); + + groupToMasterLevelsLock.readLock().lock(); + try { + Map> retVal = groupToMasterLevels + .get(group); + return retVal; + } finally { + groupToMasterLevelsLock.readLock().unlock(); + } } private void initializeLevelToLevelMappings() throws CommunicationException { - for (LevelMapping mapping : keyToLevelMappings.values()) { - String group = mapping.getGroup(); - - for (Level l : mapping.getLevels()) { - if (levelToLevelMappings.containsKey(l)) { - LevelMapping oldMapping = levelToLevelMappings.get(l); - // Only replace the old level mapping if we have less - // levels than the old mapping - // This should cause the most specific mapping to be - // used - if (mapping.getLevels().size() < oldMapping.getLevels() - .size()) { - levelToLevelMappings.put(l, mapping); + // acquire the write lock + levelToLevelLock.writeLock().lock(); + try { + // verify some other thread hasn't already initialized + if (!levelToLevelMappingsInitialized) { + for (LevelMapping mapping : keyToLevelMappings.values()) { + for (Level l : mapping.getLevels()) { + // Only replace the old level mapping if we have + // less levels than the old mapping + // This should cause the most specific mapping to be + // used + LevelMapping oldMapping = levelToLevelMappings.get(l); + if (oldMapping == null + || mapping.getLevels().size() < oldMapping + .getLevels().size()) { + levelToLevelMappings.put(l, mapping); + } } - } else { - levelToLevelMappings.put(l, mapping); } + levelToLevelMappingsInitialized = true; } + } finally { + // release the write lock + levelToLevelLock.writeLock().unlock(); } - levelToLevelMappingsInitialized = true; } private void initializeGroupToMasterLevels() throws CommunicationException { - for (LevelMapping mapping : keyToLevelMappings.values()) { - String group = mapping.getGroup(); - Map> masterLevels = null; + // acquire the write lock + groupToMasterLevelsLock.writeLock().lock(); + try { + // verify some other thread hasn't already initialized + if (!groupToMasterLevelsInitialized) { + for (LevelMapping mapping : keyToLevelMappings.values()) { + String group = mapping.getGroup(); + Map> masterLevels = null; - if (group != null) { - masterLevels = groupToMasterLevels.get(mapping.getGroup()); - if (masterLevels == null) { - masterLevels = new HashMap>(); - groupToMasterLevels.put(group, masterLevels); - } - } - - for (Level l : mapping.getLevels()) { - - // populate grouping map - if (masterLevels != null) { - MasterLevel ml = l.getMasterLevel(); - Set levels = masterLevels.get(ml); - - if (levels == null) { - levels = new HashSet(); - masterLevels.put(ml, levels); + if (group != null) { + masterLevels = groupToMasterLevels.get(mapping + .getGroup()); + if (masterLevels == null) { + masterLevels = new HashMap>(); + groupToMasterLevels.put(group, masterLevels); + } } - levels.add(l); + for (Level l : mapping.getLevels()) { + + // populate grouping map + if (masterLevels != null) { + MasterLevel ml = l.getMasterLevel(); + Set levels = masterLevels.get(ml); + + if (levels == null) { + levels = new HashSet(); + masterLevels.put(ml, levels); + } + + levels.add(l); + } + } } + groupToMasterLevelsInitialized = true; } + } finally { + // release the write lock + groupToMasterLevelsLock.writeLock().unlock(); } - groupToMasterLevelsInitialized = true; } } diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/background/NsharpIcingPaneBackground.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/background/NsharpIcingPaneBackground.java index e9f5775a51..ddd2344e6e 100644 --- a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/background/NsharpIcingPaneBackground.java +++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/background/NsharpIcingPaneBackground.java @@ -21,7 +21,9 @@ package gov.noaa.nws.ncep.ui.nsharp.background; import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingLayer; +import gov.noaa.nws.ncep.ui.nsharp.NsharpConfigManager; import gov.noaa.nws.ncep.ui.nsharp.NsharpConstants; +import gov.noaa.nws.ncep.ui.nsharp.NsharpGraphProperty; import gov.noaa.nws.ncep.ui.nsharp.NsharpLineProperty; import gov.noaa.nws.ncep.ui.nsharp.display.NsharpSkewTPaneDescriptor; @@ -58,6 +60,7 @@ public class NsharpIcingPaneBackground extends NsharpGenericPaneBackground { private int paneHeight = NsharpConstants.SKEWT_HEIGHT; private float yMagFactor=1; private float xMagFactor=1; + private NsharpGraphProperty graphConfigProperty; public NsharpIcingPaneBackground(NsharpSkewTPaneDescriptor desc) { super(); @@ -66,7 +69,8 @@ public class NsharpIcingPaneBackground extends NsharpGenericPaneBackground { pe = new PixelExtent(this.rectangle); world = new WGraphics(this.rectangle); - + NsharpConfigManager configMgr = NsharpConfigManager.getInstance(); + graphConfigProperty = configMgr.retrieveNsharpConfigStoreFromFs().getGraphProperty(); //System.out.println("NsharpIcingPaneBackground created"); this.desc = desc; } @@ -372,7 +376,11 @@ public class NsharpIcingPaneBackground extends NsharpGenericPaneBackground { double pX= world.mapX( NsharpConstants.ICING_RELATIVE_HUMIDITY_RIGHT); if(pX < xmax) xmax = pX; - double dispX = xmax - 30 * currentZoomLevel * xMagFactor; + + double windBarbSizfactor = graphConfigProperty.getWindBarbSize()/2.2f; + if(windBarbSizfactor < 1) + windBarbSizfactor=1; + double dispX = xmax - 50 * currentZoomLevel * xMagFactor* windBarbSizfactor; Coordinate cumap = world.unMap(dispX,ymax); diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/background/NsharpSkewTPaneBackground.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/background/NsharpSkewTPaneBackground.java index d70188d11f..d1500a0788 100644 --- a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/background/NsharpSkewTPaneBackground.java +++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/background/NsharpSkewTPaneBackground.java @@ -68,6 +68,8 @@ public class NsharpSkewTPaneBackground extends NsharpGenericPaneBackground { private double currentZoomLevel=1; private int skewtWidth=NsharpConstants.SKEWT_WIDTH; private float xRatio=1; + private NsharpGraphProperty graphConfigProperty; + private Float[]mainMixingRatios = { .5f, 1f, 2f, 5f, 10f, 20f}; private float[]mixingRatios = @@ -80,7 +82,7 @@ public class NsharpSkewTPaneBackground extends NsharpGenericPaneBackground { 1000, 100, 10, -40, 273, 20); private static final double Rd = 0.2870586d; - private NsharpGraphProperty graphConfigProperty; + private int tempOffset = 0; public NsharpSkewTPaneBackground(NsharpSkewTPaneDescriptor desc) { super(); @@ -96,8 +98,9 @@ public class NsharpSkewTPaneBackground extends NsharpGenericPaneBackground { NsharpConstants.right, NsharpConstants.bottom); //System.out.println("NsharpSkewTPaneBackground created"); this.desc = desc; + NsharpConfigManager configMgr = NsharpConfigManager.getInstance(); - graphConfigProperty = configMgr.retrieveNsharpConfigStoreFromFs().getGraphProperty(); + graphConfigProperty = configMgr.retrieveNsharpConfigStoreFromFs().getGraphProperty(); pressureMainList = Arrays.asList(NsharpConstants.PRESSURE_MAIN_LEVELS); mixRatioMainList = Arrays.asList(mainMixingRatios); } @@ -363,7 +366,7 @@ public class NsharpSkewTPaneBackground extends NsharpGenericPaneBackground { VerticalAlignment.MIDDLE, null); } else{ - // only mark pressure line to a small length + // only mark pressure line to a small lengthprivate NsharpGraphProperty graphConfigProperty; xend = xmin+15* currentZoomLevel*xRatio; } target.drawLine(xmin, world.mapY(coor.y), 0.0, xend, @@ -825,7 +828,10 @@ public class NsharpSkewTPaneBackground extends NsharpGenericPaneBackground { double pX= world.mapX( NsharpConstants.right); if(pX < xmax) xmax = pX; - double dispX = xmax - 20 * currentZoomLevel * xRatio; + double windBarbSizfactor = graphConfigProperty.getWindBarbSize()/1.6f; + if(windBarbSizfactor < 1) + windBarbSizfactor=1; + double dispX = xmax - 40 * currentZoomLevel * xRatio * windBarbSizfactor; Coordinate cumap = world.unMap(dispX,ymax); return cumap.x; diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/background/NsharpTurbulencePaneBackground.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/background/NsharpTurbulencePaneBackground.java index 75b07d3b03..c26f15fdd6 100644 --- a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/background/NsharpTurbulencePaneBackground.java +++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/background/NsharpTurbulencePaneBackground.java @@ -20,7 +20,9 @@ */ package gov.noaa.nws.ncep.ui.nsharp.background; import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingLayer; +import gov.noaa.nws.ncep.ui.nsharp.NsharpConfigManager; import gov.noaa.nws.ncep.ui.nsharp.NsharpConstants; +import gov.noaa.nws.ncep.ui.nsharp.NsharpGraphProperty; import gov.noaa.nws.ncep.ui.nsharp.NsharpLineProperty; import gov.noaa.nws.ncep.ui.nsharp.display.NsharpSkewTPaneDescriptor; @@ -54,6 +56,7 @@ public class NsharpTurbulencePaneBackground extends NsharpGenericPaneBackground{ private int paneHeight = NsharpConstants.SKEWT_HEIGHT; private float yMagFactor=1; private float xMagFactor=1; + private NsharpGraphProperty graphConfigProperty; public NsharpTurbulencePaneBackground(NsharpSkewTPaneDescriptor desc) { super(); @@ -61,6 +64,8 @@ public class NsharpTurbulencePaneBackground extends NsharpGenericPaneBackground{ NsharpConstants.TURB_WIDTH, NsharpConstants.TURB_HEIGHT); pe = new PixelExtent(this.rectangle); world = new WGraphics(this.rectangle); + NsharpConfigManager configMgr = NsharpConfigManager.getInstance(); + graphConfigProperty = configMgr.retrieveNsharpConfigStoreFromFs().getGraphProperty(); this.desc = desc; } @Override @@ -347,7 +352,10 @@ public class NsharpTurbulencePaneBackground extends NsharpGenericPaneBackground{ double pX= world.mapX( NsharpConstants.TURBULENCE_LN_RICHARDSON_NUMBER_LEFT); if(pX < xmax) xmax = pX; - double dispX = xmax - 50 * currentZoomLevel * xMagFactor; + double windBarbSizfactor = graphConfigProperty.getWindBarbSize()/2f; + if(windBarbSizfactor < 1) + windBarbSizfactor=1; + double dispX = xmax - 50 * currentZoomLevel * xMagFactor* windBarbSizfactor; Coordinate cumap = world.unMap(dispX,ymax); diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpSkewTPaneResource.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpSkewTPaneResource.java index 992b8ed8eb..14c79c248f 100644 --- a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpSkewTPaneResource.java +++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpSkewTPaneResource.java @@ -784,7 +784,7 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{ WGraphics world, RGB iicolor, List sndLys, double xPosition, double botPress)throws VizException { if(sndLys.size()< 4) return; - ArrayList> windList = new ArrayList>(); + //ArrayList> windList = new ArrayList>(); List layerStateList = new ArrayList(); float lastHeight = -9999; RGB icolor = iicolor;//graphConfigProperty.getWindBarbColor(); @@ -843,10 +843,10 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{ } double windX = xPosition; double windY=0; - double barbScaleFactorx, barbScaleFactory; - barbScaleFactorx = zoomLevel; - barbScaleFactory = zoomLevel; - List locations = new ArrayList(); + //double barbScaleFactorx, barbScaleFactory; + //barbScaleFactorx = zoomLevel; + // barbScaleFactory = zoomLevel; + //List locations = new ArrayList(); //System.out.println("zoom="+zoomLevel +"world viewYmin="+world.getViewYmin()+" viewYmax="+world.getViewYmax()+" wolrdYmin="+ world.getWorldYmin()+" wolrdYmax="+ world.getWorldYmax() // +"world viewXmin="+world.getViewXmin()+" viewXmax="+world.getViewXmax()+" wolrdXmin="+ world.getWorldXmin()+" wolrdXmax="+ world.getWorldXmax()); //plot wind barbs @@ -876,30 +876,30 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{ // Get the vertical ordinate. if(currentGraphMode== NsharpConstants.GRAPH_SKEWT){ windY = NsharpWxMath.getSkewTXY(pressure, 0).y; - barbScaleFactorx = 0.6*zoomLevel; - barbScaleFactory= zoomLevel; + //barbScaleFactorx = 0.6*zoomLevel; + //barbScaleFactory= zoomLevel; } else if(currentGraphMode== NsharpConstants.GRAPH_ICING ){ //Chin:Y axis (pressure) is scaled using log scale and increaing downward //WorldYmin= at pressure 1000,its value actually is 1000 (max), wolrdYmax = at pressure 300, its value is 825 (min) windY = world.getWorldYmax() + (world.getWorldYmin()-icingBackground.toLogScale(pressure)); - barbScaleFactorx = 1.3*zoomLevel; - barbScaleFactory= 2.5*zoomLevel;//experimental value: depends on the world coordinate size set + //barbScaleFactorx = 1.3*zoomLevel; + //barbScaleFactory= 2.5*zoomLevel;//experimental value: depends on the world coordinate size set }else if( currentGraphMode== NsharpConstants.GRAPH_TURB){ //Chin:Y axis (pressure) is scaled using log scale and increaing downward //WorldYmin= at pressure 1000,its value actually is 1000 (max), wolrdYmax = at pressure 300, its value is 825 (min) windY = world.getWorldYmax() + (world.getWorldYmin()-turbBackground.toLogScale(pressure)); - barbScaleFactorx = .12*zoomLevel;//experimental value: depends on the world coordinate size set - barbScaleFactory=3.8*zoomLevel; + //barbScaleFactorx = .12*zoomLevel;//experimental value: depends on the world coordinate size set + //barbScaleFactory=3.8*zoomLevel; } else continue; if(ele.myState.equals(eleState.UNPICKED)){ - double[] loc= {world.mapX(windX), world.mapY(windY)}; - locations.add(loc); - continue; - //spd=0.1f; + //double[] loc= {world.mapX(windX), world.mapY(windY)}; + //locations.add(loc); + continue; + //spd=0.1f;//Chin::if we want pgen to draw unpicked wind as a circle, then set this. } //System.out.println("spd="+spd+" dir="+dir); /* @@ -1356,7 +1356,7 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{ str.verticallAlignment = VerticalAlignment.TOP; Rectangle2D rect = target.getStringsBounds(str); PixelExtent boxExt; - if(cursorInSkewT== true){ + if(cursorInSkewT== true && currentGraphMode == NsharpConstants.GRAPH_SKEWT){ boxExt = new PixelExtent(dispX,dispX+(rect.getWidth()+1)*hRatio,dispY-1*vRatio, dispY+rect.getHeight()*vRatio*4); //blank out box, should draw this first and then draw data on top of it target.drawShadedRect(boxExt, NsharpConstants.color_black, 1f, null); @@ -1691,8 +1691,6 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{ if(curseToggledFontLevel < CURSER_STRING_OFF) drawNsharpSkewtCursorData(target); } - //} - }// end of currentGraphMode= NsharpConstants.GRAPH_SKEWT else if(currentGraphMode == NsharpConstants.GRAPH_ICING){ paintIcing( currentZoomLevel, target); diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpWitoPaneResource.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpWitoPaneResource.java index fab5b42575..cdfb70d171 100644 --- a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpWitoPaneResource.java +++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpWitoPaneResource.java @@ -281,7 +281,7 @@ public class NsharpWitoPaneResource extends NsharpAbstractPaneResource{ shNcolor = new NsharpShapeAndLineProperty(); shNcolor.setShape(target.createWireframeShape(false,descriptor) ); IWireframeShape shapeG= shNcolor.getShape(); - shapeG.allocate(soundingLys.size()*2); + shapeG.allocate(soundingLys.size()*2); shNcolor.getLp().setLineColor(NsharpConstants.color_green); windBoxWindRscShapeList.add(shNcolor); shNcolor = new NsharpShapeAndLineProperty(); @@ -352,6 +352,7 @@ public class NsharpWitoPaneResource extends NsharpAbstractPaneResource{ shapeC.compile(); shapePline.compile(); } + private static int k=0; /* * Chin:: NOTE::: * This plotting function is based on the algorithm of plot_advectionprofile() at xwvid5.c of Bignsharp source code @@ -443,14 +444,23 @@ public class NsharpWitoPaneResource extends NsharpAbstractPaneResource{ * Should be used only when a new resource is becoming Current active resource to be displayed. * */ - public void createAllWireFrameShapes(){ + public synchronized void createAllWireFrameShapes(){ if(target== null || rscHandler== null || inSidePane ) return; //System.out.println("whitoPane="+this.toString()+" createAllWireFrameShapes called"); rscHandler.repopulateSndgData(); disposeAllWireFrameShapes(); - createRscWireFrameShapes();; + if(soundingLys != null){ + NsharpGenericPaneBackground skewtBgd = rscHandler.getSkewtPaneRsc().getActiveBackground(); + if(skewtBgd!=null){ + vpc = skewtBgd.getViewablePressureContainer(soundingLys); + vplc = skewtBgd.getViewablePressureLinesContainer(); + } + createRscOmegaShape(); + createRscWindBoxWindShape(); + createRscVerticalWindShape(); + } //create static shape createBkgOmegaShape(); createBkgWindBoxShape(); @@ -475,12 +485,15 @@ public class NsharpWitoPaneResource extends NsharpAbstractPaneResource{ public void disposeAllWireFrameShapes(){ disposeRscWireFrameShapes(); //also dispose static background shpae - if(omegaBkgShape!=null) + if(omegaBkgShape!=null){ omegaBkgShape.dispose(); + omegaBkgShape=null; + } - if(windBoxBkgShape!=null) + if(windBoxBkgShape!=null){ windBoxBkgShape.dispose(); - + windBoxBkgShape=null; + } } public void disposeRscWireFrameShapes(){ if(omegaRscShape!=null){ diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/view/NsharpPaneConfigDialog.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/view/NsharpPaneConfigDialog.java index 571085fd85..ab153ac64e 100644 --- a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/view/NsharpPaneConfigDialog.java +++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/view/NsharpPaneConfigDialog.java @@ -113,7 +113,7 @@ public class NsharpPaneConfigDialog extends Dialog { paneCfgCombo.add(NsharpConstants.PANE_CONFIGURATION_NAME[i]); if(paneConfigurationName.equals(NsharpConstants.PANE_CONFIGURATION_NAME[i])){ selectIndex = i; - break; + //break; } } diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/view/NsharpWindBarbConfigDialog.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/view/NsharpWindBarbConfigDialog.java index ccac9ac792..07503cc9f6 100644 --- a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/view/NsharpWindBarbConfigDialog.java +++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/view/NsharpWindBarbConfigDialog.java @@ -209,7 +209,7 @@ public class NsharpWindBarbConfigDialog extends Dialog { mb = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK); - mb.setMessage( "Input Error! Should be greater than 0"); + mb.setMessage( "Input Error! "); } @Override public Control createDialogArea(Composite parent) { @@ -248,9 +248,15 @@ public class NsharpWindBarbConfigDialog extends Dialog { } } textStr = windBarbSizeText.getText(); - if((textStr != null) && !(textStr.isEmpty())){ - curSize = Float.parseFloat(textStr); - if(curSize <= 0){ + if((textStr != null) && !(textStr.isEmpty()) ){ + try{ + curSize = Float.parseFloat(textStr); + } + catch (NumberFormatException e){ + mb.open(); + return false; + } + if(curSize <= 0 || curSize > 15){ curSize=1; windBarbSizeText.setText(Float.toString(curSize)); mb.open(); @@ -259,8 +265,14 @@ public class NsharpWindBarbConfigDialog extends Dialog { } textStr = windBarbWidthText.getText(); if((textStr != null) && !(textStr.isEmpty())){ - curLineWidth = Float.parseFloat(textStr); - if(curLineWidth <=0){ + try{ + curLineWidth = Float.parseFloat(textStr); + } + catch (NumberFormatException e){ + mb.open(); + return false; + } + if(curLineWidth <=0 || curLineWidth > 7){ curLineWidth=1; windBarbWidthText.setText(Float.toString(curLineWidth)); mb.open(); diff --git a/rpms/awips2.core/Installer.ldm/component.spec b/rpms/awips2.core/Installer.ldm/component.spec index e17297583b..8d7a82ac97 100644 --- a/rpms/awips2.core/Installer.ldm/component.spec +++ b/rpms/awips2.core/Installer.ldm/component.spec @@ -1,5 +1,7 @@ -%define _ldm_version 6.11.2 -%define _ldm_src_tar awips2-ldm.%{_ldm_version}.tar.gz +%define _ldm_version 6.11.5 +%define _ldm_src_tar ldm-%{_ldm_version}.tar.gz +# ldm-%{_ldm_version}.tar.gz is tarred up ldm-%{_ldm_version}/src dir after +# ISG makes retrans changes # # AWIPS II LDM Spec File # @@ -18,10 +20,8 @@ Vendor: Raytheon Packager: Bryan Kowal AutoReq: no -Requires: qpid-cpp-client = 0.7.946106-28.el5.centos.1 -Requires: qpid-cpp-client-devel = 0.7.946106-28.el5.centos.1 +Requires: awips2-notification Requires: zlib-devel -Requires: /usr/lib/libz.a provides: awips2-ldm provides: awips2-base-component @@ -55,6 +55,21 @@ if [ $? -ne 0 ]; then exit 1 fi +/bin/mkdir -p %{_build_root}/etc/ld.so.conf.d +if [ $? -ne 0 ]; then + exit 1 +fi + +/bin/mkdir -p %{_build_root}/etc/logrotate.d +if [ $? -ne 0 ]; then + exit 1 +fi + +/bin/mkdir -p %{_build_root}/etc/init.d +if [ $? -ne 0 ]; then + exit 1 +fi + %build %install @@ -118,6 +133,21 @@ if [ $? -ne 0 ]; then exit 1 fi +/bin/cp ld.so.conf.d/* %{_build_root}/etc/ld.so.conf.d +if [ $? -ne 0 ]; then + exit 1 +fi + +/bin/cp logrotate.d/* %{_build_root}/etc/logrotate.d +if [ $? -ne 0 ]; then + exit 1 +fi + +/bin/cp init.d/* %{_build_root}/etc/init.d +if [ $? -ne 0 ]; then + exit 1 +fi + %pre if [ -d /tmp/ldm ]; then rm -rf /tmp/ldm @@ -126,7 +156,7 @@ mkdir -p /tmp/ldm for dir in etc .ssh; do if [ -d /usr/local/ldm/${dir} ]; then - scp -qrp /usr/local/${dir} /tmp/ldm + scp -qrp /usr/local/ldm/${dir} /tmp/ldm fi done @@ -139,12 +169,12 @@ _myHost=`echo ${_myHost} | cut -f1 -d'-'` pushd . > /dev/null 2>&1 cd ${_ldm_dir}/SOURCES # unpack the ldm source -/bin/tar -xf awips2-ldm.%{_ldm_version}.tar.gz \ +/bin/tar -xf %{_ldm_src_tar} \ -C ${_ldm_dir} if [ $? -ne 0 ]; then exit 1 fi -rm -f awips2-ldm.%{_ldm_version}.tar.gz +rm -f %{_ldm_src_tar} if [ $? -ne 0 ]; then exit 1 fi @@ -400,4 +430,7 @@ rm -rf ${RPM_BUILD_ROOT} %dir /usr/local/ldm/SOURCES /usr/local/ldm/SOURCES/* -%attr(755,root,root) /etc/profile.d/awipsLDM.csh \ No newline at end of file +%attr(755,root,root) /etc/profile.d/awipsLDM.csh +%attr(755,root,root) /etc/ld.so.conf.d/awips2-ldm-i386.conf +%attr(755,root,root) /etc/ld.so.conf.d/ldm.log +%attr(755,root,root) /etc/init.d/ldmcp diff --git a/rpms/awips2.core/Installer.ldm/patch/bin/start_ldm b/rpms/awips2.core/Installer.ldm/patch/bin/start_ldm new file mode 100644 index 0000000000..c1c16383e5 --- /dev/null +++ b/rpms/awips2.core/Installer.ldm/patch/bin/start_ldm @@ -0,0 +1,59 @@ +#!/bin/bash + +# Check for necessary named pipes (FIFOs) + +myhost=`hostname | awk -F'-' '{ print substr($1,1,length($1)-1)}'` + +# Check for the host type nad perform operations accordingly + +if [ "$myhost" = "cpsbn" ]; then + + echo "Checking for availability of named pipes" + if [ -p /dev/p_LOG ];then + echo "Pipe /dev/p_LOG exists" + else + mknod /dev/p_LOG p + fi + chmod 664 /dev/p_LOG && chgrp fxalpha /dev/p_LOG + + if [ -p /dev/p_LOST ];then + echo "Pipe /dev/p_LOST exists" + else + mknod /dev/p_LOST p + fi + chmod 664 /dev/p_LOST && chgrp fxalpha /dev/p_LOST + + if [ -f /etc/rc.config.d/AWIPS ];then + . /etc/rc.config.d/AWIPS + else + echo "AWIPS file not found.Install AWIPS and proceed." + echo "Exiting." + exit $? + fi + +# Start AWIPS-I retransmission process +# Move to a2cp1apps to prevent duplicate retransmission request from both CPs +# $PROJECT/bin/start_sbn_retransmit + +# Setup shared memory for LDM to store retransmission params + + su - ldm -c "acq_ldm_getshm -m0" + +else + echo "It seems like host(`hostname`) is NOT a downlink CP." + echo "Do you still want to start LDM (y/n) [default=n]?" + read ch + if [ $ch != 'y' -o $ch != 'Y' ];then + echo "Exiting." + exit 1 + fi +fi + + +# Start LDM + +su - ldm -c "ldmadmin start" + + +echo "Done." + diff --git a/rpms/awips2.core/Installer.ldm/patch/bin/stop_ldm b/rpms/awips2.core/Installer.ldm/patch/bin/stop_ldm new file mode 100644 index 0000000000..5b80c79ff1 --- /dev/null +++ b/rpms/awips2.core/Installer.ldm/patch/bin/stop_ldm @@ -0,0 +1,21 @@ +#!/bin/bash + + +if [ -f /etc/rc.config.d/AWIPS ];then + . /etc/rc.config.d/AWIPS +fi + +#echo "Halting retransmission process" +#pid=`ps -ef |grep start_sbn_retransmit|grep -v grep | awk '{print $2}'` +#kill -s SIGKILL $pid + +echo "Stopping ldm service" + +su - ldm -c "ldmadmin stop" + +echo "Releasing shared memory resources" + +su - ldm -c "acq_ldm_freeshm -m0" + +echo "Done." + diff --git a/rpms/awips2.core/Installer.ldm/patch/etc/ldmd.conf.gum b/rpms/awips2.core/Installer.ldm/patch/etc/ldmd.conf.gum index 562afe8ffe..12286773bc 100644 --- a/rpms/awips2.core/Installer.ldm/patch/etc/ldmd.conf.gum +++ b/rpms/awips2.core/Installer.ldm/patch/etc/ldmd.conf.gum @@ -53,20 +53,11 @@ # are started by the "exec" command and are in the same process group. # #EXEC "pqact" - # dvbs shared memory ingest processes - -EXEC "dvbs_multicast -b 40000 -m 224.0.1.1" -EXEC "dvbs_multicast -b 40000 -m 224.0.1.2" -EXEC "dvbs_multicast -b 40000 -m 224.0.1.3" -EXEC "dvbs_multicast -b 40000 -m 224.0.1.4" -EXEC "dvbs_multicast -b 40000 -m 224.0.1.5" - # - # readnoaaport shared memory readers -EXEC "readnoaaport -m 224.0.1.1 -n -u 3 -t mhs -r 1" -EXEC "readnoaaport -m 224.0.1.2 -n -u 4 -t mhs -r 1" -EXEC "readnoaaport -m 224.0.1.3 -n -u 5 -t mhs -r 1" -EXEC "readnoaaport -m 224.0.1.4 -n -u 6 -t mhs -r 1" -EXEC "readnoaaport -m 224.0.1.5 -n -u 7 -t mhs -r 1" +EXEC "noaaportIngester -m 224.0.1.1 -n -u 3 -t mhs -r 1 -s NMC" +EXEC "noaaportIngester -m 224.0.1.2 -n -u 4 -t mhs -r 1 -s GOES" +EXEC "noaaportIngester -m 224.0.1.3 -n -u 5 -t mhs -r 1 -s NMC2" +EXEC "noaaportIngester -m 224.0.1.4 -n -u 6 -t mhs -r 1 -s NOAAPORT_OPT" +EXEC "noaaportIngester -m 224.0.1.5 -n -u 7 -t mhs -r 1 -s NMC3" # # rtstats uses the LDM to send product latency statistics to the UPC. # For more info on rtstats please see the man page. diff --git a/rpms/awips2.core/Installer.ldm/patch/etc/ldmd.conf.hfo b/rpms/awips2.core/Installer.ldm/patch/etc/ldmd.conf.hfo index 562afe8ffe..12286773bc 100644 --- a/rpms/awips2.core/Installer.ldm/patch/etc/ldmd.conf.hfo +++ b/rpms/awips2.core/Installer.ldm/patch/etc/ldmd.conf.hfo @@ -53,20 +53,11 @@ # are started by the "exec" command and are in the same process group. # #EXEC "pqact" - # dvbs shared memory ingest processes - -EXEC "dvbs_multicast -b 40000 -m 224.0.1.1" -EXEC "dvbs_multicast -b 40000 -m 224.0.1.2" -EXEC "dvbs_multicast -b 40000 -m 224.0.1.3" -EXEC "dvbs_multicast -b 40000 -m 224.0.1.4" -EXEC "dvbs_multicast -b 40000 -m 224.0.1.5" - # - # readnoaaport shared memory readers -EXEC "readnoaaport -m 224.0.1.1 -n -u 3 -t mhs -r 1" -EXEC "readnoaaport -m 224.0.1.2 -n -u 4 -t mhs -r 1" -EXEC "readnoaaport -m 224.0.1.3 -n -u 5 -t mhs -r 1" -EXEC "readnoaaport -m 224.0.1.4 -n -u 6 -t mhs -r 1" -EXEC "readnoaaport -m 224.0.1.5 -n -u 7 -t mhs -r 1" +EXEC "noaaportIngester -m 224.0.1.1 -n -u 3 -t mhs -r 1 -s NMC" +EXEC "noaaportIngester -m 224.0.1.2 -n -u 4 -t mhs -r 1 -s GOES" +EXEC "noaaportIngester -m 224.0.1.3 -n -u 5 -t mhs -r 1 -s NMC2" +EXEC "noaaportIngester -m 224.0.1.4 -n -u 6 -t mhs -r 1 -s NOAAPORT_OPT" +EXEC "noaaportIngester -m 224.0.1.5 -n -u 7 -t mhs -r 1 -s NMC3" # # rtstats uses the LDM to send product latency statistics to the UPC. # For more info on rtstats please see the man page. diff --git a/rpms/awips2.core/Installer.ldm/patch/etc/ldmd.conf.pbp b/rpms/awips2.core/Installer.ldm/patch/etc/ldmd.conf.pbp index 562afe8ffe..12286773bc 100644 --- a/rpms/awips2.core/Installer.ldm/patch/etc/ldmd.conf.pbp +++ b/rpms/awips2.core/Installer.ldm/patch/etc/ldmd.conf.pbp @@ -53,20 +53,11 @@ # are started by the "exec" command and are in the same process group. # #EXEC "pqact" - # dvbs shared memory ingest processes - -EXEC "dvbs_multicast -b 40000 -m 224.0.1.1" -EXEC "dvbs_multicast -b 40000 -m 224.0.1.2" -EXEC "dvbs_multicast -b 40000 -m 224.0.1.3" -EXEC "dvbs_multicast -b 40000 -m 224.0.1.4" -EXEC "dvbs_multicast -b 40000 -m 224.0.1.5" - # - # readnoaaport shared memory readers -EXEC "readnoaaport -m 224.0.1.1 -n -u 3 -t mhs -r 1" -EXEC "readnoaaport -m 224.0.1.2 -n -u 4 -t mhs -r 1" -EXEC "readnoaaport -m 224.0.1.3 -n -u 5 -t mhs -r 1" -EXEC "readnoaaport -m 224.0.1.4 -n -u 6 -t mhs -r 1" -EXEC "readnoaaport -m 224.0.1.5 -n -u 7 -t mhs -r 1" +EXEC "noaaportIngester -m 224.0.1.1 -n -u 3 -t mhs -r 1 -s NMC" +EXEC "noaaportIngester -m 224.0.1.2 -n -u 4 -t mhs -r 1 -s GOES" +EXEC "noaaportIngester -m 224.0.1.3 -n -u 5 -t mhs -r 1 -s NMC2" +EXEC "noaaportIngester -m 224.0.1.4 -n -u 6 -t mhs -r 1 -s NOAAPORT_OPT" +EXEC "noaaportIngester -m 224.0.1.5 -n -u 7 -t mhs -r 1 -s NMC3" # # rtstats uses the LDM to send product latency statistics to the UPC. # For more info on rtstats please see the man page. diff --git a/rpms/awips2.core/Installer.ldm/patch/etc/ldmd.conf.vrh b/rpms/awips2.core/Installer.ldm/patch/etc/ldmd.conf.vrh index 64b763ce6d..7c0c6915a1 100644 --- a/rpms/awips2.core/Installer.ldm/patch/etc/ldmd.conf.vrh +++ b/rpms/awips2.core/Installer.ldm/patch/etc/ldmd.conf.vrh @@ -53,20 +53,11 @@ # are started by the "exec" command and are in the same process group. # #EXEC "pqact" - # dvbs shared memory ingest processes - -EXEC "dvbs_multicast -b 40000 -m 224.0.1.1" -EXEC "dvbs_multicast -b 40000 -m 224.0.1.2" -EXEC "dvbs_multicast -b 40000 -m 224.0.1.3" -EXEC "dvbs_multicast -b 40000 -m 224.0.1.4" -EXEC "dvbs_multicast -b 40000 -m 224.0.1.5" - # - # readnoaaport shared memory readers -EXEC "readnoaaport -m 224.0.1.1 -n -u 3 -t mhs -r 1" -EXEC "readnoaaport -m 224.0.1.2 -n -u 4 -t mhs -r 1" -EXEC "readnoaaport -m 224.0.1.3 -n -u 5 -t mhs -r 1" -EXEC "readnoaaport -m 224.0.1.4 -n -u 6 -t mhs -r 1" -EXEC "readnoaaport -m 224.0.1.5 -n -u 7 -t mhs -r 1" +EXEC "noaaportIngester -m 224.0.1.1 -n -u 3 -t mhs -r 1 -s NMC" +EXEC "noaaportIngester -m 224.0.1.2 -n -u 4 -t mhs -r 1 -s GOES" +EXEC "noaaportIngester -m 224.0.1.3 -n -u 5 -t mhs -r 1 -s NMC2" +EXEC "noaaportIngester -m 224.0.1.4 -n -u 6 -t mhs -r 1 -s NOAAPORT_OPT" +EXEC "noaaportIngester -m 224.0.1.5 -n -u 7 -t mhs -r 1 -s NMC3" # # rtstats uses the LDM to send product latency statistics to the UPC. # For more info on rtstats please see the man page. diff --git a/rpms/awips2.core/Installer.ldm/patch/init.d/ldmcp b/rpms/awips2.core/Installer.ldm/patch/init.d/ldmcp new file mode 100644 index 0000000000..5e923f09e5 --- /dev/null +++ b/rpms/awips2.core/Installer.ldm/patch/init.d/ldmcp @@ -0,0 +1,143 @@ +#!/bin/bash +# +# ldmcp: This starts and stops the SBN LDMCP software at the sites +# +# chkconfig: 345 99 0 +# description: ldmcp starts/stops SBN LDM software on the CP at the site +# +# + +PATH=/sbin:/bin:/usr/bin:/usr/sbin + +# Source function library. +. /etc/init.d/functions + +RETVAL=0 +LDM_PROJECT="/usr/local/ldm" +AWIPS_PROJECT="/awips" +LOGFILE=`basename $0` + +if [ -f /etc/rc.config.d/AWIPS ];then + . /etc/rc.config.d/AWIPS +else + echo "AWIPS file not found. Exiting.." + exit -1 +fi + +function handle_ramdisk() { + + # check if ramdisk is mounted: + if ! mount | grep ram0 > /dev/null + then + echo -ne "Creating RAMDISK:\t" + if mkfs -t ext2 -m 0 -q /dev/ramdisk 1500000 && success || failure + then + echo + # mount to /data/ldm/data + echo -ne "Mounting to /data/ldm/data:\t" + if ! mount /dev/ramdisk /data/ldm/data && failure + then + echo + return 1 + else + success + fi + echo + sleep 2 + else + echo + return 1 + fi + fi + echo -ne "Fixing Permissions:\t" + if ! chown -R ldm:fxalpha /data/ldm/data && failure + then + echo + return 1 + fi + success + echo + return 0 +} + +function clean_ldm() { + + echo -ne "Cleaning LDM:\t" + su ldm -lc "ldmadmin clean" > /dev/null 2>&1 && success || failure + myRetVal=$? + if [[ ${myRetVal} -ne 0 ]] + then + return ${myRetVal} + fi + echo + if [[ -f /data/ldm/data/ldm.pq ]] + then + echo -ne "\nDeleting the ldm queue:\t" + su ldm -lc "ldmadmin delqueue" > /dev/null 2>&1 && success || failure + echo + fi + echo -ne "\nCreating the ldm queue:\t" + su ldm -lc "ldmadmin mkqueue" > /dev/null 2>&1 && success || failure + myRetVal=$? + echo + return ${myRetVal} +} + +case $1 in + +'start') + if ! handle_ramdisk; then exit 1 ; fi + if ! clean_ldm; then exit 1 ; fi + + echo -n "Starting AWIPS SBN CP (LDM) processes:" + + $LDM_PROJECT/bin/start_ldm > /data/ldm/logs/$LOGFILE 2>&1 + if [ $? -eq 0 ] + then + RETVAL=0 + touch /var/lock/subsys/ldmcp + success && echo + $AWIPS_PROJECT/bin/ErrorLogADS -p ldmcp -t c -s ma -g 60 -n 2 -m "SBN CP (LDM) Start OK" + echo "$AWIPS_PROJECT/bin/ErrorLogADS -p ldmcp -t c -s ma -g 60 -n 2 -m 'SBN CP (LDM) Start OK' " + else + RETVAL=1 + failure && echo + $AWIPS_PROJECT/bin/ErrorLogADS -p ldmcp -t c -s ma -g 60 -n 2 -m "SBN CP (LDM) Start FAIL" + echo "$AWIPS_PROJECT/bin/ErrorLogADS -p ldmcp -t c -s ma -g 60 -n 2 -m 'SBN CP (LDM) Start FAIL'" + fi + mc_sbn_S300_dvb + ;; + +'stop') + echo -n "Stopping AWIPS SBN CP (LDM) processes:" + + $LDM_PROJECT/bin/stop_ldm >> /data/ldm/logs/$LOGFILE 2>&1 + if [ $? -eq 0 ] + then + RETVAL=0 + rm -f /var/lock/subsys/ldmcp + success && echo + $AWIPS_PROJECT/bin/ErrorLogADS -p ldmcp -t c -s ma -g 60 -n 2 -m "SBN CP (LDM) Stop OK" + echo "$AWIPS_PROJECT/bin/ErrorLogADS -p ldmcp -t c -s ma -g 60 -n 2 -m 'SBN CP (LDM) Stop OK'" + else + RETVAL=1 + failure && echo + $AWIPS_PROJECT/bin/ErrorLogADS -p ldmcp -t c -s ma -g 60 -n 2 -m "SBN CP (LDM) Stop FAIL" + echo "$AWIPS_PROJECT/bin/ErrorLogADS -p ldmcp -t c -s ma -g 60 -n 2 -m 'SBN CP (LDM) Stop FAIL'" + fi + for pid in `ps -C mc_sbn_S300_dvb --no-headings -o pid` + do + echo "Sending SIGTERM to the mc_sbn_S300_dvb pid $pid" + kill -s SIGTERM $pid + sleep 1 + done + ;; + +*) + echo "usage: $0 {start|stop}" + RETVAL=1 + ;; + +esac + +exit $RETVAL diff --git a/rpms/awips2.core/Installer.ldm/patch/ld.so.conf.d/awips2-ldm-i386.conf b/rpms/awips2.core/Installer.ldm/patch/ld.so.conf.d/awips2-ldm-i386.conf new file mode 100644 index 0000000000..77daf2e3f7 --- /dev/null +++ b/rpms/awips2.core/Installer.ldm/patch/ld.so.conf.d/awips2-ldm-i386.conf @@ -0,0 +1 @@ +/usr/local/ldm/lib diff --git a/rpms/awips2.core/Installer.ldm/patch/logrotate.d/ldm.log b/rpms/awips2.core/Installer.ldm/patch/logrotate.d/ldm.log new file mode 100644 index 0000000000..4021e28003 --- /dev/null +++ b/rpms/awips2.core/Installer.ldm/patch/logrotate.d/ldm.log @@ -0,0 +1,12 @@ +/data/ldm/logs/ldmd.log /data/ldm/logs/nwstg.log /data/ldm/logs/goes.log /data/ldm/logs/nwstg2.log /data/ldm/logs/oconus.log /data/ldm/logs/polarsat.log { + missingok + compress + notifempty + daily + rotate 5 + create 0660 root fxalpha + postrotate + /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true + endscript + +} diff --git a/rpms/awips2.core/Installer.ldm/src/ldm-6.11.5.tar.gz b/rpms/awips2.core/Installer.ldm/src/ldm-6.11.5.tar.gz new file mode 100644 index 0000000000..a28676c4ff Binary files /dev/null and b/rpms/awips2.core/Installer.ldm/src/ldm-6.11.5.tar.gz differ