diff --git a/cave/build/static/common/cave/etc/menus/upperair/baseAviation.xml b/cave/build/static/common/cave/etc/menus/upperair/baseAviation.xml index b99b8e6866..a6ac6b05ab 100644 --- a/cave/build/static/common/cave/etc/menus/upperair/baseAviation.xml +++ b/cave/build/static/common/cave/etc/menus/upperair/baseAviation.xml @@ -25,7 +25,9 @@ menuText="Convective SIGMET" id="ConvSigmet"> /convsigmet/% - + + /bufrncwf/% + diff --git a/cave/com.raytheon.uf.viz.gisdatastore.directory/build.properties b/cave/com.raytheon.uf.viz.gisdatastore.directory/build.properties index e9863e281e..983035b5c2 100644 --- a/cave/com.raytheon.uf.viz.gisdatastore.directory/build.properties +++ b/cave/com.raytheon.uf.viz.gisdatastore.directory/build.properties @@ -2,4 +2,5 @@ source.. = src/ output.. = bin/ bin.includes = META-INF/,\ .,\ - plugin.xml + plugin.xml,\ + config.xml diff --git a/cave/com.raytheon.uf.viz.gisdatastore.directory/config.xml b/cave/com.raytheon.uf.viz.gisdatastore.directory/config.xml new file mode 100644 index 0000000000..a70ed0bf4b --- /dev/null +++ b/cave/com.raytheon.uf.viz.gisdatastore.directory/config.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/cave/com.raytheon.uf.viz.gisdatastore/build.properties b/cave/com.raytheon.uf.viz.gisdatastore/build.properties index e9863e281e..983035b5c2 100644 --- a/cave/com.raytheon.uf.viz.gisdatastore/build.properties +++ b/cave/com.raytheon.uf.viz.gisdatastore/build.properties @@ -2,4 +2,5 @@ source.. = src/ output.. = bin/ bin.includes = META-INF/,\ .,\ - plugin.xml + plugin.xml,\ + config.xml diff --git a/cave/com.raytheon.uf.viz.gisdatastore/src/com/raytheon/uf/viz/gisdatastore/ui/GisDataStoreParametersDialog.java b/cave/com.raytheon.uf.viz.gisdatastore/src/com/raytheon/uf/viz/gisdatastore/ui/GisDataStoreParametersDialog.java index e443a67151..d8f55b201e 100644 --- a/cave/com.raytheon.uf.viz.gisdatastore/src/com/raytheon/uf/viz/gisdatastore/ui/GisDataStoreParametersDialog.java +++ b/cave/com.raytheon.uf.viz.gisdatastore/src/com/raytheon/uf/viz/gisdatastore/ui/GisDataStoreParametersDialog.java @@ -76,7 +76,8 @@ import com.raytheon.viz.ui.widgets.TimeRangeEntry; * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Dec 5, 2012 randerso Initial creation + * Dec 5, 2012 randerso Initial creation + * Feb 15, 2013 #1629 randerso Fix saving of default plugin to prefs * * * @@ -292,7 +293,7 @@ public class GisDataStoreParametersDialog extends CaveJFACEDialog { String pluginName = prefs.getString(GIS_DATA_STORE_PLUGIN_PREF); if (!Arrays.asList(getPluginNames()).contains(pluginName)) { pluginName = getPluginNames()[0]; - prefs.setToDefault(GIS_DATA_STORE_PLUGIN_PREF); + prefs.setValue(GIS_DATA_STORE_PLUGIN_PREF, pluginName); try { prefs.save(); } catch (IOException e1) { diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/griddata/AbstractGridData.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/griddata/AbstractGridData.java index c9650039c1..c9e8de0441 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/griddata/AbstractGridData.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/griddata/AbstractGridData.java @@ -25,6 +25,8 @@ import java.util.Date; import java.util.List; import org.opengis.metadata.spatial.PixelOrientation; +import org.opengis.referencing.FactoryException; +import org.opengis.referencing.operation.TransformException; import com.raytheon.uf.common.dataplugin.gfe.GridDataHistory; import com.raytheon.uf.common.dataplugin.gfe.db.objects.GFERecord.GridType; @@ -64,6 +66,7 @@ import com.vividsolutions.jts.geom.Coordinate; * 01/29/2008 chammack Initial Class Skeleton. * 03/13/2008 879 rbell Legacy conversion. * 06/10/2009 2159 rjpeter Updated isValid to call gridSlice.isValid + * 02/19/2013 1637 randerso Added throws declarations to translateDataFrom * * * @author chammack @@ -337,7 +340,12 @@ public abstract class AbstractGridData implements IGridData { } // perform translation - return translateDataFrom(sourceGrid); + try { + return translateDataFrom(sourceGrid); + } catch (Exception e) { + statusHandler.handle(Priority.PROBLEM, "Error translating data", e); + return false; + } } @@ -350,7 +358,8 @@ public abstract class AbstractGridData implements IGridData { @Override public abstract IGridData clone() throws CloneNotSupportedException; - protected abstract boolean translateDataFrom(final IGridData source); + protected abstract boolean translateDataFrom(final IGridData source) + throws FactoryException, TransformException; /* * (non-Javadoc) diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/griddata/DiscreteGridData.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/griddata/DiscreteGridData.java index d80900ecc9..a5b7c2ae5c 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/griddata/DiscreteGridData.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/griddata/DiscreteGridData.java @@ -30,6 +30,8 @@ import jep.INumpyable; import org.apache.commons.lang.mutable.MutableByte; import org.geotools.geometry.jts.JTS; import org.opengis.metadata.spatial.PixelOrientation; +import org.opengis.referencing.FactoryException; +import org.opengis.referencing.operation.TransformException; import com.raytheon.uf.common.dataplugin.gfe.RemapGrid; import com.raytheon.uf.common.dataplugin.gfe.db.objects.GFERecord.GridType; @@ -69,6 +71,7 @@ import com.vividsolutions.jts.geom.MultiPolygon; * Tweak doSet() for filtered grids, fix bugs * 30Jan2013 #15719 jdynina Fixed allowed field size to accept more * than 128 characters + * 02/19/2013 1637 randerso Added throws declarations to translateDataFrom * * * @@ -215,7 +218,8 @@ public class DiscreteGridData extends AbstractGridData implements INumpyable { } @Override - protected boolean translateDataFrom(IGridData sourceGrid) { + protected boolean translateDataFrom(IGridData sourceGrid) + throws FactoryException, TransformException { if (!(sourceGrid instanceof DiscreteGridData)) { throw new IllegalArgumentException( "Expected DiscreteGridData as source."); @@ -586,8 +590,8 @@ public class DiscreteGridData extends AbstractGridData implements INumpyable { // fancy code in here to prevent lots of repeated combining // for efficiency. // Make an array of byte...init to MAX_VALUE - byte newValues[] = new byte[255]; - Arrays.fill(newValues, (byte)-1); + byte newValues[] = new byte[255]; + Arrays.fill(newValues, (byte) -1); byte[] gridA = discreteGrid.getBuffer().array(); byte[] pToSetA = pointsToSet.getBuffer().array(); @@ -598,10 +602,10 @@ public class DiscreteGridData extends AbstractGridData implements INumpyable { if ((byte) 1 == pToSetA[rowOffset + col]) { // pointsToSet selects this grid point byte dataPoint = gridA[rowOffset + col]; - int dataPointIdx = 0xFF & dataPoint; + int dataPointIdx = 0xFF & dataPoint; if (dataPoint != index) { // value needs to change - if (newValues[dataPointIdx] == (byte)-1) { + if (newValues[dataPointIdx] == (byte) -1) { // new key hasn't been found DiscreteKey combinedKey = DiscreteKey.combine( dk, getKey()[dataPointIdx]); @@ -718,8 +722,8 @@ public class DiscreteGridData extends AbstractGridData implements INumpyable { // if inside grid limits, copy value to new position // of working grid. if (sliceGrid.isValid(newx, newy)) { - //byte og = originalGrid.get(i, j); - int og = 0xFF & originalGrid.get(i, j); + // byte og = originalGrid.get(i, j); + int og = 0xFF & originalGrid.get(i, j); byte v = translate[og]; if (v == -1) { v = lookupKeyValue(originalKey[og]); @@ -899,7 +903,7 @@ public class DiscreteGridData extends AbstractGridData implements INumpyable { int numValues = values.getXdim() * values.getYdim(); byte[] bp = values.getBuffer().array(); for (int i = 0; i < numValues; i++) { - if ((0xFF & bp[i]) > key.size() -1) { + if ((0xFF & bp[i]) > key.size() - 1) { throw new IllegalArgumentException( "Illegal discrete grid (bad values) in gridSet()"); } @@ -946,7 +950,7 @@ public class DiscreteGridData extends AbstractGridData implements INumpyable { protected DiscreteKey doGetDiscreteValue(int x, int y) { byte gridValue = getGrid().get(x, y); - int gridValueIdx = 0xFF & gridValue; + int gridValueIdx = 0xFF & gridValue; return getKey()[gridValueIdx]; } @@ -1054,14 +1058,14 @@ public class DiscreteGridData extends AbstractGridData implements INumpyable { // check data values byte[] data = grid.getBuffer().array(); DiscreteKey[] keys = getKey(); - //byte keySize = (byte) keys.length; + // byte keySize = (byte) keys.length; int keySize = keys.length; for (int j = 0; j < data.length; j++) { - int value = 0xFF & data[j]; + int value = 0xFF & data[j]; if (value > keySize) { - statusHandler.handle(Priority.PROBLEM, emsg + "Data=" - + (int) value + " Min=0 Max=" + (int) keySize); + statusHandler.handle(Priority.PROBLEM, emsg + "Data=" + value + + " Min=0 Max=" + keySize); return false; } } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/griddata/ScalarGridData.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/griddata/ScalarGridData.java index 6a8b47869b..e39c483b1d 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/griddata/ScalarGridData.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/griddata/ScalarGridData.java @@ -27,6 +27,9 @@ import javax.measure.converter.ConversionException; import javax.measure.converter.UnitConverter; import javax.measure.unit.Unit; +import org.opengis.referencing.FactoryException; +import org.opengis.referencing.operation.TransformException; + import com.raytheon.uf.common.dataplugin.gfe.RemapGrid; import com.raytheon.uf.common.dataplugin.gfe.grid.Grid2DBit; import com.raytheon.uf.common.dataplugin.gfe.grid.Grid2DFloat; @@ -52,6 +55,7 @@ import com.vividsolutions.jts.geom.Coordinate; * 01/29/2008 chammack Initial Class Skeleton. * 03/13/2008 879 rbell Legacy conversion. * 05/20/2009 #2159 rjpeter Fixed doDelta + * 02/19/2013 1637 randerso Added throws declarations to translateDataFrom * * * @author chammack @@ -400,7 +404,8 @@ public class ScalarGridData extends OrderedGridData implements Cloneable { } @Override - protected boolean translateDataFrom(IGridData source) { + protected boolean translateDataFrom(IGridData source) + throws FactoryException, TransformException { if (!(source instanceof ScalarGridData)) { throw new IllegalArgumentException( "Expected ScalarGridData as source."); @@ -446,14 +451,9 @@ public class ScalarGridData extends OrderedGridData implements Cloneable { RemapGrid remap = new RemapGrid(scalarSource.getParm() .getGridInfo().getGridLoc(), this.parm.getGridInfo() .getGridLoc()); - try { - - Grid2DFloat scalarGrid = remap.remap(scalarSource.getGrid(), - -99999.99f, maxLimit, minLimit, minLimit); - setGrid(scalarGrid); - } catch (Exception e) { - e.printStackTrace(); - } + Grid2DFloat scalarGrid = remap.remap(scalarSource.getGrid(), + -99999.99f, maxLimit, minLimit, minLimit); + setGrid(scalarGrid); } return true; } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/griddata/VectorGridData.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/griddata/VectorGridData.java index 1852673a1a..f268c9f6ba 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/griddata/VectorGridData.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/griddata/VectorGridData.java @@ -28,6 +28,7 @@ import javax.measure.converter.UnitConverter; import javax.measure.unit.Unit; import org.opengis.metadata.spatial.PixelOrientation; +import org.opengis.referencing.FactoryException; import com.raytheon.uf.common.dataplugin.gfe.RemapGrid; import com.raytheon.uf.common.dataplugin.gfe.grid.Grid2DBit; @@ -56,6 +57,7 @@ import com.vividsolutions.jts.geom.Coordinate; * ------------ ---------- ----------- -------------------------- * 01/29/2008 chammack Initial Class Skeleton. * 03/25/2008 879 rbell Legacy conversion. + * 02/19/2013 1637 randerso Added throws declarations to translateDataFrom * * * @@ -445,7 +447,8 @@ public class VectorGridData extends OrderedGridData implements Cloneable { } @Override - protected boolean translateDataFrom(IGridData source) { + protected boolean translateDataFrom(IGridData source) + throws FactoryException { if (!(source instanceof VectorGridData)) { throw new IllegalArgumentException( "Expected VectorGridData as source."); diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/griddata/WeatherGridData.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/griddata/WeatherGridData.java index 4f0e1390e8..fd24fb53bf 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/griddata/WeatherGridData.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/griddata/WeatherGridData.java @@ -29,6 +29,8 @@ import jep.INumpyable; import org.apache.commons.lang.mutable.MutableByte; import org.geotools.geometry.jts.JTS; import org.opengis.metadata.spatial.PixelOrientation; +import org.opengis.referencing.FactoryException; +import org.opengis.referencing.operation.TransformException; import com.raytheon.uf.common.dataplugin.gfe.RemapGrid; import com.raytheon.uf.common.dataplugin.gfe.db.objects.GFERecord.GridType; @@ -65,6 +67,7 @@ import com.vividsolutions.jts.geom.MultiPolygon; * Mar 15, 2011 randerso Initial creation * Jan 30, 2013 #15719 jdynina Allowed more than 128 chars in wx * strings + * 02/19/2013 1637 randerso Added throws declarations to translateDataFrom * * * @@ -204,7 +207,8 @@ public class WeatherGridData extends AbstractGridData implements INumpyable { } @Override - protected boolean translateDataFrom(IGridData sourceGrid) { + protected boolean translateDataFrom(IGridData sourceGrid) + throws FactoryException, TransformException { if (!(sourceGrid instanceof WeatherGridData)) { throw new IllegalArgumentException( "Expected WeatherGridData as source."); @@ -566,8 +570,8 @@ public class WeatherGridData extends AbstractGridData implements INumpyable { // fancy code in here to prevent lots of repeated combining // for efficiency. // Make an array of byte...init to MAX_VALUE - byte newValues[] = new byte[255]; - Arrays.fill(newValues, (byte)-1); + byte newValues[] = new byte[255]; + Arrays.fill(newValues, (byte) -1); byte[] gridA = weatherGrid.getBuffer().array(); byte[] pToSetA = pointsToSet.getBuffer().array(); @@ -579,10 +583,10 @@ public class WeatherGridData extends AbstractGridData implements INumpyable { if ((byte) 1 == pToSetA[rowOffset + col]) { // pointsToSet selects this grid point byte dataPoint = gridA[rowOffset + col]; - int dataPointIdx = 0xFF & dataPoint; + int dataPointIdx = 0xFF & dataPoint; if (dataPoint != index) { // value needs to change - if (newValues[dataPointIdx] == (byte)-1) { + if (newValues[dataPointIdx] == (byte) -1) { // new key hasn't been found WeatherKey combinedKey = new WeatherKey(wk); combinedKey.addAll(getKeys()[dataPointIdx]); @@ -721,7 +725,7 @@ public class WeatherGridData extends AbstractGridData implements INumpyable { } // set up translation matrix - //byte translate[] = new byte[128]; + // byte translate[] = new byte[128]; byte translate[] = new byte[255]; Arrays.fill(translate, (byte) -1); @@ -761,8 +765,8 @@ public class WeatherGridData extends AbstractGridData implements INumpyable { // if inside grid limits, copy value to new position // of working grid. if (sliceGrid.isValid(newx, newy)) { - //byte og = originalGrid.get(i, j); - int og = 0xFF & originalGrid.get(i, j); + // byte og = originalGrid.get(i, j); + int og = 0xFF & originalGrid.get(i, j); byte v = translate[og]; if (v == -1) { v = lookupKeyValue(originalKey[og]); @@ -876,7 +880,7 @@ public class WeatherGridData extends AbstractGridData implements INumpyable { int numValues = values.getXdim() * values.getYdim(); byte[] bp = values.getBuffer().array(); for (int i = 0; i < numValues; i++) { - if ((0xFF & bp[i]) > key.size() -1) { + if ((0xFF & bp[i]) > key.size() - 1) { throw new IllegalArgumentException( "Illegal weather grid (bad values) in gridSet()"); } @@ -1025,14 +1029,14 @@ public class WeatherGridData extends AbstractGridData implements INumpyable { // check data values byte[] data = grid.getBuffer().array(); WeatherKey[] keys = getKeys(); - //byte keySize = (byte) keys.length; + // byte keySize = (byte) keys.length; int keySize = keys.length; for (int j = 0; j < data.length; j++) { - int value = 0xFF & data[j]; + int value = 0xFF & data[j]; if (value > keySize) { - statusHandler.handle(Priority.PROBLEM, emsg + "Data=" - + (int) value + " Min=0 Max=" + (int) keySize); + statusHandler.handle(Priority.PROBLEM, emsg + "Data=" + value + + " Min=0 Max=" + keySize); return false; } } diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/ifpAG/ASCIIGrid.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/ifpAG/ASCIIGrid.java index 928c5a3d05..6ac020ea38 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/ifpAG/ASCIIGrid.java +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/ifpAG/ASCIIGrid.java @@ -70,6 +70,7 @@ import com.vividsolutions.jts.geom.Coordinate; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Apr 13, 2011 #8393 dgilling Initial creation + * 02/19/13 #1637 randerso Added exception handling for Discrete and Weather * * * @@ -689,47 +690,43 @@ public class ASCIIGrid { RemapGrid remap = new RemapGrid(sourceDomain, outputDomain); // some data overlaps and remapping is possible - switch (gs.getGridInfo().getGridType()) { - case SCALAR: - ScalarGridSlice scalar = (ScalarGridSlice) gs; - try { + try { + switch (gs.getGridInfo().getGridType()) { + case SCALAR: + ScalarGridSlice scalar = (ScalarGridSlice) gs; scalar.setScalarGrid(remap.remap(scalar.getScalarGrid(), -99999.99f, maxLimit, minLimit, minLimit)); - } catch (Exception e) { - statusHandler.handle(Priority.PROBLEM, - "Unable to remap scalar ASCIIGrid", e); - return false; - } - break; - case VECTOR: - VectorGridSlice vector = (VectorGridSlice) gs; - Grid2DFloat mag = new Grid2DFloat(outputDomain.getNx(), - outputDomain.getNy()); - Grid2DFloat dir = new Grid2DFloat(outputDomain.getNx(), - outputDomain.getNy()); - try { + break; + case VECTOR: + VectorGridSlice vector = (VectorGridSlice) gs; + Grid2DFloat mag = new Grid2DFloat(outputDomain.getNx(), + outputDomain.getNy()); + Grid2DFloat dir = new Grid2DFloat(outputDomain.getNx(), + outputDomain.getNy()); remap.remap(vector.getMagGrid(), vector.getDirGrid(), -99999.99f, maxLimit, minLimit, minLimit, mag, dir); - } catch (Exception e) { - statusHandler.handle(Priority.PROBLEM, - "Unable to remap vector ASCIIGrid", e); - return false; + vector.setMagGrid(mag); + vector.setDirGrid(dir); + break; + case WEATHER: + WeatherGridSlice weather = (WeatherGridSlice) gs; + weather.setWeatherGrid(remap.remap(weather.getWeatherGrid(), + 255, 0)); + break; + case DISCRETE: + DiscreteGridSlice discrete = (DiscreteGridSlice) gs; + discrete.setDiscreteGrid(remap.remap( + discrete.getDiscreteGrid(), 255, 0)); + break; + default: + statusHandler.handle(Priority.WARN, + "Illegal data type detected."); + break; } - vector.setMagGrid(mag); - vector.setDirGrid(dir); - break; - case WEATHER: - WeatherGridSlice weather = (WeatherGridSlice) gs; - weather.setWeatherGrid(remap.remap(weather.getWeatherGrid(), 255, 0)); - break; - case DISCRETE: - DiscreteGridSlice discrete = (DiscreteGridSlice) gs; - discrete.setDiscreteGrid(remap.remap(discrete.getDiscreteGrid(), - 255, 0)); - break; - default: - statusHandler.handle(Priority.WARN, "Illegal data type detected."); - break; + } catch (Exception e) { + statusHandler.handle(Priority.PROBLEM, "Unable to remap ASCIIGrid", + e); + return false; } return true; diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/iscUtil.py b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/iscUtil.py index ef78946aa5..002973434d 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/iscUtil.py +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/iscUtil.py @@ -28,7 +28,6 @@ from datetime import datetime from time import gmtime,strftime from java.io import File from com.raytheon.uf.common.time import TimeRange -from com.raytheon.uf.common.dataplugin.gfe import RemapGrid from com.raytheon.uf.common.dataplugin.gfe.db.objects import GridLocation from com.raytheon.uf.common.dataplugin.gfe.reference import ReferenceData_CoordinateType as CoordinateType from com.raytheon.edex.plugin.gfe.config import IFPServerConfig @@ -48,6 +47,7 @@ from com.raytheon.uf.common.localization import LocalizationContext_Localization # Date Ticket# Engineer Description # ------------ ---------- ----------- -------------------------- # 07/06/09 1995 bphillip Initial Creation. +# 02/19/13 1637 randerso Removed unused import # # # diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/RemapGrid.java b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/RemapGrid.java index 1d4a550b28..eb7e0e1cf5 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/RemapGrid.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/RemapGrid.java @@ -34,11 +34,8 @@ import javax.media.jai.PlanarImage; import org.geotools.coverage.grid.GridCoverage2D; import org.geotools.coverage.grid.GridCoverageFactory; import org.geotools.coverage.grid.GridGeometry2D; -import org.geotools.geometry.DirectPosition2D; -import org.opengis.geometry.DirectPosition; import org.opengis.geometry.Envelope; import org.opengis.referencing.FactoryException; -import org.opengis.referencing.operation.MathTransform; import org.opengis.referencing.operation.TransformException; import com.raytheon.uf.common.dataplugin.gfe.db.objects.GridLocation; @@ -48,11 +45,10 @@ import com.raytheon.uf.common.dataplugin.gfe.grid.Grid2DFloat; import com.raytheon.uf.common.geospatial.MapUtil; import com.raytheon.uf.common.geospatial.interpolation.BilinearInterpolation; import com.raytheon.uf.common.geospatial.interpolation.GridReprojection; +import com.raytheon.uf.common.geospatial.interpolation.NearestNeighborInterpolation; +import com.raytheon.uf.common.geospatial.interpolation.data.ByteBufferWrapper; import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; import com.raytheon.uf.common.geospatial.interpolation.data.FloatArrayWrapper; -import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; -import com.raytheon.uf.common.status.UFStatus.Priority; import com.vividsolutions.jts.geom.Coordinate; /** @@ -66,6 +62,7 @@ import com.vividsolutions.jts.geom.Coordinate; * ------------ ---------- ----------- -------------------------- * 5/16/08 875 bphillip Initial Creation. * 10/10/12 #1260 randerso Added getters for source and destination glocs + * 02/19/13 #1637 randerso Fixed remapping of byte grids * * * @@ -73,9 +70,6 @@ import com.vividsolutions.jts.geom.Coordinate; * @version 1.0 */ public class RemapGrid { - private static final transient IUFStatusHandler statusHandler = UFStatus - .getHandler(RemapGrid.class); - /** The input grid location describing the source data */ private GridLocation sourceGloc; @@ -95,12 +89,23 @@ public class RemapGrid { * The source grid location describing the source data * @param destinationGloc * The destination grid location describing the destination data + * @throws FactoryException */ public RemapGrid(GridLocation sourceGloc, GridLocation destinationGloc) { - this.sourceGloc = sourceGloc; - this.destinationGloc = destinationGloc; + this(sourceGloc, destinationGloc, false); } + /** + * Constructs a new RemapGrid with the given input and output grid locations + * + * @param sourceGloc + * The source grid location describing the source data + * @param destinationGloc + * The destination grid location describing the destination data + * @param rescale + * true if data is to be rescaled + * @throws FactoryException + */ public RemapGrid(GridLocation sourceGloc, GridLocation destinationGloc, boolean rescale) { this.sourceGloc = sourceGloc; @@ -160,12 +165,14 @@ public class RemapGrid { * @param outputFill * The output fill value * @return The remapped Grid2DByte object + * @throws TransformException + * @throws FactoryException * @throws IllegalArgumentException * If the input dimensions do not match the source dimensions or * when problems occur during resampling */ public Grid2DByte remap(final Grid2DByte input, byte inputFill, - byte outputFill) { + byte outputFill) throws FactoryException, TransformException { Grid2DByte retVal = null; @@ -198,7 +205,7 @@ public class RemapGrid { } public Grid2DByte remap(final Grid2DByte input, int inputFill, - int outputFill) { + int outputFill) throws FactoryException, TransformException { return remap(input, (byte) inputFill, (byte) outputFill); } @@ -436,64 +443,40 @@ public class RemapGrid { /** * Resamples the data from the input grid location to the destination grid - * location. + * location * * @param input * The input data * @return The resampled data + * @throws TransformException + * @throws FactoryException */ - private Grid2DByte resample(final Grid2DByte input) { + private Grid2DByte resample(final Grid2DByte input) + throws FactoryException, TransformException { - if (input.getXdim() != sourceGloc.getNx() - || input.getYdim() != sourceGloc.getNy()) { - statusHandler - .handle(Priority.PROBLEM, - "Cannot resample data. Input data dimensions do not match the input grid location"); - return input; - } + GridGeometry2D sourceGeometry = MapUtil.getGridGeometry(sourceGloc); - int dx = destinationGloc.getNx(); - int dy = destinationGloc.getNy(); - Grid2DByte data = new Grid2DByte(dx, dy); + ByteBuffer data = input.getBuffer(); + ByteBuffer resampledData = null; - Coordinate srcCoord = null; - int roundedX = 0; - int roundedY = 0; - try { - for (int x = 0; x < dx; x++) { - for (int y = 0; y < dy; y++) { - srcCoord = getSourceCoord(x, y); - roundedX = (int) Math.round(srcCoord.x); - roundedY = (int) Math.round(srcCoord.y); - if (roundedX < 0 || roundedY < 0 - || roundedX >= input.getXdim() - || roundedY >= input.getYdim()) { - data.set(x, y, 0); - } else { - data.set(x, y, input.get(roundedX, roundedY)); - } - - } + GridGeometry2D destGeometry = MapUtil.getGridGeometry(destinationGloc); + synchronized (this) { + if (interp == null) { + interp = new GridReprojection(sourceGeometry, destGeometry); + interp.computeTransformTable(); } - } catch (Exception e) { - statusHandler.handle(Priority.PROBLEM, - "Error resampling byte data!", e); } + DataSource source = new ByteBufferWrapper(data, sourceGeometry); + resampledData = interp.reprojectedGrid( + new NearestNeighborInterpolation(), source, + new ByteBufferWrapper(destGeometry)).getBuffer(); - return data; - } + // Remap the the output data into a Grid2DFloat object - private Coordinate getSourceCoord(int x, int y) throws Exception { - GridGeometry2D destGeom = MapUtil.getGridGeometry(destinationGloc); - GridGeometry2D srcGeom = MapUtil.getGridGeometry(sourceGloc); + Grid2DByte retVal = new Grid2DByte(destinationGloc.getNx(), + destinationGloc.getNy(), resampledData); - MathTransform destToCRS = destGeom.getGridToCRS(); - MathTransform srcGridFromCRS = srcGeom.getCRSToGrid2D(); - - DirectPosition destLatLon = destToCRS.transform(new DirectPosition2D(x, - y), null); - DirectPosition srcCoord = srcGridFromCRS.transform(destLatLon, null); - return new Coordinate(srcCoord.getOrdinate(0), srcCoord.getOrdinate(1)); + return retVal; } /** @@ -550,6 +533,8 @@ public class RemapGrid { f1 = rasterData.getPixels(rasterData.getMinX(), rasterData.getMinY(), rasterData.getWidth(), rasterData.getHeight(), f1); + + JAI.getDefaultInstance().getTileCache().flush(); } else { GridGeometry2D destGeometry = MapUtil .getGridGeometry(destinationGloc); @@ -569,8 +554,6 @@ public class RemapGrid { Grid2DFloat retVal = new Grid2DFloat(destinationGloc.getNx(), destinationGloc.getNy(), f1); - JAI.getDefaultInstance().getTileCache().flush(); - return retVal; } diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpResourceHandler.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpResourceHandler.java index 223aa19e53..6846736319 100644 --- a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpResourceHandler.java +++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpResourceHandler.java @@ -97,6 +97,7 @@ public class NsharpResourceHandler { private int dtYOrig = NsharpConstants.DATA_TIMELINE_Y_ORIG; private int dtWidth = NsharpConstants.DATA_TIMELINE_WIDTH; private String paneConfigurationName; + private int numTimeLinePerPage=1; /* Hodograph Modes - definition is based on definitions in globals_xw.h of BigNsharp */ private static final int HODO_NORMAL = 0; //private static int HODO_EFFECTIVE= 1; not used in BigNsharp source code @@ -324,8 +325,6 @@ public class NsharpResourceHandler { break; } } - int numTimeLinePerPage = (cnYOrig-dtNextPageEnd)/charHeight; - curStnIdPage = totalStnIdPage/numTimeLinePerPage + 1; setCurSndProfileProp(); setCurrentSoundingLayerInfo(); resetData(); @@ -353,8 +352,6 @@ public class NsharpResourceHandler { break; } } - int numTimeLinePerPage = (cnYOrig-dtNextPageEnd)/charHeight; - curTimeLinePage = currentTimeLineStateListIndex/numTimeLinePerPage + 1; setCurSndProfileProp(); setCurrentSoundingLayerInfo(); resetData(); @@ -1579,21 +1576,7 @@ public class NsharpResourceHandler { } //set total time line group and stn id list page number - int numTimeLinePerPage = (cnYOrig-dtNextPageEnd)/charHeight; - //fix bug, when numTimeLinePerPage ==0 case - if(numTimeLinePerPage <= 0) { - numTimeLinePerPage = 1; - totalTimeLinePage = timeLineStateList.size(); - curTimeLinePage = currentTimeLineStateListIndex; - totalStnIdPage = stnStateList.size(); - curStnIdPage= currentStnStateListIndex; - } - else{ - totalTimeLinePage = timeLineStateList.size()/numTimeLinePerPage + 1; - curTimeLinePage = currentTimeLineStateListIndex/numTimeLinePerPage + 1; - totalStnIdPage = stnStateList.size()/numTimeLinePerPage + 1; - curStnIdPage= currentStnStateListIndex/numTimeLinePerPage + 1; - } + calculateTimeStnBoxData(); /* Chin: TBD: do we need these code? @@ -1607,7 +1590,9 @@ public class NsharpResourceHandler { }*/ //set data time to descriptor //this is necessary for looping - if (( skewtPaneRsc.getDescriptor().getFramesInfo().getFrameCount() == 0)&& !getTimeMatcher) { + // starting 13.2.1, this line is changed by Raytheon + if (( skewtPaneRsc.getDescriptor().getFramesInfo().getFrameCount() == 0)&& !getTimeMatcher) { + //was this line before 13.2.1 if (( skewtPaneRsc.getDescriptor().getTimeMatcher() == null || skewtPaneRsc.getDescriptor().getTimeMatcher().getTimeMatchBasis() == null)&& !getTimeMatcher) { //DataTime[] dataTimes = new DataTime[dataTimelineList.size()]; //Chin Note: we just have to do this once and set dataTimes size bigger than 1. //Nsharp handles changing frame itself. It just need system to send change frame notice. @@ -1650,7 +1635,6 @@ public class NsharpResourceHandler { public void handleUserClickOnStationId(Coordinate c) { - int numStnIdPerPage = (cnYOrig-dtNextPageEnd)/charHeight; //first to find if it is for change to next page, or change sorting //System.out.println("numTimeLinePerPage="+numTimeLinePerPage+"gap="+(cnYOrig-dtNextPageEnd)); int index =((int)(c.y - dtYOrig))/ charHeight; @@ -1672,7 +1656,7 @@ public class NsharpResourceHandler { } // recalculate index for time line index =((int)(c.y - dtNextPageEnd))/ charHeight + - (curStnIdPage-1)* numStnIdPerPage ; + (curStnIdPage-1)* numTimeLinePerPage ; if( index < this.stnStateList.size() ){ switch(stnStateList.get(index).getStnState()){ @@ -1696,7 +1680,6 @@ public class NsharpResourceHandler { } public void handleUserClickOnTimeLine(Coordinate c) { - int numTimeLinePerPage = (cnYOrig-dtNextPageEnd)/charHeight; //first to find if it is for change to next/prev page //System.out.println("numTimeLinePerPage="+numTimeLinePerPage+"gap="+(cnYOrig-dtNextPageEnd)); int index =((int)(c.y - dtYOrig))/ charHeight; @@ -1833,7 +1816,6 @@ public class NsharpResourceHandler { break; } - int numTimeLinePerPage = (cnYOrig-dtNextPageEnd)/charHeight; curTimeLinePage = currentTimeLineStateListIndex/numTimeLinePerPage + 1; setCurSndProfileProp(); setCurrentSoundingLayerInfo(); @@ -1935,8 +1917,7 @@ public class NsharpResourceHandler { } previousTimeLineStateListIndex = currentTimeLineStateListIndex; currentTimeLineStateListIndex = targetIndex; - int numTimeLinePerPage = (cnYOrig-dtNextPageEnd)/charHeight; - curTimeLinePage = currentTimeLineStateListIndex/numTimeLinePerPage + 1; + curTimeLinePage = currentTimeLineStateListIndex/numTimeLinePerPage + 1; setCurSndProfileProp(); setCurrentSoundingLayerInfo(); resetData(); @@ -2000,7 +1981,6 @@ public class NsharpResourceHandler { break; } } - int numTimeLinePerPage = (cnYOrig-dtNextPageEnd)/charHeight; curStnIdPage = currentStnStateListIndex/numTimeLinePerPage + 1; setCurSndProfileProp(); setCurrentSoundingLayerInfo(); @@ -2744,7 +2724,8 @@ public class NsharpResourceHandler { if(insetPaneRsc!=null) insetPaneRsc.createInsetWireFrameShapes(); if(skewtPaneRsc!=null) - skewtPaneRsc.handleResize(); + //CHIN:::fix edit zoom issue skewtPaneRsc.handleResize(); + skewtPaneRsc.createRscWireFrameShapes(); } } catch(Exception e) { @@ -2813,7 +2794,8 @@ public class NsharpResourceHandler { nsharpNative.populateSndgData(soundingLys); //get storm motion wind data after populate sounding from NsharpLib skewtPaneRsc.setSoundingLys(soundingLys); - skewtPaneRsc.handleResize(); + //CHIN:::fix edit zoom issue skewtPaneRsc.handleResize(); + skewtPaneRsc.createRscWireFrameShapes(); if(hodoPaneRsc!=null){ hodoPaneRsc.setSoundingLys(soundingLys); hodoPaneRsc.createRscHodoWindShapeAll(); @@ -2851,11 +2833,9 @@ public class NsharpResourceHandler { nsharpNative.populateSndgData(soundingLys); //get storm motion wind data after populate sounding from NsharpLib skewtPaneRsc.setSoundingLys(soundingLys); - skewtPaneRsc.handleResize(); - //skewtPaneRsc.createRscPressTempCurveShapeAll(); - //skewtPaneRsc.createRscwetBulbTraceShape(); - //skewtPaneRsc.createRscVTempTraceShape(); - //skewtPaneRsc.createParcelShapes(parcelList); + //CHIN:::fix edit zoom issue skewtPaneRsc.handleResize(); + skewtPaneRsc.createRscWireFrameShapes(); + if(hodoPaneRsc!=null){ hodoPaneRsc.setSoundingLys(soundingLys); hodoPaneRsc.createRscHodoWindShapeAll(); @@ -2911,7 +2891,8 @@ public class NsharpResourceHandler { } if(skewtPaneRsc!=null){ skewtPaneRsc.setSoundingLys(soundingLys); - skewtPaneRsc.handleResize(); + //CHIN:::fix edit zoom issue skewtPaneRsc.handleResize(); + skewtPaneRsc.createRscWireFrameShapes(); } if(hodoPaneRsc!=null){ hodoPaneRsc.setSoundingLys(soundingLys); @@ -2951,7 +2932,8 @@ public class NsharpResourceHandler { } if(skewtPaneRsc!=null){ skewtPaneRsc.setSoundingLys(soundingLys); - skewtPaneRsc.handleResize(); + //CHIN:::fix edit zoom issue skewtPaneRsc.handleResize(); + skewtPaneRsc.createRscWireFrameShapes(); } if(hodoPaneRsc!=null){ hodoPaneRsc.setSoundingLys(soundingLys); @@ -3205,18 +3187,7 @@ public class NsharpResourceHandler { this.dtWidth = dtWidth; this.cnYOrig = cnYOrig; this.dtNextPageEnd = dtNextPage_end; - int numTimeLinePerPage = (cnYOrig-dtNextPageEnd)/charHeight; - if(numTimeLinePerPage<=0) - numTimeLinePerPage=1; - //System.out.println("numTimeLinePerPage="+numTimeLinePerPage); - totalTimeLinePage = timeLineStateList.size()/numTimeLinePerPage ; - if(timeLineStateList.size()%numTimeLinePerPage != 0) - totalTimeLinePage= totalTimeLinePage+1; - curTimeLinePage = currentTimeLineStateListIndex/numTimeLinePerPage+1; - totalStnIdPage = stnStateList.size()/numTimeLinePerPage; - if(stnStateList.size()%numTimeLinePerPage != 0) - totalStnIdPage++; - curStnIdPage= currentStnStateListIndex/numTimeLinePerPage + 1; //NEW CODE + calculateTimeStnBoxData(); } /*public void setCharHeight(int charHeight) { @@ -3233,5 +3204,20 @@ public class NsharpResourceHandler { return paneConfigurationName; } + private void calculateTimeStnBoxData(){ + //set total time line group and stn id list page number + numTimeLinePerPage = (cnYOrig-dtNextPageEnd)/charHeight; + if(numTimeLinePerPage<=0) + numTimeLinePerPage=1; + //System.out.println("numTimeLinePerPage="+numTimeLinePerPage); + totalTimeLinePage = timeLineStateList.size()/numTimeLinePerPage ; + if(timeLineStateList.size()%numTimeLinePerPage != 0) + totalTimeLinePage= totalTimeLinePage+1; + curTimeLinePage = currentTimeLineStateListIndex/numTimeLinePerPage+1; + totalStnIdPage = stnStateList.size()/numTimeLinePerPage; + if(stnStateList.size()%numTimeLinePerPage != 0) + totalStnIdPage++; + curStnIdPage= currentStnStateListIndex/numTimeLinePerPage + 1; + } } diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpTimeStnPaneResource.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpTimeStnPaneResource.java index 9fd5ca4795..9ffb087f50 100644 --- a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpTimeStnPaneResource.java +++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpTimeStnPaneResource.java @@ -83,12 +83,15 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{ } private void drawNsharpColorNotation(IGraphicsTarget target, Rectangle rect) throws VizException { + PixelExtent extent = new PixelExtent(rect); RGB color; target.setupClippingPlane(extent); target.drawRect(extent,NsharpConstants.backgroundColor, 1.0f, 1.0f); //plot notations: - + if(dtHeight >= paneHeight) + return; + //draw time line page title etc. only when pane box height is larger than timeline box height double x = cnXOrig+5*xRatio; double y = cnYOrig+1.5*charHeight; //double xGap = paneWidth/3*xRatio; @@ -135,50 +138,60 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{ PixelExtent extent = new PixelExtent(rect); target.setupClippingPlane(extent); target.drawRect(extent,NsharpConstants.backgroundColor, 1.0f, 1.0f); - double x = dtXOrig; - double y = dtYOrig-1.5*charHeight*yRatio; - String s = timeLineStateList.size() + " time lines, page " + curTimeLinePage+"/"+totalTimeLinePage; - target.drawString(font10, s, x, - y, 0.0, - IGraphicsTarget.TextStyle.NORMAL, - NsharpConstants.color_green, - HorizontalAlignment.LEFT, - VerticalAlignment.TOP, null); - y = dtYOrig; - target.drawLine(dtXOrig, y, 0.0,dtXEnd , y, 0.0,NsharpConstants.color_white,1, LineStyle.SOLID); - //System.out.println("drawNsharpDataTimelines picked stn info: "+ pickedStnInfoStr); + double x; + double y; + String s; + if(dtHeight < paneHeight){ + //draw time line page title etc. only when pane box height is larger than timeline box height + x = dtXOrig; + y = dtYOrig-1.5*charHeight*yRatio; + s = timeLineStateList.size() + " time lines, page " + curTimeLinePage+"/"+totalTimeLinePage; + target.drawString(font10, s, x, + y, 0.0, + IGraphicsTarget.TextStyle.NORMAL, + NsharpConstants.color_green, + HorizontalAlignment.LEFT, + VerticalAlignment.TOP, null); + y = dtYOrig; + target.drawLine(dtXOrig, y, 0.0,dtXEnd , y, 0.0,NsharpConstants.color_white,1, LineStyle.SOLID); + //System.out.println("drawNsharpDataTimelines picked stn info: "+ pickedStnInfoStr); - x = dtXOrig +dtWidth/2; - // line divide nextPage and prevPage strings - target.drawLine(x, y, 0.0, - x , y+1.2*charHeight*yRatio, 0.0, - NsharpConstants.color_white,1, LineStyle.SOLID); + x = dtXOrig +dtWidth/2; + // line divide nextPage and prevPage strings + target.drawLine(x, y, 0.0, + x , y+1.2*charHeight*yRatio, 0.0, + NsharpConstants.color_white,1, LineStyle.SOLID); - x = dtXOrig + 5; - y = y+1.2*charHeight*yRatio; - s = "nextPage"; - target.drawString(font10, s, x, - y, 0.0, - IGraphicsTarget.TextStyle.NORMAL, - NsharpConstants.color_yellow, - HorizontalAlignment.LEFT, - VerticalAlignment.BOTTOM, null); - x= dtXOrig + dtWidth/2 + 5; - s = "prevPage"; - target.drawString(font10, s, x, - y, 0.0, - IGraphicsTarget.TextStyle.NORMAL, - NsharpConstants.color_yellow, - HorizontalAlignment.LEFT, - VerticalAlignment.BOTTOM, null); - - //line below nextPage string - target.drawLine(dtXOrig, y, 0.0, - dtXEnd , y, 0.0, - NsharpConstants.color_white,1, LineStyle.SOLID); + x = dtXOrig + 5; + y = y+1.2*charHeight*yRatio; + s = "nextPage"; + target.drawString(font10, s, x, + y, 0.0, + IGraphicsTarget.TextStyle.NORMAL, + NsharpConstants.color_yellow, + HorizontalAlignment.LEFT, + VerticalAlignment.BOTTOM, null); + x= dtXOrig + dtWidth/2 + 5; + s = "prevPage"; + target.drawString(font10, s, x, + y, 0.0, + IGraphicsTarget.TextStyle.NORMAL, + NsharpConstants.color_yellow, + HorizontalAlignment.LEFT, + VerticalAlignment.BOTTOM, null); + //line below nextPage string + target.drawLine(dtXOrig, y, 0.0, + dtXEnd , y, 0.0, + NsharpConstants.color_white,1, LineStyle.SOLID); + } int numTimeLineToShowPerPage = (cnYOrig-dtNextPageEnd)/charHeight; + if(numTimeLineToShowPerPage <1){ + numTimeLineToShowPerPage = dtHeight/charHeight; + if(numTimeLineToShowPerPage <1) + numTimeLineToShowPerPage=1; + } int startIndex = (curTimeLinePage-1) * numTimeLineToShowPerPage; if(timeLineStateList!= null){ @@ -257,50 +270,60 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{ PixelExtent extent = new PixelExtent(rect); target.setupClippingPlane(extent); target.drawRect(extent,NsharpConstants.backgroundColor, 1.0f, 1.0f); - double x = stnXOrig; - double y = stnYOrig -1.5*charHeight*yRatio; - String s = stnStateList.size() + " stations, page " + curStnIdPage+"/"+totalStnIdPage; - target.drawString(font10, s, x, - y, 0.0, - IGraphicsTarget.TextStyle.NORMAL, - NsharpConstants.color_green, - HorizontalAlignment.LEFT, - VerticalAlignment.TOP, null); - y = dtYOrig; - target.drawLine(stnXOrig, y, 0.0,stnXEnd , y, 0.0,NsharpConstants.color_white,1, LineStyle.SOLID); - //System.out.println("drawNsharpDataTimelines picked stn info: "+ pickedStnInfoStr); - x = stnXOrig +dtWidth/2; - // line divide nextPage and prevPage strings - target.drawLine(x, y, 0.0, - x , y+1.2*charHeight*yRatio, 0.0, - NsharpConstants.color_white,1, LineStyle.SOLID); + double x; + double y; + String s; + if(dtHeight < paneHeight){ + //draw time line page title etc. only when pane box height is larger than timeline box height + x = stnXOrig; + y = stnYOrig -1.5*charHeight*yRatio; + s = stnStateList.size() + " stations, page " + curStnIdPage+"/"+totalStnIdPage; + target.drawString(font10, s, x, + y, 0.0, + IGraphicsTarget.TextStyle.NORMAL, + NsharpConstants.color_green, + HorizontalAlignment.LEFT, + VerticalAlignment.TOP, null); + y = dtYOrig; + target.drawLine(stnXOrig, y, 0.0,stnXEnd , y, 0.0,NsharpConstants.color_white,1, LineStyle.SOLID); + //System.out.println("drawNsharpDataTimelines picked stn info: "+ pickedStnInfoStr); + x = stnXOrig +dtWidth/2; + // line divide nextPage and prevPage strings + target.drawLine(x, y, 0.0, + x , y+1.2*charHeight*yRatio, 0.0, + NsharpConstants.color_white,1, LineStyle.SOLID); + + x = stnXOrig + 5; + y = y+1.2*charHeight*yRatio; + s = "nextPage"; + target.drawString(font10, s, x, + y, 0.0, + IGraphicsTarget.TextStyle.NORMAL, + NsharpConstants.color_yellow, + HorizontalAlignment.LEFT, + VerticalAlignment.BOTTOM, null); + + x= stnXOrig + dtWidth/2 + 5; + s = "prevPage"; + target.drawString(font10, s, x, + y, 0.0, + IGraphicsTarget.TextStyle.NORMAL, + NsharpConstants.color_yellow, + HorizontalAlignment.LEFT, + VerticalAlignment.BOTTOM, null); + + //line below neextPage string + target.drawLine(stnXOrig, y, 0.0, + stnXEnd , y, 0.0, + NsharpConstants.color_white,1, LineStyle.SOLID); + } - x = stnXOrig + 5; - y = y+1.2*charHeight*yRatio; - s = "nextPage"; - target.drawString(font10, s, x, - y, 0.0, - IGraphicsTarget.TextStyle.NORMAL, - NsharpConstants.color_yellow, - HorizontalAlignment.LEFT, - VerticalAlignment.BOTTOM, null); - - x= stnXOrig + dtWidth/2 + 5; - s = "prevPage"; - target.drawString(font10, s, x, - y, 0.0, - IGraphicsTarget.TextStyle.NORMAL, - NsharpConstants.color_yellow, - HorizontalAlignment.LEFT, - VerticalAlignment.BOTTOM, null); - - //line below neextPage string - target.drawLine(stnXOrig, y, 0.0, - stnXEnd , y, 0.0, - NsharpConstants.color_white,1, LineStyle.SOLID); - - int numStnToShow = (cnYOrig-dtNextPageEnd)/charHeight; + if(numStnToShow <1){ + numStnToShow = dtHeight/charHeight; + if(numStnToShow <1) + numStnToShow=1; + } int startIndex = (rscHandler.getCurStnIdPage()-1) * numStnToShow; int compIndex= 1; int colorIndex; @@ -453,16 +476,26 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{ float prevWidth = paneWidth; paneHeight = (int) ext.getHeight(); paneWidth = (int) (ext.getWidth()); - xRatio = xRatio* paneWidth/prevWidth; - yRatio = yRatio* paneHeight/prevHeight; - //charHeight = (int)(NsharpConstants.CHAR_HEIGHT_*yRatio); + //xRatio = xRatio* paneWidth/prevWidth; + //DEBUGGING yRatio = yRatio* paneHeight/prevHeight; + xRatio = 1; + yRatio = 1; + //if pane height is less than 10 char height, then just plot time line. not plot "messages/title/notations" etc.. + if(paneHeight > (int)(10* charHeight*yRatio)){ + dtYOrig = (int) ext.getMinY()+(int)(2* charHeight*yRatio); + cnHeight = (int)(3* charHeight*yRatio); + dtHeight = paneHeight-(int)(5* charHeight*yRatio); + dtNextPageEnd = dtYOrig+ (int) (2*charHeight*yRatio); + } + else { + dtYOrig = (int) (ext.getMinY()); + cnHeight = 0; + dtHeight = paneHeight; + dtNextPageEnd = dtYOrig; + } dtXOrig = (int) (ext.getMinX()); - dtYOrig = (int) ext.getMinY()+(int)(2* charHeight*yRatio); dtWidth = paneWidth/2; dtXEnd = dtXOrig + dtWidth; - cnHeight = (int)(3* charHeight*yRatio); - dtHeight = paneHeight-dtYOrig-cnHeight; - dtNextPageEnd = dtYOrig+ (int) (2*charHeight*yRatio); stnXOrig = dtXEnd; stnYOrig = dtYOrig; stnWidth = dtWidth; diff --git a/pythonPackages/qpid/bin/monitor_qpid_host.sh b/pythonPackages/qpid/bin/monitor_qpid_host.sh index 6c8d3c2c59..677628a132 100644 --- a/pythonPackages/qpid/bin/monitor_qpid_host.sh +++ b/pythonPackages/qpid/bin/monitor_qpid_host.sh @@ -13,6 +13,7 @@ function setupEnv() { nasHost=nas1 nasVolName=dataFXA # This is so we can change it for new nas! lsofCommand="lsof -Pns -p" + platformName=$( hostname | cut -f2 -d'-') if [[ ${logDirectory}/${logName} -ot ${logDirectory}/$( basename $0 .sh ).$(date --date='1 day ago' +%A).log ]] then @@ -100,6 +101,11 @@ function runlsof() { function captureQpidStat() { local returnCode=0 + local qpidConnLimit=500 + + case "${platformName}" in + [a-z][a-z][a-z]n ) qpidConnLimit=1000 ; echo -e "\tNOTE: Setting Max qpidd connection to 1000 due to NCEP site" >> ${logDirectory}/${nowTimeDate}-qpid-stat.out ;; + esac echo -ne "\n| START " >> ${logDirectory}/${nowTimeDate}-qpid-stat.out echoDate >> ${logDirectory}/${nowTimeDate}-qpid-stat.out @@ -108,6 +114,22 @@ function captureQpidStat() { numQpidConnections=$( qpid-stat -c | wc -l ) (( numQpidConnections-=3 )) echo -e "Total Number of QPID Connections: ${numQpidConnections}" >> ${logDirectory}/${nowTimeDate}-qpid-stat.out + if [[ ${numQpidConnections} -ge $(( qpidConnLimit - 50 )) && ${numQpidConnections} -le $(( qpidConnLimit - 15 )) ]] ; then + echo -e "\tNOTE: Sending Major ITO to NCF because number of connections is between 450 and 485" >> ${logDirectory}/${nowTimeDate}-qpid-stat.out + if [[ -f /opt/OV/bin/OpC/opcmsg ]] ; then + opt/OV/bin/OpC/opcmsg application=QPIDD object=QPIDD msg_text="Number Of Connections To QPID is between 450-485: Please check system health" severity=Major msg_grp=AWIPS + else + echo -e "\tERROR - can not find /opt/OV/bin/OpC/opcmsg on $( hostname )" >> ${logDirectory}/${nowTimeDate}-qpid-stat.out + fi + elif [[ ${numQpidConnections} -gt $(( qpidConnLimit - 15 )) ]] ; then + echo -e "\tNOTE: Sending CRITIAL ITO to NCF because number of connections is > 485" >> ${logDirectory}/${nowTimeDate}-qpid-stat.out + if [[ -f /opt/OV/bin/OpC/opcmsg ]] ; then + /opt/OV/bin/OpC/opcmsg application=QPIDD object=QPIDD msg_text="Number Of Connections To QPID is > 485 -- Take IMMEDIATE action to prevent system failure" severity=Critical msg_grp=AWIPS + else + echo -e "\tERROR - can not find /opt/OV/bin/OpC/opcmsg on $( hostname )" >> ${logDirectory}/${nowTimeDate}-qpid-stat.out + fi + fi + echo >> ${logDirectory}/${nowTimeDate}-qpid-stat.out for cmdArg in "-b" "-c" "-s" "-e" "-q -Smsg"