CM-MERGE:OB13.5.5-7 into 14.1.2

Former-commit-id: a9f2fdb086 [formerly 509616ba6a] [formerly f8ed9c7944] [formerly e9bd17a21f [formerly f8ed9c7944 [formerly 3595e9c0962e9ef4ea987da3c52fdaf8b9b68114]]]
Former-commit-id: e9bd17a21f
Former-commit-id: d77fe7357769ccd29689730a70de23400e90fee7 [formerly 409a48b907]
Former-commit-id: e563eb3376
This commit is contained in:
Brian.Dyke 2014-05-19 07:55:42 -04:00
parent cc09a85660
commit 3772c8d2bf

View file

@ -48,7 +48,9 @@ import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.viz.warngen.gui.WarngenLayer; import com.raytheon.viz.warngen.gui.WarngenLayer;
import com.raytheon.viz.warngen.util.Abbreviation; import com.raytheon.viz.warngen.util.Abbreviation;
import com.vividsolutions.jts.geom.Geometry; import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.PrecisionModel;
import com.vividsolutions.jts.geom.prep.PreparedGeometry; import com.vividsolutions.jts.geom.prep.PreparedGeometry;
import com.vividsolutions.jts.precision.SimpleGeometryPrecisionReducer;
/** /**
* Area * Area
@ -75,6 +77,7 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometry;
* May 2, 2013 1963 jsanchez Updated method to determine partOfArea. * May 2, 2013 1963 jsanchez Updated method to determine partOfArea.
* Aug 19, 2013 2177 jsanchez Used portionsUtil to calculate area portion descriptions. * Aug 19, 2013 2177 jsanchez Used portionsUtil to calculate area portion descriptions.
* Apr 29, 2014 3033 jsanchez Updated method to retrieve files in localization. * Apr 29, 2014 3033 jsanchez Updated method to retrieve files in localization.
* May 16, 2014 DR 17365 D. Friedman Reduce warning area precision to avoid topology errors.
* </pre> * </pre>
* *
* @author chammack * @author chammack
@ -84,6 +87,8 @@ public class Area {
private static final transient IUFStatusHandler statusHandler = UFStatus private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(Area.class); .getHandler(Area.class);
private static final double REDUCED_PRECISION_SCALE = 1000000000.0;
/** /**
* If an area greater than this percentage of the area is covered, no * If an area greater than this percentage of the area is covered, no
* direction is included * direction is included
@ -292,6 +297,17 @@ public class Area {
WarngenLayer warngenLayer) throws VizException { WarngenLayer warngenLayer) throws VizException {
Map<String, Object> areasMap = new HashMap<String, Object>(); Map<String, Object> areasMap = new HashMap<String, Object>();
Geometry simplifiedArea = null;
try {
simplifiedArea = (new SimpleGeometryPrecisionReducer(new PrecisionModel(
REDUCED_PRECISION_SCALE))).reduce(warnArea);
} catch (Exception e) {
// ignore
}
if (simplifiedArea != null && simplifiedArea.isValid()) {
warnArea = simplifiedArea;
}
String hatchedAreaSource = config.getHatchedAreaSource() String hatchedAreaSource = config.getHatchedAreaSource()
.getAreaSource(); .getAreaSource();
for (AreaSourceConfiguration asc : config.getAreaSources()) { for (AreaSourceConfiguration asc : config.getAreaSources()) {