VLab Issue #4003 - Mostly PGEN bug fixes

minor updates to nsharp, lat/lon overlay, ntrans, and plotdata resource

Change-Id: I2a1718ed7674edb786bceec13bcb20c29cc5d616

Former-commit-id: 8bdc663629050457b23d06c19bd7a925597c1288
This commit is contained in:
Stephen Gilbert 2014-12-01 17:17:39 -05:00
parent f87cc6e7fb
commit 57393984d3
37 changed files with 7515 additions and 6910 deletions

View file

@ -47,7 +47,7 @@ import java.util.Set;
* 17-May-2011 M. Li Created a parseCINT to simplify CINT parsing. * 17-May-2011 M. Li Created a parseCINT to simplify CINT parsing.
* 07-Apr-2014 TTR-938 D.Sushon Added check for null string to constructor, fixing NullPointerException * 07-Apr-2014 TTR-938 D.Sushon Added check for null string to constructor, fixing NullPointerException
* thrown when attempting to initialize with null String. * thrown when attempting to initialize with null String.
* * 09-Sep-2014 TTR-852 A.Yuk remove restriction of contour lines =50 and make it unlimited contour lines.
* *
* </pre> * </pre>
* *
@ -397,11 +397,12 @@ public class CINT {
interval = (cmax - cmin) / 10.0; interval = (cmax - cmin) / 10.0;
} }
// Only allow less than 50 contour levels // Only allow less than 50 contour levels :
if ((cmax - cmin) / interval > 50) // comment out contour restriction. : IT WAs BAD Code to generate decimal point on contour labels.
/* if ((cmax - cmin) / interval > 50) {
interval = (cmax - cmin) / 50; interval = (cmax - cmin) / 50;
interval =(double) (int) ((cmax - cmin)/50) ; }
// System.out.println(" cmax=="+cmax); */
contourInfo = new CINT(interval.toString() + "/" contourInfo = new CINT(interval.toString() + "/"
+ cmin.toString() + "/" + cmax.toString()); + cmin.toString() + "/" + cmax.toString());
cvalues = contourInfo cvalues = contourInfo
@ -409,7 +410,30 @@ public class CINT {
} }
} }
return cvalues; /********************************
int csize=cvalues.size();
System.out.println(" .................");
System.out.println(" .................");
System.out.println(" Contour level range is from "+cvalues.get(0)+" to "+cvalues.get(csize-1)+".");
System.out.println(" Contour interval "+interval+".");
System.out.println(" .................");
System.out.println(" .................");
// * capped contour lines to 50
if (csize > 50) {
System.out.println(" !!! Pay attention to CONTOUR INTERVAL.");
System.out.println(" Contour lines from "+cvalues.get(0)+" to "+cvalues.get(csize-1)+" are eliminated due to maximum contour allowance." );
while (cvalues.size()>50){cvalues.remove(50);}
System.out.println(" !!! Contours are being plotted to the first 50th lines.");
System.out.println(" Range of contour lines drawn is from "+cvalues.get(0)+" to "+cvalues.get(49)+".");
System.out.println(" !!! Contour lines are capped due to allowance of maximum contour lines of 50. ");
}
System.out.println(" Contour level = "+cvalues.toString()+".");
***************************/
while (cvalues.size()>50){cvalues.remove(50);}
int csize=cvalues.size();
System.out.println(" Contour lines("+csize+ ") from "+cvalues.get(0)+" to "+cvalues.get(csize-1));
return cvalues;
} }
/** @return boolean isCINTStringParsed */ /** @return boolean isCINTStringParsed */
@ -652,3 +676,4 @@ public class CINT {
} }
} }

View file

@ -1940,9 +1940,10 @@ public class NsharpResourceHandler {
return; return;
} }
if (!fromArchive) { if (!fromArchive) {
// start FixMark:nearByStnCompSnd d2dlite // For those sounding report with forecast time, e.g. model/pfc sounding
if (!(sndType.contentEquals("NCUAIR") || sndType if (timeLine.contains("V")) { //fix D2D loading issue. 10/8/2014
.contentEquals("BUFRUA"))) { // if (!(sndType.contentEquals("NCUAIR") || sndType
// .contentEquals("BUFRUA"))) {
// Chin's NOTE: // Chin's NOTE:
// Can Not use reference time directly from the stnInfo, // Can Not use reference time directly from the stnInfo,
// Timestamp refTime = stnInfo.getReftime() // Timestamp refTime = stnInfo.getReftime()

View file

@ -16,7 +16,7 @@
* 01/08/2014 Chin Chen Only initializing inventory when in NCP * 01/08/2014 Chin Chen Only initializing inventory when in NCP
* 01/13/2014 Chin Chen TTR829- when interpolation, edit graph is allowed * 01/13/2014 Chin Chen TTR829- when interpolation, edit graph is allowed
* 01/22/2014 Chin Chen DR17003 issue: NSHARP sounding display throws errors when swapping into main pane when show text is turned on. * 01/22/2014 Chin Chen DR17003 issue: NSHARP sounding display throws errors when swapping into main pane when show text is turned on.
* * 10/20/2014 Chin Chen DR16864, D2D does not use unload button. Check to make sure not D2D instance before access unload button.
* </pre> * </pre>
* *
* @author Chin Chen * @author Chin Chen
@ -150,7 +150,7 @@ public class NsharpPaletteWindow extends ViewPart implements SelectionListener,
private boolean spcGpCreated = false; private boolean spcGpCreated = false;
private boolean awcGpCreated = false; private boolean imD2d = false; // fixMark:NcInventory
public static NsharpPaletteWindow getInstance() { public static NsharpPaletteWindow getInstance() {
if (VizPerspectiveListener.getCurrentPerspectiveManager() != null) { if (VizPerspectiveListener.getCurrentPerspectiveManager() != null) {
@ -220,7 +220,8 @@ public class NsharpPaletteWindow extends ViewPart implements SelectionListener,
interpBtn.setEnabled(false); interpBtn.setEnabled(false);
graphModeBtnIcing.setEnabled(false); graphModeBtnIcing.setEnabled(false);
graphModeBtnTurb.setEnabled(false); graphModeBtnTurb.setEnabled(false);
unloadBtn.setEnabled(false); // FixMark:nearByStnCompSnd if (!imD2d)
unloadBtn.setEnabled(false); // FixMark:nearByStnCompSnd
} else if (compareStnIsOn) { } else if (compareStnIsOn) {
compareStnBtn.setText(COMP_STN_ON); compareStnBtn.setText(COMP_STN_ON);
graphEditBtn.setEnabled(false); graphEditBtn.setEnabled(false);
@ -231,7 +232,8 @@ public class NsharpPaletteWindow extends ViewPart implements SelectionListener,
interpBtn.setEnabled(false); interpBtn.setEnabled(false);
graphModeBtnIcing.setEnabled(false); graphModeBtnIcing.setEnabled(false);
graphModeBtnTurb.setEnabled(false); graphModeBtnTurb.setEnabled(false);
unloadBtn.setEnabled(false); // FixMark:nearByStnCompSnd if (!imD2d)
unloadBtn.setEnabled(false); // FixMark:nearByStnCompSnd
} else if (compareSndIsOn) { } else if (compareSndIsOn) {
compareSndBtn.setText(COMP_SND_ON); compareSndBtn.setText(COMP_SND_ON);
graphEditBtn.setEnabled(false); graphEditBtn.setEnabled(false);
@ -242,7 +244,8 @@ public class NsharpPaletteWindow extends ViewPart implements SelectionListener,
interpBtn.setEnabled(false); interpBtn.setEnabled(false);
graphModeBtnIcing.setEnabled(false); graphModeBtnIcing.setEnabled(false);
graphModeBtnTurb.setEnabled(false); graphModeBtnTurb.setEnabled(false);
unloadBtn.setEnabled(false); // FixMark:nearByStnCompSnd if (!imD2d)
unloadBtn.setEnabled(false); // FixMark:nearByStnCompSnd
} else if (compareTmIsOn) { } else if (compareTmIsOn) {
compareTmBtn.setText(COMP_TM_ON); compareTmBtn.setText(COMP_TM_ON);
compareSndBtn.setEnabled(false); compareSndBtn.setEnabled(false);
@ -253,7 +256,8 @@ public class NsharpPaletteWindow extends ViewPart implements SelectionListener,
interpBtn.setEnabled(false); interpBtn.setEnabled(false);
graphModeBtnIcing.setEnabled(false); graphModeBtnIcing.setEnabled(false);
graphModeBtnTurb.setEnabled(false); graphModeBtnTurb.setEnabled(false);
unloadBtn.setEnabled(false); // FixMark:nearByStnCompSnd if (!imD2d)
unloadBtn.setEnabled(false); // FixMark:nearByStnCompSnd
} else if (editGraphOn) { } else if (editGraphOn) {
graphEditBtn.setText(EDIT_GRAPH_ON); graphEditBtn.setText(EDIT_GRAPH_ON);
dataEditBtn.setEnabled(false); dataEditBtn.setEnabled(false);
@ -264,7 +268,8 @@ public class NsharpPaletteWindow extends ViewPart implements SelectionListener,
interpBtn.setEnabled(false); interpBtn.setEnabled(false);
graphModeBtnIcing.setEnabled(false); graphModeBtnIcing.setEnabled(false);
graphModeBtnTurb.setEnabled(false); graphModeBtnTurb.setEnabled(false);
unloadBtn.setEnabled(false); // FixMark:nearByStnCompSnd if (!imD2d)
unloadBtn.setEnabled(false); // FixMark:nearByStnCompSnd
} }
} else if (currentGraphMode == NsharpConstants.GRAPH_TURB) { } else if (currentGraphMode == NsharpConstants.GRAPH_TURB) {
@ -377,7 +382,7 @@ public class NsharpPaletteWindow extends ViewPart implements SelectionListener,
public NsharpPaletteWindow() { public NsharpPaletteWindow() {
super(); super();
instance = this; instance = this;
boolean imD2d = false; // fixMark:NcInventory //boolean imD2d = false; // fixMark:NcInventory
if (VizPerspectiveListener.getCurrentPerspectiveManager() != null) { if (VizPerspectiveListener.getCurrentPerspectiveManager() != null) {
if (VizPerspectiveListener.getCurrentPerspectiveManager() if (VizPerspectiveListener.getCurrentPerspectiveManager()
.getPerspectiveId().equals(D2D5Pane.ID_PERSPECTIVE)) { .getPerspectiveId().equals(D2D5Pane.ID_PERSPECTIVE)) {
@ -945,7 +950,8 @@ public class NsharpPaletteWindow extends ViewPart implements SelectionListener,
graphModeBtnIcing.setEnabled(false); graphModeBtnIcing.setEnabled(false);
interpBtn.setEnabled(false); interpBtn.setEnabled(false);
cfgBtn.setEnabled(false); cfgBtn.setEnabled(false);
unloadBtn.setEnabled(false);// FixMark:nearByStnCompSnd if (!imD2d)
unloadBtn.setEnabled(false);// FixMark:nearByStnCompSnd
} else { } else {
overlayIsOn = false; overlayIsOn = false;
overlayBtn.setText(OVLY_OFF); overlayBtn.setText(OVLY_OFF);
@ -958,7 +964,8 @@ public class NsharpPaletteWindow extends ViewPart implements SelectionListener,
graphModeBtnIcing.setEnabled(true); graphModeBtnIcing.setEnabled(true);
interpBtn.setEnabled(true); interpBtn.setEnabled(true);
cfgBtn.setEnabled(true); cfgBtn.setEnabled(true);
unloadBtn.setEnabled(true);// FixMark:nearByStnCompSnd if (!imD2d)
unloadBtn.setEnabled(true);// FixMark:nearByStnCompSnd
} }
NsharpResourceHandler rsc = getRscHandler(); NsharpResourceHandler rsc = getRscHandler();
if (rsc != null) { if (rsc != null) {
@ -1001,7 +1008,8 @@ public class NsharpPaletteWindow extends ViewPart implements SelectionListener,
graphModeBtnIcing.setEnabled(false); graphModeBtnIcing.setEnabled(false);
interpBtn.setEnabled(false); interpBtn.setEnabled(false);
cfgBtn.setEnabled(false); cfgBtn.setEnabled(false);
unloadBtn.setEnabled(false);// FixMark:nearByStnCompSnd if (!imD2d)
unloadBtn.setEnabled(false);// FixMark:nearByStnCompSnd
} else { } else {
compareStnIsOn = false; compareStnIsOn = false;
compareStnBtn.setText(COMP_STN_OFF); compareStnBtn.setText(COMP_STN_OFF);
@ -1014,7 +1022,8 @@ public class NsharpPaletteWindow extends ViewPart implements SelectionListener,
graphModeBtnIcing.setEnabled(true); graphModeBtnIcing.setEnabled(true);
interpBtn.setEnabled(true); interpBtn.setEnabled(true);
cfgBtn.setEnabled(true); cfgBtn.setEnabled(true);
unloadBtn.setEnabled(true);// FixMark:nearByStnCompSnd if (!imD2d)
unloadBtn.setEnabled(true);// FixMark:nearByStnCompSnd
} }
NsharpResourceHandler rsc = getRscHandler(); NsharpResourceHandler rsc = getRscHandler();
if (rsc != null) { if (rsc != null) {
@ -1059,7 +1068,8 @@ public class NsharpPaletteWindow extends ViewPart implements SelectionListener,
graphModeBtnIcing.setEnabled(false); graphModeBtnIcing.setEnabled(false);
interpBtn.setEnabled(false); interpBtn.setEnabled(false);
cfgBtn.setEnabled(false); cfgBtn.setEnabled(false);
unloadBtn.setEnabled(false);// FixMark:nearByStnCompSnd if (!imD2d)
unloadBtn.setEnabled(false);// FixMark:nearByStnCompSnd
} else { } else {
compareTmIsOn = false; compareTmIsOn = false;
compareTmBtn.setText(COMP_TM_OFF); compareTmBtn.setText(COMP_TM_OFF);
@ -1072,7 +1082,8 @@ public class NsharpPaletteWindow extends ViewPart implements SelectionListener,
graphModeBtnIcing.setEnabled(true); graphModeBtnIcing.setEnabled(true);
interpBtn.setEnabled(true); interpBtn.setEnabled(true);
cfgBtn.setEnabled(true); cfgBtn.setEnabled(true);
unloadBtn.setEnabled(true);// FixMark:nearByStnCompSnd if (!imD2d)
unloadBtn.setEnabled(true);// FixMark:nearByStnCompSnd
} }
NsharpResourceHandler rsc = getRscHandler(); NsharpResourceHandler rsc = getRscHandler();
if (rsc != null) { if (rsc != null) {
@ -1115,7 +1126,8 @@ public class NsharpPaletteWindow extends ViewPart implements SelectionListener,
graphModeBtnIcing.setEnabled(false); graphModeBtnIcing.setEnabled(false);
interpBtn.setEnabled(false); interpBtn.setEnabled(false);
cfgBtn.setEnabled(false); cfgBtn.setEnabled(false);
unloadBtn.setEnabled(false);// FixMark:nearByStnCompSnd if (!imD2d)
unloadBtn.setEnabled(false);// FixMark:nearByStnCompSnd
} else { } else {
compareSndIsOn = false; compareSndIsOn = false;
compareSndBtn.setText(COMP_SND_OFF); compareSndBtn.setText(COMP_SND_OFF);
@ -1128,7 +1140,8 @@ public class NsharpPaletteWindow extends ViewPart implements SelectionListener,
graphModeBtnIcing.setEnabled(true); graphModeBtnIcing.setEnabled(true);
interpBtn.setEnabled(true); interpBtn.setEnabled(true);
cfgBtn.setEnabled(true); cfgBtn.setEnabled(true);
unloadBtn.setEnabled(true);// FixMark:nearByStnCompSnd if (!imD2d)
unloadBtn.setEnabled(true);// FixMark:nearByStnCompSnd
} }
NsharpResourceHandler rsc = getRscHandler(); NsharpResourceHandler rsc = getRscHandler();
if (rsc != null) { if (rsc != null) {
@ -1187,7 +1200,8 @@ public class NsharpPaletteWindow extends ViewPart implements SelectionListener,
compareSndBtn.setEnabled(true); compareSndBtn.setEnabled(true);
compareStnBtn.setEnabled(true); compareStnBtn.setEnabled(true);
overlayBtn.setEnabled(true); overlayBtn.setEnabled(true);
unloadBtn.setEnabled(true);// FixMark:nearByStnCompSnd if (!imD2d)
unloadBtn.setEnabled(true);// FixMark:nearByStnCompSnd
} }
} else { } else {
editGraphOn = true; editGraphOn = true;
@ -1200,7 +1214,8 @@ public class NsharpPaletteWindow extends ViewPart implements SelectionListener,
compareSndBtn.setEnabled(false); compareSndBtn.setEnabled(false);
compareStnBtn.setEnabled(false); compareStnBtn.setEnabled(false);
overlayBtn.setEnabled(false); overlayBtn.setEnabled(false);
unloadBtn.setEnabled(false);// FixMark:nearByStnCompSnd if (!imD2d)
unloadBtn.setEnabled(false);// FixMark:nearByStnCompSnd
} }
NsharpResourceHandler rsc = getRscHandler(); NsharpResourceHandler rsc = getRscHandler();
if (rsc != null) { if (rsc != null) {

View file

@ -840,7 +840,7 @@
<Color red="255" green="255" blue="0" alpha="255"/> <Color red="255" green="255" blue="0" alpha="255"/>
<Point Lat="39.35390746604257" Lon="-73.2133975036754"/> <Point Lat="39.35390746604257" Lon="-73.2133975036754"/>
</Vector> </Vector>
<Track skipFactorTextString="0" setTimeButtonSelected="true" pgenType="STORM_TRACK" pgenCategory="Track" lineWidth="1.0" intervalTimeTextString="01:00" intervalComboSelectedIndex="2" initialMarker="FILLED_DIAMOND" initialLinePattern="LINE_SOLID" fontStyleComboSelectedIndex="2" fontSizeComboSelectedIndex="2" fontSize="14.0" fontNameComboSelectedIndex="0" fontName="Courier" extrapMarker="FILLED_TRIANGLE" extrapLinePattern="LINE_SOLID" extraPointTimeDisplayOptionName="SKIP_FACTOR"> <Track skipFactorTextString="0" setTimeButtonSelected="true" pgenType="STORM_TRACK" pgenCategory="Track" lineWidth="1.0" intervalTimeTextString="00:30" intervalComboSelectedIndex="2" initialMarker="FILLED_DIAMOND" initialLinePattern="LINE_SOLID" fontStyleComboSelectedIndex="1" fontStyle="BOLD" fontSizeComboSelectedIndex="2" fontSize="14.0" fontNameComboSelectedIndex="0" fontName="Courier" extrapMarker="FILLED_TRIANGLE" extrapLinePattern="LINE_SOLID" extraPointTimeDisplayOptionName="SKIP_FACTOR">
<initialColor> <initialColor>
<Color red="255" green="0" blue="0" alpha="255"/> <Color red="255" green="0" blue="0" alpha="255"/>
</initialColor> </initialColor>

View file

@ -803,7 +803,7 @@
<Color red="255" green="255" blue="0" alpha="255"/> <Color red="255" green="255" blue="0" alpha="255"/>
<Point Lat="39.35390746604257" Lon="-73.2133975036754"/> <Point Lat="39.35390746604257" Lon="-73.2133975036754"/>
</Vector> </Vector>
<Track skipFactorTextString="0" setTimeButtonSelected="true" pgenType="STORM_TRACK" pgenCategory="Track" lineWidth="1.0" intervalTimeTextString="01:00" intervalComboSelectedIndex="2" initialMarker="FILLED_DIAMOND" initialLinePattern="LINE_SOLID" fontStyleComboSelectedIndex="2" fontSizeComboSelectedIndex="2" fontSize="14.0" fontNameComboSelectedIndex="0" fontName="Courier" extrapMarker="FILLED_TRIANGLE" extrapLinePattern="LINE_SOLID" extraPointTimeDisplayOptionName="SKIP_FACTOR"> <Track skipFactorTextString="0" setTimeButtonSelected="true" pgenType="STORM_TRACK" pgenCategory="Track" lineWidth="1.0" intervalTimeTextString="00:30" intervalComboSelectedIndex="2" initialMarker="FILLED_DIAMOND" initialLinePattern="LINE_SOLID" fontStyleComboSelectedIndex="1" fontStyle="BOLD" fontSizeComboSelectedIndex="2" fontSize="14.0" fontNameComboSelectedIndex="0" fontName="Courier" extrapMarker="FILLED_TRIANGLE" extrapLinePattern="LINE_SOLID" extraPointTimeDisplayOptionName="SKIP_FACTOR">
<initialColor> <initialColor>
<Color red="255" green="0" blue="0" alpha="255"/> <Color red="255" green="0" blue="0" alpha="255"/>
</initialColor> </initialColor>

View file

@ -18,6 +18,7 @@
E. Safford/SAIC 06/07 rm "...UPDT TO CANCEL..." E. Safford/SAIC 06/07 rm "...UPDT TO CANCEL..."
B. Yin/SAIC 02/08 add tag number after cancellation B. Yin/SAIC 02/08 add tag number after cancellation
B. Yin 12/11 added new line for 'New' or 'Cor' B. Yin 12/11 added new line for 'New' or 'Cor'
J. Wu 09/14 added new line for 'CAN'
--> -->
<xsl:template name="GetAttentionLine"> <xsl:template name="GetAttentionLine">
<xsl:param name="status"></xsl:param> <xsl:param name="status"></xsl:param>
@ -30,9 +31,11 @@
<xsl:choose> <xsl:choose>
<xsl:when test="contains( $airmet_outlook, 'AIRMET')"> <xsl:when test="contains( $airmet_outlook, 'AIRMET')">
<xsl:value-of select="$newline"/>
<xsl:text>CANCEL AIRMET. CONDS HV ENDED.</xsl:text> <xsl:text>CANCEL AIRMET. CONDS HV ENDED.</xsl:text>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:value-of select="$newline"/>
<xsl:text>CANCEL OUTLOOK.</xsl:text> <xsl:text>CANCEL OUTLOOK.</xsl:text>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>

View file

@ -20,6 +20,9 @@
B. Yin/SAIC 08/06 distinguish smear and outlook B. Yin/SAIC 08/06 distinguish smear and outlook
B. Yin/Chugach 12/11 changed 'Status' to 'issueType' B. Yin/Chugach 12/11 changed 'Status' to 'issueType'
changed for-each condition for smears changed for-each condition for smears
J. Wu/SGT 10/14 TTR 714 - go through all smears (airmets & outlooks) in
one loop since the input XML format is different from
those in NMAP2
--> -->
<xsl:template name="GetStatus"> <xsl:template name="GetStatus">
@ -27,8 +30,9 @@
<xsl:param name="haz2">NO HAZARD2</xsl:param> <xsl:param name="haz2">NO HAZARD2</xsl:param>
<xsl:param name="haz3">NO HAZARD3</xsl:param> <xsl:param name="haz3">NO HAZARD3</xsl:param>
<xsl:for-each select="//Gfa[(@hazard = $haz1 or @hazard = $haz2 or @hazard = $haz3) and contains(@fcstHr,'-') and @isOutlook='false']"> <!-- <xsl:for-each select="//Gfa[(@hazard = $haz1 or @hazard = $haz2 or @hazard = $haz3) and contains(@fcstHr,'-') and @isOutlook='false']">
-->
<xsl:for-each select="//Gfa[(@hazard = $haz1 or @hazard = $haz2 or @hazard = $haz3) and contains(@fcstHr,'-') ]">
<xsl:if test="contains( @hazard, $haz1 ) or contains( @hazard, $haz2 ) or contains( @hazard, $haz3 )"> <xsl:if test="contains( @hazard, $haz1 ) or contains( @hazard, $haz2 ) or contains( @hazard, $haz3 )">
<xsl:choose> <xsl:choose>
<xsl:when test="@issueType = 'CAN'"> <xsl:when test="@issueType = 'CAN'">
@ -47,7 +51,8 @@
</xsl:if> </xsl:if>
</xsl:for-each> </xsl:for-each>
<xsl:for-each select="//outlook"> <!--
<xsl:for-each select="//outlook">
<xsl:if test="contains( hazard, $haz1 ) or contains( hazard, $haz2 ) or contains( hazard, $haz3 )"> <xsl:if test="contains( hazard, $haz1 ) or contains( hazard, $haz2 ) or contains( hazard, $haz3 )">
<xsl:choose> <xsl:choose>
<xsl:when test="issueType = 'CAN'"> <xsl:when test="issueType = 'CAN'">
@ -65,7 +70,7 @@
</xsl:choose> </xsl:choose>
</xsl:if> </xsl:if>
</xsl:for-each> </xsl:for-each>
-->
</xsl:template> </xsl:template>
<!-- <!--

View file

@ -141,15 +141,14 @@
</xsl:element> </xsl:element>
</xsl:if> </xsl:if>
<xsl:if test="contains( @issueType, 'CAN' ) or not(string-length($freqSevStatement) > 1)"> <!-- <xsl:if test="contains( @issueType, 'CAN' ) or not(string-length($freqSevStatement) > 1)">
<xsl:value-of select="$newline"/> <xsl:value-of select="$newline"/>
<!-- <xsl:if test="string-length($airTag) > 1"> <xsl:if test="string-length($airTag) > 1">
<xsl:element name="line"> <xsl:element name="line">
<xsl:value-of select="$newline"/><xsl:value-of select="normalize-space($airTag)"/>.</xsl:element> <xsl:value-of select="$newline"/><xsl:value-of select="normalize-space($airTag)"/>.</xsl:element>
</xsl:if> </xsl:if>
-->
</xsl:if> </xsl:if>
-->
<!-- Add the attention line(s) --> <!-- Add the attention line(s) -->
<xsl:call-template name="GetAttentionLine"> <xsl:call-template name="GetAttentionLine">
<xsl:with-param name="status"><xsl:value-of select="@issueType"/></xsl:with-param> <xsl:with-param name="status"><xsl:value-of select="@issueType"/></xsl:with-param>

View file

@ -78,6 +78,7 @@ public abstract class AttrDlg extends Dialog implements IAttribute {
public static int ctrlBtnHeight = 28; public static int ctrlBtnHeight = 28;
// public static int ctrlBtnWidth = 90; // public static int ctrlBtnWidth = 90;
// public static int ctrlBtnHeight = 30; // public static int ctrlBtnHeight = 30;
/** /**
@ -128,11 +129,24 @@ public abstract class AttrDlg extends Dialog implements IAttribute {
this.getButton(IDialogConstants.CANCEL_ID).setEnabled(false); this.getButton(IDialogConstants.CANCEL_ID).setEnabled(false);
this.getButton(IDialogConstants.OK_ID).setEnabled(false); this.getButton(IDialogConstants.OK_ID).setEnabled(false);
this.getButton(IDialogConstants.CANCEL_ID).setLayoutData( setDefaultControlButtonSize();
new GridData(ctrlBtnWidth, ctrlBtnHeight)); }
this.getButton(IDialogConstants.OK_ID).setLayoutData(
new GridData(ctrlBtnWidth, ctrlBtnHeight));
/**
* Set default size for control buttons.
*/
public void setDefaultControlButtonSize() {
setButtonSize(ctrlBtnWidth, ctrlBtnHeight);
}
/**
* Set size for control buttons.
*/
public void setButtonSize(int width, int height) {
this.getButton(IDialogConstants.CANCEL_ID).setLayoutData(
new GridData(width, height));
this.getButton(IDialogConstants.OK_ID).setLayoutData(
new GridData(width, height));
} }
@Override @Override

View file

@ -3169,6 +3169,10 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
private PgenContoursTool tool = null; private PgenContoursTool tool = null;
private Contours prevCont = null;
private Contours nowCont = null;
private ContourMinmaxAttrDlg(Shell parShell) throws VizException { private ContourMinmaxAttrDlg(Shell parShell) throws VizException {
super(parShell); super(parShell);
@ -3238,11 +3242,54 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
if (apt instanceof PgenContoursTool) { if (apt instanceof PgenContoursTool) {
tool = (PgenContoursTool) apt; tool = (PgenContoursTool) apt;
} }
if (tool != null) { if (tool != null) {
tool.resetUndoRedoCount(); tool.resetUndoRedoCount();
PgenSession.getInstance().getCommandManager() PgenSession.getInstance().getCommandManager()
.addStackListener(tool); .addStackListener(tool);
} }
// set the lat/lon from the current symbol.
DrawableElement de = drawingLayer.getSelectedDE();
if (de != null && de.getParent() instanceof ContourMinmax
&& de instanceof Symbol) {
super.setLatitude(((Symbol) de).getLocation().y);
super.setLongitude(((Symbol) de).getLocation().x);
}
/*
* Reset the listenser.
*/
for (Listener ls : undoBtn.getListeners(SWT.MouseDown)) {
undoBtn.removeListener(SWT.MouseDown, ls);
}
undoBtn.addListener(SWT.MouseDown, new Listener() {
@Override
public void handleEvent(Event event) {
if (undoBtn.getText().equalsIgnoreCase(UNDO_SYMBOL)) {
undoBtn.setText(REDO_SYMBOL);
drawingLayer.getCommandMgr().undo();
} else if (undoBtn.getText().equalsIgnoreCase(REDO_SYMBOL)) {
undoBtn.setText(UNDO_SYMBOL);
drawingLayer.getCommandMgr().redo();
}
/*
* Reset the currentContours for the ContoursAttrDlg.
*/
currentContours = prevCont;
prevCont = nowCont;
nowCont = currentContours;
mapEditor.refresh();
}
});
} }
@Override @Override
@ -3252,6 +3299,10 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
PgenSession.getInstance().getCommandManager() PgenSession.getInstance().getCommandManager()
.removeStackListener(tool); .removeStackListener(tool);
} }
prevCont = null;
nowCont = null;
return super.close(); return super.close();
} }
@ -3262,15 +3313,34 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
protected void placeSymbol() { protected void placeSymbol() {
if (tool != null) { if (tool != null) {
if (tool.getMouseHandler() instanceof PgenContoursHandler) {
/*
* Keep a copy of currentConoturs for "Undo". It chnages
* after call the "tool".
*/
prevCont = currentContours;
((PgenContoursHandler) tool.getMouseHandler())
.drawContourMinmax(new Coordinate(Double
.parseDouble(longitudeText.getText()),
Double.parseDouble(latitudeText.getText())));
placeBtn.setEnabled(false);
nowCont = currentContours; // Keep a copy for "Redo"
undoBtn.setEnabled(true);
undoBtn.setText("Undo Symbol");
((PgenContoursHandler) tool.getMouseHandler()) } else if (tool.getMouseHandler() instanceof PgenSelectHandler) {
.drawContourMinmax(new Coordinate(Double minmaxTemplate = (gov.noaa.nws.ncep.ui.pgen.elements.Symbol) new DrawableElementFactory()
.parseDouble(longitudeText.getText()), Double .create(DrawableType.SYMBOL, (IAttribute) this,
.parseDouble(latitudeText.getText()))); "Symbol", getActiveSymbolObjType(),
placeBtn.setEnabled(false); (Coordinate) null, null);
undoBtn.setEnabled(true); contoursAttrSettings.put(getActiveSymbolObjType(),
undoBtn.setText("Undo Symbol"); minmaxTemplate);
updateMinmaxAttributes();
placeBtn.setEnabled(false);
}
} }
} }
} }
@ -3330,7 +3400,34 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
if (newEl != null && oldAdc.equals(de.getParent())) { if (newEl != null && oldAdc.equals(de.getParent())) {
newEl.setParent(newAdc); newEl.setParent(newAdc);
if (newEl instanceof Symbol) { if (newEl instanceof Symbol) {
if (minmaxAttrDlg != null
&& minmaxAttrDlg.getShell() != null) {
if (minmaxAttrDlg.latitudeText.isEnabled()
&& minmaxAttrDlg.longitudeText
.isEnabled()) {
ArrayList<Coordinate> loc = new ArrayList<Coordinate>();
double lat = ((Symbol) newEl).getLocation().y;
double lon = ((Symbol) newEl).getLocation().x;
try {
lon = Double
.valueOf(minmaxAttrDlg.longitudeText
.getText());
lat = Double
.valueOf(minmaxAttrDlg.latitudeText
.getText());
} catch (Exception e) {
lon = ((Symbol) newEl).getLocation().x;
lat = ((Symbol) newEl).getLocation().y;
}
loc.add(new Coordinate(lon, lat));
newEl.setPoints(loc);
}
}
((DECollection) newAdc) ((DECollection) newAdc)
.replace(((ContourMinmax) newAdc) .replace(((ContourMinmax) newAdc)
.getSymbol(), newEl); .getSymbol(), newEl);
@ -3338,6 +3435,8 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
((ContourMinmax) newAdc).getSymbol().update( ((ContourMinmax) newAdc).getSymbol().update(
minmaxTemplate); minmaxTemplate);
((ContourMinmax) newAdc).getLabel().setAuto(true);
} }
} }
@ -3926,4 +4025,15 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
return typeChanged; return typeChanged;
} }
/**
* Update lat/lon and Undo button on SymbolAttrDlg.
*/
public void updateSymbolAttrOnGUI(Coordinate loc) {
if (minmaxAttrDlg != null && minmaxAttrDlg.getShell() != null) {
minmaxAttrDlg.setLatitude(loc.y);
minmaxAttrDlg.setLongitude(loc.x);
minmaxAttrDlg.enableUndoBtn(true);
}
}
} }

View file

@ -68,9 +68,6 @@ import com.raytheon.uf.viz.core.exception.VizException;
*/ */
public class GfaFormatAttrDlg extends AttrDlg { public class GfaFormatAttrDlg extends AttrDlg {
// private final static Logger logger =
// Logger.getLogger(GfaFormatAttrDlg.class);
private static final String ZULU = "ZULU"; private static final String ZULU = "ZULU";
private static final String TANGO = "TANGO"; private static final String TANGO = "TANGO";
@ -151,7 +148,6 @@ public class GfaFormatAttrDlg extends AttrDlg {
instance = new GfaFormatAttrDlg(parShell); instance = new GfaFormatAttrDlg(parShell);
} catch (VizException e) { } catch (VizException e) {
// logger.error(e);
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -306,12 +302,14 @@ public class GfaFormatAttrDlg extends AttrDlg {
@Override @Override
public void createButtonsForButtonBar(Composite parent) { public void createButtonsForButtonBar(Composite parent) {
super.createButtonsForButtonBar(parent); super.createButtonsForButtonBar(parent);
this.getButton( OK_ID ).setText( SAVE_LABEL ); this.getButton(OK_ID).setText(SAVE_LABEL);
this.getButton( CANCEL_ID).setText( CANCEL_LABEL ); this.getButton(CANCEL_ID).setText(CANCEL_LABEL);
}
// createButton(parent, OK_ID, SAVE_LABEL, true); @Override
// createButton(parent, CANCEL_ID, CANCEL_LABEL, false); public void setDefaultControlButtonSize() {
setButtonSize(ctrlBtnWidth + 50, ctrlBtnHeight);
} }
@Override @Override

View file

@ -69,9 +69,27 @@ public class DefaultElementContainer extends AbstractElementContainer {
public void draw(IGraphicsTarget target, PaintProperties paintProps, public void draw(IGraphicsTarget target, PaintProperties paintProps,
DisplayProperties dprops, boolean needsCreate) { DisplayProperties dprops, boolean needsCreate) {
if ((displayEls == null) || paintProps.isZooming()) /*
* For ghost drawing - "needsCreate && dprops == null" - It is always on
* the active layer so DiaplayProperties' "filled" should be true while
* "monoColor" should be false (using the element's color).
*/
if (needsCreate && dprops == null) {
dprops = new DisplayProperties(false, null, true);
}
// For normal drawing........
if ((displayEls == null) || paintProps.isZooming()) {
needsCreate = true; needsCreate = true;
/*
* TTR971 - needs to set display properties, otherwise the layer
* color may not take effect (e.g., after switching projection)
*/
def.setLayerDisplayAttr(dprops.getLayerMonoColor(),
dprops.getLayerColor(), dprops.getLayerFilled());
}
if (paintProps.getZoomLevel() != zoomLevel) { if (paintProps.getZoomLevel() != zoomLevel) {
needsCreate = true; needsCreate = true;
zoomLevel = paintProps.getZoomLevel(); zoomLevel = paintProps.getZoomLevel();
@ -102,5 +120,4 @@ public class DefaultElementContainer extends AbstractElementContainer {
} }
} }
} }

View file

@ -143,6 +143,9 @@ import com.vividsolutions.jts.operation.distance.DistanceOp;
* 05/14 TTR 995 J. Wu Make contour label auto-placement an option. * 05/14 TTR 995 J. Wu Make contour label auto-placement an option.
* 07/14 ? B. Yin Added support for dashed-line circle for TCM 12 feet sea. * 07/14 ? B. Yin Added support for dashed-line circle for TCM 12 feet sea.
* 08/14 ? B. Yin Fixed world wrap for TCM track and zero circle issues. * 08/14 ? B. Yin Fixed world wrap for TCM track and zero circle issues.
* 08/14 TTR972 J. Wu Draw filled object as filled only if either its layer's "filled" flag
* "true" or they are on the active layer, .
* 09/14 TTR750 J. Wu Draw track label with specified font styles.
* </pre> * </pre>
* *
* @author sgilbert * @author sgilbert
@ -524,6 +527,7 @@ public class DisplayElementFactory {
if (isFilled) { if (isFilled) {
list.add(createFill(pts)); list.add(createFill(pts));
} }
/* /*
* Compile each IWireframeShape, create its LineDisplayElement, and add * Compile each IWireframeShape, create its LineDisplayElement, and add
* to IDisplayable return list * to IDisplayable return list
@ -1814,7 +1818,8 @@ public class DisplayElementFactory {
double major = Math.sqrt((diff[0] * diff[0]) + (diff[1] * diff[1])); double major = Math.sqrt((diff[0] * diff[0]) + (diff[1] * diff[1]));
double minor = major * arc.getAxisRatio(); double minor = major * arc.getAxisRatio();
if (major / this.screenToExtent < 0.000001) { // ignore circles with major = 0 if (major / this.screenToExtent < 0.000001) { // ignore circles with
// major = 0
return slist; return slist;
} }
@ -2035,8 +2040,9 @@ public class DisplayElementFactory {
Text txt = new Text(null, track.getFontName(), Text txt = new Text(null, track.getFontName(),
track.getFontSize(), TextJustification.LEFT_JUSTIFY, track.getFontSize(), TextJustification.LEFT_JUSTIFY,
pt.getLocation(), 0.0, TextRotation.SCREEN_RELATIVE, pt.getLocation(), 0.0, TextRotation.SCREEN_RELATIVE,
new String[] { dtime }, FontStyle.BOLD, iniDspClr, 0, new String[] { dtime }, track.getFontStyle(),
3, false, DisplayType.NORMAL, "Text", "General Text"); iniDspClr, 0, 3, false, DisplayType.NORMAL, "Text",
"General Text");
temps = createDisplayElements((IText) txt, paintProps); temps = createDisplayElements((IText) txt, paintProps);
slist.addAll(temps); slist.addAll(temps);
} }
@ -2093,8 +2099,9 @@ public class DisplayElementFactory {
Text txt = new Text(null, track.getFontName(), Text txt = new Text(null, track.getFontName(),
track.getFontSize(), TextJustification.LEFT_JUSTIFY, track.getFontSize(), TextJustification.LEFT_JUSTIFY,
pt.getLocation(), 0.0, TextRotation.SCREEN_RELATIVE, pt.getLocation(), 0.0, TextRotation.SCREEN_RELATIVE,
new String[] { dtime }, FontStyle.BOLD, expDspClr, 0, new String[] { dtime }, track.getFontStyle(),
3, false, DisplayType.NORMAL, "Text", "General Text"); expDspClr, 0, 3, false, DisplayType.NORMAL, "Text",
"General Text");
temps = createDisplayElements((IText) txt, paintProps); temps = createDisplayElements((IText) txt, paintProps);
slist.addAll(temps); slist.addAll(temps);
} }
@ -4814,10 +4821,22 @@ public class DisplayElementFactory {
*/ */
private boolean getDisplayFillMode(Boolean filled) { private boolean getDisplayFillMode(Boolean filled) {
if (layerFilled) { /*
return layerFilled; * if (layerFilled) { return layerFilled; } else { return filled; }
*/
/*
* TTR 972 - to match NMAP2 behavior, non-filled elements will always be
* drawn as non-filled. Filled objects should be drawn as filled only
* when the "filled" flag for its layer is set to "true" or they are on
* the active layer, so it is necessary to set the "layerFilled" flag to
* true before generating displayables for such objects (see
* PgenResource.drawFilledElement()).
*/
if (filled && layerFilled) {
return true;
} else { } else {
return filled; return false;
} }
} }

View file

@ -7,118 +7,134 @@
*/ */
package gov.noaa.nws.ncep.ui.pgen.display; package gov.noaa.nws.ncep.ui.pgen.display;
import gov.noaa.nws.ncep.ui.pgen.display.IText.FontStyle;
import java.awt.Color; import java.awt.Color;
import java.util.Calendar; import java.util.Calendar;
import gov.noaa.nws.ncep.ui.pgen.display.IText.FontStyle;
/** /**
* Interface used to get specific attributes of a PGEN Storm track object. * Interface used to get specific attributes of a PGEN Storm track object.
*
* @author sgilbert * @author sgilbert
* *
*/ */
public interface ITrack extends ILine{ public interface ITrack extends ILine {
/** /**
* this enum stores the time display options for extra points * this enum stores the time display options for extra points
*/ */
public static enum ExtraPointTimeDisplayOption { SKIP_FACTOR, SHOW_FIRST_LAST, ON_ONE_HOUR, ON_HALF_HOUR }; public static enum ExtraPointTimeDisplayOption {
SKIP_FACTOR, SHOW_FIRST_LAST, ON_ONE_HOUR, ON_HALF_HOUR
// /** };
// * Defines available font styles
// * @return font style
// */
// public static enum FontStyle {
// REGULAR, BOLD, ITALIC, BOLD_ITALIC
// }
/** /**
* Gets a font style for text of track points * Gets a font style for text of track points
*/ */
public FontStyle getFontStyle() ; public FontStyle getFontStyle();
/** /**
* Fets a boolean array that indicates if a time text of a extra point should be skipped * Fets a boolean array that indicates if a time text of a extra point
*/ * should be skipped
public boolean[] getExtraPointTimeTextDisplayIndicator(); */
public boolean[] getExtraPointTimeTextDisplayIndicator();
/** /**
* Gets extra point time display option * Gets extra point time display option
*/ */
public ExtraPointTimeDisplayOption getExtraPointTimeDisplayOption(); public ExtraPointTimeDisplayOption getExtraPointTimeDisplayOption();
/** /**
* Gets color to plot the initial storm points * Gets color to plot the initial storm points
* @return color *
*/ * @return color
public Color getInitialColor(); */
public Color getInitialColor();
/** /**
* Gets the line pattern used to display the initial storm points * Gets the line pattern used to display the initial storm points
* @return line pattern *
*/ * @return line pattern
public String getInitialLinePattern(); */
public String getInitialLinePattern();
/** /**
* Gets the marker used to display the initial storm points * Gets the marker used to display the initial storm points
* @return marker type *
*/ * @return marker type
public String getInitialMarker(); */
public String getInitialMarker();
/** /**
* Gets the initial storm points and associated date/times * Gets the initial storm points and associated date/times
* @return track points *
*/ * @return track points
public TrackPoint[] getInitialPoints(); */
public TrackPoint[] getInitialPoints();
/** /**
* Gets color to plot the extrapolated storm points * Gets color to plot the extrapolated storm points
* @return color *
*/ * @return color
public Color getExtrapColor(); */
public Color getExtrapColor();
/** /**
* Gets the line pattern used to display the extrapolated storm points * Gets the line pattern used to display the extrapolated storm points
* @return line pattern *
*/ * @return line pattern
public String getExtrapLinePattern(); */
public String getExtrapLinePattern();
/** /**
* Gets the marker used to display the extrapolated storm points * Gets the marker used to display the extrapolated storm points
* @return marker type *
*/ * @return marker type
public String getExtrapMarker(); */
public String getExtrapMarker();
/** /**
* Gets the extrapolated storm points and associated date/times * Gets the extrapolated storm points and associated date/times
* @return track points *
*/ * @return track points
public TrackPoint[] getExtrapPoints(); */
public TrackPoint[] getExtrapPoints();
/** /**
* Gets the font used to display the location times * Gets the font used to display the location times
* @return font name *
*/ * @return font name
public String getFontName(); */
public String getFontName();
/** /**
* Gets the size of the font * Gets the size of the font
* @return font size *
*/ * @return font size
public float getFontSize(); */
public float getFontSize();
public Calendar getFirstTimeCalendar(); public Calendar getFirstTimeCalendar();
public Calendar getSecondTimeCalendar();
public boolean isSetTimeButtonSelected();
public int getExtraDrawingPointNumber();
public FontStyle getStyle();
public String getSkipFactorText();
public int getFontNameComboSelectedIndex();
public int getFontSizeComboSelectedIndex();
public int getFontStyleComboSelectedIndex();
public int getUnitComboSelectedIndex();
public int getRoundComboSelectedIndex();
public int getRoundDirComboSelectedIndex();
public String getIntervalTimeString();
} public Calendar getSecondTimeCalendar();
public boolean isSetTimeButtonSelected();
public int getExtraDrawingPointNumber();
public String getSkipFactorText();
public int getFontNameComboSelectedIndex();
public int getFontSizeComboSelectedIndex();
public int getFontStyleComboSelectedIndex();
public int getUnitComboSelectedIndex();
public int getRoundComboSelectedIndex();
public int getRoundDirComboSelectedIndex();
public String getIntervalTimeString();
}

View file

@ -15,59 +15,81 @@ import com.raytheon.uf.viz.core.map.IMapDescriptor;
/** /**
* An Element Container that can be used for most Symbol/Marker Elements. * An Element Container that can be used for most Symbol/Marker Elements.
* Recreation of the IDisplayable objects is only done if the layer DisplayProperties change. * Recreation of the IDisplayable objects is only done if the layer
* The raster images do not need to be recreated when panning or zooming. * DisplayProperties change. The raster images do not need to be recreated when
* panning or zooming.
*
* @author sgilbert * @author sgilbert
* *
*/ */
public class RasterElementContainer extends AbstractElementContainer { public class RasterElementContainer extends AbstractElementContainer {
private DisplayProperties saveProps = null; private DisplayProperties saveProps = null;
/** /**
* @param element * @param element
* @param mapDescriptor * @param mapDescriptor
* @param target * @param target
*/ */
public RasterElementContainer(DrawableElement element, public RasterElementContainer(DrawableElement element,
IMapDescriptor mapDescriptor, IGraphicsTarget target) { IMapDescriptor mapDescriptor, IGraphicsTarget target) {
super(element, mapDescriptor, target); super(element, mapDescriptor, target);
// //
} }
/* /*
* Draws to the given graphics target. Recreates the IDisplayable objects * Draws to the given graphics target. Recreates the IDisplayable objects if
* if the Layer properties change. * the Layer properties change.
* @see gov.noaa.nws.ncep.ui.pgen.display.AbstractTBNL#draw(com.raytheon.uf.viz.core.IGraphicsTarget, com.raytheon.uf.viz.core.drawables.PaintProperties) *
*/ * @see
@Override * gov.noaa.nws.ncep.ui.pgen.display.AbstractTBNL#draw(com.raytheon.uf.viz
public void draw(IGraphicsTarget target, PaintProperties paintProps, * .core.IGraphicsTarget,
DisplayProperties dprops) { * com.raytheon.uf.viz.core.drawables.PaintProperties)
draw(target, paintProps, dprops, false); */
} @Override
public void draw(IGraphicsTarget target, PaintProperties paintProps,
DisplayProperties dprops) {
draw(target, paintProps, dprops, false);
}
/* /*
* Draws to the given graphics target. Recreates the IDisplayable objects * Draws to the given graphics target. Recreates the IDisplayable objects if
* if the Layer properties change. * the Layer properties change.
* @see gov.noaa.nws.ncep.ui.pgen.display.AbstractTBNL#draw(com.raytheon.uf.viz.core.IGraphicsTarget, com.raytheon.uf.viz.core.drawables.PaintProperties, boolean) *
*/ * @see
@Override * gov.noaa.nws.ncep.ui.pgen.display.AbstractTBNL#draw(com.raytheon.uf.viz
public void draw(IGraphicsTarget target, PaintProperties paintProps, * .core.IGraphicsTarget,
DisplayProperties dprops, boolean needsCreate) { * com.raytheon.uf.viz.core.drawables.PaintProperties, boolean)
*/
@Override
public void draw(IGraphicsTarget target, PaintProperties paintProps,
DisplayProperties dprops, boolean needsCreate) {
if ( displayEls == null ) needsCreate = true; if (displayEls == null) {
needsCreate = true;
if ( (dprops != null) && ! dprops.equals(saveProps) ) { /*
def.setLayerDisplayAttr(dprops.getLayerMonoColor(), dprops.getLayerColor(), dprops.getLayerFilled()); * TTR971 - needs to set display properties, otherwise the layer
needsCreate = true; * color may not take effect (e.g., after switching projection)
} */
def.setLayerDisplayAttr(dprops.getLayerMonoColor(),
dprops.getLayerColor(), dprops.getLayerFilled());
}
if ( needsCreate ) createDisplayables(paintProps); if ((dprops != null) && !dprops.equals(saveProps)) {
saveProps = dprops; def.setLayerDisplayAttr(dprops.getLayerMonoColor(),
dprops.getLayerColor(), dprops.getLayerFilled());
needsCreate = true;
}
for ( IDisplayable each : displayEls ) { if (needsCreate)
each.draw(target, paintProps); createDisplayables(paintProps);
}
} saveProps = dprops;
for (IDisplayable each : displayEls) {
each.draw(target, paintProps);
}
}
} }

View file

@ -154,6 +154,14 @@ public class TextDisplayElement implements IDisplayable {
target.drawShadedRect(box, bg, 1.0, null); target.drawShadedRect(box, bg, 1.0, null);
} }
/*
* TTR 741 (10/2014) - Note, for single-line text, we could match it
* to Raytheon's text style. For multi-line text, we cannot match it
* to Raytheon's since it may add box, overline, underline to each
* line of text, not one single box, overline, or underline - so we
* may need to develop a new drawing method or ask Raytheon to
* provide support in GlTarget.
*/
switch (displayType) { switch (displayType) {
case NORMAL: case NORMAL:
@ -161,19 +169,40 @@ public class TextDisplayElement implements IDisplayable {
break; break;
case BOX: case BOX:
dstring.textStyle = TextStyle.BOXED; // dstring.textStyle = TextStyle.BOXED;
if (dstring.getText().length > 1) {
target.drawRect(box, dstring.getColors()[0], 1.0f, 1.0);
} else {
dstring.textStyle = TextStyle.BOXED;
}
// target.drawRect(box, dstring.getColors()[0], 1.0f, 1.0); // target.drawRect(box, dstring.getColors()[0], 1.0f, 1.0);
break; break;
case OVERLINE: case OVERLINE:
dstring.textStyle = TextStyle.OVERLINE; // dstring.textStyle = TextStyle.OVERLINE;
if (dstring.getText().length > 1) {
target.drawLine(box.getMinX(), box.getMinY(), 0.0,
box.getMaxX(), box.getMinY(), 0.0,
dstring.getColors()[0], 1.0f);
} else {
dstring.textStyle = TextStyle.OVERLINE;
}
// target.drawLine(box.getMinX(), box.getMinY(), 0.0, // target.drawLine(box.getMinX(), box.getMinY(), 0.0,
// box.getMaxX(), box.getMinY(), 0.0, // box.getMaxX(), box.getMinY(), 0.0,
// dstring.getColors()[0], 1.0f); // dstring.getColors()[0], 1.0f);
break; break;
case UNDERLINE: case UNDERLINE:
dstring.textStyle = TextStyle.UNDERLINE; // dstring.textStyle = TextStyle.UNDERLINE;
if (dstring.getText().length > 1) {
target.drawLine(box.getMinX(), box.getMaxY(), 0.0,
box.getMaxX(), box.getMaxY(), 0.0,
dstring.getColors()[0], 1.0f);
} else {
dstring.textStyle = TextStyle.UNDERLINE;
}
// target.drawLine(box.getMinX(), box.getMaxY(), 0.0, // target.drawLine(box.getMinX(), box.getMaxY(), 0.0,
// box.getMaxX(), box.getMaxY(), 0.0, // box.getMaxX(), box.getMaxY(), 0.0,
// dstring.getColors()[0], 1.0f); // dstring.getColors()[0], 1.0f);

View file

@ -134,6 +134,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* 12/13 TTR904 B. Yin Added back the water zone string for Watch county list * 12/13 TTR904 B. Yin Added back the water zone string for Watch county list
* 11/13 #1065 J. Wu Added Kink lines. * 11/13 #1065 J. Wu Added Kink lines.
* 05/14 TTR995 J. Wu Set Text's 'auto" flag to false. * 05/14 TTR995 J. Wu Set Text's 'auto" flag to false.
* 09/14 TTR716 J. Wu Use "-" for GFA Outlook's Vor text.
* *
* </pre> * </pre>
* *
@ -735,6 +736,12 @@ public class ProductConverter {
gfa.setGfaValue("Type", fgfa.getType()); gfa.setGfaValue("Type", fgfa.getType());
} }
// textVOR
String vorStr = fgfa.getTextVor();
if (vorStr != null) {
gfa.setGfaVorText(nvl(vorStr));
}
String cig = fgfa.getCig(); String cig = fgfa.getCig();
if (cig != null) { if (cig != null) {
gfa.setGfaValue(Gfa.CIG, fgfa.getCig()); gfa.setGfaValue(Gfa.CIG, fgfa.getCig());
@ -1098,7 +1105,11 @@ public class ProductConverter {
} }
// textVOR // textVOR
fgfa.setTextVor(nvl(((Gfa) de).getGfaVorText())); String vorStr = ((Gfa) de).getGfaVorText();
if (vorStr != null && ((Gfa) de).isOutlook()) {
vorStr = vorStr.replaceAll(" TO ", "-");
}
fgfa.setTextVor(nvl(vorStr));
fgfa.setFillPattern(nvl(((Gfa) de).getFillPattern() fgfa.setFillPattern(nvl(((Gfa) de).getFillPattern()
.name())); .name()));

View file

@ -5,11 +5,11 @@
// Generated on: 2009.05.28 at 02:35:15 PM EDT // Generated on: 2009.05.28 at 02:35:15 PM EDT
// //
package gov.noaa.nws.ncep.ui.pgen.file; package gov.noaa.nws.ncep.ui.pgen.file;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
@ -17,11 +17,13 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
/** /**
* <p>Java class for anonymous complex type. * <p>
* Java class for anonymous complex type.
* *
* <p>The following schema fragment specifies the expected content contained within this class. * <p>
* The following schema fragment specifies the expected content contained within
* this class.
* *
* <pre> * <pre>
* &lt;complexType> * &lt;complexType>
@ -38,6 +40,7 @@ import javax.xml.bind.annotation.XmlType;
* &lt;attribute name="extrapLinePattern" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;attribute name="extrapLinePattern" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;attribute name="extrapMarker" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;attribute name="extrapMarker" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;attribute name="fontName" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;attribute name="fontName" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;attribute name="fontStyle" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;attribute name="fontNameComboSelectedIndex" type="{http://www.w3.org/2001/XMLSchema}int" /> * &lt;attribute name="fontNameComboSelectedIndex" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;attribute name="fontSize" type="{http://www.w3.org/2001/XMLSchema}float" /> * &lt;attribute name="fontSize" type="{http://www.w3.org/2001/XMLSchema}float" />
* &lt;attribute name="fontSizeComboSelectedIndex" type="{http://www.w3.org/2001/XMLSchema}int" /> * &lt;attribute name="fontSizeComboSelectedIndex" type="{http://www.w3.org/2001/XMLSchema}int" />
@ -60,67 +63,84 @@ import javax.xml.bind.annotation.XmlType;
* *
*/ */
@XmlAccessorType(XmlAccessType.FIELD) @XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = { @XmlType(name = "", propOrder = { "initialColor", "extrapColor",
"initialColor", "initialPoints", "extrapPoints", "extraPointTimeTextDisplayIndicator" })
"extrapColor",
"initialPoints",
"extrapPoints",
"extraPointTimeTextDisplayIndicator"
})
@XmlRootElement(name = "Track") @XmlRootElement(name = "Track")
public class Track { public class Track {
@XmlElement(required = true) @XmlElement(required = true)
protected ColorType initialColor; protected ColorType initialColor;
@XmlElement(required = true) @XmlElement(required = true)
protected ColorType extrapColor; protected ColorType extrapColor;
@XmlElement(required = true) @XmlElement(required = true)
protected List<TrackPoint> initialPoints; protected List<TrackPoint> initialPoints;
@XmlElement(required = true) @XmlElement(required = true)
protected List<TrackPoint> extrapPoints; protected List<TrackPoint> extrapPoints;
@XmlElement(type = Boolean.class) @XmlElement(type = Boolean.class)
protected List<Boolean> extraPointTimeTextDisplayIndicator; protected List<Boolean> extraPointTimeTextDisplayIndicator;
@XmlAttribute @XmlAttribute
protected String extraPointTimeDisplayOptionName; protected String extraPointTimeDisplayOptionName;
@XmlAttribute @XmlAttribute
protected String extrapLinePattern; protected String extrapLinePattern;
@XmlAttribute @XmlAttribute
protected String extrapMarker; protected String extrapMarker;
@XmlAttribute @XmlAttribute
protected String fontName; protected String fontName;
@XmlAttribute
protected String fontStyle;
@XmlAttribute @XmlAttribute
protected Integer fontNameComboSelectedIndex; protected Integer fontNameComboSelectedIndex;
@XmlAttribute @XmlAttribute
protected Float fontSize; protected Float fontSize;
@XmlAttribute @XmlAttribute
protected Integer fontSizeComboSelectedIndex; protected Integer fontSizeComboSelectedIndex;
@XmlAttribute @XmlAttribute
protected Integer fontStyleComboSelectedIndex; protected Integer fontStyleComboSelectedIndex;
@XmlAttribute @XmlAttribute
protected String initialLinePattern; protected String initialLinePattern;
@XmlAttribute @XmlAttribute
protected String initialMarker; protected String initialMarker;
@XmlAttribute @XmlAttribute
protected Integer intervalComboSelectedIndex; protected Integer intervalComboSelectedIndex;
@XmlAttribute @XmlAttribute
protected String intervalTimeTextString; protected String intervalTimeTextString;
@XmlAttribute @XmlAttribute
protected Float lineWidth; protected Float lineWidth;
@XmlAttribute @XmlAttribute
protected String pgenCategory; protected String pgenCategory;
@XmlAttribute @XmlAttribute
protected String pgenType; protected String pgenType;
@XmlAttribute @XmlAttribute
protected Boolean setTimeButtonSelected; protected Boolean setTimeButtonSelected;
@XmlAttribute @XmlAttribute
protected String skipFactorTextString; protected String skipFactorTextString;
/** /**
* Gets the value of the initialColor property. * Gets the value of the initialColor property.
* *
* @return * @return possible object is {@link ColorType }
* possible object is
* {@link ColorType }
* *
*/ */
public ColorType getInitialColor() { public ColorType getInitialColor() {
@ -131,8 +151,7 @@ public class Track {
* Sets the value of the initialColor property. * Sets the value of the initialColor property.
* *
* @param value * @param value
* allowed object is * allowed object is {@link ColorType }
* {@link ColorType }
* *
*/ */
public void setInitialColor(ColorType value) { public void setInitialColor(ColorType value) {
@ -142,9 +161,7 @@ public class Track {
/** /**
* Gets the value of the extrapColor property. * Gets the value of the extrapColor property.
* *
* @return * @return possible object is {@link ColorType }
* possible object is
* {@link ColorType }
* *
*/ */
public ColorType getExtrapColor() { public ColorType getExtrapColor() {
@ -155,8 +172,7 @@ public class Track {
* Sets the value of the extrapColor property. * Sets the value of the extrapColor property.
* *
* @param value * @param value
* allowed object is * allowed object is {@link ColorType }
* {@link ColorType }
* *
*/ */
public void setExtrapColor(ColorType value) { public void setExtrapColor(ColorType value) {
@ -167,15 +183,16 @@ public class Track {
* Gets the value of the initialPoints property. * Gets the value of the initialPoints property.
* *
* <p> * <p>
* This accessor method returns a reference to the live list, * This accessor method returns a reference to the live list, not a
* not a snapshot. Therefore any modification you make to the * snapshot. Therefore any modification you make to the returned list will
* returned list will be present inside the JAXB object. * be present inside the JAXB object. This is why there is not a
* This is why there is not a <CODE>set</CODE> method for the initialPoints property. * <CODE>set</CODE> method for the initialPoints property.
* *
* <p> * <p>
* For example, to add a new item, do as follows: * For example, to add a new item, do as follows:
*
* <pre> * <pre>
* getInitialPoints().add(newItem); * getInitialPoints().add(newItem);
* </pre> * </pre>
* *
* *
@ -196,15 +213,16 @@ public class Track {
* Gets the value of the extrapPoints property. * Gets the value of the extrapPoints property.
* *
* <p> * <p>
* This accessor method returns a reference to the live list, * This accessor method returns a reference to the live list, not a
* not a snapshot. Therefore any modification you make to the * snapshot. Therefore any modification you make to the returned list will
* returned list will be present inside the JAXB object. * be present inside the JAXB object. This is why there is not a
* This is why there is not a <CODE>set</CODE> method for the extrapPoints property. * <CODE>set</CODE> method for the extrapPoints property.
* *
* <p> * <p>
* For example, to add a new item, do as follows: * For example, to add a new item, do as follows:
*
* <pre> * <pre>
* getExtrapPoints().add(newItem); * getExtrapPoints().add(newItem);
* </pre> * </pre>
* *
* *
@ -225,21 +243,22 @@ public class Track {
* Gets the value of the extraPointTimeTextDisplayIndicator property. * Gets the value of the extraPointTimeTextDisplayIndicator property.
* *
* <p> * <p>
* This accessor method returns a reference to the live list, * This accessor method returns a reference to the live list, not a
* not a snapshot. Therefore any modification you make to the * snapshot. Therefore any modification you make to the returned list will
* returned list will be present inside the JAXB object. * be present inside the JAXB object. This is why there is not a
* This is why there is not a <CODE>set</CODE> method for the extraPointTimeTextDisplayIndicator property. * <CODE>set</CODE> method for the extraPointTimeTextDisplayIndicator
* property.
* *
* <p> * <p>
* For example, to add a new item, do as follows: * For example, to add a new item, do as follows:
*
* <pre> * <pre>
* getExtraPointTimeTextDisplayIndicator().add(newItem); * getExtraPointTimeTextDisplayIndicator().add(newItem);
* </pre> * </pre>
* *
* *
* <p> * <p>
* Objects of the following type(s) are allowed in the list * Objects of the following type(s) are allowed in the list {@link Boolean }
* {@link Boolean }
* *
* *
*/ */
@ -253,9 +272,7 @@ public class Track {
/** /**
* Gets the value of the extraPointTimeDisplayOptionName property. * Gets the value of the extraPointTimeDisplayOptionName property.
* *
* @return * @return possible object is {@link String }
* possible object is
* {@link String }
* *
*/ */
public String getExtraPointTimeDisplayOptionName() { public String getExtraPointTimeDisplayOptionName() {
@ -266,8 +283,7 @@ public class Track {
* Sets the value of the extraPointTimeDisplayOptionName property. * Sets the value of the extraPointTimeDisplayOptionName property.
* *
* @param value * @param value
* allowed object is * allowed object is {@link String }
* {@link String }
* *
*/ */
public void setExtraPointTimeDisplayOptionName(String value) { public void setExtraPointTimeDisplayOptionName(String value) {
@ -277,9 +293,7 @@ public class Track {
/** /**
* Gets the value of the extrapLinePattern property. * Gets the value of the extrapLinePattern property.
* *
* @return * @return possible object is {@link String }
* possible object is
* {@link String }
* *
*/ */
public String getExtrapLinePattern() { public String getExtrapLinePattern() {
@ -290,8 +304,7 @@ public class Track {
* Sets the value of the extrapLinePattern property. * Sets the value of the extrapLinePattern property.
* *
* @param value * @param value
* allowed object is * allowed object is {@link String }
* {@link String }
* *
*/ */
public void setExtrapLinePattern(String value) { public void setExtrapLinePattern(String value) {
@ -301,9 +314,7 @@ public class Track {
/** /**
* Gets the value of the extrapMarker property. * Gets the value of the extrapMarker property.
* *
* @return * @return possible object is {@link String }
* possible object is
* {@link String }
* *
*/ */
public String getExtrapMarker() { public String getExtrapMarker() {
@ -314,8 +325,7 @@ public class Track {
* Sets the value of the extrapMarker property. * Sets the value of the extrapMarker property.
* *
* @param value * @param value
* allowed object is * allowed object is {@link String }
* {@link String }
* *
*/ */
public void setExtrapMarker(String value) { public void setExtrapMarker(String value) {
@ -325,9 +335,7 @@ public class Track {
/** /**
* Gets the value of the fontName property. * Gets the value of the fontName property.
* *
* @return * @return possible object is {@link String }
* possible object is
* {@link String }
* *
*/ */
public String getFontName() { public String getFontName() {
@ -338,20 +346,38 @@ public class Track {
* Sets the value of the fontName property. * Sets the value of the fontName property.
* *
* @param value * @param value
* allowed object is * allowed object is {@link String }
* {@link String }
* *
*/ */
public void setFontName(String value) { public void setFontName(String value) {
this.fontName = value; this.fontName = value;
} }
/**
* Gets the value of the fontStyle property.
*
* @return possible object is {@link String }
*
*/
public String getFontStyle() {
return fontStyle;
}
/**
* Sets the value of the fontStyle property.
*
* @param value
* allowed object is {@link String }
*
*/
public void setFontStyle(String value) {
this.fontStyle = value;
}
/** /**
* Gets the value of the fontNameComboSelectedIndex property. * Gets the value of the fontNameComboSelectedIndex property.
* *
* @return * @return possible object is {@link Integer }
* possible object is
* {@link Integer }
* *
*/ */
public Integer getFontNameComboSelectedIndex() { public Integer getFontNameComboSelectedIndex() {
@ -362,8 +388,7 @@ public class Track {
* Sets the value of the fontNameComboSelectedIndex property. * Sets the value of the fontNameComboSelectedIndex property.
* *
* @param value * @param value
* allowed object is * allowed object is {@link Integer }
* {@link Integer }
* *
*/ */
public void setFontNameComboSelectedIndex(Integer value) { public void setFontNameComboSelectedIndex(Integer value) {
@ -373,9 +398,7 @@ public class Track {
/** /**
* Gets the value of the fontSize property. * Gets the value of the fontSize property.
* *
* @return * @return possible object is {@link Float }
* possible object is
* {@link Float }
* *
*/ */
public Float getFontSize() { public Float getFontSize() {
@ -386,8 +409,7 @@ public class Track {
* Sets the value of the fontSize property. * Sets the value of the fontSize property.
* *
* @param value * @param value
* allowed object is * allowed object is {@link Float }
* {@link Float }
* *
*/ */
public void setFontSize(Float value) { public void setFontSize(Float value) {
@ -397,9 +419,7 @@ public class Track {
/** /**
* Gets the value of the fontSizeComboSelectedIndex property. * Gets the value of the fontSizeComboSelectedIndex property.
* *
* @return * @return possible object is {@link Integer }
* possible object is
* {@link Integer }
* *
*/ */
public Integer getFontSizeComboSelectedIndex() { public Integer getFontSizeComboSelectedIndex() {
@ -410,8 +430,7 @@ public class Track {
* Sets the value of the fontSizeComboSelectedIndex property. * Sets the value of the fontSizeComboSelectedIndex property.
* *
* @param value * @param value
* allowed object is * allowed object is {@link Integer }
* {@link Integer }
* *
*/ */
public void setFontSizeComboSelectedIndex(Integer value) { public void setFontSizeComboSelectedIndex(Integer value) {
@ -421,9 +440,7 @@ public class Track {
/** /**
* Gets the value of the fontStyleComboSelectedIndex property. * Gets the value of the fontStyleComboSelectedIndex property.
* *
* @return * @return possible object is {@link Integer }
* possible object is
* {@link Integer }
* *
*/ */
public Integer getFontStyleComboSelectedIndex() { public Integer getFontStyleComboSelectedIndex() {
@ -434,8 +451,7 @@ public class Track {
* Sets the value of the fontStyleComboSelectedIndex property. * Sets the value of the fontStyleComboSelectedIndex property.
* *
* @param value * @param value
* allowed object is * allowed object is {@link Integer }
* {@link Integer }
* *
*/ */
public void setFontStyleComboSelectedIndex(Integer value) { public void setFontStyleComboSelectedIndex(Integer value) {
@ -445,9 +461,7 @@ public class Track {
/** /**
* Gets the value of the initialLinePattern property. * Gets the value of the initialLinePattern property.
* *
* @return * @return possible object is {@link String }
* possible object is
* {@link String }
* *
*/ */
public String getInitialLinePattern() { public String getInitialLinePattern() {
@ -458,8 +472,7 @@ public class Track {
* Sets the value of the initialLinePattern property. * Sets the value of the initialLinePattern property.
* *
* @param value * @param value
* allowed object is * allowed object is {@link String }
* {@link String }
* *
*/ */
public void setInitialLinePattern(String value) { public void setInitialLinePattern(String value) {
@ -469,9 +482,7 @@ public class Track {
/** /**
* Gets the value of the initialMarker property. * Gets the value of the initialMarker property.
* *
* @return * @return possible object is {@link String }
* possible object is
* {@link String }
* *
*/ */
public String getInitialMarker() { public String getInitialMarker() {
@ -482,8 +493,7 @@ public class Track {
* Sets the value of the initialMarker property. * Sets the value of the initialMarker property.
* *
* @param value * @param value
* allowed object is * allowed object is {@link String }
* {@link String }
* *
*/ */
public void setInitialMarker(String value) { public void setInitialMarker(String value) {
@ -493,9 +503,7 @@ public class Track {
/** /**
* Gets the value of the intervalComboSelectedIndex property. * Gets the value of the intervalComboSelectedIndex property.
* *
* @return * @return possible object is {@link Integer }
* possible object is
* {@link Integer }
* *
*/ */
public Integer getIntervalComboSelectedIndex() { public Integer getIntervalComboSelectedIndex() {
@ -506,8 +514,7 @@ public class Track {
* Sets the value of the intervalComboSelectedIndex property. * Sets the value of the intervalComboSelectedIndex property.
* *
* @param value * @param value
* allowed object is * allowed object is {@link Integer }
* {@link Integer }
* *
*/ */
public void setIntervalComboSelectedIndex(Integer value) { public void setIntervalComboSelectedIndex(Integer value) {
@ -517,9 +524,7 @@ public class Track {
/** /**
* Gets the value of the intervalTimeTextString property. * Gets the value of the intervalTimeTextString property.
* *
* @return * @return possible object is {@link String }
* possible object is
* {@link String }
* *
*/ */
public String getIntervalTimeTextString() { public String getIntervalTimeTextString() {
@ -530,8 +535,7 @@ public class Track {
* Sets the value of the intervalTimeTextString property. * Sets the value of the intervalTimeTextString property.
* *
* @param value * @param value
* allowed object is * allowed object is {@link String }
* {@link String }
* *
*/ */
public void setIntervalTimeTextString(String value) { public void setIntervalTimeTextString(String value) {
@ -541,9 +545,7 @@ public class Track {
/** /**
* Gets the value of the lineWidth property. * Gets the value of the lineWidth property.
* *
* @return * @return possible object is {@link Float }
* possible object is
* {@link Float }
* *
*/ */
public Float getLineWidth() { public Float getLineWidth() {
@ -554,8 +556,7 @@ public class Track {
* Sets the value of the lineWidth property. * Sets the value of the lineWidth property.
* *
* @param value * @param value
* allowed object is * allowed object is {@link Float }
* {@link Float }
* *
*/ */
public void setLineWidth(Float value) { public void setLineWidth(Float value) {
@ -565,9 +566,7 @@ public class Track {
/** /**
* Gets the value of the pgenCategory property. * Gets the value of the pgenCategory property.
* *
* @return * @return possible object is {@link String }
* possible object is
* {@link String }
* *
*/ */
public String getPgenCategory() { public String getPgenCategory() {
@ -578,8 +577,7 @@ public class Track {
* Sets the value of the pgenCategory property. * Sets the value of the pgenCategory property.
* *
* @param value * @param value
* allowed object is * allowed object is {@link String }
* {@link String }
* *
*/ */
public void setPgenCategory(String value) { public void setPgenCategory(String value) {
@ -589,9 +587,7 @@ public class Track {
/** /**
* Gets the value of the pgenType property. * Gets the value of the pgenType property.
* *
* @return * @return possible object is {@link String }
* possible object is
* {@link String }
* *
*/ */
public String getPgenType() { public String getPgenType() {
@ -602,8 +598,7 @@ public class Track {
* Sets the value of the pgenType property. * Sets the value of the pgenType property.
* *
* @param value * @param value
* allowed object is * allowed object is {@link String }
* {@link String }
* *
*/ */
public void setPgenType(String value) { public void setPgenType(String value) {
@ -613,9 +608,7 @@ public class Track {
/** /**
* Gets the value of the setTimeButtonSelected property. * Gets the value of the setTimeButtonSelected property.
* *
* @return * @return possible object is {@link Boolean }
* possible object is
* {@link Boolean }
* *
*/ */
public Boolean isSetTimeButtonSelected() { public Boolean isSetTimeButtonSelected() {
@ -626,8 +619,7 @@ public class Track {
* Sets the value of the setTimeButtonSelected property. * Sets the value of the setTimeButtonSelected property.
* *
* @param value * @param value
* allowed object is * allowed object is {@link Boolean }
* {@link Boolean }
* *
*/ */
public void setSetTimeButtonSelected(Boolean value) { public void setSetTimeButtonSelected(Boolean value) {
@ -637,9 +629,7 @@ public class Track {
/** /**
* Gets the value of the skipFactorTextString property. * Gets the value of the skipFactorTextString property.
* *
* @return * @return possible object is {@link String }
* possible object is
* {@link String }
* *
*/ */
public String getSkipFactorTextString() { public String getSkipFactorTextString() {
@ -650,8 +640,7 @@ public class Track {
* Sets the value of the skipFactorTextString property. * Sets the value of the skipFactorTextString property.
* *
* @param value * @param value
* allowed object is * allowed object is {@link String }
* {@link String }
* *
*/ */
public void setSkipFactorTextString(String value) { public void setSkipFactorTextString(String value) {

View file

@ -7,11 +7,17 @@
*/ */
package gov.noaa.nws.ncep.ui.pgen.file; package gov.noaa.nws.ncep.ui.pgen.file;
import gov.noaa.nws.ncep.ui.pgen.display.FillPatternList.FillPattern;
import gov.noaa.nws.ncep.ui.pgen.display.IText.FontStyle;
import gov.noaa.nws.ncep.ui.pgen.display.ITrack;
import gov.noaa.nws.ncep.ui.pgen.display.TrackPoint;
import gov.noaa.nws.ncep.ui.pgen.elements.Track;
import java.awt.Color;
import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
import java.util.List; import java.util.List;
import java.util.ArrayList;
import java.awt.Color;
import javax.xml.datatype.DatatypeConfigurationException; import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.DatatypeFactory;
@ -22,318 +28,423 @@ import org.geotools.referencing.datum.DefaultEllipsoid;
import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Coordinate;
import gov.noaa.nws.ncep.ui.pgen.elements.Track;
import gov.noaa.nws.ncep.ui.pgen.display.ITrack;
import gov.noaa.nws.ncep.ui.pgen.display.TrackPoint;
import gov.noaa.nws.ncep.ui.pgen.display.FillPatternList.FillPattern;
/** /**
* Define a ProductConverter Class - some methods to convert the products between XML format * Define a ProductConverter Class - some methods to convert the products
* and the actual in-memory PGEN products. * between XML format and the actual in-memory PGEN products.
* *
* <pre> * <pre>
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 02/2012 TTR456 Q. Zhou Added speed, dir. Default to kts, no round * 02/2012 TTR456 Q. Zhou Added speed, dir. Default to kts, no round
* 09/2014 TTR750 J. Wu Use FontStyle instead of "index".
* </pre> * </pre>
* */ * */
public class TrackConverter { public class TrackConverter {
// private final static org.apache.log4j.Logger log = // private final static org.apache.log4j.Logger log =
// org.apache.log4j.Logger.getLogger(TrackConverter.class); // org.apache.log4j.Logger.getLogger(TrackConverter.class);
/* /*
* Convert a XML file DrawableElement object to a list of PGEN in-memory * Convert a XML file DrawableElement object to a list of PGEN in-memory
* DrawableElement objects * DrawableElement objects
*/ */
public static List<Track> getTrackElementListByTrackBeanList ( public static List<Track> getTrackElementListByTrackBeanList(
List<gov.noaa.nws.ncep.ui.pgen.file.Track> trackBeanList) { List<gov.noaa.nws.ncep.ui.pgen.file.Track> trackBeanList) {
List<Track> trackElementList = new ArrayList<Track>(trackBeanList.size()); List<Track> trackElementList = new ArrayList<Track>(
trackBeanList.size());
for(gov.noaa.nws.ncep.ui.pgen.file.Track trackBean : trackBeanList) { for (gov.noaa.nws.ncep.ui.pgen.file.Track trackBean : trackBeanList) {
Track trackElement = new Track(); Track trackElement = new Track();
trackElement.setInitialColor(getColorByColorTypeBean(trackBean.initialColor, true)); trackElement.setInitialColor(getColorByColorTypeBean(
trackElement.setExtrapColor(getColorByColorTypeBean(trackBean.extrapColor, false)); trackBean.initialColor, true));
trackElement.setExtrapColor(getColorByColorTypeBean(
trackBean.extrapColor, false));
trackElement.setInitTrackPoints(getTrackPointElementListByTrackPointBeanList(trackBean.getInitialPoints()).toArray(new TrackPoint[trackBean.getInitialPoints().size()])); trackElement
trackElement.setExtrapPoints(getTrackPointElementListByTrackPointBeanList(trackBean.getExtrapPoints()).toArray(new TrackPoint[trackBean.getExtrapPoints().size()])); .setInitTrackPoints(getTrackPointElementListByTrackPointBeanList(
trackBean.getInitialPoints())
.toArray(
new TrackPoint[trackBean.getInitialPoints()
.size()]));
trackElement
.setExtrapPoints(getTrackPointElementListByTrackPointBeanList(
trackBean.getExtrapPoints()).toArray(
new TrackPoint[trackBean.getExtrapPoints().size()]));
/* /*
* Now initialize track's firstTimeCalendar and secondTimeCalendar using initTrackPoints * Now initialize track's firstTimeCalendar and secondTimeCalendar
*/ * using initTrackPoints
trackElement.setFirstTimeCalendar(getFirstOrSecondTimeCalendarByTrackBean(trackBean, true)); */
trackElement.setSecondTimeCalendar(getFirstOrSecondTimeCalendarByTrackBean(trackBean, false)); trackElement
.setFirstTimeCalendar(getFirstOrSecondTimeCalendarByTrackBean(
trackBean, true));
trackElement
.setSecondTimeCalendar(getFirstOrSecondTimeCalendarByTrackBean(
trackBean, false));
/* /*
* Important note: the following two method calls are necessary. * Important note: the following two method calls are necessary. 1.
* 1. combine init and extrap points to allow PgenSource to go over every point for drawing * combine init and extrap points to allow PgenSource to go over
* 2. setLinePattern is from the parent class of Track, the name is kind of misleading * every point for drawing 2. setLinePattern is from the parent
* It is hard coded now, for future, a new field is needed to the XSD file. * class of Track, the name is kind of misleading It is hard coded
*/ * now, for future, a new field is needed to the XSD file.
trackElement.setLinePointsValue(trackElement.getInitialPoints(), trackElement.getExtrapPoints()); */
trackElement.setLinePointsValue(trackElement.getInitialPoints(),
trackElement.getExtrapPoints());
trackElement.setExtraPointTimeTextDisplayIndicator(getBooleanArrayByBooleanList(trackBean.extraPointTimeTextDisplayIndicator)); trackElement
.setExtraPointTimeTextDisplayIndicator(getBooleanArrayByBooleanList(trackBean.extraPointTimeTextDisplayIndicator));
trackElement.setInitialLinePattern(trackBean.getInitialLinePattern()); trackElement.setInitialLinePattern(trackBean
trackElement.setExtrapLinePattern(trackBean.getExtrapLinePattern()); .getInitialLinePattern());
trackElement.setInitialMarker(trackBean.getInitialMarker()); trackElement.setExtrapLinePattern(trackBean.getExtrapLinePattern());
trackElement.setExtrapMarker(trackBean.getExtrapMarker()); trackElement.setInitialMarker(trackBean.getInitialMarker());
trackElement.setFontName(trackBean.getFontName()); trackElement.setExtrapMarker(trackBean.getExtrapMarker());
if(trackBean.getLineWidth() != null) trackElement.setFontName(trackBean.getFontName());
trackElement.setLineWidth(trackBean.getLineWidth().floatValue());
else
trackElement.setLineWidth((float)1.0); //set a 1.0 as the default value
if(trackBean.getFontSize() != null)
trackElement.setFontSize(trackBean.getFontSize().floatValue());
else
trackElement.setFontSize((float)2.0); //set a 2.0 as the default value
if(trackBean.getPgenCategory() == null) // TTR 950 - Font Style
trackElement.setPgenCategory(Track.TRACK_PGEN_CATEGORY); int styleInd = 0;
else FontStyle dstyle = FontStyle.BOLD;
trackElement.setPgenCategory(trackBean.getPgenCategory()); if (trackBean.getFontStyle() != null) {
int jj = 0;
for (FontStyle ft : FontStyle.values()) {
if (ft == FontStyle.valueOf(trackBean.getFontStyle()
.toUpperCase())) {
styleInd = jj;
dstyle = ft;
break;
}
if(trackBean.getPgenType() == null) jj++;
trackElement.setPgenType(Track.TRACK_PGEN_TYPE); }
else }
trackElement.setPgenType(trackBean.getPgenType());
/* trackElement.setFontStyle(dstyle);
* add speed, dir. Default to kts, no round --Quan trackElement.setFontStyleComboSelectedIndex(styleInd);
*/
TrackPoint[] initPts = trackElement.getInitTrackPoints();
int initPtsLength = initPts.length;
Coordinate initPointBeforeLastInitPointCoordinate = initPts[initPtsLength - 2].getLocation();
Coordinate lastInitPointCoordinate = initPts[initPtsLength - 1].getLocation();
GeodeticCalculator gc = new GeodeticCalculator(DefaultEllipsoid.WGS84); if (trackBean.getLineWidth() != null)
gc.setStartingGeographicPoint(initPointBeforeLastInitPointCoordinate.x, trackElement
initPointBeforeLastInitPointCoordinate.y); .setLineWidth(trackBean.getLineWidth().floatValue());
gc.setDestinationGeographicPoint(lastInitPointCoordinate.x, else
lastInitPointCoordinate.y); trackElement.setLineWidth((float) 1.0); // set a 1.0 as the
double direction = gc.getAzimuth(); // default value
if (trackBean.getFontSize() != null)
trackElement.setFontSize(trackBean.getFontSize().floatValue());
else
trackElement.setFontSize((float) 2.0); // set a 2.0 as the
// default value
double distanceInMeter = gc.getOrthodromicDistance(); if (trackBean.getPgenCategory() == null)
long timeDifference = initPts[initPtsLength - 1].getTime().getTimeInMillis() - trackElement.setPgenCategory(Track.TRACK_PGEN_CATEGORY);
initPts[initPtsLength - 2].getTime().getTimeInMillis(); else
double speed = distanceInMeter / (double)timeDifference; trackElement.setPgenCategory(trackBean.getPgenCategory());
trackElement.setDirectionForExtraPoints(direction); if (trackBean.getPgenType() == null)
trackElement.setSpeed(speed); trackElement.setPgenType(Track.TRACK_PGEN_TYPE);
else
trackElement.setPgenType(trackBean.getPgenType());
/* /*
* add something related to line drawing * add speed, dir. Default to kts, no round --Quan
*/ */
trackElement.setSizeScale((double) 1.0); TrackPoint[] initPts = trackElement.getInitTrackPoints();
trackElement.setSmoothFactor(0); int initPtsLength = initPts.length;
trackElement.setClosed(false); Coordinate initPointBeforeLastInitPointCoordinate = initPts[initPtsLength - 2]
trackElement.setFilled(false); .getLocation();
trackElement.setFillPattern(FillPattern.FILL_PATTERN_0); Coordinate lastInitPointCoordinate = initPts[initPtsLength - 1]
.getLocation();
/* GeodeticCalculator gc = new GeodeticCalculator(
* The following attributes are necessary to fill values for the pop-up DefaultEllipsoid.WGS84);
* TrackAttiDlg window from the restored line images. gc.setStartingGeographicPoint(
*/ initPointBeforeLastInitPointCoordinate.x,
boolean setTimeButtonSelectedFlag = true; // set the default value as TRUE initPointBeforeLastInitPointCoordinate.y);
if(trackBean.isSetTimeButtonSelected() != null) gc.setDestinationGeographicPoint(lastInitPointCoordinate.x,
setTimeButtonSelectedFlag = trackBean.isSetTimeButtonSelected().booleanValue(); lastInitPointCoordinate.y);
trackElement.setSetTimeButtonSelected(setTimeButtonSelectedFlag); double direction = gc.getAzimuth();
int intervalComboSelectedIndexValue = 0; //set the default value double distanceInMeter = gc.getOrthodromicDistance();
if(trackBean.getIntervalComboSelectedIndex() != null) long timeDifference = initPts[initPtsLength - 1].getTime()
intervalComboSelectedIndexValue = trackBean.getIntervalComboSelectedIndex().intValue(); .getTimeInMillis()
trackElement.setIntervalComboSelectedIndex(intervalComboSelectedIndexValue); - initPts[initPtsLength - 2].getTime().getTimeInMillis();
double speed = distanceInMeter / (double) timeDifference;
trackElement.setIntervalTimeString(trackBean.getIntervalTimeTextString()); trackElement.setDirectionForExtraPoints(direction);
trackElement.setSpeed(speed);
String extraPointTimeDisplayOptionName = ITrack.ExtraPointTimeDisplayOption.SKIP_FACTOR.name(); // set the default value /*
if(trackBean.getExtraPointTimeDisplayOptionName() != null) * add something related to line drawing
extraPointTimeDisplayOptionName = trackBean.getExtraPointTimeDisplayOptionName(); */
trackElement.setExtraPointTimeDisplayOption(ITrack.ExtraPointTimeDisplayOption.valueOf(extraPointTimeDisplayOptionName)); trackElement.setSizeScale((double) 1.0);
trackElement.setSmoothFactor(0);
trackElement.setClosed(false);
trackElement.setFilled(false);
trackElement.setFillPattern(FillPattern.FILL_PATTERN_0);
String skipFactorTextString = "0"; //set the default value /*
if(trackBean.getSkipFactorTextString() != null) * The following attributes are necessary to fill values for the
skipFactorTextString = trackBean.getSkipFactorTextString(); * pop-up TrackAttiDlg window from the restored line images.
trackElement.setSkipFactorTextString(skipFactorTextString); */
boolean setTimeButtonSelectedFlag = true; // set the default value
// as TRUE
if (trackBean.isSetTimeButtonSelected() != null)
setTimeButtonSelectedFlag = trackBean.isSetTimeButtonSelected()
.booleanValue();
trackElement.setSetTimeButtonSelected(setTimeButtonSelectedFlag);
int fontNameComboSelectedIndex = 0; //set the default value int intervalComboSelectedIndexValue = 0; // set the default value
if(trackBean.getFontNameComboSelectedIndex() != null) if (trackBean.getIntervalComboSelectedIndex() != null)
fontNameComboSelectedIndex = trackBean.getFontNameComboSelectedIndex().intValue(); intervalComboSelectedIndexValue = trackBean
trackElement.setFontNameComboSelectedIndex(fontNameComboSelectedIndex); .getIntervalComboSelectedIndex().intValue();
trackElement
.setIntervalComboSelectedIndex(intervalComboSelectedIndexValue);
int fontSizeComboSelectedIndex = 0; //set the default value trackElement.setIntervalTimeString(trackBean
if(trackBean.getFontSizeComboSelectedIndex() != null) .getIntervalTimeTextString());
fontSizeComboSelectedIndex = trackBean.getFontSizeComboSelectedIndex().intValue();
trackElement.setFontSizeComboSelectedIndex(fontSizeComboSelectedIndex);
int fontStyleComboSelectedIndex = 0; //set the default value String extraPointTimeDisplayOptionName = ITrack.ExtraPointTimeDisplayOption.SKIP_FACTOR
if(trackBean.getFontStyleComboSelectedIndex() != null) .name(); // set the default value
fontStyleComboSelectedIndex = trackBean.getFontStyleComboSelectedIndex().intValue(); if (trackBean.getExtraPointTimeDisplayOptionName() != null)
trackElement.setFontStyleComboSelectedIndex(fontStyleComboSelectedIndex); extraPointTimeDisplayOptionName = trackBean
.getExtraPointTimeDisplayOptionName();
trackElement
.setExtraPointTimeDisplayOption(ITrack.ExtraPointTimeDisplayOption
.valueOf(extraPointTimeDisplayOptionName));
trackElementList.add(trackElement); String skipFactorTextString = "0"; // set the default value
} if (trackBean.getSkipFactorTextString() != null)
skipFactorTextString = trackBean.getSkipFactorTextString();
trackElement.setSkipFactorTextString(skipFactorTextString);
int fontNameComboSelectedIndex = 0; // set the default value
if (trackBean.getFontNameComboSelectedIndex() != null)
fontNameComboSelectedIndex = trackBean
.getFontNameComboSelectedIndex().intValue();
trackElement
.setFontNameComboSelectedIndex(fontNameComboSelectedIndex);
int fontSizeComboSelectedIndex = 0; // set the default value
if (trackBean.getFontSizeComboSelectedIndex() != null)
fontSizeComboSelectedIndex = trackBean
.getFontSizeComboSelectedIndex().intValue();
trackElement
.setFontSizeComboSelectedIndex(fontSizeComboSelectedIndex);
trackElementList.add(trackElement);
}
return trackElementList; return trackElementList;
} }
public static gov.noaa.nws.ncep.ui.pgen.file.Track getTrackBeanByTrackElement( public static gov.noaa.nws.ncep.ui.pgen.file.Track getTrackBeanByTrackElement(
Track trackElement) { Track trackElement) {
gov.noaa.nws.ncep.ui.pgen.file.Track trackBean = new gov.noaa.nws.ncep.ui.pgen.file.Track(); gov.noaa.nws.ncep.ui.pgen.file.Track trackBean = new gov.noaa.nws.ncep.ui.pgen.file.Track();
trackBean.setInitialColor(getColorTypeBeanByColorElement(trackElement.getInitialColor())); trackBean.setInitialColor(getColorTypeBeanByColorElement(trackElement
trackBean.setExtrapColor(getColorTypeBeanByColorElement(trackElement.getExtrapColor())); .getInitialColor()));
trackBean.setExtrapColor(getColorTypeBeanByColorElement(trackElement
.getExtrapColor()));
if(trackElement.getInitialPoints() != null) { if (trackElement.getInitialPoints() != null) {
for(TrackPoint currentTrackPoint : trackElement.getInitialPoints()) { for (TrackPoint currentTrackPoint : trackElement.getInitialPoints()) {
trackBean.getInitialPoints().add(getTrackPointBeanByTrackPointElement(currentTrackPoint)); trackBean
} .getInitialPoints()
} .add(getTrackPointBeanByTrackPointElement(currentTrackPoint));
if(trackElement.getExtrapPoints() != null) { }
for(TrackPoint currentTrackPoint : trackElement.getExtrapPoints()) { }
trackBean.getExtrapPoints().add(getTrackPointBeanByTrackPointElement(currentTrackPoint)); if (trackElement.getExtrapPoints() != null) {
} for (TrackPoint currentTrackPoint : trackElement.getExtrapPoints()) {
} trackBean
.getExtrapPoints()
.add(getTrackPointBeanByTrackPointElement(currentTrackPoint));
}
}
trackBean.getExtraPointTimeTextDisplayIndicator().addAll(getBooleanObjectList(trackElement.getExtraPointTimeTextDisplayIndicator())); trackBean.getExtraPointTimeTextDisplayIndicator().addAll(
getBooleanObjectList(trackElement
.getExtraPointTimeTextDisplayIndicator()));
trackBean.setInitialLinePattern(trackElement.getInitialLinePattern()); trackBean.setInitialLinePattern(trackElement.getInitialLinePattern());
trackBean.setExtrapLinePattern(trackElement.getExtrapLinePattern()); trackBean.setExtrapLinePattern(trackElement.getExtrapLinePattern());
trackBean.setInitialMarker(trackElement.getInitialMarker()); trackBean.setInitialMarker(trackElement.getInitialMarker());
trackBean.setExtrapMarker(trackElement.getExtrapMarker()); trackBean.setExtrapMarker(trackElement.getExtrapMarker());
trackBean.setFontName(trackElement.getFontName()); trackBean.setFontName(trackElement.getFontName());
trackBean.setFontSize(new Float(trackElement.getFontSize()));
trackBean.setLineWidth(new Float(trackElement.getLineWidth()));
trackBean.setPgenCategory(trackElement.getPgenCategory()); // Font style
trackBean.setPgenType(trackElement.getPgenType()); int styleInd = 0;
FontStyle dstyle = FontStyle.BOLD;
if (trackElement.getFontStyle() != null) {
int jj = 0;
for (FontStyle ft : FontStyle.values()) {
if (ft == trackElement.getFontStyle()) {
styleInd = jj;
dstyle = ft;
break;
}
/* jj++;
* The following attributes are not necessary to save the line images }
* and late to restore them back on the map. However, they are necessary }
* values to pop-up and set up the correct attributes of the TrackAttrDlg
*/
trackBean.setSetTimeButtonSelected(new Boolean(trackElement.isSetTimeButtonSelected()));
trackBean.setIntervalComboSelectedIndex(new Integer(trackElement.getIntervalComboSelectedIndex()));
trackBean.setIntervalTimeTextString(trackElement.getIntervalTimeString());
trackBean.setExtraPointTimeDisplayOptionName(trackElement.getExtraPointTimeDisplayOption().name());
trackBean.setSkipFactorTextString(trackElement.getSkipFactorTextString());
trackBean.setFontNameComboSelectedIndex(new Integer(trackElement.getFontNameComboSelectedIndex()));
trackBean.setFontSizeComboSelectedIndex(new Integer(trackElement.getFontSizeComboSelectedIndex()));
trackBean.setFontStyleComboSelectedIndex(new Integer(trackElement.getFontStyleComboSelectedIndex()));
return trackBean; trackBean.setFontStyle(dstyle.toString());
trackBean.setFontStyleComboSelectedIndex(styleInd);
trackBean.setFontSize(new Float(trackElement.getFontSize()));
trackBean.setLineWidth(new Float(trackElement.getLineWidth()));
trackBean.setPgenCategory(trackElement.getPgenCategory());
trackBean.setPgenType(trackElement.getPgenType());
/*
* The following attributes are not necessary to save the line images
* and late to restore them back on the map. However, they are necessary
* values to pop-up and set up the correct attributes of the
* TrackAttrDlg
*/
trackBean.setSetTimeButtonSelected(new Boolean(trackElement
.isSetTimeButtonSelected()));
trackBean.setIntervalComboSelectedIndex(new Integer(trackElement
.getIntervalComboSelectedIndex()));
trackBean.setIntervalTimeTextString(trackElement
.getIntervalTimeString());
trackBean.setExtraPointTimeDisplayOptionName(trackElement
.getExtraPointTimeDisplayOption().name());
trackBean.setSkipFactorTextString(trackElement
.getSkipFactorTextString());
trackBean.setFontNameComboSelectedIndex(new Integer(trackElement
.getFontNameComboSelectedIndex()));
trackBean.setFontSizeComboSelectedIndex(new Integer(trackElement
.getFontSizeComboSelectedIndex()));
return trackBean;
} }
/* /*
* help methods for transferring objects back and forth between class objects and JAXB beans * help methods for transferring objects back and forth between class
* objects and JAXB beans
*/ */
private static Calendar getFirstOrSecondTimeCalendarByTrackBean(gov.noaa.nws.ncep.ui.pgen.file.Track trackBean, boolean isFirstTimeCalendar) { private static Calendar getFirstOrSecondTimeCalendarByTrackBean(
int indexOffSet = 1; gov.noaa.nws.ncep.ui.pgen.file.Track trackBean,
if(isFirstTimeCalendar) boolean isFirstTimeCalendar) {
indexOffSet++; int indexOffSet = 1;
List<TrackPoint> trackPointElementList = getTrackPointElementListByTrackPointBeanList(trackBean.getInitialPoints()); if (isFirstTimeCalendar)
if(trackPointElementList == null || trackPointElementList.size() < 2) { indexOffSet++;
// log.error("Retrieved List<TrackPoint> trackPointElementList is NULL or the initial points are less than 2 points"); List<TrackPoint> trackPointElementList = getTrackPointElementListByTrackPointBeanList(trackBean
return null; .getInitialPoints());
} if (trackPointElementList == null || trackPointElementList.size() < 2) {
int listSize = trackPointElementList.size(); // log.error("Retrieved List<TrackPoint> trackPointElementList is NULL or the initial points are less than 2 points");
return trackPointElementList.get(listSize - indexOffSet).getTime(); return null;
}
int listSize = trackPointElementList.size();
return trackPointElementList.get(listSize - indexOffSet).getTime();
} }
private static java.awt.Color getColorByColorTypeBean(gov.noaa.nws.ncep.ui.pgen.file.ColorType colorTypeBean, private static java.awt.Color getColorByColorTypeBean(
boolean isInitColor) { gov.noaa.nws.ncep.ui.pgen.file.ColorType colorTypeBean,
if(colorTypeBean == null || colorTypeBean.getColor() == null) { boolean isInitColor) {
if(isInitColor) if (colorTypeBean == null || colorTypeBean.getColor() == null) {
return new Color(0, 0, 255); //return a default color as Blue if (isInitColor)
else return new Color(0, 0, 255); // return a default color as Blue
return new Color(0, 192, 0); //return a green color as the default color for extrapPoint else
} return new Color(0, 192, 0); // return a green color as the
gov.noaa.nws.ncep.ui.pgen.file.Color colorBean = colorTypeBean.getColor(); // default color for extrapPoint
return new Color(colorBean.getRed(), colorBean.getGreen(), colorBean.getBlue(), }
colorBean.getAlpha()); gov.noaa.nws.ncep.ui.pgen.file.Color colorBean = colorTypeBean
.getColor();
return new Color(colorBean.getRed(), colorBean.getGreen(),
colorBean.getBlue(), colorBean.getAlpha());
} }
private static List<TrackPoint> getTrackPointElementListByTrackPointBeanList(List<gov.noaa.nws.ncep.ui.pgen.file.TrackPoint> trackPointBeanList) { private static List<TrackPoint> getTrackPointElementListByTrackPointBeanList(
List<TrackPoint> trackPointElementList = new ArrayList<TrackPoint>(trackPointBeanList.size()); List<gov.noaa.nws.ncep.ui.pgen.file.TrackPoint> trackPointBeanList) {
for(gov.noaa.nws.ncep.ui.pgen.file.TrackPoint trackPointBean : trackPointBeanList) { List<TrackPoint> trackPointElementList = new ArrayList<TrackPoint>(
java.util.Calendar currentCalendar = null; trackPointBeanList.size());
if(trackPointBean.getTime() != null) { for (gov.noaa.nws.ncep.ui.pgen.file.TrackPoint trackPointBean : trackPointBeanList) {
currentCalendar = trackPointBean.getTime().toGregorianCalendar(); java.util.Calendar currentCalendar = null;
} if (trackPointBean.getTime() != null) {
Coordinate currentCoordinate = getCoordinateByTrackPointBean(trackPointBean); currentCalendar = trackPointBean.getTime()
TrackPoint currentTrackPointElement = new TrackPoint(currentCoordinate, currentCalendar); .toGregorianCalendar();
trackPointElementList.add(currentTrackPointElement); }
} Coordinate currentCoordinate = getCoordinateByTrackPointBean(trackPointBean);
return trackPointElementList; TrackPoint currentTrackPointElement = new TrackPoint(
currentCoordinate, currentCalendar);
trackPointElementList.add(currentTrackPointElement);
}
return trackPointElementList;
} }
private static Coordinate getCoordinateByTrackPointBean(gov.noaa.nws.ncep.ui.pgen.file.TrackPoint trackPointBean) { private static Coordinate getCoordinateByTrackPointBean(
Coordinate coordinate = new Coordinate(); gov.noaa.nws.ncep.ui.pgen.file.TrackPoint trackPointBean) {
if(trackPointBean.getLocation() != null) { Coordinate coordinate = new Coordinate();
coordinate.x = trackPointBean.getLocation().getLongitude(); if (trackPointBean.getLocation() != null) {
coordinate.y = trackPointBean.getLocation().getLatitude(); coordinate.x = trackPointBean.getLocation().getLongitude();
} coordinate.y = trackPointBean.getLocation().getLatitude();
return coordinate; }
return coordinate;
} }
private static boolean[] getBooleanArrayByBooleanList(List<Boolean> booleanList) { private static boolean[] getBooleanArrayByBooleanList(
boolean[] booleanArray = new boolean[booleanList.size()]; List<Boolean> booleanList) {
int arrayIndex = 0; boolean[] booleanArray = new boolean[booleanList.size()];
for(Boolean currentBoolean : booleanList) { int arrayIndex = 0;
booleanArray[arrayIndex++] = currentBoolean.booleanValue(); for (Boolean currentBoolean : booleanList) {
} booleanArray[arrayIndex++] = currentBoolean.booleanValue();
return booleanArray; }
return booleanArray;
} }
private static gov.noaa.nws.ncep.ui.pgen.file.ColorType getColorTypeBeanByColorElement(
private static gov.noaa.nws.ncep.ui.pgen.file.ColorType getColorTypeBeanByColorElement(java.awt.Color colorElement) { java.awt.Color colorElement) {
gov.noaa.nws.ncep.ui.pgen.file.ColorType colorTypeBean = new gov.noaa.nws.ncep.ui.pgen.file.ColorType(); gov.noaa.nws.ncep.ui.pgen.file.ColorType colorTypeBean = new gov.noaa.nws.ncep.ui.pgen.file.ColorType();
gov.noaa.nws.ncep.ui.pgen.file.Color colorBean = new gov.noaa.nws.ncep.ui.pgen.file.Color(); gov.noaa.nws.ncep.ui.pgen.file.Color colorBean = new gov.noaa.nws.ncep.ui.pgen.file.Color();
colorBean.setAlpha(colorElement.getAlpha()); colorBean.setAlpha(colorElement.getAlpha());
colorBean.setBlue(colorElement.getBlue()); colorBean.setBlue(colorElement.getBlue());
colorBean.setRed(colorElement.getRed()); colorBean.setRed(colorElement.getRed());
colorBean.setGreen(colorElement.getGreen()); colorBean.setGreen(colorElement.getGreen());
colorTypeBean.setColor(colorBean); colorTypeBean.setColor(colorBean);
return colorTypeBean; return colorTypeBean;
} }
private static gov.noaa.nws.ncep.ui.pgen.file.TrackPoint getTrackPointBeanByTrackPointElement(TrackPoint trackPointElement) { private static gov.noaa.nws.ncep.ui.pgen.file.TrackPoint getTrackPointBeanByTrackPointElement(
gov.noaa.nws.ncep.ui.pgen.file.TrackPoint trackPointBean = new gov.noaa.nws.ncep.ui.pgen.file.TrackPoint(); TrackPoint trackPointElement) {
gov.noaa.nws.ncep.ui.pgen.file.TrackPoint trackPointBean = new gov.noaa.nws.ncep.ui.pgen.file.TrackPoint();
if(trackPointElement.getTime() != null) { if (trackPointElement.getTime() != null) {
GregorianCalendar gregorianCalendar = new GregorianCalendar(); GregorianCalendar gregorianCalendar = new GregorianCalendar();
gregorianCalendar.setTimeInMillis(trackPointElement.getTime().getTimeInMillis()); gregorianCalendar.setTimeInMillis(trackPointElement.getTime()
try { .getTimeInMillis());
XMLGregorianCalendar xmlGregorianCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(gregorianCalendar); try {
trackPointBean.setTime(xmlGregorianCalendar); XMLGregorianCalendar xmlGregorianCalendar = DatatypeFactory
} catch(DatatypeConfigurationException dce) { .newInstance().newXMLGregorianCalendar(
// log.error("Error, instantiating XMLGregorianCalendar failed, error="+dce.getMessage()); gregorianCalendar);
} trackPointBean.setTime(xmlGregorianCalendar);
} } catch (DatatypeConfigurationException dce) {
if(trackPointElement.getLocation() != null) { // log.error("Error, instantiating XMLGregorianCalendar failed, error="+dce.getMessage());
trackPointBean.location = new gov.noaa.nws.ncep.ui.pgen.file.TrackPoint.Location(); }
trackPointBean.getLocation().setLongitude(trackPointElement.getLocation().x); }
trackPointBean.getLocation().setLatitude(trackPointElement.getLocation().y); if (trackPointElement.getLocation() != null) {
} trackPointBean.location = new gov.noaa.nws.ncep.ui.pgen.file.TrackPoint.Location();
return trackPointBean; trackPointBean.getLocation().setLongitude(
trackPointElement.getLocation().x);
trackPointBean.getLocation().setLatitude(
trackPointElement.getLocation().y);
}
return trackPointBean;
} }
private static List<Boolean> getBooleanObjectList(boolean[] booleanArray) { private static List<Boolean> getBooleanObjectList(boolean[] booleanArray) {
List<Boolean> booleanList = null; List<Boolean> booleanList = null;
if(booleanArray == null) if (booleanArray == null)
booleanList = new ArrayList<Boolean>(); booleanList = new ArrayList<Boolean>();
else else
booleanList = new ArrayList<Boolean>(booleanArray.length); booleanList = new ArrayList<Boolean>(booleanArray.length);
for(boolean booleanValue : booleanArray) { for (boolean booleanValue : booleanArray) {
Boolean booleanObject = new Boolean(booleanValue); Boolean booleanObject = new Boolean(booleanValue);
booleanList.add(booleanObject); booleanList.add(booleanObject);
} }
return booleanList; return booleanList;
} }
} }

View file

@ -411,27 +411,52 @@
<xsd:sequence> <xsd:sequence>
<xsd:element name="initialColor" type="ColorType"></xsd:element> <xsd:element name="initialColor" type="ColorType"></xsd:element>
<xsd:element name="extrapColor" type="ColorType"></xsd:element> <xsd:element name="extrapColor" type="ColorType"></xsd:element>
<xsd:element name="initialPoints" type="TrackPoint" maxOccurs="unbounded" minOccurs="1"></xsd:element> <xsd:element name="initialPoints" type="TrackPoint"
<xsd:element name="extrapPoints" type="TrackPoint" maxOccurs="unbounded" minOccurs="1"></xsd:element> maxOccurs="unbounded" minOccurs="1">
<xsd:element name="extraPointTimeTextDisplayIndicator" type="xsd:boolean" maxOccurs="unbounded" minOccurs="1"></xsd:element> </xsd:element>
<xsd:element name="extrapPoints" type="TrackPoint"
maxOccurs="unbounded" minOccurs="1">
</xsd:element>
<xsd:element name="extraPointTimeTextDisplayIndicator"
type="xsd:boolean" maxOccurs="unbounded" minOccurs="1">
</xsd:element>
</xsd:sequence> </xsd:sequence>
<xsd:attribute name="initialLinePattern" type="xsd:string"></xsd:attribute> <xsd:attribute name="initialLinePattern"
type="xsd:string">
</xsd:attribute>
<xsd:attribute name="extrapLinePattern" type="xsd:string"></xsd:attribute> <xsd:attribute name="extrapLinePattern" type="xsd:string"></xsd:attribute>
<xsd:attribute name="initialMarker" type="xsd:string"></xsd:attribute> <xsd:attribute name="initialMarker" type="xsd:string"></xsd:attribute>
<xsd:attribute name="extrapMarker" type="xsd:string"></xsd:attribute> <xsd:attribute name="extrapMarker" type="xsd:string"></xsd:attribute>
<xsd:attribute name="lineWidth" type="xsd:float"></xsd:attribute> <xsd:attribute name="lineWidth" type="xsd:float"></xsd:attribute>
<xsd:attribute name="fontName" type="xsd:string"></xsd:attribute> <xsd:attribute name="fontName" type="xsd:string"></xsd:attribute>
<xsd:attribute name="fontStyle" type="xsd:string"></xsd:attribute>
<xsd:attribute name="fontSize" type="xsd:float"></xsd:attribute> <xsd:attribute name="fontSize" type="xsd:float"></xsd:attribute>
<xsd:attribute name="pgenType" type="xsd:string"></xsd:attribute> <xsd:attribute name="pgenType" type="xsd:string"></xsd:attribute>
<xsd:attribute name="pgenCategory" type="xsd:string"></xsd:attribute> <xsd:attribute name="pgenCategory" type="xsd:string"></xsd:attribute>
<xsd:attribute name="setTimeButtonSelected" type="xsd:boolean"></xsd:attribute> <xsd:attribute name="setTimeButtonSelected"
<xsd:attribute name="intervalComboSelectedIndex" type="xsd:int"></xsd:attribute> type="xsd:boolean">
<xsd:attribute name="intervalTimeTextString" type="xsd:string"></xsd:attribute> </xsd:attribute>
<xsd:attribute name="extraPointTimeDisplayOptionName" type="xsd:string"></xsd:attribute> <xsd:attribute name="intervalComboSelectedIndex"
<xsd:attribute name="skipFactorTextString" type="xsd:string"></xsd:attribute> type="xsd:int">
<xsd:attribute name="fontNameComboSelectedIndex" type="xsd:int"></xsd:attribute> </xsd:attribute>
<xsd:attribute name="fontSizeComboSelectedIndex" type="xsd:int"></xsd:attribute> <xsd:attribute name="intervalTimeTextString"
<xsd:attribute name="fontStyleComboSelectedIndex" type="xsd:int"></xsd:attribute> type="xsd:string">
</xsd:attribute>
<xsd:attribute name="extraPointTimeDisplayOptionName"
type="xsd:string">
</xsd:attribute>
<xsd:attribute name="skipFactorTextString"
type="xsd:string">
</xsd:attribute>
<xsd:attribute name="fontNameComboSelectedIndex"
type="xsd:int">
</xsd:attribute>
<xsd:attribute name="fontSizeComboSelectedIndex"
type="xsd:int">
</xsd:attribute>
<xsd:attribute name="fontStyleComboSelectedIndex"
type="xsd:int">
</xsd:attribute>
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>

View file

@ -14,10 +14,10 @@ import gov.noaa.nws.ncep.ui.pgen.elements.Product;
import gov.noaa.nws.ncep.ui.pgen.file.FileTools; import gov.noaa.nws.ncep.ui.pgen.file.FileTools;
import gov.noaa.nws.ncep.ui.pgen.file.ProductConverter; import gov.noaa.nws.ncep.ui.pgen.file.ProductConverter;
import gov.noaa.nws.ncep.ui.pgen.file.Products; import gov.noaa.nws.ncep.ui.pgen.file.Products;
import gov.noaa.nws.ncep.ui.pgen.rsc.PgenResource;
import gov.noaa.nws.ncep.ui.pgen.store.PgenStorageException; import gov.noaa.nws.ncep.ui.pgen.store.PgenStorageException;
import gov.noaa.nws.ncep.ui.pgen.store.StorageUtils; import gov.noaa.nws.ncep.ui.pgen.store.StorageUtils;
import gov.noaa.nws.ncep.ui.pgen.tools.PgenCycleTool; import gov.noaa.nws.ncep.ui.pgen.tools.PgenCycleTool;
import gov.noaa.nws.ncep.ui.pgen.rsc.PgenResource;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -61,6 +61,7 @@ import com.vividsolutions.jts.geom.GeometryFactory;
* 05/13 #610 J. Wu Implemented FZLVL range (TTR425) * 05/13 #610 J. Wu Implemented FZLVL range (TTR425)
* 07/13 ? J. Wu Move state list ordering to GfaRules. * 07/13 ? J. Wu Move state list ordering to GfaRules.
* 08/13 TTR714/715 J. Wu Fixed issue type and times. * 08/13 TTR714/715 J. Wu Fixed issue type and times.
* 10/14 TTR714 J. Wu Check issue type in get_status.xml.
* *
* </pre> * </pre>
* *
@ -70,7 +71,9 @@ import com.vividsolutions.jts.geom.GeometryFactory;
public class GfaGenerate { public class GfaGenerate {
private static final String TEXT_TYPE = "TEXT"; private static final String TEXT_TYPE = "TEXT";
private GeometryFactory gf = new GeometryFactory();
private GeometryFactory gf = new GeometryFactory();
private static final String ISSUE_TYPE_FROM_OUTLOOK = "ISSUE_TYPE_FROM_OUTLOOK"; private static final String ISSUE_TYPE_FROM_OUTLOOK = "ISSUE_TYPE_FROM_OUTLOOK";
// private final static Logger logger = Logger.getLogger(GfaGenerate.class); // private final static Logger logger = Logger.getLogger(GfaGenerate.class);
@ -109,20 +112,22 @@ public class GfaGenerate {
/* /*
* Create an additional smear for the adjacent area. * Create an additional smear for the adjacent area.
*/ */
for ( Gfa g : all) { for (Gfa g : all) {
Gfa sg = createAdjacentGfa( g ); Gfa sg = createAdjacentGfa(g);
adjusted.add( g ); adjusted.add(g);
if ( sg != null ) { if (sg != null) {
adjusted.add( sg ); adjusted.add(sg);
} }
} }
/* /*
* Find issue type for an Airmet's associated Outlook * Find issue type for an Airmet's associated Outlook. Note: TTR 714 -
* J. Wu: this may cause other issues. Instead, we should check the
* issue types in "get_status.xsl".
*/ */
trackOtlkIssueTypeToAirmet( adjusted ); // trackOtlkIssueTypeToAirmet(adjusted);
/* /*
* Find GFA smears in each area and hazard category, generate xml, and * Find GFA smears in each area and hazard category, generate xml, and
@ -131,13 +136,13 @@ public class GfaGenerate {
for (String category : categories) { for (String category : categories) {
for (String area : areas) { for (String area : areas) {
List<Gfa> ret = filterSelected( adjusted, area, category ); List<Gfa> ret = filterSelected(adjusted, area, category);
// If no issue/until times, assign them. // If no issue/until times, assign them.
for (Gfa de : ret) { for (Gfa de : ret) {
if (!de.isSnapshot() if (!de.isSnapshot()
&& de.getAttribute(Gfa.ISSUE_TIME) == null) { && de.getAttribute(Gfa.ISSUE_TIME) == null) {
GfaRules.assignIssueTime( de ); GfaRules.assignIssueTime(de);
} }
} }
@ -154,24 +159,25 @@ public class GfaGenerate {
/* /*
* Find freezing range for this area! * Find freezing range for this area!
*/ */
String fzlvlRange = findFreezingRange( all, ret, area, category ); String fzlvlRange = findFreezingRange(all, ret, area, category);
/* /*
* Note - needs to use a copy so it won't change the parent of * Note - needs to use a copy so it won't change the parent of
* the original G-Airmets, e.g. l.add( de ) will set the parent * the original G-Airmets, e.g. l.add( de ) will set the parent
* of the 'de" to be "l"! * of the 'de" to be "l"!
*/ */
for ( Gfa gss : ret) { for (Gfa gss : ret) {
Gfa gfaCopy = gss.copy(); Gfa gfaCopy = gss.copy();
String otlkIssueType = nvl( gfaCopy.getGfaValue( ISSUE_TYPE_FROM_OUTLOOK ) ); /*
if ( !otlkIssueType.equals( "NRML" ) ) { * String otlkIssueType = nvl(gfaCopy
gfaCopy.setGfaIssueType( otlkIssueType ); * .getGfaValue(ISSUE_TYPE_FROM_OUTLOOK)); if
} * (!otlkIssueType.equals("NRML")) {
* gfaCopy.setGfaIssueType( otlkIssueType ); }
if ( fzlvlRange != null ) { */
gfaCopy.setGfaValue( Gfa.FZL_RANGE, fzlvlRange ); if (fzlvlRange != null) {
} gfaCopy.setGfaValue(Gfa.FZL_RANGE, fzlvlRange);
l.add( gfaCopy ); }
l.add(gfaCopy);
} }
// l.add( ret ); // l.add( ret );
@ -183,7 +189,7 @@ public class GfaGenerate {
// Needs to add an empty Gfa to carry the issue/until for proper // Needs to add an empty Gfa to carry the issue/until for proper
// formatting. // formatting.
if (ret.size() == 0) { if (ret.size() == 0) {
addNullGfa( products, category, fzlvlRange ); addNullGfa(products, category, fzlvlRange);
} }
String xml = SerializationUtil.marshalToXml(products); String xml = SerializationUtil.marshalToXml(products);
@ -233,7 +239,8 @@ public class GfaGenerate {
* @param cats * @param cats
* @return * @return
*/ */
private static List<Gfa> filterSelected( List<Gfa> all, String area, String category) { private static List<Gfa> filterSelected(List<Gfa> all, String area,
String category) {
ArrayList<Gfa> ret = new ArrayList<Gfa>(); ArrayList<Gfa> ret = new ArrayList<Gfa>();
@ -258,6 +265,7 @@ public class GfaGenerate {
} }
public String generateProduct(String prdxml, String category, String area) { public String generateProduct(String prdxml, String category, String area) {
System.out.println("\nprdxml is:\n" + prdxml + "\n");
String xml1 = prdxml.replaceAll("TURB-HI", "TURB"); String xml1 = prdxml.replaceAll("TURB-HI", "TURB");
String xml = xml1.replaceAll("TURB-LO", "TURB"); String xml = xml1.replaceAll("TURB-LO", "TURB");
@ -279,6 +287,7 @@ public class GfaGenerate {
transformer.transform(xmlSource, result); transformer.transform(xmlSource, result);
res = result.getWriter().toString().trim(); res = result.getWriter().toString().trim();
System.out.println("\nres is:\n" + res + "\n");
} catch (Exception e) { } catch (Exception e) {
// logger.error( "", e ); // logger.error( "", e );
@ -295,11 +304,13 @@ public class GfaGenerate {
} }
/** /**
* Create a new smear for smears with two FA areas and re-order the state list. * Create a new smear for smears with two FA areas and re-order the state
* list.
* *
* The States in the primary area precede states in the adjacent area. * The States in the primary area precede states in the adjacent area.
* *
* @param g Gfa to be processed * @param g
* Gfa to be processed
* *
* @return * @return
*/ */
@ -310,12 +321,12 @@ public class GfaGenerate {
String[] s = nvl(g.getGfaArea()).split("-"); String[] s = nvl(g.getGfaArea()).split("-");
if (s.length > 1) { if (s.length > 1) {
String sname = new String( s[1].trim() + "-" + s[0].trim() ); String sname = new String(s[1].trim() + "-" + s[0].trim());
// create an additional smear and re-order state list. // create an additional smear and re-order state list.
secondg = g.copy(); secondg = g.copy();
secondg.setGfaArea( sname ); secondg.setGfaArea(sname);
GfaRules.reorderStateList( secondg ); GfaRules.reorderStateList(secondg);
} }
return secondg; return secondg;
@ -362,12 +373,12 @@ public class GfaGenerate {
/* /*
* Adds an empty Gfa to the product so it can pass issue/until time for * Adds an empty Gfa to the product so it can pass issue/until time for
* correct formatting. Freezing range should be set if provided. * correct formatting. Freezing range should be set if provided.
* *
* Note - this should be called only when there is no Gfa smears in the * Note - this should be called only when there is no Gfa smears in the
* "prds". * "prds".
*/ */
private void addNullGfa(Products prds, String category, String fzlRange ) { private void addNullGfa(Products prds, String category, String fzlRange) {
gov.noaa.nws.ncep.ui.pgen.file.Gfa fgfa = new gov.noaa.nws.ncep.ui.pgen.file.Gfa(); gov.noaa.nws.ncep.ui.pgen.file.Gfa fgfa = new gov.noaa.nws.ncep.ui.pgen.file.Gfa();
@ -380,9 +391,9 @@ public class GfaGenerate {
fgfa.setFcstHr("0-6"); fgfa.setFcstHr("0-6");
// If freezing range is provided, set it and set hazard type as "FZLVL". // If freezing range is provided, set it and set hazard type as "FZLVL".
if ( fzlRange != null ) { if (fzlRange != null) {
fgfa.setHazard( "FZLVL" ); fgfa.setHazard("FZLVL");
fgfa.setFzlRange( fzlRange ); fgfa.setFzlRange(fzlRange);
} }
// //
@ -429,396 +440,393 @@ public class GfaGenerate {
} }
/* /*
* Find the freezing range from FZLVL/M_FZLVL airmets. * Find the freezing range from FZLVL/M_FZLVL airmets.
*/ */
private String findFreezingRange( List<Gfa> all, List<Gfa> selected, private String findFreezingRange(List<Gfa> all, List<Gfa> selected,
String area, String cat ) { String area, String cat) {
if ( !cat.equalsIgnoreCase( "ZULU" ) ) { if (!cat.equalsIgnoreCase("ZULU")) {
return null; return null;
} }
String fzlRange = null;
String topStr = null;
String botStr = null;
String fzlRange = null; /*
String topStr = null; * If no FZLVL/M_FZLVL in this area, find range using those outside of
String botStr = null; * this area, if any.
*/
if (selected == null || selected.size() == 0) {
int[] extRange = findExernalFzlvlRange(all, area);
if (extRange[0] != -1) {
topStr = padding(extRange[0]);
botStr = padding(extRange[1]);
}
} else {
/*
* First - find the worst range from existing FZL_RANGE in FZLVL
* airmets. If no existing range found, then find the worst
* top/bottom from FZLVLs' levels ( top = level + 40 and bottom =
* level - 40) Second - find the worst top/bottom from M_FZLVLs
*
* Third - find the worst case range using info from step 1 and 2.
*/
int[] existingRange = findExistingFzlRange(all, selected, area);
int[] mfzlRange = findMfzlvlRange(all, selected, area);
/* if (existingRange[0] == -1) {
* If no FZLVL/M_FZLVL in this area, find range using those outside of existingRange = findFzlvlLevelRange(all, selected, area);
* this area, if any. }
*/
if ( selected == null || selected.size() == 0 ) {
int[] extRange = findExernalFzlvlRange( all, area );
if ( extRange[0] != -1 ) {
topStr = padding( extRange[0] );
botStr = padding( extRange[1] );
}
}
else {
/*
* First - find the worst range from existing FZL_RANGE in FZLVL airmets.
* If no existing range found, then find the worst top/bottom from
* FZLVLs' levels ( top = level + 40 and bottom = level - 40)
* Second - find the worst top/bottom from M_FZLVLs
*
* Third - find the worst case range using info from step 1 and 2.
*
*/
int[] existingRange = findExistingFzlRange( all, selected, area );
int[] mfzlRange = findMfzlvlRange( all, selected, area );
if ( existingRange[0] == -1 ) { if (existingRange[0] != -1 || mfzlRange[0] != -1) {
existingRange = findFzlvlLevelRange( all, selected, area ); topStr = padding(Math.max(existingRange[0], mfzlRange[0]));
} }
if ( existingRange[0] != -1 || mfzlRange[0] != -1 ) { if (existingRange[1] != 9999 || mfzlRange[1] != 9999) {
topStr = padding( Math.max( existingRange[0], mfzlRange[0] ) ); botStr = padding(Math.min(existingRange[1], mfzlRange[1]));
} }
}
if ( existingRange[1] != 9999 || mfzlRange[1] != 9999 ){ // Now create a range string.
botStr = padding( Math.min( existingRange[1], mfzlRange[1] ) ); if (topStr != null && botStr != null) {
} fzlRange = area + ";" + topStr + ";" + botStr;
} }
// Now create a range string. return fzlRange;
if ( topStr != null && botStr != null ) {
fzlRange = area + ";" + topStr + ";" + botStr;
}
return fzlRange;
}
/*
* Retrieve the worst FZLVL range from ranges existing in FZLVL airmet/outlook.
* Such existing range should be in the form as "MIA;160;40", retrievable as
* gfa.getGfaValue( Gfa.FZL_RANGE ).
*/
private int[] findExistingFzlRange( List<Gfa> all, List<Gfa> selected, String area ) {
int[] topBot = { -1, 9999 };
for ( Gfa elem : selected ) {
String gtype = elem.getGfaHazard();
if ( !gtype.equalsIgnoreCase("FZLVL") || elem.isSnapshot() ) {
continue;
}
String range1 = elem.getGfaValue( Gfa.FZL_RANGE );
if ( range1 != null ) {
String[] rangeInfo = range1.split(";");
if ( rangeInfo.length >= 3 && rangeInfo[0].equalsIgnoreCase( area ) ) {
int top1 = -1;
int bot1 = -1;
try {
top1 = Integer.parseInt( rangeInfo[1] );
}
catch ( Exception e ) {
e.printStackTrace();
}
if ( rangeInfo[2].equalsIgnoreCase("SFC") ) {
bot1 = 0;
}
else {
try {
bot1 = Integer.parseInt( rangeInfo[2] );
}
catch ( Exception e ) {
e.printStackTrace();
}
}
if ( top1 >= 0 && bot1 >= 0 ) {
topBot[0] = Math.max( topBot[0], top1 );
topBot[1] = Math.min( topBot[1], bot1 );
}
}
}
}
return topBot;
}
/*
* Retrieve the worst range from existing top/bottom of M_FZLVL airmet/outlook.
* Such top/bottom are retrievable as gfa.getGfaTop() & gfa.getGfaBottom().
*/
private int[] findMfzlvlRange( List<Gfa> all, List<Gfa> selected, String area ) {
int[] topBot = { -1, 9999 };
for ( Gfa elem : selected ) {
String gtype = elem.getGfaHazard();
if ( !gtype.equalsIgnoreCase("M_FZLVL") || elem.isSnapshot() ) {
continue;
}
int top2 = -1;
int bot2 = -1;
if ( elem.getGfaTop() != null ) {
try {
top2 = Integer.parseInt( elem.getGfaTop() );
}
catch ( Exception e ) {
e.printStackTrace();
}
}
String botStr = elem.getGfaBottom();
if ( botStr != null ) {
if ( botStr.equalsIgnoreCase( "SFC") ) {
bot2 = 0;
}
else {
try {
bot2 = Integer.parseInt( elem.getGfaBottom() );
}
catch ( Exception e ) {
e.printStackTrace();
}
}
}
if ( top2 >= 0 && bot2 >= 0 ) {
topBot[0] = Math.max( topBot[0], top2 );
topBot[1] = Math.min( topBot[1], bot2 );
}
}
return topBot;
} }
/* /*
* Retrieve the worst range from existing levels of FZLVL airmet/outlook. * Retrieve the worst FZLVL range from ranges existing in FZLVL
* Such levels are retrievable as gfa.getGfaValue( Gfa.LEVEL ). * airmet/outlook. Such existing range should be in the form as
* "MIA;160;40", retrievable as gfa.getGfaValue( Gfa.FZL_RANGE ).
*/ */
private int[] findFzlvlLevelRange( List<Gfa> all, List<Gfa> selected, String area ) { private int[] findExistingFzlRange(List<Gfa> all, List<Gfa> selected,
String area) {
int[] topBot = { -1, 9999 }; int[] topBot = { -1, 9999 };
for ( Gfa elem : selected ) {
String gtype = elem.getGfaHazard(); for (Gfa elem : selected) {
if ( !gtype.equalsIgnoreCase("FZLVL") || elem.isSnapshot() ) { String gtype = elem.getGfaHazard();
continue;
}
int top2 = -1; if (!gtype.equalsIgnoreCase("FZLVL") || elem.isSnapshot()) {
int bot2 = -1; continue;
}
String levelStr = elem.getGfaValue( Gfa.LEVEL ); String range1 = elem.getGfaValue(Gfa.FZL_RANGE);
int lvl = -1; if (range1 != null) {
String[] rangeInfo = range1.split(";");
if (rangeInfo.length >= 3
&& rangeInfo[0].equalsIgnoreCase(area)) {
int top1 = -1;
int bot1 = -1;
if ( levelStr != null ) { try {
top1 = Integer.parseInt(rangeInfo[1]);
} catch (Exception e) {
e.printStackTrace();
}
if ( levelStr.equalsIgnoreCase( "SFC" ) ) { if (rangeInfo[2].equalsIgnoreCase("SFC")) {
top2 = 40; bot1 = 0;
bot2 = 0; } else {
} try {
else { bot1 = Integer.parseInt(rangeInfo[2]);
try { } catch (Exception e) {
lvl = Integer.parseInt( levelStr ); e.printStackTrace();
} }
catch ( Exception e ) { }
e.printStackTrace();
}
if ( lvl >= 0 && lvl <= 40 ) { if (top1 >= 0 && bot1 >= 0) {
top2 = 40; topBot[0] = Math.max(topBot[0], top1);
bot2 = 0; topBot[1] = Math.min(topBot[1], bot1);
} }
else { }
top2 = lvl + 40; }
bot2 = lvl - 40; }
}
}
}
return topBot;
}
if ( top2 >= 0 && bot2 >= 0 ) { /*
topBot[0] = Math.max( topBot[0], top2 ); * Retrieve the worst range from existing top/bottom of M_FZLVL
topBot[1] = Math.min( topBot[1], bot2 ); * airmet/outlook. Such top/bottom are retrievable as gfa.getGfaTop() &
} * gfa.getGfaBottom().
*/
private int[] findMfzlvlRange(List<Gfa> all, List<Gfa> selected, String area) {
} int[] topBot = { -1, 9999 };
return topBot; for (Gfa elem : selected) {
String gtype = elem.getGfaHazard();
if (!gtype.equalsIgnoreCase("M_FZLVL") || elem.isSnapshot()) {
continue;
}
int top2 = -1;
int bot2 = -1;
if (elem.getGfaTop() != null) {
try {
top2 = Integer.parseInt(elem.getGfaTop());
} catch (Exception e) {
e.printStackTrace();
}
}
String botStr = elem.getGfaBottom();
if (botStr != null) {
if (botStr.equalsIgnoreCase("SFC")) {
bot2 = 0;
} else {
try {
bot2 = Integer.parseInt(elem.getGfaBottom());
} catch (Exception e) {
e.printStackTrace();
}
}
}
if (top2 >= 0 && bot2 >= 0) {
topBot[0] = Math.max(topBot[0], top2);
topBot[1] = Math.min(topBot[1], bot2);
}
}
return topBot;
} }
/* /*
* Find the top and base levels for a FA area that is not intersected by any FZLVL * Retrieve the worst range from existing levels of FZLVL airmet/outlook.
* contours. It sorts all external fzlvls by distance from the area centroid, then * Such levels are retrievable as gfa.getGfaValue( Gfa.LEVEL ).
* uses the level from that contour. If the contour is to the left of the area then */
* the answer is base = contour level, top = base + 040. If the contour is to the private int[] findFzlvlLevelRange(List<Gfa> all, List<Gfa> selected,
* right of the area then the answer top = contour level, base = top - 040. String area) {
int[] topBot = { -1, 9999 };
for (Gfa elem : selected) {
String gtype = elem.getGfaHazard();
if (!gtype.equalsIgnoreCase("FZLVL") || elem.isSnapshot()) {
continue;
}
int top2 = -1;
int bot2 = -1;
String levelStr = elem.getGfaValue(Gfa.LEVEL);
int lvl = -1;
if (levelStr != null) {
if (levelStr.equalsIgnoreCase("SFC")) {
top2 = 40;
bot2 = 0;
} else {
try {
lvl = Integer.parseInt(levelStr);
} catch (Exception e) {
e.printStackTrace();
}
if (lvl >= 0 && lvl <= 40) {
top2 = 40;
bot2 = 0;
} else {
top2 = lvl + 40;
bot2 = lvl - 40;
}
}
}
if (top2 >= 0 && bot2 >= 0) {
topBot[0] = Math.max(topBot[0], top2);
topBot[1] = Math.min(topBot[1], bot2);
}
}
return topBot;
}
/*
* Find the top and base levels for a FA area that is not intersected by any
* FZLVL contours. It sorts all external fzlvls by distance from the area
* centroid, then uses the level from that contour. If the contour is to the
* left of the area then the answer is base = contour level, top = base +
* 040. If the contour is to the right of the area then the answer top =
* contour level, base = top - 040.
* *
* See legacy af_getExternalFzlvlRng() in af_getAirmetXml.c. * See legacy af_getExternalFzlvlRng() in af_getAirmetXml.c.
* *
* Note (1) only FZLVLs are used, not M_FZLVLs. * Note (1) only FZLVLs are used, not M_FZLVLs. (2) All FZLVLs are used,
* (2) All FZLVLs are used, including snapshots. * including snapshots.
*
*/ */
private int[] findExernalFzlvlRange( List<Gfa> all, String area ) { private int[] findExernalFzlvlRange(List<Gfa> all, String area) {
int[] topBot = { -1, 9999 }; int[] topBot = { -1, 9999 };
HashMap<String, Geometry> areaBnds = GfaClip.getInstance().getFaAreaBounds(); HashMap<String, Geometry> areaBnds = GfaClip.getInstance()
.getFaAreaBounds();
Coordinate center = gf.createLinearRing( areaBnds.get(area ).getCoordinates() ).getCentroid().getCoordinate(); Coordinate center = gf
.createLinearRing(areaBnds.get(area).getCoordinates())
.getCentroid().getCoordinate();
Gfa closestGfa = null; Gfa closestGfa = null;
double minDist = Double.MAX_VALUE; double minDist = Double.MAX_VALUE;
for ( Gfa elem : all ) { for (Gfa elem : all) {
String gtype = elem.getGfaHazard(); String gtype = elem.getGfaHazard();
if ( !gtype.equalsIgnoreCase("FZLVL") ) { if (!gtype.equalsIgnoreCase("FZLVL")) {
continue; continue;
}
// Find distance from the FA Area's centroid to this FZLVL.
double dist = distance( elem, center );
if ( dist < minDist ) {
minDist = dist;
closestGfa = elem;
} }
} // Find distance from the FA Area's centroid to this FZLVL.
double dist = distance(elem, center);
if (dist < minDist) {
minDist = dist;
closestGfa = elem;
}
if ( closestGfa != null ) { }
boolean isLeft = GfaSnap.getInstance().atLeft( center, closestGfa.getLinePoints(),
closestGfa.isClosedLine(), 0.0 );
String levelStr = closestGfa.getGfaValue( Gfa.LEVEL ); if (closestGfa != null) {
int lvl = -1; boolean isLeft = GfaSnap.getInstance().atLeft(center,
closestGfa.getLinePoints(), closestGfa.isClosedLine(), 0.0);
if ( levelStr != null ) { String levelStr = closestGfa.getGfaValue(Gfa.LEVEL);
int lvl = -1;
if ( levelStr.equalsIgnoreCase( "SFC" ) ) { if (levelStr != null) {
if (levelStr.equalsIgnoreCase("SFC")) {
lvl = 0; lvl = 0;
} } else {
else { try {
try { lvl = Integer.parseInt(levelStr);
lvl = Integer.parseInt( levelStr ); } catch (Exception e) {
} e.printStackTrace();
catch ( Exception e ) { }
e.printStackTrace(); }
} }
}
}
if ( lvl >= 0 ) { if (lvl >= 0) {
if ( !isLeft ) { // FZLVL is at right of FA area if (!isLeft) { // FZLVL is at right of FA area
topBot[0] = lvl + 40; topBot[0] = lvl + 40;
topBot[1] = lvl; topBot[1] = lvl;
} } else { // FZLVL is at left of FA area
else { // FZLVL is at left of FA area topBot[0] = lvl;
topBot[0] = lvl; topBot[1] = lvl - 40;
topBot[1] = lvl - 40; if (topBot[1] < 0)
if ( topBot[1] < 0 ) topBot[1] = 0; topBot[1] = 0;
} }
} }
} }
return topBot; return topBot;
} }
/* /*
* Pad a value between 0 to 100 in format of "0xx". * Pad a value between 0 to 100 in format of "0xx".
*/ */
private String padding( int value ) { private String padding(int value) {
StringBuilder str = new StringBuilder(); StringBuilder str = new StringBuilder();
if ( value <= 0 ) { if (value <= 0) {
str.append( "SFC" ); str.append("SFC");
} } else {
else { if (value < 100) {
if ( value < 100 ) { str.append("0" + value);
str.append( "0" + value ); } else {
} str.append(value);
else { }
str.append( value ); }
}
}
return str.toString(); return str.toString();
} }
/* /*
* Find the distance from a given point to a Gfa line or polygon. * Find the distance from a given point to a Gfa line or polygon.
*/ */
private double distance( Gfa gfa, Coordinate loc ) { private double distance(Gfa gfa, Coordinate loc) {
double dist = Double.MAX_VALUE; double dist = Double.MAX_VALUE;
double minDist = Double.MAX_VALUE; double minDist = Double.MAX_VALUE;
Object pts[] = gfa.getPoints().toArray(); Object pts[] = gfa.getPoints().toArray();
for ( int ii = 0; ii < pts.length; ii++ ) { for (int ii = 0; ii < pts.length; ii++) {
if ( ii == pts.length - 1 ) { if (ii == pts.length - 1) {
if ( gfa.isClosedLine() ) { if (gfa.isClosedLine()) {
dist = PgenResource.distanceFromLineSegment( loc, dist = PgenResource.distanceFromLineSegment(loc,
(Coordinate) pts[ii], (Coordinate) pts[0]); (Coordinate) pts[ii], (Coordinate) pts[0]);
} } else {
else {
break; break;
} }
} } else {
else { dist = PgenResource.distanceFromLineSegment(loc,
dist = PgenResource.distanceFromLineSegment( loc, (Coordinate) pts[ii], (Coordinate) pts[ii], (Coordinate) pts[ii + 1]);
(Coordinate) pts[ii + 1]);
} }
if ( dist < minDist ) { if (dist < minDist) {
minDist = dist; minDist = dist;
} }
} }
return minDist; return minDist;
} }
/** /**
* Find if a smear has an associated outlook that are generated from the same series of * Find if a smear has an associated outlook that are generated from the
* snapshots (with same hazard type, tag and desk. * same series of snapshots (with same hazard type, tag and desk.
* *
* This is used to get around the issue when a pair of airmet and outlook is generated from * This is used to get around the issue when a pair of airmet and outlook is
* the same series of snapshots, and the airmet's issue tyep is "NRML" while outlook's issue * generated from the same series of snapshots, and the airmet's issue type
* type is not "NRML". In this case, the formatted header should show the outlook's issue type. * is "NRML" while outlook's issue type is not "NRML". In this case, the
* formatted header should show the outlook's issue type.
*
* Note: TTR 714 - 10/2014: for the above case, we should modify
* "get_status.xsl" to get the formatted header by looping through all
* airmets and outlooks instead of modifying it here.
* *
* @param all * @param all
* @return * @return
*/ */
private static void trackOtlkIssueTypeToAirmet( List<Gfa> all ) { private static void trackOtlkIssueTypeToAirmet(List<Gfa> all) {
for ( Gfa gg : all) { for (Gfa gg : all) {
gg.setGfaValue( ISSUE_TYPE_FROM_OUTLOOK, "NRML" ); gg.setGfaValue(ISSUE_TYPE_FROM_OUTLOOK, "NRML");
if ( gg.isAirmet() && "NRML".equalsIgnoreCase( gg.getGfaIssueType() ) ) { if (gg.isAirmet() && "NRML".equalsIgnoreCase(gg.getGfaIssueType())) {
String akey = gg.getGfaHazard() + gg.getGfaTag() + gg.getGfaDesk(); String akey = gg.getGfaHazard() + gg.getGfaTag()
for ( Gfa gotlk : all) { + gg.getGfaDesk();
if ( gotlk.isOutlook() && !("NRML".equalsIgnoreCase( gotlk.getGfaIssueType() ) ) ) { for (Gfa gotlk : all) {
String okey = gotlk.getGfaHazard() + gotlk.getGfaTag() + gotlk.getGfaDesk(); if (gotlk.isOutlook()
if ( okey.equals( akey ) ) { && !("NRML".equalsIgnoreCase(gotlk
gg.setGfaValue( ISSUE_TYPE_FROM_OUTLOOK, gotlk.getGfaIssueType() ); .getGfaIssueType()))) {
break; String okey = gotlk.getGfaHazard() + gotlk.getGfaTag()
} + gotlk.getGfaDesk();
} if (okey.equals(akey)) {
} gg.setGfaValue(ISSUE_TYPE_FROM_OUTLOOK,
gotlk.getGfaIssueType());
break;
}
}
}
} }
} }
} }

View file

@ -7,6 +7,12 @@
*/ */
package gov.noaa.nws.ncep.ui.pgen.gfa; package gov.noaa.nws.ncep.ui.pgen.gfa;
import static gov.noaa.nws.ncep.ui.pgen.gfa.Gfa.BOS;
import static gov.noaa.nws.ncep.ui.pgen.gfa.Gfa.CHI;
import static gov.noaa.nws.ncep.ui.pgen.gfa.Gfa.DFW;
import static gov.noaa.nws.ncep.ui.pgen.gfa.Gfa.MIA;
import static gov.noaa.nws.ncep.ui.pgen.gfa.Gfa.SFO;
import static gov.noaa.nws.ncep.ui.pgen.gfa.Gfa.SLC;
import gov.noaa.nws.ncep.ui.pgen.PgenStaticDataProvider; import gov.noaa.nws.ncep.ui.pgen.PgenStaticDataProvider;
import java.awt.Color; import java.awt.Color;
@ -20,8 +26,6 @@ import org.dom4j.Node;
import org.dom4j.io.SAXReader; import org.dom4j.io.SAXReader;
import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.graphics.RGB;
import static gov.noaa.nws.ncep.ui.pgen.gfa.Gfa.*;
/** /**
* Helper class to read the GFA configuration. * Helper class to read the GFA configuration.
* *
@ -41,379 +45,390 @@ import static gov.noaa.nws.ncep.ui.pgen.gfa.Gfa.*;
*/ */
public class GfaInfo { public class GfaInfo {
// gui settings // gui settings
private static Document doc; private static Document doc;
public static final String HAZARD_XPATH = "/root/hazard"; public static final String HAZARD_XPATH = "/root/hazard";
public static final String FCSTHR_XPATH = "/root/fcstHr";
public static final String TAG_XPATH = "/root/tag";
public static final String DESK_XPATH = "/root/desk";
public static final String ISSUE_TYPE_XPATH = "/root/issueType";
public static final String GFA_OTLKGEN_RATIO_XPATH = "/root/gfaOtlkgenRatio";
public static final String AIRMET_ELEMENT_XPATH = "/airmetcycle/element"; public static final String FCSTHR_XPATH = "/root/fcstHr";
public static final String GFA_SNAPSHOT = "snapshot"; public static final String TAG_XPATH = "/root/tag";
public static final String GFA_SMEAR = "smear";
public static final String GFA_OUTLOOK = "outlook";
public static final int GFA_SMEAR_LINEWIDTH = 3; public static final String DESK_XPATH = "/root/desk";
public static final int GFA_OUTLOOK_LINEWIDTH = 4;
public static final int GFA_OTHER_LINEWIDTH = 2;
public static final String ISSUE_TYPE_XPATH = "/root/issueType";
/** public static final String GFA_OTLKGEN_RATIO_XPATH = "/root/gfaOtlkgenRatio";
* Hazard type vs color array (index means the same as the position
* in fcstHr combo box)
*/
private static HashMap<String, RGB[]> rgbMap;
/** public static final String AIRMET_ELEMENT_XPATH = "/airmetcycle/element";
* Pairs like ("red", new RGB(255, 0, 0)) read from gfa.xml
*/
private static HashMap<String, RGB> definedColors;
/** public static final String GFA_SNAPSHOT = "snapshot";
* Hazard categories
*/
private static HashMap<String, HazardCategory> hazardCategories;
public enum HazardCategory{ public static final String GFA_SMEAR = "smear";
SIERRA, TANGO, ZULU, NONE;
}
/** public static final String GFA_OUTLOOK = "outlook";
* State orders in each FA area.
*/
private static HashMap<String, ArrayList<String> > stateOrderByArea;
/** public static final int GFA_SMEAR_LINEWIDTH = 3;
* Pairs like ("red", new RGB(255, 0, 0)) read from gfa.xml
*/
private static HashMap<String, RGB> fzlvlSfcColors;
/** public static final int GFA_OUTLOOK_LINEWIDTH = 4;
* Getter for the document.
*
* @return
*/
public static Document getDocument() {
if (doc == null) {
readOptions();
}
return doc;
}
/** public static final int GFA_OTHER_LINEWIDTH = 2;
* Read the menu configuration from gfa.xml file
*/
private static void readOptions() {
File gfainfoFile = PgenStaticDataProvider.getProvider().getStaticFile(
PgenStaticDataProvider.getProvider().getPgenLocalizationRoot() + "gfa.xml");
try { /**
SAXReader reader = new SAXReader(); * Hazard type vs color array (index means the same as the position in
doc = reader.read(gfainfoFile.getAbsoluteFile()); * fcstHr combo box)
} catch (Exception e) { */
e.printStackTrace(); private static HashMap<String, RGB[]> rgbMap;
}
}
/* /**
* This method is just to suppress warning * Pairs like ("red", new RGB(255, 0, 0)) read from gfa.xml
*/ */
@SuppressWarnings("unchecked") private static HashMap<String, RGB> definedColors;
public static List<Node> selectNodes(String xPath) {
return (List<Node>) GfaInfo.getDocument().selectNodes(xPath);
}
/** /**
* Creates an rgb map for hazard types and returns the corresponding color. * Hazard categories
* */
* @param hazard private static HashMap<String, HazardCategory> hazardCategories;
* @return
*/
public static RGB getRGB(String hazard, int fcstHrIndex) {
if (rgbMap == null) {
loadColors();
}
if (fcstHrIndex < 0 || fcstHrIndex >= rgbMap.get(hazard).length) { public enum HazardCategory {
// take last as default if parameter is out of range (fcstHr=Other) SIERRA, TANGO, ZULU, NONE;
fcstHrIndex = rgbMap.get(hazard).length-1; }
}
return rgbMap.get(hazard)[fcstHrIndex]; /**
} * State orders in each FA area.
*/
private static HashMap<String, ArrayList<String>> stateOrderByArea;
/** /**
* Load colors. * Pairs like ("red", new RGB(255, 0, 0)) read from gfa.xml
*/ */
private static void loadColors() { private static HashMap<String, RGB> fzlvlSfcColors;
List<Node> colorNodes = selectNodes("/root/color/value");
definedColors = new HashMap<String, RGB>(); /**
for (Node n : colorNodes) { * Getter for the document.
int r = Integer.parseInt(n.valueOf("@r")); *
int g = Integer.parseInt(n.valueOf("@g")); * @return
int b = Integer.parseInt(n.valueOf("@b")); */
// for example, <"red", (255,0,0)> public static Document getDocument() {
definedColors.put(n.valueOf("@name"), new RGB(r, g, b)); if (doc == null) {
} readOptions();
}
return doc;
}
List<Node> hazardNodes = selectNodes(HAZARD_XPATH); /**
List<Node> fcstHrNodes = selectNodes(FCSTHR_XPATH); * Read the menu configuration from gfa.xml file
*/
private static void readOptions() {
File gfainfoFile = PgenStaticDataProvider.getProvider().getStaticFile(
PgenStaticDataProvider.getProvider().getPgenLocalizationRoot()
+ "gfa.xml");
// hazard type vs. color array (index means the same as the position try {
// in fcstHr combo box) SAXReader reader = new SAXReader();
rgbMap = new HashMap<String, RGB[]>(); doc = reader.read(gfainfoFile.getAbsoluteFile());
} catch (Exception e) {
e.printStackTrace();
}
}
for (Node n : hazardNodes) { /*
RGB[] colors = new RGB[fcstHrNodes.size()]; * This method is just to suppress warning
int i = 0; */
for (Node f : fcstHrNodes) { @SuppressWarnings("unchecked")
String type = f.valueOf("@type"); // for example, "smear" public static List<Node> selectNodes(String xPath) {
String colorStr = n.valueOf("@" + type); // for example, return (List<Node>) GfaInfo.getDocument().selectNodes(xPath);
// "blue" }
colors[i++] = definedColors.get(colorStr);
}
rgbMap.put(n.valueOf("@name"), colors);
}
}
/** /**
* Returns the default colors for the hazard and forecast hour pair. * Creates an rgb map for hazard types and returns the corresponding color.
* *
* @param hazard * @param hazard
* @param fcstHr * @return
* @return Color[] */
*/ public static RGB getRGB(String hazard, int fcstHrIndex) {
public static Color[] getDefaultColors(String hazard, String fcstHr) { if (rgbMap == null) {
RGB rgb = getDefaultRGB( hazard, fcstHr ); loadColors();
}
Color color = new Color(rgb.red, rgb.green, rgb.blue); if (fcstHrIndex < 0 || fcstHrIndex >= rgbMap.get(hazard).length) {
return new Color[]{color, color}; // take last as default if parameter is out of range (fcstHr=Other)
} fcstHrIndex = rgbMap.get(hazard).length - 1;
}
/** return rgbMap.get(hazard)[fcstHrIndex];
* Returns the default color's RGB for the hazard and forecast hour pair. }
*
* @param hazard
* @param fcstHr
* @return RGB
*/
public static RGB getDefaultRGB(String hazard, String fcstHr) {
if (definedColors == null) {
loadColors();
}
String xPath = HAZARD_XPATH + "[@name='" + hazard + "']"; /**
List<Node> hazardNodes = selectNodes(xPath); * Load colors.
*/
private static void loadColors() {
List<Node> colorNodes = selectNodes("/root/color/value");
xPath = FCSTHR_XPATH + "[@name='" + fcstHr + "']"; definedColors = new HashMap<String, RGB>();
List<Node> fcsthrNodes = selectNodes(xPath); for (Node n : colorNodes) {
int r = Integer.parseInt(n.valueOf("@r"));
int g = Integer.parseInt(n.valueOf("@g"));
int b = Integer.parseInt(n.valueOf("@b"));
// for example, <"red", (255,0,0)>
definedColors.put(n.valueOf("@name"), new RGB(r, g, b));
}
if (fcsthrNodes.size() != 1) { List<Node> hazardNodes = selectNodes(HAZARD_XPATH);
try{ List<Node> fcstHrNodes = selectNodes(FCSTHR_XPATH);
if(fcstHr.indexOf("-") == -1) { // snapshot
xPath = FCSTHR_XPATH + "[@name='0 Z']";
} else {
String second= fcstHr.split("-")[1];
String hour = second.split(":")[0];
if(Integer.parseInt(hour) <=6){ // smear
xPath = FCSTHR_XPATH + "[@name='0-6']";
} else { // outlook
xPath = FCSTHR_XPATH + "[@name='6-9']";
}
}
} catch (Exception e){
xPath = FCSTHR_XPATH + "[@name='Other']";
}
fcsthrNodes = selectNodes(xPath);
}
String gfaType = GFA_SNAPSHOT; // hazard type vs. color array (index means the same as the position
if ( fcsthrNodes.size() != 1 ) { //hard-coded // in fcstHr combo box)
if ( fcstHr.indexOf("-") >= 0 ) { rgbMap = new HashMap<String, RGB[]>();
String second= fcstHr.split("-")[1];
String hour = second.split(":")[0];
if(Integer.parseInt(hour) <=6) {
gfaType = GFA_SMEAR;
} else {
gfaType = GFA_OUTLOOK;
}
}
}
else {
gfaType = fcsthrNodes.get(0).valueOf("@type"); // from table
}
if (hazardNodes.size() != 1 ) { for (Node n : hazardNodes) {
throw new IllegalArgumentException("Please check hazard name"); RGB[] colors = new RGB[fcstHrNodes.size()];
} int i = 0;
for (Node f : fcstHrNodes) {
String type = f.valueOf("@type"); // for example, "smear"
String colorStr = n.valueOf("@" + type); // for example,
// "blue"
colors[i++] = definedColors.get(colorStr);
}
rgbMap.put(n.valueOf("@name"), colors);
}
}
String colorStr = hazardNodes.get(0).valueOf("@" + gfaType ); /**
* Returns the default colors for the hazard and forecast hour pair.
*
* @param hazard
* @param fcstHr
* @return Color[]
*/
public static Color[] getDefaultColors(String hazard, String fcstHr) {
RGB rgb = getDefaultRGB(hazard, fcstHr);
RGB rgb = definedColors.get(colorStr); Color color = new Color(rgb.red, rgb.green, rgb.blue);
return new Color[] { color, color };
}
return rgb; /**
} * Returns the default color's RGB for the hazard and forecast hour pair.
*
* @param hazard
* @param fcstHr
* @return RGB
*/
public static RGB getDefaultRGB(String hazard, String fcstHr) {
if (definedColors == null) {
loadColors();
}
/** String xPath = HAZARD_XPATH + "[@name='" + hazard + "']";
* Returns the default line width for the forecast hour. List<Node> hazardNodes = selectNodes(xPath);
*
* @param fcstHr
* @return
*/
public static int getLineWidth(String fcstHr) {
String xPath = FCSTHR_XPATH + "[@name='" + fcstHr + "']";
List<Node> fcsthrNodes = selectNodes(xPath);
int lineWidth = GFA_OTHER_LINEWIDTH; xPath = FCSTHR_XPATH + "[@name='" + fcstHr + "']";
if ( fcsthrNodes.size() > 0 ) { List<Node> fcsthrNodes = selectNodes(xPath);
lineWidth = Integer.parseInt( fcsthrNodes.get(0).valueOf("@linewidth") );
}
else {
if ( fcstHr.indexOf("-") >= 0 ) {
String second= fcstHr.split("-")[1];
String hour = second.split(":")[0];
if( Integer.parseInt(hour) <= 6 ) {
lineWidth = GFA_SMEAR_LINEWIDTH;
} else {
lineWidth = GFA_OUTLOOK_LINEWIDTH;
}
}
} if (fcsthrNodes.size() != 1) {
try {
if (fcstHr.indexOf("-") == -1) { // snapshot
xPath = FCSTHR_XPATH + "[@name='0 Z']";
} else {
String second = fcstHr.split("-")[1];
String hour = second.split(":")[0];
if (Integer.parseInt(hour) <= 6) { // smear
xPath = FCSTHR_XPATH + "[@name='0-6']";
} else { // outlook
xPath = FCSTHR_XPATH + "[@name='6-9']";
}
}
} catch (Exception e) {
xPath = FCSTHR_XPATH + "[@name='Other']";
}
fcsthrNodes = selectNodes(xPath);
}
return lineWidth; String gfaType = GFA_SNAPSHOT;
} if (fcsthrNodes.size() != 1) { // hard-coded
if (fcstHr.indexOf("-") >= 0) {
String second = fcstHr.split("-")[1];
String hour = second.split(":")[0];
if (Integer.parseInt(hour) <= 6) {
gfaType = GFA_SMEAR;
} else {
gfaType = GFA_OUTLOOK;
}
}
} else {
gfaType = fcsthrNodes.get(0).valueOf("@type"); // from table
}
public static boolean isFormat(String hazard){ if (hazardNodes.size() != 1) {
if (definedColors == null) { throw new IllegalArgumentException("Please check hazard name");
loadColors(); }
}
String xPath = HAZARD_XPATH + "[@name='" + hazard + "']"; String colorStr = hazardNodes.get(0).valueOf("@" + gfaType);
List<Node> hazardNodes = selectNodes(xPath);
if (hazardNodes.size() != 1) {
throw new IllegalArgumentException("Please check hazard name");
}
String format = hazardNodes.get(0).valueOf("@format");
return !"false".equals(format);
}
private static HashMap<String, HazardCategory> getHazardCategories() { RGB rgb = definedColors.get(colorStr);
if(hazardCategories == null) {
hazardCategories = new HashMap<String, HazardCategory>();
List<Node> nodes = selectNodes(HAZARD_XPATH);
for(Node n: nodes){
String key = n.valueOf("@name");
String category = n.valueOf("@category");
HazardCategory cat = HazardCategory.valueOf(HazardCategory.class, category);
if(cat == null) cat = HazardCategory.NONE;
hazardCategories.put(key, cat);
}
}
return hazardCategories;
}
public static HazardCategory getHazardCategory(String hazard){ return rgb;
return getHazardCategories().get(hazard); }
}
public static double getGfaOtlkgenRatio(){ /**
List<Node> nodes = selectNodes(GFA_OTLKGEN_RATIO_XPATH); * Returns the default line width for the forecast hour.
Node n = nodes.get(0); *
String rationStr = n.getStringValue(); * @param fcstHr
return Double.parseDouble(rationStr); * @return
} */
public static int getLineWidth(String fcstHr) {
String xPath = FCSTHR_XPATH + "[@name='" + fcstHr + "']";
List<Node> fcsthrNodes = selectNodes(xPath);
int lineWidth = GFA_OTHER_LINEWIDTH;
if (fcsthrNodes.size() > 0) {
lineWidth = Integer.parseInt(fcsthrNodes.get(0).valueOf(
"@linewidth"));
} else {
if (fcstHr.indexOf("-") >= 0) {
String second = fcstHr.split("-")[1];
String hour = second.split(":")[0];
if (Integer.parseInt(hour) <= 6) {
lineWidth = GFA_SMEAR_LINEWIDTH;
} else {
lineWidth = GFA_OUTLOOK_LINEWIDTH;
}
}
}
return lineWidth;
}
public static boolean isFormat(String hazard) {
if (definedColors == null) {
loadColors();
}
String xPath = HAZARD_XPATH + "[@name='" + hazard + "']";
List<Node> hazardNodes = selectNodes(xPath);
if (hazardNodes.size() != 1) {
throw new IllegalArgumentException("Please check hazard name");
}
String format = hazardNodes.get(0).valueOf("@format");
return !"false".equals(format);
}
private static HashMap<String, HazardCategory> getHazardCategories() {
if (hazardCategories == null) {
hazardCategories = new HashMap<String, HazardCategory>();
List<Node> nodes = selectNodes(HAZARD_XPATH);
for (Node n : nodes) {
String key = n.valueOf("@name");
String category = n.valueOf("@category");
HazardCategory cat = HazardCategory.valueOf(
HazardCategory.class, category);
if (cat == null)
cat = HazardCategory.NONE;
hazardCategories.put(key, cat);
}
}
return hazardCategories;
}
public static HazardCategory getHazardCategory(String hazard) {
return getHazardCategories().get(hazard);
}
public static double getGfaOtlkgenRatio() {
List<Node> nodes = selectNodes(GFA_OTLKGEN_RATIO_XPATH);
Node n = nodes.get(0);
String rationStr = n.getStringValue();
return Double.parseDouble(rationStr);
}
/** /**
* Return the fixed ordered state list in each FA area. * Return the fixed ordered state list in each FA area.
*/ */
public static HashMap<String, ArrayList<String> > getStateOrderByArea() { public static HashMap<String, ArrayList<String>> getStateOrderByArea() {
if ( stateOrderByArea == null ) { if (stateOrderByArea == null) {
stateOrderByArea = new HashMap<String, ArrayList<String> >(); stateOrderByArea = new HashMap<String, ArrayList<String>>();
ArrayList<String> bos = new ArrayList<String>(); ArrayList<String> bos = new ArrayList<String>();
String[] bosStr = new String[]{"ME","NH","VT","MA","RI","CT","NY", String[] bosStr = new String[] { "ME", "NH", "VT", "MA", "RI",
"LO","PA","NJ","OH","LE","WV","MD", "CT", "NY", "LO", "NJ", "PA", "OH", "LE", "WV", "MD", "DC",
"DC", "DE", "VA", "CSTL WTRS"}; "DE", "VA", "CSTL WTRS" };
for ( String st : bosStr ) { for (String st : bosStr) {
bos.add( st ); bos.add(st);
} }
stateOrderByArea.put( BOS, bos); stateOrderByArea.put(BOS, bos);
ArrayList<String> mia = new ArrayList<String>(); ArrayList<String> mia = new ArrayList<String>();
String[] miaStr = new String[]{"NC", "SC", "GA", "FL" , "CSTL WTRS"}; String[] miaStr = new String[] { "NC", "SC", "GA", "FL",
for ( String st : miaStr ) { "CSTL WTRS" };
mia.add( st ); for (String st : miaStr) {
} mia.add(st);
stateOrderByArea.put( MIA, mia ); }
stateOrderByArea.put(MIA, mia);
ArrayList<String> chi = new ArrayList<String>(); ArrayList<String> chi = new ArrayList<String>();
String[] chiStr = new String[]{"ND", "SD", "NE", "KS", "MN", "IA", String[] chiStr = new String[] { "ND", "SD", "NE", "KS", "MN",
"MO", "WI", "LM", "LS", "MI", "LH", "IA", "MO", "WI", "LM", "LS", "MI", "LH", "IL", "IN", "KY" };
"IL", "IN", "KY"}; for (String st : chiStr) {
for ( String st : chiStr ) { chi.add(st);
chi.add( st ); }
} stateOrderByArea.put(CHI, chi);
stateOrderByArea.put( CHI, chi );
ArrayList<String> dfw = new ArrayList<String>(); ArrayList<String> dfw = new ArrayList<String>();
String[] dfwStr = new String[]{"OK", "TX", "AR", "TN", "LA", "MS", String[] dfwStr = new String[] { "OK", "TX", "AR", "TN", "LA",
"AL", "CSTL WTRS"}; "MS", "AL", "CSTL WTRS" };
for ( String st : dfwStr ) { for (String st : dfwStr) {
dfw.add( st ); dfw.add(st);
} }
stateOrderByArea.put( DFW, dfw ); stateOrderByArea.put(DFW, dfw);
ArrayList<String> slc = new ArrayList<String>(); ArrayList<String> slc = new ArrayList<String>();
String[] slcStr = new String[]{"ID", "MT", "WY", "NV", "UT", "CO", String[] slcStr = new String[] { "ID", "MT", "WY", "NV", "UT",
"AZ", "NM"} ; "CO", "AZ", "NM" };
for ( String st : slcStr ) { for (String st : slcStr) {
slc.add( st ); slc.add(st);
} }
stateOrderByArea.put( SLC, slc ); stateOrderByArea.put(SLC, slc);
ArrayList<String> sfo = new ArrayList<String>(); ArrayList<String> sfo = new ArrayList<String>();
String[] sfoStr = new String[]{"WA", "OR", "CA", "CSTL WTRS"}; String[] sfoStr = new String[] { "WA", "OR", "CA", "CSTL WTRS" };
for ( String st : sfoStr ) { for (String st : sfoStr) {
sfo.add( st ); sfo.add(st);
} }
stateOrderByArea.put( SFO, sfo ); stateOrderByArea.put(SFO, sfo);
} }
return stateOrderByArea; return stateOrderByArea;
} }
/** /**
* Get colors for FZLVL SFC snapshot, smear, or outlook. * Get colors for FZLVL SFC snapshot, smear, or outlook. Default is "sky".
* Default is "sky". */
*/ public static RGB getFzlvlSfcColor(String name) {
public static RGB getFzlvlSfcColor( String name ) {
if ( definedColors == null ) { if (definedColors == null) {
loadColors(); loadColors();
} }
List<Node> colorNodes = selectNodes("/root/fzlvlSFC/value"); List<Node> colorNodes = selectNodes("/root/fzlvlSFC/value");
if ( fzlvlSfcColors == null ) { if (fzlvlSfcColors == null) {
fzlvlSfcColors = new HashMap<String, RGB>(); fzlvlSfcColors = new HashMap<String, RGB>();
for ( Node nd : colorNodes ) { for (Node nd : colorNodes) {
fzlvlSfcColors.put( nd.valueOf("@name"), definedColors.get( nd.valueOf("@nmapcolor") ) ); fzlvlSfcColors.put(nd.valueOf("@name"),
} definedColors.get(nd.valueOf("@nmapcolor")));
} }
}
RGB clr = fzlvlSfcColors.get( name ); RGB clr = fzlvlSfcColors.get(name);
if ( clr == null ) clr = definedColors.get( "sky" ); if (clr == null)
clr = definedColors.get("sky");
return clr; return clr;
} }
} }

View file

@ -179,7 +179,7 @@ public class ProductManageDialog extends ProductDialog {
* Sets the title of the dialog. * Sets the title of the dialog.
*/ */
public void setTitle() { public void setTitle() {
shell.setText("Product Center"); shell.setText("Activity Center");
} }
/** /**
@ -319,7 +319,7 @@ public class ProductManageDialog extends ProductDialog {
titleComp.setLayout(gl0); titleComp.setLayout(gl0);
Label prds = new Label(titleComp, SWT.NONE); Label prds = new Label(titleComp, SWT.NONE);
prds.setText("Products:"); prds.setText("Activities:");
/* /*
* if ( !compact ) { Button multiSaveBtn = new Button( titleComp, * if ( !compact ) { Button multiSaveBtn = new Button( titleComp,
@ -745,12 +745,8 @@ public class ProductManageDialog extends ProductDialog {
if (!compact) { if (!compact) {
Button clrBtn = new Button(layersComp, SWT.PUSH); Button clrBtn = new Button(layersComp, SWT.PUSH);
if (lyr.isMonoColor()) { clrBtn.setText(getDisplayString(lyr.isMonoColor(),
clrBtn.setText("M/F"); lyr.isFilled()));
} else {
clrBtn.setText("A/F");
}
setButtonColor(clrBtn, lyr.getColor()); setButtonColor(clrBtn, lyr.getColor());
clrBtn.setData(ii); clrBtn.setData(ii);
@ -852,12 +848,8 @@ public class ProductManageDialog extends ProductDialog {
protected void updateDisplayAttr(boolean mono, Color clr, boolean fill) { protected void updateDisplayAttr(boolean mono, Color clr, boolean fill) {
if (colorModeBtnInUse >= 0) { if (colorModeBtnInUse >= 0) {
colorModeBtns.get(colorModeBtnInUse).setText(
if (mono) { getDisplayString(mono, fill));
colorModeBtns.get(colorModeBtnInUse).setText("M/F");
} else {
colorModeBtns.get(colorModeBtnInUse).setText("A/F");
}
layerList.get(colorModeBtnInUse).setMonoColor(mono); layerList.get(colorModeBtnInUse).setMonoColor(mono);
layerList.get(colorModeBtnInUse).setColor(clr); layerList.get(colorModeBtnInUse).setColor(clr);
@ -2188,4 +2180,25 @@ public class ProductManageDialog extends ProductDialog {
exitProductManage(); exitProductManage();
} }
/*
* Build a string based on given Mono color and fill flags..
*/
private String getDisplayString(boolean monoClr, boolean fill) {
String dispStr = "";
if (monoClr) {
if (fill)
dispStr += "M/F ";
else
dispStr += "M/N";
} else {
if (fill)
dispStr += "A/F ";
else
dispStr += "A/N ";
}
return dispStr;
}
} }

View file

@ -11,10 +11,10 @@ import gov.noaa.nws.ncep.ui.pgen.PgenUtil;
import gov.noaa.nws.ncep.ui.pgen.producttypes.PgenLayer; import gov.noaa.nws.ncep.ui.pgen.producttypes.PgenLayer;
import gov.noaa.nws.ncep.ui.pgen.producttypes.ProductType; import gov.noaa.nws.ncep.ui.pgen.producttypes.ProductType;
import java.awt.Color;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.awt.Color;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionAdapter;
@ -29,13 +29,13 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.FileDialog; import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem; import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.ToolBar; import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem; import org.eclipse.swt.widgets.ToolItem;
@ -60,497 +60,500 @@ import org.eclipse.swt.widgets.ToolItem;
public class ProductNameDialog extends ProductDialog { public class ProductNameDialog extends ProductDialog {
private Text nameText = null; private Text nameText = null;
private Combo typeCombo = null;
private Composite typeComp = null;
private Text typeText = null;
private ToolBar typeToolBar = null;
private Text forecasterText = null;
private Text centerText = null;
private Button saveLayerBtn = null;
private Text outputFileTxt = null;
private Group layersGrp = null;
private String initialOutput = null; private Combo typeCombo = null;
private Composite typeComp = null;
private Text typeText = null;
private ToolBar typeToolBar = null;
private Text forecasterText = null;
private Text centerText = null;
private Button saveLayerBtn = null;
private Text outputFileTxt = null;
private Group layersGrp = null;
private String initialOutput = null;
private ProductManageDialog prdManageDlg = null; private ProductManageDialog prdManageDlg = null;
/**
/**
* Constructor. * Constructor.
*/ */
public ProductNameDialog( Shell parentShell, ProductManageDialog dlg ) { public ProductNameDialog(Shell parentShell, ProductManageDialog dlg) {
super( parentShell ); super(parentShell);
prdManageDlg = dlg; prdManageDlg = dlg;
}
/**
* Sets the title of the dialog.
*/
public void setTitle() {
shell.setText( "Edit Product" );
} }
/** /**
* Creates the main layout for the shell. * Sets the title of the dialog.
*/
public void setTitle() {
shell.setText("Edit Activity");
}
/**
* Creates the main layout for the shell.
*/ */
public void setLayout() { public void setLayout() {
GridLayout mainLayout = new GridLayout( 1, true ); GridLayout mainLayout = new GridLayout(1, true);
mainLayout.marginHeight = 1; mainLayout.marginHeight = 1;
mainLayout.marginWidth = 1; mainLayout.marginWidth = 1;
shell.setLayout( mainLayout ); shell.setLayout(mainLayout);
} }
/** /**
* Set the default location. * Set the default location.
*
* @param parent * @param parent
*/ */
public void setDefaultLocation( Shell parent ) { public void setDefaultLocation(Shell parent) {
if ( shellLocation == null ) { if (shellLocation == null) {
Point pt = parent.getLocation(); Point pt = parent.getLocation();
shell.setLocation( pt.x + 420, pt.y + 200 ); shell.setLocation(pt.x + 420, pt.y + 200);
} else { } else {
shell.setLocation(shellLocation); shell.setLocation(shellLocation);
} }
} }
/** /**
* Initialize the dialog components. * Initialize the dialog components.
*/ */
public void initializeComponents() { public void initializeComponents() {
// initialOutput = prdManageDlg.getPrdOutputFile( prdManageDlg.getActiveProduct() ); // initialOutput = prdManageDlg.getPrdOutputFile(
initialOutput = prdManageDlg.getActiveProduct().getOutputFile(); // prdManageDlg.getActiveProduct() );
initialOutput = prdManageDlg.getActiveProduct().getOutputFile();
Composite main = new Composite( shell, SWT.NONE ); Composite main = new Composite(shell, SWT.NONE);
GridLayout gl1 = new GridLayout( 1, false ); GridLayout gl1 = new GridLayout(1, false);
main.setLayout( gl1 ); main.setLayout(gl1);
Composite top = new Composite( main, SWT.NONE ); Composite top = new Composite(main, SWT.NONE);
GridLayout gl = new GridLayout( 2, false ); GridLayout gl = new GridLayout(2, false);
top.setLayout( gl ); top.setLayout(gl);
GridData gd = new GridData( SWT.FILL, SWT.DEFAULT, true, false ); GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
Label pname = new Label( top, SWT.NONE ); Label pname = new Label(top, SWT.NONE);
pname.setText( "Name:"); pname.setText("Name:");
nameText = new Text( top, SWT.SINGLE | SWT.BORDER ); nameText = new Text(top, SWT.SINGLE | SWT.BORDER);
nameText.setLayoutData( new GridData( 100, 20 ) ); nameText.setLayoutData(new GridData(100, 20));
nameText.setEditable( true ); nameText.setEditable(true);
nameText.setText( prdManageDlg.getActiveProduct().getName() ); nameText.setText(prdManageDlg.getActiveProduct().getName());
Label ptype = new Label( top, SWT.NONE ); Label ptype = new Label(top, SWT.NONE);
ptype.setText( "Type:"); ptype.setText("Type:");
String curType = prdManageDlg.getActiveProduct().getType(); String curType = prdManageDlg.getActiveProduct().getType();
typeComp = new Composite( top, SWT.LEFT ); typeComp = new Composite(top, SWT.LEFT);
typeComp.setLayout( new GridLayout( 2, false ) ); typeComp.setLayout(new GridLayout(2, false));
typeText = new Text( typeComp, SWT.LEFT | SWT.BORDER ); typeText = new Text(typeComp, SWT.LEFT | SWT.BORDER);
typeText.setSize( 300, 20 ); typeText.setSize(300, 20);
typeText.setText( curType ); typeText.setText(curType);
typeText.setData( curType ); typeText.setData(curType);
typeText.setEditable( false ); typeText.setEditable(false);
typeToolBar = new ToolBar( typeComp, SWT.HORIZONTAL ); typeToolBar = new ToolBar(typeComp, SWT.HORIZONTAL);
final ToolItem ti = new ToolItem( typeToolBar, SWT.DROP_DOWN ); final ToolItem ti = new ToolItem(typeToolBar, SWT.DROP_DOWN);
ti.setEnabled( true ); ti.setEnabled(true);
final Menu mu = new Menu( shell.getShell(), SWT.POP_UP ); final Menu mu = new Menu(shell.getShell(), SWT.POP_UP);
MenuItem mi1 = new MenuItem( mu, SWT.PUSH, 0 );
mi1.setText( "Default" );
mi1.setData( "Default" );
mi1.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
typeText.setText( ((MenuItem)e.widget).getData().toString() );
typeText.pack();
typeComp.pack();
typeComp.getParent().pack();
switchProductType( "Default" );
}
});
int ntyp = 1;
ArrayList<String> typeUsed = new ArrayList<String>();
for ( String ptypName : prdManageDlg.prdTypesMap.keySet() ) {
ProductType prdType = prdManageDlg.prdTypesMap.get( ptypName );
LinkedHashMap<String, String> subtypesNalias = prdManageDlg.getSubtypes( prdType.getType(), true );
if ( (ptypName.equals( prdType.getName() ) &&
!prdType.getType().equals( prdType.getName() ) ) ||
!prdManageDlg.hasSubtypes( subtypesNalias.values() ) ) {
MenuItem typeItem = new MenuItem( mu, SWT.PUSH, ntyp );
typeItem.setText( ptypName );
typeItem.setData( ptypName );
typeItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
String typeName = ((MenuItem)e.widget).getData().toString();
typeText.setText( typeName );
typeText.pack();
typeComp.pack();
typeComp.getParent().pack();
switchProductType( typeName );
}
});
MenuItem mi1 = new MenuItem(mu, SWT.PUSH, 0);
mi1.setText("Default");
mi1.setData("Default");
mi1.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
typeText.setText(((MenuItem) e.widget).getData().toString());
typeText.pack();
typeComp.pack();
typeComp.getParent().pack();
switchProductType("Default");
} }
else {
if ( typeUsed.contains( prdType.getType() ) ) {
continue;
}
else {
typeUsed.add( prdType.getType() );
}
MenuItem typeItem = new MenuItem( mu, SWT.CASCADE, ntyp );
typeItem.setText( prdType.getType() );
Menu submenu = new Menu( typeItem );
typeItem.setMenu( submenu );
for ( String styp : subtypesNalias.keySet() ) {
MenuItem subtypeItem = new MenuItem( submenu, SWT.PUSH );
subtypeItem.setText( subtypesNalias.get( styp ) );
subtypeItem.setData( styp );
subtypeItem.addSelectionListener( new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
String typeName = ((MenuItem)e.widget).getData().toString();
typeText.setText( typeName );
typeText.pack();
typeComp.pack();
typeComp.getParent().pack();
switchProductType( typeName);
}
});
}
}
ntyp++;
}
ti.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
Rectangle bounds = ti.getBounds();
Point point = typeToolBar.toDisplay( bounds.x, bounds.y + bounds.height );
mu.setLocation( point );
mu.setVisible( true );
}
}); });
Label pfst = new Label( top, SWT.NONE ); int ntyp = 1;
pfst.setText( "Forecaster:"); ArrayList<String> typeUsed = new ArrayList<String>();
for (String ptypName : prdManageDlg.prdTypesMap.keySet()) {
forecasterText = new Text( top, SWT.SINGLE | SWT.BORDER ); ProductType prdType = prdManageDlg.prdTypesMap.get(ptypName);
forecasterText.setLayoutData( new GridData( 100, 20 ) ); LinkedHashMap<String, String> subtypesNalias = prdManageDlg
forecasterText.setEditable( true ); .getSubtypes(prdType.getType(), true);
forecasterText.setText( prdManageDlg.getActiveProduct().getForecaster() );
Label pcnt = new Label( top, SWT.NONE ); if ((ptypName.equals(prdType.getName()) && !prdType.getType()
pcnt.setText( "Center:"); .equals(prdType.getName()))
|| !prdManageDlg.hasSubtypes(subtypesNalias.values())) {
centerText = new Text( top, SWT.SINGLE | SWT.BORDER ); MenuItem typeItem = new MenuItem(mu, SWT.PUSH, ntyp);
centerText.setLayoutData( new GridData( 100, 20 ) );
centerText.setEditable( true );
centerText.setText( prdManageDlg.getActiveProduct().getCenter() );
Group typeInfoGrp = new Group( main, SWT.SHADOW_IN ); typeItem.setText(ptypName);
typeInfoGrp.setLayout( new GridLayout( 1, false) ); typeItem.setData(ptypName);
typeInfoGrp.setText( "Product Type Information" ); typeItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
String typeName = ((MenuItem) e.widget).getData()
.toString();
typeText.setText(typeName);
typeText.pack();
typeComp.pack();
typeComp.getParent().pack();
switchProductType(typeName);
}
});
Composite bot1 = new Composite( typeInfoGrp, SWT.NONE ); } else {
bot1.setLayout( new GridLayout( 2, false) );
Composite bot2 = new Composite( typeInfoGrp, SWT.NONE ); if (typeUsed.contains(prdType.getType())) {
bot2.setLayout( new GridLayout( 3, false) ); continue;
} else {
typeUsed.add(prdType.getType());
Label psave = new Label( bot1, SWT.NONE ); }
psave.setText( "Save Layers:");
saveLayerBtn = new Button( bot1, SWT.CHECK ); MenuItem typeItem = new MenuItem(mu, SWT.CASCADE, ntyp);
saveLayerBtn.setSelection( prdManageDlg.getActiveProduct().isSaveLayers() );
//Create a composite for output file name typeItem.setText(prdType.getType());
Label outputLbl = new Label( bot2, SWT.LEFT ); Menu submenu = new Menu(typeItem);
typeItem.setMenu(submenu);
for (String styp : subtypesNalias.keySet()) {
MenuItem subtypeItem = new MenuItem(submenu, SWT.PUSH);
subtypeItem.setText(subtypesNalias.get(styp));
subtypeItem.setData(styp);
subtypeItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
String typeName = ((MenuItem) e.widget).getData()
.toString();
typeText.setText(typeName);
typeText.pack();
typeComp.pack();
typeComp.getParent().pack();
switchProductType(typeName);
}
});
}
}
ntyp++;
}
ti.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
Rectangle bounds = ti.getBounds();
Point point = typeToolBar.toDisplay(bounds.x, bounds.y
+ bounds.height);
mu.setLocation(point);
mu.setVisible(true);
}
});
Label pfst = new Label(top, SWT.NONE);
pfst.setText("Forecaster:");
forecasterText = new Text(top, SWT.SINGLE | SWT.BORDER);
forecasterText.setLayoutData(new GridData(100, 20));
forecasterText.setEditable(true);
forecasterText.setText(prdManageDlg.getActiveProduct().getForecaster());
Label pcnt = new Label(top, SWT.NONE);
pcnt.setText("Center:");
centerText = new Text(top, SWT.SINGLE | SWT.BORDER);
centerText.setLayoutData(new GridData(100, 20));
centerText.setEditable(true);
centerText.setText(prdManageDlg.getActiveProduct().getCenter());
Group typeInfoGrp = new Group(main, SWT.SHADOW_IN);
typeInfoGrp.setLayout(new GridLayout(1, false));
typeInfoGrp.setText("Product Type Information");
Composite bot1 = new Composite(typeInfoGrp, SWT.NONE);
bot1.setLayout(new GridLayout(2, false));
Composite bot2 = new Composite(typeInfoGrp, SWT.NONE);
bot2.setLayout(new GridLayout(3, false));
Label psave = new Label(bot1, SWT.NONE);
psave.setText("Save Layers:");
saveLayerBtn = new Button(bot1, SWT.CHECK);
saveLayerBtn.setSelection(prdManageDlg.getActiveProduct()
.isSaveLayers());
// Create a composite for output file name
Label outputLbl = new Label(bot2, SWT.LEFT);
outputLbl.setText("Output:"); outputLbl.setText("Output:");
outputFileTxt = new Text( bot2, SWT.SINGLE | SWT.BORDER ); outputFileTxt = new Text(bot2, SWT.SINGLE | SWT.BORDER);
outputFileTxt.setLayoutData( new GridData( 150, 20 ) ); outputFileTxt.setLayoutData(new GridData(150, 20));
outputFileTxt.setEditable( true ); outputFileTxt.setEditable(true);
if ( initialOutput != null ) { if (initialOutput != null) {
outputFileTxt.setText( initialOutput ); outputFileTxt.setText(initialOutput);
} } else {
else { outputFileTxt.setText("");
outputFileTxt.setText( "" );
} }
Button browseBtn = new Button( bot2, SWT.PUSH ); Button browseBtn = new Button(bot2, SWT.PUSH);
browseBtn.setText( "Browse"); browseBtn.setText("Browse");
layersGrp = new Group( typeInfoGrp, SWT.NONE ); layersGrp = new Group(typeInfoGrp, SWT.NONE);
layersGrp.setLayout( new GridLayout( 1, false) ); layersGrp.setLayout(new GridLayout(1, false));
layersGrp.setText( "Layers Defined"); layersGrp.setText("Layers Defined");
String prevType = prdManageDlg.getActiveProduct().getType(); String prevType = prdManageDlg.getActiveProduct().getType();
createLayersTemplate( layersGrp , prevType ); createLayersTemplate(layersGrp, prevType);
browseBtn.addSelectionListener( new SelectionAdapter() { browseBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected( SelectionEvent event ) { public void widgetSelected(SelectionEvent event) {
createFileText( outputFileTxt, initialOutput ); createFileText(outputFileTxt, initialOutput);
} }
}); });
browseBtn.setEnabled( false ); browseBtn.setEnabled(false);
// Create control buttons // Create control buttons
Composite centeredComp = new Composite( shell, SWT.NONE ); Composite centeredComp = new Composite(shell, SWT.NONE);
GridLayout gl2 = new GridLayout( 2, true ); GridLayout gl2 = new GridLayout(2, true);
centeredComp.setLayout( gl2 ); centeredComp.setLayout(gl2);
centeredComp.setLayoutData( gd ); centeredComp.setLayoutData(gd);
Button acceptBtn = new Button( centeredComp, SWT.NONE ); Button acceptBtn = new Button(centeredComp, SWT.NONE);
acceptBtn.setText( "Accept" ); acceptBtn.setText("Accept");
acceptBtn.setLayoutData( gd ); acceptBtn.setLayoutData(gd);
acceptBtn.addSelectionListener( new SelectionAdapter() { acceptBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
updateProduct(); updateProduct();
close(); close();
} }
}); });
Button cancelBtn = new Button( centeredComp, SWT.NONE ); Button cancelBtn = new Button(centeredComp, SWT.NONE);
cancelBtn.setText( " Close " ); cancelBtn.setText(" Close ");
cancelBtn.setLayoutData( gd ); cancelBtn.setLayoutData(gd);
cancelBtn.addSelectionListener( new SelectionAdapter() { cancelBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
prdManageDlg.setOpenPrdNameDlg( false ); prdManageDlg.setOpenPrdNameDlg(false);
close(); close();
} }
}); });
} }
/*
/* * Update the product attributes in the product control window.
* Update the product attributes in the product control window.
*/ */
private void updateProduct() { private void updateProduct() {
// selectProductType(); // selectProductType();
HashMap<String, String> attr = new HashMap<String, String>(); HashMap<String, String> attr = new HashMap<String, String>();
attr.put( "name", nameText.getText() ); attr.put("name", nameText.getText());
attr.put( "type", typeText.getText() ); attr.put("type", typeText.getText());
attr.put( "forecaster", forecasterText.getText() ); attr.put("forecaster", forecasterText.getText());
attr.put( "center", centerText.getText() ); attr.put("center", centerText.getText());
if (saveLayerBtn.getSelection() ) { if (saveLayerBtn.getSelection()) {
attr.put( "saveLayers", "true" ); attr.put("saveLayers", "true");
} } else {
else { attr.put("saveLayers", "false");
attr.put( "saveLayers", "false" ); }
} attr.put("outputfile", outputFileTxt.getText());
attr.put( "outputfile", outputFileTxt.getText() );
if ( prdManageDlg != null ) { if (prdManageDlg != null) {
prdManageDlg.updateProductAttr( attr ); prdManageDlg.updateProductAttr(attr);
} }
} }
/* /*
* Select a product type with confirmation. * Select a product type with confirmation.
*/ */
private void selectProductType() { private void selectProductType() {
if ( !(typeCombo.getText().equals( prdManageDlg.getActiveProduct().getType() ) ) ) { if (!(typeCombo.getText().equals(prdManageDlg.getActiveProduct()
/* .getType()))) {
MessageDialog confirmDlg = new MessageDialog( /*
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), * MessageDialog confirmDlg = new MessageDialog(
"Confirm type", null, * PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
"Are you sure you want to switch from type " + * "Confirm type", null,
prdManageDlg.getActiveProduct().getType() * "Are you sure you want to switch from type " +
+ " to type " + typeCombo.getText() + "?", * prdManageDlg.getActiveProduct().getType() + " to type " +
MessageDialog.QUESTION, new String[]{"OK", "Cancel"}, 0); * typeCombo.getText() + "?", MessageDialog.QUESTION, new
* String[]{"OK", "Cancel"}, 0);
*
* confirmDlg.open();
*
* if ( confirmDlg.getReturnCode() != MessageDialog.OK ) {
* typeCombo.select( curType ); }
*/
confirmDlg.open(); // typeCombo.select( curType );
if ( confirmDlg.getReturnCode() != MessageDialog.OK ) {
typeCombo.select( curType );
}
*/
// typeCombo.select( curType );
} }
} }
/** /**
* Create a file/path input dialog with a Text and a "Browse" button. * Create a file/path input dialog with a Text and a "Browse" button.
* *
* @param txt * @param txt
* @return * @return
*/ */
private void createFileText( Text txt, String initialFile ) { private void createFileText(Text txt, String initialFile) {
String[] filterNames = new String[] { "*.xml", "All Files (*)" }; String[] filterNames = new String[] { "*.xml", "All Files (*)" };
String[] filterExtensions = new String[] {"*.xml", "*" }; String[] filterExtensions = new String[] { "*.xml", "*" };
// String filterPath = PgenUtil.CURRENT_WORKING_DIRECTORY; // String filterPath = PgenUtil.CURRENT_WORKING_DIRECTORY;
String filterPath = PgenUtil.getWorkingDirectory(); String filterPath = PgenUtil.getWorkingDirectory();
String defaultFile = new String( "default.xml" ); String defaultFile = new String("default.xml");
if ( initialFile != null ) { if (initialFile != null) {
int index = initialFile.lastIndexOf('/'); int index = initialFile.lastIndexOf('/');
if ( index >= 0 ) { if (index >= 0) {
defaultFile = initialFile.substring( index+1, initialFile.length() ); defaultFile = initialFile.substring(index + 1,
filterPath = initialFile.substring( 0, index); initialFile.length());
} filterPath = initialFile.substring(0, index);
else { } else {
defaultFile = new String( initialFile ); defaultFile = new String(initialFile);
} }
}
String selectedFile = selectFile( shell, SWT.OPEN, filterNames,
filterExtensions, filterPath, defaultFile, true );
if ( selectedFile != null ) {
txt.setText( selectedFile );
}
}
/**
* Create a file selection dialog
*
* @param sh
* @param mode
* @param nameFilter
* @param extensionFilter
* @param pathFilter
* @param defaultFile
* @param overWrite
* @return dialog.open()
*/
private String selectFile( Shell sh, int mode, String[] nameFilter,
String[] extensionFilter, String pathFilter,
String defaultFile, boolean overWrite ) {
FileDialog dialog = new FileDialog( sh, mode );
dialog.setFilterNames( nameFilter );
dialog.setFilterExtensions( extensionFilter );
dialog.setFilterPath( pathFilter );
if ( defaultFile != null ) {
dialog.setFileName ( defaultFile );
} }
dialog.setOverwrite( overWrite );
String selectedFile = selectFile(shell, SWT.OPEN, filterNames,
filterExtensions, filterPath, defaultFile, true);
if (selectedFile != null) {
txt.setText(selectedFile);
}
}
/**
* Create a file selection dialog
*
* @param sh
* @param mode
* @param nameFilter
* @param extensionFilter
* @param pathFilter
* @param defaultFile
* @param overWrite
* @return dialog.open()
*/
private String selectFile(Shell sh, int mode, String[] nameFilter,
String[] extensionFilter, String pathFilter, String defaultFile,
boolean overWrite) {
FileDialog dialog = new FileDialog(sh, mode);
dialog.setFilterNames(nameFilter);
dialog.setFilterExtensions(extensionFilter);
dialog.setFilterPath(pathFilter);
if (defaultFile != null) {
dialog.setFileName(defaultFile);
}
dialog.setOverwrite(overWrite);
return dialog.open(); return dialog.open();
} }
/* /*
* Create name, on/off, and color mode buttons for defined layers * Create name, on/off, and color mode buttons for defined layers
*/ */
private void createLayersTemplate( Composite cmp, String typ ) { private void createLayersTemplate(Composite cmp, String typ) {
Control[] wids = cmp.getChildren(); Control[] wids = cmp.getChildren();
for ( int jj = 0; jj < wids.length; jj++ ) { for (int jj = 0; jj < wids.length; jj++) {
wids[jj].dispose(); wids[jj].dispose();
}
cmp.pack();
shell.pack( true );
ProductType prdtype = prdManageDlg.prdTypesMap.get( typ );
if ( prdtype == null || prdtype.getPgenLayer() == null ||
prdtype.getPgenLayer().size() <= 0 ) {
return;
} }
Composite layersComp = new Composite( cmp, SWT.NONE ); cmp.pack();
GridLayout gl = new GridLayout( 3, false ); shell.pack(true);
ProductType prdtype = prdManageDlg.prdTypesMap.get(typ);
if (prdtype == null || prdtype.getPgenLayer() == null
|| prdtype.getPgenLayer().size() <= 0) {
return;
}
Composite layersComp = new Composite(cmp, SWT.NONE);
GridLayout gl = new GridLayout(3, false);
gl.marginHeight = 1; gl.marginHeight = 1;
gl.marginWidth = 1; gl.marginWidth = 1;
gl.verticalSpacing = 1; gl.verticalSpacing = 1;
gl.horizontalSpacing = 10; gl.horizontalSpacing = 10;
layersComp.setLayout( gl ); layersComp.setLayout(gl);
for ( PgenLayer lyr : prdtype.getPgenLayer() ) { for (PgenLayer lyr : prdtype.getPgenLayer()) {
Button nameBtn = new Button( layersComp, SWT.PUSH ); Button nameBtn = new Button(layersComp, SWT.PUSH);
nameBtn.setText( lyr.getName() ); nameBtn.setText(lyr.getName());
Button dispBtn = new Button( layersComp, SWT.CHECK ); Button dispBtn = new Button(layersComp, SWT.CHECK);
dispBtn.setSelection( lyr.isOnOff() ); dispBtn.setSelection(lyr.isOnOff());
dispBtn.setEnabled( false ); dispBtn.setEnabled(false);
Button clrBtn = new Button( layersComp, SWT.PUSH ); Button clrBtn = new Button(layersComp, SWT.PUSH);
clrBtn.setText( "A/F" ); clrBtn.setText("A/F");
Color clr = new Color( lyr.getColor().getRed(), Color clr = new Color(lyr.getColor().getRed(), lyr.getColor()
lyr.getColor().getGreen(), .getGreen(), lyr.getColor().getBlue(), lyr.getColor()
lyr.getColor().getBlue(), .getAlpha());
lyr.getColor().getAlpha() );
setButtonColor( clrBtn, clr ); setButtonColor(clrBtn, clr);
} }
cmp.pack(); cmp.pack();
shell.pack( true ); shell.pack(true);
} }
/* /*
* Switch to a new type * Switch to a new type
*/ */
private void switchProductType( String newType ) { private void switchProductType(String newType) {
createLayersTemplate( layersGrp, newType ); createLayersTemplate(layersGrp, newType);
nameText.setText( newType ); nameText.setText(newType);
saveLayerBtn.setSelection( false ); saveLayerBtn.setSelection(false);
outputFileTxt.setText( "" ); outputFileTxt.setText("");
outputFileTxt.setEditable( false ); outputFileTxt.setEditable(false);
ProductType ptyp = prdManageDlg.prdTypesMap.get( newType ); ProductType ptyp = prdManageDlg.prdTypesMap.get(newType);
if ( ptyp != null ) { if (ptyp != null) {
if ( ptyp.getPgenSave() != null ) { if (ptyp.getPgenSave() != null) {
if ( ptyp.getPgenSave().getOutputFile() != null ) { if (ptyp.getPgenSave().getOutputFile() != null) {
outputFileTxt.setText( ptyp.getPgenSave().getOutputFile() ); outputFileTxt.setText(ptyp.getPgenSave().getOutputFile());
} }
if ( ptyp.getPgenSave().isSaveLayers() != null ) { if (ptyp.getPgenSave().isSaveLayers() != null) {
saveLayerBtn.setSelection( ptyp.getPgenSave().isSaveLayers() ); saveLayerBtn
} .setSelection(ptyp.getPgenSave().isSaveLayers());
} }
}
} }
} }
} }

View file

@ -143,7 +143,9 @@ import com.vividsolutions.jts.geom.Point;
* 03/13 #927 B. Yin Implemented IContextMenuProvider interface * 03/13 #927 B. Yin Implemented IContextMenuProvider interface
* 04/13 #874 B. Yin Added a method replaceElements with parameter parent. * 04/13 #874 B. Yin Added a method replaceElements with parameter parent.
* 04/13 #977 S. Gilbert PGEN Database support * 04/13 #977 S. Gilbert PGEN Database support
* 11/13 TTR 752 J. Wu Add methods for CCFP text auto placement. * 09/14 TTR972 J. Wu "Filled" object on the active layer should be
* drawn as "filled" even if the "filled" flag for
* the layer is "false".
* </pre> * </pre>
* *
* @author B. Yin * @author B. Yin
@ -1841,6 +1843,12 @@ public class PgenResource extends
dprops.setLayerMonoColor(layer.isMonoColor()); dprops.setLayerMonoColor(layer.isMonoColor());
dprops.setLayerColor(layer.getColor()); dprops.setLayerColor(layer.getColor());
dprops.setLayerFilled(layer.isFilled()); dprops.setLayerFilled(layer.isFilled());
} else {
/*
* "Filled" should always be set to "true" for displaying the
* active layer.
*/
dprops.setLayerFilled(true);
} }
Iterator<DrawableElement> iterator = layer.createDEIterator(); Iterator<DrawableElement> iterator = layer.createDEIterator();
@ -1991,7 +1999,6 @@ public class PgenResource extends
PaintProperties paintProps, DisplayProperties dispProps) { PaintProperties paintProps, DisplayProperties dispProps) {
if (filters.acceptOnce(de)) { if (filters.acceptOnce(de)) {
if (!displayMap.containsKey(de)) { if (!displayMap.containsKey(de)) {
AbstractElementContainer container = ElementContainerFactory AbstractElementContainer container = ElementContainerFactory
.createContainer(de, descriptor, target); .createContainer(de, descriptor, target);

View file

@ -23,7 +23,6 @@ import gov.noaa.nws.ncep.ui.pgen.display.AbstractElementContainer;
import gov.noaa.nws.ncep.ui.pgen.display.DefaultElementContainer; import gov.noaa.nws.ncep.ui.pgen.display.DefaultElementContainer;
import gov.noaa.nws.ncep.ui.pgen.display.DisplayElementFactory; import gov.noaa.nws.ncep.ui.pgen.display.DisplayElementFactory;
import gov.noaa.nws.ncep.ui.pgen.elements.AbstractDrawableComponent; import gov.noaa.nws.ncep.ui.pgen.elements.AbstractDrawableComponent;
import gov.noaa.nws.ncep.ui.pgen.elements.DECollection;
import gov.noaa.nws.ncep.ui.pgen.elements.DrawableElement; import gov.noaa.nws.ncep.ui.pgen.elements.DrawableElement;
import java.util.HashMap; import java.util.HashMap;
@ -53,21 +52,22 @@ import com.raytheon.uf.viz.core.map.IMapDescriptor;
public class PgenResourceGhost { public class PgenResourceGhost {
public AbstractDrawableComponent component; public AbstractDrawableComponent component;
Map<Object, AbstractElementContainer> componentMap = new HashMap<Object, AbstractElementContainer>(); Map<Object, AbstractElementContainer> componentMap = new HashMap<Object, AbstractElementContainer>();
/** /**
* Draw the ghost * Draw the ghost
*
* @param target * @param target
* @param paintProps * @param paintProps
* @param df * @param df
* @param descriptor * @param descriptor
*/ */
public void draw( IGraphicsTarget target, PaintProperties paintProps, public void draw(IGraphicsTarget target, PaintProperties paintProps,
DisplayElementFactory df, IMapDescriptor descriptor){ DisplayElementFactory df, IMapDescriptor descriptor) {
df.setLayerDisplayAttr( false, null, false ); df.setLayerDisplayAttr(false, null, false);
if (component != null) { if (component != null) {
Iterator<DrawableElement> iterator = component Iterator<DrawableElement> iterator = component.createDEIterator();
.createDEIterator();
int count = 0; int count = 0;
while (iterator.hasNext()) { while (iterator.hasNext()) {
DrawableElement element = iterator.next(); DrawableElement element = iterator.next();
@ -78,18 +78,24 @@ public class PgenResourceGhost {
} }
/** /**
* Creates displayables for an element using an ElementContainer and call the * Creates displayables for an element using an ElementContainer and call
* displayables' draw() method to draw the element. * the displayables' draw() method to draw the element.
* @param target Graphic target *
* @param paintProps Paint properties * @param target
* @param df Display element factory * Graphic target
* @param el Input drawable element * @param paintProps
* Paint properties
* @param df
* Display element factory
* @param el
* Input drawable element
* @praram descriptor * @praram descriptor
*/ */
private void drawElement( IGraphicsTarget target, PaintProperties paintProps, private void drawElement(IGraphicsTarget target,
DisplayElementFactory df, DrawableElement el, IMapDescriptor descriptor){ PaintProperties paintProps, DisplayElementFactory df,
DrawableElement el, IMapDescriptor descriptor) {
Object key = createKey(el); Object key = createKey(el);
AbstractElementContainer graphic = componentMap.get(key); AbstractElementContainer graphic = componentMap.get(key);
if (graphic == null) { if (graphic == null) {
graphic = new DefaultElementContainer(el, descriptor, target); graphic = new DefaultElementContainer(el, descriptor, target);
@ -101,14 +107,15 @@ public class PgenResourceGhost {
} }
private Object createKey(DrawableElement el) { private Object createKey(DrawableElement el) {
return el.getPgenCategory()+ ":"+el.getPgenType(); return el.getPgenCategory() + ":" + el.getPgenType();
} }
/** /**
* Sets the ghost line for the PGEN drawing layer. * Sets the ghost line for the PGEN drawing layer.
*
* @param ghost * @param ghost
*/ */
public void setGhostLine(AbstractDrawableComponent ghost) { public void setGhostLine(AbstractDrawableComponent ghost) {
this.component = ghost; this.component = ghost;
} }
} }

View file

@ -197,6 +197,7 @@ public class PgenContoursTool extends AbstractPgenDrawingTool implements
if (button == 1) { if (button == 1) {
drawContourMinmax(loc); drawContourMinmax(loc);
((ContoursAttrDlg) attrDlg).updateSymbolAttrOnGUI(loc);
} else if (button == 3) { } else if (button == 3) {
points.clear(); points.clear();

View file

@ -3,13 +3,15 @@ package gov.noaa.nws.ncep.viz.overlays.resources;
import gov.noaa.nws.ncep.viz.resources.INatlCntrsResource; import gov.noaa.nws.ncep.viz.resources.INatlCntrsResource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.HashMap;
import java.util.Map;
import org.opengis.referencing.crs.CoordinateReferenceSystem; import org.opengis.referencing.crs.CoordinateReferenceSystem;
import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.PixelExtent; import com.raytheon.uf.viz.core.PixelExtent;
import com.raytheon.uf.viz.core.drawables.IFont; import com.raytheon.uf.viz.core.drawables.IFont;
import com.raytheon.uf.viz.core.drawables.IFont.Style;
import com.raytheon.uf.viz.core.drawables.IWireframeShape; import com.raytheon.uf.viz.core.drawables.IWireframeShape;
import com.raytheon.uf.viz.core.drawables.PaintProperties; import com.raytheon.uf.viz.core.drawables.PaintProperties;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
@ -17,6 +19,8 @@ import com.raytheon.uf.viz.core.map.IMapDescriptor;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource; import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.GeometryFactory;
/** /**
* Implements a drawing layer to draw lat/lon lines * Implements a drawing layer to draw lat/lon lines
@ -52,9 +56,9 @@ public class LatLonOverlayResource extends
/** The wireframe object for drawing Longitude lines */ /** The wireframe object for drawing Longitude lines */
private IWireframeShape wireframeShapeForLonLineArray; private IWireframeShape wireframeShapeForLonLineArray;
private List<Coordinate[]> latitudeCoordinatePointArrayList; private Map<Double, Geometry> latitudeLineGeometries;
private List<Coordinate[]> longitudeCoordinatePointArrayList; private Map<Double, Geometry> longitudeLineGeometries;
private double offset = 0; // 50000; private double offset = 0; // 50000;
@ -75,17 +79,26 @@ public class LatLonOverlayResource extends
private double viewMaxX; private double viewMaxX;
/* /*
* The four minimum and maximum of X and Y used to paint label * The four effective view borders (map borders inside the viewable user
* window) used to paint label
*/ */
private double effectiveMinX; private Geometry effectiveLeftBorder;
private double effectiveMaxY; private Geometry effectiveRightBorder;
private double effectiveMinY; private Geometry effectiveBottomBorder;
private double effectiveMaxX; private Geometry effectiveTopBorder;
private double latLonDrawingPointInterval = 1.0; // 0.7; //1.0; //0.5 private Geometry mapBoundary;
private Geometry mapMedianLine;
private final double latLonDrawingPointInterval = 1.0; // 0.7; //1.0; //0.5
private final double drawingGap = 120;
private double labelGap;
private boolean needsUpdate = true; private boolean needsUpdate = true;
@ -114,8 +127,10 @@ public class LatLonOverlayResource extends
public void paintInternal(IGraphicsTarget target, PaintProperties paintProps) public void paintInternal(IGraphicsTarget target, PaintProperties paintProps)
throws VizException { throws VizException {
IFont lfont = target.initializeFont("Courier", 14, null); IFont lfont = target.initializeFont("Courier", 14,
new Style[] { Style.BOLD });
float zoomFactor = paintProps.getZoomLevel(); float zoomFactor = paintProps.getZoomLevel();
labelGap = drawingGap * zoomFactor;
initializeViewMinAndMaxXAndY(paintProps); initializeViewMinAndMaxXAndY(paintProps);
int latitudeDrawingLineNumber = getLatitudeDrawingLineNumber(latLonOverlayResourceData int latitudeDrawingLineNumber = getLatitudeDrawingLineNumber(latLonOverlayResourceData
@ -128,17 +143,12 @@ public class LatLonOverlayResource extends
if (needsUpdate) { if (needsUpdate) {
needsUpdate = false; needsUpdate = false;
/*
* necessary???
*/
clearWireFrameShapeArray(wireframeShapeForLatLineArray); clearWireFrameShapeArray(wireframeShapeForLatLineArray);
clearWireFrameShapeArray(wireframeShapeForLonLineArray); clearWireFrameShapeArray(wireframeShapeForLonLineArray);
clearCoordinatePointArrayList(latitudeCoordinatePointArrayList);
clearCoordinatePointArrayList(longitudeCoordinatePointArrayList);
latitudeCoordinatePointArrayList = new ArrayList<Coordinate[]>( latitudeLineGeometries = new HashMap<Double, Geometry>(
latitudeDrawingLineNumber); latitudeDrawingLineNumber);
longitudeCoordinatePointArrayList = new ArrayList<Coordinate[]>( longitudeLineGeometries = new HashMap<Double, Geometry>(
longitudeDrawingLineNumber); longitudeDrawingLineNumber);
wireframeShapeForLatLineArray = target.createWireframeShape(false, wireframeShapeForLatLineArray = target.createWireframeShape(false,
@ -149,19 +159,17 @@ public class LatLonOverlayResource extends
double latitudeValue = -90; double latitudeValue = -90;
for (int i = 0; i < latitudeDrawingLineNumber for (int i = 0; i < latitudeDrawingLineNumber
&& latitudeValue <= 90; i++) { && latitudeValue <= 90; i++) {
Coordinate[] latLonCoordinateArray = createCoordinateArrayForLatitudeLine( double[][] latLonCoordinateArray = createCoordinateArrayForLatitudeLine(
latitudeValue, latLonDrawingPointInterval); latitudeValue, latLonDrawingPointInterval);
latitudeCoordinatePointArrayList.add(latLonCoordinateArray);
if (!(latitudeValue == -90 || latitudeValue == 90)) { if (!(latitudeValue == -90 || latitudeValue == 90)
&& latLonCoordinateArray.length > 0) {
wireframeShapeForLatLineArray wireframeShapeForLatLineArray
.addLineSegment(latLonCoordinateArray); .addLineSegment(latLonCoordinateArray);
} }
latitudeValue += latLonOverlayResourceData latitudeValue += latLonOverlayResourceData
.getLatitudeInterval(); .getLatitudeInterval();
} }
wireframeShapeForLatLineArray.compile(); wireframeShapeForLatLineArray.compile();
wireframeShapeForLonLineArray = target.createWireframeShape(false, wireframeShapeForLonLineArray = target.createWireframeShape(false,
@ -172,39 +180,47 @@ public class LatLonOverlayResource extends
double longitudeValue = -180; double longitudeValue = -180;
for (int i = 0; i < longitudeDrawingLineNumber for (int i = 0; i < longitudeDrawingLineNumber
&& longitudeValue <= 180; i++) { && longitudeValue <= 180; i++) {
double[][] latLonCoordinateArray = createCoordinateArrayLongitudeLine(
Coordinate[] latLonCoordinateArray = createCoordinateArrayLongitudeLine(
longitudeValue, latLonDrawingPointInterval); longitudeValue, latLonDrawingPointInterval);
longitudeCoordinatePointArrayList.add(latLonCoordinateArray);
wireframeShapeForLonLineArray if (latLonCoordinateArray.length > 0) {
.addLineSegment(latLonCoordinateArray); wireframeShapeForLonLineArray
.addLineSegment(latLonCoordinateArray);
}
longitudeValue += latLonOverlayResourceData longitudeValue += latLonOverlayResourceData
.getLongitudeInterval(); .getLongitudeInterval();
} }
wireframeShapeForLonLineArray.compile(); wireframeShapeForLonLineArray.compile();
} }
double latitudeValue = -90; double latitudeValue = -90;
updateEffectiveMinX(getMapMinX(), getViewMinX(), getViewMaxX());
for (int i = 0; i < latitudeDrawingLineNumber && latitudeValue <= 90; i++) { for (int i = 0; i < latitudeDrawingLineNumber && latitudeValue <= 90; i++) {
Geometry latLine = latitudeLineGeometries.get(latitudeValue);
addDefaultLabelByPointIndex(wireframeShapeForLatLineArray, if (latLine != null) {
String.valueOf((int) latitudeValue), wireframeShapeForLatLineArray.clearLabels();
latitudeCoordinatePointArrayList.get(i), 0); Coordinate intersection = null;
if (effectiveLeftBorder.intersects(latLine)) {
int pointIndexForAddingLabel = getPointLabelIndexForAddingLatitudeLabel( intersection = effectiveLeftBorder.intersection(latLine)
latitudeCoordinatePointArrayList.get(i), zoomFactor, .getCoordinate();
getEffectiveMinX(), getEffectiveMaxX(), getEffectiveMinY(), } else if (latLine.within(mapBoundary)
getEffectiveMaxY()); && mapMedianLine.intersects(latLine)) {
intersection = mapMedianLine.intersection(latLine)
if (!(pointIndexForAddingLabel < 0)) { .getCoordinate();
addLabelOnLatLonLine(wireframeShapeForLatLineArray, // Removes default latitude label if it is too close to the
latitudeCoordinatePointArrayList.get(i), // bottom of the viewable edge to prevent the latitude label
pointIndexForAddingLabel, // from being displayed over the longitude labels.
String.valueOf((int) latitudeValue)); if (intersection.y > effectiveBottomBorder.getCoordinate().y
- 2.5 * labelGap) {
intersection = null;
}
}
if (intersection != null) {
wireframeShapeForLatLineArray
.addLabel(String.valueOf((int) latitudeValue),
new double[] { intersection.x + labelGap,
intersection.y });
}
} }
target.drawWireframeShape(wireframeShapeForLatLineArray, target.drawWireframeShape(wireframeShapeForLatLineArray,
latLonOverlayResourceData.getColor(), latLonOverlayResourceData.getColor(),
latLonOverlayResourceData.getLineWidth(), latLonOverlayResourceData.getLineWidth(),
@ -212,18 +228,21 @@ public class LatLonOverlayResource extends
latitudeValue += latLonOverlayResourceData.getLatitudeInterval(); latitudeValue += latLonOverlayResourceData.getLatitudeInterval();
} }
double longitudeValue = -180; double longitudeValue = -180;
updateEffectiveMaxY(getMapMaxY(), getViewMinY(), getViewMaxY());
for (int i = 0; i < longitudeDrawingLineNumber && longitudeValue <= 180; i++) { for (int i = 0; i < longitudeDrawingLineNumber && longitudeValue <= 180; i++) {
int pointIndexForAddingLabel = getPointLabelIndexForAddingLongitudeLabel( Geometry lonLine = longitudeLineGeometries.get(longitudeValue);
longitudeCoordinatePointArrayList.get(i), zoomFactor, if (lonLine != null) {
getEffectiveMinX(), getEffectiveMaxX(), getEffectiveMinY(), wireframeShapeForLonLineArray.clearLabels();
getEffectiveMaxY()); if (lonLine.intersects(effectiveBottomBorder)) {
if (!(pointIndexForAddingLabel < 0)) { Coordinate intersection = effectiveBottomBorder
addLabelOnLatLonLine(wireframeShapeForLonLineArray, .intersection(lonLine).getCoordinate();
longitudeCoordinatePointArrayList.get(i), int lonInt = (int) longitudeValue;
pointIndexForAddingLabel, String label = Math.abs(lonInt) != 180 ? String
String.valueOf((int) longitudeValue)); .valueOf(lonInt) : "ID";
wireframeShapeForLonLineArray.clearLabels();
wireframeShapeForLonLineArray.addLabel(label, new double[] {
intersection.x, intersection.y - labelGap });
}
} }
target.drawWireframeShape(wireframeShapeForLonLineArray, target.drawWireframeShape(wireframeShapeForLonLineArray,
latLonOverlayResourceData.getColor(), latLonOverlayResourceData.getColor(),
@ -234,22 +253,27 @@ public class LatLonOverlayResource extends
lfont.dispose(); lfont.dispose();
} }
private void addLabelOnLatLonLine(IWireframeShape wireframeShape,
Coordinate[] coordinateArray, int coordiantePointIndex, String label) {
double[] tmp = { coordinateArray[coordiantePointIndex].x,
coordinateArray[coordiantePointIndex].y };
double[] screenPixel = descriptor.worldToPixel(tmp);
if (screenPixel != null) {
wireframeShape.clearLabels();
wireframeShape.addLabel(label, screenPixel);
}
}
private void initializeMapMinAndMaxXAndY() { private void initializeMapMinAndMaxXAndY() {
mapMinX = descriptor.getGridGeometry().getGridRange().getLow(0); mapMinX = descriptor.getGridGeometry().getGridRange().getLow(0);
mapMaxX = descriptor.getGridGeometry().getGridRange().getHigh(0); mapMaxX = descriptor.getGridGeometry().getGridRange().getHigh(0);
mapMinY = descriptor.getGridGeometry().getGridRange().getLow(1); mapMinY = descriptor.getGridGeometry().getGridRange().getLow(1);
mapMaxY = descriptor.getGridGeometry().getGridRange().getHigh(1); mapMaxY = descriptor.getGridGeometry().getGridRange().getHigh(1);
double mapMidX = (mapMaxX - mapMinX) / 2;
double mapMidY = (mapMaxY - mapMinY) / 2;
mapMedianLine = new GeometryFactory()
.createLineString(new Coordinate[] {
new Coordinate(mapMidX, mapMinY),
new Coordinate(mapMidX, mapMidY) });
// Map boundary must be created in a continuous coordinate order to form
// a rectangle!
mapBoundary = new GeometryFactory().createPolygon(
new GeometryFactory().createLinearRing(new Coordinate[] {
new Coordinate(mapMinX, mapMinY),
new Coordinate(mapMinX, mapMaxY),
new Coordinate(mapMaxX, mapMaxY),
new Coordinate(mapMaxX, mapMinY),
new Coordinate(mapMinX, mapMinY) }), null);
} }
private void initializeViewMinAndMaxXAndY(PaintProperties paintProps) { private void initializeViewMinAndMaxXAndY(PaintProperties paintProps) {
@ -258,129 +282,48 @@ public class LatLonOverlayResource extends
viewMinY = paintProps.getView().getExtent().getMinY(); viewMinY = paintProps.getView().getExtent().getMinY();
viewMaxY = paintProps.getView().getExtent().getMaxY(); viewMaxY = paintProps.getView().getExtent().getMaxY();
effectiveMinX = viewMinX; updateEffectiveView();
effectiveMaxX = viewMaxX;
effectiveMinY = viewMinY;
effectiveMaxY = viewMaxY;
} }
private void updateEffectiveMinX(double mapMinXValue, double viewMinXValue, private void updateEffectiveView() {
double viewMaxXValue) { double effectiveMinX = viewMinX;
if (isLeftEdgeOfMapInsideCurrentView(mapMinXValue, viewMinXValue, double effectiveMaxX = viewMaxX;
viewMaxXValue)) { double effectiveMinY = viewMinY;
effectiveMinX = mapMinXValue; double effectiveMaxY = viewMaxY;
if (mapMinX > viewMinX && mapMinX < viewMaxX) {
effectiveMinX = mapMinX;
} }
} if (mapMaxX > viewMinX && mapMaxX < viewMaxX) {
effectiveMaxX = mapMaxX;
private boolean isLeftEdgeOfMapInsideCurrentView(double minXOfMap,
double minXOfCurrentView, double maxXOfCurrentView) {
boolean isInsideResult = false;
if (minXOfMap > minXOfCurrentView && minXOfMap < maxXOfCurrentView)
isInsideResult = true;
return isInsideResult;
}
private void updateEffectiveMaxY(double mapMaxYValue, double viewMinYValue,
double viewMaxYValue) {
if (isBottomEdgeOfMapInsideCurrentView(mapMaxYValue, viewMinYValue,
viewMaxYValue))
effectiveMaxY = mapMaxYValue;
}
private boolean isBottomEdgeOfMapInsideCurrentView(double maxYOfMap,
double minYOfCurrentView, double maxYOfCurrentView) {
boolean isInsideResult = false;
if (maxYOfMap > minYOfCurrentView && maxYOfMap < maxYOfCurrentView) {
isInsideResult = true;
} }
return isInsideResult; if (mapMinY > viewMinY && mapMinY < viewMaxY) {
} effectiveMinY = mapMinY;
private int getPointLabelIndexForAddingLongitudeLabel(
Coordinate[] latLonCoordinateArray, float zoomFactor, double minX,
double maxX, double minY, double maxY) {
int pointIndex = -1;
if (latLonCoordinateArray == null || latLonCoordinateArray.length == 0)
return pointIndex;
double positionOffset = 120;
for (int i = 0; i < latLonCoordinateArray.length; i++) {
double[] tmp = { latLonCoordinateArray[i].x,
latLonCoordinateArray[i].y };
double[] screenPixel = descriptor.worldToPixel(tmp);
if (isPointForPlacingLongituteLabel(screenPixel, positionOffset,
zoomFactor, minX, maxX, minY, maxY)) {
pointIndex = i;
break;
}
} }
return pointIndex; if (mapMaxY > viewMinY && mapMaxY < viewMaxY) {
} effectiveMaxY = mapMaxY;
private int getPointLabelIndexForAddingLatitudeLabel(
Coordinate[] latLonCoordinateArray, float zoomFactor, double minX,
double maxX, double minY, double maxY) {
int pointIndex = -1;
if (latLonCoordinateArray == null || latLonCoordinateArray.length == 0)
return pointIndex;
double positionOffset = 120;
for (int i = 0; i < latLonCoordinateArray.length; i++) {
double[] tmp = { latLonCoordinateArray[i].x,
latLonCoordinateArray[i].y };
double[] screenPixel = descriptor.worldToPixel(tmp);
if (isPointForPlacingLatituteLabel(screenPixel, positionOffset,
zoomFactor, minX, maxX, minY, maxY)) {
pointIndex = i;
break;
}
} }
return pointIndex; double cornerGap = 2.5 * labelGap;
} Coordinate[] leftBorderCoordinates = new Coordinate[] {
new Coordinate(effectiveMinX, effectiveMinY + cornerGap),
private void addDefaultLabelByPointIndex(IWireframeShape wireframeShape, new Coordinate(effectiveMinX, effectiveMaxY - cornerGap) };
String labelValue, Coordinate[] latLonCoordinateArray, Coordinate[] rightBorderCoordinates = new Coordinate[] {
int defaultPointIndex) { new Coordinate(effectiveMaxX, effectiveMinY + cornerGap),
double[] tmp = { latLonCoordinateArray[defaultPointIndex].x, new Coordinate(effectiveMaxX, effectiveMaxY - cornerGap) };
latLonCoordinateArray[defaultPointIndex].y }; Coordinate[] bottomBorderCoordinates = new Coordinate[] {
double[] screenPixel = descriptor.worldToPixel(tmp); new Coordinate(effectiveMinX + cornerGap, effectiveMaxY),
if (screenPixel != null) new Coordinate(effectiveMaxX - cornerGap, effectiveMaxY) };
wireframeShape.addLabel(labelValue, screenPixel); Coordinate[] topBorderCoordinates = new Coordinate[] {
} new Coordinate(effectiveMinX + cornerGap, effectiveMinY),
new Coordinate(effectiveMaxX - cornerGap, effectiveMinY) };
private boolean isPointForPlacingLongituteLabel(double[] pixelValueArray, effectiveLeftBorder = new GeometryFactory()
double positionOffset, float zoomFactor, double minX, double maxX, .createLineString(leftBorderCoordinates);
double minY, double maxY) { effectiveRightBorder = new GeometryFactory()
double delta = 200; .createLineString(rightBorderCoordinates);
boolean isPointForLabel = false; effectiveBottomBorder = new GeometryFactory()
if (pixelValueArray != null) { .createLineString(bottomBorderCoordinates);
if (pixelValueArray[0] > minX && pixelValueArray[0] < maxX effectiveTopBorder = new GeometryFactory()
&& pixelValueArray[1] > minY && pixelValueArray[1] < maxY) { .createLineString(topBorderCoordinates);
if (Math.abs(pixelValueArray[1] - maxY) < delta) {
isPointForLabel = true;
}
}
}
return isPointForLabel;
}
private boolean isPointForPlacingLatituteLabel(double[] pixelValueArray,
double positionOffset, float zoomFactor, double minX, double maxX,
double minY, double maxY) {
double delta = 200;
double adjustedOffset = positionOffset * zoomFactor;
boolean isPointForLabel = false;
if (pixelValueArray != null) {
if (pixelValueArray[0] > (minX + adjustedOffset)
&& pixelValueArray[0] < maxX && pixelValueArray[1] > minY
&& pixelValueArray[1] < maxY) {
if (Math.abs(pixelValueArray[0] - minX
- (positionOffset * zoomFactor)) < delta) {
isPointForLabel = true;
}
}
}
return isPointForLabel;
} }
private int getLatitudeDrawingLineNumber(int latInterval) { private int getLatitudeDrawingLineNumber(int latInterval) {
@ -402,28 +345,54 @@ public class LatLonOverlayResource extends
return lonLineNumber + 1; return lonLineNumber + 1;
} }
private Coordinate[] createCoordinateArrayForLatitudeLine( private double[][] createCoordinateArrayForLatitudeLine(
double latitudeValue, double latLonPointInterval) { double latitudeValue, double latLonPointInterval) {
int coordinateArrayLength = (int) (360 / latLonPointInterval) + 1; int coordinateArrayLength = (int) (360 / latLonPointInterval) + 1;
Coordinate[] coordinateArray = new Coordinate[coordinateArrayLength]; ArrayList<Coordinate> latLineCoordinates = new ArrayList<Coordinate>(
coordinateArrayLength);
ArrayList<double[]> latLinePixels = new ArrayList<double[]>(
coordinateArrayLength);
double longitude = -180; double longitude = -180;
for (int i = 0; i < coordinateArray.length && longitude <= 180; i++) { for (int i = 0; i < coordinateArrayLength && longitude <= 180; i++) {
coordinateArray[i] = new Coordinate(longitude, latitudeValue); double[] latLon = new double[] { longitude, latitudeValue };
double[] screenPixel = descriptor.worldToPixel(latLon);
if (screenPixel != null) {
latLinePixels.add(screenPixel);
latLineCoordinates.add(new Coordinate(screenPixel[0],
screenPixel[1]));
}
longitude += latLonPointInterval; longitude += latLonPointInterval;
} }
return coordinateArray; if (!latLineCoordinates.isEmpty())
latitudeLineGeometries.put(latitudeValue, new GeometryFactory()
.createLineString(latLineCoordinates
.toArray(new Coordinate[] {})));
return latLinePixels.toArray(new double[][] {});
} }
private Coordinate[] createCoordinateArrayLongitudeLine( private double[][] createCoordinateArrayLongitudeLine(
double longitudeValue, double latLonPointInterval) { double longitudeValue, double latLonPointInterval) {
int coordinateArrayLength = (int) ((180 - 10) / latLonPointInterval); int coordinateArrayLength = (int) ((180 - 10) / latLonPointInterval);
Coordinate[] coordinateArray = new Coordinate[coordinateArrayLength]; ArrayList<Coordinate> lonLineCoordinates = new ArrayList<Coordinate>(
coordinateArrayLength);
ArrayList<double[]> lonLinePixels = new ArrayList<double[]>(
coordinateArrayLength);
double latitude = -90 + latLonPointInterval; double latitude = -90 + latLonPointInterval;
for (int i = 0; i < coordinateArray.length && latitude <= 90; i++) { for (int i = 0; i < coordinateArrayLength && latitude <= 90; i++) {
coordinateArray[i] = new Coordinate(longitudeValue, latitude); double[] latLon = new double[] { longitudeValue, latitude };
double[] screenPixel = descriptor.worldToPixel(latLon);
if (screenPixel != null) {
lonLinePixels.add(screenPixel);
lonLineCoordinates.add(new Coordinate(screenPixel[0],
screenPixel[1]));
}
latitude += latLonPointInterval; latitude += latLonPointInterval;
} }
return coordinateArray; if (!lonLineCoordinates.isEmpty())
longitudeLineGeometries.put(longitudeValue, new GeometryFactory()
.createLineString(lonLineCoordinates
.toArray(new Coordinate[] {})));
return lonLinePixels.toArray(new double[][] {});
} }
/* /*
@ -432,9 +401,8 @@ public class LatLonOverlayResource extends
* @see com.raytheon.viz.core.rsc.IVizResource#dispose() * @see com.raytheon.viz.core.rsc.IVizResource#dispose()
*/ */
public void disposeInternal() { public void disposeInternal() {
// clearWireFrameShapeArray(wireframeShapeForLatLineArray); clearWireFrameShapeArray(wireframeShapeForLatLineArray);
// clearWireFrameShapeArray(wireframeShapeForLonLineArray); clearWireFrameShapeArray(wireframeShapeForLonLineArray);
} }
private void clearWireFrameShapeArray(IWireframeShape wireframeShapeArray) { private void clearWireFrameShapeArray(IWireframeShape wireframeShapeArray) {
@ -444,16 +412,6 @@ public class LatLonOverlayResource extends
} }
} }
private void clearCoordinatePointArrayList(
List<Coordinate[]> coordinatePointArrayList) {
if (coordinatePointArrayList != null) {
for (Coordinate[] eachCoordinateArray : coordinatePointArrayList) {
eachCoordinateArray = null;
}
coordinatePointArrayList = null;
}
}
/* /*
* the getters for Map's Min and Max X and Y, View's Min and Max X and Y * the getters for Map's Min and Max X and Y, View's Min and Max X and Y
*/ */
@ -489,22 +447,6 @@ public class LatLonOverlayResource extends
return mapMaxX; return mapMaxX;
} }
public double getEffectiveMinX() {
return effectiveMinX;
}
public double getEffectiveMaxY() {
return effectiveMaxY;
}
public double getEffectiveMinY() {
return effectiveMinY;
}
public double getEffectiveMaxX() {
return effectiveMaxX;
}
// @Override // @Override
public void resourceAttrsModified() { public void resourceAttrsModified() {
needsUpdate = true; needsUpdate = true;
@ -515,9 +457,9 @@ public class LatLonOverlayResource extends
return true; return true;
} }
// TODO : This has not been tested.
@Override @Override
public void project(CoordinateReferenceSystem mapData) throws VizException { public void project(CoordinateReferenceSystem mapData) throws VizException {
needsUpdate = true; needsUpdate = true;
initializeMapMinAndMaxXAndY();
} }
} }

View file

@ -59,6 +59,7 @@ import com.raytheon.uf.viz.core.exception.VizException;
* 09/15/2014 B. Hebbard At CPC request, persist model selected across dialog close/open * 09/15/2014 B. Hebbard At CPC request, persist model selected across dialog close/open
* even if resource not preselected (from existing RBD contents). * even if resource not preselected (from existing RBD contents).
* (This now differs from non-NTRANS behavior.) * (This now differs from non-NTRANS behavior.)
* 09/15/2014 B. Hebbard Remove bogus "km" from product group name if it appears (per CPC)
* *
* </pre> * </pre>
* *
@ -771,6 +772,23 @@ public class NtransSelectionControl extends ResourceSelectionControl {
} }
}); });
productLViewer.setLabelProvider(new LabelProvider() {
public String getText(Object element) {
String productName = (String) element;
// TODO investigate following -- already fixed separately?
// This happens intermittently; band-aid until cause located...
final String removeMe = "km";
if (productName.endsWith(removeMe)) {
System.out
.println("[WARNING: Caught a productName ending in '"
+ removeMe + "']");
return productName.substring(0, productName.length() - 2);
} else {
return productName;
}
}
});
rscAttrSetLViewer.setContentProvider(new IStructuredContentProvider() { rscAttrSetLViewer.setContentProvider(new IStructuredContentProvider() {
@Override @Override
public Object[] getElements(Object inputElement) { public Object[] getElements(Object inputElement) {

View file

@ -8,7 +8,6 @@ import gov.noaa.nws.ncep.viz.resources.manager.ResourceName;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension; import org.eclipse.core.runtime.IExtension;
@ -19,6 +18,7 @@ import org.eclipse.swt.graphics.RGB;
import com.raytheon.uf.viz.core.IGraphicsTarget.LineStyle; import com.raytheon.uf.viz.core.IGraphicsTarget.LineStyle;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
/** /**
* *
* *
@ -34,7 +34,7 @@ import com.raytheon.uf.viz.core.exception.VizException;
* 01/15/12 #606 Greg Hull add resource parameters * 01/15/12 #606 Greg Hull add resource parameters
* 04/19/12 #606 Greg Hull add attributeName attribute for resource parameters * 04/19/12 #606 Greg Hull add attributeName attribute for resource parameters
* 04/23/12 #606 Greg Hull add ConditionalFilter as a shortcut for the classname. * 04/23/12 #606 Greg Hull add ConditionalFilter as a shortcut for the classname.
* * - - S.Gurung Code formatter changes only
* </pre> * </pre>
* *
* @author * @author
@ -44,121 +44,153 @@ import com.raytheon.uf.viz.core.exception.VizException;
public class ResourceExtPointMngr { public class ResourceExtPointMngr {
private static final String NC_RESOURCE_EXT = "gov.noaa.nws.ncep.viz.resources.NC-Resource"; private static final String NC_RESOURCE_EXT = "gov.noaa.nws.ncep.viz.resources.NC-Resource";
private static final String RESOURCE_NAME_TAG = "name";
private static final String RESOURCE_NAME_TAG = "name";
private static final String RESOURCE_CLASS_TAG = "class"; private static final String RESOURCE_CLASS_TAG = "class";
private static final String EDIT_DLG_CLASS_TAG = "editDialogClass"; private static final String EDIT_DLG_CLASS_TAG = "editDialogClass";
private static final String NC_RESOURCE_PARAMS_EXT = "gov.noaa.nws.ncep.viz.resources.NC-ResourceParameter"; private static final String NC_RESOURCE_PARAMS_EXT = "gov.noaa.nws.ncep.viz.resources.NC-ResourceParameter";
private static final String RESOURCE_NAME_REF_TAG = "ncResourceName"; private static final String RESOURCE_NAME_REF_TAG = "ncResourceName";
private static final String RSC_PARAM_ELEMENT_NAME = "nc-resourceParameter"; private static final String RSC_PARAM_ELEMENT_NAME = "nc-resourceParameter";
private static final String PARAM_TYPE_TAG = "paramType"; private static final String PARAM_TYPE_TAG = "paramType";
private static final String PARAM_NAME_TAG = "paramName";
private static final String ATTR_NAME_TAG = "attributeName"; private static final String PARAM_NAME_TAG = "paramName";
private static final String ATTR_NAME_TAG = "attributeName";
private static final String PARAM_CLASS_TAG = "paramClass"; private static final String PARAM_CLASS_TAG = "paramClass";
private static final String CONSTRAINT_NAME_TAG = "constraintName"; private static final String CONSTRAINT_NAME_TAG = "constraintName";
// private static final String PARAM_REF_LOC_TAG = "paramRefLocation";
// private static final String PARAM_REF_LOC_TAG = "paramRefLocation";
private static final String DFLT_VAL_TAG = "defaultValue"; private static final String DFLT_VAL_TAG = "defaultValue";
public static enum ResourceParamType { public static enum ResourceParamType {
EDITABLE_ATTRIBUTE("EDITABLE_ATTRIBUTE"), EDITABLE_ATTRIBUTE("EDITABLE_ATTRIBUTE"), IMPLEMENTATION_PARAM(
IMPLEMENTATION_PARAM("IMPLEMENTATION_PARAM"), // used to instantiate the ResourceImplementation "IMPLEMENTATION_PARAM"), // used to instantiate the
REQUEST_CONSTRAINT("REQUEST_CONSTRAINT"), // instantiates a Resource Implementation and also used as a request constraint // ResourceImplementation
NON_EDITABLE_ATTRIBUTE("NON_EDITABLE_ATTRIBUTE"); REQUEST_CONSTRAINT("REQUEST_CONSTRAINT"), // instantiates a Resource
// Implementation and also
// used as a request
// constraint
NON_EDITABLE_ATTRIBUTE("NON_EDITABLE_ATTRIBUTE");
private String name; private String name;
private ResourceParamType( String n ) {
name = n;
}
public static ResourceParamType getResourceParamType( String n ) { private ResourceParamType(String n) {
if( n.equalsIgnoreCase( REQUEST_CONSTRAINT.name ) ) { name = n;
return REQUEST_CONSTRAINT; }
}
else if( n.equalsIgnoreCase( EDITABLE_ATTRIBUTE.name ) ) { public static ResourceParamType getResourceParamType(String n) {
return EDITABLE_ATTRIBUTE; if (n.equalsIgnoreCase(REQUEST_CONSTRAINT.name)) {
} return REQUEST_CONSTRAINT;
else if( n.equalsIgnoreCase( NON_EDITABLE_ATTRIBUTE.name ) ) { } else if (n.equalsIgnoreCase(EDITABLE_ATTRIBUTE.name)) {
return NON_EDITABLE_ATTRIBUTE; return EDITABLE_ATTRIBUTE;
} } else if (n.equalsIgnoreCase(NON_EDITABLE_ATTRIBUTE.name)) {
else if( n.equalsIgnoreCase( IMPLEMENTATION_PARAM.name ) ) { return NON_EDITABLE_ATTRIBUTE;
return IMPLEMENTATION_PARAM; } else if (n.equalsIgnoreCase(IMPLEMENTATION_PARAM.name)) {
} return IMPLEMENTATION_PARAM;
return IMPLEMENTATION_PARAM; }
} return IMPLEMENTATION_PARAM;
}
} }
public static class ResourceParamInfo { public static class ResourceParamInfo {
private String paramName; private String paramName;
private String constraintName; // usually the same as the paramName except for
// GDFILE which is modelName
// the name of the member variable in the java resourceData class.
// This will default to the paramName which will be the case for everything
// except the Grid resource which will be the same except lower case.
//
private String attributeName;
private Class<?> paramClass;
private ResourceParamType paramType;
private String dfltVal; // not implemented private String constraintName; // usually the same as the paramName
// private String paramRefLocation; // for ref'd colorBars // except for
// GDFILE which is modelName
ResourceParamInfo( String n, String c, String a, Class<?> clz, ResourceParamType ptype, // the name of the member variable in the java resourceData class.
String dval ) { //, String prmRefLoc) { // This will default to the paramName which will be the case for
paramName = n; // everything
constraintName = c; // except the Grid resource which will be the same except lower case.
attributeName = a; //
paramClass = clz; private String attributeName;
paramType = ptype;
dfltVal = dval;
// paramRefLocation = prmRefLoc;
}
public String getParamName() {
return paramName;
}
public String getConstraintName() {
return constraintName;
}
public String getAttributeName() {
return attributeName;
}
public Class<?> getParamClass() {
return paramClass;
}
public ResourceParamType getParamType() {
return paramType;
}
public String getDefaultValue() {
return dfltVal;
}
}
private Class<?> paramClass;
private static class ResourceExtPointInfo { private ResourceParamType paramType;
String rscName; //
Class<?> rscDataClass;
Class<?> rscDialogClass;
HashMap<String, ResourceParamInfo> rscParameters = null; private String dfltVal; // not implemented
ResourceExtPointInfo( String name, Class<?> rcls, Class<?> rdlgcls) { // private String paramRefLocation; // for ref'd colorBars
rscName = new String( name );
rscParameters = new HashMap<String, ResourceParamInfo>(); ResourceParamInfo(String n, String c, String a, Class<?> clz,
rscDataClass = rcls; ResourceParamType ptype, String dval) { // , String prmRefLoc) {
rscDialogClass = rdlgcls; paramName = n;
constraintName = c;
attributeName = a;
paramClass = clz;
paramType = ptype;
dfltVal = dval;
// paramRefLocation = prmRefLoc;
} }
void addParameter( String prmName, String cName, String aName, public String getParamName() {
Class<?> prmClass, ResourceParamType pType, String dflt) { // , Object dfltVal ) { return paramName;
}
rscParameters.put( prmName, public String getConstraintName() {
new ResourceParamInfo( prmName, cName, aName, prmClass, pType, dflt ) ); return constraintName;
} }
public String getAttributeName() {
return attributeName;
}
public Class<?> getParamClass() {
return paramClass;
}
public ResourceParamType getParamType() {
return paramType;
}
public String getDefaultValue() {
return dfltVal;
}
}
private static class ResourceExtPointInfo {
String rscName; //
Class<?> rscDataClass;
Class<?> rscDialogClass;
HashMap<String, ResourceParamInfo> rscParameters = null;
ResourceExtPointInfo(String name, Class<?> rcls, Class<?> rdlgcls) {
rscName = new String(name);
rscParameters = new HashMap<String, ResourceParamInfo>();
rscDataClass = rcls;
rscDialogClass = rdlgcls;
}
void addParameter(String prmName, String cName, String aName,
Class<?> prmClass, ResourceParamType pType, String dflt) { // ,
// Object
// dfltVal
// )
// {
rscParameters.put(prmName, new ResourceParamInfo(prmName, cName,
aName, prmClass, pType, dflt));
}
} }
// map from the resource name to the resource info containing the rscData class, // map from the resource name to the resource info containing the rscData
// the class that implements the edit dialog and a list of attributes from the // class,
// the class that implements the edit dialog and a list of attributes from
// the
// attribute extension points // attribute extension points
// //
static HashMap<String, ResourceExtPointInfo> rscExtPointInfoMap = null; static HashMap<String, ResourceExtPointInfo> rscExtPointInfoMap = null;
@ -166,50 +198,54 @@ public class ResourceExtPointMngr {
static ResourceExtPointMngr instance = null; static ResourceExtPointMngr instance = null;
public static ResourceExtPointMngr getInstance() { public static ResourceExtPointMngr getInstance() {
if( instance == null ) { if (instance == null) {
instance = new ResourceExtPointMngr(); instance = new ResourceExtPointMngr();
} } else if (instance.rscExtPointInfoMap.size() == 0) {
else if( instance.rscExtPointInfoMap.size() == 0 ) { instance = new ResourceExtPointMngr();
instance = new ResourceExtPointMngr(); }
} return instance;
return instance;
} }
private ResourceExtPointMngr() { private ResourceExtPointMngr() {
rscExtPointInfoMap = new HashMap<String, ResourceExtPointInfo>(); rscExtPointInfoMap = new HashMap<String, ResourceExtPointInfo>();
readResourceExpPoint(); readResourceExpPoint();
readResourceParameterssExtPoint(); readResourceParameterssExtPoint();
} }
private static void readResourceExpPoint( ) { private static void readResourceExpPoint() {
IExtensionRegistry registry = Platform.getExtensionRegistry(); IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint extPoint = registry.getExtensionPoint( NC_RESOURCE_EXT ); IExtensionPoint extPoint = registry.getExtensionPoint(NC_RESOURCE_EXT);
if( extPoint == null ) { if (extPoint == null) {
System.out.println("Unable to get Extension Point : " + NC_RESOURCE_EXT ); System.out.println("Unable to get Extension Point : "
return; + NC_RESOURCE_EXT);
return;
} }
IExtension[] extensions = extPoint.getExtensions(); IExtension[] extensions = extPoint.getExtensions();
for( int i = 0; i < extensions.length; i++ ) { for (int i = 0; i < extensions.length; i++) {
IConfigurationElement[] config = extensions[i].getConfigurationElements(); IConfigurationElement[] config = extensions[i]
.getConfigurationElements();
for( int j = 0; j < config.length; j++ ) { for (int j = 0; j < config.length; j++) {
String rscName = config[j].getAttribute(RESOURCE_NAME_TAG); String rscName = config[j].getAttribute(RESOURCE_NAME_TAG);
String rscClassName = config[j].getAttribute(RESOURCE_CLASS_TAG); String rscClassName = config[j]
String editDlgClassName = config[j].getAttribute(EDIT_DLG_CLASS_TAG); .getAttribute(RESOURCE_CLASS_TAG);
String editDlgClassName = config[j]
.getAttribute(EDIT_DLG_CLASS_TAG);
if( rscClassName == null ) { if (rscClassName == null) {
System.out.println( " "+rscClassName ); System.out.println(" " + rscClassName);
continue; continue;
} }
// for now this is optional since we can have NC resources that do not have // for now this is optional since we can have NC resources that
// do not have
// editable attributes. // editable attributes.
if( editDlgClassName == null ) { if (editDlgClassName == null) {
continue; continue;
} }
IConfigurationElement[] fields = config[j].getChildren(); IConfigurationElement[] fields = config[j].getChildren();
@ -218,198 +254,219 @@ public class ResourceExtPointMngr {
Class<?> editDlgClass = null; Class<?> editDlgClass = null;
try { try {
rscClass = Class.forName( rscClassName ); rscClass = Class.forName(rscClassName);
editDlgClass = Class.forName( editDlgClassName ); editDlgClass = Class.forName(editDlgClassName);
rscExtPointInfoMap.put( rscName, rscExtPointInfoMap.put(rscName, new ResourceExtPointInfo(
new ResourceExtPointInfo( rscName, rscClass, editDlgClass ) ); rscName, rscClass, editDlgClass));
} catch ( ClassNotFoundException e ) { } catch (ClassNotFoundException e) {
System.out.println("Unable to load class "+rscClassName +" or "+ editDlgClassName ); System.out.println("Unable to load class " + rscClassName
+ " or " + editDlgClassName);
} }
} }
} }
} }
// init the resourceAttrsMap from the NC-ResourceAttributes ext point
// init the resourceAttrsMap from the NC-ResourceAttributes ext point private static void readResourceParameterssExtPoint() {
private static void readResourceParameterssExtPoint( ) {
IExtensionRegistry registry = Platform.getExtensionRegistry(); IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint extPoint = registry.getExtensionPoint( NC_RESOURCE_PARAMS_EXT ); IExtensionPoint extPoint = registry
.getExtensionPoint(NC_RESOURCE_PARAMS_EXT);
if( extPoint == null ) { if (extPoint == null) {
System.out.println("Unable to get Extension Point : "+ NC_RESOURCE_PARAMS_EXT ); System.out.println("Unable to get Extension Point : "
return; + NC_RESOURCE_PARAMS_EXT);
return;
} }
IExtension[] extensions = extPoint.getExtensions(); IExtension[] extensions = extPoint.getExtensions();
for( int i = 0; i < extensions.length; i++ ) { for (int i = 0; i < extensions.length; i++) {
IConfigurationElement[] config = extensions[i].getConfigurationElements(); IConfigurationElement[] config = extensions[i]
.getConfigurationElements();
for( int j = 0; j < config.length; j++ ) { for (int j = 0; j < config.length; j++) {
if( config[j].getName().equalsIgnoreCase( RSC_PARAM_ELEMENT_NAME ) ) { if (config[j].getName()
String rscName = config[j].getAttribute(RESOURCE_NAME_REF_TAG); .equalsIgnoreCase(RSC_PARAM_ELEMENT_NAME)) {
String prmName = config[j].getAttribute(PARAM_NAME_TAG); String rscName = config[j]
String attrName = config[j].getAttribute(ATTR_NAME_TAG); .getAttribute(RESOURCE_NAME_REF_TAG);
String prmClassName = config[j].getAttribute(PARAM_CLASS_TAG); String prmName = config[j].getAttribute(PARAM_NAME_TAG);
String constraintName = config[j].getAttribute(CONSTRAINT_NAME_TAG); String attrName = config[j].getAttribute(ATTR_NAME_TAG);
String prmType = config[j].getAttribute(PARAM_TYPE_TAG); String prmClassName = config[j]
String dfltVal = config[j].getAttribute(DFLT_VAL_TAG); .getAttribute(PARAM_CLASS_TAG);
// String refLoc = config[j].getAttribute(PARAM_REF_LOC_TAG); String constraintName = config[j]
.getAttribute(CONSTRAINT_NAME_TAG);
String prmType = config[j].getAttribute(PARAM_TYPE_TAG);
String dfltVal = config[j].getAttribute(DFLT_VAL_TAG);
// String refLoc =
// config[j].getAttribute(PARAM_REF_LOC_TAG);
// sanity check ; these are required // sanity check ; these are required
if( rscName == null || prmName == null || prmClassName == null || prmType == null) { if (rscName == null || prmName == null
System.out.println( "Invalid Extension of Ext Point: "+ NC_RESOURCE_PARAMS_EXT ); || prmClassName == null || prmType == null) {
continue; System.out.println("Invalid Extension of Ext Point: "
} + NC_RESOURCE_PARAMS_EXT);
continue;
}
// then test for one of the standard types or classes. // then test for one of the standard types or classes.
// //
prmClassName = getFullClassName( prmClassName ); prmClassName = getFullClassName(prmClassName);
ResourceExtPointInfo repi = rscExtPointInfoMap.get( rscName ); ResourceExtPointInfo repi = rscExtPointInfoMap.get(rscName);
if( repi == null ) { if (repi == null) {
System.out.println("Error reading "+NC_RESOURCE_PARAMS_EXT + " Ext Point: The Resource " + System.out.println("Error reading "
rscName + " is not defined." ); + NC_RESOURCE_PARAMS_EXT
continue; + " Ext Point: The Resource " + rscName
} + " is not defined.");
continue;
}
if( constraintName == null ) { if (constraintName == null) {
constraintName = prmName; constraintName = prmName;
} }
// this only exists for Grids where the parameter name is upper case // this only exists for Grids where the parameter name is
// and the attribute name (ie the name of the member variable in the // upper case
// java class) is lowercase // and the attribute name (ie the name of the member
// // variable in the
if( attrName == null ) { // java class) is lowercase
attrName = prmName; //
} if (attrName == null) {
try { attrName = prmName;
Class<?> rscPrmClass = Class.forName( prmClassName ); }
ResourceParamType rscPrmType = ResourceParamType.getResourceParamType( prmType ); try {
Class<?> rscPrmClass = Class.forName(prmClassName);
ResourceParamType rscPrmType = ResourceParamType
.getResourceParamType(prmType);
repi.addParameter( prmName, constraintName, attrName, repi.addParameter(prmName, constraintName, attrName,
rscPrmClass, rscPrmType, dfltVal ); rscPrmClass, rscPrmType, dfltVal);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
System.out.println("Unable to load class: "+prmClassName ); System.out.println("Unable to load class: "
} + prmClassName);
} }
}
} }
} }
} }
public Class<?> getResourceDialogClass( ResourceName rscName ) { public Class<?> getResourceDialogClass(ResourceName rscName) {
// get the rsc Impl for this // get the rsc Impl for this
String rscImplName = null; String rscImplName = null;
// if( rscCfgMngr == null ) { // if( rscCfgMngr == null ) {
try { try {
rscImplName = ResourceDefnsMngr.getInstance().getResourceImplementation( rscName.getRscType() ); rscImplName = ResourceDefnsMngr.getInstance()
} catch (VizException e) { .getResourceImplementation(rscName.getRscType());
e.printStackTrace(); } catch (VizException e) {
} e.printStackTrace();
// } }
// }
ResourceExtPointInfo repi = rscExtPointInfoMap.get(rscImplName);
ResourceExtPointInfo repi = rscExtPointInfoMap.get( rscImplName ); return (repi == null ? null : repi.rscDialogClass);
}
return ( repi == null ? null : repi.rscDialogClass ); private static String getFullClassName(String clzName) {
} // then test for one of the standard types or classes.
//
if (clzName.equalsIgnoreCase("Integer")) {
return "java.lang.Integer";
} else if (clzName.equalsIgnoreCase("Boolean")) {
return "java.lang.Boolean";
} else if (clzName.equalsIgnoreCase("Double")) {
return "java.lang.Double";
} else if (clzName.equalsIgnoreCase("Float")) {
return "java.lang.Float";
} else if (clzName.equalsIgnoreCase("String")) {
return "java.lang.String";
} else if (clzName.equalsIgnoreCase("RGB")) {
return RGB.class.getName();
} else if (clzName.equalsIgnoreCase("ArrowStyle")) {
return "gov.noaa.nws.ncep.viz.rsc.ncscat.rsc.NcscatResourceData$ArrowStyle";
} else if (clzName.equalsIgnoreCase("LineStyle")) {
return LineStyle.class.getName();
} else if (clzName.equalsIgnoreCase("MarkerState")) {
return MarkerState.class.getName();
} else if (clzName.equalsIgnoreCase("MarkerType")) {
return MarkerType.class.getName();
} else if (clzName.equalsIgnoreCase("MarkerTextSize")) {
return MarkerTextSize.class.getName();
} else if (clzName.equalsIgnoreCase("PlotModel")) {
return "gov.noaa.nws.ncep.viz.rsc.plotdata.plotModels.elements.PlotModel";
} else if (clzName.equalsIgnoreCase("ColorBar")) {
return "gov.noaa.nws.ncep.viz.ui.display.ColorBar";
} else if (clzName.equalsIgnoreCase("conditionalFilter")) {
return "gov.noaa.nws.ncep.viz.rsc.plotdata.conditionalfilter.ConditionalFilter";
}
return clzName;
}
private static String getFullClassName( String clzName ) { // public String getResourceNameForClass( Class<?> rscDataClass ) {
// then test for one of the standard types or classes. // ResourceExtPointInfo repi = rscExtPointInfoMap.get( //rscDataClass );
// //
if( clzName.equalsIgnoreCase( "Integer" )) { // return ( repi == null ? null : repi.rscName );
return "java.lang.Integer"; // }
} else if( clzName.equalsIgnoreCase( "Boolean" )) {
return "java.lang.Boolean";
} else if( clzName.equalsIgnoreCase( "Double" )) {
return "java.lang.Double";
} else if( clzName.equalsIgnoreCase( "Float" )) {
return "java.lang.Float";
} else if( clzName.equalsIgnoreCase( "String" )) {
return "java.lang.String";
} else if( clzName.equalsIgnoreCase( "RGB" )) {
return RGB.class.getName();
} else if( clzName.equalsIgnoreCase( "ArrowStyle" )) {
return "gov.noaa.nws.ncep.viz.rsc.ncscat.rsc.NcscatResourceData$ArrowStyle";
} else if( clzName.equalsIgnoreCase( "LineStyle" )) {
return LineStyle.class.getName();
} else if( clzName.equalsIgnoreCase( "MarkerState" )) {
return MarkerState.class.getName();
} else if( clzName.equalsIgnoreCase( "MarkerType" )) {
return MarkerType.class.getName();
} else if( clzName.equalsIgnoreCase( "MarkerTextSize" )) {
return MarkerTextSize.class.getName();
} else if( clzName.equalsIgnoreCase("PlotModel") ) {
return "gov.noaa.nws.ncep.viz.rsc.plotdata.plotModels.elements.PlotModel";
} else if( clzName.equalsIgnoreCase("ColorBar") ) {
return "gov.noaa.nws.ncep.viz.ui.display.ColorBar";
} else if( clzName.equalsIgnoreCase("conditionalFilter") ) {
return "gov.noaa.nws.ncep.viz.rsc.plotdata.conditionalfilter.ConditionalFilter";
}
return clzName;
}
// public String getResourceNameForClass( Class<?> rscDataClass ) { // public HashMap<String,ResourceAttrInfo> getResourceAttributes(
// ResourceExtPointInfo repi = rscExtPointInfoMap.get( //rscDataClass ); // ResourceName rscName ) {
// // String rscImplName = null;
// return ( repi == null ? null : repi.rscName ); //
// } // // if( rscCfgMngr == null ) {
// try {
// rscImplName = ResourceDefnsMngr.getInstance().getResourceImplementation(
// rscName.getRscType() );
// } catch (VizException e) {
// e.printStackTrace();
// }
// // }
//
// ResourceExtPointInfo repi = rscExtPointInfoMap.get( rscImplName );
//
// return ( repi == null ? null : repi.rscAttributes );
// }
// public HashMap<String,ResourceAttrInfo> getResourceAttributes( ResourceName rscName ) { public HashMap<String, ResourceParamInfo> getParameterInfoForRscImplementation(
// String rscImplName = null; ResourceName rscName) {
// try {
//// if( rscCfgMngr == null ) { String rscImpl = ResourceDefnsMngr.getInstance()
// try { .getResourceImplementation(rscName.getRscType());
// rscImplName = ResourceDefnsMngr.getInstance().getResourceImplementation( rscName.getRscType() );
// } catch (VizException e) {
// e.printStackTrace();
// }
//// }
//
// ResourceExtPointInfo repi = rscExtPointInfoMap.get( rscImplName );
//
// return ( repi == null ? null : repi.rscAttributes );
// }
public HashMap<String,ResourceParamInfo> getParameterInfoForRscImplementation( ResourceName rscName ) { return getResourceParameters(rscImpl);
try { } catch (VizException e) {
String rscImpl = ResourceDefnsMngr.getInstance().getResourceImplementation( rscName.getRscType() ); e.printStackTrace();
return new HashMap<String, ResourceParamInfo>();
}
}
return getResourceParameters( rscImpl ); public HashMap<String, ResourceParamInfo> getResourceParameters(
} catch (VizException e) { String rscImpl) {
e.printStackTrace(); ResourceExtPointInfo repi = rscExtPointInfoMap.get(rscImpl);
return new HashMap<String,ResourceParamInfo>(); return (repi == null ? null : repi.rscParameters);
} }
}
public HashMap<String,ResourceParamInfo> getResourceParameters( String rscImpl ) { public ArrayList<String> getAvailResources() {
ResourceExtPointInfo repi = rscExtPointInfoMap.get( rscImpl ); ArrayList<String> availResources = new ArrayList<String>();
return ( repi == null ? null : repi.rscParameters ); for (ResourceExtPointInfo rscInfo : rscExtPointInfoMap.values()) {
} availResources.add(rscInfo.rscName);
}
return availResources;
}
public ArrayList<String> getAvailResources( ) { public Class<?> getResourceDataClass(String rscName) {
ArrayList<String> availResources = new ArrayList<String>(); for (ResourceExtPointInfo rscInfo : rscExtPointInfoMap.values()) {
for( ResourceExtPointInfo rscInfo : rscExtPointInfoMap.values() ) { if (rscInfo.rscName.equals(rscName)) {
availResources.add( rscInfo.rscName ); return rscInfo.rscDataClass;
} }
return availResources; }
} // if( rscExtPointInfoMap.containsKey( rscName ) ) {
// return rscExtPointInfoMap.get( rscName ).rscDataClass;
public Class<?> getResourceDataClass( String rscName ) { // }
for( ResourceExtPointInfo rscInfo : rscExtPointInfoMap.values() ) { return null;
if( rscInfo.rscName.equals( rscName ) ) { }
return rscInfo.rscDataClass;
}
}
// if( rscExtPointInfoMap.containsKey( rscName ) ) {
// return rscExtPointInfoMap.get( rscName ).rscDataClass;
// }
return null;
}
} }

View file

@ -30,6 +30,8 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.TimeZone; import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.measure.converter.ConversionException; import javax.measure.converter.ConversionException;
@ -119,6 +121,7 @@ import com.sun.jna.ptr.IntByReference;
* 11/2013 845 T. Lee Implemented parameter scaling * 11/2013 845 T. Lee Implemented parameter scaling
* 04/11/2014 981 D.Sushon Code cleanup, enforce explicit use of curly-brackets {} * 04/11/2014 981 D.Sushon Code cleanup, enforce explicit use of curly-brackets {}
* 04/14/2014 S. Gilbert Remove dataUri from query - cleanup old unused methods. * 04/14/2014 S. Gilbert Remove dataUri from query - cleanup old unused methods.
* 07/2014 T. Lee Fixed specific humidity scaling for NAM
* </pre> * </pre>
* *
* @author tlee * @author tlee
@ -1334,7 +1337,7 @@ public class Dgdriv {
outGridFlipped[kk] = -9999.0f; outGridFlipped[kk] = -9999.0f;
kk++; kk++;
} else { } else {
outGridFlipped[kk] = inGrid[ii] / scale_parm; outGridFlipped[kk] = inGrid[ii];
kk++; kk++;
} }
} }
@ -1354,7 +1357,7 @@ public class Dgdriv {
if (inGrid[ii] < -900000.0) { if (inGrid[ii] < -900000.0) {
outGridFlipped[ii] = -9999.0f; outGridFlipped[ii] = -9999.0f;
} else { } else {
outGridFlipped[ii] = inGrid[ii] / scale_parm; outGridFlipped[ii] = inGrid[ii];
} }
} }
@ -1405,8 +1408,6 @@ public class Dgdriv {
return outGridFlopped; return outGridFlopped;
} }
int scale_parm = 1;
private float[] retrieveDataFromRetriever(String dataURI) private float[] retrieveDataFromRetriever(String dataURI)
throws VizException { throws VizException {
@ -1425,8 +1426,6 @@ public class Dgdriv {
try { try {
String gempakParm = cacheData.getGempakParam(dataURI); String gempakParm = cacheData.getGempakParam(dataURI);
if (gempakParm != null) { if (gempakParm != null) {
scale_parm = (int) Math.pow(10,
gempakParmInfo.getParmScale(gempakParm));
dataRetriever.setUnit(UnitConv.deserializer(gempakParmInfo dataRetriever.setUnit(UnitConv.deserializer(gempakParmInfo
.getParmUnit(gempakParm))); .getParmUnit(gempakParm)));
} }
@ -1750,8 +1749,8 @@ public class Dgdriv {
String modelName = parms[0]; String modelName = parms[0];
String dbTag = parms[1]; String dbTag = parms[1];
String eventName = parms[2]; String eventName = parms[2];
// String tmStr = constructTimeStr(parms[3]); String tmStr = constructTimeStr(parms[3]);
DataTime dtime = constructDataTime(parms[3]); Pattern p = Pattern.compile(tmStr);
// logger.info("executeScript:modelname=" + modelName + " dbTag=" +dbTag // logger.info("executeScript:modelname=" + modelName + " dbTag=" +dbTag
// + " eventName="+eventName + " time=" + tmStr); // + " eventName="+eventName + " time=" + tmStr);
@ -1765,9 +1764,15 @@ public class Dgdriv {
eventName, ConstraintType.EQUALS)); eventName, ConstraintType.EQUALS));
} }
rcMap.put(GridDBConstants.DATA_TIME_QUERY, try {
new RequestConstraint(dtime.getURIString(), String gempakTimeStrFFF = parms[3].split("f")[1];
ConstraintType.EQUALS)); int fhr = Integer.parseInt(gempakTimeStrFFF) * 3600;
rcMap.put(GridDBConstants.FORECAST_TIME_QUERY,
new RequestConstraint(Integer.toString(fhr),
ConstraintType.EQUALS));
} catch (NumberFormatException e1) {
// Don't worry if fcsthr not specified. we'll get em all
}
DbQueryRequest request = new DbQueryRequest(); DbQueryRequest request = new DbQueryRequest();
request.addRequestField(GridDBConstants.REF_TIME_QUERY); request.addRequestField(GridDBConstants.REF_TIME_QUERY);
@ -1775,6 +1780,8 @@ public class Dgdriv {
request.setDistinct(true); request.setDistinct(true);
request.setConstraints(rcMap); request.setConstraints(rcMap);
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHH");
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
String retFileNames = ""; String retFileNames = "";
try { try {
DbQueryResponse response = (DbQueryResponse) ThriftClient DbQueryResponse response = (DbQueryResponse) ThriftClient
@ -1796,6 +1803,14 @@ public class Dgdriv {
GridDBConstants.REF_TIME_QUERY); GridDBConstants.REF_TIME_QUERY);
if (fSecValue != null && fSecValue instanceof Integer if (fSecValue != null && fSecValue instanceof Integer
&& refValue != null && refValue instanceof Date) { && refValue != null && refValue instanceof Date) {
String refString = sdf.format((Date) refValue);
logger.debug("executeScript: match " + refString);
logger.debug("executeScript: with " + tmStr);
Matcher m = p.matcher(refString);
if (!m.matches())
continue;
int fcstTimeInSec = ((Integer) fSecValue).intValue(); int fcstTimeInSec = ((Integer) fSecValue).intValue();
DataTime refTime = new DataTime((Date) refValue); DataTime refTime = new DataTime((Date) refValue);
String[] dts = refTime.toString().split(" "); String[] dts = refTime.toString().split(" ");
@ -1822,57 +1837,20 @@ public class Dgdriv {
return retFileNames; return retFileNames;
} }
/* private String constructTimeStr(String gempakTimeStr) {
* Convert Gempak time string YYMMDD/HHMMfHHH to DataTime String gempakTimeStrCycle = gempakTimeStr.split("f")[0];
*/ gempakTimeStrCycle = gempakTimeStrCycle.replace("[0-9]", ".");
private DataTime constructDataTime(String gempakTimeStr) { if (gempakTimeStrCycle.length() < 10) {
return null;
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd/HH");
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
String[] times = gempakTimeStr.split("f");
DataTime dt;
try {
Date date = sdf.parse(times[0]);
int fcstTimeInSec = CommonDateFormatUtil
.getForecastTimeInSec(gempakTimeStr);
dt = new DataTime(date, fcstTimeInSec);
} catch (Exception e) {
dt = null;
} }
return dt; String timeStr = gempakTimeStrCycle.substring(0, 4)
+ gempakTimeStrCycle.substring(4, 6)
+ gempakTimeStrCycle.substring(6, 8)
+ gempakTimeStrCycle.substring(8, 10);
return timeStr;
} }
// private String constructTimeStr(String gempakTimeStr) {
// String gempakTimeStrCycle = gempakTimeStr.split("f")[0];
// gempakTimeStrCycle = gempakTimeStrCycle.replace("[0-9]", "%");
// if (gempakTimeStrCycle.length() < 10) {
// return null;
// }
//
// String gempakTimeStrFFF = gempakTimeStr.split("f")[1];
// gempakTimeStrFFF = gempakTimeStrFFF.replace("[0-9]", "%");
//
// String timeStr;
// try {
// int fhr = Integer.parseInt(gempakTimeStrFFF) / 3600;
//
// timeStr = gempakTimeStrCycle.substring(0, 4) + "-"
// + gempakTimeStrCycle.substring(4, 6) + "-"
// + gempakTimeStrCycle.substring(6, 8) + "_"
// + gempakTimeStrCycle.substring(8, 10) + "%_(" + fhr + ")%";
// } catch (NumberFormatException e) {
// timeStr = gempakTimeStrCycle.substring(0, 4) + "-"
// + gempakTimeStrCycle.substring(4, 6) + "-"
// + gempakTimeStrCycle.substring(6, 8) + "_"
// + gempakTimeStrCycle.substring(8, 10) + "%_("
// + gempakTimeStrFFF;
// }
// return timeStr;
// }
private String getDataURIFromAssembler(String parameters) private String getDataURIFromAssembler(String parameters)
throws VizException { throws VizException {
long t0 = System.currentTimeMillis(); long t0 = System.currentTimeMillis();

View file

@ -0,0 +1,28 @@
ncgm -- Computer Graphics Metafile interpreter and renderer
See also the other README.TXT, in sibling "jcgm" package.
This package contains classes which extend a limited subset of the classes
in the "jcgm" package.
(For more information about "jcgm", see: http://jcgm.sourceforge.net)
The key classes here are...
NcCGM (extends jcgm's CGM):
Builds (via NcCGM.read(DataInput)) and holds (as an ordered list
of "commands") a Java representation of a single CGM image.
NcCommand (extends jcgm's Command):
Builds (via *static* NcCommand.read(DataInput)) and returns
a single CGM command. The readCommand() method has been modified
from the jcgm original to "know" which commands have extensions
in ncgm, and to create them instead of the base jcgm versions.
INcCommand:
Interface whose implementation enables these ncgm extended
commands to know how to contribute themselves to an AWIPS II
image.
An AWIPS II image is constructed in an ImageBuilder object, by sequential
"execution" of these CGM commands.
We only extend the "jcgm" commands that are of interest to NTRANS. Any others
(if somehow encountered in an input metafile) will simply be ignored.

View file

@ -72,7 +72,7 @@ import com.raytheon.viz.pointdata.PointDataRequest;
* 04/01/2014 1040 B. Hebbard In requestUpperAirData, (1) clear displayStationPlotBoolList for each new station, (2) call cond filter check with newInstance vs. metPrm * 04/01/2014 1040 B. Hebbard In requestUpperAirData, (1) clear displayStationPlotBoolList for each new station, (2) call cond filter check with newInstance vs. metPrm
* 04/08/2014 1127 B. Hebbard In requestSurfaceData, exclude only those obs returned from HDF5 that don't match desired time; fix dataTime association; * 04/08/2014 1127 B. Hebbard In requestSurfaceData, exclude only those obs returned from HDF5 that don't match desired time; fix dataTime association;
* removed redundant datatimes from constraint. * removed redundant datatimes from constraint.
* 06/17/2014 932 S. Russell TTR 923, altered methods addToDerivedParamsList(), requestSurfaceData(), and newInstance() * 06/17/2014 923 S. Russell TTR 923, altered methods addToDerivedParamsList(), requestSurfaceData(), and newInstance()
* 07/08/2014 TTR1028 B. Hebbard In requestSurfaceData() and requestUpperAirData(), prune out stations that already have all met params they need, to avoid unnecessary querying * 07/08/2014 TTR1028 B. Hebbard In requestSurfaceData() and requestUpperAirData(), prune out stations that already have all met params they need, to avoid unnecessary querying
* 09/04/2014 1127 B. Hebbard Exempt forecast (e.g., MOS) datatimes from check in requestSurfaceData that sees if retrieved value matches desired time. This is because we retrieve only the refTime from HDF5 for comparison, which is sufficient for obs times, but not those with forecast component. * 09/04/2014 1127 B. Hebbard Exempt forecast (e.g., MOS) datatimes from check in requestSurfaceData that sees if retrieved value matches desired time. This is because we retrieve only the refTime from HDF5 for comparison, which is sufficient for obs times, but not those with forecast component.
* *