Merge "ASM #514 - Line of Storms functionality behaving oddly in WarnGen" into asm_14.3.1

Former-commit-id: 433a3be9362e151d8da6af2d69cdcd50f4a87b93
This commit is contained in:
Juliya Dynina 2014-05-07 14:18:01 -05:00 committed by Gerrit Code Review
commit d6a796c476
4 changed files with 69 additions and 2 deletions

View file

@ -101,6 +101,8 @@ import com.vividsolutions.jts.geom.LineString;
* 01-28-2014 DR16465 mgamazaychikov Fixed the problem with anchor point when frame * 01-28-2014 DR16465 mgamazaychikov Fixed the problem with anchor point when frame
* count changes; made line width configurable. * count changes; made line width configurable.
* 04-07-2014 DR 17232 D. Friedman Make sure pivot indexes are valid. * 04-07-2014 DR 17232 D. Friedman Make sure pivot indexes are valid.
* 04-24-2014 DR 16356 Qinglu Lin Updated generateTrackInfo(), generateNewTrackInfo(),
* and createTrack().
* *
* </pre> * </pre>
* *
@ -691,6 +693,14 @@ public class StormTrackDisplay implements IRenderable {
if (cachedTrack != null) { if (cachedTrack != null) {
cachedTrack.dispose(); cachedTrack.dispose();
} }
if (StormTrackState.trackType.equals("lineOfStorms") && state.justSwitchedToLOS) {
GeodeticCalculator gc = new GeodeticCalculator();
Coordinate[] coords = state.dragMeGeom.getCoordinates();
gc.setStartingGeographicPoint(coords[0].x, coords[0].y);
gc.setDestinationGeographicPoint(coords[coords.length - 1].x,
coords[coords.length - 1].y);
state.angle = adjustAngle(gc.getAzimuth() - 90);
}
generateTrackInfo(state, paintProps); generateTrackInfo(state, paintProps);
if (state.mode == Mode.TRACK) { if (state.mode == Mode.TRACK) {
createTrack(target, paintProps); createTrack(target, paintProps);
@ -703,6 +713,9 @@ public class StormTrackDisplay implements IRenderable {
state.lineWidth, state.lineStyle); state.lineWidth, state.lineStyle);
paintLabels(target, paintProps); paintLabels(target, paintProps);
} }
if (StormTrackState.trackType.equals("lineOfStorms") && state.justSwitchedToLOS) {
state.angle = StormTrackState.oneStormAngle;
}
} }
/** /**
@ -781,6 +794,10 @@ public class StormTrackDisplay implements IRenderable {
currentState.pointMoved = false; currentState.pointMoved = false;
currentState.originalTrack = false; currentState.originalTrack = false;
moved = true; moved = true;
if (StormTrackState.trackType.equals("lineOfStorms") &&
currentState.justSwitchedToLOS) {
currentState.justSwitchedToLOS = false;
}
} }
currentDisplayedTimes = trackUtil.getDataTimes(paintProps currentDisplayedTimes = trackUtil.getDataTimes(paintProps
@ -959,6 +976,7 @@ public class StormTrackDisplay implements IRenderable {
state.futurePoints = futurePoints; state.futurePoints = futurePoints;
state.angle = angle; state.angle = angle;
StormTrackState.oneStormAngle = angle;
state.speed = speed; state.speed = speed;
postData(state); postData(state);
@ -995,7 +1013,11 @@ public class StormTrackDisplay implements IRenderable {
coords[coords.length - 1].y); coords[coords.length - 1].y);
angle = adjustAngle(gc.getAzimuth() - 90); angle = adjustAngle(gc.getAzimuth() - 90);
} else { } else {
angle = adjustAngle(std.getMotionDirection()); if (state.justSwitchedToOS) {
angle = StormTrackState.oneStormAngle;
} else {
angle = adjustAngle(std.getMotionDirection());
}
} }
state.angle = angle; state.angle = angle;
state.speed = speed; state.speed = speed;
@ -1182,6 +1204,11 @@ public class StormTrackDisplay implements IRenderable {
compiler.handle(gf.createLineString(coords)); compiler.handle(gf.createLineString(coords));
double angle = state.angle; double angle = state.angle;
if(!state.justSwitchedToOS) {
if (StormTrackState.trackType.equals("oneStorm")) {
StormTrackState.oneStormAngle = angle;
}
}
// Draw ticks, X and Arrow // Draw ticks, X and Arrow
for (int i = 0; i < orig.length - 1; ++i) { for (int i = 0; i < orig.length - 1; ++i) {
GeodeticCalculator gc = new GeodeticCalculator(); GeodeticCalculator gc = new GeodeticCalculator();
@ -1189,6 +1216,10 @@ public class StormTrackDisplay implements IRenderable {
gc.setDestinationGeographicPoint(orig[i + 1].x, orig[i + 1].y); gc.setDestinationGeographicPoint(orig[i + 1].x, orig[i + 1].y);
angle = gc.getAzimuth(); angle = gc.getAzimuth();
if (state.justSwitchedToLOS) {
angle = 90.0;
state.justSwitchedToLOS = false;
}
if (i == state.displayedPivotIndex) { if (i == state.displayedPivotIndex) {
double tickLen = SQRT_2 * tickLengthInMeters; double tickLen = SQRT_2 * tickLengthInMeters;

View file

@ -47,6 +47,8 @@ import com.vividsolutions.jts.geom.Point;
* 11/29/2012 15571 Qinglu Lin Added compuateCurrentStormCenter(); * 11/29/2012 15571 Qinglu Lin Added compuateCurrentStormCenter();
* 15Mar2013 15693 mgamazaychikov Added magnification. * 15Mar2013 15693 mgamazaychikov Added magnification.
* 06-24-2013 DR 16317 D. Friedman Handle "motionless" track. * 06-24-2013 DR 16317 D. Friedman Handle "motionless" track.
* 04-24-2014 DR 16356 Qinglu Lin Added newWarnGen, oneStormAngle, justSwitchedToLOS,
* justSwitchedToOS, and trackType.
* *
* </pre> * </pre>
* *
@ -198,6 +200,16 @@ public class StormTrackState {
private boolean initiallyMotionless; private boolean initiallyMotionless;
public static boolean newWarnGen = true;
public static double oneStormAngle = Double.NaN;
public boolean justSwitchedToLOS = false;
public boolean justSwitchedToOS = false;
public static String trackType = null;
/** Compute the coordinate of the storm center at the time defined by dataTime via interpolation. */ /** Compute the coordinate of the storm center at the time defined by dataTime via interpolation. */
public boolean compuateCurrentStormCenter(Coordinate coord, DataTime dateTime) { public boolean compuateCurrentStormCenter(Coordinate coord, DataTime dateTime) {
if (futurePoints == null) return false; if (futurePoints == null) return false;

View file

@ -152,6 +152,7 @@ import com.vividsolutions.jts.geom.Polygon;
* Sep 24, 2013 #2401 lvenable Fixed font memory leak. * Sep 24, 2013 #2401 lvenable Fixed font memory leak.
* Oct 01, 2013 DR16612 m.gamazaychikov Fixed inconsistencies with track locking and updateListSelected method * 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 polygon the be used. * Oct 29, 2013 DR 16734 D. Friedman If redraw-from-hatched-area fails, don't allow the polygon the be used.
* Apr 24, 2014 DR 16356 Qinglu Lin Updated selectOneStorm() and selectLineOfStorms().
* </pre> * </pre>
* *
* @author chammack * @author chammack
@ -1323,6 +1324,8 @@ public class WarngenDialog extends CaveSWTDialog implements
*/ */
private void selectOneStorm() { private void selectOneStorm() {
if (warngenLayer.state.followupData == null) { if (warngenLayer.state.followupData == null) {
warngenLayer.resetState();
warngenLayer.reset("oneStorm");
warngenLayer.clearWarningGeometries(); warngenLayer.clearWarningGeometries();
warngenLayer.getStormTrackState().dragMeLine = null; warngenLayer.getStormTrackState().dragMeLine = null;
warngenLayer.getStormTrackState().dragMeGeom = null; warngenLayer.getStormTrackState().dragMeGeom = null;
@ -1338,6 +1341,8 @@ public class WarngenDialog extends CaveSWTDialog implements
*/ */
private void selectLineOfStorms() { private void selectLineOfStorms() {
if (warngenLayer.state.followupData == null) { if (warngenLayer.state.followupData == null) {
warngenLayer.resetState();
warngenLayer.reset("lineOfStorms");
warngenLayer.clearWarningGeometries(); warngenLayer.clearWarningGeometries();
warngenLayer.getStormTrackState().dragMeLine = null; warngenLayer.getStormTrackState().dragMeLine = null;
warngenLayer.getStormTrackState().dragMeGeom = null; warngenLayer.getStormTrackState().dragMeGeom = null;

View file

@ -205,10 +205,11 @@ import com.vividsolutions.jts.io.WKTReader;
* 02/07/2014 DR16090 m.gamazaychikov Added GeomMetaDataUpdateNotificationObserver class to get notification * 02/07/2014 DR16090 m.gamazaychikov Added GeomMetaDataUpdateNotificationObserver class to get notification
* when geometry file get updated to re-read them in. * when geometry file get updated to re-read them in.
* 02/19/2014 2819 randerso Removed unnecessary .clone() call * 02/19/2014 2819 randerso Removed unnecessary .clone() call
* 03/17/2014 DR16309 Qinglu Lin Updated getWarningAreaFromPolygon(); changed searchCountyGeospatialDataAccessor) to * 03/17/2014 DR 16309 Qinglu Lin Updated getWarningAreaFromPolygon(); changed searchCountyGeospatialDataAccessor) to
* searchGeospatialDataAccessor() and updated it; changed getCountyGeospatialDataAcessor() * searchGeospatialDataAccessor() and updated it; changed getCountyGeospatialDataAcessor()
* to getGeospatialDataAcessor(); changed getAllCountyUgcs() to getAllUgcs(); changed * to getGeospatialDataAcessor(); changed getAllCountyUgcs() to getAllUgcs(); changed
* getUgcsForWatches() to getUgcsForCountyWatches(). * getUgcsForWatches() to getUgcsForCountyWatches().
* 04/23/2014 DR 16356 Qinglu Lin Updated initializeState() and added reset().
* </pre> * </pre>
* *
* @author mschenke * @author mschenke
@ -737,6 +738,11 @@ public class WarngenLayer extends AbstractStormTrackResource {
// Default angle for POINT // Default angle for POINT
displayState.labelMode = LabelMode.TIME; displayState.labelMode = LabelMode.TIME;
state.angle = 60; state.angle = 60;
if (StormTrackState.newWarnGen) {
StormTrackState.oneStormAngle = state.angle;
StormTrackState.trackType = "oneStorm";
StormTrackState.newWarnGen = false;
}
state.speed = 35; state.speed = 35;
state.dragMePoint = null; state.dragMePoint = null;
state.resetAnchor = true; state.resetAnchor = true;
@ -3493,4 +3499,17 @@ public class WarngenLayer extends AbstractStormTrackResource {
return hatchedArea; return hatchedArea;
} }
} }
public void reset(String trackType) {
if (trackType.equals("oneStorm")) {
getStormTrackState().justSwitchedToOS = true;
getStormTrackState().justSwitchedToLOS = false;
StormTrackState.trackType = "oneStorm";
getStormTrackState().angle = StormTrackState.oneStormAngle;
} else if (trackType.equals("lineOfStorms")) {
getStormTrackState().justSwitchedToOS = false;
getStormTrackState().justSwitchedToLOS = true;
StormTrackState.trackType = "lineOfStorms";
}
}
} }