Issue #915 Set the user data. (cherry picked from development_on_ss_builds)
Conflicts: edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/config/WarngenConfiguration.java Former-commit-id:b8629a0f20
[formerly ef64da82bb8594eddead221f7c5bf5fa95e4ff8b] Former-commit-id:8e3ecc1efd
This commit is contained in:
parent
e404398ea6
commit
04c8c3ca55
3 changed files with 75 additions and 18 deletions
|
@ -316,6 +316,22 @@ public class Area {
|
|||
return areas.toArray(new AffectedAreas[areas.size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the affected areas that intersect the warnArea. This method
|
||||
* should be used if the intersected areas are of a different area source
|
||||
* compared to the hatched area source. Otherwise, the information in the
|
||||
* warnArea can just be re-used in the template. If the area source of the
|
||||
* intersect and the hatched are the same, then the configuration and
|
||||
* template files are configured inefficiently.
|
||||
*
|
||||
* @param config
|
||||
* @param warnPolygon
|
||||
* @param warnArea
|
||||
* @param localizedSite
|
||||
* @param warngenLayer
|
||||
* @return
|
||||
* @throws VizException
|
||||
*/
|
||||
public static Map<String, Object> findInsectingAreas(
|
||||
WarngenConfiguration config, Geometry warnPolygon,
|
||||
Geometry warnArea, String localizedSite, WarngenLayer warngenLayer)
|
||||
|
@ -332,8 +348,17 @@ public class Area {
|
|||
for (GeospatialData f : warngenLayer.getGeodataFeatures(key)) {
|
||||
for (int i = 0; i < warnArea.getNumGeometries(); i++) {
|
||||
Geometry geom = warnArea.getGeometryN(i);
|
||||
if (f.geometry.intersects(geom)) {
|
||||
GeometryUtil.buildGeometryList(geoms, f.geometry);
|
||||
if (GeometryUtil.intersects(f.geometry, geom)) {
|
||||
Geometry intersect = f.geometry.intersection(geom);
|
||||
if (intersect != null && !intersect.isEmpty()) {
|
||||
for (int j = 0; j < intersect
|
||||
.getNumGeometries(); j++) {
|
||||
intersect.getGeometryN(j).setUserData(
|
||||
f.geometry.getUserData());
|
||||
}
|
||||
GeometryUtil
|
||||
.buildGeometryList(geoms, intersect);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,13 @@ public class AreaSourceConfiguration {
|
|||
@XmlElement
|
||||
private AreaType areaType = AreaType.INTERSECT;
|
||||
|
||||
/*
|
||||
* TODO This is for 12.9 to be backwards compatible. This will be removed in
|
||||
* 12.10
|
||||
*/
|
||||
@XmlElement
|
||||
private AreaType areaType;
|
||||
|
||||
@XmlAttribute
|
||||
private String variable;
|
||||
|
||||
|
@ -59,7 +66,7 @@ public class AreaSourceConfiguration {
|
|||
|
||||
@XmlElement
|
||||
private String areaNotationTranslationFile;
|
||||
|
||||
|
||||
@XmlElement
|
||||
private String timeZoneField;
|
||||
|
||||
|
@ -271,4 +278,12 @@ public class AreaSourceConfiguration {
|
|||
this.timeZoneField = timeZoneField;
|
||||
}
|
||||
|
||||
public AreaType getAreaType() {
|
||||
return areaType;
|
||||
}
|
||||
|
||||
public void setAreaType(AreaType areaType) {
|
||||
this.areaType = areaType;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ import java.text.ParseException;
|
|||
import java.text.ParsePosition;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
@ -81,6 +80,8 @@ public class WarngenConfiguration implements ISerializableObject {
|
|||
@XmlElement
|
||||
private PathcastConfiguration pathcastConfig;
|
||||
|
||||
private AreaSourceConfiguration hatchedAreaSource;
|
||||
|
||||
@XmlElement
|
||||
private AreaConfiguration areaConfig;
|
||||
|
||||
|
@ -200,31 +201,39 @@ public class WarngenConfiguration implements ISerializableObject {
|
|||
}
|
||||
}
|
||||
|
||||
List<AreaSourceConfiguration> ascList = new ArrayList<AreaSourceConfiguration>();
|
||||
// TODO This section is for 12.9 to be backwards compatible with old
|
||||
// configuration files. 12.10 will drop the use of 'areaConfig'.
|
||||
if (config.getAreaConfig() != null) {
|
||||
AreaSourceConfiguration areaSourceConfig = new AreaSourceConfiguration(
|
||||
config.getAreaConfig());
|
||||
ascList.add(areaSourceConfig);
|
||||
}
|
||||
ArrayList<AreaSourceConfiguration> areaSources = null;
|
||||
|
||||
AreaSourceConfiguration ascs[] = config.getAreaSources();
|
||||
if (ascs != null) {
|
||||
ascList.addAll(Arrays.asList(ascs));
|
||||
if (config.getAreaSources() == null) {
|
||||
areaSources = new ArrayList<AreaSourceConfiguration>();
|
||||
} else {
|
||||
areaSources = new ArrayList<AreaSourceConfiguration>(
|
||||
Arrays.asList(config.getAreaSources()));
|
||||
}
|
||||
areaSources
|
||||
.add(new AreaSourceConfiguration(config.getAreaConfig()));
|
||||
config.setAreaSources(areaSources
|
||||
.toArray(new AreaSourceConfiguration[areaSources.size()]));
|
||||
}
|
||||
// 12.9 section end
|
||||
|
||||
for (AreaSourceConfiguration asc : ascList) {
|
||||
for (AreaSourceConfiguration asc : config.getAreaSources()) {
|
||||
if (asc.getAreaSource() == null) {
|
||||
asc.setAreaSource(config.getGeospatialConfig().getAreaSource());
|
||||
}
|
||||
|
||||
if (asc.getAreaType() == AreaType.HATCHING) {
|
||||
config.setAreaConfig(asc.getAreaConfig());
|
||||
// 12.9. 12.10 get rid of 'areaType'
|
||||
if (asc.getAreaType() != null) {
|
||||
asc.setType(asc.getAreaType());
|
||||
}
|
||||
|
||||
if (asc.getType() == AreaType.HATCHING) {
|
||||
config.setHatchedAreaSource(asc);
|
||||
}
|
||||
}
|
||||
|
||||
config.setAreaSources(ascList
|
||||
.toArray(new AreaSourceConfiguration[ascList.size()]));
|
||||
|
||||
if (config.getPathcastConfig() != null
|
||||
&& config.getPathcastConfig().getPointSource() == null) {
|
||||
config.getPathcastConfig().setPointSource(
|
||||
|
@ -482,4 +491,12 @@ public class WarngenConfiguration implements ISerializableObject {
|
|||
this.enableDuration = enableDuration;
|
||||
}
|
||||
|
||||
public AreaSourceConfiguration getHatchedAreaSource() {
|
||||
return hatchedAreaSource;
|
||||
}
|
||||
|
||||
public void setHatchedAreaSource(AreaSourceConfiguration hatchedAreaSource) {
|
||||
this.hatchedAreaSource = hatchedAreaSource;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue