From 3853ef16bb0c20959c8ba0ef20321192e0db65b0 Mon Sep 17 00:00:00 2001 From: Nate Jensen Date: Mon, 5 May 2014 13:04:06 -0500 Subject: [PATCH 1/9] Issue #2060 fix sat precip for grid data URI removal Change-Id: Iaa5144a63ff455f5c12a060a9daad0dd0bd04e58 Former-commit-id: f76ace3c9b93a57639c84a62fdd91d756cf45768 [formerly 2b6c30e67d08ade42c5670ef7826442888d86d2d] [formerly 0cf0f724f492657ac0816501caaaa9922620092e] [formerly d82f6e5ff6c7269641293ffdac43eb8b60ad4a0e [formerly 0cf0f724f492657ac0816501caaaa9922620092e [formerly cf0bb31583f0ec0b2135aa9101f3247e88e877d0]]] Former-commit-id: d82f6e5ff6c7269641293ffdac43eb8b60ad4a0e Former-commit-id: 7beb650628fb602c30c71cbf5eab29724e2cc3f8 [formerly 97597c3ab1e8cd1370b76ac670a7576b9d6120c5] Former-commit-id: 09091ccf25b22f24dc37222b1fd8e7cd250aa7c6 --- .../uf/edex/ohd/pproc/SatPreURIFilter.java | 33 +-- .../edex/ohd/pproc/SatPrecipFileBuilder.java | 194 ++++++++---------- 2 files changed, 97 insertions(+), 130 deletions(-) diff --git a/edexOsgi/com.raytheon.uf.edex.ohd/src/com/raytheon/uf/edex/ohd/pproc/SatPreURIFilter.java b/edexOsgi/com.raytheon.uf.edex.ohd/src/com/raytheon/uf/edex/ohd/pproc/SatPreURIFilter.java index 44aa25f548..6e26ea1b1f 100644 --- a/edexOsgi/com.raytheon.uf.edex.ohd/src/com/raytheon/uf/edex/ohd/pproc/SatPreURIFilter.java +++ b/edexOsgi/com.raytheon.uf.edex.ohd/src/com/raytheon/uf/edex/ohd/pproc/SatPreURIFilter.java @@ -19,10 +19,13 @@ **/ package com.raytheon.uf.edex.ohd.pproc; +import com.raytheon.uf.common.dataplugin.annotations.DataURI; +import com.raytheon.uf.common.dataplugin.grid.GridConstants; import com.raytheon.uf.common.dataplugin.message.DataURINotificationMessage; /** - * TODO Add Description + * Filters URIs for Satellite Precip and generates an xmrg file if the filter + * matches. * *
  * 
@@ -30,8 +33,9 @@ import com.raytheon.uf.common.dataplugin.message.DataURINotificationMessage;
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * Sep 10, 2009            snaples     Initial creation
- * Feb 12, 2010  4635      snaples     Updated to match more generically.
+ * Feb 12, 2010 4635       snaples     Updated to match more generically.
  * Feb 15, 2013 1638       mschenke    Moved DataURINotificationMessage to uf.common.dataplugin
+ * May 05, 2014 2060       njensen     Cleanup
  * 
  * 
* @@ -41,22 +45,22 @@ import com.raytheon.uf.common.dataplugin.message.DataURINotificationMessage; public class SatPreURIFilter { - DataURINotificationMessage message; + private static final String AUTOSPE = "AUTOSPE"; - String outpath = ""; + private String startFilter; - static final String AUTOSPE = "AUTOSPE"; + private SatPrecipFileBuilder builder; - public SatPreURIFilter() { + public SatPreURIFilter() throws Exception { + startFilter = DataURI.SEPARATOR + GridConstants.GRID; + builder = new SatPrecipFileBuilder(); } - public void matchURI(DataURINotificationMessage msg) { - message = msg; - - if (message instanceof DataURINotificationMessage) { + public void matchURI(DataURINotificationMessage msg) throws Exception { + if (msg instanceof DataURINotificationMessage) { String uri = ""; - for (String data : message.getDataURIs()) { - if (data.startsWith("/grid")) { + for (String data : msg.getDataURIs()) { + if (data.startsWith(startFilter)) { if (data.contains(AUTOSPE)) { uri = data; break; @@ -68,10 +72,7 @@ public class SatPreURIFilter { } } if (uri.length() > 1) { - SatPrecipFileBuilder sb = new SatPrecipFileBuilder(uri); - sb.createSatPre(); - } else { - return; + builder.createSatPre(uri); } } } diff --git a/edexOsgi/com.raytheon.uf.edex.ohd/src/com/raytheon/uf/edex/ohd/pproc/SatPrecipFileBuilder.java b/edexOsgi/com.raytheon.uf.edex.ohd/src/com/raytheon/uf/edex/ohd/pproc/SatPrecipFileBuilder.java index 61b2715eb3..a23aa8d668 100644 --- a/edexOsgi/com.raytheon.uf.edex.ohd/src/com/raytheon/uf/edex/ohd/pproc/SatPrecipFileBuilder.java +++ b/edexOsgi/com.raytheon.uf.edex.ohd/src/com/raytheon/uf/edex/ohd/pproc/SatPrecipFileBuilder.java @@ -22,42 +22,43 @@ package com.raytheon.uf.edex.ohd.pproc; import java.awt.Rectangle; import java.io.File; import java.io.IOException; -import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; -import java.util.TimeZone; import javax.measure.converter.UnitConverter; import javax.measure.unit.SI; import javax.measure.unit.Unit; -import com.raytheon.uf.common.dataplugin.PluginException; import com.raytheon.uf.common.dataplugin.grid.GridRecord; import com.raytheon.uf.common.datastorage.IDataStore; import com.raytheon.uf.common.datastorage.Request; import com.raytheon.uf.common.datastorage.records.FloatDataRecord; import com.raytheon.uf.common.datastorage.records.IDataRecord; -import com.raytheon.uf.common.datastorage.records.ShortDataRecord; import com.raytheon.uf.common.hydro.spatial.HRAP; import com.raytheon.uf.common.hydro.spatial.HRAPCoordinates; import com.raytheon.uf.common.mpe.util.XmrgFile; import com.raytheon.uf.common.mpe.util.XmrgFile.XmrgHeader; import com.raytheon.uf.common.ohd.AppsDefaults; +import com.raytheon.uf.common.status.IUFStatusHandler; +import com.raytheon.uf.common.status.UFStatus; +import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.common.units.UnitConv; import com.raytheon.uf.edex.database.plugin.PluginDao; import com.raytheon.uf.edex.database.plugin.PluginFactory; /** - * TODO Add Description + * Builder for xmrg files that contain satellite precip data. * *
  * 
  * SOFTWARE HISTORY
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
- * Sep 8, 2009            snaples     Initial creation
+ * Sep 08, 2009            snaples     Initial creation
  * Feb 15, 2013 1638       mschenke    Moved DataURINotificationMessage to uf.common.dataplugin
- * Mar 19, 2014 17109     snaples     Removed code that adds 1 hour to grid reftime, was not needed.
+ * Mar 19, 2014 17109      snaples     Removed code that adds 1 hour to grid reftime, was not needed.
+ * May 05, 2014 2060       njensen     Major cleanup and remove dependency on grid dataURI
+ * 
  * 
  * 
* @@ -67,25 +68,8 @@ import com.raytheon.uf.edex.database.plugin.PluginFactory; public class SatPrecipFileBuilder { - Rectangle extent = null; - - XmrgFile xmfile = null; - - GridRecord gr = null; - - private IDataRecord dataRec; - - private String uri = ""; - - private String outputPath = ""; - - private short[] data; - - private static final SimpleDateFormat sdf = new SimpleDateFormat( - "yyyyMMddHH"); - static { - sdf.setTimeZone(TimeZone.getTimeZone("GMT")); - } + private static final IUFStatusHandler logger = UFStatus + .getHandler(SatPrecipFileBuilder.class); private static final String FILEPRE = "SATPRE"; @@ -99,70 +83,81 @@ public class SatPrecipFileBuilder { private static final String USER = "SANmdY"; - private Date grReftime = null; + private Rectangle extent = null; private int height; private int width; - private static int minX; + private int minX; - private static int minY; + private int minY; - private static int maxX; + private int maxY; - private static int maxY; + private SimpleDateFormat sdf; - public SatPrecipFileBuilder(String datauri) { - uri = datauri; - } + private String outputPath; - public void createSatPre() { - try { - getGridRecord(); - } catch (PluginException e) { - e.printStackTrace(); - } - float[] fa = null; - fa = new float[((float[]) gr.getMessageData()).length]; - fa = (float[]) gr.getMessageData(); - String gribUnit = gr.getParameter().getUnitString(); - UnitConverter cv = null; - Unit gi = Unit.ONE; - try { - gi = UnitConv.deserializer(gribUnit); - } catch (ParseException e) { - e.printStackTrace(); - } - Unit xOut = SI.MILLIMETER; - cv = gi.getConverterTo(xOut); - data = new short[fa.length]; - int k = 0; - for (int i = 0; i < height; i++) { - for (int j = 0; j < width; j++) { - if (fa[k] < 0) { - fa[k] = 0; - } - data[(i * width) + j] = (short) (cv.convert(fa[k]) * 100.0); - k++; - } - } - fa = null; - createXmrgFile(); - } + public SatPrecipFileBuilder() throws Exception { + extent = HRAPCoordinates.getHRAPCoordinates(); + maxY = (int) (HRAP.getInstance().getNy() - extent.getMinY()); + minY = (int) (maxY - extent.getHeight()); + minX = (int) extent.getMinX(); + width = (int) (extent.getWidth()); + height = (int) (extent.getHeight()); - private void createXmrgFile() { + sdf = new SimpleDateFormat("yyyyMMddHH"); + sdf.setTimeZone(TimeUtil.GMT_TIME_ZONE); AppsDefaults appsDefaults = AppsDefaults.getInstance(); outputPath = appsDefaults.getToken("mpe_satpre_dir"); - File op = new File(outputPath); - if (op.exists() == false) { - op.mkdir(); + File outputDir = new File(outputPath); + if (!outputDir.exists()) { + outputDir.mkdirs(); } - op = null; + } + + /** + * Retrieves a grid record, converts the data to millimeters, and stores it + * to an xmrg file. + * + * @param uri + * the data URI of the grid record + */ + public void createSatPre(String uri) { + try { + GridRecord gr = getGridRecord(uri); + float[] fa = (float[]) gr.getMessageData(); + String gribUnit = gr.getParameter().getUnitString(); + UnitConverter cv = null; + Unit gi = UnitConv.deserializer(gribUnit); + Unit xOut = SI.MILLIMETER; + cv = gi.getConverterTo(xOut); + short[] data = new short[fa.length]; + int k = 0; + for (int i = 0; i < height; i++) { + for (int j = 0; j < width; j++) { + if (fa[k] < 0) { + fa[k] = 0; + } + data[(i * width) + j] = (short) (cv.convert(fa[k]) * 100.0); + k++; + } + } + fa = null; + createXmrgFile(data, gr.getDataTime().getRefTime()); + } catch (Exception e) { + logger.error("Error creating sat precip xmrg file for URI " + uri, + e); + } + } + + private void createXmrgFile(short[] data, Date grReftime) + throws IOException { String fname = outputPath + File.separatorChar + FILEPRE + sdf.format(grReftime) + "z"; - xmfile = new XmrgFile(fname); + XmrgFile xmfile = new XmrgFile(fname); XmrgHeader xmhead = new XmrgHeader(); xmhead.setValidDate(grReftime); xmhead.setSaveDate(grReftime); @@ -174,63 +169,34 @@ public class SatPrecipFileBuilder { xmfile.setHeader(xmhead); xmfile.setHrapExtent(extent); xmfile.setData(data); - try { - xmfile.save(fname); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + xmfile.save(fname); } /** - * get Populated grib record + * Get Populated grid record * * @param uri + * the uri of the grid record * @return */ - public void getGridRecord() throws PluginException { - try { - extent = HRAPCoordinates.getHRAPCoordinates(); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - HRAP hr = HRAP.getInstance(); - - maxY = (int) (hr.getNy() - extent.getMinY()); - minY = (int) (maxY - extent.getHeight()); - minX = (int) extent.getMinX(); - maxX = (int) extent.getMaxX(); - width = (int) (extent.getWidth()); - height = (int) (extent.getHeight()); + private GridRecord getGridRecord(String uri) throws Exception { + GridRecord gr = new GridRecord(uri); + PluginDao gd = PluginFactory.getInstance().getPluginDao( + gr.getPluginName()); + IDataStore dataStore = gd.getDataStore(gr); int[] minIndex = { minX, minY }; int[] maxIndex = { minX + width, minY + height }; - - gr = new GridRecord(uri); - PluginDao gd = PluginFactory.getInstance().getPluginDao( - gr.getPluginName()); - gr = (GridRecord) gd.getMetadata(uri); - IDataStore dataStore = gd.getDataStore(gr); - - try { - dataRec = dataStore.retrieve(uri, "Data", - Request.buildSlab(minIndex, maxIndex)); - } catch (Exception se) { - se.printStackTrace(); - } + IDataRecord dataRec = dataStore.retrieve(uri, "Data", + Request.buildSlab(minIndex, maxIndex)); if (dataRec instanceof FloatDataRecord) { gr.setMessageData(((FloatDataRecord) dataRec).getFloatData()); - } else if (dataRec instanceof ShortDataRecord) { - gr.setMessageData(((ShortDataRecord) dataRec).getShortData()); } else { gr.setMessageData(dataRec); } - // this get the reftime of the record - grReftime = gr.getDataTime().getRefTime(); - long millis = grReftime.getTime(); - grReftime.setTime(millis); + + return gr; } } From a8864844bb93c1d84999febc5e5d248cdc5b4a0f Mon Sep 17 00:00:00 2001 From: Lee Venable Date: Mon, 5 May 2014 16:12:24 -0500 Subject: [PATCH 2/9] Issue #3109 - removed code that sets the Cave cursor. Change-Id: I1d6d640c5abafffdea29f1e2e835142fe6598470 Former-commit-id: a57f0e338d71bd702faeb96a81570c131a870a50 [formerly 550668cbf73b0c925a663f3b5187be2c6c2bf206] [formerly a6c2260dd14a7d6d351229bd41c72b7241b67389] [formerly b0a251f4e39ab6cc459c7e08f87bbea54bdf1b8b [formerly a6c2260dd14a7d6d351229bd41c72b7241b67389 [formerly d875f73ff44986b2c7862f0dee06504d576fd96b]]] Former-commit-id: b0a251f4e39ab6cc459c7e08f87bbea54bdf1b8b Former-commit-id: 99c525ad61eed1107476ce09523a10adfb16b511 [formerly 631a8d3cb164e759c50e2c31d3fd28fb6488d6e6] Former-commit-id: a092fd45dc26f634aa479a3b18ad7e15f5af7126 --- .../uf/viz/monitor/ffmp/fffg/FFFGDlg.java | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/cave/com.raytheon.uf.viz.monitor.ffmp/src/com/raytheon/uf/viz/monitor/ffmp/fffg/FFFGDlg.java b/cave/com.raytheon.uf.viz.monitor.ffmp/src/com/raytheon/uf/viz/monitor/ffmp/fffg/FFFGDlg.java index 3eb5d8d52f..32de4c553f 100644 --- a/cave/com.raytheon.uf.viz.monitor.ffmp/src/com/raytheon/uf/viz/monitor/ffmp/fffg/FFFGDlg.java +++ b/cave/com.raytheon.uf.viz.monitor.ffmp/src/com/raytheon/uf/viz/monitor/ffmp/fffg/FFFGDlg.java @@ -91,6 +91,8 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback; * Changes for non-blocking LoadSaveDeleteSelectDlg. * Mar 28, 2013 #1790 rferrel Bug fix for non-blocking dialogs. * Apr, 15, 2013 #1911 dhladky dialog wouldn't open every time to retrieve file. + * May 05, 2014 #3109 lvenable Removed code that sets the cursor on Cave because it doesn't need + * to be set. * * * @@ -310,8 +312,7 @@ public class FFFGDlg extends CaveSWTDialog implements ISourceCompAction, public FFFGDlg(Shell parentShell) { super(parentShell, SWT.DIALOG_TRIM, CAVE.INDEPENDENT_SHELL | CAVE.DO_NOT_BLOCK); - this.getParent().setCursor( - this.getParent().getDisplay().getSystemCursor(SWT.CURSOR_WAIT)); + setText("Forced Flash Flood Guidance"); sourceCompArray = new ArrayList(); @@ -808,15 +809,9 @@ public class FFFGDlg extends CaveSWTDialog implements ISourceCompAction, applyBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - getParent().setCursor( - getParent().getDisplay().getSystemCursor( - SWT.CURSOR_WAIT)); shell.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT)); applyDataAction(); updateFileStatusLabel(false); - getParent().setCursor( - getParent().getDisplay().getSystemCursor( - SWT.CURSOR_ARROW)); shell.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_ARROW)); saveFileAs(); @@ -886,6 +881,7 @@ public class FFFGDlg extends CaveSWTDialog implements ISourceCompAction, * -1 = error, 0 = information message * @param message */ + @Override public void setStatusMsg(int status, String message) { if (message == null) { statusLbl.setText(""); @@ -1609,8 +1605,8 @@ public class FFFGDlg extends CaveSWTDialog implements ISourceCompAction, } if (isDialogClear() && (fileNameLbl.getText().trim().length() == 0)) { - getRetrieveFilename(RetrieveMergeAction.RETRIEVE); - } else { + getRetrieveFilename(RetrieveMergeAction.RETRIEVE); + } else { if (retMergeDlg == null) { retMergeDlg = new RetrieveMergeDlg(shell); retMergeDlg.setCloseCallback(new ICloseCallback() { @@ -2223,10 +2219,6 @@ public class FFFGDlg extends CaveSWTDialog implements ISourceCompAction, sc.populateSourceComp(); statusLbl.setText(""); - this.getParent() - .setCursor( - this.getParent().getDisplay() - .getSystemCursor(SWT.CURSOR_ARROW)); } /* From 0fbb5dc22a3dc795f29730b63a4110b8f0e22a72 Mon Sep 17 00:00:00 2001 From: Brian Clements Date: Mon, 5 May 2014 12:52:46 -0500 Subject: [PATCH 3/9] Issue #3076 added clear all to shared display sessions Former-commit-id: 02c921ed127fefe27f23830ee5bf158e9ca2efca [formerly 729e717be1c63639ab82d3f8720f648d9e82038a] [formerly f545c548cc2a536f20fc7c3a8f9c8121ba85f8fa] [formerly 1432aa1302a52d56027f01d3b32fa5dfd548c11d [formerly f545c548cc2a536f20fc7c3a8f9c8121ba85f8fa [formerly 9e4a518f2ecbe86fed87fbb6dac7fad08ffb33eb]]] Former-commit-id: 1432aa1302a52d56027f01d3b32fa5dfd548c11d Former-commit-id: bcb942f3e18364de413f94465a2f8a874c91dc8e [formerly 5583c3903b4f6cc6e5ece5d6e4a42b3ce4e1bf26] Former-commit-id: 867484115490c777525cff948976129b893b2254 --- .../CollaborationDrawingEvent.java | 3 +- .../CollaborationDrawingResource.java | 41 +++++++++- .../icons/clear_all.gif | Bin 0 -> 223 bytes .../ui/session/CollaborationSessionView.java | 72 ++++++++++++++++-- .../uf/viz/drawing/DrawingToolLayer.java | 35 ++++++--- 5 files changed, 130 insertions(+), 21 deletions(-) create mode 100644 cave/com.raytheon.uf.viz.collaboration.ui/icons/clear_all.gif diff --git a/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/rsc/telestrator/CollaborationDrawingEvent.java b/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/rsc/telestrator/CollaborationDrawingEvent.java index 0c138412c9..ec07161cbd 100644 --- a/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/rsc/telestrator/CollaborationDrawingEvent.java +++ b/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/rsc/telestrator/CollaborationDrawingEvent.java @@ -37,6 +37,7 @@ import com.vividsolutions.jts.geom.Coordinate; * ------------ ---------- ----------- -------------------------- * Apr 3, 2012 mnash Initial creation * Jan 30, 2014 2698 bclement changed UserId to VenueParticipant + * May 05, 2014 3076 bclement added DISPOSE_ALL * * * @@ -48,7 +49,7 @@ import com.vividsolutions.jts.geom.Coordinate; public class CollaborationDrawingEvent { public static enum CollaborationEventType { - DRAW, ERASE, REDO, UNDO, CLEAR, LOCK_USERS, UNLOCK_USERS, CLEAR_ALL, NEW_USER_ARRIVED; + DRAW, ERASE, REDO, UNDO, CLEAR, CLEAR_ALL, LOCK_USERS, UNLOCK_USERS, DISPOSE_ALL, NEW_USER_ARRIVED; } @DynamicSerializeElement diff --git a/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/rsc/telestrator/CollaborationDrawingResource.java b/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/rsc/telestrator/CollaborationDrawingResource.java index 48dd9259fe..e9cd38f8b7 100644 --- a/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/rsc/telestrator/CollaborationDrawingResource.java +++ b/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/rsc/telestrator/CollaborationDrawingResource.java @@ -19,6 +19,9 @@ **/ package com.raytheon.uf.viz.collaboration.display.rsc.telestrator; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -64,6 +67,8 @@ import com.vividsolutions.jts.geom.Coordinate; * Jan 30, 2014 2698 bclement changed UserId to VenueParticipant * Feb 13, 2014 2751 bclement VenueParticipant refactor * Mar 18, 2014 2895 njensen Fix concurrent mod exception on dispose + * May 05, 2014 3076 bclement old CLEAR_ALL is now DISPOSE_ALL, + * added clearLayers() and getAllDrawingLayers() * * * @@ -129,7 +134,7 @@ public class CollaborationDrawingResource extends CollaborationDrawingEvent event = new CollaborationDrawingEvent( resourceData.getDisplayId()); event.setUserName(myUser); - event.setType(CollaborationEventType.CLEAR_ALL); + event.setType(CollaborationEventType.DISPOSE_ALL); sendEvent(event); } @@ -205,6 +210,18 @@ public class CollaborationDrawingResource extends } } + /** + * Clear all drawing layers. Does not generate any collaboration events. + * This is not "undoable". + */ + private void clearLayers() { + synchronized (layerMap) { + for (DrawingToolLayer layer : layerMap.values()) { + layer.clearAllDrawingData(); + } + } + } + /** * @return the myUser */ @@ -249,6 +266,23 @@ public class CollaborationDrawingResource extends return null; } + /** + * A collection of drawing layers for resource + * + * @return empty collection if there are no layers + */ + public Collection getAllDrawingLayers() { + Collection rval; + if (layerMap != null) { + synchronized (layerMap) { + rval = new ArrayList(layerMap.values()); + } + } else { + rval = Collections.emptyList(); + } + return rval; + } + /* * (non-Javadoc) * @@ -377,9 +411,12 @@ public class CollaborationDrawingResource extends case UNDO: layer.undo(); break; - case CLEAR_ALL: + case DISPOSE_ALL: disposeLayers(); break; + case CLEAR_ALL: + clearLayers(); + break; case NEW_USER_ARRIVED: CollaborationDrawingToolLayer myLayer = (CollaborationDrawingToolLayer) getDrawingLayerFor(getMyUser()); InitialCollaborationData dataBundle = new InitialCollaborationData( diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/icons/clear_all.gif b/cave/com.raytheon.uf.viz.collaboration.ui/icons/clear_all.gif new file mode 100644 index 0000000000000000000000000000000000000000..3baa1c7a858fb5673ed4f2ff1f9e81019896f547 GIT binary patch literal 223 zcmZ?wbhEHb6krfwc+AJJhk@Z71H(NAhBpih|A2^>_rJ9Ce_7f8y1M`E?f?1u{`2?$ z9~=9B?b`ofp!iSFxhOTUBsE2$JhLQ2!QIn0fI;ym3nK#qKZ6bf5P%G3U@8A#yLd_H zv8dt~PiLl?@E$K&axlZoQHj+_Z0a`|mX*Toxq^!s4>@d5V4HS$fuRBi``*Q$x5e-X zbv`@P>8dxAgON$CqgAlqk@1%T3tvIS0*yp(rdNlo9!wTsU}ujl;YB$Y(vLJ&s09xKr+5i9m literal 0 HcmV?d00001 diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/CollaborationSessionView.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/CollaborationSessionView.java index a27ce5e13c..a1b08ae7e0 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/CollaborationSessionView.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/CollaborationSessionView.java @@ -21,6 +21,7 @@ package com.raytheon.uf.viz.collaboration.ui.session; **/ import java.util.Collection; +import java.util.Collections; import java.util.IdentityHashMap; import java.util.Map; @@ -101,6 +102,7 @@ import com.raytheon.viz.ui.input.EditableManager; * Mar 11, 2014 2865 lvenable Added null checks in threads * Mar 18, 2014 2895 njensen Fix lockAction enable/disable logic * Apr 15, 2014 2822 bclement only allow transfer leader if participant is using shared display + * May 05, 2014 3076 bclement added clear all action * * * @@ -140,6 +142,8 @@ public class CollaborationSessionView extends SessionView implements private ActionContributionItem lockAction; + private ActionContributionItem clearAllAction; + private ControlContribution noEditorAction; private ISharedDisplaySession session; @@ -181,6 +185,21 @@ public class CollaborationSessionView extends SessionView implements return null; } + /** + * @see CollaborationDrawingResource#getAllDrawingLayers() + * @return empty collection if no layers are found + */ + private Collection getAllLayers() { + Collection rval; + CollaborationDrawingResource resource = getCurrentDrawingResource(); + if (resource != null) { + rval = resource.getAllDrawingLayers(); + } else { + rval = Collections.emptyList(); + } + return rval; + } + /* * (non-Javadoc) * @@ -354,7 +373,15 @@ public class CollaborationSessionView extends SessionView implements lockAction.getAction().setImageDescriptor( IconUtil.getImageDescriptor(Activator.getDefault().getBundle(), "lock.gif")); - + clearAllAction = new ActionContributionItem(new Action("Clear All") { + @Override + public void run() { + clearAllDrawingLayers(); + } + }); + clearAllAction.getAction().setImageDescriptor( + IconUtil.getImageDescriptor(Activator.getDefault().getBundle(), + "clear_all.gif")); noEditorAction = new ControlContribution("noEditorAction") { @Override @@ -383,12 +410,30 @@ public class CollaborationSessionView extends SessionView implements mgr.insert(mgr.getSize() - 1, redoAction); mgr.insert(mgr.getSize() - 1, clearAction); mgr.insert(mgr.getSize() - 1, eraseAction); + mgr.insert(mgr.getSize() - 1, new Separator()); mgr.insert(mgr.getSize() - 1, lockAction); + mgr.insert(mgr.getSize() - 1, clearAllAction); mgr.insert(mgr.getSize() - 1, new Separator()); updateToolItems(); } + /** + * Clear all drawing layers and send clear all event + */ + private void clearAllDrawingLayers() { + for (DrawingToolLayer layer : getAllLayers()) { + layer.clearAllDrawingData(); + } + CollaborationDrawingResource resource = getCurrentDrawingResource(); + CollaborationDrawingEvent event = new CollaborationDrawingEvent( + resource.getResourceData().getDisplayId()); + event.setType(CollaborationEventType.CLEAR_ALL); + event.setUserName(resource.getMyUser()); + resource.sendEvent(event); + updateToolItems(); + } + private void toggleDrawMode(DrawMode mode) { if (mode != DrawMode.NONE) { CollaborationDrawingResource resource = getCurrentDrawingResource(); @@ -411,6 +456,20 @@ public class CollaborationSessionView extends SessionView implements } } + /** + * @return true if any drawing layer has been drawn on + */ + private boolean anyLayerHasDrawing() { + boolean anyCanClear = false; + for (DrawingToolLayer dtl : getAllLayers()) { + if (dtl.hasDrawing()) { + anyCanClear = true; + break; + } + } + return anyCanClear; + } + public void updateToolItems() { ToolBarManager mgr = (ToolBarManager) getViewSite().getActionBars() .getToolBarManager(); @@ -419,24 +478,21 @@ public class CollaborationSessionView extends SessionView implements mgr.insert(0, noEditorAction); } CollaborationDrawingResource currentResource = getCurrentDrawingResource(); - DrawingToolLayer layer = null; - if (currentResource != null) { - layer = currentResource.getDrawingLayerFor(currentResource - .getMyUser()); - } + DrawingToolLayer layer = getCurrentLayer(); if (layer != null && currentResource.isSessionLeader()) { lockAction.getAction().setEnabled(true); + clearAllAction.getAction().setEnabled(anyLayerHasDrawing()); } else { lockAction.getAction().setEnabled(false); + clearAllAction.getAction().setEnabled(false); } - // enable/disable toolbar buttons based on locked if (layer != null && (locked == false || currentResource.isSessionLeader())) { drawAction.getAction().setEnabled(true); undoAction.getAction().setEnabled(layer.canUndo()); redoAction.getAction().setEnabled(layer.canRedo()); - clearAction.getAction().setEnabled(layer.canClear()); + clearAction.getAction().setEnabled(layer.hasDrawing()); eraseAction.getAction().setEnabled(true); switch (layer.getDrawMode()) { case DRAW: diff --git a/cave/com.raytheon.uf.viz.drawing/src/com/raytheon/uf/viz/drawing/DrawingToolLayer.java b/cave/com.raytheon.uf.viz.drawing/src/com/raytheon/uf/viz/drawing/DrawingToolLayer.java index bd549a3665..8112d33860 100644 --- a/cave/com.raytheon.uf.viz.drawing/src/com/raytheon/uf/viz/drawing/DrawingToolLayer.java +++ b/cave/com.raytheon.uf.viz.drawing/src/com/raytheon/uf/viz/drawing/DrawingToolLayer.java @@ -65,6 +65,8 @@ import com.vividsolutions.jts.geom.TopologyException; * May 23, 2012 mschenke Initial creation * May 23, 2012 2646 bsteffen Fix NPE in project. * Apr 03, 2014 2967 njensen Fix error when erasing the last part of a line + * May 05, 2014 3076 bclement added clearAllDrawingData() and disposeWireframeShape() + * renamed canClear() to hasDrawing() * * * @@ -331,15 +333,7 @@ public class DrawingToolLayer implements IRenderable { * Disposes the data in the layer */ public void dispose() { - synchronized (currentData) { - if (wireframeShape != null) { - wireframeShape.dispose(); - } - currentData.geometries.clear(); - currentDrawingLine = null; - undoStack.clear(); - redoStack.clear(); - } + clearAllDrawingData(); } /** @@ -503,7 +497,7 @@ public class DrawingToolLayer implements IRenderable { * * @return */ - public boolean canClear() { + public boolean hasDrawing() { return currentData.geometries.size() > 0 || redoStack.size() > 0; } @@ -535,6 +529,20 @@ public class DrawingToolLayer implements IRenderable { } } + /** + * Clears the current display and the undo and redo stacks. This operation + * is not "undoable" + */ + public void clearAllDrawingData() { + synchronized (currentData) { + disposeWireframeShape(); + currentData.geometries.clear(); + currentDrawingLine = null; + undoStack.clear(); + redoStack.clear(); + } + } + /** * Pushes currentData on pushStack and pops next frame from popStack and * puts in currentData @@ -568,6 +576,13 @@ public class DrawingToolLayer implements IRenderable { StackFrame oldData = new StackFrame(new ArrayList( currentData.geometries)); stack.push(oldData); + disposeWireframeShape(); + } + + /** + * disposes and sets wireframeShape to null if not already null + */ + private void disposeWireframeShape() { if (wireframeShape != null) { wireframeShape.dispose(); wireframeShape = null; From 9846fbd82ce8cc52a8d688442c11f7c8a34524b3 Mon Sep 17 00:00:00 2001 From: Richard Peter Date: Mon, 5 May 2014 19:30:20 -0500 Subject: [PATCH 4/9] Issue #2726: Autoset route startup order. Change-Id: I1f4165b6eab12207cf6b6d31964e8170ebe1bddc Former-commit-id: f76ed476c8aa24727fb18f9a11e110a63da4016a [formerly 8ae9cfba55eb037e40dc642c23c94e224dddefc4] [formerly b148d11ec9018f4d4ff965b39436152d3501aa96] [formerly 4dc91f494fdac3628ad1451ac2f40f947ff69730 [formerly b148d11ec9018f4d4ff965b39436152d3501aa96 [formerly 9b9d2b475f4777febf125e4013cba0d971eaf8e8]]] Former-commit-id: 4dc91f494fdac3628ad1451ac2f40f947ff69730 Former-commit-id: c051c2b6a07908c54dd3268091a67a3084664d5b [formerly c6719da76b5f3e42c41392ca54bd2a5013c5d83a] Former-commit-id: 7fe7b43ee2792ee8d9e949cd18dfbef9a8e9fbb8 --- .../res/spring/text-ingest.xml | 54 +++++++------ .../esb/camel/context/ContextManager.java | 80 +++++++++++++++---- .../res/spring/persist-ingest.xml | 4 + .../res/spring/modelsounding-ingest.xml | 5 +- 4 files changed, 101 insertions(+), 42 deletions(-) diff --git a/edexOsgi/com.raytheon.edex.plugin.text/res/spring/text-ingest.xml b/edexOsgi/com.raytheon.edex.plugin.text/res/spring/text-ingest.xml index ba7acf67c8..09c6394bcd 100644 --- a/edexOsgi/com.raytheon.edex.plugin.text/res/spring/text-ingest.xml +++ b/edexOsgi/com.raytheon.edex.plugin.text/res/spring/text-ingest.xml @@ -86,8 +86,35 @@ --> + + + + text + + + + + + + + + + + + + + + + java.lang.Throwable + + + + + @@ -134,31 +161,6 @@ - - - - text - - - - - - - - - - - - - - - - java.lang.Throwable - - - - - diff --git a/edexOsgi/com.raytheon.uf.edex.esb.camel/src/com/raytheon/uf/edex/esb/camel/context/ContextManager.java b/edexOsgi/com.raytheon.uf.edex.esb.camel/src/com/raytheon/uf/edex/esb/camel/context/ContextManager.java index 7490a1e673..a7ce7b3bc0 100644 --- a/edexOsgi/com.raytheon.uf.edex.esb.camel/src/com/raytheon/uf/edex/esb/camel/context/ContextManager.java +++ b/edexOsgi/com.raytheon.uf.edex.esb.camel/src/com/raytheon/uf/edex/esb/camel/context/ContextManager.java @@ -20,6 +20,7 @@ package com.raytheon.uf.edex.esb.camel.context; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -38,6 +39,7 @@ import javax.naming.ConfigurationException; import org.apache.camel.CamelContext; import org.apache.camel.Route; import org.apache.camel.impl.DefaultCamelContext; +import org.apache.camel.model.RouteDefinition; import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.BeanFactoryPostProcessor; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; @@ -78,6 +80,21 @@ public class ContextManager implements ApplicationContextAware, private static ContextManager instance = new ContextManager(); + /** + * Endpoint types that are internal only. Mainly used at shutdown time to + * designate routes that shouldn't be shutdown immediately. + */ + private static final Set INTERNAL_ENDPOINT_TYPES; + + static { + HashSet set = new HashSet( + ContextDependencyMapping.DEPENDENCY_ENDPOINT_TYPES); + set.add("timer"); + set.add("quartz"); + set.add("direct"); + INTERNAL_ENDPOINT_TYPES = Collections.unmodifiableSet(set); + } + /** * Service used for start up and shut down threading. */ @@ -102,12 +119,6 @@ public class ContextManager implements ApplicationContextAware, */ private ApplicationContext springCtx = null; - /** - * Endpoint types that are internal only. Mainly used at shutdown time to - * designate routes that shouldn't be shutdown immediately. - */ - private final Set internalEndpointTypes = new HashSet(); - /** * Map of context processors that have been registered for a given context. * Used to allow contexts to do custom worn on startup/shutdown. @@ -147,15 +158,19 @@ public class ContextManager implements ApplicationContextAware, } /** - * Private constructor. Sets up internal types for prioritized stopping of - * routes on shutdown. + * Private constructor. */ private ContextManager() { - internalEndpointTypes - .addAll(ContextDependencyMapping.DEPENDENCY_ENDPOINT_TYPES); - internalEndpointTypes.add("timer"); - internalEndpointTypes.add("quartz"); - internalEndpointTypes.add("direct"); + } + + /** + * Returns a set of endpoint types that are considered internal for routing + * purposes. + * + * @return + */ + public Set getInternalEndpointTypes() { + return INTERNAL_ENDPOINT_TYPES; } /** @@ -242,6 +257,31 @@ public class ContextManager implements ApplicationContextAware, List>> callbacks = new LinkedList>>(); for (final CamelContext context : cxtData.getContexts()) { + /* + * Enforce startup order so that internal endpoints start first + * and shutdown last. Each route must have a unique number under + * 1000. Camel documentation doesn't state if numbers can be + * negative or not. Order is reverse of how they are found in + * the file with internal types going first followed by external + * types. + */ + int externalCount = 999; + int internalCount = externalCount - context.getRoutes().size(); + + for (Route route : context.getRoutes()) { + String uri = route.getEndpoint().getEndpointUri(); + Pair typeAndName = ContextData + .getEndpointTypeAndName(uri); + String type = typeAndName.getFirst(); + RouteDefinition def = route.getRouteContext().getRoute(); + + if (INTERNAL_ENDPOINT_TYPES.contains(type)) { + def.setStartupOrder(internalCount--); + } else { + def.setStartupOrder(externalCount--); + } + } + final IContextStateManager stateManager = getStateManager(context); if (stateManager.isContextStartable(context)) { /* @@ -410,7 +450,7 @@ public class ContextManager implements ApplicationContextAware, Pair typeAndName = ContextData .getEndpointTypeAndName(uri); String type = typeAndName.getFirst(); - if (!internalEndpointTypes.contains(type)) { + if (!INTERNAL_ENDPOINT_TYPES.contains(type)) { try { statusHandler.info("Stopping route [" + route.getId() + "]"); @@ -531,7 +571,7 @@ public class ContextManager implements ApplicationContextAware, } /** - * Update all camel beans to have autoStartup to false and handles quart + * Update all camel beans to have autoStartup to false and handles quartz * workaround when JMX is disabled. */ @Override @@ -539,8 +579,18 @@ public class ContextManager implements ApplicationContextAware, ConfigurableListableBeanFactory beanFactory) throws BeansException { for (CamelContext ctx : beanFactory.getBeansOfType(CamelContext.class) .values()) { + /* + * set contexts to not auto start to enforce dependency order + * correctly. + */ ctx.setAutoStartup(false); + /* + * Quartz work around to set management name. + * + * TODO: Remove with camel 2.12.3 upgrade: + * https://issues.apache.org/jira/browse/CAMEL-7132 + */ if ((ctx instanceof DefaultCamelContext) && (ctx.getManagementName() == null)) { ((DefaultCamelContext) ctx).setManagementName(ctx.getName()); diff --git a/edexOsgi/com.raytheon.uf.edex.ingest/res/spring/persist-ingest.xml b/edexOsgi/com.raytheon.uf.edex.ingest/res/spring/persist-ingest.xml index b14c671dbc..6045f19ea7 100644 --- a/edexOsgi/com.raytheon.uf.edex.ingest/res/spring/persist-ingest.xml +++ b/edexOsgi/com.raytheon.uf.edex.ingest/res/spring/persist-ingest.xml @@ -51,6 +51,10 @@ + diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.modelsounding/res/spring/modelsounding-ingest.xml b/edexOsgi/com.raytheon.uf.edex.plugin.modelsounding/res/spring/modelsounding-ingest.xml index 518b24d3c4..f1e08678f6 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.modelsounding/res/spring/modelsounding-ingest.xml +++ b/edexOsgi/com.raytheon.uf.edex.plugin.modelsounding/res/spring/modelsounding-ingest.xml @@ -86,7 +86,10 @@ - + From e8ca9729eb4e8091c95fb75df71b46ba904f22a7 Mon Sep 17 00:00:00 2001 From: Nate Jensen Date: Tue, 6 May 2014 10:47:50 -0500 Subject: [PATCH 5/9] Issue #2060 fill in units on GridRecords created from URIs Change-Id: Ic7c1594c1442d8463c5050bdefb434995ffc7f8a Former-commit-id: 1d38804eb2ad97505b915a63517a05e86bb1b354 [formerly 3719c41d2b5c8f08bf53618a12731dbb9e20cd84] [formerly 71b422706132e75fb83ae6ec2229f480d2892648] [formerly 7cea97ab15b866474ae50e439b942d891c96b5be [formerly 71b422706132e75fb83ae6ec2229f480d2892648 [formerly 949d132cf3260db5f75ea665f21601ab91440958]]] Former-commit-id: 7cea97ab15b866474ae50e439b942d891c96b5be Former-commit-id: 4cf3887df369f38b75f0a2c9f9f7949057e50e42 [formerly 6bdbfb7e1ae53dc869fe0fdc6013f6dacf2748ca] Former-commit-id: 5bf15545978cb944a0fd17f73c48ef1ce45b0a0f --- .../viz/satellite/rsc/SatResource.java | 3 +- .../dataplugin/grid/GridInfoRecord.java | 3 +- .../uf/common/parameter/Parameter.java | 2 - .../common/parameter/ParameterConverter.java | 59 +++++++++++++++++++ .../META-INF/MANIFEST.MF | 10 ++-- .../uf/edex/dat/utils/FreezingLevel.java | 5 +- 6 files changed, 70 insertions(+), 12 deletions(-) create mode 100644 edexOsgi/com.raytheon.uf.common.parameter/src/com/raytheon/uf/common/parameter/ParameterConverter.java diff --git a/cave/com.raytheon.viz.satellite/src/com/raytheon/viz/satellite/rsc/SatResource.java b/cave/com.raytheon.viz.satellite/src/com/raytheon/viz/satellite/rsc/SatResource.java index 55204a29b3..41f30e9b68 100644 --- a/cave/com.raytheon.viz.satellite/src/com/raytheon/viz/satellite/rsc/SatResource.java +++ b/cave/com.raytheon.viz.satellite/src/com/raytheon/viz/satellite/rsc/SatResource.java @@ -100,6 +100,7 @@ import com.vividsolutions.jts.geom.Coordinate; * rules. * Apr 09, 2014 2947 bsteffen Improve flexibility of sat derived * parameters, implement ImageProvider + * May 06, 2014 njensen Improve error message * * * @@ -257,7 +258,7 @@ public class SatResource extends initializeFirstFrame((SatelliteRecord) pdo); } catch (VizException e) { throw new IllegalStateException( - "Unable to initialize the satellite resource"); + "Unable to initialize the satellite resource", e); } initialized = true; } diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/src/com/raytheon/uf/common/dataplugin/grid/GridInfoRecord.java b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/src/com/raytheon/uf/common/dataplugin/grid/GridInfoRecord.java index 7a40edd823..1ed01e29bb 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/src/com/raytheon/uf/common/dataplugin/grid/GridInfoRecord.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/src/com/raytheon/uf/common/dataplugin/grid/GridInfoRecord.java @@ -36,6 +36,7 @@ import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject; import com.raytheon.uf.common.gridcoverage.GridCoverage; import com.raytheon.uf.common.gridcoverage.convert.GridCoverageConverter; import com.raytheon.uf.common.parameter.Parameter; +import com.raytheon.uf.common.parameter.ParameterConverter; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; @@ -106,7 +107,7 @@ public class GridInfoRecord extends PersistableDataObject { @ManyToOne @PrimaryKeyJoinColumn - @DataURI(position = 4, embedded = true) + @DataURI(position = 4, converter = ParameterConverter.class) @DynamicSerializeElement private Parameter parameter; diff --git a/edexOsgi/com.raytheon.uf.common.parameter/src/com/raytheon/uf/common/parameter/Parameter.java b/edexOsgi/com.raytheon.uf.common.parameter/src/com/raytheon/uf/common/parameter/Parameter.java index b7ecd7d3bb..6479a8a49b 100644 --- a/edexOsgi/com.raytheon.uf.common.parameter/src/com/raytheon/uf/common/parameter/Parameter.java +++ b/edexOsgi/com.raytheon.uf.common.parameter/src/com/raytheon/uf/common/parameter/Parameter.java @@ -34,7 +34,6 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; -import com.raytheon.uf.common.dataplugin.annotations.DataURI; import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject; import com.raytheon.uf.common.serialization.ISerializableObject; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; @@ -71,7 +70,6 @@ public class Parameter extends PersistableDataObject implements @Id @DynamicSerializeElement @XmlElement - @DataURI(position = 0) private String abbreviation; @Column(nullable = false) diff --git a/edexOsgi/com.raytheon.uf.common.parameter/src/com/raytheon/uf/common/parameter/ParameterConverter.java b/edexOsgi/com.raytheon.uf.common.parameter/src/com/raytheon/uf/common/parameter/ParameterConverter.java new file mode 100644 index 0000000000..7ebeab9c80 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.parameter/src/com/raytheon/uf/common/parameter/ParameterConverter.java @@ -0,0 +1,59 @@ +/** + * This software was developed and / or modified by Raytheon Company, + * pursuant to Contract DG133W-05-CQ-1067 with the US Government. + * + * U.S. EXPORT CONTROLLED TECHNICAL DATA + * This software product contains export-restricted data whose + * export/transfer/disclosure is restricted by U.S. law. Dissemination + * to non-U.S. persons whether in the United States or abroad requires + * an export license or other authorization. + * + * Contractor Name: Raytheon Company + * Contractor Address: 6825 Pine Street, Suite 340 + * Mail Stop B8 + * Omaha, NE 68106 + * 402.291.0100 + * + * See the AWIPS II Master Rights File ("Master Rights File.pdf") for + * further licensing information. + **/ +package com.raytheon.uf.common.parameter; + +import com.raytheon.uf.common.dataplugin.annotations.DataURIFieldConverter; +import com.raytheon.uf.common.parameter.lookup.ParameterLookup; + +/** + * A DataURIFieldConverter that ensures that a String parameter abbreviation + * will be looked up to potentially contain all the fields. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * May 6, 2014  2060       njensen     Initial creation
+ * 
+ * 
+ * + * @author njensen + * @version 1.0 + */ + +public class ParameterConverter implements DataURIFieldConverter { + + @Override + public String toString(Parameter field) { + return field.getAbbreviation(); + } + + @Override + public Parameter fromString(String string) { + Parameter p = ParameterLookup.getInstance().getParameter(string); + if (p == null) { + p = new Parameter(string); + } + return p; + } + +} diff --git a/edexOsgi/com.raytheon.uf.edex.dat.utils/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.dat.utils/META-INF/MANIFEST.MF index c3cbd9a5dc..d74ea2f075 100644 --- a/edexOsgi/com.raytheon.uf.edex.dat.utils/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.edex.dat.utils/META-INF/MANIFEST.MF @@ -2,11 +2,10 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: DatUtils Plug-in Bundle-SymbolicName: com.raytheon.uf.edex.dat.utils -Bundle-Version: 1.12.1174.qualifier +Bundle-Version: 1.14.0.qualifier Bundle-Vendor: RAYTHEON Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Import-Package: com.raytheon.uf.common.dataplugin.ffmp, - com.raytheon.uf.common.dataplugin.grid, +Import-Package: com.raytheon.uf.common.dataplugin.grid, com.raytheon.uf.common.dataplugin.scan.data, com.raytheon.uf.common.localization, com.raytheon.uf.common.monitor.xml, @@ -14,7 +13,6 @@ Import-Package: com.raytheon.uf.common.dataplugin.ffmp, org.apache.commons.logging Export-Package: com.raytheon.uf.edex.dat.utils Require-Bundle: com.raytheon.edex.common;bundle-version="1.12.2", - com.raytheon.uf.common.dataplugin.ffmp;bundle-version="1.12.2", com.raytheon.uf.common.monitor;bundle-version="1.12.2", - com.raytheon.uf.common.dataplugin.shef;bundle-version="1.12.1174", - com.raytheon.uf.edex.menus;bundle-version="1.0.0" + com.raytheon.uf.edex.menus;bundle-version="1.0.0", + com.raytheon.uf.common.parameter diff --git a/edexOsgi/com.raytheon.uf.edex.dat.utils/src/com/raytheon/uf/edex/dat/utils/FreezingLevel.java b/edexOsgi/com.raytheon.uf.edex.dat.utils/src/com/raytheon/uf/edex/dat/utils/FreezingLevel.java index 539109ba4c..b4703b2e96 100644 --- a/edexOsgi/com.raytheon.uf.edex.dat.utils/src/com/raytheon/uf/edex/dat/utils/FreezingLevel.java +++ b/edexOsgi/com.raytheon.uf.edex.dat.utils/src/com/raytheon/uf/edex/dat/utils/FreezingLevel.java @@ -1,5 +1,3 @@ -package com.raytheon.uf.edex.dat.utils; - /** * This software was developed and / or modified by Raytheon Company, * pursuant to Contract DG133W-05-CQ-1067 with the US Government. @@ -19,6 +17,9 @@ package com.raytheon.uf.edex.dat.utils; * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ + +package com.raytheon.uf.edex.dat.utils; + import java.util.ArrayList; import java.util.Calendar; import java.util.Date; From b16bfd2b389da509118c02851380f9c0edb99d75 Mon Sep 17 00:00:00 2001 From: Nate Jensen Date: Tue, 6 May 2014 13:10:48 -0500 Subject: [PATCH 6/9] Issue #2060 genericize DataURIFieldConverter Change-Id: I885b0a8ec64eb69256c04fa2476814b1300fcdd4 Former-commit-id: 37b72c933b772a14223b20962bb75ec1e5eefc3f [formerly 770182090256725913e1c297367544fc493d6301] [formerly ff6c77420c800b974bb0b1e46c4514a40eb83182] [formerly 87b6df4840a407f9d98ce18210fe131a24d8ad28 [formerly ff6c77420c800b974bb0b1e46c4514a40eb83182 [formerly 0a7265da59457e8dc6a122db81b134d6555d5276]]] Former-commit-id: 87b6df4840a407f9d98ce18210fe131a24d8ad28 Former-commit-id: 620466e14629a8e102bf9c9fd5dc3bbc2e70ff37 [formerly a6363fc3d484175b718aa8bbff052b158032ac1b] Former-commit-id: d1a040b9c2c422f7d9af4aeff5506c11783107e9 --- .../dataplugin/annotations/DataURIFieldConverter.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin/src/com/raytheon/uf/common/dataplugin/annotations/DataURIFieldConverter.java b/edexOsgi/com.raytheon.uf.common.dataplugin/src/com/raytheon/uf/common/dataplugin/annotations/DataURIFieldConverter.java index 589161734a..cb539602d4 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin/src/com/raytheon/uf/common/dataplugin/annotations/DataURIFieldConverter.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin/src/com/raytheon/uf/common/dataplugin/annotations/DataURIFieldConverter.java @@ -29,7 +29,8 @@ package com.raytheon.uf.common.dataplugin.annotations; * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Oct 3, 2013 2081 mschenke Initial creation + * Oct 03, 2013 2081 mschenke Initial creation + * May 06, 2014 2060 njensen Added generics * * * @@ -37,7 +38,7 @@ package com.raytheon.uf.common.dataplugin.annotations; * @version 1.0 */ -public interface DataURIFieldConverter { +public interface DataURIFieldConverter { /** * Converts field object to a String for the DataURI @@ -45,7 +46,7 @@ public interface DataURIFieldConverter { * @param field * @return */ - public String toString(Object field); + public String toString(T field); /** * Converts String returned from {@link #toString()} back into a field @@ -54,6 +55,6 @@ public interface DataURIFieldConverter { * @param string * @return */ - public Object fromString(String string); + public T fromString(String string); } From 8e8e1c45ed93dd8fa5fc1c8f1f357e20dbbeb354 Mon Sep 17 00:00:00 2001 From: Richard Peter Date: Tue, 6 May 2014 15:54:23 -0500 Subject: [PATCH 7/9] Issue #2726: update smartInit threads to 1 Change-Id: Ic2d432087f66fd9f03b3d6f01fefce8af0d5b0b0 Former-commit-id: 2044b64206ec897a7196a839c519d18a322fcfda [formerly 884562700aeb1a9bdf7d60ba3e582f45ba8a08c2] [formerly 03ab7599deaeea51513bcecd8e22197e37d95feb] [formerly 611c010968ce4b4b1da1147d3fd1362db1458411 [formerly 03ab7599deaeea51513bcecd8e22197e37d95feb [formerly c12469d133558750e85049f7ce0f0a42b802c2b9]]] Former-commit-id: 611c010968ce4b4b1da1147d3fd1362db1458411 Former-commit-id: f30788353ad2101cd2e64a4eed43d47dc68ddbb5 [formerly 4f2d4708019496d5e300d550c0e22bffc69e027e] Former-commit-id: be288505e0efea37d4ed4c8f01b7e0ac1a452ba1 --- .../resources/com.raytheon.edex.plugin.gfe.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/resources/com.raytheon.edex.plugin.gfe.properties b/edexOsgi/com.raytheon.edex.plugin.gfe/resources/com.raytheon.edex.plugin.gfe.properties index a5529c1a1c..da3c8dac1c 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/resources/com.raytheon.edex.plugin.gfe.properties +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/resources/com.raytheon.edex.plugin.gfe.properties @@ -1,2 +1,2 @@ # The number of smart init threads to use -smartinit.threads=2 +smartinit.threads=1 From c83559ee618ff94c7910b68e40f80019af2a81ba Mon Sep 17 00:00:00 2001 From: Ben Steffensmeier Date: Tue, 6 May 2014 16:15:37 -0500 Subject: [PATCH 8/9] Issue #3117 update satellite inventory for new sectors or elements. Former-commit-id: 34c4ce163021f040c487f815e86f08f53de87b10 [formerly e70a6999b78187cd4eecd36b5699e69e7f6a5e46] [formerly bbbf957ba88bada655413a58c6f3bf0a860dbced] [formerly 70df0ee87ea89c8354eedbd30df661d625814436 [formerly bbbf957ba88bada655413a58c6f3bf0a860dbced [formerly 35845fa63be35661893d31510f83e2d9ab6f60af]]] Former-commit-id: 70df0ee87ea89c8354eedbd30df661d625814436 Former-commit-id: 4e4ce9614076e1c738d79e3feab9658310edbcb5 [formerly 945fe1db2f241901097dd47da8e7fe8bca7a7ec0] Former-commit-id: 81916ecdb64370a93489447831eb7ed5aae460f4 --- .../META-INF/MANIFEST.MF | 3 +- .../inventory/SatelliteInventory.java | 33 ++++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/cave/com.raytheon.viz.satellite/META-INF/MANIFEST.MF b/cave/com.raytheon.viz.satellite/META-INF/MANIFEST.MF index 3186ca34c3..7b2a3d75be 100644 --- a/cave/com.raytheon.viz.satellite/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.viz.satellite/META-INF/MANIFEST.MF @@ -28,7 +28,8 @@ Require-Bundle: org.eclipse.ui, com.raytheon.uf.viz.datacube;bundle-version="1.14.0", com.raytheon.uf.common.dataplugin.level, com.raytheon.uf.common.comm, - com.raytheon.uf.common.numeric + com.raytheon.uf.common.numeric, + com.raytheon.viz.alerts Bundle-ActivationPolicy: lazy Export-Package: com.raytheon.viz.satellite, com.raytheon.viz.satellite.rsc diff --git a/cave/com.raytheon.viz.satellite/src/com/raytheon/viz/satellite/inventory/SatelliteInventory.java b/cave/com.raytheon.viz.satellite/src/com/raytheon/viz/satellite/inventory/SatelliteInventory.java index 6bfda8f9f8..3f94381331 100644 --- a/cave/com.raytheon.viz.satellite/src/com/raytheon/viz/satellite/inventory/SatelliteInventory.java +++ b/cave/com.raytheon.viz.satellite/src/com/raytheon/viz/satellite/inventory/SatelliteInventory.java @@ -53,6 +53,9 @@ import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.time.DataTime; +import com.raytheon.uf.viz.core.alerts.AlertMessage; +import com.raytheon.viz.alerts.IAlertObserver; +import com.raytheon.viz.alerts.observers.ProductAlertObserver; /** * Inventory of available satellite data. sectorID is used for source and @@ -65,13 +68,15 @@ import com.raytheon.uf.common.time.DataTime; * Date Ticket# Engineer Description * ------------- -------- ----------- -------------------------- * Apr 09, 2014 2947 bsteffen Initial creation + * May 06, 2014 3117 bsteffen Update for new data. * * * * @author bsteffen * @version 1.0 */ -public class SatelliteInventory extends AbstractInventory { +public class SatelliteInventory extends AbstractInventory implements + IAlertObserver { private static final IUFStatusHandler statusHandler = UFStatus .getHandler(SatelliteInventory.class); @@ -88,6 +93,10 @@ public class SatelliteInventory extends AbstractInventory { private Level level; + public SatelliteInventory() { + ProductAlertObserver.addObserver(SATELLITE, this); + } + @Override public List timeAgnosticQuery(Map query) { /* Returning null means no data will be time agnostic. */ @@ -226,4 +235,26 @@ public class SatelliteInventory extends AbstractInventory { } } + @Override + public void alertArrived(Collection alertMessages) { + if (dataTree == null) { + return; + } + for (AlertMessage message : alertMessages) { + String sector = message.decodedAlert.get(SECTOR_ID).toString(); + String pe = message.decodedAlert.get(PHYSICALELEMENT).toString(); + if (dataTree.getParameterNode(sector, pe) == null) { + /* + * When a sector or element arrives that is not known reinit the + * tree to ensure no nodes are missing. + */ + try { + initTree(derParLibrary); + } catch (DataCubeException e) { + statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e); + } + return; + } + } + } } From c333277d3068edcf30f32f8e4f2d7de3f13cc20b Mon Sep 17 00:00:00 2001 From: Nate Jensen Date: Tue, 6 May 2014 17:08:04 -0500 Subject: [PATCH 9/9] Issue #3101 fix some derived parameters on win64 platform Change-Id: I9de1d31e7f7c19af437aef834aa84f163bf36d86 Former-commit-id: 3aa9bfdca1a089ad7b30ffa87058bf293e1b37a0 [formerly 49d34cc4e4acb677d4f79e975e799c7dc60c9700] [formerly 5191b61b30f8e588052c95cdcd179c181ad61776] [formerly aa7c1fac905c86402db9a0ab6dea259165be4928 [formerly 5191b61b30f8e588052c95cdcd179c181ad61776 [formerly 4659c0240aa31b615bc50228906d514f47a72f94]]] Former-commit-id: aa7c1fac905c86402db9a0ab6dea259165be4928 Former-commit-id: e218d9c6b2e2544a412d7bf24b528ba73c8cd8fc [formerly 8c1748d3701b9d851b88e9a6ecb1b29e76a86f9b] Former-commit-id: 815aa21d8e7d99a604672430bed7eadee1f7e651 --- .../base/derivedParameters/functions/Cape.py | 19 +++++++++++++------ .../base/derivedParameters/functions/Dcape.py | 4 +++- .../derivedParameters/functions/Filter.py | 10 +++++++++- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/edexOsgi/com.raytheon.uf.common.derivparam.python/utility/common_static/base/derivedParameters/functions/Cape.py b/edexOsgi/com.raytheon.uf.common.derivparam.python/utility/common_static/base/derivedParameters/functions/Cape.py index da98d5c111..d18b656da9 100644 --- a/edexOsgi/com.raytheon.uf.common.derivparam.python/utility/common_static/base/derivedParameters/functions/Cape.py +++ b/edexOsgi/com.raytheon.uf.common.derivparam.python/utility/common_static/base/derivedParameters/functions/Cape.py @@ -18,6 +18,14 @@ # further licensing information. ## +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# --/--/----- Initial creation +# May 06, 2014 3101 njensen Cast numpy shape values to int +# for cross platform compatibility + from com.raytheon.uf.common.derivparam.python.function import CapeFuncPythonAdapter as CapeFunc from numpy import zeros @@ -90,9 +98,8 @@ def __execute(*args): pressureValue = pressure pressure = zeros(temperatureValues.shape, temperatureValues.dtype) pressure[:] = pressureValue - if upperTerminationPressure is None: - threeDshape = pressureValues.shape - return CapeFunc.capeFunc(useVirtualTemp, pressureValues, temperatureValues, pressure, potentialTemperature, specificHumidity, threeDshape[1], threeDshape[2], threeDshape[0]).__numpy__ - else: - threeDshape = pressureValues.shape - return CapeFunc.capeFuncTop(useVirtualTemp, pressureValues, temperatureValues, pressure, potentialTemperature, specificHumidity, upperTerminationPressure, threeDshape[1], threeDshape[2], threeDshape[0]).__numpy__ + threeDshape = pressureValues.shape + if upperTerminationPressure is None: + return CapeFunc.capeFunc(useVirtualTemp, pressureValues, temperatureValues, pressure, potentialTemperature, specificHumidity, int(threeDshape[1]), int(threeDshape[2]), int(threeDshape[0])).__numpy__ + else: + return CapeFunc.capeFuncTop(useVirtualTemp, pressureValues, temperatureValues, pressure, potentialTemperature, specificHumidity, upperTerminationPressure, int(threeDshape[1]), int(threeDshape[2]), int(threeDshape[0])).__numpy__ diff --git a/edexOsgi/com.raytheon.uf.common.derivparam.python/utility/common_static/base/derivedParameters/functions/Dcape.py b/edexOsgi/com.raytheon.uf.common.derivparam.python/utility/common_static/base/derivedParameters/functions/Dcape.py index 778bab0f56..c8668c0b13 100644 --- a/edexOsgi/com.raytheon.uf.common.derivparam.python/utility/common_static/base/derivedParameters/functions/Dcape.py +++ b/edexOsgi/com.raytheon.uf.common.derivparam.python/utility/common_static/base/derivedParameters/functions/Dcape.py @@ -24,6 +24,8 @@ # ------------ ---------- ----------- -------------------------- # Feb 17, 2010 4502 jelkins Initial Creation. # Jun 05, 2013 2043 bsteffen Ported from meteolib C +# May 06, 2014 3101 njensen Cast numpy shape values to int +# for cross platform compatibility from numpy import zeros from com.raytheon.uf.common.derivparam.python.function import DCapeFuncPythonAdapter as DCapeFunc @@ -62,5 +64,5 @@ def execute(threeDtemperature, threeDdewpoint, pressure, potentialTemperature, s pressure = zeros(potentialTemperature.shape, potentialTemperature.dtype) pressure[:] = pressureValue threeDshape = threeDpressure.shape - return DCapeFunc.dcapeFunc(useVirtualTemp, threeDpressure, threeDtemperature[0], threeDdewpoint[0], pressure, potentialTemperature, specificHumidity, threeDshape[1], threeDshape[2], threeDshape[0], maxEvaporation, maxRelativeHumidity).__numpy__[0] + return DCapeFunc.dcapeFunc(useVirtualTemp, threeDpressure, threeDtemperature[0], threeDdewpoint[0], pressure, potentialTemperature, specificHumidity, int(threeDshape[1]), int(threeDshape[2]), int(threeDshape[0]), maxEvaporation, maxRelativeHumidity).__numpy__[0] diff --git a/edexOsgi/com.raytheon.uf.common.derivparam.python/utility/common_static/base/derivedParameters/functions/Filter.py b/edexOsgi/com.raytheon.uf.common.derivparam.python/utility/common_static/base/derivedParameters/functions/Filter.py index 3689fccf16..92f6e41ca8 100644 --- a/edexOsgi/com.raytheon.uf.common.derivparam.python/utility/common_static/base/derivedParameters/functions/Filter.py +++ b/edexOsgi/com.raytheon.uf.common.derivparam.python/utility/common_static/base/derivedParameters/functions/Filter.py @@ -18,6 +18,14 @@ # further licensing information. ### +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# --/--/----- Initial creation +# May 06, 2014 3101 njensen Cast numpy shape values to int +# for cross platform compatibility + from numpy import ndarray, float32, NaN from numpy import sin, isnan, invert from com.raytheon.uf.common.derivparam.python.function import DistFilterPythonAdapter as DistFilter @@ -43,7 +51,7 @@ def execute(input, dist, dx, dy, times=1): #return executePython(input, npts, times) def executeJava(input, npts, times): - output = DistFilter.filter(input, npts, input.shape[1], input.shape[0], times).__numpy__[0] + output = DistFilter.filter(input, npts, int(input.shape[1]), int(input.shape[0]), times).__numpy__[0] output[output==1e37] = NaN return output