Merge "Issue #2819 Removed more unnecessary .clone() calls" into development
Former-commit-id: d4fb7ae2684b26e93c33467de0b1813e263ce9e6
This commit is contained in:
commit
b8c00d8ead
13 changed files with 252 additions and 242 deletions
|
@ -94,6 +94,7 @@ import com.vividsolutions.jts.io.WKBReader;
|
||||||
* polygons in map resource.
|
* polygons in map resource.
|
||||||
* Nov 06, 2013 2361 njensen Prepopulate fields in initInternal
|
* Nov 06, 2013 2361 njensen Prepopulate fields in initInternal
|
||||||
* instead of constructor for speed
|
* instead of constructor for speed
|
||||||
|
* Feb 18, 2014 2819 randerso Removed unnecessary clones of geometries
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -279,11 +280,11 @@ public class DbMapResource extends
|
||||||
}
|
}
|
||||||
List<String> fields = new ArrayList<String>();
|
List<String> fields = new ArrayList<String>();
|
||||||
fields.add(GID);
|
fields.add(GID);
|
||||||
if (req.labelField != null
|
if ((req.labelField != null)
|
||||||
&& !fields.contains(req.labelField)) {
|
&& !fields.contains(req.labelField)) {
|
||||||
fields.add(req.labelField);
|
fields.add(req.labelField);
|
||||||
}
|
}
|
||||||
if (req.shadingField != null
|
if ((req.shadingField != null)
|
||||||
&& !fields.contains(req.shadingField)) {
|
&& !fields.contains(req.shadingField)) {
|
||||||
fields.add(req.shadingField);
|
fields.add(req.shadingField);
|
||||||
}
|
}
|
||||||
|
@ -318,7 +319,7 @@ public class DbMapResource extends
|
||||||
Geometry geom = GeometryCache.getGeometry(table, ""
|
Geometry geom = GeometryCache.getGeometry(table, ""
|
||||||
+ gid, req.geomField);
|
+ gid, req.geomField);
|
||||||
if (geom != null) {
|
if (geom != null) {
|
||||||
gidMap.put(gid, (Geometry) geom.clone());
|
gidMap.put(gid, geom);
|
||||||
} else {
|
} else {
|
||||||
toRequest.add(gid);
|
toRequest.add(gid);
|
||||||
}
|
}
|
||||||
|
@ -371,7 +372,7 @@ public class DbMapResource extends
|
||||||
}
|
}
|
||||||
gidMap.put(gid, g);
|
gidMap.put(gid, g);
|
||||||
GeometryCache.putGeometry(table, "" + gid,
|
GeometryCache.putGeometry(table, "" + gid,
|
||||||
req.geomField, (Geometry) g.clone());
|
req.geomField, g);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,7 +412,7 @@ public class DbMapResource extends
|
||||||
req.labelField.toLowerCase());
|
req.labelField.toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj != null && g != null) {
|
if ((obj != null) && (g != null)) {
|
||||||
String label;
|
String label;
|
||||||
if (obj instanceof BigDecimal) {
|
if (obj instanceof BigDecimal) {
|
||||||
label = Double.toString(((Number) obj)
|
label = Double.toString(((Number) obj)
|
||||||
|
@ -447,8 +448,7 @@ public class DbMapResource extends
|
||||||
} catch (TopologyException e) {
|
} catch (TopologyException e) {
|
||||||
statusHandler.handle(Priority.VERBOSE,
|
statusHandler.handle(Priority.VERBOSE,
|
||||||
"Invalid geometry cannot be labeled: "
|
"Invalid geometry cannot be labeled: "
|
||||||
+ label,
|
+ label, e);
|
||||||
e);
|
|
||||||
unlabelablePoints.add(label);
|
unlabelablePoints.add(label);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -645,12 +645,12 @@ public class DbMapResource extends
|
||||||
String shadingField = getCapability(ShadeableCapability.class)
|
String shadingField = getCapability(ShadeableCapability.class)
|
||||||
.getShadingField();
|
.getShadingField();
|
||||||
// System.out.println("shadingField: " + shadingField);
|
// System.out.println("shadingField: " + shadingField);
|
||||||
boolean isShaded = isPolygonal() && shadingField != null;
|
boolean isShaded = isPolygonal() && (shadingField != null);
|
||||||
|
|
||||||
if (simpLev < lastSimpLev
|
if ((simpLev < lastSimpLev)
|
||||||
|| (isLabeled && !labelField.equals(lastLabelField))
|
|| (isLabeled && !labelField.equals(lastLabelField))
|
||||||
|| (isShaded && !shadingField.equals(lastShadingField))
|
|| (isShaded && !shadingField.equals(lastShadingField))
|
||||||
|| lastExtent == null
|
|| (lastExtent == null)
|
||||||
|| !lastExtent.getEnvelope().contains(
|
|| !lastExtent.getEnvelope().contains(
|
||||||
clipToProjExtent(screenExtent).getEnvelope())) {
|
clipToProjExtent(screenExtent).getEnvelope())) {
|
||||||
if (!paintProps.isZooming()) {
|
if (!paintProps.isZooming()) {
|
||||||
|
@ -688,20 +688,20 @@ public class DbMapResource extends
|
||||||
|
|
||||||
float alpha = paintProps.getAlpha();
|
float alpha = paintProps.getAlpha();
|
||||||
|
|
||||||
if (shadedShape != null && shadedShape.isDrawable() && isShaded) {
|
if ((shadedShape != null) && shadedShape.isDrawable() && isShaded) {
|
||||||
float opacity = getCapability(ShadeableCapability.class)
|
float opacity = getCapability(ShadeableCapability.class)
|
||||||
.getOpacity();
|
.getOpacity();
|
||||||
aTarget.drawShadedShape(shadedShape, alpha * opacity);
|
aTarget.drawShadedShape(shadedShape, alpha * opacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (outlineShape != null && outlineShape.isDrawable()
|
if ((outlineShape != null) && outlineShape.isDrawable()
|
||||||
&& getCapability(OutlineCapability.class).isOutlineOn()) {
|
&& getCapability(OutlineCapability.class).isOutlineOn()) {
|
||||||
aTarget.drawWireframeShape(outlineShape,
|
aTarget.drawWireframeShape(outlineShape,
|
||||||
getCapability(ColorableCapability.class).getColor(),
|
getCapability(ColorableCapability.class).getColor(),
|
||||||
getCapability(OutlineCapability.class).getOutlineWidth(),
|
getCapability(OutlineCapability.class).getOutlineWidth(),
|
||||||
getCapability(OutlineCapability.class).getLineStyle(),
|
getCapability(OutlineCapability.class).getLineStyle(),
|
||||||
alpha);
|
alpha);
|
||||||
} else if (outlineShape == null
|
} else if ((outlineShape == null)
|
||||||
&& getCapability(OutlineCapability.class).isOutlineOn()) {
|
&& getCapability(OutlineCapability.class).isOutlineOn()) {
|
||||||
issueRefresh();
|
issueRefresh();
|
||||||
}
|
}
|
||||||
|
@ -709,7 +709,7 @@ public class DbMapResource extends
|
||||||
double labelMagnification = getCapability(MagnificationCapability.class)
|
double labelMagnification = getCapability(MagnificationCapability.class)
|
||||||
.getMagnification();
|
.getMagnification();
|
||||||
|
|
||||||
if (labels != null && isLabeled && labelMagnification != 0) {
|
if ((labels != null) && isLabeled && (labelMagnification != 0)) {
|
||||||
if (font == null) {
|
if (font == null) {
|
||||||
font = aTarget
|
font = aTarget
|
||||||
.initializeFont(aTarget.getDefaultFont().getFontName(),
|
.initializeFont(aTarget.getDefaultFont().getFontName(),
|
||||||
|
@ -737,7 +737,7 @@ public class DbMapResource extends
|
||||||
.getDensity();
|
.getDensity();
|
||||||
double minScreenDistance = Double.MAX_VALUE;
|
double minScreenDistance = Double.MAX_VALUE;
|
||||||
if (density > 0) {
|
if (density > 0) {
|
||||||
minScreenDistance = screenToWorldRatio * BASE_DENSITY_MULT
|
minScreenDistance = (screenToWorldRatio * BASE_DENSITY_MULT)
|
||||||
/ density;
|
/ density;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -768,7 +768,7 @@ public class DbMapResource extends
|
||||||
node.location[1]
|
node.location[1]
|
||||||
+ ((node.rect.getHeight() - node.rect.getY()) * screenToWorldRatio));
|
+ ((node.rect.getHeight() - node.rect.getY()) * screenToWorldRatio));
|
||||||
|
|
||||||
if (lastLabel != null && lastLabel.equals(node.label)) {
|
if ((lastLabel != null) && lastLabel.equals(node.label)) {
|
||||||
// check intersection of extents
|
// check intersection of extents
|
||||||
for (IExtent ext : extents) {
|
for (IExtent ext : extents) {
|
||||||
if (ext.intersects(strExtent)) {
|
if (ext.intersects(strExtent)) {
|
||||||
|
|
|
@ -113,6 +113,7 @@ import com.vividsolutions.jts.geom.Point;
|
||||||
* Feb 22, 2013 #1641 randerso Moved ID_ATTRIBUTE_NAME to package scope
|
* Feb 22, 2013 #1641 randerso Moved ID_ATTRIBUTE_NAME to package scope
|
||||||
* Jul 24, 2013 #1907 randerso Fixed sampling when cropped
|
* Jul 24, 2013 #1907 randerso Fixed sampling when cropped
|
||||||
* Jul 24, 2013 #1908 randerso Update attributes when cropped
|
* Jul 24, 2013 #1908 randerso Update attributes when cropped
|
||||||
|
* Feb 18, 2014 #2819 randerso Removed unnecessary clones of geometries
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
|
|
@ -56,6 +56,7 @@ import com.vividsolutions.jts.geom.Point;
|
||||||
* Oct 31, 2012 #1326 randerso Initial creation
|
* Oct 31, 2012 #1326 randerso Initial creation
|
||||||
* Feb 22, 2013 #1641 randerso Added checks for using ID as label or shading attribute
|
* Feb 22, 2013 #1641 randerso Added checks for using ID as label or shading attribute
|
||||||
* Jul 24, 2014 #1908 randerso Removed debug sysouts
|
* Jul 24, 2014 #1908 randerso Removed debug sysouts
|
||||||
|
* Feb 18, 2014 #2819 randerso Removed unnecessary clones of geometries
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -314,7 +315,7 @@ class ReloadJob extends Job {
|
||||||
|
|
||||||
Geometry g = (Geometry) f.getAttribute(req.geomField);
|
Geometry g = (Geometry) f.getAttribute(req.geomField);
|
||||||
if (da.isHighlighted()) {
|
if (da.isHighlighted()) {
|
||||||
highlightGeoms.add((Geometry) g.clone());
|
highlightGeoms.add(g);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (req.highlightsOnly) {
|
if (req.highlightsOnly) {
|
||||||
|
|
|
@ -173,8 +173,10 @@ import com.vividsolutions.jts.geom.Point;
|
||||||
* Jul 15, 2013 2184 dhladky Remove all HUC's for storage except ALL
|
* Jul 15, 2013 2184 dhladky Remove all HUC's for storage except ALL
|
||||||
* Jul 17, 2013 2197 njensen Improved speed of getName()
|
* Jul 17, 2013 2197 njensen Improved speed of getName()
|
||||||
* Oct 18, 2013 DR 16151 gzhang Used getAverageValue() for QPF Graph.
|
* Oct 18, 2013 DR 16151 gzhang Used getAverageValue() for QPF Graph.
|
||||||
|
* Feb 19, 2014 2819 randerso Removed unnecessary .clone() call
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
|
*
|
||||||
* @author dhladky
|
* @author dhladky
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
@ -1203,8 +1205,8 @@ public class FFMPResource extends
|
||||||
@Override
|
@Override
|
||||||
protected void paintInternal(IGraphicsTarget aTarget,
|
protected void paintInternal(IGraphicsTarget aTarget,
|
||||||
PaintProperties paintProps) throws VizException {
|
PaintProperties paintProps) throws VizException {
|
||||||
if (getTimeOrderedKeys() == null || getTimeOrderedKeys().isEmpty()
|
if ((getTimeOrderedKeys() == null) || getTimeOrderedKeys().isEmpty()
|
||||||
|| getDomains() == null) {
|
|| (getDomains() == null)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1252,12 +1254,12 @@ public class FFMPResource extends
|
||||||
if ((drawable != null) && drawable.isDirty()) {
|
if ((drawable != null) && drawable.isDirty()) {
|
||||||
// only need to do the query if extent changed, pfafs may be
|
// only need to do the query if extent changed, pfafs may be
|
||||||
// fine
|
// fine
|
||||||
if (!isFirst || queryJob.getState() == Job.NONE) {
|
if (!isFirst || (queryJob.getState() == Job.NONE)) {
|
||||||
queryJob.request(aTarget, drawable, paintTime);
|
queryJob.request(aTarget, drawable, paintTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drawable != null && isFfmpDataToggle()) {
|
if ((drawable != null) && isFfmpDataToggle()) {
|
||||||
IColormapShadedShapeExtension ext = aTarget
|
IColormapShadedShapeExtension ext = aTarget
|
||||||
.getExtension(IColormapShadedShapeExtension.class);
|
.getExtension(IColormapShadedShapeExtension.class);
|
||||||
ImagingCapability imageCap = getCapability(ImagingCapability.class);
|
ImagingCapability imageCap = getCapability(ImagingCapability.class);
|
||||||
|
@ -1268,7 +1270,7 @@ public class FFMPResource extends
|
||||||
IColormapShadedShape shape = shadedShapes.getDrawableShape(cwa,
|
IColormapShadedShape shape = shadedShapes.getDrawableShape(cwa,
|
||||||
drawable.getShadedHuc());
|
drawable.getShadedHuc());
|
||||||
Map<Object, RGB> colorMap = drawable.getColorMap(cwa);
|
Map<Object, RGB> colorMap = drawable.getColorMap(cwa);
|
||||||
if (shape != null && colorMap != null) {
|
if ((shape != null) && (colorMap != null)) {
|
||||||
ext.drawColormapShadedShape(shape, colorMap, alpha,
|
ext.drawColormapShadedShape(shape, colorMap, alpha,
|
||||||
brightness);
|
brightness);
|
||||||
}
|
}
|
||||||
|
@ -1319,7 +1321,7 @@ public class FFMPResource extends
|
||||||
}
|
}
|
||||||
|
|
||||||
// the product string
|
// the product string
|
||||||
if (isFfmpDataToggle() && fieldDescString != null) {
|
if (isFfmpDataToggle() && (fieldDescString != null)) {
|
||||||
paintProductString(aTarget, paintProps);
|
paintProductString(aTarget, paintProps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1558,7 +1560,7 @@ public class FFMPResource extends
|
||||||
FFMPBasinMetaData metaBasin = monitor.getTemplates(getSiteKey())
|
FFMPBasinMetaData metaBasin = monitor.getTemplates(getSiteKey())
|
||||||
.findBasinByLatLon(getSiteKey(), coord.asLatLon());
|
.findBasinByLatLon(getSiteKey(), coord.asLatLon());
|
||||||
if (getHuc().equals(FFMPRecord.ALL)
|
if (getHuc().equals(FFMPRecord.ALL)
|
||||||
|| centeredAggregationKey != null) {
|
|| (centeredAggregationKey != null)) {
|
||||||
pfaf = metaBasin.getPfaf();
|
pfaf = metaBasin.getPfaf();
|
||||||
if (isMaintainLayer) {
|
if (isMaintainLayer) {
|
||||||
pfaf = monitor.getTemplates(getSiteKey())
|
pfaf = monitor.getTemplates(getSiteKey())
|
||||||
|
@ -1826,13 +1828,11 @@ public class FFMPResource extends
|
||||||
List<Float> guids = null;
|
List<Float> guids = null;
|
||||||
if ((getQpeRecord() != null)
|
if ((getQpeRecord() != null)
|
||||||
&& (getGuidanceRecord() != null)) {
|
&& (getGuidanceRecord() != null)) {
|
||||||
qpes = getQpeRecord().getBasinData()
|
qpes = getQpeRecord().getBasinData().getAccumValues(
|
||||||
.getAccumValues(pfafs, getTableTime(),
|
pfafs, getTableTime(), recentTime,
|
||||||
recentTime, getQpeSourceExpiration(),
|
getQpeSourceExpiration(), isRate());
|
||||||
isRate());
|
|
||||||
|
|
||||||
guids = getGuidanceRecord()
|
guids = getGuidanceRecord().getBasinData()
|
||||||
.getBasinData()
|
|
||||||
.getGuidanceValues(pfafs,
|
.getGuidanceValues(pfafs,
|
||||||
getGuidanceInterpolation(ffgType),
|
getGuidanceInterpolation(ffgType),
|
||||||
getGuidSourceExpiration(ffgType));
|
getGuidSourceExpiration(ffgType));
|
||||||
|
@ -1870,8 +1870,8 @@ public class FFMPResource extends
|
||||||
|
|
||||||
guid = getGuidanceValue(
|
guid = getGuidanceValue(
|
||||||
(FFMPGuidanceBasin) getGuidanceRecord()
|
(FFMPGuidanceBasin) getGuidanceRecord()
|
||||||
.getBasinData().get(key),
|
.getBasinData().get(key), recentTime,
|
||||||
recentTime, ffgType);
|
ffgType);
|
||||||
guid = forceValue(pfafs,
|
guid = forceValue(pfafs,
|
||||||
getBasin(key, getField(), recentTime, aggregate),
|
getBasin(key, getField(), recentTime, aggregate),
|
||||||
guid);
|
guid);
|
||||||
|
@ -1905,14 +1905,12 @@ public class FFMPResource extends
|
||||||
List<Float> qpes = null;
|
List<Float> qpes = null;
|
||||||
List<Float> guids = null;
|
List<Float> guids = null;
|
||||||
if (getQpeRecord() != null) {
|
if (getQpeRecord() != null) {
|
||||||
qpes = getQpeRecord().getBasinData()
|
qpes = getQpeRecord().getBasinData().getAccumValues(
|
||||||
.getAccumValues(pfafs, getTableTime(),
|
pfafs, getTableTime(), recentTime,
|
||||||
recentTime, getQpeSourceExpiration(),
|
getQpeSourceExpiration(), isRate());
|
||||||
isRate());
|
|
||||||
}
|
}
|
||||||
if (getGuidanceRecord() != null) {
|
if (getGuidanceRecord() != null) {
|
||||||
guids = getGuidanceRecord()
|
guids = getGuidanceRecord().getBasinData()
|
||||||
.getBasinData()
|
|
||||||
.getGuidanceValues(pfafs,
|
.getGuidanceValues(pfafs,
|
||||||
getGuidanceInterpolation(ffgType),
|
getGuidanceInterpolation(ffgType),
|
||||||
getGuidSourceExpiration(ffgType));
|
getGuidSourceExpiration(ffgType));
|
||||||
|
@ -1947,8 +1945,8 @@ public class FFMPResource extends
|
||||||
getQpeSourceExpiration(), isRate());
|
getQpeSourceExpiration(), isRate());
|
||||||
guid = getGuidanceValue(
|
guid = getGuidanceValue(
|
||||||
(FFMPGuidanceBasin) getGuidanceRecord()
|
(FFMPGuidanceBasin) getGuidanceRecord()
|
||||||
.getBasinData().get(key),
|
.getBasinData().get(key), recentTime,
|
||||||
recentTime, ffgType);
|
ffgType);
|
||||||
ratio = FFMPUtils.getRatioValue(qpe, guid);
|
ratio = FFMPUtils.getRatioValue(qpe, guid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2236,7 +2234,7 @@ public class FFMPResource extends
|
||||||
*/
|
*/
|
||||||
private void addWorstCase(Long aggPfaf, Date recentTime, Float value) {
|
private void addWorstCase(Long aggPfaf, Date recentTime, Float value) {
|
||||||
FFMPDrawable drawable = drawables.get(new DataTime(recentTime));
|
FFMPDrawable drawable = drawables.get(new DataTime(recentTime));
|
||||||
if (drawable != null && drawable.worstCaseHash != null) {
|
if ((drawable != null) && (drawable.worstCaseHash != null)) {
|
||||||
drawable.worstCaseHash.put(aggPfaf, value);
|
drawable.worstCaseHash.put(aggPfaf, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2761,8 +2759,7 @@ public class FFMPResource extends
|
||||||
try {
|
try {
|
||||||
Geometry g = geomMap.get(pfaf);
|
Geometry g = geomMap.get(pfaf);
|
||||||
if (g != null) {
|
if (g != null) {
|
||||||
jtsCompiler2.handle((Geometry) g.clone(),
|
jtsCompiler2.handle(g, basinTraceColor);
|
||||||
basinTraceColor);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -2817,8 +2814,7 @@ public class FFMPResource extends
|
||||||
for (Long pfaf : geomMap.keySet()) {
|
for (Long pfaf : geomMap.keySet()) {
|
||||||
Geometry g = geomMap.get(pfaf);
|
Geometry g = geomMap.get(pfaf);
|
||||||
if (g != null) {
|
if (g != null) {
|
||||||
jtsCompiler3
|
jtsCompiler3.handle(g, color);
|
||||||
.handle((Geometry) g.clone(), color);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2897,7 +2893,7 @@ public class FFMPResource extends
|
||||||
|
|
||||||
FFMPTime ffmpTime = (FFMPTime) fhce.getSource();
|
FFMPTime ffmpTime = (FFMPTime) fhce.getSource();
|
||||||
|
|
||||||
if (ffmpTime.getTime() != time || isSplit != ffmpTime.isSplit()) {
|
if ((ffmpTime.getTime() != time) || (isSplit != ffmpTime.isSplit())) {
|
||||||
|
|
||||||
isSplit = ffmpTime.isSplit();
|
isSplit = ffmpTime.isSplit();
|
||||||
setTime(ffmpTime.getTime());
|
setTime(ffmpTime.getTime());
|
||||||
|
@ -3157,9 +3153,11 @@ public class FFMPResource extends
|
||||||
getDataKey(), null, oldestRefTime, FFMPRecord.ALL,
|
getDataKey(), null, oldestRefTime, FFMPRecord.ALL,
|
||||||
basinPfaf);
|
basinPfaf);
|
||||||
|
|
||||||
//Float qpfFloat = qpfBasin.getValue(monitor.getQpfWindow()
|
// Float qpfFloat = qpfBasin.getValue(monitor.getQpfWindow()
|
||||||
//.getBeforeTime(), monitor.getQpfWindow().getAfterTime());
|
// .getBeforeTime(), monitor.getQpfWindow().getAfterTime());
|
||||||
Float qpfFloat = qpfBasin.getAverageValue(monitor.getQpfWindow().getAfterTime(),monitor.getQpfWindow().getBeforeTime() ); // DR 16151
|
Float qpfFloat = qpfBasin.getAverageValue(monitor.getQpfWindow()
|
||||||
|
.getAfterTime(), monitor.getQpfWindow().getBeforeTime()); // DR
|
||||||
|
// 16151
|
||||||
fgd.setQpfValue(qpfFloat);
|
fgd.setQpfValue(qpfFloat);
|
||||||
|
|
||||||
ArrayList<Double> qpfTimes = new ArrayList<Double>();
|
ArrayList<Double> qpfTimes = new ArrayList<Double>();
|
||||||
|
@ -3407,7 +3405,7 @@ public class FFMPResource extends
|
||||||
synchronized (tableTime) {
|
synchronized (tableTime) {
|
||||||
Date recentTime = getMostRecentTime();
|
Date recentTime = getMostRecentTime();
|
||||||
long time = new Double(recentTime.getTime()
|
long time = new Double(recentTime.getTime()
|
||||||
- (TimeUtil.MILLIS_PER_HOUR) * getTime()).longValue();
|
- ((TimeUtil.MILLIS_PER_HOUR) * getTime())).longValue();
|
||||||
Date date = new Date();
|
Date date = new Date();
|
||||||
date.setTime(time);
|
date.setTime(time);
|
||||||
this.tableTime = date;
|
this.tableTime = date;
|
||||||
|
@ -3570,7 +3568,7 @@ public class FFMPResource extends
|
||||||
* @return ordered dates
|
* @return ordered dates
|
||||||
*/
|
*/
|
||||||
public synchronized List<Date> getTimeOrderedKeys() {
|
public synchronized List<Date> getTimeOrderedKeys() {
|
||||||
if (timeOrderedKeys == null || !toKeysInitialized) {
|
if ((timeOrderedKeys == null) || !toKeysInitialized) {
|
||||||
toKeysInitialized = true;
|
toKeysInitialized = true;
|
||||||
|
|
||||||
// stand alone displays use this
|
// stand alone displays use this
|
||||||
|
@ -3623,7 +3621,7 @@ public class FFMPResource extends
|
||||||
- getTableTime().getTime();
|
- getTableTime().getTime();
|
||||||
|
|
||||||
sliderTime = Math
|
sliderTime = Math
|
||||||
.floor(4 * (offset.doubleValue() / (TimeUtil.MILLIS_PER_HOUR)) + .25) / 4;
|
.floor((4 * (offset.doubleValue() / (TimeUtil.MILLIS_PER_HOUR))) + .25) / 4;
|
||||||
// sliderTime = Math.floor(((offset.doubleValue() / (1000 * 3600)) +
|
// sliderTime = Math.floor(((offset.doubleValue() / (1000 * 3600)) +
|
||||||
// .005) * 100) / 100;
|
// .005) * 100) / 100;
|
||||||
setTime(sliderTime);
|
setTime(sliderTime);
|
||||||
|
@ -4018,7 +4016,7 @@ public class FFMPResource extends
|
||||||
*/
|
*/
|
||||||
public FFMPDrawable getDrawable(DataTime time) {
|
public FFMPDrawable getDrawable(DataTime time) {
|
||||||
FFMPDrawable drawable = null;
|
FFMPDrawable drawable = null;
|
||||||
if (drawables != null && time != null) {
|
if ((drawables != null) && (time != null)) {
|
||||||
drawable = drawables.get(time);
|
drawable = drawables.get(time);
|
||||||
}
|
}
|
||||||
return drawable;
|
return drawable;
|
||||||
|
|
|
@ -93,6 +93,7 @@ import com.vividsolutions.jts.geom.LineString;
|
||||||
* Dec 4, 2007 njensen Initial creation
|
* Dec 4, 2007 njensen Initial creation
|
||||||
* 02/17/09 njensen Refactored to new rsc architecture
|
* 02/17/09 njensen Refactored to new rsc architecture
|
||||||
* 02/27/12 14490 kshresth Fixed cross sections not loading as images
|
* 02/27/12 14490 kshresth Fixed cross sections not loading as images
|
||||||
|
* 02/19/2014 2819 randerso Removed unnecessary .clone() call
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -179,7 +180,7 @@ public abstract class AbstractCrossSectionResource extends
|
||||||
DataTime time = dataTimes.get(numTimes - 1);
|
DataTime time = dataTimes.get(numTimes - 1);
|
||||||
sliceMap.put(time, null);
|
sliceMap.put(time, null);
|
||||||
dataRetrievalJob.times.add(time);
|
dataRetrievalJob.times.add(time);
|
||||||
for (int i = 0; i < numTimes - 1; i++) {
|
for (int i = 0; i < (numTimes - 1); i++) {
|
||||||
time = dataTimes.get(i);
|
time = dataTimes.get(i);
|
||||||
sliceMap.put(time, null);
|
sliceMap.put(time, null);
|
||||||
dataRetrievalJob.times.add(time);
|
dataRetrievalJob.times.add(time);
|
||||||
|
@ -205,7 +206,7 @@ public abstract class AbstractCrossSectionResource extends
|
||||||
IExtent extent = descriptor.getGraph(this).getExtent().clone();
|
IExtent extent = descriptor.getGraph(this).getExtent().clone();
|
||||||
// To be numerically accurate the grid geometry should be 1 grid
|
// To be numerically accurate the grid geometry should be 1 grid
|
||||||
// cell larger than the graph
|
// cell larger than the graph
|
||||||
extent.scale(1.0 + 1.0 / GRID_SIZE);
|
extent.scale(1.0 + (1.0 / GRID_SIZE));
|
||||||
GeneralEnvelope env = new GeneralEnvelope(new double[] {
|
GeneralEnvelope env = new GeneralEnvelope(new double[] {
|
||||||
extent.getMinX(), extent.getMinY() }, new double[] {
|
extent.getMinX(), extent.getMinY() }, new double[] {
|
||||||
extent.getMaxX(), extent.getMaxY() });
|
extent.getMaxX(), extent.getMaxY() });
|
||||||
|
@ -283,12 +284,11 @@ public abstract class AbstractCrossSectionResource extends
|
||||||
GRID_SIZE);
|
GRID_SIZE);
|
||||||
// filter below topo
|
// filter below topo
|
||||||
for (int i = 0; i < GRID_SIZE; i++) {
|
for (int i = 0; i < GRID_SIZE; i++) {
|
||||||
double height = GRID_SIZE
|
double height = (GRID_SIZE * (graph.getExtent().getMaxY() - topoData[i]))
|
||||||
* (graph.getExtent().getMaxY() - topoData[i])
|
|
||||||
/ graph.getExtent().getHeight();
|
/ graph.getExtent().getHeight();
|
||||||
for (int j = 0; j < height; j++) {
|
for (int j = 0; j < height; j++) {
|
||||||
for (float[] floatArr : floatData) {
|
for (float[] floatArr : floatData) {
|
||||||
floatArr[j * GRID_SIZE + i] = -999999;
|
floatArr[(j * GRID_SIZE) + i] = -999999;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -324,7 +324,7 @@ public abstract class AbstractCrossSectionResource extends
|
||||||
pdoTime = resourceData.getBinOffset().getNormalizedTime(pdoTime);
|
pdoTime = resourceData.getBinOffset().getNormalizedTime(pdoTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dataTimes == null || dataTimes.isEmpty()) {
|
if ((dataTimes == null) || dataTimes.isEmpty()) {
|
||||||
dataTimes = new ArrayList<DataTime>();
|
dataTimes = new ArrayList<DataTime>();
|
||||||
}
|
}
|
||||||
adapter.addRecord(pdo);
|
adapter.addRecord(pdo);
|
||||||
|
@ -415,7 +415,7 @@ public abstract class AbstractCrossSectionResource extends
|
||||||
shape = target.createWireframeShape(false, insetMapDescriptor);
|
shape = target.createWireframeShape(false, insetMapDescriptor);
|
||||||
JTSCompiler compiler = new JTSCompiler(null, shape,
|
JTSCompiler compiler = new JTSCompiler(null, shape,
|
||||||
insetMapDescriptor);
|
insetMapDescriptor);
|
||||||
compiler.handle((LineString) line.clone());
|
compiler.handle(line);
|
||||||
shape.compile();
|
shape.compile();
|
||||||
lines.put(line, shape);
|
lines.put(line, shape);
|
||||||
}
|
}
|
||||||
|
@ -437,18 +437,20 @@ public abstract class AbstractCrossSectionResource extends
|
||||||
|
|
||||||
stnID = resourceData.getMetadataMap().get("location.stationId")
|
stnID = resourceData.getMetadataMap().get("location.stationId")
|
||||||
.getConstraintValue();
|
.getConstraintValue();
|
||||||
if (stnID == null)
|
if (stnID == null) {
|
||||||
stnID = "";
|
stnID = "";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (stnID != "") {
|
if (stnID != "") {
|
||||||
if (stnID.contains(",")) { // ID may be formatted point1,point2 to
|
if (stnID.contains(",")) { // ID may be formatted point1,point2 to
|
||||||
// define a line
|
// define a line
|
||||||
String stn = stnID.replace(",", "-"); // For display, need
|
String stn = stnID.replace(",", "-"); // For display, need
|
||||||
// point1-point2
|
// point1-point2
|
||||||
completeName += " " + stn;
|
completeName += " " + stn;
|
||||||
} else
|
} else {
|
||||||
completeName += " " + stnID;
|
completeName += " " + stnID;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
String parameterName = resourceData.getParameterName();
|
String parameterName = resourceData.getParameterName();
|
||||||
completeName += " " + parameterName;
|
completeName += " " + parameterName;
|
||||||
if (getCapability(DisplayTypeCapability.class).getDisplayType() == DisplayType.IMAGE) {
|
if (getCapability(DisplayTypeCapability.class).getDisplayType() == DisplayType.IMAGE) {
|
||||||
|
@ -464,7 +466,7 @@ public abstract class AbstractCrossSectionResource extends
|
||||||
|
|
||||||
public String getUnitString() {
|
public String getUnitString() {
|
||||||
String unitString = "?";
|
String unitString = "?";
|
||||||
if (prefs != null && prefs.getDisplayUnitLabel() != null) {
|
if ((prefs != null) && (prefs.getDisplayUnitLabel() != null)) {
|
||||||
unitString = prefs.getDisplayUnitLabel();
|
unitString = prefs.getDisplayUnitLabel();
|
||||||
} else if (adapter.getUnit() == Unit.ONE) {
|
} else if (adapter.getUnit() == Unit.ONE) {
|
||||||
return "";
|
return "";
|
||||||
|
@ -477,11 +479,11 @@ public abstract class AbstractCrossSectionResource extends
|
||||||
|
|
||||||
public Unit<?> getUnit() {
|
public Unit<?> getUnit() {
|
||||||
Unit<?> xPrefUnit = prefs == null ? null : prefs.getDisplayUnits();
|
Unit<?> xPrefUnit = prefs == null ? null : prefs.getDisplayUnits();
|
||||||
if (xPrefUnit != null && xPrefUnit != Unit.ONE) {
|
if ((xPrefUnit != null) && (xPrefUnit != Unit.ONE)) {
|
||||||
return xPrefUnit;
|
return xPrefUnit;
|
||||||
}
|
}
|
||||||
Unit<?> xDataUnit = adapter.getUnit();
|
Unit<?> xDataUnit = adapter.getUnit();
|
||||||
if (xDataUnit != null && xDataUnit != Unit.ONE) {
|
if ((xDataUnit != null) && (xDataUnit != Unit.ONE)) {
|
||||||
return xDataUnit;
|
return xDataUnit;
|
||||||
}
|
}
|
||||||
return Unit.ONE;
|
return Unit.ONE;
|
||||||
|
@ -501,7 +503,7 @@ public abstract class AbstractCrossSectionResource extends
|
||||||
Coordinate[] coords = descriptor.getLine(myTime).getCoordinates();
|
Coordinate[] coords = descriptor.getLine(myTime).getCoordinates();
|
||||||
double totalDistance = 0.0;
|
double totalDistance = 0.0;
|
||||||
|
|
||||||
for (int j = 0; j < coords.length - 1; j++) {
|
for (int j = 0; j < (coords.length - 1); j++) {
|
||||||
try {
|
try {
|
||||||
totalDistance += JTS.orthodromicDistance(coords[j],
|
totalDistance += JTS.orthodromicDistance(coords[j],
|
||||||
coords[j + 1], MapUtil.getLatLonProjection());
|
coords[j + 1], MapUtil.getLatLonProjection());
|
||||||
|
@ -550,7 +552,7 @@ public abstract class AbstractCrossSectionResource extends
|
||||||
protected IStatus run(IProgressMonitor monitor) {
|
protected IStatus run(IProgressMonitor monitor) {
|
||||||
DataTime time = null;
|
DataTime time = null;
|
||||||
|
|
||||||
while (run && (time = times.poll()) != null) {
|
while (run && ((time = times.poll()) != null)) {
|
||||||
try {
|
try {
|
||||||
AbstractCrossSectionResource.this.loadSlice(time);
|
AbstractCrossSectionResource.this.loadSlice(time);
|
||||||
AbstractCrossSectionResource.this.issueRefresh();
|
AbstractCrossSectionResource.this.issueRefresh();
|
||||||
|
|
|
@ -144,7 +144,7 @@ public class GenericGeometryResource extends
|
||||||
|
|
||||||
OutlineCapability outlineCapability = getCapability(OutlineCapability.class);
|
OutlineCapability outlineCapability = getCapability(OutlineCapability.class);
|
||||||
// Finally, draw the shape
|
// Finally, draw the shape
|
||||||
if (frameData.shape != null && outlineCapability.isOutlineOn()) {
|
if ((frameData.shape != null) && outlineCapability.isOutlineOn()) {
|
||||||
target.drawWireframeShape(frameData.shape,
|
target.drawWireframeShape(frameData.shape,
|
||||||
getCapability(ColorableCapability.class).getColor(),
|
getCapability(ColorableCapability.class).getColor(),
|
||||||
outlineCapability.getOutlineWidth(),
|
outlineCapability.getOutlineWidth(),
|
||||||
|
@ -215,8 +215,7 @@ public class GenericGeometryResource extends
|
||||||
// add the geometries
|
// add the geometries
|
||||||
for (IGeometryData geometryData : this.resourceData.getData(time)) {
|
for (IGeometryData geometryData : this.resourceData.getData(time)) {
|
||||||
try {
|
try {
|
||||||
jtsCompiler.handle((Geometry) geometryData.getGeometry()
|
jtsCompiler.handle(geometryData.getGeometry());
|
||||||
.clone());
|
|
||||||
} catch (VizException e1) {
|
} catch (VizException e1) {
|
||||||
statusHandler.handle(UFStatus.Priority.ERROR,
|
statusHandler.handle(UFStatus.Priority.ERROR,
|
||||||
"Failed to handle Geometry "
|
"Failed to handle Geometry "
|
||||||
|
|
|
@ -62,6 +62,7 @@ import com.vividsolutions.jts.geom.MultiPolygon;
|
||||||
* Mar 27, 2008 #1053 randerso Initial creation
|
* Mar 27, 2008 #1053 randerso Initial creation
|
||||||
* 02/14/2013 #1506 mnash Use the new Python concurrency for QueryScript
|
* 02/14/2013 #1506 mnash Use the new Python concurrency for QueryScript
|
||||||
* 02/26/2013 #1708 randerso Changed to not evaluate the ref set
|
* 02/26/2013 #1708 randerso Changed to not evaluate the ref set
|
||||||
|
* 02/19/2014 #2819 randerso Removed unnecessary .clone() call
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -162,8 +163,7 @@ public class GFEReferenceSetResource extends
|
||||||
|
|
||||||
refData.setGrid(refData.getGrid());
|
refData.setGrid(refData.getGrid());
|
||||||
|
|
||||||
MultiPolygon mp = (MultiPolygon) refData.getPolygons(
|
MultiPolygon mp = refData.getPolygons(CoordinateType.GRID);
|
||||||
CoordinateType.GRID).clone();
|
|
||||||
|
|
||||||
ReferencedGeometry rc = new ReferencedGeometry(mp,
|
ReferencedGeometry rc = new ReferencedGeometry(mp,
|
||||||
MapUtil.getGridGeometry(refData.getGloc()), Type.GRID_CENTER);
|
MapUtil.getGridGeometry(refData.getGloc()), Type.GRID_CENTER);
|
||||||
|
@ -196,12 +196,12 @@ public class GFEReferenceSetResource extends
|
||||||
|
|
||||||
float alpha = paintProps.getAlpha();
|
float alpha = paintProps.getAlpha();
|
||||||
|
|
||||||
if (shadedShape != null && shadedShape.isDrawable()) {
|
if ((shadedShape != null) && shadedShape.isDrawable()) {
|
||||||
aTarget.drawShadedShape(shadedShape, alpha);
|
aTarget.drawShadedShape(shadedShape, alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
OutlineCapability outlineCapability = getCapability(OutlineCapability.class);
|
OutlineCapability outlineCapability = getCapability(OutlineCapability.class);
|
||||||
if (outlineCapability.isOutlineOn() && outlineShape != null
|
if (outlineCapability.isOutlineOn() && (outlineShape != null)
|
||||||
&& outlineShape.isDrawable()) {
|
&& outlineShape.isDrawable()) {
|
||||||
aTarget.drawWireframeShape(outlineShape,
|
aTarget.drawWireframeShape(outlineShape,
|
||||||
getCapability(ColorableCapability.class).getColor(),
|
getCapability(ColorableCapability.class).getColor(),
|
||||||
|
|
|
@ -102,6 +102,7 @@ import com.vividsolutions.jts.io.WKBReader;
|
||||||
* Apr 10, 2013 #1854 randerso Fix for compatibility with PostGIS 2.0
|
* Apr 10, 2013 #1854 randerso Fix for compatibility with PostGIS 2.0
|
||||||
* May 30, 2013 #2028 randerso Fixed date line issue with map display
|
* May 30, 2013 #2028 randerso Fixed date line issue with map display
|
||||||
* Jul 31, 2013 #2239 randerso Fixed scaling of maps that cross the date line
|
* Jul 31, 2013 #2239 randerso Fixed scaling of maps that cross the date line
|
||||||
|
* Feb 18, 2014 #2819 randerso Removed unnecessary clones of geometries
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -277,7 +278,7 @@ public class ZoneSelectorResource extends DbMapResource {
|
||||||
wfoPoints -= existingGeom.getNumPoints();
|
wfoPoints -= existingGeom.getNumPoints();
|
||||||
}
|
}
|
||||||
wfoPoints += g.getNumPoints();
|
wfoPoints += g.getNumPoints();
|
||||||
wfoGeoms.add((Geometry) g.clone());
|
wfoGeoms.add(g);
|
||||||
}
|
}
|
||||||
|
|
||||||
ZoneInfo info = req.rsc.getZoneInfo(zoneName);
|
ZoneInfo info = req.rsc.getZoneInfo(zoneName);
|
||||||
|
@ -326,7 +327,7 @@ public class ZoneSelectorResource extends DbMapResource {
|
||||||
ZoneInfo info = req.rsc.getZoneInfo(zoneName);
|
ZoneInfo info = req.rsc.getZoneInfo(zoneName);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
outlineCompiler.handle((Geometry) g.clone());
|
outlineCompiler.handle(g);
|
||||||
} catch (VizException e) {
|
} catch (VizException e) {
|
||||||
statusHandler.handle(Priority.PROBLEM,
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
"Error reprojecting map outline", e);
|
"Error reprojecting map outline", e);
|
||||||
|
@ -905,7 +906,7 @@ public class ZoneSelectorResource extends DbMapResource {
|
||||||
JTSCompiler shapeCompiler = new JTSCompiler(newShadedShape, null,
|
JTSCompiler shapeCompiler = new JTSCompiler(newShadedShape, null,
|
||||||
descriptor, PointStyle.CROSS);
|
descriptor, PointStyle.CROSS);
|
||||||
try {
|
try {
|
||||||
shapeCompiler.handle((Geometry) g.clone(), color);
|
shapeCompiler.handle(g, color);
|
||||||
} catch (VizException e) {
|
} catch (VizException e) {
|
||||||
statusHandler.handle(Priority.PROBLEM,
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
"Error computing shaded shape", e);
|
"Error computing shaded shape", e);
|
||||||
|
|
|
@ -195,6 +195,7 @@ import com.vividsolutions.jts.io.WKTReader;
|
||||||
* Use A1 hatching behavior when no county passes the inclusion filter.
|
* Use A1 hatching behavior when no county passes the inclusion filter.
|
||||||
* 10/29/2013 DR 16734 D. Friedman If redraw-from-hatched-area fails, don't allow the pollygon the be used.
|
* 10/29/2013 DR 16734 D. Friedman If redraw-from-hatched-area fails, don't allow the pollygon the be used.
|
||||||
* 12/04/2013 2604 jsanchez Refactored GisUtil.
|
* 12/04/2013 2604 jsanchez Refactored GisUtil.
|
||||||
|
* 02/19/2014 2819 randerso Removed unnecessary .clone() call
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author mschenke
|
* @author mschenke
|
||||||
|
@ -233,7 +234,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
|
|
||||||
public GeospatialDataAccessor(GeospatialDataList geoData,
|
public GeospatialDataAccessor(GeospatialDataList geoData,
|
||||||
AreaSourceConfiguration areaConfig) {
|
AreaSourceConfiguration areaConfig) {
|
||||||
if (geoData == null || areaConfig == null) {
|
if ((geoData == null) || (areaConfig == null)) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"GeospatialDataAccessor must not be null");
|
"GeospatialDataAccessor must not be null");
|
||||||
}
|
}
|
||||||
|
@ -309,11 +310,12 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
Geometry g2 = g.getGeometryN(n);
|
Geometry g2 = g.getGeometryN(n);
|
||||||
if (g != g2) {
|
if (g != g2) {
|
||||||
String fips = getFips(g2);
|
String fips = getFips(g2);
|
||||||
if (fips != null)
|
if (fips != null) {
|
||||||
return fips;
|
return fips;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -413,7 +415,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected IStatus run(IProgressMonitor monitor) {
|
protected IStatus run(IProgressMonitor monitor) {
|
||||||
while (this.warningArea != null && this.warningPolygon != null) {
|
while ((this.warningArea != null) && (this.warningPolygon != null)) {
|
||||||
Geometry warningArea;
|
Geometry warningArea;
|
||||||
Polygon warningPolygon;
|
Polygon warningPolygon;
|
||||||
synchronized (polygonUtil) {
|
synchronized (polygonUtil) {
|
||||||
|
@ -443,7 +445,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
hatchedArea = gf.createPolygon(lr, null);
|
hatchedArea = gf.createPolygon(lr, null);
|
||||||
int adjustPolygon_counter = 0;
|
int adjustPolygon_counter = 0;
|
||||||
while (!hatchedArea.isValid()
|
while (!hatchedArea.isValid()
|
||||||
&& adjustPolygon_counter < 1) {
|
&& (adjustPolygon_counter < 1)) {
|
||||||
System.out.println("Calling adjustPolygon #"
|
System.out.println("Calling adjustPolygon #"
|
||||||
+ adjustPolygon_counter);
|
+ adjustPolygon_counter);
|
||||||
PolygonUtil.adjustPolygon(coords);
|
PolygonUtil.adjustPolygon(coords);
|
||||||
|
@ -457,7 +459,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
adjustPolygon_counter += 1;
|
adjustPolygon_counter += 1;
|
||||||
}
|
}
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
if (!hatchedArea.isValid() && counter < 2) {
|
if (!hatchedArea.isValid() && (counter < 2)) {
|
||||||
System.out
|
System.out
|
||||||
.println("calling adjustVertex & alterVertexes: loop #"
|
.println("calling adjustVertex & alterVertexes: loop #"
|
||||||
+ counter);
|
+ counter);
|
||||||
|
@ -465,7 +467,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
lr = gf.createLinearRing(coords);
|
lr = gf.createLinearRing(coords);
|
||||||
hatchedArea = gf.createPolygon(lr, null);
|
hatchedArea = gf.createPolygon(lr, null);
|
||||||
while (!hatchedArea.isValid()
|
while (!hatchedArea.isValid()
|
||||||
&& adjustVertex_counter < 5) {
|
&& (adjustVertex_counter < 5)) {
|
||||||
System.out.println(" Calling adjustVertex #"
|
System.out.println(" Calling adjustVertex #"
|
||||||
+ adjustVertex_counter);
|
+ adjustVertex_counter);
|
||||||
coords = PolygonUtil.adjustVertex(coords);
|
coords = PolygonUtil.adjustVertex(coords);
|
||||||
|
@ -479,7 +481,8 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
}
|
}
|
||||||
int inner_counter = 0;
|
int inner_counter = 0;
|
||||||
System.out.println("");
|
System.out.println("");
|
||||||
while (!hatchedArea.isValid() && inner_counter < 5) {
|
while (!hatchedArea.isValid()
|
||||||
|
&& (inner_counter < 5)) {
|
||||||
System.out
|
System.out
|
||||||
.println(" Calling alterVertexes #"
|
.println(" Calling alterVertexes #"
|
||||||
+ inner_counter);
|
+ inner_counter);
|
||||||
|
@ -531,8 +534,9 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!this.haveInput)
|
if (!this.haveInput) {
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
hatchedArea = this.hatchedArea;
|
hatchedArea = this.hatchedArea;
|
||||||
hatchedWarningArea = this.hatchedWarningArea;
|
hatchedWarningArea = this.hatchedWarningArea;
|
||||||
return new Geometry[] { hatchedArea, hatchedWarningArea };
|
return new Geometry[] { hatchedArea, hatchedWarningArea };
|
||||||
|
@ -605,13 +609,13 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
|
|
||||||
static {
|
static {
|
||||||
for (int i = 0; i < 128; i++) {
|
for (int i = 0; i < 128; i++) {
|
||||||
if (i % 32 == 0) {
|
if ((i % 32) == 0) {
|
||||||
fillPattern[i] = 0x11;
|
fillPattern[i] = 0x11;
|
||||||
} else if (i % 32 == 1) {
|
} else if ((i % 32) == 1) {
|
||||||
fillPattern[i] = 0x11;
|
fillPattern[i] = 0x11;
|
||||||
} else if (i % 32 == 2) {
|
} else if ((i % 32) == 2) {
|
||||||
fillPattern[i] = 0x11;
|
fillPattern[i] = 0x11;
|
||||||
} else if (i % 32 == 3) {
|
} else if ((i % 32) == 3) {
|
||||||
fillPattern[i] = 0x11;
|
fillPattern[i] = 0x11;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -653,8 +657,8 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setDuration() {
|
private void setDuration() {
|
||||||
if (getConfiguration() != null
|
if ((getConfiguration() != null)
|
||||||
&& getConfiguration().getDefaultDuration() != 0) {
|
&& (getConfiguration().getDefaultDuration() != 0)) {
|
||||||
displayState.duration = getConfiguration().getDefaultDuration();
|
displayState.duration = getConfiguration().getDefaultDuration();
|
||||||
} else {
|
} else {
|
||||||
displayState.duration = 30;
|
displayState.duration = 30;
|
||||||
|
@ -737,14 +741,14 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
}
|
}
|
||||||
Date now = SimulatedTime.getSystemTime().getTime();
|
Date now = SimulatedTime.getSystemTime().getTime();
|
||||||
Date then = data.getDate();
|
Date then = data.getDate();
|
||||||
if (then == null
|
if ((then == null)
|
||||||
|| ((now.getTime() - then.getTime()) / (60 * 1000) > 10)) {
|
|| (((now.getTime() - then.getTime()) / (60 * 1000)) > 10)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Double.isNaN(data.getMotionDirection())
|
if (Double.isNaN(data.getMotionDirection())
|
||||||
|| Double.isNaN(data.getMotionSpeed())
|
|| Double.isNaN(data.getMotionSpeed())
|
||||||
|| data.getMotionSpeed() == 0) {
|
|| (data.getMotionSpeed() == 0)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -775,7 +779,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
@Override
|
@Override
|
||||||
protected void initInternal(IGraphicsTarget target) throws VizException {
|
protected void initInternal(IGraphicsTarget target) throws VizException {
|
||||||
WarngenLayer theOne = getLayerForContainer();
|
WarngenLayer theOne = getLayerForContainer();
|
||||||
if (theOne != null && theOne != this) {
|
if ((theOne != null) && (theOne != this)) {
|
||||||
/**
|
/**
|
||||||
* For multipane containers, warngen should only have a single
|
* For multipane containers, warngen should only have a single
|
||||||
* resource shared by all panes, when deserializing you end up with
|
* resource shared by all panes, when deserializing you end up with
|
||||||
|
@ -824,8 +828,8 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
for (WarngenLayer other : otherwarngens) {
|
for (WarngenLayer other : otherwarngens) {
|
||||||
// grab the first layer, unless another layer exists and is
|
// grab the first layer, unless another layer exists and is
|
||||||
// already intialized
|
// already intialized
|
||||||
if (layer == null
|
if ((layer == null)
|
||||||
|| other.getStatus() == ResourceStatus.INITIALIZED) {
|
|| (other.getStatus() == ResourceStatus.INITIALIZED)) {
|
||||||
layer = other;
|
layer = other;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -848,13 +852,13 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
|
|
||||||
// TODO: Issues with frameCount == 1? Could happen if we update on all
|
// TODO: Issues with frameCount == 1? Could happen if we update on all
|
||||||
// tilts where we had multiple frames then they went away.
|
// tilts where we had multiple frames then they went away.
|
||||||
if (displayState.mode == Mode.TRACK && lastMode == Mode.DRAG_ME) {
|
if ((displayState.mode == Mode.TRACK) && (lastMode == Mode.DRAG_ME)) {
|
||||||
if (warningAction == null || warningAction == WarningAction.NEW) {
|
if ((warningAction == null) || (warningAction == WarningAction.NEW)) {
|
||||||
// Initialize box
|
// Initialize box
|
||||||
redrawBoxFromTrack();
|
redrawBoxFromTrack();
|
||||||
if (((configuration.isTrackEnabled() == false || configuration
|
if ((((configuration.isTrackEnabled() == false) || (configuration
|
||||||
.getPathcastConfig() == null) && this.displayState.displayType != DisplayType.POLY)
|
.getPathcastConfig() == null)) && (this.displayState.displayType != DisplayType.POLY))
|
||||||
|| frameCount == 1) {
|
|| (frameCount == 1)) {
|
||||||
resetInitialFrame();
|
resetInitialFrame();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -863,7 +867,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (configuration.getEnableDamBreakThreat()
|
if (configuration.getEnableDamBreakThreat()
|
||||||
&& displayState.mode == Mode.NONE && lastMode == Mode.NONE) {
|
&& (displayState.mode == Mode.NONE) && (lastMode == Mode.NONE)) {
|
||||||
resetInitialFrame();
|
resetInitialFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -910,7 +914,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
double[] in1 = new double[2];
|
double[] in1 = new double[2];
|
||||||
double[] in2 = new double[2];
|
double[] in2 = new double[2];
|
||||||
|
|
||||||
for (int i = 0; i < c.length - 1; i++) {
|
for (int i = 0; i < (c.length - 1); i++) {
|
||||||
in1[0] = c[i].x;
|
in1[0] = c[i].x;
|
||||||
in1[1] = c[i].y;
|
in1[1] = c[i].y;
|
||||||
in2[0] = c[i + 1].x;
|
in2[0] = c[i + 1].x;
|
||||||
|
@ -966,7 +970,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
double minY = paintProps.getView().getExtent().getMinY() + boundary;
|
double minY = paintProps.getView().getExtent().getMinY() + boundary;
|
||||||
double maxY = paintProps.getView().getExtent().getMaxY() - boundary;
|
double maxY = paintProps.getView().getExtent().getMaxY() - boundary;
|
||||||
List<DrawableString> strings = new ArrayList<DrawableString>();
|
List<DrawableString> strings = new ArrayList<DrawableString>();
|
||||||
if (state.strings != null && state.strings.size() > 0) {
|
if ((state.strings != null) && (state.strings.size() > 0)) {
|
||||||
Iterator<Coordinate> coords = state.strings.keySet().iterator();
|
Iterator<Coordinate> coords = state.strings.keySet().iterator();
|
||||||
double[] in = new double[3];
|
double[] in = new double[3];
|
||||||
while (coords.hasNext()) {
|
while (coords.hasNext()) {
|
||||||
|
@ -996,7 +1000,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
if (false) {
|
if (false) {
|
||||||
// set to true for debug and drawing coordinate order
|
// set to true for debug and drawing coordinate order
|
||||||
Coordinate[] coords = state.getWarningPolygon().getCoordinates();
|
Coordinate[] coords = state.getWarningPolygon().getCoordinates();
|
||||||
for (int i = 0; i < coords.length - 1; ++i) {
|
for (int i = 0; i < (coords.length - 1); ++i) {
|
||||||
double[] out = descriptor.worldToPixel(new double[] {
|
double[] out = descriptor.worldToPixel(new double[] {
|
||||||
coords[i].x, coords[i].y });
|
coords[i].x, coords[i].y });
|
||||||
DrawableString string = new DrawableString("" + i, textColor);
|
DrawableString string = new DrawableString("" + i, textColor);
|
||||||
|
@ -1025,9 +1029,9 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
}
|
}
|
||||||
if (config != null) {
|
if (config != null) {
|
||||||
init(config);
|
init(config);
|
||||||
displayState.setInitiallyMotionless(this.configuration
|
displayState.setInitiallyMotionless((this.configuration
|
||||||
.isTrackEnabled() == false
|
.isTrackEnabled() == false)
|
||||||
|| this.configuration.getPathcastConfig() == null);
|
|| (this.configuration.getPathcastConfig() == null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1147,8 +1151,9 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
|
|
||||||
GridSpacing gridSpacing = dialogConfig.getGridSpacing();
|
GridSpacing gridSpacing = dialogConfig.getGridSpacing();
|
||||||
|
|
||||||
if (gridSpacing != null && gridSpacing.getNx() != null
|
if ((gridSpacing != null)
|
||||||
&& gridSpacing != null) {
|
&& (gridSpacing.getNx() != null)
|
||||||
|
&& (gridSpacing != null)) {
|
||||||
nx = gridSpacing.getNx();
|
nx = gridSpacing.getNx();
|
||||||
ny = gridSpacing.getNy();
|
ny = gridSpacing.getNy();
|
||||||
keepAspectRatio = gridSpacing.isKeepAspectRatio();
|
keepAspectRatio = gridSpacing.isKeepAspectRatio();
|
||||||
|
@ -1268,7 +1273,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
|
|
||||||
public String getLocalizedSite() {
|
public String getLocalizedSite() {
|
||||||
String site = "";
|
String site = "";
|
||||||
if (backupSite == null || "".equals(backupSite)) {
|
if ((backupSite == null) || "".equals(backupSite)) {
|
||||||
site = LocalizationManager.getInstance().getCurrentSite();
|
site = LocalizationManager.getInstance().getCurrentSite();
|
||||||
} else {
|
} else {
|
||||||
site = backupSite;
|
site = backupSite;
|
||||||
|
@ -1306,8 +1311,9 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
state.setOldWarningPolygon((Polygon) record.getGeometry().clone());
|
state.setOldWarningPolygon((Polygon) record.getGeometry().clone());
|
||||||
Geometry oldArea = getWarningAreaFromPolygon(
|
Geometry oldArea = getWarningAreaFromPolygon(
|
||||||
state.getOldWarningPolygon(), record);
|
state.getOldWarningPolygon(), record);
|
||||||
if (oldArea.getUserData() instanceof Set)
|
if (oldArea.getUserData() instanceof Set) {
|
||||||
state.setFipsOutsidePolygon((Set<String>) oldArea.getUserData());
|
state.setFipsOutsidePolygon((Set<String>) oldArea.getUserData());
|
||||||
|
}
|
||||||
state.setOldWarningArea(oldArea);
|
state.setOldWarningArea(oldArea);
|
||||||
} else {
|
} else {
|
||||||
state.setOldWarningArea(null);
|
state.setOldWarningArea(null);
|
||||||
|
@ -1399,7 +1405,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
for (Map.Entry<String, GeospatialDataList> entry : siteMap
|
for (Map.Entry<String, GeospatialDataList> entry : siteMap
|
||||||
.entrySet()) {
|
.entrySet()) {
|
||||||
String[] keyParts = entry.getKey().split("\\.");
|
String[] keyParts = entry.getKey().split("\\.");
|
||||||
if (keyParts.length == 2
|
if ((keyParts.length == 2)
|
||||||
&& "county".equalsIgnoreCase(keyParts[0])
|
&& "county".equalsIgnoreCase(keyParts[0])
|
||||||
&& getLocalizedSite().equals(keyParts[1])) {
|
&& getLocalizedSite().equals(keyParts[1])) {
|
||||||
return entry.getValue();
|
return entry.getValue();
|
||||||
|
@ -1519,8 +1525,9 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
|
|
||||||
Geometry result = area.getFactory().createGeometryCollection(
|
Geometry result = area.getFactory().createGeometryCollection(
|
||||||
newList.toArray(new Geometry[newList.size()]));
|
newList.toArray(new Geometry[newList.size()]));
|
||||||
if (fipsOutsidePolygon != null)
|
if (fipsOutsidePolygon != null) {
|
||||||
result.setUserData(fipsOutsidePolygon);
|
result.setUserData(fipsOutsidePolygon);
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -1541,7 +1548,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
* Create the WarnGen dialog if it has not been created.
|
* Create the WarnGen dialog if it has not been created.
|
||||||
*/
|
*/
|
||||||
public void createDialog() {
|
public void createDialog() {
|
||||||
if (dialog == null || dialog.isDisposed() == true) {
|
if ((dialog == null) || (dialog.isDisposed() == true)) {
|
||||||
dialog = new WarngenDialog(PlatformUI.getWorkbench()
|
dialog = new WarngenDialog(PlatformUI.getWorkbench()
|
||||||
.getActiveWorkbenchWindow().getShell(), this);
|
.getActiveWorkbenchWindow().getShell(), this);
|
||||||
dialog.open();
|
dialog.open();
|
||||||
|
@ -1560,7 +1567,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
* Show the WarnGen dialog and move it to the front.
|
* Show the WarnGen dialog and move it to the front.
|
||||||
*/
|
*/
|
||||||
public void showDialog(boolean show) {
|
public void showDialog(boolean show) {
|
||||||
if (dialog != null && dialog.isDisposed() == false) {
|
if ((dialog != null) && (dialog.isDisposed() == false)) {
|
||||||
dialog.showDialog(show);
|
dialog.showDialog(show);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1588,9 +1595,9 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
Geometry warningArea = state.getWarningArea();
|
Geometry warningArea = state.getWarningArea();
|
||||||
Geometry warningPolygon = state.getWarningPolygon();
|
Geometry warningPolygon = state.getWarningPolygon();
|
||||||
Geometry newWarningArea = createWarnedArea(
|
Geometry newWarningArea = createWarnedArea(
|
||||||
latLonToLocal((snapHatchedAreaToPolygon || warningArea == null) ? warningPolygon
|
latLonToLocal((snapHatchedAreaToPolygon || (warningArea == null)) ? warningPolygon
|
||||||
: warningArea), preservedSelection
|
: warningArea), preservedSelection
|
||||||
&& warningArea != null ? latLonToLocal(warningArea)
|
&& (warningArea != null) ? latLonToLocal(warningArea)
|
||||||
: null);
|
: null);
|
||||||
updateWarnedAreaState(newWarningArea, snapHatchedAreaToPolygon);
|
updateWarnedAreaState(newWarningArea, snapHatchedAreaToPolygon);
|
||||||
|
|
||||||
|
@ -1647,8 +1654,9 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
|
|
||||||
Set<String> selectedFips = null;
|
Set<String> selectedFips = null;
|
||||||
List<Geometry> selectedGeoms = null;
|
List<Geometry> selectedGeoms = null;
|
||||||
if (preservedSelection != null)
|
if (preservedSelection != null) {
|
||||||
selectedFips = getAllFipsInArea(preservedSelection);
|
selectedFips = getAllFipsInArea(preservedSelection);
|
||||||
|
}
|
||||||
|
|
||||||
// Loop through each of our counties returned from the query
|
// Loop through each of our counties returned from the query
|
||||||
for (GeospatialData f : geoData.features) {
|
for (GeospatialData f : geoData.features) {
|
||||||
|
@ -1665,7 +1673,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
oldWarningArea);
|
oldWarningArea);
|
||||||
}
|
}
|
||||||
if (intersection.isEmpty()) {
|
if (intersection.isEmpty()) {
|
||||||
if (selectedFips == null
|
if ((selectedFips == null)
|
||||||
|| !selectedFips.contains(getFips(f))) {
|
|| !selectedFips.contains(getFips(f))) {
|
||||||
continue;
|
continue;
|
||||||
} else if (!selectedFips.isEmpty()) {
|
} else if (!selectedFips.isEmpty()) {
|
||||||
|
@ -1713,7 +1721,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
useFilteredArea = useFilteredArea || passed;
|
useFilteredArea = useFilteredArea || passed;
|
||||||
include = (passed || filterAreaSecondChance(f,
|
include = (passed || filterAreaSecondChance(f,
|
||||||
intersection, true))
|
intersection, true))
|
||||||
&& (oldWarningPolygon == null
|
&& ((oldWarningPolygon == null)
|
||||||
|| prepGeom.intersects(oldWarningPolygon) || isOldAreaOutsidePolygon(f));
|
|| prepGeom.intersects(oldWarningPolygon) || isOldAreaOutsidePolygon(f));
|
||||||
newUnfilteredArea = union(newUnfilteredArea, intersection);
|
newUnfilteredArea = union(newUnfilteredArea, intersection);
|
||||||
}
|
}
|
||||||
|
@ -1730,18 +1738,19 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
newHatchedArea = useFilteredArea && newHatchedArea != null ? newHatchedArea
|
newHatchedArea = useFilteredArea && (newHatchedArea != null) ? newHatchedArea
|
||||||
: useFallback ? newUnfilteredArea : null;
|
: useFallback ? newUnfilteredArea : null;
|
||||||
return newHatchedArea != null ? newHatchedArea : new GeometryFactory()
|
return newHatchedArea != null ? newHatchedArea : new GeometryFactory()
|
||||||
.createGeometryCollection(new Geometry[0]);
|
.createGeometryCollection(new Geometry[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Geometry union(Geometry a, Geometry b) {
|
private static Geometry union(Geometry a, Geometry b) {
|
||||||
if (a != null && b != null)
|
if ((a != null) && (b != null)) {
|
||||||
return GeometryUtil.union(a, b);
|
return GeometryUtil.union(a, b);
|
||||||
else
|
} else {
|
||||||
return a != null ? a : b;
|
return a != null ? a : b;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void updateWarnedAreaState(Geometry newHatchedArea,
|
private void updateWarnedAreaState(Geometry newHatchedArea,
|
||||||
boolean snapToHatchedArea) throws VizException {
|
boolean snapToHatchedArea) throws VizException {
|
||||||
|
@ -1763,7 +1772,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
dialog.setInstructions();
|
dialog.setInstructions();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (!state.isMarked() || oldWarningArea == null) {
|
if (!state.isMarked() || (oldWarningArea == null)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1783,13 +1792,13 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
e);
|
e);
|
||||||
areaPercent = 100;
|
areaPercent = 100;
|
||||||
}
|
}
|
||||||
if (oldWarningPolygon.intersects(warningPolygon) == false
|
if ((oldWarningPolygon.intersects(warningPolygon) == false)
|
||||||
&& !state.isMarked()) {
|
&& !state.isMarked()) {
|
||||||
// Snap back to polygon
|
// Snap back to polygon
|
||||||
state.setWarningPolygon(localToLatLon((Polygon) oldWarningPolygon));
|
state.setWarningPolygon(localToLatLon((Polygon) oldWarningPolygon));
|
||||||
newHatchedArea = (Geometry) oldWarningArea.clone();
|
newHatchedArea = (Geometry) oldWarningArea.clone();
|
||||||
} else if (oldWarningPolygon.intersects(warningPolygon) == false
|
} else if ((oldWarningPolygon.intersects(warningPolygon) == false)
|
||||||
&& areaPercent < 10 && state.isMarked()) {
|
&& (areaPercent < 10) && state.isMarked()) {
|
||||||
// snap back to last valid user selected area
|
// snap back to last valid user selected area
|
||||||
state.setWarningPolygon((Polygon) state
|
state.setWarningPolygon((Polygon) state
|
||||||
.getMarkedWarningPolygon().clone());
|
.getMarkedWarningPolygon().clone());
|
||||||
|
@ -1836,31 +1845,33 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (flag)
|
if (flag) {
|
||||||
areas.add(area);
|
areas.add(area);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
newHatchedArea = GeometryUtil.union(areas
|
newHatchedArea = GeometryUtil.union(areas
|
||||||
.toArray(new Geometry[0]));
|
.toArray(new Geometry[0]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newHatchedArea == null || newHatchedArea.isEmpty()) {
|
if ((newHatchedArea == null) || newHatchedArea.isEmpty()) {
|
||||||
boolean initialWarning = false;
|
boolean initialWarning = false;
|
||||||
String[] followUps = this.getConfiguration().getFollowUps();
|
String[] followUps = this.getConfiguration().getFollowUps();
|
||||||
if (followUps.length == 0)
|
if (followUps.length == 0) {
|
||||||
initialWarning = true;
|
initialWarning = true;
|
||||||
else
|
} else {
|
||||||
for (String followup : followUps) {
|
for (String followup : followUps) {
|
||||||
if (followup.equals("NEW")) {
|
if (followup.equals("NEW")) {
|
||||||
initialWarning = true;
|
initialWarning = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (initialWarning)
|
}
|
||||||
|
if (initialWarning) {
|
||||||
state.clear2(); // not to hatch polygon for initial warning
|
state.clear2(); // not to hatch polygon for initial warning
|
||||||
else {
|
} else {
|
||||||
// Snap back for follow-ups
|
// Snap back for follow-ups
|
||||||
state.setWarningPolygon((Polygon) state
|
state.setWarningPolygon((Polygon) state
|
||||||
.getMarkedWarningPolygon().clone());
|
.getMarkedWarningPolygon().clone());
|
||||||
|
@ -1954,8 +1965,9 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
* more permissive, this test is not really necessary.
|
* more permissive, this test is not really necessary.
|
||||||
*/
|
*/
|
||||||
Geometry oldWarningArea = state.getOldWarningArea();
|
Geometry oldWarningArea = state.getOldWarningArea();
|
||||||
if (localCRS)
|
if (localCRS) {
|
||||||
oldWarningArea = latLonToLocal(oldWarningArea);
|
oldWarningArea = latLonToLocal(oldWarningArea);
|
||||||
|
}
|
||||||
List<Geometry> geoms = new ArrayList<Geometry>();
|
List<Geometry> geoms = new ArrayList<Geometry>();
|
||||||
GeometryUtil.buildGeometryList(geoms, oldWarningArea);
|
GeometryUtil.buildGeometryList(geoms, oldWarningArea);
|
||||||
Geometry oldSelectedArea = null;
|
Geometry oldSelectedArea = null;
|
||||||
|
@ -1977,7 +1989,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
* possible loss of precision in all of the calculations, we
|
* possible loss of precision in all of the calculations, we
|
||||||
* allow >= 0.999.
|
* allow >= 0.999.
|
||||||
*/
|
*/
|
||||||
return ratioOfOldArea >= .999
|
return (ratioOfOldArea >= .999)
|
||||||
&& !filterCheck(oldSelectedArea, geom, areaOfGeom);
|
&& !filterCheck(oldSelectedArea, geom, areaOfGeom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1986,8 +1998,9 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
|
|
||||||
private boolean isOldAreaOutsidePolygon(GeospatialData f) {
|
private boolean isOldAreaOutsidePolygon(GeospatialData f) {
|
||||||
Set<String> fipsOutsidePolygon = state.getFipsOutsidePolygon();
|
Set<String> fipsOutsidePolygon = state.getFipsOutsidePolygon();
|
||||||
if (fipsOutsidePolygon != null)
|
if (fipsOutsidePolygon != null) {
|
||||||
return fipsOutsidePolygon.contains(getFips(f));
|
return fipsOutsidePolygon.contains(getFips(f));
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2003,7 +2016,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
if (poly != null) {
|
if (poly != null) {
|
||||||
JTSCompiler comp = new JTSCompiler(shadedCoveredArea, null,
|
JTSCompiler comp = new JTSCompiler(shadedCoveredArea, null,
|
||||||
descriptor);
|
descriptor);
|
||||||
comp.handle((Geometry) state.getWarningArea().clone(),
|
comp.handle(state.getWarningArea(),
|
||||||
getCapability(ColorableCapability.class).getColor());
|
getCapability(ColorableCapability.class).getColor());
|
||||||
hasDrawnShaded = true;
|
hasDrawnShaded = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -2048,11 +2061,11 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
if (displayState.mode == Mode.DRAG_ME) {
|
if (displayState.mode == Mode.DRAG_ME) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (warningAction == null || warningAction == WarningAction.NEW) {
|
if ((warningAction == null) || (warningAction == WarningAction.NEW)) {
|
||||||
if ((configuration.isTrackEnabled() == false || configuration
|
if (((configuration.isTrackEnabled() == false) || (configuration
|
||||||
.getPathcastConfig() == null)
|
.getPathcastConfig() == null))
|
||||||
&& !this.displayState.isNonstationary()
|
&& !this.displayState.isNonstationary()
|
||||||
&& this.displayState.displayType != DisplayType.POLY) {
|
&& (this.displayState.displayType != DisplayType.POLY)) {
|
||||||
createSquare();
|
createSquare();
|
||||||
return;
|
return;
|
||||||
} else if (descriptor.getFramesInfo().getFrameCount() == 1) {
|
} else if (descriptor.getFramesInfo().getFrameCount() == 1) {
|
||||||
|
@ -2118,7 +2131,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
end = new Coordinate(point.getX(), point.getY());
|
end = new Coordinate(point.getX(), point.getY());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (start == null || end == null) {
|
if ((start == null) || (end == null)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2132,7 +2145,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
gc.setStartingGeographicPoint(start.x, start.y);
|
gc.setStartingGeographicPoint(start.x, start.y);
|
||||||
gc.setDestinationGeographicPoint(end.x, end.y);
|
gc.setDestinationGeographicPoint(end.x, end.y);
|
||||||
double farDistance = displayState.futurePoints != null ? gc
|
double farDistance = displayState.futurePoints != null ? gc
|
||||||
.getOrthodromicDistance() + shortDistance * 1.8
|
.getOrthodromicDistance() + (shortDistance * 1.8)
|
||||||
: shortDistance;
|
: shortDistance;
|
||||||
double angle = displayState.angle;
|
double angle = displayState.angle;
|
||||||
Point2D startPoint = null;
|
Point2D startPoint = null;
|
||||||
|
@ -2156,7 +2169,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
.getDestinationGeographicPoint());
|
.getDestinationGeographicPoint());
|
||||||
gc.setDirection(adjustAngle(gc2.getAzimuth() - 180),
|
gc.setDirection(adjustAngle(gc2.getAzimuth() - 180),
|
||||||
shortDistance * factor);
|
shortDistance * factor);
|
||||||
} else if (i == size - 1) {
|
} else if (i == (size - 1)) {
|
||||||
gc2.setStartingGeographicPoint(coord.x, coord.y);
|
gc2.setStartingGeographicPoint(coord.x, coord.y);
|
||||||
gc2.setDestinationGeographicPoint(coords[i - 1].x,
|
gc2.setDestinationGeographicPoint(coords[i - 1].x,
|
||||||
coords[i - 1].y);
|
coords[i - 1].y);
|
||||||
|
@ -2188,7 +2201,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
.getDestinationGeographicPoint());
|
.getDestinationGeographicPoint());
|
||||||
gc.setDirection(adjustAngle(gc2.getAzimuth() - 180),
|
gc.setDirection(adjustAngle(gc2.getAzimuth() - 180),
|
||||||
shortDistance);
|
shortDistance);
|
||||||
} else if (i == size - 1) {
|
} else if (i == (size - 1)) {
|
||||||
gc2.setStartingGeographicPoint(coord.x, coord.y);
|
gc2.setStartingGeographicPoint(coord.x, coord.y);
|
||||||
gc2.setDestinationGeographicPoint(coords[i - 1].x,
|
gc2.setDestinationGeographicPoint(coords[i - 1].x,
|
||||||
coords[i - 1].y);
|
coords[i - 1].y);
|
||||||
|
@ -2227,8 +2240,8 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
|
|
||||||
double dist2 = 11000;
|
double dist2 = 11000;
|
||||||
|
|
||||||
final double hyp1 = Math.sqrt(d1 * d1 + dist1 * dist1);
|
final double hyp1 = Math.sqrt((d1 * d1) + (dist1 * dist1));
|
||||||
final double hyp2 = Math.sqrt(d2 * d2 + dist2 * dist2);
|
final double hyp2 = Math.sqrt((d2 * d2) + (dist2 * dist2));
|
||||||
|
|
||||||
double ang1 = 90 + Math.toDegrees(Math.atan(dist1 / d1));
|
double ang1 = 90 + Math.toDegrees(Math.atan(dist1 / d1));
|
||||||
double ang2 = Math.toDegrees(Math.atan(d2 / dist2));
|
double ang2 = Math.toDegrees(Math.atan(d2 / dist2));
|
||||||
|
@ -2271,7 +2284,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
public boolean redrawBoxFromHatched() {
|
public boolean redrawBoxFromHatched() {
|
||||||
boolean result = true;
|
boolean result = true;
|
||||||
if (state.snappedToArea == false) {
|
if (state.snappedToArea == false) {
|
||||||
if (state.getWarningArea() == null
|
if ((state.getWarningArea() == null)
|
||||||
|| state.getWarningArea().isEmpty()) {
|
|| state.getWarningArea().isEmpty()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2287,9 +2300,10 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
warningAreaChanged();
|
warningAreaChanged();
|
||||||
areas = areaHatcher.getHatchedAreas();
|
areas = areaHatcher.getHatchedAreas();
|
||||||
// If still null, give up.
|
// If still null, give up.
|
||||||
if (areas == null)
|
if (areas == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
hatched = (Polygon) areas[0];
|
hatched = (Polygon) areas[0];
|
||||||
hatchedArea = areas[1];
|
hatchedArea = areas[1];
|
||||||
}
|
}
|
||||||
|
@ -2421,8 +2435,8 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
}
|
}
|
||||||
|
|
||||||
Point point = displayState.dragMePoint;
|
Point point = displayState.dragMePoint;
|
||||||
if (motdir != null && motspd != null
|
if ((motdir != null) && (motspd != null)
|
||||||
&& (motspd != 0 || configuration.isTrackEnabled())) {
|
&& ((motspd != 0) || configuration.isTrackEnabled())) {
|
||||||
displayState.setInitiallyMotionless(false);
|
displayState.setInitiallyMotionless(false);
|
||||||
displayState.angle = adjustAngle(motdir);
|
displayState.angle = adjustAngle(motdir);
|
||||||
displayState.speed = knotToMeterPerSec.convert(motspd);
|
displayState.speed = knotToMeterPerSec.convert(motspd);
|
||||||
|
@ -2475,9 +2489,10 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
if (m.find()) {
|
if (m.find()) {
|
||||||
int hour = Integer.parseInt(m.group(1));
|
int hour = Integer.parseInt(m.group(1));
|
||||||
int minute = Integer.parseInt(m.group(2));
|
int minute = Integer.parseInt(m.group(2));
|
||||||
frameTime = TimeUtil.timeOfDayToAbsoluteTime(hour
|
frameTime = TimeUtil.timeOfDayToAbsoluteTime(
|
||||||
* TimeUtil.SECONDS_PER_HOUR + minute
|
(hour * TimeUtil.SECONDS_PER_HOUR)
|
||||||
* TimeUtil.SECONDS_PER_MINUTE, warnRecord.getIssueTime());
|
+ (minute * TimeUtil.SECONDS_PER_MINUTE),
|
||||||
|
warnRecord.getIssueTime());
|
||||||
} else {
|
} else {
|
||||||
frameTime = warnRecord.getIssueTime();
|
frameTime = warnRecord.getIssueTime();
|
||||||
}
|
}
|
||||||
|
@ -2525,7 +2540,8 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
FramesInfo info = descriptor.getFramesInfo();
|
FramesInfo info = descriptor.getFramesInfo();
|
||||||
int currentFrame = trackUtil.getCurrentFrame(info);
|
int currentFrame = trackUtil.getCurrentFrame(info);
|
||||||
int frameCount = trackUtil.getFrameCount(info);
|
int frameCount = trackUtil.getFrameCount(info);
|
||||||
if (currentFrame == frameCount - 1 || !displayState.isNonstationary()) {
|
if ((currentFrame == (frameCount - 1))
|
||||||
|
|| !displayState.isNonstationary()) {
|
||||||
return coordinate;
|
return coordinate;
|
||||||
}
|
}
|
||||||
DataTime[] datatimes = trackUtil.getDataTimes(info);
|
DataTime[] datatimes = trackUtil.getDataTimes(info);
|
||||||
|
@ -2549,17 +2565,18 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
case POINT:
|
case POINT:
|
||||||
cc = new Coordinate[] { stormTrackState.futurePoints == null ? stormTrackState.dragMePoint
|
cc = new Coordinate[] { stormTrackState.futurePoints == null ? stormTrackState.dragMePoint
|
||||||
.getCoordinate() : stormTrackState.futurePoints[0].coord };
|
.getCoordinate() : stormTrackState.futurePoints[0].coord };
|
||||||
if (warningAction == null || warningAction == WarningAction.NEW
|
if ((warningAction == null) || (warningAction == WarningAction.NEW)
|
||||||
|| warningAction == WarningAction.CON
|
|| (warningAction == WarningAction.CON)
|
||||||
|| warningAction == WarningAction.CAN) {
|
|| (warningAction == WarningAction.CAN)) {
|
||||||
Coordinate coord = new Coordinate(
|
Coordinate coord = new Coordinate(
|
||||||
stormTrackState.dragMePoint.getCoordinate());
|
stormTrackState.dragMePoint.getCoordinate());
|
||||||
DataTime currentDataTime = new DataTime(SimulatedTime
|
DataTime currentDataTime = new DataTime(SimulatedTime
|
||||||
.getSystemTime().getTime());
|
.getSystemTime().getTime());
|
||||||
if (stormTrackState.compuateCurrentStormCenter(coord,
|
if (stormTrackState.compuateCurrentStormCenter(coord,
|
||||||
currentDataTime))
|
currentDataTime)) {
|
||||||
cc = new Coordinate[] { coord };
|
cc = new Coordinate[] { coord };
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case POLY:
|
case POLY:
|
||||||
Coordinate[] polyPoints = stormTrackState.dragMeLine
|
Coordinate[] polyPoints = stormTrackState.dragMeLine
|
||||||
|
@ -2616,7 +2633,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
IDisplayPaneContainer container = getResourceContainer();
|
IDisplayPaneContainer container = getResourceContainer();
|
||||||
Coordinate[] coords = warningPolygon.getExteriorRing().getCoordinates();
|
Coordinate[] coords = warningPolygon.getExteriorRing().getCoordinates();
|
||||||
|
|
||||||
if (vertexId >= coords.length || vertexId < 0) {
|
if ((vertexId >= coords.length) || (vertexId < 0)) {
|
||||||
return vertexId;
|
return vertexId;
|
||||||
}
|
}
|
||||||
int rval = vertexId;
|
int rval = vertexId;
|
||||||
|
@ -2635,8 +2652,8 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
}
|
}
|
||||||
double[] a = container.translateInverseClick(coords[i]);
|
double[] a = container.translateInverseClick(coords[i]);
|
||||||
double distance = new Coordinate(a[0], a[1]).distance(vc);
|
double distance = new Coordinate(a[0], a[1]).distance(vc);
|
||||||
if (distance < 5
|
if ((distance < 5)
|
||||||
&& !((i == coords.length - 1 && vertexId == 0) || (i == 0 && vertexId == coords.length - 1))) {
|
&& !(((i == (coords.length - 1)) && (vertexId == 0)) || ((i == 0) && (vertexId == (coords.length - 1))))) {
|
||||||
delete = i;
|
delete = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2644,20 +2661,20 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
coords[vertexId] = newCoord;
|
coords[vertexId] = newCoord;
|
||||||
if (vertexId == 0) {
|
if (vertexId == 0) {
|
||||||
coords[coords.length - 1] = newCoord;
|
coords[coords.length - 1] = newCoord;
|
||||||
} else if (vertexId == coords.length - 1) {
|
} else if (vertexId == (coords.length - 1)) {
|
||||||
coords[0] = newCoord;
|
coords[0] = newCoord;
|
||||||
}
|
}
|
||||||
if (deleteSameVertex && delete != -1 && coords.length > 4) {
|
if (deleteSameVertex && (delete != -1) && (coords.length > 4)) {
|
||||||
setModifiedVertexNeedsToBeUpdated(true);
|
setModifiedVertexNeedsToBeUpdated(true);
|
||||||
Coordinate[] newCoords = new Coordinate[coords.length - 1];
|
Coordinate[] newCoords = new Coordinate[coords.length - 1];
|
||||||
int ctr = 0;
|
int ctr = 0;
|
||||||
if (delete == 0 || delete == coords.length - 1) {
|
if ((delete == 0) || (delete == (coords.length - 1))) {
|
||||||
for (int i = 1; i < coords.length - 1; i++) {
|
for (int i = 1; i < (coords.length - 1); i++) {
|
||||||
newCoords[ctr++] = coords[i];
|
newCoords[ctr++] = coords[i];
|
||||||
}
|
}
|
||||||
newCoords[newCoords.length - 1] = newCoords[0];
|
newCoords[newCoords.length - 1] = newCoords[0];
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < coords.length - 1; i++) {
|
for (int i = 0; i < (coords.length - 1); i++) {
|
||||||
if (i != delete) {
|
if (i != delete) {
|
||||||
newCoords[ctr++] = coords[i];
|
newCoords[ctr++] = coords[i];
|
||||||
}
|
}
|
||||||
|
@ -2681,18 +2698,18 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
|
|
||||||
LineSegment[] ls = new LineSegment[coords.length - 1];
|
LineSegment[] ls = new LineSegment[coords.length - 1];
|
||||||
|
|
||||||
for (int i = 0; i < coords.length - 1; i++) {
|
for (int i = 0; i < (coords.length - 1); i++) {
|
||||||
ls[i] = new LineSegment(coords[i], coords[i + 1]);
|
ls[i] = new LineSegment(coords[i], coords[i + 1]);
|
||||||
}
|
}
|
||||||
boolean intersectFlag = false;
|
boolean intersectFlag = false;
|
||||||
for (int i = 0; i < ls.length; i++) {
|
for (int i = 0; i < ls.length; i++) {
|
||||||
for (int j = 0; j < ls.length; j++) {
|
for (int j = 0; j < ls.length; j++) {
|
||||||
if (i != j
|
if ((i != j)
|
||||||
&& ls[i].intersection(ls[j]) != null
|
&& (ls[i].intersection(ls[j]) != null)
|
||||||
&& ls[i].intersection(ls[j]).equals(
|
&& (ls[i].intersection(ls[j]).equals(
|
||||||
ls[i].getCoordinate(0)) == false
|
ls[i].getCoordinate(0)) == false)
|
||||||
&& ls[i].intersection(ls[j]).equals(
|
&& (ls[i].intersection(ls[j]).equals(
|
||||||
ls[i].getCoordinate(1)) == false) {
|
ls[i].getCoordinate(1)) == false)) {
|
||||||
intersectFlag = true;
|
intersectFlag = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2713,9 +2730,9 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
AbstractWarningRecord warnRec = cw.getNewestByTracking(data.getEtn(),
|
AbstractWarningRecord warnRec = cw.getNewestByTracking(data.getEtn(),
|
||||||
data.getPhen() + "." + data.getSig());
|
data.getPhen() + "." + data.getSig());
|
||||||
|
|
||||||
if (warnRec == null
|
if ((warnRec == null)
|
||||||
|| GisUtil.equivalent(warnRec.getGeometry(),
|
|| (GisUtil.equivalent(warnRec.getGeometry(),
|
||||||
state.getWarningPolygon()) == false) {
|
state.getWarningPolygon()) == false)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2762,7 +2779,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
coords = (Coordinate[]) newArray;
|
coords = (Coordinate[]) newArray;
|
||||||
coords[coords.length - 1] = coords[0];
|
coords[coords.length - 1] = coords[0];
|
||||||
}
|
}
|
||||||
for (int i = 0; i < coords.length - 1; i++) {
|
for (int i = 0; i < (coords.length - 1); i++) {
|
||||||
coords[i].x += delta.x;
|
coords[i].x += delta.x;
|
||||||
coords[i].y += delta.y;
|
coords[i].y += delta.y;
|
||||||
coords[i].z += delta.z;
|
coords[i].z += delta.z;
|
||||||
|
@ -2787,7 +2804,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
super.addContextMenuItems(menuManager, x, y);
|
super.addContextMenuItems(menuManager, x, y);
|
||||||
menuManager.add(manager.getSelectLocationAction());
|
menuManager.add(manager.getSelectLocationAction());
|
||||||
|
|
||||||
if (displayState.mode == Mode.DRAG_ME || !boxEditable) {
|
if ((displayState.mode == Mode.DRAG_ME) || !boxEditable) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2840,7 +2857,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
Geometry tmp = removeCounty(warningArea, getFips(f));
|
Geometry tmp = removeCounty(warningArea, getFips(f));
|
||||||
if (tmp.isEmpty()) {
|
if (tmp.isEmpty()) {
|
||||||
String fip = getFips(f);
|
String fip = getFips(f);
|
||||||
if (fip != null && uniqueFip != null
|
if ((fip != null) && (uniqueFip != null)
|
||||||
&& fip.equals(uniqueFip)) {
|
&& fip.equals(uniqueFip)) {
|
||||||
updateWarnedAreas(true);
|
updateWarnedAreas(true);
|
||||||
}
|
}
|
||||||
|
@ -2855,8 +2872,8 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
if (oldWarningArea != null) {
|
if (oldWarningArea != null) {
|
||||||
// for a CON, prevents extra areas to be added
|
// for a CON, prevents extra areas to be added
|
||||||
Set<String> fipsIds = getAllFipsInArea(oldWarningArea);
|
Set<String> fipsIds = getAllFipsInArea(oldWarningArea);
|
||||||
if (fipsIds.contains(featureFips) == false
|
if ((fipsIds.contains(featureFips) == false)
|
||||||
|| !(oldWarningPolygon.contains(point) == true || isOldAreaOutsidePolygon(f))) {
|
|| !((oldWarningPolygon.contains(point) == true) || isOldAreaOutsidePolygon(f))) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2900,8 +2917,9 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
|
|
||||||
private Geometry filterWarningArea(Geometry warningArea) {
|
private Geometry filterWarningArea(Geometry warningArea) {
|
||||||
// TODO: Duplicates logic in createWarnedArea
|
// TODO: Duplicates logic in createWarnedArea
|
||||||
if (warningArea == null)
|
if (warningArea == null) {
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* Note: Currently does not determine if warningArea is valid (i.e., in
|
* Note: Currently does not determine if warningArea is valid (i.e., in
|
||||||
* contained in CWA, old warning area, etc.) or has overlapping
|
* contained in CWA, old warning area, etc.) or has overlapping
|
||||||
|
@ -2920,12 +2938,13 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
boolean passed = filterArea(f, warningAreaForFeature, false);
|
boolean passed = filterArea(f, warningAreaForFeature, false);
|
||||||
useFilteredArea = useFilteredArea || passed;
|
useFilteredArea = useFilteredArea || passed;
|
||||||
if (passed
|
if (passed
|
||||||
|| filterAreaSecondChance(f, warningAreaForFeature, false))
|
|| filterAreaSecondChance(f, warningAreaForFeature, false)) {
|
||||||
newHatchedArea = union(newHatchedArea, warningAreaForFeature);
|
newHatchedArea = union(newHatchedArea, warningAreaForFeature);
|
||||||
|
}
|
||||||
newUnfilteredArea = union(newUnfilteredArea, warningAreaForFeature);
|
newUnfilteredArea = union(newUnfilteredArea, warningAreaForFeature);
|
||||||
}
|
}
|
||||||
|
|
||||||
newHatchedArea = useFilteredArea && newHatchedArea != null ? newHatchedArea
|
newHatchedArea = useFilteredArea && (newHatchedArea != null) ? newHatchedArea
|
||||||
: useFallback ? newUnfilteredArea : null;
|
: useFallback ? newUnfilteredArea : null;
|
||||||
|
|
||||||
return newHatchedArea != null ? newHatchedArea : new GeometryFactory()
|
return newHatchedArea != null ? newHatchedArea : new GeometryFactory()
|
||||||
|
@ -2964,12 +2983,12 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
Polygon newPolygon = null;
|
Polygon newPolygon = null;
|
||||||
if (g instanceof Polygon) {
|
if (g instanceof Polygon) {
|
||||||
newPolygon = (Polygon) g;
|
newPolygon = (Polygon) g;
|
||||||
} else if (g instanceof GeometryCollection
|
} else if ((g instanceof GeometryCollection)
|
||||||
&& g.getNumGeometries() == 1
|
&& (g.getNumGeometries() == 1)
|
||||||
&& g.getGeometryN(0) instanceof Polygon) {
|
&& (g.getGeometryN(0) instanceof Polygon)) {
|
||||||
newPolygon = (Polygon) g.getGeometryN(0);
|
newPolygon = (Polygon) g.getGeometryN(0);
|
||||||
}
|
}
|
||||||
if (newPolygon != null && newPolygon.isValid()) {
|
if ((newPolygon != null) && newPolygon.isValid()) {
|
||||||
polygon = newPolygon;
|
polygon = newPolygon;
|
||||||
}
|
}
|
||||||
} catch (TopologyException e) {
|
} catch (TopologyException e) {
|
||||||
|
@ -3001,8 +3020,9 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
|
|
||||||
private Geometry removeCounties(Geometry warningArea,
|
private Geometry removeCounties(Geometry warningArea,
|
||||||
Set<String> fipsToRemove) {
|
Set<String> fipsToRemove) {
|
||||||
if (fipsToRemove == null || fipsToRemove.isEmpty())
|
if ((fipsToRemove == null) || fipsToRemove.isEmpty()) {
|
||||||
return warningArea;
|
return warningArea;
|
||||||
|
}
|
||||||
List<Geometry> toKeep = new ArrayList<Geometry>(
|
List<Geometry> toKeep = new ArrayList<Geometry>(
|
||||||
warningArea.getNumGeometries());
|
warningArea.getNumGeometries());
|
||||||
for (int n = 0; n < warningArea.getNumGeometries(); ++n) {
|
for (int n = 0; n < warningArea.getNumGeometries(); ++n) {
|
||||||
|
@ -3057,10 +3077,10 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
if (s == null) {
|
if (s == null) {
|
||||||
// invalid follow up selection
|
// invalid follow up selection
|
||||||
continue;
|
continue;
|
||||||
} else if (f != null && f.equals(s)) {
|
} else if ((f != null) && f.equals(s)) {
|
||||||
// follow up already featured
|
// follow up already featured
|
||||||
continue;
|
continue;
|
||||||
} else if (prev != null && s.equals(prev)) {
|
} else if ((prev != null) && s.equals(prev)) {
|
||||||
// geometry for this warning has already been tested
|
// geometry for this warning has already been tested
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -3069,7 +3089,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
getLocalizedSite()).getNewestByTracking(s.getEtn(),
|
getLocalizedSite()).getNewestByTracking(s.getEtn(),
|
||||||
s.getPhen() + "." + s.getSig());
|
s.getPhen() + "." + s.getSig());
|
||||||
GeometryFactory gf = new GeometryFactory();
|
GeometryFactory gf = new GeometryFactory();
|
||||||
if (featuredWarning != null
|
if ((featuredWarning != null)
|
||||||
&& featuredWarning.getGeometry().contains(
|
&& featuredWarning.getGeometry().contains(
|
||||||
gf.createPoint(c))) {
|
gf.createPoint(c))) {
|
||||||
if (isPolygonLocked()) {
|
if (isPolygonLocked()) {
|
||||||
|
@ -3083,13 +3103,13 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (w == null || w.getGeometry() == null) {
|
if ((w == null) || (w.getGeometry() == null)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if mouse click is near the polygon
|
// check if mouse click is near the polygon
|
||||||
Coordinate[] coords = w.getGeometry().getCoordinates();
|
Coordinate[] coords = w.getGeometry().getCoordinates();
|
||||||
for (int i = 0; i < coords.length - 1; i++) {
|
for (int i = 0; i < (coords.length - 1); i++) {
|
||||||
LineSegment segment = new LineSegment(coords[i],
|
LineSegment segment = new LineSegment(coords[i],
|
||||||
coords[i + 1]);
|
coords[i + 1]);
|
||||||
double dist = segment.distance(c);
|
double dist = segment.distance(c);
|
||||||
|
@ -3134,8 +3154,8 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
@Override
|
@Override
|
||||||
public void resourceChanged(ChangeType type, Object object) {
|
public void resourceChanged(ChangeType type, Object object) {
|
||||||
super.resourceChanged(type, object);
|
super.resourceChanged(type, object);
|
||||||
if (type == ChangeType.CAPABILITY
|
if ((type == ChangeType.CAPABILITY)
|
||||||
&& object instanceof EditableCapability) {
|
&& (object instanceof EditableCapability)) {
|
||||||
if (dialog != null) {
|
if (dialog != null) {
|
||||||
final boolean editable = isEditable();
|
final boolean editable = isEditable();
|
||||||
boxEditable = editable;
|
boxEditable = editable;
|
||||||
|
@ -3145,8 +3165,8 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
dialog.getDisplay().asyncExec(new Runnable() {
|
dialog.getDisplay().asyncExec(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (dlg.isDisposed() == false
|
if ((dlg.isDisposed() == false)
|
||||||
&& dlg.getShell().isVisible() != editable) {
|
&& (dlg.getShell().isVisible() != editable)) {
|
||||||
dlg.showDialog(editable);
|
dlg.showDialog(editable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3219,8 +3239,9 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
*/
|
*/
|
||||||
private Set<String> removeDuplicateGid(Set<String> prefixes) {
|
private Set<String> removeDuplicateGid(Set<String> prefixes) {
|
||||||
|
|
||||||
if (prefixes.size() < 2)
|
if (prefixes.size() < 2) {
|
||||||
return prefixes;
|
return prefixes;
|
||||||
|
}
|
||||||
|
|
||||||
Map<String, Double> fipsSize = new HashMap<String, Double>();
|
Map<String, Double> fipsSize = new HashMap<String, Double>();
|
||||||
Map<String, String> namePrefix = new HashMap<String, String>();
|
Map<String, String> namePrefix = new HashMap<String, String>();
|
||||||
|
|
|
@ -62,6 +62,7 @@ import com.vividsolutions.jts.geom.Geometry;
|
||||||
* Removed no longer needed frameAltered. Do not set wire frame for a CAN.
|
* Removed no longer needed frameAltered. Do not set wire frame for a CAN.
|
||||||
* Jul 24, 2013 DR16350 mgamazaychikov Fix the problem with plotting EXP warning
|
* Jul 24, 2013 DR16350 mgamazaychikov Fix the problem with plotting EXP warning
|
||||||
* Sep 5, 2013 2176 jsanchez Disposed the emergency font.
|
* Sep 5, 2013 2176 jsanchez Disposed the emergency font.
|
||||||
|
* Feb 19, 2014 2819 randerso Removed unnecessary .clone() call
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author jsanchez
|
* @author jsanchez
|
||||||
|
@ -116,7 +117,7 @@ public class WarningsResource extends AbstractWWAResource {
|
||||||
protected void initInternal(IGraphicsTarget target) throws VizException {
|
protected void initInternal(IGraphicsTarget target) throws VizException {
|
||||||
FramesInfo info = descriptor.getFramesInfo();
|
FramesInfo info = descriptor.getFramesInfo();
|
||||||
DataTime[] times = info.getFrameTimes();
|
DataTime[] times = info.getFrameTimes();
|
||||||
if (times != null && times.length > 0) {
|
if ((times != null) && (times.length > 0)) {
|
||||||
// Request data for "earliest" time
|
// Request data for "earliest" time
|
||||||
requestData(times[0]);
|
requestData(times[0]);
|
||||||
}
|
}
|
||||||
|
@ -165,9 +166,9 @@ public class WarningsResource extends AbstractWWAResource {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (type == ChangeType.CAPABILITY) {
|
} else if (type == ChangeType.CAPABILITY) {
|
||||||
if (color != null
|
if ((color != null)
|
||||||
&& color.equals(getCapability((ColorableCapability.class))
|
&& (color.equals(getCapability((ColorableCapability.class))
|
||||||
.getColor()) == false) {
|
.getColor()) == false)) {
|
||||||
color = getCapability((ColorableCapability.class)).getColor();
|
color = getCapability((ColorableCapability.class)).getColor();
|
||||||
|
|
||||||
// TODO this needs to be fixed to work with watches which are
|
// TODO this needs to be fixed to work with watches which are
|
||||||
|
@ -212,7 +213,7 @@ public class WarningsResource extends AbstractWWAResource {
|
||||||
// Do not paint a wire frame shape for a CAN
|
// Do not paint a wire frame shape for a CAN
|
||||||
if (act != WarningAction.CAN) {
|
if (act != WarningAction.CAN) {
|
||||||
wfs = target.createWireframeShape(false, descriptor);
|
wfs = target.createWireframeShape(false, descriptor);
|
||||||
geo = (Geometry) record.getGeometry().clone();
|
geo = record.getGeometry();
|
||||||
|
|
||||||
JTSCompiler jtsCompiler = new JTSCompiler(null, wfs,
|
JTSCompiler jtsCompiler = new JTSCompiler(null, wfs,
|
||||||
descriptor);
|
descriptor);
|
||||||
|
@ -238,8 +239,8 @@ public class WarningsResource extends AbstractWWAResource {
|
||||||
DataTime[] frames = info.getFrameTimes();
|
DataTime[] frames = info.getFrameTimes();
|
||||||
for (AbstractWarningRecord warnrec : recordsToLoad) {
|
for (AbstractWarningRecord warnrec : recordsToLoad) {
|
||||||
WarningAction act = WarningAction.valueOf(warnrec.getAct());
|
WarningAction act = WarningAction.valueOf(warnrec.getAct());
|
||||||
if (act == WarningAction.CON || act == WarningAction.CAN
|
if ((act == WarningAction.CON) || (act == WarningAction.CAN)
|
||||||
|| act == WarningAction.EXT) {
|
|| (act == WarningAction.EXT)) {
|
||||||
AbstractWarningRecord createShape = null;
|
AbstractWarningRecord createShape = null;
|
||||||
for (String key : entryMap.keySet()) {
|
for (String key : entryMap.keySet()) {
|
||||||
WarningEntry entry = entryMap.get(key);
|
WarningEntry entry = entryMap.get(key);
|
||||||
|
@ -274,8 +275,8 @@ public class WarningsResource extends AbstractWWAResource {
|
||||||
// if it's a con, need to have a new entry for a
|
// if it's a con, need to have a new entry for a
|
||||||
// new
|
// new
|
||||||
// polygon
|
// polygon
|
||||||
if (act == WarningAction.CON
|
if ((act == WarningAction.CON)
|
||||||
|| act == WarningAction.EXT) {
|
|| (act == WarningAction.EXT)) {
|
||||||
createShape = warnrec;
|
createShape = warnrec;
|
||||||
}
|
}
|
||||||
} else if ((entry.altered && entry.partialCancel)) {
|
} else if ((entry.altered && entry.partialCancel)) {
|
||||||
|
|
|
@ -52,6 +52,7 @@ import com.vividsolutions.jts.geom.GeometryFactory;
|
||||||
* Sep 5, 2013 2176 jsanchez Disposed the emergency font.
|
* Sep 5, 2013 2176 jsanchez Disposed the emergency font.
|
||||||
* Nov 8, 2013 16758 mgamazaychikov Changed access modifier of mergeWatches to protected
|
* Nov 8, 2013 16758 mgamazaychikov Changed access modifier of mergeWatches to protected
|
||||||
* so a child class can override the implementation.
|
* so a child class can override the implementation.
|
||||||
|
* Feb 19, 2014 2819 randerso Removed unnecessary .clone() call
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author jsanchez
|
* @author jsanchez
|
||||||
|
@ -196,7 +197,7 @@ public class WatchesResource extends AbstractWWAResource {
|
||||||
if ((record.getGeometry() != null) && (record.getPhen() != null)) {
|
if ((record.getGeometry() != null) && (record.getPhen() != null)) {
|
||||||
IShadedShape ss = target.createShadedShape(false,
|
IShadedShape ss = target.createShadedShape(false,
|
||||||
descriptor.getGridGeometry(), false);
|
descriptor.getGridGeometry(), false);
|
||||||
geo = (Geometry) record.getGeometry().clone();
|
geo = record.getGeometry();
|
||||||
JTSCompiler jtsCompiler = new JTSCompiler(ss, null,
|
JTSCompiler jtsCompiler = new JTSCompiler(ss, null,
|
||||||
this.descriptor, PointStyle.CROSS);
|
this.descriptor, PointStyle.CROSS);
|
||||||
jtsCompiler.handle(geo, color);
|
jtsCompiler.handle(geo, color);
|
||||||
|
|
|
@ -20,11 +20,14 @@
|
||||||
package com.raytheon.uf.common.geospatial;
|
package com.raytheon.uf.common.geospatial;
|
||||||
|
|
||||||
import org.geotools.coverage.grid.GeneralGridGeometry;
|
import org.geotools.coverage.grid.GeneralGridGeometry;
|
||||||
|
import org.geotools.geometry.jts.CoordinateSequenceTransformer;
|
||||||
|
import org.geotools.geometry.jts.DefaultCoordinateSequenceTransformer;
|
||||||
|
import org.geotools.geometry.jts.GeometryCoordinateSequenceTransformer;
|
||||||
import org.opengis.referencing.operation.MathTransform;
|
import org.opengis.referencing.operation.MathTransform;
|
||||||
import org.opengis.referencing.operation.TransformException;
|
import org.opengis.referencing.operation.TransformException;
|
||||||
|
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
import com.vividsolutions.jts.geom.Geometry;
|
||||||
|
import com.vividsolutions.jts.geom.impl.PackedCoordinateSequenceFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a coordinate in any reference system
|
* Represents a coordinate in any reference system
|
||||||
|
@ -35,6 +38,7 @@ import com.vividsolutions.jts.geom.Geometry;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Dec 29, 2008 chammack Initial creation
|
* Dec 29, 2008 chammack Initial creation
|
||||||
|
* Feb 18, 2014 #2819 randerso Made transform non-destructive
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -94,33 +98,13 @@ public class ReferencedGeometry extends ReferencedObject<Geometry> {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected Geometry transform(MathTransform mt) throws TransformException {
|
protected Geometry transform(MathTransform mt) throws TransformException {
|
||||||
// The following appears to be very slow due to object creation:
|
CoordinateSequenceTransformer t1 = new DefaultCoordinateSequenceTransformer(
|
||||||
// return JTS.transform(this.internalCoordinate, mt);
|
PackedCoordinateSequenceFactory.DOUBLE_FACTORY);
|
||||||
|
final GeometryCoordinateSequenceTransformer transformer = new GeometryCoordinateSequenceTransformer(
|
||||||
|
t1);
|
||||||
|
transformer.setMathTransform(mt);
|
||||||
|
|
||||||
// Faster, but destructive version:
|
return transformer.transform(this.internalObject);
|
||||||
Coordinate[] coords = this.internalObject.getCoordinates();
|
|
||||||
int size = coords.length * 2;
|
|
||||||
double[] out = new double[size];
|
|
||||||
double[] in = new double[size];
|
|
||||||
int index = 0;
|
|
||||||
for (int i = 0; i < coords.length; i++) {
|
|
||||||
in[index++] = coords[i].x;
|
|
||||||
in[index++] = coords[i].y;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
mt.transform(in, 0, out, 0, coords.length);
|
|
||||||
index = 0;
|
|
||||||
for (int i = 0; i < coords.length; i++) {
|
|
||||||
coords[i].x = out[index++];
|
|
||||||
coords[i].y = out[index++];
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.internalObject;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,6 +140,7 @@ import com.vividsolutions.jts.operation.distance.DistanceOp;
|
||||||
* this class
|
* this class
|
||||||
* 11/13 TTR 752 J. Wu added methods to compute an element's range record.
|
* 11/13 TTR 752 J. Wu added methods to compute an element's range record.
|
||||||
* 12/13 #1089 B. Yin Modify watch to display county list
|
* 12/13 #1089 B. Yin Modify watch to display county list
|
||||||
|
* 02/14 #2819 R. Anderson Removed unnecessary .clone() call
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author sgilbert
|
* @author sgilbert
|
||||||
|
@ -697,7 +698,7 @@ public class DisplayElementFactory {
|
||||||
null, iDescriptor, PointStyle.CROSS);
|
null, iDescriptor, PointStyle.CROSS);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
compiler.handle((Geometry) cntyUnion.clone(),
|
compiler.handle(cntyUnion,
|
||||||
new RGB(colors[1].getRed(), colors[1].getGreen(), colors[1].getBlue()));
|
new RGB(colors[1].getRed(), colors[1].getGreen(), colors[1].getBlue()));
|
||||||
|
|
||||||
if ( elem.getFillPattern() != FillPattern.TRANSPARENCY &&
|
if ( elem.getFillPattern() != FillPattern.TRANSPARENCY &&
|
||||||
|
|
Loading…
Add table
Reference in a new issue