Merge branch 'asm_14.4.1' of ssh://10.201.30.8:29418/AWIPS2_baseline into master_14.4.1

Former-commit-id: 0d4c9d4cf1 [formerly 62c8b784ec6cc09c405ecc3ee75325db8e0ae204]
Former-commit-id: 8ac7bc54cf
This commit is contained in:
Fay.Liang 2015-05-10 00:11:55 -04:00
commit 330dfb3ca3
6 changed files with 50 additions and 12 deletions

View file

@ -89,6 +89,7 @@ import com.vividsolutions.jts.precision.SimpleGeometryPrecisionReducer;
* 06/27/2014 DR 17443 D. Friedman Fix some odd cases in which parts of a polygon not covering a
* hatched area would be retained after redrawing.
* 07/22/2014 DR 17475 Qinglu Lin Updated createPolygonByPoints() and created second createPolygonByPoints().
* 05/08/2015 DR 17310 D. Friedman Prevent reducePoints from generating invalid polygons.
* </pre>
*
* @author mschenke
@ -543,7 +544,6 @@ public class PolygonUtil {
GeometryFactory gf = new GeometryFactory();
points.add(new Coordinate(points.get(0)));
truncate(points, 2);
Polygon rval = gf.createPolygon(gf.createLinearRing(points
.toArray(new Coordinate[points.size()])), null);
@ -799,6 +799,7 @@ public class PolygonUtil {
int npts = pts.length;
double xavg = 0, yavg = 0;
int[] yesList = new int[npts];
boolean[] excludeList = new boolean[npts];
int nyes = 0;
int k, k1, k2, kn, y, simple;
double bigDis, maxDis, dis, dx, dy, dx0, dy0, bas;
@ -863,6 +864,8 @@ public class PolygonUtil {
k = 0;
if (k == k2)
break;
if (excludeList[k])
continue;
dx = pts[k].x - pts[k1].x;
dy = pts[k].y - pts[k1].y;
dis = dx * dx0 + dy * dy0;
@ -870,6 +873,8 @@ public class PolygonUtil {
dis = -dis;
else
dis -= bas;
double newMaxDis = maxDis;
int newSimple = simple;
if (dis <= 0) {
if (simple == 0)
continue;
@ -877,15 +882,30 @@ public class PolygonUtil {
if (dis < 0)
dis = -dis;
} else if (simple != 0)
maxDis = simple = 0;
if (dis < maxDis)
newMaxDis = newSimple = 0;
if (dis < newMaxDis) {
maxDis = newMaxDis;
continue;
}
if (! checkReducePointsValid(pts, yesList, nyes, k)) {
excludeList[k] = true;
continue;
}
simple = newSimple;
maxDis = dis;
kn = k;
}
k1 = k2;
}
Arrays.fill(excludeList, false);
if (kn < 0) {
statusHandler.debug(
String.format("reducePoints(..., %d): Unable to find a valid point\npoints: %s",
maxNpts, points));
break;
}
if (simple != 0 && nyes > 2) {
if (maxDis * 40 < bigDis)
break;
@ -909,6 +929,24 @@ public class PolygonUtil {
points.addAll(Arrays.asList(Arrays.copyOf(pts, npts)));
}
private boolean checkReducePointsValid(Coordinate[] pts, int[] yesList, int nyes, int k) {
Coordinate[] verts = new Coordinate[nyes + 2];
int vi = 0;
for (int i = 0; i < nyes; ++i) {
if (k >= 0 && k < yesList[i]) {
verts[vi++] = pts[k];
k = -1;
}
verts[vi++] = pts[yesList[i]];
}
if (k >= 0) {
verts[vi++] = pts[k];
}
verts[verts.length - 1] = new Coordinate(verts[0]);
GeometryFactory gf = new GeometryFactory();
return gf.createPolygon(verts).isValid();
}
/**
* A1 ported point reduction method 2
*

View file

@ -234,6 +234,7 @@ import com.vividsolutions.jts.io.WKTReader;
* any of them is missing.
* 11/03/2014 3353 rferrel Ignore GeoSpatialData notification when this is the instance layer will do an update.
* 02/25/2014 3353 rjpeter Fix synchronized use case, updated to not create dialog before init is finished.
* 05/08/2015 ASM #17310 D. Friedman Log input polygon when output of AreaHatcher is invalid.
* </pre>
*
* @author mschenke
@ -570,6 +571,10 @@ public class WarngenLayer extends AbstractStormTrackResource {
outputHatchedWarningArea = createWarnedArea(
latLonToLocal(outputHatchedArea),
latLonToLocal(warningArea));
if (! outputHatchedArea.isValid()) {
statusHandler.debug(String.format("Input %s redrawn to invalid %s",
inputWarningPolygon, outputHatchedArea));
}
}
this.hatchedArea = outputHatchedArea;
this.hatchedWarningArea = outputHatchedWarningArea;

View file

@ -45,6 +45,8 @@ import com.raytheon.uf.common.time.util.TimeUtil;
* Feb 12, 2014 2655 njensen Set source
* Jun 05, 2014 3226 bclement LightningStikePoint refactor
* Jun 10, 2014 3226 bclement fixed source
* May 8, 2015 DR17252 MPorricelli Removed setting of source.
* Source set in TextLightningParser.
*
* </pre>
*
@ -57,12 +59,6 @@ public class TextLightningDecoder extends AbstractDecoder implements
private String traceId = null;
/*
* inferred from Wufeng Zhou comment in BinLightningDecoderUtil, stands for
* World Wide Lightning Location Network
*/
private static final String SOURCE = "WWLLN";
/**
* Construct a TextLightning decoder. Calling hasNext() after construction
* will return false, decode() will return a null.
@ -103,8 +99,6 @@ public class TextLightningDecoder extends AbstractDecoder implements
report.setTraceId(traceId);
report.setSource(SOURCE);
return new PluginDataObject[] { report };
}

View file

@ -34,6 +34,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 3, 2014 3226 bclement Initial creation
* May 8, 2015 DR17252 MPorricelli Use HOUR_OF_DAY for setHour
*
* </pre>
*
@ -118,7 +119,7 @@ public class BaseLightningPoint {
* Hour of the day [0..23].
*/
public void setHour(int hour) {
this.time.set(Calendar.HOUR, hour);
this.time.set(Calendar.HOUR_OF_DAY, hour);
}
/**