Merge branch 'master_13.5.1' into omaha_13.5.1

Conflicts:
	edexOsgi/com.raytheon.uf.common.dataplugin.ffmp/src/com/raytheon/uf/common/dataplugin/ffmp/FFMPBasinData.java

Former-commit-id: b08ce25ac8 [formerly d79f0ffacc775ed4dc49bcf35adacf4fded994d3]
Former-commit-id: ffb2bea8ad
This commit is contained in:
Greg Armendariz 2013-08-08 16:24:39 -05:00
commit 566532c40d
72 changed files with 137704 additions and 268019 deletions

File diff suppressed because it is too large Load diff

View file

@ -87,8 +87,8 @@ public class NSharpPrintScreenAction extends PrintScreenAction {
if (frameMode == null || frameMode.equalsIgnoreCase("current")) {
// selection doesn't seem to work.
pd.setScope(PrinterData.PAGE_RANGE);
pd.setStartPage(NsharpFrameIndexUtil.getCurrentIndex(handler) + 1);
pd.setEndPage(NsharpFrameIndexUtil.getCurrentIndex(handler) + 1);
pd.setStartPage(handler.getCurrentIndex()+1);//Chin NsharpFrameIndexUtil.getCurrentIndex(handler) + 1);
pd.setEndPage(handler.getCurrentIndex()+1); // Chin NsharpFrameIndexUtil.getCurrentIndex(handler) + 1);
} else if (frameMode.equalsIgnoreCase("all")) {
pd.setScope(PrinterData.ALL_PAGES);
} else {
@ -138,24 +138,26 @@ public class NSharpPrintScreenAction extends PrintScreenAction {
private void printAllFrames(NsharpPrintHandle printer, NsharpEditor editor)
throws VizException {
printFrames(printer, editor, 0, NsharpFrameIndexUtil.getFrameCount(editor.getRscHandler()));
printFrames(printer, editor, 0, editor.getRscHandler().getFrameCount()); //Chin NsharpFrameIndexUtil.getFrameCount(editor.getRscHandler()));
}
private void printFrames(NsharpPrintHandle printer, NsharpEditor editor,
int startIndex, int endIndex) throws VizException {
NsharpResourceHandler handler = ((NsharpEditor) editor).getRscHandler();
IDisplayPane pane = editor.getActiveDisplayPane();
int startingIndex = NsharpFrameIndexUtil.getCurrentIndex(handler);
int startingIndex = handler.getCurrentIndex();//Chin NsharpFrameIndexUtil.getCurrentIndex(handler);
LoopProperties loopProperties = ((AbstractEditor) editor)
.getLoopProperties();
renderPane(pane, loopProperties);
for (int i = startIndex; i < endIndex; i++) {
NsharpFrameIndexUtil.setCurrentIndex(handler, i);
//Chin NsharpFrameIndexUtil.setCurrentIndex(handler, i);
if(handler.setCurrentIndex(i)== false)
continue;
pane.refresh();
renderPane(pane, loopProperties);
printImage(printer);
}
NsharpFrameIndexUtil.setCurrentIndex(handler, startingIndex);
handler.setCurrentIndex(startingIndex); // Chin NsharpFrameIndexUtil.setCurrentIndex(handler, startingIndex);
pane.refresh();
renderPane(pane, loopProperties);
}

View file

@ -62,7 +62,7 @@ public class NSharpSaveScreenAction extends SaveScreenAction {
}
NsharpResourceHandler handler = ((NsharpEditor) editor).getRscHandler();
int startIndex = 0;
int endIndex = NsharpFrameIndexUtil.getFrameCount(handler);
int endIndex = handler .getFrameCount(); // Chin NsharpFrameIndexUtil.getFrameCount(handler);
return captureFrames(editor, startIndex, endIndex);
}
@ -75,18 +75,20 @@ public class NSharpSaveScreenAction extends SaveScreenAction {
IDisplayPane pane = editor.getActiveDisplayPane();
NsharpResourceHandler handler = ((NsharpEditor) editor).getRscHandler();
// save the frame we are on;
int startingIndex = NsharpFrameIndexUtil.getCurrentIndex(handler);
int startingIndex = handler.getCurrentIndex(); // Chin NsharpFrameIndexUtil.getCurrentIndex(handler);
List<BufferedImage> images = new ArrayList<BufferedImage>();
LoopProperties loopProperties = ((AbstractEditor) editor)
.getLoopProperties();
renderPane(pane, loopProperties);
for (int i = startIndex; i < endIndex; i++) {
NsharpFrameIndexUtil.setCurrentIndex(handler, i);
//Chin NsharpFrameIndexUtil.setCurrentIndex(handler, i);
if(handler.setCurrentIndex(i)== false)
continue;
pane.refresh();
renderPane(pane, loopProperties);
images.add(captureCurrentFrames(editor));
}
NsharpFrameIndexUtil.setCurrentIndex(handler, startingIndex);
handler.setCurrentIndex(startingIndex); // Chin NsharpFrameIndexUtil.setCurrentIndex(handler, startingIndex);
pane.refresh();
renderPane(pane, loopProperties);
return images;

View file

@ -46,7 +46,7 @@ import com.raytheon.uf.viz.core.drawables.IFrameCoordinator.FrameChangeOperation
*/
public class NsharpFrameIndexUtil {
/* Chin
public static int getFrameCount(NsharpResourceHandler handler){
int count = 0;
for (List<NsharpSoundingElementStateProperty> list : handler.getStnTimeTable()) {
@ -104,5 +104,5 @@ public class NsharpFrameIndexUtil {
current = handler.getCurSndProfileProp();
}
}
*/
}

View file

@ -99,6 +99,7 @@ import com.raytheon.uf.viz.monitor.listeners.IMonitorListener;
* Jun 07, 2013 2075 njensen Extracted FFMPProcessUris to separate class
* Jul 09, 2013 2152 njensen Synchronize uri requests to avoid duplicating effort
* Jul 15, 2013 2184 dhladky Remove all HUC's for storage except ALL
* Jul 16, 2013 2197 njensen Use FFMPBasinData.hasAnyBasins() for efficiency
*
* </pre>
*
@ -295,6 +296,7 @@ public class FFMPMonitor extends ResourceMonitor {
* @param phuc
* @return
*/
protected List<String> getLoadedUris(String siteKey, String source) {
FFMPSiteData siteData = siteDataMap.get(siteKey);
FFMPSourceData sourceData = siteData.getSourceData(source);
@ -333,6 +335,7 @@ public class FFMPMonitor extends ResourceMonitor {
try {
populateFFMPRecord(siteKey, new FFMPRecord(
uri), source);
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM,
"FFMP Can't retrieve FFMP URI, "
@ -787,11 +790,13 @@ public class FFMPMonitor extends ResourceMonitor {
} else {
populateFFMPRecord(siteKey, dataKey, sourceName,
ptime, retrieveNew);
}
}
} else {
populateFFMPRecord(siteKey, dataKey, sourceName, ptime,
retrieveNew);
}
} else {
// special case where FFG is the primary source
@ -1651,6 +1656,7 @@ public class FFMPMonitor extends ResourceMonitor {
public void processUris(NavigableMap<Date, List<String>> uriMap,
String siteKey, String sourceName, Date barrierTime,
SubMonitor smonitor) {
FFMPProcessUris processor = new FFMPProcessUris(this, uriMap, siteKey,
sourceName, barrierTime);
processor.run(smonitor);
@ -2191,6 +2197,7 @@ public class FFMPMonitor extends ResourceMonitor {
statusHandler.handle(Priority.PROBLEM,
"FFMP Can't retrieve FFMP URI, " + dataUri, e);
}
sourceData.addLoadedUri(dataUri);
}
}

View file

@ -79,6 +79,7 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FfmpTableConfigData;
* multi-threaded row creation.
* July 1, 2013 2155 dhladky Fixed bug that created more rows than were actually needed.
* Jul 15, 2013 2184 dhladky Remove all HUC's for storage except ALL
* Jul 16, 2013 2197 njensen Use FFMPBasinData.hasAnyBasins() for efficiency
*
* </pre>
*
@ -163,7 +164,9 @@ public class FFMPDataGenerator {
* @return FFMPTableData object
* @throws Exception
*/
public FFMPTableData generateFFMPData() throws Exception {
// You should always have at least a QPE data source
FFMPTableData tData = null;
// update the FFFGDataManager
@ -174,23 +177,27 @@ public class FFMPDataGenerator {
FIELDS field = getBaseField();
if (field == null || baseRec == null) {
return tData;
}
List<DomainXML> domains = resource.getDomains();
if ((centeredAggregationKey == null) || huc.equals(FFMPRecord.ALL)) {
// System.out.println(fbd.getBasins().keySet().size()
// + " rows in the table");
if (huc.equals(FFMPRecord.ALL)) {
FFMPBasinData fbd = baseRec.getBasinData();
tData = new FFMPTableData(fbd.getBasins().size());
for (Long key : fbd.getBasins().keySet()) {
FFMPBasinMetaData fmdb = ft.getBasin(siteKey, key);
if (fmdb == null) {
continue;
}
for (DomainXML domain : domains) {
@ -200,26 +207,36 @@ public class FFMPDataGenerator {
if ((cwa.equals(fmdb.getCwa()))
|| (domain.isPrimary() && fmdb
.isPrimaryCwa())) {
try {
setFFMPRow(fbd.get(key), tData, false, cwa);
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM,
"Couldn't create table row", e);
}
if (virtualBasin != null) {
for (Long id : ft
.getVirtualGageBasinLookupIds(
siteKey, key, huc,
resource.basinTableDlg
.getRowName())) {
try {
setFFMPRow(virtualBasin.get(id),
tData, true, cwa);
} catch (Exception e) {
statusHandler.handle(
Priority.PROBLEM,
"Couldn't create table row"
+ e);
}
}
}
@ -237,9 +254,10 @@ public class FFMPDataGenerator {
List<Long> pfafs = ft.getAggregatePfafs(key, siteKey,
huc);
boolean isVGB = false;
if (ft.checkVGBsInAggregate(key, siteKey, huc)) {
isVGB = true;
}
@ -249,23 +267,28 @@ public class FFMPDataGenerator {
siteKey, domains, pfafs);
if (fmdb != null) {
try {
FFMPBasin basin = new FFMPBasin(key, true);
setFFMPRow(basin, tData, isVGB, null);
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM,
"Couldn't create table row", e);
}
}
}
}
}
}
// show pfafs in aggregation
else {
FFMPBasinData fbd = baseRec.getBasinData();
List<Long> centerAggPfafs = resource
.getCenteredAggregatePfafs();
@ -288,6 +311,7 @@ public class FFMPDataGenerator {
// We *DO NOT* want all of the aggregate
// VGB's,
// just the one's for this individual basin.
List<Long> virtuals = ft
.getVirtualGageBasinLookupIds(
siteKey, key,
@ -299,7 +323,9 @@ public class FFMPDataGenerator {
try {
setFFMPRow(virtualBasin.get(id),
tData, true, null);
} catch (Exception e) {
statusHandler
.handle(Priority.PROBLEM,
"Couldn't create table row",
@ -312,17 +338,23 @@ public class FFMPDataGenerator {
}
}
}
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM,
"Failed to load FFMP table data!", e);
}
// wait for all the rows to finish being created before continuing on
long t0 = System.currentTimeMillis();
jobPool.join();
System.out.println("Waited on FFMP job pool for: "
+ (System.currentTimeMillis() - t0));
return tData;
}
private void setFFMPRow(FFMPBasin cBasin, FFMPTableData tData,
@ -368,7 +400,6 @@ public class FFMPDataGenerator {
}
monitor.setQpeWindow(new FFMPTimeWindow(tableTime, qpeTime));
FFMPRecord rateRecord = monitor.getRateRecord(product, siteKey,
dataKey, product.getRate(), paintRefTime, true);
FFMPRecord qpeRecord = monitor.getQPERecord(product, siteKey, dataKey,
@ -391,6 +422,7 @@ public class FFMPDataGenerator {
if (qpeRecord != null) {
qpeBasin = qpeRecord.getBasinData();
if (!qpeBasin.getBasins().isEmpty()) {
field = FIELDS.QPE;
if (baseRec == null) {
baseRec = qpeRecord;

View file

@ -171,7 +171,7 @@ import com.vividsolutions.jts.geom.Point;
* refactored updates
* Jun 27, 2013 2152 njensen More thorough disposeInternal()
* Jul 15, 2013 2184 dhladky Remove all HUC's for storage except ALL
*
* Jul 17, 2013 2197 njensen Improved speed of getName()
*
* </pre>
*
@ -866,23 +866,10 @@ public class FFMPResource extends
sfield = FFMPRecord.FIELDS.QPE;
}
PluginDataObject pdo = null;
try {
pdo = getRecord(sfield, paintTime.getRefTime());
} catch (NullPointerException npe) {
return "No Data Available";
}
if (pdo == null) {
return "No Data Available";
}
FFMPRecord record = (FFMPRecord) pdo;
prefix = new StringBuilder();
prefix.append(record.getPluginName());
prefix.append("ffmp");
prefix.append(" ");
prefix.append(record.getSiteKey());
prefix.append(resourceData.siteKey);
prefix.append(" ");
if (getResourceData().tableLoad) {
prefix.append("Table Display ");

View file

@ -81,6 +81,7 @@ import com.raytheon.uf.viz.monitor.ffmp.xml.FFMPConfigBasinXML;
* Apr 26, 2013 1954 bsteffen Minor code cleanup throughout FFMP.
* Jun 06, 2013 2075 njensen Use new load jobs
* Jul 15, 2013 2184 dhladky Remove all HUC's for storage except ALL
* Jul 17, 2013 2197 njensen Broke background loading into chunks
*
* </pre>
*
@ -215,6 +216,7 @@ public class FFMPResourceData extends AbstractRequestableResourceData {
final double configTimeFrame = cfgBasinXML.getTimeFrame();
final Date timeBack = new Date(
(long) (mostRecentTime.getTime() - (configTimeFrame * TimeUtil.MILLIS_PER_HOUR)));
final List<String> onlyAllHuc = new ArrayList<String>();
onlyAllHuc.add(FFMPRecord.ALL);
InitialLoadJob initialJob = new InitialLoadJob(this, timeBack,
@ -232,6 +234,7 @@ public class FFMPResourceData extends AbstractRequestableResourceData {
backgroundStartTime, timeBack, onlyAllHuc);
backgroundJob.setPreloadAvailableUris(true);
backgroundJob.schedule();
}
});
initialJob.schedule();
@ -241,6 +244,7 @@ public class FFMPResourceData extends AbstractRequestableResourceData {
// will be faster
List<String> earlyLoadHucs = new ArrayList<String>();
earlyLoadHucs.addAll(onlyAllHuc);
for (String otherHuc : FFMPTemplateConfigurationManager
.getInstance().getHucLevels()) {
if (!earlyLoadHucs.contains(otherHuc)) {
@ -291,12 +295,12 @@ public class FFMPResourceData extends AbstractRequestableResourceData {
standAloneTime);
monitor.processUris(sourceURIs, siteKey, sourceName,
standAloneTime, SubMonitor.convert(null));
}
}
}
return new FFMPResource(this, loadProperties);
}
/**

View file

@ -19,6 +19,7 @@
**/
package com.raytheon.uf.viz.monitor.ffmp.ui.thread;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.NavigableMap;
@ -51,6 +52,9 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.rsc.FFMPResourceData;
public class BackgroundLoadJob extends AbstractLoadJob {
private static final SimpleDateFormat sdf = new SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss");
protected boolean preloadAvailableUris = false;
public BackgroundLoadJob(String name, FFMPResourceData resourceData,
@ -66,6 +70,9 @@ public class BackgroundLoadJob extends AbstractLoadJob {
*/
@Override
protected IStatus run(IProgressMonitor monitor) {
System.out.println("FFMP background load job running for: "
+ sdf.format(startTime) + " to " + sdf.format(endTime));
try {
SubMonitor smonitor = SubMonitor.convert(monitor, "Loading Data",
2500);

View file

@ -709,7 +709,6 @@ public class MPEDisplayManager {
|| accumulationHrs != displayedAccumHrs
|| arealDisplay != displayedArealDisplay) {
DisplayFieldData oldField = displayedField;
displayedField = fieldToDisplay;
displayedAccumHrs = accumulationHrs;
displayedArealDisplay = arealDisplay;
@ -737,7 +736,7 @@ public class MPEDisplayManager {
listener.displayFieldChanged(oldField, fieldToDisplay);
}
}
}
}
displayedFieldResource.issueRefresh();
}
@ -1013,7 +1012,7 @@ public class MPEDisplayManager {
.convert((short) displayToData.convert(threshold)));
if (displayField != DisplayFieldData.Index) {
entry.setLabel(format.format(threshold));
}
}
}
entry.setPixelValue((double) i);
@ -1049,7 +1048,7 @@ public class MPEDisplayManager {
entries[i].setLabel("");
}
}
}
}
return params;
}

View file

@ -27,8 +27,12 @@ import java.util.Map;
import java.util.TimeZone;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Font;
@ -64,7 +68,7 @@ import com.raytheon.viz.mpe.ui.radartable.ReadBiasTableParam;
* ------------ ---------- ----------- --------------------------
* Jul 14, 2009 snaples Initial creation
* Jun 18, 2013 16053 snaples Removed reference to setRadarEditFlag
*
* Aug 06, 2013 16243 Changed the Gui to a ScrolledComposite.
* </pre>
*
* @author snaples
@ -311,9 +315,17 @@ public class RadarBiasTableDialog extends Dialog {
*/
private void createBiasListComp() {
// Create a container to hold the label and the combo box.
final ScrolledComposite biasListScrollComp = new ScrolledComposite(
shell, SWT.BORDER | SWT.V_SCROLL);
GridLayout gl = new GridLayout(1, false);
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, true);
Composite biasListComp = new Composite(bcLblComp, SWT.V_SCROLL);
gd.heightHint = 300;
biasListScrollComp.setLayout(gl);
biasListScrollComp.setLayoutData(gd);
// Create a container to hold the label and the combo box.
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, true);
final Composite biasListComp = new Composite(biasListScrollComp,
SWT.BORDER);
GridLayout biasListCompLayout = new GridLayout(7, true);
biasListComp.setLayout(biasListCompLayout);
gd.horizontalSpan = 7;
@ -386,7 +398,7 @@ public class RadarBiasTableDialog extends Dialog {
gd = new GridData(SWT.FILL, SWT.CENTER, true, true);
final Text lbiasTxt = new Text(biasListComp, SWT.SINGLE
| SWT.CENTER);
| SWT.CENTER | SWT.BORDER);
if (radarresultdata.getProductDate() == null) {
ridBtn.setEnabled(false);
}
@ -476,6 +488,16 @@ public class RadarBiasTableDialog extends Dialog {
offcLbl.setText(ooffice);
offcLbl.setLayoutData(gd);
}
biasListScrollComp.setContent(biasListComp);
biasListScrollComp.setExpandVertical(true);
biasListScrollComp.setExpandHorizontal(true);
biasListScrollComp.addControlListener(new ControlAdapter() {
public void controlResized(ControlEvent e) {
Rectangle r = biasListScrollComp.getClientArea();
biasListScrollComp.setMinSize(biasListComp.computeSize(r.width,
SWT.DEFAULT));
}
});
}
private void applyBiasUpdate(String obstime) {

View file

@ -39,7 +39,6 @@ import org.eclipse.swt.widgets.Spinner;
import com.raytheon.uf.common.dataplugin.shef.tables.Rwradarresult;
import com.raytheon.viz.hydrocommon.whfslib.IHFSDbGenerated;
import com.raytheon.viz.mpe.MPEDateFormatter;
import com.raytheon.viz.mpe.core.MPEDataManager;
import com.raytheon.viz.mpe.ui.MPEDisplayManager;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;

View file

@ -78,7 +78,6 @@ import com.vividsolutions.jts.geom.Coordinate;
* updating RawPP records
* Nov 24, 2008 1748 snaples Added getters to MPEGageData
* Jun 18, 2013 16053 snaples Removed methods set and getRadarEditFlag
* July 9, 2013 2172 bkowal Added a polygon edit flag
* </pre>
*
* @author randerso
@ -672,8 +671,6 @@ public class MPEDataManager {
private ArrayList<String> badGages = new ArrayList<String>();
private boolean polygonEditFlag = false;
private Map<Date, MPEDateInfo> dateMap;
private Date latestAvailableDate = null;
@ -748,8 +745,8 @@ public class MPEDataManager {
}
public Map<Date, MPEDateInfo> getDateMap(boolean update) {
getDates(update);
getDates(update);
return dateMap;
}
@ -1486,14 +1483,6 @@ public class MPEDataManager {
}
}
public boolean isPolygonEditFlag() {
return polygonEditFlag;
}
public void setPolygonEditFlag(boolean polygonEditFlag) {
this.polygonEditFlag = polygonEditFlag;
}
/**
* @return the rFC
*/

View file

@ -56,8 +56,6 @@ import com.raytheon.viz.mpe.core.MPEDataManager.MPEGageData;
* Jan 02, 2013 15565 snaples Fixed problem with wrong time being sent to mpe_fieldgen
* Mar 14, 2013 1457 mpduff Fixed memory leak.
* Jun 18, 2013 16053 snaples Removed check for Radar Edit flag
* July 7, 2013 2172 bkowal Polygon Edits will now also trigger an hourly
* mpe field regeneration.
* </pre>
*
* @author snaples
@ -165,10 +163,6 @@ public class RegenHrFlds {
int pCount = pseudoList.size();
num_gage_edit += pCount;
}
private boolean polygonsModified() {
return MPEDataManager.getInstance().isPolygonEditFlag();
}
public double round(final double x) {
double tmp = x + 0.5;
@ -187,8 +181,7 @@ public class RegenHrFlds {
.getShell();
this.checkGages();
/* Store any gage edits into the HourlyPP or PseudoGageVal table. */
options.shef_duplicate = shef_dup.USE_REVCODE;
options.shef_duplicate = shef_dup.USE_REVCODE;
for (MPEGageData gData : gages.values()) {
@ -274,7 +267,6 @@ public class RegenHrFlds {
}
}
MPEDataManager.getInstance().setPolygonEditFlag(false);
/*-------------------------------------------------------------------------*/
/* Read Gage Data and store in structure */
/*-------------------------------------------------------------------------*/
@ -303,7 +295,6 @@ public class RegenHrFlds {
MPEDataManager.getInstance().clearEditGages();
shell.setCursor(null);
}
/**

View file

@ -92,6 +92,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* menu choice
* Apr 29, 2013 1958 bgonzale New class RedbookBlockHeader.
* May 21, 2013 2001 njensen Fixed error handling
* Jul 19, 2013 DR 16401 D. Friedman Fix unknown block processing.
*
* </pre>
*
@ -283,7 +284,7 @@ public class RedbookFrame implements IRenderable {
} else {
DefaultBlock block = new DefaultBlock(header, dataBuf);
if (!currBlock.equals("")) {
if (!RedbookBlockHeader.DEFAULT.equals(currBlock)) {
status.unhandledPackets = true;
statusHandler
.debug("Unhandled redbook packet: (mode="

View file

@ -184,6 +184,7 @@ import com.vividsolutions.jts.io.WKTReader;
* 07/09/2013 DR 16376 Qinglu Lin Removed calling removeOverTriplylaidLinesegment() but called removeOverlaidLinesegment().
* 07/26/2013 DR 16376 Qinglu Lin Moved adjustVertex() and computeSlope() to PolygonUtil; removed calculateDistance();
* updated AreaHatcher's run().
* 07/26/2013 DR 16450 D. Friedman Fix logic errors when frame count is one.
* </pre>
*
* @author mschenke
@ -1936,12 +1937,14 @@ public class WarngenLayer extends AbstractStormTrackResource {
if (displayState.mode == Mode.DRAG_ME) {
return;
}
if ((configuration.isTrackEnabled() == false ||
configuration.getPathcastConfig() == null)
&& !this.displayState.isNonstationary()
&& this.displayState.displayType != DisplayType.POLY) {
createSquare();
return;
if (warningAction == null || warningAction == WarningAction.NEW) {
if ((configuration.isTrackEnabled() == false ||
configuration.getPathcastConfig() == null)
&& !this.displayState.isNonstationary()
&& this.displayState.displayType != DisplayType.POLY) {
createSquare();
return;
}
}
DestinationGeodeticCalculator gc = new DestinationGeodeticCalculator();
@ -2268,7 +2271,8 @@ public class WarngenLayer extends AbstractStormTrackResource {
}
Point point = displayState.dragMePoint;
if (motdir != null && motspd != null) {
if (motdir != null && motspd != null &&
(motspd != 0 || configuration.isTrackEnabled())) {
displayState.setInitiallyMotionless(false);
displayState.angle = adjustAngle(motdir);
displayState.speed = knotToMeterPerSec.convert(motspd);

View file

@ -117,7 +117,7 @@
<!-- Convert the topic into a queue so only one consumer gets each message and we still have competing consumers. -->
<route id="gfeDataURINotificationQueueRoute">
<from uri="jms-gfe-notify:topic:edex.alerts?clientId=gfeNotify&amp;durableSubscriptionName=gfeNotificationSubscription" />
<from uri="jms-gfe-notify:topic:edex.alerts" />
<doTry>
<to uri="jms-generic:queue:gfeDataURINotification"/>
<doCatch>

View file

@ -65,6 +65,7 @@ from com.raytheon.uf.common.localization import LocalizationContext_Localization
# 04/23/13 1937 dgilling Reimplement WECache to match
# A1, big perf improvement.
# 05/23/13 1759 dgilling Remove unnecessary imports.
# 07/25/13 2233 randerso Improved memory utilization and performance
#
#
@ -365,7 +366,7 @@ def getMaskGrid(client, editAreaName, dbId):
return mask
###-------------------------------------------------------------------------###
def storeLatLonGrids(client, file, databaseID, maskGrid, krunch, clipArea):
def storeLatLonGrids(client, file, databaseID, invMask, krunch, clipArea):
# db = client[databaseID]
# Get the grid location and projection information
@ -460,7 +461,7 @@ def storeLatLonGrids(client, file, databaseID, maskGrid, krunch, clipArea):
logEvent("Saved Latitude/Longitude Grid")
###-------------------------------------------------------------------------###
def storeTopoGrid(client, file, databaseID, maskGrid, clipArea):
def storeTopoGrid(client, file, databaseID, invMask, clipArea):
"Stores the topo grid in the database"
# Get the grid location and projection information
@ -669,7 +670,8 @@ def storeWEAttributes(var, we, timeList, databaseID, clipArea):
# Note that geo information is modified based on the clip info.
# TimeRanges
setattr(var, "validTimes", timeList)
import itertools
setattr(var, "validTimes", list(itertools.chain.from_iterable(timeList)))
# Descriptive Name
setattr(var, "descriptiveName", we.getGpi().getDescriptiveName())
@ -727,30 +729,41 @@ def storeWEAttributes(var, we, timeList, databaseID, clipArea):
return
def findOverlappingTimes(trList, timeRange):
timeList = []
overlappingTimes = []
for t in trList:
interTR = intersection(t, timeRange)
if interTR is not None:
overlappingTimes.append(t)
timeList.append(interTR)
return timeList, overlappingTimes
###-------------------------------------------------------------------------###
### Stores the specified Scalar WE in the netCDF file whose grids fall within
### the specified timeRange.
def storeScalarWE(we, trList, file, timeRange, databaseID,
mask, trim, clipArea, krunch):
invMask, trim, clipArea, krunch):
"Stores a weather element to the netCDF file"
# get the data and store it in a Numeric array.
cube = []
timeList = []
wec = WECache(we, trList)
for t in trList:
interTR = intersection(t, timeRange)
if interTR is not None:
grid = clipToExtrema(wec[t][0], clipArea)
#adjust for time changes
if we.getGpi().isRateParm():
durRatio = (float(interTR[1]-interTR[0]))/float((t[1]-t[0]))
grid = (grid * durRatio).astype(numpy.float32)
cube.append(grid)
timeList.append(interTR[0])
timeList.append(interTR[1])
timeList, overlappingTimes = findOverlappingTimes(trList, timeRange)
cube = numpy.array(cube).astype(numpy.float32)
# clipped size
clipSize = (clipArea[1] - clipArea[0] + 1, clipArea[3] - clipArea[2] + 1)
gridCount = len(overlappingTimes)
cube = numpy.empty(shape=(gridCount, clipSize[1], clipSize[0]), dtype=numpy.float32)
wec = WECache(we, overlappingTimes)
for i,t in enumerate(overlappingTimes):
grid = clipToExtrema(wec[t][0], clipArea)
#adjust for time changes
if we.getGpi().isRateParm():
durRatio = (float(timeList[i][1]-timeList[i][0]))/float((t[1]-t[0]))
grid *= durRatio
cube[i]= grid
### Make sure we found some grids
# make the variable name
@ -759,21 +772,12 @@ def storeScalarWE(we, trList, file, timeRange, databaseID,
if len(cube) == 0:
logVerbose("No", varName, "grids found")
# clipped size
clipSize = (clipArea[1] - clipArea[0] + 1, clipArea[3] - clipArea[2] + 1)
gridCount = len(timeList) / 2
newsize = (gridCount, clipSize[1], clipSize[0]) #y,x
cube = numpy.resize(cube, newsize) # necessary when no grids
#get the dimension List
dimNames = ["ngrids_" + varName, "y", "x"]
dims = getDims(file, cube.shape, dimNames)
# Round the values according to the precision
if trim:
precision = pow(10, we.getGpi().getPrecision())
if krunch:
format, multiplier, offset, fillValue, pythonType = \
calcKrunchValues(we)
@ -783,23 +787,21 @@ def storeScalarWE(we, trList, file, timeRange, databaseID,
# krunch
if multiplier is not None:
cube = ((cube - offset) * multiplier)
roundMask = numpy.where(numpy.greater(cube, 0), 1.0, -1.0)
cube = (cube + (0.5 * roundMask)).astype(pythonType)
cube -= offset
cube *= multiplier
numpy.around(cube,out=cube)
# normal trim
else:
roundMask = numpy.where(numpy.greater(cube, 0), 1.0, -1.0)
trimmed = (cube * precision + (0.5 * roundMask))
trimmed = numpy.array(trimmed).astype(numpy.int32)
cube = numpy.array(trimmed).astype(numpy.float32)
cube = numpy.array(cube / precision).astype(numpy.float32)
digits = we.getGpi().getPrecision()
numpy.around(cube, digits, cube)
cube = cube.astype(pythonType)
else:
format, multiplier, offset, fillValue, pythonType = \
('f', None, None, -30000.0, numpy.float32)
# mask the data
cube = numpy.where(mask, cube, fillValue).astype(pythonType)
cube[:,invMask] = fillValue
# create the variable
var = file.createVariable(varName, format, dims)
@ -826,44 +828,36 @@ def storeScalarWE(we, trList, file, timeRange, databaseID,
### Stores the specified Vector WE in the netCDF file whose grids fall within
### the specified timeRange.
def storeVectorWE(we, trList, file, timeRange,
databaseID, mask, trim, clipArea, krunch):
databaseID, invMask, trim, clipArea, krunch):
"Stores a vector weather element to the netCDF file"
# get the data and store it in a Numeric array.
magCube = []
dirCube = []
timeList = []
wec = WECache(we, trList)
for t in trList:
interTR = intersection(t, timeRange)
if interTR is not None:
vecData = wec[t][0]
mag = clipToExtrema(vecData[0], clipArea)
dir = clipToExtrema(vecData[1], clipArea)
if we.getGpi().isRateParm():
durRatio = (float(interTR[1]-interTR[0]))/float((t[1]-t[0]))
mag = (mag * durRatio).astype(numpy.float32)
magCube.append(mag)
dirCube.append(dir)
timeList.append(interTR[0])
timeList.append(interTR[1])
timeList, overlappingTimes = findOverlappingTimes(trList, timeRange)
# clipped size
clipSize = (clipArea[1] - clipArea[0] + 1, clipArea[3] - clipArea[2] + 1)
gridCount = len(overlappingTimes)
magCube = numpy.empty(shape=(gridCount, clipSize[1], clipSize[0]),dtype=numpy.float32)
dirCube = numpy.empty(shape=(gridCount, clipSize[1], clipSize[0]),dtype=numpy.float32)
wec = WECache(we, overlappingTimes)
for i,t in enumerate(overlappingTimes):
vecData = wec[t][0]
mag = clipToExtrema(vecData[0], clipArea)
dir = clipToExtrema(vecData[1], clipArea)
if we.getGpi().isRateParm():
durRatio = (float(timeList[i][1]-timeList[i][0]))/float((t[1]-t[0]))
mag *= durRatio
magCube[i] = mag
dirCube[i] = dir
magCube = numpy.array(magCube).astype(numpy.float32)
dirCube = numpy.array(dirCube).astype(numpy.float32)
varName = we.getParmid().getParmName() + "_" + we.getParmid().getParmLevel()
### Make sure we found some grids
if len(magCube) == 0:
logVerbose("No", varName, "grids found")
# clipped size
clipSize = (clipArea[1] - clipArea[0] + 1, clipArea[3] - clipArea[2] + 1)
gridCount = len(timeList) / 2
newsize = (gridCount, clipSize[1], clipSize[0]) #y,x
magCube = numpy.resize(magCube, newsize) # necessary when no grids
dirCube = numpy.resize(dirCube, newsize) # necessary when no grids
# make the variable name
magVarName = we.getParmid().getParmName() + "_Mag_" + we.getParmid().getParmLevel()
dirVarName = we.getParmid().getParmName() + "_Dir_" + we.getParmid().getParmLevel()
@ -874,8 +868,6 @@ def storeVectorWE(we, trList, file, timeRange,
# Round the values according to the precision
if trim:
mprecision = pow(10, we.getGpi().getPrecision())
if krunch:
mformat, mmultiplier, moffset, mfillValue, mpythonType = \
calcKrunchValues(we)
@ -889,29 +881,27 @@ def storeVectorWE(we, trList, file, timeRange,
# krunch magnitude
if mmultiplier is not None:
magCube = ((magCube - moffset) * mmultiplier)
roundMask = numpy.where(numpy.greater(magCube, 0), 1.0, -1.0)
magCube = (magCube + (0.5 * roundMask)).astype(mpythonType)
magCube -= moffset
magCube *= mmultiplier
numpy.around(magCube,out=magCube)
# normal trim for magnitude
else:
roundMask = numpy.where(numpy.greater(magCube, 0), 1.0, -1.0)
trimmed = (magCube * mprecision + (0.5 * roundMask))
trimmed = numpy.array(trimmed).astype(numpy.int32)
magCube = numpy.array(trimmed).astype(numpy.float32)
magCube = numpy.array(magCube / mprecision).astype(numpy.float32)
digits = we.getGpi().getPrecision()
numpy.around(magCube, digits, magCube)
magCube = magCube.astype(mpythonType)
# krunch direction
if dmultiplier is not None:
dirCube = ((dirCube - doffset) * dmultiplier)
roundMask = numpy.where(numpy.greater(dirCube, 0), 1.0, -1.0)
dirCube = (dirCube + (0.5 * roundMask)).astype(dpythonType)
dirCube -= doffset
dirCube *= dmultiplier
numpy.around(dirCube,out=dirCube)
# normal trim for direction
else:
dirCube = numpy.array((dirCube + (0.5 * 10)) / 10).astype(numpy.int32)
dirCube = numpy.array(dirCube * 10).astype(numpy.float32)
mask360 = numpy.greater_equal(dirCube, 360.0)
dirCube = numpy.where(mask360, dirCube - 360.0, dirCube).astype(numpy.float32)
numpy.around(dirCube, -1, dirCube)
dirCube[numpy.greater_equal(dirCube, 360.0)] -= 360.0
dirCube = dirCube.astype(dpythonType)
else:
mformat, mmultiplier, moffset, mfillValue, mpythonType = \
@ -919,9 +909,8 @@ def storeVectorWE(we, trList, file, timeRange,
dformat, dmultiplier, doffset, dfillValue, dpythonType = \
('f', None, None, -30000.0, numpy.float32)
magCube = numpy.where(mask, magCube, mfillValue).astype(mpythonType)
dirCube = numpy.where(mask, dirCube, dfillValue).astype(dpythonType)
magCube[:,invMask] = mfillValue
dirCube[:,invMask] = dfillValue
# create the variable
magVar = file.createVariable(magVarName, mformat, dims)
@ -999,26 +988,25 @@ def collapseKey(keys, grid):
###-------------------------------------------------------------------------###
# Stores the specified Weather WE in the netCDF file whose grids fall within
### the specified timeRange.
def storeWeatherWE(we, trList, file, timeRange, databaseID, mask, clipArea):
def storeWeatherWE(we, trList, file, timeRange, databaseID, invMask, clipArea):
"Stores the Weather weather element to the netCDF file"
# get the data and store it in a Numeric array.
byteCube = []
keyList = []
timeList = []
wec = WECache(we, trList)
for t in trList:
interTR = intersection(t, timeRange)
if interTR is not None:
wx = wec[t][0]
grid = clipToExtrema(wx[0], clipArea)
byteCube.append(grid)
# Save times for these grids in a list
timeList.append(interTR[0])
timeList.append(interTR[1])
keyList.append(wx[1])
timeList, overlappingTimes = findOverlappingTimes(trList, timeRange)
byteCube = numpy.array(byteCube).astype(numpy.int8)
# clipped size
clipSize = (clipArea[1] - clipArea[0] + 1, clipArea[3] - clipArea[2] + 1)
gridCount = len(overlappingTimes)
byteCube = numpy.empty(shape=(gridCount, clipSize[1], clipSize[0]), dtype=numpy.int8)
keyList = []
wec = WECache(we, overlappingTimes)
for i,t in enumerate(overlappingTimes):
wx = wec[t][0]
grid = clipToExtrema(wx[0], clipArea)
byteCube[i] = grid
keyList.append(wx[1])
# make the variable name
varName = we.getParmid().getParmName() + "_" + we.getParmid().getParmLevel()
@ -1027,13 +1015,6 @@ def storeWeatherWE(we, trList, file, timeRange, databaseID, mask, clipArea):
if len(byteCube) == 0:
logVerbose("No", varName, "grids found")
# clipped size
clipSize = (clipArea[1] - clipArea[0] + 1, clipArea[3] - clipArea[2] + 1)
gridCount = len(timeList) / 2
newsize = (gridCount, clipSize[1], clipSize[0]) #y,x
byteCube = numpy.resize(byteCube, newsize)
#get the dimension List
dimNames = ["ngrids_" + varName, "y", "x"]
dims = getDims(file, byteCube.shape, dimNames)
@ -1048,7 +1029,7 @@ def storeWeatherWE(we, trList, file, timeRange, databaseID, mask, clipArea):
# Mask the values
fillValue = -127
byteCube = numpy.where(mask, byteCube, fillValue).astype(numpy.int8)
byteCube[:,invMask] =fillValue
# Save the grids to the netCDF file
for i in range(len(byteCube)):
@ -1098,26 +1079,26 @@ def storeWeatherWE(we, trList, file, timeRange, databaseID, mask, clipArea):
###-------------------------------------------------------------------------###
# Stores the specified Discrete WE in the netCDF file whose grids fall within
### the specified timeRange.
def storeDiscreteWE(we, trList, file, timeRange, databaseID, mask, clipArea):
def storeDiscreteWE(we, trList, file, timeRange, databaseID, invMask, clipArea):
"Stores the Weather weather element to the netCDF file"
# get the data and store it in a Numeric array.
byteCube = []
keyList = []
timeList = []
wec = WECache(we, trList)
for t in trList:
interTR = intersection(t, timeRange)
if interTR is not None:
dis = wec[t][0]
grid = clipToExtrema(dis[0], clipArea)
byteCube.append(grid)
# Save times for these grids in a list
timeList.append(interTR[0])
timeList.append(interTR[1])
keyList.append(dis[1])
timeList, overlappingTimes = findOverlappingTimes(trList, timeRange)
byteCube = numpy.array(byteCube).astype(numpy.int8)
# clipped size
clipSize = (clipArea[1] - clipArea[0] + 1, clipArea[3] - clipArea[2] + 1)
gridCount = len(overlappingTimes)
byteCube = numpy.empty(shape=(gridCount, clipSize[1], clipSize[0]), dtype=numpy.int8)
keyList = []
wec = WECache(we, overlappingTimes)
for i,t in enumerate(overlappingTimes):
dis = wec[t][0]
grid = clipToExtrema(dis[0], clipArea)
byteCube[i] = grid
keyList.append(dis[1])
# make the variable name
varName = we.getParmid().getParmName() + "_" + we.getParmid().getParmLevel()
@ -1126,13 +1107,6 @@ def storeDiscreteWE(we, trList, file, timeRange, databaseID, mask, clipArea):
if len(byteCube) == 0:
logVerbose("No", varName, "grids found")
# clipped size
clipSize = (clipArea[1] - clipArea[0] + 1, clipArea[3] - clipArea[2] + 1)
gridCount = len(timeList) / 2
newsize = (gridCount, clipSize[1], clipSize[0]) #y,x
byteCube = numpy.resize(byteCube, newsize) # necessary when no grids
#get the dimension List
dimNames = ["ngrids_" + varName, "y", "x"]
dims = getDims(file, byteCube.shape, dimNames)
@ -1147,7 +1121,7 @@ def storeDiscreteWE(we, trList, file, timeRange, databaseID, mask, clipArea):
# Mask the values
fillValue = -127
byteCube = numpy.where(mask, byteCube, fillValue).astype(numpy.int8)
byteCube[:,invMask] = fillValue
# Save the grids to the netCDF file
for i in range(len(byteCube)):
@ -1375,7 +1349,11 @@ def main(outputFilename, parmList, databaseID, startTime,
clipArea = extremaOfSetBits(maskGrid)
maskGrid = clipToExtrema(maskGrid, clipArea)
clippedGridSize = maskGrid.shape
validPointCount = numpy.add.reduce(numpy.add.reduce(maskGrid))
validPointCount = numpy.add.reduce(numpy.add.reduce(maskGrid))
#invert the mask grid
invMask = numpy.logical_not(maskGrid)
#del maskGrid
# Determine sampling definition
samplingDef = getSamplingDefinition(client, argDict['configFileName'])
@ -1395,18 +1373,18 @@ def main(outputFilename, parmList, databaseID, startTime,
gridType = str(we.getGpi().getGridType())
if gridType == "SCALAR":
nGrids = storeScalarWE(we, weInv, file, timeRange,
argDict['databaseID'], maskGrid, argDict['trim'], clipArea,
argDict['databaseID'], invMask, argDict['trim'], clipArea,
argDict['krunch'])
elif gridType == "VECTOR":
nGrids = storeVectorWE(we, weInv, file, timeRange,
argDict['databaseID'], maskGrid, argDict['trim'], clipArea,
argDict['databaseID'], invMask, argDict['trim'], clipArea,
argDict['krunch'])
elif gridType == "WEATHER":
nGrids = storeWeatherWE(we, weInv, file, timeRange,
argDict['databaseID'], maskGrid, clipArea)
argDict['databaseID'], invMask, clipArea)
elif gridType == "DISCRETE":
nGrids = storeDiscreteWE(we, weInv, file, timeRange,
argDict['databaseID'], maskGrid, clipArea)
argDict['databaseID'], invMask, clipArea)
else:
s = "Grids of type: " + we.gridType + " are not supported, " + \
"parm=" + p
@ -1417,8 +1395,8 @@ def main(outputFilename, parmList, databaseID, startTime,
# store the topo and lat, lon grids if the -g was present
if argDict["geoInfo"]:
storeTopoGrid(client, file, argDict['databaseID'], maskGrid, clipArea)
storeLatLonGrids(client, file, argDict['databaseID'], maskGrid,
storeTopoGrid(client, file, argDict['databaseID'], invMask, clipArea)
storeLatLonGrids(client, file, argDict['databaseID'], invMask,
argDict['krunch'], clipArea)
totalGrids = totalGrids + 3

View file

@ -13,7 +13,8 @@ Require-Bundle: com.raytheon.edex.common,
javax.persistence,
com.raytheon.uf.common.site;bundle-version="1.12.1174",
com.raytheon.uf.common.status;bundle-version="1.12.1174",
org.apache.commons.lang;bundle-version="2.3.0"
org.apache.commons.lang;bundle-version="2.3.0",
com.google.guava;bundle-version="1.0.0"
Export-Package: com.raytheon.edex.plugin.modelsounding,
com.raytheon.edex.plugin.modelsounding.common,
com.raytheon.edex.plugin.modelsounding.dao,

View file

@ -3,13 +3,17 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean id="modelsoundingDecoder"
class="com.raytheon.edex.plugin.modelsounding.ModelSoundingDecoder" />
<bean id="mdlsndgSeparator" class="com.raytheon.edex.plugin.modelsounding.ModelSoundingSeparator" >
<property name="chunkSize" value="500000" />
<bean id="modelsoundingPersistenceManager"
class="com.raytheon.edex.plugin.modelsounding.ModelSoundingPersistenceManager">
</bean>
<bean id="modelsoundingDecoder"
class="com.raytheon.edex.plugin.modelsounding.ModelSoundingDecoder"
init-method="start"
destroy-method="shutdown">
<property name="modelSoundingPersistenceManager" ref="modelsoundingPersistenceManager" />
</bean>
<!-- Filter down sounding data -->
<!-- bean id="mdlsndgFilter" class="com.raytheon.uf.edex.decodertools.core.filterimpl.PluginDataObjectFilter">
<constructor-arg type="java.lang.String" value="modelSounding_filters.xml" />
@ -30,6 +34,7 @@
xmlns="http://camel.apache.org/schema/spring"
errorHandlerRef="errorHandler"
autoStartup="false">
<!--
<endpoint id="modelsndgFileEndpoint"
uri="file:${edex.home}/data/sbn/mdlsndg?noop=true&amp;idempotent=false" />
@ -53,19 +58,9 @@
<doTry>
<pipeline>
<bean ref="stringToFile" />
<split streaming="true">
<method bean="mdlsndgSeparator" method="getSeparator"/>
<doTry>
<pipeline>
<bean ref="modelsoundingDecoder" method="decode"/>
<to uri="direct-vm:persistIndexAlert" />
</pipeline>
<doCatch>
<exception>java.lang.Throwable</exception>
<to uri="log:modelsounding?level=ERROR"/>
</doCatch>
</doTry>
</split>
<bean ref="modelsoundingDecoder" method="decode"/>
<!-- model sounding decoder has dedicated store thread, only need to forward to log -->
<bean ref="processUtil" method="log"/>
</pipeline>
<doCatch>
<exception>java.lang.Throwable</exception>
@ -73,5 +68,14 @@
</doCatch>
</doTry>
</route>
<!-- Copy of persist route without the log call -->
<route id="modelSoundingPersistIndexAlert">
<from uri="direct-vm:modelSoundingPersistIndexAlert"/>
<bean ref="persist" method="persist"/>
<bean ref="index" method="index"/>
<bean ref="toDataURI" method="toDataURI"/>
<to uri="vm:stageNotification"/>
</route>
</camelContext>
</beans>
</beans>

View file

@ -20,15 +20,12 @@
package com.raytheon.edex.plugin.modelsounding;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.Map;
import java.util.HashMap;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import java.util.Set;
import com.raytheon.edex.esb.Headers;
import com.raytheon.edex.exception.DecoderException;
@ -39,6 +36,9 @@ import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.pointdata.PointDataContainer;
import com.raytheon.uf.common.pointdata.PointDataDescription;
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.edex.decodertools.bufr.BUFRDataDocument;
import com.raytheon.uf.edex.decodertools.bufr.BUFRDocument;
import com.raytheon.uf.edex.decodertools.bufr.BUFRFile;
@ -69,6 +69,11 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader;
* by forecast hour and reftime when completing
* a decode operation. Overrode default
* Point Data Container size.
* 07/16/13 #2161 bkowal Store the records in a container that will
* be persisted every X (configurable) seconds
* by a timer. The timer is started during spring
* initialization and destroyed during spring
* container destruction.
*
* </pre>
*
@ -86,7 +91,8 @@ public class ModelSoundingDecoder extends AbstractDecoder implements
private static final int PDC_SIZE = 20;
/** The logger */
private Log logger = LogFactory.getLog(getClass());
private final IUFStatusHandler logger = UFStatus
.getHandler(ModelSoundingDecoder.class);
private PointDataDescription pdd;
@ -96,6 +102,8 @@ public class ModelSoundingDecoder extends AbstractDecoder implements
private IDescriptorFactoryDelegate delegate;
private ModelSoundingPersistenceManager modelSoundingPersistenceManager;
/**
* Construct a ProfilerDecoder instance.
*/
@ -114,6 +122,14 @@ public class ModelSoundingDecoder extends AbstractDecoder implements
}
}
public void start() {
this.modelSoundingPersistenceManager.start();
}
public void shutdown() {
this.modelSoundingPersistenceManager.shutdown();
}
/**
* Get one entry from the separator and interpret that data as a single
* profiler observation.
@ -132,10 +148,11 @@ public class ModelSoundingDecoder extends AbstractDecoder implements
return new PluginDataObject[0];
}
PluginDataObject[] decodedData = null;
if (logger.isPriorityEnabled(Priority.DEBUG)) {
logger.debug(traceId + "- Starting decode process");
}
logger.debug(traceId + "- Starting decode process");
if (data != null && data.length > 0) {
if ((data != null) && (data.length > 0)) {
WMOHeader wmoHeader = new WMOHeader(data, headers);
@ -157,9 +174,7 @@ public class ModelSoundingDecoder extends AbstractDecoder implements
messageData = null;
Iterator<BUFRDataDocument> iterator = document.iterator();
List<SoundingSite> pdoList = new ArrayList<SoundingSite>();
Map<SoundingTemporalData, PointDataContainer> pdcTemporalMap = new HashMap<SoundingTemporalData, PointDataContainer>();
Map<String, ModelSoundingStorageContainer> containerMap = new HashMap<String, ModelSoundingStorageContainer>();
while (iterator.hasNext()) {
BUFRDataDocument dataDoc = iterator.next();
@ -167,29 +182,41 @@ public class ModelSoundingDecoder extends AbstractDecoder implements
continue;
}
SoundingTemporalData soundingTemporalData = ModelSoundingDataAdapter
.getSoundingTemporalInformation(dataDoc);
SoundingModelTemporalData soundingTemporalData = ModelSoundingDataAdapter
.getSoundingTemporalInformation(dataDoc,
wmoHeader);
PointDataContainer container = pdcTemporalMap
.get(soundingTemporalData);
String pdcKey = (soundingTemporalData == null) ? " NULL"
: soundingTemporalData.toString();
ModelSoundingStorageContainer container = containerMap
.get(pdcKey);
if (container == null) {
container = PointDataContainer.build(pdd, PDC_SIZE);
pdcTemporalMap.put(soundingTemporalData, container);
if (logger.isDebugEnabled()) {
logger.debug("Added Point Data Container to Map with: "
+ ((soundingTemporalData == null) ? " NULL"
: soundingTemporalData
.toString()));
// haven't yet decoded a sounding for the given
// refTime/forecasthour, check the persistence
// manager for one from a previous decode
container = modelSoundingPersistenceManager
.checkOut(pdcKey);
if (container == null) {
if (logger.isPriorityEnabled(Priority.DEBUG)) {
logger.debug("Creating new Point Data Container: "
+ pdcKey);
}
container = new ModelSoundingStorageContainer(
PointDataContainer.build(pdd, PDC_SIZE));
} else if (logger.isPriorityEnabled(Priority.DEBUG)) {
logger.debug("Reusing Point Data Container: "
+ pdcKey);
}
} else if (logger.isDebugEnabled()) {
logger.debug("Retrieved Point Data Container from Map with: "
+ ((soundingTemporalData == null) ? " NULL"
: soundingTemporalData.toString()));
containerMap.put(pdcKey, container);
}
PointDataContainer pdc = container.getPdc();
SoundingSite soundingData = ModelSoundingDataAdapter
.createSoundingData(dataDoc, wmoHeader,
container, soundingTemporalData);
.createSoundingData(dataDoc, wmoHeader, pdc,
soundingTemporalData);
if (soundingData != null) {
soundingData.setTraceId(traceId);
soundingData.setPluginName(PLUGIN_NAME);
@ -201,30 +228,31 @@ public class ModelSoundingDecoder extends AbstractDecoder implements
}
String uri = soundingData.getDataURI();
if (dataSet.add(uri)) {
pdoList.add(soundingData);
container.addPdo(soundingData);
}
}
}
decodedData = pdoList.toArray(new PluginDataObject[pdoList
.size()]);
for (Map.Entry<String, ModelSoundingStorageContainer> entry : containerMap
.entrySet()) {
modelSoundingPersistenceManager.checkIn(entry.getKey(),
entry.getValue());
}
} catch (Exception ee) {
logger.error(traceId + "- Decoder error", ee);
} finally {
if (decodedData == null) {
decodedData = new PluginDataObject[0];
}
}
} else {
logger.error(traceId + "- Missing or invalid WMOHeader");
decodedData = new PluginDataObject[0];
}
} else {
logger.info(traceId + "- No data in file");
decodedData = new PluginDataObject[0];
}
logger.debug(traceId + "- ModelSounding decode complete");
return decodedData;
if (logger.isPriorityEnabled(Priority.DEBUG)) {
logger.debug(traceId + "- ModelSounding decode complete");
}
return new PluginDataObject[0];
}
/**
@ -272,4 +300,13 @@ public class ModelSoundingDecoder extends AbstractDecoder implements
return "DEFAULT";
}
public ModelSoundingPersistenceManager getModelSoundingPersistenceManager() {
return modelSoundingPersistenceManager;
}
public void setModelSoundingPersistenceManager(
ModelSoundingPersistenceManager modelSoundingPersistenceManager) {
this.modelSoundingPersistenceManager = modelSoundingPersistenceManager;
}
}

View file

@ -0,0 +1,178 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.edex.plugin.modelsounding;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
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.edex.core.EDEXUtil;
import com.raytheon.uf.edex.core.EdexException;
/**
* Thread for storing Model Soundings asynchronously. If decode thread decodes
* more data for an hdf5 record that hasn't been stored yet it will allow
* appending to the pending store.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 17, 2013 2161 bkowal Initial creation
*
* </pre>
*
* @author bkowal
* @version 1.0
*/
public class ModelSoundingPersistenceManager extends Thread {
/** The logger */
private final IUFStatusHandler logger = UFStatus
.getHandler(ModelSoundingPersistenceManager.class);
private final LinkedHashMap<String, ModelSoundingStorageContainer> containerMap;
private final AtomicBoolean run = new AtomicBoolean(true);
/**
*
*/
public ModelSoundingPersistenceManager() {
super("ModelSoundingStore");
this.containerMap = new LinkedHashMap<String, ModelSoundingStorageContainer>(
64, 1);
}
@Override
public void run() {
boolean keepStoring = true;
while (keepStoring) {
try {
ModelSoundingStorageContainer container = null;
synchronized (containerMap) {
while (containerMap.isEmpty() && this.run.get()) {
try {
containerMap.wait();
} catch (InterruptedException e) {
// ignore
}
}
Iterator<String> iter = containerMap.keySet().iterator();
if (iter.hasNext()) {
// remove first entry and process
String key = iter.next();
container = containerMap.remove(key);
if (logger.isPriorityEnabled(Priority.DEBUG)) {
logger.debug("Persisting "
+ container.getPdos().size()
+ " PluginDataObject(s) for : " + key);
}
}
}
if (container != null) {
List<PluginDataObject> pdoList = container.getPdos();
PluginDataObject[] pdos = pdoList
.toArray(new PluginDataObject[pdoList.size()]);
try {
EDEXUtil.getMessageProducer().sendSync(
"modelSoundingPersistIndexAlert", pdos);
} catch (EdexException e) {
logger.error("Failed to persist " + pdos.length
+ " PluginDataObject(s)!", e);
}
} else if (!this.run.get()) {
// received shutdown flag
keepStoring = false;
}
} catch (Throwable e) {
// fail safe so store thread doesn't fail
logger.error(
"Caught unknown exception on modelsounding store thread",
e);
}
}
}
/**
* Checking in a model sounding container makes it available for the store
* thread to store. A decode thread can check out the model sounding
* container for appending more data to if the store thread has not yet
* stored the container.
*
* @param persistRecordKey
* @param container
* @return
*/
public boolean checkIn(String persistRecordKey,
ModelSoundingStorageContainer container) {
boolean rval = run.get();
synchronized (containerMap) {
if (rval) {
ModelSoundingStorageContainer prev = containerMap.put(
persistRecordKey, container);
if (prev != null) {
// technically only possible in an environment where there
// are multiple decode threads running, just append the
// pdo's from the first, their pdc will not be used again
if (logger.isPriorityEnabled(Priority.DEBUG)) {
logger.debug("PDC for time already exists, appending previous PDC data");
}
container.addPdos(prev.getPdos());
}
containerMap.notify();
}
}
return rval;
}
/**
* Checks out a sounding container if one is pending store. This allows a
* decode thread to append more data to the store if the writing thread has
* not yet gotten to the data.
*
* @param persistRecordKey
* @return
*/
public ModelSoundingStorageContainer checkOut(String persistRecordKey) {
synchronized (containerMap) {
return containerMap.remove(persistRecordKey);
}
}
public void shutdown() {
run.set(false);
synchronized (containerMap) {
containerMap.notify();
}
}
}

View file

@ -0,0 +1,73 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.edex.plugin.modelsounding;
import java.util.LinkedList;
import java.util.List;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.pointdata.PointDataContainer;
/**
* Associates a PointDataContainer with a list of plugin data objects.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 15, 2013 2161 bkowal Initial creation
*
* </pre>
*
* @author bkowal
* @version 1.0
*/
public class ModelSoundingStorageContainer {
private final PointDataContainer pdc;
private final List<PluginDataObject> pdos;
/**
*
*/
public ModelSoundingStorageContainer(PointDataContainer pdc) {
this.pdos = new LinkedList<PluginDataObject>();
this.pdc = pdc;
}
public PointDataContainer getPdc() {
return pdc;
}
public List<PluginDataObject> getPdos() {
return pdos;
}
public void addPdo(PluginDataObject pdo) {
this.pdos.add(pdo);
}
public void addPdos(List<PluginDataObject> pdos) {
this.pdos.addAll(pdos);
}
}

View file

@ -0,0 +1,127 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.edex.plugin.modelsounding;
import java.util.Calendar;
import com.raytheon.edex.plugin.modelsounding.common.SoundingModels;
import com.raytheon.uf.common.time.DataTime;
/**
* Stores temporal information associated with sounding data.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 3, 2013 2161 bkowal Initial creation
*
* </pre>
*
* @author bkowal
* @version 1.0
*/
public class SoundingModelTemporalData {
private Calendar obsTime;
private DataTime dt;
private long refTime;
private long validTime;
private int forecastHr;
private SoundingModels model;
/**
*
*/
public SoundingModelTemporalData() {
this.obsTime = null;
this.dt = null;
this.refTime = -1L;
this.validTime = -1L;
this.forecastHr = -1;
}
public Calendar getObsTime() {
return obsTime;
}
public void setObsTime(Calendar obsTime) {
this.obsTime = obsTime;
}
public DataTime getDt() {
return dt;
}
public void setDt(DataTime dt) {
this.dt = dt;
}
public long getRefTime() {
return refTime;
}
public void setRefTime(long refTime) {
this.refTime = refTime;
}
public long getValidTime() {
return validTime;
}
public void setValidTime(long validTime) {
this.validTime = validTime;
}
public int getForecastHr() {
return forecastHr;
}
public void setForecastHr(int forecastHr) {
this.forecastHr = forecastHr;
}
public SoundingModels getModel() {
return model;
}
public void setModel(SoundingModels model) {
this.model = model;
}
@Override
public String toString() {
StringBuilder stringBuilder = new StringBuilder(40);
stringBuilder.append("model = ").append(model.getReportType());
stringBuilder.append(", refTime = ");
stringBuilder.append(this.refTime);
stringBuilder.append(", forecastHr = ");
stringBuilder.append(this.forecastHr);
return stringBuilder.toString();
}
}

View file

@ -28,7 +28,7 @@ import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.raytheon.edex.plugin.modelsounding.SoundingTemporalData;
import com.raytheon.edex.plugin.modelsounding.SoundingModelTemporalData;
import com.raytheon.edex.plugin.modelsounding.common.SoundingModels;
import com.raytheon.edex.plugin.modelsounding.common.SoundingSite;
import com.raytheon.uf.common.geospatial.spi.SPIContainer;
@ -119,8 +119,15 @@ public class ModelSoundingDataAdapter {
}
}
public static SoundingTemporalData getSoundingTemporalInformation(
BUFRDataDocument dataDoc) {
/**
* Get the temporal and model information.
*
* @param dataDoc
* @param wmoHeader
* @return
*/
public static SoundingModelTemporalData getSoundingTemporalInformation(
BUFRDataDocument dataDoc, WMOHeader wmoHeader) {
Calendar obsTime = dataDoc.getEnclosingDocument().getSection1()
.getSectionDate();
if (obsTime == null) {
@ -138,7 +145,7 @@ public class ModelSoundingDataAdapter {
.longValue() : null;
}
SoundingTemporalData soundingTemporalData = new SoundingTemporalData();
SoundingModelTemporalData soundingTemporalData = new SoundingModelTemporalData();
soundingTemporalData.setObsTime(obsTime);
DataTime dt = new DataTime(obsTime, forecastSeconds.intValue());
@ -152,6 +159,9 @@ public class ModelSoundingDataAdapter {
soundingTemporalData.setForecastHr((int) (forecastSeconds / 3600));
soundingTemporalData.setModel(SoundingModels.getModel(wmoHeader
.getCccc()));
return soundingTemporalData;
}
@ -167,14 +177,13 @@ public class ModelSoundingDataAdapter {
*/
public static SoundingSite createSoundingData(BUFRDataDocument dataDoc,
WMOHeader wmoHeader, PointDataContainer container,
SoundingTemporalData soundingTemporalData) {
SoundingModelTemporalData soundingTemporalData) {
SoundingSite obsData = null;
synchronized (LOCK) {
try {
SoundingModels model = SoundingModels.getModel(wmoHeader
.getCccc());
SoundingModels model = soundingTemporalData.getModel();
// Get the primary data list.
List<IBUFRDataPacket> dataList = dataDoc.getList();
// Extract the header data.

View file

@ -47,6 +47,7 @@ import com.raytheon.uf.common.util.ReflectionUtil;
* and moved reflective calls to the
* mapping population method. Map now
* contains factory objects.
* Jul 19, 2013 DR 16401 D. Friedman Fix end-of-product block decoding.
*
* </pre>
*
@ -99,8 +100,11 @@ public class RedbookBlockBuilder {
byte rawMode = dataBuffer.get();
byte rawSubMode = dataBuffer.get();
// Must have at least MIN_REMAINING
if (dataBuffer.remaining() >= MIN_REMAINING) {
/* Must have at least MIN_REMAINING,
* but allow the the end-of-product block (mode=1,sub=2)
*/
if (dataBuffer.remaining() >= MIN_REMAINING ||
(rawMode == 1 && rawSubMode == 2)) {
header = new RedbookBlockHeader(rawHdr, rawMode, rawSubMode);
} else {
header = RedbookBlockHeader.DEFAULT;

View file

@ -190,11 +190,11 @@ public class FFMPBasinData implements ISerializableObject {
*/
public float getAverageValue(ArrayList<Long> pfaf_ids, Date beforeDate,
Date afterDate) {
float tvalue = 0.0f;
int i = 0;
Map<Long, FFMPBasin> localBasins = getBasins();
for (Long pfaf : pfaf_ids) {
FFMPBasin basin = getBasins().get(pfaf);
FFMPBasin basin = localBasins.get(pfaf);
if (basin != null) {
tvalue += basin.getValue(beforeDate, afterDate);
i++;
@ -267,8 +267,9 @@ public class FFMPBasinData implements ISerializableObject {
float tvalue = 0.0f;
float tarea = 0.0f;
int i = 0;
Map<Long, FFMPBasin> localBasins = getBasins();
for (Long pfaf : pfaf_ids) {
FFMPBasin basin = getBasins().get(pfaf);
FFMPBasin basin = localBasins.get(pfaf);
if (basin != null) {
if (basin.getValue() != FFMPUtils.MISSING) {
tvalue += (basin.getValue() * areas.get(i));
@ -297,8 +298,9 @@ public class FFMPBasinData implements ISerializableObject {
float tvalue = 0.0f;
int i = 0;
Map<Long, FFMPBasin> localBasins = getBasins();
for (Long pfaf : pfaf_ids) {
FFMPBasin basin = getBasins().get(pfaf);
FFMPBasin basin = localBasins.get(pfaf);
if (basin != null) {
tvalue += basin.getAccumValue(beforeDate, afterDate,
expirationTime, rate);
@ -319,10 +321,11 @@ public class FFMPBasinData implements ISerializableObject {
*/
public float getMaxValue(ArrayList<Long> pfaf_ids, Date beforeDate,
Date afterDate) {
float tvalue = 0.0f;
Map<Long, FFMPBasin> localBasins = getBasins();
for (Long pfaf : pfaf_ids) {
FFMPBasin basin = getBasins().get(pfaf);
FFMPBasin basin = localBasins.get(pfaf);
if (basin != null) {
Float value = basin.getValue(beforeDate, afterDate);
if (value > tvalue) {
@ -343,10 +346,10 @@ public class FFMPBasinData implements ISerializableObject {
*/
public float getAverageMaxValue(List<Long> pfaf_ids, Date date,
long expiration) {
float tvalue = 0.0f;
Map<Long, FFMPBasin> localBasins = getBasins();
for (Long pfaf : pfaf_ids) {
FFMPBasin basin = getBasins().get(pfaf);
FFMPBasin basin = localBasins.get(pfaf);
if (basin != null) {
Float value = basin.getAverageValue(date, expiration);
if (value > tvalue) {
@ -367,10 +370,10 @@ public class FFMPBasinData implements ISerializableObject {
*/
public float getAverageMaxValue(ArrayList<Long> pfaf_ids, Date afterDate,
Date beforeDate) {
float tvalue = 0.0f;
Map<Long, FFMPBasin> localBasins = getBasins();
for (Long pfaf : pfaf_ids) {
FFMPBasin basin = getBasins().get(pfaf);
FFMPBasin basin = localBasins.get(pfaf);
if (basin != null) {
Float value = basin.getAverageValue(afterDate, beforeDate);
if (value > tvalue) {
@ -389,10 +392,10 @@ public class FFMPBasinData implements ISerializableObject {
* @return
*/
public float getMaxValue(List<Long> pfaf_ids, Date date) {
float tvalue = 0.0f;
Map<Long, FFMPBasin> localBasins = getBasins();
for (Long pfaf : pfaf_ids) {
FFMPBasin basin = getBasins().get(pfaf);
FFMPBasin basin = localBasins.get(pfaf);
if (basin != null) {
Float value = basin.getValue(date);
if (value > tvalue) {
@ -413,12 +416,12 @@ public class FFMPBasinData implements ISerializableObject {
public float getAverageGuidanceValue(List<Long> pfaf_ids,
FFMPGuidanceInterpolation interpolation, float guidance,
List<Long> forcedPfafs, long expiration) {
float tvalue = 0.0f;
float value;
int i = 0;
Map<Long, FFMPBasin> localBasins = getBasins();
for (Long pfaf : pfaf_ids) {
FFMPBasin basin = getBasins().get(pfaf);
FFMPBasin basin = localBasins.get(pfaf);
if (basin == null) {
return guidance;
@ -497,8 +500,9 @@ public class FFMPBasinData implements ISerializableObject {
FFMPGuidanceInterpolation interpolation, long expiration,
long parentPfaf) {
float tvalue = Float.NaN;
Map<Long, FFMPBasin> localBasins = getBasins();
for (Long pfaf : pfaf_ids) {
FFMPBasin basin = getBasins().get(pfaf);
FFMPBasin basin = localBasins.get(pfaf);
if (basin != null) {
FFMPGuidanceBasin fgb = (FFMPGuidanceBasin) basin;
fgb.setCountyFips(parentPfaf);
@ -549,11 +553,10 @@ public class FFMPBasinData implements ISerializableObject {
*/
public float getAccumMaxValue(List<Long> pfaf_ids, Date beforeDate,
Date afterDate, long expirationTime, boolean rate) {
float tvalue = 0.0f;
Map<Long, FFMPBasin> localBasins = getBasins();
for (Long pfaf : pfaf_ids) {
FFMPBasin basin = getBasins().get(pfaf);
FFMPBasin basin = localBasins.get(pfaf);
if (basin != null) {
float val = basin.getAccumValue(afterDate, beforeDate,
@ -578,8 +581,9 @@ public class FFMPBasinData implements ISerializableObject {
public List<Float> getGuidanceValues(List<Long> pfaf_ids,
FFMPGuidanceInterpolation interpolation, long expiration) {
List<Float> values = new ArrayList<Float>();
Map<Long, FFMPBasin> localBasins = getBasins();
for (Long pfaf : pfaf_ids) {
FFMPBasin basin = getBasins().get(pfaf);
FFMPBasin basin = localBasins.get(pfaf);
if (basin != null) {
FFMPGuidanceBasin fgb = (FFMPGuidanceBasin) basin;
if (interpolation.isInterpolate()) {
@ -637,8 +641,9 @@ public class FFMPBasinData implements ISerializableObject {
public List<Float> getAccumValues(List<Long> pfaf_ids, Date beforeDate,
Date afterDate, long expirationTime, boolean rate) {
List<Float> values = new ArrayList<Float>();
Map<Long, FFMPBasin> localBasins = getBasins();
for (Long pfaf : pfaf_ids) {
FFMPBasin basin = getBasins().get(pfaf);
FFMPBasin basin = localBasins.get(pfaf);
if (basin != null) {
values.add(basin.getAccumValue(beforeDate, afterDate,
expirationTime, rate));
@ -822,6 +827,16 @@ public class FFMPBasinData implements ISerializableObject {
}
}
/**
* Returns whether or not any basins have been put in the basins map. Faster
* than calling getBasins().size() or getBasins().isEmpty().
*
* @return
*/
public boolean hasAnyBasins() {
return !basins.isEmpty();
}
/**
* Load now.
*/

View file

@ -58,6 +58,8 @@ import com.vividsolutions.jts.io.WKTReader;
* ETN values.
* Feb 26, 2013 #1447 dgilling Rewrite based on MergeActiveTableRequest
* and use MergeVTEC.py to perform merge.
* Jul 23, 2013 #2212 dgilling Fix ClassCastExceptions on flood
* fields.
*
* </pre>
*
@ -181,31 +183,32 @@ public class MergeActiveTableHandler implements
atr.setProductClass(template.get("productClass").toString());
atr.setUgcZone(template.get("id").toString());
atr.setRawmessage(template.get("rawMessage").toString());
atr.setCountyheader((String) template.get("countyheader"));
Integer floodBeginInt = (Integer) template
.get("floodBegin");
if (floodBeginInt != null) {
Number floodBeginTime = (Number) template.get("floodBegin");
if (floodBeginTime != null) {
Calendar floodBegin = GregorianCalendar.getInstance();
floodBegin.setTimeInMillis(floodBeginInt * 1000L);
floodBegin
.setTimeInMillis(floodBeginTime.longValue() * 1000L);
atr.setFloodBegin(floodBegin);
}
Integer floodCrestInt = (Integer) template
.get("floodCrest");
if (floodCrestInt != null) {
Number floodCrestTime = (Number) template.get("floodCrest");
if (floodCrestTime != null) {
Calendar floodCrest = GregorianCalendar.getInstance();
floodCrest.setTimeInMillis(floodCrestInt * 1000L);
floodCrest
.setTimeInMillis(floodCrestTime.longValue() * 1000L);
atr.setFloodCrest(floodCrest);
}
Integer floodEndInt = (Integer) template.get("floodEnd");
if (floodEndInt != null) {
Number floodEndTime = (Number) template.get("floodEnd");
if (floodEndTime != null) {
Calendar floodEnd = GregorianCalendar.getInstance();
floodEnd.setTimeInMillis(floodEndInt * 1000L);
floodEnd.setTimeInMillis(floodEndTime.longValue() * 1000L);
atr.setFloodEnd(floodEnd);
}
atr.setFloodRecordStatus((String) template
.get("floodRecordStatus"));
atr.setFloodSeverity((String) template.get("floodseverity"));
atr.setImmediateCause((String) template
.get("immediateCause"));
atr.setLoc((String) template.get("loc"));

View file

@ -29,8 +29,8 @@
# 12/20/09 njensen Initial Creation.
# 02/26/13 1447 dgilling Implement __eq__() and
# __ne__().
#
#
# 07/23/13 2212 dgilling Fix typo in __eq__().
#
#
@ -154,7 +154,7 @@ class ActiveTableRecord(object):
return ActiveTableRecord(self.atr.clone(), self.state)
def __eq__(self, other):
return self.javaRecord().equals(other.javeRecord())
return self.javaRecord().equals(other.javaRecord())
def __ne__(self, other):
return not self.__eq__(other)

View file

@ -1 +1 @@
8c6dca9fe87ba72219b27ed3dcb8c74cc4f0e53d
c28b0356ba38c6aa1c3ad220caf3ad27f2534f33

View file

@ -1 +1 @@
8c6dca9fe87ba72219b27ed3dcb8c74cc4f0e53d
c28b0356ba38c6aa1c3ad220caf3ad27f2534f33

View file

@ -28,10 +28,10 @@
void display_field_data_RFCW ( enum DisplayFieldData,
int ** data_array_tmp , date_struct date ,
int addition_flag ) ;
int addition_flag , int rowSize, int colSize) ;
void display_field_read_xmrg ( int ** data_array_tmp , char * fname ,
int addition_flag ) ;
int addition_flag , int rowSize, int colSize ) ;
void display_field_read_spe ( int ** data_array_tmp , char * fname ,
int addition_flag ) ;

View file

@ -52,8 +52,8 @@
/* Ordering of the elements in this list must be the same as the beginning
* of the enum DisplayFieldData type in the mpe_field_names.h header file. */
typedef enum {rmosaic = 0, avgrmosaic, maxrmosaic, gaugeonly, bmosaic, lmosaic,
mmosaic, mlmosaic, satpre, lsatpre, p3lmosaic, srmosaic, sgmosaic, srgmosaic,
typedef enum {rmosaic = 0, avgrmosaic, maxrmosaic, bmosaic, lmosaic, gaugeonly,
satpre, lsatpre, mmosaic, mlmosaic, p3lmosaic, srmosaic, sgmosaic, srgmosaic,
qmosaic, lqmosaic, mlqmosaic, rfcmosaic, rfcbmosaic, rfcmmosaic, num_mosaics
}mosaicType ;

View file

@ -174,7 +174,9 @@ void main_mpe_fieldgen_for_calls_from_editor(int num_args, char ** args)
sprintf ( message , "\t\tMPE Precip Processing -- %s\n", strTempTime) ;
printMessage( message, logFile );
sprintf ( message , "\t\tVersion OB11.7 -- Jun 01, 2011 \n") ;
sprintf ( message , "\t\tLast Modification: August 1, 2013 \n") ;
printMessage( message, logFile );
sprintf ( message , "\t\t \n") ;
printMessage( message, logFile );
sprintf( message , "STATUS: Processing %d hour(s)\n",

View file

@ -436,8 +436,12 @@ static void accum_show_data ( Widget w , XtPointer clientdata ,
for ( i = index ; ( i < ( index + interval_value ) ) &&
( i < NUMHRS ) ; ++ i )
{
/*
* Set to zeros; it is known that this code is unused in AWIPS II
* due to the existence of the X functions in this source file.
*/
display_field_data_RFCW ( display_Xmrg , rad_data[0].data_array ,
dates [ i ] , 1 ) ;
dates [ i ] , 1 , 0, 0) ;
}
/* If the type of this precipitation accumulation is anything other

View file

@ -793,7 +793,7 @@ static void apply_edit_polygon(const rubber_poly_data * pPolyNode,
display_field_data_RFCW(
( enum DisplayFieldData ) pPolyNode->draw_source, temp_array,
(date_struct ) * pDate, ( int ) add_flag );
(date_struct ) * pDate, ( int ) add_flag , num_rows, num_columns );
}
/*-----------------------------------------------------------*/
@ -829,9 +829,14 @@ static void apply_edit_polygon(const rubber_poly_data * pPolyNode,
case display_rfcbMosaic:
case display_rfcmMosaic:
case display_Xmrg:
case display_lqMosaic:
case display_qMosaic:
case display_mlqMosaic:
data_array[x_adj][y_adj] = temp_array[x_adj][y_adj];
break;
case display_subValue:
if (pPolyNode->raise_flag == True)

View file

@ -335,9 +335,13 @@ void create_gage_table_RFCW ( draw_struct * data )
for ( m = 0; m < SIZE; ++m )
{
/*
* defaulting to 0 since this source is not used in
* AWIPS II due to the existence of the X functions.
*/
display_field_data_RFCW ( display_array[m] ,
data_array_field , date_st3 ,
addition_flag );
addition_flag , 0, 0);
lookup_mosaic_data ( data_array_field ,
gage ,
@ -1085,7 +1089,7 @@ void lookup_radar_index ( int ** data_array_tmp ,
sprintf(fname,"%s/%s%sz",dirname,cv_use_tmp,date_st3.cdate);
len_fname = strlen(fname);
display_field_read_xmrg ( data_array_tmp , fname, addition_flag );
display_field_read_xmrg ( data_array_tmp , fname, addition_flag , 0, 0 );
for(k=0; k<ngages; k++)
{

View file

@ -32,7 +32,7 @@ Called by function:
void display_field_data_RFCW ( enum DisplayFieldData display_data ,
int ** data_array_tmp , date_struct date ,
int addition_flag )
int addition_flag , int rowSize, int colSize )
{
char dirname [ 100 ] ;
char fname [ 128 ] ;
@ -160,6 +160,24 @@ void display_field_data_RFCW ( enum DisplayFieldData display_data ,
strcpy(cv_use_tmp,"RFCMMOSAIC");
break;
case display_lqMosaic:
len = strlen("mpe_lqmosaic_dir");
get_apps_defaults("mpe_lqmosaic_dir",&len,dirname,&len);
strcpy(cv_use_tmp,"LQMOSAIC");
break;
case display_qMosaic:
len = strlen("mpe_qmosaic_dir");
get_apps_defaults("mpe_qmosaic_dir",&len,dirname,&len);
strcpy(cv_use_tmp,"QMOSAIC");
break;
case display_mlqMosaic:
len = strlen("mpe_mlqmosaic_dir");
get_apps_defaults("mpe_mlqmosaic_dir",&len,dirname,&len);
strcpy(cv_use_tmp,"MLQMOSAIC");
break;
case display_subValue:
len = strlen("rfcwide_gageonly_dir");
get_apps_defaults("rfcwide_gageonly_dir",&len,dirname,&len);
@ -171,7 +189,8 @@ void display_field_data_RFCW ( enum DisplayFieldData display_data ,
return;
default:
logMessage("ERROR: invalid selection");
flogMessage(stderr, "\nIn routine 'display_field_data_RFCW':\n"
"Invalid Selection: %d.\n", (int) display_data);
return;
}
@ -209,7 +228,7 @@ void display_field_data_RFCW ( enum DisplayFieldData display_data ,
if ( display_data != display_satPrecip )
{
len_fname = strlen ( fname ) ;
display_field_read_xmrg ( data_array_tmp , fname, addition_flag );
display_field_read_xmrg ( data_array_tmp , fname, addition_flag , rowSize, colSize );
}
else
{
@ -220,13 +239,22 @@ void display_field_data_RFCW ( enum DisplayFieldData display_data ,
}
void display_field_read_xmrg (int ** data_array_tmp , char * fname,
int addition_flag )
int addition_flag , int rowSize, int colSize )
{
int len_fname;
int i, j, ifile;
short **temp = NULL ;
enum TestByteResult result ;
if (colSize > 0)
{
MAXX = colSize;
}
if (rowSize > 0)
{
MAXY = rowSize;
}
len_fname = strlen(fname);
temp = ( short ** ) malloc ( MAXY * sizeof ( short *) ) ;
@ -297,14 +325,16 @@ void display_field_read_xmrg (int ** data_array_tmp , char * fname,
return ;
}
bool success = true;
for ( i = 0 ; i < MAXY ; ++ i )
{
read_xmrg ( & MAXX , & MAXY , & i , fname , & len_fname , & ifile ,
temp [ i ] ) ;
temp[i] ) ;
if (ifile != 0)
{
logMessage("error reading %s -- missing data substituted....\n",fname);
success = false;
break;
}
@ -314,8 +344,11 @@ void display_field_read_xmrg (int ** data_array_tmp , char * fname,
}
}
if (ifile == 0)
if (success)
{
flogMessage ( stderr , "In routine \"display_field\":\n"
"addition_flag = %d\n" , fname , addition_flag ) ;
for (i=0;i<MAXX;i++)
for (j=0;j<MAXY;j++)
{
@ -331,10 +364,11 @@ void display_field_read_xmrg (int ** data_array_tmp , char * fname,
data_array_tmp[i][j] = temp[j][i];
}
}
}
else
{
flogMessage(stderr, "\nIn routine 'display_field_read_xmrg':\n"
"failed to read file; defaulting data to -999\n");
for (i=0;i<MAXX;i++)
for (j=0;j<MAXY;j++)
{

View file

@ -1,4 +1,5 @@
#include <stdio.h>
#include "mpe_log_utils.h"
const int MPEUtil_num_bytes_to_discard = 94 ;

View file

@ -8,9 +8,8 @@
<bean id="edexIngestUtilWebServer" class="org.eclipse.jetty.server.Server" init-method="start" destroy-method="stop">
<property name="threadPool">
<bean id="ThreadPool" class="org.eclipse.jetty.util.thread.OldQueuedThreadPool">
<bean id="ThreadPool" class="org.eclipse.jetty.util.thread.QueuedThreadPool">
<property name="minThreads" value="25"/>
<property name="lowThreads" value="25"/>
<property name="maxThreads" value="50"/>
</bean>
</property>

View file

@ -7,13 +7,26 @@
id="gov.noaa.nws.ncep.ui.nsharp.palette"
name="Nsharp">
</command>
<command
id="gov.noaa.nws.ncep.ui.nsharp.key"
name="Manage shift key">
<commandParameter
id="action"
name="action"
optional="false">
</commandParameter>
</command>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler
class="gov.noaa.nws.ncep.ui.nsharp.NsharpViewAction"
commandId="gov.noaa.nws.ncep.ui.nsharp.palette">
</handler>
</handler>
<handler
class="gov.noaa.nws.ncep.ui.nsharp.NsharpKeyHandler"
commandId="gov.noaa.nws.ncep.ui.nsharp.key">
</handler>
</extension>
<extension
@ -66,4 +79,31 @@
extensionFilter=".xml,.txt">
</path>
</extension>
<extension
point="org.eclipse.ui.contexts">
<context
description="The Natl Centers Nsharp Context"
id="gov.noaa.nws.ncep.ui.nsharp.nsharpContext"
name="Natl Centers Nsharp Context">
</context>
</extension>
<extension
point="org.eclipse.ui.bindings"
id="gov.noaa.nws.ncep.ui.nsharp.nsharpKeyBinding"
name="Nsharp Shift Key Binding">
<key
commandId="gov.noaa.nws.ncep.ui.nsharp.key"
contextId="gov.noaa.nws.ncep.ui.nsharp.nsharpContext"
schemeId="com.raytheon.viz.ui.awips.scheme"
sequence="SHIFT+ARROW_DOWN">
<parameter id="action" value="arrowdown" />
</key>
<key
commandId="gov.noaa.nws.ncep.ui.nsharp.key"
contextId="gov.noaa.nws.ncep.ui.nsharp.nsharpContext"
schemeId="com.raytheon.viz.ui.awips.scheme"
sequence="SHIFT+ARROW_UP">
<parameter id="action" value="arrowup" />
</key>
</extension>
</plugin>

View file

@ -104,6 +104,7 @@ public class NsharpConfigManager {
try {
//System.out.println("lFile name="+ lFile.getName());
@SuppressWarnings("deprecation")
Object xmlObj = SerializationUtil.jaxbUnmarshalFromXmlFile(
lFile.getFile().getAbsolutePath() );

View file

@ -523,18 +523,24 @@ public class NsharpConstants {
public static final int DATA_TIMELINE_X_ORIG = 0;
public static final int DATA_TIMELINE_Y_ORIG = 40;
public static final int DATA_TIMELINE_WIDTH = TIMESTN_PANE_REC_WIDTH/2;
public static final int COLOR_NOTATION_HEIGHT = 110;
public static final int DATA_TIMELINE_WIDTH = TIMESTN_PANE_REC_WIDTH * 40 /100;
public static final int COLOR_NOTATION_HEIGHT = 165;
public static final int DATA_TIMELINE_HEIGHT = TIMESTN_PANE_REC_HEIGHT-DATA_TIMELINE_Y_ORIG-COLOR_NOTATION_HEIGHT;
public static final int DATA_TIMELINE_X_END = DATA_TIMELINE_X_ORIG+DATA_TIMELINE_WIDTH;
public static final int DATA_TIMELINE_Y_END = DATA_TIMELINE_Y_ORIG+DATA_TIMELINE_HEIGHT;
public static final int DATA_TIMELINE_NEXT_PAGE_END_ = DATA_TIMELINE_Y_ORIG+ CHAR_HEIGHT_;
public static final int STATION_ID_X_ORIG = DATA_TIMELINE_X_END;
public static final int STATION_ID_Y_ORIG = DATA_TIMELINE_Y_ORIG;
public static final int STATION_ID_WIDTH = DATA_TIMELINE_WIDTH;
public static final int STATION_ID_WIDTH = (TIMESTN_PANE_REC_WIDTH - DATA_TIMELINE_WIDTH)/2;
public static final int STATION_ID_HEIGHT = DATA_TIMELINE_HEIGHT;
public static final int STATION_ID_X_END = STATION_ID_X_ORIG+STATION_ID_WIDTH;
public static final int STATION_ID_Y_END = STATION_ID_Y_ORIG+STATION_ID_HEIGHT;
public static final int SND_TYPE_X_ORIG = STATION_ID_X_END;
public static final int SND_TYPE_Y_ORIG = DATA_TIMELINE_Y_ORIG;
public static final int SND_TYPE_WIDTH = STATION_ID_WIDTH;
public static final int SND_TYPE_HEIGHT = DATA_TIMELINE_HEIGHT;
public static final int SND_TYPE_X_END = SND_TYPE_X_ORIG+SND_TYPE_WIDTH;
public static final int SND_TYPE_Y_END = SND_TYPE_Y_ORIG+ SND_TYPE_HEIGHT;
public static final int COLOR_NOTATION_X_ORIG = DATA_TIMELINE_X_ORIG;
public static final int COLOR_NOTATION_Y_ORIG = DATA_TIMELINE_Y_END;
public static final int COLOR_NOTATION_WIDTH = DATA_TIMELINE_WIDTH+STATION_ID_WIDTH;
@ -799,8 +805,10 @@ public class NsharpConstants {
"Severe Potential Page"
};
public enum State {
CURRENT, ACTIVE, INACTIVE,NOTAVAIL ,OVERLAY, AVAIL//was , DISABLED
CURRENT, ACTIVE, INACTIVE,NOTAVAIL , AVAIL, ACTIVE_SRC_COMP, INACTIVE_SRC_COMP,ACTIVE_TM_COMP, INACTIVE_TM_COMP
}
//public enum LoadState { NOTAVAIL , AVAIL}
public enum ActState {CURRENT, ACTIVE, INACTIVE}//, ACTIVE_SRC_COMP, INACTIVE_SRC_COMP,ACTIVE_TM_COMP, INACTIVE_TM_COMP}
public enum SPCGraph {
EBS, STP, SHIP, WINTER, FIRE, HAIL, SARS
}

View file

@ -121,6 +121,9 @@ public class NsharpGraphProperty implements ISerializableObject{
@XmlJavaTypeAdapter(RGBColorAdapter.class)
private RGB windBarbColor= NsharpConstants.color_yellow;
@XmlAttribute
private boolean showFilteredWindInCircle=false;
public boolean isTemp() {
return temp;
}
@ -347,5 +350,13 @@ public class NsharpGraphProperty implements ISerializableObject{
this.windBarbColor = windBarbColor;
}
public boolean isShowFilteredWindInCircle() {
return showFilteredWindInCircle;
}
public void setShowFilteredWindInCircle(boolean showFilteredWindInCircle) {
this.showFilteredWindInCircle = showFilteredWindInCircle;
}
}

View file

@ -0,0 +1,34 @@
package gov.noaa.nws.ncep.ui.nsharp;
import gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import com.raytheon.uf.viz.core.drawables.IFrameCoordinator;
import com.raytheon.viz.ui.tools.AbstractTool;
public class NsharpKeyHandler extends AbstractTool {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
NsharpEditor edtor = NsharpEditor.getActiveNsharpEditor();
if(edtor!= null&& event.getParameter("action") != null && !event.getParameter("action").isEmpty()){
String actionToDo = new String(event.getParameter("action"));
if( actionToDo.equals("arrowdown")){
//System.out.println("Nsharp shift + arrow down ");
if(edtor.getRscHandler()!= null)
edtor.getRscHandler().setSteppingSndTypeList(IFrameCoordinator.FrameChangeOperation.PREVIOUS );
}else if(actionToDo.equals("arrowup")){
//System.out.println("Nsharp shift + arrow up");
if(edtor.getRscHandler()!= null)
edtor.getRscHandler().setSteppingSndTypeList(IFrameCoordinator.FrameChangeOperation.NEXT);
}
else
System.out.println("Nsharp key error");
}
return super.execute(event);
}
}

View file

@ -0,0 +1,49 @@
package gov.noaa.nws.ncep.ui.nsharp;
import gov.noaa.nws.ncep.ui.nsharp.NsharpConstants.ActState;
/**
*
* gov.noaa.nws.ncep.ui.nsharp.NsharpSoundingStateProperty
*
*
* This code has been developed by the NCEP-SIB for use in the AWIPS2 system.
*
* <pre>
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------- ------- -------- -----------
* 06/26/2013 Chin Chen Initial coding
*
* </pre>
*
* @author Chin Chen
* @version 1.0
*/
public class NsharpOperationElement {
public String elementDescription;
public NsharpConstants.ActState actionState; //possible values are ACTIVE, INACTIVE, CURRENT. set by User. Default is Active
public NsharpOperationElement(String elementDescription,
ActState actionState) {
super();
this.elementDescription = elementDescription;
this.actionState = actionState;
}
public String getElementDescription() {
return elementDescription;
}
public void setElementDescription(String elementDescription) {
this.elementDescription = elementDescription;
}
public NsharpConstants.ActState getActionState() {
return actionState;
}
public void setActionState(NsharpConstants.ActState actionState) {
this.actionState = actionState;
}
}

View file

@ -1,5 +1,10 @@
package gov.noaa.nws.ncep.ui.nsharp;
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingLayer;
import java.util.ArrayList;
import java.util.List;
/**
*
@ -22,21 +27,36 @@ package gov.noaa.nws.ncep.ui.nsharp;
*/
public class NsharpSoundingElementStateProperty {
public String elementDescription;
public NsharpConstants.State elementState; // possible values are AVAIL,NOTAVAIL
private String elementDescription; //stnId_timeLine_sndType
//private NsharpConstants.LoadState elementState; // possible values are AVAIL,NOTAVAIL
// NOTAVAIL is set when there is no sounding data loaded for this stn at this time line.
public String stnDescription;
public String timeDescription;
public NsharpStationInfo stnInfo;
private String stnDescription;
private String timeDescription;
private String sndType;
private NsharpStationInfo stnInfo;
private int compColorIndex;
private List<NcSoundingLayer> sndLyLst;
private List<NcSoundingLayer> sndLyLstBk;
public NsharpSoundingElementStateProperty(String elementDescription,
NsharpConstants.State elementState, String stnDescription,
String timeDescription, NsharpStationInfo stnInfo) {
String stnDescription,
String timeDescription, NsharpStationInfo stnInfo, List<NcSoundingLayer> sndLyLst) {
super();
this.elementDescription = elementDescription;
this.elementState = elementState;
//this.elementState = elementState;
this.stnDescription = stnDescription;
this.timeDescription = timeDescription;
this.stnInfo = stnInfo;
this.sndType = stnInfo.getSndType();
this.compColorIndex = NsharpConstants.LINE_COMP1;;
this.sndLyLst = sndLyLst;
sndLyLstBk= new ArrayList<NcSoundingLayer>(sndLyLst.size());
for(NcSoundingLayer ly : sndLyLst){
try {
sndLyLstBk.add((NcSoundingLayer)ly.clone());
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
}
}
public NsharpSoundingElementStateProperty() {
@ -50,12 +70,7 @@ public class NsharpSoundingElementStateProperty {
public void setElementDescription(String elementDescription) {
this.elementDescription = elementDescription;
}
public NsharpConstants.State getElementState() {
return elementState;
}
public void setElementState(NsharpConstants.State elementState) {
this.elementState = elementState;
}
public String getStnDescription() {
return stnDescription;
}
@ -77,12 +92,47 @@ public class NsharpSoundingElementStateProperty {
this.stnInfo = stnInfo;
}
public void copy(NsharpSoundingElementStateProperty target){
elementDescription = target.getElementDescription();
elementState= target.getElementState();
stnDescription=target.getStnDescription();
stnInfo = target.getStnInfo();
timeDescription=target.getTimeDescription();
public int getCompColorIndex() {
return compColorIndex;
}
public void setCompColorIndex(int compColorIndex) {
this.compColorIndex = compColorIndex;
}
public String getSndType() {
return sndType;
}
public void setSndType(String sndType) {
this.sndType = sndType;
}
public List<NcSoundingLayer> getSndLyLst() {
return sndLyLst;
}
public void setSndLyLst(List<NcSoundingLayer> sndLyLst) {
this.sndLyLst = sndLyLst;
}
public List<NcSoundingLayer> getSndLyLstBk() {
return sndLyLstBk;
}
public void setSndLyLstBk(List<NcSoundingLayer> sndLyLstBk) {
this.sndLyLstBk = sndLyLstBk;
}
public void restoreSndLyLstFromBackup(){
sndLyLst.clear();
for(NcSoundingLayer ly : sndLyLstBk){
try {
sndLyLst.add((NcSoundingLayer)ly.clone());
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
}
}
}

View file

@ -43,14 +43,12 @@ public class NsharpStationInfo {
}
protected List<timeLineSpecific> timeLineSpList = new ArrayList<timeLineSpecific>();
//Chin PER protected float latitude;
//protected float longitude;
protected double latitude;
protected double longitude;
protected Timestamp reftime; //uair (same as Synoptictime in uair)
protected Timestamp rangestarttime; //rangestart used by model sounding e.g. PFC sounding, or uair (same as Synoptictime in uair)
protected String stnDisplayInfo;
protected String sndType;
protected String sndType="N/A";
protected String stnId;

View file

@ -261,6 +261,7 @@ public class NsharpSkewTPaneBackground extends NsharpGenericPaneBackground {
if(target==null)
return;
String s = "";
presslinesNumbersShape = target.createWireframeShape(false,desc );
presslinesNumbersShape.allocate(150);
// System.out.println("NsharpConstants.left="+NsharpConstants.left+"NsharpConstants.right"+NsharpConstants.right+" top="+NsharpConstants.top + " bot="+ NsharpConstants.bottom);
@ -288,9 +289,9 @@ public class NsharpSkewTPaneBackground extends NsharpGenericPaneBackground {
double [][] lines = {{world.mapX(NsharpConstants.left), world.mapY(coor.y)},{ world.mapX(NsharpConstants.left)+15* currentZoomLevel*xRatio,
world.mapY(coor.y)}};
presslinesNumbersShape.addLineSegment(lines);
//System.out.println("coor.x="+coor.x+"coor.y="+coor.y);
//System.out.println("lines="+ lines[0] + "; "+ lines[1]);
//System.out.println("x1="+world.mapX(NsharpConstants.left)+"y1=" +world.mapY(coor.y)+"x2="+world.mapX(NsharpConstants.right)+"y2="+
// world.mapY(coor.y));
// world.mapY(coor.y));
}
IExtent ext = desc.getRenderableDisplay().getExtent();
double xmin = ext.getMinX(); //Extent's viewable envelope min x and y
@ -372,6 +373,7 @@ public class NsharpSkewTPaneBackground extends NsharpGenericPaneBackground {
target.drawLine(xmin, world.mapY(coor.y), 0.0, xend,
world.mapY(coor.y), 0.0,
NsharpConstants.pressureColor, 1);
//System.out.println("lines ="+ NsharpConstants.PRESSURE_MARK_LEVELS[i] + "; "+ world.mapY(coor.y));
} catch (VizException e) {
// TODO Auto-generated catch block
e.printStackTrace();

View file

@ -39,7 +39,7 @@ import com.raytheon.viz.ui.panes.VizDisplayPane;
public class NsharpAbstractMouseHandler extends InputHandlerDefaultImpl{//implements IInputHandler {
protected enum Mode {
CREATE, SKEWT_DOWN, HODO_DOWN, HODO_DOWN_MOVE, TIMELINE_DOWN, STATIONID_DOWN, PARCELLINE_DOWN, HODO_WIND_MOTION_DOWN
CREATE, SKEWT_DOWN, HODO_DOWN, HODO_DOWN_MOVE, TIMELINE_DOWN, STATIONID_DOWN,SNDTYPE_DOWN, PARCELLINE_DOWN, HODO_WIND_MOTION_DOWN
};
protected static Display display;
protected NsharpEditor editor;

View file

@ -27,7 +27,6 @@ import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import org.geotools.referencing.crs.DefaultEngineeringCRS;

View file

@ -67,7 +67,6 @@ import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.IRenderableDisplayChangedListener;
import com.raytheon.uf.viz.core.PixelExtent;
import com.raytheon.uf.viz.core.datastructure.LoopProperties;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
import com.raytheon.uf.viz.core.drawables.ResourcePair;
import com.raytheon.uf.viz.core.exception.VizException;
@ -796,6 +795,8 @@ public class NsharpEditor extends AbstractEditor implements IRenderableDisplayC
NsharpConfigStore configStore = configMgr.retrieveNsharpConfigStoreFromFs();
NsharpGraphProperty graphConfigProperty = configStore.getGraphProperty();
paneConfigurationName = graphConfigProperty.getPaneConfigurationName();
if(!paneConfigurationName.equals(NsharpConstants.PANE_SPCWS_CFG_STR) && !paneConfigurationName.equals(NsharpConstants.PANE_SIMPLE_D2D_CFG_STR))
paneConfigurationName = NsharpConstants.PANE_SIMPLE_D2D_CFG_STR;
initDisplayPublicParms();
createRenderableDisplayArray();
/*
@ -881,7 +882,7 @@ public class NsharpEditor extends AbstractEditor implements IRenderableDisplayC
if(paletteWin!=null){
paletteWin.restorePaletteWindow(paneConfigurationName, rscHandler.getCurrentGraphMode(),
rscHandler.isInterpolateIsOn(), rscHandler.isOverlayIsOn(),
rscHandler.isCompareStnIsOn(),rscHandler.isCompareTmIsOn(),rscHandler.isEditGraphOn());
rscHandler.isCompareStnIsOn(),rscHandler.isCompareTmIsOn(),rscHandler.isEditGraphOn(), rscHandler.isCompareSndIsOn());
}
createPaneResource();
@ -1122,8 +1123,17 @@ public class NsharpEditor extends AbstractEditor implements IRenderableDisplayC
//System.out.println("SkewtEditor getDisplayPanes called");
//return getDisplayPaneArray();//this.displayPane;
// changed for D2D
if(displayPane.length <=0)
try {
throw new VizException("Display pane is not available!");
} catch (VizException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
IDisplayPane[] pan = { displayPane[DISPLAY_SKEWT]};
return pan;
}
public IRenderableDisplay[] getRenderableDisplays() {
IRenderableDisplay[] displays = new IRenderableDisplay[displayPane.length];
@ -1171,7 +1181,7 @@ public class NsharpEditor extends AbstractEditor implements IRenderableDisplayC
@Override
protected PaneManager getNewPaneManager() {
//return new PaneManager();
return null;
}
private void initDisplayPublicParms(){

View file

@ -99,8 +99,8 @@ public class NsharpSkewTPaneDescriptor extends NsharpAbstractPaneDescriptor {
waitTime = loopProperties.getFwdFrameTime();
else
waitTime = loopProperties.getRevFrameTime();
int frameSize= rscHandler.getTimeLineStateListSize();
int curFrameIndex = rscHandler.getCurrentTimeLineStateListIndex();
int frameSize= rscHandler.getTimeElementListSize();
int curFrameIndex = rscHandler.getCurrentTimeElementListIndex();
if(curFrameIndex == 0)
waitTime = loopProperties.getFirstFrameDwell();
else if(curFrameIndex == frameSize-1)
@ -135,7 +135,7 @@ public class NsharpSkewTPaneDescriptor extends NsharpAbstractPaneDescriptor {
//Chin Note: there are multiple (6) panes.
//However, we only need to step once. Therefore, only handle stepping by skewt pane.
//From stepping commands
//System.out.println("NsharpAbstractPaneDescriptor changeFrame called pane= "+paneNumber);
//System.out.println("NsharpAbstractPaneDescriptor changeFrame called ");
if( VizPerspectiveListener.getCurrentPerspectiveManager()!= null){
//System.out.println("changeFrame: current perspective ="+VizPerspectiveListener.getCurrentPerspectiveManager().getPerspectiveId());
if(!VizPerspectiveListener.getCurrentPerspectiveManager().getPerspectiveId().equals(NmapCommon.NatlCntrsPerspectiveID)){

View file

@ -51,9 +51,10 @@ public class NsharpSkewTPaneMouseHandler extends NsharpAbstractMouseHandler{
@Override
public boolean handleKeyDown(int keyCode) {
//System.out.println("key down="+(char)keyCode+ " code ="+keyCode);
if ((keyCode & SWT.SHIFT) != 0) {
shiftDown = true;
//System.out.println("shift pressed");
return true;
} else if (shiftDown && keyCode == KEY_Z ) {
zDownWhileShiftDown=true;
@ -70,23 +71,7 @@ public class NsharpSkewTPaneMouseHandler extends NsharpAbstractMouseHandler{
return false;
}
NsharpSkewTPaneResource skewRsc = (NsharpSkewTPaneResource)getDescriptor().getPaneResource();
// Arrow key handling is now under NsharpSkewTPaneDescriptor.frameCoordinator.changeFrame()
/*if (keyCode == SWT.ARROW_DOWN) {
skewRsc.getRscHandler().setSteppingStnIdList(FrameChangeOperation.NEXT) ;
return true;
}else if (keyCode == SWT.ARROW_UP) {
//System.out.println("Arrow up");
skewRsc.getRscHandler().setSteppingStnIdList(FrameChangeOperation.PREVIOUS) ;
return true;
}else if (keyCode == SWT.ARROW_LEFT) {
//System.out.println("Arrow left");
skewRsc.getRscHandler().setSteppingTimeLine(FrameChangeOperation.PREVIOUS, FrameChangeMode.TIME_ONLY) ;
return true;
}else if (keyCode == SWT.ARROW_RIGHT) {
//System.out.println("Arrow right");
skewRsc.getRscHandler().setSteppingTimeLine(FrameChangeOperation.NEXT, FrameChangeMode.TIME_ONLY) ;
return true;
} else */if (keyCode == SWT.SHIFT) {
if (keyCode == SWT.SHIFT) {
shiftDown = false;
return true;
}else if (zDownWhileShiftDown && keyCode == KEY_Z ) {
@ -97,21 +82,7 @@ public class NsharpSkewTPaneMouseHandler extends NsharpAbstractMouseHandler{
}
return false;
}
/*public static void startEditingCursor(){
editingCursor = new Cursor( display, SWT.CURSOR_CROSS);
cursorControl = display.getCursorControl();
if(cursorControl!=null && editingCursor!=null)
cursorControl.setCursor(editingCursor);
}
public static void stopEditingCursor(){
if(editingCursor!=null&&cursorControl!=null ){
cursorControl.setCursor(null);
}
if(editingCursor!=null){
editingCursor.dispose();
editingCursor= null;
}
}*/
@Override
public boolean handleMouseDown(int x, int y, int mouseButton) {
//ystem.out.println("handleMouseDown x="+ x+ " y="+y);
@ -256,18 +227,15 @@ public class NsharpSkewTPaneMouseHandler extends NsharpAbstractMouseHandler{
this.mode = Mode.CREATE;
NsharpSkewTPaneResource skewRsc = (NsharpSkewTPaneResource)getDescriptor().getPaneResource();
if(editor != null && skewRsc !=null) {
Coordinate c = editor.translateClick(x, y);
Coordinate currentCursorCoord = editor.translateClick(x, y);
//System.out.println(" skewt-handleMouseMove! x="+x+" y="+y+" C.x="+c.x + " c.y="+c.y);
if (skewRsc.getSkewTBackground().contains(c)){
if (skewRsc.getSkewTBackground().contains(currentCursorCoord)){
//always update coordinate C to SkewT editor
boolean graphEditOn = skewRsc.getRscHandler().isEditGraphOn();
if(graphEditOn == true){
//Point curPoint = display.getCursorLocation();
//int xdiff = x- curPoint.x;
//int ydiff = y- curPoint.y;
Coordinate anchoredPtC;
//get editing cursor point
anchoredPtC= skewRsc.getPickedTempPoint(c);
anchoredPtC= skewRsc.getPickedTempPoint(currentCursorCoord);
int currentSkewTEditMode = skewRsc.getCurrentSkewTEditMode();
if(anchoredPtC.x != 0 || anchoredPtC.y!=0){
//cursor is within editing range ( i.e within 2 degree range from temp/dew line)
@ -281,10 +249,16 @@ public class NsharpSkewTPaneMouseHandler extends NsharpAbstractMouseHandler{
display.getCursorControl().setCursor(null);
}
}
//cursorInSkewT=true;
/* TBDWB
else if(false){
//find wind barb point that closet to current cursor position
skewRsc.findClosestWindBarbPoint(currentCursorCoord);
//do nothing here now. findClosestWindBarbPoint() already handle things for wind barb plotting to use
}*/
skewRsc.setCursorInSkewT(true);
try {
skewRsc.updateDynamicData(c);
skewRsc.updateDynamicData(currentCursorCoord);
editor.refresh();
} catch (VizException e) {
e.printStackTrace();

View file

@ -50,11 +50,12 @@ public class NsharpTimeStnPaneMouseHandler extends NsharpAbstractMouseHandler{
NsharpTimeStnPaneResource timeStnRsc = (NsharpTimeStnPaneResource)getDescriptor().getPaneResource();
if(timeStnRsc.getTimeLineRectangle().contains((int) c.x, (int) c.y)== true) {
this.mode = Mode.TIMELINE_DOWN;
//changeMouse(this.mode);
}
else if(timeStnRsc.getStnIdRectangle().contains((int) c.x, (int) c.y) == true) {
this.mode = Mode.STATIONID_DOWN;
//changeMouse(this.mode);
}
else if(timeStnRsc.getSndRectangle().contains((int) c.x, (int) c.y) == true) {
this.mode = Mode.SNDTYPE_DOWN;
}
editor.refresh();
}
@ -89,6 +90,11 @@ public class NsharpTimeStnPaneMouseHandler extends NsharpAbstractMouseHandler{
timeStnRsc.getRscHandler().handleUserClickOnStationId(c);
handleMouseMove(x,y);
}
else if(timeStnRsc.getSndRectangle().contains((int) c.x, (int) c.y) == true && this.mode == Mode.SNDTYPE_DOWN) {
//stn id line has been touched, and may be changed
timeStnRsc.getRscHandler().handleUserClickOnSndLine(c);
handleMouseMove(x,y);
}
this.mode = Mode.CREATE;
} else if(mouseButton == 3){

View file

@ -22,56 +22,48 @@
package gov.noaa.nws.ncep.ui.nsharp.display.map;
import java.awt.Color;
import java.io.File;
import java.util.List;
import java.util.ArrayList;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PlatformUI;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import com.vividsolutions.jts.geom.Coordinate;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.PixelExtent;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.drawables.PaintProperties;
import com.raytheon.uf.viz.core.drawables.ResourcePair;
import com.raytheon.uf.viz.core.map.IMapDescriptor;
import com.raytheon.uf.viz.core.map.MapDescriptor;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.IInputHandler;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.core.rsc.ResourceProperties;
import com.raytheon.uf.viz.core.rsc.ResourceList.RemoveListener;
import com.raytheon.uf.viz.core.rsc.capabilities.EditableCapability;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.viz.ui.EditorUtil;
import com.raytheon.viz.ui.editor.AbstractEditor;
import com.raytheon.viz.ui.input.EditableManager;
import gov.noaa.nws.ncep.viz.common.display.NcDisplayType;
import gov.noaa.nws.ncep.viz.localization.NcPathManager;
import gov.noaa.nws.ncep.viz.localization.NcPathManager.NcPathConstants;
import gov.noaa.nws.ncep.viz.resources.manager.ResourceBndlLoader;
import gov.noaa.nws.ncep.viz.ui.display.NatlCntrsEditor;
import gov.noaa.nws.ncep.viz.ui.display.AbstractNcEditor;
import gov.noaa.nws.ncep.viz.ui.display.NcEditorUtil;
import gov.noaa.nws.ncep.viz.ui.display.NatlCntrsEditor;
import gov.noaa.nws.ncep.viz.ui.display.NcDisplayMngr;
import gov.noaa.nws.ncep.ui.nsharp.NsharpConstants;
import gov.noaa.nws.ncep.ui.nsharp.NsharpStationInfo;
import gov.noaa.nws.ncep.ui.nsharp.view.NsharpPaletteWindow;
import gov.noaa.nws.ncep.ui.pgen.display.DisplayElementFactory;
import gov.noaa.nws.ncep.ui.pgen.display.IDisplayable;
import gov.noaa.nws.ncep.ui.pgen.elements.SymbolLocationSet;
import gov.noaa.nws.ncep.viz.common.display.NcDisplayType;
import gov.noaa.nws.ncep.viz.resources.manager.ResourceBndlLoader;
import gov.noaa.nws.ncep.viz.ui.display.NatlCntrsEditor;
import gov.noaa.nws.ncep.viz.ui.display.NcDisplayMngr;
import gov.noaa.nws.ncep.viz.ui.display.NcEditorUtil;
import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PlatformUI;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.PixelExtent;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.drawables.PaintProperties;
import com.raytheon.uf.viz.core.drawables.ResourcePair;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.map.IMapDescriptor;
import com.raytheon.uf.viz.core.map.MapDescriptor;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.IInputHandler;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.core.rsc.ResourceList.RemoveListener;
import com.raytheon.uf.viz.core.rsc.ResourceProperties;
import com.raytheon.uf.viz.core.rsc.capabilities.EditableCapability;
import com.raytheon.viz.ui.editor.AbstractEditor;
import com.raytheon.viz.ui.input.EditableManager;
import com.vividsolutions.jts.geom.Coordinate;
public class NsharpMapResource extends AbstractVizResource<NsharpMapResourceData,MapDescriptor>
@ -160,7 +152,6 @@ public class NsharpMapResource extends AbstractVizResource<NsharpMapResourceDat
waitCursor= null;
}
}
@SuppressWarnings("unused")
private static void createMapEditor(){
// create an editor MapEditor
try {

View file

@ -337,9 +337,7 @@ public class NsharpDataPaneResource extends NsharpAbstractPaneResource{
float layerPressure1 = NsharpNativeConstants.parcelToLayerMap.get(parcelNumber);
if(parcelNumber == NsharpNativeConstants.PARCELTYPE_USER_DEFINED){
//get user selected parcel type, if available
if(NsharpParcelDialog.getAccess() != null){
layerPressure1 = NsharpParcelDialog.getAccess().getUserDefdParcelMb();
}
layerPressure1 = NsharpParcelDialog.getUserDefdParcelMb();
}
//System.out.println("drawPanel1-1 called define_parcel pType="+parcelNumber+" pre="+ layerPressure1);
@ -439,11 +437,7 @@ public class NsharpDataPaneResource extends NsharpAbstractPaneResource{
target.drawLine(rect.x, curY, 0.0, rect.x+rect.width, curY, 0.0, NsharpConstants.color_white, 1);
parcelLineYEnd= curY;
if(currentParcel == NsharpNativeConstants.PARCELTYPE_USER_DEFINED){
if(NsharpParcelDialog.getAccess() != null){
layerPressure = NsharpParcelDialog.getAccess().getUserDefdParcelMb();
}
else
layerPressure = NsharpNativeConstants.parcelToLayerMap.get(currentParcel);
layerPressure = NsharpParcelDialog.getUserDefdParcelMb();
}
else
layerPressure = NsharpNativeConstants.parcelToLayerMap.get(currentParcel);
@ -1099,11 +1093,7 @@ public class NsharpDataPaneResource extends NsharpAbstractPaneResource{
//System.out.println("drawPanel2-2 called define_parcel pType="+oldlplchoice+" pre="+ pres);
try{
if(oldlplchoice == NsharpNativeConstants.PARCELTYPE_USER_DEFINED){
if(NsharpParcelDialog.getAccess() != null){
pres = NsharpParcelDialog.getAccess().getUserDefdParcelMb();
}
else
pres = NsharpNativeConstants.parcelToLayerMap.get(oldlplchoice);
pres = NsharpParcelDialog.getUserDefdParcelMb();
}
else
pres = NsharpNativeConstants.parcelToLayerMap.get(oldlplchoice);
@ -1429,10 +1419,7 @@ public class NsharpDataPaneResource extends NsharpAbstractPaneResource{
hdrStr = NsharpNativeConstants.parcelToHdrStrMap.get(currentParcel);
layerPressure = NsharpNativeConstants.parcelToLayerMap.get(currentParcel);
if(currentParcel == NsharpNativeConstants.PARCELTYPE_USER_DEFINED ){
if(NsharpParcelDialog.getAccess() != null){
layerPressure = NsharpParcelDialog.getAccess().getUserDefdParcelMb();
}
layerPressure = NsharpParcelDialog.getUserDefdParcelMb();
hdrStr = String.format(hdrStr, layerPressure);
}
curY = curY + charHeight;
@ -2744,8 +2731,8 @@ public class NsharpDataPaneResource extends NsharpAbstractPaneResource{
// set default
//short currentParcel;
float layerPressure;
if(currentParcel == NsharpNativeConstants.PARCELTYPE_USER_DEFINED && NsharpParcelDialog.getAccess() != null){
layerPressure = NsharpParcelDialog.getAccess().getUserDefdParcelMb();
if(currentParcel == NsharpNativeConstants.PARCELTYPE_USER_DEFINED ){
layerPressure = NsharpParcelDialog.getUserDefdParcelMb();
}
else
layerPressure = NsharpNativeConstants.parcelToLayerMap.get(currentParcel);

View file

@ -20,15 +20,13 @@ package gov.noaa.nws.ncep.ui.nsharp.display.rsc;
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingLayer;
import gov.noaa.nws.ncep.ui.nsharp.NsharpConstants;
import gov.noaa.nws.ncep.ui.nsharp.NsharpGraphProperty;
import gov.noaa.nws.ncep.ui.nsharp.NsharpOperationElement;
import gov.noaa.nws.ncep.ui.nsharp.NsharpShapeAndLineProperty;
import gov.noaa.nws.ncep.ui.nsharp.NsharpSoundingElementStateProperty;
import gov.noaa.nws.ncep.ui.nsharp.NsharpStationStateProperty;
import gov.noaa.nws.ncep.ui.nsharp.NsharpTimeLineStateProperty;
import gov.noaa.nws.ncep.ui.nsharp.background.NsharpHodoPaneBackground;
import gov.noaa.nws.ncep.ui.nsharp.display.NsharpHodoPaneDescriptor;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.eclipse.swt.graphics.GC;
@ -69,16 +67,9 @@ public class NsharpHodoPaneResource extends NsharpAbstractPaneResource{
private IWireframeShape hodoWindMotionBoxShape = null;
private boolean cursorInHodo=false;
private Integer markerWidth = 1;
private List<NsharpTimeLineStateProperty> timeLineStateList;
private List<NsharpStationStateProperty> stnStateList;
private IFont fixedFont;
private int hodoWidth = NsharpConstants.HODO_WIDTH;
private int hodoHeight = NsharpConstants.HODO_HEIGHT;
//private int hodoXOrig = NsharpConstants.HODO_X_ORIG;
//private int hodoYOrig = NsharpConstants.HODO_Y_ORIG;
//private int hodoXEnd = NsharpConstants.HODO_X_END;
//private int hodoYEnd = NsharpConstants.HODO_Y_ORIG+ NsharpConstants.HODO_HEIGHT;
//private Coordinate hodoHouseC = new Coordinate(NsharpConstants.HODO_CENTER_X_, NsharpConstants.HODO_CENTER_Y_);
private float xRatio=1;
private float yRatio=1;
public NsharpHodoPaneResource(AbstractResourceData resourceData,
@ -188,38 +179,46 @@ public class NsharpHodoPaneResource extends NsharpAbstractPaneResource{
}
world = hodoBackground.computeWorld();
boolean compareStnIsOn = rscHandler.isCompareStnIsOn();
int currentTimeLineStateListIndex = rscHandler.getCurrentTimeLineStateListIndex();
int currentTimeListIndex = rscHandler.getCurrentTimeElementListIndex();
int currentStnListIndex = rscHandler.getCurrentStnElementListIndex();
int currentSndListIndex = rscHandler.getCurrentSndElementListIndex();
List<NsharpOperationElement> stnElemList = rscHandler.getStnElementList();
List<NsharpOperationElement> timeElemList = rscHandler.getTimeElementList();
List<NsharpOperationElement> sndElemList = rscHandler.getSndElementList();
List<List<List<NsharpSoundingElementStateProperty>>> stnTimeSndTable = rscHandler.getStnTimeSndTable();
boolean compareTmIsOn = rscHandler.isCompareTmIsOn();
boolean compareSndIsOn = rscHandler.isCompareSndIsOn();
boolean overlayIsOn = rscHandler.isOverlayIsOn();
int currentStnStateListIndex = rscHandler.getCurrentStnStateListIndex();
stnStateList = rscHandler.getStnStateList();
timeLineStateList = rscHandler.getTimeLineStateList();
List<List<NsharpSoundingElementStateProperty>> stnTimeTable = rscHandler.getStnTimeTable();
HashMap<String, List<NcSoundingLayer>> dataTimelineSndLysListMap = rscHandler.getDataTimelineSndLysListMap();
if(compareStnIsOn && currentTimeLineStateListIndex >=0){
int colorIndex =NsharpConstants.LINE_COMP1;
for(NsharpStationStateProperty elm: stnStateList) {
if(elm.stnState == NsharpConstants.State.ACTIVE &&
stnTimeTable.get(stnStateList.indexOf(elm)).get(currentTimeLineStateListIndex).elementState == NsharpConstants.State.AVAIL){
List<NcSoundingLayer> soundingLayeys = dataTimelineSndLysListMap.get(stnTimeTable.get(stnStateList.indexOf(elm)).get(currentTimeLineStateListIndex).elementDescription);
if(compareStnIsOn && currentTimeListIndex >=0 && currentSndListIndex >=0){
for(NsharpOperationElement elm: stnElemList) {
if(elm.getActionState() == NsharpConstants.ActState.ACTIVE &&
stnTimeSndTable.get(stnElemList.indexOf(elm)).get(currentTimeListIndex).get(currentSndListIndex)!=null){
List<NcSoundingLayer> soundingLayeys = stnTimeSndTable.get(stnElemList.indexOf(elm)).get(currentTimeListIndex).get(currentSndListIndex).getSndLyLst();
int colorIndex = stnTimeSndTable.get(stnElemList.indexOf(elm)).get(currentTimeListIndex).get(currentSndListIndex).getCompColorIndex();
RGB color = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]).getLineColor();
colorIndex++;
if(colorIndex > NsharpConstants.LINE_COMP10)
colorIndex =NsharpConstants.LINE_COMP1;
createRscHodoWindShape(world, soundingLayeys, color);
}
}
}
else if(compareTmIsOn && currentStnStateListIndex >=0 ){
int colorIndex =NsharpConstants.LINE_COMP1;
for(NsharpTimeLineStateProperty elm: timeLineStateList) {
if(elm.timeState == NsharpConstants.State.ACTIVE &&
stnTimeTable.get(currentStnStateListIndex).get(timeLineStateList.indexOf(elm)).elementState == NsharpConstants.State.AVAIL){
List<NcSoundingLayer> soundingLayeys = dataTimelineSndLysListMap.get(stnTimeTable.get(currentStnStateListIndex).get(timeLineStateList.indexOf(elm)).elementDescription);
else if(compareTmIsOn && currentStnListIndex >=0 && currentSndListIndex >=0 ){
for(NsharpOperationElement elm: timeElemList) {
if(elm.getActionState() == NsharpConstants.ActState.ACTIVE &&
stnTimeSndTable.get(currentStnListIndex).get(timeElemList.indexOf(elm)).get(currentSndListIndex)!=null){
List<NcSoundingLayer> soundingLayeys = stnTimeSndTable.get(currentStnListIndex).get(timeElemList.indexOf(elm)).get(currentSndListIndex).getSndLyLst(); // dataTimelineSndLysListMap.get(stnTimeSndTable.get(currentStnListIndex).get(timeElemList.indexOf(elm)).get(currentSndListIndex).getElementDescription());
int colorIndex = stnTimeSndTable.get(currentStnListIndex).get(timeElemList.indexOf(elm)).get(currentSndListIndex).getCompColorIndex();
RGB color = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]).getLineColor();
createRscHodoWindShape(world, soundingLayeys, color);
}
}
}
else if(compareSndIsOn && currentStnListIndex >=0 && currentTimeListIndex >=0){
for(NsharpOperationElement elm: sndElemList) {
if(elm.getActionState() == NsharpConstants.ActState.ACTIVE &&
stnTimeSndTable.get(currentStnListIndex).get(currentTimeListIndex).get(sndElemList.indexOf(elm))!=null){
List<NcSoundingLayer> soundingLayeys = stnTimeSndTable.get(currentStnListIndex).get(currentTimeListIndex).get(sndElemList.indexOf(elm)).getSndLyLst(); //dataTimelineSndLysListMap.get(stnTimeSndTable.get(currentStnListIndex).get(currentTimeListIndex).get(sndElemList.indexOf(elm)).getElementDescription());
int colorIndex = stnTimeSndTable.get(currentStnListIndex).get(currentTimeListIndex).get(sndElemList.indexOf(elm)).getCompColorIndex();
RGB color = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]).getLineColor();
colorIndex++;
if(colorIndex > NsharpConstants.LINE_COMP10)
colorIndex =NsharpConstants.LINE_COMP1;
createRscHodoWindShape(world, soundingLayeys, color);
}
}
@ -560,8 +559,6 @@ public class NsharpHodoPaneResource extends NsharpAbstractPaneResource{
if(rscHandler==null)
return;
timeLineStateList = rscHandler.getTimeLineStateList(); //System.out.println("NsharpHodoPaneResource "+ descriptor.getPaneNumber());
stnStateList = rscHandler.getStnStateList();
hodoBackground.paintInternal(target, paintProps);
if((soundingLys != null) && (soundingLys.size()>= 4))
{

View file

@ -21,11 +21,10 @@ package gov.noaa.nws.ncep.ui.nsharp.display.rsc;
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingLayer;
import gov.noaa.nws.ncep.ui.nsharp.NsharpConstants;
import gov.noaa.nws.ncep.ui.nsharp.NsharpLineProperty;
import gov.noaa.nws.ncep.ui.nsharp.NsharpOperationElement;
import gov.noaa.nws.ncep.ui.nsharp.NsharpShapeAndLineProperty;
import gov.noaa.nws.ncep.ui.nsharp.NsharpSoundingElementStateProperty;
import gov.noaa.nws.ncep.ui.nsharp.NsharpStationInfo;
import gov.noaa.nws.ncep.ui.nsharp.NsharpStationStateProperty;
import gov.noaa.nws.ncep.ui.nsharp.NsharpTimeLineStateProperty;
import gov.noaa.nws.ncep.ui.nsharp.NsharpWxMath;
import gov.noaa.nws.ncep.ui.nsharp.background.NsharpGenericPaneBackground;
import gov.noaa.nws.ncep.ui.nsharp.background.NsharpIcingPaneBackground;
@ -49,7 +48,6 @@ import java.awt.Color;
import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.locks.ReentrantLock;
@ -81,9 +79,7 @@ import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.d2d.ui.perspectives.D2D5Pane;
import com.raytheon.viz.core.graphing.LineStroke;
import com.raytheon.viz.core.graphing.WGraphics;
import com.raytheon.viz.core.graphing.WindBarbFactory;
import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
import com.sun.jna.ptr.FloatByReference;
import com.vividsolutions.jts.geom.Coordinate;
@ -102,14 +98,11 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
private int skewtHeight = NsharpConstants.SKEWT_HEIGHT;
private int skewtXOrig = NsharpConstants.SKEWT_X_ORIG;
private int skewtYOrig = NsharpConstants.SKEWT_Y_ORIG;
//private int skewtXEnd = NsharpConstants.SKEWT_X_END;
//private int skewtYEnd = NsharpConstants.SKEWT_Y_END;
private float omegaXOrig = NsharpConstants.OMEGA_X_ORIG;
private float omegaYOrig = NsharpConstants.OMEGA_Y_ORIG;
private float omegaWidth = NsharpConstants.OMEGA_WIDTH;
private float omegaHeight = NsharpConstants.OMEGA_HEIGHT;
private float omegaYEnd = NsharpConstants.OMEGA_Y_END;
//private float omegaMF = NsharpConstants.OMEGA_MAGNIFICATION_FACTOR;
private float xRatio=1;
private float yRatio=1;
private String sTemperatureC= "";
@ -153,7 +146,6 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
private int currentTempCurveType;
private Coordinate interactiveTempPointCoordinate;
private boolean plotInteractiveTemp= false;
//private double mycurrentZoomLevel=1;
private boolean cursorInSkewT = false;
private static int CURSER_FONT_INC_STEP = 3;
private static int CURSER_FONT_10 =10;
@ -162,7 +154,28 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
private String myPerspective= NmapCommon.NatlCntrsPerspectiveID;
public static ReentrantLock reentryLock = new ReentrantLock ();
private boolean justMoveToSidePane = false;
public boolean isJustMoveToSidePane() {
private boolean cursorTopWindBarb = false;
private boolean windBarbMagnify = false;
private int currentWindBarbSoundingLayerIndex;
public boolean isWindBarbMagnify() {
return windBarbMagnify;
}
public void setWindBarbMagnify(boolean windBarbMagnify) {
this.windBarbMagnify = windBarbMagnify;
}
public boolean isCursorTopWindBarb() {
return cursorTopWindBarb;
}
public void setCursorTopWindBarb(boolean cursorTopWindBarb) {
this.cursorTopWindBarb = cursorTopWindBarb;
}
public boolean isJustMoveToSidePane() {
return justMoveToSidePane;
}
@ -777,14 +790,14 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
*
* Draws Wind barb vs height
* This function followed algorithm in plot_barbs (void) at xwvid1.c
* to choose wind bulb for drawing around every 400m
* to choose wind bulbs with minimum distance defined @ graphConfigProperty.getWindBarbDistance()
*
*/
private void drawNsharpWindBarb(IGraphicsTarget target, double zoomLevel,
WGraphics world, RGB iicolor, List<NcSoundingLayer> sndLys, double xPosition, double botPress)throws VizException {
if(sndLys.size()< 4)
return;
//ArrayList<List<LineStroke>> windList = new ArrayList<List<LineStroke>>();
//ArrayList<List<LineStroke>> windList = new ArrayList<List<LineStroke>>();
List<windPickedElement> layerStateList = new ArrayList<windPickedElement>();
float lastHeight = -9999;
RGB icolor = iicolor;//graphConfigProperty.getWindBarbColor();
@ -807,6 +820,7 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
//System.out.println( "layer#"+ i+ " RE_MAX_WIND =" + spd );
}
}
//DR16384 : handle when all winds are not positive case
if (layerStateList.isEmpty()) {
return;
}
@ -820,8 +834,7 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
if ( pressure < botPress || spd < 0 ) {
continue;
}
if ((ele.layer.getGeoHeight() - lastHeight) < graphConfigProperty.getWindBarbDistance()){// *zoomLevel ){
if ((ele.layer.getGeoHeight() - lastHeight) < graphConfigProperty.getWindBarbDistance() *zoomLevel ){
if(ele.myState.equals(eleState.RE_MAX_WIND) && spd > lastEle.layer.getWindSpeed()){
//swapped last picked layer with this relative max wind layer
lastEle.myState = eleState.UNPICKED;
@ -840,80 +853,58 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
lastHeight = ele.layer.getGeoHeight();
lastEle = ele;
}
}
double windX = xPosition;
double windY=0;
//double barbScaleFactorx, barbScaleFactory;
//barbScaleFactorx = zoomLevel;
// barbScaleFactory = zoomLevel;
//List<double[]> locations = new ArrayList<double[]>();
//System.out.println("zoom="+zoomLevel +"world viewYmin="+world.getViewYmin()+" viewYmax="+world.getViewYmax()+" wolrdYmin="+ world.getWorldYmin()+" wolrdYmax="+ world.getWorldYmax()
// +"world viewXmin="+world.getViewXmin()+" viewXmax="+world.getViewXmax()+" wolrdXmin="+ world.getWorldXmin()+" wolrdXmax="+ world.getWorldXmax());
//plot wind barbs
List<IVector> windVectList = new ArrayList<IVector>();
Color[] colors = new Color[1];
Color color = new Color(icolor.red, icolor.green, icolor.blue);
colors[0]= color;
DisplayElementFactory df = new DisplayElementFactory (target, this.descriptor);
ArrayList<IDisplayable> elements = new ArrayList<IDisplayable> ();
//double shift=2;
//int shiftDirection=1;
float wbSize = graphConfigProperty.getWindBarbSize();
float wbWidth = graphConfigProperty.getWindBarbLineWidth();
for(windPickedElement ele: layerStateList){
/*shift = shift + shiftDirection;
if(shift >=1 || shift <= -1)
shiftDirection=-1* shiftDirection;
if(shift==2)
shift=0;
else
shift=2;*/
NcSoundingLayer layer = ele.layer;
float pressure = layer.getPressure();
if(pressure < 100)
continue;
float spd = layer.getWindSpeed();
float dir = layer.getWindDirection();
//test
//dir= (dir+50)%360;
// Get the vertical ordinate.
if(currentGraphMode== NsharpConstants.GRAPH_SKEWT){
windY = NsharpWxMath.getSkewTXY(pressure, 0).y;
//barbScaleFactorx = 0.6*zoomLevel;
//barbScaleFactory= zoomLevel;
}
else if(currentGraphMode== NsharpConstants.GRAPH_ICING ){
//Chin:Y axis (pressure) is scaled using log scale and increaing downward
//WorldYmin= at pressure 1000,its value actually is 1000 (max), wolrdYmax = at pressure 300, its value is 825 (min)
windY = world.getWorldYmax() + (world.getWorldYmin()-icingBackground.toLogScale(pressure));
//barbScaleFactorx = 1.3*zoomLevel;
//barbScaleFactory= 2.5*zoomLevel;//experimental value: depends on the world coordinate size set
}else if( currentGraphMode== NsharpConstants.GRAPH_TURB){
//Chin:Y axis (pressure) is scaled using log scale and increaing downward
//WorldYmin= at pressure 1000,its value actually is 1000 (max), wolrdYmax = at pressure 300, its value is 825 (min)
windY = world.getWorldYmax() + (world.getWorldYmin()-turbBackground.toLogScale(pressure));
//barbScaleFactorx = .12*zoomLevel;//experimental value: depends on the world coordinate size set
//barbScaleFactory=3.8*zoomLevel;
}
else
continue;
float curWbSize = wbSize;
float curWbWidth = wbWidth;
if(ele.myState.equals(eleState.UNPICKED)){
//double[] loc= {world.mapX(windX), world.mapY(windY)};
//locations.add(loc);
continue;
//spd=0.1f;//Chin::if we want pgen to draw unpicked wind as a circle, then set this.
}
//System.out.println("spd="+spd+" dir="+dir);
/*
List<LineStroke> barb = WindBarbFactory.getWindGraphics((double) (spd), (double) dir);
if (barb != null) {
// WindBarbFactory.scaleBarb(barb, zoomLevel*barbScaleFactor);
for (LineStroke stroke : barb) {
stroke.scale(barbScaleFactorx, barbScaleFactory);
}
WindBarbFactory.translateBarb(barb, windX, windY);
windList.add(barb);
if(graphConfigProperty.isShowFilteredWindInCircle()){
//Chin::if we want pgen to draw un-picked wind as a circle, then set this.
spd=0.1f;
curWbSize = 1;
}
else
continue;
}
/* TBDWB
else if(windBarbMagnify==true && cursorTopWindBarb == true && currentWindBarbSoundingLayerIndex == this.soundingLys.indexOf(layer)){
curWbSize = wbSize*2;
curWbWidth = wbWidth*2;
}*/
//use PGEN tool
Vector vect= new Vector();
vect.setVectorType(VectorType.WIND_BARB);
@ -921,18 +912,15 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
dir= (dir+180.0f)%360.0f;
vect.setDirection(dir);
vect.setSpeed(spd);
vect.setSizeScale(graphConfigProperty.getWindBarbSize());
vect.setLineWidth(graphConfigProperty.getWindBarbLineWidth());
vect.setSizeScale(curWbSize);
vect.setLineWidth(curWbWidth);
vect.setClear(true);
vect.setColors(colors);
Coordinate location = new Coordinate(world.mapX(windX/*-shift*/), world.mapY(windY));
Coordinate location = new Coordinate(world.mapX(windX), world.mapY(windY));
vect.setLocation(location);
windVectList.add(vect);
ArrayList<IDisplayable> subelements = df.createDisplayElements(vect,paintProps);
elements.addAll(subelements);
}
//ArrayList<IDisplayable> elements = df.createDisplayElements(windVectList,paintProps);
for (IDisplayable each : elements)
{
try {
@ -944,16 +932,6 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
//System.out.println("paintInternal caught draw exception!");
}
}
//#3: plot "unpicked" layer with a small dot
/*
target.drawPoints(locations, icolor, PointStyle.POINT,2);
for (List<LineStroke> barb : windList) {
//System.out.println("barb");
for (LineStroke stroke : barb) {
//System.out.println("p1x="+(int)stroke.getPoint().x+" p1y="+(int)stroke.getPoint().y);
stroke.render(target, world, icolor);
}
}*/
}
/**
@ -1329,8 +1307,8 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
NsharpSoundingElementStateProperty preSndProfileProp= rscHandler.getPreSndProfileProp();
if(preSndProfileProp!= null){
pickedStnColor = linePropertyMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_OVERLAY2]).getLineColor();
String stnInfoStr = preSndProfileProp.elementDescription;
latlonStr = Math.rint(preSndProfileProp.stnInfo.getLatitude()*100)/100 + "," + Math.rint(preSndProfileProp.stnInfo.getLongitude()*100)/100;
String stnInfoStr = preSndProfileProp.getElementDescription();
latlonStr = Math.rint(preSndProfileProp.getStnInfo().getLatitude()*100)/100 + "," + Math.rint(preSndProfileProp.getStnInfo().getLongitude()*100)/100;
DrawableString str =new DrawableString( stnInfoStr+" "+latlonStr,pickedStnColor);
str.font = font10;
str.setCoordinates(dispX + 300 * zoomLevel* xRatio, dispY);
@ -1438,9 +1416,6 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
@Override
protected void paintInternal(IGraphicsTarget target,
PaintProperties paintProps) throws VizException {
//System.out.println("NsharpSkewTPaneResource paintInternal called! I am pane "+ this.toString());
//double X = NsharpConstants.WIND_BX_X_ORIG;
//double Y = 80;
this.paintProps = paintProps;
if(soundingLys==null)
return;
@ -1454,12 +1429,21 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
//rscHandler.repopulateSndgData();//CHIN swapping
if(justMoveToSidePane){
reentryLock.lock();
rscHandler.repopulateSndgData();//CHIN swapping TBDDD???
//to check a scenario that sounding data is removed while thread is locked
if(soundingLys==null ||(soundingLys!=null && soundingLys.size()<=0)){
reentryLock.unlock();
return;
}
rscHandler.repopulateSndgData();
handleResize();
justMoveToSidePane = false;
reentryLock.unlock();
}else if(justBackToMainPane ){
reentryLock.lock();
if(soundingLys==null ||(soundingLys!=null && soundingLys.size()<=0)){
reentryLock.unlock();
return;
}
rscHandler.repopulateSndgData();//CHIN swapping
createRscWireFrameShapes();
justBackToMainPane = false;
@ -1468,7 +1452,7 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
if(paletteWin!=null){
paletteWin.restorePaletteWindow(paneConfigurationName, rscHandler.getCurrentGraphMode(),
rscHandler.isInterpolateIsOn(), rscHandler.isOverlayIsOn(),
rscHandler.isCompareStnIsOn(),rscHandler.isCompareTmIsOn(),rscHandler.isEditGraphOn());
rscHandler.isCompareStnIsOn(),rscHandler.isCompareTmIsOn(),rscHandler.isEditGraphOn(), rscHandler.isCompareSndIsOn());
}
}
}
@ -1514,6 +1498,7 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
}
}
boolean compareStnIsOn = rscHandler.isCompareStnIsOn();
boolean compareSndIsOn = rscHandler.isCompareSndIsOn();
boolean compareTmIsOn = rscHandler.isCompareTmIsOn();
boolean editGraphOn= rscHandler.isEditGraphOn();
boolean overlayIsOn = rscHandler.isOverlayIsOn();
@ -1634,40 +1619,47 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
drawNsharpWindBarb(target, currentZoomLevel, world, linePropertyMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_OVERLAY2]).getLineColor(), this.previousSoundingLys, xPos - NsharpResourceHandler.BARB_LENGTH,100);
}
else{
if(!compareStnIsOn && !compareTmIsOn){
//NsharpLineProperty lp =linePropertyMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_WIND_BARB]);
drawNsharpWindBarb(target, currentZoomLevel, world, graphConfigProperty.getWindBarbColor()/*lp.getLineColor()*/, this.soundingLys, xPos,100);
if(!compareStnIsOn && !compareTmIsOn && !compareSndIsOn){
drawNsharpWindBarb(target, currentZoomLevel, world, graphConfigProperty.getWindBarbColor(), this.soundingLys, xPos,100);
}
else{
int currentTimeLineStateListIndex = rscHandler.getCurrentTimeLineStateListIndex();
int currentStnStateListIndex = rscHandler.getCurrentStnStateListIndex();
List<NsharpStationStateProperty> stnStateList = rscHandler.getStnStateList();
List<NsharpTimeLineStateProperty> timeLineStateList = rscHandler.getTimeLineStateList();
List<List<NsharpSoundingElementStateProperty>> stnTimeTable = rscHandler.getStnTimeTable();
HashMap<String, List<NcSoundingLayer>> dataTimelineSndLysListMap = rscHandler.getDataTimelineSndLysListMap();
if(compareTmIsOn && currentStnStateListIndex >=0 ){
int colorIndex =NsharpConstants.LINE_COMP1;
for(NsharpTimeLineStateProperty elm: timeLineStateList) {
if(elm.getTimeState() == NsharpConstants.State.ACTIVE &&
stnTimeTable.get(currentStnStateListIndex).get(timeLineStateList.indexOf(elm)).getElementState() == NsharpConstants.State.AVAIL){
List<NcSoundingLayer> soundingLayeys = dataTimelineSndLysListMap.get(stnTimeTable.get(currentStnStateListIndex).get(timeLineStateList.indexOf(elm)).getElementDescription());
int currentTimeListIndex = rscHandler.getCurrentTimeElementListIndex();
int currentStnListIndex = rscHandler.getCurrentStnElementListIndex();
int currentSndListIndex = rscHandler.getCurrentSndElementListIndex();
List<NsharpOperationElement> stnElemList = rscHandler.getStnElementList();
List<NsharpOperationElement> timeElemList = rscHandler.getTimeElementList();
List<NsharpOperationElement> sndElemList = rscHandler.getSndElementList();
List<List<List<NsharpSoundingElementStateProperty>>> stnTimeSndTable = rscHandler.getStnTimeSndTable();
if(compareTmIsOn && currentStnListIndex >=0 && currentSndListIndex >=0){
int colorIndex;
for(NsharpOperationElement elm: timeElemList) {
if(elm.getActionState() == NsharpConstants.ActState.ACTIVE &&
stnTimeSndTable.get(currentStnListIndex).get(timeElemList.indexOf(elm)).get(currentSndListIndex)!=null){
List<NcSoundingLayer> soundingLayeys = stnTimeSndTable.get(currentStnListIndex).get(timeElemList.indexOf(elm)).get(currentSndListIndex).getSndLyLst();
colorIndex = stnTimeSndTable.get(currentStnListIndex).get(timeElemList.indexOf(elm)).get(currentSndListIndex).getCompColorIndex();
NsharpLineProperty lp = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]);
colorIndex++;
if(colorIndex > NsharpConstants.LINE_COMP10)
colorIndex =NsharpConstants.LINE_COMP1;
drawNsharpWindBarb(target, currentZoomLevel, world, lp.getLineColor(), soundingLayeys, xPos,100);
}
}
} else if(compareStnIsOn && currentTimeLineStateListIndex >=0){
int colorIndex =NsharpConstants.LINE_COMP1;
for(NsharpStationStateProperty elm: stnStateList) {
if(elm.getStnState() == NsharpConstants.State.ACTIVE &&
stnTimeTable.get(stnStateList.indexOf(elm)).get(currentTimeLineStateListIndex).getElementState() == NsharpConstants.State.AVAIL){
List<NcSoundingLayer> soundingLayeys = dataTimelineSndLysListMap.get(stnTimeTable.get(stnStateList.indexOf(elm)).get(currentTimeLineStateListIndex).getElementDescription());
} else if(compareStnIsOn && currentTimeListIndex >=0 && currentSndListIndex >=0){
int colorIndex ;
for(NsharpOperationElement elm: stnElemList) {
if(elm.getActionState() == NsharpConstants.ActState.ACTIVE &&
stnTimeSndTable.get(stnElemList.indexOf(elm)).get(currentTimeListIndex).get(currentSndListIndex)!=null){
List<NcSoundingLayer> soundingLayeys = stnTimeSndTable.get(stnElemList.indexOf(elm)).get(currentTimeListIndex).get(currentSndListIndex).getSndLyLst();
colorIndex = stnTimeSndTable.get(stnElemList.indexOf(elm)).get(currentTimeListIndex).get(currentSndListIndex).getCompColorIndex();
NsharpLineProperty lp = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]);
drawNsharpWindBarb(target, currentZoomLevel, world, lp.getLineColor(), soundingLayeys, xPos,100);
}
}
} else if(compareSndIsOn && currentStnListIndex >=0 && currentTimeListIndex >=0){
int colorIndex;
for(NsharpOperationElement elm: sndElemList) {
if(elm.getActionState() == NsharpConstants.ActState.ACTIVE &&
stnTimeSndTable.get(currentStnListIndex).get(currentTimeListIndex).get(sndElemList.indexOf(elm))!=null){
List<NcSoundingLayer> soundingLayeys = stnTimeSndTable.get(currentStnListIndex).get(currentTimeListIndex).get(sndElemList.indexOf(elm)).getSndLyLst();
colorIndex = stnTimeSndTable.get(currentStnListIndex).get(currentTimeListIndex).get(sndElemList.indexOf(elm)).getCompColorIndex();
NsharpLineProperty lp = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]);
colorIndex++;
if(colorIndex > NsharpConstants.LINE_COMP10)
colorIndex =NsharpConstants.LINE_COMP1;
drawNsharpWindBarb(target, currentZoomLevel, world, lp.getLineColor(), soundingLayeys, xPos,100);
}
}
@ -1677,9 +1669,6 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
//System.out.println("x1 pos"+xPos+ " x2 pos="+ (xPos - NsharpResourceHandler.BARB_LENGTH));
}
drawHeightMark(target);
//target.drawWireframeShape(heightMarkRscShape, NsharpConstants.color_red, 1, LineStyle.SOLID, font10);
//if(!compareStnIsOn){
//draw EL, LFC, LCL, FZL, -20C, -30C lines
//drawLclLine(target);
target.drawWireframeShape(lclShape,NsharpConstants.color_green, 2,LineStyle.SOLID, font10);
@ -1688,7 +1677,9 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
target.drawWireframeShape(fzlShape,NsharpConstants.color_cyan, 2,LineStyle.SOLID, font10);
// draw cursor data
if(cursorInSkewT== true){
if(curseToggledFontLevel < CURSER_STRING_OFF)
if((curseToggledFontLevel < CURSER_STRING_OFF)&&
(cursorTopWindBarb == false || windBarbMagnify == false)
)
drawNsharpSkewtCursorData(target);
}
}// end of currentGraphMode= NsharpConstants.GRAPH_SKEWT
@ -1777,22 +1768,20 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
parcelRtShapeList.clear();
}
int currentTimeLineStateListIndex = rscHandler.getCurrentTimeLineStateListIndex();
int currentStnStateListIndex = rscHandler.getCurrentStnStateListIndex();
List<NsharpStationStateProperty> stnStateList = rscHandler.getStnStateList();
List<NsharpTimeLineStateProperty> timeLineStateList = rscHandler.getTimeLineStateList();
List<List<NsharpSoundingElementStateProperty>> stnTimeTable = rscHandler.getStnTimeTable();
HashMap<String, List<NcSoundingLayer>> dataTimelineSndLysListMap = rscHandler.getDataTimelineSndLysListMap();
if(rscHandler.isCompareStnIsOn() && currentTimeLineStateListIndex >=0){
int lpIndex =NsharpConstants.LINE_COMP1;
for(NsharpStationStateProperty elm: stnStateList) {
if(elm.getStnState() == NsharpConstants.State.ACTIVE &&
stnTimeTable.get(stnStateList.indexOf(elm)).get(currentTimeLineStateListIndex).getElementState() == NsharpConstants.State.AVAIL){
List<NcSoundingLayer> soundingLayeys = dataTimelineSndLysListMap.get(stnTimeTable.get(stnStateList.indexOf(elm)).get(currentTimeLineStateListIndex).getElementDescription());
NsharpLineProperty lp = linePropertyMap.get(NsharpConstants.lineNameArray[lpIndex]);
lpIndex++;
if(lpIndex > NsharpConstants.LINE_COMP10)
lpIndex =NsharpConstants.LINE_COMP1;
int currentTimeListIndex = rscHandler.getCurrentTimeElementListIndex();
int currentStnListIndex = rscHandler.getCurrentStnElementListIndex();
int currentSndListIndex = rscHandler.getCurrentSndElementListIndex();
List<NsharpOperationElement> stnElemList = rscHandler.getStnElementList();
List<NsharpOperationElement> timeElemList = rscHandler.getTimeElementList();
List<NsharpOperationElement> sndElemList = rscHandler.getSndElementList();
List<List<List<NsharpSoundingElementStateProperty>>> stnTimeSndTable = rscHandler.getStnTimeSndTable();
if(rscHandler.isCompareStnIsOn() && currentTimeListIndex >=0 && currentSndListIndex >=0){
for(NsharpOperationElement elm: stnElemList) {
if(elm.getActionState() == NsharpConstants.ActState.ACTIVE &&
stnTimeSndTable.get(stnElemList.indexOf(elm)).get(currentTimeListIndex).get(currentSndListIndex)!=null){
List<NcSoundingLayer> soundingLayeys = stnTimeSndTable.get(stnElemList.indexOf(elm)).get(currentTimeListIndex).get(currentSndListIndex).getSndLyLst();
int colorIndex = stnTimeSndTable.get(stnElemList.indexOf(elm)).get(currentTimeListIndex).get(currentSndListIndex).getCompColorIndex();
NsharpLineProperty lp = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]);
IWireframeShape shape = createRTParcelTraceShapes( parcelType, userPre, soundingLayeys);
NsharpShapeAndLineProperty shNLp = new NsharpShapeAndLineProperty();
shNLp.setShape(shape);
@ -1801,16 +1790,29 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
}
}
}
else if(rscHandler.isCompareTmIsOn() && currentStnStateListIndex >=0 ){
int lpIndex =NsharpConstants.LINE_COMP1;
for(NsharpTimeLineStateProperty elm: timeLineStateList) {
if(elm.getTimeState() == NsharpConstants.State.ACTIVE &&
stnTimeTable.get(currentStnStateListIndex).get(timeLineStateList.indexOf(elm)).getElementState() == NsharpConstants.State.AVAIL){
List<NcSoundingLayer> soundingLayeys = dataTimelineSndLysListMap.get(stnTimeTable.get(currentStnStateListIndex).get(timeLineStateList.indexOf(elm)).getElementDescription());
NsharpLineProperty lp = linePropertyMap.get(NsharpConstants.lineNameArray[lpIndex]);
lpIndex++;
if(lpIndex > NsharpConstants.LINE_COMP10)
lpIndex =NsharpConstants.LINE_COMP1;
else if(rscHandler.isCompareTmIsOn() && currentStnListIndex >=0 && currentSndListIndex >=0 ){
//tk#1004int lpIndex =NsharpConstants.LINE_COMP1;
for(NsharpOperationElement elm: timeElemList) {
if(elm.getActionState() == NsharpConstants.ActState.ACTIVE &&
stnTimeSndTable.get(currentStnListIndex).get(timeElemList.indexOf(elm)).get(currentSndListIndex)!=null){
List<NcSoundingLayer> soundingLayeys = stnTimeSndTable.get(currentStnListIndex).get(timeElemList.indexOf(elm)).get(currentSndListIndex).getSndLyLst();
int colorIndex = stnTimeSndTable.get(currentStnListIndex).get(timeElemList.indexOf(elm)).get(currentSndListIndex).getCompColorIndex();
NsharpLineProperty lp = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]);
IWireframeShape shape = createRTParcelTraceShapes( parcelType, userPre, soundingLayeys);
NsharpShapeAndLineProperty shNLp = new NsharpShapeAndLineProperty();
shNLp.setShape(shape);
shNLp.setLp(lp);
parcelRtShapeList.add(shNLp);
}
}
}
else if(rscHandler.isCompareSndIsOn() && currentStnListIndex >=0 && currentTimeListIndex >=0){
for(NsharpOperationElement elm: sndElemList) {
if(elm.getActionState() == NsharpConstants.ActState.ACTIVE &&
stnTimeSndTable.get(currentStnListIndex).get(currentTimeListIndex).get(sndElemList.indexOf(elm))!=null){
List<NcSoundingLayer> soundingLayeys = stnTimeSndTable.get(currentStnListIndex).get(currentTimeListIndex).get(sndElemList.indexOf(elm)).getSndLyLst();
int colorIndex = stnTimeSndTable.get(currentStnListIndex).get(currentTimeListIndex).get(sndElemList.indexOf(elm)).getCompColorIndex();
NsharpLineProperty lp = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]);
IWireframeShape shape = createRTParcelTraceShapes( parcelType, userPre, soundingLayeys);
NsharpShapeAndLineProperty shNLp = new NsharpShapeAndLineProperty();
shNLp.setShape(shape);
@ -2455,7 +2457,7 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
shNcolorT.setShape(shapeT);
shNcolorD.setShape(shapeD);
if(!rscHandler.isOverlayIsOn() && !rscHandler.isCompareStnIsOn() && !rscHandler.isCompareTmIsOn()){
if(!rscHandler.isOverlayIsOn() && !rscHandler.isCompareStnIsOn() && !rscHandler.isCompareTmIsOn() && !rscHandler.isCompareSndIsOn()){
//use default color
if(linePropertyMap!=null){
@ -2487,36 +2489,45 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
pressureTempRscShapeList.clear();
}
int currentTimeLineStateListIndex = rscHandler.getCurrentTimeLineStateListIndex();
int currentStnStateListIndex = rscHandler.getCurrentStnStateListIndex();
List<NsharpStationStateProperty> stnStateList = rscHandler.getStnStateList();
List<NsharpTimeLineStateProperty> timeLineStateList = rscHandler.getTimeLineStateList();
List<List<NsharpSoundingElementStateProperty>> stnTimeTable = rscHandler.getStnTimeTable();
HashMap<String, List<NcSoundingLayer>> dataTimelineSndLysListMap = rscHandler.getDataTimelineSndLysListMap();
if(rscHandler.isCompareStnIsOn() && currentTimeLineStateListIndex >=0){
int colorIndex =NsharpConstants.LINE_COMP1;
for(NsharpStationStateProperty elm: stnStateList) {
if(elm.getStnState() == NsharpConstants.State.ACTIVE &&
stnTimeTable.get(stnStateList.indexOf(elm)).get(currentTimeLineStateListIndex).getElementState() == NsharpConstants.State.AVAIL){
List<NcSoundingLayer> soundingLayeys = dataTimelineSndLysListMap.get(stnTimeTable.get(stnStateList.indexOf(elm)).get(currentTimeLineStateListIndex).getElementDescription());
int currentTimeListIndex = rscHandler.getCurrentTimeElementListIndex();
int currentStnListIndex = rscHandler.getCurrentStnElementListIndex();
int currentSndListIndex = rscHandler.getCurrentSndElementListIndex();
List<NsharpOperationElement> stnElemList = rscHandler.getStnElementList();
List<NsharpOperationElement> timeElemList = rscHandler.getTimeElementList();
List<NsharpOperationElement> sndElemList = rscHandler.getSndElementList();
List<List<List<NsharpSoundingElementStateProperty>>> stnTimeSndTable = rscHandler.getStnTimeSndTable();
if(rscHandler.isCompareStnIsOn()&& currentTimeListIndex >=0 && currentSndListIndex >=0){
int colorIndex ;
for(NsharpOperationElement elm: stnElemList) {
if(elm.getActionState() == NsharpConstants.ActState.ACTIVE &&
stnTimeSndTable.get(stnElemList.indexOf(elm)).get(currentTimeListIndex).get(currentSndListIndex)!=null){
List<NcSoundingLayer> soundingLayeys = stnTimeSndTable.get(stnElemList.indexOf(elm)).get(currentTimeListIndex).get(currentSndListIndex).getSndLyLst();
colorIndex = stnTimeSndTable.get(stnElemList.indexOf(elm)).get(currentTimeListIndex).get(currentSndListIndex).getCompColorIndex();
NsharpLineProperty lp = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]);
colorIndex++;
if(colorIndex > NsharpConstants.LINE_COMP10)
colorIndex =NsharpConstants.LINE_COMP1;
createRscPressTempCurveShape(world, soundingLayeys, lp, target);
}
}
}
else if(rscHandler.isCompareTmIsOn() && currentStnStateListIndex >=0 ){
int colorIndex =NsharpConstants.LINE_COMP1;
for(NsharpTimeLineStateProperty elm: timeLineStateList) {
if(elm.getTimeState() == NsharpConstants.State.ACTIVE &&
stnTimeTable.get(currentStnStateListIndex).get(timeLineStateList.indexOf(elm)).getElementState() == NsharpConstants.State.AVAIL){
List<NcSoundingLayer> soundingLayeys = dataTimelineSndLysListMap.get(stnTimeTable.get(currentStnStateListIndex).get(timeLineStateList.indexOf(elm)).getElementDescription());
else if(rscHandler.isCompareTmIsOn() && currentStnListIndex >=0 && currentSndListIndex >=0){
int colorIndex;
for(NsharpOperationElement elm: timeElemList) {
if(elm.getActionState() == NsharpConstants.ActState.ACTIVE &&
stnTimeSndTable.get(currentStnListIndex).get(timeElemList.indexOf(elm)).get(currentSndListIndex)!=null){
List<NcSoundingLayer> soundingLayeys = stnTimeSndTable.get(currentStnListIndex).get(timeElemList.indexOf(elm)).get(currentSndListIndex).getSndLyLst();
colorIndex = stnTimeSndTable.get(currentStnListIndex).get(timeElemList.indexOf(elm)).get(currentSndListIndex).getCompColorIndex();
NsharpLineProperty lp = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]);
createRscPressTempCurveShape(world, soundingLayeys, lp, target);
}
}
}
else if(rscHandler.isCompareSndIsOn() & currentStnListIndex >=0 && currentTimeListIndex >=0){
int colorIndex;
for(NsharpOperationElement elm: sndElemList) {
if(elm.getActionState() == NsharpConstants.ActState.ACTIVE &&
stnTimeSndTable.get(currentStnListIndex).get(currentTimeListIndex).get(sndElemList.indexOf(elm))!=null){
List<NcSoundingLayer> soundingLayeys = stnTimeSndTable.get(currentStnListIndex).get(currentTimeListIndex).get(sndElemList.indexOf(elm)).getSndLyLst();
colorIndex = stnTimeSndTable.get(currentStnListIndex).get(currentTimeListIndex).get(sndElemList.indexOf(elm)).getCompColorIndex();
NsharpLineProperty lp = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]);
colorIndex++;
if(colorIndex > NsharpConstants.LINE_COMP10)
colorIndex =NsharpConstants.LINE_COMP1;
createRscPressTempCurveShape(world, soundingLayeys, lp, target);
}
}
@ -2848,6 +2859,86 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
lfcShape = null;
}
}
/*
* Return the closest wind barb origin point to the input point
* Also set currentWindBarbSoundingLayerIndex for wind barb magnification plotting later
*/
public Coordinate findClosestWindBarbPoint(Coordinate currentCursorSkewTCoord){
//wind barb X position
double windX = skewTBackground.getWindBarbXPosition();
Coordinate currentCursorPresTempCoord = NsharpWxMath.reverseSkewTXY(world.unMap(currentCursorSkewTCoord));
double curCursorPressure = currentCursorPresTempCoord.y;
double curCursorTemp = currentCursorPresTempCoord.x;
double prevPressure=1000;
double prevT=0;
Coordinate closetWindBarbCoord = new Coordinate(0,0,0);
/*
* Note: soundingLys list sorted with highest pressure as first element
*/
for (NcSoundingLayer layer : this.soundingLys) {
if( layer.getPressure() < 100 )
continue;
double pressure = layer.getPressure();
double temperatureAtWBOrigin;
// get windBrb Y position at temp 0
double windY = NsharpWxMath.getSkewTXY(pressure, 0).y;
// get wind barb temperature at windX(= skewTBackground.getWindBarbXPosition()), windY
temperatureAtWBOrigin = NsharpWxMath.reverseSkewTXY(new Coordinate(windX,windY)).x;
//System.out.println(" pressure "+ pressure + " temp "+ temperatureAtWBOrigin + " prevPressure="+prevPressure);
if( pressure <= curCursorPressure){
// decide which pressure (layer) should be used. current one or previous one
double disCurrentP = Math.abs(pressure -curCursorPressure );
double disPreviousP = Math.abs(prevPressure -curCursorPressure );
double pickedPressure, pickedTemp;
if(disPreviousP <= disCurrentP){
pickedPressure = prevPressure;
pickedTemp = prevT;
if(this.soundingLys.indexOf(layer) == 0)
currentWindBarbSoundingLayerIndex = this.soundingLys.indexOf(layer);
else
currentWindBarbSoundingLayerIndex = this.soundingLys.indexOf(layer)-1;
}
else {
pickedPressure = pressure;
pickedTemp = temperatureAtWBOrigin;
currentWindBarbSoundingLayerIndex = this.soundingLys.indexOf(layer);
}
double disTemp = Math.abs(pickedTemp- curCursorTemp);
//if distancw is not within 5 * currentZoomLevel degree, then return with (0,0);
if(disTemp > 5 * currentZoomLevel){
setCursorTopWindBarb(false);
return closetWindBarbCoord;
}
else {
//System.out.println("pickedP="+pickedPressure+" pickedT="+pickedTemp+ " inPressure"+inPressure+" inTemp="+ inTemp+" temp dis="+disTemp+ " rangeT="+ 5 * currentZoomLevel);
closetWindBarbCoord = NsharpWxMath.getSkewTXY(pickedPressure, pickedTemp);
closetWindBarbCoord = world.map(closetWindBarbCoord);
setCursorTopWindBarb(true);
return closetWindBarbCoord;
}
}
prevPressure = pressure;
prevT = temperatureAtWBOrigin;
}
//This is the case that inC is above highest layer (lowest pressure), then we picked highest layer, if within temp range
if(Math.abs(prevT- curCursorTemp) > 5 * currentZoomLevel){
setCursorTopWindBarb(false);
return closetWindBarbCoord;
}
closetWindBarbCoord = NsharpWxMath.getSkewTXY(prevPressure, prevT);
closetWindBarbCoord = world.map(closetWindBarbCoord);
//System.out.println("pickedP="+prevPressure+" pickedT="+prevT+ " inPressure"+inPressure+" inTemp="+ inTemp);
setCursorTopWindBarb(true);
return closetWindBarbCoord;
}
/*
* Return the closest point to the input point on either Temp or Dewpoint trace line
* Also set currentSoundingLayerIndex for plotting later

View file

@ -18,8 +18,8 @@ package gov.noaa.nws.ncep.ui.nsharp.display.rsc;
*/
import gov.noaa.nws.ncep.ui.nsharp.NsharpConstants;
import gov.noaa.nws.ncep.ui.nsharp.NsharpStationStateProperty;
import gov.noaa.nws.ncep.ui.nsharp.NsharpTimeLineStateProperty;
import gov.noaa.nws.ncep.ui.nsharp.NsharpOperationElement;
import gov.noaa.nws.ncep.ui.nsharp.NsharpSoundingElementStateProperty;
import gov.noaa.nws.ncep.ui.nsharp.display.NsharpAbstractPaneDescriptor;
import java.awt.geom.Rectangle2D;
@ -43,13 +43,21 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties;
public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
private Rectangle timeLineRectangle;
private Rectangle stnIdRectangle;
private Rectangle sndRectangle;
private Rectangle colorNoteRectangle;
private List<NsharpTimeLineStateProperty> timeLineStateList;
private List<NsharpStationStateProperty> stnStateList;
private List<NsharpOperationElement> stnElemList;
private List<NsharpOperationElement> timeElemList;
private List<NsharpOperationElement> sndElemList;
private List<List<List<NsharpSoundingElementStateProperty>>> stnTimeSndTable;
private int curTimeLineIndex=0;
private int curStnIndex=0;
private int curSndIndex=0;
private int curTimeLinePage=1;
private int curStnIdPage=1;
private int curSndPage=1;
private int totalTimeLinePage=1;
private int totalStnIdPage=1;
private int totalSndPage=1;
private int paneWidth = NsharpConstants.TIMESTN_PANE_REC_WIDTH;
private int paneHeight = NsharpConstants.TIMESTN_PANE_REC_HEIGHT;
private int dtXOrig = NsharpConstants.DATA_TIMELINE_X_ORIG;
@ -63,6 +71,11 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
private int stnXEnd = NsharpConstants.STATION_ID_X_END;
private int stnWidth = NsharpConstants.STATION_ID_WIDTH;
private int stnHeight = NsharpConstants.STATION_ID_HEIGHT;
private int sndXOrig = NsharpConstants.SND_TYPE_X_ORIG;
private int sndYOrig = NsharpConstants.SND_TYPE_Y_ORIG;
private int sndXEnd = NsharpConstants.SND_TYPE_X_END;
private int sndWidth = NsharpConstants.SND_TYPE_WIDTH;
private int sndHeight = NsharpConstants.SND_TYPE_HEIGHT;
private int cnXOrig = NsharpConstants.COLOR_NOTATION_X_ORIG;
private int cnYOrig = NsharpConstants.COLOR_NOTATION_Y_ORIG;
//private int cnXEnd = NsharpConstants.COLOR_NOTATION_X_END;
@ -70,6 +83,13 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
private int cnHeight = NsharpConstants.COLOR_NOTATION_HEIGHT;
private float xRatio=1;
private float yRatio=1;
private static String sndTypeStr="NA";
private static String timelineStr="NA";
private static String stationStr="NA";
private boolean compareStnIsOn;
private boolean compareTmIsOn;
private boolean compareSndIsOn;
public NsharpTimeStnPaneResource(AbstractResourceData resourceData,
LoadProperties loadProperties, NsharpAbstractPaneDescriptor desc) {
super(resourceData, loadProperties, desc);
@ -78,6 +98,8 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
dtWidth,dtHeight);
stnIdRectangle = new Rectangle(stnXOrig,stnYOrig,
stnWidth,stnHeight);
sndRectangle = new Rectangle(sndXOrig,sndYOrig,
sndWidth,sndHeight);
colorNoteRectangle = new Rectangle(cnXOrig,cnYOrig,
cnWidth,cnHeight);
}
@ -91,12 +113,13 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
//plot notations:
if(dtHeight >= paneHeight)
return;
//draw time line page title etc. only when pane box height is larger than timeline box height
//draw time line page title etc. only when pane box height is larger than timeline box height
double x = cnXOrig+5*xRatio;
double y = cnYOrig+1.5*charHeight;
//double xGap = paneWidth/3*xRatio;
color = NsharpConstants.color_white;
DrawableString str =new DrawableString( "State:",color);
DrawableString str =new DrawableString( "Line State:",color);
str.font = font10;
str.setCoordinates(x, y);
double horizRatio = paintProps.getView().getExtent().getWidth() / paintProps.getCanvasBounds().width;
@ -105,31 +128,74 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
color = NsharpConstants.color_green;
DrawableString str1 =new DrawableString( "Current", color);
str1.setCoordinates(x, y);
str1.font = font10;
x = x + target.getStringsBounds(str1).getWidth() * horizRatio *1.1;
color = NsharpConstants.color_yellow;
DrawableString str2 =new DrawableString( "Active", color);
str2.setCoordinates(x, y);
str2.font = font10;
x = x + target.getStringsBounds(str2).getWidth() * horizRatio * 1.1;
color = NsharpConstants.color_white;
DrawableString str3 =new DrawableString( "InActive", color);
str3.setCoordinates(x, y);
str3.font = font10;
x = cnXOrig+5*xRatio;
y=y+charHeight;
y=y+charHeight*1.3;
color = NsharpConstants.color_white;
DrawableString str4 =new DrawableString( "Status:", color);
DrawableString str4 =new DrawableString( "Load Status:", color);
str4.setCoordinates(x, y);
str4.font = font10;
x = x + target.getStringsBounds(str4).getWidth() * horizRatio * 1.1;
color = NsharpConstants.color_red;
DrawableString str5 =new DrawableString( "* :Loaded", color);
str5.setCoordinates(x, y);
str5.font = font10;
x = x + target.getStringsBounds(str5).getWidth() * horizRatio * 1.1;
color = NsharpConstants.color_cyan;
color = NsharpConstants.color_purple;
DrawableString str6 =new DrawableString( "* :UnLoaded", color);
str6.setCoordinates(x, y);
str6.font = font10;
target.drawStrings(str,str1,str2,str3,str4,str5,str6);
if(compareStnIsOn || compareSndIsOn || compareTmIsOn){
x = cnXOrig+5*xRatio;
y=y+charHeight*1.3;
color = NsharpConstants.color_white;
String baseStr="";
String cursndType, stnId, tl;
if(curTimeLineIndex<0){
tl=timelineStr;
}
else {
timelineStr = tl = timeElemList.get(curTimeLineIndex).getElementDescription();
}
if(curSndIndex<0){
cursndType = sndTypeStr;
}
else {
sndTypeStr = cursndType = sndElemList.get(curSndIndex).getElementDescription() ;
}
if(curStnIndex <0){
stnId=stationStr;
}
else{
stationStr = stnId = stnElemList.get(curStnIndex).getElementDescription() ;
}
if(compareStnIsOn)
baseStr = "Comp Stn Based on: "+ tl + "-" + cursndType;
else if(compareSndIsOn)
baseStr = "Comp Src Based on: "+ tl + "-" + stnId;
else
baseStr = "Comp Tm Based on: "+ cursndType + "-" +stnId;
DrawableString baseDrawStr =new DrawableString(baseStr, color);
baseDrawStr.setCoordinates(x, y);
baseDrawStr.font = font10;
target.drawStrings( baseDrawStr);
}
target.clearClippingPlane();
}
@ -145,7 +211,7 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
//draw time line page title etc. only when pane box height is larger than timeline box height
x = dtXOrig;
y = dtYOrig-1.5*charHeight*yRatio;
s = timeLineStateList.size() + " time lines, page " + curTimeLinePage+"/"+totalTimeLinePage;
s = timeElemList.size() + " time lines, page " + curTimeLinePage+"/"+totalTimeLinePage;
target.drawString(font10, s, x,
y, 0.0,
IGraphicsTarget.TextStyle.NORMAL,
@ -154,7 +220,7 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
VerticalAlignment.TOP, null);
y = dtYOrig;
target.drawLine(dtXOrig, y, 0.0,dtXEnd , y, 0.0,NsharpConstants.color_white,1, LineStyle.SOLID);
//System.out.println("drawNsharpDataTimelines picked stn info: "+ pickedStnInfoStr);
x = dtXOrig +dtWidth/2;
// line divide nextPage and prevPage strings
@ -195,36 +261,34 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
int startIndex = (curTimeLinePage-1) * numTimeLineToShowPerPage;
if(startIndex<0)
startIndex =0;
if(timeLineStateList!= null){
int compIndex= 1;
if(timeElemList!= null){
int colorIndex;
boolean compareTmIsOn = rscHandler.isCompareTmIsOn();
int currentStnStateListIndex = rscHandler.getCurrentStnStateListIndex();
int currentTimeLineStateListIndex = rscHandler.getCurrentTimeLineStateListIndex();
double ly = dtNextPageEnd + charHeight;
RGB color;
double hRatio = paintProps.getView().getExtent().getWidth() / paintProps.getCanvasBounds().width;
Rectangle2D strBD = target.getStringBounds(font10, "*");
double xGap = 2*strBD.getWidth()*hRatio;
for (int j = startIndex; j< timeLineStateList.size(); j++)
for (int j = startIndex; j< timeElemList.size(); j++)
{
x = dtXOrig + 5;
boolean avail=false;
NsharpTimeLineStateProperty elm = timeLineStateList.get(j);
NsharpConstants.State sta = elm.getTimeState();
NsharpOperationElement elm = timeElemList.get(j);
NsharpConstants.ActState sta = elm.getActionState();
if(sta == NsharpConstants.State.ACTIVE && j == currentTimeLineStateListIndex)
sta = NsharpConstants.State.CURRENT;
if(currentStnStateListIndex>=0){
if(sta == NsharpConstants.ActState.ACTIVE && j == curTimeLineIndex)
sta = NsharpConstants.ActState.CURRENT;
if(curStnIndex>=0 && curSndIndex >=0) {
s = "*";
if ( rscHandler.getStnTimeTable().get(currentStnStateListIndex).get(j).elementState == NsharpConstants.State.AVAIL ){
if ( stnTimeSndTable.get(curStnIndex).get(j).get(curSndIndex)!=null){
avail = true;
}
if(avail){
color = NsharpConstants.color_red;
if(sta == NsharpConstants.ActState.CURRENT)
color = NsharpConstants.color_green;
}
else {
color = NsharpConstants.color_cyan;
color = NsharpConstants.color_purple;
}
//System.out.println("selectedTimeList: "+ s);
@ -237,28 +301,44 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
}
x=x+xGap;
color = rscHandler.getElementColorMap().get(sta);
s = elm.timeDescription;
target.drawString(font10, s, x,
ly, 0.0,
IGraphicsTarget.TextStyle.NORMAL,
color,
HorizontalAlignment.LEFT,
VerticalAlignment.BOTTOM, null);
RGB tmLnColor = rscHandler.getElementColorMap().get(sta.name());
String tmDesStr = elm.getElementDescription();
double tmX=x;
if(compareTmIsOn && elm.timeState == NsharpConstants.State.ACTIVE && avail){
colorIndex = (compIndex-1)%(NsharpConstants.LINE_COMP10-NsharpConstants.LINE_COMP1+1)+ NsharpConstants.LINE_COMP1;
strBD = target.getStringBounds(font10, s);
s =""+ compIndex;
if(compareTmIsOn && elm.getActionState() == NsharpConstants.ActState.ACTIVE
&& avail){
colorIndex = stnTimeSndTable.get(curStnIndex).get(j).get(curSndIndex).getCompColorIndex();
strBD = target.getStringBounds(font10, tmDesStr);
String colorIndexStr =""+ (colorIndex % NsharpConstants.LINE_COMP1 + 1);//compIndex;
x=x+ strBD.getWidth()*hRatio+5;
target.drawString(font10,s, x,
target.drawString(font10,colorIndexStr, x,
ly, 0.0,
IGraphicsTarget.TextStyle.NORMAL,
linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]).getLineColor(),
HorizontalAlignment.LEFT,
VerticalAlignment.BOTTOM, null);
compIndex++;
}
tmLnColor = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]).getLineColor();
}
else if((compareStnIsOn||compareSndIsOn) && elm.getActionState() == NsharpConstants.ActState.ACTIVE && timeElemList.indexOf(elm) == curTimeLineIndex
&& avail){
colorIndex = stnTimeSndTable.get(curStnIndex).get(curTimeLineIndex).get(curSndIndex).getCompColorIndex();
strBD = target.getStringBounds(font10, tmDesStr);
String colorIndexStr =""+ (colorIndex % NsharpConstants.LINE_COMP1 + 1);//compIndex;
x=x+ strBD.getWidth()*hRatio+5;
target.drawString(font10,colorIndexStr, x,
ly, 0.0,
IGraphicsTarget.TextStyle.NORMAL,
linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]).getLineColor(),
HorizontalAlignment.LEFT,
VerticalAlignment.BOTTOM, null);
tmLnColor = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]).getLineColor();
}
target.drawString(font10, tmDesStr, tmX,
ly, 0.0,
IGraphicsTarget.TextStyle.NORMAL,
tmLnColor,
HorizontalAlignment.LEFT,
VerticalAlignment.BOTTOM, null);
ly = ly + charHeight;
if (ly >= cnYOrig)//-charHeight)
//we dont show time line that extends below time line box
@ -278,7 +358,7 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
//draw time line page title etc. only when pane box height is larger than timeline box height
x = stnXOrig;
y = stnYOrig -1.5*charHeight*yRatio;
s = stnStateList.size() + " stations, page " + curStnIdPage+"/"+totalStnIdPage;
s = stnElemList.size() + " stations, page " + curStnIdPage+"/"+totalStnIdPage;
target.drawString(font10, s, x,
y, 0.0,
IGraphicsTarget.TextStyle.NORMAL,
@ -288,7 +368,7 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
y = dtYOrig;
target.drawLine(stnXOrig, y, 0.0,stnXEnd , y, 0.0,NsharpConstants.color_white,1, LineStyle.SOLID);
//System.out.println("drawNsharpDataTimelines picked stn info: "+ pickedStnInfoStr);
x = stnXOrig +dtWidth/2;
x = stnXOrig +stnWidth/2;
// line divide nextPage and prevPage strings
target.drawLine(x, y, 0.0,
x , y+1.2*charHeight*yRatio, 0.0,
@ -304,7 +384,7 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
HorizontalAlignment.LEFT,
VerticalAlignment.BOTTOM, null);
x= stnXOrig + dtWidth/2 + 5;
x= stnXOrig + stnWidth/2 + 5;
s = "prevPage";
target.drawString(font10, s, x,
y, 0.0,
@ -328,39 +408,34 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
int startIndex = (rscHandler.getCurStnIdPage()-1) * numStnToShow;
if(startIndex<0)
startIndex =0;
int compIndex= 1;
int colorIndex;
boolean compareStnIsOn = rscHandler.isCompareStnIsOn();
int currentStnStateListIndex = rscHandler.getCurrentStnStateListIndex();
int currentTimeLineStateListIndex = rscHandler.getCurrentTimeLineStateListIndex();
double ly = dtNextPageEnd + charHeight;
int colorIndex;
double ly = dtNextPageEnd + charHeight;
RGB color;
Rectangle2D strBD = target.getStringBounds(font10, "*");
double hRatio = paintProps.getView().getExtent().getWidth() / paintProps.getCanvasBounds().width;
double xGap = 2*strBD.getWidth()*hRatio;
for (int j = startIndex; j< stnStateList.size(); j++)
for (int j = startIndex; j< stnElemList.size(); j++)
{
boolean avail=false;
x = stnXOrig + 5;
NsharpStationStateProperty elm = stnStateList.get(j);
NsharpConstants.State sta ;
if(elm.stnState == NsharpConstants.State.ACTIVE && j == currentStnStateListIndex)
sta = NsharpConstants.State.CURRENT;
else
sta = elm.stnState; // set its state based on stn state
NsharpOperationElement elm = stnElemList.get(j);
NsharpConstants.ActState sta = elm.getActionState();
if(sta == NsharpConstants.ActState.ACTIVE && j == curStnIndex)
sta = NsharpConstants.ActState.CURRENT;
if (currentTimeLineStateListIndex>=0){
if(rscHandler.getStnTimeTable().get(j).get(currentTimeLineStateListIndex).elementState == NsharpConstants.State.AVAIL ){
if (curTimeLineIndex>=0 && curSndIndex >=0){
if(stnTimeSndTable.get(j).get(curTimeLineIndex).get(curSndIndex)!=null ){
avail =true;
}
s = "*";
if(avail){
color = NsharpConstants.color_red;
s = "*";
if(sta == NsharpConstants.ActState.CURRENT)
color = NsharpConstants.color_green;
}
else {
color = NsharpConstants.color_cyan;
s = "*";
color = NsharpConstants.color_purple;
}
target.drawString(font10, s, x,
ly, 0.0,
@ -370,32 +445,46 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
VerticalAlignment.BOTTOM, null);
}
x=x+xGap;
String stnId = elm.stnDescription;
color = rscHandler.getElementColorMap().get(sta);
target.drawString(font10, stnId, x,
String stnId = elm.elementDescription;
double stnIdX = x;
color = rscHandler.getElementColorMap().get(sta.name());
if( elm.getActionState() == NsharpConstants.ActState.ACTIVE && avail){
if(compareStnIsOn){
strBD = target.getStringBounds(font10, stnId);
//colorIndex = (compIndex-1)%(NsharpConstants.LINE_COMP10-NsharpConstants.LINE_COMP1+1)+ NsharpConstants.LINE_COMP1;
colorIndex = stnTimeSndTable.get(j).get(curTimeLineIndex).get(curSndIndex).getCompColorIndex();
color = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]).getLineColor();
s =""+ (colorIndex % NsharpConstants.LINE_COMP1 + 1);
x=x+ strBD.getWidth()*hRatio+5;
target.drawString(font10,s, x,
ly, 0.0,
IGraphicsTarget.TextStyle.NORMAL,
color,
HorizontalAlignment.LEFT,
VerticalAlignment.BOTTOM, null);
}
else if((compareTmIsOn||compareSndIsOn) && j == curStnIndex){
strBD = target.getStringBounds(font10, stnId);
//colorIndex = (compIndex-1)%(NsharpConstants.LINE_COMP10-NsharpConstants.LINE_COMP1+1)+ NsharpConstants.LINE_COMP1;
colorIndex = stnTimeSndTable.get(curStnIndex).get(curTimeLineIndex).get(curSndIndex).getCompColorIndex();
color = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]).getLineColor();
s =""+ (colorIndex % NsharpConstants.LINE_COMP1 + 1);
x=x+ strBD.getWidth()*hRatio+5;
target.drawString(font10,s, x,
ly, 0.0,
IGraphicsTarget.TextStyle.NORMAL,
color,
HorizontalAlignment.LEFT,
VerticalAlignment.BOTTOM, null);
}
}
target.drawString(font10, stnId, stnIdX,
ly, 0.0,
IGraphicsTarget.TextStyle.NORMAL,
color,
HorizontalAlignment.LEFT,
VerticalAlignment.BOTTOM, null);
if(compareStnIsOn && elm.stnState == NsharpConstants.State.ACTIVE && avail){
strBD = target.getStringBounds(font10, stnId);
colorIndex = (compIndex-1)%(NsharpConstants.LINE_COMP10-NsharpConstants.LINE_COMP1+1)+ NsharpConstants.LINE_COMP1;
s =""+ compIndex;
x=x+ strBD.getWidth()*hRatio+5;
target.drawString(font10,s, x,
ly, 0.0,
IGraphicsTarget.TextStyle.NORMAL,
linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]).getLineColor(),
HorizontalAlignment.LEFT,
VerticalAlignment.BOTTOM, null);
compIndex++;
}//else if(compareTmIsOn){
//anything to do?
//}
ly = ly + charHeight;
if (ly >= cnYOrig)
//we dont show stn id that extends below box
@ -403,6 +492,151 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
}
}
@SuppressWarnings("deprecation")
private void drawNsharpSndTypeBox(IGraphicsTarget target, Rectangle rect) throws VizException {
PixelExtent extent = new PixelExtent(rect);
target.setupClippingPlane(extent);
target.drawRect(extent,NsharpConstants.backgroundColor, 1.0f, 1.0f);
double x;
double y;
String s;
if(dtHeight < paneHeight){
//draw time line page title etc. only when pane box height is larger than timeline box height
x = sndXOrig;
y = sndYOrig -1.5*charHeight*yRatio;
s = sndElemList.size() + " srcs, page " + curSndPage+"/"+totalSndPage;
target.drawString(font10, s, x,
y, 0.0,
IGraphicsTarget.TextStyle.NORMAL,
NsharpConstants.color_green,
HorizontalAlignment.LEFT,
VerticalAlignment.TOP, null);
y = sndYOrig;
target.drawLine(sndXOrig, y, 0.0,sndXEnd , y, 0.0,NsharpConstants.color_white,1, LineStyle.SOLID);
//System.out.println("drawNsharpDataTimelines picked stn info: "+ pickedStnInfoStr);
x = sndXOrig +sndWidth/2;
// line divide nextPage and prevPage strings
target.drawLine(x, y, 0.0,
x , y+1.2*charHeight*yRatio, 0.0,
NsharpConstants.color_white,1, LineStyle.SOLID);
x = sndXOrig + 5;
y = y+1.2*charHeight*yRatio;
s = "nextPage";
target.drawString(font10, s, x,
y, 0.0,
IGraphicsTarget.TextStyle.NORMAL,
NsharpConstants.color_yellow,
HorizontalAlignment.LEFT,
VerticalAlignment.BOTTOM, null);
x= sndXOrig + sndWidth/2 + 5;
s = "prevPage";
target.drawString(font10, s, x,
y, 0.0,
IGraphicsTarget.TextStyle.NORMAL,
NsharpConstants.color_yellow,
HorizontalAlignment.LEFT,
VerticalAlignment.BOTTOM, null);
//line below neextPage string
target.drawLine(sndXOrig, y, 0.0,
sndXEnd , y, 0.0,
NsharpConstants.color_white,1, LineStyle.SOLID);
}
int numStnToShow = (cnYOrig-dtNextPageEnd)/charHeight;
if(numStnToShow <1){
numStnToShow = dtHeight/charHeight;
if(numStnToShow <1)
numStnToShow=1;
}
int startIndex = (rscHandler.getCurStnIdPage()-1) * numStnToShow;
if(startIndex<0)
startIndex =0;
int colorIndex;
double ly = dtNextPageEnd + charHeight;
RGB color;
Rectangle2D strBD = target.getStringBounds(font10, "*");
double hRatio = paintProps.getView().getExtent().getWidth() / paintProps.getCanvasBounds().width;
double xGap = 2*strBD.getWidth()*hRatio;
for (int j = startIndex; j< sndElemList.size(); j++)
{
boolean avail=false;
x = sndXOrig + 5;
NsharpOperationElement elm = sndElemList.get(j);
NsharpConstants.ActState sta = elm.getActionState();
if(sta == NsharpConstants.ActState.ACTIVE && j == curSndIndex)
sta = NsharpConstants.ActState.CURRENT;
if (curTimeLineIndex>=0 && curStnIndex >=0){
if(stnTimeSndTable.get(curStnIndex).get(curTimeLineIndex).get(j)!=null ){
avail =true;
}
s = "*";
if(avail){
color = NsharpConstants.color_red;
if(sta == NsharpConstants.ActState.CURRENT)
color = NsharpConstants.color_green;
}
else {
color = NsharpConstants.color_purple;
}
target.drawString(font10, s, x,
ly, 0.0,
IGraphicsTarget.TextStyle.NORMAL,
color,
HorizontalAlignment.LEFT,
VerticalAlignment.BOTTOM, null);
}
x=x+xGap;
String sndType = elm.elementDescription;
double sndX = x;
color = rscHandler.getElementColorMap().get(sta.name());
if( elm.getActionState() == NsharpConstants.ActState.ACTIVE && avail){
if(compareSndIsOn){
strBD = target.getStringBounds(font10, sndType);
//colorIndex = (compIndex-1)%(NsharpConstants.LINE_COMP10-NsharpConstants.LINE_COMP1+1)+ NsharpConstants.LINE_COMP1;
colorIndex = stnTimeSndTable.get(curStnIndex).get(curTimeLineIndex).get(j).getCompColorIndex();
color = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]).getLineColor();
s =""+ (colorIndex % NsharpConstants.LINE_COMP1 + 1);
x=x+ strBD.getWidth()*hRatio+5;
target.drawString(font10,s, x,
ly, 0.0,
IGraphicsTarget.TextStyle.NORMAL,
color,
HorizontalAlignment.LEFT,
VerticalAlignment.BOTTOM, null);
}
else if((compareTmIsOn||compareStnIsOn) && j == curSndIndex){
strBD = target.getStringBounds(font10, sndType);
//colorIndex = (compIndex-1)%(NsharpConstants.LINE_COMP10-NsharpConstants.LINE_COMP1+1)+ NsharpConstants.LINE_COMP1;
colorIndex = stnTimeSndTable.get(curStnIndex).get(curTimeLineIndex).get(curSndIndex).getCompColorIndex();
color = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]).getLineColor();
s =""+ (colorIndex % NsharpConstants.LINE_COMP1 + 1);
x=x+ strBD.getWidth()*hRatio+5;
target.drawString(font10,s, x,
ly, 0.0,
IGraphicsTarget.TextStyle.NORMAL,
color,
HorizontalAlignment.LEFT,
VerticalAlignment.BOTTOM, null);
}
}
target.drawString(font10, sndType, sndX,
ly, 0.0,
IGraphicsTarget.TextStyle.NORMAL,
color,
HorizontalAlignment.LEFT,
VerticalAlignment.BOTTOM, null);
ly = ly + charHeight;
if (ly >= cnYOrig)
//we dont show stn id that extends below box
break;
}
}
@Override
protected void paintInternal(IGraphicsTarget target,
PaintProperties paintProps) throws VizException {
@ -411,12 +645,22 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
//System.out.println("timeStn paintInternal zoomL="+currentZoomLevel);
if(rscHandler== null)
return;
timeLineStateList = rscHandler.getTimeLineStateList(); //System.out.println("NsharpTimeStnPaneResource "+ descriptor.getPaneNumber());
stnStateList = rscHandler.getStnStateList();
stnElemList = rscHandler.getStnElementList();
timeElemList = rscHandler.getTimeElementList();
sndElemList = rscHandler.getSndElementList();
curTimeLineIndex = rscHandler.getCurrentTimeElementListIndex();
curStnIndex = rscHandler.getCurrentStnElementListIndex();
curSndIndex = rscHandler.getCurrentSndElementListIndex();
curTimeLinePage = rscHandler.getCurTimeLinePage();
curStnIdPage = rscHandler.getCurStnIdPage();
curSndPage = rscHandler.getCurSndPage();
totalTimeLinePage = rscHandler.getTotalTimeLinePage();
totalStnIdPage = rscHandler.getTotalStnIdPage();
totalSndPage = rscHandler.getTotalSndPage();
compareStnIsOn = rscHandler.isCompareStnIsOn();
compareSndIsOn = rscHandler.isCompareSndIsOn();
compareTmIsOn = rscHandler.isCompareTmIsOn();
stnTimeSndTable = rscHandler.getStnTimeSndTable();
this.font10.setSmoothing(false);
this.font10.setScaleFont(false);
this.font9.setSmoothing(false);
@ -429,6 +673,8 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
//plot station id
drawNsharpStationIdBox(target, stnIdRectangle);
drawNsharpSndTypeBox(target, sndRectangle);
//plot color notations
drawNsharpColorNotation(target, colorNoteRectangle );
@ -460,6 +706,11 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
public Rectangle getStnIdRectangle() {
return stnIdRectangle;
}
public Rectangle getSndRectangle() {
return sndRectangle;
}
public Rectangle getColorNoteRectangle() {
return colorNoteRectangle;
}
@ -474,10 +725,7 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
pe = new PixelExtent(this.rectangle);
getDescriptor().setNewPe(pe);
defineCharHeight(font10);
//rscHandler.setCharHeight(charHeight);
//float prevHeight = paneHeight;
//float prevWidth = paneWidth;
paneHeight = (int) ext.getHeight();
paneHeight = (int) ext.getHeight();
paneWidth = (int) (ext.getWidth());
//xRatio = xRatio* paneWidth/prevWidth;
//DEBUGGING yRatio = yRatio* paneHeight/prevHeight;
@ -486,8 +734,8 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
//if pane height is less than 10 char height, then just plot time line. not plot "messages/title/notations" etc..
if(paneHeight > (int)(10* charHeight*yRatio)){
dtYOrig = (int) ext.getMinY()+(int)(2* charHeight*yRatio);
cnHeight = (int)(3* charHeight*yRatio);
dtHeight = paneHeight-(int)(5* charHeight*yRatio);
cnHeight = (int)(4* charHeight*yRatio);
dtHeight = paneHeight-(int)(6* charHeight*yRatio);
dtNextPageEnd = dtYOrig+ (int) (2*charHeight*yRatio);
}
else {
@ -497,12 +745,16 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
dtNextPageEnd = dtYOrig;
}
dtXOrig = (int) (ext.getMinX());
dtWidth = paneWidth/2;
dtWidth = paneWidth* 40/100;
dtXEnd = dtXOrig + dtWidth;
stnXOrig = dtXEnd;
stnYOrig = dtYOrig;
stnWidth = dtWidth;
stnWidth = paneWidth * 30/100;
stnXEnd = stnXOrig+ stnWidth;
sndXOrig = stnXEnd;
sndYOrig = stnYOrig;
sndWidth = paneWidth * 30/100;
sndXEnd = sndXOrig+ sndWidth;
stnHeight = dtHeight;
cnXOrig = dtXOrig;
cnYOrig = dtYOrig+ dtHeight;
@ -512,14 +764,10 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
dtWidth,paneHeight-cnHeight);
stnIdRectangle = new Rectangle(stnXOrig,(int) ext.getMinY(),
stnWidth,paneHeight-cnHeight);
sndRectangle = new Rectangle(sndXOrig,(int) ext.getMinY(),
sndWidth,paneHeight-cnHeight);
colorNoteRectangle = new Rectangle(cnXOrig,cnYOrig,
cnWidth,cnHeight);
rscHandler.setTimeStnBoxData( cnYOrig, dtNextPageEnd, dtYOrig ,dtXOrig, dtWidth, charHeight);
/*rscHandler.setDtNextPageEnd(dtNextPageEnd);
rscHandler.setDtYOrig(dtYOrig);
rscHandler.setCnYOrig(cnYOrig);
rscHandler.setCharHeight(charHeight);*/
//System.out.println("pane 4 height="+paneHeight);
}
}

View file

@ -352,7 +352,6 @@ public class NsharpWitoPaneResource extends NsharpAbstractPaneResource{
shapeC.compile();
shapePline.compile();
}
private static int k=0;
/*
* Chin:: NOTE:::
* This plotting function is based on the algorithm of plot_advectionprofile() at xwvid5.c of Bignsharp source code

View file

@ -35,13 +35,14 @@ import org.eclipse.ui.PlatformUI;
public class NsharpConfigDialog extends Dialog {
private Button parameterBtn, dataDisplayBtn,dataPageBtn, timeLineBtn, stnBtn, paneCfgBtn, mdlCfgBtn;
private Button parameterBtn, dataDisplayBtn,dataPageBtn, timeLineBtn, stnBtn, sndBtn,paneCfgBtn, mdlCfgBtn;
private static NsharpConfigDialog thisDialog=null;
private static NsharpParametersSelectionConfigDialog parameterSelDialog = null;
private static NsharpDataDisplayConfigDialog dataDislpayDialog = null;
private static NsharpDataPageConfigDialog dataPageDialog = null;
private static NsharpTimeLineConfigDialog timelineDialog = null;
private static NsharpStnConfigDialog stnDialog = null;
private static NsharpSndConfigDialog sndDialog = null;
private static NsharpPaneConfigDialog paneCfgDialog = null;
private static NsharpGribModelTypeConfigDialog mdlCfgDialog = null;
public NsharpConfigDialog(Shell parentShell) {
@ -67,52 +68,26 @@ public class NsharpConfigDialog extends Dialog {
parameterBtn = new Button(parent, SWT.PUSH);
parameterBtn.setText("Parameters Selection");
parameterBtn.setEnabled( true );
//graphBtn.setSize(btnWidth,pushbtnHeight);
parameterBtn.addListener( SWT.MouseUp, new Listener() {
public void handleEvent(Event event) {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
parameterSelDialog = NsharpParametersSelectionConfigDialog.getInstance(shell);
if ( parameterSelDialog != null ) {
parameterSelDialog.open();
/*timeLineBtn.setEnabled( false );
dataDisplayBtn.setEnabled(false);
stnBtn.setEnabled( false );
dataPageBtn.setEnabled( false );
paneCfgBtn.setEnabled( false );
mdlCfgBtn.setEnabled( false );
parameterSelDialog.open();
dataDisplayBtn.setEnabled(true);
timeLineBtn.setEnabled( true );
stnBtn.setEnabled( true );
dataPageBtn.setEnabled( true );
paneCfgBtn.setEnabled( true );
mdlCfgBtn.setEnabled( true );*/
}
}
} );
dataDisplayBtn = new Button(parent, SWT.PUSH);
dataDisplayBtn.setText("Data Display Configuration");
dataDisplayBtn.setEnabled( true );
//lineBtn.setSize(btnWidth,pushbtnHeight);
dataDisplayBtn.addListener( SWT.MouseUp, new Listener() {
public void handleEvent(Event event) {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
dataDislpayDialog = NsharpDataDisplayConfigDialog.getInstance(shell);
if ( dataDislpayDialog != null ) {
dataDislpayDialog.open();
/*timeLineBtn.setEnabled( false );
parameterBtn.setEnabled(false);
stnBtn.setEnabled( false );
dataPageBtn.setEnabled( false );
paneCfgBtn.setEnabled( false );
mdlCfgBtn.setEnabled( false );
dataDislpayDialog.open();
parameterBtn.setEnabled(true);
timeLineBtn.setEnabled( true );
stnBtn.setEnabled( true );
dataPageBtn.setEnabled( true );
paneCfgBtn.setEnabled( true );
mdlCfgBtn.setEnabled( true );*/
}
}
} );
@ -120,78 +95,53 @@ public class NsharpConfigDialog extends Dialog {
dataPageBtn = new Button(parent, SWT.PUSH);
dataPageBtn.setText("Data Page Configuration");
dataPageBtn.setEnabled( true );
//lineBtn.setSize(btnWidth,pushbtnHeight);
dataPageBtn.addListener( SWT.MouseUp, new Listener() {
public void handleEvent(Event event) {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
dataPageDialog = NsharpDataPageConfigDialog.getInstance(shell);
if ( dataPageDialog != null ) {
/*timeLineBtn.setEnabled( false );
parameterBtn.setEnabled(false);
stnBtn.setEnabled( false );
dataDisplayBtn.setEnabled(false);
paneCfgBtn.setEnabled( false );
mdlCfgBtn.setEnabled( false );
dataPageDialog.open();
parameterBtn.setEnabled(true);
timeLineBtn.setEnabled( true );
stnBtn.setEnabled( true );
dataDisplayBtn.setEnabled(true);
paneCfgBtn.setEnabled( true );
mdlCfgBtn.setEnabled( true );*/
dataPageDialog.open();
}
}
} );
timeLineBtn = new Button(parent, SWT.PUSH);
timeLineBtn.setText("Time Line Activation");
timeLineBtn.setEnabled( true );
//lineBtn.setSize(btnWidth,pushbtnHeight);
timeLineBtn.addListener( SWT.MouseUp, new Listener() {
public void handleEvent(Event event) {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
timelineDialog = NsharpTimeLineConfigDialog.getInstance(shell);
if ( timelineDialog != null ) {
timelineDialog.open();
/*dataDisplayBtn.setEnabled(false);
parameterBtn.setEnabled(false);
stnBtn.setEnabled( false );
dataPageBtn.setEnabled( false );
paneCfgBtn.setEnabled( false );
mdlCfgBtn.setEnabled( false );
timelineDialog.open();
parameterBtn.setEnabled(true);
dataDisplayBtn.setEnabled(true);
stnBtn.setEnabled( true );
dataPageBtn.setEnabled( true );
paneCfgBtn.setEnabled( true );
mdlCfgBtn.setEnabled( true );*/
}
}
} );
stnBtn = new Button(parent, SWT.PUSH);
stnBtn.setText("Station Activation");
stnBtn.setEnabled( true );
//lineBtn.setSize(btnWidth,pushbtnHeight);
stnBtn.addListener( SWT.MouseUp, new Listener() {
public void handleEvent(Event event) {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
stnDialog = NsharpStnConfigDialog.getInstance(shell);
if ( stnDialog != null ) {
stnDialog.open();
/*dataDisplayBtn.setEnabled(false);
parameterBtn.setEnabled(false);
timeLineBtn.setEnabled( false );
dataPageBtn.setEnabled( false );
paneCfgBtn.setEnabled( false );
mdlCfgBtn.setEnabled( false );
stnDialog.open();
parameterBtn.setEnabled(true);
dataDisplayBtn.setEnabled(true);
timeLineBtn.setEnabled( true );
dataPageBtn.setEnabled( true );
paneCfgBtn.setEnabled( true );
mdlCfgBtn.setEnabled( true );*/
}
}
} );
sndBtn = new Button(parent, SWT.PUSH);
sndBtn.setText("Sounding Source Activation");
sndBtn.setEnabled( true );
sndBtn.addListener( SWT.MouseUp, new Listener() {
public void handleEvent(Event event) {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
sndDialog = NsharpSndConfigDialog.getInstance(shell);
if ( sndDialog != null ) {
sndDialog.open();
}
}
} );
@ -199,7 +149,7 @@ public class NsharpConfigDialog extends Dialog {
paneCfgBtn = new Button(parent, SWT.PUSH);
paneCfgBtn.setText("Display Pane Configuration");
paneCfgBtn.setEnabled( true );
//lineBtn.setSize(btnWidth,pushbtnHeight);
paneCfgBtn.addListener( SWT.MouseUp, new Listener() {
public void handleEvent(Event event) {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
@ -207,46 +157,19 @@ public class NsharpConfigDialog extends Dialog {
if ( paneCfgDialog != null ) {
paneCfgDialog.open();
}
/*dataDisplayBtn.setEnabled(false);
parameterBtn.setEnabled(false);
timeLineBtn.setEnabled( false );
dataPageBtn.setEnabled( false );
stnBtn.setEnabled( false );
mdlCfgBtn.setEnabled( false );
paneCfgDialog.open();
parameterBtn.setEnabled(true);
dataDisplayBtn.setEnabled(true);
timeLineBtn.setEnabled( true );
dataPageBtn.setEnabled( true );
stnBtn.setEnabled( true );
mdlCfgBtn.setEnabled( true );
*/
}
} );
mdlCfgBtn = new Button(parent, SWT.PUSH);
mdlCfgBtn.setText("Grid Model Type Configuration");
mdlCfgBtn.setEnabled( true );
//lineBtn.setSize(btnWidth,pushbtnHeight);
mdlCfgBtn.addListener( SWT.MouseUp, new Listener() {
public void handleEvent(Event event) {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
mdlCfgDialog = NsharpGribModelTypeConfigDialog.getInstance(shell);
if ( mdlCfgDialog != null ) {
mdlCfgDialog.open();
/*dataDisplayBtn.setEnabled(false);
parameterBtn.setEnabled(false);
timeLineBtn.setEnabled( false );
dataPageBtn.setEnabled( false );
stnBtn.setEnabled( false );
paneCfgBtn.setEnabled( false );
mdlCfgDialog.open();
parameterBtn.setEnabled(true);
dataDisplayBtn.setEnabled(true);
timeLineBtn.setEnabled( true );
dataPageBtn.setEnabled( true );
stnBtn.setEnabled( true );
paneCfgBtn.setEnabled(true);*/
}
}
} );
@ -254,7 +177,7 @@ public class NsharpConfigDialog extends Dialog {
Button windbarbCfgBtn = new Button(parent, SWT.PUSH);
windbarbCfgBtn.setText("Wind Barb Configuration");
windbarbCfgBtn.setEnabled( true );
//lineBtn.setSize(btnWidth,pushbtnHeight);
windbarbCfgBtn.addListener( SWT.MouseUp, new Listener() {
public void handleEvent(Event event) {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
@ -262,19 +185,6 @@ public class NsharpConfigDialog extends Dialog {
if ( windBarbDlg != null ) {
windBarbDlg.open();
/*dataDisplayBtn.setEnabled(false);
parameterBtn.setEnabled(false);
timeLineBtn.setEnabled( false );
dataPageBtn.setEnabled( false );
stnBtn.setEnabled( false );
paneCfgBtn.setEnabled( false );
windBarbDlg.open();
parameterBtn.setEnabled(true);
dataDisplayBtn.setEnabled(true);
timeLineBtn.setEnabled( true );
dataPageBtn.setEnabled( true );
stnBtn.setEnabled( true );
paneCfgBtn.setEnabled(true);*/
}
}
} );
@ -313,7 +223,7 @@ public class NsharpConfigDialog extends Dialog {
protected void configureShell( Shell shell ) {
super.configureShell( shell );
shell.setText( "Nsharp Configuration" );
shell.setSize(250, 370);
shell.setSize(250, 450);
}
@Override
public int open( ) {

View file

@ -57,6 +57,8 @@ import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.contexts.IContextActivation;
import org.eclipse.ui.contexts.IContextService;
import org.eclipse.ui.part.ViewPart;
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
@ -71,13 +73,13 @@ public class NsharpPaletteWindow extends ViewPart implements SelectionListener,
DisposeListener, IPartListener{
private MessageBox mb ;
protected Button loadBtn, unloadBtn, overlayBtn, interpBtn,dataEditBtn,
compareStnBtn,compareTmBtn, graphEditBtn,graphModeBtnSkew, graphModeBtnIcing,
graphModeBtnTurb, effBulkShearBtn, stpBtn, shipBtn, winterBtn, fireBtn,hailBtn,sarsBtn;
compareStnBtn,compareSndBtn,compareTmBtn, graphEditBtn,graphModeBtnSkew, graphModeBtnIcing,
graphModeBtnTurb, effBulkShearBtn, stpBtn, shipBtn, winterBtn, fireBtn,hailBtn,sarsBtn,cfgBtn;
private Shell shell;
private Label spcGplbl;
private Composite parent;
private Group spcGp;
private boolean overlayIsOn=false, compareStnIsOn=false, compareTmIsOn=false;
private boolean overlayIsOn=false, compareStnIsOn=false, compareSndIsOn=false,compareTmIsOn=false;
protected boolean interpolateIsOn=false, editGraphOn=false;
private static String INTP_OFF = " Interp(off) ";
private static String INTP_ON = " Interp(on) ";
@ -85,6 +87,8 @@ DisposeListener, IPartListener{
private static String COMP_STN_ON= "CompStn(on) ";
private static String COMP_TM_OFF= "CompTm(off)";
private static String COMP_TM_ON= "CompTm(on) ";
private static String COMP_SND_OFF= "CompSrc(off)";
private static String COMP_SND_ON= "CompSrc(on) ";
private static String OVLY_OFF= "Ovrlay2(off) ";
private static String OVLY_ON= "Ovrlay2(on) ";
protected static String EDIT_GRAPH_OFF= "EditGraph(off)";
@ -116,13 +120,14 @@ DisposeListener, IPartListener{
}
public void restorePaletteWindow( String paneConfigurationName,int currentGraphMode, boolean interpolateIsOn, boolean overlayIsOn, boolean compareStnIsOn,
boolean compareTmIsOn, boolean editGraphOn) {
boolean compareTmIsOn, boolean editGraphOn, boolean compareSndIsOn) {
//System.out.println("restorePaletteWindow "+ this.toString());
updateSpcGraphBtn(paneConfigurationName);
this.currentGraphMode = currentGraphMode;
this.interpolateIsOn = interpolateIsOn;
this.overlayIsOn = overlayIsOn;
this.compareStnIsOn = compareStnIsOn;
this.compareSndIsOn = compareSndIsOn;
this.compareTmIsOn = compareTmIsOn;
this.editGraphOn = editGraphOn;
graphModeBtnSkew.setEnabled(true);
@ -135,6 +140,7 @@ DisposeListener, IPartListener{
graphEditBtn.setEnabled(true);
dataEditBtn.setEnabled(true);
compareTmBtn.setEnabled( true );
compareSndBtn.setEnabled( true );
compareStnBtn.setEnabled( true );
overlayBtn.setEnabled( true );
interpBtn.setEnabled(true);
@ -142,11 +148,13 @@ DisposeListener, IPartListener{
interpBtn.setText(INTP_OFF);
graphEditBtn.setText(EDIT_GRAPH_OFF);
compareTmBtn.setText(COMP_TM_OFF);
compareSndBtn.setText(COMP_SND_OFF);
compareStnBtn.setText(COMP_STN_OFF);
if(interpolateIsOn) {
graphEditBtn.setEnabled(false);
dataEditBtn.setEnabled(false);
compareTmBtn.setEnabled( false );
compareSndBtn.setEnabled( false );
compareStnBtn.setEnabled( false );
overlayBtn.setEnabled( false );
interpBtn.setText(INTP_ON);
@ -156,6 +164,7 @@ DisposeListener, IPartListener{
graphEditBtn.setEnabled(false);
dataEditBtn.setEnabled(false);
compareTmBtn.setEnabled( false );
compareSndBtn.setEnabled( false );
compareStnBtn.setEnabled( false );
interpBtn.setEnabled(false);
graphModeBtnIcing.setEnabled(false);
@ -166,6 +175,18 @@ DisposeListener, IPartListener{
graphEditBtn.setEnabled(false);
dataEditBtn.setEnabled(false);
compareTmBtn.setEnabled( false );
compareSndBtn.setEnabled( false );
overlayBtn.setEnabled( false );
interpBtn.setEnabled(false);
graphModeBtnIcing.setEnabled(false);
graphModeBtnTurb.setEnabled(false);
}
else if(compareSndIsOn){
compareSndBtn.setText(COMP_SND_ON);
graphEditBtn.setEnabled(false);
dataEditBtn.setEnabled(false);
compareTmBtn.setEnabled( false );
compareStnBtn.setEnabled( false );
overlayBtn.setEnabled( false );
interpBtn.setEnabled(false);
graphModeBtnIcing.setEnabled(false);
@ -173,6 +194,7 @@ DisposeListener, IPartListener{
}
else if(compareTmIsOn){
compareTmBtn.setText(COMP_TM_ON);
compareSndBtn.setEnabled( false );
graphEditBtn.setEnabled(false);
dataEditBtn.setEnabled(false);
compareStnBtn.setEnabled( false );
@ -186,6 +208,7 @@ DisposeListener, IPartListener{
dataEditBtn.setEnabled(false);
compareStnBtn.setEnabled( false );
compareTmBtn.setEnabled( false );
compareSndBtn.setEnabled( false );
overlayBtn.setEnabled( false );
interpBtn.setEnabled(false);
graphModeBtnIcing.setEnabled(false);
@ -200,6 +223,7 @@ DisposeListener, IPartListener{
graphEditBtn.setEnabled(false);
dataEditBtn.setEnabled(false);
compareTmBtn.setEnabled( false );
compareSndBtn.setEnabled( false );
compareStnBtn.setEnabled( false );
overlayBtn.setEnabled( false );
if(interpolateIsOn)
@ -215,6 +239,7 @@ DisposeListener, IPartListener{
graphEditBtn.setEnabled(false);
dataEditBtn.setEnabled(false);
compareTmBtn.setEnabled( false );
compareSndBtn.setEnabled( false );
compareStnBtn.setEnabled( false );
overlayBtn.setEnabled( false );
if(interpolateIsOn)
@ -304,7 +329,7 @@ DisposeListener, IPartListener{
}
//System.out.println("view NsharpPaletteWindow constructed!! "+ this.toString());
printHandle = NsharpPrintHandle.getPrintHandle();
shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
mb = new MessageBox(shell, SWT.ICON_WARNING
| SWT.OK );
@ -350,7 +375,9 @@ DisposeListener, IPartListener{
interpolateIsOn = rsc.isInterpolateIsOn();
overlayIsOn = rsc.isOverlayIsOn();
compareStnIsOn = rsc.isCompareStnIsOn();
editGraphOn = rsc.isEditGraphOn();
editGraphOn = rsc.isEditGraphOn();
compareSndIsOn = rsc.isCompareSndIsOn();
compareTmIsOn = rsc.isCompareTmIsOn();
}
}
@ -437,7 +464,7 @@ DisposeListener, IPartListener{
}
public void createDataControlGp(Composite parent){
this.parent = parent;
this.parent = parent;
Group textModeGp = new Group(parent,SWT.SHADOW_OUT);
textModeGp.setLayout( new RowLayout(SWT.HORIZONTAL) );
textModeGp.setLayoutData( new GridData(GridData.FILL_HORIZONTAL) );
@ -466,7 +493,7 @@ DisposeListener, IPartListener{
}
}
} );
unloadBtn = new Button(textModeGp, SWT.PUSH);
unloadBtn.setFont(newFont);
unloadBtn.setText(" UnLoad ");
@ -505,7 +532,7 @@ DisposeListener, IPartListener{
} );
// Push buttons for CONFIGURE
Button cfgBtn = new Button(textModeGp, SWT.PUSH);
cfgBtn = new Button(textModeGp, SWT.PUSH);
cfgBtn.setFont(newFont);
cfgBtn.setText(" Configure ");
cfgBtn.setEnabled(true);
@ -532,7 +559,7 @@ DisposeListener, IPartListener{
public void handleEvent(Event event) {
//RESET should turn off everything...
shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
cfgBtn.setEnabled(true);
overlayIsOn = false;
overlayBtn.setText(OVLY_OFF);
overlayBtn.setEnabled(true);
@ -542,6 +569,9 @@ DisposeListener, IPartListener{
compareTmIsOn = false;
compareTmBtn.setText(COMP_TM_OFF);
compareTmBtn.setEnabled(true);
compareSndIsOn = false;
compareSndBtn.setText(COMP_SND_OFF);
compareSndBtn.setEnabled(true);
interpolateIsOn = false;
interpBtn.setText(INTP_OFF);
interpBtn.setEnabled(true);
@ -665,6 +695,7 @@ DisposeListener, IPartListener{
graphEditBtn.setEnabled(false);
dataEditBtn.setEnabled(false);
compareTmBtn.setEnabled( false );
compareSndBtn.setEnabled( false );
compareStnBtn.setEnabled( false );
overlayBtn.setEnabled( false );
}
@ -675,6 +706,7 @@ DisposeListener, IPartListener{
graphEditBtn.setEnabled(true);
dataEditBtn.setEnabled(true);
compareTmBtn.setEnabled( true );
compareSndBtn.setEnabled( true );
compareStnBtn.setEnabled( true );
overlayBtn.setEnabled( true );
}
@ -711,7 +743,7 @@ DisposeListener, IPartListener{
else{
overlayBtn.setText(OVLY_OFF);
//comparison and overlay is mutual exclusive
if((rscHandler!= null) && (rscHandler.isCompareStnIsOn() || rscHandler.isCompareTmIsOn()))
if((rscHandler!= null) && (rscHandler.isCompareStnIsOn() || rscHandler.isCompareTmIsOn()|| rscHandler.isCompareSndIsOn()))
overlayBtn.setEnabled( false );
else
overlayBtn.setEnabled( true );
@ -725,22 +757,26 @@ DisposeListener, IPartListener{
overlayBtn.setText(OVLY_ON);
compareStnBtn.setEnabled(false);
compareTmBtn.setEnabled(false);
compareSndBtn.setEnabled(false);
graphEditBtn.setEnabled(false);
dataEditBtn.setEnabled(false);
graphModeBtnTurb.setEnabled( false );
graphModeBtnIcing.setEnabled( false );
interpBtn.setEnabled( false );
cfgBtn.setEnabled( false );
}
else {
overlayIsOn = false;
overlayBtn.setText(OVLY_OFF);
compareStnBtn.setEnabled(true);
compareTmBtn.setEnabled(true);
compareSndBtn.setEnabled(true);
graphEditBtn.setEnabled(true);
dataEditBtn.setEnabled(true);
graphModeBtnTurb.setEnabled( true );
graphModeBtnIcing.setEnabled( true );
interpBtn.setEnabled( true );
cfgBtn.setEnabled( true );
}
NsharpResourceHandler rsc = getRscHandler();
if(rsc!= null){
@ -759,7 +795,7 @@ DisposeListener, IPartListener{
else{
//comparison and overlay is mutual exclusive
compareStnBtn.setText(COMP_STN_OFF);
if((rscHandler!= null) && (rscHandler.isOverlayIsOn() || rscHandler.isCompareTmIsOn()))
if((rscHandler!= null) && (rscHandler.isOverlayIsOn() || rscHandler.isCompareTmIsOn()|| rscHandler.isCompareSndIsOn()))
compareStnBtn.setEnabled( false );
else
compareStnBtn.setEnabled( true );
@ -773,22 +809,26 @@ DisposeListener, IPartListener{
compareStnBtn.setText(COMP_STN_ON);
overlayBtn.setEnabled(false);
compareTmBtn.setEnabled( false );
compareSndBtn.setEnabled(false);
graphEditBtn.setEnabled(false);
dataEditBtn.setEnabled(false);
graphModeBtnTurb.setEnabled( false );
graphModeBtnIcing.setEnabled( false );
interpBtn.setEnabled( false );
cfgBtn.setEnabled( false );
}
else {
compareStnIsOn = false;
compareStnBtn.setText(COMP_STN_OFF);
overlayBtn.setEnabled(true);
compareTmBtn.setEnabled( true );
compareSndBtn.setEnabled(true);
graphEditBtn.setEnabled(true);
dataEditBtn.setEnabled(true);
graphModeBtnTurb.setEnabled( true );
graphModeBtnIcing.setEnabled( true );
interpBtn.setEnabled( true );
cfgBtn.setEnabled( true );
}
NsharpResourceHandler rsc = getRscHandler();
if(rsc!= null){
@ -808,7 +848,7 @@ DisposeListener, IPartListener{
else{
//comparison and overlay is mutual exclusive
compareTmBtn.setText(COMP_TM_OFF);
if((rscHandler!= null) && (rscHandler.isOverlayIsOn() || rscHandler.isCompareStnIsOn()))
if((rscHandler!= null) && (rscHandler.isOverlayIsOn() || rscHandler.isCompareStnIsOn() || rscHandler.isCompareSndIsOn()))
compareTmBtn.setEnabled( false );
else
compareTmBtn.setEnabled( true );
@ -820,6 +860,7 @@ DisposeListener, IPartListener{
compareTmIsOn = true;
compareTmBtn.setText(COMP_TM_ON);
compareSndBtn.setEnabled(false);
overlayBtn.setEnabled(false);
compareStnBtn.setEnabled( false );
graphEditBtn.setEnabled(false);
@ -827,17 +868,20 @@ DisposeListener, IPartListener{
graphModeBtnTurb.setEnabled( false );
graphModeBtnIcing.setEnabled( false );
interpBtn.setEnabled( false );
cfgBtn.setEnabled( false );
}
else {
compareTmIsOn = false;
compareTmBtn.setText(COMP_TM_OFF);
compareSndBtn.setEnabled(true);
overlayBtn.setEnabled(true);
compareStnBtn.setEnabled( true );
graphEditBtn.setEnabled(true);
dataEditBtn.setEnabled(true);
graphModeBtnTurb.setEnabled( true );
graphModeBtnIcing.setEnabled( true );
interpBtn.setEnabled( true );
interpBtn.setEnabled( true );
cfgBtn.setEnabled( true );
}
NsharpResourceHandler rsc = getRscHandler();
if(rsc!= null){
@ -847,6 +891,59 @@ DisposeListener, IPartListener{
}
} );
// Push buttons for CompBySrc info
compareSndBtn = new Button(textModeGp, SWT.PUSH);
compareSndBtn.setFont(newFont);
if(compareSndIsOn){
compareSndBtn.setText(COMP_SND_ON);
compareSndBtn.setEnabled( true );
}
else{
//comparison and overlay is mutual exclusive
compareSndBtn.setText(COMP_SND_OFF);
if((rscHandler!= null) && (rscHandler.isOverlayIsOn() || rscHandler.isCompareStnIsOn() || rscHandler.isCompareTmIsOn()))
compareSndBtn.setEnabled( false );
else
compareSndBtn.setEnabled( true );
}
compareSndBtn.addListener( SWT.MouseUp, new Listener() {
public void handleEvent(Event event) {
shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
if(compareSndIsOn == false){
compareSndIsOn = true;
compareSndBtn.setText(COMP_SND_ON);
overlayBtn.setEnabled(false);
compareStnBtn.setEnabled( false );
compareTmBtn.setEnabled( false );
graphEditBtn.setEnabled(false);
dataEditBtn.setEnabled(false);
graphModeBtnTurb.setEnabled( false );
graphModeBtnIcing.setEnabled( false );
interpBtn.setEnabled( false );
cfgBtn.setEnabled( false );
}
else {
compareSndIsOn = false;
compareSndBtn.setText(COMP_SND_OFF);
overlayBtn.setEnabled(true);
compareStnBtn.setEnabled( true );
compareTmBtn.setEnabled( true );
graphEditBtn.setEnabled(true);
dataEditBtn.setEnabled(true);
graphModeBtnTurb.setEnabled( true );
graphModeBtnIcing.setEnabled( true );
interpBtn.setEnabled( true );
cfgBtn.setEnabled( true );
}
NsharpResourceHandler rsc = getRscHandler();
if(rsc!= null){
rsc.setCompareSndIsOn(compareSndIsOn);
rsc.refreshPane();
}
}
} );
dataEditBtn = new Button(textModeGp, SWT.PUSH);
dataEditBtn.setFont(newFont);
dataEditBtn.setText(" Edit Data ");
@ -890,6 +987,7 @@ DisposeListener, IPartListener{
dataEditBtn.setEnabled( true );
interpBtn.setEnabled( true );
compareTmBtn.setEnabled( true );
compareSndBtn.setEnabled( true );
compareStnBtn.setEnabled( true );
overlayBtn.setEnabled( true );
}
@ -901,6 +999,7 @@ DisposeListener, IPartListener{
dataEditBtn.setEnabled( false );
interpBtn.setEnabled( false );
compareTmBtn.setEnabled( false );
compareSndBtn.setEnabled( false );
compareStnBtn.setEnabled( false );
overlayBtn.setEnabled( false );
}
@ -965,6 +1064,7 @@ DisposeListener, IPartListener{
graphEditBtn.setEnabled(true);
dataEditBtn.setEnabled(true);
compareTmBtn.setEnabled( true );
compareSndBtn.setEnabled( true );
compareStnBtn.setEnabled( true );
overlayBtn.setEnabled( true );
}
@ -972,6 +1072,7 @@ DisposeListener, IPartListener{
graphEditBtn.setEnabled(false);
dataEditBtn.setEnabled(false);
compareTmBtn.setEnabled( false );
compareSndBtn.setEnabled( false );
compareStnBtn.setEnabled( false );
overlayBtn.setEnabled( false );
}
@ -998,6 +1099,7 @@ DisposeListener, IPartListener{
graphEditBtn.setEnabled(false);
dataEditBtn.setEnabled(false);
compareTmBtn.setEnabled( false );
compareSndBtn.setEnabled( false );
compareStnBtn.setEnabled( false );
overlayBtn.setEnabled( false );
NsharpResourceHandler rsc = getRscHandler();
@ -1022,6 +1124,7 @@ DisposeListener, IPartListener{
graphEditBtn.setEnabled(false);
dataEditBtn.setEnabled(false);
compareTmBtn.setEnabled( false );
compareSndBtn.setEnabled( false );
compareStnBtn.setEnabled( false );
overlayBtn.setEnabled( false );
NsharpResourceHandler rsc = getRscHandler();
@ -1070,7 +1173,7 @@ DisposeListener, IPartListener{
if(rscHandler!= null){
restorePaletteWindow(paneConfigurationName, rscHandler.getCurrentGraphMode(),
rscHandler.isInterpolateIsOn(), rscHandler.isOverlayIsOn(),
rscHandler.isCompareStnIsOn(),rscHandler.isCompareTmIsOn(),rscHandler.isEditGraphOn());
rscHandler.isCompareStnIsOn(),rscHandler.isCompareTmIsOn(),rscHandler.isEditGraphOn(),rscHandler.isCompareSndIsOn());
}
parent.redraw();
}
@ -1294,10 +1397,15 @@ DisposeListener, IPartListener{
}
private IContextActivation context;
@Override
public void partActivated(IWorkbenchPart part) {
// TODO Auto-generated method stub
if(context==null){
IContextService ctxSvc = (IContextService) PlatformUI
.getWorkbench().getService(IContextService.class);
context = ctxSvc.activateContext("gov.noaa.nws.ncep.ui.nsharp.nsharpContext");
//System.out.println("Activated " + context.getContextId());
}
}
@Override
public void partBroughtToTop(IWorkbenchPart part) {
@ -1309,7 +1417,14 @@ DisposeListener, IPartListener{
}
@Override
public void partDeactivated(IWorkbenchPart part) {
// TODO Auto-generated method stub
if (context != null) {
IContextService ctxSvc = (IContextService) PlatformUI
.getWorkbench().getService(IContextService.class);
ctxSvc.deactivateContext(context);
//System.out.println("Deactivated " + context.getContextId());
context = null;
}
}
@Override

View file

@ -0,0 +1,202 @@
package gov.noaa.nws.ncep.ui.nsharp.view;
/**
*
* gov.noaa.nws.ncep.ui.nsharp.palette.NsharpSndConfigDialog
*
*
* This code has been developed by the NCEP-SIB for use in the AWIPS2 system.
*
* <pre>
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------- ------- -------- -----------
* 04/23/2012 229 Chin Chen Initial coding
*
* </pre>
*
* @author Chin Chen
* @version 1.0
*/
import gov.noaa.nws.ncep.ui.nsharp.NsharpConstants;
import gov.noaa.nws.ncep.ui.nsharp.NsharpOperationElement;
import gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor;
import gov.noaa.nws.ncep.ui.nsharp.display.rsc.NsharpResourceHandler;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
public class NsharpSndConfigDialog extends Dialog {
private static NsharpSndConfigDialog INSTANCE = null;
private org.eclipse.swt.widgets.List sndList;
private List<String> selectedsndList = new ArrayList<String>();
protected Composite top;
private MessageBox mb;
protected NsharpSndConfigDialog(Shell parentShell) {
super(parentShell);
mb = new MessageBox(parentShell, SWT.ICON_WARNING
| SWT.OK );
mb.setMessage( "Current sounding type can't be deactivated!");
}
public static NsharpSndConfigDialog getInstance( Shell parShell){
if ( INSTANCE == null ){
INSTANCE = new NsharpSndConfigDialog( parShell );
}
return INSTANCE;
}
@Override
public int open() {
return super.open();
}
@Override
public boolean close() {
if(sndList!=null){
sndList.removeListener(SWT.Selection, sndList.getListeners(SWT.Selection)[0]);
sndList.dispose();
sndList = null;
}
if(selectedsndList!= null){
selectedsndList.clear();
selectedsndList = null;
}
INSTANCE = null;
return super.close();
}
@Override
protected void configureShell( Shell shell ) {
super.configureShell( shell );
shell.setText( "Sounding Configuration" );
}
@Override
protected void createButtonsForButtonBar(Composite parent) {
createButton(parent, IDialogConstants.CANCEL_ID,
IDialogConstants.CANCEL_LABEL, false);
}
@Override
protected Control createDialogArea(Composite parent) {
top = (Composite) super.createDialogArea(parent);
// Create the main layout for the shell.
GridLayout mainLayout = new GridLayout(1, false);
mainLayout.marginHeight = 3;
mainLayout.marginWidth = 3;
top.setLayout(mainLayout);
// Initialize all of the menus, controls, and layouts
createDiaContents(top);
return top;
}
private void createDiaContents(Composite parent) {
//create file widget list
Group sndListGp = new Group(parent,SWT.SHADOW_ETCHED_IN);
sndList = new org.eclipse.swt.widgets.List(sndListGp, SWT.BORDER | SWT.MULTI| SWT.V_SCROLL );
sndList.setBounds(0,0, 2*NsharpConstants.listWidth, NsharpConstants.listHeight * 8);
createsndList();
//create a selection listener to handle user's selection on list
sndList.addListener ( SWT.Selection, new Listener () {
private String selectedSndType=null;
public void handleEvent (Event e) {
if (sndList.getSelectionCount() > 0 ) {
selectedsndList.clear();
for(int i=0; i < sndList.getSelectionCount(); i++) {
selectedSndType = sndList.getSelection()[i];
if(selectedSndType.contains("Active-Current") == true){
sndList.deselect(sndList.indexOf(selectedSndType));
mb.open();
break;
}
//remove "--InActive" or "--Active" from string
selectedSndType= selectedSndType.substring(0, selectedSndType.indexOf('-'));
selectedsndList.add(selectedSndType);
}
}
}
});
Group buttonGp = new Group(parent,SWT.SHADOW_OUT);
buttonGp.setLayout( new GridLayout(2, false) );
Button activateBtn = new Button(buttonGp, SWT.PUSH);
activateBtn.setText("Activate");
activateBtn.setEnabled( true );
activateBtn.addListener( SWT.MouseUp, new Listener() {
public void handleEvent(Event event) {
NsharpResourceHandler rsc = NsharpEditor.getActiveNsharpEditor().getRscHandler();
rsc.handleSndTypeActConfig(selectedsndList, NsharpConstants.ActState.ACTIVE);
selectedsndList.clear();
close();
}
} );
Button deactivateBtn = new Button(buttonGp, SWT.PUSH);
deactivateBtn.setText("DeActivate");
deactivateBtn.setEnabled( true );
deactivateBtn.addListener( SWT.MouseUp, new Listener() {
public void handleEvent(Event event) {
//System.out.println("Unload Selected");
NsharpResourceHandler rsc = NsharpEditor.getActiveNsharpEditor().getRscHandler();
rsc.handleSndTypeActConfig(selectedsndList, NsharpConstants.ActState.INACTIVE);
selectedsndList.clear();
close();
}
} );
}
private boolean checkLoadedRsc() {
NsharpEditor editor = NsharpEditor.getActiveNsharpEditor();
if (editor == null) {
return false;
}
NsharpResourceHandler rsc = editor.getRscHandler();
if (rsc == null) {
return false;
}
return true;
}
private void createsndList(){
if(checkLoadedRsc()== false)
return;
//after checking, rsc is not null guaranteed.
NsharpResourceHandler rsc = NsharpEditor.getActiveNsharpEditor().getRscHandler();
List<NsharpOperationElement> sndTypeList = rsc.getSndElementList();
int curStnIndex = rsc.getCurrentSndElementListIndex();
for(NsharpOperationElement snd: sndTypeList){
String s;
if(snd.getActionState() == NsharpConstants.ActState.INACTIVE)
s = "--(InActive)";
else{
if(sndTypeList.indexOf(snd)== curStnIndex)
s="--(Active-Current)";
else
s="--(Active)";
}
sndList.add(snd.getElementDescription() +s);
}
}
}

View file

@ -19,7 +19,7 @@ package gov.noaa.nws.ncep.ui.nsharp.view;
* @version 1.0
*/
import gov.noaa.nws.ncep.ui.nsharp.NsharpConstants;
import gov.noaa.nws.ncep.ui.nsharp.NsharpStationStateProperty;
import gov.noaa.nws.ncep.ui.nsharp.NsharpOperationElement;
import gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor;
import gov.noaa.nws.ncep.ui.nsharp.display.rsc.NsharpResourceHandler;
@ -36,6 +36,7 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
public class NsharpStnConfigDialog extends Dialog {
@ -43,8 +44,12 @@ public class NsharpStnConfigDialog extends Dialog {
private org.eclipse.swt.widgets.List stnList;
private List<String> selectedStnList = new ArrayList<String>();
protected Composite top;
private MessageBox mb;
protected NsharpStnConfigDialog(Shell parentShell) {
super(parentShell);
mb = new MessageBox(parentShell, SWT.ICON_WARNING
| SWT.OK );
mb.setMessage( "Current station can't be deactivated!");
}
public static NsharpStnConfigDialog getInstance( Shell parShell){
@ -121,6 +126,11 @@ public class NsharpStnConfigDialog extends Dialog {
selectedStnList.clear();
for(int i=0; i < stnList.getSelectionCount(); i++) {
selectedSndTime = stnList.getSelection()[i];
if(selectedSndTime.contains("Active-Current") == true){
stnList.deselect(stnList.indexOf(selectedSndTime));
mb.open();
break;
}
//remove "--InActive" or "--Active" from string
selectedSndTime= selectedSndTime.substring(0, selectedSndTime.indexOf('-'));
selectedStnList.add(selectedSndTime);
@ -139,7 +149,7 @@ public class NsharpStnConfigDialog extends Dialog {
activateBtn.addListener( SWT.MouseUp, new Listener() {
public void handleEvent(Event event) {
NsharpResourceHandler rsc = NsharpEditor.getActiveNsharpEditor().getRscHandler();
rsc.handleStationActConfig(selectedStnList, NsharpConstants.State.ACTIVE);
rsc.handleStationActConfig(selectedStnList, NsharpConstants.ActState.ACTIVE);
selectedStnList.clear();
close();
}
@ -152,7 +162,7 @@ public class NsharpStnConfigDialog extends Dialog {
public void handleEvent(Event event) {
//System.out.println("Unload Selected");
NsharpResourceHandler rsc = NsharpEditor.getActiveNsharpEditor().getRscHandler();
rsc.handleStationActConfig(selectedStnList, NsharpConstants.State.INACTIVE);
rsc.handleStationActConfig(selectedStnList, NsharpConstants.ActState.INACTIVE);
selectedStnList.clear();
close();
}
@ -174,14 +184,19 @@ public class NsharpStnConfigDialog extends Dialog {
return;
//after checking, rsc is not null guaranteed.
NsharpResourceHandler rsc = NsharpEditor.getActiveNsharpEditor().getRscHandler();
List<NsharpStationStateProperty> stnStList = rsc.getStnStateList();
for(NsharpStationStateProperty stn: stnStList){
List<NsharpOperationElement> stnStList = rsc.getStnElementList();
int curStnIndex = rsc.getCurrentStnElementListIndex();
for(NsharpOperationElement stn: stnStList){
String s;
if(stn.getStnState() == NsharpConstants.State.INACTIVE)
if(stn.getActionState() == NsharpConstants.ActState.INACTIVE)
s = "--(InActive)";
else
s="--(Active)";
stnList.add(stn.getStnDescription() +s);
else{
if(stnStList.indexOf(stn)== curStnIndex)
s="--(Active-Current)";
else
s="--(Active)";
}
stnList.add(stn.getElementDescription() +s);
}
}
}

View file

@ -19,7 +19,7 @@ package gov.noaa.nws.ncep.ui.nsharp.view;
* @version 1.0
*/
import gov.noaa.nws.ncep.ui.nsharp.NsharpConstants;
import gov.noaa.nws.ncep.ui.nsharp.NsharpTimeLineStateProperty;
import gov.noaa.nws.ncep.ui.nsharp.NsharpOperationElement;
import gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor;
import gov.noaa.nws.ncep.ui.nsharp.display.rsc.NsharpResourceHandler;
@ -36,6 +36,7 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
public class NsharpTimeLineConfigDialog extends Dialog {
@ -43,8 +44,12 @@ public class NsharpTimeLineConfigDialog extends Dialog {
private org.eclipse.swt.widgets.List timeLineList;
private List<String> selectedTimeList = new ArrayList<String>();
protected Composite top;
private MessageBox mb;
protected NsharpTimeLineConfigDialog(Shell parentShell) {
super(parentShell);
mb = new MessageBox(parentShell, SWT.ICON_WARNING
| SWT.OK );
mb.setMessage( "Current time line can't be deactivated!");
}
public static NsharpTimeLineConfigDialog getInstance( Shell parShell){
@ -111,7 +116,7 @@ public class NsharpTimeLineConfigDialog extends Dialog {
//create file widget list
Group sndTimeListGp = new Group(parent,SWT.SHADOW_ETCHED_IN);
timeLineList = new org.eclipse.swt.widgets.List(sndTimeListGp, SWT.BORDER | SWT.MULTI| SWT.V_SCROLL );
timeLineList.setBounds(0,0, 2*NsharpConstants.listWidth, NsharpConstants.listHeight * 8);
timeLineList.setBounds(0,0, 2*NsharpConstants.listWidth, NsharpConstants.listHeight * 4);
createSndList();
//create a selection listener to handle user's selection on list
timeLineList.addListener ( SWT.Selection, new Listener () {
@ -121,6 +126,11 @@ public class NsharpTimeLineConfigDialog extends Dialog {
selectedTimeList.clear();
for(int i=0; i < timeLineList.getSelectionCount(); i++) {
selectedSndTime = timeLineList.getSelection()[i];
if(selectedSndTime.contains("Active-Current") == true){
timeLineList.deselect(timeLineList.indexOf(selectedSndTime));
mb.open();
break;
}
//remove "--InActive" or "--Active"
selectedSndTime= selectedSndTime.substring(0, selectedSndTime.indexOf("--"));
selectedTimeList.add(selectedSndTime);
@ -138,8 +148,9 @@ public class NsharpTimeLineConfigDialog extends Dialog {
activateBtn.setEnabled( true );
activateBtn.addListener( SWT.MouseUp, new Listener() {
public void handleEvent(Event event) {
NsharpResourceHandler rsc = NsharpEditor.getActiveNsharpEditor().getRscHandler();
rsc.handleTimeLineActConfig(selectedTimeList, NsharpConstants.State.ACTIVE);
NsharpResourceHandler rsc = NsharpEditor.getActiveNsharpEditor().getRscHandler();
rsc.handleTimeLineActConfig(selectedTimeList, NsharpConstants.ActState.ACTIVE);
selectedTimeList.clear();
close();
}
@ -151,8 +162,8 @@ public class NsharpTimeLineConfigDialog extends Dialog {
deactivateBtn.addListener( SWT.MouseUp, new Listener() {
public void handleEvent(Event event) {
//System.out.println("Unload Selected");
NsharpResourceHandler rsc = NsharpEditor.getActiveNsharpEditor().getRscHandler();
rsc.handleTimeLineActConfig(selectedTimeList, NsharpConstants.State.INACTIVE);
NsharpResourceHandler rsc = NsharpEditor.getActiveNsharpEditor().getRscHandler();
rsc.handleTimeLineActConfig(selectedTimeList, NsharpConstants.ActState.INACTIVE);
selectedTimeList.clear();
close();
}
@ -174,14 +185,19 @@ public class NsharpTimeLineConfigDialog extends Dialog {
return;
//after checking, rsc is not null guaranteed.
NsharpResourceHandler rsc = NsharpEditor.getActiveNsharpEditor().getRscHandler();
List<NsharpTimeLineStateProperty> tlList = rsc.getTimeLineStateList();
for(NsharpTimeLineStateProperty tl: tlList){
List<NsharpOperationElement> tlList = rsc.getTimeElementList();
int curTmIndex = rsc.getCurrentTimeElementListIndex();
for(NsharpOperationElement tl: tlList){
String s;
if(tl.getTimeState() == NsharpConstants.State.INACTIVE)
if(tl.getActionState() == NsharpConstants.ActState.INACTIVE)
s = "--(InActive)";
else
s="--(Active)";
timeLineList.add(tl.getTimeDescription() +s);
else {
if(tlList.indexOf(tl) == curTmIndex)
s="--(Active-Current)";
else
s="--(Active)";
}
timeLineList.add(tl.getElementDescription() +s);
}
}
}

View file

@ -19,14 +19,13 @@
*/
package gov.noaa.nws.ncep.ui.nsharp.view;
import java.util.ArrayList;
import java.util.List;
import gov.noaa.nws.ncep.ui.nsharp.NsharpConstants;
import gov.noaa.nws.ncep.ui.nsharp.NsharpSoundingElementStateProperty;
import gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor;
import gov.noaa.nws.ncep.ui.nsharp.display.rsc.NsharpResourceHandler;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.SWT;
@ -188,17 +187,11 @@ public class NsharpUnloadDialog extends Dialog {
return;
//after checking, rsc is not null guaranteed.
NsharpResourceHandler rsc = NsharpEditor.getActiveNsharpEditor().getRscHandler();
//List<ElementStateProperty> timeLineElementList = rsc.getDataTimelineList();
List<List<NsharpSoundingElementStateProperty>> stnTmTable = rsc.getStnTimeTable();
//for(ElementStateProperty elm: timeLineElementList){
// sndTimeList.add(elm.getElementDescription());
//}
for(List<NsharpSoundingElementStateProperty> stnTmList: stnTmTable){
for(NsharpSoundingElementStateProperty tm: stnTmList){
if(tm.getElementState() != NsharpConstants.State.NOTAVAIL){
sndTimeList.add(tm.getElementDescription());
}
}
List<String> elemDescLst = rsc.getAllLoadedSndDesciptionList();
for(String eleDesc: elemDescLst){
sndTimeList.add(eleDesc);
}
}
}

View file

@ -59,6 +59,7 @@ public class NsharpWindBarbConfigDialog extends Dialog {
private ColorMatrixSelector cms;
private Text windBarbWidthText, windBarbSizeText, windBarbDistText;
private MessageBox mb;
private boolean showFilteredWind;
public static NsharpWindBarbConfigDialog getInstance(Shell parentShell) {
if(instance == null)
instance = new NsharpWindBarbConfigDialog(parentShell);
@ -77,6 +78,7 @@ public class NsharpWindBarbConfigDialog extends Dialog {
curColor = configStore.getGraphProperty().getWindBarbColor();
curSize = configStore.getGraphProperty().getWindBarbSize();
curDist = configStore.getGraphProperty().getWindBarbDistance();
showFilteredWind = configStore.getGraphProperty().isShowFilteredWindInCircle();
}
}
@ -85,7 +87,7 @@ public class NsharpWindBarbConfigDialog extends Dialog {
FormLayout layout0 = new FormLayout();
composite.setLayout(layout0);
// Lay out the various groups within the dialog
Group lineConfigGroup = new Group ( composite, SWT.SHADOW_NONE );
Group lineConfigGroup = new Group ( composite, SWT.SHADOW_NONE | SWT.NO_RADIO_GROUP );
lineConfigGroup.setText("Properties");
GridLayout lineConfigGridLayout = new GridLayout();
lineConfigGridLayout.numColumns = 1;
@ -115,9 +117,9 @@ public class NsharpWindBarbConfigDialog extends Dialog {
colorConfigGroup.setLayoutData(formData5);
// Parameters to give a uniform look to all line width/style buttons
final int lblWidth = 100;
final int lblWidth = 110;
final int lblHeight = 20;
final int textWidth = 100;
final int textWidth = 110;
// Line Width
@ -154,7 +156,21 @@ public class NsharpWindBarbConfigDialog extends Dialog {
windBarbDistText.setVisible(true);
//listen to Integer data type, use 0 as input
windBarbDistText.addListener (SWT.Verify,new InEditListener ( 0) );
/* TBDWB
Button showFilteredWBtn = new Button(lineConfigGroup, SWT.RADIO | SWT.BORDER);
showFilteredWBtn.setText("Show Filter wb in Crc");
if(showFilteredWind == true)
showFilteredWBtn.setSelection(true);
else
showFilteredWBtn.setSelection(false);
showFilteredWBtn.addListener( SWT.MouseUp, new Listener() {
public void handleEvent(Event event) {
if(showFilteredWind == true)
showFilteredWind=false;
else
showFilteredWind=true;
}
} ); */
// Line Color
cms = new ColorMatrixSelector(colorConfigGroup, false, false,
@ -283,6 +299,7 @@ public class NsharpWindBarbConfigDialog extends Dialog {
configStore.getGraphProperty().setWindBarbDistance(curDist);
configStore.getGraphProperty().setWindBarbLineWidth(curLineWidth);
configStore.getGraphProperty().setWindBarbSize(curSize);
configStore.getGraphProperty().setShowFilteredWindInCircle(showFilteredWind);
//inform editor
NsharpEditor editor = NsharpEditor.getActiveNsharpEditor();
if (editor != null) {

View file

@ -363,9 +363,9 @@ fi
if [ "${1}" = "-edex" ]; then
#buildRPM "awips2"
#buildRPM "awips2-common-base"
#buildRPM "awips2-adapt-native"
buildRPM "awips2-adapt-native"
#buildRPM "awips2-python-qpid"
#buildRPM "awips2-cli"
buildRPM "awips2-cli"
buildRPM "awips2-gfesuite-client"
buildRPM "awips2-gfesuite-server"
buildEDEX