Merge "ASM #641 - Filtered cases where Areas do not match Zones." into asm_14.3.1
Former-commit-id:7f1afc7176
[formerly4c650fec35
] [formerlyaa273ffb70
] [formerly7f1afc7176
[formerly4c650fec35
] [formerlyaa273ffb70
] [formerly6e0d48d840
[formerlyaa273ffb70
[formerly f33abc302597a3120c9220278e28d865d5f185b6]]]] Former-commit-id:6e0d48d840
Former-commit-id:c7fa5827ad
[formerly7f464afac7
] [formerly 4bca28549f5bfe6ca45333848dfc7ace2b7c045b [formerly5a54cf0d33
]] Former-commit-id: 2b9e0b35c5abc3678ee07bfccfa56f1e3169fa46 [formerly3508956a81
] Former-commit-id:6bd366d178
This commit is contained in:
commit
df6fb9c83d
2 changed files with 39 additions and 8 deletions
|
@ -83,7 +83,9 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometry;
|
|||
* Apr 29, 2014 3033 jsanchez Updated method to retrieve files in localization.
|
||||
* May 16, 2014 DR 17365 D. Friedman Reduce precision of warning area to avoid topology errors.
|
||||
* Jun 30, 2014 DR 17447 Qinglu lin Updated findAffectedAreas().
|
||||
* Jul 22, 23014 3419 jsanchez Cleaned up converFeAreaToPartList.
|
||||
* Jul 22, 2014 3419 jsanchez Cleaned up converFeAreaToPartList.
|
||||
* Sep 14, 2014 ASM #641 dhuffman Filtered out cases where Areas do not match Zones by using
|
||||
* refactored WarngenLayer::filterArea.
|
||||
* </pre>
|
||||
*
|
||||
* @author chammack
|
||||
|
@ -327,13 +329,21 @@ public class Area {
|
|||
for (AreaSourceConfiguration asc : config.getAreaSources()) {
|
||||
if (asc.getType() == AreaType.INTERSECT) {
|
||||
List<Geometry> geoms = new ArrayList<Geometry>();
|
||||
boolean filtered = false;
|
||||
for (GeospatialData f : warngenLayer.getGeodataFeatures(
|
||||
asc.getAreaSource(), localizedSite)) {
|
||||
|
||||
boolean ignoreUserData = asc.getAreaSource().equals(
|
||||
hatchedAreaSource) == false;
|
||||
Geometry intersect = GeometryUtil.intersection(warnArea,
|
||||
f.prepGeom, ignoreUserData);
|
||||
if (intersect.isEmpty() == false) {
|
||||
|
||||
filtered = false;
|
||||
if (!intersect.isEmpty()) {
|
||||
filtered = warngenLayer.filterArea(f, intersect, asc);
|
||||
}
|
||||
|
||||
if (intersect.isEmpty() == false && filtered == true) {
|
||||
geoms.add(intersect);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -217,6 +217,8 @@ import com.vividsolutions.jts.io.WKTReader;
|
|||
* 07/28/2014 DR 17475 Qinglu Lin Updated populateStrings() and findLargestQuadrant(), removed findLargestGeometry(),
|
||||
* added createAreaAndCentroidMaps() and movePopulatePt(), updated paintText() to center W.
|
||||
* 08/20/2014 ASM #16703 D. Friedman Make geo feature types for watches explicit
|
||||
* 09/14/2014 ASM #641 dhuffman To facilitate Area.java need to filter the differences between Areas and Zones,
|
||||
* refactored filterCheck and added a new siginature version of filterArea.
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
|
@ -2112,17 +2114,28 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
|||
*/
|
||||
private boolean filterCheck(Geometry areaToConsider, Geometry wholeArea,
|
||||
double areaInMetersSq) {
|
||||
|
||||
return filterCheck(
|
||||
areaToConsider,
|
||||
wholeArea,
|
||||
areaInMetersSq,
|
||||
getConfiguration().getHatchedAreaSource().getInclusionPercent(),
|
||||
getConfiguration().getHatchedAreaSource().getInclusionArea(),
|
||||
getConfiguration().getHatchedAreaSource().getInclusionAndOr());
|
||||
}
|
||||
|
||||
private boolean filterCheck(Geometry areaToConsider, Geometry wholeArea,
|
||||
double areaInMetersSq, double inclusionPercent,
|
||||
double inclusionArea, String inclusionAndOr) {
|
||||
double ratio = areaToConsider.getArea() / wholeArea.getArea();
|
||||
double ratioInPercent = ratio * 100.;
|
||||
double areaInKmSqOfIntersection = meterSqToKmSq.convert(areaInMetersSq
|
||||
* ratio);
|
||||
|
||||
boolean percentOk = ratioInPercent >= getConfiguration()
|
||||
.getHatchedAreaSource().getInclusionPercent();
|
||||
boolean areaOk = areaInKmSqOfIntersection > getConfiguration()
|
||||
.getHatchedAreaSource().getInclusionArea();
|
||||
return getConfiguration().getHatchedAreaSource().getInclusionAndOr()
|
||||
.equalsIgnoreCase("AND") ? percentOk && areaOk : percentOk
|
||||
boolean percentOk = ratioInPercent >= inclusionPercent;
|
||||
boolean areaOk = areaInKmSqOfIntersection > inclusionArea;
|
||||
|
||||
return inclusionAndOr.matches("AND") ? percentOk && areaOk : percentOk
|
||||
|| areaOk;
|
||||
}
|
||||
|
||||
|
@ -2146,6 +2159,14 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
|||
return filterCheck(featureAreaToConsider, geom, areaOfGeom);
|
||||
}
|
||||
|
||||
public boolean filterArea(GeospatialData feature,
|
||||
Geometry featureAreaToConsider, AreaSourceConfiguration asc) {
|
||||
double areaOfGeom = (Double) feature.attributes.get(AREA);
|
||||
return filterCheck(featureAreaToConsider, feature.geometry, areaOfGeom,
|
||||
asc.getInclusionPercent(), asc.getInclusionArea(),
|
||||
asc.getInclusionAndOr());
|
||||
}
|
||||
|
||||
private boolean filterAreaSecondChance(GeospatialData feature,
|
||||
Geometry featureAreaToConsider, boolean localCRS) {
|
||||
Geometry geom = localCRS ? (Geometry) feature.attributes
|
||||
|
|
Loading…
Add table
Reference in a new issue