Merge branch 'omaha_13.5.3' into development

Former-commit-id: 65d3e37b287dd2f429aba4d70c24bde3f1bc6470
This commit is contained in:
Steve Harris 2013-11-11 15:40:45 -06:00
commit 66f99f3974
5 changed files with 62 additions and 17 deletions

View file

@ -328,8 +328,8 @@ public class StationProfileDlg extends CaveSWTDialog {
* Calculate pixel and offset values.
*/
private void calculateValues() {
double totalElevInc = Math.abs(stationProfData.getElevationFtMax())
- Math.abs(stationProfData.getElevationFtMin());
double totalElevInc = stationProfData.getElevationFtMax()
- stationProfData.getElevationFtMin();
// Calculate the offset between the elevation points
double offsetDbl = totalElevInc / 5;
@ -684,6 +684,7 @@ public class StationProfileDlg extends CaveSWTDialog {
if (stationList != null) {
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm MM/dd");
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
int i = 0;
for (Statprof station : stationList) {
// Skip gage if the river mile is not valid
@ -694,6 +695,7 @@ public class StationProfileDlg extends CaveSWTDialog {
e.gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_BLACK));
x = calcRiverMileXCoord(station.getId().getMile());
y = calcElevationYCoord(station.getId().getZd());
i++;
// hash mark at each site
e.gc.drawLine(x, y, x, y + POINT_HASH);

View file

@ -151,7 +151,7 @@ import com.vividsolutions.jts.geom.Polygon;
* Sep 17, 2013 DR 16496 D. Friedman Make editable state more consistent.
* Sep 24, 2013 #2401 lvenable Fixed font memory leak.
* Oct 01, 2013 DR16612 m.gamazaychikov Fixed inconsistencies with track locking and updateListSelected method
* Oct 29, 2013 DR 16734 D. Friedman If redraw-from-hatched-area fails, don't allow the pollygon the be used.
* Oct 29, 2013 DR 16734 D. Friedman If redraw-from-hatched-area fails, don't allow the polygon the be used.
* </pre>
*
* @author chammack
@ -1073,14 +1073,16 @@ public class WarngenDialog extends CaveSWTDialog implements
if ((followupData != null)
&& (WarningAction.valueOf(followupData.getAct()) == WarningAction.NEW)) {
redrawFromWarned();
if (! redrawFromWarned())
return;
}
if (((followupData == null) || ((WarningAction.valueOf(followupData
.getAct()) == WarningAction.CON) && warngenLayer
.conWarnAreaChanged(followupData)))
&& !polygonLocked && !trackLocked) {
redrawFromWarned();
if (!redrawFromWarned())
return;
}
// Need to check again because redraw may have failed.
@ -1457,14 +1459,10 @@ public class WarngenDialog extends CaveSWTDialog implements
/**
* Redraw everything based on warned area
*/
private void redrawFromWarned() {
try {
warngenLayer.redrawBoxFromHatched();
} catch (VizException e) {
statusHandler.handle(Priority.PROBLEM,
"Error redrawing box from hatched", e);
}
private boolean redrawFromWarned() {
boolean result = warngenLayer.redrawBoxFromHatched();
warngenLayer.issueRefresh();
return result;
}
/**

View file

@ -396,6 +396,8 @@ public class WarngenLayer extends AbstractStormTrackResource {
private Polygon oldWarningPolygon;
private boolean haveInput;
public AreaHatcher(PolygonUtil polygonUtil) {
super("Hatching Warning Area");
setSystem(true);
@ -513,6 +515,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
this.warningPolygon = warningPolygon;
this.warningArea = warningArea;
this.oldWarningPolygon = oldWarningPolygon;
this.haveInput = true;
}
schedule();
}
@ -520,12 +523,15 @@ public class WarngenLayer extends AbstractStormTrackResource {
public synchronized Geometry[] getHatchedAreas() {
Polygon hatchedArea = null;
Geometry hatchedWarningArea = null;
if (getState() == Job.RUNNING) {
while (getState() != Job.NONE) {
try {
join();
} catch (InterruptedException e) {
break;
}
}
if (! this.haveInput)
return null;
hatchedArea = this.hatchedArea;
hatchedWarningArea = this.hatchedWarningArea;
return new Geometry[] { hatchedArea, hatchedWarningArea };
@ -2254,13 +2260,14 @@ public class WarngenLayer extends AbstractStormTrackResource {
}
/**
*
* @return true if the box has been redraw successfully
*/
public void redrawBoxFromHatched() throws VizException {
public boolean redrawBoxFromHatched() {
boolean result = true;
if (state.snappedToArea == false) {
if (state.getWarningArea() == null
|| state.getWarningArea().isEmpty()) {
return;
return true;
}
try {
@ -2269,6 +2276,14 @@ public class WarngenLayer extends AbstractStormTrackResource {
Geometry hatchedArea = state.getWarningArea();
if (areaHatcher != null) {
Geometry[] areas = areaHatcher.getHatchedAreas();
if (areas == null) {
// Somehow, the hatcher has not been run. Try it now.
warningAreaChanged();
areas = areaHatcher.getHatchedAreas();
// If still null, give up.
if (areas == null)
return false;
}
hatched = (Polygon) areas[0];
hatchedArea = areas[1];
}
@ -2302,15 +2317,18 @@ public class WarngenLayer extends AbstractStormTrackResource {
issueRefresh();
statusHandler.handle(Priority.PROBLEM,
"Could not redraw box from warned area");
result = false;
}
System.out.println("Time to createWarningPolygon: "
+ (System.currentTimeMillis() - t0) + "ms");
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM,
"Error hatching polygon", e);
result = false;
}
issueRefresh();
}
return result;
}
public void createDamThreatArea(Coordinate[] coordinates) {

View file

@ -56,6 +56,8 @@ import com.vividsolutions.jts.io.WKTReader;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 10, 2013 1951 rjpeter Initial history entry, updated ugcZones references
* Nov 08, 2013 16758 mgamazaychikov Added mergeWatches to simplify SPS processing
* and getEventKey to create SPS-unique key
* </pre>
*
* @author rjpeter
@ -286,4 +288,27 @@ public class CWASPSResource extends WatchesResource {
return textToPrint;
}
/**
* Groups all the ugc zones with the same 'product.act.phensig.etn'
*
* Since there are no ugc zones in SPSs return the input watch records
* without changing them.
*/
protected List<AbstractWarningRecord> mergeWatches(
List<AbstractWarningRecord> watchrecs) {
return watchrecs;
}
/**
* Create unique enough key to be used in paint method entryMap
*
* Use wmoId and countyHeader fields
**/
@Override
protected String getEventKey(WarningEntry entry) {
AbstractWarningRecord rec = entry.record;
return rec.getWmoid().replaceAll(" ", "_") + ':'
+ rec.getInsertTime().getTimeInMillis();
}
}

View file

@ -50,6 +50,8 @@ import com.vividsolutions.jts.geom.GeometryFactory;
* May 06, 2013 1930 bsteffen Check for null in WatchesResource.
* May 10, 2013 1951 rjpeter Updated ugcZones references
* Sep 5, 2013 2176 jsanchez Disposed the emergency font.
* Nov 8, 2013 16758 mgamazaychikov Changed access modifier of mergeWatches to protected
* so a child class can override the implementation.
* </pre>
*
* @author jsanchez
@ -377,7 +379,7 @@ public class WatchesResource extends AbstractWWAResource {
/**
* Groups all the ugc zones with the same 'product.act.phensig.etn'
*/
private List<AbstractWarningRecord> mergeWatches(
protected List<AbstractWarningRecord> mergeWatches(
List<AbstractWarningRecord> watchrecs) {
Map<String, AbstractWarningRecord> watches = new HashMap<String, AbstractWarningRecord>();
for (AbstractWarningRecord watchrec : watchrecs) {