14.1.1-16 baseline
Former-commit-id:9e935404d8
[formerly6be938e6eb
] [formerly9e935404d8
[formerly6be938e6eb
] [formerlyb84f7d4203
[formerly dee925ccd6738c3ca6727a7c65f4471170bc698c]]] Former-commit-id:b84f7d4203
Former-commit-id:b72cd19055
[formerly644da23327
] Former-commit-id:5f79da2501
This commit is contained in:
parent
1ca553385c
commit
6bf3189db9
13 changed files with 264 additions and 99 deletions
|
@ -152,6 +152,9 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
|||
* 05/08/2013 #1842 dgilling Add alternate setProductText(), fix
|
||||
* warnings.
|
||||
* 09/03/2013 16534 ryu Refactor; sneak in a change for Ron (RM #1597).
|
||||
* 01/06/2014 2649 dgilling Pass flag to StoreTransmitDlg to only
|
||||
* update VTEC lines on products that
|
||||
* aren't being corrected.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -1139,7 +1142,7 @@ public class ProductEditorComp extends Composite implements
|
|||
// prevent the launching of another dialog until the modal dialog is
|
||||
// closed.
|
||||
StoreTransmitDlg storeDlg = new StoreTransmitDlg(parent.getShell(),
|
||||
showStore, this, transmissionCB, pid);
|
||||
showStore, this, transmissionCB, pid, !textComp.isCorMode());
|
||||
storeDlg.open();
|
||||
}
|
||||
}
|
||||
|
@ -2877,7 +2880,7 @@ public class ProductEditorComp extends Composite implements
|
|||
mb2.open();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Word-wrap the whole selection.
|
||||
int curLine = styledText.getLineAtOffset(selectionRange.x);
|
||||
int lastSelIdx = selectionRange.x + selectionRange.y - 1;
|
||||
|
|
|
@ -58,23 +58,28 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* Display the Store/Transmit dialog.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 21 APR 2008 ### lvenable Initial creation
|
||||
* 19 FEB 2010 4132 ryu Product correction.
|
||||
* 28May2010 2187 cjeanbap Added StdTextProductFactory
|
||||
* functionality.
|
||||
* 09 NOV 2012 1298 rferrel Changes for non-blocking dialog.
|
||||
* 02apr2013 15564 mgamazaychikov Ensured awipsWanPil to be 10 characters space-padded long
|
||||
* 08 MAY 2013 1842 dgilling Use VtecUtil to set product ETNs, fix
|
||||
* Apr 21, 2008 ### lvenable Initial creation
|
||||
* Feb 19, 2010 4132 ryu Product correction.
|
||||
* May 28, 2010 2187 cjeanbap Added StdTextProductFactory
|
||||
* functionality.
|
||||
* Nov 09, 2012 1298 rferrel Changes for non-blocking dialog.
|
||||
* Apr 02, 2013 15564 mgamazaychikov Ensured awipsWanPil to be 10 characters
|
||||
* space-padded long
|
||||
* May 08, 2013 1842 dgilling Use VtecUtil to set product ETNs, fix
|
||||
* warnings.
|
||||
* 07 Jun 2013 1981 mpduff Set user's id in OUPRequest as it is now a protected operation.
|
||||
* Jun 07, 2013 1981 mduff Set user's id in OUPRequest as it is
|
||||
* now a protected operation.
|
||||
* Jan 06, 2014 2649 dgilling Make ETN assignment process optional.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author lvenable
|
||||
* @version 1.0
|
||||
*
|
||||
*/
|
||||
public class StoreTransmitDlg extends CaveSWTDialog implements
|
||||
IStoreTransmitProduct {
|
||||
|
@ -132,17 +137,26 @@ public class StoreTransmitDlg extends CaveSWTDialog implements
|
|||
|
||||
private final String pid;
|
||||
|
||||
private final boolean updateVtec;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param parent
|
||||
* Parent shell.
|
||||
* @param storeDialog
|
||||
* Store flag. True is store, false is transmit.
|
||||
* @param editor
|
||||
* Parent editor. Product will be updated in this editor after
|
||||
* transmission.
|
||||
* @param transmissionCB
|
||||
* @param pid
|
||||
* @param updateVtec
|
||||
* Whether or not to update the ETNs of any VTEC lines in the
|
||||
* product to be transmitted. Recommend setting this to false
|
||||
* when correcting a previously transmitted product.
|
||||
*/
|
||||
public StoreTransmitDlg(Shell parent, boolean storeDialog,
|
||||
ProductEditorComp editor, ITransmissionState transmissionCB,
|
||||
String pid) {
|
||||
String pid, boolean updateVtec) {
|
||||
super(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL,
|
||||
CAVE.DO_NOT_BLOCK);
|
||||
|
||||
|
@ -151,6 +165,7 @@ public class StoreTransmitDlg extends CaveSWTDialog implements
|
|||
parentEditor = editor;
|
||||
this.productText = editor.getProductText();
|
||||
this.pid = pid;
|
||||
this.updateVtec = updateVtec;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -334,21 +349,22 @@ public class StoreTransmitDlg extends CaveSWTDialog implements
|
|||
// Store/Transmit the product...
|
||||
|
||||
if (!countdownThread.threadCancelled()) {
|
||||
if (updateVtec) {
|
||||
try {
|
||||
productText = GFEVtecUtil.finalizeETNs(productText);
|
||||
} catch (VizException e) {
|
||||
statusHandler.handle(Priority.CRITICAL,
|
||||
"Error setting ETNs for product", e);
|
||||
sendTransmissionStatus(ConfigData.productStateEnum.Failed);
|
||||
VizApp.runAsync(new Runnable() {
|
||||
|
||||
try {
|
||||
productText = GFEVtecUtil.finalizeETNs(productText);
|
||||
} catch (VizException e) {
|
||||
statusHandler.handle(Priority.CRITICAL,
|
||||
"Error setting ETNs for product", e);
|
||||
sendTransmissionStatus(ConfigData.productStateEnum.Failed);
|
||||
VizApp.runAsync(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
StoreTransmitDlg.this.parentEditor.revive();
|
||||
}
|
||||
});
|
||||
return;
|
||||
@Override
|
||||
public void run() {
|
||||
StoreTransmitDlg.this.parentEditor.revive();
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
VizApp.runSync(new Runnable() {
|
||||
|
|
|
@ -99,6 +99,7 @@ import com.raytheon.viz.gfe.ui.zoneselector.ZoneSelector;
|
|||
* not found to match A1.
|
||||
* Dec 03, 2013 #2591 dgilling Ensure all change states to the combo
|
||||
* file are handled.
|
||||
* Jan 07, 2014 #2662 randerso Disabled zone combiner if no maps are selected
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -257,7 +258,11 @@ public class ZoneCombinerComp extends Composite implements
|
|||
|
||||
this.textProductMgr = textProductMgr;
|
||||
|
||||
mapRequired = textProductMgr.mapRequired(productName);
|
||||
mapRequired = this.textProductMgr.mapRequired(productName);
|
||||
this.mapNames = getMapNames(productName);
|
||||
if (mapNames.isEmpty()) {
|
||||
mapRequired = false;
|
||||
}
|
||||
|
||||
initPreferences();
|
||||
init();
|
||||
|
@ -278,6 +283,23 @@ public class ZoneCombinerComp extends Composite implements
|
|||
});
|
||||
}
|
||||
|
||||
private List<String> getMapNames(String productName) {
|
||||
Object obj = this.textProductMgr.getMapNameForCombinations(productName);
|
||||
List<String> mapNames = new ArrayList<String>();
|
||||
if (obj instanceof String) {
|
||||
String s = (String) obj;
|
||||
if (!s.isEmpty()) {
|
||||
mapNames.add(s);
|
||||
}
|
||||
} else if (obj instanceof List<?>) {
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> list = (List<String>) obj;
|
||||
mapNames.addAll(list);
|
||||
}
|
||||
|
||||
return mapNames;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the composite.
|
||||
*/
|
||||
|
@ -790,21 +812,9 @@ public class ZoneCombinerComp extends Composite implements
|
|||
}
|
||||
Map<String, Integer> comboDict = loadCombinationsFile(comboName);
|
||||
|
||||
Object obj = textProductMgr.getMapNameForCombinations(productName);
|
||||
mapNames = new ArrayList<String>();
|
||||
if (obj instanceof String) {
|
||||
String s = (String) obj;
|
||||
if (!s.isEmpty()) {
|
||||
mapNames.add(s);
|
||||
}
|
||||
} else if (obj instanceof List<?>) {
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> list = (List<String>) obj;
|
||||
mapNames.addAll(list);
|
||||
}
|
||||
|
||||
boolean singleComboOnly = false;
|
||||
obj = textProductMgr.getDefinitionValue(productName, "singleComboOnly");
|
||||
Object obj = textProductMgr.getDefinitionValue(productName,
|
||||
"singleComboOnly");
|
||||
if (obj != null) {
|
||||
if (obj instanceof Integer) {
|
||||
singleComboOnly = ((Integer) obj) != 0;
|
||||
|
|
|
@ -74,6 +74,7 @@ import com.vividsolutions.jts.geom.Envelope;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 23, 2011 randerso Initial creation
|
||||
* May 30, 2013 #2028 randerso Fixed date line issue with map display
|
||||
* Jan 07, 2014 #2662 randerso Fixed limitZones (subDomainUGCs) support
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -158,7 +159,6 @@ public abstract class AbstractZoneSelector extends PaneManager {
|
|||
return this.zoomLevel;
|
||||
}
|
||||
|
||||
// command to label the zones, calls setMap() to update the display
|
||||
public void setLabelZones(boolean labelZones) {
|
||||
if (labelZones == this.labelZones) {
|
||||
return;
|
||||
|
@ -182,7 +182,9 @@ public abstract class AbstractZoneSelector extends PaneManager {
|
|||
return;
|
||||
}
|
||||
this.limitZoneNames = limitZones;
|
||||
setMapInternal(this.mapRscList);
|
||||
for (ZoneSelectorResource mapRsc : this.mapRscList) {
|
||||
mapRsc.setLimitZones(limitZones);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -287,7 +289,7 @@ public abstract class AbstractZoneSelector extends PaneManager {
|
|||
.retrieveMap(bundlePath).getResourceData();
|
||||
|
||||
ZoneSelectorResource rsc = new ZoneSelectorResource(rscData,
|
||||
new LoadProperties(), gloc);
|
||||
new LoadProperties(), gloc, this.limitZoneNames);
|
||||
mapRscList.add(rsc);
|
||||
} catch (VizException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, "Error loading map: "
|
||||
|
|
|
@ -102,6 +102,7 @@ import com.vividsolutions.jts.io.WKBReader;
|
|||
* Apr 10, 2013 #1854 randerso Fix for compatibility with PostGIS 2.0
|
||||
* May 30, 2013 #2028 randerso Fixed date line issue with map display
|
||||
* Jul 31, 2013 #2239 randerso Fixed scaling of maps that cross the date line
|
||||
* Jan 07, 2014 #2662 randerso Fixed limitZones (subDomainUGCs) support
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -230,6 +231,7 @@ public class ZoneSelectorResource extends DbMapResource {
|
|||
|
||||
int numPoints = 0;
|
||||
int wfoPoints = 0;
|
||||
List<String> limitZones = req.rsc.getLimitZones();
|
||||
WKBReader wkbReader = new WKBReader();
|
||||
for (int i = 0; i < mappedResult.getResultCount(); i++) {
|
||||
if (canceled) {
|
||||
|
@ -259,6 +261,12 @@ public class ZoneSelectorResource extends DbMapResource {
|
|||
// TODO: what do we do with this?
|
||||
// zoneName = "";
|
||||
}
|
||||
|
||||
if (limitZones != null
|
||||
&& !limitZones.contains(zoneName)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String wfo = (String) mappedResult
|
||||
.getRowColumnValue(i, "wfo");
|
||||
|
||||
|
@ -532,6 +540,8 @@ public class ZoneSelectorResource extends DbMapResource {
|
|||
|
||||
private Map<String, ZoneInfo> zoneData;
|
||||
|
||||
private List<String> limitZones;
|
||||
|
||||
private RGB defaultFillColor;
|
||||
|
||||
private RGB outlineColor;
|
||||
|
@ -559,9 +569,12 @@ public class ZoneSelectorResource extends DbMapResource {
|
|||
/**
|
||||
* @param data
|
||||
* @param loadProperties
|
||||
* @param gloc
|
||||
* @param limitZones
|
||||
*/
|
||||
public ZoneSelectorResource(DbMapResourceData data,
|
||||
LoadProperties loadProperties, GridLocation gloc) {
|
||||
LoadProperties loadProperties, GridLocation gloc,
|
||||
List<String> limitZones) {
|
||||
super(data, loadProperties);
|
||||
this.zoneData = new HashMap<String, ZoneInfo>();
|
||||
this.geomFactory = new GeometryFactory();
|
||||
|
@ -570,6 +583,7 @@ public class ZoneSelectorResource extends DbMapResource {
|
|||
this.outlineColor = RGBColors.getRGBColor("white");
|
||||
this.wfoOutlineColor = RGBColors.getRGBColor("yellow");
|
||||
this.gloc = gloc;
|
||||
this.limitZones = limitZones;
|
||||
|
||||
GeneralEnvelope env = new GeneralEnvelope(MapUtil.LATLON_PROJECTION);
|
||||
env.setEnvelope(-180.0, -90.0, 180.0, 90.0);
|
||||
|
@ -848,13 +862,10 @@ public class ZoneSelectorResource extends DbMapResource {
|
|||
query.append(geometryField);
|
||||
|
||||
// add any additional columns
|
||||
List<String> additionalColumns = new ArrayList<String>();
|
||||
if (resourceData.getColumns() != null) {
|
||||
for (ColumnDefinition column : resourceData.getColumns()) {
|
||||
query.append(", ");
|
||||
query.append(column);
|
||||
|
||||
additionalColumns.add(column.getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -915,6 +926,22 @@ public class ZoneSelectorResource extends DbMapResource {
|
|||
return newShadedShape;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the limitZones
|
||||
*/
|
||||
public List<String> getLimitZones() {
|
||||
return limitZones;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param limitZones
|
||||
* the limitZones to set
|
||||
*/
|
||||
public void setLimitZones(List<String> limitZones) {
|
||||
this.limitZones = limitZones;
|
||||
issueRefresh();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param labelZones
|
||||
*/
|
||||
|
@ -1023,6 +1050,16 @@ public class ZoneSelectorResource extends DbMapResource {
|
|||
query.append(resourceData.getGeomField());
|
||||
query.append(")) as extent");
|
||||
|
||||
// add editarea column
|
||||
if (resourceData.getColumns() != null) {
|
||||
for (ColumnDefinition column : resourceData.getColumns()) {
|
||||
if (column.getName().equalsIgnoreCase("editarea")) {
|
||||
query.append(", ");
|
||||
query.append(column);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add the geometry table
|
||||
query.append(" FROM ");
|
||||
query.append(resourceData.getTable());
|
||||
|
@ -1047,6 +1084,14 @@ public class ZoneSelectorResource extends DbMapResource {
|
|||
|
||||
WKBReader wkbReader = new WKBReader();
|
||||
for (int i = 0; i < mappedResult.getResultCount(); i++) {
|
||||
String zoneName = (String) mappedResult.getRowColumnValue(
|
||||
i, "editarea");
|
||||
|
||||
if (this.limitZones != null
|
||||
&& !this.limitZones.contains(zoneName)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
byte[] b = (byte[]) mappedResult.getRowColumnValue(i,
|
||||
"extent");
|
||||
if (b != null) {
|
||||
|
|
|
@ -38,7 +38,8 @@ import com.raytheon.viz.mpe.util.DailyQcUtils.Station;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 11, 2009 snaples Initial creation
|
||||
* May 02, 2011 8962 snaples Added render24hrPcpUsingFour6hr() method
|
||||
*
|
||||
* Jan 10, 2014 16976 cgobs Fixed issue on line 153.
|
||||
* Changed pcp.value[row][col] to pcp.value[col][row]
|
||||
* </pre>
|
||||
*
|
||||
* @author snaples
|
||||
|
@ -149,7 +150,7 @@ public class RenderPcp {
|
|||
|
||||
for (int col = 0; col < hrap_grid.maxi; col++) {
|
||||
for (int row = 0; row < hrap_grid.maxj; row++) {
|
||||
value = pcp.value[row][col];
|
||||
value = pcp.value[col][row];
|
||||
|
||||
if (value > maxValue) {
|
||||
maxValue = value;
|
||||
|
|
|
@ -38,7 +38,8 @@ import com.raytheon.viz.mpe.util.DailyQcUtils.Station;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 11, 2009 snaples Initial creation
|
||||
* May 02, 2011 8962 snaples Added render24hrPcpUsingFour6hr() method
|
||||
*
|
||||
* Jan 10, 2014 16976 cgobs Fixed issue on line 290.
|
||||
* Changed pcp.value[row][col] to pcp.value[col][row]
|
||||
* </pre>
|
||||
*
|
||||
* @author snaples
|
||||
|
@ -286,7 +287,7 @@ public class RenderPcpBlocking {
|
|||
* not estimate precipitation for it.
|
||||
*/
|
||||
if (hrap_grid.owner[col][row] == -1) {
|
||||
pcp.value[row][col] = 0;
|
||||
pcp.value[col][row] = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -308,7 +309,7 @@ public class RenderPcpBlocking {
|
|||
resultingPrecipValue = 0.0;
|
||||
}
|
||||
|
||||
// pcp.value[row][col] is the value of grid,
|
||||
// pcp.value[col][row] is the value of grid,
|
||||
// so we don't need to estimate a value for [row][col]
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,9 @@ import org.opengis.metadata.spatial.PixelOrientation;
|
|||
import org.opengis.referencing.operation.MathTransform;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.warning.util.GeometryUtil;
|
||||
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.core.IExtent;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.viz.core.contours.util.ContourContainer;
|
||||
|
@ -76,6 +79,7 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
|
|||
* 10/01/2013 DR 16632 Qinglu Lin Fixed the bug in for loop range.
|
||||
* 10/17/2013 DR 16632 Qinglu Lin Updated removeOverlaidLinesegments().
|
||||
* 10/18/2013 DR 16632 Qinglu Lin Catch exception thrown when coords length is less than 4 and doing createLinearRing(coords).
|
||||
* 01/09/2014 DR 16974 D. Friedman Improve followup redraw-from-hatched-area polygons.
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
|
@ -83,6 +87,8 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
|
|||
*/
|
||||
|
||||
public class PolygonUtil {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(PolygonUtil.class);
|
||||
|
||||
private WarngenLayer layer;
|
||||
|
||||
|
@ -114,6 +120,39 @@ public class PolygonUtil {
|
|||
Geometry origWarningArea, Polygon oldWarningPolygon) throws VizException {
|
||||
float[][] contourAreaData = toFloatData(origWarningArea);
|
||||
|
||||
/* If we have an oldWarningPolygon, we can take a shortcut and see
|
||||
* if the intersection of the current polygon and the old polygon
|
||||
* generates the same input to the contouring algorithm as the current
|
||||
* hatched area. If it does, that intersection can be used instead of
|
||||
* generating a new contour.
|
||||
*/
|
||||
if (oldWarningPolygon != null) {
|
||||
try {
|
||||
Geometry intersection = origPolygon.intersection(oldWarningPolygon);
|
||||
if (intersection instanceof Polygon) {
|
||||
Polygon polygonIntersection = (Polygon) intersection;
|
||||
if (polygonIntersection.isValid() &&
|
||||
polygonIntersection.getNumInteriorRing() == 0 &&
|
||||
polygonIntersection.getNumPoints() - 1 <= maxVertices) {
|
||||
/*
|
||||
* Use buildIdealArea to clip the current polygon against the old
|
||||
* polygon (actually oldWarningArea) and the CWA, using the same
|
||||
* coordinate transformations that are used to generate
|
||||
* origWarningArea.
|
||||
*/
|
||||
Geometry comparableIntersection = layer.buildIdealArea(origPolygon);
|
||||
float[][] interAreaData = toFloatData(comparableIntersection);
|
||||
if (areasEqual(interAreaData, contourAreaData)) {
|
||||
return polygonIntersection;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
statusHandler.handle(Priority.WARN,
|
||||
"Error while using simple polygon redraw method. Will continue using contouring method.", e);
|
||||
}
|
||||
}
|
||||
|
||||
// Create contouring configuration
|
||||
FortConConfig config = new FortConConfig();
|
||||
config.generateMaxes = false;
|
||||
|
|
|
@ -194,6 +194,7 @@ import com.vividsolutions.jts.io.WKTReader;
|
|||
* 10/21/2013 DR 16632 D. Friedman Modify areaPercent exception handling. Fix an NPE.
|
||||
* Use A1 hatching behavior when no county passes the inclusion filter.
|
||||
* 10/29/2013 DR 16734 D. Friedman If redraw-from-hatched-area fails, don't allow the pollygon the be used.
|
||||
* 01/09/2014 DR 16974 D. Friedman Improve followup redraw-from-hatched-area polygons.
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
|
@ -2934,41 +2935,11 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
|||
state.snappedToArea = false;
|
||||
if (areaHatcher != null) {
|
||||
Polygon polygon = state.getWarningPolygon();
|
||||
polygon = tryToIntersectWithOriginalPolygon(polygon);
|
||||
areaHatcher.hatchArea(polygon, state.getWarningArea(),
|
||||
state.getOldWarningPolygon());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to determine the intersection of the given polygon with the original
|
||||
* warning polygon. If there is no original polygon, if the result of the
|
||||
* intersection is not a single polygon, or if a problem occurs, just return
|
||||
* the original polygon. The purpose of this is to pass the polygon that
|
||||
* best represents the user's intent to the polygon redrawing algorithm.
|
||||
*/
|
||||
private Polygon tryToIntersectWithOriginalPolygon(Polygon polygon) {
|
||||
if (state.getOldWarningPolygon() != null) {
|
||||
try {
|
||||
Geometry g = polygon.intersection(state.getOldWarningPolygon());
|
||||
Polygon newPolygon = null;
|
||||
if (g instanceof Polygon) {
|
||||
newPolygon = (Polygon) g;
|
||||
} else if (g instanceof GeometryCollection
|
||||
&& g.getNumGeometries() == 1
|
||||
&& g.getGeometryN(0) instanceof Polygon) {
|
||||
newPolygon = (Polygon) g.getGeometryN(0);
|
||||
}
|
||||
if (newPolygon != null && newPolygon.isValid()) {
|
||||
polygon = newPolygon;
|
||||
}
|
||||
} catch (TopologyException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
return polygon;
|
||||
}
|
||||
|
||||
private Collection<GeospatialData> getDataWithFips(String fips) {
|
||||
List<GeospatialData> data = new ArrayList<GeospatialData>();
|
||||
for (GeospatialData d : geoData.features) {
|
||||
|
@ -3252,4 +3223,40 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Like buildArea, but does not take inclusion filters into account. Also
|
||||
* returns a Geometry in lat/lon space.
|
||||
* @param inputArea
|
||||
* @return
|
||||
*/
|
||||
public Geometry buildIdealArea(Geometry inputArea) {
|
||||
Geometry localHatchedArea = latLonToLocal(inputArea);
|
||||
Geometry oldWarningArea = latLonToLocal(state.getOldWarningArea());
|
||||
Geometry newHatchedArea = null;
|
||||
|
||||
for (GeospatialData f : geoData.features) {
|
||||
// get the geometry of the county and make sure it intersects
|
||||
// with our hatched area
|
||||
PreparedGeometry prepGeom = (PreparedGeometry) f.attributes
|
||||
.get(GeospatialDataList.LOCAL_PREP_GEOM);
|
||||
Geometry intersection = null;
|
||||
try {
|
||||
// Get intersection between county and hatched boundary
|
||||
intersection = GeometryUtil.intersection(localHatchedArea, prepGeom);
|
||||
if (oldWarningArea != null) {
|
||||
intersection = GeometryUtil.intersection(intersection,
|
||||
oldWarningArea);
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
continue;
|
||||
// This is a workaround for JTS 1.7.1
|
||||
}
|
||||
|
||||
newHatchedArea = union(newHatchedArea, intersection);
|
||||
}
|
||||
Geometry result = newHatchedArea != null ? newHatchedArea : new GeometryFactory()
|
||||
.createGeometryCollection(new Geometry[0]);
|
||||
return localToLatLon(result);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,6 +83,7 @@ from com.raytheon.uf.edex.database.cluster import ClusterTask
|
|||
# call IFPWE.history() like A1.
|
||||
# 11/05/13 2517 randerso Restructured logging so it coulde be used by WECache
|
||||
# Changed WECache to limit the number of cached grids kept in memory
|
||||
# 01/09/14 16952 randerso Fix regression made in #2517 which caused errors with overlapping grids
|
||||
#
|
||||
#
|
||||
|
||||
|
@ -467,6 +468,7 @@ class IscMosaic:
|
|||
self.__mysite = args['siteID']
|
||||
self.__userID = args['userID']
|
||||
self.__db = None # ifpServer database object
|
||||
self.__dbGrid = None
|
||||
self.__parmsToProcess = args['parmsToProcess']
|
||||
self.__blankOtherPeriods = args['blankOtherPeriods']
|
||||
self.__altMask = args['altMask']
|
||||
|
@ -828,7 +830,7 @@ class IscMosaic:
|
|||
|
||||
logger.debug("Merge: %s %s %s", printTR(m[0]),
|
||||
printTR(m[1]), m[2])
|
||||
gotGrid = self._wec[m[0]]
|
||||
gotGrid = self.__getDbGrid(m[0])
|
||||
|
||||
if gotGrid is not None:
|
||||
destGrid = gotGrid[0]
|
||||
|
@ -893,6 +895,30 @@ class IscMosaic:
|
|||
self._wec[tr] = None
|
||||
self.__dbinv = self._wec.keys()
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# get db grid
|
||||
# Gets the needed database grid
|
||||
# tr = desired grid, identified by time range
|
||||
# Returns tuple of (grid, history) (or None if unknown)
|
||||
#---------------------------------------------------------------------
|
||||
def __getDbGrid(self, tr):
|
||||
if tr is None:
|
||||
return None
|
||||
|
||||
if self.__dbGrid is None or tr != self.__dbGrid[2]:
|
||||
self.__dbGrid = None
|
||||
#grid = self.__dbwe.getGridAndHist(tr)
|
||||
grid = self._wec[tr]
|
||||
if grid is not None:
|
||||
destGrid, history = grid
|
||||
self.__dbGrid = (destGrid, history, tr)
|
||||
else:
|
||||
self.logProblem("Unable to access grid for ",
|
||||
self.__printTR(tr), "for ", self.__parmName)
|
||||
return None
|
||||
|
||||
return (self.__dbGrid[0], self.__dbGrid[1])
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# calculate file start/end processing times
|
||||
# Returns (startTime, endTime) or None for processing
|
||||
|
@ -1112,7 +1138,7 @@ class IscMosaic:
|
|||
for m in mergeInfo:
|
||||
if m[0] != m[1]: #split grid needed
|
||||
if m[0] != oldTR:
|
||||
oldGrid = self._wec[m[0]]
|
||||
oldGrid = self.__getDbGrid(m[0])
|
||||
oldTR = m[0]
|
||||
if oldGrid is not None:
|
||||
if self.__rateParm:
|
||||
|
@ -1121,6 +1147,7 @@ class IscMosaic:
|
|||
self.__storeGrid(m[1], (adjGrid, oldGrid[1]))
|
||||
else:
|
||||
self.__storeGrid(m[1], oldGrid)
|
||||
self.__dbGrid = None
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Get Incoming netCDF file grid valid times
|
||||
|
@ -1400,7 +1427,7 @@ class IscMosaic:
|
|||
if m[0] != None and m[2] == 1:
|
||||
if self.__siteInDbGrid(m[0]):
|
||||
try:
|
||||
(destGrid, oldHist) = self._wec[m[0]]
|
||||
(destGrid, oldHist) = self.__getDbGrid(m[0])
|
||||
except:
|
||||
destGrid = None
|
||||
oldHist = None
|
||||
|
@ -1616,6 +1643,7 @@ class IscMosaic:
|
|||
#---------------------------------------------------------------------
|
||||
def __eraseAllGrids(self, processTimePeriod):
|
||||
self.__storeGrid(processTimePeriod, None)
|
||||
self.__dbGrid = None
|
||||
|
||||
|
||||
def convertList(unknownList):
|
||||
|
|
|
@ -189,6 +189,15 @@ public class ArchiveConfigManager {
|
|||
public Collection<ArchiveConfig> getArchives() {
|
||||
String fileName = ArchiveConstants.selectFileName(Type.Retention, null);
|
||||
SelectConfig selections = loadSelection(fileName);
|
||||
List<String> emptySelection = new ArrayList<String>(0);
|
||||
|
||||
// Clear old selections.
|
||||
for (ArchiveConfig archive : archiveMap.values()) {
|
||||
for (CategoryConfig category : archive.getCategoryList()) {
|
||||
category.setSelectedDisplayNames(emptySelection);
|
||||
}
|
||||
}
|
||||
|
||||
if ((selections != null) && !selections.isEmpty()) {
|
||||
for (ArchiveSelect archiveSelect : selections.getArchiveList()) {
|
||||
String archiveName = archiveSelect.getName();
|
||||
|
@ -325,7 +334,8 @@ public class ArchiveConfigManager {
|
|||
|
||||
Map<CategoryConfig, CategoryFileDateHelper> helperMap = new HashMap<CategoryConfig, CategoryFileDateHelper>();
|
||||
for (CategoryConfig category : archive.getCategoryList()) {
|
||||
CategoryFileDateHelper helper = new CategoryFileDateHelper(category);
|
||||
CategoryFileDateHelper helper = new CategoryFileDateHelper(
|
||||
archiveRootDirPath, category);
|
||||
helperMap.put(category, helper);
|
||||
}
|
||||
|
||||
|
@ -470,13 +480,8 @@ public class ArchiveConfigManager {
|
|||
if (file.isDirectory()) {
|
||||
purgeCount += purgeDir(file,
|
||||
FileFilterUtils.trueFileFilter());
|
||||
if (file.list().length == 0) {
|
||||
purgeCount += purgeDir(file,
|
||||
FileFilterUtils.trueFileFilter());
|
||||
}
|
||||
} else {
|
||||
purgeCount += deleteFile(file);
|
||||
}
|
||||
purgeCount += deleteFile(file);
|
||||
}
|
||||
} else if (file.isDirectory()) {
|
||||
purgeCount += purgeDir(file, defaultTimeFilter,
|
||||
|
|
|
@ -72,6 +72,7 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* May 1, 2013 1966 rferrel Initial creation
|
||||
* Aug 03, 2013 2224 rferrel Changes to include DataSet.
|
||||
* Jan 09, 2014 2603 rferrel Fix bug in setSelectedDisplayNames
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -155,7 +156,7 @@ public class CategoryConfig implements Comparable<CategoryConfig> {
|
|||
public void setSelectedDisplayNames(
|
||||
Collection<String> selectedDisplayNameList) {
|
||||
selectedDisplayNames.clear();
|
||||
selectedDisplayNameList.addAll(selectedDisplayNameList);
|
||||
selectedDisplayNames.addAll(selectedDisplayNameList);
|
||||
}
|
||||
|
||||
public void addSelectedDisplayName(String displayName) {
|
||||
|
|
|
@ -125,15 +125,19 @@ public class CategoryFileDateHelper implements IFileDateHelper {
|
|||
|
||||
private final List<CategoryDateInfo> dateInfoList;
|
||||
|
||||
private final String archiveRootDirPath;
|
||||
|
||||
/**
|
||||
* Initialization constructor.
|
||||
*
|
||||
* @param archiveRootDirPath
|
||||
* - Assumes path ends with file separator.
|
||||
* @param config
|
||||
* @param rootDirPattern
|
||||
* categoryTopLevelDirPattern
|
||||
*/
|
||||
public CategoryFileDateHelper(CategoryConfig config) {
|
||||
public CategoryFileDateHelper(String archiveRootDirPath,
|
||||
CategoryConfig config) {
|
||||
List<CategoryDataSet> categoryDataSetList = config.getDataSetList();
|
||||
this.archiveRootDirPath = archiveRootDirPath;
|
||||
int size = 0;
|
||||
for (CategoryDataSet dataSet : categoryDataSetList) {
|
||||
size += dataSet.getDirPatterns().size();
|
||||
|
@ -176,6 +180,9 @@ public class CategoryFileDateHelper implements IFileDateHelper {
|
|||
@Override
|
||||
public DataSetStatus getFileDate(File file) {
|
||||
String filenamePath = file.getAbsolutePath();
|
||||
if (filenamePath.indexOf(archiveRootDirPath) == 0) {
|
||||
filenamePath = filenamePath.substring(archiveRootDirPath.length());
|
||||
}
|
||||
Long timestamp = null;
|
||||
DataSetStatus result = new DataSetStatus(file);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue