diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenLayer.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenLayer.java index f584abf32a..ac4bdacd2d 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenLayer.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenLayer.java @@ -212,7 +212,6 @@ import com.vividsolutions.jts.io.WKTReader; * 07/01/2014 DR 17450 D. Friedman Use list of templates from backup site. * 07/28/2014 DR 17475 Qinglu Lin Updated populateStrings() and findLargestQuadrant(), removed findLargestGeometry(), * added createAreaAndCentroidMaps() and movePopulatePt(), updated paintText() to center W. - * 07/28/2014 DR15627 mgamazaychikov Change access qualifiers for some fields, methods for GeospatialDataList and GeospatialDataAccessor classes, create setAccessorAreaSourceConfiguration method. * * * @author mschenke @@ -247,22 +246,10 @@ public class WarngenLayer extends AbstractStormTrackResource { GeneralGridGeometry localGridGeometry; } - public static class GeospatialDataAccessor { - public GeospatialDataList geoData; + private static class GeospatialDataAccessor { + GeospatialDataList geoData; - public AreaSourceConfiguration areaConfig; - - public GeospatialDataList getGeoData() { - return geoData; - } - - public AreaSourceConfiguration getAreaConfig() { - return areaConfig; - } - - public GeospatialData[] getFeatures() { - return Arrays.copyOf(geoData.features, geoData.features.length); - } + AreaSourceConfiguration areaConfig; public GeospatialDataAccessor(GeospatialDataList geoData, AreaSourceConfiguration areaConfig) { @@ -1563,7 +1550,7 @@ public class WarngenLayer extends AbstractStormTrackResource { return ugcs; } - public GeospatialDataAccessor getGeospatialDataAcessor() + private GeospatialDataAccessor getGeospatialDataAcessor() throws Exception { GeospatialDataList gdl = searchGeospatialDataAccessor(); if (gdl == null) { @@ -1584,36 +1571,12 @@ public class WarngenLayer extends AbstractStormTrackResource { // TODO: There should be some way to get the "county" configuration by // name // independent of a template - AreaSourceConfiguration areaConfig = getAccessorAreaSourceConfiguration(); + AreaSourceConfiguration areaConfig = new AreaSourceConfiguration(); + areaConfig.setFipsField("FIPS"); + return new GeospatialDataAccessor(gdl, areaConfig); } - private static String ASC_MARINE = "MarineZones"; - private static String ASC_COUNTY = "County"; - - /** - * Returns the AreaSourceConfiguration for either county or marine zones based product - * - * @return - * @throws Exception - */ - private AreaSourceConfiguration getAccessorAreaSourceConfiguration() throws Exception { - boolean isMarineZone = configuration.getGeospatialConfig() - .getAreaSource().equalsIgnoreCase(MARINE); - WarngenConfiguration ascConfig = WarngenConfiguration.loadConfig( - "watchAreaSourceConfiguration", getLocalizedSite(), null); - AreaSourceConfiguration[] areaConfigs = ascConfig.getAreaSources(); - for (AreaSourceConfiguration af:areaConfigs){ - if (!isMarineZone && af.getAreaSource().equalsIgnoreCase(ASC_COUNTY)) {; - return af; - } - else if (isMarineZone && af.getAreaSource().equalsIgnoreCase(ASC_MARINE) ) { - return af; - } - } - return new AreaSourceConfiguration(); - } - private GeospatialDataList searchGeospatialDataAccessor() { synchronized (siteMap) { for (Map.Entry entry : siteMap diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/template/TemplateRunner.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/template/TemplateRunner.java index 527c276403..1ab7ab65d1 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/template/TemplateRunner.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/template/TemplateRunner.java @@ -63,6 +63,7 @@ import com.raytheon.uf.common.dataplugin.warning.AbstractWarningRecord; import com.raytheon.uf.common.dataplugin.warning.WarningConstants; import com.raytheon.uf.common.dataplugin.warning.WarningRecord.WarningAction; import com.raytheon.uf.common.dataplugin.warning.config.AreaSourceConfiguration; +import com.raytheon.uf.common.dataplugin.warning.config.AreaSourceConfiguration.AreaType; import com.raytheon.uf.common.dataplugin.warning.config.WarngenConfiguration; import com.raytheon.uf.common.dataplugin.warning.gis.GeospatialData; import com.raytheon.uf.common.dataplugin.warning.util.GeometryUtil; @@ -102,7 +103,6 @@ import com.raytheon.viz.warngen.gis.Wx; import com.raytheon.viz.warngen.gui.BackupData; import com.raytheon.viz.warngen.gui.FollowupData; import com.raytheon.viz.warngen.gui.WarngenLayer; -import com.raytheon.viz.warngen.gui.WarngenLayer.GeospatialDataAccessor; import com.raytheon.viz.warngen.gui.WarngenUIState; import com.raytheon.viz.warngen.text.WarningTextHandler; import com.raytheon.viz.warngen.text.WarningTextHandlerFactory; @@ -159,8 +159,6 @@ import com.vividsolutions.jts.io.WKTReader; * Apr 28, 2014 3033 jsanchez Set the site and backup site in Velocity Engine's properties * Mar 17, 2014 DR 16309 Qinglu Lin Updated getWatches(), processATEntries() and determineAffectedPortions(), and * added determineAffectedMarinePortions(). - * Jul 17, 2014 DR15627 mgamazaychikov Fix setting asc and geoData in processATEntries, update getStateName, - * determineAffectedPortions and determineAffectedMarinePortions. * * * @author njensen @@ -1155,14 +1153,14 @@ public class TemplateRunner { Set validUgcZones) { WatchUtil rval = new WatchUtil(); TreeMap map = new TreeMap(); - GeospatialData[] geoData = null; + AreaSourceConfiguration asc = null; - try { - GeospatialDataAccessor gda = warngenLayer.getGeospatialDataAcessor(); - geoData = gda.getFeatures(); - asc = gda.getAreaConfig(); - } catch (Exception e) { - statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),e); + for (AreaSourceConfiguration a : warngenLayer.getConfiguration() + .getAreaSources()) { + if (a.getType() == AreaType.HATCHING) { + asc = a; + break; + } } if (asc == null) { statusHandler @@ -1170,6 +1168,8 @@ public class TemplateRunner { "Cannot process watches: missing HATCHING area source configuration"); return rval; } + GeospatialData[] geoData = warngenLayer.getGeodataFeatures( + asc.getAreaSource(), warngenLayer.getLocalizedSite()); if ((geoData == null) || (geoData.length == 0)) { statusHandler.handle(Priority.ERROR, "Cannot process watches: cannot get geospatial data"); @@ -1232,7 +1232,7 @@ public class TemplateRunner { rval.addWaw(work.waw); } } else { - if (determineAffectedMarinePortions(work.ugcZone, geoData, work.waw)) { + if (determineAffectedMarinePortions(work.ugcZone, asc, geoData, work.waw)) { rval.addWaw(work.waw); } } @@ -1297,7 +1297,7 @@ public class TemplateRunner { for (Entry> e : map.entrySet()) { Portion portion = new Portion(); try { - portion.parentRegion = getStateName(e.getKey(), geoData) + portion.parentRegion = getStateName(e.getKey(), asc, geoData) .toUpperCase(); } catch (RuntimeException exc) { statusHandler.handle(Priority.ERROR, @@ -1330,7 +1330,8 @@ public class TemplateRunner { */ @SuppressWarnings("deprecation") private static boolean determineAffectedMarinePortions(List ugcs, - GeospatialData[] geoData, WeatherAdvisoryWatch waw) { + AreaSourceConfiguration asc, GeospatialData[] geoData, + WeatherAdvisoryWatch waw) { // Maps state abbreviation to unique fe_area values HashMap> map = new HashMap>(); @@ -1509,7 +1510,7 @@ public class TemplateRunner { return abrev; } - private static String getStateName(String key, + private static String getStateName(String key, AreaSourceConfiguration asc, GeospatialData[] geoData) { for (GeospatialData g : geoData) { if (key.equals(g.attributes.get("STATE"))) { diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.warning/utility/common_static/base/warngen/watchAreaSourceConfiguration.xml b/edexOsgi/com.raytheon.uf.common.dataplugin.warning/utility/common_static/base/warngen/watchAreaSourceConfiguration.xml deleted file mode 100755 index 8efb1a476a..0000000000 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.warning/utility/common_static/base/warngen/watchAreaSourceConfiguration.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - County - 0 - AND - 0 - COUNTYNAME - NAME - STATE - FE_AREA - TIME_ZONE - countyTypes.txt - FIPS - NAME - - parent - - - - - - - 0 - - - - - MarineZones - 0 - AND - 0 - NAME - NAME - NAME - countyTypes.txt - ID - NAME - - parent - - - - - - - 0 - - -