Merge "Issue #1902 - FFMP permormance/cleanup peer review comments" into omaha_13.4.1
Former-commit-id:c23b6d31d5
[formerly9ae56e2172
] [formerly8723d88a19
] [formerlyc23b6d31d5
[formerly9ae56e2172
] [formerly8723d88a19
] [formerly8c8709f4a6
[formerly8723d88a19
[formerly 042819679ba8e0d22695b41059772da841619f29]]]] Former-commit-id:8c8709f4a6
Former-commit-id:953d3f79fb
[formerlyb18fa4f6bf
] [formerly 3ebd30bd68f66548fee71c2096f5598c7cdba3aa [formerly1674a59ed3
]] Former-commit-id: b694b850da12576a75b20bb91bfeb2f285ef290a [formerlyec3f0c0a11
] Former-commit-id:783df0394c
This commit is contained in:
commit
99bf297190
6 changed files with 381 additions and 420 deletions
|
@ -22,7 +22,6 @@ package com.raytheon.uf.viz.monitor.ffmp.ui.dialogs;
|
|||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.bind.JAXB;
|
||||
|
||||
|
@ -31,8 +30,6 @@ import org.eclipse.swt.widgets.Display;
|
|||
|
||||
import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord.FIELDS;
|
||||
import com.raytheon.uf.common.localization.IPathManager;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.common.monitor.config.FFMPRunConfigurationManager;
|
||||
|
@ -40,6 +37,9 @@ import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager;
|
|||
import com.raytheon.uf.common.monitor.xml.FFMPRunXML;
|
||||
import com.raytheon.uf.common.monitor.xml.ProductRunXML;
|
||||
import com.raytheon.uf.common.monitor.xml.ProductXML;
|
||||
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.viz.monitor.ffmp.FFMPMonitor;
|
||||
import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FfmpTableConfigData.COLUMN_NAME;
|
||||
import com.raytheon.uf.viz.monitor.ffmp.xml.FFMPConfigBasinXML;
|
||||
|
@ -55,6 +55,7 @@ import com.raytheon.uf.viz.monitor.ffmp.xml.FFMPTableColumnXML;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 01, 2012 14168 mpduff Add convenience methods for
|
||||
* getting ColorCell and ReverseFilter
|
||||
* Apr 12, 2013 1902 mpduff Speed up cell coloring.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -62,6 +63,10 @@ import com.raytheon.uf.viz.monitor.ffmp.xml.FFMPTableColumnXML;
|
|||
* @version 1.0
|
||||
*/
|
||||
public class FFMPConfig {
|
||||
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(FFMPConfig.class);
|
||||
|
||||
private static FFMPConfig classInstance = new FFMPConfig();
|
||||
|
||||
public static enum TableCellColor {
|
||||
|
@ -217,20 +222,17 @@ public class FFMPConfig {
|
|||
try {
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
|
||||
Map<LocalizationLevel, LocalizationFile> fileMap = pm
|
||||
.getTieredLocalizationFile(LocalizationType.CAVE_STATIC,
|
||||
"ffmp" + fs + "guiConfig" + fs + xmlFileName);
|
||||
|
||||
String path = null;
|
||||
if (fileMap.get(LocalizationLevel.USER) != null) {
|
||||
path = fileMap.get(LocalizationLevel.USER).getFile(true)
|
||||
.getAbsolutePath();
|
||||
} else if (fileMap.get(LocalizationLevel.SITE) != null) {
|
||||
path = fileMap.get(LocalizationLevel.SITE).getFile(true)
|
||||
.getAbsolutePath();
|
||||
File file = pm.getStaticFile("ffmp" + fs + "guiConfig" + fs
|
||||
+ xmlFileName);
|
||||
if (file != null) {
|
||||
path = file.getAbsolutePath();
|
||||
} else {
|
||||
path = fileMap.get(LocalizationLevel.BASE).getFile(true)
|
||||
.getAbsolutePath();
|
||||
// Should never get here since there is a baseline version of
|
||||
// the file.
|
||||
statusHandler.handle(Priority.ERROR,
|
||||
"Default FFMP Configuration File Not Found.");
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println("Path Config FFMP: " + path);
|
||||
|
@ -322,20 +324,15 @@ public class FFMPConfig {
|
|||
* color based on threshold
|
||||
*/
|
||||
public Color getThresholdColor(String colName, double val) {
|
||||
if (thresholdLookup.containsKey(colName) == true) {
|
||||
ArrayList<FFMPTableColumnXML> ffmpTableCols = ffmpCfgBasin
|
||||
.getTableColumnData();
|
||||
ThreshColNames colNames = thresholdLookup.get(colName);
|
||||
if (colNames != null) {
|
||||
FFMPTableColumnXML tableColData = ffmpCfgBasin
|
||||
.getTableColumnData(colName);
|
||||
if (tableColData.getColorCell()) {
|
||||
TableCellColor cellColor = threshMgrMap.get(colNames)
|
||||
.getThresholdColor(val);
|
||||
|
||||
for (FFMPTableColumnXML tableColData : ffmpTableCols) {
|
||||
if (tableColData.getColumnName().compareTo(colName) == 0) {
|
||||
if (tableColData.getColorCell()) {
|
||||
return getCellColor(threshMgrMap.get(
|
||||
thresholdLookup.get(colName))
|
||||
.getThresholdColor(val));
|
||||
} else {
|
||||
return defaultColor;
|
||||
}
|
||||
}
|
||||
return getCellColor(cellColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FFMPConfig.ThreshColNames;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 6, 2009 lvenable Initial creation
|
||||
* Apr 12, 2013 1902 mpduff Optimized the color assignments.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -69,7 +70,7 @@ public class FFMPTableCellData {
|
|||
|
||||
private FIELDS columnName;
|
||||
|
||||
private FFMPConfig ffmpCfg = FFMPConfig.getInstance();
|
||||
private static final FFMPConfig ffmpCfg = FFMPConfig.getInstance();
|
||||
|
||||
private boolean vgbFlag = false;
|
||||
|
||||
|
@ -77,6 +78,8 @@ public class FFMPTableCellData {
|
|||
|
||||
private String displayStr = null;
|
||||
|
||||
private double colorValue;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
@ -86,13 +89,7 @@ public class FFMPTableCellData {
|
|||
* The column value
|
||||
*/
|
||||
public FFMPTableCellData(FIELDS columnName, float value) {
|
||||
if (columnName == FIELDS.RATIO) {
|
||||
displayAsInt = true;
|
||||
}
|
||||
|
||||
this.columnName = columnName;
|
||||
this.value = value;
|
||||
this.setColor();
|
||||
this(columnName, value, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -113,7 +110,18 @@ public class FFMPTableCellData {
|
|||
this.columnName = columnName;
|
||||
this.value = value;
|
||||
this.guidForcedFlag = forced;
|
||||
this.setColor();
|
||||
|
||||
if (displayAsInt == true) {
|
||||
colorValue = Math.rint(value);
|
||||
} else {
|
||||
if (!this.value.isNaN()) {
|
||||
colorValue = ((Math.round(value * 100.0)) / 100.0);
|
||||
} else {
|
||||
colorValue = Float.NaN;
|
||||
}
|
||||
}
|
||||
|
||||
this.generateCellColor();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -171,16 +179,7 @@ public class FFMPTableCellData {
|
|||
/**
|
||||
* Set the RGB which is the cell background color.
|
||||
*/
|
||||
public void setColor() {
|
||||
double tmpVal = value;
|
||||
if (displayAsInt == true) {
|
||||
tmpVal = Math.rint(value);
|
||||
} else {
|
||||
if (!value.isNaN()) {
|
||||
tmpVal = (double) ((Math.round(value * 100.0))/100.0);
|
||||
}
|
||||
}
|
||||
|
||||
public void generateCellColor() {
|
||||
if ((columnName == FIELDS.GUIDANCE) && this.guidForcedFlag) {
|
||||
if (this.value.isNaN()) {
|
||||
backgroundColor = ffmpCfg.getCellColor(TableCellColor.Default);
|
||||
|
@ -189,11 +188,11 @@ public class FFMPTableCellData {
|
|||
.getCellColor(TableCellColor.ForcedFFG);
|
||||
}
|
||||
} else if (columnName == FIELDS.GUIDANCE) {
|
||||
backgroundColor = ffmpCfg.getThresholdColor(ThreshColNames.GUID.name(),
|
||||
tmpVal);
|
||||
backgroundColor = ffmpCfg.getThresholdColor(
|
||||
ThreshColNames.GUID.name(), colorValue);
|
||||
} else {
|
||||
backgroundColor = ffmpCfg.getThresholdColor(columnName.name(),
|
||||
tmpVal);
|
||||
colorValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ public class FFMPTableComp extends FFMPTable {
|
|||
ArrayList<FFMPTableRowData> rowData = tableData.getTableRows();
|
||||
for (int i = 0; i < rowData.size(); i++) {
|
||||
rowData.get(i).getTableCellData(threshColumn.getColIndex())
|
||||
.setColor();
|
||||
.generateCellColor();
|
||||
}
|
||||
|
||||
sortTableUsingConfig();
|
||||
|
|
|
@ -70,14 +70,16 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FfmpTableConfigData;
|
|||
* Feb 1, 2013 DR 1569 dhladky Switched to using pypies records instead of files
|
||||
* Feb 19, 2013 1639 njensen Replaced FFMPCacheRecord with FFMPRecord
|
||||
* feb 20, 2013 1635 dhladky Fixed multi guidance displays
|
||||
* Feb 28, 2013 1729 dhladky General enhancements for speed.
|
||||
* Feb 28, 2013 1729 dhladky General enhancements for speed.
|
||||
* Apr 12, 2013 1902 mpduff Code Cleanup.
|
||||
* </pre>
|
||||
*
|
||||
* @author dhladky
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class FFMPDataGenerator {
|
||||
private FfmpTableConfig tableConfig;
|
||||
private final FfmpTableConfig tableConfig;
|
||||
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(FFMPDataGenerator.class);
|
||||
|
@ -86,23 +88,23 @@ public class FFMPDataGenerator {
|
|||
|
||||
private final String NA = "NA";
|
||||
|
||||
private String siteKey;
|
||||
private final String siteKey;
|
||||
|
||||
private String dataKey;
|
||||
private final String dataKey;
|
||||
|
||||
private ProductXML product;
|
||||
private final ProductXML product;
|
||||
|
||||
private Date paintRefTime;
|
||||
private final Date paintRefTime;
|
||||
|
||||
private Date tableTime;
|
||||
private final Date tableTime;
|
||||
|
||||
private Object centeredAggregationKey;
|
||||
private final Object centeredAggregationKey;
|
||||
|
||||
private String huc;
|
||||
private final String huc;
|
||||
|
||||
private ArrayList<DomainXML> domains;
|
||||
private final List<DomainXML> domains;
|
||||
|
||||
private double sliderTime;
|
||||
private final double sliderTime;
|
||||
|
||||
private boolean isWorstCase = false;
|
||||
|
||||
|
@ -176,14 +178,14 @@ public class FFMPDataGenerator {
|
|||
public FFMPTableData generateFFMPData() throws Exception {
|
||||
// You should always have at least a QPE data source
|
||||
FFMPTableData tData = null;
|
||||
|
||||
// update the FFFGDataManager
|
||||
FFFGDataMgr.getUpdatedInstance();
|
||||
tData = new FFMPTableData();
|
||||
|
||||
try {
|
||||
|
||||
FIELDS field = getBaseField();
|
||||
|
||||
|
||||
if (field != null) {
|
||||
if (baseRec != null) {
|
||||
FFMPBasinData fbd = null;
|
||||
|
@ -209,8 +211,7 @@ public class FFMPDataGenerator {
|
|||
continue;
|
||||
}
|
||||
|
||||
if ((cwa.equals(fmdb
|
||||
.getCwa()))
|
||||
if ((cwa.equals(fmdb.getCwa()))
|
||||
|| (domain.isPrimary() && fmdb
|
||||
.isPrimaryCwa())) {
|
||||
try {
|
||||
|
@ -253,9 +254,8 @@ public class FFMPDataGenerator {
|
|||
* is in the CWA
|
||||
*/
|
||||
|
||||
ArrayList<Long> pfafs = ft
|
||||
.getAggregatePfafs(key, siteKey,
|
||||
huc);
|
||||
List<Long> pfafs = ft.getAggregatePfafs(
|
||||
key, siteKey, huc);
|
||||
|
||||
boolean isVGB = false;
|
||||
if (ft.checkVGBsInAggregate(key, siteKey,
|
||||
|
@ -300,11 +300,11 @@ public class FFMPDataGenerator {
|
|||
|| (domain.isPrimary() && fmdb
|
||||
.isPrimaryCwa())) {
|
||||
|
||||
setFFMPRow(fbd.get(key), tData,
|
||||
false, null);
|
||||
// virtual basin
|
||||
if (virtualBasin != null) {
|
||||
for (Long id : ft
|
||||
setFFMPRow(fbd.get(key), tData,
|
||||
false, null);
|
||||
|
||||
if (virtualBasin != null) {
|
||||
for (Long id : ft
|
||||
.getVirtualGageBasinLookupIds(
|
||||
siteKey,
|
||||
key,
|
||||
|
@ -327,7 +327,7 @@ public class FFMPDataGenerator {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
tData.sortData();
|
||||
|
@ -335,7 +335,8 @@ public class FFMPDataGenerator {
|
|||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM, "Failed to load FFMP table data!", e);
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Failed to load FFMP table data!", e);
|
||||
}
|
||||
|
||||
return tData;
|
||||
|
@ -346,11 +347,11 @@ public class FFMPDataGenerator {
|
|||
try {
|
||||
if (cBasin instanceof FFMPVirtualGageBasin) {
|
||||
if (tData.containsPfaf(((FFMPVirtualGageBasin) cBasin).getLid()
|
||||
.toString()) == true) {
|
||||
.toString())) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (tData.containsPfaf(cBasin.getPfaf().toString()) == true) {
|
||||
if (tData.containsPfaf(cBasin.getPfaf().toString())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -378,7 +379,6 @@ public class FFMPDataGenerator {
|
|||
|
||||
rowField = FIELDS.VIRTUAL;
|
||||
|
||||
|
||||
String lid = ((FFMPVirtualGageBasin) cBasin).getLid();
|
||||
|
||||
if (lid != null) {
|
||||
|
@ -394,7 +394,7 @@ public class FFMPDataGenerator {
|
|||
Long parentBasinPfaf = fvgmbd.getParentPfaf();
|
||||
|
||||
if (fvgmbd != null) {
|
||||
|
||||
|
||||
mouseOverText = metabasin.getBasinId() + "\n"
|
||||
+ fvgmbd.getLid() + "-" + fvgmbd.getName();
|
||||
|
||||
|
@ -403,8 +403,9 @@ public class FFMPDataGenerator {
|
|||
}
|
||||
}
|
||||
|
||||
trd.setTableCellData(0, new FFMPTableCellData(rowField,
|
||||
sb.toString(), mouseOverText));
|
||||
trd.setTableCellData(0,
|
||||
new FFMPTableCellData(rowField, sb.toString(),
|
||||
mouseOverText));
|
||||
|
||||
if (!isWorstCase || huc.equals(ALL)
|
||||
|| (centeredAggregationKey != null)) {
|
||||
|
@ -412,14 +413,11 @@ public class FFMPDataGenerator {
|
|||
if (!cBasin.getValues().isEmpty()) {
|
||||
rate = ((FFMPVirtualGageBasin) cBasin)
|
||||
.getValue(paintRefTime);
|
||||
trd.setTableCellData(1, new FFMPTableCellData(
|
||||
FIELDS.RATE, rate));
|
||||
} else {
|
||||
trd.setTableCellData(1, new FFMPTableCellData(
|
||||
FIELDS.RATE, Float.NaN));
|
||||
}
|
||||
if (!cBasin.getValues().isEmpty()) {
|
||||
trd.setTableCellData(1, new FFMPTableCellData(FIELDS.RATE,
|
||||
rate));
|
||||
|
||||
if (!cBasin.getValues().isEmpty()) {
|
||||
if (sliderTime > 0.00) {
|
||||
qpe = cBasin.getAccumValue(monitor.getQpeWindow()
|
||||
.getAfterTime(), monitor.getQpeWindow()
|
||||
|
@ -427,38 +425,34 @@ public class FFMPDataGenerator {
|
|||
} else {
|
||||
qpe = 0.0f;
|
||||
}
|
||||
trd.setTableCellData(2, new FFMPTableCellData(
|
||||
FIELDS.QPE, qpe));
|
||||
|
||||
} else {
|
||||
trd.setTableCellData(2, new FFMPTableCellData(
|
||||
FIELDS.QPE, Float.NaN));
|
||||
}
|
||||
trd.setTableCellData(2, new FFMPTableCellData(FIELDS.QPE,
|
||||
qpe));
|
||||
|
||||
if ((qpfBasin != null)
|
||||
&& (qpfBasin.get(parentBasinPfaf) != null)) {
|
||||
qpf = qpfBasin.get(parentBasinPfaf).getAverageValue(
|
||||
monitor.getQpfWindow().getAfterTime(),
|
||||
monitor.getQpfWindow().getBeforeTime());
|
||||
trd.setTableCellData(3, new FFMPTableCellData(
|
||||
FIELDS.QPF, qpf));
|
||||
} else {
|
||||
trd.setTableCellData(3, new FFMPTableCellData(
|
||||
FIELDS.QPF, Float.NaN));
|
||||
}
|
||||
trd.setTableCellData(3, new FFMPTableCellData(FIELDS.QPF,
|
||||
qpf));
|
||||
|
||||
// run over each guidance type
|
||||
int i = 0;
|
||||
|
||||
for (String guidType : guidBasins.keySet()) {
|
||||
List<Long> pfafList = new ArrayList<Long>();
|
||||
List<Long> forcedPfafs = new ArrayList<Long>();
|
||||
guidance = Float.NaN;
|
||||
boolean forced = false;
|
||||
Float diffValue = Float.NaN;
|
||||
Float ratioValue = Float.NaN;
|
||||
|
||||
FFFGForceUtil forceUtil = forceUtils.get(guidType);
|
||||
FFMPBasinData guidBasin = guidBasins.get(guidType);
|
||||
forceUtil.setSliderTime(sliderTime);
|
||||
|
||||
FFMPBasinData guidBasin = guidBasins.get(guidType);
|
||||
|
||||
if ((guidBasin != null)
|
||||
&& ((FFMPGuidanceBasin) guidBasin
|
||||
.get(parentBasinPfaf) != null)) {
|
||||
|
@ -549,23 +543,15 @@ public class FFMPDataGenerator {
|
|||
FIELDS.GUIDANCE, Float.NaN));
|
||||
}
|
||||
|
||||
// If guidance is NaN then it cannot be > 0
|
||||
if (!qpe.isNaN() && (guidance > 0.0f)) {
|
||||
trd.setTableCellData(
|
||||
i + 5,
|
||||
new FFMPTableCellData(FIELDS.RATIO,
|
||||
FFMPUtils.getRatioValue(qpe,
|
||||
guidance)));
|
||||
trd.setTableCellData(
|
||||
i + 6,
|
||||
new FFMPTableCellData(FIELDS.DIFF,
|
||||
FFMPUtils.getDiffValue(qpe,
|
||||
guidance)));
|
||||
} else {
|
||||
trd.setTableCellData(i + 5, new FFMPTableCellData(
|
||||
FIELDS.RATIO, Float.NaN));
|
||||
trd.setTableCellData(i + 6, new FFMPTableCellData(
|
||||
FIELDS.DIFF, Float.NaN));
|
||||
ratioValue = FFMPUtils.getRatioValue(qpe, guidance);
|
||||
diffValue = FFMPUtils.getDiffValue(qpe, guidance);
|
||||
}
|
||||
trd.setTableCellData(i + 5, new FFMPTableCellData(
|
||||
FIELDS.RATIO, ratioValue));
|
||||
trd.setTableCellData(i + 6, new FFMPTableCellData(
|
||||
FIELDS.DIFF, diffValue));
|
||||
|
||||
i += 3;
|
||||
}
|
||||
|
@ -593,25 +579,20 @@ public class FFMPDataGenerator {
|
|||
&& (rateBasin.get(cBasin.getPfaf()) != null)) {
|
||||
rate = rateBasin.get(cBasin.getPfaf()).getValue(
|
||||
paintRefTime);
|
||||
trd.setTableCellData(1, new FFMPTableCellData(
|
||||
FIELDS.RATE, rate));
|
||||
// System.out.println("rate: "+rate);
|
||||
} else {
|
||||
trd.setTableCellData(1, new FFMPTableCellData(
|
||||
FIELDS.RATE, Float.NaN));
|
||||
}
|
||||
trd.setTableCellData(1, new FFMPTableCellData(FIELDS.RATE,
|
||||
rate));
|
||||
|
||||
if ((qpeBasin != null)
|
||||
&& (qpeBasin.get(cBasin.getPfaf()) != null)) {
|
||||
qpe = qpeBasin.get(cBasin.getPfaf()).getAccumValue(
|
||||
monitor.getQpeWindow().getAfterTime(),
|
||||
monitor.getQpeWindow().getBeforeTime(),
|
||||
expirationTime, isRate);
|
||||
trd.setTableCellData(2, new FFMPTableCellData(
|
||||
FIELDS.QPE, qpe));
|
||||
} else {
|
||||
trd.setTableCellData(2, new FFMPTableCellData(
|
||||
FIELDS.QPE, Float.NaN));
|
||||
}
|
||||
trd.setTableCellData(2, new FFMPTableCellData(FIELDS.QPE,
|
||||
qpe));
|
||||
|
||||
if ((qpfBasin != null)
|
||||
&& (qpfBasin.get(cBasin.getPfaf()) != null)) {
|
||||
|
||||
|
@ -620,25 +601,27 @@ public class FFMPDataGenerator {
|
|||
monitor.getQpfWindow().getBeforeTime());
|
||||
// qpf = getQPFValue(false, cBasin.getPfaf(),
|
||||
// new ArrayList<Long>());/* DR13839 */
|
||||
trd.setTableCellData(3, new FFMPTableCellData(
|
||||
FIELDS.QPF, qpf));
|
||||
// System.out.println("qpf: "+qpf);
|
||||
} else {
|
||||
trd.setTableCellData(3, new FFMPTableCellData(
|
||||
FIELDS.QPF, Float.NaN));
|
||||
}
|
||||
trd.setTableCellData(3, new FFMPTableCellData(FIELDS.QPF,
|
||||
qpf));
|
||||
|
||||
// run over each guidance type
|
||||
int i = 0;
|
||||
Float ratioValue;
|
||||
Float diffValue;
|
||||
for (String guidType : guidBasins.keySet()) {
|
||||
List<Long> pfafList = new ArrayList<Long>();
|
||||
List<Long> forcedPfafs = new ArrayList<Long>();
|
||||
guidance = Float.NaN;
|
||||
boolean forced = false;
|
||||
ratioValue = Float.NaN;
|
||||
diffValue = Float.NaN;
|
||||
|
||||
FFFGForceUtil forceUtil = forceUtils.get(guidType);
|
||||
FFMPBasinData guidBasin = guidBasins.get(guidType);
|
||||
forceUtil.setSliderTime(sliderTime);
|
||||
|
||||
FFMPBasinData guidBasin = guidBasins.get(guidType);
|
||||
|
||||
if ((guidBasin != null)
|
||||
&& ((FFMPGuidanceBasin) guidBasin.get(cBasin
|
||||
.getPfaf()) != null)) {
|
||||
|
@ -729,7 +712,7 @@ public class FFMPDataGenerator {
|
|||
// check for forcing even if no data are available
|
||||
guidance = getForcedAvg(forceUtil, domain, cBasin,
|
||||
guidType);
|
||||
if (guidance.isNaN() == false) {
|
||||
if (!guidance.isNaN()) {
|
||||
forced = true;
|
||||
} else {
|
||||
forced = false;
|
||||
|
@ -739,23 +722,15 @@ public class FFMPDataGenerator {
|
|||
FIELDS.GUIDANCE, guidance, forced));
|
||||
}
|
||||
|
||||
// If guidance is NaN then it cannot be > 0
|
||||
if (!qpe.isNaN() && (guidance > 0.0f)) {
|
||||
trd.setTableCellData(
|
||||
i + 5,
|
||||
new FFMPTableCellData(FIELDS.RATIO,
|
||||
FFMPUtils.getRatioValue(qpe,
|
||||
guidance)));
|
||||
trd.setTableCellData(
|
||||
i + 6,
|
||||
new FFMPTableCellData(FIELDS.DIFF,
|
||||
FFMPUtils.getDiffValue(qpe,
|
||||
guidance)));
|
||||
} else {
|
||||
trd.setTableCellData(i + 5, new FFMPTableCellData(
|
||||
FIELDS.RATIO, Float.NaN));
|
||||
trd.setTableCellData(i + 6, new FFMPTableCellData(
|
||||
FIELDS.DIFF, Float.NaN));
|
||||
ratioValue = FFMPUtils.getRatioValue(qpe, guidance);
|
||||
diffValue = FFMPUtils.getDiffValue(qpe, guidance);
|
||||
}
|
||||
trd.setTableCellData(i + 5, new FFMPTableCellData(
|
||||
FIELDS.RATIO, ratioValue));
|
||||
trd.setTableCellData(i + 6, new FFMPTableCellData(
|
||||
FIELDS.DIFF, diffValue));
|
||||
|
||||
i += 3;
|
||||
}
|
||||
|
@ -780,7 +755,7 @@ public class FFMPDataGenerator {
|
|||
forceUtil.calculateForcings(domain, ft, cBasin);
|
||||
forcedPfafs = forceUtil.getForcedPfafList();
|
||||
forced = forceUtil.isForced();
|
||||
if (forced == false) {
|
||||
if (!forced) {
|
||||
return Float.NaN;
|
||||
}
|
||||
} else {
|
||||
|
@ -883,20 +858,15 @@ public class FFMPDataGenerator {
|
|||
Float guidance = Float.NaN;
|
||||
Float rate = Float.NaN;
|
||||
Float qpf = Float.NaN;
|
||||
Float ratioValue = Float.NaN;
|
||||
Float diffValue = Float.NaN;
|
||||
|
||||
if (cBasin instanceof FFMPVirtualGageBasin) {
|
||||
if (!pfafs.isEmpty()) {
|
||||
if (virtualBasin != null) {
|
||||
trd.setTableCellData(
|
||||
1,
|
||||
new FFMPTableCellData(FIELDS.RATE, virtualBasin
|
||||
.get(cBasin.getPfaf()).getValue(
|
||||
paintRefTime)));
|
||||
} else {
|
||||
trd.setTableCellData(1, new FFMPTableCellData(FIELDS.RATE,
|
||||
Float.NaN));
|
||||
}
|
||||
if (virtualBasin != null) {
|
||||
rate = virtualBasin.get(cBasin.getPfaf()).getValue(
|
||||
paintRefTime);
|
||||
|
||||
if (sliderTime > 0.00) {
|
||||
qpe = virtualBasin.get(cBasin.getPfaf()).getAccumValue(
|
||||
monitor.getQpeWindow().getAfterTime(),
|
||||
|
@ -905,104 +875,40 @@ public class FFMPDataGenerator {
|
|||
} else {
|
||||
qpe = 0.0f;
|
||||
}
|
||||
|
||||
trd.setTableCellData(2, new FFMPTableCellData(FIELDS.QPE,
|
||||
qpe));
|
||||
|
||||
} else {
|
||||
trd.setTableCellData(2, new FFMPTableCellData(FIELDS.QPE,
|
||||
Float.NaN));
|
||||
}
|
||||
trd.setTableCellData(1,
|
||||
new FFMPTableCellData(FIELDS.RATE, rate));
|
||||
|
||||
trd.setTableCellData(2, new FFMPTableCellData(FIELDS.QPE, qpe));
|
||||
|
||||
if (qpfBasin != null) {
|
||||
trd.setTableCellData(
|
||||
3,
|
||||
new FFMPTableCellData(FIELDS.QPF, new Float(
|
||||
qpfBasin.get(cBasin.getPfaf()).getMaxValue(
|
||||
monitor.getQpfWindow()
|
||||
.getAfterTime(),
|
||||
monitor.getQpfWindow()
|
||||
.getBeforeTime()))
|
||||
.floatValue()));
|
||||
} else {
|
||||
trd.setTableCellData(3, new FFMPTableCellData(FIELDS.QPF,
|
||||
Float.NaN));
|
||||
qpf = new Float(qpfBasin.get(cBasin.getPfaf()).getMaxValue(
|
||||
monitor.getQpfWindow().getAfterTime(),
|
||||
monitor.getQpfWindow().getBeforeTime()))
|
||||
.floatValue();
|
||||
}
|
||||
|
||||
// run over each guidance type
|
||||
int i = 0;
|
||||
for (String guidType : guidBasins.keySet()) {
|
||||
FFFGForceUtil forceUtil = forceUtils.get(guidType);
|
||||
forceUtil.setSliderTime(sliderTime);
|
||||
trd.setTableCellData(3, new FFMPTableCellData(FIELDS.QPF, qpf));
|
||||
|
||||
FFMPBasinData guidBasin = guidBasins.get(guidType);
|
||||
|
||||
if (guidBasin != null) {
|
||||
|
||||
FFMPGuidanceBasin basin = ((FFMPGuidanceBasin) guidBasin
|
||||
.get(cBasin.getPfaf()));
|
||||
guidance = resource.getGuidanceValue(basin, monitor
|
||||
.getQpeWindow().getBeforeTime(), guidType);
|
||||
|
||||
forceUtil.calculateForcings(pfafs, ft, cBasin);
|
||||
|
||||
List<Long> forcedPfafs = forceUtil.getForcedPfafList();
|
||||
boolean forced = forceUtil.isForced();
|
||||
|
||||
if (!forced) {
|
||||
if ((forcedPfafs != null)
|
||||
&& (!forcedPfafs.isEmpty())) {
|
||||
forced = true;
|
||||
}
|
||||
}
|
||||
|
||||
trd.setTableCellData(i + 4, new FFMPTableCellData(
|
||||
FIELDS.GUIDANCE, guidance, forced));
|
||||
} else {
|
||||
trd.setTableCellData(i + 4, new FFMPTableCellData(
|
||||
FIELDS.GUIDANCE, Float.NaN));
|
||||
}
|
||||
if (!qpe.isNaN() && (guidance > 0.0f)) {
|
||||
|
||||
trd.setTableCellData(
|
||||
i + 5,
|
||||
new FFMPTableCellData(FIELDS.RATIO, FFMPUtils
|
||||
.getRatioValue(qpe, guidance)));
|
||||
trd.setTableCellData(
|
||||
i + 6,
|
||||
new FFMPTableCellData(FIELDS.DIFF, FFMPUtils
|
||||
.getDiffValue(qpe, guidance)));
|
||||
} else {
|
||||
trd.setTableCellData(i + 5, new FFMPTableCellData(
|
||||
FIELDS.RATIO, Float.NaN));
|
||||
trd.setTableCellData(i + 6, new FFMPTableCellData(
|
||||
FIELDS.DIFF, Float.NaN));
|
||||
}
|
||||
|
||||
i += 3;
|
||||
}
|
||||
processGuidance(trd, cBasin, pfafs, qpe);
|
||||
}
|
||||
|
||||
} else {
|
||||
// Not Virtual
|
||||
if (!pfafs.isEmpty()) {
|
||||
if (rateBasin != null) {
|
||||
rate = rateBasin.getMaxValue(pfafs, paintRefTime);
|
||||
trd.setTableCellData(1, new FFMPTableCellData(FIELDS.RATE,
|
||||
rate));
|
||||
} else {
|
||||
trd.setTableCellData(1, new FFMPTableCellData(FIELDS.RATE,
|
||||
Float.NaN));
|
||||
}
|
||||
trd.setTableCellData(1,
|
||||
new FFMPTableCellData(FIELDS.RATE, rate));
|
||||
|
||||
if (qpeBasin != null) {
|
||||
qpe = qpeBasin.getAccumMaxValue(pfafs, monitor
|
||||
.getQpeWindow().getBeforeTime(), monitor
|
||||
.getQpeWindow().getAfterTime(), expirationTime,
|
||||
isRate);
|
||||
trd.setTableCellData(2, new FFMPTableCellData(FIELDS.QPE,
|
||||
qpe));
|
||||
} else {
|
||||
trd.setTableCellData(2, new FFMPTableCellData(FIELDS.QPE,
|
||||
Float.NaN));
|
||||
}
|
||||
trd.setTableCellData(2, new FFMPTableCellData(FIELDS.QPE, qpe));
|
||||
|
||||
if (qpfBasin != null) {
|
||||
qpf = qpfBasin.getAverageMaxValue(pfafs, monitor
|
||||
.getQpfWindow().getAfterTime(), monitor
|
||||
|
@ -1010,16 +916,17 @@ public class FFMPDataGenerator {
|
|||
|
||||
// qpf = getQPFValue(true, new Long(0l), pfafs);/* DR13839
|
||||
// */
|
||||
trd.setTableCellData(3, new FFMPTableCellData(FIELDS.QPF,
|
||||
qpf.floatValue()));
|
||||
} else {
|
||||
trd.setTableCellData(3, new FFMPTableCellData(FIELDS.QPF,
|
||||
Float.NaN));
|
||||
}
|
||||
trd.setTableCellData(3,
|
||||
new FFMPTableCellData(FIELDS.QPF, qpf.floatValue()));
|
||||
|
||||
// run over each guidance type
|
||||
int i = 0;
|
||||
for (String guidType : guidBasins.keySet()) {
|
||||
guidance = Float.NaN;
|
||||
diffValue = Float.NaN;
|
||||
ratioValue = Float.NaN;
|
||||
|
||||
FFFGForceUtil forceUtil = forceUtils.get(guidType);
|
||||
forceUtil.setSliderTime(sliderTime);
|
||||
|
||||
|
@ -1076,6 +983,8 @@ public class FFMPDataGenerator {
|
|||
trd.setTableCellData(i + 4, new FFMPTableCellData(
|
||||
FIELDS.GUIDANCE, Float.NaN));
|
||||
}
|
||||
|
||||
// If guidance is NaN then it cannot be > 0
|
||||
if (!qpe.isNaN() && (guidance > 0.0f)) {
|
||||
|
||||
List<Float> qpes = qpeBasin.getAccumValues(pfafs,
|
||||
|
@ -1091,23 +1000,14 @@ public class FFMPDataGenerator {
|
|||
|
||||
if ((!qpes.isEmpty())
|
||||
&& ((guids != null) && (!guids.isEmpty()))) {
|
||||
|
||||
trd.setTableCellData(
|
||||
i + 5,
|
||||
new FFMPTableCellData(FIELDS.RATIO,
|
||||
FFMPUtils.getMaxRatioValue(qpes,
|
||||
guids)));
|
||||
trd.setTableCellData(
|
||||
i + 6,
|
||||
new FFMPTableCellData(FIELDS.DIFF,
|
||||
FFMPUtils.getMaxDiffValue(qpes,
|
||||
guids)));
|
||||
} else {
|
||||
trd.setTableCellData(i + 5, new FFMPTableCellData(
|
||||
FIELDS.RATIO, Float.NaN));
|
||||
trd.setTableCellData(i + 6, new FFMPTableCellData(
|
||||
FIELDS.DIFF, Float.NaN));
|
||||
ratioValue = FFMPUtils
|
||||
.getMaxRatioValue(qpes, guids);
|
||||
diffValue = FFMPUtils.getMaxDiffValue(qpes, guids);
|
||||
}
|
||||
trd.setTableCellData(i + 5, new FFMPTableCellData(
|
||||
FIELDS.RATIO, ratioValue));
|
||||
trd.setTableCellData(i + 6, new FFMPTableCellData(
|
||||
FIELDS.DIFF, diffValue));
|
||||
} else {
|
||||
trd.setTableCellData(i + 5, new FFMPTableCellData(
|
||||
FIELDS.RATIO, Float.NaN));
|
||||
|
@ -1121,98 +1021,31 @@ public class FFMPDataGenerator {
|
|||
} else {
|
||||
if ((rateBasin != null)
|
||||
&& (rateBasin.get(cBasin.getPfaf()) != null)) {
|
||||
trd.setTableCellData(
|
||||
1,
|
||||
new FFMPTableCellData(FIELDS.RATE, rateBasin.get(
|
||||
cBasin.getPfaf()).getValue(paintRefTime)));
|
||||
} else {
|
||||
trd.setTableCellData(1, new FFMPTableCellData(FIELDS.RATE,
|
||||
Float.NaN));
|
||||
rate = rateBasin.get(cBasin.getPfaf()).getValue(
|
||||
paintRefTime);
|
||||
}
|
||||
trd.setTableCellData(1,
|
||||
new FFMPTableCellData(FIELDS.RATE, rate));
|
||||
|
||||
if ((qpeBasin != null)
|
||||
&& (qpeBasin.get(cBasin.getPfaf()) != null)) {
|
||||
qpe = qpeBasin.get(cBasin.getPfaf()).getAccumValue(
|
||||
monitor.getQpeWindow().getAfterTime(),
|
||||
monitor.getQpeWindow().getBeforeTime(),
|
||||
expirationTime, isRate);
|
||||
trd.setTableCellData(2, new FFMPTableCellData(FIELDS.QPE,
|
||||
qpe));
|
||||
} else {
|
||||
trd.setTableCellData(2, new FFMPTableCellData(FIELDS.QPE,
|
||||
Float.NaN));
|
||||
}
|
||||
trd.setTableCellData(2, new FFMPTableCellData(FIELDS.QPE, qpe));
|
||||
|
||||
if ((qpfBasin != null)
|
||||
&& (qpfBasin.get(cBasin.getPfaf()) != null)) {
|
||||
trd.setTableCellData(
|
||||
3,
|
||||
new FFMPTableCellData(FIELDS.QPF, new Float(
|
||||
qpfBasin.get(cBasin.getPfaf()).getMaxValue(
|
||||
monitor.getQpfWindow()
|
||||
.getAfterTime(),
|
||||
monitor.getQpfWindow()
|
||||
.getBeforeTime()))
|
||||
.floatValue()));
|
||||
} else {
|
||||
trd.setTableCellData(3, new FFMPTableCellData(FIELDS.QPF,
|
||||
Float.NaN));
|
||||
qpf = new Float(qpfBasin.get(cBasin.getPfaf()).getMaxValue(
|
||||
monitor.getQpfWindow().getAfterTime(),
|
||||
monitor.getQpfWindow().getBeforeTime()))
|
||||
.floatValue();
|
||||
}
|
||||
trd.setTableCellData(3, new FFMPTableCellData(FIELDS.QPF, qpf));
|
||||
|
||||
// run over each guidance type
|
||||
int i = 0;
|
||||
for (String guidType : guidBasins.keySet()) {
|
||||
FFFGForceUtil forceUtil = forceUtils.get(guidType);
|
||||
forceUtil.setSliderTime(sliderTime);
|
||||
|
||||
FFMPBasinData guidBasin = guidBasins.get(guidType);
|
||||
|
||||
if (guidBasin != null) {
|
||||
|
||||
FFMPGuidanceBasin basin = ((FFMPGuidanceBasin) guidBasin
|
||||
.get(cBasin.getPfaf()));
|
||||
guidance = resource.getGuidanceValue(basin, monitor
|
||||
.getQpeWindow().getBeforeTime(), guidType);
|
||||
|
||||
if (guidance < 0.0f) {
|
||||
guidance = Float.NaN;
|
||||
}
|
||||
|
||||
forceUtil.calculateForcings(pfafs, ft, cBasin);
|
||||
|
||||
List<Long> forcedPfafs = forceUtil.getForcedPfafList();
|
||||
boolean forced = forceUtil.isForced();
|
||||
|
||||
if (!forced) {
|
||||
if ((forcedPfafs != null)
|
||||
&& (!forcedPfafs.isEmpty())) {
|
||||
forced = true;
|
||||
}
|
||||
}
|
||||
|
||||
trd.setTableCellData(i + 4, new FFMPTableCellData(
|
||||
FIELDS.GUIDANCE, guidance, forced));
|
||||
} else {
|
||||
trd.setTableCellData(i + 4, new FFMPTableCellData(
|
||||
FIELDS.GUIDANCE, Float.NaN));
|
||||
}
|
||||
if (!qpe.isNaN() && (guidance > 0.0f)) {
|
||||
|
||||
trd.setTableCellData(
|
||||
i + 5,
|
||||
new FFMPTableCellData(FIELDS.RATIO, FFMPUtils
|
||||
.getRatioValue(qpe, guidance)));
|
||||
trd.setTableCellData(
|
||||
i + 6,
|
||||
new FFMPTableCellData(FIELDS.DIFF, FFMPUtils
|
||||
.getDiffValue(qpe, guidance)));
|
||||
} else {
|
||||
trd.setTableCellData(i + 5, new FFMPTableCellData(
|
||||
FIELDS.RATIO, Float.NaN));
|
||||
trd.setTableCellData(i + 6, new FFMPTableCellData(
|
||||
FIELDS.DIFF, Float.NaN));
|
||||
}
|
||||
|
||||
i += 3;
|
||||
}
|
||||
processGuidance(trd, cBasin, pfafs, qpe);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1220,6 +1053,71 @@ public class FFMPDataGenerator {
|
|||
return trd;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param trd
|
||||
* @param cBasin
|
||||
* @param pfafs
|
||||
* @param qpe
|
||||
*/
|
||||
private void processGuidance(FFMPTableRowData trd, FFMPBasin cBasin,
|
||||
ArrayList<Long> pfafs, Float qpe) {
|
||||
Float guidance;
|
||||
Float ratioValue;
|
||||
Float diffValue;
|
||||
int i = 0;
|
||||
for (String guidType : guidBasins.keySet()) {
|
||||
guidance = Float.NaN;
|
||||
diffValue = Float.NaN;
|
||||
ratioValue = Float.NaN;
|
||||
|
||||
FFFGForceUtil forceUtil = forceUtils.get(guidType);
|
||||
forceUtil.setSliderTime(sliderTime);
|
||||
|
||||
FFMPBasinData guidBasin = guidBasins.get(guidType);
|
||||
|
||||
if (guidBasin != null) {
|
||||
|
||||
FFMPGuidanceBasin basin = ((FFMPGuidanceBasin) guidBasin
|
||||
.get(cBasin.getPfaf()));
|
||||
guidance = resource.getGuidanceValue(basin, monitor
|
||||
.getQpeWindow().getBeforeTime(), guidType);
|
||||
|
||||
if (guidance < 0.0f) {
|
||||
guidance = Float.NaN;
|
||||
}
|
||||
|
||||
forceUtil.calculateForcings(pfafs, ft, cBasin);
|
||||
|
||||
List<Long> forcedPfafs = forceUtil.getForcedPfafList();
|
||||
boolean forced = forceUtil.isForced();
|
||||
|
||||
if (!forced) {
|
||||
if ((forcedPfafs != null) && (!forcedPfafs.isEmpty())) {
|
||||
forced = true;
|
||||
}
|
||||
}
|
||||
|
||||
trd.setTableCellData(i + 4, new FFMPTableCellData(
|
||||
FIELDS.GUIDANCE, guidance, forced));
|
||||
} else {
|
||||
trd.setTableCellData(i + 4, new FFMPTableCellData(
|
||||
FIELDS.GUIDANCE, Float.NaN));
|
||||
}
|
||||
|
||||
// If guidance is NaN then it cannot be > 0
|
||||
if (!qpe.isNaN() && (guidance > 0.0f)) {
|
||||
ratioValue = FFMPUtils.getRatioValue(qpe, guidance);
|
||||
diffValue = FFMPUtils.getDiffValue(qpe, guidance);
|
||||
}
|
||||
trd.setTableCellData(i + 5, new FFMPTableCellData(FIELDS.RATIO,
|
||||
ratioValue));
|
||||
trd.setTableCellData(i + 6, new FFMPTableCellData(FIELDS.DIFF,
|
||||
diffValue));
|
||||
|
||||
i += 3;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the base field
|
||||
*
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
package com.raytheon.uf.viz.monitor.ffmp.xml;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
|
@ -29,6 +31,22 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||
|
||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||
|
||||
/**
|
||||
* Config Basin xml object.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Initial creation
|
||||
* Apr 12, 2013 1902 mpduff Return a FFMPTableColumnXML object.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
|
||||
@XmlRootElement(name = "FfmpConfigBasin")
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
public class FFMPConfigBasinXML implements ISerializableObject {
|
||||
|
@ -91,6 +109,11 @@ public class FFMPConfigBasinXML implements ISerializableObject {
|
|||
@XmlElements({ @XmlElement(name = "TableColumn", type = FFMPTableColumnXML.class) })
|
||||
private ArrayList<FFMPTableColumnXML> tableColumnData;
|
||||
|
||||
/**
|
||||
* Temp data structure.
|
||||
*/
|
||||
private transient Map<String, FFMPTableColumnXML> tableColumnMap = new HashMap<String, FFMPTableColumnXML>();
|
||||
|
||||
public FFMPConfigBasinXML() {
|
||||
|
||||
}
|
||||
|
@ -230,4 +253,24 @@ public class FFMPConfigBasinXML implements ISerializableObject {
|
|||
public void setTableColumnData(ArrayList<FFMPTableColumnXML> tableColumnData) {
|
||||
this.tableColumnData = tableColumnData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the FFMPTableColumn object for the provided column name
|
||||
*
|
||||
* @param colName
|
||||
* the column name
|
||||
* @return the FFMPTableColumnXML object
|
||||
*/
|
||||
public FFMPTableColumnXML getTableColumnData(String colName) {
|
||||
if (!tableColumnMap.containsKey(colName)) {
|
||||
for (FFMPTableColumnXML tc : tableColumnData) {
|
||||
if (tc.getColumnName().equals(colName)) {
|
||||
tableColumnMap.put(colName, tc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tableColumnMap.get(colName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,6 +86,7 @@ import com.vividsolutions.jts.io.WKBReader;
|
|||
* 03/01/13 DR13228 G. Zhang Add VGB county and related code
|
||||
* 02/20/13 1635 D. Hladky Constants
|
||||
* 03/18/13 1817 D. Hladky Fixed issue with BOX where only 1 HUC was showing up.
|
||||
* 04/15/13 1902 M. Duff Generic List
|
||||
* </pre>
|
||||
*
|
||||
* @author dhladky
|
||||
|
@ -108,11 +109,12 @@ public class FFMPTemplates {
|
|||
|
||||
private HashMap<String, HashMap<String, HashMap<Long, ArrayList<FFMPVirtualGageBasinMetaData>>>> virtualGageBasinsInParentPfaf = null;
|
||||
|
||||
private HashMap<String, HashMap<String, HashMap<String, ArrayList<FFMPVirtualGageBasinMetaData>>>> vgbsInCounty = null;// DR 13228
|
||||
|
||||
private HashMap<String, HashMap<String, HashMap<String, ArrayList<FFMPVirtualGageBasinMetaData>>>> vgbsInCounty = null;// DR
|
||||
// 13228
|
||||
|
||||
private HashMap<String, HashMap<String, LinkedHashMap<String, FFMPVirtualGageBasinMetaData>>> virtualDomainMap = null;
|
||||
|
||||
private Map<String, SoftReference<Map<Long, Geometry>>> cwaRawGeometries = new ConcurrentHashMap<String, SoftReference<Map<Long, Geometry>>>();
|
||||
private final Map<String, SoftReference<Map<Long, Geometry>>> cwaRawGeometries = new ConcurrentHashMap<String, SoftReference<Map<Long, Geometry>>>();
|
||||
|
||||
/** Singleton instance of this class */
|
||||
private static FFMPTemplates template = null;
|
||||
|
@ -149,12 +151,12 @@ public class FFMPTemplates {
|
|||
|
||||
public boolean done = false;
|
||||
|
||||
private Map<Long, FFMPCounty> countyMap = new HashMap<Long, FFMPCounty>();
|
||||
private final Map<Long, FFMPCounty> countyMap = new HashMap<Long, FFMPCounty>();
|
||||
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(FFMPTemplates.class);
|
||||
|
||||
private IPathManager pathManager;
|
||||
private final IPathManager pathManager;
|
||||
|
||||
/**
|
||||
* Single constructor
|
||||
|
@ -229,8 +231,9 @@ public class FFMPTemplates {
|
|||
virtualGageBasinsInParentPfaf = new HashMap<String, HashMap<String, HashMap<Long, ArrayList<FFMPVirtualGageBasinMetaData>>>>();
|
||||
ftcm = FFMPTemplateConfigurationManager.getInstance();
|
||||
frcm = FFMPRunConfigurationManager.getInstance();
|
||||
vgbsInCounty = new HashMap<String, HashMap<String, HashMap<String, ArrayList<FFMPVirtualGageBasinMetaData>>>>();// DR 13228
|
||||
|
||||
vgbsInCounty = new HashMap<String, HashMap<String, HashMap<String, ArrayList<FFMPVirtualGageBasinMetaData>>>>();// DR
|
||||
// 13228
|
||||
|
||||
try {
|
||||
ftcm.readConfigXml();
|
||||
|
||||
|
@ -251,11 +254,12 @@ public class FFMPTemplates {
|
|||
"No configuration file found, default settings applied");
|
||||
|
||||
// we use 4 because it is the 90% solution as a start point for
|
||||
// the analysis. Added check to make sure at least 2 HUC layers are created.
|
||||
// the analysis. Added check to make sure at least 2 HUC layers
|
||||
// are created.
|
||||
int preliminarystart = 4;
|
||||
// first crack
|
||||
ArrayList<Integer> hucParams = FFMPUtils.getHucParameters(preliminarystart,
|
||||
primaryCWA.getCwa());
|
||||
ArrayList<Integer> hucParams = FFMPUtils.getHucParameters(
|
||||
preliminarystart, primaryCWA.getCwa());
|
||||
int startDepth = hucParams.get(0);
|
||||
int numlevels = hucParams.get(1);
|
||||
int i = 1;
|
||||
|
@ -267,13 +271,13 @@ public class FFMPTemplates {
|
|||
startDepth = hucParams.get(0);
|
||||
numlevels = hucParams.get(1);
|
||||
i++;
|
||||
|
||||
|
||||
// safety value in case it just won't work with this shape
|
||||
if (checkDepth == 0) {
|
||||
// bail, won't work
|
||||
statusHandler
|
||||
.handle(Priority.ERROR,
|
||||
"Cannot create a good template. There are not enough unique HUC's to create more than 1 layer.");
|
||||
.handle(Priority.ERROR,
|
||||
"Cannot create a good template. There are not enough unique HUC's to create more than 1 layer.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -545,7 +549,8 @@ public class FFMPTemplates {
|
|||
public FFMPBasinMetaData getBasin(String dataKey, Long pfaf) {
|
||||
FFMPBasinMetaData fmbd = null;
|
||||
for (DomainXML domain : domains) {
|
||||
LinkedHashMap<Long, ?> map = getMap(dataKey, domain.getCwa(), FFMPRecord.ALL);
|
||||
LinkedHashMap<Long, ?> map = getMap(dataKey, domain.getCwa(),
|
||||
FFMPRecord.ALL);
|
||||
fmbd = (FFMPBasinMetaData) map.get(pfaf);
|
||||
if (fmbd != null) {
|
||||
break;
|
||||
|
@ -570,7 +575,8 @@ public class FFMPTemplates {
|
|||
if (isSiteLoaded(product.getProductKey())) {
|
||||
for (DomainXML domain : domains) {
|
||||
LinkedHashMap<Long, ?> map = getMap(
|
||||
product.getProductKey(), domain.getCwa(), FFMPRecord.ALL);
|
||||
product.getProductKey(), domain.getCwa(),
|
||||
FFMPRecord.ALL);
|
||||
fmbd = (FFMPBasinMetaData) map.get(pfaf);
|
||||
if (fmbd != null) {
|
||||
return fmbd;
|
||||
|
@ -829,7 +835,8 @@ public class FFMPTemplates {
|
|||
// TODO: make reverse lookup...
|
||||
FFMPBasinMetaData basin = null;
|
||||
for (DomainXML domain : domains) {
|
||||
LinkedHashMap<Long, ?> map = getMap(dataKey, domain.getCwa(), FFMPRecord.ALL);
|
||||
LinkedHashMap<Long, ?> map = getMap(dataKey, domain.getCwa(),
|
||||
FFMPRecord.ALL);
|
||||
for (Long key : map.keySet()) {
|
||||
basin = ((FFMPBasinMetaData) map.get(key));
|
||||
if (basin.getBasinId() == basinId) {
|
||||
|
@ -953,8 +960,8 @@ public class FFMPTemplates {
|
|||
try {
|
||||
|
||||
for (DomainXML domain : domains) {
|
||||
for (Long key : getMap(dataKey, domain.getCwa(), FFMPRecord.COUNTY)
|
||||
.keySet()) {
|
||||
for (Long key : getMap(dataKey, domain.getCwa(),
|
||||
FFMPRecord.COUNTY).keySet()) {
|
||||
if (countyMap.get(key) == null) {
|
||||
county = FFMPUtils.getCounty(key, MODE.CAVE.getMode());
|
||||
if (county != null) {
|
||||
|
@ -1146,8 +1153,8 @@ public class FFMPTemplates {
|
|||
TreeSet<Long> aggrPfafs = new TreeSet<Long>();
|
||||
aggrPfafToAllChildPfafsMap = new HashMap<Long, TreeSet<Long>>();
|
||||
if (myHucNum + 1 == getTotalHucLevels()) {
|
||||
Set<Long> allPfafs = getMap(dataKey, cwa, FFMPRecord.ALL)
|
||||
.keySet();
|
||||
Set<Long> allPfafs = getMap(dataKey, cwa,
|
||||
FFMPRecord.ALL).keySet();
|
||||
for (Long pfaf : allPfafs) {
|
||||
int endIndex = getHucDepthStart() + myHucNum;
|
||||
Long aggrPfaf = Long.parseLong(pfaf.toString()
|
||||
|
@ -1246,7 +1253,8 @@ public class FFMPTemplates {
|
|||
if (huc.equals(FFMPRecord.COUNTY)) {
|
||||
|
||||
if (allMap != null) {
|
||||
writeTemplateFile(dataKey, FFMPRecord.ALL, cwa, allMap);
|
||||
writeTemplateFile(dataKey, FFMPRecord.ALL, cwa,
|
||||
allMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1341,7 +1349,8 @@ public class FFMPTemplates {
|
|||
// Expensive..., use envelopes first to get rough idea and
|
||||
// skip
|
||||
// unnecessary checks
|
||||
LinkedHashMap<Long, ?> map = getMap(dataKey, cwa, FFMPRecord.ALL);
|
||||
LinkedHashMap<Long, ?> map = getMap(dataKey, cwa,
|
||||
FFMPRecord.ALL);
|
||||
for (Entry<Long, ?> entry : map.entrySet()) {
|
||||
Long pfaf = entry.getKey();
|
||||
Geometry geometry = rawGeometries.get(pfaf);
|
||||
|
@ -1376,9 +1385,9 @@ public class FFMPTemplates {
|
|||
writeVGBFile(virtuals, cwa, dataKey);
|
||||
}
|
||||
} else {
|
||||
|
||||
|
||||
virtuals = readVGBFile("VIRTUAL", cwa, dataKey);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return virtuals;
|
||||
|
@ -1411,49 +1420,56 @@ public class FFMPTemplates {
|
|||
|
||||
virtualmap.put(cwa, map);
|
||||
|
||||
HashMap<String, ArrayList<FFMPVirtualGageBasinMetaData>> vgbMap = new HashMap<String, ArrayList<FFMPVirtualGageBasinMetaData>>();// DR 13228
|
||||
|
||||
HashMap<String, ArrayList<FFMPVirtualGageBasinMetaData>> vgbMap = new HashMap<String, ArrayList<FFMPVirtualGageBasinMetaData>>();// DR
|
||||
// 13228
|
||||
|
||||
HashMap<Long, ArrayList<FFMPVirtualGageBasinMetaData>> virtualGageBasins = new HashMap<Long, ArrayList<FFMPVirtualGageBasinMetaData>>(
|
||||
(int) (map.size() * 1.3));
|
||||
|
||||
|
||||
for (FFMPVirtualGageBasinMetaData vgb : map.values()) {
|
||||
Long id = vgb.getParentPfaf();
|
||||
String stateCommaCnty=vgb.getState()+", "+vgb.getCounty();// DR 13228 see getCountyStateName(,)
|
||||
|
||||
Long id = vgb.getParentPfaf();
|
||||
String stateCommaCnty = vgb.getState() + ", " + vgb.getCounty();// DR
|
||||
// 13228
|
||||
// see
|
||||
// getCountyStateName(,)
|
||||
|
||||
ArrayList<FFMPVirtualGageBasinMetaData> list = virtualGageBasins
|
||||
.get(id);
|
||||
ArrayList<FFMPVirtualGageBasinMetaData> list2=vgbMap.get(stateCommaCnty.toUpperCase());// DR 13228
|
||||
|
||||
.get(id);
|
||||
ArrayList<FFMPVirtualGageBasinMetaData> list2 = vgbMap
|
||||
.get(stateCommaCnty.toUpperCase());// DR 13228
|
||||
|
||||
if (list == null) {
|
||||
list = new ArrayList<FFMPVirtualGageBasinMetaData>();
|
||||
virtualGageBasins.put(id, list);
|
||||
}
|
||||
list.add(vgb);
|
||||
|
||||
list.add(vgb);
|
||||
|
||||
// DR 13228
|
||||
if(list2==null){
|
||||
list2=new ArrayList<FFMPVirtualGageBasinMetaData>();
|
||||
vgbMap.put(stateCommaCnty.toUpperCase(),list2);
|
||||
}
|
||||
if (list2 == null) {
|
||||
list2 = new ArrayList<FFMPVirtualGageBasinMetaData>();
|
||||
vgbMap.put(stateCommaCnty.toUpperCase(), list2);
|
||||
}
|
||||
list2.add(vgb);// DR 13228
|
||||
}
|
||||
|
||||
HashMap<String, HashMap<String, ArrayList<FFMPVirtualGageBasinMetaData>>> vMapCounty = vgbsInCounty.get(dataKey);// DR 13228
|
||||
HashMap<String, HashMap<String, ArrayList<FFMPVirtualGageBasinMetaData>>> vMapCounty = vgbsInCounty
|
||||
.get(dataKey);// DR 13228
|
||||
HashMap<String, HashMap<Long, ArrayList<FFMPVirtualGageBasinMetaData>>> virtualMapPfaf = virtualGageBasinsInParentPfaf
|
||||
.get(dataKey);
|
||||
if (virtualMapPfaf == null) {
|
||||
virtualMapPfaf = new HashMap<String, HashMap<Long, ArrayList<FFMPVirtualGageBasinMetaData>>>();
|
||||
|
||||
}
|
||||
|
||||
|
||||
// DR 13228
|
||||
if(vMapCounty==null) {
|
||||
vMapCounty = new HashMap<String, HashMap<String, ArrayList<FFMPVirtualGageBasinMetaData>>>();// DR 13228
|
||||
if (vMapCounty == null) {
|
||||
vMapCounty = new HashMap<String, HashMap<String, ArrayList<FFMPVirtualGageBasinMetaData>>>();// DR
|
||||
// 13228
|
||||
}
|
||||
|
||||
vMapCounty.put(cwa, vgbMap);// DR 13228
|
||||
vgbsInCounty.put(dataKey,vMapCounty);// DR 13228
|
||||
|
||||
vMapCounty.put(cwa, vgbMap);// DR 13228
|
||||
vgbsInCounty.put(dataKey, vMapCounty);// DR 13228
|
||||
|
||||
virtualMapPfaf.put(cwa, virtualGageBasins);
|
||||
virtualGageBasinsInParentPfaf.put(dataKey, virtualMapPfaf);
|
||||
}
|
||||
|
@ -1638,9 +1654,10 @@ public class FFMPTemplates {
|
|||
* @param pfaf
|
||||
* @return
|
||||
*/
|
||||
public synchronized /*ArrayList<FFMPVirtualGageBasinMetaData>*/ArrayList<Long> getVirtualGageBasinLookupIds(
|
||||
public synchronized/* ArrayList<FFMPVirtualGageBasinMetaData> */ArrayList<Long> getVirtualGageBasinLookupIds(
|
||||
String dataKey, Long pfaf, String huc, String rowName) {
|
||||
if(isCountyRow(huc, rowName)) return getVgbLookupIdsByCounty(dataKey, pfaf, huc, rowName);
|
||||
if (isCountyRow(huc, rowName))
|
||||
return getVgbLookupIdsByCounty(dataKey, pfaf, huc, rowName);
|
||||
HashMap<String, HashMap<Long, ArrayList<FFMPVirtualGageBasinMetaData>>> virtualMap = virtualGageBasinsInParentPfaf
|
||||
.get(dataKey);
|
||||
|
||||
|
@ -1651,15 +1668,18 @@ if(isCountyRow(huc, rowName)) return getVgbLookupIdsByCounty(dataKey, pfaf, huc,
|
|||
if (map != null) {
|
||||
ArrayList<FFMPVirtualGageBasinMetaData> list = map.get(pfaf);
|
||||
if (list != null && !list.isEmpty()) {
|
||||
ArrayList<Long> result = new ArrayList<Long>();//ArrayList<FFMPVirtualGageBasinMetaData> vgblist = new ArrayList<FFMPVirtualGageBasinMetaData>();
|
||||
ArrayList<Long> result = new ArrayList<Long>();// ArrayList<FFMPVirtualGageBasinMetaData>
|
||||
// vgblist =
|
||||
// new
|
||||
// ArrayList<FFMPVirtualGageBasinMetaData>();
|
||||
for (FFMPVirtualGageBasinMetaData md : list)
|
||||
/*vgblist.add(md);*/result.add(md.getLookupId());
|
||||
return /*vgblist;*/result;
|
||||
/* vgblist.add(md); */result.add(md.getLookupId());
|
||||
return /* vgblist; */result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return /*new ArrayList<FFMPVirtualGageBasinMetaData>();*/new ArrayList<Long>();
|
||||
return /* new ArrayList<FFMPVirtualGageBasinMetaData>(); */new ArrayList<Long>();
|
||||
|
||||
}
|
||||
|
||||
|
@ -2242,13 +2262,14 @@ if(isCountyRow(huc, rowName)) return getVgbLookupIdsByCounty(dataKey, pfaf, huc,
|
|||
* @return
|
||||
*/
|
||||
public FFMPBasinMetaData getBasinInDomains(String dataKey,
|
||||
ArrayList<DomainXML> domains, ArrayList<Long> pfafs) {
|
||||
List<DomainXML> domains, List<Long> pfafs) {
|
||||
|
||||
FFMPBasinMetaData mbasin = null;
|
||||
|
||||
for (DomainXML domain : domains) {
|
||||
|
||||
LinkedHashMap<Long, ?> map = getMap(dataKey, domain.getCwa(), FFMPRecord.ALL);
|
||||
LinkedHashMap<Long, ?> map = getMap(dataKey, domain.getCwa(),
|
||||
FFMPRecord.ALL);
|
||||
|
||||
for (Long key : pfafs) {
|
||||
if (map.containsKey(key)) {
|
||||
|
@ -2377,43 +2398,46 @@ if(isCountyRow(huc, rowName)) return getVgbLookupIdsByCounty(dataKey, pfaf, huc,
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* DR 13228
|
||||
/**
|
||||
* DR 13228
|
||||
*/
|
||||
public static boolean isCountyRow(String huc, String rowName){
|
||||
public static boolean isCountyRow(String huc, String rowName) {
|
||||
|
||||
return "COUNTY".equals(huc) && rowName.contains(",");// see getCountyStateName(,)
|
||||
return "COUNTY".equals(huc) && rowName.contains(",");// see
|
||||
// getCountyStateName(,)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* DR 13228
|
||||
|
||||
/**
|
||||
* DR 13228
|
||||
*/
|
||||
public synchronized ArrayList<Long> getVgbLookupIdsByCounty(
|
||||
String dataKey, Long pfaf, String huc, String rowName) {
|
||||
public synchronized ArrayList<Long> getVgbLookupIdsByCounty(String dataKey,
|
||||
Long pfaf, String huc, String rowName) {
|
||||
|
||||
String stateCommaCnty = rowName;//.split(",")[1];
|
||||
String stateCommaCnty = rowName;// .split(",")[1];
|
||||
|
||||
HashMap<String, HashMap<String, ArrayList<FFMPVirtualGageBasinMetaData>>> virtualMap = vgbsInCounty.get(dataKey);
|
||||
HashMap<String, HashMap<String, ArrayList<FFMPVirtualGageBasinMetaData>>> virtualMap = vgbsInCounty
|
||||
.get(dataKey);
|
||||
|
||||
for (DomainXML domain : domains) {
|
||||
for (DomainXML domain : domains) {
|
||||
|
||||
HashMap<String, ArrayList<FFMPVirtualGageBasinMetaData>> map = virtualMap
|
||||
.get(domain.getCwa());
|
||||
if (map != null) {
|
||||
ArrayList<FFMPVirtualGageBasinMetaData> list = map.get(stateCommaCnty.trim().toUpperCase());
|
||||
HashMap<String, ArrayList<FFMPVirtualGageBasinMetaData>> map = virtualMap
|
||||
.get(domain.getCwa());
|
||||
if (map != null) {
|
||||
ArrayList<FFMPVirtualGageBasinMetaData> list = map
|
||||
.get(stateCommaCnty.trim().toUpperCase());
|
||||
|
||||
if (list != null && !list.isEmpty()) {
|
||||
ArrayList<Long> result = new ArrayList<Long>();
|
||||
for (FFMPVirtualGageBasinMetaData md : list){
|
||||
result.add(md.getLookupId());
|
||||
if (list != null && !list.isEmpty()) {
|
||||
ArrayList<Long> result = new ArrayList<Long>();
|
||||
for (FFMPVirtualGageBasinMetaData md : list) {
|
||||
result.add(md.getLookupId());
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return new ArrayList<Long>();
|
||||
}
|
||||
return new ArrayList<Long>();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue