VLab Issue #4003 - NCEP CAVE Plugins delivery for 14.2.1-n
Many bug fixes and configuration changes Change-Id: Ic064fc5a059603c67c0ecd8abb355e99f108d900 Former-commit-id:1e0f4de966
[formerly1e0f4de966
[formerly 6db979bed0dd16198362245f78916546b4c488af]] Former-commit-id:5e7146353b
Former-commit-id:4d5f585a46
This commit is contained in:
parent
d1aa062c08
commit
6f151b8229
59 changed files with 7214 additions and 6364 deletions
|
@ -35,7 +35,7 @@
|
|||
<Point Lat="24.370719825166535" Lon="-122.20535221347572"/>
|
||||
<textLine>FL300</textLine>
|
||||
</Text>
|
||||
<Vector pgenCategory="Vector" pgenType="Barb" direction="323.01585993274364" speed="120.0" arrowHeadSize="1.0" directionOnly="false" lineWidth="2.0" sizeScale="2.0" clear="true">
|
||||
<Vector pgenCategory="Vector" pgenType="Barb" direction="323.01585993274364" speed="120.0" arrowHeadSize="1.0" directionOnly="false" lineWidth="3.0" sizeScale="2.0" clear="true">
|
||||
<Color red="255" green="0" blue="0" alpha="255"/>
|
||||
<Point Lat="23.48763893335557" Lon="-120.67426748783554"/>
|
||||
</Vector>
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
B. Yin/Chugach 08/11 Initial Coding
|
||||
B. Yin/SGT 02/14 Added contour support
|
||||
P.Swamy 05/2014 TTR 993 - Highs and Lows do not decode for WPC SFC text product
|
||||
-->
|
||||
|
||||
<xsl:variable name="newline"><xsl:text>
|
||||
|
@ -35,19 +36,19 @@
|
|||
<xsl:if test="@pgenCategory= 'Front'">
|
||||
<xsl:value-of select="$newline"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="@pgenType = 'COLD_FRONT'">
|
||||
<xsl:when test="@pgenType = 'COLD_FRONT' or @pgenType = 'COLD_FRONT_FORM' or @pgenType = 'COLD_FRONT_DISS'">
|
||||
<xsl:text>COLD WK </xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="@pgenType = 'WARM_FRONT'">
|
||||
<xsl:when test="@pgenType = 'WARM_FRONT' or @pgenType = 'WARM_FRONT_FORM' or @pgenType = 'WARM_FRONT_DISS'">
|
||||
<xsl:text>WARM WK </xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="@pgenType = 'STATIONARY_FRONT'">
|
||||
<xsl:when test="@pgenType = 'STATIONARY_FRONT' or @pgenType = 'STATIONARY_FRONT_FORM' or @pgenType = 'STATIONARY_FRONT_DISS'">
|
||||
<xsl:text>STNRY WK </xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="@pgenType = 'OCCLUDED_FRONT'">
|
||||
<xsl:when test="@pgenType = 'OCCLUDED_FRONT' or @pgenType = 'OCCLUDED_FRONT_FORM' or @pgenType = 'OCCLUDED_FRONT_DISS'">
|
||||
<xsl:text>OCFNT WK </xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="@pgenType = 'TROF'">
|
||||
<xsl:when test="@pgenType = 'TROF' or @pgenType = 'TROPICAL_TROF' or @pgenType = 'DRY_LINE' or @pgenType = 'INSTABILITY' or @pgenType = 'SHEAR_LINE'">
|
||||
<xsl:text>TROF </xsl:text>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
Change Log:
|
||||
|
||||
B. Yin/Chugach 08/11 Initial Coding
|
||||
P.Swamy 05/2014 TTR 993 - Highs and Lows do not decode for WPC SFC text product
|
||||
-->
|
||||
|
||||
<xsl:variable name="newline"><xsl:text>
|
||||
|
@ -33,19 +34,19 @@
|
|||
<xsl:if test="@pgenCategory= 'Front'">
|
||||
<xsl:value-of select="$newline"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="@pgenType = 'COLD_FRONT'">
|
||||
<xsl:text>COLD </xsl:text>
|
||||
<xsl:when test="@pgenType = 'COLD_FRONT' or @pgenType = 'COLD_FRONT_FORM' or @pgenType = 'COLD_FRONT_DISS'">
|
||||
<xsl:text>COLD WK </xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="@pgenType = 'WARM_FRONT'">
|
||||
<xsl:text>WARM </xsl:text>
|
||||
<xsl:when test="@pgenType = 'WARM_FRONT' or @pgenType = 'WARM_FRONT_FORM' or @pgenType = 'WARM_FRONT_DISS'">
|
||||
<xsl:text>WARM WK </xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="@pgenType = 'STATIONARY_FRONT'">
|
||||
<xsl:text>STNRY </xsl:text>
|
||||
<xsl:when test="@pgenType = 'STATIONARY_FRONT' or @pgenType = 'STATIONARY_FRONT_FORM' or @pgenType = 'STATIONARY_FRONT_DISS'">
|
||||
<xsl:text>STNRY WK </xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="@pgenType = 'OCCLUDED_FRONT'">
|
||||
<xsl:text>OCFNT </xsl:text>
|
||||
<xsl:when test="@pgenType = 'OCCLUDED_FRONT' or @pgenType = 'OCCLUDED_FRONT_FORM' or @pgenType = 'OCCLUDED_FRONT_DISS'">
|
||||
<xsl:text>OCFNT WK </xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="@pgenType = 'TROF'">
|
||||
<xsl:when test="@pgenType = 'TROF' or @pgenType = 'TROPICAL_TROF' or @pgenType = 'DRY_LINE' or @pgenType = 'INSTABILITY' or @pgenType = 'SHEAR_LINE'">
|
||||
<xsl:text>TROF </xsl:text>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
|
|
|
@ -85,6 +85,7 @@ public class Activator extends AbstractUIPlugin {
|
|||
myprefs.setDefault(PgenPreferences.P_COMP_COORD,
|
||||
PgenPreferences.CED_COMP_COORD);
|
||||
myprefs.setDefault(PgenPreferences.P_AUTOPLACE_TEXT, false);
|
||||
myprefs.setDefault(PgenPreferences.P_AUTOPLACE_CONTOUR_LABEL, false);
|
||||
myprefs.setDefault(PgenPreferences.P_LAYER_MERGE, 4);
|
||||
}
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ import org.eclipse.ui.IWorkbenchPreferencePage;
|
|||
* 04/12 #977 S. Gilbert PGEN Database support
|
||||
* 11/13 TTR752 J. Wu Added P_AUTOPLACE_TEXT
|
||||
* 12/13 TTR776 J. Wu Added P_LAYER_MERGE
|
||||
* 05/14 TTR 995 J. Wu Added P_AUTOPLACE_CONTOUR_LABEL.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -84,6 +85,11 @@ public class PgenPreferences extends FieldEditorPreferencePage implements
|
|||
|
||||
private BooleanFieldEditor autoPlaceText;
|
||||
|
||||
// Preference to place text box automatically (CCFP);
|
||||
public final static String P_AUTOPLACE_CONTOUR_LABEL = "PGEN_AUTOPLACE_CONTOUR_LABEL";
|
||||
|
||||
private BooleanFieldEditor autoPlaceContourLabel;
|
||||
|
||||
public final static String P_LAYER_MERGE = "P_LAYER_MERGE";
|
||||
|
||||
private BooleanFieldEditor layerLink;
|
||||
|
@ -142,10 +148,16 @@ public class PgenPreferences extends FieldEditorPreferencePage implements
|
|||
this.addField(projCombo);
|
||||
|
||||
autoPlaceText = new BooleanFieldEditor(P_AUTOPLACE_TEXT,
|
||||
"&Text Auto Placement (where applicable)",
|
||||
"&Enable Auto Placement for CCFP Text Boxes",
|
||||
BooleanFieldEditor.DEFAULT, getFieldEditorParent());
|
||||
this.addField(autoPlaceText);
|
||||
|
||||
autoPlaceContourLabel = new BooleanFieldEditor(
|
||||
P_AUTOPLACE_CONTOUR_LABEL,
|
||||
"&Enable Auto Placement for Contour Labels",
|
||||
BooleanFieldEditor.DEFAULT, getFieldEditorParent());
|
||||
this.addField(autoPlaceContourLabel);
|
||||
|
||||
ComboFieldEditor layerMerge = new ComboFieldEditor(P_LAYER_MERGE,
|
||||
"&Default Action for PGEN Layer Merge:", new String[][] {
|
||||
{ "Take no action", "0" },
|
||||
|
|
|
@ -140,6 +140,8 @@ import com.vividsolutions.jts.linearref.LocationIndexedLine;
|
|||
* 07/26 TTR J. Wu Extract "DEL_PART" in DeletePartCommand into deleteLinePart().
|
||||
* 12/13 #1089 B. Yin Removed the UTC time functions to a new class.
|
||||
* 12/13 #1091 J. Wu Added getLayerMergeOption()
|
||||
* 05/14 TTR 995 J. Wu Added getContourLabelAutoPlacement().
|
||||
* 05/14 TTR998 J. Wu Added pixelToLatlon().
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -825,7 +827,7 @@ public class PgenUtil {
|
|||
* @param pts
|
||||
* An array of points in lat/lon coordinates
|
||||
* @param mapDescriptor
|
||||
* Descriptoer to use for world to pixel transform
|
||||
* Descriptor to use for world to pixel transform
|
||||
* @return The array of points in pixel coordinates
|
||||
*/
|
||||
public static final double[][] latlonToPixel(Coordinate[] pts,
|
||||
|
@ -843,6 +845,27 @@ public class PgenUtil {
|
|||
return pixels;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts an array of point in pixel coordinates to lat/lons
|
||||
*
|
||||
* @param pixels
|
||||
* An array of points in pixel coordinates
|
||||
* @param mapDescriptor
|
||||
* Descriptor to use for world to pixel transform
|
||||
* @return The array list of points in lat/lon coordinates
|
||||
*/
|
||||
public static final ArrayList<Coordinate> pixelToLatlon(double[][] pixels,
|
||||
IMapDescriptor mapDescriptor) {
|
||||
ArrayList<Coordinate> crd = new ArrayList<Coordinate>();
|
||||
|
||||
for (int ii = 0; ii < pixels.length; ii++) {
|
||||
double[] pt = mapDescriptor.pixelToWorld(pixels[ii]);
|
||||
crd.add(new Coordinate(pt[0], pt[1]));
|
||||
}
|
||||
|
||||
return crd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current site id from the localization Manager
|
||||
*
|
||||
|
@ -2344,7 +2367,7 @@ public class PgenUtil {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns text auto placement flag
|
||||
* ReturnsCCFP text box auto placement flag
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
@ -2353,6 +2376,16 @@ public class PgenUtil {
|
|||
return prefs.getBoolean(PgenPreferences.P_AUTOPLACE_TEXT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns contour's label auto placement flag
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static boolean getContourLabelAutoPlacement() {
|
||||
IPreferenceStore prefs = Activator.getDefault().getPreferenceStore();
|
||||
return prefs.getBoolean(PgenPreferences.P_AUTOPLACE_CONTOUR_LABEL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default PGEN layer merge option.
|
||||
*
|
||||
|
|
|
@ -113,6 +113,10 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* similar changes to labels for other contour objects
|
||||
* caused a similar error (label or object or both
|
||||
* would disappear), this should now be fixed.
|
||||
* 05/02/2014 ? D. Sushon In testing solution for trac 1132, it was found that
|
||||
* multiple instances of the contour dialog's Edit
|
||||
* windows could be created with no way to remove,
|
||||
* should now be fixed.
|
||||
* 05/14 TTR1008 J. Wu Set default contour parameters through settings_tbl.xml.
|
||||
*
|
||||
* </pre>
|
||||
|
@ -1960,6 +1964,16 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int open() {
|
||||
|
||||
if (this.getShell() == null || this.getShell().isDisposed()) {
|
||||
return super.open();
|
||||
} else {
|
||||
return CANCEL;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the label attributes
|
||||
*/
|
||||
|
@ -1994,6 +2008,11 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
|||
this.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleShellCloseEvent() {
|
||||
this.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* disable un-used widgets
|
||||
*/
|
||||
|
@ -2260,6 +2279,11 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
|||
this.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleShellCloseEvent() {
|
||||
this.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* disable un-used widgets
|
||||
*/
|
||||
|
@ -2425,6 +2449,11 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
|||
this.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleShellCloseEvent() {
|
||||
this.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* disable un-used widgets
|
||||
*/
|
||||
|
@ -3123,6 +3152,16 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int open() {
|
||||
|
||||
if (this.getShell() == null || this.getShell().isDisposed()) {
|
||||
return super.open();
|
||||
} else {
|
||||
return CANCEL;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the min/max attributes
|
||||
*/
|
||||
|
@ -3159,6 +3198,11 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
|||
this.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleShellCloseEvent() {
|
||||
this.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* initialize dialog
|
||||
*/
|
||||
|
@ -3902,4 +3946,4 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
|||
return typeChanged;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -49,6 +49,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
|||
* ------------ ---------- ----------- -----------------------------------
|
||||
* 03/13 #977 S. Gilbert Initial creation
|
||||
* 01/14 #1105 J. Wu Pre-fill for each activity info.
|
||||
* 05/14 TTR 963 J. Wu Change activity Info to Activity Label.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -440,7 +441,7 @@ public class StoreActivityDialog extends CaveJFACEDialog {
|
|||
.getShell(),
|
||||
"Need More Information",
|
||||
null,
|
||||
"Activity Info field is required.\nPlease enter an appropriate string and then try saving!",
|
||||
"Activity Label field is required.\nPlease enter an appropriate string and then try saving!",
|
||||
MessageDialog.WARNING, new String[] { "OK" }, 0);
|
||||
|
||||
confirmDlg.open();
|
||||
|
|
|
@ -140,6 +140,7 @@ import com.vividsolutions.jts.operation.distance.DistanceOp;
|
|||
* this class
|
||||
* 11/13 TTR 752 J. Wu added methods to compute an element's range record.
|
||||
* 12/13 #1089 B. Yin Modify watch to display county list
|
||||
* 05/14 TTR 995 J. Wu Make contour label auto-placement an option.
|
||||
* </pre>
|
||||
*
|
||||
* @author sgilbert
|
||||
|
@ -336,10 +337,6 @@ public class DisplayElementFactory {
|
|||
list.addAll(createDisplayElementsForLines(de, smoothpts,
|
||||
paintProps));
|
||||
|
||||
// Draw labels for contour lines.
|
||||
// list.addAll( adjustContourLineLabels( elem, paintProps,
|
||||
// smoothpts ) );
|
||||
|
||||
}
|
||||
|
||||
return list;
|
||||
|
@ -382,7 +379,6 @@ public class DisplayElementFactory {
|
|||
LinePatternManager lpl = LinePatternManager.getInstance();
|
||||
try {
|
||||
pattern = lpl.getLinePattern(de.getPatternName());
|
||||
// System.out.println("&&&pattern "+pattern.getMaxExtent());
|
||||
} catch (LinePatternException lpe) {
|
||||
/*
|
||||
* could not find desired line pattern. Used solid line as default.
|
||||
|
@ -623,7 +619,7 @@ public class DisplayElementFactory {
|
|||
/*
|
||||
* Draw labels for contour lines.
|
||||
*/
|
||||
list.addAll(adjustContourLineLabels(elem, paintProps, smoothpts));
|
||||
// ???list.addAll(adjustContourLineLabels(elem, paintProps, smoothpts));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
@ -1342,7 +1338,9 @@ public class DisplayElementFactory {
|
|||
|| tparent instanceof ContourCircle) {
|
||||
return slist;
|
||||
} else if (tparent instanceof ContourMinmax) {
|
||||
if (((Text) txt).getAuto() != null && ((Text) txt).getAuto()) {
|
||||
boolean forceAuto = PgenUtil.getContourLabelAutoPlacement();
|
||||
if (((Text) txt).getAuto() != null && ((Text) txt).getAuto()
|
||||
|| forceAuto) {
|
||||
Coordinate loc = ((ISinglePoint) ((ContourMinmax) tparent)
|
||||
.getSymbol()).getLocation();
|
||||
double[] pixel = iDescriptor.worldToPixel(new double[] {
|
||||
|
@ -1356,6 +1354,11 @@ public class DisplayElementFactory {
|
|||
pixel[0], pixel[1], 0.0 });
|
||||
((Text) txt).setLocationOnly(new Coordinate(nloc[0],
|
||||
nloc[1]));
|
||||
// Only adjust once if auto-place flag in preference is
|
||||
// false.
|
||||
if (!forceAuto) {
|
||||
((Text) txt).setAuto(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3093,7 +3096,6 @@ public class DisplayElementFactory {
|
|||
*/
|
||||
double psize = pattern.getLength() * sfactor;
|
||||
double numPatterns = Math.floor(totalDist / psize);
|
||||
// System.out.println("NUM_OF_PATTERN_ITERATIONS="+numPatterns+":"+psize);
|
||||
|
||||
/*
|
||||
* Calculate the amount to increase or decrease the pattern length so
|
||||
|
@ -5153,6 +5155,8 @@ public class DisplayElementFactory {
|
|||
|
||||
boolean lineClosed = cline.getLine().isClosedLine();
|
||||
|
||||
boolean forceAuto = PgenUtil.getContourLabelAutoPlacement();
|
||||
|
||||
/*
|
||||
* Find the visible part of the line.
|
||||
*/
|
||||
|
@ -5328,13 +5332,17 @@ public class DisplayElementFactory {
|
|||
loc[1] = txtPositions.get(kk).y;
|
||||
|
||||
tps = iDescriptor.pixelToWorld(loc);
|
||||
if (txt.getAuto() != null && txt.getAuto()) {
|
||||
if (txt.getAuto() != null && txt.getAuto() || forceAuto) {
|
||||
txt.setLocationOnly(new Coordinate(tps[0], tps[1]));
|
||||
}
|
||||
|
||||
txt.setParent(null);
|
||||
dlist.addAll(createDisplayElements((IText) txt, paintProps));
|
||||
txt.setParent(cline);
|
||||
|
||||
if (!forceAuto) {
|
||||
txt.setAuto(false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5356,7 +5364,9 @@ public class DisplayElementFactory {
|
|||
|
||||
Text labelText = ((ContourCircle) parent).getLabel();
|
||||
|
||||
if (labelText.getAuto() != null && labelText.getAuto()) {
|
||||
boolean forceAuto = PgenUtil.getContourLabelAutoPlacement();
|
||||
|
||||
if (labelText.getAuto() != null && labelText.getAuto() || forceAuto) {
|
||||
/*
|
||||
* Find the visible part of the circle.
|
||||
*/
|
||||
|
@ -5409,6 +5419,10 @@ public class DisplayElementFactory {
|
|||
dlist.addAll(createDisplayElements((IText) labelText, paintProps));
|
||||
labelText.setParent(parent);
|
||||
|
||||
if (!forceAuto) {
|
||||
labelText.setAuto(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return dlist;
|
||||
|
@ -5455,8 +5469,7 @@ public class DisplayElementFactory {
|
|||
spdCoors.get(0),
|
||||
gov.noaa.nws.ncep.ui.pgen.display.IVector.VectorType.ARROW,
|
||||
10, vDir, 1.0, false, "Vector", "Arrow");
|
||||
// System.out.println("generate a text for " + spd + " at: "
|
||||
// + getCcfpTxtPts(v).x + "," + getCcfpTxtPts(v).y);
|
||||
|
||||
Text spdTxt = new Text(null, "Courier",
|
||||
14.0f,
|
||||
TextJustification.CENTER,// .LEFT_JUSTIFY,
|
||||
|
@ -5582,13 +5595,10 @@ public class DisplayElementFactory {
|
|||
*/
|
||||
public PgenRangeRecord findTextBoxRange(IText txt,
|
||||
PaintProperties paintProps) {
|
||||
// System.out.println("findTextBoxRange for IText .... enter ");
|
||||
|
||||
setScales(paintProps);
|
||||
|
||||
double[] tmp = { txt.getPosition().x, txt.getPosition().y, 0.0 };
|
||||
// System.out.println("findTextBoxRange for IText .... "
|
||||
// + txt.getPosition().x + "," + txt.getPosition().y);
|
||||
double[] loc = iDescriptor.worldToPixel(tmp);
|
||||
|
||||
double horizRatio = paintProps.getView().getExtent().getWidth()
|
||||
|
@ -5601,7 +5611,6 @@ public class DisplayElementFactory {
|
|||
*/
|
||||
IFont font = initializeFont(txt.getFontName(), txt.getFontSize(),
|
||||
txt.getStyle());
|
||||
// System.out.println("findTextBoxRange for IText .... 1 ");
|
||||
|
||||
/*
|
||||
* apply X offset in half-characters
|
||||
|
@ -5638,14 +5647,12 @@ public class DisplayElementFactory {
|
|||
((Text) txt).setXOffset(0);
|
||||
((Text) txt).setYOffset(0);
|
||||
}
|
||||
// System.out.println("findTextBoxRange for IText .... 2 ");
|
||||
|
||||
/*
|
||||
* Get text color
|
||||
*/
|
||||
Color clr = getDisplayColor(txt.getTextColor());
|
||||
RGB textColor = new RGB(clr.getRed(), clr.getGreen(), clr.getBlue());
|
||||
// System.out.println("findTextBoxRange for IText .... 2.5 ");
|
||||
|
||||
/*
|
||||
* Get angle rotation for text. If rotation is "North" relative,
|
||||
|
@ -5654,7 +5661,6 @@ public class DisplayElementFactory {
|
|||
double rotation = txt.getRotation();
|
||||
if (txt.getRotationRelativity() == TextRotation.NORTH_RELATIVE)
|
||||
rotation += northOffsetAngle(txt.getPosition());
|
||||
// System.out.println("findTextBoxRange for IText .... 3 ");
|
||||
|
||||
/*
|
||||
* create drawableString and calculate its bounds
|
||||
|
@ -5666,13 +5672,10 @@ public class DisplayElementFactory {
|
|||
dstring.horizontalAlignment = HorizontalAlignment.CENTER;
|
||||
dstring.verticallAlignment = VerticalAlignment.MIDDLE;
|
||||
dstring.rotation = rotation;
|
||||
// System.out.println("findTextBoxRange for IText .... 3.1 ");
|
||||
|
||||
Rectangle2D bounds = target.getStringsBounds(dstring);
|
||||
// System.out.println("findTextBoxRange for IText .... 3.1.1 ");
|
||||
double xOffset = (bounds.getWidth() + 1) * horizRatio / 2;
|
||||
double yOffset = (bounds.getHeight() + 1) * vertRatio / 2;
|
||||
// System.out.println("findTextBoxRange for IText .... 3.2 ");
|
||||
|
||||
/*
|
||||
* Set proper alignment
|
||||
|
@ -5699,7 +5702,6 @@ public class DisplayElementFactory {
|
|||
break;
|
||||
}
|
||||
}
|
||||
// System.out.println("findTextBoxRange for IText .... 4 ");
|
||||
|
||||
dstring.horizontalAlignment = align;
|
||||
|
||||
|
@ -5711,7 +5713,6 @@ public class DisplayElementFactory {
|
|||
|
||||
IExtent box = new PixelExtent(dstring.basics.x - left, dstring.basics.x
|
||||
+ right, dstring.basics.y - yOffset, dstring.basics.y + yOffset);
|
||||
// System.out.println("findTextBoxRange for IText .... 5 ");
|
||||
|
||||
List<Coordinate> rngBox = new ArrayList<Coordinate>();
|
||||
rngBox.add(new Coordinate(box.getMinX() - PgenRangeRecord.RANGE_OFFSET,
|
||||
|
@ -5726,8 +5727,6 @@ public class DisplayElementFactory {
|
|||
List<Coordinate> textPos = new ArrayList<Coordinate>();
|
||||
textPos.add(new Coordinate(loc[0], loc[1]));
|
||||
|
||||
// System.out.println("findTextBoxRange for IText .... return ");
|
||||
|
||||
return new PgenRangeRecord(rngBox, textPos, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -133,6 +133,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* 11/13 #1049 B. Yin Handle outlook type defined in layer.
|
||||
* 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.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -367,10 +368,11 @@ public class ProductConverter {
|
|||
text.setHide(fText.isHide());
|
||||
}
|
||||
|
||||
if (fText.isAuto() != null) {
|
||||
text.setAuto(fText.isAuto());
|
||||
}
|
||||
|
||||
/*
|
||||
* if (fText.isAuto() != null) { //
|
||||
* text.setAuto(fText.isAuto()); text.setAuto(false); }
|
||||
*/
|
||||
text.setAuto(false);
|
||||
des.add(text);
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -58,6 +58,7 @@ import com.vividsolutions.jts.geom.impl.CoordinateArraySequence;
|
|||
* a GEMPAK grid file
|
||||
* 09/10 #215 J. Wu Checked working directory and PATH.
|
||||
* 11/10 #345 J. Wu Added support for circle.
|
||||
* 05/14 TTR989 J. Wu Allow environmental variable in PATH.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -418,26 +419,61 @@ public class ContoursToGrid extends GraphToGrid {
|
|||
}
|
||||
}
|
||||
|
||||
String fullFile = new String(path + "/" + gdoutf);
|
||||
|
||||
/*
|
||||
* GEMPAK cannot accept a PATH with upper case letter, however, it takes
|
||||
* environmental variables (which is UPPER CASE!). So we need to parse
|
||||
* the environmental variables in the PATH before checking upper case
|
||||
* characters.
|
||||
*
|
||||
* Check if the PATH is valid and exists
|
||||
*/
|
||||
File grdfile = new File(path);
|
||||
|
||||
Pattern ptn = Pattern.compile("[A-Z]");
|
||||
Matcher mt = ptn.matcher(path);
|
||||
|
||||
String msg = null;
|
||||
if (mt.find()) {
|
||||
msg = new String("The PATH cannot have upper case in it");
|
||||
} else {
|
||||
if (!grdfile.exists()) {
|
||||
msg = new String(
|
||||
"The PATH does not exist, please create it first");
|
||||
|
||||
String[] dirs = path.split(File.separator);
|
||||
StringBuilder rpath = new StringBuilder();
|
||||
for (String str : dirs) {
|
||||
if (str.trim().startsWith("$")) {
|
||||
String val = System.getenv(str.substring(1));
|
||||
if (val != null) {
|
||||
rpath.append(val);
|
||||
rpath.append(File.separator);
|
||||
} else {
|
||||
msg = new String(str + " is not defined.");
|
||||
rpath = new StringBuilder(path);
|
||||
break;
|
||||
}
|
||||
} else if (str.trim().startsWith("~")) {
|
||||
rpath.append(System.getProperty("user.home"));
|
||||
rpath.append(File.separator);
|
||||
} else {
|
||||
rpath.append(str);
|
||||
rpath.append(File.separator);
|
||||
}
|
||||
}
|
||||
|
||||
String fpath = rpath.toString();
|
||||
if (fpath.endsWith(File.separator)) {
|
||||
fpath = fpath.substring(0, fpath.length() - 1);
|
||||
}
|
||||
|
||||
Pattern ptn = Pattern.compile("[A-Z]");
|
||||
Matcher mt = ptn.matcher(fpath);
|
||||
|
||||
File grdfile = new File(fpath);
|
||||
|
||||
if (msg == null) {
|
||||
if (mt.find()) {
|
||||
msg = new String("The PATH cannot have upper case in it");
|
||||
} else {
|
||||
if (!grdfile.exists()) {
|
||||
msg = new String(
|
||||
"The PATH does not exist, please create it first");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String fullFile = new String(fpath + "/" + gdoutf);
|
||||
|
||||
if (msg != null) {
|
||||
|
||||
MessageDialog msgDlg = new MessageDialog(PlatformUI.getWorkbench()
|
||||
|
@ -893,4 +929,4 @@ public class ContoursToGrid extends GraphToGrid {
|
|||
return points;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -19,8 +19,10 @@ import gov.noaa.nws.ncep.ui.pgen.contours.ContourLine;
|
|||
import gov.noaa.nws.ncep.ui.pgen.contours.ContourMinmax;
|
||||
import gov.noaa.nws.ncep.ui.pgen.contours.Contours;
|
||||
import gov.noaa.nws.ncep.ui.pgen.contours.IContours;
|
||||
import gov.noaa.nws.ncep.ui.pgen.elements.AbstractDrawableComponent;
|
||||
import gov.noaa.nws.ncep.ui.pgen.elements.DECollection;
|
||||
import gov.noaa.nws.ncep.ui.pgen.elements.DrawableElement;
|
||||
import gov.noaa.nws.ncep.ui.pgen.elements.Outlook;
|
||||
import gov.noaa.nws.ncep.ui.pgen.rsc.PgenResource;
|
||||
import gov.noaa.nws.ncep.viz.gempak.nativelib.LibraryLoader;
|
||||
|
||||
|
@ -30,6 +32,7 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.TimeZone;
|
||||
|
@ -70,6 +73,7 @@ import com.raytheon.viz.ui.editor.AbstractEditor;
|
|||
* 10/11 ? J. Wu Remove entry if the given table does not exist.
|
||||
* 08/13 TTR778 J. Wu Load libg2g when this dialog is created.
|
||||
* 12/13 1090 J. Wu Allow either table or element applied to g2g.
|
||||
* 05/14 TTR989 J. Wu Find current contour via contour parameters.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -858,11 +862,12 @@ public class GraphToGridParamDialog extends CaveJFACEDialog {
|
|||
|
||||
if (cntAttrDlg instanceof ContoursAttrDlg) {
|
||||
|
||||
// First try to get from dialog
|
||||
curCnt = ((ContoursAttrDlg) cntAttrDlg).getCurrentContours();
|
||||
|
||||
// Then try to get from the selected DE's parent....
|
||||
if (curCnt == null) {
|
||||
DrawableElement de = drawingLayer.getSelectedDE();
|
||||
|
||||
if (de != null
|
||||
&& (de.getParent() instanceof ContourLine
|
||||
|| de.getParent() instanceof ContourMinmax || de
|
||||
|
@ -871,6 +876,27 @@ public class GraphToGridParamDialog extends CaveJFACEDialog {
|
|||
curCnt = (Contours) de.getParent().getParent();
|
||||
}
|
||||
}
|
||||
|
||||
// Finally try to get from PgenResource - matching this contour
|
||||
// dialog's attributes.
|
||||
if (curCnt == null) {
|
||||
Iterator<AbstractDrawableComponent> it = drawingLayer
|
||||
.getActiveLayer().getComponentIterator();
|
||||
while (it.hasNext()) {
|
||||
AbstractDrawableComponent de = it.next();
|
||||
if (de instanceof Contours && !(de instanceof Outlook)) {
|
||||
Contours thisContour = (Contours) de;
|
||||
ContoursAttrDlg thisDlg = (ContoursAttrDlg) cntAttrDlg;
|
||||
|
||||
if (thisContour.getKey().equals(
|
||||
Contours.getKey(thisDlg))) {
|
||||
curCnt = (Contours) de;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else if (cntAttrDlg instanceof OutlookAttrDlg) {
|
||||
curCnt = ((OutlookAttrDlg) cntAttrDlg).getCurrentOtlk();
|
||||
}
|
||||
|
@ -1076,4 +1102,4 @@ public class GraphToGridParamDialog extends CaveJFACEDialog {
|
|||
return cints;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
/*
|
||||
* gov.noaa.nws.ncep.ui.pgen.rsc.PgenModifyTool
|
||||
*
|
||||
|
@ -9,25 +8,25 @@
|
|||
|
||||
package gov.noaa.nws.ncep.ui.pgen.tools;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.awt.Color;
|
||||
import gov.noaa.nws.ncep.ui.pgen.PgenUtil;
|
||||
import gov.noaa.nws.ncep.ui.pgen.annotation.Operation;
|
||||
import gov.noaa.nws.ncep.ui.pgen.elements.Arc;
|
||||
import gov.noaa.nws.ncep.ui.pgen.elements.DrawableElement;
|
||||
import gov.noaa.nws.ncep.ui.pgen.elements.Jet;
|
||||
import gov.noaa.nws.ncep.ui.pgen.elements.Line;
|
||||
import gov.noaa.nws.ncep.ui.pgen.elements.MultiPointElement;
|
||||
import gov.noaa.nws.ncep.ui.pgen.filter.OperationFilter;
|
||||
import gov.noaa.nws.ncep.ui.pgen.gfa.Gfa;
|
||||
import gov.noaa.nws.ncep.ui.pgen.gfa.GfaReducePoint;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.raytheon.uf.viz.core.map.IMapDescriptor;
|
||||
import com.raytheon.uf.viz.core.rsc.IInputHandler;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
|
||||
//import gov.noaa.nws.ncep.ui.display.InputHandlerDefaultImpl;
|
||||
import gov.noaa.nws.ncep.ui.pgen.PgenUtil;
|
||||
import gov.noaa.nws.ncep.ui.pgen.annotation.Operation;
|
||||
import gov.noaa.nws.ncep.ui.pgen.elements.Jet;
|
||||
import gov.noaa.nws.ncep.ui.pgen.elements.Line;
|
||||
import gov.noaa.nws.ncep.ui.pgen.elements.Arc;
|
||||
import gov.noaa.nws.ncep.ui.pgen.elements.MultiPointElement;
|
||||
import gov.noaa.nws.ncep.ui.pgen.elements.DrawableElement;
|
||||
import gov.noaa.nws.ncep.ui.pgen.filter.OperationFilter;
|
||||
import gov.noaa.nws.ncep.ui.pgen.gfa.Gfa;
|
||||
import gov.noaa.nws.ncep.ui.pgen.gfa.GfaReducePoint;
|
||||
import gov.noaa.nws.ncep.ui.pgen.tools.PgenModifyLine;
|
||||
|
||||
|
||||
/**
|
||||
* Implements a modal map tool for PGEN Line Modification function.
|
||||
|
@ -44,372 +43,434 @@ import gov.noaa.nws.ncep.ui.pgen.tools.PgenModifyLine;
|
|||
* Moved snap functionalities to SnapUtil from SigmetInfo.
|
||||
* 05/12 #808 J. Wu Update GFA vor text
|
||||
* 05/12 #610 J. Wu Add warning when GFA FROM lines > 3
|
||||
*
|
||||
* 05/12 TTR 998 J. Wu Use mapDescriptor's pixelToWorld instead of PaneManager's
|
||||
* translateClick() to convert point - translateClick() may
|
||||
* fail to convert if a point is outside of Grid coverage.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author J. Wu
|
||||
* @author J. Wu
|
||||
*/
|
||||
|
||||
public class PgenModifyTool extends AbstractPgenTool {
|
||||
|
||||
|
||||
/**
|
||||
* Input handler for mouse events.
|
||||
*/
|
||||
*/
|
||||
protected IInputHandler modifyHandler = null;
|
||||
|
||||
|
||||
|
||||
public PgenModifyTool() {
|
||||
|
||||
super();
|
||||
|
||||
|
||||
super();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the current mouse handler.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public IInputHandler getMouseHandler() {
|
||||
|
||||
if ( this.modifyHandler == null ) {
|
||||
|
||||
this.modifyHandler = new PgenModifyHandler();
|
||||
|
||||
*/
|
||||
public IInputHandler getMouseHandler() {
|
||||
|
||||
if (this.modifyHandler == null) {
|
||||
|
||||
this.modifyHandler = new PgenModifyHandler();
|
||||
|
||||
}
|
||||
|
||||
return this.modifyHandler;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implements input handler for mouse events.
|
||||
*
|
||||
* @author bingfan
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class PgenModifyHandler extends InputHandlerDefaultImpl {
|
||||
|
||||
private boolean preempt;
|
||||
OperationFilter modifyFilter = new OperationFilter( Operation.MODIFY );
|
||||
|
||||
/**
|
||||
* Array list to hold clicked points.
|
||||
*/
|
||||
|
||||
private boolean preempt;
|
||||
|
||||
OperationFilter modifyFilter = new OperationFilter(Operation.MODIFY);
|
||||
|
||||
/**
|
||||
* Array list to hold clicked points.
|
||||
*/
|
||||
ArrayList<Coordinate> clickPts = null;
|
||||
|
||||
/**
|
||||
* Ghost element that shows the modified element.
|
||||
*/
|
||||
MultiPointElement ghostEl = null;
|
||||
|
||||
/**
|
||||
* Instance for performing modification.
|
||||
*/
|
||||
PgenModifyLine pml = null;
|
||||
|
||||
/**
|
||||
* Color of the ghost element.
|
||||
*/
|
||||
Color ghostColor = new java.awt.Color( 255,255,255);
|
||||
|
||||
|
||||
/**
|
||||
* Ghost element that shows the modified element.
|
||||
*/
|
||||
MultiPointElement ghostEl = null;
|
||||
|
||||
/**
|
||||
* Instance for performing modification.
|
||||
*/
|
||||
PgenModifyLine pml = null;
|
||||
|
||||
/**
|
||||
* Color of the ghost element.
|
||||
*/
|
||||
Color ghostColor = new java.awt.Color(255, 255, 255);
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseDown(int,
|
||||
* int, int)
|
||||
* int, int)
|
||||
*/
|
||||
@Override
|
||||
public boolean handleMouseDown( int anX, int aY, int button ) {
|
||||
if ( !isResourceEditable() ) return false;
|
||||
@Override
|
||||
public boolean handleMouseDown(int anX, int aY, int button) {
|
||||
if (!isResourceEditable())
|
||||
return false;
|
||||
|
||||
preempt = false;
|
||||
// Check if mouse is in geographic extent
|
||||
Coordinate loc = mapEditor.translateClick(anX, aY);
|
||||
if ( loc == null || shiftDown ) return false;
|
||||
|
||||
if ( button == 1 ) {
|
||||
preempt = false;
|
||||
// Check if mouse is in geographic extent
|
||||
Coordinate loc = mapEditor.translateClick(anX, aY);
|
||||
if (loc == null || shiftDown)
|
||||
return false;
|
||||
|
||||
if ( drawingLayer.getSelectedDE() == null ) {
|
||||
|
||||
// Get the nearest element and set it as the selected element.
|
||||
DrawableElement elSelected = drawingLayer.getNearestElement( loc, modifyFilter);
|
||||
if (( (elSelected instanceof Line) && !(elSelected instanceof Arc ) ) || isModifiableSigmet(elSelected)) {
|
||||
drawingLayer.setSelected( elSelected );
|
||||
mapEditor.refresh();
|
||||
preempt = true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
preempt = true;
|
||||
|
||||
if ( clickPts == null ) {
|
||||
clickPts = new ArrayList<Coordinate>();
|
||||
}
|
||||
|
||||
clickPts.add( loc );
|
||||
|
||||
if ( pml == null ) {
|
||||
pml = new PgenModifyLine();
|
||||
}
|
||||
|
||||
pml.setClickPts( latlonToPixel( clickPts.toArray( new Coordinate[clickPts.size()] ) ) );
|
||||
|
||||
ModifyLine();
|
||||
|
||||
ghostEl.setColors(new Color[]{ ghostColor, new java.awt.Color( 255,255,255)});
|
||||
if (button == 1) {
|
||||
|
||||
drawingLayer.setGhostLine( ghostEl) ;
|
||||
mapEditor.refresh();
|
||||
|
||||
}
|
||||
|
||||
return preempt;
|
||||
|
||||
}
|
||||
else if ( button == 3 ) {
|
||||
|
||||
if ( drawingLayer.getSelectedDE() != null ) {
|
||||
|
||||
if ( clickPts != null && !clickPts.isEmpty() ) {
|
||||
|
||||
pml.setClickPts( latlonToPixel( clickPts.toArray( new Coordinate[clickPts.size()] ) ) );
|
||||
|
||||
ModifyLine();
|
||||
|
||||
if ( ! ( ((Line)drawingLayer.getSelectedDE()).isClosedLine() &&
|
||||
((MultiPointElement)ghostEl).getLinePoints().length < 3 ) ) {
|
||||
|
||||
MultiPointElement selected = (MultiPointElement)drawingLayer.getSelectedDE();
|
||||
|
||||
if ( selected instanceof Jet.JetLine ){
|
||||
|
||||
Jet jet = (Jet)drawingLayer.getActiveLayer().search(selected);
|
||||
Jet newJet = jet.copy();
|
||||
drawingLayer.replaceElement(jet, newJet);
|
||||
newJet.getPrimaryDE().setPoints( ghostEl.getPoints());
|
||||
drawingLayer.setSelected(newJet.getPrimaryDE());
|
||||
}
|
||||
else {
|
||||
MultiPointElement mpe = (MultiPointElement)drawingLayer.getSelectedDE().copy();
|
||||
if (drawingLayer.getSelectedDE() == null) {
|
||||
|
||||
drawingLayer.replaceElement( drawingLayer.getSelectedDE(), mpe );
|
||||
|
||||
//need snapping, get ghostEl's points with mpe's pgenType
|
||||
/*if( isModifiableSigmet(mpe)){
|
||||
ArrayList<Coordinate> list = SigmetInfo.getSnapWithStation(
|
||||
ghostEl.getPoints(),
|
||||
SigmetInfo.VOR_STATION_LIST,
|
||||
10,
|
||||
SigmetInfo.getNumOfCompassPts(mpe));
|
||||
//ArrayList<Coordinate> list2 = SigmetInfo.getNonDplicList(list);
|
||||
mpe.setPoints(list);//2);
|
||||
}else*/
|
||||
|
||||
mpe.setPoints(ghostEl.getPoints());
|
||||
if ( mpe instanceof Gfa ) {
|
||||
if( ((Gfa)mpe).getGfaFcstHr().indexOf("-") > -1 ){
|
||||
// snap
|
||||
((Gfa)mpe).snap();
|
||||
|
||||
GfaReducePoint.WarningForOverThreeLines( (Gfa)mpe );
|
||||
}
|
||||
|
||||
// Get the nearest element and set it as the selected
|
||||
// element.
|
||||
DrawableElement elSelected = drawingLayer
|
||||
.getNearestElement(loc, modifyFilter);
|
||||
if (((elSelected instanceof Line) && !(elSelected instanceof Arc))
|
||||
|| isModifiableSigmet(elSelected)) {
|
||||
drawingLayer.setSelected(elSelected);
|
||||
mapEditor.refresh();
|
||||
preempt = true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
preempt = true;
|
||||
|
||||
if (clickPts == null) {
|
||||
clickPts = new ArrayList<Coordinate>();
|
||||
}
|
||||
|
||||
clickPts.add(loc);
|
||||
|
||||
if (pml == null) {
|
||||
pml = new PgenModifyLine();
|
||||
}
|
||||
|
||||
pml.setClickPts(latlonToPixel(clickPts
|
||||
.toArray(new Coordinate[clickPts.size()])));
|
||||
|
||||
ModifyLine();
|
||||
|
||||
ghostEl.setColors(new Color[] { ghostColor,
|
||||
new java.awt.Color(255, 255, 255) });
|
||||
|
||||
drawingLayer.setGhostLine(ghostEl);
|
||||
mapEditor.refresh();
|
||||
|
||||
((Gfa)mpe).setGfaVorText( Gfa.buildVorText( (Gfa)mpe ));
|
||||
}
|
||||
|
||||
drawingLayer.setSelected( mpe );
|
||||
}
|
||||
}
|
||||
|
||||
drawingLayer.removeGhostLine();
|
||||
clickPts.clear();
|
||||
|
||||
mapEditor.refresh();
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
ghostEl = null;
|
||||
|
||||
drawingLayer.removeGhostLine();
|
||||
drawingLayer.removeSelected();
|
||||
mapEditor.refresh();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
drawingLayer.removeSelected();
|
||||
mapEditor.refresh();
|
||||
|
||||
// set selecting mode
|
||||
PgenUtil.setSelectingMode();
|
||||
|
||||
|
||||
return preempt;
|
||||
|
||||
} else if (button == 3) {
|
||||
|
||||
if (drawingLayer.getSelectedDE() != null) {
|
||||
|
||||
if (clickPts != null && !clickPts.isEmpty()) {
|
||||
|
||||
pml.setClickPts(latlonToPixel(clickPts
|
||||
.toArray(new Coordinate[clickPts.size()])));
|
||||
|
||||
ModifyLine();
|
||||
|
||||
if (!(((Line) drawingLayer.getSelectedDE())
|
||||
.isClosedLine() && ((MultiPointElement) ghostEl)
|
||||
.getLinePoints().length < 3)) {
|
||||
|
||||
MultiPointElement selected = (MultiPointElement) drawingLayer
|
||||
.getSelectedDE();
|
||||
|
||||
if (selected instanceof Jet.JetLine) {
|
||||
|
||||
Jet jet = (Jet) drawingLayer.getActiveLayer()
|
||||
.search(selected);
|
||||
Jet newJet = jet.copy();
|
||||
drawingLayer.replaceElement(jet, newJet);
|
||||
newJet.getPrimaryDE().setPoints(
|
||||
ghostEl.getPoints());
|
||||
drawingLayer.setSelected(newJet.getPrimaryDE());
|
||||
} else {
|
||||
MultiPointElement mpe = (MultiPointElement) drawingLayer
|
||||
.getSelectedDE().copy();
|
||||
|
||||
drawingLayer.replaceElement(
|
||||
drawingLayer.getSelectedDE(), mpe);
|
||||
|
||||
// need snapping, get ghostEl's points with
|
||||
// mpe's pgenType
|
||||
/*
|
||||
* if( isModifiableSigmet(mpe)){
|
||||
* ArrayList<Coordinate> list =
|
||||
* SigmetInfo.getSnapWithStation(
|
||||
* ghostEl.getPoints(),
|
||||
* SigmetInfo.VOR_STATION_LIST, 10,
|
||||
* SigmetInfo.getNumOfCompassPts(mpe));
|
||||
* //ArrayList<Coordinate> list2 =
|
||||
* SigmetInfo.getNonDplicList(list);
|
||||
* mpe.setPoints(list);//2); }else
|
||||
*/
|
||||
|
||||
mpe.setPoints(ghostEl.getPoints());
|
||||
if (mpe instanceof Gfa) {
|
||||
if (((Gfa) mpe).getGfaFcstHr().indexOf("-") > -1) {
|
||||
// snap
|
||||
((Gfa) mpe).snap();
|
||||
|
||||
GfaReducePoint
|
||||
.WarningForOverThreeLines((Gfa) mpe);
|
||||
}
|
||||
|
||||
((Gfa) mpe).setGfaVorText(Gfa
|
||||
.buildVorText((Gfa) mpe));
|
||||
}
|
||||
|
||||
drawingLayer.setSelected(mpe);
|
||||
}
|
||||
}
|
||||
|
||||
drawingLayer.removeGhostLine();
|
||||
clickPts.clear();
|
||||
|
||||
mapEditor.refresh();
|
||||
|
||||
} else {
|
||||
|
||||
ghostEl = null;
|
||||
|
||||
drawingLayer.removeGhostLine();
|
||||
drawingLayer.removeSelected();
|
||||
mapEditor.refresh();
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
drawingLayer.removeSelected();
|
||||
mapEditor.refresh();
|
||||
|
||||
// set selecting mode
|
||||
PgenUtil.setSelectingMode();
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
else {
|
||||
return false;
|
||||
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseMove(int,
|
||||
* int)
|
||||
* int)
|
||||
*/
|
||||
@Override
|
||||
public boolean handleMouseMove(int x, int y) {
|
||||
if ( !isResourceEditable() ) return false;
|
||||
if (!isResourceEditable())
|
||||
return false;
|
||||
|
||||
// Check if mouse is in geographic extent
|
||||
Coordinate loc = mapEditor.translateClick(x, y);
|
||||
if (loc == null)
|
||||
return false;
|
||||
|
||||
// create the ghost element and put it in the drawing layer
|
||||
if (clickPts != null && clickPts.size() >= 1) {
|
||||
|
||||
ArrayList<Coordinate> newPts = new ArrayList<Coordinate>(
|
||||
clickPts);
|
||||
newPts.add(loc);
|
||||
|
||||
pml.setClickPts(latlonToPixel(newPts
|
||||
.toArray(new Coordinate[newPts.size()])));
|
||||
|
||||
ModifyLine();
|
||||
|
||||
ghostEl.setColors(new Color[] { ghostColor,
|
||||
new java.awt.Color(255, 255, 255) });
|
||||
drawingLayer.setGhostLine(ghostEl);
|
||||
mapEditor.refresh();
|
||||
|
||||
// Check if mouse is in geographic extent
|
||||
Coordinate loc = mapEditor.translateClick(x, y);
|
||||
if ( loc == null ) return false;
|
||||
|
||||
// create the ghost element and put it in the drawing layer
|
||||
if ( clickPts != null && clickPts.size() >= 1 ) {
|
||||
|
||||
ArrayList<Coordinate> newPts = new ArrayList<Coordinate>( clickPts );
|
||||
newPts.add( loc );
|
||||
|
||||
pml.setClickPts( latlonToPixel( newPts.toArray( new Coordinate[newPts.size()] ) ) );
|
||||
|
||||
ModifyLine();
|
||||
|
||||
ghostEl.setColors(new Color[]{ ghostColor, new java.awt.Color( 255,255,255)});
|
||||
drawingLayer.setGhostLine( ghostEl) ;
|
||||
mapEditor.refresh();
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseUp(int, int,
|
||||
* int)
|
||||
* int)
|
||||
*/
|
||||
@Override
|
||||
public boolean handleMouseUp( int x, int y, int button) {
|
||||
|
||||
public boolean handleMouseUp(int x, int y, int button) {
|
||||
|
||||
return false;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
|
||||
if ( !isResourceEditable() || shiftDown ) return false;
|
||||
else return preempt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set up a "modify" instance, perform modification and
|
||||
* build a new modified element
|
||||
*/
|
||||
private void ModifyLine( ) {
|
||||
|
||||
pml.setOriginalPts( latlonToPixel( ((Line)drawingLayer.getSelectedDE()).getLinePoints() ) );
|
||||
|
||||
pml.setSmoothLevel ( ((Line)drawingLayer.getSelectedDE()).getSmoothFactor() );
|
||||
@Override
|
||||
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
|
||||
if (!isResourceEditable() || shiftDown)
|
||||
return false;
|
||||
else
|
||||
return preempt;
|
||||
}
|
||||
|
||||
pml.setClosed ( ((Line)drawingLayer.getSelectedDE()).isClosedLine() );
|
||||
|
||||
pml.PerformModify();
|
||||
|
||||
buildNewElement();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts an array of lat/lons to pixel coordinates
|
||||
* @param pts An array of points in lat/lon coordinates
|
||||
* @return The array of points in pixel coordinates
|
||||
*/
|
||||
private double[][] latlonToPixel( Coordinate[] pts ) {
|
||||
|
||||
double[] point = new double[2];
|
||||
double[][] pixels = new double[pts.length][2];
|
||||
|
||||
int ii = 0;
|
||||
for ( Coordinate crd : pts ) {
|
||||
|
||||
point = mapEditor.translateInverseClick( crd );
|
||||
pixels[ii][0] = point[0];
|
||||
pixels[ii][1] = point[1];
|
||||
|
||||
ii++;
|
||||
}
|
||||
|
||||
return pixels;
|
||||
}
|
||||
/**
|
||||
* Set up a "modify" instance, perform modification and build a new
|
||||
* modified element
|
||||
*/
|
||||
private void ModifyLine() {
|
||||
|
||||
|
||||
/**
|
||||
* Converts an array of pixel coordinates to lat/lons
|
||||
* @param pts An array of points in pixel coordinates
|
||||
* @return The array of points in Lat/Lons
|
||||
*/
|
||||
private ArrayList<Coordinate> pixelToLatlon( double[][] pixels ) {
|
||||
|
||||
ArrayList<Coordinate> crd = new ArrayList<Coordinate>();
|
||||
|
||||
for ( int ii = 0; ii < pixels.length; ii++ ) {
|
||||
crd.add( mapEditor.translateClick( pixels[ii][0], pixels[ii][1] ) );
|
||||
}
|
||||
|
||||
return crd;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a new modified DrawableElement from a set of lat/lons
|
||||
* @param pts An array of points in pixel coordinates
|
||||
* @return The array of points in Lat/Lons
|
||||
*/
|
||||
private void buildNewElement() {
|
||||
|
||||
ghostEl = (MultiPointElement)( drawingLayer.getSelectedDE().copy() );
|
||||
|
||||
if ( ghostEl != null && pml.getModifiedPts() != null && pml.getModifiedPts().length > 1 ) {
|
||||
|
||||
ghostEl.setLinePoints( pixelToLatlon( pml.getModifiedPts() ) );
|
||||
|
||||
if ( ((Line)drawingLayer.getSelectedDE()).isClosedLine() ) {
|
||||
if ( pml.getModifiedPts().length < 3 ) {
|
||||
ghostEl.setClosed( false );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
pml.setOriginalPts(latlonToPixel(((Line) drawingLayer
|
||||
.getSelectedDE()).getLinePoints()));
|
||||
|
||||
pml.setSmoothLevel(((Line) drawingLayer.getSelectedDE())
|
||||
.getSmoothFactor());
|
||||
|
||||
pml.setClosed(((Line) drawingLayer.getSelectedDE()).isClosedLine());
|
||||
|
||||
pml.PerformModify();
|
||||
|
||||
buildNewElement();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts an array of lat/lons to pixel coordinates
|
||||
*
|
||||
* @param pts
|
||||
* An array of points in lat/lon coordinates
|
||||
* @return The array of points in pixel coordinates
|
||||
*/
|
||||
private double[][] latlonToPixelOld(Coordinate[] pts) {
|
||||
|
||||
double[] point = new double[2];
|
||||
double[][] pixels = new double[pts.length][2];
|
||||
|
||||
int ii = 0;
|
||||
for (Coordinate crd : pts) {
|
||||
|
||||
point = mapEditor.translateInverseClick(crd);
|
||||
pixels[ii][0] = point[0];
|
||||
pixels[ii][1] = point[1];
|
||||
|
||||
ii++;
|
||||
}
|
||||
|
||||
return pixels;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts an array of pixel coordinates to lat/lons
|
||||
*
|
||||
* @param pts
|
||||
* An array of points in pixel coordinates
|
||||
* @return The array of points in Lat/Lons
|
||||
*/
|
||||
private ArrayList<Coordinate> pixelToLatlonOld(double[][] pixels) {
|
||||
|
||||
ArrayList<Coordinate> crd = new ArrayList<Coordinate>();
|
||||
|
||||
for (int ii = 0; ii < pixels.length; ii++) {
|
||||
crd.add(mapEditor.translateClick(pixels[ii][0], pixels[ii][1]));
|
||||
}
|
||||
|
||||
return crd;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a new modified DrawableElement from a set of lat/lons
|
||||
*
|
||||
* @param pts
|
||||
* An array of points in pixel coordinates
|
||||
* @return The array of points in Lat/Lons
|
||||
*/
|
||||
private void buildNewElement() {
|
||||
|
||||
ghostEl = (MultiPointElement) (drawingLayer.getSelectedDE().copy());
|
||||
|
||||
if (ghostEl != null && pml.getModifiedPts() != null
|
||||
&& pml.getModifiedPts().length > 1) {
|
||||
|
||||
ghostEl.setLinePoints(pixelToLatlon(pml.getModifiedPts()));
|
||||
|
||||
if (((Line) drawingLayer.getSelectedDE()).isClosedLine()) {
|
||||
if (pml.getModifiedPts().length < 3) {
|
||||
ghostEl.setClosed(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts an array of pixel coordinates to lat/lons
|
||||
*
|
||||
* @param pts
|
||||
* An array of points in pixel coordinates
|
||||
* @return The array of points in Lat/Lons
|
||||
*/
|
||||
private ArrayList<Coordinate> pixelToLatlon(double[][] pixels) {
|
||||
|
||||
return PgenUtil.pixelToLatlon(pixels, (IMapDescriptor) mapEditor
|
||||
.getActiveDisplayPane().getRenderableDisplay()
|
||||
.getDescriptor());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts an array of lat/lons to pixel coordinates
|
||||
*
|
||||
* @param pts
|
||||
* An array of points in lat/lon coordinates
|
||||
* @return The array of points in pixel coordinates
|
||||
*/
|
||||
private double[][] latlonToPixel(Coordinate[] pts) {
|
||||
return PgenUtil.latlonToPixel(pts, (IMapDescriptor) mapEditor
|
||||
.getActiveDisplayPane().getRenderableDisplay()
|
||||
.getDescriptor());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* check if the DE is modifiable Sigmet.
|
||||
* @param DrawableElement: DE to be checked.
|
||||
*
|
||||
* @param DrawableElement
|
||||
* : DE to be checked.
|
||||
* @return boolean: true: the Sigmet is Modifiable.
|
||||
*/
|
||||
private boolean isModifiableSigmet(DrawableElement el){
|
||||
|
||||
if(el instanceof gov.noaa.nws.ncep.ui.pgen.sigmet.Sigmet){
|
||||
gov.noaa.nws.ncep.ui.pgen.sigmet.Sigmet sig = (gov.noaa.nws.ncep.ui.pgen.sigmet.Sigmet) el;
|
||||
|
||||
if( ! sig.getType().contains("Text") && ! sig.getType().contains("Isolated"))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
private boolean isModifiableSigmet(DrawableElement el) {
|
||||
|
||||
if (el instanceof gov.noaa.nws.ncep.ui.pgen.sigmet.Sigmet) {
|
||||
gov.noaa.nws.ncep.ui.pgen.sigmet.Sigmet sig = (gov.noaa.nws.ncep.ui.pgen.sigmet.Sigmet) el;
|
||||
|
||||
if (!sig.getType().contains("Text")
|
||||
&& !sig.getType().contains("Isolated"))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<AttributeSetGroup xmlns:ns2="http://www.example.org/productType" xmlns:ns3="group">
|
||||
<resource>NAM32</resource>
|
||||
<attrSetGroupName>standard</attrSetGroupName>
|
||||
<attrSetNames>1000-500_thkn,1000-850_thkn,1000mb_hght_tmp_wind,100mb_hght_wind,200mb_hght_wind,250mb_ageo_div_isotachs,250mb_hght_wind,300mb_hght_wind,500mb_hght_absv_wnd,500mb_hght_color,500mb_hght_wind,500mb_hght_tmp_wind,700mb_hght_rh_omega,700mb_hght_tmp_wind,850-700_thkn,850mb_hght_tmp_wind,pmsl,pmsl_thkn</attrSetNames>
|
||||
</AttributeSetGroup>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<AttributeSetGroup xmlns:ns2="http://www.example.org/productType" xmlns:ns3="group">
|
||||
<resource>NAM40</resource>
|
||||
<attrSetGroupName>standard</attrSetGroupName>
|
||||
<attrSetNames>1000-500_thkn,1000-850_thkn,1000mb_hght_tmp_wind,100mb_hght_wind,200mb_hght_wind,250mb_ageo_div_isotachs,250mb_hght_wind,300mb_hght_wind,500mb_hght_absv_wnd,500mb_hght_color,500mb_hght_wind,500mb_hght_tmp_wind,700mb_hght_rh_omega,700mb_hght_tmp_wind,850-700_thkn,850mb_hght_tmp_wind,pmsl,pmsl_thkn</attrSetNames>
|
||||
</AttributeSetGroup>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<AttributeSetGroup xmlns:ns2="http://www.example.org/productType" xmlns:ns3="group">
|
||||
<resource>NAM5</resource>
|
||||
<attrSetGroupName>standard</attrSetGroupName>
|
||||
<attrSetNames>1000-500_thkn,1000-850_thkn,1000mb_hght_tmp_wind,100mb_hght_wind,200mb_hght_wind,250mb_ageo_div_isotachs,250mb_hght_wind,300mb_hght_wind,500mb_hght_absv_wnd,500mb_hght_color,500mb_hght_wind,500mb_hght_tmp_wind,700mb_hght_rh_omega,700mb_hght_tmp_wind,850-700_thkn,850mb_hght_tmp_wind,pmsl,pmsl_thkn</attrSetNames>
|
||||
</AttributeSetGroup>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<AttributeSetGroup xmlns:ns2="http://www.example.org/productType" xmlns:ns3="group">
|
||||
<resource>NAVGEM</resource>
|
||||
<attrSetGroupName>exp_marine</attrSetGroupName>
|
||||
<attrSetNames>1000-850thk_only,500_vort_only,pmsl_1000-850thk,pmsl_1000-500thk,pmsl_only,bl_winds_only_nogaps</attrSetNames>
|
||||
</AttributeSetGroup>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<AttributeSetGroup xmlns:ns2="http://www.example.org/productType" xmlns:ns3="group">
|
||||
<resource>NAVGEM</resource>
|
||||
<attrSetGroupName>loops</attrSetGroupName>
|
||||
<attrSetNames>24-hr_obs_pcpn_al,24-hr_obs_pcpn_spc_al</attrSetNames>
|
||||
</AttributeSetGroup>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<AttributeSetGroup xmlns:ns2="http://www.example.org/productType" xmlns:ns3="group">
|
||||
<resource>NAVGEM</resource>
|
||||
<attrSetGroupName>marine</attrSetGroupName>
|
||||
<attrSetNames>1000mb_hght_absv,850mb_hght_absv,pmsl_1000-850_thk_global,pmsl_and_bl_wind_nogaps</attrSetNames>
|
||||
</AttributeSetGroup>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<AttributeSetGroup xmlns:ns2="http://www.example.org/productType" xmlns:ns3="group">
|
||||
<resource>NAVGEM</resource>
|
||||
<attrSetGroupName>medr</attrSetGroupName>
|
||||
<attrSetNames>1000-500_thkn</attrSetNames>
|
||||
</AttributeSetGroup>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<AttributeSetGroup xmlns:ns2="http://www.example.org/productType" xmlns:ns3="group">
|
||||
<resource>NAVGEM</resource>
|
||||
<attrSetGroupName>no_col-fill</attrSetGroupName>
|
||||
<attrSetNames>500mb_absv_ncf</attrSetNames>
|
||||
</AttributeSetGroup>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<AttributeSetGroup xmlns:ns2="http://www.example.org/productType" xmlns:ns3="group">
|
||||
<resource>NAVGEM</resource>
|
||||
<attrSetGroupName>precip</attrSetGroupName>
|
||||
<attrSetNames>precip_12hr_nogaps,precip_12hr_mm_nogaps</attrSetNames>
|
||||
</AttributeSetGroup>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<AttributeSetGroup xmlns:ns2="http://www.example.org/productType" xmlns:ns3="group">
|
||||
<resource>NAVGEM</resource>
|
||||
<attrSetGroupName>standard</attrSetGroupName>
|
||||
<attrSetNames>1000-500_thkn,1000-850_thkn,1000mb_hght_tmp_wind,200mb_div_isotachs,200mb_hght_wind,250mb_hght_wind,250mb_wind_and_rel_vort,300mb_div_isotachs,300mb_hght_absv_adv,300mb_hght_wind,300mb_hght_tmp_wind,500mb_hght_absv,500mb_hght_absv_adv,500mb_hght_absv_wnd,500mb_hght_color,500mb_hght_geoabsv,500mb_hght_rh_omega,500mb_hght_wind,500mb_hght_tmp_wind,700mb_hght_rh_omega,700mb_hght_tmp_wind,850-700_thkn,850mb_hght_tmp_wind,850mb_hgt_wind,pmsl,pmsl_thkn,pmsl_and_bl_wind_nogaps,300-200mb_pv,400-200mb_pv,400-250mb_pv_global,500-250mb_pv,500-300mb_pv</attrSetNames>
|
||||
</AttributeSetGroup>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<AttributeSetGroup xmlns:ns2="http://www.example.org/productType" xmlns:ns3="group">
|
||||
<resource>NAVGEM</resource>
|
||||
<attrSetGroupName>surface</attrSetGroupName>
|
||||
<attrSetNames>1000-500_thkn,1000-850_thkn,500mb_absv_ncf,500mb_hght,850-700_thkn,pmsl</attrSetNames>
|
||||
</AttributeSetGroup>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<AttributeSetGroup xmlns:ns2="http://www.example.org/productType" xmlns:ns3="group">
|
||||
<resource>NAVGEM</resource>
|
||||
<attrSetGroupName>tropical</attrSetGroupName>
|
||||
<attrSetNames>500mb_hght_absv</attrSetNames>
|
||||
</AttributeSetGroup>
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<ResourceDefinition xmlns:ns2="http://www.example.org/productType">
|
||||
<resourceDefnName>NAM11</resourceDefnName>
|
||||
<resourceDefnName>NAM32</resourceDefnName>
|
||||
<resourceCategory>GRID</resourceCategory>
|
||||
<rscImplementation>ModelFcstGridContours</rscImplementation>
|
||||
<subTypeGenerator></subTypeGenerator>
|
||||
|
@ -13,7 +13,7 @@
|
|||
<dfltGeogArea>BasicWX_US</dfltGeogArea>
|
||||
<resourceParameters>
|
||||
pluginName=grid
|
||||
GDFILE=ETA242
|
||||
GDFILE=nam32
|
||||
|
||||
</resourceParameters>
|
||||
<inventoryEnabled>true</inventoryEnabled>
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<ResourceDefinition xmlns:ns2="http://www.example.org/productType">
|
||||
<resourceDefnName>NAM40</resourceDefnName>
|
||||
<resourceCategory>GRID</resourceCategory>
|
||||
<rscImplementation>ModelFcstGridContours</rscImplementation>
|
||||
<subTypeGenerator></subTypeGenerator>
|
||||
<rscTypeGenerator></rscTypeGenerator>
|
||||
<timeMatchMethod>CLOSEST_BEFORE_OR_AFTER</timeMatchMethod>
|
||||
<frameSpan>60</frameSpan>
|
||||
<timelineGenMethod>USE_CYCLE_TIME_FCST_HOURS</timelineGenMethod>
|
||||
<dfltFrameCount>999</dfltFrameCount>
|
||||
<dfltTimeRange>96</dfltTimeRange>
|
||||
<dfltGeogArea>BasicWX_US</dfltGeogArea>
|
||||
<resourceParameters>
|
||||
pluginName=grid
|
||||
GDFILE=mesoEta212
|
||||
|
||||
</resourceParameters>
|
||||
<inventoryEnabled>true</inventoryEnabled>
|
||||
</ResourceDefinition>
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<ResourceDefinition xmlns:ns2="http://www.example.org/productType">
|
||||
<resourceDefnName>NMM40</resourceDefnName>
|
||||
<resourceDefnName>NAM40_SFC</resourceDefnName>
|
||||
<resourceCategory>GRID</resourceCategory>
|
||||
<rscImplementation>ModelFcstGridContours</rscImplementation>
|
||||
<subTypeGenerator></subTypeGenerator>
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<ResourceDefinition xmlns:ns2="http://www.example.org/productType">
|
||||
<resourceDefnName>NAM5</resourceDefnName>
|
||||
<resourceCategory>GRID</resourceCategory>
|
||||
<rscImplementation>ModelFcstGridContours</rscImplementation>
|
||||
<subTypeGenerator></subTypeGenerator>
|
||||
<rscTypeGenerator></rscTypeGenerator>
|
||||
<timeMatchMethod>CLOSEST_BEFORE_OR_AFTER</timeMatchMethod>
|
||||
<frameSpan>60</frameSpan>
|
||||
<timelineGenMethod>USE_CYCLE_TIME_FCST_HOURS</timelineGenMethod>
|
||||
<dfltFrameCount>999</dfltFrameCount>
|
||||
<dfltTimeRange>96</dfltTimeRange>
|
||||
<dfltGeogArea>BasicWX_US</dfltGeogArea>
|
||||
<resourceParameters>
|
||||
pluginName=grid
|
||||
GDFILE=NAM227
|
||||
|
||||
</resourceParameters>
|
||||
<inventoryEnabled>true</inventoryEnabled>
|
||||
</ResourceDefinition>
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<ResourceDefinition xmlns:ns2="group" xmlns:ns3="http://www.example.org/productType">
|
||||
<inventoryEnabled>true</inventoryEnabled>
|
||||
<resourceDefnName>NAVGEM</resourceDefnName>
|
||||
<resourceCategory>GRID</resourceCategory>
|
||||
<resourceParameters>
|
||||
GDFILE=nogaps
|
||||
pluginName=grid
|
||||
</resourceParameters>
|
||||
<rscImplementation>ModelFcstGridContours</rscImplementation>
|
||||
<subTypeGenerator></subTypeGenerator>
|
||||
<rscTypeGenerator></rscTypeGenerator>
|
||||
<timeMatchMethod>CLOSEST_BEFORE_OR_AFTER</timeMatchMethod>
|
||||
<frameSpan>60</frameSpan>
|
||||
<timelineGenMethod>USE_CYCLE_TIME_FCST_HOURS</timelineGenMethod>
|
||||
<dfltFrameCount>999</dfltFrameCount>
|
||||
<dfltTimeRange>240</dfltTimeRange>
|
||||
<dfltGeogArea>BasicWX_US</dfltGeogArea>
|
||||
</ResourceDefinition>
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<ResourceDefinition xmlns:ns2="group" xmlns:ns3="http://www.example.org/productType">
|
||||
<resourceDefnName>HYSPLIT_NT</resourceDefnName>
|
||||
<inventoryEnabled>false</inventoryEnabled>
|
||||
<resourceCategory>NTRANS</resourceCategory>
|
||||
<resourceParameters>
|
||||
pluginName=ntrans
|
||||
modelName=HYSPLIT
|
||||
</resourceParameters>
|
||||
<rscImplementation>NTRANS</rscImplementation>
|
||||
<subTypeGenerator>metafileName,productName</subTypeGenerator>
|
||||
<rscTypeGenerator></rscTypeGenerator>
|
||||
<timeMatchMethod>CLOSEST_BEFORE_OR_AFTER</timeMatchMethod>
|
||||
<frameSpan>60</frameSpan>
|
||||
<timelineGenMethod>USE_CYCLE_TIME_FCST_HOURS</timelineGenMethod>
|
||||
<dfltFrameCount>10</dfltFrameCount>
|
||||
<dfltTimeRange>48</dfltTimeRange>
|
||||
<dfltGeogArea>XY</dfltGeogArea>
|
||||
</ResourceDefinition>
|
|
@ -0,0 +1,2 @@
|
|||
! No real attributes for NTRANS
|
||||
color= RGB {255,255,255}
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<ResourceDefinition xmlns:ns2="group" xmlns:ns3="http://www.example.org/productType">
|
||||
<inventoryEnabled>true</inventoryEnabled>
|
||||
<inventoryEnabled>false</inventoryEnabled>
|
||||
<resourceDefnName>LocalRadar</resourceDefnName>
|
||||
<resourceCategory>RADAR</resourceCategory>
|
||||
<resourceParameters>
|
||||
|
|
|
@ -318,6 +318,9 @@
|
|||
<ResourceDefinitionFilter isEnabled="true" rscDefnName="HWRF_NT">
|
||||
<filters>Forecast,NTRANS</filters>
|
||||
</ResourceDefinitionFilter>
|
||||
<ResourceDefinitionFilter isEnabled="true" rscDefnName="HYSPLIT_NT">
|
||||
<filters>Forecast,NTRANS</filters>
|
||||
</ResourceDefinitionFilter>
|
||||
<ResourceDefinitionFilter isEnabled="true" rscDefnName="ICEACCR_NT">
|
||||
<filters>Forecast,NTRANS</filters>
|
||||
</ResourceDefinitionFilter>
|
||||
|
@ -702,7 +705,13 @@
|
|||
<ResourceDefinitionFilter isEnabled="true" rscDefnName="ECMWF">
|
||||
<filters>Forecast</filters>
|
||||
</ResourceDefinitionFilter>
|
||||
<ResourceDefinitionFilter isEnabled="true" rscDefnName="NMM40">
|
||||
<ResourceDefinitionFilter isEnabled="true" rscDefnName="NAM40">
|
||||
<filters>Forecast,Regional,SBN</filters>
|
||||
</ResourceDefinitionFilter>
|
||||
<ResourceDefinitionFilter isEnabled="true" rscDefnName="NAM5">
|
||||
<filters>Forecast,Regional,SBN</filters>
|
||||
</ResourceDefinitionFilter>
|
||||
<ResourceDefinitionFilter isEnabled="true" rscDefnName="NAM40_SFC">
|
||||
<filters>Forecast,Regional,SBN</filters>
|
||||
</ResourceDefinitionFilter>
|
||||
<ResourceDefinitionFilter isEnabled="true" rscDefnName="RAP">
|
||||
|
@ -1077,6 +1086,9 @@
|
|||
<ResourceDefinitionFilter isEnabled="true" rscDefnName="NOGAPS">
|
||||
<filters>Forecast,Global</filters>
|
||||
</ResourceDefinitionFilter>
|
||||
<ResourceDefinitionFilter isEnabled="true" rscDefnName="NAVGEM">
|
||||
<filters>Forecast,Global,NSBN</filters>
|
||||
</ResourceDefinitionFilter>
|
||||
<ResourceDefinitionFilter isEnabled="false" rscDefnName="MPE_MOSAIC_SJU">
|
||||
<filters>Forecast,SBN</filters>
|
||||
</ResourceDefinitionFilter>
|
||||
|
@ -1158,6 +1170,9 @@
|
|||
<ResourceDefinitionFilter isEnabled="false" rscDefnName="GWW233">
|
||||
<filters>Forecast</filters>
|
||||
</ResourceDefinitionFilter>
|
||||
<ResourceDefinitionFilter isEnabled="false" rscDefnName="NAM32">
|
||||
<filters>Forecast,Regional,NSBN</filters>
|
||||
</ResourceDefinitionFilter>
|
||||
<ResourceDefinitionFilter isEnabled="false" rscDefnName="NAM32PR">
|
||||
<filters>Forecast,Regional,SBN</filters>
|
||||
</ResourceDefinitionFilter>
|
||||
|
@ -1410,4 +1425,4 @@
|
|||
<ResourceDefinitionFilter isEnabled="true" rscDefnName="SOLARFLUX">
|
||||
<filters>Forecast,SWPC</filters>
|
||||
</ResourceDefinitionFilter>
|
||||
</ResourceDefinitionFilters>
|
||||
</ResourceDefinitionFilters>
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
package gov.noaa.nws.ncep.viz.overlays.resources;
|
||||
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 gov.noaa.nws.ncep.viz.resources.INatlCntrsResource;
|
||||
|
||||
import org.opengis.referencing.crs.CoordinateReferenceSystem;
|
||||
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.PixelExtent;
|
||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||
import com.raytheon.uf.viz.core.drawables.IFont;
|
||||
import com.raytheon.uf.viz.core.drawables.IWireframeShape;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Implements a drawing layer to draw lat/lon lines
|
||||
* Implements a drawing layer to draw lat/lon lines
|
||||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
|
@ -31,58 +31,70 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* 11/18/09 Greg Hull Incorporate to11d6 changes
|
||||
* 11/04/13 #880 Xiaochuan set one wireframeShape for one lat or Lon lines.
|
||||
* Set spatialChopFlag to be false.
|
||||
* 05/23/2014 #970 P.Swamy Lat/lon label sizes need to be larger
|
||||
* </pre>
|
||||
*
|
||||
* @author mgao
|
||||
*
|
||||
*/
|
||||
public class LatLonOverlayResource extends AbstractVizResource<LatLonOverlayResourceData, IMapDescriptor>
|
||||
implements INatlCntrsResource {
|
||||
public class LatLonOverlayResource extends
|
||||
AbstractVizResource<LatLonOverlayResourceData, IMapDescriptor>
|
||||
implements INatlCntrsResource {
|
||||
|
||||
private final static org.apache.log4j.Logger log =
|
||||
org.apache.log4j.Logger.getLogger(LatLonOverlayResource.class);
|
||||
|
||||
private LatLonOverlayResourceData latLonOverlayResourceData;
|
||||
|
||||
/** The wireframe object for drawing Latitude lines*/
|
||||
private final static org.apache.log4j.Logger log = org.apache.log4j.Logger
|
||||
.getLogger(LatLonOverlayResource.class);
|
||||
|
||||
private LatLonOverlayResourceData latLonOverlayResourceData;
|
||||
|
||||
/** The wireframe object for drawing Latitude lines */
|
||||
private IWireframeShape wireframeShapeForLatLineArray;
|
||||
|
||||
/** The wireframe object for drawing Longitude lines*/
|
||||
/** The wireframe object for drawing Longitude lines */
|
||||
private IWireframeShape wireframeShapeForLonLineArray;
|
||||
|
||||
private List<Coordinate[]> latitudeCoordinatePointArrayList;
|
||||
|
||||
private List<Coordinate[]> longitudeCoordinatePointArrayList;
|
||||
|
||||
private double offset = 0; //50000;
|
||||
|
||||
private double mapMinX;
|
||||
private double mapMaxY;
|
||||
private double mapMinY;
|
||||
private double mapMaxX;
|
||||
|
||||
private double viewMinX;
|
||||
private double viewMaxY;
|
||||
private double viewMinY;
|
||||
private double viewMaxX;
|
||||
|
||||
/*
|
||||
* The four minimum and maximum of X and Y used to paint label
|
||||
*/
|
||||
private double effectiveMinX;
|
||||
private double effectiveMaxY;
|
||||
private double effectiveMinY;
|
||||
private double effectiveMaxX;
|
||||
|
||||
private double latLonDrawingPointInterval = 1.0; //0.7; //1.0; //0.5
|
||||
|
||||
private boolean needsUpdate = true;
|
||||
|
||||
protected LatLonOverlayResource(LatLonOverlayResourceData llRscData, LoadProperties props) {
|
||||
private List<Coordinate[]> latitudeCoordinatePointArrayList;
|
||||
|
||||
private List<Coordinate[]> longitudeCoordinatePointArrayList;
|
||||
|
||||
private double offset = 0; // 50000;
|
||||
|
||||
private double mapMinX;
|
||||
|
||||
private double mapMaxY;
|
||||
|
||||
private double mapMinY;
|
||||
|
||||
private double mapMaxX;
|
||||
|
||||
private double viewMinX;
|
||||
|
||||
private double viewMaxY;
|
||||
|
||||
private double viewMinY;
|
||||
|
||||
private double viewMaxX;
|
||||
|
||||
/*
|
||||
* The four minimum and maximum of X and Y used to paint label
|
||||
*/
|
||||
private double effectiveMinX;
|
||||
|
||||
private double effectiveMaxY;
|
||||
|
||||
private double effectiveMinY;
|
||||
|
||||
private double effectiveMaxX;
|
||||
|
||||
private double latLonDrawingPointInterval = 1.0; // 0.7; //1.0; //0.5
|
||||
|
||||
private boolean needsUpdate = true;
|
||||
|
||||
protected LatLonOverlayResource(LatLonOverlayResourceData llRscData,
|
||||
LoadProperties props) {
|
||||
super(llRscData, props);
|
||||
latLonOverlayResourceData = llRscData;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -90,7 +102,7 @@ public class LatLonOverlayResource extends AbstractVizResource<LatLonOverlayReso
|
|||
* IGraphicsTarget)
|
||||
*/
|
||||
public void initInternal(IGraphicsTarget target) throws VizException {
|
||||
initializeMapMinAndMaxXAndY();
|
||||
initializeMapMinAndMaxXAndY();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -99,268 +111,320 @@ public class LatLonOverlayResource extends AbstractVizResource<LatLonOverlayReso
|
|||
* @see com.raytheon.viz.core.rsc.IVizResource#paint(com.raytheon.viz.core.
|
||||
* IGraphicsTarget, com.raytheon.viz.core.PixelExtent, double, float)
|
||||
*/
|
||||
public void paintInternal(IGraphicsTarget target, PaintProperties paintProps) throws VizException {
|
||||
public void paintInternal(IGraphicsTarget target, PaintProperties paintProps)
|
||||
throws VizException {
|
||||
|
||||
float zoomFactor = paintProps.getZoomLevel();
|
||||
|
||||
initializeViewMinAndMaxXAndY(paintProps);
|
||||
int latitudeDrawingLineNumber = getLatitudeDrawingLineNumber(
|
||||
latLonOverlayResourceData.getLatitudeInterval());
|
||||
int longitudeDrawingLineNumber = getLongitudeDrawingLineNumber(
|
||||
latLonOverlayResourceData.getLongitudeInterval());
|
||||
|
||||
// Only need to recreate the wireframeShapes if the intervals or line types changed.
|
||||
if( needsUpdate ) {
|
||||
needsUpdate = false;
|
||||
IFont lfont = target.initializeFont("Courier", 14, null);
|
||||
float zoomFactor = paintProps.getZoomLevel();
|
||||
|
||||
/*
|
||||
* necessary???
|
||||
*/
|
||||
clearWireFrameShapeArray(wireframeShapeForLatLineArray);
|
||||
clearWireFrameShapeArray(wireframeShapeForLonLineArray);
|
||||
clearCoordinatePointArrayList(latitudeCoordinatePointArrayList);
|
||||
clearCoordinatePointArrayList(longitudeCoordinatePointArrayList);
|
||||
|
||||
latitudeCoordinatePointArrayList = new ArrayList<Coordinate[]>(latitudeDrawingLineNumber);
|
||||
longitudeCoordinatePointArrayList = new ArrayList<Coordinate[]>(longitudeDrawingLineNumber);
|
||||
|
||||
wireframeShapeForLatLineArray = target.createWireframeShape(false,
|
||||
descriptor, 4.0f, false, new PixelExtent(
|
||||
getViewMinX()+offset, getViewMaxX()-offset, getViewMinY()+offset, getViewMaxY()-offset));
|
||||
|
||||
double latitudeValue = -90;
|
||||
for(int i=0; i<latitudeDrawingLineNumber && latitudeValue <= 90; i++) {
|
||||
Coordinate[] latLonCoordinateArray = createCoordinateArrayForLatitudeLine(latitudeValue, latLonDrawingPointInterval);
|
||||
latitudeCoordinatePointArrayList.add(latLonCoordinateArray);
|
||||
|
||||
if (!( latitudeValue == -90 || latitudeValue == 90 )){
|
||||
wireframeShapeForLatLineArray.addLineSegment(latLonCoordinateArray);
|
||||
}
|
||||
|
||||
latitudeValue += latLonOverlayResourceData.getLatitudeInterval();
|
||||
}
|
||||
|
||||
wireframeShapeForLatLineArray.compile();
|
||||
initializeViewMinAndMaxXAndY(paintProps);
|
||||
int latitudeDrawingLineNumber = getLatitudeDrawingLineNumber(latLonOverlayResourceData
|
||||
.getLatitudeInterval());
|
||||
int longitudeDrawingLineNumber = getLongitudeDrawingLineNumber(latLonOverlayResourceData
|
||||
.getLongitudeInterval());
|
||||
|
||||
wireframeShapeForLonLineArray = target.createWireframeShape(false,
|
||||
descriptor, 4.0f, false, new PixelExtent(
|
||||
getViewMinX()+offset, getViewMaxX()-offset, getViewMinY()+offset, getViewMaxY()-offset));
|
||||
|
||||
double longitudeValue = -180;
|
||||
for(int i=0; i<longitudeDrawingLineNumber && longitudeValue <= 180; i++) {
|
||||
|
||||
Coordinate[] latLonCoordinateArray = createCoordinateArrayLongitudeLine(longitudeValue, latLonDrawingPointInterval);
|
||||
longitudeCoordinatePointArrayList.add(latLonCoordinateArray);
|
||||
wireframeShapeForLonLineArray.addLineSegment(latLonCoordinateArray);
|
||||
longitudeValue += latLonOverlayResourceData.getLongitudeInterval();
|
||||
}
|
||||
wireframeShapeForLonLineArray.compile();
|
||||
}
|
||||
|
||||
double latitudeValue = -90;
|
||||
updateEffectiveMinX(getMapMinX(), getViewMinX(), getViewMaxX());
|
||||
// Only need to recreate the wireframeShapes if the intervals or line
|
||||
// types changed.
|
||||
if (needsUpdate) {
|
||||
needsUpdate = false;
|
||||
|
||||
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));
|
||||
}
|
||||
target.drawWireframeShape(wireframeShapeForLatLineArray,
|
||||
latLonOverlayResourceData.getColor(),
|
||||
latLonOverlayResourceData.getLineWidth(),
|
||||
latLonOverlayResourceData.getLineStyle());
|
||||
latitudeValue += latLonOverlayResourceData.getLatitudeInterval();
|
||||
}
|
||||
/*
|
||||
* necessary???
|
||||
*/
|
||||
clearWireFrameShapeArray(wireframeShapeForLatLineArray);
|
||||
clearWireFrameShapeArray(wireframeShapeForLonLineArray);
|
||||
clearCoordinatePointArrayList(latitudeCoordinatePointArrayList);
|
||||
clearCoordinatePointArrayList(longitudeCoordinatePointArrayList);
|
||||
|
||||
double longitudeValue = -180;
|
||||
updateEffectiveMaxY(getMapMaxY(), getViewMinY(), getViewMaxY());
|
||||
latitudeCoordinatePointArrayList = new ArrayList<Coordinate[]>(
|
||||
latitudeDrawingLineNumber);
|
||||
longitudeCoordinatePointArrayList = new ArrayList<Coordinate[]>(
|
||||
longitudeDrawingLineNumber);
|
||||
|
||||
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));
|
||||
}
|
||||
target.drawWireframeShape(wireframeShapeForLonLineArray,
|
||||
latLonOverlayResourceData.getColor(),
|
||||
latLonOverlayResourceData.getLineWidth(),
|
||||
latLonOverlayResourceData.getLineStyle());
|
||||
longitudeValue += latLonOverlayResourceData.getLongitudeInterval();
|
||||
}
|
||||
wireframeShapeForLatLineArray = target.createWireframeShape(false,
|
||||
descriptor, 4.0f, false, new PixelExtent(getViewMinX()
|
||||
+ offset, getViewMaxX() - offset, getViewMinY()
|
||||
+ offset, getViewMaxY() - offset));
|
||||
|
||||
double latitudeValue = -90;
|
||||
for (int i = 0; i < latitudeDrawingLineNumber
|
||||
&& latitudeValue <= 90; i++) {
|
||||
Coordinate[] latLonCoordinateArray = createCoordinateArrayForLatitudeLine(
|
||||
latitudeValue, latLonDrawingPointInterval);
|
||||
latitudeCoordinatePointArrayList.add(latLonCoordinateArray);
|
||||
|
||||
if (!(latitudeValue == -90 || latitudeValue == 90)) {
|
||||
wireframeShapeForLatLineArray
|
||||
.addLineSegment(latLonCoordinateArray);
|
||||
}
|
||||
|
||||
latitudeValue += latLonOverlayResourceData
|
||||
.getLatitudeInterval();
|
||||
}
|
||||
|
||||
wireframeShapeForLatLineArray.compile();
|
||||
|
||||
wireframeShapeForLonLineArray = target.createWireframeShape(false,
|
||||
descriptor, 4.0f, false, new PixelExtent(getViewMinX()
|
||||
+ offset, getViewMaxX() - offset, getViewMinY()
|
||||
+ offset, getViewMaxY() - offset));
|
||||
|
||||
double longitudeValue = -180;
|
||||
for (int i = 0; i < longitudeDrawingLineNumber
|
||||
&& longitudeValue <= 180; i++) {
|
||||
|
||||
Coordinate[] latLonCoordinateArray = createCoordinateArrayLongitudeLine(
|
||||
longitudeValue, latLonDrawingPointInterval);
|
||||
longitudeCoordinatePointArrayList.add(latLonCoordinateArray);
|
||||
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));
|
||||
}
|
||||
|
||||
target.drawWireframeShape(wireframeShapeForLatLineArray,
|
||||
latLonOverlayResourceData.getColor(),
|
||||
latLonOverlayResourceData.getLineWidth(),
|
||||
latLonOverlayResourceData.getLineStyle(), lfont);
|
||||
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));
|
||||
}
|
||||
target.drawWireframeShape(wireframeShapeForLonLineArray,
|
||||
latLonOverlayResourceData.getColor(),
|
||||
latLonOverlayResourceData.getLineWidth(),
|
||||
latLonOverlayResourceData.getLineStyle(), lfont);
|
||||
longitudeValue += latLonOverlayResourceData.getLongitudeInterval();
|
||||
}
|
||||
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 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);
|
||||
mapMinX = descriptor.getGridGeometry().getGridRange().getLow(0);
|
||||
mapMaxX = descriptor.getGridGeometry().getGridRange().getHigh(0);
|
||||
mapMinY = descriptor.getGridGeometry().getGridRange().getLow(1);
|
||||
mapMaxY = descriptor.getGridGeometry().getGridRange().getHigh(1);
|
||||
}
|
||||
|
||||
|
||||
private void initializeViewMinAndMaxXAndY(PaintProperties paintProps) {
|
||||
viewMinX = paintProps.getView().getExtent().getMinX();
|
||||
viewMaxX = paintProps.getView().getExtent().getMaxX();
|
||||
viewMinY = paintProps.getView().getExtent().getMinY();
|
||||
viewMaxY = paintProps.getView().getExtent().getMaxY();
|
||||
viewMinX = paintProps.getView().getExtent().getMinX();
|
||||
viewMaxX = paintProps.getView().getExtent().getMaxX();
|
||||
viewMinY = paintProps.getView().getExtent().getMinY();
|
||||
viewMaxY = paintProps.getView().getExtent().getMaxY();
|
||||
|
||||
effectiveMinX = viewMinX;
|
||||
effectiveMaxX = viewMaxX;
|
||||
effectiveMinY = viewMinY;
|
||||
effectiveMaxY = viewMaxY;
|
||||
}
|
||||
|
||||
private void updateEffectiveMinX(double mapMinXValue, double viewMinXValue, double viewMaxXValue) {
|
||||
if(isLeftEdgeOfMapInsideCurrentView(mapMinXValue, viewMinXValue, viewMaxXValue)) {
|
||||
effectiveMinX = mapMinXValue;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isLeftEdgeOfMapInsideCurrentView(double minXOfMap, double minXOfCurrentView, double maxXOfCurrentView) {
|
||||
boolean isInsideResult = false;
|
||||
if(minXOfMap > minXOfCurrentView && minXOfMap < maxXOfCurrentView)
|
||||
isInsideResult = true;
|
||||
return isInsideResult;
|
||||
}
|
||||
|
||||
private void updateEffectiveMaxY(double mapMaxYValue, double viewMinYValue, double viewMaxYValue) {
|
||||
if(isBottomEdgeOfMapInsideCurrentView(mapMaxYValue, viewMinYValue, viewMaxYValue))
|
||||
effectiveMaxY = mapMaxYValue;
|
||||
}
|
||||
|
||||
private boolean isBottomEdgeOfMapInsideCurrentView(double maxYOfMap, double minYOfCurrentView, double maxYOfCurrentView) {
|
||||
boolean isInsideResult = false;
|
||||
if(maxYOfMap > minYOfCurrentView && maxYOfMap < maxYOfCurrentView) {
|
||||
isInsideResult = true;
|
||||
}
|
||||
return isInsideResult;
|
||||
}
|
||||
|
||||
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;
|
||||
effectiveMinX = viewMinX;
|
||||
effectiveMaxX = viewMaxX;
|
||||
effectiveMinY = viewMinY;
|
||||
effectiveMaxY = viewMaxY;
|
||||
}
|
||||
|
||||
private boolean isPointForPlacingLatituteLabel(double[] pixelValueArray, double positionOffset, float zoomFactor,
|
||||
double minX, double maxX, double minY, double maxY) {
|
||||
double delta = 200;
|
||||
double adjustedOffset = positionOffset * zoomFactor;
|
||||
boolean isPointForLabel = false;
|
||||
if(pixelValueArray != null) {
|
||||
if(pixelValueArray[0] > (minX + adjustedOffset) && pixelValueArray[0] < maxX &&
|
||||
pixelValueArray[1] > minY && pixelValueArray[1] < maxY) {
|
||||
if(Math.abs(pixelValueArray[0] - minX - (positionOffset * zoomFactor)) < delta) {
|
||||
isPointForLabel = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return isPointForLabel;
|
||||
private void updateEffectiveMinX(double mapMinXValue, double viewMinXValue,
|
||||
double viewMaxXValue) {
|
||||
if (isLeftEdgeOfMapInsideCurrentView(mapMinXValue, viewMinXValue,
|
||||
viewMaxXValue)) {
|
||||
effectiveMinX = mapMinXValue;
|
||||
}
|
||||
}
|
||||
|
||||
private int getLatitudeDrawingLineNumber(int latInterval) {
|
||||
int latLineNumber = 180/15; // set a default value
|
||||
if(latInterval>0 && latInterval<=180) {
|
||||
latLineNumber = 180/latInterval;
|
||||
}
|
||||
return latLineNumber + 1;
|
||||
}
|
||||
|
||||
private int getLongitudeDrawingLineNumber(int lonInterval) {
|
||||
int lonLineNumber = 360/15; // set a default value
|
||||
if(lonInterval>0 && lonInterval<=360) {
|
||||
lonLineNumber = 360 / lonInterval;
|
||||
if(lonLineNumber > 360)
|
||||
lonLineNumber = 360; // if we draw 360 lines, the last line will overlap with the first line
|
||||
}
|
||||
return lonLineNumber + 1;
|
||||
}
|
||||
|
||||
private Coordinate[] createCoordinateArrayForLatitudeLine(double latitudeValue, double latLonPointInterval) {
|
||||
int coordinateArrayLength = (int)(360 / latLonPointInterval) + 1;
|
||||
Coordinate[] coordinateArray = new Coordinate[coordinateArrayLength];
|
||||
double longitude = -180;
|
||||
for(int i=0; i<coordinateArray.length && longitude <= 180; i++) {
|
||||
coordinateArray[i] = new Coordinate(longitude, latitudeValue);
|
||||
longitude += latLonPointInterval;
|
||||
}
|
||||
return coordinateArray;
|
||||
}
|
||||
|
||||
private Coordinate[] createCoordinateArrayLongitudeLine(double longitudeValue, double latLonPointInterval) {
|
||||
int coordinateArrayLength = (int)((180 - 10) / latLonPointInterval);
|
||||
Coordinate[] coordinateArray = new Coordinate[coordinateArrayLength];
|
||||
double latitude = -90 + latLonPointInterval;
|
||||
for(int i=0; i<coordinateArray.length && latitude <= 90; i++) {
|
||||
coordinateArray[i] = new Coordinate(longitudeValue, latitude);
|
||||
latitude += latLonPointInterval;
|
||||
}
|
||||
return coordinateArray;
|
||||
}
|
||||
private boolean isLeftEdgeOfMapInsideCurrentView(double minXOfMap,
|
||||
double minXOfCurrentView, double maxXOfCurrentView) {
|
||||
boolean isInsideResult = false;
|
||||
if (minXOfMap > minXOfCurrentView && minXOfMap < maxXOfCurrentView)
|
||||
isInsideResult = true;
|
||||
return isInsideResult;
|
||||
}
|
||||
|
||||
private void updateEffectiveMaxY(double mapMaxYValue, double viewMinYValue,
|
||||
double viewMaxYValue) {
|
||||
if (isBottomEdgeOfMapInsideCurrentView(mapMaxYValue, viewMinYValue,
|
||||
viewMaxYValue))
|
||||
effectiveMaxY = mapMaxYValue;
|
||||
}
|
||||
|
||||
private boolean isBottomEdgeOfMapInsideCurrentView(double maxYOfMap,
|
||||
double minYOfCurrentView, double maxYOfCurrentView) {
|
||||
boolean isInsideResult = false;
|
||||
if (maxYOfMap > minYOfCurrentView && maxYOfMap < maxYOfCurrentView) {
|
||||
isInsideResult = true;
|
||||
}
|
||||
return isInsideResult;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
private int getLatitudeDrawingLineNumber(int latInterval) {
|
||||
int latLineNumber = 180 / 15; // set a default value
|
||||
if (latInterval > 0 && latInterval <= 180) {
|
||||
latLineNumber = 180 / latInterval;
|
||||
}
|
||||
return latLineNumber + 1;
|
||||
}
|
||||
|
||||
private int getLongitudeDrawingLineNumber(int lonInterval) {
|
||||
int lonLineNumber = 360 / 15; // set a default value
|
||||
if (lonInterval > 0 && lonInterval <= 360) {
|
||||
lonLineNumber = 360 / lonInterval;
|
||||
if (lonLineNumber > 360)
|
||||
lonLineNumber = 360; // if we draw 360 lines, the last line will
|
||||
// overlap with the first line
|
||||
}
|
||||
return lonLineNumber + 1;
|
||||
}
|
||||
|
||||
private Coordinate[] createCoordinateArrayForLatitudeLine(
|
||||
double latitudeValue, double latLonPointInterval) {
|
||||
int coordinateArrayLength = (int) (360 / latLonPointInterval) + 1;
|
||||
Coordinate[] coordinateArray = new Coordinate[coordinateArrayLength];
|
||||
double longitude = -180;
|
||||
for (int i = 0; i < coordinateArray.length && longitude <= 180; i++) {
|
||||
coordinateArray[i] = new Coordinate(longitude, latitudeValue);
|
||||
longitude += latLonPointInterval;
|
||||
}
|
||||
return coordinateArray;
|
||||
}
|
||||
|
||||
private Coordinate[] createCoordinateArrayLongitudeLine(
|
||||
double longitudeValue, double latLonPointInterval) {
|
||||
int coordinateArrayLength = (int) ((180 - 10) / latLonPointInterval);
|
||||
Coordinate[] coordinateArray = new Coordinate[coordinateArrayLength];
|
||||
double latitude = -90 + latLonPointInterval;
|
||||
for (int i = 0; i < coordinateArray.length && latitude <= 90; i++) {
|
||||
coordinateArray[i] = new Coordinate(longitudeValue, latitude);
|
||||
latitude += latLonPointInterval;
|
||||
}
|
||||
return coordinateArray;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
|
@ -368,91 +432,92 @@ public class LatLonOverlayResource extends AbstractVizResource<LatLonOverlayReso
|
|||
* @see com.raytheon.viz.core.rsc.IVizResource#dispose()
|
||||
*/
|
||||
public void disposeInternal() {
|
||||
// clearWireFrameShapeArray(wireframeShapeForLatLineArray);
|
||||
// clearWireFrameShapeArray(wireframeShapeForLonLineArray);
|
||||
|
||||
// clearWireFrameShapeArray(wireframeShapeForLatLineArray);
|
||||
// clearWireFrameShapeArray(wireframeShapeForLonLineArray);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void clearWireFrameShapeArray(IWireframeShape wireframeShapeArray) {
|
||||
if(wireframeShapeArray != null) {
|
||||
wireframeShapeArray.dispose();
|
||||
wireframeShapeArray = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void clearCoordinatePointArrayList(List<Coordinate[]> coordinatePointArrayList) {
|
||||
if(coordinatePointArrayList != null) {
|
||||
for(Coordinate[] eachCoordinateArray : coordinatePointArrayList) {
|
||||
eachCoordinateArray = null;
|
||||
}
|
||||
coordinatePointArrayList = null;
|
||||
}
|
||||
if (wireframeShapeArray != null) {
|
||||
wireframeShapeArray.dispose();
|
||||
wireframeShapeArray = null;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* the getters for Map's Min and Max X and Y, View's Min and Max X and Y
|
||||
*/
|
||||
public double getViewMinX() {
|
||||
return viewMinX;
|
||||
}
|
||||
private void clearCoordinatePointArrayList(
|
||||
List<Coordinate[]> coordinatePointArrayList) {
|
||||
if (coordinatePointArrayList != null) {
|
||||
for (Coordinate[] eachCoordinateArray : coordinatePointArrayList) {
|
||||
eachCoordinateArray = null;
|
||||
}
|
||||
coordinatePointArrayList = null;
|
||||
}
|
||||
}
|
||||
|
||||
public double getViewMaxY() {
|
||||
return viewMaxY;
|
||||
}
|
||||
/*
|
||||
* the getters for Map's Min and Max X and Y, View's Min and Max X and Y
|
||||
*/
|
||||
public double getViewMinX() {
|
||||
return viewMinX;
|
||||
}
|
||||
|
||||
public double getViewMinY() {
|
||||
return viewMinY;
|
||||
}
|
||||
public double getViewMaxY() {
|
||||
return viewMaxY;
|
||||
}
|
||||
|
||||
public double getViewMaxX() {
|
||||
return viewMaxX;
|
||||
}
|
||||
public double getViewMinY() {
|
||||
return viewMinY;
|
||||
}
|
||||
|
||||
public double getViewMaxX() {
|
||||
return viewMaxX;
|
||||
}
|
||||
|
||||
public double getMapMinX() {
|
||||
return mapMinX;
|
||||
}
|
||||
|
||||
public double getMapMaxY() {
|
||||
return mapMaxY;
|
||||
}
|
||||
|
||||
public double getMapMinY() {
|
||||
return mapMinY;
|
||||
}
|
||||
|
||||
public double getMapMaxX() {
|
||||
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;
|
||||
return mapMinX;
|
||||
}
|
||||
|
||||
// @Override
|
||||
public boolean isProjectable(CoordinateReferenceSystem mapData) {
|
||||
return true;
|
||||
}
|
||||
public double getMapMaxY() {
|
||||
return mapMaxY;
|
||||
}
|
||||
|
||||
// TODO : This has not been tested.
|
||||
@Override
|
||||
public void project(CoordinateReferenceSystem mapData) throws VizException {
|
||||
needsUpdate = true;
|
||||
}
|
||||
public double getMapMinY() {
|
||||
return mapMinY;
|
||||
}
|
||||
|
||||
public double getMapMaxX() {
|
||||
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;
|
||||
}
|
||||
|
||||
// @Override
|
||||
public boolean isProjectable(CoordinateReferenceSystem mapData) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO : This has not been tested.
|
||||
@Override
|
||||
public void project(CoordinateReferenceSystem mapData) throws VizException {
|
||||
needsUpdate = true;
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -7,8 +7,13 @@ import gov.noaa.nws.ncep.viz.resources.INatlCntrsResourceData;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.StringReader;
|
||||
import java.util.HashMap;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
import org.xml.sax.InputSource;
|
||||
|
||||
import com.raytheon.uf.viz.core.VariableSubstitutionUtil;
|
||||
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
@ -37,6 +42,7 @@ import com.raytheon.uf.viz.core.rsc.ResourceList;
|
|||
* 11/17/11 #518 Greg Hull set dfltFrameTimes (GDATTIM)
|
||||
* 02/10/13 #972 Greg Hull getSupportedDisplayTypes
|
||||
* 10/29/13 #2491 bsteffen Use AbstratRBD JAXBManager instead of SerializationUtil.
|
||||
* 05/14/14 #1048 Bruce Hebbard Before substituting string variables into XML, encode special characters as XML predefined entities
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -56,8 +62,8 @@ public class ResourceFactory {
|
|||
private Boolean isBaseLevelResource = false;
|
||||
|
||||
// called when loading an existing RBD into the dialog and we need to
|
||||
// get the attribute values
|
||||
// from the edited RBD instead of the original attrSet file.
|
||||
// get the attribute values from the edited RBD instead of the original
|
||||
// attrSet file.
|
||||
protected ResourceSelection(ResourcePair rp) throws VizException {
|
||||
rscPair = rp;
|
||||
rscData = (INatlCntrsResourceData) rp.getResourceData();
|
||||
|
@ -116,10 +122,10 @@ public class ResourceFactory {
|
|||
|
||||
// TODO : Would it be nice to give an indication that this is the
|
||||
// dominant resource???
|
||||
// if( rscData instanceof AbstractNatlCntrsRequestableResourceData
|
||||
// if (rscData instanceof AbstractNatlCntrsRequestableResourceData
|
||||
// &&
|
||||
// ((AbstractNatlCntrsRequestableResourceData)rscData).getIsDominant()
|
||||
// ) {
|
||||
// ((AbstractNatlCntrsRequestableResourceData)rscData).getIsDominant())
|
||||
// {
|
||||
// rsc_label = rscData.getFullResourceName() + " (D)";
|
||||
// }
|
||||
|
||||
|
@ -188,9 +194,27 @@ public class ResourceFactory {
|
|||
}
|
||||
|
||||
try {
|
||||
// Before substituting variables, make sure all their values are
|
||||
// XML-friendly strings
|
||||
if (rscParams != null) {
|
||||
for (String attrName : rscParams.keySet()) {
|
||||
String attrValue = rscParams.get(attrName);
|
||||
// Only 'sanitize' value string if it DOES contain
|
||||
// XML-sensitive characters, but is NOT itself an
|
||||
// XML fragment (like <colorBar>...</colorBar>)
|
||||
if (attrValue != null && XMLSpecialCharacter.in(attrValue)
|
||||
&& !isXMLFragment(attrValue)) {
|
||||
rscParams.put(attrName,
|
||||
XMLSpecialCharacter.encode(attrValue));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Perform variable substitution
|
||||
String substStr = VariableSubstitutionUtil.processVariables(
|
||||
bundleStr, rscParams);
|
||||
|
||||
// Unmarshal the resource (group) from XML
|
||||
// ResourceGroup rscGroup = SerializationUtil.unmarshalFromXml(
|
||||
// ResourceGroup.class, substStr );
|
||||
ResourceGroup rscGroup = (ResourceGroup) AbstractRBD
|
||||
|
@ -236,4 +260,21 @@ public class ResourceFactory {
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static boolean isXMLFragment(String s) {
|
||||
// Determine whether the (trimmed) input string is a valid XML fragment.
|
||||
String t = s.trim();
|
||||
// We can quickly rule out something that looks nothing like XML...
|
||||
if (!t.startsWith("<") || !t.endsWith(">")) {
|
||||
return false;
|
||||
}
|
||||
// ...but otherwise, see if it passes the parse test.
|
||||
try {
|
||||
DocumentBuilderFactory.newInstance().newDocumentBuilder()
|
||||
.parse(new InputSource(new StringReader(t)));
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,108 @@
|
|||
/**
|
||||
**/
|
||||
package gov.noaa.nws.ncep.viz.resources.manager;
|
||||
|
||||
/**
|
||||
* XMLSpecialCharacter - Class (enum) to encapsulate knowledge of predefined
|
||||
* character entity references in XML. Provides methods to take an arbitrary
|
||||
* string, and (1) detect presence of any characters requiring such special
|
||||
* handling in XML, or (2) return a suitably encoded (XML-safe) string.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* May 9, 2014 bhebbard Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bhebbard
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public enum XMLSpecialCharacter {
|
||||
|
||||
// @formatter:off
|
||||
AMPERSAND ( '&', "&" ),
|
||||
LESS_THAN_SIGN ( '<', "<" ),
|
||||
GREATER_THAN_SIGN ( '>', ">" ),
|
||||
DOUBLE_QUOTE ( '"', """ ),
|
||||
APOSTROPHE ( '\'', "'" );
|
||||
// @formatter:on
|
||||
|
||||
private char character;
|
||||
|
||||
private String characterEntityReference;
|
||||
|
||||
private XMLSpecialCharacter(char c, String cer) {
|
||||
character = c;
|
||||
characterEntityReference = cer;
|
||||
}
|
||||
|
||||
// Non-static methods apply only to "this" character
|
||||
|
||||
private String encodeMe(String inString) {
|
||||
return inString.replaceAll(Character.toString(character),
|
||||
characterEntityReference);
|
||||
}
|
||||
|
||||
private String decodeMe(String inString) {
|
||||
return inString.replaceAll(characterEntityReference,
|
||||
Character.toString(character));
|
||||
}
|
||||
|
||||
// Static convenience methods apply to all values()
|
||||
|
||||
/**
|
||||
* Returns a boolean, indicating whether the source string contains at least
|
||||
* one of the XML-sensitive characters: & < > " '
|
||||
*
|
||||
* @param testString
|
||||
* a String to be tested for XML-sensitive characters
|
||||
* @return boolean; true iff testString contains any of: & < > " '
|
||||
*/
|
||||
public static boolean in(String testString) {
|
||||
for (XMLSpecialCharacter xsc : values()) {
|
||||
if (testString.indexOf(xsc.character) != -1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a String that contains character entity references substituted
|
||||
* into the source String for any of the predefined entities defined in XML
|
||||
* (for handling special XML-sensitive characters). Operation is idempotent,
|
||||
* i.e., can be applied repeatedly with no harm (e.g., an originalString
|
||||
* already containing "<" will result in a string containing "<", and
|
||||
* not invalid string "&lt;").
|
||||
*
|
||||
* @param originalString
|
||||
* a String which may contain (or not): & < > " '
|
||||
* @return String with XML-safe substitutions: & < > " '
|
||||
*/
|
||||
public static String encode(String originalString) {
|
||||
// Because '&' is a special character AND is itself a substring of all
|
||||
// character entity references, we start the encoding by DEcoding the
|
||||
// string, to avoid iterative/recursive &-->& substitutions.
|
||||
String codedString = decode(originalString);
|
||||
// For each special character...
|
||||
for (XMLSpecialCharacter xsc : values()) {
|
||||
// ...encode all its occurrences in the string)
|
||||
codedString = xsc.encodeMe(codedString);
|
||||
}
|
||||
return codedString;
|
||||
}
|
||||
|
||||
private static String decode(String originalString) {
|
||||
String decodedString = originalString;
|
||||
for (XMLSpecialCharacter xsc : values()) {
|
||||
decodedString = xsc.decodeMe(decodedString);
|
||||
}
|
||||
return decodedString;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
jcgm -- Computer Graphics Metafile interpreter and renderer
|
||||
|
||||
This package contains source code from the "jcgm" open source Java
|
||||
implementation to interpret and render Computer Graphics Metafile (CGM)
|
||||
graphics files.
|
||||
|
||||
For more information about "jcgm", see: http://jcgm.sourceforge.net
|
||||
|
||||
See also LICENSE.txt, which states (in part):
|
||||
"Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted...
|
||||
[subject to conditions met by LICENSE.txt contents]"
|
||||
|
||||
Some of these files have been modified slightly from their original form,
|
||||
mainly to make originally 'private' fields 'protected' in order to allow
|
||||
access from classes over in the "ncgm" package which extend them.
|
||||
|
||||
These changes are usually marked by comments showing the //ORIGINAL// form
|
||||
of the code.
|
||||
|
||||
Note that only the "core" code from jcgm appears here; the "image" code
|
||||
(from a separate branch of the jcgm source tree) is not included. That's
|
||||
because we are interested only in the "interpreter" part of jcgm, and not
|
||||
the "rendering" part; that is, we use jcgm to build a Java representation
|
||||
of CGM commands, but we must do our own rendering via AWIPS II graphics.
|
||||
|
||||
Classes in the "ncgm" package generally extend classes from "jcgm", in order
|
||||
to implement the INcCommand interface, and so perform this rendering.
|
||||
|
||||
Note that all of the jcgm core classes are present, even though we do not
|
||||
currently use most of them. This is for completeness, and to allow
|
||||
possible future expansion.
|
|
@ -5,8 +5,9 @@
|
|||
* open source "jcgm" package, to implement this interface.
|
||||
*
|
||||
* This gives them the ability to draw themselves in the AWIPS II
|
||||
* (IGraphicsTarget) world. More precisely, they contribute themselves
|
||||
* to an image being built, whose state is kept in the ImageBuilder parameter.
|
||||
* (IGraphicsTarget) world. In many cases, instead of drawing
|
||||
* themselves immediately, they contribute themselves to an image
|
||||
* being built, whose state is kept in the ImageBuilder passed in.
|
||||
*/
|
||||
package gov.noaa.nws.ncep.viz.rsc.ntrans.ncgm;
|
||||
|
||||
|
|
|
@ -87,9 +87,8 @@ import org.apache.commons.logging.LogFactory;
|
|||
*/
|
||||
public class NcCGM extends CGM implements Cloneable {
|
||||
|
||||
private final Log logger = LogFactory.getLog(this.getClass()); // TODO
|
||||
// static
|
||||
// better??
|
||||
// TODO static better? If so, change sister classes as well.
|
||||
private final Log logger = LogFactory.getLog(this.getClass());
|
||||
|
||||
private List<Command> commands;
|
||||
|
||||
|
|
|
@ -9,9 +9,6 @@ import gov.noaa.nws.ncep.viz.rsc.ntrans.rsc.ImageBuilder;
|
|||
import java.io.DataInput;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
import com.raytheon.uf.viz.core.drawables.IFont.Style;
|
||||
|
@ -24,33 +21,13 @@ import com.raytheon.uf.viz.core.exception.VizException;
|
|||
*/
|
||||
public class NcCharacterHeight extends CharacterHeight implements INcCommand {
|
||||
|
||||
private final Log logger = LogFactory.getLog(this.getClass()); // TODO
|
||||
// static
|
||||
// better??
|
||||
// private final Log logger = LogFactory.getLog(this.getClass());
|
||||
|
||||
/**
|
||||
* @param ec
|
||||
* @param eid
|
||||
* @param l
|
||||
* @param in
|
||||
* @throws IOException
|
||||
*/
|
||||
public NcCharacterHeight(int ec, int eid, int l, DataInput in)
|
||||
throws IOException {
|
||||
super(ec, eid, l, in);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* gov.noaa.nws.ncep.viz.rsc.ntrans.ncgm.INcCommand#paint(com.raytheon.uf
|
||||
* .viz.core.IGraphicsTarget,
|
||||
* com.raytheon.uf.viz.core.drawables.PaintProperties,
|
||||
* com.raytheon.uf.viz.core.drawables.IDescriptor,
|
||||
* gov.noaa.nws.ncep.viz.rsc.ntrans.rsc.NtransResource.ImageBuilder)
|
||||
*/
|
||||
@Override
|
||||
public void paint(IGraphicsTarget target, PaintProperties paintProps,
|
||||
IDescriptor descriptor, ImageBuilder ib) throws VizException {
|
||||
|
|
|
@ -9,9 +9,6 @@ import gov.noaa.nws.ncep.viz.rsc.ntrans.rsc.ImageBuilder;
|
|||
import java.io.DataInput;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.raytheon.uf.viz.core.DrawableCircle;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
|
@ -24,33 +21,13 @@ import com.raytheon.uf.viz.core.exception.VizException;
|
|||
*/
|
||||
public class NcCircleElement extends CircleElement implements INcCommand {
|
||||
|
||||
private final Log logger = LogFactory.getLog(this.getClass()); // TODO
|
||||
// static
|
||||
// better??
|
||||
// private final Log logger = LogFactory.getLog(this.getClass());
|
||||
|
||||
/**
|
||||
* @param ec
|
||||
* @param eid
|
||||
* @param l
|
||||
* @param in
|
||||
* @throws IOException
|
||||
*/
|
||||
public NcCircleElement(int ec, int eid, int l, DataInput in)
|
||||
throws IOException {
|
||||
super(ec, eid, l, in);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* gov.noaa.nws.ncep.viz.rsc.ntrans.ncgm.INcCommand#paint(com.raytheon.uf
|
||||
* .viz.core.IGraphicsTarget,
|
||||
* com.raytheon.uf.viz.core.drawables.PaintProperties,
|
||||
* com.raytheon.uf.viz.core.drawables.IDescriptor,
|
||||
* gov.noaa.nws.ncep.viz.rsc.ntrans.rsc.NtransResource.ImageBuilder)
|
||||
*/
|
||||
@Override
|
||||
public void paint(IGraphicsTarget target, PaintProperties paintProps,
|
||||
IDescriptor descriptor, ImageBuilder ib) throws VizException {
|
||||
|
|
|
@ -125,9 +125,6 @@ import java.io.DataInput;
|
|||
import java.io.EOFException;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* Base class for all the CGM commands.
|
||||
* <p>
|
||||
|
@ -142,13 +139,10 @@ import org.apache.commons.logging.LogFactory;
|
|||
*/
|
||||
public class NcCommand extends Command implements Cloneable {
|
||||
|
||||
private final Log logger = LogFactory.getLog(this.getClass()); // TODO
|
||||
// static
|
||||
// better??
|
||||
// private final Log logger = LogFactory.getLog(this.getClass());
|
||||
|
||||
public NcCommand(int ec, int eid, int l, DataInput in) throws IOException {
|
||||
super(ec, eid, l, in);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,13 +23,12 @@ public class NcFillColour extends FillColour implements INcCommand {
|
|||
public NcFillColour(int ec, int eid, int l, DataInput in)
|
||||
throws IOException {
|
||||
super(ec, eid, l, in);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(IGraphicsTarget target, PaintProperties paintProps,
|
||||
IDescriptor descriptor, ImageBuilder ib) throws VizException {
|
||||
ib.currentFillColor = GempakColor.convertToRGB(this.colorIndex);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,32 +23,13 @@ import com.raytheon.uf.viz.core.exception.VizException;
|
|||
*/
|
||||
public class NcInteriorStyle extends InteriorStyle implements INcCommand {
|
||||
|
||||
private final Log logger = LogFactory.getLog(this.getClass()); // TODO
|
||||
// static
|
||||
// better??
|
||||
private final Log logger = LogFactory.getLog(this.getClass());
|
||||
|
||||
/**
|
||||
* @param ec
|
||||
* @param eid
|
||||
* @param l
|
||||
* @param in
|
||||
* @throws IOException
|
||||
*/
|
||||
public NcInteriorStyle(int ec, int eid, int l, DataInput in)
|
||||
throws IOException {
|
||||
super(ec, eid, l, in);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* gov.noaa.nws.ncep.viz.rsc.ntrans.ncgm.INcCommand#paint(com.raytheon.uf
|
||||
* .viz.core.IGraphicsTarget,
|
||||
* com.raytheon.uf.viz.core.drawables.PaintProperties,
|
||||
* gov.noaa.nws.ncep.viz.rsc.ntrans.rsc.NtransResource.ImageBuilder)
|
||||
*/
|
||||
@Override
|
||||
public void paint(IGraphicsTarget target, PaintProperties paintProps,
|
||||
IDescriptor descriptor, ImageBuilder ib) throws VizException {
|
||||
|
|
|
@ -24,7 +24,6 @@ public class NcLineColour extends LineColour implements INcCommand {
|
|||
public NcLineColour(int ec, int eid, int l, DataInput in)
|
||||
throws IOException {
|
||||
super(ec, eid, l, in);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,31 +20,14 @@ import com.raytheon.uf.viz.core.exception.VizException;
|
|||
*/
|
||||
public class NcLineWidth extends LineWidth implements INcCommand {
|
||||
|
||||
/**
|
||||
* @param ec
|
||||
* @param eid
|
||||
* @param l
|
||||
* @param in
|
||||
* @throws IOException
|
||||
*/
|
||||
public NcLineWidth(int ec, int eid, int l, DataInput in) throws IOException {
|
||||
super(ec, eid, l, in);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* gov.noaa.nws.ncep.viz.rsc.ntrans.ncgm.INcCommand#paint(com.raytheon.uf
|
||||
* .viz.core.IGraphicsTarget,
|
||||
* com.raytheon.uf.viz.core.drawables.PaintProperties,
|
||||
* gov.noaa.nws.ncep.viz.rsc.ntrans.rsc.NtransResource.ImageBuilder)
|
||||
*/
|
||||
@Override
|
||||
public void paint(IGraphicsTarget target, PaintProperties paintProps,
|
||||
IDescriptor descriptor, ImageBuilder ib) throws VizException {
|
||||
ib.currentLineWidth = this.width / 1.0; // TODO ??
|
||||
ib.currentLineWidth = this.width; // / 1.0; // TODO ??
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,9 +12,6 @@ import java.io.IOException;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
import com.raytheon.uf.viz.core.drawables.IShadedShape;
|
||||
|
@ -30,26 +27,16 @@ import com.vividsolutions.jts.geom.LineString;
|
|||
*/
|
||||
public class NcPolygonElement extends PolygonElement implements INcCommand {
|
||||
|
||||
private final Log logger = LogFactory.getLog(this.getClass()); // TODO
|
||||
// static
|
||||
// better??
|
||||
// private final Log logger = LogFactory.getLog(this.getClass());
|
||||
|
||||
static List<double[]> currentDraw = new ArrayList<double[]>();
|
||||
|
||||
private GeometryFactory gf;
|
||||
|
||||
/**
|
||||
* @param ec
|
||||
* @param eid
|
||||
* @param l
|
||||
* @param in
|
||||
* @throws IOException
|
||||
*/
|
||||
public NcPolygonElement(int ec, int eid, int l, DataInput in)
|
||||
throws IOException {
|
||||
super(ec, eid, l, in);
|
||||
gf = new GeometryFactory(); // TODO move!?
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -122,9 +109,9 @@ public class NcPolygonElement extends PolygonElement implements INcCommand {
|
|||
if (currentDraw.size() > 1) {
|
||||
Coordinate[] coords = new Coordinate[currentDraw.size()];
|
||||
for (int j = 0; j < currentDraw.size(); j++) {
|
||||
coords[j] = new Coordinate(currentDraw.get(j)[0], 1000.000 - // TODO
|
||||
// why?
|
||||
currentDraw.get(j)[1]);
|
||||
// TODO: why?
|
||||
coords[j] = new Coordinate(currentDraw.get(j)[0],
|
||||
1000.000 - currentDraw.get(j)[1]);
|
||||
}
|
||||
LineString[] lineStrings = new LineString[] { gf
|
||||
.createLineString(coords) };
|
||||
|
|
|
@ -10,9 +10,6 @@ import java.io.IOException;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
import com.raytheon.uf.viz.core.drawables.IWireframeShape;
|
||||
|
@ -21,15 +18,12 @@ import com.raytheon.uf.viz.core.exception.VizException;
|
|||
|
||||
public class NcPolyline extends Polyline implements INcCommand {
|
||||
|
||||
private final Log logger = LogFactory.getLog(this.getClass()); // TODO
|
||||
// static
|
||||
// better??
|
||||
// private final Log logger = LogFactory.getLog(this.getClass());
|
||||
|
||||
static List<double[]> currentDraw = new ArrayList<double[]>();
|
||||
|
||||
public NcPolyline(int ec, int eid, int l, DataInput in) throws IOException {
|
||||
super(ec, eid, l, in);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -9,9 +9,6 @@ import gov.noaa.nws.ncep.viz.rsc.ntrans.rsc.ImageBuilder;
|
|||
import java.io.DataInput;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.raytheon.uf.viz.core.DrawableString;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
|
@ -24,52 +21,35 @@ import com.raytheon.uf.viz.core.exception.VizException;
|
|||
*/
|
||||
public class NcText extends Text implements INcCommand {
|
||||
|
||||
private final Log logger = LogFactory.getLog(this.getClass()); // TODO
|
||||
// static
|
||||
// better??
|
||||
// private final Log logger = LogFactory.getLog(this.getClass());
|
||||
|
||||
static boolean flipflop = true;
|
||||
|
||||
/**
|
||||
* @param ec
|
||||
* @param eid
|
||||
* @param l
|
||||
* @param in
|
||||
* @throws IOException
|
||||
*/
|
||||
public NcText(int ec, int eid, int l, DataInput in) throws IOException {
|
||||
// To handle little-endian strings, we need to bump an odd length ("l")
|
||||
// parameter
|
||||
// up one to make it even (ending on two-byte CGM word boundary), so
|
||||
// that we
|
||||
// get the last character. (Will be flipped into place later.) Note that
|
||||
// special case of l=31 indicates "long form" (string length >=31 char,
|
||||
// to
|
||||
// be specified in following 2-byte integer), so the parent constructor
|
||||
// for
|
||||
// Command has also been modified to interpret l=32 fed up to it as a
|
||||
// signal
|
||||
// to handle as l=31, then "bump" the long-form length it reads (from
|
||||
// next
|
||||
// 2 bytes) up to even value if needed.
|
||||
// To handle little-endian strings, we need to bump an odd length
|
||||
// ("l") parameter up one to make it even (ending on two-byte CGM
|
||||
// word boundary), so that we get the last character. (Will be
|
||||
// flipped into place later.) Note that special case of l=31
|
||||
// indicates "long form" (string length >=31 char, to be specified
|
||||
// in following 2-byte integer), so the parent constructor for
|
||||
// Command has also been modified to interpret l=32 fed up to
|
||||
// it as a signal to handle as l=31, then "bump" the long-form
|
||||
// length it reads (from next 2 bytes) up to even value if needed.
|
||||
super(ec, eid, (l + 1) / 2 * 2, in);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* gov.noaa.nws.ncep.viz.rsc.ntrans.ncgm.INcCommand#paint(com.raytheon.uf
|
||||
* .viz.core.IGraphicsTarget,
|
||||
* com.raytheon.uf.viz.core.drawables.PaintProperties,
|
||||
* gov.noaa.nws.ncep.viz.rsc.ntrans.rsc.NtransResource.ImageBuilder)
|
||||
*/
|
||||
@Override
|
||||
public void paint(IGraphicsTarget target, PaintProperties paintProps,
|
||||
IDescriptor descriptor, ImageBuilder ib) throws VizException {
|
||||
|
||||
DrawableString ds = new DrawableString(this.string, ib.currentLineColor); // TODO:why?
|
||||
// TODO: Why currentLineColor and not currentTextColor? Legacy quirk?
|
||||
DrawableString ds = new DrawableString(this.string, ib.currentLineColor);
|
||||
double[] newpoint = new double[] { 0.0, 0.0 };
|
||||
|
||||
// Following "flipflop" is experimental code to alternate between
|
||||
// normal scaling and alternate scaling which holds the screen
|
||||
// location of the text invariant under zoom. The latter could be
|
||||
// used to keep NTRANS frame title strings always in view.
|
||||
if (flipflop) // TODO test code
|
||||
{
|
||||
newpoint = ib.scalePoint(this.position.x, this.position.y);
|
||||
|
@ -77,6 +57,7 @@ public class NcText extends Text implements INcCommand {
|
|||
newpoint = ib.scalePointNoZoom(this.position.x, this.position.y);
|
||||
}
|
||||
// flipflop = ! flipflop ;
|
||||
|
||||
ds.setCoordinates(newpoint[0], newpoint[1]);
|
||||
|
||||
ds.font = ib.currentFont;
|
||||
|
@ -84,26 +65,18 @@ public class NcText extends Text implements INcCommand {
|
|||
ds.horizontalAlignment = ib.horizontalAlignment;
|
||||
ds.verticallAlignment = ib.verticalAlignment;
|
||||
|
||||
// Don't draw the string right now; just add it to list of
|
||||
// strings in the image to be drawn later -- all at once.
|
||||
ib.strings.add(ds);
|
||||
|
||||
/*
|
||||
* IFont font = target.initializeFont("Monospace", 14, new IFont.Style[]
|
||||
* { IFont.Style.BOLD}); PixelCoordinate textLoc = new PixelCoordinate(
|
||||
* this.position.x * ib.scaling, this.position.y * ib.scaling, 0 );
|
||||
* target.drawString(font, this.string, textLoc.getX(), textLoc.getY(),
|
||||
* 0.0, TextStyle.NORMAL, new RGB( 255, 255, 200 ),
|
||||
* HorizontalAlignment.CENTER, VerticalAlignment.MIDDLE, 0.0);
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
public void flipString() {
|
||||
// Flip every even char with its odd sibling (endianess reversal)
|
||||
String oldString = this.string;
|
||||
char[] oldCharArray = oldString.toCharArray();
|
||||
int lengthOfNewArray = oldCharArray.length / 2 * 2; // if odd length,
|
||||
// discard last
|
||||
// character (null)
|
||||
// if odd length, discard last character (null)
|
||||
int lengthOfNewArray = oldCharArray.length / 2 * 2;
|
||||
char[] newCharArray = new char[lengthOfNewArray];
|
||||
for (int i = 0; i < lengthOfNewArray; i = i + 2) {
|
||||
newCharArray[i] = oldCharArray[i + 1];
|
||||
|
|
|
@ -9,9 +9,6 @@ import gov.noaa.nws.ncep.viz.rsc.ntrans.rsc.ImageBuilder;
|
|||
import java.io.DataInput;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
|
@ -23,33 +20,13 @@ import com.raytheon.uf.viz.core.exception.VizException;
|
|||
*/
|
||||
public class NcTextAlignment extends TextAlignment implements INcCommand {
|
||||
|
||||
private final Log logger = LogFactory.getLog(this.getClass()); // TODO
|
||||
// static
|
||||
// better??
|
||||
// private final Log logger = LogFactory.getLog(this.getClass());
|
||||
|
||||
/**
|
||||
* @param ec
|
||||
* @param eid
|
||||
* @param l
|
||||
* @param in
|
||||
* @throws IOException
|
||||
*/
|
||||
public NcTextAlignment(int ec, int eid, int l, DataInput in)
|
||||
throws IOException {
|
||||
super(ec, eid, l, in);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* gov.noaa.nws.ncep.viz.rsc.ntrans.ncgm.INcCommand#paint(com.raytheon.uf
|
||||
* .viz.core.IGraphicsTarget,
|
||||
* com.raytheon.uf.viz.core.drawables.PaintProperties,
|
||||
* com.raytheon.uf.viz.core.drawables.IDescriptor,
|
||||
* gov.noaa.nws.ncep.viz.rsc.ntrans.rsc.NtransResource.ImageBuilder)
|
||||
*/
|
||||
@Override
|
||||
public void paint(IGraphicsTarget target, PaintProperties paintProps,
|
||||
IDescriptor descriptor, ImageBuilder ib) throws VizException {
|
||||
|
@ -59,13 +36,12 @@ public class NcTextAlignment extends TextAlignment implements INcCommand {
|
|||
|
||||
switch (this.horizontalAlignment) {
|
||||
case NORMAL_HORIZONTAL:
|
||||
// TODO: Following is sort of a hack, to deal with the way legacy
|
||||
// NTRANS metafiles are created by the NC driver code. A horizontal
|
||||
// alignment of CENTER appears to be coded (intentionally or
|
||||
// otherwise)
|
||||
// in the legacy generated CGM by a *vertical* alignment value of
|
||||
// CAP.
|
||||
// Might want to investigate, and possibly bring legacy code to CGM
|
||||
// TODO: Following is a bit of a hack, to deal with the way
|
||||
// legacy NTRANS metafiles are created by the NC driver code.
|
||||
// A horizontal alignment of CENTER appears to be coded
|
||||
// (intentionally or otherwise) in the legacy generated CGM
|
||||
// by a *vertical* alignment value of CAP. Might want to
|
||||
// investigate, and possibly bring legacy code to CGM
|
||||
// compliance.
|
||||
if (this.verticalAlignment == TextAlignment.VerticalAlignment.CAP) {
|
||||
ib.horizontalAlignment = IGraphicsTarget.HorizontalAlignment.CENTER;
|
||||
|
|
|
@ -21,29 +21,11 @@ import com.raytheon.uf.viz.core.exception.VizException;
|
|||
*/
|
||||
public class NcTextColour extends TextColour implements INcCommand {
|
||||
|
||||
/**
|
||||
* @param ec
|
||||
* @param eid
|
||||
* @param l
|
||||
* @param in
|
||||
* @throws IOException
|
||||
*/
|
||||
public NcTextColour(int ec, int eid, int l, DataInput in)
|
||||
throws IOException {
|
||||
super(ec, eid, l, in);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* gov.noaa.nws.ncep.viz.rsc.ntrans.ncgm.INcCommand#paint(com.raytheon.uf
|
||||
* .viz.core.IGraphicsTarget,
|
||||
* com.raytheon.uf.viz.core.drawables.PaintProperties,
|
||||
* com.raytheon.uf.viz.core.drawables.IDescriptor,
|
||||
* gov.noaa.nws.ncep.viz.rsc.ntrans.rsc.NtransResource.ImageBuilder)
|
||||
*/
|
||||
@Override
|
||||
public void paint(IGraphicsTarget target, PaintProperties paintProps,
|
||||
IDescriptor descriptor, ImageBuilder ib) throws VizException {
|
||||
|
|
|
@ -23,35 +23,15 @@ import com.raytheon.uf.viz.core.exception.VizException;
|
|||
*/
|
||||
public class NcTextFontIndex extends TextFontIndex implements INcCommand {
|
||||
|
||||
private final Log logger = LogFactory.getLog(this.getClass()); // TODO
|
||||
// static
|
||||
// better??
|
||||
private final Log logger = LogFactory.getLog(this.getClass());
|
||||
|
||||
private static boolean notWarned = true;
|
||||
|
||||
/**
|
||||
* @param ec
|
||||
* @param eid
|
||||
* @param l
|
||||
* @param in
|
||||
* @throws IOException
|
||||
*/
|
||||
public NcTextFontIndex(int ec, int eid, int l, DataInput in)
|
||||
throws IOException {
|
||||
super(ec, eid, l, in);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* gov.noaa.nws.ncep.viz.rsc.ntrans.ncgm.INcCommand#paint(com.raytheon.uf
|
||||
* .viz.core.IGraphicsTarget,
|
||||
* com.raytheon.uf.viz.core.drawables.PaintProperties,
|
||||
* com.raytheon.uf.viz.core.drawables.IDescriptor,
|
||||
* gov.noaa.nws.ncep.viz.rsc.ntrans.rsc.NtransResource.ImageBuilder)
|
||||
*/
|
||||
@Override
|
||||
public void paint(IGraphicsTarget target, PaintProperties paintProps,
|
||||
IDescriptor descriptor, ImageBuilder ib) throws VizException {
|
||||
|
|
|
@ -36,7 +36,15 @@ import com.raytheon.uf.viz.core.drawables.IShadedShape;
|
|||
import com.raytheon.uf.viz.core.drawables.IWireframeShape;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* ImageBuilder - Class which holds the state of a single image while it's under
|
||||
* construction by sequential execution of CGM commands. For efficiency (and
|
||||
* other) reasons, it is useful not to draw some elements immediately to the
|
||||
* screen as each drawable CGM command is processed, but rather to accumulate
|
||||
* simple objects (e.g., polylines) into larger aggregate constructs
|
||||
* (wireframes) for drawing later by AWIPS II IGraphicsTarget commands. Also,
|
||||
* some CGM commands are dependent on modes or states set by previous CGM
|
||||
* commands (e.g., LineWidth); this structure also provides a place to hold
|
||||
* these states.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -60,6 +68,13 @@ public class ImageBuilder {
|
|||
// construction by sequential execution of the CGM commands.
|
||||
|
||||
public class WireframeKey {
|
||||
|
||||
// An object of this class forms a unique key to an AWIPS II
|
||||
// wireframe (IWireframeShape) which can be drawn in a
|
||||
// single operation. As such, it contains as fields all
|
||||
// characteristics that must be held constant in a single
|
||||
// such wireframe draw operation.
|
||||
|
||||
public RGB color;
|
||||
|
||||
public double width;
|
||||
|
@ -108,12 +123,19 @@ public class ImageBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
// Collection of all wireframes under construction, keyed by unique output
|
||||
// draw states
|
||||
public Map<WireframeKey, IWireframeShape> wireframes = new HashMap<WireframeKey, IWireframeShape>();
|
||||
|
||||
// Line color set by the most recent CGM LineColour command. Default to
|
||||
// WHITE.
|
||||
public RGB currentLineColor = new RGB(255, 255, 255);
|
||||
|
||||
// Line width set by the most recent CGM LineWidth command. Default to 1
|
||||
// pixel.
|
||||
public double currentLineWidth = 1.0;
|
||||
|
||||
// Accumulator for AWIPS II DrawableString text objects
|
||||
public List<DrawableString> strings = new ArrayList<DrawableString>();
|
||||
|
||||
public RGB currentTextColor = new RGB(255, 255, 255);
|
||||
|
|
|
@ -434,8 +434,6 @@ public class NtransResource extends
|
|||
// TODO assert
|
||||
} else {
|
||||
wireframeForThisKey.compile();
|
||||
// TODO to be correct, should be lineWidth in effect at
|
||||
// individual wireframe paints
|
||||
target.drawWireframeShape(wireframeForThisKey, key.color,
|
||||
(float) key.width);
|
||||
wireframeForThisKey.dispose();
|
||||
|
|
Loading…
Add table
Reference in a new issue