Merge branch 'master_14.2.3' into master_14.2.4
Former-commit-id:702dd65aa7
[formerly9e1ee22146
[formerly 876c6fc4db3901fdcd8dd9a6fb343d2f65254569]] Former-commit-id:9e1ee22146
Former-commit-id:4220590613
This commit is contained in:
commit
4b84db346d
5 changed files with 123 additions and 116 deletions
|
@ -37,7 +37,6 @@ import org.opengis.referencing.crs.ProjectedCRS;
|
|||
|
||||
import com.raytheon.uf.common.dataplugin.radar.RadarDataKey;
|
||||
import com.raytheon.uf.common.dataplugin.radar.RadarDataPoint;
|
||||
import com.raytheon.uf.common.dataplugin.radar.RadarDataPoint.RadarProductType;
|
||||
import com.raytheon.uf.common.dataplugin.radar.RadarRecord;
|
||||
import com.raytheon.uf.common.dataplugin.radar.level3.GraphicBlock;
|
||||
import com.raytheon.uf.common.dataplugin.radar.level3.Layer;
|
||||
|
@ -70,6 +69,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 13, 2009 chammack Initial creation
|
||||
* 03/04/2013 DCS51 zwang Handle GFM product
|
||||
* Sep 03, 2014 3574 njensen Properly dispose objects
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -79,11 +79,11 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
|
||||
public class RadarGraphicsDisplay implements IRenderable {
|
||||
|
||||
private Map<Integer, RadarGraphicsPage> pageMap;
|
||||
private final Map<Integer, RadarGraphicsPage> pageMap;
|
||||
|
||||
private ArrayList<RadarGraphicsPage> symbologyPages;
|
||||
private final ArrayList<RadarGraphicsPage> symbologyPages;
|
||||
|
||||
private Map<RadarDataKey, RadarDataPoint> symbologyData;
|
||||
private final Map<RadarDataKey, RadarDataPoint> symbologyData;
|
||||
|
||||
private int currentPage;
|
||||
|
||||
|
@ -108,9 +108,9 @@ public class RadarGraphicsDisplay implements IRenderable {
|
|||
this.currentPage = 0;
|
||||
|
||||
// Only retrieve if this record has not been retrieved.
|
||||
if ((radarRecord.getSymbologyData() == null || radarRecord
|
||||
if (((radarRecord.getSymbologyData() == null) || radarRecord
|
||||
.getSymbologyData().isEmpty())
|
||||
&& radarRecord.getGraphicBlock() == null) {
|
||||
&& (radarRecord.getGraphicBlock() == null)) {
|
||||
File loc = HDF5Util.findHDF5Location(radarRecord);
|
||||
|
||||
IDataStore dataStore = DataStoreFactory.getDataStore(loc);
|
||||
|
@ -135,9 +135,10 @@ public class RadarGraphicsDisplay implements IRenderable {
|
|||
new GeneralGridEnvelope(new int[] { 0, 0 }, new int[] { 4096,
|
||||
4096 }, false), generalEnvelope);
|
||||
IWireframeShape ws = target.createWireframeShape(true, mapDescriptor);
|
||||
|
||||
|
||||
// Used for GFM forecast positions
|
||||
IWireframeShape gfmWs = target.createWireframeShape(true, mapDescriptor);
|
||||
IWireframeShape gfmWs = target
|
||||
.createWireframeShape(true, mapDescriptor);
|
||||
|
||||
symbologyData = radarRecord.getSymbologyData();
|
||||
if (symbologyData != null) {
|
||||
|
@ -162,8 +163,8 @@ public class RadarGraphicsDisplay implements IRenderable {
|
|||
// logic in createSymbologyImages()
|
||||
rgp.addImages(currStorm, CoordinateSystem.LOCAL);
|
||||
|
||||
//Handle DMD table data
|
||||
if (radarRecord.getProductCode() == 149) {
|
||||
// Handle DMD table data
|
||||
if (radarRecord.getProductCode() == 149) {
|
||||
// Handle the tabular display data in the Generic Packet
|
||||
String data = GraphicDataUtil.getDMDGraphicDataValue(
|
||||
tableModifier, radarRecord,
|
||||
|
@ -175,7 +176,7 @@ public class RadarGraphicsDisplay implements IRenderable {
|
|||
addTableRow(tableData, featureData);
|
||||
processTableData = true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -211,7 +212,7 @@ public class RadarGraphicsDisplay implements IRenderable {
|
|||
}
|
||||
// handle GFM product
|
||||
else {
|
||||
this.currentPage = pageNum;
|
||||
this.currentPage = pageNum;
|
||||
|
||||
RadarGraphicsPage gab = this.pageMap.get(pageNum);
|
||||
if (gab == null) {
|
||||
|
@ -223,7 +224,7 @@ public class RadarGraphicsDisplay implements IRenderable {
|
|||
|
||||
this.currentPage = 0;
|
||||
}
|
||||
|
||||
|
||||
// Graphic block is organized into pages for display. The data for each
|
||||
// page is contained in packets.
|
||||
GraphicBlock gb = radarRecord.getGraphicBlock();
|
||||
|
@ -249,7 +250,8 @@ public class RadarGraphicsDisplay implements IRenderable {
|
|||
}
|
||||
|
||||
}
|
||||
if ((symbologyData == null || symbologyData.isEmpty()) && gb == null) {
|
||||
if (((symbologyData == null) || symbologyData.isEmpty())
|
||||
&& (gb == null)) {
|
||||
String nullLegend = null;
|
||||
switch (radarRecord.getProductCode()) {
|
||||
case 139:
|
||||
|
@ -295,7 +297,7 @@ public class RadarGraphicsDisplay implements IRenderable {
|
|||
|
||||
String[] values = sortValues.trim().split("\\s+");
|
||||
|
||||
if (values.length > 0 && values[0].length() > 1) {
|
||||
if ((values.length > 0) && (values[0].length() > 1)) {
|
||||
try {
|
||||
strengthRank = Integer.parseInt(values[0].substring(1,
|
||||
values[0].length()));
|
||||
|
@ -340,11 +342,15 @@ public class RadarGraphicsDisplay implements IRenderable {
|
|||
}
|
||||
|
||||
public void setMagnification(double magnification) {
|
||||
for (RadarGraphicsPage page : symbologyPages) {
|
||||
page.setMagnification(magnification);
|
||||
synchronized (symbologyPages) {
|
||||
for (RadarGraphicsPage page : symbologyPages) {
|
||||
page.setMagnification(magnification);
|
||||
}
|
||||
}
|
||||
for (RadarGraphicsPage page : pageMap.values()) {
|
||||
page.setMagnification(magnification);
|
||||
synchronized (pageMap) {
|
||||
for (RadarGraphicsPage page : pageMap.values()) {
|
||||
page.setMagnification(magnification);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -358,32 +364,49 @@ public class RadarGraphicsDisplay implements IRenderable {
|
|||
@Override
|
||||
public void paint(IGraphicsTarget target, PaintProperties paintProps)
|
||||
throws VizException {
|
||||
if (currentPage < 0 || currentPage >= this.pageMap.size()) {
|
||||
return;
|
||||
}
|
||||
|
||||
RadarGraphicsPage page = pageMap.get(currentPage);
|
||||
if (page == null) {
|
||||
return;
|
||||
}
|
||||
page.paint(target, paintProps);
|
||||
|
||||
for (RadarGraphicsPage currPage : symbologyPages) {
|
||||
if (currPage == null) {
|
||||
synchronized (pageMap) {
|
||||
if ((currentPage < 0) || (currentPage >= this.pageMap.size())) {
|
||||
return;
|
||||
}
|
||||
|
||||
currPage.paint(target, paintProps);
|
||||
RadarGraphicsPage page = pageMap.get(currentPage);
|
||||
if (page == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
page.paint(target, paintProps);
|
||||
}
|
||||
|
||||
synchronized (symbologyPages) {
|
||||
for (RadarGraphicsPage currPage : symbologyPages) {
|
||||
if (currPage == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
currPage.paint(target, paintProps);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getNumPages() {
|
||||
return this.pageMap.size() > 0 ? this.pageMap.size() : 1;
|
||||
synchronized (pageMap) {
|
||||
return this.pageMap.size() > 0 ? this.pageMap.size() : 1;
|
||||
}
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
for (RadarGraphicsPage page : pageMap.values()) {
|
||||
page.dispose();
|
||||
synchronized (pageMap) {
|
||||
for (RadarGraphicsPage page : pageMap.values()) {
|
||||
page.dispose();
|
||||
}
|
||||
pageMap.clear();
|
||||
}
|
||||
|
||||
synchronized (symbologyPages) {
|
||||
for (RadarGraphicsPage page : symbologyPages) {
|
||||
page.dispose();
|
||||
}
|
||||
symbologyPages.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -120,6 +120,7 @@ import com.vividsolutions.jts.geom.LineString;
|
|||
* 03/05/2013 DCS51 zwang Handle GFM product
|
||||
* 06/24/2013 DR16162 zwang Remove "wind behind"
|
||||
* 11/20/2013 2488 randerso Removed use of VeraMono font file
|
||||
* Sep 03, 2014 3574 njensen Properly dispose objects
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -1456,6 +1457,21 @@ public class RadarGraphicsPage implements IRenderable {
|
|||
this.wireframeShape = null;
|
||||
}
|
||||
|
||||
if (this.gfmFcstWireframeShape != null) {
|
||||
this.gfmFcstWireframeShape.dispose();
|
||||
this.gfmFcstWireframeShape = null;
|
||||
}
|
||||
|
||||
if (plotObjects != null) {
|
||||
for (PlotObject po : plotObjects) {
|
||||
if (po != null) {
|
||||
po.image.dispose();
|
||||
po.image = null;
|
||||
}
|
||||
}
|
||||
plotObjects.clear();
|
||||
}
|
||||
|
||||
if (this.font != null) {
|
||||
this.font.dispose();
|
||||
}
|
||||
|
|
|
@ -76,7 +76,8 @@ import com.vividsolutions.jts.geom.Polygon;
|
|||
* Jul 17, 2014 3419 jsanchez Initial creation
|
||||
* Aug 20, 2014 ASM #16703 D. Friedman Ensure watches have a state attribute.
|
||||
* Aug 28, 2014 ASM #15658 D. Friedman Add marine zones.
|
||||
* Aug 29, 2014 ASM #15551 Qinglu Lin Sorting watches by ETN in processRecords().
|
||||
* Aug 29, 2014 ASM #15551 Qinglu Lin Sort watches by ETN and filter out ActiveTableRecord
|
||||
* with act of CAN and EXP in processRecords().
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -360,6 +361,9 @@ public class WatchUtil {
|
|||
Map<Watch, List<String>> map = new HashMap<Watch, List<String>>();
|
||||
// For each watch event, get the end time and list of active zones
|
||||
for (ActiveTableRecord ar : activeTableRecords) {
|
||||
if (ar.getAct().equals("CAN") || ar.getAct().equals("EXP")) {
|
||||
continue;
|
||||
}
|
||||
/*
|
||||
* Currently reports all zones in the watch even if a given zone is
|
||||
* not in the warning polygon. If the logic is changed to only show
|
||||
|
|
|
@ -127,6 +127,7 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools;
|
|||
* 07/10/2014 3370 mpduff Fix update/insert issue for riverstatus
|
||||
* 07/14/2014 mpduff Fix data range checks
|
||||
* 08/05/2014 15671 snaples Fixed check for posting when not found in ingestfilter and token is set for load_shef_ingest
|
||||
* 09/03/2014 mpduff Fixed river status table updates.
|
||||
* </pre>
|
||||
*
|
||||
* @author mduff
|
||||
|
@ -1057,24 +1058,24 @@ public class PostShef {
|
|||
+ "] to commentValue table");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* if we just received some forecast height or discharge data,
|
||||
* then update the riverstatus table for those reports
|
||||
*/
|
||||
if ((DataType.FORECAST.equals(dataType))
|
||||
&& loadMaxFcst
|
||||
&& (data.getPhysicalElement().getCode().startsWith("H") || data
|
||||
.getPhysicalElement().getCode().startsWith("Q"))) {
|
||||
postRiverStatus(data, locId);
|
||||
if (!same_lid_product) {
|
||||
log.info("Update RiverStatus for: " + locId + " " + pe);
|
||||
}
|
||||
}
|
||||
} // for
|
||||
|
||||
postTables.executeBatchUpdates();
|
||||
} catch (Exception e) {
|
||||
|
||||
if (!dataValues.isEmpty()) {
|
||||
ShefData data = dataValues.get(0);
|
||||
DataType dataType = ParameterCode.DataType.getDataType(
|
||||
data.getTypeSource(), procObs);
|
||||
if ((DataType.FORECAST.equals(dataType))
|
||||
&& loadMaxFcst
|
||||
&& (data.getPhysicalElement().getCode().startsWith("H") || data
|
||||
.getPhysicalElement().getCode().startsWith("Q"))) {
|
||||
postRiverStatus(data, locId);
|
||||
log.info("Update RiverStatus for: " + locId + " "
|
||||
+ data.getPhysicalElement().getCode());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("An error occurred posting shef data.", e);
|
||||
}
|
||||
|
||||
|
@ -1678,7 +1679,8 @@ public class PostShef {
|
|||
private void convertDur(short dur, ShefData data) {
|
||||
String value = null;
|
||||
String durationCode = null;
|
||||
value = DURATION_MAP.get(dur);
|
||||
Integer durInt = new Integer(dur);
|
||||
value = DURATION_MAP.get(durInt);
|
||||
if (value == null) {
|
||||
// Anything not in the DURATION_MAP is
|
||||
// probably a variable duration.
|
||||
|
|
|
@ -86,6 +86,7 @@ import com.raytheon.uf.edex.database.dao.DaoConfig;
|
|||
* 09/19/2013 16515 w. Kwock Fix the excessive digits in rawpp,lake,height...tables
|
||||
* 04/29/2014 3088 mpduff Change logging class, clean up/optimization.
|
||||
* More performance fixes.
|
||||
* 09/03/2014 mpduff postRiverStatus() writes directly, not via batch
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -123,10 +124,6 @@ public class PostTables {
|
|||
|
||||
private Map<String, CallableStatement> statementMap = new HashMap<String, CallableStatement>();
|
||||
|
||||
private PreparedStatement riverStatusUpdateStatement = null;
|
||||
|
||||
private PreparedStatement riverStatusInsertStatement = null;
|
||||
|
||||
static {
|
||||
gagePPSetup();
|
||||
}
|
||||
|
@ -1222,10 +1219,11 @@ public class PostTables {
|
|||
String ts = null;
|
||||
float probability = -9999;
|
||||
int status = -1;
|
||||
|
||||
PreparedStatement ps = null;
|
||||
|
||||
try {
|
||||
conn = getConnection();
|
||||
PreparedStatement ps = getRiverStatusPreparedStatement(updateFlag);
|
||||
ps = getRiverStatusPreparedStatement(updateFlag);
|
||||
lid = shefDataValue.getLocationId();
|
||||
ps.setString(1, lid);
|
||||
|
||||
|
@ -1258,7 +1256,6 @@ public class PostTables {
|
|||
timeStamp2 = new java.sql.Timestamp(basisDate.getTime());
|
||||
ps.setTimestamp(8, timeStamp2);
|
||||
|
||||
// ps.setFloat(9, Float.parseFloat(shefDataValue.getStringValue()));
|
||||
ps.setDouble(9, shefDataValue.getValue().floatValue());
|
||||
|
||||
if (updateFlag) {
|
||||
|
@ -1266,7 +1263,8 @@ public class PostTables {
|
|||
ps.setString(11, pe);
|
||||
ps.setString(12, ts);
|
||||
}
|
||||
ps.addBatch();
|
||||
ps.execute();
|
||||
conn.commit();
|
||||
} catch (Exception e) {
|
||||
if (updateFlag) {
|
||||
log.error(String.format(
|
||||
|
@ -1276,26 +1274,32 @@ public class PostTables {
|
|||
"Error inserting into RiverStatus with [%s]", record),
|
||||
e);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
if (ps != null) {
|
||||
try {
|
||||
ps.close();
|
||||
} catch (SQLException e) {
|
||||
log.error(
|
||||
"Error closing prepared statement for RiverStatus",
|
||||
e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
private PreparedStatement getRiverStatusPreparedStatement(boolean updateFlag)
|
||||
throws SQLException {
|
||||
if (updateFlag) {
|
||||
if (riverStatusUpdateStatement == null) {
|
||||
riverStatusUpdateStatement = conn
|
||||
.prepareCall(RIVER_STATUS_UPDATE_STATEMENT);
|
||||
}
|
||||
return riverStatusUpdateStatement;
|
||||
} else {
|
||||
if (riverStatusInsertStatement == null) {
|
||||
riverStatusInsertStatement = conn
|
||||
.prepareCall(RIVER_STATUS_INSERT_STATEMENT);
|
||||
}
|
||||
return riverStatusInsertStatement;
|
||||
}
|
||||
if (updateFlag) {
|
||||
PreparedStatement riverStatusUpdateStatement = conn
|
||||
.prepareCall(RIVER_STATUS_UPDATE_STATEMENT);
|
||||
return riverStatusUpdateStatement;
|
||||
} else {
|
||||
PreparedStatement riverStatusInsertStatement = conn
|
||||
.prepareCall(RIVER_STATUS_INSERT_STATEMENT);
|
||||
return riverStatusInsertStatement;
|
||||
}
|
||||
}
|
||||
|
||||
private Connection getConnection() {
|
||||
|
@ -1314,26 +1318,6 @@ public class PostTables {
|
|||
* Close the connections and statements
|
||||
*/
|
||||
public void close() {
|
||||
if (riverStatusInsertStatement != null) {
|
||||
try {
|
||||
riverStatusInsertStatement.close();
|
||||
} catch (SQLException e) {
|
||||
log.error(
|
||||
"Error closing river status insert prepared statement",
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
if (riverStatusUpdateStatement != null) {
|
||||
try {
|
||||
riverStatusUpdateStatement.close();
|
||||
} catch (SQLException e) {
|
||||
log.error(
|
||||
"Error closing river status update prepared statement",
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
for (String functionName : statementMap.keySet()) {
|
||||
CallableStatement cs = statementMap.get(functionName);
|
||||
try {
|
||||
|
@ -1356,28 +1340,6 @@ public class PostTables {
|
|||
*
|
||||
*/
|
||||
public void executeBatchUpdates() {
|
||||
try {
|
||||
if (riverStatusUpdateStatement != null) {
|
||||
riverStatusUpdateStatement.execute();
|
||||
conn.commit();
|
||||
riverStatusUpdateStatement.close();
|
||||
riverStatusUpdateStatement = null;
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
log.error("An error occurred storing river status updates", e);
|
||||
}
|
||||
|
||||
try {
|
||||
if (riverStatusInsertStatement != null) {
|
||||
riverStatusInsertStatement.execute();
|
||||
conn.commit();
|
||||
riverStatusInsertStatement.close();
|
||||
riverStatusInsertStatement = null;
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
log.error("An error occurred inserting river status values", e);
|
||||
}
|
||||
|
||||
for (String key : statementMap.keySet()) {
|
||||
CallableStatement cs = statementMap.get(key);
|
||||
try {
|
||||
|
|
Loading…
Add table
Reference in a new issue