Merge changes I06189460,Ide604398 into omaha_16.2.2
* changes: Omaha #5316 Fix zoom and label menu item selection states in GHG Monitor Omaha #5618 Fix ifpClient to work with "chunked" grid requests. Former-commit-id: 77cb25d6a507267b95808b32f0fdaeff635c07ba
This commit is contained in:
commit
95a8fb4eea
6 changed files with 123 additions and 35 deletions
|
@ -86,7 +86,16 @@ import com.vividsolutions.jts.geom.Envelope;
|
|||
*/
|
||||
|
||||
public abstract class AbstractZoneSelector extends PaneManager {
|
||||
/**
|
||||
* Interface for zone selection listener
|
||||
*/
|
||||
public static interface IZoneSelectionListener {
|
||||
/**
|
||||
* Called when a zone is selected
|
||||
*
|
||||
* @param zone
|
||||
* selected zone
|
||||
*/
|
||||
public void zoneSelected(String zone);
|
||||
}
|
||||
|
||||
|
@ -161,15 +170,30 @@ public abstract class AbstractZoneSelector extends PaneManager {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the zoomLevel
|
||||
*
|
||||
* @param zoomLevel
|
||||
*/
|
||||
public void setZoomLevel(double zoomLevel) {
|
||||
this.zoomLevel = zoomLevel;
|
||||
updateZoom();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the zoomLevel
|
||||
*
|
||||
* @return the zoomLevel
|
||||
*/
|
||||
public double getZoomLevel() {
|
||||
return this.zoomLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set labelZones
|
||||
*
|
||||
* @param labelZones
|
||||
*/
|
||||
public void setLabelZones(boolean labelZones) {
|
||||
if (labelZones == this.labelZones) {
|
||||
return;
|
||||
|
@ -180,9 +204,23 @@ public abstract class AbstractZoneSelector extends PaneManager {
|
|||
}
|
||||
}
|
||||
|
||||
// command to limit the set of zones that are allowed to be part of the
|
||||
// zone combinations and maps. If set to None, then all items in
|
||||
// the maps are allowed.
|
||||
/**
|
||||
* Get labelZones
|
||||
*
|
||||
* @return labelZones
|
||||
*/
|
||||
public boolean isLabelZones() {
|
||||
return this.labelZones;
|
||||
}
|
||||
|
||||
/**
|
||||
* Command to limit the set of zones that are allowed to be part of the zone
|
||||
* combinations and maps. If set to None, then all items in the maps are
|
||||
* allowed.
|
||||
*
|
||||
* @param limitZones
|
||||
* list of allowable zones
|
||||
*/
|
||||
public void setLimitZones(List<String> limitZones) {
|
||||
if ((this.limitZoneNames == null) && (limitZones == null)) {
|
||||
return;
|
||||
|
|
|
@ -86,6 +86,8 @@ import com.raytheon.viz.gfe.core.griddata.IGridData;
|
|||
* 06/26/13 #2044 randerso Fixed error message priority
|
||||
* 04/03/2014 #2737 randerso Moved clientSendStatus from SaveGridRequest to SaveGFEGridRequest
|
||||
* 11/17/2015 #5129 dgilling Support new IFPClient.
|
||||
* 04/28/2016 #5618 randerso Changed "Unable to get grid" message from INFO to ERROR
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author chammack
|
||||
|
@ -348,8 +350,8 @@ public class DbParm extends Parm {
|
|||
}
|
||||
}
|
||||
for (IGridData grid : gridsNotReplaced) {
|
||||
statusHandler.handle(Priority.EVENTA, "Unable to get grid for "
|
||||
+ getParmID() + " tr=" + grid.getGridTime()
|
||||
statusHandler.error("Unable to get grid for " + getParmID()
|
||||
+ " tr=" + grid.getGridTime()
|
||||
+ ". Temporarily using default data");
|
||||
IGridData g = makeEmptyGrid();
|
||||
g.changeValidTime(grid.getGridTime(), false);
|
||||
|
|
|
@ -696,6 +696,7 @@ public class GhgMonitorDlg extends CaveSWTDialog implements
|
|||
MenuItem item = new MenuItem(mapMenu, SWT.RADIO);
|
||||
item.setText(zoom.toString());
|
||||
item.setData(zoom);
|
||||
item.setSelection(DEFAULT_ZOOM.equals(zoom));
|
||||
item.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
|
@ -706,17 +707,6 @@ public class GhgMonitorDlg extends CaveSWTDialog implements
|
|||
}
|
||||
});
|
||||
}
|
||||
mapMenu.addMenuListener(new MenuAdapter() {
|
||||
|
||||
@Override
|
||||
public void menuShown(MenuEvent e) {
|
||||
String mapName = ghgSpatialViewer.getCurrentMap();
|
||||
for (MenuItem item : mapMenu.getItems()) {
|
||||
item.setSelection(item.getText().endsWith(mapName));
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Menu Separator
|
||||
new MenuItem(mapMenu, SWT.SEPARATOR);
|
||||
|
@ -731,6 +721,28 @@ public class GhgMonitorDlg extends CaveSWTDialog implements
|
|||
ghgSpatialViewer.setLabelZones(item.getSelection());
|
||||
}
|
||||
});
|
||||
|
||||
mapMenu.addMenuListener(new MenuAdapter() {
|
||||
|
||||
@Override
|
||||
public void menuShown(MenuEvent e) {
|
||||
String mapName = ghgSpatialViewer.getCurrentMap();
|
||||
int zoomLevel = (int) Math.round(1.0 / ghgSpatialViewer
|
||||
.getZoomLevel());
|
||||
for (MenuItem item : mapMenu.getItems()) {
|
||||
Object data = item.getData();
|
||||
if (data instanceof String) {
|
||||
item.setSelection(mapName.equals(data));
|
||||
} else if (data instanceof ZoomLevel) {
|
||||
item.setSelection(zoomLevel == ((ZoomLevel) data)
|
||||
.getZoomLevel());
|
||||
} else {
|
||||
item.setSelection(ghgSpatialViewer.isLabelZones());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private void showMap(String mapName) {
|
||||
|
|
|
@ -998,6 +998,11 @@ public class D2DGridDatabase extends VGridDatabase {
|
|||
vRecord = d2dDao.getGrid(d2dModelName, refTime, "vW",
|
||||
windParm.getLevel(), fcstHr, gpi);
|
||||
|
||||
if ((uRecord == null) || (vRecord == null)) {
|
||||
throw new GfeException("No data available for " + parmId
|
||||
+ " for time range " + timeRange);
|
||||
}
|
||||
|
||||
// Gets the raw grid data from the D2D grib HDF5 files
|
||||
Grid2DFloat uData = getRawGridData(uRecord);
|
||||
Grid2DFloat vData = getRawGridData(vRecord);
|
||||
|
@ -1035,6 +1040,11 @@ public class D2DGridDatabase extends VGridDatabase {
|
|||
dRecord = d2dDao.getGrid(d2dModelName, refTime, "WD",
|
||||
windParm.getLevel(), fcstHr, gpi);
|
||||
|
||||
if ((sRecord == null) || (dRecord == null)) {
|
||||
throw new GfeException("No data available for " + parmId
|
||||
+ " for time range " + timeRange);
|
||||
}
|
||||
|
||||
// Gets the raw grid data from the D2D grib HDF5 files
|
||||
Grid2DFloat sData = getRawGridData(sRecord);
|
||||
Grid2DFloat dData = getRawGridData(dRecord);
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
-->
|
||||
<gridParamInfo xmlns:ns2="group">
|
||||
<valtimeMINUSreftime>
|
||||
<fcst>237600</fcst>
|
||||
<fcst>259200</fcst>
|
||||
<fcst>280800</fcst>
|
||||
<fcst>302400</fcst>
|
||||
<fcst>324000</fcst>
|
||||
<fcst>345600</fcst>
|
||||
|
|
|
@ -118,9 +118,10 @@ import com.raytheon.uf.common.time.TimeRange;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 13, 2015 #5129 dgilling Initial creation
|
||||
* Feb 05, 2016 #5242 dgilling Replace calls to deprecated Localization APIs.
|
||||
* Feb 24, 2016 #5129 dgilling Change how PyFPClient is constructed.
|
||||
* Nov 13, 2015 #5129 dgilling Initial creation
|
||||
* Feb 05, 2016 #5242 dgilling Replace calls to deprecated Localization APIs.
|
||||
* Feb 24, 2016 #5129 dgilling Change how PyFPClient is constructed.
|
||||
* Apr 28, 2016 #5618 randerso Fix getGridData to handle "chunked" response.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -442,29 +443,51 @@ public class IFPClient {
|
|||
/**
|
||||
* Retrieves grid data identified by the get grid request.
|
||||
*
|
||||
* @param request
|
||||
* @param getRequest
|
||||
* The get grid request.
|
||||
* @return Status of the request as a {@code ServerResponse}. Payload
|
||||
* contains the data as {@code IGridSlice}s.
|
||||
*/
|
||||
public ServerResponse<List<IGridSlice>> getGridData(GetGridRequest request) {
|
||||
return getGridData(Arrays.asList(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves grid data identified by the sequence of get grid requests.
|
||||
*
|
||||
* @param getRequest
|
||||
* The get grid requests.
|
||||
* @return Status of the request as a {@code ServerResponse}. Payload
|
||||
* contains the data as {@code IGridSlice}s.
|
||||
*/
|
||||
public ServerResponse<List<IGridSlice>> getGridData(
|
||||
List<GetGridRequest> getRequest) {
|
||||
GetGridRequest getRequest) {
|
||||
GetGridDataRequest request = new GetGridDataRequest();
|
||||
request.setRequests(getRequest);
|
||||
request.addRequest(getRequest);
|
||||
|
||||
return (ServerResponse<List<IGridSlice>>) makeRequest(request);
|
||||
ServerResponse<List<IGridSlice>> sr = new ServerResponse<>();
|
||||
|
||||
ParmID parmId = getRequest.getParmId();
|
||||
List<TimeRange> gridTimes = getRequest.getTimes();
|
||||
List<IGridSlice> slices = new ArrayList<IGridSlice>(gridTimes.size());
|
||||
while (slices.size() < gridTimes.size()) {
|
||||
@SuppressWarnings("unchecked")
|
||||
ServerResponse<List<IGridSlice>> resp = (ServerResponse<List<IGridSlice>>) makeRequest(request);
|
||||
if (resp.isOkay()) {
|
||||
slices.addAll(resp.getPayload());
|
||||
|
||||
// if no slices returned (shouldn't happen unless server code is
|
||||
// broken)
|
||||
if (slices.isEmpty()) {
|
||||
String msg = "No data returned from GetGridDataRequest for "
|
||||
+ parmId + " for times:" + getRequest.getTimes();
|
||||
statusHandler.error(msg);
|
||||
sr.addMessage(msg);
|
||||
break;
|
||||
}
|
||||
|
||||
// if not all slices returned
|
||||
if (slices.size() < gridTimes.size()) {
|
||||
// request remaining times.
|
||||
getRequest.setTimes(gridTimes.subList(slices.size(),
|
||||
gridTimes.size()));
|
||||
}
|
||||
} else {
|
||||
sr.addMessages(resp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
sr.setPayload(slices);
|
||||
return sr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue