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:
parent
f87cc6e7fb
commit
57393984d3
37 changed files with 7515 additions and 6910 deletions
|
@ -47,7 +47,7 @@ import java.util.Set;
|
|||
* 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
|
||||
* 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>
|
||||
*
|
||||
|
@ -397,11 +397,12 @@ public class CINT {
|
|||
interval = (cmax - cmin) / 10.0;
|
||||
}
|
||||
|
||||
// Only allow less than 50 contour levels
|
||||
if ((cmax - cmin) / interval > 50)
|
||||
// Only allow less than 50 contour levels :
|
||||
// comment out contour restriction. : IT WAs BAD Code to generate decimal point on contour labels.
|
||||
/* if ((cmax - cmin) / interval > 50) {
|
||||
interval = (cmax - cmin) / 50;
|
||||
|
||||
// System.out.println(" cmax=="+cmax);
|
||||
interval =(double) (int) ((cmax - cmin)/50) ; }
|
||||
*/
|
||||
contourInfo = new CINT(interval.toString() + "/"
|
||||
+ cmin.toString() + "/" + cmax.toString());
|
||||
cvalues = contourInfo
|
||||
|
@ -409,6 +410,29 @@ public class CINT {
|
|||
}
|
||||
}
|
||||
|
||||
/********************************
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -652,3 +676,4 @@ public class CINT {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1940,9 +1940,10 @@ public class NsharpResourceHandler {
|
|||
return;
|
||||
}
|
||||
if (!fromArchive) {
|
||||
// start FixMark:nearByStnCompSnd d2dlite
|
||||
if (!(sndType.contentEquals("NCUAIR") || sndType
|
||||
.contentEquals("BUFRUA"))) {
|
||||
// For those sounding report with forecast time, e.g. model/pfc sounding
|
||||
if (timeLine.contains("V")) { //fix D2D loading issue. 10/8/2014
|
||||
// if (!(sndType.contentEquals("NCUAIR") || sndType
|
||||
// .contentEquals("BUFRUA"))) {
|
||||
// Chin's NOTE:
|
||||
// Can Not use reference time directly from the stnInfo,
|
||||
// Timestamp refTime = stnInfo.getReftime()
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* 01/08/2014 Chin Chen Only initializing inventory when in NCP
|
||||
* 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.
|
||||
*
|
||||
* 10/20/2014 Chin Chen DR16864, D2D does not use unload button. Check to make sure not D2D instance before access unload button.
|
||||
* </pre>
|
||||
*
|
||||
* @author Chin Chen
|
||||
|
@ -150,7 +150,7 @@ public class NsharpPaletteWindow extends ViewPart implements SelectionListener,
|
|||
|
||||
private boolean spcGpCreated = false;
|
||||
|
||||
private boolean awcGpCreated = false;
|
||||
private boolean imD2d = false; // fixMark:NcInventory
|
||||
|
||||
public static NsharpPaletteWindow getInstance() {
|
||||
if (VizPerspectiveListener.getCurrentPerspectiveManager() != null) {
|
||||
|
@ -220,6 +220,7 @@ public class NsharpPaletteWindow extends ViewPart implements SelectionListener,
|
|||
interpBtn.setEnabled(false);
|
||||
graphModeBtnIcing.setEnabled(false);
|
||||
graphModeBtnTurb.setEnabled(false);
|
||||
if (!imD2d)
|
||||
unloadBtn.setEnabled(false); // FixMark:nearByStnCompSnd
|
||||
} else if (compareStnIsOn) {
|
||||
compareStnBtn.setText(COMP_STN_ON);
|
||||
|
@ -231,6 +232,7 @@ public class NsharpPaletteWindow extends ViewPart implements SelectionListener,
|
|||
interpBtn.setEnabled(false);
|
||||
graphModeBtnIcing.setEnabled(false);
|
||||
graphModeBtnTurb.setEnabled(false);
|
||||
if (!imD2d)
|
||||
unloadBtn.setEnabled(false); // FixMark:nearByStnCompSnd
|
||||
} else if (compareSndIsOn) {
|
||||
compareSndBtn.setText(COMP_SND_ON);
|
||||
|
@ -242,6 +244,7 @@ public class NsharpPaletteWindow extends ViewPart implements SelectionListener,
|
|||
interpBtn.setEnabled(false);
|
||||
graphModeBtnIcing.setEnabled(false);
|
||||
graphModeBtnTurb.setEnabled(false);
|
||||
if (!imD2d)
|
||||
unloadBtn.setEnabled(false); // FixMark:nearByStnCompSnd
|
||||
} else if (compareTmIsOn) {
|
||||
compareTmBtn.setText(COMP_TM_ON);
|
||||
|
@ -253,6 +256,7 @@ public class NsharpPaletteWindow extends ViewPart implements SelectionListener,
|
|||
interpBtn.setEnabled(false);
|
||||
graphModeBtnIcing.setEnabled(false);
|
||||
graphModeBtnTurb.setEnabled(false);
|
||||
if (!imD2d)
|
||||
unloadBtn.setEnabled(false); // FixMark:nearByStnCompSnd
|
||||
} else if (editGraphOn) {
|
||||
graphEditBtn.setText(EDIT_GRAPH_ON);
|
||||
|
@ -264,6 +268,7 @@ public class NsharpPaletteWindow extends ViewPart implements SelectionListener,
|
|||
interpBtn.setEnabled(false);
|
||||
graphModeBtnIcing.setEnabled(false);
|
||||
graphModeBtnTurb.setEnabled(false);
|
||||
if (!imD2d)
|
||||
unloadBtn.setEnabled(false); // FixMark:nearByStnCompSnd
|
||||
}
|
||||
|
||||
|
@ -377,7 +382,7 @@ public class NsharpPaletteWindow extends ViewPart implements SelectionListener,
|
|||
public NsharpPaletteWindow() {
|
||||
super();
|
||||
instance = this;
|
||||
boolean imD2d = false; // fixMark:NcInventory
|
||||
//boolean imD2d = false; // fixMark:NcInventory
|
||||
if (VizPerspectiveListener.getCurrentPerspectiveManager() != null) {
|
||||
if (VizPerspectiveListener.getCurrentPerspectiveManager()
|
||||
.getPerspectiveId().equals(D2D5Pane.ID_PERSPECTIVE)) {
|
||||
|
@ -945,6 +950,7 @@ public class NsharpPaletteWindow extends ViewPart implements SelectionListener,
|
|||
graphModeBtnIcing.setEnabled(false);
|
||||
interpBtn.setEnabled(false);
|
||||
cfgBtn.setEnabled(false);
|
||||
if (!imD2d)
|
||||
unloadBtn.setEnabled(false);// FixMark:nearByStnCompSnd
|
||||
} else {
|
||||
overlayIsOn = false;
|
||||
|
@ -958,6 +964,7 @@ public class NsharpPaletteWindow extends ViewPart implements SelectionListener,
|
|||
graphModeBtnIcing.setEnabled(true);
|
||||
interpBtn.setEnabled(true);
|
||||
cfgBtn.setEnabled(true);
|
||||
if (!imD2d)
|
||||
unloadBtn.setEnabled(true);// FixMark:nearByStnCompSnd
|
||||
}
|
||||
NsharpResourceHandler rsc = getRscHandler();
|
||||
|
@ -1001,6 +1008,7 @@ public class NsharpPaletteWindow extends ViewPart implements SelectionListener,
|
|||
graphModeBtnIcing.setEnabled(false);
|
||||
interpBtn.setEnabled(false);
|
||||
cfgBtn.setEnabled(false);
|
||||
if (!imD2d)
|
||||
unloadBtn.setEnabled(false);// FixMark:nearByStnCompSnd
|
||||
} else {
|
||||
compareStnIsOn = false;
|
||||
|
@ -1014,6 +1022,7 @@ public class NsharpPaletteWindow extends ViewPart implements SelectionListener,
|
|||
graphModeBtnIcing.setEnabled(true);
|
||||
interpBtn.setEnabled(true);
|
||||
cfgBtn.setEnabled(true);
|
||||
if (!imD2d)
|
||||
unloadBtn.setEnabled(true);// FixMark:nearByStnCompSnd
|
||||
}
|
||||
NsharpResourceHandler rsc = getRscHandler();
|
||||
|
@ -1059,6 +1068,7 @@ public class NsharpPaletteWindow extends ViewPart implements SelectionListener,
|
|||
graphModeBtnIcing.setEnabled(false);
|
||||
interpBtn.setEnabled(false);
|
||||
cfgBtn.setEnabled(false);
|
||||
if (!imD2d)
|
||||
unloadBtn.setEnabled(false);// FixMark:nearByStnCompSnd
|
||||
} else {
|
||||
compareTmIsOn = false;
|
||||
|
@ -1072,6 +1082,7 @@ public class NsharpPaletteWindow extends ViewPart implements SelectionListener,
|
|||
graphModeBtnIcing.setEnabled(true);
|
||||
interpBtn.setEnabled(true);
|
||||
cfgBtn.setEnabled(true);
|
||||
if (!imD2d)
|
||||
unloadBtn.setEnabled(true);// FixMark:nearByStnCompSnd
|
||||
}
|
||||
NsharpResourceHandler rsc = getRscHandler();
|
||||
|
@ -1115,6 +1126,7 @@ public class NsharpPaletteWindow extends ViewPart implements SelectionListener,
|
|||
graphModeBtnIcing.setEnabled(false);
|
||||
interpBtn.setEnabled(false);
|
||||
cfgBtn.setEnabled(false);
|
||||
if (!imD2d)
|
||||
unloadBtn.setEnabled(false);// FixMark:nearByStnCompSnd
|
||||
} else {
|
||||
compareSndIsOn = false;
|
||||
|
@ -1128,6 +1140,7 @@ public class NsharpPaletteWindow extends ViewPart implements SelectionListener,
|
|||
graphModeBtnIcing.setEnabled(true);
|
||||
interpBtn.setEnabled(true);
|
||||
cfgBtn.setEnabled(true);
|
||||
if (!imD2d)
|
||||
unloadBtn.setEnabled(true);// FixMark:nearByStnCompSnd
|
||||
}
|
||||
NsharpResourceHandler rsc = getRscHandler();
|
||||
|
@ -1187,6 +1200,7 @@ public class NsharpPaletteWindow extends ViewPart implements SelectionListener,
|
|||
compareSndBtn.setEnabled(true);
|
||||
compareStnBtn.setEnabled(true);
|
||||
overlayBtn.setEnabled(true);
|
||||
if (!imD2d)
|
||||
unloadBtn.setEnabled(true);// FixMark:nearByStnCompSnd
|
||||
}
|
||||
} else {
|
||||
|
@ -1200,6 +1214,7 @@ public class NsharpPaletteWindow extends ViewPart implements SelectionListener,
|
|||
compareSndBtn.setEnabled(false);
|
||||
compareStnBtn.setEnabled(false);
|
||||
overlayBtn.setEnabled(false);
|
||||
if (!imD2d)
|
||||
unloadBtn.setEnabled(false);// FixMark:nearByStnCompSnd
|
||||
}
|
||||
NsharpResourceHandler rsc = getRscHandler();
|
||||
|
|
|
@ -840,7 +840,7 @@
|
|||
<Color red="255" green="255" blue="0" alpha="255"/>
|
||||
<Point Lat="39.35390746604257" Lon="-73.2133975036754"/>
|
||||
</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>
|
||||
<Color red="255" green="0" blue="0" alpha="255"/>
|
||||
</initialColor>
|
||||
|
|
|
@ -803,7 +803,7 @@
|
|||
<Color red="255" green="255" blue="0" alpha="255"/>
|
||||
<Point Lat="39.35390746604257" Lon="-73.2133975036754"/>
|
||||
</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>
|
||||
<Color red="255" green="0" blue="0" alpha="255"/>
|
||||
</initialColor>
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
E. Safford/SAIC 06/07 rm "...UPDT TO CANCEL..."
|
||||
B. Yin/SAIC 02/08 add tag number after cancellation
|
||||
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:param name="status"></xsl:param>
|
||||
|
@ -30,9 +31,11 @@
|
|||
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains( $airmet_outlook, 'AIRMET')">
|
||||
<xsl:value-of select="$newline"/>
|
||||
<xsl:text>CANCEL AIRMET. CONDS HV ENDED.</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$newline"/>
|
||||
<xsl:text>CANCEL OUTLOOK.</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
|
|
|
@ -20,6 +20,9 @@
|
|||
B. Yin/SAIC 08/06 distinguish smear and outlook
|
||||
B. Yin/Chugach 12/11 changed 'Status' to 'issueType'
|
||||
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">
|
||||
|
@ -27,8 +30,9 @@
|
|||
<xsl:param name="haz2">NO HAZARD2</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:choose>
|
||||
<xsl:when test="@issueType = 'CAN'">
|
||||
|
@ -47,6 +51,7 @@
|
|||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
|
||||
<!--
|
||||
<xsl:for-each select="//outlook">
|
||||
<xsl:if test="contains( hazard, $haz1 ) or contains( hazard, $haz2 ) or contains( hazard, $haz3 )">
|
||||
<xsl:choose>
|
||||
|
@ -65,7 +70,7 @@
|
|||
</xsl:choose>
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
|
||||
-->
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
|
|
|
@ -141,15 +141,14 @@
|
|||
</xsl:element>
|
||||
</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:if test="string-length($airTag) > 1">
|
||||
<xsl:if test="string-length($airTag) > 1">
|
||||
<xsl:element name="line">
|
||||
<xsl:value-of select="$newline"/><xsl:value-of select="normalize-space($airTag)"/>.</xsl:element>
|
||||
</xsl:if>
|
||||
-->
|
||||
</xsl:if>
|
||||
|
||||
-->
|
||||
<!-- Add the attention line(s) -->
|
||||
<xsl:call-template name="GetAttentionLine">
|
||||
<xsl:with-param name="status"><xsl:value-of select="@issueType"/></xsl:with-param>
|
||||
|
|
|
@ -78,6 +78,7 @@ public abstract class AttrDlg extends Dialog implements IAttribute {
|
|||
public static int ctrlBtnHeight = 28;
|
||||
|
||||
// public static int ctrlBtnWidth = 90;
|
||||
|
||||
// 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.OK_ID).setEnabled(false);
|
||||
|
||||
this.getButton(IDialogConstants.CANCEL_ID).setLayoutData(
|
||||
new GridData(ctrlBtnWidth, ctrlBtnHeight));
|
||||
this.getButton(IDialogConstants.OK_ID).setLayoutData(
|
||||
new GridData(ctrlBtnWidth, ctrlBtnHeight));
|
||||
setDefaultControlButtonSize();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
|
|
@ -3169,6 +3169,10 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
|||
|
||||
private PgenContoursTool tool = null;
|
||||
|
||||
private Contours prevCont = null;
|
||||
|
||||
private Contours nowCont = null;
|
||||
|
||||
private ContourMinmaxAttrDlg(Shell parShell) throws VizException {
|
||||
|
||||
super(parShell);
|
||||
|
@ -3238,11 +3242,54 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
|||
if (apt instanceof PgenContoursTool) {
|
||||
tool = (PgenContoursTool) apt;
|
||||
}
|
||||
|
||||
if (tool != null) {
|
||||
tool.resetUndoRedoCount();
|
||||
PgenSession.getInstance().getCommandManager()
|
||||
.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
|
||||
|
@ -3252,6 +3299,10 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
|||
PgenSession.getInstance().getCommandManager()
|
||||
.removeStackListener(tool);
|
||||
}
|
||||
|
||||
prevCont = null;
|
||||
nowCont = null;
|
||||
|
||||
return super.close();
|
||||
}
|
||||
|
||||
|
@ -3262,15 +3313,34 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
|||
protected void placeSymbol() {
|
||||
|
||||
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())));
|
||||
.parseDouble(longitudeText.getText()),
|
||||
Double.parseDouble(latitudeText.getText())));
|
||||
placeBtn.setEnabled(false);
|
||||
nowCont = currentContours; // Keep a copy for "Redo"
|
||||
undoBtn.setEnabled(true);
|
||||
undoBtn.setText("Undo Symbol");
|
||||
|
||||
} else if (tool.getMouseHandler() instanceof PgenSelectHandler) {
|
||||
minmaxTemplate = (gov.noaa.nws.ncep.ui.pgen.elements.Symbol) new DrawableElementFactory()
|
||||
.create(DrawableType.SYMBOL, (IAttribute) this,
|
||||
"Symbol", getActiveSymbolObjType(),
|
||||
(Coordinate) null, null);
|
||||
contoursAttrSettings.put(getActiveSymbolObjType(),
|
||||
minmaxTemplate);
|
||||
|
||||
updateMinmaxAttributes();
|
||||
|
||||
placeBtn.setEnabled(false);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3330,7 +3400,34 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
|||
|
||||
if (newEl != null && oldAdc.equals(de.getParent())) {
|
||||
newEl.setParent(newAdc);
|
||||
|
||||
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)
|
||||
.replace(((ContourMinmax) newAdc)
|
||||
.getSymbol(), newEl);
|
||||
|
@ -3338,6 +3435,8 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
|||
|
||||
((ContourMinmax) newAdc).getSymbol().update(
|
||||
minmaxTemplate);
|
||||
|
||||
((ContourMinmax) newAdc).getLabel().setAuto(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3926,4 +4025,15 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -68,9 +68,6 @@ import com.raytheon.uf.viz.core.exception.VizException;
|
|||
*/
|
||||
public class GfaFormatAttrDlg extends AttrDlg {
|
||||
|
||||
// private final static Logger logger =
|
||||
// Logger.getLogger(GfaFormatAttrDlg.class);
|
||||
|
||||
private static final String ZULU = "ZULU";
|
||||
|
||||
private static final String TANGO = "TANGO";
|
||||
|
@ -151,7 +148,6 @@ public class GfaFormatAttrDlg extends AttrDlg {
|
|||
instance = new GfaFormatAttrDlg(parShell);
|
||||
|
||||
} catch (VizException e) {
|
||||
// logger.error(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -309,9 +305,11 @@ public class GfaFormatAttrDlg extends AttrDlg {
|
|||
super.createButtonsForButtonBar(parent);
|
||||
this.getButton(OK_ID).setText(SAVE_LABEL);
|
||||
this.getButton(CANCEL_ID).setText(CANCEL_LABEL);
|
||||
}
|
||||
|
||||
// createButton(parent, OK_ID, SAVE_LABEL, true);
|
||||
// createButton(parent, CANCEL_ID, CANCEL_LABEL, false);
|
||||
@Override
|
||||
public void setDefaultControlButtonSize() {
|
||||
setButtonSize(ctrlBtnWidth + 50, ctrlBtnHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -8,39 +8,39 @@
|
|||
|
||||
package gov.noaa.nws.ncep.ui.pgen.attrdialog;
|
||||
|
||||
import gov.noaa.nws.ncep.ui.pgen.display.FillPatternList.FillPattern;
|
||||
import gov.noaa.nws.ncep.ui.pgen.display.IAttribute;
|
||||
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.AbstractDrawableComponent;
|
||||
import gov.noaa.nws.ncep.ui.pgen.elements.Track;
|
||||
import gov.noaa.nws.ncep.viz.common.ui.color.ColorButtonSelector;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.awt.Color;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.widgets.Combo;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.events.ModifyEvent;
|
||||
import org.eclipse.swt.events.ModifyListener;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Combo;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Group;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
|
||||
import gov.noaa.nws.ncep.ui.pgen.display.ITrack;
|
||||
import gov.noaa.nws.ncep.ui.pgen.display.IText.FontStyle;
|
||||
import gov.noaa.nws.ncep.ui.pgen.display.TrackPoint;
|
||||
import gov.noaa.nws.ncep.ui.pgen.display.FillPatternList.FillPattern;
|
||||
import gov.noaa.nws.ncep.ui.pgen.elements.AbstractDrawableComponent;
|
||||
import gov.noaa.nws.ncep.ui.pgen.display.IAttribute;
|
||||
import gov.noaa.nws.ncep.ui.pgen.elements.Track;
|
||||
import gov.noaa.nws.ncep.viz.common.ui.color.ColorButtonSelector;
|
||||
|
||||
/**
|
||||
* Singleton attribute dialog for Track.
|
||||
*
|
||||
|
@ -61,6 +61,7 @@ import gov.noaa.nws.ncep.viz.common.ui.color.ColorButtonSelector;
|
|||
* Added isNewTrack flag to make the FirstTime(/SecondTime) current time when create a Track
|
||||
* 03/13 #928 B. Yin Added a separator above the button bar.
|
||||
* 08/13 #1020 B. Yin Fixed the 'Other' interval problem.
|
||||
* 09/14 TTR750 J. Wu Use fontStyle for track labels.
|
||||
* </pre>
|
||||
*
|
||||
* @author M. Gao
|
||||
|
@ -68,42 +69,56 @@ import gov.noaa.nws.ncep.viz.common.ui.color.ColorButtonSelector;
|
|||
|
||||
public class TrackAttrDlg extends AttrDlg implements ITrack {
|
||||
|
||||
// private final static org.apache.log4j.Logger log =
|
||||
// org.apache.log4j.Logger.getLogger(TrackAttrDlg.class);
|
||||
public static enum FontSizeName {
|
||||
TINY, SMALL, MEDIUM, LARGE, HUGE, GIANT
|
||||
};
|
||||
|
||||
public static enum FontSizeName { TINY, SMALL, MEDIUM, LARGE, HUGE, GIANT };
|
||||
public static int[] FontSizeValue = { 10, 12, 14, 18, 24, 34 };
|
||||
//public static String[] FontName = new String[]{ "Courier", "Helvetica", "Times" };
|
||||
public static String[] FontName = new String[]{ "Courier", "Nimbus Sans L", "Liberation Serif" };
|
||||
|
||||
public static String[] BoxName = new String[]{ "Normal", "Boxed", "Blanked", "Outline" };
|
||||
public static String[] FontName = new String[] { "Courier",
|
||||
"Nimbus Sans L", "Liberation Serif" };
|
||||
|
||||
public static String[] BoxName = new String[] { "Normal", "Boxed",
|
||||
"Blanked", "Outline" };
|
||||
|
||||
private final int DEFAULT_NUMBER_OF_TIMES = 5;
|
||||
|
||||
private final int DEFAULT_HOUR_SHIFT_FOR_FIRST_TIME = 4;
|
||||
|
||||
private final int DEFAULT_HOUR_SHIFT_BEYOND_FIRST_TIME = 1;
|
||||
|
||||
private static String[] IntervalTimeValues = {"00:15", "00:30", "01:00", "02:00", "06:00",
|
||||
"12:00", "Other"};
|
||||
private static String[] IntervalTimeValues = { "00:15", "00:30", "01:00",
|
||||
"02:00", "06:00", "12:00", "Other" };
|
||||
|
||||
private String previousIntervalTimeValue = "";
|
||||
|
||||
private static String[] UnitValues = { "kts", "kph", "mph" };
|
||||
|
||||
private static String[] RoundTo = { " ", "5", "10" };
|
||||
|
||||
private static String[] RoundDirTo = { " ", "1", "5" };
|
||||
|
||||
private Text firstTimeText;
|
||||
|
||||
private Text secondTimeText;
|
||||
|
||||
private boolean setTimeButtonSelected;
|
||||
|
||||
private Button frameTimeButton;
|
||||
|
||||
private Button setTimeButton;
|
||||
|
||||
private Text numberOfTimesText;
|
||||
|
||||
private Text intervalText;
|
||||
|
||||
private Text skipFactorText;
|
||||
|
||||
private ExtraPointTimeDisplayOption extraPointTimeDisplayOption;
|
||||
|
||||
// private Composite top = null;
|
||||
private ColorButtonSelector initialCS;
|
||||
|
||||
private ColorButtonSelector extrapCS;
|
||||
|
||||
private Text text = null;
|
||||
|
@ -111,27 +126,43 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
private Combo intervalCombo;
|
||||
|
||||
private Combo unitCombo;
|
||||
|
||||
private int unitComboSelectedIndex;
|
||||
|
||||
private Button roundButton;
|
||||
|
||||
private Combo roundCombo;
|
||||
|
||||
private int roundComboSelectedIndex;
|
||||
|
||||
private Button roundDirButton;
|
||||
|
||||
private Combo roundDirCombo;
|
||||
|
||||
private int roundDirComboSelectedIndex;
|
||||
|
||||
private Combo fontSizeCombo;
|
||||
|
||||
private int fontSizeComboSelectedIndex;
|
||||
|
||||
private Combo fontNameCombo;
|
||||
|
||||
private int fontNameComboSelectedIndex;
|
||||
|
||||
private Combo fontStyleCombo;
|
||||
|
||||
private int fontStyleComboSelectedIndex;
|
||||
|
||||
private Button skipFactorButton;
|
||||
|
||||
private Button showFirstLastButton;
|
||||
|
||||
private Button onHourButton;
|
||||
|
||||
private Button onHalfHourButton;
|
||||
|
||||
private Calendar firstTimeCalendar;
|
||||
|
||||
private Calendar secondTimeCalendar;
|
||||
|
||||
private int numberOfTimes = DEFAULT_NUMBER_OF_TIMES; // set the default to 5
|
||||
|
@ -144,6 +175,7 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
|
||||
/**
|
||||
* Private constructor
|
||||
*
|
||||
* @param parShell
|
||||
* @throws VizException
|
||||
*/
|
||||
|
@ -152,8 +184,8 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a track attribute dialog if the dialog does not exist
|
||||
* and returns the instance. If the dialog exists, return the instance.
|
||||
* Creates a track attribute dialog if the dialog does not exist and returns
|
||||
* the instance. If the dialog exists, return the instance.
|
||||
*
|
||||
* @param parShell
|
||||
* @return
|
||||
|
@ -176,7 +208,8 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
|
||||
// get the list of selected tracks
|
||||
if (drawingLayer != null) {
|
||||
adcList = (ArrayList<AbstractDrawableComponent>) drawingLayer.getAllSelected();
|
||||
adcList = (ArrayList<AbstractDrawableComponent>) drawingLayer
|
||||
.getAllSelected();
|
||||
}
|
||||
|
||||
if (adcList != null && !adcList.isEmpty()) {
|
||||
|
@ -195,8 +228,10 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
/*
|
||||
* populate the TrackExtrapPointInofDlg object
|
||||
*/
|
||||
populateTrackExtrapPointInfoDlgWithNewTrackData(getTrackExtrapPointInfoDlg(), newEl,
|
||||
unitComboSelectedIndex, roundComboSelectedIndex, roundDirComboSelectedIndex);
|
||||
populateTrackExtrapPointInfoDlgWithNewTrackData(
|
||||
getTrackExtrapPointInfoDlg(), newEl,
|
||||
unitComboSelectedIndex, roundComboSelectedIndex,
|
||||
roundDirComboSelectedIndex);
|
||||
|
||||
newList.add(newEl);
|
||||
|
||||
|
@ -207,7 +242,8 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
AttrSettings.getInstance().setSettings(newEl);
|
||||
}
|
||||
|
||||
ArrayList<AbstractDrawableComponent> oldList = new ArrayList<AbstractDrawableComponent>(adcList);
|
||||
ArrayList<AbstractDrawableComponent> oldList = new ArrayList<AbstractDrawableComponent>(
|
||||
adcList);
|
||||
drawingLayer.replaceElements(oldList, newList);
|
||||
}
|
||||
|
||||
|
@ -273,11 +309,16 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
String[] firstSecondTimeValueArray = getFirstSecondTimeInitialTimeValueForSetTimeButton();
|
||||
getFirstTimeText().setText(firstSecondTimeValueArray[0]);
|
||||
getSecondTimeText().setText(firstSecondTimeValueArray[1]);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
|
||||
getFirstTimeText().setText(getFirstOrSecondTimeStringValue(track.getFirstTimeCalendar(), true, track.getInitialPoints()));
|
||||
getSecondTimeText().setText(getFirstOrSecondTimeStringValue(track.getSecondTimeCalendar(), false, track.getInitialPoints()));
|
||||
getFirstTimeText().setText(
|
||||
getFirstOrSecondTimeStringValue(
|
||||
track.getFirstTimeCalendar(), true,
|
||||
track.getInitialPoints()));
|
||||
getSecondTimeText().setText(
|
||||
getFirstOrSecondTimeStringValue(
|
||||
track.getSecondTimeCalendar(), false,
|
||||
track.getInitialPoints()));
|
||||
}
|
||||
|
||||
// isNewTrack = false;
|
||||
|
@ -285,33 +326,30 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
* 3. restore Number of times value
|
||||
*/
|
||||
if (track.getExtrapPoints() != null)
|
||||
numberOfTimesText.setText(String.valueOf(track.getExtrapPoints().length));
|
||||
numberOfTimesText
|
||||
.setText(String.valueOf(track.getExtrapPoints().length));
|
||||
|
||||
/*
|
||||
* 4. restore interval time settings
|
||||
*/
|
||||
// intervalCombo.select(track.getIntervalComboSelectedIndex());
|
||||
// int intervalComboItemCount = intervalCombo.getItemCount();
|
||||
// if ( (intervalComboItemCount - 1) == track.getIntervalComboSelectedIndex() )
|
||||
// intervalText.setText(track.getIntervalTimeString());
|
||||
|
||||
setIntervalTimeString(track.getIntervalTimeString());
|
||||
|
||||
// restoreIntervalTimeSettingByTrack(this, track);
|
||||
|
||||
/*
|
||||
* 5. restore initial and extrap colors
|
||||
*/
|
||||
java.awt.Color initColor = track.getInitialColor();
|
||||
initialCS.setColorValue(new RGB(initColor.getRed(), initColor.getGreen(), initColor.getBlue()));
|
||||
initialCS.setColorValue(new RGB(initColor.getRed(), initColor
|
||||
.getGreen(), initColor.getBlue()));
|
||||
java.awt.Color extrapColor = track.getExtrapColor();
|
||||
extrapCS.setColorValue(new RGB(extrapColor.getRed(), extrapColor.getGreen(), extrapColor.getBlue()));
|
||||
extrapCS.setColorValue(new RGB(extrapColor.getRed(), extrapColor
|
||||
.getGreen(), extrapColor.getBlue()));
|
||||
|
||||
/*
|
||||
* 6. restore label option settings
|
||||
*/
|
||||
setExtraPointTimeDisplayOption(track.getExtraPointTimeDisplayOption());
|
||||
makeTimeDisplayOptionSelected(track.getExtraPointTimeDisplayOption(), track.getSkipFactorTextString());
|
||||
makeTimeDisplayOptionSelected(track.getExtraPointTimeDisplayOption(),
|
||||
track.getSkipFactorTextString());
|
||||
|
||||
/*
|
||||
* 7. restore Font, Size, Style combo values
|
||||
|
@ -341,36 +379,27 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
roundDirButton.setSelection(false);
|
||||
}
|
||||
|
||||
private void populateTrackExtrapPointInfoDlgWithNewTrackData(TrackExtrapPointInfoDlg trackExtrapPointInfoDlgObject,
|
||||
Track newTrackObject, int unitComboSelectedIndex, int roundComboSelectedIndex, int roundDirComboSelectedIndex) {
|
||||
private void populateTrackExtrapPointInfoDlgWithNewTrackData(
|
||||
TrackExtrapPointInfoDlg trackExtrapPointInfoDlgObject,
|
||||
Track newTrackObject, int unitComboSelectedIndex,
|
||||
int roundComboSelectedIndex, int roundDirComboSelectedIndex) {
|
||||
if (trackExtrapPointInfoDlgObject != null && newTrackObject != null) {
|
||||
trackExtrapPointInfoDlgObject.close();
|
||||
|
||||
trackExtrapPointInfoDlgObject.setBlockOnOpen(false);
|
||||
trackExtrapPointInfoDlgObject.open();
|
||||
|
||||
trackExtrapPointInfoDlgObject.setTrack(newTrackObject, unitComboSelectedIndex, roundComboSelectedIndex, roundDirComboSelectedIndex);
|
||||
trackExtrapPointInfoDlgObject.setTrack(newTrackObject,
|
||||
unitComboSelectedIndex, roundComboSelectedIndex,
|
||||
roundDirComboSelectedIndex);
|
||||
|
||||
trackExtrapPointInfoDlgObject.setBlockOnOpen(true);
|
||||
}
|
||||
}
|
||||
|
||||
// private void restoreIntervalTimeSettingByTrack(TrackAttrDlg targetTrackAttrDlg, Track track) {
|
||||
// if(targetTrackAttrDlg == null || track == null)
|
||||
// return;
|
||||
//
|
||||
// targetTrackAttrDlg.getIntervalCombo().select(track.getIntervalComboSelectedIndex());
|
||||
// int intervalComboItemCount = targetTrackAttrDlg.getIntervalCombo().getItemCount();
|
||||
// if((intervalComboItemCount - 1) == track.getIntervalComboSelectedIndex()) {
|
||||
// if(track.getIntervalTimeString() != null)
|
||||
// targetTrackAttrDlg.getIntervalText().setText(track.getIntervalTimeString());
|
||||
// } else {
|
||||
//// targetTrackAttrDlg.getIntervalText().setText(targetTrackAttrDlg.getIntervalCombo().getText());
|
||||
// track.setIntervalTimeString(targetTrackAttrDlg.getIntervalCombo().getText());
|
||||
// }
|
||||
// }
|
||||
|
||||
private void makeTimeDisplayOptionSelected(ExtraPointTimeDisplayOption extraPointTimeDisplayOption, String skipFactorTextString) {
|
||||
private void makeTimeDisplayOptionSelected(
|
||||
ExtraPointTimeDisplayOption extraPointTimeDisplayOption,
|
||||
String skipFactorTextString) {
|
||||
getSkipFactorButton().setSelection(false);
|
||||
skipFactorText.setText("");
|
||||
if (extraPointTimeDisplayOption == ITrack.ExtraPointTimeDisplayOption.ON_HALF_HOUR)
|
||||
|
@ -387,6 +416,7 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
|
||||
/**
|
||||
* Creates buttons, menus, and other controls in the dialog area
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
private void initializeComponents(Composite topComposite) {
|
||||
|
@ -398,7 +428,6 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
GridLayout childGridLayout = new GridLayout(2, false);
|
||||
|
||||
this.getShell().setText("Track Attributes");
|
||||
// log.info("===now it is inside initializeComponents(...)");
|
||||
|
||||
/**
|
||||
* Draw Frame/Set time buttons
|
||||
|
@ -407,14 +436,10 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
timeRadioButtonGroup.setLayout(childGridLayout);
|
||||
|
||||
frameTimeButton = new Button(timeRadioButtonGroup, SWT.RADIO);
|
||||
// Button frameTimeButton = new Button(topComposite, SWT.RADIO);
|
||||
frameTimeButton.setText("Frame time");
|
||||
|
||||
// Button setTimeButton = new Button(topComposite, SWT.RADIO);
|
||||
setTimeButton = new Button(timeRadioButtonGroup, SWT.RADIO);
|
||||
setTimeButton.setText("Set Time");
|
||||
// setTimeButton.setSelection(true);
|
||||
// timeRadioButtonGroup.h
|
||||
Label emptyLabel = new Label(topComposite, SWT.LEFT);
|
||||
emptyLabel.setText(" ");
|
||||
|
||||
|
@ -429,36 +454,38 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
public void modifyText(ModifyEvent e) {
|
||||
Text txt = (Text) e.widget;
|
||||
Calendar cal = gempakTM2Calendar(txt.getText());
|
||||
if ( cal != null ) firstTimeCalendar = cal;
|
||||
if (cal != null)
|
||||
firstTimeCalendar = cal;
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
setSecondTimeText(createTextfieldWithLabel(topComposite, "Second time:",
|
||||
SWT.SINGLE | SWT.BORDER, textWidth, textHeight, true));
|
||||
setSecondTimeText(createTextfieldWithLabel(topComposite,
|
||||
"Second time:", SWT.SINGLE | SWT.BORDER, textWidth, textHeight,
|
||||
true));
|
||||
getSecondTimeText().setText(firstSecondTimeValueArray[1]);
|
||||
|
||||
getSecondTimeText().addModifyListener(new ModifyListener() {
|
||||
public void modifyText(ModifyEvent e) {
|
||||
Text txt = (Text) e.widget;
|
||||
Calendar cal = gempakTM2Calendar(txt.getText());
|
||||
if ( cal != null ) secondTimeCalendar = cal;
|
||||
if (cal != null)
|
||||
secondTimeCalendar = cal;
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
setTimeButton.setSelection(true);
|
||||
setSetTimeButtonSelected(true);
|
||||
frameAndSetTimeButtonSelectionListenerAction(frameTimeButton, getFirstTimeText(),
|
||||
getSecondTimeText());
|
||||
frameAndSetTimeButtonSelectionListenerAction(setTimeButton, getFirstTimeText(),
|
||||
getSecondTimeText());
|
||||
frameAndSetTimeButtonSelectionListenerAction(frameTimeButton,
|
||||
getFirstTimeText(), getSecondTimeText());
|
||||
frameAndSetTimeButtonSelectionListenerAction(setTimeButton,
|
||||
getFirstTimeText(), getSecondTimeText());
|
||||
|
||||
/*
|
||||
* Played with NMAP2, it seems directly change first/second time texts do not have any
|
||||
* impact on the first/second starting points. Thus, now set both text fields are not
|
||||
* editable
|
||||
* Played with NMAP2, it seems directly change first/second time texts
|
||||
* do not have any impact on the first/second starting points. Thus, now
|
||||
* set both text fields are not editable
|
||||
*/
|
||||
getFirstTimeText().setEditable(true);
|
||||
getSecondTimeText().setEditable(true);
|
||||
|
@ -466,17 +493,18 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
/*
|
||||
* Draw Number of times text row
|
||||
*/
|
||||
setNumberOfTimesText(createTextfieldWithLabel(topComposite, "Number of times:",
|
||||
SWT.SINGLE | SWT.BORDER, textWidth/3, textHeight, true));
|
||||
setNumberOfTimesText(createTextfieldWithLabel(topComposite,
|
||||
"Number of times:", SWT.SINGLE | SWT.BORDER, textWidth / 3,
|
||||
textHeight, true));
|
||||
numberOfTimesText.setText(String.valueOf(numberOfTimes));
|
||||
numberOfTimesText.addModifyListener(new ModifyListener() {
|
||||
public void modifyText(ModifyEvent e) {
|
||||
try {
|
||||
numberOfTimes = Integer.parseInt(numberOfTimesText.getText());
|
||||
numberOfTimes = Integer.parseInt(numberOfTimesText
|
||||
.getText());
|
||||
} catch (NumberFormatException nfe) {
|
||||
numberOfTimes = DEFAULT_NUMBER_OF_TIMES; //use the default value
|
||||
// log.error("The text value of number of times is invalid, input text="
|
||||
// +getNumberOfTimesText().getText());
|
||||
numberOfTimes = DEFAULT_NUMBER_OF_TIMES; // use the default
|
||||
// value
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -490,7 +518,8 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
Group intervalRowGroup = new Group(topComposite, SWT.NONE);
|
||||
intervalRowGroup.setLayout(childGridLayout);
|
||||
|
||||
intervalCombo = new Combo(intervalRowGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
|
||||
intervalCombo = new Combo(intervalRowGroup, SWT.DROP_DOWN
|
||||
| SWT.READ_ONLY);
|
||||
for (String currentString : IntervalTimeValues) {
|
||||
intervalCombo.add(currentString);
|
||||
}
|
||||
|
@ -506,7 +535,6 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
intervalText.setEditable(false);
|
||||
intervalText.setText("");
|
||||
setPreviousIntervalTimeValue(intervalCombo.getText());
|
||||
// setIntervalTimeString(intervalCombo.getText());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -542,7 +570,8 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
unitCombo.add(unit);
|
||||
}
|
||||
|
||||
unitCombo.select(0); // default to the 1st item of the list. the value is Courier
|
||||
unitCombo.select(0); // default to the 1st item of the list. the value
|
||||
// is Courier
|
||||
setUnitComboSelectedIndex(0);
|
||||
unitCombo.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
|
@ -602,7 +631,8 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
roundDirCombo.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
if (roundDirButton.getSelection())
|
||||
setRoundDirComboSelectedIndex(roundDirCombo.getSelectionIndex());
|
||||
setRoundDirComboSelectedIndex(roundDirCombo
|
||||
.getSelectionIndex());
|
||||
else
|
||||
setRoundDirComboSelectedIndex(-1);
|
||||
}
|
||||
|
@ -613,6 +643,7 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
*/
|
||||
Label optionLabel = new Label(topComposite, SWT.LEFT);
|
||||
optionLabel.setText("Label Options:");
|
||||
|
||||
// make the label to fill the two columns
|
||||
GridData gridData = new GridData();
|
||||
gridData.horizontalSpan = 2;
|
||||
|
@ -629,20 +660,21 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
skipFactorText.setLayoutData(new GridData(textWidth / 4, textHeight));
|
||||
|
||||
skipFactorText.setText("0");
|
||||
labelOptionButtonSelectionListenerAction(skipFactorButton, skipFactorText, true,
|
||||
skipFactorButtonText, 0);
|
||||
labelOptionButtonSelectionListenerAction(skipFactorButton,
|
||||
skipFactorText, true, skipFactorButtonText, 0);
|
||||
|
||||
showFirstLastButton = createButton(topComposite, "Show first&&last", true, 2);
|
||||
labelOptionButtonSelectionListenerAction(showFirstLastButton, skipFactorText, false,
|
||||
skipFactorButtonText, 0);
|
||||
showFirstLastButton = createButton(topComposite, "Show first&&last",
|
||||
true, 2);
|
||||
labelOptionButtonSelectionListenerAction(showFirstLastButton,
|
||||
skipFactorText, false, skipFactorButtonText, 0);
|
||||
|
||||
onHourButton = createButton(topComposite, "On hour", true, 2);
|
||||
labelOptionButtonSelectionListenerAction(onHourButton, skipFactorText, false,
|
||||
skipFactorButtonText, 0);
|
||||
labelOptionButtonSelectionListenerAction(onHourButton, skipFactorText,
|
||||
false, skipFactorButtonText, 0);
|
||||
|
||||
onHalfHourButton = createButton(topComposite, "On half-hour", true, 2);
|
||||
labelOptionButtonSelectionListenerAction(onHalfHourButton, skipFactorText, false,
|
||||
skipFactorButtonText, 0);
|
||||
labelOptionButtonSelectionListenerAction(onHalfHourButton,
|
||||
skipFactorText, false, skipFactorButtonText, 0);
|
||||
|
||||
/*
|
||||
* Initialize the extra point display option as SKIP_FACTOR
|
||||
|
@ -658,7 +690,8 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
for (String fontName : FontName) {
|
||||
fontNameCombo.add(fontName);
|
||||
}
|
||||
fontNameCombo.select(0); // default to the 1st item of the list. the value is Courier
|
||||
fontNameCombo.select(0); // default to the 1st item of the list. the
|
||||
// value is Courier
|
||||
setFontNameComboSelectedIndex(0);
|
||||
fontNameCombo.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
|
@ -672,7 +705,8 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
for (FontSizeName fontSizeName : FontSizeName.values()) {
|
||||
fontSizeCombo.add(fontSizeName.name());
|
||||
}
|
||||
fontSizeCombo.select(2); // default to the 3rd item of the list. The value is Medium
|
||||
fontSizeCombo.select(2); // default to the 3rd item of the list. The
|
||||
// value is Medium
|
||||
setFontSizeComboSelectedIndex(2);
|
||||
fontSizeCombo.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
|
@ -686,11 +720,13 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
for (FontStyle fontStyle : FontStyle.values()) {
|
||||
fontStyleCombo.add(fontStyle.name());
|
||||
}
|
||||
fontStyleCombo.select(2); // default to the 3rd item of the list. The value is Bold
|
||||
fontStyleCombo.select(2); // default to the 3rd item of the list. The
|
||||
// value is Bold
|
||||
setFontStyleComboSelectedIndex(2);
|
||||
fontStyleCombo.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
setFontStyleComboSelectedIndex(fontStyleCombo.getSelectionIndex());
|
||||
setFontStyleComboSelectedIndex(fontStyleCombo
|
||||
.getSelectionIndex());
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -698,8 +734,9 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
|
||||
}
|
||||
|
||||
private void frameAndSetTimeButtonSelectionListenerAction(final Button button,
|
||||
final Text firstTimeText, final Text secondTimeText) {
|
||||
private void frameAndSetTimeButtonSelectionListenerAction(
|
||||
final Button button, final Text firstTimeText,
|
||||
final Text secondTimeText) {
|
||||
button.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
String[] firstAndSecondTimeValueArray = null;
|
||||
|
@ -732,46 +769,11 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
setSecondTimeCalendar(calendar);
|
||||
timeValueResult[1] = getDateTimeStringValue(calendar);
|
||||
|
||||
// Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
|
||||
// //calendar.add(Calendar.HOUR_OF_DAY, DEFAULT_HOUR_SHIFT_FOR_FIRST_TIME);
|
||||
// setFirstTimeCalendar(calendar);
|
||||
// timeValueResult[0] = getDateTimeStringValue(calendar);
|
||||
//
|
||||
// String intervalStr = getPreviousIntervalTimeValue(); //intervalTimeValue;
|
||||
// System.out.println("intervalStr "+intervalStr);
|
||||
//
|
||||
// if (intervalStr == null || intervalStr.equalsIgnoreCase(""))
|
||||
// intervalStr = "1:00";
|
||||
// String[] intervalString = intervalStr.split(":");
|
||||
//
|
||||
// int day = 0;
|
||||
// int hr = 0;
|
||||
// int min = 0;
|
||||
// if (intervalString.length == 1){
|
||||
// try {
|
||||
// hr = Integer.parseInt(intervalString[0]);
|
||||
// }
|
||||
// catch (NumberFormatException e) {
|
||||
// }
|
||||
// }
|
||||
// else if (intervalString.length == 2){
|
||||
// try {
|
||||
// hr = Integer.parseInt(intervalString[0]);
|
||||
// min = Integer.parseInt(intervalString[1]);
|
||||
// }
|
||||
// catch (NumberFormatException e) {
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// calendar.add(Calendar.HOUR_OF_DAY, hr);
|
||||
// calendar.add(Calendar.MINUTE, min);
|
||||
// setSecondTimeCalendar(calendar);
|
||||
// timeValueResult[1] = getDateTimeStringValue(calendar);
|
||||
|
||||
return timeValueResult;
|
||||
}
|
||||
|
||||
private String getFirstOrSecondTimeStringValue(Calendar timeCalendar, boolean isFirstTimeCalendar, TrackPoint[] initTrackPoints) {
|
||||
private String getFirstOrSecondTimeStringValue(Calendar timeCalendar,
|
||||
boolean isFirstTimeCalendar, TrackPoint[] initTrackPoints) {
|
||||
String timeStringValue = "";
|
||||
if (timeCalendar != null) {
|
||||
timeStringValue = getDateTimeStringValue(timeCalendar);
|
||||
|
@ -780,23 +782,25 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
int trackPointArrayIndex = initTrackPoints.length - 1;
|
||||
if (isFirstTimeCalendar)
|
||||
trackPointArrayIndex--;
|
||||
timeStringValue = getInitialPointsTimeStringValue(initTrackPoints, trackPointArrayIndex);
|
||||
timeStringValue = getInitialPointsTimeStringValue(
|
||||
initTrackPoints, trackPointArrayIndex);
|
||||
}
|
||||
}
|
||||
return timeStringValue;
|
||||
}
|
||||
|
||||
private String getInitialPointsTimeStringValue(TrackPoint[] trackPointArray, int pointArrayIndex) {
|
||||
private String getInitialPointsTimeStringValue(
|
||||
TrackPoint[] trackPointArray, int pointArrayIndex) {
|
||||
String timeStringValue = "";
|
||||
if (pointArrayIndex < trackPointArray.length) {
|
||||
TrackPoint targetTrackPoint = trackPointArray[pointArrayIndex];
|
||||
if (targetTrackPoint != null && targetTrackPoint.getTime() != null)
|
||||
timeStringValue = getDateTimeStringValue(targetTrackPoint.getTime());
|
||||
timeStringValue = getDateTimeStringValue(targetTrackPoint
|
||||
.getTime());
|
||||
}
|
||||
return timeStringValue;
|
||||
}
|
||||
|
||||
|
||||
private String getDateTimeStringValue(Calendar calendar) {
|
||||
StringBuilder stringBuilder = new StringBuilder(11);
|
||||
int year = calendar.get(Calendar.YEAR);
|
||||
|
@ -824,24 +828,9 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
return stringBuilder.toString();
|
||||
}
|
||||
|
||||
// private Calendar getCalendarByParsingString(String dateString, String dateFormatPattern) {
|
||||
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat(dateFormatPattern); //a pattern is something like "yyMMdd/HHmm"
|
||||
// Calendar cal = null;
|
||||
// if(dateString == null)
|
||||
// return cal;
|
||||
// try {
|
||||
// Date date = simpleDateFormat.parse(dateString);
|
||||
// cal = Calendar.getInstance();
|
||||
// cal.setTime(date);
|
||||
// } catch(ParseException pe) {
|
||||
// log.error("The input of dateString is invalid, parse fails, dateString="+dateString);
|
||||
// }
|
||||
// return cal;
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* a helper method to create an editable text with a text label
|
||||
*
|
||||
* @parentComposite, a parent Composite the text and label are built on
|
||||
* @textLabel, the value of the labe ltext
|
||||
* @textStyle, text style value
|
||||
|
@ -850,8 +839,9 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
* @isEditable, a boolean to indicate if the text is editable
|
||||
* @return Text
|
||||
*/
|
||||
private Text createTextfieldWithLabel(Composite parentComposite, String textLabel,
|
||||
int textStyle, int textWidth, int textHeight, boolean isEditable) {
|
||||
private Text createTextfieldWithLabel(Composite parentComposite,
|
||||
String textLabel, int textStyle, int textWidth, int textHeight,
|
||||
boolean isEditable) {
|
||||
Label firstTimeLabel = new Label(parentComposite, SWT.NONE);
|
||||
firstTimeLabel.setText(textLabel);
|
||||
|
||||
|
@ -863,6 +853,7 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
|
||||
/**
|
||||
* a helper method to create a button
|
||||
*
|
||||
* @parentComposite, a parent Composite the button is built on
|
||||
* @buttonText, text value associated with the button
|
||||
* @isHorizontalSpan, a boolean to indicate if the button should do a span
|
||||
|
@ -895,15 +886,15 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
else
|
||||
targetText.setText("");
|
||||
String buttonTextString = button.getText();
|
||||
ExtraPointTimeDisplayOption extraPointTimeDisplayOption =
|
||||
decideExtraPointTimeDisplayOptionByButtonText(buttonTextString);
|
||||
ExtraPointTimeDisplayOption extraPointTimeDisplayOption = decideExtraPointTimeDisplayOptionByButtonText(buttonTextString);
|
||||
setExtraPointTimeDisplayOption(extraPointTimeDisplayOption);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// "Skip factor" "Show first&&last" "On hour" "On half-hour"
|
||||
private ExtraPointTimeDisplayOption decideExtraPointTimeDisplayOptionByButtonText(String buttonTextString) {
|
||||
// ITrack.ExtraPointTimeDisplayOption[] testOptions = ITrack.ExtraPointTimeDisplayOption.values();
|
||||
private ExtraPointTimeDisplayOption decideExtraPointTimeDisplayOptionByButtonText(
|
||||
String buttonTextString) {
|
||||
|
||||
if (buttonTextString.equalsIgnoreCase("Show first&&last"))
|
||||
return ITrack.ExtraPointTimeDisplayOption.SHOW_FIRST_LAST;
|
||||
|
@ -942,7 +933,8 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
/**
|
||||
* Return font style from the style combo
|
||||
*/
|
||||
public FontStyle getStyle(){
|
||||
@Override
|
||||
public FontStyle getFontStyle() {
|
||||
return FontStyle.values()[fontStyleCombo.getSelectionIndex()];
|
||||
}
|
||||
|
||||
|
@ -978,7 +970,7 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
/**
|
||||
* set font style
|
||||
*/
|
||||
public void setStyle( FontStyle style ){
|
||||
public void setFontStyle(FontStyle style) {
|
||||
for (FontStyle fs : FontStyle.values()) {
|
||||
if (fs == style) {
|
||||
fontStyleCombo.setText(fs.name());
|
||||
|
@ -1040,7 +1032,6 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
return fontStyleCombo;
|
||||
}
|
||||
|
||||
|
||||
public int getFontSizeComboSelectedIndex() {
|
||||
return fontSizeComboSelectedIndex;
|
||||
}
|
||||
|
@ -1101,7 +1092,6 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
this.roundDirComboSelectedIndex = roundDirComboSelectedIndex;
|
||||
}
|
||||
|
||||
|
||||
public boolean isSetTimeButtonSelected() {
|
||||
return setTimeButtonSelected;
|
||||
}
|
||||
|
@ -1109,6 +1099,7 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
public void setSetTimeButtonSelected(boolean setTimeButtonSelected) {
|
||||
this.setTimeButtonSelected = setTimeButtonSelected;
|
||||
}
|
||||
|
||||
public Button getFrameTimeButton() {
|
||||
return frameTimeButton;
|
||||
}
|
||||
|
@ -1125,12 +1116,12 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
this.setTimeButton = setTimeButton;
|
||||
}
|
||||
|
||||
|
||||
public ExtraPointTimeDisplayOption getExtraPointTimeDisplayOption() {
|
||||
return extraPointTimeDisplayOption;
|
||||
}
|
||||
|
||||
public void setExtraPointTimeDisplayOption(ExtraPointTimeDisplayOption extraPointTimeDisplayOption) {
|
||||
public void setExtraPointTimeDisplayOption(
|
||||
ExtraPointTimeDisplayOption extraPointTimeDisplayOption) {
|
||||
this.extraPointTimeDisplayOption = extraPointTimeDisplayOption;
|
||||
}
|
||||
|
||||
|
@ -1162,8 +1153,7 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
int ret = 0;
|
||||
try {
|
||||
ret = Integer.parseInt(numberOfTimesText.getText());
|
||||
}
|
||||
catch ( Exception e ){
|
||||
} catch (Exception e) {
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
|
@ -1189,8 +1179,7 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
public String getIntervalTimeString() {
|
||||
if (intervalCombo.getSelectionIndex() == intervalCombo.getItemCount() - 1) {
|
||||
return intervalText.getText();
|
||||
}
|
||||
else
|
||||
} else
|
||||
return intervalCombo.getText();
|
||||
}
|
||||
|
||||
|
@ -1212,8 +1201,10 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
Calendar cal = Calendar.getInstance();
|
||||
cal.set(Calendar.YEAR, firstTimeCalendar.get(Calendar.YEAR));
|
||||
cal.set(Calendar.MONTH, firstTimeCalendar.get(Calendar.MONTH));
|
||||
cal.set(Calendar.DAY_OF_MONTH, firstTimeCalendar.get(Calendar.DAY_OF_MONTH));
|
||||
cal.set(Calendar.HOUR_OF_DAY, firstTimeCalendar.get(Calendar.HOUR_OF_DAY));
|
||||
cal.set(Calendar.DAY_OF_MONTH,
|
||||
firstTimeCalendar.get(Calendar.DAY_OF_MONTH));
|
||||
cal.set(Calendar.HOUR_OF_DAY,
|
||||
firstTimeCalendar.get(Calendar.HOUR_OF_DAY));
|
||||
cal.set(Calendar.MINUTE, firstTimeCalendar.get(Calendar.MINUTE));
|
||||
this.firstTimeCalendar = cal;
|
||||
}
|
||||
|
@ -1226,8 +1217,10 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
Calendar cal = Calendar.getInstance();
|
||||
cal.set(Calendar.YEAR, secondTimeCalendar.get(Calendar.YEAR));
|
||||
cal.set(Calendar.MONTH, secondTimeCalendar.get(Calendar.MONTH));
|
||||
cal.set(Calendar.DAY_OF_MONTH, secondTimeCalendar.get(Calendar.DAY_OF_MONTH));
|
||||
cal.set(Calendar.HOUR_OF_DAY, secondTimeCalendar.get(Calendar.HOUR_OF_DAY));
|
||||
cal.set(Calendar.DAY_OF_MONTH,
|
||||
secondTimeCalendar.get(Calendar.DAY_OF_MONTH));
|
||||
cal.set(Calendar.HOUR_OF_DAY,
|
||||
secondTimeCalendar.get(Calendar.HOUR_OF_DAY));
|
||||
cal.set(Calendar.MINUTE, secondTimeCalendar.get(Calendar.MINUTE));
|
||||
this.secondTimeCalendar = cal;
|
||||
}
|
||||
|
@ -1283,10 +1276,10 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
}
|
||||
|
||||
/**
|
||||
* The following methods are used in DrawableElementFactory class to set up all
|
||||
* necessary attributes for drawing a line. Since Track element dialogue GUI does
|
||||
* not supply all of those attributes needed by a line. The methods below provide
|
||||
* some default values for the attributes
|
||||
* The following methods are used in DrawableElementFactory class to set up
|
||||
* all necessary attributes for drawing a line. Since Track element dialogue
|
||||
* GUI does not supply all of those attributes needed by a line. The methods
|
||||
* below provide some default values for the attributes
|
||||
*/
|
||||
/**
|
||||
* Update the attributes
|
||||
|
@ -1325,12 +1318,6 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FontStyle getFontStyle() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean[] getExtraPointTimeTextDisplayIndicator() {
|
||||
// TODO Auto-generated method stub
|
||||
|
@ -1349,10 +1336,11 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert a String in gempak time format to a calendar.
|
||||
* @param gempakTm - String in GEMPAK time format
|
||||
*
|
||||
* @param gempakTm
|
||||
* - String in GEMPAK time format
|
||||
* @return - Calendar
|
||||
*/
|
||||
private Calendar gempakTM2Calendar(String gempakTm) {
|
||||
|
@ -1369,8 +1357,7 @@ public class TrackAttrDlg extends AttrDlg implements ITrack{
|
|||
cal.set(Calendar.DAY_OF_MONTH, day);
|
||||
cal.set(Calendar.HOUR_OF_DAY, hour);
|
||||
cal.set(Calendar.MINUTE, min);
|
||||
}
|
||||
catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
cal = null;
|
||||
}
|
||||
|
||||
|
|
|
@ -69,9 +69,27 @@ public class DefaultElementContainer extends AbstractElementContainer {
|
|||
public void draw(IGraphicsTarget target, PaintProperties paintProps,
|
||||
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;
|
||||
|
||||
/*
|
||||
* 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) {
|
||||
needsCreate = true;
|
||||
zoomLevel = paintProps.getZoomLevel();
|
||||
|
@ -102,5 +120,4 @@ public class DefaultElementContainer extends AbstractElementContainer {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -143,6 +143,9 @@ import com.vividsolutions.jts.operation.distance.DistanceOp;
|
|||
* 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.
|
||||
* 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>
|
||||
*
|
||||
* @author sgilbert
|
||||
|
@ -524,6 +527,7 @@ public class DisplayElementFactory {
|
|||
if (isFilled) {
|
||||
list.add(createFill(pts));
|
||||
}
|
||||
|
||||
/*
|
||||
* Compile each IWireframeShape, create its LineDisplayElement, and add
|
||||
* to IDisplayable return list
|
||||
|
@ -1814,7 +1818,8 @@ public class DisplayElementFactory {
|
|||
double major = Math.sqrt((diff[0] * diff[0]) + (diff[1] * diff[1]));
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -2035,8 +2040,9 @@ public class DisplayElementFactory {
|
|||
Text txt = new Text(null, track.getFontName(),
|
||||
track.getFontSize(), TextJustification.LEFT_JUSTIFY,
|
||||
pt.getLocation(), 0.0, TextRotation.SCREEN_RELATIVE,
|
||||
new String[] { dtime }, FontStyle.BOLD, iniDspClr, 0,
|
||||
3, false, DisplayType.NORMAL, "Text", "General Text");
|
||||
new String[] { dtime }, track.getFontStyle(),
|
||||
iniDspClr, 0, 3, false, DisplayType.NORMAL, "Text",
|
||||
"General Text");
|
||||
temps = createDisplayElements((IText) txt, paintProps);
|
||||
slist.addAll(temps);
|
||||
}
|
||||
|
@ -2093,8 +2099,9 @@ public class DisplayElementFactory {
|
|||
Text txt = new Text(null, track.getFontName(),
|
||||
track.getFontSize(), TextJustification.LEFT_JUSTIFY,
|
||||
pt.getLocation(), 0.0, TextRotation.SCREEN_RELATIVE,
|
||||
new String[] { dtime }, FontStyle.BOLD, expDspClr, 0,
|
||||
3, false, DisplayType.NORMAL, "Text", "General Text");
|
||||
new String[] { dtime }, track.getFontStyle(),
|
||||
expDspClr, 0, 3, false, DisplayType.NORMAL, "Text",
|
||||
"General Text");
|
||||
temps = createDisplayElements((IText) txt, paintProps);
|
||||
slist.addAll(temps);
|
||||
}
|
||||
|
@ -4814,10 +4821,22 @@ public class DisplayElementFactory {
|
|||
*/
|
||||
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 {
|
||||
return filled;
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,13 +7,14 @@
|
|||
*/
|
||||
package gov.noaa.nws.ncep.ui.pgen.display;
|
||||
|
||||
import gov.noaa.nws.ncep.ui.pgen.display.IText.FontStyle;
|
||||
|
||||
import java.awt.Color;
|
||||
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.
|
||||
*
|
||||
* @author sgilbert
|
||||
*
|
||||
*/
|
||||
|
@ -22,15 +23,9 @@ public interface ITrack extends ILine{
|
|||
/**
|
||||
* 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 };
|
||||
|
||||
// /**
|
||||
// * Defines available font styles
|
||||
// * @return font style
|
||||
// */
|
||||
// public static enum FontStyle {
|
||||
// REGULAR, BOLD, ITALIC, BOLD_ITALIC
|
||||
// }
|
||||
public static enum ExtraPointTimeDisplayOption {
|
||||
SKIP_FACTOR, SHOW_FIRST_LAST, ON_ONE_HOUR, ON_HALF_HOUR
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets a font style for text of track points
|
||||
|
@ -38,7 +33,8 @@ public interface ITrack extends ILine{
|
|||
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();
|
||||
|
||||
|
@ -49,76 +45,96 @@ public interface ITrack extends ILine{
|
|||
|
||||
/**
|
||||
* Gets color to plot the initial storm points
|
||||
*
|
||||
* @return color
|
||||
*/
|
||||
public Color getInitialColor();
|
||||
|
||||
/**
|
||||
* Gets the line pattern used to display the initial storm points
|
||||
*
|
||||
* @return line pattern
|
||||
*/
|
||||
public String getInitialLinePattern();
|
||||
|
||||
/**
|
||||
* Gets the marker used to display the initial storm points
|
||||
*
|
||||
* @return marker type
|
||||
*/
|
||||
public String getInitialMarker();
|
||||
|
||||
/**
|
||||
* Gets the initial storm points and associated date/times
|
||||
*
|
||||
* @return track points
|
||||
*/
|
||||
public TrackPoint[] getInitialPoints();
|
||||
|
||||
/**
|
||||
* Gets color to plot the extrapolated storm points
|
||||
*
|
||||
* @return color
|
||||
*/
|
||||
public Color getExtrapColor();
|
||||
|
||||
/**
|
||||
* Gets the line pattern used to display the extrapolated storm points
|
||||
*
|
||||
* @return line pattern
|
||||
*/
|
||||
public String getExtrapLinePattern();
|
||||
|
||||
/**
|
||||
* Gets the marker used to display the extrapolated storm points
|
||||
*
|
||||
* @return marker type
|
||||
*/
|
||||
public String getExtrapMarker();
|
||||
|
||||
/**
|
||||
* Gets the extrapolated storm points and associated date/times
|
||||
*
|
||||
* @return track points
|
||||
*/
|
||||
public TrackPoint[] getExtrapPoints();
|
||||
|
||||
/**
|
||||
* Gets the font used to display the location times
|
||||
*
|
||||
* @return font name
|
||||
*/
|
||||
public String getFontName();
|
||||
|
||||
/**
|
||||
* Gets the size of the font
|
||||
*
|
||||
* @return font size
|
||||
*/
|
||||
public float getFontSize();
|
||||
|
||||
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();
|
||||
|
||||
}
|
||||
|
|
|
@ -15,8 +15,10 @@ import com.raytheon.uf.viz.core.map.IMapDescriptor;
|
|||
|
||||
/**
|
||||
* 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.
|
||||
* The raster images do not need to be recreated when panning or zooming.
|
||||
* Recreation of the IDisplayable objects is only done if the layer
|
||||
* DisplayProperties change. The raster images do not need to be recreated when
|
||||
* panning or zooming.
|
||||
*
|
||||
* @author sgilbert
|
||||
*
|
||||
*/
|
||||
|
@ -36,9 +38,13 @@ public class RasterElementContainer extends AbstractElementContainer {
|
|||
}
|
||||
|
||||
/*
|
||||
* Draws to the given graphics target. Recreates the IDisplayable objects
|
||||
* if 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)
|
||||
* Draws to the given graphics target. Recreates the IDisplayable objects if
|
||||
* 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)
|
||||
*/
|
||||
@Override
|
||||
public void draw(IGraphicsTarget target, PaintProperties paintProps,
|
||||
|
@ -47,22 +53,38 @@ public class RasterElementContainer extends AbstractElementContainer {
|
|||
}
|
||||
|
||||
/*
|
||||
* Draws to the given graphics target. Recreates the IDisplayable objects
|
||||
* if 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)
|
||||
* Draws to the given graphics target. Recreates the IDisplayable objects if
|
||||
* 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)
|
||||
*/
|
||||
@Override
|
||||
public void draw(IGraphicsTarget target, PaintProperties paintProps,
|
||||
DisplayProperties dprops, boolean needsCreate) {
|
||||
|
||||
if ( displayEls == null ) needsCreate = true;
|
||||
if (displayEls == null) {
|
||||
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 ((dprops != null) && !dprops.equals(saveProps)) {
|
||||
def.setLayerDisplayAttr(dprops.getLayerMonoColor(), dprops.getLayerColor(), dprops.getLayerFilled());
|
||||
def.setLayerDisplayAttr(dprops.getLayerMonoColor(),
|
||||
dprops.getLayerColor(), dprops.getLayerFilled());
|
||||
needsCreate = true;
|
||||
}
|
||||
|
||||
if ( needsCreate ) createDisplayables(paintProps);
|
||||
if (needsCreate)
|
||||
createDisplayables(paintProps);
|
||||
|
||||
saveProps = dprops;
|
||||
|
||||
for (IDisplayable each : displayEls) {
|
||||
|
|
|
@ -154,6 +154,14 @@ public class TextDisplayElement implements IDisplayable {
|
|||
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) {
|
||||
|
||||
case NORMAL:
|
||||
|
@ -161,19 +169,40 @@ public class TextDisplayElement implements IDisplayable {
|
|||
break;
|
||||
|
||||
case BOX:
|
||||
// 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);
|
||||
break;
|
||||
|
||||
case 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,
|
||||
// box.getMaxX(), box.getMinY(), 0.0,
|
||||
// dstring.getColors()[0], 1.0f);
|
||||
break;
|
||||
|
||||
case 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,
|
||||
// box.getMaxX(), box.getMaxY(), 0.0,
|
||||
// dstring.getColors()[0], 1.0f);
|
||||
|
|
|
@ -46,17 +46,16 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
*/
|
||||
@ElementOperations({ Operation.COPY_MOVE, Operation.EXTRAPOLATE })
|
||||
public class Track extends Line implements ITrack {
|
||||
//public class Track extends MultiPointElement implements ITrack {
|
||||
|
||||
// private final static org.apache.log4j.Logger log =
|
||||
// org.apache.log4j.Logger.getLogger(Track.class);
|
||||
|
||||
|
||||
private final static float DEFAULT_FONT_SIZE = 14.0f;
|
||||
|
||||
private final static float DEFAULT_LINE_WIDTH = 0.1f;
|
||||
|
||||
private final static int DEFAULT_EXTRA_POINT_NUMBER = 5;
|
||||
|
||||
// private final static int DEFAULT_INTERVAL_HOUR = 1;
|
||||
private final static String INTERVAL_TIME_FORMAT_PATTERN = "HH:mm";
|
||||
|
||||
public void setExtrapMarker(String extrapMarker) {
|
||||
this.extrapMarker = extrapMarker;
|
||||
}
|
||||
|
@ -66,74 +65,105 @@ public class Track extends Line implements ITrack {
|
|||
}
|
||||
|
||||
private final static String INITIAL_MARKER = "FILLED_DIAMOND";
|
||||
|
||||
private final static String EXTRAP_MARKER = "FILLED_TRIANGLE";
|
||||
|
||||
private final static String INITIAL_LINE_PATTERN = "LINE_SOLID";
|
||||
|
||||
private final static String EXTRAP_LINE_PATTERN = "LINE_SOLID";
|
||||
|
||||
/*
|
||||
* This value of DEFAULT_LINE_PATTERN is a temporary solution
|
||||
* Eventually a decision needs to be done for what a value
|
||||
* should be used
|
||||
* This value of DEFAULT_LINE_PATTERN is a temporary solution Eventually a
|
||||
* decision needs to be done for what a value should be used
|
||||
*/
|
||||
public final static String TRACK_PGEN_CATEGORY = "Track";
|
||||
|
||||
public final static String TRACK_INFO_DLG_CATEGORY_NAME = "TRACK_EXTRA_POINTS_INFO";
|
||||
|
||||
public final static String TRACK_PGEN_TYPE = "STORM_TRACK";
|
||||
|
||||
private Color initialColor;
|
||||
|
||||
private Color extrapColor;
|
||||
|
||||
private String initialMarker;
|
||||
|
||||
private String initialLinePattern;
|
||||
|
||||
private String extrapMarker;
|
||||
|
||||
private String extrapLinePattern;
|
||||
|
||||
private TrackPoint[] initTrackPoints;
|
||||
|
||||
private TrackPoint[] extrapPoints;
|
||||
|
||||
private String fontName;
|
||||
|
||||
private float fontSize;
|
||||
|
||||
private FontStyle fontStyle;
|
||||
|
||||
private float lineWidth;
|
||||
|
||||
private int extraDrawingPointNumber;
|
||||
|
||||
private boolean setTimeButtonSelected;
|
||||
|
||||
private Calendar firstTimeCalendar;
|
||||
|
||||
private Calendar secondTimeCalendar;
|
||||
|
||||
private String intervalTimeString;
|
||||
|
||||
private int intervalComboSelectedIndex;
|
||||
|
||||
private int fontSizeComboSelectedIndex;
|
||||
|
||||
private int fontNameComboSelectedIndex;
|
||||
|
||||
private int fontStyleComboSelectedIndex;
|
||||
|
||||
private int elapsedHourForExtraPoint;
|
||||
|
||||
private int elapsedMinuteForExtraPoint;
|
||||
|
||||
private ExtraPointTimeDisplayOption extraPointTimeDisplayOption;
|
||||
|
||||
private String skipFactorTextString;
|
||||
|
||||
private boolean[] extraPointTimeTextDisplayIndicator;
|
||||
|
||||
// direction, speed and unit are not saved to a file
|
||||
private double directionForExtraPoints;
|
||||
|
||||
private boolean roundDirBtnSelected;
|
||||
|
||||
private int roundDirComboSelectedIndex;
|
||||
|
||||
private double speed; // speed in meter/millisecond
|
||||
|
||||
private double speedInKnotOverHour;
|
||||
|
||||
private double speedInKilometerOverHour;
|
||||
|
||||
private double speedInMileOverHour;
|
||||
|
||||
private boolean roundBtnSelected;
|
||||
|
||||
private int unitComboSelectedIndex;
|
||||
|
||||
private int roundComboSelectedIndex;
|
||||
|
||||
public Track() {}
|
||||
public Track() {
|
||||
}
|
||||
|
||||
public Track(ArrayList<Coordinate> _locations, Calendar _firstTimeCalendar,
|
||||
Calendar _secondTimeCalendar) {
|
||||
initializeInitTrackPoints(_locations,
|
||||
_firstTimeCalendar, _secondTimeCalendar);
|
||||
initializeInitTrackPoints(_locations, _firstTimeCalendar,
|
||||
_secondTimeCalendar);
|
||||
}
|
||||
|
||||
|
||||
public void initializeInitTrackPoints(ArrayList<Coordinate> locations,
|
||||
Calendar firstTimeCalendar, Calendar secondTimeCalendar) {
|
||||
initializeInitTrackPoints(locations);
|
||||
|
@ -141,49 +171,61 @@ public class Track extends Line implements ITrack {
|
|||
initializeInitSecondTimeCalendar(secondTimeCalendar);
|
||||
}
|
||||
|
||||
public void initializeTrackByTrackAttrDlgAndLocationList(ITrack trackAttrDlgObject, ArrayList<Coordinate> locations) {
|
||||
public void initializeTrackByTrackAttrDlgAndLocationList(
|
||||
ITrack trackAttrDlgObject, ArrayList<Coordinate> locations) {
|
||||
initializeInitTrackPoints(locations);
|
||||
initializeInitFirstTimeCalendar(trackAttrDlgObject.getFirstTimeCalendar());
|
||||
initializeInitSecondTimeCalendar(trackAttrDlgObject.getSecondTimeCalendar());
|
||||
initializeInitFirstTimeCalendar(trackAttrDlgObject
|
||||
.getFirstTimeCalendar());
|
||||
initializeInitSecondTimeCalendar(trackAttrDlgObject
|
||||
.getSecondTimeCalendar());
|
||||
|
||||
this.setInitialMarker("");
|
||||
this.setSetTimeButtonSelected(trackAttrDlgObject.isSetTimeButtonSelected());
|
||||
this.setExtraDrawingPointNumber(trackAttrDlgObject.getExtraDrawingPointNumber());
|
||||
this.setSetTimeButtonSelected(trackAttrDlgObject
|
||||
.isSetTimeButtonSelected());
|
||||
this.setExtraDrawingPointNumber(trackAttrDlgObject
|
||||
.getExtraDrawingPointNumber());
|
||||
|
||||
this.setIntervalTimeString(getIntervalTimeTextStringValue(trackAttrDlgObject));
|
||||
|
||||
this.setFontName(trackAttrDlgObject.getFontName());
|
||||
this.setFontStyle(trackAttrDlgObject.getStyle());
|
||||
this.setFontStyle(trackAttrDlgObject.getFontStyle());
|
||||
this.setFontSize(trackAttrDlgObject.getFontSize());
|
||||
this.setInitialColor(trackAttrDlgObject.getInitialColor());
|
||||
this.setExtrapColor(trackAttrDlgObject.getExtrapColor());
|
||||
this.setExtraPointTimeDisplayOption(trackAttrDlgObject.getExtraPointTimeDisplayOption());
|
||||
this.setExtraPointTimeDisplayOption(trackAttrDlgObject
|
||||
.getExtraPointTimeDisplayOption());
|
||||
this.setSkipFactorTextString(trackAttrDlgObject.getSkipFactorText());
|
||||
this.setFontNameComboSelectedIndex(trackAttrDlgObject.getFontNameComboSelectedIndex());
|
||||
this.setFontSizeComboSelectedIndex(trackAttrDlgObject.getFontSizeComboSelectedIndex());
|
||||
this.setFontStyleComboSelectedIndex(trackAttrDlgObject.getFontStyleComboSelectedIndex());
|
||||
this.setUnitComboSelectedIndex(trackAttrDlgObject.getUnitComboSelectedIndex());
|
||||
this.setRoundComboSelectedIndex(trackAttrDlgObject.getRoundComboSelectedIndex());
|
||||
this.setFontNameComboSelectedIndex(trackAttrDlgObject
|
||||
.getFontNameComboSelectedIndex());
|
||||
this.setFontSizeComboSelectedIndex(trackAttrDlgObject
|
||||
.getFontSizeComboSelectedIndex());
|
||||
this.setFontStyleComboSelectedIndex(trackAttrDlgObject
|
||||
.getFontStyleComboSelectedIndex());
|
||||
this.setUnitComboSelectedIndex(trackAttrDlgObject
|
||||
.getUnitComboSelectedIndex());
|
||||
this.setRoundComboSelectedIndex(trackAttrDlgObject
|
||||
.getRoundComboSelectedIndex());
|
||||
if (trackAttrDlgObject.getRoundComboSelectedIndex() > 0)
|
||||
this.setRoundBtnSelected(true);
|
||||
else
|
||||
this.setRoundBtnSelected(false);
|
||||
|
||||
this.setRoundDirComboSelectedIndex(trackAttrDlgObject.getRoundDirComboSelectedIndex());
|
||||
this.setRoundDirComboSelectedIndex(trackAttrDlgObject
|
||||
.getRoundDirComboSelectedIndex());
|
||||
if (trackAttrDlgObject.getRoundDirComboSelectedIndex() > 0)
|
||||
this.setRoundDirBtnSelected(true);
|
||||
else
|
||||
this.setRoundDirBtnSelected(false);
|
||||
|
||||
//This method can be called only after all of the above settings are completed!
|
||||
// This method can be called only after all of the above settings are
|
||||
// completed!
|
||||
this.calculateExtrapTrackPoints();
|
||||
/**
|
||||
* For now, the type is the name of a LinePattern defined in
|
||||
* "gov.noaa.nws.ncep.ui.pgen.display.LinePatternList"
|
||||
* However, there is no type has been decided for Track element
|
||||
* yet. Thus, it is now hard coded.
|
||||
* "gov.noaa.nws.ncep.ui.pgen.display.LinePatternList" However, there is
|
||||
* no type has been decided for Track element yet. Thus, it is now hard
|
||||
* coded.
|
||||
*/
|
||||
// this.setType("Solid Lines");
|
||||
this.setPgenCategory(Track.TRACK_PGEN_CATEGORY);
|
||||
this.setPgenType(Track.TRACK_PGEN_TYPE);
|
||||
}
|
||||
|
@ -191,7 +233,7 @@ public class Track extends Line implements ITrack {
|
|||
public void initializeInitTrackPoints(ArrayList<Coordinate> locations) {
|
||||
TrackPoint[] initTrackPointArray = new TrackPoint[locations.size()];
|
||||
int arrayIndex = 0;
|
||||
// log.info("inside Track.initializeInitTrackPoints, points Number="+locations.size());
|
||||
|
||||
for (Coordinate currentCoordinate : locations) {
|
||||
TrackPoint eachTrackPoint = new TrackPoint(currentCoordinate, null);
|
||||
initTrackPointArray[arrayIndex++] = eachTrackPoint;
|
||||
|
@ -204,7 +246,8 @@ public class Track extends Line implements ITrack {
|
|||
if (getInitTrackPoints() != null) {
|
||||
int initTrackPointLength = getInitTrackPoints().length;
|
||||
if (initTrackPointLength >= 2) {
|
||||
getInitTrackPoints()[initTrackPointLength - 2].setTime(firstCalendar);
|
||||
getInitTrackPoints()[initTrackPointLength - 2]
|
||||
.setTime(firstCalendar);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -214,38 +257,43 @@ public class Track extends Line implements ITrack {
|
|||
if (getInitTrackPoints() != null) {
|
||||
int initTrackPointLength = getInitTrackPoints().length;
|
||||
if (initTrackPointLength >= 2) {
|
||||
getInitTrackPoints()[initTrackPointLength - 1].setTime(secondCalendar);
|
||||
getInitTrackPoints()[initTrackPointLength - 1]
|
||||
.setTime(secondCalendar);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void calculateExtrapTrackPoints() {
|
||||
extrapPoints = calculateExtrapTrackPoints(getInitialPoints(), getFirstTimeCalendar(),
|
||||
getSecondTimeCalendar(), getExtraDrawingPointNumber(),
|
||||
getElapsedHourForExtraPoint(), getElapsedMinuteForExtraPoint(),
|
||||
extrapPoints = calculateExtrapTrackPoints(getInitialPoints(),
|
||||
getFirstTimeCalendar(), getSecondTimeCalendar(),
|
||||
getExtraDrawingPointNumber(), getElapsedHourForExtraPoint(),
|
||||
getElapsedMinuteForExtraPoint(),
|
||||
getExtraPointTimeDisplayOption(), getSkipFactorTextString());
|
||||
|
||||
/*
|
||||
* it is important to override the variable "ArrayList<Coordinate> linePoints" with
|
||||
* initTrackPoints and extrapPoints arrays
|
||||
* it is important to override the variable
|
||||
* "ArrayList<Coordinate> linePoints" with initTrackPoints and
|
||||
* extrapPoints arrays
|
||||
*/
|
||||
setLinePointsValue(getInitialPoints(), getExtrapPoints());
|
||||
|
||||
/*
|
||||
* a linePattern needs to be set for PgenSelectingTool to pick up
|
||||
* the correct dialogue window to popup
|
||||
* a linePattern needs to be set for PgenSelectingTool to pick up the
|
||||
* correct dialogue window to popup
|
||||
*/
|
||||
setPgenCategory(Track.TRACK_PGEN_CATEGORY);
|
||||
setPgenType(Track.TRACK_PGEN_TYPE);
|
||||
}
|
||||
|
||||
public void setLinePointsValue(TrackPoint[] initTrackPoints, TrackPoint[] extrapPoints) {
|
||||
public void setLinePointsValue(TrackPoint[] initTrackPoints,
|
||||
TrackPoint[] extrapPoints) {
|
||||
int listSize = 1;
|
||||
if (initTrackPoints != null)
|
||||
listSize += initTrackPoints.length;
|
||||
if (extrapPoints != null)
|
||||
listSize += extrapPoints.length;
|
||||
ArrayList<Coordinate> coordinatePointList = new ArrayList<Coordinate>(listSize);
|
||||
ArrayList<Coordinate> coordinatePointList = new ArrayList<Coordinate>(
|
||||
listSize);
|
||||
addArrayToArrayList(coordinatePointList, initTrackPoints);
|
||||
addArrayToArrayList(coordinatePointList, extrapPoints);
|
||||
|
||||
|
@ -264,40 +312,29 @@ public class Track extends Line implements ITrack {
|
|||
public Track copy() {
|
||||
|
||||
/*
|
||||
* create a new Track object and initially set its attributes to this one's
|
||||
* create a new Track object and initially set its attributes to this
|
||||
* one's
|
||||
*/
|
||||
Track newTrack = new Track();
|
||||
Calendar newFirstTimeCalendar = Calendar.getInstance();
|
||||
newFirstTimeCalendar.setTimeInMillis(getFirstTimeCalendar().getTimeInMillis());
|
||||
newFirstTimeCalendar.setTimeInMillis(getFirstTimeCalendar()
|
||||
.getTimeInMillis());
|
||||
newTrack.setFirstTimeCalendar(newFirstTimeCalendar);
|
||||
// newTrack.setFirstTimeCalendar(getFirstTimeCalendar());
|
||||
|
||||
Calendar newSecondTimeCalendar = Calendar.getInstance();
|
||||
newSecondTimeCalendar.setTimeInMillis(getSecondTimeCalendar().getTimeInMillis());
|
||||
newSecondTimeCalendar.setTimeInMillis(getSecondTimeCalendar()
|
||||
.getTimeInMillis());
|
||||
newTrack.setSecondTimeCalendar(newSecondTimeCalendar);
|
||||
// newTrack.setSecondTimeCalendar(getSecondTimeCalendar());
|
||||
|
||||
TrackPoint[] newInitTrackPoints = new TrackPoint[getInitTrackPoints().length];
|
||||
// log.info("######, before enter the loop for TrackPoint.clone, newInitTrackPoints.length="+newInitTrackPoints.length);
|
||||
for(int i=0; i<newInitTrackPoints.length; i++) {
|
||||
// log.info("######, inside enter the loop for TrackPoint.clone, index of the TrackPoint.clone="+i);
|
||||
// if(getInitTrackPoints()[i].getLocation() == null)
|
||||
// log.info("#####, getInitTrackPoints()["+i+"].getLocation() is NULL");
|
||||
// else
|
||||
// log.info("#####, getInitTrackPoints()["+i+"].getLocation() is NOTNOTNOT NULL");
|
||||
|
||||
newInitTrackPoints[i] = TrackPoint.clone(getInitTrackPoints()[i].getLocation(), getInitTrackPoints()[i].getTime());
|
||||
for (int i = 0; i < newInitTrackPoints.length; i++) {
|
||||
|
||||
newInitTrackPoints[i] = TrackPoint.clone(
|
||||
getInitTrackPoints()[i].getLocation(),
|
||||
getInitTrackPoints()[i].getTime());
|
||||
}
|
||||
newTrack.setInitTrackPoints(newInitTrackPoints);
|
||||
// newTrack.setInitTrackPoints(getInitTrackPoints());
|
||||
|
||||
// not sure if extrap points shoud be simply copied over or calculated by initial points
|
||||
// TrackPoint[] newExtrapTrackPoints = new TrackPoint[getExtrapPoints().length];
|
||||
// for(int i=0; i<newExtrapTrackPoints.length; i++) {
|
||||
// if(getExtrapPoints()[i].getLocation() == null || getExtrapPoints()[i].getTime() == null)
|
||||
// throw new PGenRuntimeException("Method: Track.copy(), both location and time can not be NULL for any of extrap points");
|
||||
// newExtrapTrackPoints[i] = TrackPoint.clone(getExtrapPoints()[i].getLocation(), getExtrapPoints()[i].getTime());
|
||||
// }
|
||||
|
||||
newTrack.setFontStyle(getFontStyle());
|
||||
newTrack.setFontSize(getFontSize());
|
||||
|
@ -309,31 +346,31 @@ public class Track extends Line implements ITrack {
|
|||
newExtraPointTimeTextDisplayIndicator[i] = getExtraPointTimeTextDisplayIndicator()[i];
|
||||
}
|
||||
newTrack.setExtraPointTimeTextDisplayIndicator(newExtraPointTimeTextDisplayIndicator);
|
||||
// newTrack.setExtraPointTimeTextDisplayIndicator(getExtraPointTimeTextDisplayIndicator());
|
||||
|
||||
newTrack.setSkipFactorTextString(new String(getSkipFactorTextString()));
|
||||
newTrack.setInitialColor(new Color(getInitialColor().getRed(), getInitialColor().getGreen(),
|
||||
getInitialColor().getBlue()));
|
||||
newTrack.setExtrapColor(new Color(getExtrapColor().getRed(), getExtrapColor().getGreen(),
|
||||
getExtrapColor().getBlue()));
|
||||
newTrack.setInitialColor(new Color(getInitialColor().getRed(),
|
||||
getInitialColor().getGreen(), getInitialColor().getBlue()));
|
||||
newTrack.setExtrapColor(new Color(getExtrapColor().getRed(),
|
||||
getExtrapColor().getGreen(), getExtrapColor().getBlue()));
|
||||
|
||||
newTrack.setIntervalTimeString(new String(getIntervalTimeString()));
|
||||
|
||||
/*
|
||||
* Under some scenarios, e.g. marshall/unmarshall procees, the ExtraDrawingPointNumber
|
||||
* is not serialized. Thus, first try to use the length of ExtrapPoints array
|
||||
* Under some scenarios, e.g. marshall/unmarshall procees, the
|
||||
* ExtraDrawingPointNumber is not serialized. Thus, first try to use the
|
||||
* length of ExtrapPoints array
|
||||
*/
|
||||
if (getExtrapPoints() != null)
|
||||
newTrack.setExtraDrawingPointNumber(getExtrapPoints().length);
|
||||
else
|
||||
newTrack.setExtraDrawingPointNumber(getExtraDrawingPointNumber());
|
||||
// newTrack.setExtraDrawingPointNumberText(getExtraDrawingPointNumberText());
|
||||
|
||||
newTrack.setExtrapLinePattern(new String(getExtrapLinePattern()));
|
||||
newTrack.setExtrapMarker(new String(getExtrapMarker()));
|
||||
// log.info("#######, inside track.copy(), getInitialLinePattern()="+getInitialLinePattern());
|
||||
|
||||
newTrack.setInitialLinePattern(new String(getInitialLinePattern()));
|
||||
newTrack.setInitialMarker(new String(getInitialMarker()));
|
||||
// newTrack.setType("Solid Lines");
|
||||
|
||||
if (getPgenCategory() != null)
|
||||
newTrack.setPgenCategory(new String(getPgenCategory()));
|
||||
if (getPgenType() != null)
|
||||
|
@ -342,31 +379,32 @@ public class Track extends Line implements ITrack {
|
|||
newTrack.calculateExtrapTrackPoints();
|
||||
|
||||
/*
|
||||
* Now copy some important attributes that make a Line or multi-points element can be displayed
|
||||
* Now copy some important attributes that make a Line or multi-points
|
||||
* element can be displayed
|
||||
*/
|
||||
newTrack.setClosed(isClosedLine());
|
||||
newTrack.setFilled(isFilled());
|
||||
|
||||
/*
|
||||
* colors value in Track will only be used in dragging initial points. Thus,
|
||||
* here the color of the initial points is used
|
||||
* colors value in Track will only be used in dragging initial points.
|
||||
* Thus, here the color of the initial points is used
|
||||
*/
|
||||
Color[] initColors = new Color[1];
|
||||
initColors[0] = getInitialColor();
|
||||
newTrack.setColors(initColors);
|
||||
newTrack.setLineWidth(getLineWidth());
|
||||
newTrack.setSizeScale(getSizeScale());
|
||||
// newTrack.setSmoothFactor(getSmoothFactor());
|
||||
|
||||
newTrack.setSmoothFactor(2);
|
||||
newTrack.setFillPattern(getFillPattern());
|
||||
|
||||
newTrack.setParent(this.getParent());
|
||||
|
||||
// log.info("@@@###$$$%%%!!!, the last line of track.copy()");
|
||||
return newTrack;
|
||||
}
|
||||
|
||||
public void update(ITrack trackAttrDlg) {
|
||||
// log.info("############, track.update(...) is executed!!!!");
|
||||
|
||||
initializeInitFirstTimeCalendar(trackAttrDlg.getFirstTimeCalendar());
|
||||
initializeInitSecondTimeCalendar(trackAttrDlg.getSecondTimeCalendar());
|
||||
|
||||
|
@ -375,15 +413,19 @@ public class Track extends Line implements ITrack {
|
|||
setExtraDrawingPointNumber(trackAttrDlg.getExtraDrawingPointNumber());
|
||||
setIntervalTimeString(trackAttrDlg.getIntervalTimeString());
|
||||
setFontName(trackAttrDlg.getFontName());
|
||||
setFontStyle(trackAttrDlg.getStyle());
|
||||
setFontStyle(trackAttrDlg.getFontStyle());
|
||||
setFontSize(trackAttrDlg.getFontSize());
|
||||
setInitialColor(trackAttrDlg.getInitialColor());
|
||||
setExtrapColor(trackAttrDlg.getExtrapColor());
|
||||
setExtraPointTimeDisplayOption(trackAttrDlg.getExtraPointTimeDisplayOption());
|
||||
setExtraPointTimeDisplayOption(trackAttrDlg
|
||||
.getExtraPointTimeDisplayOption());
|
||||
setSkipFactorTextString(trackAttrDlg.getSkipFactorText());
|
||||
setFontNameComboSelectedIndex(trackAttrDlg.getFontNameComboSelectedIndex());
|
||||
setFontSizeComboSelectedIndex(trackAttrDlg.getFontSizeComboSelectedIndex());
|
||||
setFontStyleComboSelectedIndex(trackAttrDlg.getFontStyleComboSelectedIndex());
|
||||
setFontNameComboSelectedIndex(trackAttrDlg
|
||||
.getFontNameComboSelectedIndex());
|
||||
setFontSizeComboSelectedIndex(trackAttrDlg
|
||||
.getFontSizeComboSelectedIndex());
|
||||
setFontStyleComboSelectedIndex(trackAttrDlg
|
||||
.getFontStyleComboSelectedIndex());
|
||||
setUnitComboSelectedIndex(trackAttrDlg.getUnitComboSelectedIndex());
|
||||
setRoundComboSelectedIndex(trackAttrDlg.getRoundComboSelectedIndex());
|
||||
if (trackAttrDlg.getRoundComboSelectedIndex() > 0)
|
||||
|
@ -391,21 +433,23 @@ public class Track extends Line implements ITrack {
|
|||
else
|
||||
this.setRoundBtnSelected(false);
|
||||
|
||||
setRoundDirComboSelectedIndex(trackAttrDlg.getRoundDirComboSelectedIndex());
|
||||
setRoundDirComboSelectedIndex(trackAttrDlg
|
||||
.getRoundDirComboSelectedIndex());
|
||||
if (trackAttrDlg.getRoundDirComboSelectedIndex() > 0)
|
||||
this.setRoundDirBtnSelected(true);
|
||||
else
|
||||
this.setRoundDirBtnSelected(false);
|
||||
|
||||
//This method can be called only after all of the above settings are completed!
|
||||
// This method can be called only after all of the above settings are
|
||||
// completed!
|
||||
calculateExtrapTrackPoints();
|
||||
|
||||
/**
|
||||
* For now, the type is the name of a LinePattern defined in
|
||||
* "gov.noaa.nws.ncep.ui.pgen.display.LinePatternList"
|
||||
* However, there is no type has been decided for Track element
|
||||
* yet. Thus, it is now hard coded.
|
||||
* "gov.noaa.nws.ncep.ui.pgen.display.LinePatternList" However, there is
|
||||
* no type has been decided for Track element yet. Thus, it is now hard
|
||||
* coded.
|
||||
*/
|
||||
// setType("Solid Lines");
|
||||
setPgenType(Track.TRACK_PGEN_TYPE);
|
||||
setPgenCategory(Track.TRACK_PGEN_CATEGORY);
|
||||
}
|
||||
|
@ -433,20 +477,18 @@ public class Track extends Line implements ITrack {
|
|||
modifiedTrackPoint.setLocation(point);
|
||||
}
|
||||
}
|
||||
// linePoints.add(index, point);
|
||||
|
||||
}
|
||||
|
||||
public void removePoint(int index) {
|
||||
ArrayList<Coordinate> allLinePoints = getPoints();
|
||||
if (allLinePoints == null)
|
||||
return;
|
||||
// if(allLinePoints.size() > index && getInitialPoints().length > index) {
|
||||
|
||||
if (allLinePoints.size() > index) {
|
||||
allLinePoints.remove(index);
|
||||
}
|
||||
|
||||
// linePoints.remove( index );
|
||||
|
||||
}
|
||||
|
||||
public void setPoints(ArrayList<Coordinate> pts) {
|
||||
|
@ -456,6 +498,7 @@ public class Track extends Line implements ITrack {
|
|||
* call MultiPointElement.setPoint(...)
|
||||
*/
|
||||
super.setPoints(pts);
|
||||
|
||||
/*
|
||||
* Now initialize initPoint and ExtrapPoint arrays
|
||||
*/
|
||||
|
@ -476,15 +519,11 @@ public class Track extends Line implements ITrack {
|
|||
index++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int extrapTrackPointSize = 0;
|
||||
if (getExtrapPoints() != null)
|
||||
extrapTrackPointSize = getExtrapPoints().length;
|
||||
int extrapIndex = 0;
|
||||
while(extrapIndex < extrapTrackPointSize &&
|
||||
index < allPointsSize) {
|
||||
while (extrapIndex < extrapTrackPointSize && index < allPointsSize) {
|
||||
TrackPoint currentTrackPoint = getExtrapPoints()[extrapIndex];
|
||||
if (currentTrackPoint != null)
|
||||
currentTrackPoint.setLocation(pts.get(index));
|
||||
|
@ -492,9 +531,6 @@ public class Track extends Line implements ITrack {
|
|||
extrapIndex++;
|
||||
}
|
||||
|
||||
|
||||
// this.linePoints = pts;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -505,7 +541,8 @@ public class Track extends Line implements ITrack {
|
|||
return trackAttrDlg.getIntervalTimeString();
|
||||
}
|
||||
|
||||
private void addArrayToArrayList(ArrayList<Coordinate> coordinatePointList, TrackPoint[] trackPoints) {
|
||||
private void addArrayToArrayList(ArrayList<Coordinate> coordinatePointList,
|
||||
TrackPoint[] trackPoints) {
|
||||
if (trackPoints == null)
|
||||
return;
|
||||
for (TrackPoint trackPoint : trackPoints) {
|
||||
|
@ -515,8 +552,7 @@ public class Track extends Line implements ITrack {
|
|||
|
||||
private TrackPoint[] calculateExtrapTrackPoints(TrackPoint[] initialPoints,
|
||||
Calendar initPointBeforeLastInitPointTimeCal,
|
||||
Calendar lastInitPointTimeCal,
|
||||
int extraDrawingPointNumber,
|
||||
Calendar lastInitPointTimeCal, int extraDrawingPointNumber,
|
||||
int elapsedHourForExtraPointValue,
|
||||
int elapsedMinuteForExtraPointValue,
|
||||
ExtraPointTimeDisplayOption extraPointTimeDisplayOption,
|
||||
|
@ -527,14 +563,15 @@ public class Track extends Line implements ITrack {
|
|||
}
|
||||
|
||||
int arrayLength = initialPoints.length;
|
||||
Coordinate initPointBeforeLastInitPointCoordinate = initialPoints[arrayLength - 2].getLocation();
|
||||
Coordinate lastInitPointCoordinate = initialPoints[arrayLength - 1].getLocation();
|
||||
if(!isCoordinateValid(initPointBeforeLastInitPointCoordinate) ||
|
||||
!isCoordinateValid(lastInitPointCoordinate) ||
|
||||
initPointBeforeLastInitPointTimeCal == null ||
|
||||
lastInitPointTimeCal == null) {
|
||||
// log.error("Method: calculateExtrapTrackPoints, find 4 possible invalid input: startPointCoordinate or "+
|
||||
// "destPointCoordinate is invalid. firstTimeCal or secondTimeCal is null");
|
||||
Coordinate initPointBeforeLastInitPointCoordinate = initialPoints[arrayLength - 2]
|
||||
.getLocation();
|
||||
Coordinate lastInitPointCoordinate = initialPoints[arrayLength - 1]
|
||||
.getLocation();
|
||||
if (!isCoordinateValid(initPointBeforeLastInitPointCoordinate)
|
||||
|| !isCoordinateValid(lastInitPointCoordinate)
|
||||
|| initPointBeforeLastInitPointTimeCal == null
|
||||
|| lastInitPointTimeCal == null) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -547,19 +584,20 @@ public class Track extends Line implements ITrack {
|
|||
setDirectionForExtraPoints(direction);
|
||||
|
||||
double distanceInMeter = gc.getOrthodromicDistance();
|
||||
long timeDifference = getTimeDifferenceInMillisecond(initPointBeforeLastInitPointTimeCal,
|
||||
lastInitPointTimeCal);
|
||||
long timeDifference = getTimeDifferenceInMillisecond(
|
||||
initPointBeforeLastInitPointTimeCal, lastInitPointTimeCal);
|
||||
double speed = distanceInMeter / (double) timeDifference;
|
||||
setSpeed(speed);
|
||||
|
||||
// Calculate the first extra point time Calendar
|
||||
Calendar firstExtraPointTimeCal = getTimeElapsedCalendarForFirstExtraPoint(lastInitPointTimeCal,
|
||||
elapsedHourForExtraPointValue,
|
||||
Calendar firstExtraPointTimeCal = getTimeElapsedCalendarForFirstExtraPoint(
|
||||
lastInitPointTimeCal, elapsedHourForExtraPointValue,
|
||||
elapsedMinuteForExtraPointValue);
|
||||
|
||||
//calculate the distance between the last Initial point and the first extra point
|
||||
double distanceBetweenLastInitPointAndFirstExtraPoint = calculateDistanceBetweenLastInitPointAndFirstExtraPoint(speed,
|
||||
lastInitPointTimeCal, firstExtraPointTimeCal);
|
||||
// calculate the distance between the last Initial point and the first
|
||||
// extra point
|
||||
double distanceBetweenLastInitPointAndFirstExtraPoint = calculateDistanceBetweenLastInitPointAndFirstExtraPoint(
|
||||
speed, lastInitPointTimeCal, firstExtraPointTimeCal);
|
||||
|
||||
// calculate the distance among extra points
|
||||
double distanceForExtraPoint = calculateDistanceForExtraPoints(speed,
|
||||
|
@ -569,46 +607,52 @@ public class Track extends Line implements ITrack {
|
|||
TrackPoint[] extrapTrackPointArray = calculateExtrapTrackPoints(gc,
|
||||
lastInitPointCoordinate, direction,
|
||||
distanceBetweenLastInitPointAndFirstExtraPoint,
|
||||
distanceForExtraPoint,
|
||||
extraDrawingPointNumber, lastInitPointTimeCal,
|
||||
firstExtraPointTimeCal,
|
||||
elapsedHourForExtraPointValue,
|
||||
elapsedMinuteForExtraPointValue);
|
||||
disableSomeTimeTagsDisplayBasedOnExtraPointTimeDisplayOption(extrapTrackPointArray,
|
||||
extraPointTimeDisplayOption, skipFactorTextString);
|
||||
distanceForExtraPoint, extraDrawingPointNumber,
|
||||
lastInitPointTimeCal, firstExtraPointTimeCal,
|
||||
elapsedHourForExtraPointValue, elapsedMinuteForExtraPointValue);
|
||||
disableSomeTimeTagsDisplayBasedOnExtraPointTimeDisplayOption(
|
||||
extrapTrackPointArray, extraPointTimeDisplayOption,
|
||||
skipFactorTextString);
|
||||
|
||||
return extrapTrackPointArray;
|
||||
}
|
||||
|
||||
private void disableSomeTimeTagsDisplayBasedOnExtraPointTimeDisplayOption(TrackPoint[] extrapTrackPointArray,
|
||||
ExtraPointTimeDisplayOption extraPointTimeDisplayOption, String skipFactorTextString) {
|
||||
private void disableSomeTimeTagsDisplayBasedOnExtraPointTimeDisplayOption(
|
||||
TrackPoint[] extrapTrackPointArray,
|
||||
ExtraPointTimeDisplayOption extraPointTimeDisplayOption,
|
||||
String skipFactorTextString) {
|
||||
if (extrapTrackPointArray == null)
|
||||
return;
|
||||
boolean[] extraPointTimeTagFlagArray = new boolean[extrapTrackPointArray.length];
|
||||
initializeBooleanArray(extraPointTimeTagFlagArray, true);
|
||||
|
||||
if (extraPointTimeDisplayOption == ITrack.ExtraPointTimeDisplayOption.SKIP_FACTOR) {
|
||||
removeTimeTagsBasedOnSkipFactor(extrapTrackPointArray, skipFactorTextString, extraPointTimeTagFlagArray);
|
||||
removeTimeTagsBasedOnSkipFactor(extrapTrackPointArray,
|
||||
skipFactorTextString, extraPointTimeTagFlagArray);
|
||||
} else if (extraPointTimeDisplayOption == ITrack.ExtraPointTimeDisplayOption.SHOW_FIRST_LAST) {
|
||||
removeTimeTagsBasedOnShowLastFirstOnly(extrapTrackPointArray, extraPointTimeTagFlagArray);
|
||||
removeTimeTagsBasedOnShowLastFirstOnly(extrapTrackPointArray,
|
||||
extraPointTimeTagFlagArray);
|
||||
} else if (extraPointTimeDisplayOption == ITrack.ExtraPointTimeDisplayOption.ON_ONE_HOUR) {
|
||||
removeTimeTagsBasedOnHourMinuteValue(extrapTrackPointArray, true, extraPointTimeTagFlagArray);
|
||||
removeTimeTagsBasedOnHourMinuteValue(extrapTrackPointArray, true,
|
||||
extraPointTimeTagFlagArray);
|
||||
} else if (extraPointTimeDisplayOption == ITrack.ExtraPointTimeDisplayOption.ON_HALF_HOUR) {
|
||||
removeTimeTagsBasedOnHourMinuteValue(extrapTrackPointArray, false, extraPointTimeTagFlagArray);
|
||||
}
|
||||
else {
|
||||
removeTimeTagsBasedOnHourMinuteValue(extrapTrackPointArray, false, extraPointTimeTagFlagArray);
|
||||
removeTimeTagsBasedOnHourMinuteValue(extrapTrackPointArray, false,
|
||||
extraPointTimeTagFlagArray);
|
||||
} else {
|
||||
removeTimeTagsBasedOnHourMinuteValue(extrapTrackPointArray, false,
|
||||
extraPointTimeTagFlagArray);
|
||||
}
|
||||
|
||||
/*
|
||||
* set the updated boolean array back to the indicator,
|
||||
* in displayElementFactory, this boolean array will be
|
||||
* used to indicate if a time text should be skipped
|
||||
* set the updated boolean array back to the indicator, in
|
||||
* displayElementFactory, this boolean array will be used to indicate if
|
||||
* a time text should be skipped
|
||||
*/
|
||||
setExtraPointTimeTextDisplayIndicator(extraPointTimeTagFlagArray);
|
||||
}
|
||||
|
||||
private void removeTimeTagsBasedOnShowLastFirstOnly(TrackPoint[] extrapTrackPointArray, boolean[] timeTagIndicatorArray) {
|
||||
private void removeTimeTagsBasedOnShowLastFirstOnly(
|
||||
TrackPoint[] extrapTrackPointArray, boolean[] timeTagIndicatorArray) {
|
||||
if (extrapTrackPointArray.length < 3)
|
||||
return;
|
||||
for (int i = 1; i < (extrapTrackPointArray.length - 1); i++) {
|
||||
|
@ -616,8 +660,9 @@ public class Track extends Line implements ITrack {
|
|||
}
|
||||
}
|
||||
|
||||
private void removeTimeTagsBasedOnSkipFactor(TrackPoint[] extrapTrackPointArray,
|
||||
String skipFactorTextString, boolean[] timeTagIndicatorArray) {
|
||||
private void removeTimeTagsBasedOnSkipFactor(
|
||||
TrackPoint[] extrapTrackPointArray, String skipFactorTextString,
|
||||
boolean[] timeTagIndicatorArray) {
|
||||
if (skipFactorTextString == null)
|
||||
return;
|
||||
/*
|
||||
|
@ -630,17 +675,15 @@ public class Track extends Line implements ITrack {
|
|||
try {
|
||||
skipFactorIntValue = Integer.parseInt(skipFactorTextString);
|
||||
} catch (NumberFormatException nfe) {
|
||||
// log.error("The input of skipFactorTextString is invalid, skipFactorTextString="+
|
||||
// skipFactorTextString);
|
||||
}
|
||||
|
||||
/*
|
||||
* 1. make sure skipFactorIntValue is a valid value
|
||||
* 2. since the last and first extra points are always
|
||||
* displayed, thus do skipFactorIntValue > (extrapTrackPointArray.length - 2)
|
||||
* check
|
||||
* 1. make sure skipFactorIntValue is a valid value 2. since the last
|
||||
* and first extra points are always displayed, thus do
|
||||
* skipFactorIntValue > (extrapTrackPointArray.length - 2) check
|
||||
*/
|
||||
if(!(skipFactorIntValue > 0) || skipFactorIntValue > (extrapTrackPointArray.length - 2))
|
||||
if (!(skipFactorIntValue > 0)
|
||||
|| skipFactorIntValue > (extrapTrackPointArray.length - 2))
|
||||
return;
|
||||
|
||||
for (int i = 1; i <= skipFactorIntValue; i++) {
|
||||
|
@ -648,8 +691,9 @@ public class Track extends Line implements ITrack {
|
|||
}
|
||||
}
|
||||
|
||||
private void removeTimeTagsBasedOnHourMinuteValue(TrackPoint[] extrapTrackPointArray,
|
||||
boolean isExactHourDisplayed, boolean[] timeTagIndicatorArray) {
|
||||
private void removeTimeTagsBasedOnHourMinuteValue(
|
||||
TrackPoint[] extrapTrackPointArray, boolean isExactHourDisplayed,
|
||||
boolean[] timeTagIndicatorArray) {
|
||||
for (int i = 0; i < (extrapTrackPointArray.length); i++) {
|
||||
TrackPoint targetTrackPoint = extrapTrackPointArray[i];
|
||||
Calendar targetPointTimeCal = targetTrackPoint.getTime();
|
||||
|
@ -663,14 +707,16 @@ public class Track extends Line implements ITrack {
|
|||
}
|
||||
}
|
||||
|
||||
private void initializeBooleanArray(boolean[] booleanArray, boolean initValue) {
|
||||
private void initializeBooleanArray(boolean[] booleanArray,
|
||||
boolean initValue) {
|
||||
if (booleanArray == null)
|
||||
return;
|
||||
for (int i = 0; i < booleanArray.length; i++)
|
||||
booleanArray[i] = initValue;
|
||||
}
|
||||
|
||||
private boolean isTimeTagDisplayable(Calendar targetPointTimeCal, boolean isExactHourDisplayed) {
|
||||
private boolean isTimeTagDisplayable(Calendar targetPointTimeCal,
|
||||
boolean isExactHourDisplayed) {
|
||||
boolean isDisplayable = false;
|
||||
if (targetPointTimeCal == null)
|
||||
return isDisplayable;
|
||||
|
@ -680,29 +726,29 @@ public class Track extends Line implements ITrack {
|
|||
if (minuteIntValue == 0)
|
||||
isDisplayable = true;
|
||||
} else {
|
||||
// int hourIntValue = targetPointTimeCal.get(Calendar.HOUR_OF_DAY);
|
||||
if (minuteIntValue == 0 || minuteIntValue == 30)
|
||||
isDisplayable = true;
|
||||
}
|
||||
return isDisplayable;
|
||||
}
|
||||
|
||||
private double calculateDistanceBetweenLastInitPointAndFirstExtraPoint(double speed,
|
||||
Calendar lastInitPointCal, Calendar firstExtraPointCal) {
|
||||
long timeDifferenceBetweenExtraPoints = getTimeDifferenceInMillisecond(lastInitPointCal,
|
||||
firstExtraPointCal);
|
||||
double distanceBetweenLastInitPointAndFirstExtraPoint = speed * timeDifferenceBetweenExtraPoints;
|
||||
private double calculateDistanceBetweenLastInitPointAndFirstExtraPoint(
|
||||
double speed, Calendar lastInitPointCal, Calendar firstExtraPointCal) {
|
||||
long timeDifferenceBetweenExtraPoints = getTimeDifferenceInMillisecond(
|
||||
lastInitPointCal, firstExtraPointCal);
|
||||
double distanceBetweenLastInitPointAndFirstExtraPoint = speed
|
||||
* timeDifferenceBetweenExtraPoints;
|
||||
return distanceBetweenLastInitPointAndFirstExtraPoint;
|
||||
}
|
||||
|
||||
private double calculateDistanceForExtraPoints(double speed,
|
||||
Calendar firstExtraPointCal, int elapsedHourForExtraPoint,
|
||||
int elapsedMinuteForExtraPoint) {
|
||||
Calendar nextExtraPointTimeCal = getTimeElapsedCalendar(firstExtraPointCal,
|
||||
elapsedHourForExtraPoint,
|
||||
Calendar nextExtraPointTimeCal = getTimeElapsedCalendar(
|
||||
firstExtraPointCal, elapsedHourForExtraPoint,
|
||||
elapsedMinuteForExtraPoint);
|
||||
long timeDifferenceBetweenExtraPoints = getTimeDifferenceInMillisecond(firstExtraPointCal,
|
||||
nextExtraPointTimeCal);
|
||||
long timeDifferenceBetweenExtraPoints = getTimeDifferenceInMillisecond(
|
||||
firstExtraPointCal, nextExtraPointTimeCal);
|
||||
double distanceForExtraPoint = speed * timeDifferenceBetweenExtraPoints;
|
||||
return distanceForExtraPoint;
|
||||
}
|
||||
|
@ -712,8 +758,7 @@ public class Track extends Line implements ITrack {
|
|||
double distanceBetweenLastInitPointAndFirstExtraPoint,
|
||||
double distanceBetweenExtraPoint, int extraPointNumber,
|
||||
Calendar lastInitPointTimeCal, Calendar firstExtraPointTimeCal,
|
||||
int elapsedHourForExtraPoint,
|
||||
int elapsedMinuteForExtraPoint) {
|
||||
int elapsedHourForExtraPoint, int elapsedMinuteForExtraPoint) {
|
||||
double startLongitude = lastInitPointCoordinate.x;
|
||||
double startLatitude = lastInitPointCoordinate.y;
|
||||
TrackPoint[] trackPointArray = new TrackPoint[extraPointNumber];
|
||||
|
@ -721,25 +766,29 @@ public class Track extends Line implements ITrack {
|
|||
/*
|
||||
* Add the first extra point
|
||||
*/
|
||||
java.awt.geom.Point2D firstExtraPointPoint2dValue = getNextPoint2DValue(gc, startLongitude, startLatitude,
|
||||
direction, distanceBetweenLastInitPointAndFirstExtraPoint);
|
||||
java.awt.geom.Point2D firstExtraPointPoint2dValue = getNextPoint2DValue(
|
||||
gc, startLongitude, startLatitude, direction,
|
||||
distanceBetweenLastInitPointAndFirstExtraPoint);
|
||||
startLongitude = firstExtraPointPoint2dValue.getX();
|
||||
startLatitude = firstExtraPointPoint2dValue.getY();
|
||||
Coordinate firstExtraPointCoordinate = new Coordinate(startLongitude, startLatitude);
|
||||
TrackPoint firstExtraTrackPoint = new TrackPoint(firstExtraPointCoordinate, firstExtraPointTimeCal);
|
||||
Coordinate firstExtraPointCoordinate = new Coordinate(startLongitude,
|
||||
startLatitude);
|
||||
TrackPoint firstExtraTrackPoint = new TrackPoint(
|
||||
firstExtraPointCoordinate, firstExtraPointTimeCal);
|
||||
trackPointArray[0] = firstExtraTrackPoint;
|
||||
|
||||
|
||||
Calendar newPointCal = firstExtraPointTimeCal;
|
||||
for (int i = 1; i < (extraPointNumber); i++) {
|
||||
java.awt.geom.Point2D pt = getNextPoint2DValue(gc, startLongitude, startLatitude,
|
||||
direction, distanceBetweenExtraPoint);
|
||||
java.awt.geom.Point2D pt = getNextPoint2DValue(gc, startLongitude,
|
||||
startLatitude, direction, distanceBetweenExtraPoint);
|
||||
startLongitude = pt.getX();
|
||||
startLatitude = pt.getY();
|
||||
Coordinate nextCoordinate = new Coordinate(startLongitude, startLatitude);
|
||||
newPointCal = getTimeElapsedCalendar(newPointCal, elapsedHourForExtraPoint,
|
||||
elapsedMinuteForExtraPoint);
|
||||
TrackPoint eachTrackPoint = new TrackPoint(nextCoordinate, newPointCal);
|
||||
Coordinate nextCoordinate = new Coordinate(startLongitude,
|
||||
startLatitude);
|
||||
newPointCal = getTimeElapsedCalendar(newPointCal,
|
||||
elapsedHourForExtraPoint, elapsedMinuteForExtraPoint);
|
||||
TrackPoint eachTrackPoint = new TrackPoint(nextCoordinate,
|
||||
newPointCal);
|
||||
trackPointArray[i] = eachTrackPoint;
|
||||
}
|
||||
return trackPointArray;
|
||||
|
@ -748,30 +797,34 @@ public class Track extends Line implements ITrack {
|
|||
private java.awt.geom.Point2D getNextPoint2DValue(GeodeticCalculator gc,
|
||||
double startingPointLongitude, double startIngPointLatitude,
|
||||
double direction, double distanceBetweenTwoPoints) {
|
||||
gc.setStartingGeographicPoint(startingPointLongitude, startIngPointLatitude);
|
||||
gc.setStartingGeographicPoint(startingPointLongitude,
|
||||
startIngPointLatitude);
|
||||
gc.setDirection(direction, distanceBetweenTwoPoints);
|
||||
java.awt.geom.Point2D pt = gc.getDestinationGeographicPoint();
|
||||
return pt;
|
||||
}
|
||||
|
||||
private long getTimeDifferenceInMillisecond(Calendar startTimeCal, Calendar endTimeCal) {
|
||||
private long getTimeDifferenceInMillisecond(Calendar startTimeCal,
|
||||
Calendar endTimeCal) {
|
||||
long startTimeInMillisecond = startTimeCal.getTimeInMillis();
|
||||
long endTimeInMillisecond = endTimeCal.getTimeInMillis();
|
||||
|
||||
long timeDiffInMillisecond = endTimeInMillisecond - startTimeInMillisecond;
|
||||
long timeDiffInMillisecond = endTimeInMillisecond
|
||||
- startTimeInMillisecond;
|
||||
return timeDiffInMillisecond;
|
||||
}
|
||||
|
||||
private boolean isCoordinateValid(Coordinate coordinate) {
|
||||
if(coordinate.x > 180.0 || coordinate.x < -180.0 || coordinate.y > 90.0 ||
|
||||
coordinate.y < -90.0)
|
||||
if (coordinate.x > 180.0 || coordinate.x < -180.0
|
||||
|| coordinate.y > 90.0 || coordinate.y < -90.0)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private Calendar getIntervalCalendarByParsingString(String dateString,
|
||||
String formatStringPattern, Calendar secondTimeCal) {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(formatStringPattern);
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(
|
||||
formatStringPattern);
|
||||
Calendar cal = null;
|
||||
int elapsedHour = 1;
|
||||
int elapsedMinute = 0;
|
||||
|
@ -783,7 +836,6 @@ public class Track extends Line implements ITrack {
|
|||
elapsedHour = cal.get(Calendar.HOUR_OF_DAY);
|
||||
elapsedMinute = cal.get(Calendar.MINUTE);
|
||||
} catch (ParseException pe) {
|
||||
// log.error("The input of dateString is invalid, parse fails, dateString="+dateString);
|
||||
elapsedHour = 1;
|
||||
}
|
||||
}
|
||||
|
@ -793,19 +845,20 @@ public class Track extends Line implements ITrack {
|
|||
return cal;
|
||||
}
|
||||
|
||||
private Calendar getTimeElapsedCalendarForFirstExtraPoint(Calendar startCalendar, int elapsedHour,
|
||||
int elapsedMinute) {
|
||||
private Calendar getTimeElapsedCalendarForFirstExtraPoint(
|
||||
Calendar startCalendar, int elapsedHour, int elapsedMinute) {
|
||||
Calendar nextCal = Calendar.getInstance();
|
||||
nextCal.setTimeInMillis(startCalendar.getTimeInMillis());
|
||||
/*
|
||||
* played with the nmap2 APP, get confused with the logic behind, right now, calculate
|
||||
* the first extra point as the logic described below:
|
||||
* 1. if elapsedHour > 1 hour, set the first extra point time as the next exact hour
|
||||
* 2. if elapsedHour == 0 and last init. point MINUTE value >= elapsedMinute,
|
||||
* set the first time extra point as the next exact hour
|
||||
* 3. if elapsedHour == 0 and last init. point MINUTE value < elapsedMinute,
|
||||
* set the first time extra point as the exact hour of the last init. point + elapsedMinute
|
||||
* In the future, this logic may be changed once the real logic is figured. Michael Gao comment.
|
||||
* played with the nmap2 APP, get confused with the logic behind, right
|
||||
* now, calculate the first extra point as the logic described below: 1.
|
||||
* if elapsedHour > 1 hour, set the first extra point time as the next
|
||||
* exact hour 2. if elapsedHour == 0 and last init. point MINUTE value
|
||||
* >= elapsedMinute, set the first time extra point as the next exact
|
||||
* hour 3. if elapsedHour == 0 and last init. point MINUTE value <
|
||||
* elapsedMinute, set the first time extra point as the exact hour of
|
||||
* the last init. point + elapsedMinute In the future, this logic may be
|
||||
* changed once the real logic is figured. Michael Gao comment.
|
||||
*/
|
||||
if (elapsedHour >= 1) {
|
||||
nextCal.set(Calendar.MINUTE, 0);
|
||||
|
@ -822,8 +875,8 @@ public class Track extends Line implements ITrack {
|
|||
return nextCal;
|
||||
}
|
||||
|
||||
private Calendar getTimeElapsedCalendar(Calendar startCalendar, int elapsedHour,
|
||||
int elapsedMinute) {
|
||||
private Calendar getTimeElapsedCalendar(Calendar startCalendar,
|
||||
int elapsedHour, int elapsedMinute) {
|
||||
Calendar nextCal = Calendar.getInstance();
|
||||
nextCal.setTimeInMillis(startCalendar.getTimeInMillis());
|
||||
nextCal.add(Calendar.HOUR_OF_DAY, elapsedHour);
|
||||
|
@ -831,7 +884,6 @@ public class Track extends Line implements ITrack {
|
|||
return nextCal;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* all override setters and getters of the instance variables go here
|
||||
*/
|
||||
|
@ -1011,16 +1063,20 @@ public class Track extends Line implements ITrack {
|
|||
|
||||
public double getFromdirection() {
|
||||
|
||||
Coordinate initPointBeforeLastInitPointCoordinate = initTrackPoints[initTrackPoints.length - 2].getLocation();
|
||||
Coordinate lastInitPointCoordinate = initTrackPoints[initTrackPoints.length - 1].getLocation();
|
||||
Coordinate initPointBeforeLastInitPointCoordinate = initTrackPoints[initTrackPoints.length - 2]
|
||||
.getLocation();
|
||||
Coordinate lastInitPointCoordinate = initTrackPoints[initTrackPoints.length - 1]
|
||||
.getLocation();
|
||||
|
||||
GeodeticCalculator gc = new GeodeticCalculator(DefaultEllipsoid.WGS84);
|
||||
gc.setStartingGeographicPoint(lastInitPointCoordinate.x,
|
||||
lastInitPointCoordinate.y);
|
||||
gc.setDestinationGeographicPoint(initPointBeforeLastInitPointCoordinate.x,
|
||||
gc.setDestinationGeographicPoint(
|
||||
initPointBeforeLastInitPointCoordinate.x,
|
||||
initPointBeforeLastInitPointCoordinate.y);
|
||||
double dir = gc.getAzimuth();
|
||||
if ( dir < 0 ) dir += 360;
|
||||
if (dir < 0)
|
||||
dir += 360;
|
||||
return dir;
|
||||
}
|
||||
|
||||
|
@ -1035,8 +1091,8 @@ public class Track extends Line implements ITrack {
|
|||
public void setSpeed(double speed) {
|
||||
this.speed = speed;
|
||||
/*
|
||||
* The original speed is meters / millisecond, now it needs
|
||||
* to be converted to following units
|
||||
* The original speed is meters / millisecond, now it needs to be
|
||||
* converted to following units
|
||||
*/
|
||||
this.speedInKnotOverHour = speed * 1944;
|
||||
this.speedInKilometerOverHour = speed * 3600;
|
||||
|
@ -1046,19 +1102,21 @@ public class Track extends Line implements ITrack {
|
|||
public double getSpeedInKnotOverHour() {
|
||||
return speedInKnotOverHour;
|
||||
}
|
||||
|
||||
public double getSpeedInKilometerOverHour() {
|
||||
return speedInKilometerOverHour;
|
||||
}
|
||||
|
||||
public double getSpeedInMileOverHour() {
|
||||
return speedInMileOverHour;
|
||||
}
|
||||
|
||||
|
||||
public ExtraPointTimeDisplayOption getExtraPointTimeDisplayOption() {
|
||||
return extraPointTimeDisplayOption;
|
||||
}
|
||||
|
||||
public void setExtraPointTimeDisplayOption(ExtraPointTimeDisplayOption extraPointTimeDisplayOption) {
|
||||
public void setExtraPointTimeDisplayOption(
|
||||
ExtraPointTimeDisplayOption extraPointTimeDisplayOption) {
|
||||
this.extraPointTimeDisplayOption = extraPointTimeDisplayOption;
|
||||
}
|
||||
|
||||
|
@ -1135,8 +1193,9 @@ public class Track extends Line implements ITrack {
|
|||
*/
|
||||
this.intervalTimeString = _intervalTimeString;
|
||||
|
||||
Calendar intervalTimeCal = getIntervalCalendarByParsingString(_intervalTimeString,
|
||||
INTERVAL_TIME_FORMAT_PATTERN, getSecondTimeCalendar());
|
||||
Calendar intervalTimeCal = getIntervalCalendarByParsingString(
|
||||
_intervalTimeString, INTERVAL_TIME_FORMAT_PATTERN,
|
||||
getSecondTimeCalendar());
|
||||
// setIntervalTimeCalendar(intervalTimeCal);
|
||||
}
|
||||
|
||||
|
@ -1160,11 +1219,4 @@ public class Track extends Line implements ITrack {
|
|||
public String getSkipFactorText() {
|
||||
return skipFactorTextString;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FontStyle getStyle() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* 11/13 #1065 J. Wu Added Kink lines.
|
||||
* 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>
|
||||
*
|
||||
|
@ -735,6 +736,12 @@ public class ProductConverter {
|
|||
gfa.setGfaValue("Type", fgfa.getType());
|
||||
}
|
||||
|
||||
// textVOR
|
||||
String vorStr = fgfa.getTextVor();
|
||||
if (vorStr != null) {
|
||||
gfa.setGfaVorText(nvl(vorStr));
|
||||
}
|
||||
|
||||
String cig = fgfa.getCig();
|
||||
if (cig != null) {
|
||||
gfa.setGfaValue(Gfa.CIG, fgfa.getCig());
|
||||
|
@ -1098,7 +1105,11 @@ public class ProductConverter {
|
|||
}
|
||||
|
||||
// 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()
|
||||
.name()));
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
// Generated on: 2009.05.28 at 02:35:15 PM EDT
|
||||
//
|
||||
|
||||
|
||||
package gov.noaa.nws.ncep.ui.pgen.file;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
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.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>
|
||||
* <complexType>
|
||||
|
@ -38,6 +40,7 @@ import javax.xml.bind.annotation.XmlType;
|
|||
* <attribute name="extrapLinePattern" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||
* <attribute name="extrapMarker" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||
* <attribute name="fontName" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||
* <attribute name="fontStyle" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||
* <attribute name="fontNameComboSelectedIndex" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* <attribute name="fontSize" type="{http://www.w3.org/2001/XMLSchema}float" />
|
||||
* <attribute name="fontSizeComboSelectedIndex" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
|
@ -60,67 +63,84 @@ import javax.xml.bind.annotation.XmlType;
|
|||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "", propOrder = {
|
||||
"initialColor",
|
||||
"extrapColor",
|
||||
"initialPoints",
|
||||
"extrapPoints",
|
||||
"extraPointTimeTextDisplayIndicator"
|
||||
})
|
||||
@XmlType(name = "", propOrder = { "initialColor", "extrapColor",
|
||||
"initialPoints", "extrapPoints", "extraPointTimeTextDisplayIndicator" })
|
||||
@XmlRootElement(name = "Track")
|
||||
public class Track {
|
||||
|
||||
@XmlElement(required = true)
|
||||
protected ColorType initialColor;
|
||||
|
||||
@XmlElement(required = true)
|
||||
protected ColorType extrapColor;
|
||||
|
||||
@XmlElement(required = true)
|
||||
protected List<TrackPoint> initialPoints;
|
||||
|
||||
@XmlElement(required = true)
|
||||
protected List<TrackPoint> extrapPoints;
|
||||
|
||||
@XmlElement(type = Boolean.class)
|
||||
protected List<Boolean> extraPointTimeTextDisplayIndicator;
|
||||
|
||||
@XmlAttribute
|
||||
protected String extraPointTimeDisplayOptionName;
|
||||
|
||||
@XmlAttribute
|
||||
protected String extrapLinePattern;
|
||||
|
||||
@XmlAttribute
|
||||
protected String extrapMarker;
|
||||
|
||||
@XmlAttribute
|
||||
protected String fontName;
|
||||
|
||||
@XmlAttribute
|
||||
protected String fontStyle;
|
||||
|
||||
@XmlAttribute
|
||||
protected Integer fontNameComboSelectedIndex;
|
||||
|
||||
@XmlAttribute
|
||||
protected Float fontSize;
|
||||
|
||||
@XmlAttribute
|
||||
protected Integer fontSizeComboSelectedIndex;
|
||||
|
||||
@XmlAttribute
|
||||
protected Integer fontStyleComboSelectedIndex;
|
||||
|
||||
@XmlAttribute
|
||||
protected String initialLinePattern;
|
||||
|
||||
@XmlAttribute
|
||||
protected String initialMarker;
|
||||
|
||||
@XmlAttribute
|
||||
protected Integer intervalComboSelectedIndex;
|
||||
|
||||
@XmlAttribute
|
||||
protected String intervalTimeTextString;
|
||||
|
||||
@XmlAttribute
|
||||
protected Float lineWidth;
|
||||
|
||||
@XmlAttribute
|
||||
protected String pgenCategory;
|
||||
|
||||
@XmlAttribute
|
||||
protected String pgenType;
|
||||
|
||||
@XmlAttribute
|
||||
protected Boolean setTimeButtonSelected;
|
||||
|
||||
@XmlAttribute
|
||||
protected String skipFactorTextString;
|
||||
|
||||
/**
|
||||
* Gets the value of the initialColor property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link ColorType }
|
||||
* @return possible object is {@link ColorType }
|
||||
*
|
||||
*/
|
||||
public ColorType getInitialColor() {
|
||||
|
@ -131,8 +151,7 @@ public class Track {
|
|||
* Sets the value of the initialColor property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link ColorType }
|
||||
* allowed object is {@link ColorType }
|
||||
*
|
||||
*/
|
||||
public void setInitialColor(ColorType value) {
|
||||
|
@ -142,9 +161,7 @@ public class Track {
|
|||
/**
|
||||
* Gets the value of the extrapColor property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link ColorType }
|
||||
* @return possible object is {@link ColorType }
|
||||
*
|
||||
*/
|
||||
public ColorType getExtrapColor() {
|
||||
|
@ -155,8 +172,7 @@ public class Track {
|
|||
* Sets the value of the extrapColor property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link ColorType }
|
||||
* allowed object is {@link ColorType }
|
||||
*
|
||||
*/
|
||||
public void setExtrapColor(ColorType value) {
|
||||
|
@ -167,13 +183,14 @@ public class Track {
|
|||
* Gets the value of the initialPoints property.
|
||||
*
|
||||
* <p>
|
||||
* This accessor method returns a reference to the live list,
|
||||
* not a snapshot. Therefore any modification you make to the
|
||||
* returned list will be present inside the JAXB object.
|
||||
* This is why there is not a <CODE>set</CODE> method for the initialPoints property.
|
||||
* This accessor method returns a reference to the live list, not a
|
||||
* snapshot. Therefore any modification you make to the returned list will
|
||||
* be present inside the JAXB object. This is why there is not a
|
||||
* <CODE>set</CODE> method for the initialPoints property.
|
||||
*
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
*
|
||||
* <pre>
|
||||
* getInitialPoints().add(newItem);
|
||||
* </pre>
|
||||
|
@ -196,13 +213,14 @@ public class Track {
|
|||
* Gets the value of the extrapPoints property.
|
||||
*
|
||||
* <p>
|
||||
* This accessor method returns a reference to the live list,
|
||||
* not a snapshot. Therefore any modification you make to the
|
||||
* returned list will be present inside the JAXB object.
|
||||
* This is why there is not a <CODE>set</CODE> method for the extrapPoints property.
|
||||
* This accessor method returns a reference to the live list, not a
|
||||
* snapshot. Therefore any modification you make to the returned list will
|
||||
* be present inside the JAXB object. This is why there is not a
|
||||
* <CODE>set</CODE> method for the extrapPoints property.
|
||||
*
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
*
|
||||
* <pre>
|
||||
* getExtrapPoints().add(newItem);
|
||||
* </pre>
|
||||
|
@ -225,21 +243,22 @@ public class Track {
|
|||
* Gets the value of the extraPointTimeTextDisplayIndicator property.
|
||||
*
|
||||
* <p>
|
||||
* This accessor method returns a reference to the live list,
|
||||
* not a snapshot. Therefore any modification you make to the
|
||||
* returned list will be present inside the JAXB object.
|
||||
* This is why there is not a <CODE>set</CODE> method for the extraPointTimeTextDisplayIndicator property.
|
||||
* This accessor method returns a reference to the live list, not a
|
||||
* snapshot. Therefore any modification you make to the returned list will
|
||||
* be present inside the JAXB object. This is why there is not a
|
||||
* <CODE>set</CODE> method for the extraPointTimeTextDisplayIndicator
|
||||
* property.
|
||||
*
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
*
|
||||
* <pre>
|
||||
* getExtraPointTimeTextDisplayIndicator().add(newItem);
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link Boolean }
|
||||
* Objects of the following type(s) are allowed in the list {@link Boolean }
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
@ -253,9 +272,7 @@ public class Track {
|
|||
/**
|
||||
* Gets the value of the extraPointTimeDisplayOptionName property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
* @return possible object is {@link String }
|
||||
*
|
||||
*/
|
||||
public String getExtraPointTimeDisplayOptionName() {
|
||||
|
@ -266,8 +283,7 @@ public class Track {
|
|||
* Sets the value of the extraPointTimeDisplayOptionName property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
* allowed object is {@link String }
|
||||
*
|
||||
*/
|
||||
public void setExtraPointTimeDisplayOptionName(String value) {
|
||||
|
@ -277,9 +293,7 @@ public class Track {
|
|||
/**
|
||||
* Gets the value of the extrapLinePattern property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
* @return possible object is {@link String }
|
||||
*
|
||||
*/
|
||||
public String getExtrapLinePattern() {
|
||||
|
@ -290,8 +304,7 @@ public class Track {
|
|||
* Sets the value of the extrapLinePattern property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
* allowed object is {@link String }
|
||||
*
|
||||
*/
|
||||
public void setExtrapLinePattern(String value) {
|
||||
|
@ -301,9 +314,7 @@ public class Track {
|
|||
/**
|
||||
* Gets the value of the extrapMarker property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
* @return possible object is {@link String }
|
||||
*
|
||||
*/
|
||||
public String getExtrapMarker() {
|
||||
|
@ -314,8 +325,7 @@ public class Track {
|
|||
* Sets the value of the extrapMarker property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
* allowed object is {@link String }
|
||||
*
|
||||
*/
|
||||
public void setExtrapMarker(String value) {
|
||||
|
@ -325,9 +335,7 @@ public class Track {
|
|||
/**
|
||||
* Gets the value of the fontName property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
* @return possible object is {@link String }
|
||||
*
|
||||
*/
|
||||
public String getFontName() {
|
||||
|
@ -338,20 +346,38 @@ public class Track {
|
|||
* Sets the value of the fontName property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
* allowed object is {@link String }
|
||||
*
|
||||
*/
|
||||
public void setFontName(String 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.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Integer }
|
||||
* @return possible object is {@link Integer }
|
||||
*
|
||||
*/
|
||||
public Integer getFontNameComboSelectedIndex() {
|
||||
|
@ -362,8 +388,7 @@ public class Track {
|
|||
* Sets the value of the fontNameComboSelectedIndex property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Integer }
|
||||
* allowed object is {@link Integer }
|
||||
*
|
||||
*/
|
||||
public void setFontNameComboSelectedIndex(Integer value) {
|
||||
|
@ -373,9 +398,7 @@ public class Track {
|
|||
/**
|
||||
* Gets the value of the fontSize property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Float }
|
||||
* @return possible object is {@link Float }
|
||||
*
|
||||
*/
|
||||
public Float getFontSize() {
|
||||
|
@ -386,8 +409,7 @@ public class Track {
|
|||
* Sets the value of the fontSize property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Float }
|
||||
* allowed object is {@link Float }
|
||||
*
|
||||
*/
|
||||
public void setFontSize(Float value) {
|
||||
|
@ -397,9 +419,7 @@ public class Track {
|
|||
/**
|
||||
* Gets the value of the fontSizeComboSelectedIndex property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Integer }
|
||||
* @return possible object is {@link Integer }
|
||||
*
|
||||
*/
|
||||
public Integer getFontSizeComboSelectedIndex() {
|
||||
|
@ -410,8 +430,7 @@ public class Track {
|
|||
* Sets the value of the fontSizeComboSelectedIndex property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Integer }
|
||||
* allowed object is {@link Integer }
|
||||
*
|
||||
*/
|
||||
public void setFontSizeComboSelectedIndex(Integer value) {
|
||||
|
@ -421,9 +440,7 @@ public class Track {
|
|||
/**
|
||||
* Gets the value of the fontStyleComboSelectedIndex property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Integer }
|
||||
* @return possible object is {@link Integer }
|
||||
*
|
||||
*/
|
||||
public Integer getFontStyleComboSelectedIndex() {
|
||||
|
@ -434,8 +451,7 @@ public class Track {
|
|||
* Sets the value of the fontStyleComboSelectedIndex property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Integer }
|
||||
* allowed object is {@link Integer }
|
||||
*
|
||||
*/
|
||||
public void setFontStyleComboSelectedIndex(Integer value) {
|
||||
|
@ -445,9 +461,7 @@ public class Track {
|
|||
/**
|
||||
* Gets the value of the initialLinePattern property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
* @return possible object is {@link String }
|
||||
*
|
||||
*/
|
||||
public String getInitialLinePattern() {
|
||||
|
@ -458,8 +472,7 @@ public class Track {
|
|||
* Sets the value of the initialLinePattern property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
* allowed object is {@link String }
|
||||
*
|
||||
*/
|
||||
public void setInitialLinePattern(String value) {
|
||||
|
@ -469,9 +482,7 @@ public class Track {
|
|||
/**
|
||||
* Gets the value of the initialMarker property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
* @return possible object is {@link String }
|
||||
*
|
||||
*/
|
||||
public String getInitialMarker() {
|
||||
|
@ -482,8 +493,7 @@ public class Track {
|
|||
* Sets the value of the initialMarker property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
* allowed object is {@link String }
|
||||
*
|
||||
*/
|
||||
public void setInitialMarker(String value) {
|
||||
|
@ -493,9 +503,7 @@ public class Track {
|
|||
/**
|
||||
* Gets the value of the intervalComboSelectedIndex property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Integer }
|
||||
* @return possible object is {@link Integer }
|
||||
*
|
||||
*/
|
||||
public Integer getIntervalComboSelectedIndex() {
|
||||
|
@ -506,8 +514,7 @@ public class Track {
|
|||
* Sets the value of the intervalComboSelectedIndex property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Integer }
|
||||
* allowed object is {@link Integer }
|
||||
*
|
||||
*/
|
||||
public void setIntervalComboSelectedIndex(Integer value) {
|
||||
|
@ -517,9 +524,7 @@ public class Track {
|
|||
/**
|
||||
* Gets the value of the intervalTimeTextString property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
* @return possible object is {@link String }
|
||||
*
|
||||
*/
|
||||
public String getIntervalTimeTextString() {
|
||||
|
@ -530,8 +535,7 @@ public class Track {
|
|||
* Sets the value of the intervalTimeTextString property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
* allowed object is {@link String }
|
||||
*
|
||||
*/
|
||||
public void setIntervalTimeTextString(String value) {
|
||||
|
@ -541,9 +545,7 @@ public class Track {
|
|||
/**
|
||||
* Gets the value of the lineWidth property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Float }
|
||||
* @return possible object is {@link Float }
|
||||
*
|
||||
*/
|
||||
public Float getLineWidth() {
|
||||
|
@ -554,8 +556,7 @@ public class Track {
|
|||
* Sets the value of the lineWidth property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Float }
|
||||
* allowed object is {@link Float }
|
||||
*
|
||||
*/
|
||||
public void setLineWidth(Float value) {
|
||||
|
@ -565,9 +566,7 @@ public class Track {
|
|||
/**
|
||||
* Gets the value of the pgenCategory property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
* @return possible object is {@link String }
|
||||
*
|
||||
*/
|
||||
public String getPgenCategory() {
|
||||
|
@ -578,8 +577,7 @@ public class Track {
|
|||
* Sets the value of the pgenCategory property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
* allowed object is {@link String }
|
||||
*
|
||||
*/
|
||||
public void setPgenCategory(String value) {
|
||||
|
@ -589,9 +587,7 @@ public class Track {
|
|||
/**
|
||||
* Gets the value of the pgenType property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
* @return possible object is {@link String }
|
||||
*
|
||||
*/
|
||||
public String getPgenType() {
|
||||
|
@ -602,8 +598,7 @@ public class Track {
|
|||
* Sets the value of the pgenType property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
* allowed object is {@link String }
|
||||
*
|
||||
*/
|
||||
public void setPgenType(String value) {
|
||||
|
@ -613,9 +608,7 @@ public class Track {
|
|||
/**
|
||||
* Gets the value of the setTimeButtonSelected property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Boolean }
|
||||
* @return possible object is {@link Boolean }
|
||||
*
|
||||
*/
|
||||
public Boolean isSetTimeButtonSelected() {
|
||||
|
@ -626,8 +619,7 @@ public class Track {
|
|||
* Sets the value of the setTimeButtonSelected property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Boolean }
|
||||
* allowed object is {@link Boolean }
|
||||
*
|
||||
*/
|
||||
public void setSetTimeButtonSelected(Boolean value) {
|
||||
|
@ -637,9 +629,7 @@ public class Track {
|
|||
/**
|
||||
* Gets the value of the skipFactorTextString property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
* @return possible object is {@link String }
|
||||
*
|
||||
*/
|
||||
public String getSkipFactorTextString() {
|
||||
|
@ -650,8 +640,7 @@ public class Track {
|
|||
* Sets the value of the skipFactorTextString property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
* allowed object is {@link String }
|
||||
*
|
||||
*/
|
||||
public void setSkipFactorTextString(String value) {
|
||||
|
|
|
@ -7,11 +7,17 @@
|
|||
*/
|
||||
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.GregorianCalendar;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.awt.Color;
|
||||
|
||||
import javax.xml.datatype.DatatypeConfigurationException;
|
||||
import javax.xml.datatype.DatatypeFactory;
|
||||
|
@ -22,20 +28,16 @@ import org.geotools.referencing.datum.DefaultEllipsoid;
|
|||
|
||||
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
|
||||
* and the actual in-memory PGEN products.
|
||||
* Define a ProductConverter Class - some methods to convert the products
|
||||
* between XML format and the actual in-memory PGEN products.
|
||||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 02/2012 TTR456 Q. Zhou Added speed, dir. Default to kts, no round
|
||||
* 09/2014 TTR750 J. Wu Use FontStyle instead of "index".
|
||||
* </pre>
|
||||
* */
|
||||
public class TrackConverter {
|
||||
|
@ -49,46 +51,90 @@ public class TrackConverter {
|
|||
*/
|
||||
public static List<Track> getTrackElementListByTrackBeanList(
|
||||
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) {
|
||||
Track trackElement = new Track();
|
||||
|
||||
trackElement.setInitialColor(getColorByColorTypeBean(trackBean.initialColor, true));
|
||||
trackElement.setExtrapColor(getColorByColorTypeBean(trackBean.extrapColor, false));
|
||||
trackElement.setInitialColor(getColorByColorTypeBean(
|
||||
trackBean.initialColor, true));
|
||||
trackElement.setExtrapColor(getColorByColorTypeBean(
|
||||
trackBean.extrapColor, false));
|
||||
|
||||
trackElement.setInitTrackPoints(getTrackPointElementListByTrackPointBeanList(trackBean.getInitialPoints()).toArray(new TrackPoint[trackBean.getInitialPoints().size()]));
|
||||
trackElement.setExtrapPoints(getTrackPointElementListByTrackPointBeanList(trackBean.getExtrapPoints()).toArray(new TrackPoint[trackBean.getExtrapPoints().size()]));
|
||||
trackElement
|
||||
.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.
|
||||
* 1. combine init and extrap points to allow PgenSource to go over every point for drawing
|
||||
* 2. setLinePattern is from the parent 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.
|
||||
* Important note: the following two method calls are necessary. 1.
|
||||
* combine init and extrap points to allow PgenSource to go over
|
||||
* every point for drawing 2. setLinePattern is from the parent
|
||||
* 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
|
||||
.getInitialLinePattern());
|
||||
trackElement.setExtrapLinePattern(trackBean.getExtrapLinePattern());
|
||||
trackElement.setInitialMarker(trackBean.getInitialMarker());
|
||||
trackElement.setExtrapMarker(trackBean.getExtrapMarker());
|
||||
trackElement.setFontName(trackBean.getFontName());
|
||||
|
||||
// TTR 950 - Font Style
|
||||
int styleInd = 0;
|
||||
FontStyle dstyle = FontStyle.BOLD;
|
||||
if (trackBean.getFontStyle() != null) {
|
||||
int jj = 0;
|
||||
for (FontStyle ft : FontStyle.values()) {
|
||||
if (ft == FontStyle.valueOf(trackBean.getFontStyle()
|
||||
.toUpperCase())) {
|
||||
styleInd = jj;
|
||||
dstyle = ft;
|
||||
break;
|
||||
}
|
||||
|
||||
jj++;
|
||||
}
|
||||
}
|
||||
|
||||
trackElement.setFontStyle(dstyle);
|
||||
trackElement.setFontStyleComboSelectedIndex(styleInd);
|
||||
|
||||
if (trackBean.getLineWidth() != null)
|
||||
trackElement.setLineWidth(trackBean.getLineWidth().floatValue());
|
||||
trackElement
|
||||
.setLineWidth(trackBean.getLineWidth().floatValue());
|
||||
else
|
||||
trackElement.setLineWidth((float)1.0); //set a 1.0 as the default value
|
||||
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
|
||||
trackElement.setFontSize((float) 2.0); // set a 2.0 as the
|
||||
// default value
|
||||
|
||||
if (trackBean.getPgenCategory() == null)
|
||||
trackElement.setPgenCategory(Track.TRACK_PGEN_CATEGORY);
|
||||
|
@ -105,19 +151,24 @@ public class TrackConverter {
|
|||
*/
|
||||
TrackPoint[] initPts = trackElement.getInitTrackPoints();
|
||||
int initPtsLength = initPts.length;
|
||||
Coordinate initPointBeforeLastInitPointCoordinate = initPts[initPtsLength - 2].getLocation();
|
||||
Coordinate lastInitPointCoordinate = initPts[initPtsLength - 1].getLocation();
|
||||
Coordinate initPointBeforeLastInitPointCoordinate = initPts[initPtsLength - 2]
|
||||
.getLocation();
|
||||
Coordinate lastInitPointCoordinate = initPts[initPtsLength - 1]
|
||||
.getLocation();
|
||||
|
||||
GeodeticCalculator gc = new GeodeticCalculator(DefaultEllipsoid.WGS84);
|
||||
gc.setStartingGeographicPoint(initPointBeforeLastInitPointCoordinate.x,
|
||||
GeodeticCalculator gc = new GeodeticCalculator(
|
||||
DefaultEllipsoid.WGS84);
|
||||
gc.setStartingGeographicPoint(
|
||||
initPointBeforeLastInitPointCoordinate.x,
|
||||
initPointBeforeLastInitPointCoordinate.y);
|
||||
gc.setDestinationGeographicPoint(lastInitPointCoordinate.x,
|
||||
lastInitPointCoordinate.y);
|
||||
double direction = gc.getAzimuth();
|
||||
|
||||
double distanceInMeter = gc.getOrthodromicDistance();
|
||||
long timeDifference = initPts[initPtsLength - 1].getTime().getTimeInMillis() -
|
||||
initPts[initPtsLength - 2].getTime().getTimeInMillis();
|
||||
long timeDifference = initPts[initPtsLength - 1].getTime()
|
||||
.getTimeInMillis()
|
||||
- initPts[initPtsLength - 2].getTime().getTimeInMillis();
|
||||
double speed = distanceInMeter / (double) timeDifference;
|
||||
|
||||
trackElement.setDirectionForExtraPoints(direction);
|
||||
|
@ -133,25 +184,34 @@ public class TrackConverter {
|
|||
trackElement.setFillPattern(FillPattern.FILL_PATTERN_0);
|
||||
|
||||
/*
|
||||
* The following attributes are necessary to fill values for the pop-up
|
||||
* TrackAttiDlg window from the restored line images.
|
||||
* The following attributes are necessary to fill values for the
|
||||
* pop-up TrackAttiDlg window from the restored line images.
|
||||
*/
|
||||
boolean setTimeButtonSelectedFlag = true; // set the default value as TRUE
|
||||
boolean setTimeButtonSelectedFlag = true; // set the default value
|
||||
// as TRUE
|
||||
if (trackBean.isSetTimeButtonSelected() != null)
|
||||
setTimeButtonSelectedFlag = trackBean.isSetTimeButtonSelected().booleanValue();
|
||||
setTimeButtonSelectedFlag = trackBean.isSetTimeButtonSelected()
|
||||
.booleanValue();
|
||||
trackElement.setSetTimeButtonSelected(setTimeButtonSelectedFlag);
|
||||
|
||||
int intervalComboSelectedIndexValue = 0; // set the default value
|
||||
if (trackBean.getIntervalComboSelectedIndex() != null)
|
||||
intervalComboSelectedIndexValue = trackBean.getIntervalComboSelectedIndex().intValue();
|
||||
trackElement.setIntervalComboSelectedIndex(intervalComboSelectedIndexValue);
|
||||
intervalComboSelectedIndexValue = trackBean
|
||||
.getIntervalComboSelectedIndex().intValue();
|
||||
trackElement
|
||||
.setIntervalComboSelectedIndex(intervalComboSelectedIndexValue);
|
||||
|
||||
trackElement.setIntervalTimeString(trackBean.getIntervalTimeTextString());
|
||||
trackElement.setIntervalTimeString(trackBean
|
||||
.getIntervalTimeTextString());
|
||||
|
||||
String extraPointTimeDisplayOptionName = ITrack.ExtraPointTimeDisplayOption.SKIP_FACTOR.name(); // set the default value
|
||||
String extraPointTimeDisplayOptionName = ITrack.ExtraPointTimeDisplayOption.SKIP_FACTOR
|
||||
.name(); // set the default value
|
||||
if (trackBean.getExtraPointTimeDisplayOptionName() != null)
|
||||
extraPointTimeDisplayOptionName = trackBean.getExtraPointTimeDisplayOptionName();
|
||||
trackElement.setExtraPointTimeDisplayOption(ITrack.ExtraPointTimeDisplayOption.valueOf(extraPointTimeDisplayOptionName));
|
||||
extraPointTimeDisplayOptionName = trackBean
|
||||
.getExtraPointTimeDisplayOptionName();
|
||||
trackElement
|
||||
.setExtraPointTimeDisplayOption(ITrack.ExtraPointTimeDisplayOption
|
||||
.valueOf(extraPointTimeDisplayOptionName));
|
||||
|
||||
String skipFactorTextString = "0"; // set the default value
|
||||
if (trackBean.getSkipFactorTextString() != null)
|
||||
|
@ -160,18 +220,17 @@ public class TrackConverter {
|
|||
|
||||
int fontNameComboSelectedIndex = 0; // set the default value
|
||||
if (trackBean.getFontNameComboSelectedIndex() != null)
|
||||
fontNameComboSelectedIndex = trackBean.getFontNameComboSelectedIndex().intValue();
|
||||
trackElement.setFontNameComboSelectedIndex(fontNameComboSelectedIndex);
|
||||
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);
|
||||
|
||||
int fontStyleComboSelectedIndex = 0; //set the default value
|
||||
if(trackBean.getFontStyleComboSelectedIndex() != null)
|
||||
fontStyleComboSelectedIndex = trackBean.getFontStyleComboSelectedIndex().intValue();
|
||||
trackElement.setFontStyleComboSelectedIndex(fontStyleComboSelectedIndex);
|
||||
fontSizeComboSelectedIndex = trackBean
|
||||
.getFontSizeComboSelectedIndex().intValue();
|
||||
trackElement
|
||||
.setFontSizeComboSelectedIndex(fontSizeComboSelectedIndex);
|
||||
|
||||
trackElementList.add(trackElement);
|
||||
}
|
||||
|
@ -183,27 +242,55 @@ public class TrackConverter {
|
|||
Track trackElement) {
|
||||
gov.noaa.nws.ncep.ui.pgen.file.Track trackBean = new gov.noaa.nws.ncep.ui.pgen.file.Track();
|
||||
|
||||
trackBean.setInitialColor(getColorTypeBeanByColorElement(trackElement.getInitialColor()));
|
||||
trackBean.setExtrapColor(getColorTypeBeanByColorElement(trackElement.getExtrapColor()));
|
||||
trackBean.setInitialColor(getColorTypeBeanByColorElement(trackElement
|
||||
.getInitialColor()));
|
||||
trackBean.setExtrapColor(getColorTypeBeanByColorElement(trackElement
|
||||
.getExtrapColor()));
|
||||
|
||||
if (trackElement.getInitialPoints() != null) {
|
||||
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));
|
||||
trackBean
|
||||
.getExtrapPoints()
|
||||
.add(getTrackPointBeanByTrackPointElement(currentTrackPoint));
|
||||
}
|
||||
}
|
||||
|
||||
trackBean.getExtraPointTimeTextDisplayIndicator().addAll(getBooleanObjectList(trackElement.getExtraPointTimeTextDisplayIndicator()));
|
||||
trackBean.getExtraPointTimeTextDisplayIndicator().addAll(
|
||||
getBooleanObjectList(trackElement
|
||||
.getExtraPointTimeTextDisplayIndicator()));
|
||||
|
||||
trackBean.setInitialLinePattern(trackElement.getInitialLinePattern());
|
||||
trackBean.setExtrapLinePattern(trackElement.getExtrapLinePattern());
|
||||
trackBean.setInitialMarker(trackElement.getInitialMarker());
|
||||
trackBean.setExtrapMarker(trackElement.getExtrapMarker());
|
||||
trackBean.setFontName(trackElement.getFontName());
|
||||
|
||||
// Font style
|
||||
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++;
|
||||
}
|
||||
}
|
||||
|
||||
trackBean.setFontStyle(dstyle.toString());
|
||||
trackBean.setFontStyleComboSelectedIndex(styleInd);
|
||||
|
||||
trackBean.setFontSize(new Float(trackElement.getFontSize()));
|
||||
trackBean.setLineWidth(new Float(trackElement.getLineWidth()));
|
||||
|
||||
|
@ -213,28 +300,39 @@ public class TrackConverter {
|
|||
/*
|
||||
* 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
|
||||
* 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()));
|
||||
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(
|
||||
gov.noaa.nws.ncep.ui.pgen.file.Track trackBean,
|
||||
boolean isFirstTimeCalendar) {
|
||||
int indexOffSet = 1;
|
||||
if (isFirstTimeCalendar)
|
||||
indexOffSet++;
|
||||
List<TrackPoint> trackPointElementList = getTrackPointElementListByTrackPointBeanList(trackBean.getInitialPoints());
|
||||
List<TrackPoint> trackPointElementList = getTrackPointElementListByTrackPointBeanList(trackBean
|
||||
.getInitialPoints());
|
||||
if (trackPointElementList == null || trackPointElementList.size() < 2) {
|
||||
// log.error("Retrieved List<TrackPoint> trackPointElementList is NULL or the initial points are less than 2 points");
|
||||
return null;
|
||||
|
@ -243,34 +341,42 @@ public class TrackConverter {
|
|||
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(
|
||||
gov.noaa.nws.ncep.ui.pgen.file.ColorType colorTypeBean,
|
||||
boolean isInitColor) {
|
||||
if (colorTypeBean == null || colorTypeBean.getColor() == null) {
|
||||
if (isInitColor)
|
||||
return new Color(0, 0, 255); // return a default color as Blue
|
||||
else
|
||||
return new Color(0, 192, 0); //return a green color as the default color for extrapPoint
|
||||
return new Color(0, 192, 0); // return a green color as the
|
||||
// default color for extrapPoint
|
||||
}
|
||||
gov.noaa.nws.ncep.ui.pgen.file.Color colorBean = colorTypeBean.getColor();
|
||||
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) {
|
||||
List<TrackPoint> trackPointElementList = new ArrayList<TrackPoint>(trackPointBeanList.size());
|
||||
private static List<TrackPoint> getTrackPointElementListByTrackPointBeanList(
|
||||
List<gov.noaa.nws.ncep.ui.pgen.file.TrackPoint> trackPointBeanList) {
|
||||
List<TrackPoint> trackPointElementList = new ArrayList<TrackPoint>(
|
||||
trackPointBeanList.size());
|
||||
for (gov.noaa.nws.ncep.ui.pgen.file.TrackPoint trackPointBean : trackPointBeanList) {
|
||||
java.util.Calendar currentCalendar = null;
|
||||
if (trackPointBean.getTime() != null) {
|
||||
currentCalendar = trackPointBean.getTime().toGregorianCalendar();
|
||||
currentCalendar = trackPointBean.getTime()
|
||||
.toGregorianCalendar();
|
||||
}
|
||||
Coordinate currentCoordinate = getCoordinateByTrackPointBean(trackPointBean);
|
||||
TrackPoint currentTrackPointElement = new TrackPoint(currentCoordinate, currentCalendar);
|
||||
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(
|
||||
gov.noaa.nws.ncep.ui.pgen.file.TrackPoint trackPointBean) {
|
||||
Coordinate coordinate = new Coordinate();
|
||||
if (trackPointBean.getLocation() != null) {
|
||||
coordinate.x = trackPointBean.getLocation().getLongitude();
|
||||
|
@ -279,7 +385,8 @@ public class TrackConverter {
|
|||
return coordinate;
|
||||
}
|
||||
|
||||
private static boolean[] getBooleanArrayByBooleanList(List<Boolean> booleanList) {
|
||||
private static boolean[] getBooleanArrayByBooleanList(
|
||||
List<Boolean> booleanList) {
|
||||
boolean[] booleanArray = new boolean[booleanList.size()];
|
||||
int arrayIndex = 0;
|
||||
for (Boolean currentBoolean : booleanList) {
|
||||
|
@ -288,8 +395,8 @@ public class TrackConverter {
|
|||
return booleanArray;
|
||||
}
|
||||
|
||||
|
||||
private static gov.noaa.nws.ncep.ui.pgen.file.ColorType getColorTypeBeanByColorElement(java.awt.Color colorElement) {
|
||||
private static gov.noaa.nws.ncep.ui.pgen.file.ColorType getColorTypeBeanByColorElement(
|
||||
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.Color colorBean = new gov.noaa.nws.ncep.ui.pgen.file.Color();
|
||||
colorBean.setAlpha(colorElement.getAlpha());
|
||||
|
@ -300,14 +407,18 @@ public class TrackConverter {
|
|||
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(
|
||||
TrackPoint trackPointElement) {
|
||||
gov.noaa.nws.ncep.ui.pgen.file.TrackPoint trackPointBean = new gov.noaa.nws.ncep.ui.pgen.file.TrackPoint();
|
||||
|
||||
if (trackPointElement.getTime() != null) {
|
||||
GregorianCalendar gregorianCalendar = new GregorianCalendar();
|
||||
gregorianCalendar.setTimeInMillis(trackPointElement.getTime().getTimeInMillis());
|
||||
gregorianCalendar.setTimeInMillis(trackPointElement.getTime()
|
||||
.getTimeInMillis());
|
||||
try {
|
||||
XMLGregorianCalendar xmlGregorianCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(gregorianCalendar);
|
||||
XMLGregorianCalendar xmlGregorianCalendar = DatatypeFactory
|
||||
.newInstance().newXMLGregorianCalendar(
|
||||
gregorianCalendar);
|
||||
trackPointBean.setTime(xmlGregorianCalendar);
|
||||
} catch (DatatypeConfigurationException dce) {
|
||||
// log.error("Error, instantiating XMLGregorianCalendar failed, error="+dce.getMessage());
|
||||
|
@ -315,8 +426,10 @@ public class TrackConverter {
|
|||
}
|
||||
if (trackPointElement.getLocation() != null) {
|
||||
trackPointBean.location = new gov.noaa.nws.ncep.ui.pgen.file.TrackPoint.Location();
|
||||
trackPointBean.getLocation().setLongitude(trackPointElement.getLocation().x);
|
||||
trackPointBean.getLocation().setLatitude(trackPointElement.getLocation().y);
|
||||
trackPointBean.getLocation().setLongitude(
|
||||
trackPointElement.getLocation().x);
|
||||
trackPointBean.getLocation().setLatitude(
|
||||
trackPointElement.getLocation().y);
|
||||
}
|
||||
return trackPointBean;
|
||||
}
|
||||
|
@ -334,6 +447,4 @@ public class TrackConverter {
|
|||
return booleanList;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -411,27 +411,52 @@
|
|||
<xsd:sequence>
|
||||
<xsd:element name="initialColor" 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="extrapPoints" type="TrackPoint" maxOccurs="unbounded" minOccurs="1"></xsd:element>
|
||||
<xsd:element name="extraPointTimeTextDisplayIndicator" type="xsd:boolean" maxOccurs="unbounded" minOccurs="1"></xsd:element>
|
||||
<xsd:element name="initialPoints" type="TrackPoint"
|
||||
maxOccurs="unbounded" minOccurs="1">
|
||||
</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: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="initialMarker" 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="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="pgenType" 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="intervalComboSelectedIndex" type="xsd:int"></xsd:attribute>
|
||||
<xsd:attribute name="intervalTimeTextString" 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:attribute name="setTimeButtonSelected"
|
||||
type="xsd:boolean">
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="intervalComboSelectedIndex"
|
||||
type="xsd:int">
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="intervalTimeTextString"
|
||||
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:element>
|
||||
|
||||
|
|
|
@ -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.ProductConverter;
|
||||
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.StorageUtils;
|
||||
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.IOException;
|
||||
|
@ -61,6 +61,7 @@ import com.vividsolutions.jts.geom.GeometryFactory;
|
|||
* 05/13 #610 J. Wu Implemented FZLVL range (TTR425)
|
||||
* 07/13 ? J. Wu Move state list ordering to GfaRules.
|
||||
* 08/13 TTR714/715 J. Wu Fixed issue type and times.
|
||||
* 10/14 TTR714 J. Wu Check issue type in get_status.xml.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -70,7 +71,9 @@ import com.vividsolutions.jts.geom.GeometryFactory;
|
|||
public class GfaGenerate {
|
||||
|
||||
private static final String TEXT_TYPE = "TEXT";
|
||||
|
||||
private GeometryFactory gf = new GeometryFactory();
|
||||
|
||||
private static final String ISSUE_TYPE_FROM_OUTLOOK = "ISSUE_TYPE_FROM_OUTLOOK";
|
||||
|
||||
// private final static Logger logger = Logger.getLogger(GfaGenerate.class);
|
||||
|
@ -120,9 +123,11 @@ public class GfaGenerate {
|
|||
}
|
||||
|
||||
/*
|
||||
* 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
|
||||
|
@ -163,11 +168,12 @@ public class GfaGenerate {
|
|||
*/
|
||||
for (Gfa gss : ret) {
|
||||
Gfa gfaCopy = gss.copy();
|
||||
String otlkIssueType = nvl( gfaCopy.getGfaValue( ISSUE_TYPE_FROM_OUTLOOK ) );
|
||||
if ( !otlkIssueType.equals( "NRML" ) ) {
|
||||
gfaCopy.setGfaIssueType( otlkIssueType );
|
||||
}
|
||||
|
||||
/*
|
||||
* String otlkIssueType = nvl(gfaCopy
|
||||
* .getGfaValue(ISSUE_TYPE_FROM_OUTLOOK)); if
|
||||
* (!otlkIssueType.equals("NRML")) {
|
||||
* gfaCopy.setGfaIssueType( otlkIssueType ); }
|
||||
*/
|
||||
if (fzlvlRange != null) {
|
||||
gfaCopy.setGfaValue(Gfa.FZL_RANGE, fzlvlRange);
|
||||
}
|
||||
|
@ -233,7 +239,8 @@ public class GfaGenerate {
|
|||
* @param cats
|
||||
* @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>();
|
||||
|
||||
|
@ -258,6 +265,7 @@ public class GfaGenerate {
|
|||
}
|
||||
|
||||
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 xml = xml1.replaceAll("TURB-LO", "TURB");
|
||||
|
@ -279,6 +287,7 @@ public class GfaGenerate {
|
|||
transformer.transform(xmlSource, result);
|
||||
|
||||
res = result.getWriter().toString().trim();
|
||||
System.out.println("\nres is:\n" + res + "\n");
|
||||
|
||||
} catch (Exception 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.
|
||||
*
|
||||
* @param g Gfa to be processed
|
||||
* @param g
|
||||
* Gfa to be processed
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
@ -438,7 +449,6 @@ public class GfaGenerate {
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
String fzlRange = null;
|
||||
String topStr = null;
|
||||
String botStr = null;
|
||||
|
@ -453,16 +463,14 @@ public class GfaGenerate {
|
|||
topStr = padding(extRange[0]);
|
||||
botStr = padding(extRange[1]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} 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
|
||||
* 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);
|
||||
|
@ -489,13 +497,13 @@ public class GfaGenerate {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 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 ).
|
||||
* 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 ) {
|
||||
private int[] findExistingFzlRange(List<Gfa> all, List<Gfa> selected,
|
||||
String area) {
|
||||
|
||||
int[] topBot = { -1, 9999 };
|
||||
|
||||
|
@ -510,25 +518,23 @@ public class GfaGenerate {
|
|||
String range1 = elem.getGfaValue(Gfa.FZL_RANGE);
|
||||
if (range1 != null) {
|
||||
String[] rangeInfo = range1.split(";");
|
||||
if ( rangeInfo.length >= 3 && rangeInfo[0].equalsIgnoreCase( area ) ) {
|
||||
if (rangeInfo.length >= 3
|
||||
&& rangeInfo[0].equalsIgnoreCase(area)) {
|
||||
int top1 = -1;
|
||||
int bot1 = -1;
|
||||
|
||||
try {
|
||||
top1 = Integer.parseInt(rangeInfo[1]);
|
||||
}
|
||||
catch ( Exception e ) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (rangeInfo[2].equalsIgnoreCase("SFC")) {
|
||||
bot1 = 0;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
try {
|
||||
bot1 = Integer.parseInt(rangeInfo[2]);
|
||||
}
|
||||
catch ( Exception e ) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -545,8 +551,9 @@ public class GfaGenerate {
|
|||
}
|
||||
|
||||
/*
|
||||
* Retrieve the worst range from existing top/bottom of M_FZLVL airmet/outlook.
|
||||
* Such top/bottom are retrievable as gfa.getGfaTop() & gfa.getGfaBottom().
|
||||
* 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) {
|
||||
|
||||
|
@ -566,8 +573,7 @@ public class GfaGenerate {
|
|||
if (elem.getGfaTop() != null) {
|
||||
try {
|
||||
top2 = Integer.parseInt(elem.getGfaTop());
|
||||
}
|
||||
catch ( Exception e ) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -576,12 +582,10 @@ public class GfaGenerate {
|
|||
if (botStr != null) {
|
||||
if (botStr.equalsIgnoreCase("SFC")) {
|
||||
bot2 = 0;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
try {
|
||||
bot2 = Integer.parseInt(elem.getGfaBottom());
|
||||
}
|
||||
catch ( Exception e ) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -602,7 +606,8 @@ public class GfaGenerate {
|
|||
* Retrieve the worst range from existing levels of FZLVL airmet/outlook.
|
||||
* Such levels are retrievable as gfa.getGfaValue( Gfa.LEVEL ).
|
||||
*/
|
||||
private int[] findFzlvlLevelRange( List<Gfa> all, List<Gfa> selected, String area ) {
|
||||
private int[] findFzlvlLevelRange(List<Gfa> all, List<Gfa> selected,
|
||||
String area) {
|
||||
|
||||
int[] topBot = { -1, 9999 };
|
||||
for (Gfa elem : selected) {
|
||||
|
@ -624,27 +629,23 @@ public class GfaGenerate {
|
|||
if (levelStr.equalsIgnoreCase("SFC")) {
|
||||
top2 = 40;
|
||||
bot2 = 0;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
try {
|
||||
lvl = Integer.parseInt(levelStr);
|
||||
}
|
||||
catch ( Exception e ) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (lvl >= 0 && lvl <= 40) {
|
||||
top2 = 40;
|
||||
bot2 = 0;
|
||||
}
|
||||
else {
|
||||
} 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);
|
||||
|
@ -657,25 +658,28 @@ public class GfaGenerate {
|
|||
}
|
||||
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*
|
||||
* Note (1) only FZLVLs are used, not M_FZLVLs.
|
||||
* (2) All FZLVLs are used, including snapshots.
|
||||
*
|
||||
* Note (1) only FZLVLs are used, not M_FZLVLs. (2) All FZLVLs are used,
|
||||
* including snapshots.
|
||||
*/
|
||||
private int[] findExernalFzlvlRange(List<Gfa> all, String area) {
|
||||
|
||||
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;
|
||||
double minDist = Double.MAX_VALUE;
|
||||
|
@ -698,8 +702,8 @@ public class GfaGenerate {
|
|||
}
|
||||
|
||||
if (closestGfa != null) {
|
||||
boolean isLeft = GfaSnap.getInstance().atLeft( center, closestGfa.getLinePoints(),
|
||||
closestGfa.isClosedLine(), 0.0 );
|
||||
boolean isLeft = GfaSnap.getInstance().atLeft(center,
|
||||
closestGfa.getLinePoints(), closestGfa.isClosedLine(), 0.0);
|
||||
|
||||
String levelStr = closestGfa.getGfaValue(Gfa.LEVEL);
|
||||
int lvl = -1;
|
||||
|
@ -708,12 +712,10 @@ public class GfaGenerate {
|
|||
|
||||
if (levelStr.equalsIgnoreCase("SFC")) {
|
||||
lvl = 0;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
try {
|
||||
lvl = Integer.parseInt(levelStr);
|
||||
}
|
||||
catch ( Exception e ) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -723,11 +725,11 @@ public class GfaGenerate {
|
|||
if (!isLeft) { // FZLVL is at right of FA area
|
||||
topBot[0] = lvl + 40;
|
||||
topBot[1] = lvl;
|
||||
}
|
||||
else { // FZLVL is at left of FA area
|
||||
} else { // FZLVL is at left of FA area
|
||||
topBot[0] = lvl;
|
||||
topBot[1] = lvl - 40;
|
||||
if ( topBot[1] < 0 ) topBot[1] = 0;
|
||||
if (topBot[1] < 0)
|
||||
topBot[1] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -744,12 +746,10 @@ public class GfaGenerate {
|
|||
StringBuilder str = new StringBuilder();
|
||||
if (value <= 0) {
|
||||
str.append("SFC");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (value < 100) {
|
||||
str.append("0" + value);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
str.append(value);
|
||||
}
|
||||
}
|
||||
|
@ -774,14 +774,12 @@ public class GfaGenerate {
|
|||
if (gfa.isClosedLine()) {
|
||||
dist = PgenResource.distanceFromLineSegment(loc,
|
||||
(Coordinate) pts[ii], (Coordinate) pts[0]);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
dist = PgenResource.distanceFromLineSegment( loc, (Coordinate) pts[ii],
|
||||
(Coordinate) pts[ii + 1]);
|
||||
} else {
|
||||
dist = PgenResource.distanceFromLineSegment(loc,
|
||||
(Coordinate) pts[ii], (Coordinate) pts[ii + 1]);
|
||||
}
|
||||
|
||||
if (dist < minDist) {
|
||||
|
@ -794,12 +792,17 @@ public class GfaGenerate {
|
|||
}
|
||||
|
||||
/**
|
||||
* Find if a smear has an associated outlook that are generated from the same series of
|
||||
* snapshots (with same hazard type, tag and desk.
|
||||
* Find if a smear has an associated outlook that are generated from the
|
||||
* 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
|
||||
* the same series of snapshots, and the airmet's issue tyep is "NRML" while outlook's issue
|
||||
* type is not "NRML". In this case, the formatted header should show the outlook's issue type.
|
||||
* This is used to get around the issue when a pair of airmet and outlook is
|
||||
* generated from the same series of snapshots, and the airmet'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
|
||||
* @return
|
||||
|
@ -809,12 +812,17 @@ public class GfaGenerate {
|
|||
for (Gfa gg : all) {
|
||||
gg.setGfaValue(ISSUE_TYPE_FROM_OUTLOOK, "NRML");
|
||||
if (gg.isAirmet() && "NRML".equalsIgnoreCase(gg.getGfaIssueType())) {
|
||||
String akey = gg.getGfaHazard() + gg.getGfaTag() + gg.getGfaDesk();
|
||||
String akey = gg.getGfaHazard() + gg.getGfaTag()
|
||||
+ gg.getGfaDesk();
|
||||
for (Gfa gotlk : all) {
|
||||
if ( gotlk.isOutlook() && !("NRML".equalsIgnoreCase( gotlk.getGfaIssueType() ) ) ) {
|
||||
String okey = gotlk.getGfaHazard() + gotlk.getGfaTag() + gotlk.getGfaDesk();
|
||||
if (gotlk.isOutlook()
|
||||
&& !("NRML".equalsIgnoreCase(gotlk
|
||||
.getGfaIssueType()))) {
|
||||
String okey = gotlk.getGfaHazard() + gotlk.getGfaTag()
|
||||
+ gotlk.getGfaDesk();
|
||||
if (okey.equals(akey)) {
|
||||
gg.setGfaValue( ISSUE_TYPE_FROM_OUTLOOK, gotlk.getGfaIssueType() );
|
||||
gg.setGfaValue(ISSUE_TYPE_FROM_OUTLOOK,
|
||||
gotlk.getGfaIssueType());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,12 @@
|
|||
*/
|
||||
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 java.awt.Color;
|
||||
|
@ -20,8 +26,6 @@ import org.dom4j.Node;
|
|||
import org.dom4j.io.SAXReader;
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
|
||||
import static gov.noaa.nws.ncep.ui.pgen.gfa.Gfa.*;
|
||||
|
||||
/**
|
||||
* Helper class to read the GFA configuration.
|
||||
*
|
||||
|
@ -45,26 +49,34 @@ public class GfaInfo {
|
|||
private static Document doc;
|
||||
|
||||
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 GFA_SNAPSHOT = "snapshot";
|
||||
|
||||
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 int GFA_OUTLOOK_LINEWIDTH = 4;
|
||||
|
||||
public static final int GFA_OTHER_LINEWIDTH = 2;
|
||||
|
||||
|
||||
/**
|
||||
* Hazard type vs color array (index means the same as the position
|
||||
* in fcstHr combo box)
|
||||
* Hazard type vs color array (index means the same as the position in
|
||||
* fcstHr combo box)
|
||||
*/
|
||||
private static HashMap<String, RGB[]> rgbMap;
|
||||
|
||||
|
@ -109,7 +121,8 @@ public class GfaInfo {
|
|||
*/
|
||||
private static void readOptions() {
|
||||
File gfainfoFile = PgenStaticDataProvider.getProvider().getStaticFile(
|
||||
PgenStaticDataProvider.getProvider().getPgenLocalizationRoot() + "gfa.xml");
|
||||
PgenStaticDataProvider.getProvider().getPgenLocalizationRoot()
|
||||
+ "gfa.xml");
|
||||
|
||||
try {
|
||||
SAXReader reader = new SAXReader();
|
||||
|
@ -243,8 +256,7 @@ public class GfaInfo {
|
|||
gfaType = GFA_OUTLOOK;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
gfaType = fcsthrNodes.get(0).valueOf("@type"); // from table
|
||||
}
|
||||
|
||||
|
@ -271,9 +283,9 @@ public class GfaInfo {
|
|||
|
||||
int lineWidth = GFA_OTHER_LINEWIDTH;
|
||||
if (fcsthrNodes.size() > 0) {
|
||||
lineWidth = Integer.parseInt( fcsthrNodes.get(0).valueOf("@linewidth") );
|
||||
}
|
||||
else {
|
||||
lineWidth = Integer.parseInt(fcsthrNodes.get(0).valueOf(
|
||||
"@linewidth"));
|
||||
} else {
|
||||
if (fcstHr.indexOf("-") >= 0) {
|
||||
String second = fcstHr.split("-")[1];
|
||||
String hour = second.split(":")[0];
|
||||
|
@ -310,8 +322,10 @@ public class GfaInfo {
|
|||
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;
|
||||
HazardCategory cat = HazardCategory.valueOf(
|
||||
HazardCategory.class, category);
|
||||
if (cat == null)
|
||||
cat = HazardCategory.NONE;
|
||||
hazardCategories.put(key, cat);
|
||||
}
|
||||
}
|
||||
|
@ -337,41 +351,41 @@ public class GfaInfo {
|
|||
if (stateOrderByArea == null) {
|
||||
stateOrderByArea = new HashMap<String, ArrayList<String>>();
|
||||
ArrayList<String> bos = new ArrayList<String>();
|
||||
String[] bosStr = new String[]{"ME","NH","VT","MA","RI","CT","NY",
|
||||
"LO","PA","NJ","OH","LE","WV","MD",
|
||||
"DC", "DE", "VA", "CSTL WTRS"};
|
||||
String[] bosStr = new String[] { "ME", "NH", "VT", "MA", "RI",
|
||||
"CT", "NY", "LO", "NJ", "PA", "OH", "LE", "WV", "MD", "DC",
|
||||
"DE", "VA", "CSTL WTRS" };
|
||||
for (String st : bosStr) {
|
||||
bos.add(st);
|
||||
}
|
||||
stateOrderByArea.put(BOS, bos);
|
||||
|
||||
ArrayList<String> mia = new ArrayList<String>();
|
||||
String[] miaStr = new String[]{"NC", "SC", "GA", "FL" , "CSTL WTRS"};
|
||||
String[] miaStr = new String[] { "NC", "SC", "GA", "FL",
|
||||
"CSTL WTRS" };
|
||||
for (String st : miaStr) {
|
||||
mia.add(st);
|
||||
}
|
||||
stateOrderByArea.put(MIA, mia);
|
||||
|
||||
ArrayList<String> chi = new ArrayList<String>();
|
||||
String[] chiStr = new String[]{"ND", "SD", "NE", "KS", "MN", "IA",
|
||||
"MO", "WI", "LM", "LS", "MI", "LH",
|
||||
"IL", "IN", "KY"};
|
||||
String[] chiStr = new String[] { "ND", "SD", "NE", "KS", "MN",
|
||||
"IA", "MO", "WI", "LM", "LS", "MI", "LH", "IL", "IN", "KY" };
|
||||
for (String st : chiStr) {
|
||||
chi.add(st);
|
||||
}
|
||||
stateOrderByArea.put(CHI, chi);
|
||||
|
||||
ArrayList<String> dfw = new ArrayList<String>();
|
||||
String[] dfwStr = new String[]{"OK", "TX", "AR", "TN", "LA", "MS",
|
||||
"AL", "CSTL WTRS"};
|
||||
String[] dfwStr = new String[] { "OK", "TX", "AR", "TN", "LA",
|
||||
"MS", "AL", "CSTL WTRS" };
|
||||
for (String st : dfwStr) {
|
||||
dfw.add(st);
|
||||
}
|
||||
stateOrderByArea.put(DFW, dfw);
|
||||
|
||||
ArrayList<String> slc = new ArrayList<String>();
|
||||
String[] slcStr = new String[]{"ID", "MT", "WY", "NV", "UT", "CO",
|
||||
"AZ", "NM"} ;
|
||||
String[] slcStr = new String[] { "ID", "MT", "WY", "NV", "UT",
|
||||
"CO", "AZ", "NM" };
|
||||
for (String st : slcStr) {
|
||||
slc.add(st);
|
||||
}
|
||||
|
@ -390,8 +404,7 @@ public class GfaInfo {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get colors for FZLVL SFC snapshot, smear, or outlook.
|
||||
* Default is "sky".
|
||||
* Get colors for FZLVL SFC snapshot, smear, or outlook. Default is "sky".
|
||||
*/
|
||||
public static RGB getFzlvlSfcColor(String name) {
|
||||
|
||||
|
@ -404,13 +417,15 @@ public class GfaInfo {
|
|||
if (fzlvlSfcColors == null) {
|
||||
fzlvlSfcColors = new HashMap<String, RGB>();
|
||||
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);
|
||||
|
||||
if ( clr == null ) clr = definedColors.get( "sky" );
|
||||
if (clr == null)
|
||||
clr = definedColors.get("sky");
|
||||
|
||||
return clr;
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -27,11 +27,9 @@ import org.eclipse.swt.layout.GridLayout;
|
|||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
|
||||
/**
|
||||
* This class controls PGEN layering in National Centers perspective.
|
||||
*
|
||||
|
@ -54,21 +52,25 @@ public class PgenLayeringControlDialog extends PgenLayeringDialog {
|
|||
* Default color for the active layer name button.
|
||||
*/
|
||||
private final Color defaultLayerButtonColor = Color.lightGray;
|
||||
|
||||
private final Color activeLayerButtonColor = Color.green;
|
||||
|
||||
/**
|
||||
* Layer name edit dialog.
|
||||
*/
|
||||
protected PgenLayeringNameDialog layerNameDlg = null;
|
||||
protected PgenLayeringDisplayDialog displayDlg = null;
|
||||
|
||||
protected PgenLayeringDisplayDialog displayDlg = null;
|
||||
|
||||
/**
|
||||
* List of layers and buttons.
|
||||
*/
|
||||
private ArrayList<Layer> layerList = null;
|
||||
|
||||
private ArrayList<Button> layerNameBtns = null;
|
||||
|
||||
private ArrayList<Button> displayOnOffBtns = null;
|
||||
|
||||
private ArrayList<Button> colorModeBtns = null;
|
||||
|
||||
private Button allOnOffBtn = null;
|
||||
|
@ -77,14 +79,18 @@ public class PgenLayeringControlDialog extends PgenLayeringDialog {
|
|||
* The layer & color mode button in use.
|
||||
*/
|
||||
private int layerInUse = -1;
|
||||
|
||||
private int colorModeBtnInUse = -1;
|
||||
|
||||
private boolean allOnOff = false;
|
||||
|
||||
/**
|
||||
* Open dialog in compact mode or full mode.
|
||||
*/
|
||||
private Button arrowBtn = null;
|
||||
|
||||
boolean compact = true;
|
||||
|
||||
boolean openNameDialog = false;
|
||||
|
||||
/**
|
||||
|
@ -94,7 +100,6 @@ public class PgenLayeringControlDialog extends PgenLayeringDialog {
|
|||
super(parentShell);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the title of the dialog.
|
||||
*/
|
||||
|
@ -102,9 +107,9 @@ public class PgenLayeringControlDialog extends PgenLayeringDialog {
|
|||
shell.setText("Layering");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the default location.
|
||||
*
|
||||
* @param parent
|
||||
*/
|
||||
public void setDefaultLocation(Shell parent) {
|
||||
|
@ -112,8 +117,7 @@ public class PgenLayeringControlDialog extends PgenLayeringDialog {
|
|||
if (shellLocation == null) {
|
||||
Point pt = parent.getLocation();
|
||||
shell.setLocation(pt.x + 255, pt.y + 146);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
shell.setLocation(shellLocation);
|
||||
}
|
||||
|
||||
|
@ -128,7 +132,6 @@ public class PgenLayeringControlDialog extends PgenLayeringDialog {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialize the dialog components.
|
||||
*/
|
||||
|
@ -186,7 +189,6 @@ public class PgenLayeringControlDialog extends PgenLayeringDialog {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
if (!compact) {
|
||||
|
||||
Button editNameBtn = new Button(centeredComp, SWT.NONE);
|
||||
|
@ -215,8 +217,7 @@ public class PgenLayeringControlDialog extends PgenLayeringDialog {
|
|||
|
||||
if (compact) {
|
||||
arrowBtn.setText(">>");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
arrowBtn.setText("<<");
|
||||
}
|
||||
|
||||
|
@ -227,8 +228,7 @@ public class PgenLayeringControlDialog extends PgenLayeringDialog {
|
|||
|
||||
if (compact) {
|
||||
arrowBtn.setText("<<");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
arrowBtn.setText(">>");
|
||||
}
|
||||
|
||||
|
@ -240,7 +240,6 @@ public class PgenLayeringControlDialog extends PgenLayeringDialog {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Create name, on/off, and color mode buttons for one layer
|
||||
*/
|
||||
|
@ -269,7 +268,8 @@ public class PgenLayeringControlDialog extends PgenLayeringDialog {
|
|||
nameBtn.setData(ii);
|
||||
nameBtn.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
switchLayer( Integer.parseInt( event.widget.getData().toString() ) );
|
||||
switchLayer(Integer.parseInt(event.widget.getData()
|
||||
.toString()));
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -280,7 +280,8 @@ public class PgenLayeringControlDialog extends PgenLayeringDialog {
|
|||
dispBtn.setData(ii);
|
||||
dispBtn.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
turnOnDisplay( Integer.parseInt( event.widget.getData().toString() ) );
|
||||
turnOnDisplay(Integer.parseInt(event.widget.getData()
|
||||
.toString()));
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -288,19 +289,16 @@ public class PgenLayeringControlDialog extends PgenLayeringDialog {
|
|||
|
||||
if (!compact) {
|
||||
Button clrBtn = new Button(layersComp, SWT.PUSH);
|
||||
if ( lyr.isMonoColor() ) {
|
||||
clrBtn.setText( "M/F" );
|
||||
}
|
||||
else {
|
||||
clrBtn.setText( "A/F" );
|
||||
}
|
||||
clrBtn.setText(getDisplayString(lyr.isMonoColor(),
|
||||
lyr.isFilled()));
|
||||
|
||||
setButtonColor(clrBtn, lyr.getColor());
|
||||
clrBtn.setData(ii);
|
||||
|
||||
clrBtn.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
colorModeBtnInUse = Integer.parseInt( event.widget.getData().toString() );
|
||||
colorModeBtnInUse = Integer.parseInt(event.widget
|
||||
.getData().toString());
|
||||
editDisplayAttr();
|
||||
}
|
||||
|
||||
|
@ -330,7 +328,6 @@ public class PgenLayeringControlDialog extends PgenLayeringDialog {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialize the product in the PgenResource.
|
||||
*/
|
||||
|
@ -339,7 +336,8 @@ public class PgenLayeringControlDialog extends PgenLayeringDialog {
|
|||
if (currentProduct == null) {
|
||||
|
||||
currentProduct = new Product("Default", "Default", "Default",
|
||||
new ProductInfo(), new ProductTime(), new ArrayList<Layer>() );
|
||||
new ProductInfo(), new ProductTime(),
|
||||
new ArrayList<Layer>());
|
||||
|
||||
drawingLayer.addProduct(currentProduct);
|
||||
drawingLayer.setActiveProduct(currentProduct);
|
||||
|
@ -368,7 +366,6 @@ public class PgenLayeringControlDialog extends PgenLayeringDialog {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Update the active layer with a new name;
|
||||
*/
|
||||
|
@ -377,9 +374,9 @@ public class PgenLayeringControlDialog extends PgenLayeringDialog {
|
|||
boolean update = false;
|
||||
|
||||
/*
|
||||
* Update only if the new layer name is not empty and not
|
||||
* the same as the layer names on the current product.
|
||||
* Also, the name should not be any variations of "Default".
|
||||
* Update only if the new layer name is not empty and not the same as
|
||||
* the layer names on the current product. Also, the name should not be
|
||||
* any variations of "Default".
|
||||
*
|
||||
* Note: we assume the layer names should be unique within a product.
|
||||
*/
|
||||
|
@ -397,10 +394,9 @@ public class PgenLayeringControlDialog extends PgenLayeringDialog {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Rebuilds and opens the layering control dialog since the size
|
||||
* of the button will change with the length of the new name.
|
||||
* Rebuilds and opens the layering control dialog since the size of the
|
||||
* button will change with the length of the new name.
|
||||
*/
|
||||
if (update) {
|
||||
|
||||
|
@ -426,13 +422,8 @@ public class PgenLayeringControlDialog extends PgenLayeringDialog {
|
|||
protected void updateDisplayAttr(boolean mono, Color clr, boolean fill) {
|
||||
|
||||
if (colorModeBtnInUse >= 0) {
|
||||
|
||||
if ( mono ) {
|
||||
colorModeBtns.get( colorModeBtnInUse ).setText( "M/F" );
|
||||
}
|
||||
else {
|
||||
colorModeBtns.get( colorModeBtnInUse ).setText( "A/F" );
|
||||
}
|
||||
colorModeBtns.get(colorModeBtnInUse).setText(
|
||||
getDisplayString(mono, fill));
|
||||
|
||||
layerList.get(colorModeBtnInUse).setMonoColor(mono);
|
||||
layerList.get(colorModeBtnInUse).setColor(clr);
|
||||
|
@ -471,8 +462,10 @@ public class PgenLayeringControlDialog extends PgenLayeringDialog {
|
|||
/*
|
||||
* Pop up layer name editing window
|
||||
*/
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
||||
if ( layerNameDlg == null) layerNameDlg = new PgenLayeringNameDialog( shell, this );
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
if (layerNameDlg == null)
|
||||
layerNameDlg = new PgenLayeringNameDialog(shell, this);
|
||||
|
||||
if (layerNameDlg != null && !(layerNameDlg.isOpen())) {
|
||||
layerNameDlg.open();
|
||||
|
@ -488,8 +481,10 @@ public class PgenLayeringControlDialog extends PgenLayeringDialog {
|
|||
/*
|
||||
* Pop up layer name editing window
|
||||
*/
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
||||
if ( displayDlg == null) displayDlg = new PgenLayeringDisplayDialog( shell, this );
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
if (displayDlg == null)
|
||||
displayDlg = new PgenLayeringDisplayDialog(shell, this);
|
||||
|
||||
if ((displayDlg.isOpen())) {
|
||||
displayDlg.close();
|
||||
|
@ -499,7 +494,6 @@ public class PgenLayeringControlDialog extends PgenLayeringDialog {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a new layer.
|
||||
*/
|
||||
|
@ -512,7 +506,6 @@ public class PgenLayeringControlDialog extends PgenLayeringDialog {
|
|||
int size1 = layerList.size() + 1;
|
||||
String name = new String("Layer_" + size1);
|
||||
|
||||
|
||||
for (int ii = 0; ii < layerList.size(); ii++) {
|
||||
if (name.equals(layerList.get(ii).getName())) {
|
||||
name = new String("Layer_" + (size1++));
|
||||
|
@ -545,7 +538,8 @@ public class PgenLayeringControlDialog extends PgenLayeringDialog {
|
|||
|
||||
if (!newLayer.equals(clayer)) {
|
||||
for (int ii = 0; ii < layerNameBtns.size(); ii++) {
|
||||
if ( layerNameBtns.get(ii).getText().replace("&&", "&").equals( newLayer ) ) {
|
||||
if (layerNameBtns.get(ii).getText().replace("&&", "&")
|
||||
.equals(newLayer)) {
|
||||
which = ii;
|
||||
break;
|
||||
}
|
||||
|
@ -558,7 +552,6 @@ public class PgenLayeringControlDialog extends PgenLayeringDialog {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Switch between layer.
|
||||
*/
|
||||
|
@ -576,8 +569,10 @@ public class PgenLayeringControlDialog extends PgenLayeringDialog {
|
|||
layerList.get(layerInUse).setInUse(true);
|
||||
// layerList.get( layerInUse ).setOnOff( true );
|
||||
|
||||
if ( layerNameDlg != null ) layerNameDlg.close();
|
||||
if ( displayDlg != null ) displayDlg.close();
|
||||
if (layerNameDlg != null)
|
||||
layerNameDlg.close();
|
||||
if (displayDlg != null)
|
||||
displayDlg.close();
|
||||
openNameDialog = false;
|
||||
|
||||
currentLayer = layerList.get(layerInUse);
|
||||
|
@ -591,12 +586,11 @@ public class PgenLayeringControlDialog extends PgenLayeringDialog {
|
|||
if (GfaAttrDlg.getInstance(this.getParent()).isGfaOpen()) {
|
||||
if (drawingLayer.getSelectedDE() != null) {
|
||||
GfaAttrDlg.getInstance(this.getParent()).close();
|
||||
} else {
|
||||
GfaAttrDlg.getInstance(this.getParent()).switchHazard(
|
||||
currentLayer.getName());
|
||||
}
|
||||
else {
|
||||
GfaAttrDlg.getInstance( this.getParent() ).switchHazard( currentLayer.getName() );
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
PgenUtil.setSelectingMode();
|
||||
}
|
||||
|
||||
|
@ -618,12 +612,12 @@ public class PgenLayeringControlDialog extends PgenLayeringDialog {
|
|||
displayOnOffBtns.get(which).setSelection(true);
|
||||
}
|
||||
|
||||
layerList.get( which ).setOnOff( displayOnOffBtns.get( which ).getSelection() );
|
||||
layerList.get(which).setOnOff(
|
||||
displayOnOffBtns.get(which).getSelection());
|
||||
|
||||
PgenUtil.refresh();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Toggle the display on/off for all check buttons.
|
||||
*/
|
||||
|
@ -632,8 +626,7 @@ public class PgenLayeringControlDialog extends PgenLayeringDialog {
|
|||
if (allOnOff) {
|
||||
allOnOff = false;
|
||||
allOnOffBtn.setText("All On");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
allOnOff = true;
|
||||
allOnOffBtn.setText("All Off");
|
||||
}
|
||||
|
@ -654,7 +647,6 @@ public class PgenLayeringControlDialog extends PgenLayeringDialog {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the name of the layer on which the color mode button is clicked.
|
||||
*/
|
||||
|
@ -667,7 +659,6 @@ public class PgenLayeringControlDialog extends PgenLayeringDialog {
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Exit layering.
|
||||
*/
|
||||
|
@ -707,8 +698,10 @@ public class PgenLayeringControlDialog extends PgenLayeringDialog {
|
|||
/*
|
||||
* Dispose all layering dialogs.
|
||||
*/
|
||||
if ( layerNameDlg != null ) layerNameDlg.close();
|
||||
if ( displayDlg != null ) displayDlg.close();
|
||||
if (layerNameDlg != null)
|
||||
layerNameDlg.close();
|
||||
if (displayDlg != null)
|
||||
displayDlg.close();
|
||||
|
||||
close();
|
||||
// shell.dispose();
|
||||
|
@ -763,7 +756,7 @@ public class PgenLayeringControlDialog extends PgenLayeringDialog {
|
|||
|
||||
// Close the dialog first.
|
||||
if (isOpen()) {
|
||||
shell.dispose();
|
||||
close();
|
||||
}
|
||||
|
||||
// Close other dialogs as well.
|
||||
|
@ -784,4 +777,25 @@ public class PgenLayeringControlDialog extends PgenLayeringDialog {
|
|||
exitLayering();
|
||||
}
|
||||
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -179,7 +179,7 @@ public class ProductManageDialog extends ProductDialog {
|
|||
* Sets the title of the dialog.
|
||||
*/
|
||||
public void setTitle() {
|
||||
shell.setText("Product Center");
|
||||
shell.setText("Activity Center");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -319,7 +319,7 @@ public class ProductManageDialog extends ProductDialog {
|
|||
titleComp.setLayout(gl0);
|
||||
|
||||
Label prds = new Label(titleComp, SWT.NONE);
|
||||
prds.setText("Products:");
|
||||
prds.setText("Activities:");
|
||||
|
||||
/*
|
||||
* if ( !compact ) { Button multiSaveBtn = new Button( titleComp,
|
||||
|
@ -745,12 +745,8 @@ public class ProductManageDialog extends ProductDialog {
|
|||
|
||||
if (!compact) {
|
||||
Button clrBtn = new Button(layersComp, SWT.PUSH);
|
||||
if (lyr.isMonoColor()) {
|
||||
clrBtn.setText("M/F");
|
||||
} else {
|
||||
clrBtn.setText("A/F");
|
||||
}
|
||||
|
||||
clrBtn.setText(getDisplayString(lyr.isMonoColor(),
|
||||
lyr.isFilled()));
|
||||
setButtonColor(clrBtn, lyr.getColor());
|
||||
clrBtn.setData(ii);
|
||||
|
||||
|
@ -852,12 +848,8 @@ public class ProductManageDialog extends ProductDialog {
|
|||
protected void updateDisplayAttr(boolean mono, Color clr, boolean fill) {
|
||||
|
||||
if (colorModeBtnInUse >= 0) {
|
||||
|
||||
if (mono) {
|
||||
colorModeBtns.get(colorModeBtnInUse).setText("M/F");
|
||||
} else {
|
||||
colorModeBtns.get(colorModeBtnInUse).setText("A/F");
|
||||
}
|
||||
colorModeBtns.get(colorModeBtnInUse).setText(
|
||||
getDisplayString(mono, fill));
|
||||
|
||||
layerList.get(colorModeBtnInUse).setMonoColor(mono);
|
||||
layerList.get(colorModeBtnInUse).setColor(clr);
|
||||
|
@ -2188,4 +2180,25 @@ public class ProductManageDialog extends ProductDialog {
|
|||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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.ProductType;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.awt.Color;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
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.Event;
|
||||
import org.eclipse.swt.widgets.FileDialog;
|
||||
import org.eclipse.swt.widgets.Group;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
import org.eclipse.swt.widgets.Menu;
|
||||
import org.eclipse.swt.widgets.MenuItem;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
import org.eclipse.swt.widgets.Group;
|
||||
import org.eclipse.swt.widgets.ToolBar;
|
||||
import org.eclipse.swt.widgets.ToolItem;
|
||||
|
||||
|
@ -61,21 +61,29 @@ import org.eclipse.swt.widgets.ToolItem;
|
|||
public class ProductNameDialog extends ProductDialog {
|
||||
|
||||
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 ProductManageDialog prdManageDlg = null;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
|
@ -91,7 +99,7 @@ public class ProductNameDialog extends ProductDialog {
|
|||
* Sets the title of the dialog.
|
||||
*/
|
||||
public void setTitle() {
|
||||
shell.setText( "Edit Product" );
|
||||
shell.setText("Edit Activity");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -106,9 +114,9 @@ public class ProductNameDialog extends ProductDialog {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the default location.
|
||||
*
|
||||
* @param parent
|
||||
*/
|
||||
public void setDefaultLocation(Shell parent) {
|
||||
|
@ -122,13 +130,13 @@ public class ProductNameDialog extends ProductDialog {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialize the dialog components.
|
||||
*/
|
||||
public void initializeComponents() {
|
||||
|
||||
// initialOutput = prdManageDlg.getPrdOutputFile( prdManageDlg.getActiveProduct() );
|
||||
// initialOutput = prdManageDlg.getPrdOutputFile(
|
||||
// prdManageDlg.getActiveProduct() );
|
||||
initialOutput = prdManageDlg.getActiveProduct().getOutputFile();
|
||||
|
||||
Composite main = new Composite(shell, SWT.NONE);
|
||||
|
@ -188,11 +196,12 @@ public class ProductNameDialog extends ProductDialog {
|
|||
for (String ptypName : prdManageDlg.prdTypesMap.keySet()) {
|
||||
|
||||
ProductType prdType = prdManageDlg.prdTypesMap.get(ptypName);
|
||||
LinkedHashMap<String, String> subtypesNalias = prdManageDlg.getSubtypes( prdType.getType(), true );
|
||||
LinkedHashMap<String, String> subtypesNalias = prdManageDlg
|
||||
.getSubtypes(prdType.getType(), true);
|
||||
|
||||
if ( (ptypName.equals( prdType.getName() ) &&
|
||||
!prdType.getType().equals( prdType.getName() ) ) ||
|
||||
!prdManageDlg.hasSubtypes( subtypesNalias.values() ) ) {
|
||||
if ((ptypName.equals(prdType.getName()) && !prdType.getType()
|
||||
.equals(prdType.getName()))
|
||||
|| !prdManageDlg.hasSubtypes(subtypesNalias.values())) {
|
||||
|
||||
MenuItem typeItem = new MenuItem(mu, SWT.PUSH, ntyp);
|
||||
|
||||
|
@ -200,7 +209,8 @@ public class ProductNameDialog extends ProductDialog {
|
|||
typeItem.setData(ptypName);
|
||||
typeItem.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
String typeName = ((MenuItem)e.widget).getData().toString();
|
||||
String typeName = ((MenuItem) e.widget).getData()
|
||||
.toString();
|
||||
typeText.setText(typeName);
|
||||
typeText.pack();
|
||||
typeComp.pack();
|
||||
|
@ -209,13 +219,11 @@ public class ProductNameDialog extends ProductDialog {
|
|||
}
|
||||
});
|
||||
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
|
||||
if (typeUsed.contains(prdType.getType())) {
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
typeUsed.add(prdType.getType());
|
||||
|
||||
}
|
||||
|
@ -234,7 +242,8 @@ public class ProductNameDialog extends ProductDialog {
|
|||
|
||||
subtypeItem.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
String typeName = ((MenuItem)e.widget).getData().toString();
|
||||
String typeName = ((MenuItem) e.widget).getData()
|
||||
.toString();
|
||||
typeText.setText(typeName);
|
||||
typeText.pack();
|
||||
typeComp.pack();
|
||||
|
@ -252,7 +261,8 @@ public class ProductNameDialog extends ProductDialog {
|
|||
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 );
|
||||
Point point = typeToolBar.toDisplay(bounds.x, bounds.y
|
||||
+ bounds.height);
|
||||
mu.setLocation(point);
|
||||
mu.setVisible(true);
|
||||
}
|
||||
|
@ -288,7 +298,8 @@ public class ProductNameDialog extends ProductDialog {
|
|||
psave.setText("Save Layers:");
|
||||
|
||||
saveLayerBtn = new Button(bot1, SWT.CHECK);
|
||||
saveLayerBtn.setSelection( prdManageDlg.getActiveProduct().isSaveLayers() );
|
||||
saveLayerBtn.setSelection(prdManageDlg.getActiveProduct()
|
||||
.isSaveLayers());
|
||||
|
||||
// Create a composite for output file name
|
||||
Label outputLbl = new Label(bot2, SWT.LEFT);
|
||||
|
@ -300,8 +311,7 @@ public class ProductNameDialog extends ProductDialog {
|
|||
|
||||
if (initialOutput != null) {
|
||||
outputFileTxt.setText(initialOutput);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
outputFileTxt.setText("");
|
||||
}
|
||||
|
||||
|
@ -351,7 +361,6 @@ public class ProductNameDialog extends ProductDialog {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Update the product attributes in the product control window.
|
||||
*/
|
||||
|
@ -367,8 +376,7 @@ public class ProductNameDialog extends ProductDialog {
|
|||
attr.put("center", centerText.getText());
|
||||
if (saveLayerBtn.getSelection()) {
|
||||
attr.put("saveLayers", "true");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
attr.put("saveLayers", "false");
|
||||
}
|
||||
attr.put("outputfile", outputFileTxt.getText());
|
||||
|
@ -379,27 +387,26 @@ public class ProductNameDialog extends ProductDialog {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Select a product type with confirmation.
|
||||
*/
|
||||
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(),
|
||||
"Confirm type", null,
|
||||
"Are you sure you want to switch from type " +
|
||||
prdManageDlg.getActiveProduct().getType()
|
||||
+ " to type " + typeCombo.getText() + "?",
|
||||
MessageDialog.QUESTION, new String[]{"OK", "Cancel"}, 0);
|
||||
|
||||
confirmDlg.open();
|
||||
|
||||
if ( confirmDlg.getReturnCode() != MessageDialog.OK ) {
|
||||
typeCombo.select( curType );
|
||||
}
|
||||
* MessageDialog confirmDlg = new MessageDialog(
|
||||
* PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
|
||||
* "Confirm type", null,
|
||||
* "Are you sure you want to switch from type " +
|
||||
* prdManageDlg.getActiveProduct().getType() + " to type " +
|
||||
* typeCombo.getText() + "?", MessageDialog.QUESTION, new
|
||||
* String[]{"OK", "Cancel"}, 0);
|
||||
*
|
||||
* confirmDlg.open();
|
||||
*
|
||||
* if ( confirmDlg.getReturnCode() != MessageDialog.OK ) {
|
||||
* typeCombo.select( curType ); }
|
||||
*/
|
||||
|
||||
// typeCombo.select( curType );
|
||||
|
@ -424,10 +431,10 @@ public class ProductNameDialog extends ProductDialog {
|
|||
if (initialFile != null) {
|
||||
int index = initialFile.lastIndexOf('/');
|
||||
if (index >= 0) {
|
||||
defaultFile = initialFile.substring( index+1, initialFile.length() );
|
||||
defaultFile = initialFile.substring(index + 1,
|
||||
initialFile.length());
|
||||
filterPath = initialFile.substring(0, index);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
defaultFile = new String(initialFile);
|
||||
}
|
||||
}
|
||||
|
@ -453,8 +460,8 @@ public class ProductNameDialog extends ProductDialog {
|
|||
* @return dialog.open()
|
||||
*/
|
||||
private String selectFile(Shell sh, int mode, String[] nameFilter,
|
||||
String[] extensionFilter, String pathFilter,
|
||||
String defaultFile, boolean overWrite ) {
|
||||
String[] extensionFilter, String pathFilter, String defaultFile,
|
||||
boolean overWrite) {
|
||||
|
||||
FileDialog dialog = new FileDialog(sh, mode);
|
||||
dialog.setFilterNames(nameFilter);
|
||||
|
@ -483,8 +490,8 @@ public class ProductNameDialog extends ProductDialog {
|
|||
shell.pack(true);
|
||||
|
||||
ProductType prdtype = prdManageDlg.prdTypesMap.get(typ);
|
||||
if ( prdtype == null || prdtype.getPgenLayer() == null ||
|
||||
prdtype.getPgenLayer().size() <= 0 ) {
|
||||
if (prdtype == null || prdtype.getPgenLayer() == null
|
||||
|| prdtype.getPgenLayer().size() <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -510,10 +517,9 @@ public class ProductNameDialog extends ProductDialog {
|
|||
Button clrBtn = new Button(layersComp, SWT.PUSH);
|
||||
clrBtn.setText("A/F");
|
||||
|
||||
Color clr = new Color( lyr.getColor().getRed(),
|
||||
lyr.getColor().getGreen(),
|
||||
lyr.getColor().getBlue(),
|
||||
lyr.getColor().getAlpha() );
|
||||
Color clr = new Color(lyr.getColor().getRed(), lyr.getColor()
|
||||
.getGreen(), lyr.getColor().getBlue(), lyr.getColor()
|
||||
.getAlpha());
|
||||
|
||||
setButtonColor(clrBtn, clr);
|
||||
}
|
||||
|
@ -522,7 +528,6 @@ public class ProductNameDialog extends ProductDialog {
|
|||
shell.pack(true);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Switch to a new type
|
||||
*/
|
||||
|
@ -543,14 +548,12 @@ public class ProductNameDialog extends ProductDialog {
|
|||
outputFileTxt.setText(ptyp.getPgenSave().getOutputFile());
|
||||
}
|
||||
if (ptyp.getPgenSave().isSaveLayers() != null) {
|
||||
saveLayerBtn.setSelection( ptyp.getPgenSave().isSaveLayers() );
|
||||
saveLayerBtn
|
||||
.setSelection(ptyp.getPgenSave().isSaveLayers());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -143,7 +143,9 @@ import com.vividsolutions.jts.geom.Point;
|
|||
* 03/13 #927 B. Yin Implemented IContextMenuProvider interface
|
||||
* 04/13 #874 B. Yin Added a method replaceElements with parameter parent.
|
||||
* 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>
|
||||
*
|
||||
* @author B. Yin
|
||||
|
@ -1841,6 +1843,12 @@ public class PgenResource extends
|
|||
dprops.setLayerMonoColor(layer.isMonoColor());
|
||||
dprops.setLayerColor(layer.getColor());
|
||||
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();
|
||||
|
@ -1991,7 +1999,6 @@ public class PgenResource extends
|
|||
PaintProperties paintProps, DisplayProperties dispProps) {
|
||||
|
||||
if (filters.acceptOnce(de)) {
|
||||
|
||||
if (!displayMap.containsKey(de)) {
|
||||
AbstractElementContainer container = ElementContainerFactory
|
||||
.createContainer(de, descriptor, target);
|
||||
|
|
|
@ -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.DisplayElementFactory;
|
||||
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 java.util.HashMap;
|
||||
|
@ -53,10 +52,12 @@ import com.raytheon.uf.viz.core.map.IMapDescriptor;
|
|||
|
||||
public class PgenResourceGhost {
|
||||
public AbstractDrawableComponent component;
|
||||
|
||||
Map<Object, AbstractElementContainer> componentMap = new HashMap<Object, AbstractElementContainer>();
|
||||
|
||||
/**
|
||||
* Draw the ghost
|
||||
*
|
||||
* @param target
|
||||
* @param paintProps
|
||||
* @param df
|
||||
|
@ -66,8 +67,7 @@ public class PgenResourceGhost {
|
|||
DisplayElementFactory df, IMapDescriptor descriptor) {
|
||||
df.setLayerDisplayAttr(false, null, false);
|
||||
if (component != null) {
|
||||
Iterator<DrawableElement> iterator = component
|
||||
.createDEIterator();
|
||||
Iterator<DrawableElement> iterator = component.createDEIterator();
|
||||
int count = 0;
|
||||
while (iterator.hasNext()) {
|
||||
DrawableElement element = iterator.next();
|
||||
|
@ -78,16 +78,22 @@ public class PgenResourceGhost {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates displayables for an element using an ElementContainer and call the
|
||||
* displayables' draw() method to draw the element.
|
||||
* @param target Graphic target
|
||||
* @param paintProps Paint properties
|
||||
* @param df Display element factory
|
||||
* @param el Input drawable element
|
||||
* Creates displayables for an element using an ElementContainer and call
|
||||
* the displayables' draw() method to draw the element.
|
||||
*
|
||||
* @param target
|
||||
* Graphic target
|
||||
* @param paintProps
|
||||
* Paint properties
|
||||
* @param df
|
||||
* Display element factory
|
||||
* @param el
|
||||
* Input drawable element
|
||||
* @praram descriptor
|
||||
*/
|
||||
private void drawElement( IGraphicsTarget target, PaintProperties paintProps,
|
||||
DisplayElementFactory df, DrawableElement el, IMapDescriptor descriptor){
|
||||
private void drawElement(IGraphicsTarget target,
|
||||
PaintProperties paintProps, DisplayElementFactory df,
|
||||
DrawableElement el, IMapDescriptor descriptor) {
|
||||
Object key = createKey(el);
|
||||
AbstractElementContainer graphic = componentMap.get(key);
|
||||
|
||||
|
@ -106,6 +112,7 @@ public class PgenResourceGhost {
|
|||
|
||||
/**
|
||||
* Sets the ghost line for the PGEN drawing layer.
|
||||
*
|
||||
* @param ghost
|
||||
*/
|
||||
public void setGhostLine(AbstractDrawableComponent ghost) {
|
||||
|
|
|
@ -197,6 +197,7 @@ public class PgenContoursTool extends AbstractPgenDrawingTool implements
|
|||
|
||||
if (button == 1) {
|
||||
drawContourMinmax(loc);
|
||||
((ContoursAttrDlg) attrDlg).updateSymbolAttrOnGUI(loc);
|
||||
} else if (button == 3) {
|
||||
|
||||
points.clear();
|
||||
|
|
|
@ -3,13 +3,15 @@ package gov.noaa.nws.ncep.viz.overlays.resources;
|
|||
import gov.noaa.nws.ncep.viz.resources.INatlCntrsResource;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.opengis.referencing.crs.CoordinateReferenceSystem;
|
||||
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.PixelExtent;
|
||||
import com.raytheon.uf.viz.core.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.PaintProperties;
|
||||
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.LoadProperties;
|
||||
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
|
||||
|
@ -52,9 +56,9 @@ public class LatLonOverlayResource extends
|
|||
/** The wireframe object for drawing Longitude lines */
|
||||
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;
|
||||
|
||||
|
@ -75,17 +79,26 @@ public class LatLonOverlayResource extends
|
|||
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;
|
||||
|
||||
|
@ -114,8 +127,10 @@ public class LatLonOverlayResource extends
|
|||
public void paintInternal(IGraphicsTarget target, PaintProperties paintProps)
|
||||
throws VizException {
|
||||
|
||||
IFont lfont = target.initializeFont("Courier", 14, null);
|
||||
IFont lfont = target.initializeFont("Courier", 14,
|
||||
new Style[] { Style.BOLD });
|
||||
float zoomFactor = paintProps.getZoomLevel();
|
||||
labelGap = drawingGap * zoomFactor;
|
||||
|
||||
initializeViewMinAndMaxXAndY(paintProps);
|
||||
int latitudeDrawingLineNumber = getLatitudeDrawingLineNumber(latLonOverlayResourceData
|
||||
|
@ -128,17 +143,12 @@ public class LatLonOverlayResource extends
|
|||
if (needsUpdate) {
|
||||
needsUpdate = false;
|
||||
|
||||
/*
|
||||
* necessary???
|
||||
*/
|
||||
clearWireFrameShapeArray(wireframeShapeForLatLineArray);
|
||||
clearWireFrameShapeArray(wireframeShapeForLonLineArray);
|
||||
clearCoordinatePointArrayList(latitudeCoordinatePointArrayList);
|
||||
clearCoordinatePointArrayList(longitudeCoordinatePointArrayList);
|
||||
|
||||
latitudeCoordinatePointArrayList = new ArrayList<Coordinate[]>(
|
||||
latitudeLineGeometries = new HashMap<Double, Geometry>(
|
||||
latitudeDrawingLineNumber);
|
||||
longitudeCoordinatePointArrayList = new ArrayList<Coordinate[]>(
|
||||
longitudeLineGeometries = new HashMap<Double, Geometry>(
|
||||
longitudeDrawingLineNumber);
|
||||
|
||||
wireframeShapeForLatLineArray = target.createWireframeShape(false,
|
||||
|
@ -149,19 +159,17 @@ public class LatLonOverlayResource extends
|
|||
double latitudeValue = -90;
|
||||
for (int i = 0; i < latitudeDrawingLineNumber
|
||||
&& latitudeValue <= 90; i++) {
|
||||
Coordinate[] latLonCoordinateArray = createCoordinateArrayForLatitudeLine(
|
||||
double[][] latLonCoordinateArray = createCoordinateArrayForLatitudeLine(
|
||||
latitudeValue, latLonDrawingPointInterval);
|
||||
latitudeCoordinatePointArrayList.add(latLonCoordinateArray);
|
||||
|
||||
if (!(latitudeValue == -90 || latitudeValue == 90)) {
|
||||
if (!(latitudeValue == -90 || latitudeValue == 90)
|
||||
&& latLonCoordinateArray.length > 0) {
|
||||
wireframeShapeForLatLineArray
|
||||
.addLineSegment(latLonCoordinateArray);
|
||||
}
|
||||
|
||||
latitudeValue += latLonOverlayResourceData
|
||||
.getLatitudeInterval();
|
||||
}
|
||||
|
||||
wireframeShapeForLatLineArray.compile();
|
||||
|
||||
wireframeShapeForLonLineArray = target.createWireframeShape(false,
|
||||
|
@ -172,39 +180,47 @@ public class LatLonOverlayResource extends
|
|||
double longitudeValue = -180;
|
||||
for (int i = 0; i < longitudeDrawingLineNumber
|
||||
&& longitudeValue <= 180; i++) {
|
||||
|
||||
Coordinate[] latLonCoordinateArray = createCoordinateArrayLongitudeLine(
|
||||
double[][] latLonCoordinateArray = createCoordinateArrayLongitudeLine(
|
||||
longitudeValue, latLonDrawingPointInterval);
|
||||
longitudeCoordinatePointArrayList.add(latLonCoordinateArray);
|
||||
|
||||
if (latLonCoordinateArray.length > 0) {
|
||||
wireframeShapeForLonLineArray
|
||||
.addLineSegment(latLonCoordinateArray);
|
||||
}
|
||||
longitudeValue += latLonOverlayResourceData
|
||||
.getLongitudeInterval();
|
||||
}
|
||||
wireframeShapeForLonLineArray.compile();
|
||||
}
|
||||
|
||||
double latitudeValue = -90;
|
||||
updateEffectiveMinX(getMapMinX(), getViewMinX(), getViewMaxX());
|
||||
|
||||
for (int i = 0; i < latitudeDrawingLineNumber && latitudeValue <= 90; i++) {
|
||||
|
||||
addDefaultLabelByPointIndex(wireframeShapeForLatLineArray,
|
||||
String.valueOf((int) latitudeValue),
|
||||
latitudeCoordinatePointArrayList.get(i), 0);
|
||||
|
||||
int pointIndexForAddingLabel = getPointLabelIndexForAddingLatitudeLabel(
|
||||
latitudeCoordinatePointArrayList.get(i), zoomFactor,
|
||||
getEffectiveMinX(), getEffectiveMaxX(), getEffectiveMinY(),
|
||||
getEffectiveMaxY());
|
||||
|
||||
if (!(pointIndexForAddingLabel < 0)) {
|
||||
addLabelOnLatLonLine(wireframeShapeForLatLineArray,
|
||||
latitudeCoordinatePointArrayList.get(i),
|
||||
pointIndexForAddingLabel,
|
||||
String.valueOf((int) latitudeValue));
|
||||
Geometry latLine = latitudeLineGeometries.get(latitudeValue);
|
||||
if (latLine != null) {
|
||||
wireframeShapeForLatLineArray.clearLabels();
|
||||
Coordinate intersection = null;
|
||||
if (effectiveLeftBorder.intersects(latLine)) {
|
||||
intersection = effectiveLeftBorder.intersection(latLine)
|
||||
.getCoordinate();
|
||||
} else if (latLine.within(mapBoundary)
|
||||
&& mapMedianLine.intersects(latLine)) {
|
||||
intersection = mapMedianLine.intersection(latLine)
|
||||
.getCoordinate();
|
||||
// Removes default latitude label if it is too close to the
|
||||
// bottom of the viewable edge to prevent the latitude label
|
||||
// from being displayed over the longitude labels.
|
||||
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,
|
||||
latLonOverlayResourceData.getColor(),
|
||||
latLonOverlayResourceData.getLineWidth(),
|
||||
|
@ -212,18 +228,21 @@ public class LatLonOverlayResource extends
|
|||
latitudeValue += latLonOverlayResourceData.getLatitudeInterval();
|
||||
}
|
||||
double longitudeValue = -180;
|
||||
updateEffectiveMaxY(getMapMaxY(), getViewMinY(), getViewMaxY());
|
||||
|
||||
for (int i = 0; i < longitudeDrawingLineNumber && longitudeValue <= 180; i++) {
|
||||
int pointIndexForAddingLabel = getPointLabelIndexForAddingLongitudeLabel(
|
||||
longitudeCoordinatePointArrayList.get(i), zoomFactor,
|
||||
getEffectiveMinX(), getEffectiveMaxX(), getEffectiveMinY(),
|
||||
getEffectiveMaxY());
|
||||
if (!(pointIndexForAddingLabel < 0)) {
|
||||
addLabelOnLatLonLine(wireframeShapeForLonLineArray,
|
||||
longitudeCoordinatePointArrayList.get(i),
|
||||
pointIndexForAddingLabel,
|
||||
String.valueOf((int) longitudeValue));
|
||||
Geometry lonLine = longitudeLineGeometries.get(longitudeValue);
|
||||
if (lonLine != null) {
|
||||
wireframeShapeForLonLineArray.clearLabels();
|
||||
if (lonLine.intersects(effectiveBottomBorder)) {
|
||||
Coordinate intersection = effectiveBottomBorder
|
||||
.intersection(lonLine).getCoordinate();
|
||||
int lonInt = (int) longitudeValue;
|
||||
String label = Math.abs(lonInt) != 180 ? String
|
||||
.valueOf(lonInt) : "ID";
|
||||
wireframeShapeForLonLineArray.clearLabels();
|
||||
wireframeShapeForLonLineArray.addLabel(label, new double[] {
|
||||
intersection.x, intersection.y - labelGap });
|
||||
}
|
||||
}
|
||||
target.drawWireframeShape(wireframeShapeForLonLineArray,
|
||||
latLonOverlayResourceData.getColor(),
|
||||
|
@ -234,22 +253,27 @@ public class LatLonOverlayResource extends
|
|||
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() {
|
||||
mapMinX = descriptor.getGridGeometry().getGridRange().getLow(0);
|
||||
mapMaxX = descriptor.getGridGeometry().getGridRange().getHigh(0);
|
||||
mapMinY = descriptor.getGridGeometry().getGridRange().getLow(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) {
|
||||
|
@ -258,129 +282,48 @@ public class LatLonOverlayResource extends
|
|||
viewMinY = paintProps.getView().getExtent().getMinY();
|
||||
viewMaxY = paintProps.getView().getExtent().getMaxY();
|
||||
|
||||
effectiveMinX = viewMinX;
|
||||
effectiveMaxX = viewMaxX;
|
||||
effectiveMinY = viewMinY;
|
||||
effectiveMaxY = viewMaxY;
|
||||
updateEffectiveView();
|
||||
}
|
||||
|
||||
private void updateEffectiveMinX(double mapMinXValue, double viewMinXValue,
|
||||
double viewMaxXValue) {
|
||||
if (isLeftEdgeOfMapInsideCurrentView(mapMinXValue, viewMinXValue,
|
||||
viewMaxXValue)) {
|
||||
effectiveMinX = mapMinXValue;
|
||||
}
|
||||
}
|
||||
private void updateEffectiveView() {
|
||||
double effectiveMinX = viewMinX;
|
||||
double effectiveMaxX = viewMaxX;
|
||||
double effectiveMinY = viewMinY;
|
||||
double effectiveMaxY = viewMaxY;
|
||||
|
||||
private boolean isLeftEdgeOfMapInsideCurrentView(double minXOfMap,
|
||||
double minXOfCurrentView, double maxXOfCurrentView) {
|
||||
boolean isInsideResult = false;
|
||||
if (minXOfMap > minXOfCurrentView && minXOfMap < maxXOfCurrentView)
|
||||
isInsideResult = true;
|
||||
return isInsideResult;
|
||||
if (mapMinX > viewMinX && mapMinX < viewMaxX) {
|
||||
effectiveMinX = mapMinX;
|
||||
}
|
||||
|
||||
private void updateEffectiveMaxY(double mapMaxYValue, double viewMinYValue,
|
||||
double viewMaxYValue) {
|
||||
if (isBottomEdgeOfMapInsideCurrentView(mapMaxYValue, viewMinYValue,
|
||||
viewMaxYValue))
|
||||
effectiveMaxY = mapMaxYValue;
|
||||
if (mapMaxX > viewMinX && mapMaxX < viewMaxX) {
|
||||
effectiveMaxX = mapMaxX;
|
||||
}
|
||||
|
||||
private boolean isBottomEdgeOfMapInsideCurrentView(double maxYOfMap,
|
||||
double minYOfCurrentView, double maxYOfCurrentView) {
|
||||
boolean isInsideResult = false;
|
||||
if (maxYOfMap > minYOfCurrentView && maxYOfMap < maxYOfCurrentView) {
|
||||
isInsideResult = true;
|
||||
if (mapMinY > viewMinY && mapMinY < viewMaxY) {
|
||||
effectiveMinY = mapMinY;
|
||||
}
|
||||
return isInsideResult;
|
||||
if (mapMaxY > viewMinY && mapMaxY < viewMaxY) {
|
||||
effectiveMaxY = mapMaxY;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
private void addDefaultLabelByPointIndex(IWireframeShape wireframeShape,
|
||||
String labelValue, Coordinate[] latLonCoordinateArray,
|
||||
int defaultPointIndex) {
|
||||
double[] tmp = { latLonCoordinateArray[defaultPointIndex].x,
|
||||
latLonCoordinateArray[defaultPointIndex].y };
|
||||
double[] screenPixel = descriptor.worldToPixel(tmp);
|
||||
if (screenPixel != null)
|
||||
wireframeShape.addLabel(labelValue, screenPixel);
|
||||
}
|
||||
|
||||
private boolean isPointForPlacingLongituteLabel(double[] pixelValueArray,
|
||||
double positionOffset, float zoomFactor, double minX, double maxX,
|
||||
double minY, double maxY) {
|
||||
double delta = 200;
|
||||
boolean isPointForLabel = false;
|
||||
if (pixelValueArray != null) {
|
||||
if (pixelValueArray[0] > minX && pixelValueArray[0] < maxX
|
||||
&& pixelValueArray[1] > minY && pixelValueArray[1] < maxY) {
|
||||
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;
|
||||
double cornerGap = 2.5 * labelGap;
|
||||
Coordinate[] leftBorderCoordinates = new Coordinate[] {
|
||||
new Coordinate(effectiveMinX, effectiveMinY + cornerGap),
|
||||
new Coordinate(effectiveMinX, effectiveMaxY - cornerGap) };
|
||||
Coordinate[] rightBorderCoordinates = new Coordinate[] {
|
||||
new Coordinate(effectiveMaxX, effectiveMinY + cornerGap),
|
||||
new Coordinate(effectiveMaxX, effectiveMaxY - cornerGap) };
|
||||
Coordinate[] bottomBorderCoordinates = new Coordinate[] {
|
||||
new Coordinate(effectiveMinX + cornerGap, effectiveMaxY),
|
||||
new Coordinate(effectiveMaxX - cornerGap, effectiveMaxY) };
|
||||
Coordinate[] topBorderCoordinates = new Coordinate[] {
|
||||
new Coordinate(effectiveMinX + cornerGap, effectiveMinY),
|
||||
new Coordinate(effectiveMaxX - cornerGap, effectiveMinY) };
|
||||
effectiveLeftBorder = new GeometryFactory()
|
||||
.createLineString(leftBorderCoordinates);
|
||||
effectiveRightBorder = new GeometryFactory()
|
||||
.createLineString(rightBorderCoordinates);
|
||||
effectiveBottomBorder = new GeometryFactory()
|
||||
.createLineString(bottomBorderCoordinates);
|
||||
effectiveTopBorder = new GeometryFactory()
|
||||
.createLineString(topBorderCoordinates);
|
||||
}
|
||||
|
||||
private int getLatitudeDrawingLineNumber(int latInterval) {
|
||||
|
@ -402,28 +345,54 @@ public class LatLonOverlayResource extends
|
|||
return lonLineNumber + 1;
|
||||
}
|
||||
|
||||
private Coordinate[] createCoordinateArrayForLatitudeLine(
|
||||
private double[][] createCoordinateArrayForLatitudeLine(
|
||||
double latitudeValue, double latLonPointInterval) {
|
||||
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;
|
||||
for (int i = 0; i < coordinateArray.length && longitude <= 180; i++) {
|
||||
coordinateArray[i] = new Coordinate(longitude, latitudeValue);
|
||||
for (int i = 0; i < coordinateArrayLength && longitude <= 180; i++) {
|
||||
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;
|
||||
}
|
||||
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) {
|
||||
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;
|
||||
for (int i = 0; i < coordinateArray.length && latitude <= 90; i++) {
|
||||
coordinateArray[i] = new Coordinate(longitudeValue, latitude);
|
||||
for (int i = 0; i < coordinateArrayLength && latitude <= 90; i++) {
|
||||
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;
|
||||
}
|
||||
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()
|
||||
*/
|
||||
public void disposeInternal() {
|
||||
// clearWireFrameShapeArray(wireframeShapeForLatLineArray);
|
||||
// clearWireFrameShapeArray(wireframeShapeForLonLineArray);
|
||||
|
||||
clearWireFrameShapeArray(wireframeShapeForLatLineArray);
|
||||
clearWireFrameShapeArray(wireframeShapeForLonLineArray);
|
||||
}
|
||||
|
||||
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
|
||||
*/
|
||||
|
@ -489,22 +447,6 @@ public class LatLonOverlayResource extends
|
|||
return mapMaxX;
|
||||
}
|
||||
|
||||
public double getEffectiveMinX() {
|
||||
return effectiveMinX;
|
||||
}
|
||||
|
||||
public double getEffectiveMaxY() {
|
||||
return effectiveMaxY;
|
||||
}
|
||||
|
||||
public double getEffectiveMinY() {
|
||||
return effectiveMinY;
|
||||
}
|
||||
|
||||
public double getEffectiveMaxX() {
|
||||
return effectiveMaxX;
|
||||
}
|
||||
|
||||
// @Override
|
||||
public void resourceAttrsModified() {
|
||||
needsUpdate = true;
|
||||
|
@ -515,9 +457,9 @@ public class LatLonOverlayResource extends
|
|||
return true;
|
||||
}
|
||||
|
||||
// TODO : This has not been tested.
|
||||
@Override
|
||||
public void project(CoordinateReferenceSystem mapData) throws VizException {
|
||||
needsUpdate = true;
|
||||
initializeMapMinAndMaxXAndY();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* even if resource not preselected (from existing RBD contents).
|
||||
* (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>
|
||||
*
|
||||
|
@ -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() {
|
||||
@Override
|
||||
public Object[] getElements(Object inputElement) {
|
||||
|
|
|
@ -8,7 +8,6 @@ import gov.noaa.nws.ncep.viz.resources.manager.ResourceName;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.runtime.IConfigurationElement;
|
||||
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.exception.VizException;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
|
@ -34,7 +34,7 @@ import com.raytheon.uf.viz.core.exception.VizException;
|
|||
* 01/15/12 #606 Greg Hull add 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.
|
||||
*
|
||||
* - - S.Gurung Code formatter changes only
|
||||
* </pre>
|
||||
*
|
||||
* @author
|
||||
|
@ -44,29 +44,44 @@ import com.raytheon.uf.viz.core.exception.VizException;
|
|||
public class ResourceExtPointMngr {
|
||||
|
||||
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_CLASS_TAG = "class";
|
||||
|
||||
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 RESOURCE_NAME_REF_TAG = "ncResourceName";
|
||||
|
||||
private static final String RSC_PARAM_ELEMENT_NAME = "nc-resourceParameter";
|
||||
|
||||
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_CLASS_TAG = "paramClass";
|
||||
|
||||
private static final String CONSTRAINT_NAME_TAG = "constraintName";
|
||||
|
||||
// private static final String PARAM_REF_LOC_TAG = "paramRefLocation";
|
||||
private static final String DFLT_VAL_TAG = "defaultValue";
|
||||
|
||||
|
||||
public static enum ResourceParamType {
|
||||
EDITABLE_ATTRIBUTE("EDITABLE_ATTRIBUTE"),
|
||||
IMPLEMENTATION_PARAM("IMPLEMENTATION_PARAM"), // used to instantiate the ResourceImplementation
|
||||
REQUEST_CONSTRAINT("REQUEST_CONSTRAINT"), // instantiates a Resource Implementation and also used as a request constraint
|
||||
EDITABLE_ATTRIBUTE("EDITABLE_ATTRIBUTE"), IMPLEMENTATION_PARAM(
|
||||
"IMPLEMENTATION_PARAM"), // used to instantiate the
|
||||
// ResourceImplementation
|
||||
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 ResourceParamType(String n) {
|
||||
name = n;
|
||||
}
|
||||
|
@ -74,14 +89,11 @@ public class ResourceExtPointMngr {
|
|||
public static ResourceParamType getResourceParamType(String n) {
|
||||
if (n.equalsIgnoreCase(REQUEST_CONSTRAINT.name)) {
|
||||
return REQUEST_CONSTRAINT;
|
||||
}
|
||||
else if( n.equalsIgnoreCase( EDITABLE_ATTRIBUTE.name ) ) {
|
||||
} else if (n.equalsIgnoreCase(EDITABLE_ATTRIBUTE.name)) {
|
||||
return EDITABLE_ATTRIBUTE;
|
||||
}
|
||||
else if( n.equalsIgnoreCase( NON_EDITABLE_ATTRIBUTE.name ) ) {
|
||||
} else if (n.equalsIgnoreCase(NON_EDITABLE_ATTRIBUTE.name)) {
|
||||
return NON_EDITABLE_ATTRIBUTE;
|
||||
}
|
||||
else if( n.equalsIgnoreCase( IMPLEMENTATION_PARAM.name ) ) {
|
||||
} else if (n.equalsIgnoreCase(IMPLEMENTATION_PARAM.name)) {
|
||||
return IMPLEMENTATION_PARAM;
|
||||
}
|
||||
return IMPLEMENTATION_PARAM;
|
||||
|
@ -90,21 +102,28 @@ public class ResourceExtPointMngr {
|
|||
|
||||
public static class ResourceParamInfo {
|
||||
private String paramName;
|
||||
private String constraintName; // usually the same as the paramName except for
|
||||
|
||||
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
|
||||
// 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 paramRefLocation; // for ref'd colorBars
|
||||
|
||||
ResourceParamInfo( String n, String c, String a, Class<?> clz, ResourceParamType ptype,
|
||||
String dval ) { //, String prmRefLoc) {
|
||||
ResourceParamInfo(String n, String c, String a, Class<?> clz,
|
||||
ResourceParamType ptype, String dval) { // , String prmRefLoc) {
|
||||
paramName = n;
|
||||
constraintName = c;
|
||||
attributeName = a;
|
||||
|
@ -113,30 +132,37 @@ public class ResourceExtPointMngr {
|
|||
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 static class ResourceExtPointInfo {
|
||||
String rscName; //
|
||||
|
||||
Class<?> rscDataClass;
|
||||
|
||||
Class<?> rscDialogClass;
|
||||
|
||||
HashMap<String, ResourceParamInfo> rscParameters = null;
|
||||
|
@ -149,16 +175,22 @@ public class ResourceExtPointMngr {
|
|||
}
|
||||
|
||||
void addParameter(String prmName, String cName, String aName,
|
||||
Class<?> prmClass, ResourceParamType pType, String dflt) { // , Object dfltVal ) {
|
||||
Class<?> prmClass, ResourceParamType pType, String dflt) { // ,
|
||||
// Object
|
||||
// dfltVal
|
||||
// )
|
||||
// {
|
||||
|
||||
rscParameters.put( prmName,
|
||||
new ResourceParamInfo( prmName, cName, aName, prmClass, pType, dflt ) );
|
||||
rscParameters.put(prmName, new ResourceParamInfo(prmName, cName,
|
||||
aName, prmClass, pType, dflt));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// map from the resource name to the resource info containing the rscData class,
|
||||
// the class that implements the edit dialog and a list of attributes from the
|
||||
// map from the resource name to the resource info containing the rscData
|
||||
// class,
|
||||
// the class that implements the edit dialog and a list of attributes from
|
||||
// the
|
||||
// attribute extension points
|
||||
//
|
||||
static HashMap<String, ResourceExtPointInfo> rscExtPointInfoMap = null;
|
||||
|
@ -168,8 +200,7 @@ public class ResourceExtPointMngr {
|
|||
public static ResourceExtPointMngr getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new ResourceExtPointMngr();
|
||||
}
|
||||
else if( instance.rscExtPointInfoMap.size() == 0 ) {
|
||||
} else if (instance.rscExtPointInfoMap.size() == 0) {
|
||||
instance = new ResourceExtPointMngr();
|
||||
}
|
||||
return instance;
|
||||
|
@ -188,25 +219,30 @@ public class ResourceExtPointMngr {
|
|||
IExtensionPoint extPoint = registry.getExtensionPoint(NC_RESOURCE_EXT);
|
||||
|
||||
if (extPoint == null) {
|
||||
System.out.println("Unable to get Extension Point : " + NC_RESOURCE_EXT );
|
||||
System.out.println("Unable to get Extension Point : "
|
||||
+ NC_RESOURCE_EXT);
|
||||
return;
|
||||
}
|
||||
|
||||
IExtension[] extensions = extPoint.getExtensions();
|
||||
|
||||
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++) {
|
||||
String rscName = config[j].getAttribute(RESOURCE_NAME_TAG);
|
||||
String rscClassName = config[j].getAttribute(RESOURCE_CLASS_TAG);
|
||||
String editDlgClassName = config[j].getAttribute(EDIT_DLG_CLASS_TAG);
|
||||
String rscClassName = config[j]
|
||||
.getAttribute(RESOURCE_CLASS_TAG);
|
||||
String editDlgClassName = config[j]
|
||||
.getAttribute(EDIT_DLG_CLASS_TAG);
|
||||
|
||||
if (rscClassName == null) {
|
||||
System.out.println(" " + rscClassName);
|
||||
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.
|
||||
if (editDlgClassName == null) {
|
||||
continue;
|
||||
|
@ -221,46 +257,56 @@ public class ResourceExtPointMngr {
|
|||
rscClass = Class.forName(rscClassName);
|
||||
editDlgClass = Class.forName(editDlgClassName);
|
||||
|
||||
rscExtPointInfoMap.put( rscName,
|
||||
new ResourceExtPointInfo( rscName, rscClass, editDlgClass ) );
|
||||
rscExtPointInfoMap.put(rscName, new ResourceExtPointInfo(
|
||||
rscName, rscClass, editDlgClass));
|
||||
} 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
|
||||
private static void readResourceParameterssExtPoint() {
|
||||
|
||||
IExtensionRegistry registry = Platform.getExtensionRegistry();
|
||||
IExtensionPoint extPoint = registry.getExtensionPoint( NC_RESOURCE_PARAMS_EXT );
|
||||
IExtensionPoint extPoint = registry
|
||||
.getExtensionPoint(NC_RESOURCE_PARAMS_EXT);
|
||||
|
||||
if (extPoint == null) {
|
||||
System.out.println("Unable to get Extension Point : "+ NC_RESOURCE_PARAMS_EXT );
|
||||
System.out.println("Unable to get Extension Point : "
|
||||
+ NC_RESOURCE_PARAMS_EXT);
|
||||
return;
|
||||
}
|
||||
|
||||
IExtension[] extensions = extPoint.getExtensions();
|
||||
|
||||
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++) {
|
||||
if( config[j].getName().equalsIgnoreCase( RSC_PARAM_ELEMENT_NAME ) ) {
|
||||
String rscName = config[j].getAttribute(RESOURCE_NAME_REF_TAG);
|
||||
if (config[j].getName()
|
||||
.equalsIgnoreCase(RSC_PARAM_ELEMENT_NAME)) {
|
||||
String rscName = config[j]
|
||||
.getAttribute(RESOURCE_NAME_REF_TAG);
|
||||
String prmName = config[j].getAttribute(PARAM_NAME_TAG);
|
||||
String attrName = config[j].getAttribute(ATTR_NAME_TAG);
|
||||
String prmClassName = config[j].getAttribute(PARAM_CLASS_TAG);
|
||||
String constraintName = config[j].getAttribute(CONSTRAINT_NAME_TAG);
|
||||
String prmClassName = config[j]
|
||||
.getAttribute(PARAM_CLASS_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);
|
||||
// String refLoc =
|
||||
// config[j].getAttribute(PARAM_REF_LOC_TAG);
|
||||
|
||||
// sanity check ; these are required
|
||||
if( rscName == null || prmName == null || prmClassName == null || prmType == null) {
|
||||
System.out.println( "Invalid Extension of Ext Point: "+ NC_RESOURCE_PARAMS_EXT );
|
||||
if (rscName == null || prmName == null
|
||||
|| prmClassName == null || prmType == null) {
|
||||
System.out.println("Invalid Extension of Ext Point: "
|
||||
+ NC_RESOURCE_PARAMS_EXT);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -271,8 +317,10 @@ public class ResourceExtPointMngr {
|
|||
ResourceExtPointInfo repi = rscExtPointInfoMap.get(rscName);
|
||||
|
||||
if (repi == null) {
|
||||
System.out.println("Error reading "+NC_RESOURCE_PARAMS_EXT + " Ext Point: The Resource " +
|
||||
rscName + " is not defined." );
|
||||
System.out.println("Error reading "
|
||||
+ NC_RESOURCE_PARAMS_EXT
|
||||
+ " Ext Point: The Resource " + rscName
|
||||
+ " is not defined.");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -280,8 +328,10 @@ public class ResourceExtPointMngr {
|
|||
constraintName = prmName;
|
||||
}
|
||||
|
||||
// this only exists for Grids where the parameter name is upper case
|
||||
// and the attribute name (ie the name of the member variable in the
|
||||
// this only exists for Grids where the parameter name is
|
||||
// upper case
|
||||
// and the attribute name (ie the name of the member
|
||||
// variable in the
|
||||
// java class) is lowercase
|
||||
//
|
||||
if (attrName == null) {
|
||||
|
@ -289,12 +339,14 @@ public class ResourceExtPointMngr {
|
|||
}
|
||||
try {
|
||||
Class<?> rscPrmClass = Class.forName(prmClassName);
|
||||
ResourceParamType rscPrmType = ResourceParamType.getResourceParamType( prmType );
|
||||
ResourceParamType rscPrmType = ResourceParamType
|
||||
.getResourceParamType(prmType);
|
||||
|
||||
repi.addParameter(prmName, constraintName, attrName,
|
||||
rscPrmClass, rscPrmType, dfltVal);
|
||||
} catch (ClassNotFoundException e) {
|
||||
System.out.println("Unable to load class: "+prmClassName );
|
||||
System.out.println("Unable to load class: "
|
||||
+ prmClassName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -308,13 +360,13 @@ public class ResourceExtPointMngr {
|
|||
|
||||
// if( rscCfgMngr == null ) {
|
||||
try {
|
||||
rscImplName = ResourceDefnsMngr.getInstance().getResourceImplementation( rscName.getRscType() );
|
||||
rscImplName = ResourceDefnsMngr.getInstance()
|
||||
.getResourceImplementation(rscName.getRscType());
|
||||
} catch (VizException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
ResourceExtPointInfo repi = rscExtPointInfoMap.get(rscImplName);
|
||||
|
||||
return (repi == null ? null : repi.rscDialogClass);
|
||||
|
@ -361,12 +413,14 @@ public class ResourceExtPointMngr {
|
|||
// return ( repi == null ? null : repi.rscName );
|
||||
// }
|
||||
|
||||
// public HashMap<String,ResourceAttrInfo> getResourceAttributes( ResourceName rscName ) {
|
||||
// public HashMap<String,ResourceAttrInfo> getResourceAttributes(
|
||||
// ResourceName rscName ) {
|
||||
// String rscImplName = null;
|
||||
//
|
||||
// // if( rscCfgMngr == null ) {
|
||||
// try {
|
||||
// rscImplName = ResourceDefnsMngr.getInstance().getResourceImplementation( rscName.getRscType() );
|
||||
// rscImplName = ResourceDefnsMngr.getInstance().getResourceImplementation(
|
||||
// rscName.getRscType() );
|
||||
// } catch (VizException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
|
@ -377,9 +431,11 @@ public class ResourceExtPointMngr {
|
|||
// return ( repi == null ? null : repi.rscAttributes );
|
||||
// }
|
||||
|
||||
public HashMap<String,ResourceParamInfo> getParameterInfoForRscImplementation( ResourceName rscName ) {
|
||||
public HashMap<String, ResourceParamInfo> getParameterInfoForRscImplementation(
|
||||
ResourceName rscName) {
|
||||
try {
|
||||
String rscImpl = ResourceDefnsMngr.getInstance().getResourceImplementation( rscName.getRscType() );
|
||||
String rscImpl = ResourceDefnsMngr.getInstance()
|
||||
.getResourceImplementation(rscName.getRscType());
|
||||
|
||||
return getResourceParameters(rscImpl);
|
||||
} catch (VizException e) {
|
||||
|
@ -388,7 +444,8 @@ public class ResourceExtPointMngr {
|
|||
}
|
||||
}
|
||||
|
||||
public HashMap<String,ResourceParamInfo> getResourceParameters( String rscImpl ) {
|
||||
public HashMap<String, ResourceParamInfo> getResourceParameters(
|
||||
String rscImpl) {
|
||||
ResourceExtPointInfo repi = rscExtPointInfoMap.get(rscImpl);
|
||||
return (repi == null ? null : repi.rscParameters);
|
||||
}
|
||||
|
|
|
@ -30,6 +30,8 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TimeZone;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.measure.converter.ConversionException;
|
||||
|
||||
|
@ -119,6 +121,7 @@ import com.sun.jna.ptr.IntByReference;
|
|||
* 11/2013 845 T. Lee Implemented parameter scaling
|
||||
* 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.
|
||||
* 07/2014 T. Lee Fixed specific humidity scaling for NAM
|
||||
* </pre>
|
||||
*
|
||||
* @author tlee
|
||||
|
@ -1334,7 +1337,7 @@ public class Dgdriv {
|
|||
outGridFlipped[kk] = -9999.0f;
|
||||
kk++;
|
||||
} else {
|
||||
outGridFlipped[kk] = inGrid[ii] / scale_parm;
|
||||
outGridFlipped[kk] = inGrid[ii];
|
||||
kk++;
|
||||
}
|
||||
}
|
||||
|
@ -1354,7 +1357,7 @@ public class Dgdriv {
|
|||
if (inGrid[ii] < -900000.0) {
|
||||
outGridFlipped[ii] = -9999.0f;
|
||||
} else {
|
||||
outGridFlipped[ii] = inGrid[ii] / scale_parm;
|
||||
outGridFlipped[ii] = inGrid[ii];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1405,8 +1408,6 @@ public class Dgdriv {
|
|||
return outGridFlopped;
|
||||
}
|
||||
|
||||
int scale_parm = 1;
|
||||
|
||||
private float[] retrieveDataFromRetriever(String dataURI)
|
||||
throws VizException {
|
||||
|
||||
|
@ -1425,8 +1426,6 @@ public class Dgdriv {
|
|||
try {
|
||||
String gempakParm = cacheData.getGempakParam(dataURI);
|
||||
if (gempakParm != null) {
|
||||
scale_parm = (int) Math.pow(10,
|
||||
gempakParmInfo.getParmScale(gempakParm));
|
||||
dataRetriever.setUnit(UnitConv.deserializer(gempakParmInfo
|
||||
.getParmUnit(gempakParm)));
|
||||
}
|
||||
|
@ -1750,8 +1749,8 @@ public class Dgdriv {
|
|||
String modelName = parms[0];
|
||||
String dbTag = parms[1];
|
||||
String eventName = parms[2];
|
||||
// String tmStr = constructTimeStr(parms[3]);
|
||||
DataTime dtime = constructDataTime(parms[3]);
|
||||
String tmStr = constructTimeStr(parms[3]);
|
||||
Pattern p = Pattern.compile(tmStr);
|
||||
|
||||
// logger.info("executeScript:modelname=" + modelName + " dbTag=" +dbTag
|
||||
// + " eventName="+eventName + " time=" + tmStr);
|
||||
|
@ -1765,9 +1764,15 @@ public class Dgdriv {
|
|||
eventName, ConstraintType.EQUALS));
|
||||
}
|
||||
|
||||
rcMap.put(GridDBConstants.DATA_TIME_QUERY,
|
||||
new RequestConstraint(dtime.getURIString(),
|
||||
try {
|
||||
String gempakTimeStrFFF = parms[3].split("f")[1];
|
||||
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();
|
||||
request.addRequestField(GridDBConstants.REF_TIME_QUERY);
|
||||
|
@ -1775,6 +1780,8 @@ public class Dgdriv {
|
|||
request.setDistinct(true);
|
||||
request.setConstraints(rcMap);
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHH");
|
||||
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
String retFileNames = "";
|
||||
try {
|
||||
DbQueryResponse response = (DbQueryResponse) ThriftClient
|
||||
|
@ -1796,6 +1803,14 @@ public class Dgdriv {
|
|||
GridDBConstants.REF_TIME_QUERY);
|
||||
if (fSecValue != null && fSecValue instanceof Integer
|
||||
&& 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();
|
||||
DataTime refTime = new DataTime((Date) refValue);
|
||||
String[] dts = refTime.toString().split(" ");
|
||||
|
@ -1822,57 +1837,20 @@ public class Dgdriv {
|
|||
return retFileNames;
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert Gempak time string YYMMDD/HHMMfHHH to DataTime
|
||||
*/
|
||||
private DataTime constructDataTime(String gempakTimeStr) {
|
||||
|
||||
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;
|
||||
private String constructTimeStr(String gempakTimeStr) {
|
||||
String gempakTimeStrCycle = gempakTimeStr.split("f")[0];
|
||||
gempakTimeStrCycle = gempakTimeStrCycle.replace("[0-9]", ".");
|
||||
if (gempakTimeStrCycle.length() < 10) {
|
||||
return 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)
|
||||
throws VizException {
|
||||
long t0 = System.currentTimeMillis();
|
||||
|
|
|
@ -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.
|
|
@ -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/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.
|
||||
* 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
|
||||
* 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.
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue