Merge "Issue #1605 Check if storm location is over an urban bound area." into omaha_13.3.1
Former-commit-id:05b4c2f913
[formerly 65989516cda62a95cb7b6d67bea8aa20138def2a] Former-commit-id:e467daec0c
This commit is contained in:
commit
a84ef2d2c3
3 changed files with 18 additions and 2 deletions
|
@ -40,6 +40,7 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
|
|||
* Sep 25, 2012 #15425 Qinglu Lin Updated createClosestPoint().
|
||||
* Feb 13, 2012 1605 jsanchez Calculated the point based on lat,lon values.
|
||||
* Mar 25, 2013 1810 jsanchez Allowed other values to be accepted as a true value for useDirs.
|
||||
* Mar 25, 2013 1605 jsanchez Set ClosestPoint's prepGeom.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -116,9 +117,10 @@ public class DbAreaSourceDataAdaptor extends AbstractDbSourceDataAdaptor {
|
|||
List<String> partOfArea = getPartOfArea(ptFields, attributes,
|
||||
ptRslt.geometry);
|
||||
int gid = getGid(ptFields, attributes);
|
||||
|
||||
return new ClosestPoint(name, point, population, warngenlev,
|
||||
ClosestPoint cp = new ClosestPoint(name, point, population, warngenlev,
|
||||
partOfArea, gid);
|
||||
cp.setPrepGeom(PreparedGeometryFactory.prepare(ptRslt.geometry));
|
||||
return cp;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
import com.vividsolutions.jts.geom.prep.PreparedGeometry;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -40,6 +41,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* Sep 25, 2012 #15425 Qinglu Lin Updated two ClosestPoint() and added getGid().
|
||||
* Oct 17, 2012 jsanchez Added setter methods.
|
||||
* Feb 12, 2013 1600 jsanchez Removed adjustAngle method.
|
||||
* Mar 25, 2013 1605 jsanchez Added prepGeom if an urban bound area.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -77,6 +79,8 @@ public class ClosestPoint implements Comparable<ClosestPoint> {
|
|||
|
||||
protected int gid;
|
||||
|
||||
protected PreparedGeometry prepGeom;
|
||||
|
||||
public ClosestPoint() {
|
||||
|
||||
}
|
||||
|
@ -248,6 +252,10 @@ public class ClosestPoint implements Comparable<ClosestPoint> {
|
|||
this.gid = gid;
|
||||
}
|
||||
|
||||
public void setPrepGeom(PreparedGeometry prepGeom) {
|
||||
this.prepGeom = prepGeom;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
|
|
@ -105,6 +105,7 @@ import com.vividsolutions.jts.geom.Point;
|
|||
* Jan 31, 2013 1557 jsanchez Used allowDuplicates flag to collect points with duplicate names.
|
||||
* Feb 12, 2013 1600 jsanchez Used adjustAngle method from AbstractStormTrackResource.
|
||||
* Mar 5, 2013 1600 jsanchez Used AdjustAngle instead of AbstractStormTrackResource to handle angle adjusting.
|
||||
* Mar 25, 2013 1605 jsanchez Checks if a storm location is over an urban bound area.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -722,6 +723,11 @@ public class Wx {
|
|||
latLonToLocal);
|
||||
|
||||
double distance = localDistanceGeom.distance(localPt);
|
||||
// Tests if storm location is over an urban bound area
|
||||
if (cp.prepGeom != null
|
||||
&& cp.prepGeom.intersects(stormLocation)) {
|
||||
distance = 0;
|
||||
}
|
||||
if (distance <= thresholdInMeters) {
|
||||
if (allowDuplicates) {
|
||||
// collect all points that are within the threshold
|
||||
|
|
Loading…
Add table
Reference in a new issue