Issue #2160 - Fix for MPE display 7x7 dialog, field changes

Change-Id: Ib428d1aab246863bfdbbb271d27a4687197a3ebe

Former-commit-id: 1fbaa2721a4b2d79a06c1d4d8b8526b5b25150a9
This commit is contained in:
Mike Duff 2013-07-02 12:31:10 -05:00
parent 37042f0b2a
commit 655d9eb928
4 changed files with 62 additions and 23 deletions

View file

@ -102,6 +102,7 @@ import com.raytheon.viz.ui.editor.IMultiPaneEditor;
* Mar 14, 2013 1457 mpduff Reset the gages on the resource. * Mar 14, 2013 1457 mpduff Reset the gages on the resource.
* Apr 18, 2013 1920 mpduff Added updateGages method to reload the gage data, * Apr 18, 2013 1920 mpduff Added updateGages method to reload the gage data,
* fix formatting of legend for Base field Height. * fix formatting of legend for Base field Height.
* Jul 02, 2013 2160 mpduff Initialize newly displayed resources.
* *
* </pre> * </pre>
* *
@ -728,6 +729,19 @@ public class MPEDisplayManager {
new LoadProperties()); new LoadProperties());
list.add(displayedFieldResource); list.add(displayedFieldResource);
IDisplayPaneContainer container = display.getContainer();
for (IDisplayPane pane : container.getDisplayPanes()) {
if (pane.getRenderableDisplay() == display) {
try {
displayedFieldResource.init(pane.getTarget());
break;
} catch (VizException e) {
Activator.statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
}
}
}
if (oldField != fieldToDisplay) { if (oldField != fieldToDisplay) {
List<IDisplayFieldChangedListener> listeners = new ArrayList<IDisplayFieldChangedListener>(); List<IDisplayFieldChangedListener> listeners = new ArrayList<IDisplayFieldChangedListener>();
synchronized (fieldChangedListeners) { synchronized (fieldChangedListeners) {
@ -1049,7 +1063,7 @@ public class MPEDisplayManager {
entries[i].setLabel(""); entries[i].setLabel("");
} }
} }
} }
return params; return params;
} }

View file

@ -68,11 +68,12 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Sep 2, 2008 randerso Initial creation * Sep 02, 2008 randerso Initial creation
* May 01,2013 15920 lbousaidi gages get updated after clicking on * May 01, 2013 15920 lbousaidi gages get updated after clicking on
* Regenerate Hour Fields without closing 7x7 Gui. * Regenerate Hour Fields without closing 7x7 Gui.
* Jun 05,2013 15961 lbousaidi added routines for set Bad/set not bad buttons * Jun 05, 2013 15961 lbousaidi added routines for set Bad/set not bad buttons
* to reflect the state of the gages. * to reflect the state of the gages.
* Jul 02, 2013 2160 mpduff Changed to not call deprecated resource.getData() method.
* </pre> * </pre>
* *
* @author randerso * @author randerso
@ -116,7 +117,7 @@ public class Display7x7Dialog extends CaveSWTDialog {
private static Rectangle extent; private static Rectangle extent;
private MPEFieldResource resource; private MPEFieldResource resource;
private static MPEGageData selectedGage; private static MPEGageData selectedGage;
private static MPEGageData workingGage; private static MPEGageData workingGage;
@ -131,7 +132,7 @@ public class Display7x7Dialog extends CaveSWTDialog {
private ColorMapParameters parameters; private ColorMapParameters parameters;
private DisplayFieldData[] displayTypes = MPEDisplayManager.mpe_qpe_fields; private final DisplayFieldData[] displayTypes = MPEDisplayManager.mpe_qpe_fields;
private Combo prodSetCbo; private Combo prodSetCbo;
@ -183,7 +184,7 @@ public class Display7x7Dialog extends CaveSWTDialog {
if (gData != null) { if (gData != null) {
workingGage = new MPEDataManager.MPEGageData(); workingGage = new MPEDataManager.MPEGageData();
workingGage = gData; workingGage = gData;
} else if (editGage.containsKey(selectedGage.getId())) { } else if (editGage.containsKey(selectedGage.getId())) {
workingGage = editGage.get(selectedGage.getId()); workingGage = editGage.get(selectedGage.getId());
undoEn = true; undoEn = true;
@ -268,7 +269,9 @@ public class Display7x7Dialog extends CaveSWTDialog {
} }
try { try {
short[] xmData = resource.getData(); short[] xmData = resource.getData(MPEDisplayManager
.getCurrent().getCurrentDisplayedDate());
for (int i = 0; i < 7; ++i) { for (int i = 0; i < 7; ++i) {
for (int j = 0; j < 7; ++j) { for (int j = 0; j < 7; ++j) {
short val = -999; short val = -999;
@ -485,7 +488,7 @@ public class Display7x7Dialog extends CaveSWTDialog {
undoMissing.setEnabled(undoEn); undoMissing.setEnabled(undoEn);
String wid = workingGage.getId(); String wid = workingGage.getId();
editGage.put(wid, workingGage); editGage.put(wid, workingGage);
if (!editGage.isEmpty()) { if (!editGage.isEmpty()) {
Iterator<MPEGageData> x = editGage.values().iterator(); Iterator<MPEGageData> x = editGage.values().iterator();
for (int i = 0; i < editGage.size(); i++) { for (int i = 0; i < editGage.size(); i++) {
@ -568,7 +571,7 @@ public class Display7x7Dialog extends CaveSWTDialog {
oldManedit = workingGage.isManedit(); oldManedit = workingGage.isManedit();
workingGage.setManedit(true); workingGage.setManedit(true);
editGage.put(wid, workingGage); editGage.put(wid, workingGage);
if (!editGage.isEmpty()) { if (!editGage.isEmpty()) {
Iterator<MPEGageData> x = editGage.values().iterator(); Iterator<MPEGageData> x = editGage.values().iterator();
for (int i = 0; i < editGage.size(); i++) { for (int i = 0; i < editGage.size(); i++) {
@ -621,11 +624,11 @@ public class Display7x7Dialog extends CaveSWTDialog {
badGage.remove(wid); badGage.remove(wid);
notBadGage.add(wid); notBadGage.add(wid);
MPEDataManager.getInstance().addEditedGage(workingGage); MPEDataManager.getInstance().addEditedGage(workingGage);
//remove bad gage from list // remove bad gage from list
if (!notBadGage.isEmpty() && !editGage.isEmpty()) { if (!notBadGage.isEmpty() && !editGage.isEmpty()) {
for (int i = 0; i < notBadGage.size(); i++) { for (int i = 0; i < notBadGage.size(); i++) {
String gd = notBadGage.get(i); String gd = notBadGage.get(i);
MPEDataManager.getInstance().removeBadGage(gd); MPEDataManager.getInstance().removeBadGage(gd);
} }
} }
if ((workingGage.getGval() == -999.f) if ((workingGage.getGval() == -999.f)
@ -639,7 +642,7 @@ public class Display7x7Dialog extends CaveSWTDialog {
gval = String.format("%.2f", workingGage.getGval()); gval = String.format("%.2f", workingGage.getGval());
String xval = gval + " in."; String xval = gval + " in.";
gageValue.setText(xval); gageValue.setText(xval);
workingGage.setEdit(gval); workingGage.setEdit(gval);
valueLabel.setText(gval); valueLabel.setText(gval);
valueScale.setSelection(((int) (100 * Float valueScale.setSelection(((int) (100 * Float
.parseFloat(gval)))); .parseFloat(gval))));
@ -663,7 +666,7 @@ public class Display7x7Dialog extends CaveSWTDialog {
notBadGage.remove(wid); notBadGage.remove(wid);
} }
setBad.setText("Set Not Bad"); setBad.setText("Set Not Bad");
//add bad gage to the list. // add bad gage to the list.
if (!badGage.isEmpty() && !editGage.isEmpty()) { if (!badGage.isEmpty() && !editGage.isEmpty()) {
for (int i = 0; i < badGage.size(); i++) { for (int i = 0; i < badGage.size(); i++) {
String gd = badGage.get(i); String gd = badGage.get(i);
@ -671,7 +674,7 @@ public class Display7x7Dialog extends CaveSWTDialog {
} }
} }
} }
//when you set bad or not bad add gage or remove it from list // when you set bad or not bad add gage or remove it from list
if ((!notBadGage.isEmpty() || !badGage.isEmpty()) if ((!notBadGage.isEmpty() || !badGage.isEmpty())
&& !editGage.isEmpty()) { && !editGage.isEmpty()) {
MPEDataManager.getInstance().writeBadGageList(); MPEDataManager.getInstance().writeBadGageList();
@ -927,10 +930,10 @@ public class Display7x7Dialog extends CaveSWTDialog {
if (gageVal.equalsIgnoreCase("bad")) { if (gageVal.equalsIgnoreCase("bad")) {
setBad.setText("Set Not Bad"); setBad.setText("Set Not Bad");
} else { } else {
setBad.setText("Set Bad"); setBad.setText("Set Bad");
} }
undoMissing.setEnabled(false); undoMissing.setEnabled(false);
updateGridField(displayTypes[prodSetCbo.getSelectionIndex()]); updateGridField(displayTypes[prodSetCbo.getSelectionIndex()]);
} }
@ -938,7 +941,7 @@ public class Display7x7Dialog extends CaveSWTDialog {
MPEDisplayManager mgr = MPEDisplayManager.getCurrent(); MPEDisplayManager mgr = MPEDisplayManager.getCurrent();
if (selectedFieldData != fieldType) { if (selectedFieldData != fieldType) {
selectedFieldData = fieldType; selectedFieldData = fieldType;
mgr.displayFieldData(fieldType); mgr.displayFieldData(fieldType);
} }
populateGrid(); populateGrid();
gridComp.notifyListeners(SWT.Paint, new Event()); gridComp.notifyListeners(SWT.Paint, new Event());

View file

@ -21,6 +21,7 @@ package com.raytheon.viz.mpe.ui.rsc;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -64,7 +65,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Dec 6, 2012 mschenke Initial creation * Dec 06, 2012 mschenke Initial creation.
* Jul 02, 2013 2160 mpduff Added convenience method getData(Date)
* *
* </pre> * </pre>
* *
@ -297,11 +299,31 @@ public abstract class AbstractGriddedMPEResource<T extends AbstractMPEGriddedRes
return getData(lastPainted); return getData(lastPainted);
} }
/**
* Get the data.
*
* @param time
* date of the data
* @return the Data
* @throws VizException
*/
public short[] getData(DataTime time) throws VizException { public short[] getData(DataTime time) throws VizException {
Frame frame = getFrame(time); Frame frame = getFrame(time);
return frame.data; return frame.data;
} }
/**
* Get the data.
*
* @param date
* date of the data
* @return the Data
* @throws VizException
*/
public short[] getData(Date date) throws VizException {
return getData(new DataTime(date));
}
/** /**
* Returns the hrap subgrid extent * Returns the hrap subgrid extent
* *

View file

@ -73,8 +73,8 @@ import com.raytheon.viz.mpe.ui.rsc.MPEFieldResourceData.MPEFieldFrame;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Nov 29, 2012 mschenke Initial creation * Nov 29, 2012 mschenke Initial creation.
* * Jul 02, 2013 2160 mpduff Changed how edited data are called for return.
* </pre> * </pre>
* *
* @author mschenke * @author mschenke
@ -242,7 +242,7 @@ public class MPEFieldResource extends
@Override @Override
public short[] getData(DataTime time) throws VizException { public short[] getData(DataTime time) throws VizException {
MPEFieldFrame frame = getFrame(time); MPEFieldFrame frame = getFrame(time);
return frame.getEditedData(); return getEditedData(frame);
} }
/* /*