13.3.1-15 baseline
Former-commit-id:3d8ed484be
[formerly 369cf4feaee63c96725cb6efc5774b8f6b8cbf08] Former-commit-id:eb1dab3864
This commit is contained in:
parent
6a4bbd9f1a
commit
4cf3ad6abb
31 changed files with 1774 additions and 1169 deletions
|
@ -128,5 +128,5 @@
|
|||
</lineProperty>
|
||||
</Line>
|
||||
</linePropertyMap>
|
||||
<dataPageProperty severePotentialPage="10" convectiveInitiationPage="9" meanWindPage="8" stormRelativePage="7" mixingHeightPage="6" opcDataPage="5" thermodynamicDataPage="4" parcelDataPage="3" summary2Page="2" summary1Page="1"/>
|
||||
<dataPageProperty numberPagePerDisplay="1" severePotentialPage="10" convectiveInitiationPage="9" meanWindPage="8" stormRelativePage="7" mixingHeightPage="6" opcDataPage="5" thermodynamicDataPage="4" parcelDataPage="3" summary2Page="2" summary1Page="1"/>
|
||||
</NsharpConfigStore>
|
||||
|
|
|
@ -95,6 +95,7 @@ import com.raytheon.uf.edex.database.query.DatabaseQuery;
|
|||
* 1-3-2013 DR 15667 M.Porricelli Made EnvironParamsLevelTable.xml
|
||||
* accessible from SITE level
|
||||
* 03/04/2013 DR 14770 D. Friedman Correct clipped grid coordinates.
|
||||
* 03/21/2013 DR 15872 D. Friedman Correct grid orientation.
|
||||
**/
|
||||
public class RPGEnvironmentalDataManager {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
|
@ -584,6 +585,12 @@ public class RPGEnvironmentalDataManager {
|
|||
double cx2 = stationXY.x + delta;
|
||||
double cy2 = stationXY.y + delta;
|
||||
|
||||
/*
|
||||
* Note the y-coordinate flipping below. The output grid scans west
|
||||
* to east, south to north, while the input grid from EDEX scans
|
||||
* north to south.
|
||||
*/
|
||||
|
||||
DirectPosition2D c = new DirectPosition2D();
|
||||
crsToGrid.transform(new DirectPosition2D(cx1, cy1), c);
|
||||
i1 = (int) Math.round(c.x);
|
||||
|
@ -785,17 +792,24 @@ public class RPGEnvironmentalDataManager {
|
|||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* Note the y-coordinate flipping below. The output grid scans west
|
||||
* to east, south to north, while the input grid from EDEX scans
|
||||
* north to south.
|
||||
*/
|
||||
|
||||
float[] data = dataRecord.getFloatData();
|
||||
float[] clippedData = new float[grid.getPointCount()];
|
||||
int stride = domain.getSpan(0);
|
||||
int iidx = clip.getLow(0) + clip.getLow(1) * stride;
|
||||
int iidx = clip.getLow(0) +
|
||||
(domain.getHigh(1) - clip.getLow(1)) * stride;
|
||||
int oidx = 0;
|
||||
|
||||
for (int j = 0; j < clippedNy; ++j) {
|
||||
for (int i = 0; i < clippedNx; ++i) {
|
||||
clippedData[oidx++] = data[iidx + i];
|
||||
}
|
||||
iidx += stride;
|
||||
iidx -= stride;
|
||||
}
|
||||
|
||||
grid.data = clippedData;
|
||||
|
|
|
@ -29,23 +29,23 @@
|
|||
<!-- EDEX unit is actually "gpm" -->
|
||||
<field name="GH" units="m" description="Geopotential Height">
|
||||
<level name="MB" description="Pressure Level" units="mb"
|
||||
levels="1000 950 900 850 800 750 700 650 600 550 500 450 400 350 300 250 200 150 100" />
|
||||
levels="1000 975 950 925 900 875 850 825 800 775 750 725 700 675 650 625 600 575 550 525 500 475 450 425 400 375 350 325 300 250 200 150 100" />
|
||||
</field>
|
||||
<field name="RH" units="%" description="Relative Humidity">
|
||||
<level name="MB" description="Pressure Level" units="mb"
|
||||
levels="1000 950 900 850 800 750 700 650 600 550 500 450 400 350 300" />
|
||||
levels="1000 975 950 925 900 875 850 825 800 775 750 725 700 675 650 625 600 575 550 525 500 475 450 425 400 375 350 325 300 250 200 150 100" />
|
||||
</field>
|
||||
<field name="T" units="K" description="Temperature">
|
||||
<level name="MB" description="Pressure Level" units="mb"
|
||||
levels="1000 950 900 850 800 750 700 650 600 550 500 450 400 350 300 250 200 150 100" />
|
||||
levels="1000 975 950 925 900 875 850 825 800 775 750 725 700 675 650 625 600 575 550 525 500 475 450 425 400 375 350 325 300 250 200 150 100" />
|
||||
</field>
|
||||
<field name="uW" description="U Wind Component" units="m/s">
|
||||
<level name="MB" description="Pressure Level" units="mb"
|
||||
levels="1000 950 900 850 800 750 700 650 600 550 500 450 400 350 300 250 200 150 100" />
|
||||
levels="1000 975 950 925 900 875 850 825 800 775 750 725 700 675 650 625 600 575 550 525 500 475 450 425 400 375 350 325 300 250 200 150 100" />
|
||||
</field>
|
||||
<field name="vW" description="V Wind Component" units="m/s">
|
||||
<level name="MB" description="Pressure Level" units="mb"
|
||||
levels="1000 950 900 850 800 750 700 650 600 550 500 450 400 350 300 250 200 150 100" />
|
||||
levels="1000 975 950 925 900 875 850 825 800 775 750 725 700 675 650 625 600 575 550 525 500 475 450 425 400 375 350 325 300 250 200 150 100" />
|
||||
</field>
|
||||
<field name="P" units="Pa" description="Pressure">
|
||||
<level name="SFC" description="Surface Level" units="" />
|
||||
|
|
|
@ -7,5 +7,9 @@ Bundle-Vendor: RAYTHEON
|
|||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Require-Bundle: com.raytheon.edex.common;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1174",
|
||||
javax.persistence;bundle-version="1.0.0"
|
||||
javax.persistence;bundle-version="1.0.0",
|
||||
org.apache.commons.lang;bundle-version="2.3.0",
|
||||
com.raytheon.uf.common.status;bundle-version="1.12.1174"
|
||||
Export-Package: com.raytheon.uf.common.tafqueue
|
||||
Import-Package: com.raytheon.uf.common.localization,
|
||||
org.apache.commons.configuration
|
||||
|
|
|
@ -48,6 +48,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 27, 2009 avarani Initial creation
|
||||
* Apr 30, 2012 14715 rferrel Refactored and moved.
|
||||
* Mar 21, 2013 15375 zhao Modified getInfo() to also handle VFT product
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -157,10 +158,14 @@ public class TafQueueRecord implements IPersistableDataObject,
|
|||
* @return info
|
||||
*/
|
||||
public String getInfo() {
|
||||
String productTag = "TAF";
|
||||
if ( forecasterId == TafQueueVftConfigMgr.getInstance().getFcstid() ) { // for VFT product (DR15375)
|
||||
productTag = "VFT";
|
||||
}
|
||||
return String
|
||||
.format("%1$03d-%7$s%8$s%5$s-%6$s-%7$s-%2$ty%2$tm%2$td%2$tH%2$tM-%4$s-%9$d",
|
||||
forecasterId, headerTime, tafText, bbb, siteId, wmoId,
|
||||
stationId, "TAF", (xmitTime.getTime() / 1000));
|
||||
stationId, productTag, (xmitTime.getTime() / 1000));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,173 @@
|
|||
/**
|
||||
* 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.uf.common.tafqueue;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.apache.commons.configuration.ConfigurationException;
|
||||
import org.apache.commons.configuration.HierarchicalINIConfiguration;
|
||||
|
||||
import com.raytheon.uf.common.localization.IPathManager;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
|
||||
/**
|
||||
* This class is used to read in configuration for AvnFPS verification (VFT) product.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 21, 2013 15375 zhao Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author zhao
|
||||
*
|
||||
*/
|
||||
public class TafQueueVftConfigMgr {
|
||||
|
||||
private final IUFStatusHandler statusHandler = UFStatus.getHandler(TafQueueVftConfigMgr.class);
|
||||
|
||||
private static TafQueueVftConfigMgr instance = null;
|
||||
|
||||
private String wmoid = "NXUS98"; // default, to be replaced by wmo in config file
|
||||
private String siteid = "OAX"; // default (siteid in taf_queue table)
|
||||
private String stationid = "KOAX"; // default (stationid in taf_queue table)
|
||||
private int fcstid = 0; // default forecasterid for VFT
|
||||
private int period = 6; // number of hours; default period for VFT product creation, to be replaced by period in config file
|
||||
|
||||
/**
|
||||
* BBB field for VFT product; non-configurable
|
||||
*/
|
||||
private String bbb = "___";
|
||||
|
||||
private static final String XMIT_FILE = "aviation" + File.separator + "config" + File.separator + "xmit.cfg";
|
||||
|
||||
private HierarchicalINIConfiguration xmitConfig = null;
|
||||
|
||||
public static TafQueueVftConfigMgr getInstance() {
|
||||
if ( instance == null ) {
|
||||
instance = new TafQueueVftConfigMgr();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
private TafQueueVftConfigMgr() {
|
||||
// read in configuration
|
||||
loadXmitConfigFile();
|
||||
if ( xmitConfig != null ) {
|
||||
readConfiguration();
|
||||
}
|
||||
}
|
||||
|
||||
private void loadXmitConfigFile() {
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
LocalizationContext context = pm.getContext(LocalizationType.CAVE_STATIC, LocalizationLevel.SITE);
|
||||
LocalizationFile lFile = pm.getLocalizationFile(context, XMIT_FILE);
|
||||
HierarchicalINIConfiguration config = new HierarchicalINIConfiguration();
|
||||
config.setDelimiterParsingDisabled(true);
|
||||
try {
|
||||
config.load(lFile.getFile());
|
||||
} catch (ConfigurationException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, "Tafqueue VFT Configuration Manager: loading xmit.cfg file failed.\n" + e.getLocalizedMessage(), e);
|
||||
return;
|
||||
}
|
||||
this.xmitConfig =config;
|
||||
}
|
||||
|
||||
private void readConfiguration() {
|
||||
try {
|
||||
String wmo = xmitConfig.getString("verification.wmo");
|
||||
String [] wmosplits = wmo.split(" ");
|
||||
wmoid = wmosplits[0];
|
||||
stationid = wmosplits[1];
|
||||
siteid = stationid.substring(1);
|
||||
String fcstidStr = xmitConfig.getString("verification.fcstid");
|
||||
fcstid = Integer.parseInt(fcstidStr);
|
||||
String periodStr = xmitConfig.getString("verification.period");
|
||||
period = Integer.parseInt(periodStr);
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM, "Tafqueue VFT Configuration Manager: error occurred while reading configuration.\n" + e.getLocalizedMessage(), e);
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
statusHandler.handle(Priority.INFO, "Tafqueue VFT Configuration Manager: wmo = " + wmoid + " " + stationid + "; forecasterid = " + fcstid + "; period = " + period );
|
||||
return;
|
||||
}
|
||||
|
||||
public String getWmoid() {
|
||||
return wmoid;
|
||||
}
|
||||
|
||||
public void setWmoid(String wmoid) {
|
||||
this.wmoid = wmoid;
|
||||
}
|
||||
|
||||
public String getSiteid() {
|
||||
return siteid;
|
||||
}
|
||||
|
||||
public void setSiteid(String siteid) {
|
||||
this.siteid = siteid;
|
||||
}
|
||||
|
||||
public String getStationid() {
|
||||
return stationid;
|
||||
}
|
||||
|
||||
public void setStationid(String stationid) {
|
||||
this.stationid = stationid;
|
||||
}
|
||||
|
||||
public int getFcstid() {
|
||||
return fcstid;
|
||||
}
|
||||
|
||||
public void setFcstid(int fcstid) {
|
||||
this.fcstid = fcstid;
|
||||
}
|
||||
|
||||
public int getPeriod() {
|
||||
return period;
|
||||
}
|
||||
|
||||
public void setPeriod(int period) {
|
||||
this.period = period;
|
||||
}
|
||||
|
||||
public String getBbb() {
|
||||
return bbb;
|
||||
}
|
||||
|
||||
public void setBbb(String bbb) {
|
||||
this.bbb = bbb;
|
||||
}
|
||||
|
||||
}
|
|
@ -730,6 +730,10 @@ public class FFMPGenerator extends CompositeProductGenerator implements
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SourceXML source = getSourceConfig().getSource(
|
||||
ffmpRec.getSourceName());
|
||||
|
||||
if (!source.getSourceType().equals(
|
||||
SOURCE_TYPE.GUIDANCE.getSourceType())) {
|
||||
|
@ -737,14 +741,11 @@ public class FFMPGenerator extends CompositeProductGenerator implements
|
|||
dataKey, ffmpRec);
|
||||
ffmpData.remove(sourceSiteDataKey);
|
||||
statusHandler.info("Removing from memory: "+sourceSiteDataKey);
|
||||
|
||||
}
|
||||
} // ffmp.isFFTI
|
||||
} // record not null
|
||||
} // end sitekey for loop
|
||||
} // end datakey loop
|
||||
} // end process
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2013,4 +2014,31 @@ public class FFMPGenerator extends CompositeProductGenerator implements
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Find siteSourceDataKey
|
||||
*
|
||||
* @param source
|
||||
* @param dataKey
|
||||
* @param ffmpRec
|
||||
* @return
|
||||
*/
|
||||
private String getSourceSiteDataKey(SourceXML source, String dataKey, FFMPRecord ffmpRec) {
|
||||
|
||||
String sourceName = source.getSourceName();
|
||||
String sourceSiteDataKey = null;
|
||||
|
||||
if (source.getSourceType().equals(
|
||||
SOURCE_TYPE.GUIDANCE.getSourceType())) {
|
||||
sourceName = source.getDisplayName();
|
||||
sourceSiteDataKey = sourceName;
|
||||
|
||||
} else {
|
||||
sourceName = ffmpRec.getSourceName();
|
||||
sourceSiteDataKey = sourceName + "-" + ffmpRec.getSiteKey()
|
||||
+ "-" + dataKey;
|
||||
}
|
||||
|
||||
return sourceSiteDataKey;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry exported="true" kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
|
@ -10,4 +10,8 @@ Require-Bundle: com.raytheon.edex.common;bundle-version="1.12.1174",
|
|||
com.raytheon.uf.common.tafqueue;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.status;bundle-version="1.12.1174",
|
||||
javax.persistence;bundle-version="1.0.0"
|
||||
javax.persistence;bundle-version="1.0.0",
|
||||
org.apache.commons.lang;bundle-version="2.3.0"
|
||||
Import-Package: com.raytheon.uf.common.localization,
|
||||
org.apache.commons.configuration
|
||||
Export-Package: com.raytheon.uf.edex.tafqueue
|
||||
|
|
|
@ -44,6 +44,7 @@ import com.raytheon.uf.edex.database.query.DatabaseQuery;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* May 1, 2012 14715 rferrel Initial creation
|
||||
* Mar 21, 2013 15375 zhao Added methods for handling VFT product
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -274,4 +275,42 @@ public class TafQueueDao extends CoreDao {
|
|||
}
|
||||
return records.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* (for DR15375)
|
||||
* Get last xmit time for a forecaster id (for VFT purpose)
|
||||
* @param forecasterid
|
||||
* @return last xmittime; return null if no record exists
|
||||
* @throws DataAccessLayerException
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Date getLastXmitTimeByForecasterId(int forecasterid) throws DataAccessLayerException {
|
||||
Date lastXmittime = null;
|
||||
DatabaseQuery query = new DatabaseQuery(TafQueueRecord.class.getName());
|
||||
query.addQueryParam("forecasterId", forecasterid, QueryOperand.EQUALS);
|
||||
query.addOrder("xmitTime", false);
|
||||
List<TafQueueRecord> records = (List<TafQueueRecord>) queryByCriteria(query);
|
||||
if ( records.size() > 0 ) {
|
||||
lastXmittime = records.get(0).getXmitTime();
|
||||
}
|
||||
return lastXmittime;
|
||||
}
|
||||
|
||||
/** (for DR15375)
|
||||
* Retrieves a list of TAF records sent since the last VFT product was created
|
||||
* @param lastVftTime (last VFT creation time)
|
||||
* @param forecasterid (forecaster ID for VFT)
|
||||
* @return a list of TAF records sent since lastVftTime or null when no such records exit
|
||||
* @throws DataAccessLayerException
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<TafQueueRecord> getRecordsForVFT(Date lastVftTime, int forecasterid) throws DataAccessLayerException {
|
||||
DatabaseQuery query = new DatabaseQuery(TafQueueRecord.class.getName());
|
||||
query.addQueryParam("xmitTime", lastVftTime, QueryOperand.GREATERTHANEQUALS);
|
||||
query.addQueryParam("forecasterId", forecasterid, QueryOperand.NOTEQUALS);
|
||||
query.addQueryParam("state", TafQueueState.SENT, QueryOperand.EQUALS);
|
||||
query.addOrder("xmitTime", true);
|
||||
List<TafQueueRecord> records = (List<TafQueueRecord>) queryByCriteria(query);
|
||||
return records;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ import com.raytheon.uf.edex.database.DataAccessLayerException;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* May 10, 2012 14715 rferrel Initial creation
|
||||
* Mar 21, 2013 15375 zhao Modified to also handle AvnFPS VFT product
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -241,8 +242,15 @@ public class TafQueueManager implements Runnable {
|
|||
cal.set(Calendar.SECOND, 0);
|
||||
Date nextPurgeTime = cal.getTime();
|
||||
|
||||
/**
|
||||
* (for DR15375)
|
||||
*/
|
||||
TafQueueVFTMgr vftMgr = TafQueueVFTMgr.getInstance();
|
||||
Date nextVftTime = null;
|
||||
|
||||
while (true) {
|
||||
try {
|
||||
|
||||
processList = dao.getRecordsToSend();
|
||||
|
||||
if (processList.size() > 0) {
|
||||
|
@ -251,6 +259,16 @@ public class TafQueueManager implements Runnable {
|
|||
continue;
|
||||
}
|
||||
|
||||
/**
|
||||
* (for DR15375)
|
||||
*/
|
||||
nextVftTime = vftMgr.getNextVftTime();
|
||||
if ( nextVftTime.compareTo(Calendar.getInstance().getTime()) <= 0 ) {
|
||||
vftMgr.makeVftProduct();
|
||||
// transmit immediately
|
||||
continue;
|
||||
}
|
||||
|
||||
if (nextPurgeTime.compareTo(Calendar.getInstance().getTime()) <= 0) {
|
||||
purgeExpiredData(dao);
|
||||
cal = Calendar.getInstance();
|
||||
|
@ -266,12 +284,19 @@ public class TafQueueManager implements Runnable {
|
|||
nextProccessTime = nextPurgeTime;
|
||||
} else if (nextProccessTime.compareTo(nextPurgeTime) > 0) {
|
||||
nextProccessTime = nextPurgeTime;
|
||||
} else if (nextProccessTime.compareTo(Calendar.getInstance()
|
||||
.getTime()) <= 0) {
|
||||
} else if (nextProccessTime.compareTo(Calendar.getInstance().getTime()) <= 0) {
|
||||
// immediate transmit placed on queue while processing.
|
||||
continue;
|
||||
}
|
||||
|
||||
/**
|
||||
* (DR15375)
|
||||
*/
|
||||
nextVftTime = vftMgr.getNextVftTime();
|
||||
if ( nextVftTime.compareTo(nextProccessTime) < 0 ) {
|
||||
nextProccessTime = nextVftTime;
|
||||
}
|
||||
|
||||
synchronized (this) {
|
||||
long timeOut = nextProccessTime.getTime()
|
||||
- Calendar.getInstance().getTime().getTime();
|
||||
|
|
|
@ -0,0 +1,204 @@
|
|||
/**
|
||||
* 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.uf.edex.tafqueue;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.common.tafqueue.TafQueueRecord;
|
||||
import com.raytheon.uf.common.tafqueue.TafQueueVftConfigMgr;
|
||||
import com.raytheon.uf.edex.database.DataAccessLayerException;
|
||||
|
||||
/**
|
||||
* This class is used to create AvnFPS verification (VFT) products.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 07, 2013 15375 zhao Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author zhao
|
||||
*
|
||||
*/
|
||||
public class TafQueueVFTMgr {
|
||||
|
||||
private final IUFStatusHandler statusHandler = UFStatus.getHandler(TafQueueVFTMgr.class);
|
||||
|
||||
private static TafQueueVFTMgr instance = null;
|
||||
|
||||
private TafQueueVftConfigMgr config = null;
|
||||
|
||||
private String wmoid = "NXUS98"; // default, to be replaced by wmo in config file
|
||||
private String siteid = "OAX"; // default (siteid in taf_queue table)
|
||||
private String stationid = "KOAX"; // default (stationid in taf_queue table)
|
||||
private int fcstid = 0; // default forecasterid for VFT
|
||||
private int period = 6; // number of hours; default period of VFT product creation, to be replaced by period in config file
|
||||
private String bbb = "___"; // default BBB field for a VFT product
|
||||
|
||||
private Date lastVftTime = null;
|
||||
private Date nextVftTime = null;
|
||||
|
||||
private TafQueueVFTMgr() {
|
||||
init();
|
||||
statusHandler.handle(Priority.INFO, "Tafqueue VFT manager created.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an AvnFPS VFT product, and updates time for next VFT product
|
||||
*/
|
||||
public void makeVftProduct() {
|
||||
TafQueueDao dao = new TafQueueDao();
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
nextVftTime = cal.getTime();
|
||||
try {
|
||||
List<TafQueueRecord> records = dao.getRecordsForVFT(lastVftTime, fcstid);
|
||||
if (records != null) {
|
||||
if (records.size() > 0) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (TafQueueRecord record : records) {
|
||||
sb.append(formatVftTafRecord(record));
|
||||
sb.append("\n");
|
||||
}
|
||||
String vftText = sb.toString();
|
||||
vftText = vftText.substring(0, vftText.length()-1);
|
||||
TafQueueRecord vftRecord = new TafQueueRecord(fcstid, nextVftTime, vftText, bbb, siteid, wmoid, stationid, nextVftTime);
|
||||
dao.create(vftRecord);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM,"Tafqueue VFT manager: error occurred while making a VFT product.\n" + e.getLocalizedMessage(), e);
|
||||
}
|
||||
lastVftTime = nextVftTime;
|
||||
statusHandler.handle(Priority.INFO, "Tafqueue VFT manager: Last VFT xmit time = " + lastVftTime.toString());
|
||||
cal.add(Calendar.HOUR_OF_DAY, period);
|
||||
nextVftTime = cal.getTime();
|
||||
statusHandler.handle(Priority.INFO, "Tafqueue VFT manager: Next VFT xmit time = " + nextVftTime.toString());
|
||||
}
|
||||
|
||||
private String formatVftTafRecord(TafQueueRecord record) {
|
||||
String tafText = record.getTafText();
|
||||
int indexOfTafPeriod = tafText.indexOf('/');
|
||||
String tafPeriod = tafText.substring(indexOfTafPeriod-4, indexOfTafPeriod+5);
|
||||
String tafBbb = record.getBbb();
|
||||
if ( tafBbb.equals("") || tafBbb.equals(" ") ) {
|
||||
tafBbb = "___";
|
||||
}
|
||||
return String.format("%1$s %2$s %3$ty%3$tm%3$td%3$tH%4$s " +
|
||||
"%5$s %6$s %7$ty%7$tm%7$td%7$tH%7$tm%8$s %9$s %10$03d",
|
||||
record.getWmoId(), record.getStationId(), record.getHeaderTime(), "00",
|
||||
tafBbb, record.getStationId().charAt(0)+record.getSiteId(),
|
||||
record.getXmitTime(), "Z", tafPeriod, record.getForecasterId());
|
||||
}
|
||||
|
||||
private void init() {
|
||||
config = TafQueueVftConfigMgr.getInstance();
|
||||
wmoid = config.getWmoid();
|
||||
siteid = config.getSiteid();
|
||||
stationid = config.getStationid();
|
||||
fcstid = config.getFcstid();
|
||||
period = config.getPeriod();
|
||||
bbb = config.getBbb();
|
||||
|
||||
// determine lastVftTime and nextVftTime
|
||||
TafQueueDao dao = new TafQueueDao();
|
||||
try {
|
||||
lastVftTime = dao.getLastXmitTimeByForecasterId(fcstid);
|
||||
} catch (DataAccessLayerException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, "Tafqueue VFT manager: error occurred while querying for last VFT xmit time.\n" + e.getLocalizedMessage(), e);
|
||||
}
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
if ( lastVftTime == null ) {
|
||||
nextVftTime = cal.getTime();
|
||||
cal.add(Calendar.HOUR_OF_DAY, -period);
|
||||
lastVftTime = cal.getTime();
|
||||
} else {
|
||||
cal.setTime(lastVftTime);
|
||||
cal.add(Calendar.HOUR_OF_DAY, period);
|
||||
nextVftTime = cal.getTime();
|
||||
}
|
||||
statusHandler.handle(Priority.INFO, "Tafqueue VFT manager: Last VFT xmit time = " + lastVftTime.toString());
|
||||
statusHandler.handle(Priority.INFO, "Tafqueue VFT manager: Next VFT xmit time = " + nextVftTime.toString());
|
||||
}
|
||||
|
||||
public static TafQueueVFTMgr getInstance() {
|
||||
if ( instance == null ) {
|
||||
instance = new TafQueueVFTMgr();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void setWmoid(String wmoid) {
|
||||
this.wmoid = wmoid;
|
||||
}
|
||||
|
||||
public String getWmoid() {
|
||||
return wmoid;
|
||||
}
|
||||
|
||||
public void setPeriod(int period) {
|
||||
this.period = period;
|
||||
}
|
||||
|
||||
public int getPeriod() {
|
||||
return period;
|
||||
}
|
||||
|
||||
public void setSiteid(String siteid) {
|
||||
this.siteid = siteid;
|
||||
}
|
||||
|
||||
public String getSiteid() {
|
||||
return siteid;
|
||||
}
|
||||
|
||||
public void setStationid(String stationid) {
|
||||
this.stationid = stationid;
|
||||
}
|
||||
|
||||
public String getStationid() {
|
||||
return stationid;
|
||||
}
|
||||
|
||||
public void setFcstid(int fcstid) {
|
||||
this.fcstid = fcstid;
|
||||
}
|
||||
|
||||
public int getFcstid() {
|
||||
return fcstid;
|
||||
}
|
||||
|
||||
public Date getNextVftTime() {
|
||||
return nextVftTime;
|
||||
}
|
||||
|
||||
}
|
|
@ -57,6 +57,9 @@ public class NsharpDataPageProperty implements ISerializableObject{
|
|||
@XmlAttribute
|
||||
private int severePotentialPage=NsharpConstants.PAGE_SEVERE_POTENTIAL;
|
||||
|
||||
@XmlAttribute
|
||||
private int numberPagePerDisplay = 1;
|
||||
|
||||
public int getSummary1Page() {
|
||||
return summary1Page;
|
||||
}
|
||||
|
@ -137,4 +140,12 @@ public class NsharpDataPageProperty implements ISerializableObject{
|
|||
this.severePotentialPage = severePotentialPage;
|
||||
}
|
||||
|
||||
public int getNumberPagePerDisplay() {
|
||||
return numberPagePerDisplay;
|
||||
}
|
||||
|
||||
public void setNumberPagePerDisplay(int numberPagePerDisplay) {
|
||||
this.numberPagePerDisplay = numberPagePerDisplay;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1706,7 +1706,7 @@ public class NsharpEditor extends AbstractEditor implements AddListener,
|
|||
//System.out.println("After resizing...nsharpComp[1] w= " + nsharpComp[1].getBounds().width + " h= "+ nsharpComp[1].getBounds().height);
|
||||
|
||||
for(int i=0; i< DISPLAY_TOTAL; i++){
|
||||
if(displayArray[i]!=null){
|
||||
if(displayArray[i]!=null && displayArray[i].getDescriptor().getResourceList().isEmpty()== false){
|
||||
ResourcePair rscPair = displayArray[i].getDescriptor().getResourceList().get(0);
|
||||
if (rscPair.getResource() instanceof NsharpAbstractPaneResource){
|
||||
NsharpAbstractPaneResource paneRsc = (NsharpAbstractPaneResource)rscPair.getResource() ;
|
||||
|
|
|
@ -124,7 +124,8 @@ public class NsharpAbstractPaneResource extends AbstractVizResource<AbstractReso
|
|||
protected void paintInternal(IGraphicsTarget target,
|
||||
PaintProperties paintProps) throws VizException {
|
||||
this.paintProps = paintProps;
|
||||
if(rscHandler== null)
|
||||
this.target = target;
|
||||
if(rscHandler== null || rscHandler.getSoundingLys()==null)
|
||||
return;
|
||||
float zoomLevel = paintProps.getZoomLevel();
|
||||
/*if( currentCanvasBoundWidth!= paintProps.getCanvasBounds().width || currentCanvasBoundHeight!=paintProps.getCanvasBounds().height){
|
||||
|
@ -311,6 +312,8 @@ public class NsharpAbstractPaneResource extends AbstractVizResource<AbstractReso
|
|||
|
||||
}
|
||||
protected void defineCharHeight(IFont font){
|
||||
if(paintProps == null)
|
||||
return;
|
||||
DrawableString str =new DrawableString("CHINCHEN",NsharpConstants.color_black);
|
||||
str.font = font;
|
||||
double vertRatio = paintProps.getView().getExtent().getHeight() / paintProps.getCanvasBounds().height;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -86,7 +86,7 @@ public class NsharpResourceHandler {
|
|||
private NsharpAbstractPaneResource futurePaneRsc;
|
||||
//private Coordinate hodoStmCenter; //hodo storm motion center
|
||||
NsharpNative nsharpNative=null;
|
||||
private static final int DATAPAGEMAX = NsharpConstants.PAGE_MAX_NUMBER/ 2;
|
||||
private int displayDataPageMax;
|
||||
private static final int INSETPAGEMAX =2;
|
||||
private int currentTextChapter= 1;
|
||||
private int currentInsetPage= 1;
|
||||
|
@ -266,7 +266,7 @@ public class NsharpResourceHandler {
|
|||
|
||||
|
||||
public void setNextTextChapter(){
|
||||
if(currentTextChapter == DATAPAGEMAX){
|
||||
if(currentTextChapter == displayDataPageMax){
|
||||
currentTextChapter = 1;
|
||||
}
|
||||
else
|
||||
|
@ -431,14 +431,6 @@ public class NsharpResourceHandler {
|
|||
this.soundingType = soundingType;
|
||||
}
|
||||
|
||||
/*public static NsharpSkewTResource createSkewtResource() {
|
||||
LoadProperties loadProperties1 = new LoadProperties();
|
||||
ColorableCapability colorable1 = new ColorableCapability();
|
||||
colorable1.setColor(NsharpConstants.backgroundColor);
|
||||
loadProperties1.getCapabilities().addCapability(colorable1);
|
||||
return new NsharpSkewTResource(new NsharpSkewTResourceData(),
|
||||
loadProperties1);
|
||||
}*/
|
||||
|
||||
public List<List<NcSoundingLayer>> getSoundingLysList() {
|
||||
return soundingLysList;
|
||||
|
@ -447,7 +439,7 @@ public class NsharpResourceHandler {
|
|||
public void setCurrentParcel(short currentParcel) {
|
||||
this.currentParcel = currentParcel;
|
||||
currentParcelLayerPressure=NsharpNativeConstants.parcelToLayerMap.get(currentParcel);
|
||||
//inform draw panel as well
|
||||
//inform data/skewT panel as well
|
||||
if(dataPaneRsc!=null){
|
||||
dataPaneRsc.setCurrentParcel(currentParcel);
|
||||
}
|
||||
|
@ -455,64 +447,20 @@ public class NsharpResourceHandler {
|
|||
if(currentParcel == NsharpNativeConstants.PARCELTYPE_USER_DEFINED)
|
||||
currentParcelLayerPressure = NsharpParcelDialog.getUserDefdParcelMb();
|
||||
skewtPaneRsc.createRscParcelTraceShapes(currentParcel,currentParcelLayerPressure);
|
||||
skewtPaneRsc.createRscParcelRtTraceShapesList(currentParcel,currentParcelLayerPressure);
|
||||
skewtPaneRsc.createLCLEtcLinesShape();
|
||||
}
|
||||
}
|
||||
public void setCurrentParcelData(short currentParcel, float pressure) {
|
||||
this.currentParcel = currentParcel;
|
||||
currentParcelLayerPressure=pressure;
|
||||
//inform draw panel as well
|
||||
if(dataPaneRsc!=null){
|
||||
dataPaneRsc.setCurrentParcel(currentParcel);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* NOTE:::ONly one parcel will be in parcel list as current design changed to only show one configured parcel
|
||||
* This is how BigNsharp does.
|
||||
* Todo: replace List<ParcelData> with just one ParcelData
|
||||
*/
|
||||
/*public void setParcelList(List<ParcelData> parcelList) {
|
||||
this.parcelList = parcelList;
|
||||
if(skewtPaneRsc!=null)
|
||||
skewtPaneRsc.createParcelShapes(parcelList);
|
||||
}*/
|
||||
|
||||
public void updateParcelFromPanel(short currentParcel){
|
||||
this.currentParcel = currentParcel;
|
||||
currentParcelLayerPressure=NsharpNativeConstants.parcelToLayerMap.get(currentParcel);
|
||||
if(skewtPaneRsc!=null){
|
||||
skewtPaneRsc.createRscParcelTraceShapes(currentParcel,currentParcelLayerPressure);
|
||||
skewtPaneRsc.createRscParcelRtTraceShapesList(currentParcel,currentParcelLayerPressure);
|
||||
skewtPaneRsc.createLCLEtcLinesShape();
|
||||
}
|
||||
//update parcel shape
|
||||
/*List<ParcelData> parcelList = new ArrayList<ParcelData>();
|
||||
ParcelData pd= new ParcelData();
|
||||
pd.setParcelType(currentParcel);
|
||||
pd.setParcelLayerPressure(currentParcelLayerPressure);
|
||||
parcelList.add(pd);
|
||||
setParcelList(parcelList);*/
|
||||
}
|
||||
/*
|
||||
* NOTE:::when called, it assumed that this new element is current parcel. Therefore caller has to make sure of this.
|
||||
*
|
||||
public void addParcelToList(ParcelData parceldata) {
|
||||
boolean addToList = true;
|
||||
for(ParcelData pdata : parcelList){
|
||||
if((pdata.parcelType == parceldata.parcelType) && (pdata.parcelLayerPressure == parceldata.parcelLayerPressure)){
|
||||
addToList= false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(addToList== true)
|
||||
this.parcelList.add(parceldata);
|
||||
|
||||
currentParcel = parceldata.getParcelType();
|
||||
currentParcelLayerPressure = parceldata.getParcelLayerPressure();
|
||||
NsharpBackgroundResource bkRsc = descriptor.getSkewTBkGResource();
|
||||
WGraphics WGc = bkRsc.getSkewTBackground().getWorld();
|
||||
createRscParcelTraceShape( WGc, parceldata.parcelType,parceldata.parcelLayerPressure);
|
||||
|
||||
}*/
|
||||
|
||||
|
||||
public void setSoundingLysList(List<List<NcSoundingLayer>> soundingLysList) {
|
||||
this.soundingLysList = soundingLysList;
|
||||
|
@ -689,10 +637,13 @@ public class NsharpResourceHandler {
|
|||
if(NsharpParcelDialog.getAccess()!=null){
|
||||
NsharpParcelDialog.getAccess().resetUserDefParcel();
|
||||
}
|
||||
/* TBD
|
||||
//reset draw panel as well
|
||||
if(drawPanel!=null){
|
||||
drawPanel.resetCurrentParcel();
|
||||
/* Chin:::
|
||||
* This api is called in may scenarios.
|
||||
* User may want to keep his previous picked parcel type.
|
||||
* Therefore, thdataPaneRsc.resetCurrentParcel should be called from
|
||||
* other area that really meant to reset parcel type.
|
||||
if(dataPaneRsc!=null){
|
||||
dataPaneRsc.resetCurrentParcel();
|
||||
}*/
|
||||
}
|
||||
//Chin: TBD remove handle resize here to fix sizing issue when swapped nsharp from side pane back to main pane
|
||||
|
@ -1518,6 +1469,31 @@ public class NsharpResourceHandler {
|
|||
}
|
||||
}
|
||||
public void addRsc(Map<String, List<NcSoundingLayer>> soundMap, NsharpStationInfo stnInfo, boolean displayNewData){
|
||||
/* testing code
|
||||
stnInfo.setStnId("KG RI");
|
||||
{
|
||||
Set<String> keyset= new HashSet<String>(soundMap.keySet());
|
||||
for(String key: keyset) {
|
||||
List<NcSoundingLayer> sndLy = soundMap.remove(key);
|
||||
String newkey= key.replace("KGRI", "KG RI");
|
||||
soundMap.put(newkey, sndLy);
|
||||
}
|
||||
}*/
|
||||
if(stnInfo.getStnId() != null && stnInfo.getStnId().indexOf(" ")>=0){
|
||||
//take care stnId with SPACE case.
|
||||
String stnId= stnInfo.getStnId();
|
||||
String newStnId = stnId.replace(" ", "_");
|
||||
stnInfo.setStnId(newStnId);
|
||||
String dspInfo= stnInfo.getStnDisplayInfo();
|
||||
stnInfo.setStnDisplayInfo(dspInfo.replace(stnId, newStnId));
|
||||
Set<String> keyset= new HashSet<String>(soundMap.keySet());
|
||||
for(String key: keyset) {
|
||||
List<NcSoundingLayer> sndLy = soundMap.remove(key);
|
||||
String newkey= key.replace(stnId, newStnId);
|
||||
soundMap.put(newkey, sndLy);
|
||||
}
|
||||
|
||||
}
|
||||
deepCopyDataMap(this.originalDataTimelineSndLysListMap,this.dataTimelineSndLysListMap);
|
||||
//make sure not adding duplicated sounding data
|
||||
//System.out.println("NsharpSkewTResource addRsc called");
|
||||
|
@ -1627,6 +1603,7 @@ public class NsharpResourceHandler {
|
|||
|
||||
public void addRsc(Map<String, List<NcSoundingLayer>> soundMap, NsharpStationInfo stnInfo){
|
||||
//by default, display new data
|
||||
//NCP always call from this route.
|
||||
this.addRsc(soundMap, stnInfo,true);
|
||||
return;
|
||||
}
|
||||
|
@ -2177,7 +2154,7 @@ public class NsharpResourceHandler {
|
|||
dataPaneRsc.setLinePropertyMap(linePropertyMap);
|
||||
dataPaneRsc.setGraphConfigProperty(graphConfigProperty);
|
||||
dataPaneRsc.setNsharpNative(nsharpNative);
|
||||
dataPaneRsc.setPageDisplayOrderNumberArray(pageDisplayOrderNumberArray);
|
||||
dataPaneRsc.setPageDisplayOrderNumberArray(pageDisplayOrderNumberArray, dataPageProperty.getNumberPagePerDisplay());
|
||||
}
|
||||
else if (absPaneRsc instanceof NsharpHodoPaneResource){
|
||||
hodoPaneRsc = (NsharpHodoPaneResource)absPaneRsc;
|
||||
|
@ -2249,7 +2226,7 @@ public class NsharpResourceHandler {
|
|||
|
||||
|
||||
public NsharpResourceHandler(IRenderableDisplay[] displayArray, NsharpEditor editor) {
|
||||
//System.out.println("NsharpResourceHandler constructed");
|
||||
System.out.println("NsharpResourceHandler constructed");
|
||||
//myNsharpEditor = editor;
|
||||
this.soundingMap = new HashMap<Date, SoundingParams>();
|
||||
elementColorMap.put(NsharpConstants.State.CURRENT,NsharpConstants.color_green); //green
|
||||
|
@ -2284,6 +2261,7 @@ public class NsharpResourceHandler {
|
|||
dataPageProperty = configStore.getDataPageProperty();
|
||||
updatePageOrderArray();
|
||||
updateDisplay(displayArray,paneConfigurationName);
|
||||
displayDataPageMax = NsharpConstants.PAGE_MAX_NUMBER / dataPageProperty.getNumberPagePerDisplay();
|
||||
//pspLsner = new NsharpPerspectiveListener();
|
||||
//pspLsner.setRscHandler(this);
|
||||
//pspLsner.setMyPerspectiveId(VizPerspectiveListener.getCurrentPerspectiveManager().getPerspectiveId());
|
||||
|
@ -2328,7 +2306,7 @@ public class NsharpResourceHandler {
|
|||
resetData();
|
||||
}
|
||||
public void disposeInternal() {
|
||||
//System.out.println("NsharpSkewTResource disposeInternal called");
|
||||
System.out.println("NsharpResourceHandler disposeInternal called");
|
||||
soundingMap= null;
|
||||
//parcelList= null;
|
||||
listenerList=null;
|
||||
|
@ -3014,7 +2992,7 @@ public class NsharpResourceHandler {
|
|||
this.dataPageProperty = dataPageProperty;
|
||||
updatePageOrderArray();
|
||||
if(dataPaneRsc!=null)
|
||||
dataPaneRsc.setPageDisplayOrderNumberArray(pageDisplayOrderNumberArray);
|
||||
dataPaneRsc.setPageDisplayOrderNumberArray(pageDisplayOrderNumberArray, dataPageProperty.getNumberPagePerDisplay());
|
||||
}
|
||||
|
||||
|
||||
|
@ -3168,6 +3146,11 @@ public class NsharpResourceHandler {
|
|||
}
|
||||
|
||||
|
||||
public NsharpDataPaneResource getDataPaneRsc() {
|
||||
return dataPaneRsc;
|
||||
}
|
||||
|
||||
|
||||
/*public void setCnYOrig(int cnYOrig) {
|
||||
this.cnYOrig = cnYOrig;
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ import gov.noaa.nws.ncep.viz.common.ui.NmapCommon;
|
|||
|
||||
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;
|
||||
|
@ -120,8 +121,9 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
private IShadedShape cloudFMShape = null;
|
||||
private IWireframeShape cloudFMLabelShape = null;
|
||||
private IShadedShape cloudCEShape = null;
|
||||
private IWireframeShape parcelVtTraceRscShape; //Virtual temp Parcel trace
|
||||
private IWireframeShape parcelRtRscShape; //Real temp parcel trace
|
||||
private IWireframeShape parcelVtTraceRscShape; //Virtual temperature Parcel trace
|
||||
//Real temperature parcel trace also considering comparison/overlay, therefore using a list
|
||||
private List<NsharpShapeAndLineProperty> parcelRtShapeList = new ArrayList<NsharpShapeAndLineProperty>();
|
||||
private IWireframeShape dacpeTraceRscShape;
|
||||
private List<NsharpShapeAndLineProperty>pressureTempRscShapeList = new ArrayList<NsharpShapeAndLineProperty>();
|
||||
//ICING wireframe shape
|
||||
|
@ -192,7 +194,7 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
disposeRscWireFrameShapes();
|
||||
titleBoxShape.dispose();
|
||||
pressureTempRscShapeList=null;
|
||||
//parcelTraceRscShapeList = null;
|
||||
parcelRtShapeList = null;
|
||||
super.disposeInternal();
|
||||
}
|
||||
private void plotPressureTempEditPoints(IGraphicsTarget target,
|
||||
|
@ -357,6 +359,8 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
}
|
||||
@SuppressWarnings("deprecation")
|
||||
public void createLCLEtcLinesShape(){
|
||||
if(target==null)
|
||||
return;
|
||||
if(lclShape != null){
|
||||
lclShape.dispose();
|
||||
lclShape = null;
|
||||
|
@ -731,43 +735,119 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
commonLinewidth, LineStyle.DASHED);
|
||||
//System.out.println("In pressure="+ inPressure+ " above P="+aboveLayerPressure+ " below P="+belowLayerPressure);
|
||||
}
|
||||
public static Comparator<NcSoundingLayer> windSpeedComparator() {
|
||||
|
||||
return new Comparator<NcSoundingLayer>() {
|
||||
|
||||
@Override
|
||||
public int compare(NcSoundingLayer layerA, NcSoundingLayer layerB) {
|
||||
int retValue = 0;
|
||||
if (layerA != layerB) {
|
||||
// reverse sort relative to pressure!
|
||||
retValue = Double.compare(layerB.getWindSpeed(), layerA.getWindSpeed());
|
||||
}
|
||||
return retValue;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
enum eleState {
|
||||
RE_MAX_WIND, PICKED, UNPICKED
|
||||
};
|
||||
class windPickedElement {
|
||||
NcSoundingLayer layer;
|
||||
eleState myState;
|
||||
public windPickedElement(NcSoundingLayer layer, eleState myState) {
|
||||
super();
|
||||
this.layer = layer;
|
||||
this.myState = myState;
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
*
|
||||
* Draws Wind barb and wind speed vs height into box
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
private void drawNsharpWindBarb(IGraphicsTarget target, double zoomLevel,
|
||||
WGraphics world, RGB icolor, List<NcSoundingLayer> sndLys, double xPosition, double botPress)throws VizException {
|
||||
if(sndLys.size()< 4)
|
||||
return;
|
||||
ArrayList<List<LineStroke>> windList = new ArrayList<List<LineStroke>>();
|
||||
List<windPickedElement> layerStateList = new ArrayList<windPickedElement>();
|
||||
float lastHeight = -9999;
|
||||
|
||||
//#1: find relative max wind layers. I.e. a layer's wind is stronger than immediate above and below layers
|
||||
NcSoundingLayer curLayer, aboveLayer, belowLayer;
|
||||
for (int i=0; i < sndLys.size(); i++) {
|
||||
curLayer = sndLys.get(i);
|
||||
float spd = curLayer.getWindSpeed();
|
||||
if(spd <0)
|
||||
continue;
|
||||
windPickedElement newEle = new windPickedElement(curLayer, eleState.UNPICKED);
|
||||
layerStateList.add(newEle);
|
||||
if ( i==0 || i== sndLys.size()-1) {
|
||||
continue;
|
||||
}
|
||||
aboveLayer = sndLys.get(i+1);
|
||||
belowLayer = sndLys.get(i-1);
|
||||
if (spd> aboveLayer.getWindSpeed() && spd > belowLayer.getWindSpeed()){
|
||||
newEle.myState = eleState.RE_MAX_WIND;
|
||||
//System.out.println( "layer#"+ i+ " RE_MAX_WIND =" + spd );
|
||||
}
|
||||
}
|
||||
//#2: apply minimum distance rule, i.e no two wind layer closer than the minimum distance, also make sure
|
||||
// relative max wind layer is picked.
|
||||
lastHeight = -9999;
|
||||
windPickedElement lastEle=layerStateList.get(0);
|
||||
for(windPickedElement ele: layerStateList){
|
||||
float pressure = ele.layer.getPressure();
|
||||
float spd = ele.layer.getWindSpeed();
|
||||
if ( pressure < botPress || spd < 0 ) {
|
||||
continue;
|
||||
}
|
||||
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;
|
||||
lastHeight = ele.layer.getGeoHeight();
|
||||
lastEle = ele;
|
||||
continue;
|
||||
}
|
||||
else{
|
||||
ele.myState = eleState.UNPICKED;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(ele.myState.equals(eleState.UNPICKED))
|
||||
ele.myState = eleState.PICKED;
|
||||
lastHeight = ele.layer.getGeoHeight();
|
||||
lastEle = ele;
|
||||
}
|
||||
}
|
||||
double windX = xPosition;
|
||||
float lastHeight = -999;
|
||||
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());
|
||||
for (NcSoundingLayer layer : sndLys) {
|
||||
//plot wind barbs
|
||||
for(windPickedElement ele: layerStateList){
|
||||
|
||||
NcSoundingLayer layer = ele.layer;
|
||||
float pressure = layer.getPressure();
|
||||
float spd = layer.getWindSpeed();
|
||||
float dir = layer.getWindDirection();
|
||||
if ( pressure < botPress || spd < 0 ) {
|
||||
continue;
|
||||
}
|
||||
if(spd > 140)
|
||||
spd = 140;
|
||||
if ((layer.getGeoHeight() - lastHeight) < graphConfigProperty.getWindBarbDistance()*zoomLevel){
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get the vertical ordinate.
|
||||
if(currentGraphMode== NsharpConstants.GRAPH_SKEWT){
|
||||
windY = NsharpWxMath.getSkewTXY(pressure, 0).y;
|
||||
barbScaleFactorx = 0.5*zoomLevel;
|
||||
barbScaleFactorx = 0.6*zoomLevel;
|
||||
barbScaleFactory= zoomLevel;
|
||||
}
|
||||
else if(currentGraphMode== NsharpConstants.GRAPH_ICING ){
|
||||
|
@ -786,6 +866,11 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
else
|
||||
continue;
|
||||
|
||||
if(ele.myState.equals(eleState.UNPICKED)){
|
||||
double[] loc= {world.mapX(windX), world.mapY(windY)};
|
||||
locations.add(loc);
|
||||
continue;
|
||||
}
|
||||
List<LineStroke> barb = WindBarbFactory.getWindGraphics((double) (spd), (double) dir);
|
||||
if (barb != null) {
|
||||
// WindBarbFactory.scaleBarb(barb, zoomLevel*barbScaleFactor);
|
||||
|
@ -796,9 +881,9 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
WindBarbFactory.translateBarb(barb, windX, windY);
|
||||
windList.add(barb);
|
||||
}
|
||||
lastHeight = layer.getGeoHeight();
|
||||
}
|
||||
|
||||
//#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) {
|
||||
|
@ -1225,8 +1310,18 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
target.setupClippingPlane(pe);
|
||||
//plot temp curve, when constructing pressureTempRscShapeList, it already considered
|
||||
// comparison, overlay, etc..so, just draw it.
|
||||
for(NsharpShapeAndLineProperty shapeNColor: pressureTempRscShapeList){
|
||||
target.drawWireframeShape(shapeNColor.getShape(), shapeNColor.getLp().getLineColor(), shapeNColor.getLp().getLineWidth(), shapeNColor.getLp().getLineStyle(),font10);//commonLinewidth*2,commonLineStyle,font10);
|
||||
for(NsharpShapeAndLineProperty shapeNLp: pressureTempRscShapeList){
|
||||
target.drawWireframeShape(shapeNLp.getShape(), shapeNLp.getLp().getLineColor(), shapeNLp.getLp().getLineWidth(), shapeNLp.getLp().getLineStyle(),font10);//commonLinewidth*2,commonLineStyle,font10);
|
||||
}
|
||||
//plot real temp parcel trace, when constructing parcelRtShapeList, it already considered
|
||||
// comparison, overlay, etc..so, just draw it.
|
||||
//color is following comparison/overlay lines' configuration.
|
||||
//line width and line style are following parcel line configuration
|
||||
if(graphConfigProperty.isParcel() == true ){
|
||||
NsharpLineProperty parcelLp =linePropertyMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_PARCEL]);
|
||||
for(NsharpShapeAndLineProperty shapeNLp: parcelRtShapeList){
|
||||
target.drawWireframeShape(shapeNLp.getShape(), shapeNLp.getLp().getLineColor(), parcelLp.getLineWidth(), parcelLp.getLineStyle(),font10);//commonLinewidth*2,commonLineStyle,font10);
|
||||
}
|
||||
}
|
||||
boolean compareStnIsOn = rscHandler.isCompareStnIsOn();
|
||||
boolean compareTmIsOn = rscHandler.isCompareTmIsOn();
|
||||
|
@ -1247,26 +1342,20 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
NsharpLineProperty lp =linePropertyMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_WETBULB]);
|
||||
target.drawWireframeShape(wetBulbTraceRscShape, lp.getLineColor(),lp.getLineWidth(),lp.getLineStyle(),font10);
|
||||
}
|
||||
//plot virtual temp trace
|
||||
//plot virtual temperature trace
|
||||
if(graphConfigProperty.isVTemp() == true && !compareStnIsOn && !compareTmIsOn){
|
||||
NsharpLineProperty lp =linePropertyMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_VIRTUAL_TEMP]);
|
||||
target.drawWireframeShape(vtempTraceCurveRscShape,lp.getLineColor(),lp.getLineWidth(),lp.getLineStyle(),font10);
|
||||
}
|
||||
// parcel trace curve
|
||||
if(graphConfigProperty.isParcelTv() == true && !compareStnIsOn && !compareTmIsOn){
|
||||
// virtual temperature parcel trace curve
|
||||
if(graphConfigProperty.isParcelTv() == true && !compareStnIsOn && !compareTmIsOn && !overlayIsOn){
|
||||
if(soundingLys.size() > 0){
|
||||
NsharpLineProperty lp =linePropertyMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_PARCEL_TV]);
|
||||
target.drawWireframeShape(parcelVtTraceRscShape, lp.getLineColor(),lp.getLineWidth(),lp.getLineStyle(),font10);
|
||||
}
|
||||
}
|
||||
if(graphConfigProperty.isParcel() == true && !compareStnIsOn && !compareTmIsOn){
|
||||
if(soundingLys.size() > 0){
|
||||
NsharpLineProperty lp =linePropertyMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_PARCEL]);
|
||||
target.drawWireframeShape(parcelRtRscShape, lp.getLineColor(),lp.getLineWidth(),lp.getLineStyle(),font10);
|
||||
|
||||
}
|
||||
}
|
||||
if(graphConfigProperty.isDcape() == true && dacpeTraceRscShape != null && !compareStnIsOn && !compareTmIsOn){
|
||||
if(graphConfigProperty.isDcape() == true && dacpeTraceRscShape != null && !compareStnIsOn && !compareTmIsOn && !overlayIsOn){
|
||||
if(soundingLys.size() > 0){
|
||||
NsharpLineProperty lp =linePropertyMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_DCAPE]);
|
||||
target.drawWireframeShape(dacpeTraceRscShape, lp.getLineColor(),lp.getLineWidth(),lp.getLineStyle(),font10);
|
||||
|
@ -1313,15 +1402,15 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
lp =linePropertyMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_VIRTUAL_TEMP]);
|
||||
target.drawWireframeShape(vtempTraceCurveRscShape,lp.getLineColor(),lp.getLineWidth(),lp.getLineStyle(),font10);
|
||||
|
||||
// parcel trace curve
|
||||
//virtual temperature parcel trace curve
|
||||
if(!overlayIsOn){
|
||||
lp =linePropertyMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_PARCEL_TV]);
|
||||
target.drawWireframeShape(parcelVtTraceRscShape, lp.getLineColor(),lp.getLineWidth(),lp.getLineStyle(),font10);
|
||||
lp =linePropertyMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_PARCEL]);
|
||||
target.drawWireframeShape(parcelRtRscShape, lp.getLineColor(),lp.getLineWidth(),lp.getLineStyle(),font10);
|
||||
if(dacpeTraceRscShape != null){
|
||||
lp =linePropertyMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_DCAPE]);
|
||||
target.drawWireframeShape(dacpeTraceRscShape, lp.getLineColor(),lp.getLineWidth(),lp.getLineStyle(),font10);
|
||||
}
|
||||
}
|
||||
//draw effective layer lines
|
||||
//drawEffectiveLayerLines(target);
|
||||
target.drawWireframeShape(effectiveLayerLineShape, NsharpConstants.color_cyan_md, 2,
|
||||
|
@ -1359,6 +1448,41 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
NsharpLineProperty lp =linePropertyMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_WIND_BARB]);
|
||||
drawNsharpWindBarb(target, currentZoomLevel, world, lp.getLineColor()/*NsharpConstants.color_yellow*/, 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());
|
||||
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());
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//System.out.println("x1 pos"+xPos+ " x2 pos="+ (xPos - NsharpResourceHandler.BARB_LENGTH));
|
||||
}
|
||||
|
@ -1454,24 +1578,162 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
}
|
||||
return "";
|
||||
}
|
||||
//Creating real temperature parcel trace shape list - considering normal/comparison/overlay scenarios
|
||||
public void createRscParcelRtTraceShapesList( short parcelType, float userPre){
|
||||
if(target==null)
|
||||
return;
|
||||
if(parcelRtShapeList.size()>0){
|
||||
for(NsharpShapeAndLineProperty shapeColor: parcelRtShapeList){
|
||||
shapeColor.getShape().dispose();
|
||||
}
|
||||
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;
|
||||
IWireframeShape shape = createRTParcelTraceShapes( parcelType, userPre, soundingLayeys);
|
||||
NsharpShapeAndLineProperty shNLp = new NsharpShapeAndLineProperty();
|
||||
shNLp.setShape(shape);
|
||||
shNLp.setLp(lp);
|
||||
parcelRtShapeList.add(shNLp);
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
IWireframeShape shape = createRTParcelTraceShapes( parcelType, userPre, soundingLayeys);
|
||||
NsharpShapeAndLineProperty shNLp = new NsharpShapeAndLineProperty();
|
||||
shNLp.setShape(shape);
|
||||
shNLp.setLp(lp);
|
||||
parcelRtShapeList.add(shNLp);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(rscHandler.isOverlayIsOn() == true ){
|
||||
previousSoundingLys = rscHandler.getPreviousSoundingLys();
|
||||
IWireframeShape shape = createRTParcelTraceShapes( parcelType, userPre, this.soundingLys);
|
||||
NsharpShapeAndLineProperty shNLp = new NsharpShapeAndLineProperty();
|
||||
shNLp.setShape(shape);
|
||||
shNLp.setLp(linePropertyMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_OVERLAY1]));
|
||||
parcelRtShapeList.add(shNLp);
|
||||
if(this.previousSoundingLys!=null && !previousSoundingLys.equals(soundingLys)){
|
||||
shape = createRTParcelTraceShapes( parcelType, userPre, previousSoundingLys);
|
||||
shNLp = new NsharpShapeAndLineProperty();
|
||||
shNLp.setShape(shape);
|
||||
shNLp.setLp(linePropertyMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_OVERLAY2]));
|
||||
parcelRtShapeList.add(shNLp);
|
||||
}
|
||||
}
|
||||
else {
|
||||
IWireframeShape shape = createRTParcelTraceShapes( parcelType, userPre, this.soundingLys);
|
||||
NsharpShapeAndLineProperty shNLp = new NsharpShapeAndLineProperty();
|
||||
shNLp.setShape(shape);
|
||||
shNLp.setLp(linePropertyMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_PARCEL]));
|
||||
parcelRtShapeList.add(shNLp);
|
||||
}
|
||||
}
|
||||
//Creating real temperature parcel trace shape
|
||||
private IWireframeShape createRTParcelTraceShapes( short parcelType, float userPre, List<NcSoundingLayer> soundingLays){
|
||||
IWireframeShape parcelRtShape;
|
||||
parcelRtShape= target.createWireframeShape(false,descriptor );
|
||||
parcelRtShape.allocate(40);
|
||||
//the input soundingLays list may not be current sounding list, therfore need to populate it to
|
||||
//native library.
|
||||
nsharpNative.populateSndgData(soundingLays);
|
||||
//call native define_parcel() with parcel type and user defined pressure (if user defined it)
|
||||
nsharpNative.nsharpLib.define_parcel(parcelType,userPre);
|
||||
|
||||
_lplvalues lpvls = new _lplvalues();
|
||||
nsharpNative.nsharpLib.get_lpvaluesData(lpvls);
|
||||
|
||||
float sfctemp, sfcdwpt, sfcpres;
|
||||
sfctemp = lpvls.temp;
|
||||
sfcdwpt = lpvls.dwpt;
|
||||
sfcpres = lpvls.pres;
|
||||
|
||||
|
||||
FloatByReference p2 = new FloatByReference(0), t2 = new FloatByReference(0);;
|
||||
nsharpNative.nsharpLib.drylift (sfcpres, sfctemp, sfcdwpt, p2, t2);
|
||||
|
||||
|
||||
Coordinate a1 = NsharpWxMath.getSkewTXY(sfcpres, sfctemp);
|
||||
a1.x = world.mapX(a1.x);
|
||||
a1.y = world.mapY(a1.y);
|
||||
Coordinate a2 = NsharpWxMath.getSkewTXY(p2.getValue(), t2.getValue());
|
||||
a2.x = world.mapX(a2.x);
|
||||
a2.y = world.mapY(a2.y);
|
||||
|
||||
double [][] alines = {{a1.x, a1.y},{a2.x, a2.y}};
|
||||
parcelRtShape.addLineSegment(alines);
|
||||
a1 = a2;
|
||||
|
||||
float t3;
|
||||
for (float i = p2.getValue() - 50; i >= 100; i = i - 50)
|
||||
{
|
||||
t3 = nsharpNative.nsharpLib.wetlift (p2.getValue(), t2.getValue(), i);
|
||||
|
||||
|
||||
a2 = NsharpWxMath.getSkewTXY(i, t3);
|
||||
a2.x = world.mapX(a2.x);
|
||||
a2.y = world.mapY(a2.y);
|
||||
double [][] alines1 = {{a1.x, a1.y},{a2.x, a2.y}};
|
||||
parcelRtShape.addLineSegment(alines1);
|
||||
a1 = a2;
|
||||
}
|
||||
|
||||
t3 = nsharpNative.nsharpLib.wetlift (p2.getValue(), t2.getValue(), 100);
|
||||
|
||||
|
||||
a2 = NsharpWxMath.getSkewTXY(100, t3);
|
||||
a2.x = world.mapX(a2.x);
|
||||
a2.y = world.mapY(a2.y);
|
||||
double [][] alines1 = {{a1.x, a1.y},{a2.x, a2.y}};
|
||||
parcelRtShape.addLineSegment(alines1);
|
||||
|
||||
parcelRtShape.compile();
|
||||
|
||||
//re-populate sounding data back to current sounding
|
||||
nsharpNative.populateSndgData(this.soundingLys);
|
||||
return parcelRtShape;
|
||||
}
|
||||
|
||||
//Creating Virtual Temperature parcel and DCAPE trace Shapes
|
||||
public void createRscParcelTraceShapes( short parcelType, float userPre){
|
||||
if(target==null)
|
||||
return;
|
||||
//System.out.println("createRscParcelTraceShape called defoine_parcel pType="+parcelType+" pre="+ userPre+ " BY:"+this.toString());
|
||||
if(parcelVtTraceRscShape != null){
|
||||
parcelVtTraceRscShape.dispose();
|
||||
parcelVtTraceRscShape = null;
|
||||
}
|
||||
if(parcelRtRscShape != null){
|
||||
parcelRtRscShape.dispose();
|
||||
parcelRtRscShape = null;
|
||||
}
|
||||
if(dacpeTraceRscShape != null){
|
||||
dacpeTraceRscShape.dispose();
|
||||
dacpeTraceRscShape = null;
|
||||
}
|
||||
parcelVtTraceRscShape= target.createWireframeShape(false,descriptor );
|
||||
parcelVtTraceRscShape.allocate(40);
|
||||
parcelRtRscShape= target.createWireframeShape(false,descriptor );
|
||||
parcelRtRscShape.allocate(40);
|
||||
dacpeTraceRscShape= target.createWireframeShape(false,descriptor );
|
||||
dacpeTraceRscShape.allocate(40);
|
||||
//call native define_parcel() with parcel type and user defined pressure (if user defined it)
|
||||
|
@ -1500,17 +1762,6 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
parcelVtTraceRscShape.addLineSegment(lines);
|
||||
c1 = c2;
|
||||
|
||||
Coordinate a1 = NsharpWxMath.getSkewTXY(sfcpres, sfctemp);
|
||||
a1.x = world.mapX(a1.x);
|
||||
a1.y = world.mapY(a1.y);
|
||||
Coordinate a2 = NsharpWxMath.getSkewTXY(p2.getValue(), t2.getValue());
|
||||
a2.x = world.mapX(a2.x);
|
||||
a2.y = world.mapY(a2.y);
|
||||
|
||||
double [][] alines = {{a1.x, a1.y},{a2.x, a2.y}};
|
||||
parcelRtRscShape.addLineSegment(alines);
|
||||
a1 = a2;
|
||||
|
||||
float t3;
|
||||
for (float i = p2.getValue() - 50; i >= 100; i = i - 50)
|
||||
{
|
||||
|
@ -1524,12 +1775,6 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
parcelVtTraceRscShape.addLineSegment(lines1);
|
||||
c1 = c2;
|
||||
|
||||
a2 = NsharpWxMath.getSkewTXY(i, t3);
|
||||
a2.x = world.mapX(a2.x);
|
||||
a2.y = world.mapY(a2.y);
|
||||
double [][] alines1 = {{a1.x, a1.y},{a2.x, a2.y}};
|
||||
parcelRtRscShape.addLineSegment(alines1);
|
||||
a1 = a2;
|
||||
}
|
||||
|
||||
t3 = nsharpNative.nsharpLib.wetlift (p2.getValue(), t2.getValue(), 100);
|
||||
|
@ -1541,13 +1786,6 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
double [][] lines2 = {{c1.x, c1.y},{c2.x, c2.y}};
|
||||
parcelVtTraceRscShape.addLineSegment(lines2);
|
||||
|
||||
a2 = NsharpWxMath.getSkewTXY(100, t3);
|
||||
a2.x = world.mapX(a2.x);
|
||||
a2.y = world.mapY(a2.y);
|
||||
double [][] alines1 = {{a1.x, a1.y},{a2.x, a2.y}};
|
||||
parcelRtRscShape.addLineSegment(alines1);
|
||||
|
||||
parcelRtRscShape.compile();
|
||||
parcelVtTraceRscShape.compile();
|
||||
|
||||
//DCAPE------------------
|
||||
|
@ -1643,22 +1881,6 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
|
||||
dacpeTraceRscShape.compile();
|
||||
}
|
||||
/*public void createParcelShapes(List<ParcelData> parcelList) {
|
||||
|
||||
if(parcelTraceRscShapeList.size()>0){
|
||||
for(IWireframeShape shape: parcelTraceRscShapeList){
|
||||
shape.dispose();
|
||||
}
|
||||
parcelTraceRscShapeList.clear();
|
||||
}
|
||||
|
||||
|
||||
for (ParcelData parData: parcelList){
|
||||
createRscParcelTraceShape( parData.parcelType,parData.parcelLayerPressure);
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
// Chin: to handle dynamically moving height mark within viewable zone when zooming, I could not use wireframeShape successfully
|
||||
// It will chop off lower part of marks. Therefore use this draw function.
|
||||
@SuppressWarnings("deprecation")
|
||||
|
@ -2337,11 +2559,8 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
createRscwetBulbTraceShape();
|
||||
createRscPressTempCurveShapeAll(target);
|
||||
createRscVTempTraceShape();
|
||||
/*List<ParcelData> parcelList = rscHandler.getParcelList();
|
||||
for (ParcelData parData: parcelList){
|
||||
createRscParcelTraceShape( parData.parcelType,parData.parcelLayerPressure);
|
||||
}*/
|
||||
createRscParcelTraceShapes(rscHandler.getCurrentParcel(),rscHandler.getCurrentParcelLayerPressure());
|
||||
createRscParcelRtTraceShapesList(rscHandler.getCurrentParcel(),rscHandler.getCurrentParcelLayerPressure());//real temp trace
|
||||
createRscParcelTraceShapes(rscHandler.getCurrentParcel(),rscHandler.getCurrentParcelLayerPressure()); //Virtual Temp Trace and DCAPE trace
|
||||
createLCLEtcLinesShape();
|
||||
createEffectiveLayerLinesShape();
|
||||
createCloudsShape();
|
||||
|
@ -2403,21 +2622,16 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
turbLnShape.dispose();
|
||||
turbLnShape=null;
|
||||
}
|
||||
/*if(parcelTraceRscShapeList.size()>0){
|
||||
for(IWireframeShape shape: parcelTraceRscShapeList){
|
||||
shape.dispose();
|
||||
if(parcelRtShapeList.size()>0){
|
||||
for(NsharpShapeAndLineProperty shapeColor: parcelRtShapeList){
|
||||
shapeColor.getShape().dispose();
|
||||
}
|
||||
parcelRtShapeList.clear();
|
||||
}
|
||||
parcelTraceRscShapeList.clear();
|
||||
|
||||
}*/
|
||||
if(parcelVtTraceRscShape != null){
|
||||
parcelVtTraceRscShape.dispose();
|
||||
parcelVtTraceRscShape = null;
|
||||
}
|
||||
if(parcelRtRscShape != null){
|
||||
parcelRtRscShape.dispose();
|
||||
parcelRtRscShape = null;
|
||||
}
|
||||
if(dacpeTraceRscShape != null){
|
||||
dacpeTraceRscShape.dispose();
|
||||
dacpeTraceRscShape = null;
|
||||
|
|
|
@ -975,7 +975,7 @@ public class NsharpSpcGraphsPaneResource extends NsharpAbstractPaneResource{
|
|||
_parcel pcl = new _parcel();;
|
||||
_lplvalues lpvls = new _lplvalues();
|
||||
nsharpNative.nsharpLib.get_lpvaluesData(lpvls);
|
||||
oldlplchoice = lpvls.flag;
|
||||
//oldlplchoice = lpvls.flag;
|
||||
//lift ML parcel
|
||||
nsharpNative.nsharpLib.define_parcel(NsharpNativeConstants.PARCELTYPE_MEAN_MIXING, NsharpNativeConstants.MML_LAYER);
|
||||
float sfctemp, sfcdwpt, sfcpres;
|
||||
|
@ -1079,7 +1079,7 @@ public class NsharpSpcGraphsPaneResource extends NsharpAbstractPaneResource{
|
|||
valueLCL.verticallAlignment = VerticalAlignment.TOP;
|
||||
valueLCL.setCoordinates(tboxValueStart, ypos);
|
||||
strList.add(valueLCL);
|
||||
|
||||
oldlplchoice = rscHandler.getCurrentParcel();
|
||||
float pres = NsharpNativeConstants.parcelToLayerMap.get(oldlplchoice);
|
||||
nsharpNative.nsharpLib.define_parcel(oldlplchoice,pres);
|
||||
//Calculates and plots the probability of an F2+ tornado
|
||||
|
@ -1154,8 +1154,8 @@ public class NsharpSpcGraphsPaneResource extends NsharpAbstractPaneResource{
|
|||
// (given a supercell) based on effective bulk shear alone.
|
||||
// Probabilities are derived from Thompson et al. 2005 RUC soundings
|
||||
// based on prob_sigt_eshear() of xwvid3.c
|
||||
nsharpNative.nsharpLib.get_lpvaluesData(lpvls);
|
||||
oldlplchoice = lpvls.flag;
|
||||
//nsharpNative.nsharpLib.get_lpvaluesData(lpvls);
|
||||
//oldlplchoice = lpvls.flag;
|
||||
//lift MU parcel
|
||||
nsharpNative.nsharpLib.define_parcel(NsharpNativeConstants.PARCELTYPE_MOST_UNSTABLE, NsharpNativeConstants.MU_LAYER);
|
||||
|
||||
|
@ -1459,7 +1459,7 @@ public class NsharpSpcGraphsPaneResource extends NsharpAbstractPaneResource{
|
|||
_parcel pcl = new _parcel();;
|
||||
_lplvalues lpvls = new _lplvalues();
|
||||
nsharpNative.nsharpLib.get_lpvaluesData(lpvls);
|
||||
oldlplchoice = lpvls.flag;
|
||||
//oldlplchoice = lpvls.flag;
|
||||
|
||||
nsharpNative.nsharpLib.define_parcel(NsharpNativeConstants.PARCELTYPE_MOST_UNSTABLE,400f);
|
||||
|
||||
|
@ -1512,6 +1512,7 @@ public class NsharpSpcGraphsPaneResource extends NsharpAbstractPaneResource{
|
|||
pres = NsharpNativeConstants.parcelToLayerMap.get(oldlplchoice);
|
||||
}
|
||||
else*/
|
||||
oldlplchoice = rscHandler.getCurrentParcel();
|
||||
pres = NsharpNativeConstants.parcelToLayerMap.get(oldlplchoice);
|
||||
nsharpNative.nsharpLib.define_parcel(oldlplchoice,pres);
|
||||
target.drawStrings(strList.toArray(new DrawableString[strList.size()])); // x-axis mark number
|
||||
|
@ -1522,7 +1523,7 @@ public class NsharpSpcGraphsPaneResource extends NsharpAbstractPaneResource{
|
|||
PaintProperties paintProps) throws VizException {
|
||||
super.paintInternal(target, paintProps);
|
||||
//defineCharHeight(font10);
|
||||
if(rscHandler== null)
|
||||
if(rscHandler== null || rscHandler.getSoundingLys()==null)
|
||||
return;
|
||||
this.font10.setSmoothing(false);
|
||||
this.font10.setScaleFont(false);
|
||||
|
|
|
@ -249,7 +249,7 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
|
|||
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 ="Cp "+ compIndex;
|
||||
s =""+ compIndex;
|
||||
x=x+ strBD.getWidth()*hRatio+5;
|
||||
target.drawString(font10,s, x,
|
||||
ly, 0.0,
|
||||
|
@ -382,7 +382,7 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
|
|||
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 ="Cp "+ compIndex;
|
||||
s =""+ compIndex;
|
||||
x=x+ strBD.getWidth()*hRatio+5;
|
||||
target.drawString(font10,s, x,
|
||||
ly, 0.0,
|
||||
|
|
|
@ -272,7 +272,9 @@ public class ModelSoundingDialogContents {
|
|||
//System.out.println(lat+";"+lon+" "+timeLine);
|
||||
}
|
||||
else{
|
||||
soundingLysLstMap.put(stnStr+" "+timeLine, rtnSndLst);
|
||||
// replaced space to _ in stnStr.
|
||||
String stnStrPacked = stnStr.replace(" ", "_");
|
||||
soundingLysLstMap.put(stnStrPacked+" "+timeLine, rtnSndLst);
|
||||
//System.out.println(stnStr+" "+timeLine);
|
||||
}
|
||||
continue;
|
||||
|
@ -318,6 +320,7 @@ public class ModelSoundingDialogContents {
|
|||
stnInfo.setSndType(selectedModel);
|
||||
stnInfo.setLatitude(lat);
|
||||
stnInfo.setLongitude(lon);
|
||||
stnInfo.setStnId(stnStr);
|
||||
skewRsc.addRsc(soundingLysLstMap, stnInfo);
|
||||
skewRsc.setSoundingType(selectedModel);
|
||||
NsharpEditor.bringEditorToTop();
|
||||
|
|
|
@ -191,7 +191,7 @@ public class NsharpConfigDialog extends Dialog {
|
|||
} );
|
||||
|
||||
paneCfgBtn = new Button(parent, SWT.PUSH);
|
||||
paneCfgBtn.setText("Diaplay Pane Configuration");
|
||||
paneCfgBtn.setText("Display Pane Configuration");
|
||||
paneCfgBtn.setEnabled( true );
|
||||
//lineBtn.setSize(btnWidth,pushbtnHeight);
|
||||
paneCfgBtn.addListener( SWT.MouseUp, new Listener() {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package gov.noaa.nws.ncep.ui.nsharp.view;
|
||||
|
||||
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingProfile;
|
||||
import gov.noaa.nws.ncep.ui.nsharp.NsharpConfigManager;
|
||||
import gov.noaa.nws.ncep.ui.nsharp.NsharpConfigStore;
|
||||
import gov.noaa.nws.ncep.ui.nsharp.NsharpConstants;
|
||||
|
@ -38,6 +39,8 @@ public class NsharpDataPageConfigDialog extends Dialog {
|
|||
private int lblWidth = 200;
|
||||
private int lblHeight = 20;
|
||||
private int textWidth = 80;
|
||||
|
||||
private int numberPagePerDisplay = 2;
|
||||
private Label curLbl;
|
||||
private Text newText;
|
||||
private Text[] newOrderTextArray= new Text[NsharpConstants.PAGE_MAX_NUMBER+1];//element 0 is dummy one
|
||||
|
@ -65,6 +68,7 @@ public class NsharpDataPageConfigDialog extends Dialog {
|
|||
pageOrderNumberArray[NsharpConstants.PAGE_CONVECTIVE_INITIATION ] = dpp.getConvectiveInitiationPage();
|
||||
pageOrderNumberArray[NsharpConstants.PAGE_SEVERE_POTENTIAL ] = dpp.getSeverePotentialPage();
|
||||
editingOrderNumberArray = pageOrderNumberArray.clone();
|
||||
numberPagePerDisplay = dpp.getNumberPagePerDisplay();
|
||||
mb = new MessageBox(parentShell, SWT.ICON_WARNING
|
||||
| SWT.OK );
|
||||
|
||||
|
@ -77,7 +81,7 @@ public class NsharpDataPageConfigDialog extends Dialog {
|
|||
@Override
|
||||
protected void configureShell( Shell shell ) {
|
||||
super.configureShell( shell );
|
||||
shell.setText( "Data Page Display Order Configuration" );
|
||||
shell.setText( "Data Page Display Configuration" );
|
||||
|
||||
}
|
||||
@Override
|
||||
|
@ -119,6 +123,7 @@ public class NsharpDataPageConfigDialog extends Dialog {
|
|||
dpp.setMeanWindPage(pageOrderNumberArray[NsharpConstants.PAGE_MEAN_WIND ] );
|
||||
dpp.setConvectiveInitiationPage(pageOrderNumberArray[NsharpConstants.PAGE_CONVECTIVE_INITIATION ] );
|
||||
dpp.setSeverePotentialPage(pageOrderNumberArray[NsharpConstants.PAGE_SEVERE_POTENTIAL ] );
|
||||
dpp.setNumberPagePerDisplay(numberPagePerDisplay);
|
||||
try {
|
||||
//save to xml
|
||||
mgr.saveConfigStoreToFs(configStore);
|
||||
|
@ -190,6 +195,7 @@ public class NsharpDataPageConfigDialog extends Dialog {
|
|||
editingDpp.setMeanWindPage(pageOrderNumberArray[NsharpConstants.PAGE_MEAN_WIND ] );
|
||||
editingDpp.setConvectiveInitiationPage(pageOrderNumberArray[NsharpConstants.PAGE_CONVECTIVE_INITIATION ] );
|
||||
editingDpp.setSeverePotentialPage(pageOrderNumberArray[NsharpConstants.PAGE_SEVERE_POTENTIAL ] );
|
||||
editingDpp.setNumberPagePerDisplay(numberPagePerDisplay);
|
||||
rsc.setDataPageProperty(editingDpp);
|
||||
editor.refresh();
|
||||
}
|
||||
|
@ -231,6 +237,37 @@ public class NsharpDataPageConfigDialog extends Dialog {
|
|||
mainLayout.marginHeight = 3;
|
||||
mainLayout.marginWidth = 3;
|
||||
top.setLayout(mainLayout);
|
||||
|
||||
Group btnGp = new Group(top, SWT.SHADOW_ETCHED_IN);
|
||||
btnGp.setText("number of page per display");
|
||||
//.setFont(newFont);
|
||||
Button oneBtn = new Button(btnGp, SWT.RADIO | SWT.BORDER);
|
||||
oneBtn.setText("1");
|
||||
oneBtn.setEnabled( true );
|
||||
oneBtn.setBounds(btnGp.getBounds().x+ NsharpConstants.btnGapX, btnGp.getBounds().y + NsharpConstants.labelGap, NsharpConstants.btnWidth,NsharpConstants.btnHeight);
|
||||
//oneBtn.setFont(newFont);
|
||||
oneBtn.addListener( SWT.MouseUp, new Listener() {
|
||||
public void handleEvent(Event event) {
|
||||
numberPagePerDisplay=1;
|
||||
//System.out.println("new obvSnd dialog uair btn");
|
||||
}
|
||||
} );
|
||||
|
||||
|
||||
Button twoBtn = new Button(btnGp, SWT.RADIO | SWT.BORDER);
|
||||
twoBtn.setText("2");
|
||||
twoBtn.setEnabled( true );
|
||||
twoBtn.setBounds(btnGp.getBounds().x+ NsharpConstants.btnGapX, oneBtn.getBounds().y + oneBtn.getBounds().height+ NsharpConstants.btnGapY, NsharpConstants.btnWidth,NsharpConstants.btnHeight);
|
||||
//twoBtn.setFont(newFont);
|
||||
twoBtn.addListener( SWT.MouseUp, new Listener() {
|
||||
public void handleEvent(Event event) {
|
||||
numberPagePerDisplay=2;
|
||||
}
|
||||
} );
|
||||
if(numberPagePerDisplay==1)
|
||||
oneBtn.setSelection(true);
|
||||
else
|
||||
twoBtn.setSelection(true);
|
||||
Group configGp = new Group(top, SWT.SHADOW_ETCHED_IN | SWT.NO_RADIO_GROUP);
|
||||
Label nameLbl = new Label(configGp, SWT.BORDER );
|
||||
nameLbl.setText(" Page Name");
|
||||
|
|
|
@ -43,9 +43,9 @@ import org.eclipse.swt.widgets.Shell;
|
|||
|
||||
public class NsharpHandleArchiveFile {
|
||||
public static void openArchiveFile(Shell shell){
|
||||
/*
|
||||
/* Chin: 3/14/2013
|
||||
* A typical saved file contents is as following....
|
||||
* PFC NAMSND KSWF 2010-12-12 11:00:00 LAT=41.52 LON=-74.19
|
||||
* SNDTYPE=MDL TITLE=KMFR 130131/1200 NCUAIR STNID=KMFR LAT=42.38 LON=-122.87
|
||||
* PRESSURE HGHT TEMP DWPT WDIR WSPD OMEG
|
||||
* 997.500000 129.000000 -3.250006 -3.381190 10.619656 1.627882 0.000000
|
||||
* ........
|
||||
|
@ -66,8 +66,8 @@ public class NsharpHandleArchiveFile {
|
|||
if(selecteds!= null && selecteds.length > 0){
|
||||
Map<String, List<NcSoundingLayer>> soundingLysLstMap = new HashMap<String, List<NcSoundingLayer>>();
|
||||
//List<String> timeList = new ArrayList<String>();
|
||||
String timeLine ;
|
||||
String stnDispInfoStr;
|
||||
//String timeLine ;
|
||||
String stnDispInfoStr="N/A N/A";
|
||||
//read in archive file
|
||||
InputStream is = null;
|
||||
NsharpStationInfo stninfo = new NsharpStationInfo();
|
||||
|
@ -89,23 +89,65 @@ public class NsharpHandleArchiveFile {
|
|||
strContent.append((char)byteread);
|
||||
//System.out.println((char)byteread);
|
||||
}
|
||||
if(strContent.length() <=100)
|
||||
return;
|
||||
//System.out.println(strContent);
|
||||
|
||||
//hash map, use stn display info as key
|
||||
//Chin-T Map<String, List<SoundingLayer>> soundingLysLstMap = new HashMap<String, List<SoundingLayer>>();
|
||||
timeLine = new String("");
|
||||
stnDispInfoStr = new String("");
|
||||
int lat = strContent.indexOf("LAT=");
|
||||
if(lat > 0 )
|
||||
{
|
||||
lat = lat+4;
|
||||
int endIndex = strContent.substring(lat).indexOf(";");
|
||||
if(endIndex>0){
|
||||
String latStr= strContent.substring(lat,lat+endIndex);
|
||||
stninfo.setLatitude(Float.parseFloat(latStr));
|
||||
}
|
||||
}
|
||||
int lon = strContent.indexOf("LON=");
|
||||
if(lon > 0 )
|
||||
{
|
||||
lon = lon+4;
|
||||
int endIndex = strContent.substring(lon).indexOf(";");
|
||||
if(endIndex>0){
|
||||
String lonStr= strContent.substring(lon,lon+endIndex);
|
||||
stninfo.setLongitude(Float.parseFloat(lonStr));
|
||||
}
|
||||
}
|
||||
int snd = strContent.indexOf("SNDTYPE=");
|
||||
if(snd > 0 )
|
||||
{
|
||||
snd = snd+8;
|
||||
int endIndex = strContent.substring(snd).indexOf(";");
|
||||
if(endIndex>0){
|
||||
String sndStr= strContent.substring(snd,snd+endIndex);
|
||||
stninfo.setSndType(sndStr);
|
||||
if(NsharpLoadDialog.getAccess()!= null ){
|
||||
if(sndStr.equals("PFC"))
|
||||
NsharpLoadDialog.getAccess().setActiveLoadSoundingType(NsharpLoadDialog.PFC_SND);
|
||||
else if(sndStr.equals("MDL"))
|
||||
NsharpLoadDialog.getAccess().setActiveLoadSoundingType(NsharpLoadDialog.MODEL_SND);
|
||||
else if(sndStr.equals("OBS"))
|
||||
NsharpLoadDialog.getAccess().setActiveLoadSoundingType(NsharpLoadDialog.OBSER_SND);
|
||||
}
|
||||
}
|
||||
}
|
||||
int title = strContent.indexOf("TITLE=");
|
||||
if(title > 0 )
|
||||
{
|
||||
title = title+6;
|
||||
int endIndex = strContent.substring(title).indexOf(";");
|
||||
if(endIndex>0){
|
||||
String titleStr= strContent.substring(title,title+endIndex);
|
||||
stninfo.setStnDisplayInfo(titleStr);
|
||||
stnDispInfoStr = titleStr;
|
||||
}
|
||||
}
|
||||
//timeLine = new String("");
|
||||
//stnDispInfoStr = new String("");
|
||||
List<NcSoundingLayer> sndLyList = new ArrayList<NcSoundingLayer>();
|
||||
NcSoundingLayer sndLy = null;
|
||||
StringTokenizer st = new StringTokenizer(strContent.toString());
|
||||
int i =0;
|
||||
int loadSndTypeIndex = 1;
|
||||
int sndTypeIndex = 2;
|
||||
int dataStartIndex = 15;
|
||||
int stnInfoIndexEnd = 5;
|
||||
int stnLatIndex = 6;
|
||||
int stnLonIndex = 7;
|
||||
int latlonTokenHdrLength = 4; // either "LAT=" or "LON="
|
||||
int dataCycleLength = 7;
|
||||
while (st.hasMoreTokens()) {
|
||||
i++;
|
||||
|
@ -119,43 +161,10 @@ public class NsharpHandleArchiveFile {
|
|||
//From token 13, we have pressure, height, temp,..., omega, pressure, height,..omega.
|
||||
//These weather data will be repeated every 7 tokens.
|
||||
String tok = st.nextToken();
|
||||
if(i == loadSndTypeIndex){
|
||||
if(NsharpLoadDialog.getAccess()!= null ){
|
||||
if(tok.equals("PFC"))
|
||||
NsharpLoadDialog.getAccess().setActiveLoadSoundingType(NsharpLoadDialog.PFC_SND);
|
||||
else if(tok.equals("MDL"))
|
||||
NsharpLoadDialog.getAccess().setActiveLoadSoundingType(NsharpLoadDialog.MODEL_SND);
|
||||
else
|
||||
NsharpLoadDialog.getAccess().setActiveLoadSoundingType(NsharpLoadDialog.OBSER_SND);
|
||||
if(tok.equals("OMEG")){
|
||||
dataStartIndex = i+1;
|
||||
}
|
||||
//System.out.println("loadsnd type "+ tok);
|
||||
}
|
||||
else if(i == sndTypeIndex){
|
||||
sndType = tok;
|
||||
stninfo.setSndType(sndType);
|
||||
//System.out.println("snd type "+ sndType);
|
||||
}
|
||||
else if (i > sndTypeIndex && i<= stnInfoIndexEnd){
|
||||
|
||||
//stn display info
|
||||
stnDispInfoStr = stnDispInfoStr + tok + " ";
|
||||
if( i >=3){
|
||||
//time line
|
||||
timeLine = timeLine + tok + " ";
|
||||
}
|
||||
} else if (i == stnLatIndex){
|
||||
float lat=0;
|
||||
if(tok.length() > latlonTokenHdrLength) {
|
||||
lat = Float.parseFloat(tok.substring(latlonTokenHdrLength));
|
||||
}
|
||||
stninfo.setLatitude(lat);
|
||||
} else if (i == stnLonIndex){
|
||||
float lon=0;
|
||||
if(tok.length() > latlonTokenHdrLength) {
|
||||
lon = Float.parseFloat(tok.substring(latlonTokenHdrLength));
|
||||
}
|
||||
stninfo.setLongitude(lon);
|
||||
} else if (i >=dataStartIndex){
|
||||
if (i >=dataStartIndex){
|
||||
|
||||
if((i-dataStartIndex)%dataCycleLength ==0){
|
||||
sndLy = new NcSoundingLayer();
|
||||
|
@ -227,16 +236,6 @@ public class NsharpHandleArchiveFile {
|
|||
mb.setMessage("Invalid sounding data retrieved from archive file!!");
|
||||
mb.open();
|
||||
}
|
||||
//test
|
||||
//textToShow="";
|
||||
//for (NcSoundingLayer layer: sndLyList){
|
||||
// tempText = String.format("%7.2f\t%8.2f %7.2f %7.2f %6.2f %6.2f %9.6f\n", layer.getPressure(),
|
||||
// layer.getGeoHeight(),layer.getTemperature(),layer.getDewpoint(), layer.getWindDirection(),
|
||||
// layer.getWindSpeed(), layer.getOmega());
|
||||
// textToShow = textToShow + tempText;
|
||||
//}
|
||||
//System.out.println("Endof openArchiveFile");
|
||||
//end test
|
||||
} catch (FileNotFoundException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -547,9 +547,17 @@ DisposeListener, IPartListener{
|
|||
graphEditBtn.setText(EDIT_GRAPH_OFF);
|
||||
currentGraphMode= NsharpConstants.GRAPH_SKEWT;
|
||||
NsharpEditor editor = NsharpEditor.getActiveNsharpEditor();
|
||||
if(editor != null){
|
||||
if(editor != null && editor.getRscHandler()!=null){
|
||||
//note: resetRsc will reset currentPage, overlay, compare, interpolate flag in Resource
|
||||
editor.getRscHandler().resetRsc();
|
||||
//issue#18 - issue list
|
||||
if(editor.getRscHandler().getDataPaneRsc()!=null){
|
||||
editor.getRscHandler().getDataPaneRsc().resetCurrentParcel();
|
||||
}
|
||||
NsharpParcelDialog parcelDia = NsharpParcelDialog.getInstance(shell);
|
||||
if ( parcelDia != null ) {
|
||||
parcelDia.reset();
|
||||
}
|
||||
//editor.getNsharpSkewTDescriptor().getSkewtResource().resetRsc();// need to called it twice to make refresh worked...dont know why
|
||||
//know that current editor is NsharpSkewT editor, refresh it.
|
||||
editor.refresh();
|
||||
|
|
|
@ -292,7 +292,7 @@ public class NsharpParametersSelectionConfigDialog extends Dialog {
|
|||
parcelTvBtn.setText(NsharpNativeConstants.PARCEL_VT_TRACE);
|
||||
parcelTvBtn.setEnabled( true );
|
||||
parcelTvBtn.setBounds(btnGp.getBounds().x+ btnGapX, dewpBtn.getBounds().y + dewpBtn.getBounds().height+ btnGapY, btnWidth,btnHeight);
|
||||
if(parcel == true)
|
||||
if(parcelTv == true)
|
||||
parcelTvBtn.setSelection(true);
|
||||
else
|
||||
parcelTvBtn.setSelection(false);
|
||||
|
@ -309,7 +309,7 @@ public class NsharpParametersSelectionConfigDialog extends Dialog {
|
|||
parcelBtn.setText(NsharpNativeConstants.PARCEL_T_TRACE);
|
||||
parcelBtn.setEnabled( true );
|
||||
parcelBtn.setBounds(btnGp.getBounds().x+ btnGapX, parcelTvBtn.getBounds().y + parcelTvBtn.getBounds().height+ btnGapY, btnWidth,btnHeight);
|
||||
if(parcelTv == true)
|
||||
if(parcel == true)
|
||||
parcelBtn.setSelection(true);
|
||||
else
|
||||
parcelBtn.setSelection(false);
|
||||
|
|
|
@ -49,10 +49,6 @@ public class NsharpParcelDialog extends Dialog {
|
|||
private String MUP = "Most Unstable Parcel";
|
||||
private String UDL= "User Defined Level";
|
||||
private String EFF = "Mean Effective Layer";
|
||||
//private boolean surface=false, forcast=false, mml=false, mup=true, udl=false, eff=false;
|
||||
//ParcelData surfacePar=null, forcastPar=null, mmlPar=null, mupPar=null, udlPar=null, effPar=null;
|
||||
//private static short currentParcel = NsharpNativeConstants.PARCELTYPE_MOST_UNSTABLE;
|
||||
//private static short prevParcel = currentParcel;
|
||||
private static int userDefdParcelMb = 850; //default value
|
||||
private int btnWidth = 300;
|
||||
private int btnHeight = 20;
|
||||
|
@ -62,7 +58,6 @@ public class NsharpParcelDialog extends Dialog {
|
|||
private short curParcelType;
|
||||
private Button curSfcBtn,frcstBtn,effBtn,mmlBtn, mupBtn,udlBtn;
|
||||
private Text userDefdMbtext;
|
||||
//private List<ParcelData> parcelList = new ArrayList<ParcelData>();
|
||||
public static int getUserDefdParcelMb() {
|
||||
return userDefdParcelMb;
|
||||
}
|
||||
|
@ -72,38 +67,9 @@ public class NsharpParcelDialog extends Dialog {
|
|||
userDefdParcelMb = 850;
|
||||
}
|
||||
public void reset(){
|
||||
//parcelList.clear();
|
||||
//addParcelToList(mupPar);
|
||||
userDefdParcelMb = 850;
|
||||
curParcelType = NsharpNativeConstants.PARCELTYPE_MOST_UNSTABLE;
|
||||
//mup=true;
|
||||
//surface= forcast=mml= udl= eff=false;
|
||||
}
|
||||
/*
|
||||
public void setCurrentParcelButton(int parcelType){
|
||||
switch(parcelType){
|
||||
case NsharpNativeConstants.PARCELTYPE_OBS_SFC:
|
||||
curSfcBtn.setSelection(true);
|
||||
break;
|
||||
case NsharpNativeConstants.PARCELTYPE_EFF:
|
||||
effBtn.setSelection(true);
|
||||
break;
|
||||
case NsharpNativeConstants.PARCELTYPE_FCST_SFC:
|
||||
frcstBtn.setSelection(true);
|
||||
break;
|
||||
case NsharpNativeConstants.PARCELTYPE_MEAN_MIXING:
|
||||
mmlBtn.setSelection(true);
|
||||
break;
|
||||
case NsharpNativeConstants.PARCELTYPE_MOST_UNSTABLE:
|
||||
mupBtn.setSelection(true);
|
||||
break;
|
||||
case NsharpNativeConstants.PARCELTYPE_USER_DEFINED:
|
||||
udlBtn.setSelection(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
public static NsharpParcelDialog getInstance( Shell parShell){
|
||||
|
||||
if ( thisDialog == null ){
|
||||
|
@ -129,41 +95,7 @@ public class NsharpParcelDialog extends Dialog {
|
|||
protected NsharpParcelDialog(Shell parentShell) throws VizException {
|
||||
super(parentShell);
|
||||
thisDialog = this;
|
||||
/*NsharpResourceHandler skewtRsc = NsharpEditor.getActiveNsharpEditor().getRscHandler();
|
||||
if(skewtRsc!=null){
|
||||
surfacePar = skewtRsc.new ParcelData();
|
||||
surfacePar.setParcelLayerPressure(NsharpNativeConstants.OBS_LAYER);
|
||||
surfacePar.setParcelType(NsharpNativeConstants.PARCELTYPE_OBS_SFC);
|
||||
forcastPar = skewtRsc.new ParcelData();
|
||||
forcastPar.setParcelLayerPressure(NsharpNativeConstants.FCST_LAYER);
|
||||
forcastPar.setParcelType(NsharpNativeConstants.PARCELTYPE_FCST_SFC);
|
||||
mmlPar = skewtRsc.new ParcelData();
|
||||
mmlPar.setParcelLayerPressure(NsharpNativeConstants.MML_LAYER);
|
||||
mmlPar.setParcelType(NsharpNativeConstants.PARCELTYPE_MEAN_MIXING);
|
||||
mupPar = skewtRsc.new ParcelData();
|
||||
mupPar.setParcelLayerPressure(NsharpNativeConstants.MU_LAYER);
|
||||
mupPar.setParcelType(NsharpNativeConstants.PARCELTYPE_MOST_UNSTABLE);
|
||||
udlPar = skewtRsc.new ParcelData();
|
||||
udlPar.setParcelLayerPressure(NsharpNativeConstants.USER_LAYER);
|
||||
udlPar.setParcelType(NsharpNativeConstants.PARCELTYPE_USER_DEFINED);
|
||||
effPar = skewtRsc.new ParcelData();
|
||||
effPar.setParcelLayerPressure(NsharpNativeConstants.EFF_LAYER);
|
||||
effPar.setParcelType(NsharpNativeConstants.PARCELTYPE_EFF);
|
||||
|
||||
//addParcelToList(mupPar);
|
||||
|
||||
}*/
|
||||
}
|
||||
//private void addParcelToList(ParcelData parcel){
|
||||
// if(parcel!=null){
|
||||
// parcelList.add(parcel);
|
||||
// }
|
||||
//}
|
||||
/*private void deleteParcelFromList(ParcelData parceldata){
|
||||
if( parceldata!=null){
|
||||
parcelList.remove(parceldata);
|
||||
}
|
||||
}*/
|
||||
|
||||
private void createDialogContents(Composite parent){
|
||||
|
||||
|
@ -178,34 +110,6 @@ public class NsharpParcelDialog extends Dialog {
|
|||
Button button = (Button) child;
|
||||
if (button.getSelection()) {
|
||||
curParcelType = Short.parseShort(button.getData().toString());
|
||||
/*switch(parcelType){
|
||||
case NsharpNativeConstants.PARCELTYPE_OBS_SFC:
|
||||
parcelList.clear();
|
||||
parcelList.add(surfacePar);
|
||||
break;
|
||||
case NsharpNativeConstants.PARCELTYPE_EFF:
|
||||
parcelList.clear();
|
||||
parcelList.add(effPar);
|
||||
break;
|
||||
case NsharpNativeConstants.PARCELTYPE_FCST_SFC:
|
||||
parcelList.clear();
|
||||
parcelList.add(forcastPar);
|
||||
break;
|
||||
case NsharpNativeConstants.PARCELTYPE_MEAN_MIXING:
|
||||
parcelList.clear();
|
||||
parcelList.add(mmlPar);
|
||||
break;
|
||||
case NsharpNativeConstants.PARCELTYPE_MOST_UNSTABLE:
|
||||
parcelList.clear();
|
||||
parcelList.add(mupPar);
|
||||
break;
|
||||
case NsharpNativeConstants.PARCELTYPE_USER_DEFINED:
|
||||
parcelList.clear();
|
||||
parcelList.add(udlPar);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}*/
|
||||
|
||||
NsharpEditor editor = NsharpEditor.getActiveNsharpEditor();
|
||||
if(editor != null){
|
||||
|
@ -229,25 +133,6 @@ public class NsharpParcelDialog extends Dialog {
|
|||
curSfcBtn.setData(NsharpNativeConstants.PARCELTYPE_OBS_SFC);
|
||||
curSfcBtn.addListener( SWT.MouseUp,radioGpLsner);
|
||||
|
||||
/*
|
||||
if(surface == true)
|
||||
curSfcBtn.setSelection(true);
|
||||
else
|
||||
curSfcBtn.setSelection(false);
|
||||
|
||||
curSfcBtn.addListener( SWT.MouseUp, new Listener() {
|
||||
public void handleEvent(Event event) {
|
||||
if(surface == true){
|
||||
surface=false;
|
||||
deleteParcelFromList(surfacePar);
|
||||
}
|
||||
else{
|
||||
surface=true;
|
||||
addParcelToList(surfacePar);
|
||||
}
|
||||
}
|
||||
} );
|
||||
*/
|
||||
frcstBtn = new Button(btnGp, SWT.RADIO | SWT.BORDER);
|
||||
frcstBtn.setText(FRCST_SFC);
|
||||
frcstBtn.setEnabled( true );
|
||||
|
@ -255,98 +140,24 @@ public class NsharpParcelDialog extends Dialog {
|
|||
frcstBtn.setData(NsharpNativeConstants.PARCELTYPE_FCST_SFC);
|
||||
frcstBtn.addListener( SWT.MouseUp,radioGpLsner);
|
||||
|
||||
/*if(forcast==true)
|
||||
frcstBtn.setSelection(true);
|
||||
else
|
||||
frcstBtn.setSelection(false);
|
||||
frcstBtn.addListener( SWT.MouseUp, new Listener() {
|
||||
public void handleEvent(Event event) {
|
||||
if(forcast == true){
|
||||
forcast=false;
|
||||
deleteParcelFromList(forcastPar);
|
||||
}
|
||||
else{
|
||||
forcast=true;
|
||||
addParcelToList(forcastPar);
|
||||
}
|
||||
//prevParcel = currentParcel;
|
||||
//currentParcel = NsharpNativeConstants.PARCELTYPE_FCST_SFC;
|
||||
//userDefdMbtext.setEnabled(false);
|
||||
//userDefdMbtext.setVisible(false);
|
||||
}
|
||||
} ); */
|
||||
mmlBtn = new Button(btnGp, SWT.RADIO | SWT.BORDER);
|
||||
mmlBtn.setText(MML);
|
||||
mmlBtn.setEnabled( true );
|
||||
mmlBtn.setBounds(btnGp.getBounds().x+ btnGapX, frcstBtn.getBounds().y + frcstBtn.getBounds().height+ btnGapY, btnWidth,btnHeight);
|
||||
mmlBtn.setData(NsharpNativeConstants.PARCELTYPE_MEAN_MIXING);
|
||||
mmlBtn.addListener( SWT.MouseUp,radioGpLsner);
|
||||
/*if(mml == true)
|
||||
mmlBtn.setSelection(true);
|
||||
else
|
||||
mmlBtn.setSelection(false);
|
||||
mmlBtn.addListener( SWT.MouseUp, new Listener() {
|
||||
public void handleEvent(Event event) {
|
||||
if(mml == true){
|
||||
mml=false;
|
||||
deleteParcelFromList(mmlPar);
|
||||
}
|
||||
else{
|
||||
mml=true;
|
||||
addParcelToList(mmlPar);
|
||||
}
|
||||
|
||||
}
|
||||
} ); */
|
||||
mupBtn = new Button(btnGp, SWT.RADIO | SWT.BORDER);
|
||||
mupBtn.setText(MUP);
|
||||
mupBtn.setEnabled( true );
|
||||
mupBtn.setBounds(btnGp.getBounds().x+ btnGapX, mmlBtn.getBounds().y + mmlBtn.getBounds().height+ btnGapY, btnWidth,btnHeight);
|
||||
mupBtn.setData(NsharpNativeConstants.PARCELTYPE_MOST_UNSTABLE);
|
||||
mupBtn.addListener( SWT.MouseUp,radioGpLsner);
|
||||
/*if(mup == true)
|
||||
mupBtn.setSelection(true);
|
||||
else
|
||||
mupBtn.setSelection(false);
|
||||
mupBtn.addListener( SWT.MouseUp, new Listener() {
|
||||
public void handleEvent(Event event) {
|
||||
if(mup == true){
|
||||
mup=false;
|
||||
deleteParcelFromList(mupPar);
|
||||
}
|
||||
else{
|
||||
mup=true;
|
||||
addParcelToList(mupPar);
|
||||
}
|
||||
//prevParcel = currentParcel;
|
||||
//currentParcel = NsharpNativeConstants.PARCELTYPE_MOST_UNSTABLE ;
|
||||
//userDefdMbtext.setEnabled(false);
|
||||
//userDefdMbtext.setVisible(false);
|
||||
}
|
||||
} ); */
|
||||
effBtn = new Button(btnGp, SWT.RADIO | SWT.BORDER);
|
||||
effBtn.setText(EFF);
|
||||
effBtn.setEnabled( true );
|
||||
effBtn.setBounds(btnGp.getBounds().x+ btnGapX, mupBtn.getBounds().y + mupBtn.getBounds().height+ btnGapY, btnWidth,btnHeight);
|
||||
effBtn.setData(NsharpNativeConstants.PARCELTYPE_EFF);
|
||||
effBtn.addListener( SWT.MouseUp,radioGpLsner);
|
||||
/*if(eff == true)
|
||||
effBtn.setSelection(true);
|
||||
else
|
||||
effBtn.setSelection(false);
|
||||
effBtn.addListener( SWT.MouseUp, new Listener() {
|
||||
public void handleEvent(Event event) {
|
||||
System.out.println("EFF picked");
|
||||
if(eff == true){
|
||||
eff=false;
|
||||
deleteParcelFromList(effPar);
|
||||
}
|
||||
else{
|
||||
eff=true;
|
||||
addParcelToList(effPar);
|
||||
}
|
||||
}
|
||||
} ); */
|
||||
|
||||
udlBtn = new Button(btnGp, SWT.RADIO | SWT.BORDER);
|
||||
udlBtn.setText(UDL);
|
||||
|
@ -354,27 +165,6 @@ public class NsharpParcelDialog extends Dialog {
|
|||
udlBtn.setBounds(btnGp.getBounds().x+ btnGapX, effBtn.getBounds().y + effBtn.getBounds().height+ btnGapY, btnWidth,btnHeight);
|
||||
udlBtn.setData(NsharpNativeConstants.PARCELTYPE_USER_DEFINED);
|
||||
udlBtn.addListener( SWT.MouseUp,radioGpLsner);
|
||||
/*if(udl == true)
|
||||
udlBtn.setSelection(true);
|
||||
else
|
||||
udlBtn.setSelection(false);
|
||||
udlBtn.addListener( SWT.MouseUp, new Listener() {
|
||||
public void handleEvent(Event event) {
|
||||
System.out.println("UDL picked");
|
||||
if(udl == true){
|
||||
udl=false;
|
||||
deleteParcelFromList(udlPar);
|
||||
}
|
||||
else{
|
||||
udl=true;
|
||||
addParcelToList(udlPar);
|
||||
}
|
||||
//prevParcel = currentParcel;
|
||||
//currentParcel = NsharpNativeConstants.PARCELTYPE_USER_DEFINED ;
|
||||
//userDefdMbtext.setEnabled(true);
|
||||
//userDefdMbtext.setVisible(true);
|
||||
}
|
||||
} ); */
|
||||
|
||||
udlBtn.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
|
@ -388,15 +178,8 @@ public class NsharpParcelDialog extends Dialog {
|
|||
userDefdMbtext = new Text (btnGp, SWT.BORDER | SWT.SINGLE);
|
||||
userDefdMbtext.setBounds (btnGp.getBounds().x+ btnGapX, udlBtn.getBounds().y + udlBtn.getBounds().height+ btnGapY, btnWidth/4,btnHeight);
|
||||
userDefdMbtext.setText(Integer.toString(userDefdParcelMb));
|
||||
//if(udlBtn.getSelection()){
|
||||
userDefdMbtext.setEnabled(true);
|
||||
userDefdMbtext.setVisible(true);
|
||||
//}
|
||||
//else {
|
||||
//// userDefdMbtext.setEnabled(false);
|
||||
// userDefdMbtext.setVisible(false);
|
||||
//}
|
||||
|
||||
|
||||
//to make sure user enter digits only
|
||||
userDefdMbtext.addListener (SWT.Verify, new Listener () {
|
||||
|
@ -416,8 +199,8 @@ public class NsharpParcelDialog extends Dialog {
|
|||
});
|
||||
NsharpResourceHandler skewtRsc = NsharpEditor.getActiveNsharpEditor().getRscHandler();
|
||||
if(skewtRsc!=null){
|
||||
int parcelType = skewtRsc.getCurrentParcel();
|
||||
switch(parcelType){
|
||||
curParcelType = skewtRsc.getCurrentParcel();
|
||||
switch(curParcelType){
|
||||
case NsharpNativeConstants.PARCELTYPE_OBS_SFC:
|
||||
curSfcBtn.setSelection(true);
|
||||
break;
|
||||
|
@ -457,27 +240,15 @@ public class NsharpParcelDialog extends Dialog {
|
|||
}
|
||||
NsharpResourceHandler skewtRsc = NsharpEditor.getActiveNsharpEditor().getRscHandler();
|
||||
skewtRsc.setCurrentParcel(curParcelType);
|
||||
//if(udl == true)
|
||||
//udlPar.setParcelLayerPressure(userDefdParcelMb);
|
||||
|
||||
//skewtRsc.setParcelList(parcelList);
|
||||
//skewtRsc.setCurrentParcelData(NsharpNativeConstants.PARCELTYPE_USER_DEFINED,userDefdParcelMb);
|
||||
//else {
|
||||
// parceldata.setParcelLayerPressure(NsharpNativeConstants.parcelToLayerMap.get(currentParcel));
|
||||
//}
|
||||
//skewtRsc.addParcelToList(parceldata);
|
||||
//skewtRsc.setCurrentTextPage(2);
|
||||
//move close from okPressed() to here
|
||||
close();
|
||||
}
|
||||
} );
|
||||
|
||||
Button canBtn = createButton(parent, IDialogConstants.CANCEL_ID,
|
||||
IDialogConstants.CANCEL_LABEL, false);
|
||||
IDialogConstants.CLOSE_LABEL, false);
|
||||
canBtn.addListener( SWT.MouseUp, new Listener() {
|
||||
public void handleEvent(Event event) {
|
||||
//System.out.println("cancel listener is called");
|
||||
//currentParcel = prevParcel;
|
||||
close();
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
@ -541,6 +312,4 @@ public class NsharpParcelDialog extends Dialog {
|
|||
return (super.close());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -34,6 +34,9 @@ import org.eclipse.swt.widgets.FileDialog;
|
|||
import org.eclipse.swt.widgets.MessageBox;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.uf.viz.d2d.ui.perspectives.D2D5Pane;
|
||||
import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
|
||||
|
||||
public class NsharpSaveHandle {
|
||||
public static void saveFile(Shell shell) {
|
||||
FileDialog dlg = new FileDialog(shell, SWT.SAVE);
|
||||
|
@ -118,6 +121,9 @@ public class NsharpSaveHandle {
|
|||
String textToSave = new String("");
|
||||
|
||||
if(rsc!=null && rsc.getSoundingLys()!= null){
|
||||
if( VizPerspectiveListener.getCurrentPerspectiveManager()!= null &&
|
||||
VizPerspectiveListener.getCurrentPerspectiveManager().getPerspectiveId().equals(D2D5Pane.ID_PERSPECTIVE))
|
||||
{
|
||||
List<NcSoundingLayer> soundLyList = rsc.getSoundingLys();
|
||||
String latlonstr;
|
||||
NsharpStationInfo stnInfo=rsc.getPickedStnInfo();
|
||||
|
@ -154,12 +160,51 @@ public class NsharpSaveHandle {
|
|||
textToSave = textToSave + tempText;
|
||||
}
|
||||
}
|
||||
else{
|
||||
List<NcSoundingLayer> soundLyList = rsc.getSoundingLys();
|
||||
String latlonstr;
|
||||
NsharpStationInfo stnInfo=rsc.getPickedStnInfo();
|
||||
if( stnInfo!= null){
|
||||
latlonstr = "LAT=" + stnInfo.getLatitude() + "; LON="+ stnInfo.getLongitude()+";";
|
||||
}
|
||||
else {
|
||||
latlonstr = "LAT=; LON=; ";
|
||||
}
|
||||
int loadsoundingType= NsharpLoadDialog.OBSER_SND;
|
||||
String loadsoundingTypeStr= "OBS";;
|
||||
if(NsharpLoadDialog.getAccess()!= null ){
|
||||
loadsoundingType = NsharpLoadDialog.getAccess().getActiveLoadSoundingType();
|
||||
switch(loadsoundingType ){
|
||||
case NsharpLoadDialog.PFC_SND:
|
||||
loadsoundingTypeStr = "PFC";
|
||||
break;
|
||||
case NsharpLoadDialog.MODEL_SND:
|
||||
loadsoundingTypeStr = "MDL";
|
||||
break;
|
||||
case NsharpLoadDialog.OBSER_SND:
|
||||
default:
|
||||
loadsoundingTypeStr = "OBS";
|
||||
break;
|
||||
}
|
||||
}
|
||||
textToSave ="SNDTYPE="+ loadsoundingTypeStr+"; TITLE="+rsc.getPickedStnInfoStr() + "; STNID="+rsc.getPickedStnInfo().getStnId() +"; " + latlonstr
|
||||
+ "\n " + "PRESSURE HGHT\t TEMP\t DWPT WDIR WSPD OMEG \n";
|
||||
String tempText="";
|
||||
for (NcSoundingLayer layer: soundLyList){
|
||||
tempText = String.format("%f %f %f %f %f %f %f\n", layer.getPressure(),
|
||||
layer.getGeoHeight(),layer.getTemperature(),layer.getDewpoint(), layer.getWindDirection(),
|
||||
layer.getWindSpeed(), layer.getOmega());
|
||||
textToSave = textToSave + tempText;
|
||||
}
|
||||
}
|
||||
out.write(textToSave);
|
||||
//Close the output stream
|
||||
out.close();
|
||||
}
|
||||
}catch (Exception e){//Catch exception if any
|
||||
System.err.println("Error: " + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ public class NsharpShowTextDialog extends Dialog {
|
|||
private Group textGp;
|
||||
private Font newFont ;
|
||||
private static boolean iAmClosed;
|
||||
private static String textToSave="";
|
||||
//private static String textToSave="";
|
||||
public Text getText() {
|
||||
return text;
|
||||
}
|
||||
|
@ -287,7 +287,7 @@ public class NsharpShowTextDialog extends Dialog {
|
|||
latlonstr = " LAT= LON= ";
|
||||
}
|
||||
String textToShow = rsc.getPickedStnInfo().getSndType() +" "+rsc.getPickedStnInfoStr() + latlonstr+ "\n" + hdr;
|
||||
textToSave = rsc.getPickedStnInfo().getSndType() +" "+rsc.getPickedStnInfoStr() + latlonstr + "\n" + hdr;
|
||||
//textToSave = rsc.getPickedStnInfo().getSndType() +" "+rsc.getPickedStnInfoStr() + latlonstr + "\n" + hdr;
|
||||
String tempText="", tempSaveText="";
|
||||
for (NcSoundingLayer layer: soundLyList){
|
||||
tempText = String.format("%7.2f\t%8.2f %7.2f %7.2f %6.2f %6.2f %9.6f\n", layer.getPressure(),
|
||||
|
@ -297,7 +297,7 @@ public class NsharpShowTextDialog extends Dialog {
|
|||
layer.getGeoHeight(),layer.getTemperature(),layer.getDewpoint(), layer.getWindDirection(),
|
||||
layer.getWindSpeed(), layer.getOmega());
|
||||
textToShow = textToShow + tempText;
|
||||
textToSave = textToSave + tempSaveText;
|
||||
//textToSave = textToSave + tempSaveText;
|
||||
}
|
||||
|
||||
text.setText(textToShow);
|
||||
|
|
|
@ -131,10 +131,11 @@ public class ObservedSoundingDialogContents {
|
|||
|
||||
//convert to Nsharp's own station info struct
|
||||
NsharpStationInfo stn = new NsharpStationInfo();
|
||||
stn.setStnDisplayInfo(stnInfoStr + " " + selectedSndTime+ " "+currentSndType.toString());
|
||||
String packedStnInfoStr= stnInfoStr.replace(" ", "_");
|
||||
stn.setStnDisplayInfo(packedStnInfoStr + " " + selectedSndTime+ " "+currentSndType.toString());
|
||||
stn.setLongitude(lon);
|
||||
stn.setLatitude(lat);
|
||||
//stn.setElevation(elv);
|
||||
stn.setStnId(stnInfoStr);
|
||||
stn.setReftime(synoptictime);
|
||||
stn.setRangestarttime(synoptictime);
|
||||
stn.setSndType(currentSndType.toString());
|
||||
|
|
|
@ -324,7 +324,8 @@ public class PfcSoundingDialogContents {
|
|||
NsharpStationInfo.timeLineSpecific timeLinsSpc = stn.new timeLineSpecific();
|
||||
|
||||
int endIndex= Math.min(4, sndTypeStr.length());
|
||||
String dispInfo = stnInfo.getStnId() + " " + selectedSndTime+" "+sndTypeStr.substring(0,endIndex);
|
||||
String packedStnIdStr= stnInfo.getStnId().replace(" ", "_");
|
||||
String dispInfo = packedStnIdStr + " " + selectedSndTime+" "+sndTypeStr.substring(0,endIndex);
|
||||
timeLinsSpc.setDisplayInfo(dispInfo);
|
||||
timeLinsSpc.setTiemLine(stnInfo.getRangeStartTime());
|
||||
stn.addToTimeLineSpList(timeLinsSpc);
|
||||
|
@ -336,7 +337,6 @@ public class PfcSoundingDialogContents {
|
|||
//if(i <10)
|
||||
// System.out.println( "disP="+dispInfo+" refT= "+stnInfo.getSynopTime()+ " rangSt="+stnInfo.getRangeStartTime());
|
||||
stnPoints.add(stn);
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue