Issue #1977: Fix merge issue with WarngenDialog

Former-commit-id: 7c03fc955b [formerly ddfc06eb9753e893ece28e1718c5e4550e82b053]
Former-commit-id: a5383dbfa4
This commit is contained in:
Richard Peter 2013-08-14 15:33:02 -05:00
parent e867472bf6
commit 951bb37cd7

View file

@ -69,6 +69,7 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.common.time.TimeRange;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
import com.raytheon.uf.viz.core.VizApp;
@ -193,11 +194,11 @@ public class WarngenDialog extends CaveSWTDialog implements
final DateFormat df = new SimpleDateFormat("HH:mm EEE d-MMM");
private java.util.List<String> mapsLoaded = new ArrayList<String>();
private final java.util.List<String> mapsLoaded = new ArrayList<String>();
private Button okButton;
private BulletListManager bulletListManager;
private final BulletListManager bulletListManager;
private List bulletList;
@ -277,7 +278,7 @@ public class WarngenDialog extends CaveSWTDialog implements
private boolean invalidFollowUpAction = false;
private IWarngenObserver wed = new WarningSender();
private final IWarngenObserver wed = new WarningSender();
public WarngenDialog(Shell parentShell, WarngenLayer layer) {
super(parentShell, SWT.CLOSE | SWT.MODELESS | SWT.BORDER | SWT.TITLE,
@ -480,7 +481,7 @@ public class WarngenDialog extends CaveSWTDialog implements
String defaultTemplate = warngenLayer.getDialogConfig()
.getDefaultTemplate();
if (defaultTemplate == null || defaultTemplate.equals("")) {
if ((defaultTemplate == null) || defaultTemplate.equals("")) {
defaultTemplate = mainProducts.get(0).split("/")[1];
}
@ -819,7 +820,7 @@ public class WarngenDialog extends CaveSWTDialog implements
createTextButtonEnabled = false;
} else if (warngenLayer.getStormTrackState().mode == Mode.NONE) {
createTextButtonEnabled = false;
} else if (warngenLayer.getPolygon() == null
} else if ((warngenLayer.getPolygon() == null)
|| warngenLayer.getPolygon().isEmpty()) {
str += WarngenConstants.INSTRUCTION_NO_SHADED_AREA;
createTextButtonEnabled = false;
@ -888,9 +889,9 @@ public class WarngenDialog extends CaveSWTDialog implements
newYes = true;
} else if (act == WarningAction.EXT) {
extYes = true;
} else if (act == WarningAction.CON
|| act == WarningAction.CAN
|| act == WarningAction.EXP) {
} else if ((act == WarningAction.CON)
|| (act == WarningAction.CAN)
|| (act == WarningAction.EXP)) {
follow = true;
} else if (act == WarningAction.COR) {
corYes = true;
@ -1041,13 +1042,13 @@ public class WarngenDialog extends CaveSWTDialog implements
return;
}
if (followupData != null
&& WarningAction.valueOf(followupData.getAct()) == WarningAction.NEW) {
if ((followupData != null)
&& (WarningAction.valueOf(followupData.getAct()) == WarningAction.NEW)) {
redrawFromWarned();
}
if ((followupData == null || (WarningAction.valueOf(followupData
.getAct()) == WarningAction.CON && warngenLayer
if (((followupData == null) || ((WarningAction.valueOf(followupData
.getAct()) == WarningAction.CON) && warngenLayer
.conWarnAreaChanged(followupData)))
&& !polygonLocked) {
redrawFromWarned();
@ -1062,6 +1063,7 @@ public class WarngenDialog extends CaveSWTDialog implements
try {
pmd.run(false, false, new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor)
throws InvocationTargetException, InterruptedException {
try {
@ -1131,7 +1133,7 @@ public class WarngenDialog extends CaveSWTDialog implements
private boolean checkDamSelection() {
if (bulletListManager.isDamNameSeletcted()
&& bulletListManager.isDamCauseSelected() == false) {
&& (bulletListManager.isDamCauseSelected() == false)) {
/*
* On WES 'Instructions' became 'Warning' but didn't prevent a
* created text
@ -1152,9 +1154,9 @@ public class WarngenDialog extends CaveSWTDialog implements
}
private void updateWarngenUIState(String result) {
if (VtecUtil.parseMessage(result) != null
&& WarningAction.valueOf(VtecUtil.parseMessage(result)
.getAction()) != WarningAction.NEW) {
if ((VtecUtil.parseMessage(result) != null)
&& (WarningAction.valueOf(VtecUtil.parseMessage(result)
.getAction()) != WarningAction.NEW)) {
// TODO Use warningsArrived method to set old
// polygon and warning area
warngenLayer.state.setOldWarningPolygon((Polygon) warngenLayer
@ -1169,7 +1171,7 @@ public class WarngenDialog extends CaveSWTDialog implements
// An error dialog is to appear if a user tries to press Create Text
// again after a product was issued.AWIPS I does not auto update their
// update list, this is their solution.
if (followupData != null && totalSegments > 1) {
if ((followupData != null) && (totalSegments > 1)) {
multiSegmentMessage(followupData.getEquvialentString());
return false;
}
@ -1237,8 +1239,8 @@ public class WarngenDialog extends CaveSWTDialog implements
warngenLayer.getStormTrackState().mode = Mode.TRACK;
warngenLayer.lastMode = Mode.DRAG_ME;
}
if (warngenLayer.getConfiguration().isTrackEnabled() == false
|| warngenLayer.getConfiguration().getPathcastConfig() == null) {
if ((warngenLayer.getConfiguration().isTrackEnabled() == false)
|| (warngenLayer.getConfiguration().getPathcastConfig() == null)) {
warngenLayer.getStormTrackState().setInitiallyMotionless(true);
}
warngenLayer.resetInitialFrame();
@ -1258,8 +1260,8 @@ public class WarngenDialog extends CaveSWTDialog implements
* Action for when something is selected from the backup site combo
*/
private void backupSiteSelected() {
if (backupSiteCbo.getSelectionIndex() >= 0
&& backupSiteCbo.getItemCount() > 0) {
if ((backupSiteCbo.getSelectionIndex() >= 0)
&& (backupSiteCbo.getItemCount() > 0)) {
warngenLayer.setBackupSite(backupSiteCbo.getItems()[backupSiteCbo
.getSelectionIndex()]);
// Refresh template
@ -1367,8 +1369,8 @@ public class WarngenDialog extends CaveSWTDialog implements
DamInfoBullet damBullet = bulletListManager.getSelectedDamInfoBullet();
if (damBullet != null) {
if (damBullet.getCoords() == null
|| damBullet.getCoords().length() == 0) {
if ((damBullet.getCoords() == null)
|| (damBullet.getCoords().length() == 0)) {
damBreakInstruct = "LAT...LON can not be found in 'coords' parameter";
} else {
ArrayList<Coordinate> coordinates = new ArrayList<Coordinate>();
@ -1381,8 +1383,8 @@ public class WarngenDialog extends CaveSWTDialog implements
if (m.find()) {
m = latLonPtrn.matcher(damBullet.getCoords());
while (m.find()) {
coordinates.add(new Coordinate(-1
* Double.parseDouble(m.group(2)) / 100, Double
coordinates.add(new Coordinate((-1 * Double
.parseDouble(m.group(2))) / 100, Double
.parseDouble(m.group(1)) / 100));
}
@ -1448,8 +1450,9 @@ public class WarngenDialog extends CaveSWTDialog implements
private void changeTemplate(String templateName) {
// DR 14515
if (templateName.equals(warngenLayer.getTemplateName()))
if (templateName.equals(warngenLayer.getTemplateName())) {
return;
}
String lastAreaSource = warngenLayer.getConfiguration()
.getHatchedAreaSource().getAreaSource();
@ -1503,9 +1506,9 @@ public class WarngenDialog extends CaveSWTDialog implements
.getSelection() ? DisplayType.POLY : DisplayType.POINT;
}
warngenLayer.getStormTrackState().setInitiallyMotionless(
warngenLayer.getConfiguration().isTrackEnabled() == false
|| warngenLayer.getConfiguration()
.getPathcastConfig() == null);
(warngenLayer.getConfiguration().isTrackEnabled() == false)
|| (warngenLayer.getConfiguration()
.getPathcastConfig() == null));
if (warngenLayer.getStormTrackState().isInitiallyMotionless()) {
warngenLayer.getStormTrackState().speed = 0;
warngenLayer.getStormTrackState().angle = 0;
@ -1608,10 +1611,10 @@ public class WarngenDialog extends CaveSWTDialog implements
// (AWIPS 1)
if (warngenLayer.state.followupData != null) {
if (data.equals(warngenLayer.state.followupData)) {
if (WarningAction
if ((WarningAction
.valueOf(warngenLayer.state.followupData
.getAct()) == WarningAction.CON
&& totalSegments > 1) {
.getAct()) == WarningAction.CON)
&& (totalSegments > 1)) {
sameProductMessage(warngenLayer.state.followupData
.getEquvialentString());
}
@ -1678,7 +1681,7 @@ public class WarngenDialog extends CaveSWTDialog implements
if (warngenLayer.getConfiguration().getEnableDamBreakThreat()) {
for (BulletActionGroup bulletActionGroup : warngenLayer
.getConfiguration().getBulletActionGroups()) {
if (bulletActionGroup.getAction() != null
if ((bulletActionGroup.getAction() != null)
&& bulletActionGroup.getAction().equals(
data.getAct())) {
warngenLayer.getConfiguration().setDamInfoBullets(
@ -1699,14 +1702,14 @@ public class WarngenDialog extends CaveSWTDialog implements
bulletListManager.recreateBulletsFromFollowup(
warngenLayer.getConfiguration(), action, oldWarning);
if (bulletListManager.isDamNameSeletcted()
&& action != WarningAction.NEW) {
&& (action != WarningAction.NEW)) {
setPolygonLocked(true);
}
}
refreshBulletList();
recreateUpdates();
if (action == null || action == WarningAction.NEW
|| action == WarningAction.EXT) {
if ((action == null) || (action == WarningAction.NEW)
|| (action == WarningAction.EXT)) {
recreateDurations(durationList);
}
}
@ -1741,7 +1744,7 @@ public class WarngenDialog extends CaveSWTDialog implements
}
private void changeSelected() {
if (validPeriodDlg == null || validPeriodDlg.isDisposed()) {
if ((validPeriodDlg == null) || validPeriodDlg.isDisposed()) {
validPeriodDlg = new ValidPeriodDialog(shell, startTime, endTime);
validPeriodDlg.setCloseCallback(new ICloseCallback() {
@ -1846,6 +1849,7 @@ public class WarngenDialog extends CaveSWTDialog implements
public void run() {
getDisplay().syncExec(new Runnable() {
@Override
public void run() {
try {
changeStartEndTimes();
@ -1872,6 +1876,7 @@ public class WarngenDialog extends CaveSWTDialog implements
public void run() {
getDisplay().syncExec(new Runnable() {
@Override
public void run() {
try {
recreateUpdates();
@ -1887,7 +1892,7 @@ public class WarngenDialog extends CaveSWTDialog implements
// Update the follow up list every minute
long currentTimeInSeconds = SimulatedTime.getSystemTime().getMillis() / 1000;
long secondsToNextMinute = 0;
if (currentTimeInSeconds % 60 != 0) {
if ((currentTimeInSeconds % 60) != 0) {
secondsToNextMinute = 60 - (currentTimeInSeconds % 60);
}
timer.schedule(recreateUpdatesTask, secondsToNextMinute * 1000,
@ -1909,7 +1914,7 @@ public class WarngenDialog extends CaveSWTDialog implements
FollowupData fd = (FollowupData) updateListCbo
.getData(updateListCbo.getItem(updateListCbo
.getSelectionIndex()));
if (fd == null
if ((fd == null)
|| (WarningAction.valueOf(fd.getAct()) == WarningAction.NEW)) {
startTime = TimeUtil.newCalendar();
endTime = DurationUtil.calcEndTime(this.startTime, duration);
@ -2179,7 +2184,7 @@ public class WarngenDialog extends CaveSWTDialog implements
* Set the shell to visible and then move it on top of the CAVE dialog.
*/
public void showDialog(boolean show) {
if (shell != null && shell.isDisposed() == false) {
if ((shell != null) && (shell.isDisposed() == false)) {
if (show) {
if (shell.isVisible() == false) {
shell.setVisible(true);
@ -2266,8 +2271,9 @@ public class WarngenDialog extends CaveSWTDialog implements
Polygon rval = gf.createPolygon(gf.createLinearRing(points
.toArray(new Coordinate[points.size()])), null);
if (adjusted)
if (adjusted) {
oldWarning.setGeometry(rval);
}
boolean invalidPolyFlag = false;
if (rval.isValid() == false) {
@ -2292,10 +2298,12 @@ public class WarngenDialog extends CaveSWTDialog implements
int size = coords.length;
java.util.List<Coordinate> coords2 = new ArrayList<Coordinate>();
coords2.add(coords[0]);
for (int i = 1; i < size; i++)
if (Math.abs(coords[i].x - coords[i - 1].x) > MIN_LATLON_DIFF
|| Math.abs(coords[i].y - coords[i - 1].y) > MIN_LATLON_DIFF)
for (int i = 1; i < size; i++) {
if ((Math.abs(coords[i].x - coords[i - 1].x) > MIN_LATLON_DIFF)
|| (Math.abs(coords[i].y - coords[i - 1].y) > MIN_LATLON_DIFF)) {
coords2.add(coords[i]);
}
}
size = coords2.size();
Coordinate[] coords3 = coords2.toArray(new Coordinate[size]);
return coords3;
@ -2308,7 +2316,7 @@ public class WarngenDialog extends CaveSWTDialog implements
double diffx1, diffx2, diffy1, diffy2;
double ratio1, ratio2;
boolean adjusted = false;
for (int i = 2; i < coords.length - 2; i++) {
for (int i = 2; i < (coords.length - 2); i++) {
diffx1 = coords[i - 1].x - coords[i].x;
if (Math.abs(diffx1) > MIN_LATLON_DIFF) {
ratio1 = (coords[i - 1].y - coords[i].y) / diffx1;
@ -2316,8 +2324,8 @@ public class WarngenDialog extends CaveSWTDialog implements
if (Math.abs(diffx2) > MIN_LATLON_DIFF) {
ratio2 = (coords[i].y - coords[i + 1].y) / diffx2;
if (Math.abs(ratio1 - ratio2) < MIN_DIFF) {
if (diffx1 > 0.0 && diffx2 > 0.0 || diffx1 < 0.0
&& diffx2 < 0.0) {
if (((diffx1 > 0.0) && (diffx2 > 0.0))
|| ((diffx1 < 0.0) && (diffx2 < 0.0))) {
// three vertices on a straight line. Not overlaid.
} else {
// two segments overlaid
@ -2335,8 +2343,8 @@ public class WarngenDialog extends CaveSWTDialog implements
if (Math.abs(diffy2) > MIN_LATLON_DIFF) {
ratio2 = (coords[i].x - coords[i + 1].x) / diffy2;
if (Math.abs(ratio1 - ratio2) < MIN_DIFF) {
if (diffy1 > 0.0 && diffy2 > 0.0 || diffy1 < 0.0
&& diffy2 < 0.0) {
if (((diffy1 > 0.0) && (diffy2 > 0.0))
|| ((diffy1 < 0.0) && (diffy2 < 0.0))) {
// three vertices on a straight line. Not overlaid.
} else {
// two segments overlaid
@ -2368,29 +2376,33 @@ public class WarngenDialog extends CaveSWTDialog implements
if (Math.abs(diffx) > MIN_LATLON_DIFF) {
if (coords[i - 1].y > coords[i].y) {
factor = 1;
} else
} else {
factor = -1;
}
if (diffx < 0.0) {
coords[i + 1].x -= factor * adjustedValue;
} else {
coords[i - 1].x += factor * adjustedValue;
}
if (i == n - 3)
if (i == (n - 3)) {
coords[0].x = coords[i - 1].x;
}
} else {
diffx = coords[i + 2].x - coords[i + 1].x;
if (Math.abs(diffx) > MIN_LATLON_DIFF) {
if (coords[i + 1].y > coords[i].y) {
factor = -1;
} else
} else {
factor = 1;
}
if (diffx < 0.0) {
coords[i - 1].x -= factor * adjustedValue;
} else {
coords[i + 1].x += factor * adjustedValue;
}
if (i == n - 3)
if (i == (n - 3)) {
coords[0].x = coords[i - 1].x;
}
}
}
} else {
@ -2399,29 +2411,33 @@ public class WarngenDialog extends CaveSWTDialog implements
if (Math.abs(diffy) > MIN_LATLON_DIFF) {
if (coords[i - 1].x > coords[i].x) {
factor = -1;
} else
} else {
factor = 1;
}
if (diffy > 0.0) {
coords[i + 1].y -= factor * adjustedValue;
} else {
coords[i - 1].y += factor * adjustedValue;
}
if (i == n - 3)
if (i == (n - 3)) {
coords[0].y = coords[i - 1].y;
}
} else {
diffy = coords[i + 2].y - coords[i + 1].y;
if (Math.abs(diffy) > MIN_LATLON_DIFF) {
if (coords[i + 1].x > coords[i].x) {
factor = -1;
} else
} else {
factor = 1;
}
if (diffy < 0.0) {
coords[i - 1].y -= factor * adjustedValue;
} else {
coords[i + 1].y += factor * adjustedValue;
}
if (i == n - 3)
if (i == (n - 3)) {
coords[0].y = coords[i - 1].y;
}
}
}
}