Merge branch 'omaha_16.2.1' into omaha_16.2.2

Conflicts:
	cave/com.raytheon.uf.viz.aviation.advisory/src/com/raytheon/uf/viz/aviation/advisory/rsc/AdvisoryResource.java
	cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/editor/TafViewerEditorDlg.java
	cave/com.raytheon.viz.gfe/localization/gfe/userPython/textUtilities/headline/HazardsTable.py
	cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/timeseries/TimeSeriesDisplayCanvas.java
	edexOsgi/com.raytheon.uf.edex.site/src/com/raytheon/uf/edex/site/SiteAwareRegistry.java


Former-commit-id: d9745246c0f81ec088b3f4108b30e02c33f6a9ae
This commit is contained in:
Steve Harris 2016-01-06 11:55:00 -06:00
commit 8a07970ba6
257 changed files with 20143 additions and 5267 deletions

View file

@ -43,6 +43,7 @@ import com.raytheon.uf.common.serialization.SerializationException;
* ------------ ---------- ----------- --------------------------
* Jun 5, 2015 4498 nabowle Use JAXBManager to unmarshal. Rename to
* RcmUtil.
* Oct 15,2015 17789 wkwock Change max TDWR radar ID to 3099
*
* </pre>
*
@ -52,7 +53,7 @@ public class RcmUtil {
public static RadarType getRadarType(RadarConfig rc) {
int id = rc.getNexradID();
if (id >= 3000 && id <= 3045) // TODO: 3045 is the current max, but...
if (id >= 3000 && id <= 3099) // TODO: 3099 is the current max, but...
return RadarType.TDWR;
else if (id >= 4000 && id < 4050) // TODO: may be 4050
return RadarType.ASR;

View file

@ -124,7 +124,7 @@ public class Loader {
// This is not in any baselined database yet.
switch (rp.pid) {
case 180: case 181: case 182: case 183: case 185:
case 180: case 181: case 182: case 183: case 184: case 185:
case 186: case 187:
rp.typeRestriction = EnumSet.of(RadarType.TDWR);
break;

View file

@ -60,6 +60,7 @@
25 | 16 | 0 | 0.25 | 60 | V | Velocity (V) | Radial | y | | | | V | | | | | 1 | |
26 | 16 | 0 | 0.50 | 115 | V | Velocity (V) | Radial | y | | | | V | | | | | 1 | |
27 | 16 | 0 | 1.00 | 230 | V | Velocity (V) | Radial | y | | | | V | | | | | 1 | |
184|256 | 0 | 0.15 | 90 | SW | Spectrum Width (SW) | Radial | y | | | | | | | | | 2 | | y
185| 8 | 0 | 0.15 | 90 | SW | Spectrum Width (SW) | Radial | y | | | | | | | | | 2 | |
28 | 8 | 0 | 0.25 | 60 | SW | Spectrum Width (SW) | Radial | y | | | | | | | | | 2 | |
29 | 8 | 0 | 0.50 | 115 | SW | Spectrum Width (SW) | Radial | y | | | | | | | | | 2 | |

View file

@ -64,6 +64,7 @@ import com.raytheon.rcm.server.Log;
* 2009 dfriedma Initial version
* 2012-04-30 DR 14904 D. Friedman Add backup links to dial ORPGs.
* 2015-06-10 4498 nabowle Rename Util->RcmUtil
* 2015-10-15 DCS 17789 wkwock Change max TDWR radar ID to 3099
* </pre>
*/
public class Awips1ConfigProvider implements ConfigurationProvider {
@ -502,8 +503,8 @@ public class Awips1ConfigProvider implements ConfigurationProvider {
if (name.substring(1, 4).equalsIgnoreCase(namelet)) {
int nexradId = radars.get(name).getNexradID();
if (linespeed.equals("D6")) {
// TODO: can we really rely on the 3045 number?
if (nexradId >= 3000 && nexradId <= 3045)
// TODO: can we really rely on the 3099 number?
if (nexradId >= 3000 && nexradId <= 3099)
return name;
} else {
if (nexradId < 3000

View file

@ -259,6 +259,9 @@
<antcall target="p2.build.repo">
<param name="feature" value="com.raytheon.uf.viz.acarssounding.feature" />
</antcall>
<antcall target="p2.build.repo">
<param name="feature" value="com.raytheon.uf.viz.ncep.npp.feature" />
</antcall>
<antcall target="p2.build.repo">
<param name="feature" value="com.raytheon.viz.avnfps.feature" />
</antcall>

View file

@ -12,6 +12,7 @@ Import-Package: com.raytheon.uf.common.dataplugin,
com.raytheon.uf.viz.core.drawables,
com.raytheon.uf.viz.core.exception,
com.raytheon.uf.viz.core.map,
com.raytheon.uf.viz.core.point.display,
com.raytheon.uf.viz.core.rsc,
com.raytheon.uf.viz.core.rsc.capabilities,
com.vividsolutions.jts.algorithm,

View file

@ -33,7 +33,6 @@ import com.vividsolutions.jts.geom.GeometryFactory;
import com.vividsolutions.jts.geom.LinearRing;
import com.vividsolutions.jts.geom.Polygon;
/**
*
* A class containing all parameters necessary for an outline resource to be
@ -45,6 +44,7 @@ import com.vividsolutions.jts.geom.Polygon;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 2, 2009 bsteffen Initial creation
* Jul 7, 2015 10352 byin Added labelSymbolId
*
* </pre>
*
@ -76,6 +76,8 @@ public class AdvisoryRecord {
private String label;
private char labelSymbolId = 0;
private String inspectString;
public AdvisoryRecord(Coordinate labelLoc, String label) {
@ -202,8 +204,7 @@ public class AdvisoryRecord {
* @return a new Coordinate at the correct location
*/
public static Coordinate getPointOnCircle(Coordinate center,
double distance,
double angle) {
double distance, double angle) {
while (angle > 180) {
angle -= 360;
}
@ -268,5 +269,12 @@ public class AdvisoryRecord {
return inspectString;
}
public char getLabelSymbolId() {
return labelSymbolId;
}
public void setLabelSymbolId(char labelSymbolId) {
this.labelSymbolId = labelSymbolId;
}
}

View file

@ -47,6 +47,9 @@ import com.vividsolutions.jts.geom.Coordinate;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 2, 2009 bsteffen Initial creation
* Jul 7, 2015 10352 byin Display symbols for turb/icing
* and hazard types for IFR/MTOS
*
*
* </pre>
*
@ -56,14 +59,28 @@ import com.vividsolutions.jts.geom.Coordinate;
@XmlAccessorType(XmlAccessType.NONE)
public class AirmetDataAdapter extends AbstractAdvisoryDataAdapter {
private static final String LABEL_FORMAT = "%d%s";
private static final String INSPECT_FORMAT = "Valid UNTIL %02d%02d%02d\n%s";
private static final String REPORT_INDICATOR = "AIRMET";
private static final String SEGMENT_SEPERATOR = "\n. \n";
private static final String TURBULENCE_TYPE = "TURBULENCE";
private static final String ICING_TYPE = "ICING";
private static final String IFR_TYPE = "INSTRUMENT FLIGHT RULES";
private static final String MTN_TYPE = "MOUNTAIN OBSCURATION";
private static final String IFR_LABEL = "IFR";
private static final String MTN_LABEL = "MTOS";
protected static final char TURBULENCE_SYMBOL = '\u007b';
protected static final char ICING_SYMBOL = '\u007e';
private static final float LINE_WIDTH = 1.5f;
private static final LineStyle LINE_STYLE = LineStyle.SOLID;
@ -111,7 +128,6 @@ public class AirmetDataAdapter extends AbstractAdvisoryDataAdapter {
coords[loc.getIndex() - 1] = new Coordinate(loc.getLongitude(),
loc.getLatitude());
}
int updateNumber = parent.getUpdateNumber();
String sequenceId = report.getSequenceID();
if (sequenceId == null) {
sequenceId = "";
@ -134,11 +150,30 @@ public class AirmetDataAdapter extends AbstractAdvisoryDataAdapter {
} else {
segment = "";
}
String label = String.format(LABEL_FORMAT, updateNumber, sequenceId);
String inspectString = String.format(INSPECT_FORMAT, day, hour, min,
segment);
String hazType = report.getHazardType();
String label;
if (hazType.equalsIgnoreCase(IFR_TYPE)) {
label = IFR_LABEL;
} else if (hazType.equalsIgnoreCase(MTN_TYPE)) {
label = MTN_LABEL;
} else {
label = "";
}
AdvisoryRecord aRecord = new AdvisoryRecord(coords, label,
inspectString);
if (hazType.equalsIgnoreCase(ICING_TYPE)) {
aRecord.setLabelSymbolId(ICING_SYMBOL);
} else if (hazType.equalsIgnoreCase(TURBULENCE_TYPE)) {
aRecord.setLabelSymbolId(TURBULENCE_SYMBOL);
}
return aRecord;
}

View file

@ -28,6 +28,7 @@ import java.util.List;
import java.util.Map;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
@ -42,12 +43,15 @@ import com.raytheon.uf.viz.core.IGraphicsTarget.HorizontalAlignment;
import com.raytheon.uf.viz.core.IGraphicsTarget.LineStyle;
import com.raytheon.uf.viz.core.IGraphicsTarget.TextStyle;
import com.raytheon.uf.viz.core.IGraphicsTarget.VerticalAlignment;
import com.raytheon.uf.viz.core.PixelCoverage;
import com.raytheon.uf.viz.core.drawables.IFont;
import com.raytheon.uf.viz.core.drawables.IFont.Style;
import com.raytheon.uf.viz.core.drawables.IImage;
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.MapDescriptor;
import com.raytheon.uf.viz.core.point.display.SymbolLoader;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.IResourceDataChanged;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
@ -75,6 +79,7 @@ import com.vividsolutions.jts.geom.Polygon;
* Jun 13, 2011 9758 cjeanbap Set colorString of AdvisoryResourceData.
* Aug 14, 2014 3523 mapeters Updated deprecated {@link DrawableString#textStyle}
* assignments.
* Jul 7, 2015 10352 byin Added SymbolLoader to plot symbols
* Nov 05, 2015 5070 randerso Adjust font sizes for dpi scaling
* </pre>
*
@ -102,6 +107,8 @@ public class AdvisoryResource extends
private float magnification;
private SymbolLoader symbolLoader;
protected AdvisoryResource(AdvisoryResourceData resourceData,
LoadProperties loadProperties) {
super(resourceData, loadProperties);
@ -189,6 +196,7 @@ public class AdvisoryResource extends
font.dispose();
}
this.font = target.initializeFont("Monospace", 8, new Style[] {});
this.symbolLoader = new SymbolLoader();
}
@Override
@ -210,6 +218,7 @@ public class AdvisoryResource extends
}
this.displayedDataTime = curDataTime;
double scale[] = getScale(paintProps);
if (mainShape == null || dottedShape == null || dashedShape == null) {
clearShapes();
@ -284,6 +293,21 @@ public class AdvisoryResource extends
RGB[] colors = new RGB[labels.length];
Arrays.fill(colors, color);
double x = pixelLoc[0];
double y = pixelLoc[1];
if (record.getLabelSymbolId() != 0) {
IImage symbolImg = symbolLoader.getImage(target, color,
(char) record.getLabelSymbolId());
Coordinate ul = new Coordinate(x, y);
Coordinate ur = new Coordinate(x + 12 * scale[0], y);
Coordinate lr = new Coordinate(ur.x, y + 12 * scale[1]);
Coordinate ll = new Coordinate(x, lr.y);
PixelCoverage extent = new PixelCoverage(ul, ur, lr, ll);
target.drawRaster(symbolImg, extent, paintProps);
}
DrawableString dStrings = new DrawableString(labels, colors);
dStrings.font = font;
dStrings.setCoordinates(pixelLoc[0], pixelLoc[1]);
@ -419,4 +443,13 @@ public class AdvisoryResource extends
clearShapes();
}
private double[] getScale(PaintProperties paintProps) {
IExtent extent = paintProps.getView().getExtent();
Rectangle canvasBounds = paintProps.getCanvasBounds();
double[] scale = new double[2];
scale[0] = extent.getWidth() / canvasBounds.width;
scale[1] = extent.getHeight() / canvasBounds.height;
return scale;
}
}

View file

@ -29,3 +29,4 @@ Export-Package: com.raytheon.uf.viz.d2d.nsharp,
com.raytheon.uf.viz.d2d.nsharp.rsc,
com.raytheon.uf.viz.d2d.nsharp.vb
Bundle-ClassPath: com.raytheon.uf.viz.d2d.nsharp.jar
Import-Package: gov.noaa.nws.ncep.viz.soundingrequest

View file

@ -62,6 +62,10 @@ import com.raytheon.uf.viz.core.exception.VizException;
* 2/23/2015 RM#5694,7788 Chin Chen Use NCP's Nsharp text file loader
* and comment out openNspFile()
* Aug 05, 2015 4486 rjpeter Changed Timestamp to Date.
* Aug 31, 2011 bsteffen Initial creation
* 2/23/2015 RM#5694,7788 Chin Chen Use NCP's Nsharp text file loader
* and comment out openNspFile()
*
*
* </pre>
*

View file

@ -23,7 +23,7 @@ import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingCube;
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingLayer;
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingProfile.ObsSndType;
import gov.noaa.nws.ncep.ui.nsharp.NsharpStationInfo;
import gov.noaa.nws.ncep.viz.common.soundingQuery.NcSoundingQuery;
import gov.noaa.nws.ncep.viz.soundingrequest.NcSoundingQuery;
import java.util.Map;

View file

@ -25,7 +25,7 @@ import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingProfile;
import gov.noaa.nws.ncep.ui.nsharp.NsharpConfigManager;
import gov.noaa.nws.ncep.ui.nsharp.NsharpConfigStore;
import gov.noaa.nws.ncep.ui.nsharp.NsharpStationInfo;
import gov.noaa.nws.ncep.viz.common.soundingQuery.NcSoundingQuery;
import gov.noaa.nws.ncep.viz.soundingrequest.NcSoundingQuery;
import java.util.List;

View file

@ -22,7 +22,7 @@ package com.raytheon.uf.viz.d2d.nsharp.rsc;
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingCube;
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingLayer;
import gov.noaa.nws.ncep.ui.nsharp.NsharpStationInfo;
import gov.noaa.nws.ncep.viz.common.soundingQuery.NcSoundingQuery;
import gov.noaa.nws.ncep.viz.soundingrequest.NcSoundingQuery;
import java.util.Map;

View file

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<bundle>
<displayList>
<displays xsi:type="d2DMapRenderableDisplay"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<descriptor xsi:type="mapDescriptor">
<resource>
<loadProperties loadWithoutData="true">
<capabilities>
<capability xsi:type="imagingCapability"
interpolationState="false" brightness="2.0"
contrast="1.0" alpha="1.0" />
<capability xsi:type="colorableCapability"
colorAsString="#00ff00" />
</capabilities>
</loadProperties>
<properties isSystemResource="false"
isBlinking="false" isMapLayer="false" isHoverOn="false"
isVisible="true" />
<resourceData xsi:type="plotResourceData"
plotSource="Spot Forecast Request"
plotModelFile="stqPlotDesign.svg" pixelSizeHint="45"
retrieveData="false" isUpdatingOnMetadataOnly="false"
isRequeryNecessaryOnTimeMatch="true">
<binOffset posOffset="43200"
negOffset="43200" virtualOffset="0" />
<metadataMap>
<mapping key="pluginName">
<constraint constraintValue="stq"
constraintType="EQUALS" />
</mapping>
</metadataMap>
</resourceData>
</resource>
</descriptor>
</displays>
</displayList>
</bundle>

View file

@ -33,4 +33,6 @@
fileName="menus/ncepHydro/cpc/baseCPC.xml"/>
<include installTo="menu:ncepHydro?after=AWC"
fileName="menus/ncepHydro/awc/baseAWC.xml"/>
<include installTo="menu:ncepHydro?after=STQ"
fileName="menus/ncepHydro/stq/baseSTQ.xml"/>
</menuContributionFile>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<contribute xsi:type="bundleItem"
file="bundles/ncepHydro/SpotRequestPlot.xml" menuText="Spot Forecast Requests"
id="spotRequestPlot">
</contribute>
</menuTemplate>

View file

@ -0,0 +1,54 @@
<?xml version="1.0"?>
<svg width="80" height="80"
viewBox="0 0 80 80"
overflow="visible"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" style="stroke: rgb(255,255,255);">
<defs>
<script type="text/python" plotDelegate="plotDelegate">
class StqPlotDelegate(PlotDelegate):
def __init__(self):
PlotDelegate.__init__(self)
def getSampleText(self, rec):
projectName = rec.getString("projectName")
reqOfficial = rec.getString("reqOfficial")
emPhone = rec.getString("emPhone")
sampleString = "Project Name: %s\n\tOffcial Name: %s\n\tEmergency Phone: %s"%(projectName,reqOfficial,emPhone)
return sampleString
plotDelegate = StqPlotDelegate()
</script>
<style type="text/css">
<![CDATA[
@font-face { font-family: "WindSymbolFont";
src: url(WindSymbols.svg#WindSymbols); }
@font-face { font-family: "StandardFont";
src: url(Standard.svg#Standard); }
@font-face { font-family: "WxSymbolFont";
src: url(WxSymbols.svg#WxSymbols); }
@font-face { font-family: "SpecialSymbolFont";
src: url(SpecialSymbols.svg#SpecialSymbols); }
text.text
{
fill: none;
font-size: 1.2em;
stroke-width: 1px;
font-family: StandardFont;
font-size: 1.2em;
}
]]>
</style>
<symbol overflow="visible" id="plotData" class="info">
<text id="stqsymbol" plotMode="text" class="text" plotParam="stqSymbol" x="0" y="0">0</text>
<text id="sample" plotMode="sample" class="text" plotParam="projectName,reqOfficial,emPhone">0</text>
</symbol>
</defs>
<use id="wind" x="40" y="40" width="80" height="80" visibility="visible" xlink:href="#plotData"/>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

@ -104,6 +104,14 @@
name="xyx"
visible="true">
</separator>
<command id="STQ"
commandId="com.raytheon.viz.ui.actions.titleAction"
label="------ STQ ------">
</command>
<separator
name="xxx"
visible="true">
</separator>
<command
commandId="com.raytheon.viz.ui.actions.titleAction"
label="------ Local Analyses/Statistical Guidance ------">

View file

@ -23,6 +23,7 @@
<displays xsi:type="d2DMapRenderableDisplay"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<descriptor xsi:type="mapDescriptor">
<!-- Not High severity -->
<resource>
<loadProperties>
<capabilities>
@ -68,6 +69,53 @@
</resourceData>
</resource>
</resourceData>
</resource>
<!-- High severity -->
<resource>
<loadProperties>
<capabilities>
</capabilities>
</loadProperties>
<resourceData xsi:type="plotBlendedResourceData">
<resource>
<loadProperties loadWithoutData="true"/>
<properties isSystemResource="false" isBlinking="false"
isMapLayer="false" isHoverOn="false"
isVisible="true" />
<resourceData xsi:type="plotResourceData" plotSource="${legend} Sev"
plotModelFile="${svg2}"
retrieveData="false" isUpdatingOnMetadataOnly="false">
<binOffset posOffset="1800" negOffset="1800" virtualOffset="0"/>
<metadataMap>
<mapping key="pluginName">
<constraint constraintValue="pirep" constraintType="EQUALS" />
</mapping>
<mapping key="location.flightLevel">
<constraint constraintValue="${between}" constraintType="BETWEEN" />
</mapping>
</metadataMap>
</resourceData>
</resource>
<resource>
<loadProperties loadWithoutData="true"/>
<properties isSystemResource="false" isBlinking="false"
isMapLayer="false" isHoverOn="false"
isVisible="true" />
<resourceData xsi:type="plotResourceData" plotSource="${legend} Sev"
plotModelFile="${svg3}"
retrieveData="false" isUpdatingOnMetadataOnly="false">
<binOffset posOffset="1800" negOffset="1800" virtualOffset="0"/>
<metadataMap>
<mapping key="pluginName">
<constraint constraintValue="airep" constraintType="EQUALS" />
</mapping>
<mapping key="location.flightLevel">
<constraint constraintValue="${between}" constraintType="BETWEEN" />
</mapping>
</metadataMap>
</resourceData>
</resource>
</resourceData>
</resource>
</descriptor>
</displays>

View file

@ -24,6 +24,8 @@
<substitute key="svg0" value="pirepPlotDesign.svg"/>
<substitute key="svg1" value="pirepPlotDesign.svg"/>
<substitute key="legend" value="PIREP Plot 000-180 hft"/>
<substitute key="svg2" value="pirepPlotDesignSev.svg"/>
<substitute key="svg3" value="pirepPlotDesignSev.svg"/>
<substitute key="between" value="0--18000"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/PirepPlot.xml"
@ -31,6 +33,8 @@
<substitute key="svg0" value="pirepPlotDesign.svg"/>
<substitute key="svg1" value="pirepPlotDesign.svg"/>
<substitute key="legend" value="PIREP Plot 180-260 hft"/>
<substitute key="svg2" value="pirepPlotDesignSev.svg"/>
<substitute key="svg3" value="pirepPlotDesignSev.svg"/>
<substitute key="between" value="18000--26000"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/PirepPlot.xml"
@ -38,6 +42,8 @@
<substitute key="svg0" value="pirepPlotDesign.svg"/>
<substitute key="svg1" value="pirepPlotDesign.svg"/>
<substitute key="legend" value="PIREP Plot 260-500 hft"/>
<substitute key="svg2" value="pirepPlotDesignSev.svg"/>
<substitute key="svg3" value="pirepPlotDesignSev.svg"/>
<substitute key="between" value="26000--50000"/>
</contribute>
<contribute xsi:type="titleItem"
@ -47,6 +53,8 @@
<substitute key="svg0" value="pirepIcingDesign.svg"/>
<substitute key="svg1" value="airepIcingDesign.svg"/>
<substitute key="legend" value="PIREP Icing 000-180 hft"/>
<substitute key="svg2" value="pirepIcingDesignSev.svg"/>
<substitute key="svg3" value="airepIcingDesignSev.svg"/>
<substitute key="between" value="0--18000"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/PirepPlot.xml"
@ -54,6 +62,8 @@
<substitute key="svg0" value="pirepIcingDesign.svg"/>
<substitute key="svg1" value="airepIcingDesign.svg"/>
<substitute key="legend" value="PIREP Icing 180-260 hft"/>
<substitute key="svg2" value="pirepIcingDesignSev.svg"/>
<substitute key="svg3" value="airepIcingDesignSev.svg"/>
<substitute key="between" value="18000--26000"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/PirepPlot.xml"
@ -61,6 +71,8 @@
<substitute key="svg0" value="pirepIcingDesign.svg"/>
<substitute key="svg1" value="airepIcingDesign.svg"/>
<substitute key="legend" value="PIREP Icing 260-500 hft"/>
<substitute key="svg2" value="pirepIcingDesignSev.svg"/>
<substitute key="svg3" value="airepIcingDesignSev.svg"/>
<substitute key="between" value="26000--50000"/>
</contribute>
<contribute xsi:type="titleItem"
@ -70,6 +82,8 @@
<substitute key="svg0" value="pirepTurbDesign.svg"/>
<substitute key="svg1" value="airepTurbDesign.svg"/>
<substitute key="legend" value="PIREP Turb 000-180 hft"/>
<substitute key="svg2" value="pirepTurbDesignSev.svg"/>
<substitute key="svg3" value="airepTurbDesignSev.svg"/>
<substitute key="between" value="0--18000"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/PirepPlot.xml"
@ -77,6 +91,8 @@
<substitute key="svg0" value="pirepTurbDesign.svg"/>
<substitute key="svg1" value="airepTurbDesign.svg"/>
<substitute key="legend" value="PIREP Turb 180-260 hft"/>
<substitute key="svg2" value="pirepTurbDesignSev.svg"/>
<substitute key="svg3" value="airepTurbDesignSev.svg"/>
<substitute key="between" value="18000--26000"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/PirepPlot.xml"
@ -84,6 +100,8 @@
<substitute key="svg0" value="pirepTurbDesign.svg"/>
<substitute key="svg1" value="airepTurbDesign.svg"/>
<substitute key="legend" value="PIREP Turb 260-500 hft"/>
<substitute key="svg2" value="pirepTurbDesignSev.svg"/>
<substitute key="svg3" value="airepTurbDesignSev.svg"/>
<substitute key="between" value="26000--50000"/>
</contribute>
</menuTemplate>

View file

@ -20,7 +20,9 @@
package com.raytheon.uf.viz.drawables.triangulated.generic;
import com.raytheon.uf.common.colormap.prefs.ColorMapParameters;
import com.raytheon.uf.viz.core.IExtent;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.IView;
import com.raytheon.uf.viz.core.data.IColorMapDataRetrievalCallback;
import com.raytheon.uf.viz.core.drawables.IColormappedImage;
import com.raytheon.uf.viz.core.drawables.PaintProperties;
@ -30,6 +32,7 @@ import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.drawables.triangulated.ITriangleLocationCallback;
import com.raytheon.uf.viz.drawables.triangulated.ITriangulatedImage;
import com.raytheon.uf.viz.drawables.triangulated.ITriangulatedImageExtension;
import com.vividsolutions.jts.geom.Envelope;
/**
* Generic implementation of {@link ITriangulatedImageExtension} that uses a
@ -42,8 +45,9 @@ import com.raytheon.uf.viz.drawables.triangulated.ITriangulatedImageExtension;
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------- -------- --------- --------------------------
* ------------- -------- --------- ----------------------------
* Aug 18, 2015 4709 bsteffen Initial creation
* Dec 04, 2015 5146 bsteffen Limit the size of the image
*
* </pre>
*
@ -61,12 +65,25 @@ public class GenericTriangulatedImageExtension extends
IColormappedImageExtension imageExtension = target
.getExtension(IColormappedImageExtension.class);
TriangleFlattener flattener = new TriangleFlattener(dataCallback,
locationCallback);
locationCallback, getViewArea());
IColormappedImage image = imageExtension.initializeRaster(flattener,
colorMapParameters);
return new GenericTriangulatedImage(image, flattener);
}
private Envelope getViewArea() {
/*
* Use the extent area multiplied by the zoom level to determine the
* full view size when zoomed out.
*/
IView view = target.getView();
IExtent extent = view.getExtent();
double zoom = view.getZoom();
double width = extent.getWidth() / zoom;
double height = extent.getHeight() / zoom;
return new Envelope(0, width, 0, height);
}
@Override
public void drawImage(PaintProperties paintProps, ITriangulatedImage image)
throws VizException {

View file

@ -62,8 +62,9 @@ import com.vividsolutions.jts.geom.Triangle;
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------- -------- --------- --------------------------
* ------------- -------- --------- ----------------------------
* Aug 18, 2015 4709 bsteffen Initial creation
* Dec 04, 2015 5146 bsteffen Limit the size of the image
*
* </pre>
*
@ -79,11 +80,17 @@ public class TriangleFlattener implements IColorMapDataRetrievalCallback {
private Envelope envelope = new Envelope();
/*
* Limit the size of the image, this is general the size of the displayed
* area.
*/
private Envelope maximumArea;
public TriangleFlattener(IColorMapDataRetrievalCallback dataSource,
ITriangleLocationCallback locationSource) {
ITriangleLocationCallback locationSource, Envelope maximumArea) {
this.dataSource = dataSource;
this.locationSource = locationSource;
this.maximumArea = maximumArea;
}
@ -91,6 +98,9 @@ public class TriangleFlattener implements IColorMapDataRetrievalCallback {
for (double[] coordinate : coordinates) {
envelope.expandToInclude(coordinate[0], coordinate[1]);
}
if (maximumArea != null) {
envelope = envelope.intersection(maximumArea);
}
}
@Override
@ -127,6 +137,11 @@ public class TriangleFlattener implements IColorMapDataRetrievalCallback {
triEnv.expandToInclude(p1);
triEnv.expandToInclude(p2);
triEnv = triEnv.intersection(envelope);
if (triEnv.isNull()) {
continue;
}
int minX = (int) ((triEnv.getMinX() - envelope.getMinX()) / dx);
int maxX = (int) ((triEnv.getMaxX() - envelope.getMinX()) / dx);
int minY = (int) ((triEnv.getMinY() - envelope.getMinY()) / dy);

View file

@ -19,6 +19,7 @@
**/
package com.raytheon.uf.viz.gl.triangulated;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
@ -79,8 +80,9 @@ import com.vividsolutions.jts.geom.Triangle;
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------- -------- --------- --------------------------
* ------------- -------- --------- ---------------------------------
* Aug 24, 2015 4709 bsteffen Initial creation
* Dec 04, 2015 5146 bsteffen Rewind attrib buffer before use.
*
* </pre>
*
@ -201,6 +203,9 @@ public class GLTriangulatedImage implements ITriangulatedImage {
gl.glPolygonMode(GL.GL_BACK, GL.GL_FILL);
gl.glPolygonMode(GL.GL_FRONT, GL.GL_FILL);
gl.glEnable(GL.GL_BLEND);
gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
GLTextureObject cmapTexture = target
.getColorMapTexture(colorMapParameters);
@ -243,8 +248,10 @@ public class GLTriangulatedImage implements ITriangulatedImage {
vertexBuffer.rewind();
gl.glVertexPointer(2, GL.GL_FLOAT, 0, vertexBuffer);
Buffer attribBufferData = attribBuffer.getData();
attribBufferData.rewind();
program.setVertexAttributeData("attrib_value",
attribBuffer.getTextureType(), attribBuffer.getData());
attribBuffer.getTextureType(), attribBufferData);
indexBuffer.rewind();
gl.glDrawElements(GL.GL_TRIANGLES, indexBuffer.capacity(),
@ -255,6 +262,8 @@ public class GLTriangulatedImage implements ITriangulatedImage {
gl.glActiveTexture(GL.GL_TEXTURE1);
gl.glBindTexture(GL.GL_TEXTURE_1D, 0);
gl.glDisable(GL.GL_BLEND);
} finally {
target.popGLState();
}

View file

@ -33,6 +33,7 @@ import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.data.CommonConfig;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.data.ObConst.ReportType;
import com.raytheon.uf.common.monitor.xml.AreaIdXML;
import com.raytheon.uf.common.monitor.xml.StationIdXML;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.status.IUFStatusHandler;
@ -59,6 +60,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Mar 17 2015 3888 dhladky check for nulls
* Sep 25 2015 3873 skorolev Corrected addReport for moving platforms.
* Oct 19 2015 3841 skorolev Added try to saveConfigXml
* Nov 12 2015 3841 dhladky Augmented Slav's fix for moving platforms.
*
* </pre>
*
@ -164,9 +166,22 @@ public class ObHourReports {
try {
// use only marine zones
if (zone.charAt(2) == 'Z') {
Coordinate zcoor = MonitorAreaUtils.getZoneCenter(zone);
double shipToZone = distance(latShip, lonShip, zcoor.y,
zcoor.x);
double latZone;
double lonZone;
if (zcoor != null) {
latZone = zcoor.y;
lonZone = zcoor.x;
} else {
// Newly added zone
AreaIdXML zoneXML = configMgr.getAreaXml(zone);
latZone = zoneXML.getCLat();
lonZone = zoneXML.getCLon();
}
double shipToZone = distance(latShip, lonShip, latZone,
lonZone);
if (shipToZone <= shipDist) {
// associate moving platform with monitoring zone.
shipZones.add(zone);
@ -184,8 +199,9 @@ public class ObHourReports {
continue;
}
} catch (SpatialException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
e);
statusHandler.handle(Priority.PROBLEM,
"Could not determine distance from moving platform to zone: Platform: "
+ report.getPlatformId() + " Zone: " + zone, e);
}
}
// Update configuration file.
@ -214,10 +230,13 @@ public class ObHourReports {
*/
public TableData getZoneTableData() {
TableData tblData = new TableData(appName);
for (String zone : hourReports.keySet()) {
// Area configuration manager controls what gets displayed
for (String zone : configMgr.getAreaList()) {
if (hourReports.containsKey(zone)) {
tblData.addTableRowData(this.getObZoneHourReports(zone)
.getZoneTableRowData());
}
}
return tblData;
}
@ -229,7 +248,9 @@ public class ObHourReports {
*/
public TableData getFogZoneTableData(Map<String, CellType> algCellType) {
TableData tblData = new TableData(AppName.FOG);
for (String zone : hourReports.keySet()) {
// Area configuration manager controls what gets displayed
for (String zone : configMgr.getAreaList()) {
if (hourReports.containsKey(zone)) {
CellType theAlgCellType;
if (algCellType.containsKey(zone)) {
theAlgCellType = algCellType.get(zone);
@ -239,6 +260,7 @@ public class ObHourReports {
tblData.addTableRowData(this.getObZoneHourReports(zone)
.getFogZoneTableRowData(theAlgCellType));
}
}
return tblData;
}
@ -250,7 +272,9 @@ public class ObHourReports {
*/
public TableData getSSZoneTableData(Map<String, CellType> fogCellType) {
TableData tblData = new TableData(AppName.SAFESEAS);
for (String zone : hourReports.keySet()) {
// Area configuration manager controls what gets displayed
for (String zone : configMgr.getAreaList()) {
if (hourReports.containsKey(zone)) {
CellType theFogCellType;
if (fogCellType.containsKey(zone)) {
theFogCellType = fogCellType.get(zone);
@ -260,6 +284,7 @@ public class ObHourReports {
tblData.addTableRowData(this.getObZoneHourReports(zone)
.getSSZoneTableRowData(theFogCellType));
}
}
return tblData;
}

View file

@ -36,8 +36,6 @@ import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.M
import com.raytheon.uf.common.monitor.data.CommonConfig;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.data.ObConst;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.viz.monitor.config.CommonTableConfig.CellType;
@ -61,6 +59,7 @@ import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
* Jan 29, 2013 15654 zhao add Wind Chill calculation for SNOW
* Sep 04, 2014 3220 skorolev Updated getStationTableData method.
* Sep 25, 2015 3873 skorolev Added multiHrsTabData.
* Nov 12, 2015 3841 dhladky Augmented Slav's update fix.
*
* </pre>
*
@ -69,8 +68,6 @@ import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
*/
public class ObMultiHrsReports {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(ObMultiHrsReports.class);
/**
* Thresholds manager
@ -522,7 +519,7 @@ public class ObMultiHrsReports {
* @return
*/
public ObHourReports getObHourReports() {
if (multiHrsReports.isEmpty()) {
if (multiHrsReports.isEmpty() || multiHrsTabData.isEmpty()) {
ObHourReports obHrsReps = new ObHourReports(
TableUtil.getNominalTime(SimulatedTime.getSystemTime()
.getTime()), appName, thresholdMgr);
@ -615,8 +612,12 @@ public class ObMultiHrsReports {
* Updates table cache
*/
public void updateTableCache() {
// clear and rebuild table data on config changes
multiHrsTabData.clear();
for (Date time : multiHrsReports.keySet()) {
getZoneTableData(time);
TableData tblData = getZoneTableData(time);
multiHrsTabData.put(time, tblData);
}
}
}

View file

@ -52,6 +52,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Apr 28, 2014 3086 skorolev Removed local getAreaConfigMgr method.
* Feb 10, 2015 3886 skorolev Added fixed width for dialog.
* Aug 17, 2015 3841 skorolev Corrected handleAddNewAction method.
* Nov 12, 2015 3841 dhladky Augmented Slav's fix for moving platforms.
*
* </pre>
*
@ -81,6 +82,24 @@ public class AddNewZoneDlg extends CaveSWTDialog {
/** Monitoring Area Configuration Dialog. */
private final MonitoringAreaConfigDlg macDlg;
/** County constant char */
private static final char C = 'C';
/** Zone constant char */
private static final char Z = 'Z';
/** Upper Latitude Boundary **/
private static double upLatBound = 90.0;
/** Lower Latitude Boundary **/
private static double lowLatBound = -90.0;
/** Upper Longitude Boundary **/
private static double upLonBound = 180.0;
/** Lower Longitude Boundary **/
private static double lowLonBound = -180.0;
/**
* Constructor.
*
@ -280,40 +299,41 @@ public class AddNewZoneDlg extends CaveSWTDialog {
*/
private void handleAddNewAction(String areaId, String latString,
String lonString) throws NumberFormatException {
ZoneType type = ZoneType.REGULAR;
char charAt = idTF.getText().charAt(2);
if (!appName.equals(AppName.SNOW)) {
if (marineZoneRdo.getSelection()) {
type = ZoneType.MARITIME;
}
// correct zone type
if (marineZoneRdo.getSelection() && charAt != Z) {
String z = idTF.getText().substring(2).replace(charAt, Z);
idTF.setText(idTF.getText().substring(0, 2) + z);
}
if (countyRdo.getSelection() && charAt != C) {
String c = idTF.getText().substring(2).replace(charAt, C);
idTF.setText(idTF.getText().substring(0, 2) + c);
}
} else if (appName.equals(AppName.SNOW) && charAt != C) {
String c = idTF.getText().substring(2).replace(charAt, C);
idTF.setText(idTF.getText().substring(0, 2) + c);
}
double lat = Double.parseDouble(latString.trim());
double lon = Double.parseDouble(lonString.trim());
if (lat > upLatBound || lat < lowLatBound || lon > upLonBound || lon < lowLonBound) {
macDlg.latLonErrorMsg(latString, lonString);
return;
}
areaId = idTF.getText();
if (macDlg.isExistingZone(areaId)) {
macDlg.displayInputErrorMsg("The Area ID, "
+ areaId
+ ", is already in your Monitoring Area or among your Additional Zones.");
return;
}
double lat = Double.parseDouble(latString.trim());
double lon = Double.parseDouble(lonString.trim());
ZoneType type = ZoneType.REGULAR;
// correct third character for METARs
char chr = idTF.getText().charAt(2);
if (chr != 'C') {
String c = idTF.getText().substring(2).replace(chr, 'C');
idTF.setText(idTF.getText().substring(0, 2) + c);
areaId = idTF.getText();
}
if (!appName.equals(AppName.SNOW)) {
// correct zone type
if (marineZoneRdo.getSelection() || idTF.getText().charAt(2) == 'Z') {
type = ZoneType.MARITIME;
}
// correct third character for MARITIMEs
char chrm = idTF.getText().charAt(2);
if (marineZoneRdo.getSelection() && chrm != 'Z') {
String z = idTF.getText().substring(2).replace(chr, 'Z');
idTF.setText(idTF.getText().substring(0, 2) + z);
areaId = idTF.getText();
}
}
if (lat > 90.0 || lat < -90.0 || lon > 180.0 || lon < -180.0) {
macDlg.latLonErrorMsg(latString, lonString);
return;
}
} else {
macDlg.configMgr.addNewArea(areaId, lat, lon, type);
macDlg.addZoneToMA(areaId);
}
}
}

View file

@ -54,6 +54,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Apr 23, 2014 3054 skorolev Fixed issue with deleting a new station.
* Apr 28, 2014 3086 skorolev Removed local getAreaConfigMgr method.
* Aug 17, 2015 3841 skorolev Corrected deleteSelected method.
* Nov 12, 2015 3841 dhladky Augmented Slav's work.
*
* </pre>
*
@ -206,7 +207,7 @@ public class DeleteStationDlg extends CaveSWTDialog {
cfgMgr.removeStation(selection.split("#")[0], areaXmlList);
newAddedStns.remove(selection);
populate();
macDlg.maStationsRemoved = true;
macDlg.maStationsChanged = true;
} else {
MessageBox messageBox = new MessageBox(shell,
SWT.ICON_INFORMATION | SWT.NONE);

View file

@ -60,6 +60,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Apr 28, 2014 3086 skorolev Removed local getAreaConfigMgr method.
* Nov 10, 2014 3741 skorolev Fixed configXML issue.
* Aug 17, 2015 3841 skorolev Made editable a content of ID field.
* Nov 12, 2015 3841 dhladky Augmented Slav's update fixes.
*
* </pre>
*
@ -391,7 +392,7 @@ public class EditNewZoneDlg extends CaveSWTDialog {
cfgMgr.removeAdjArea(zoneXML);
}
macDlg.populateLeftLists("");
macDlg.maZonesRemoved = true;
macDlg.maZonesChanged = true;
return true;
} else {
bottomLbl.setText("No zones have been deleted.");

View file

@ -86,6 +86,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Mar 08, 2015 3888 dhladky Restored threshold pop-up when adding new stations/zones.
* Sep 18, 2015 3873 skorolev Added formIsValid method.
* Oct 19, 2015 3841 skorolev Corrected formIsValid messages.
* Nov 12, 2015 3841 dhladky Augmented Slav's fix for moving platforms.
*
* </pre>
*
@ -197,13 +198,13 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
private java.util.List<String> maZones = null;
/** monitor area zones status. */
protected boolean maZonesRemoved = false;
protected boolean maZonesChanged = false;
/** monitor area stations **/
private java.util.List<String> maStations = null;
/** monitor area stations status. */
protected boolean maStationsRemoved = false;
protected boolean maStationsChanged = false;
/** monitor area additional zones **/
private java.util.List<String> additionalZones = null;
@ -255,6 +256,13 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
+ "have been set to default values; would you like to modify "
+ "their threshold values now?";
/** County constant char */
private static final char C = 'C';
/** Zone constant char */
private static final char Z = 'Z';
/**
* Constructor.
*
@ -519,7 +527,6 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
@Override
public void widgetSelected(SelectionEvent event) {
removeZoneStn();
maZonesRemoved = true;
}
});
@ -615,7 +622,6 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
@Override
public void widgetSelected(SelectionEvent event) {
removeAssociated();
maStationsRemoved = true;
}
});
@ -1081,6 +1087,8 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
configMgr.setShipDistance(shipDistance.getSelection());
configMgr.setUseAlgorithms(fogChk.getSelection());
}
}
/**
@ -1163,6 +1171,8 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
.getAddedStations().contains(stnId));
handleMonitorAreaListSelection();
}
maZonesChanged = true;
}
/**
@ -1219,6 +1229,8 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
configMgr.removeStationFromArea(stnZone,
entry.substring(0, entry.indexOf('#')));
}
maZonesChanged = true;
}
/**
@ -1301,6 +1313,8 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
configMgr.addNewStation(entry, stnId, stnType, configMgr
.getAddedStations().contains(stnId));
}
maStationsChanged = true;
}
/**
@ -1339,11 +1353,15 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
.toArray(new String[additionalStns.size()]));
}
}
} else { // Station mode
String stn = monitorAreaList.getItem(monitorAreaList
.getSelectionIndex());
configMgr.removeStationFromArea(entry, stn);
}
maStationsChanged = true;
}
/**
@ -1479,7 +1497,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
public boolean formIsValid(String area, String latString, String lonString) {
boolean retVal = true;
if (area.equals("") || area.length() != 6
|| (area.charAt(2) != 'C' && area.charAt(2) != 'Z')) {
|| (area.charAt(2) != C && area.charAt(2) != Z)) {
StringBuilder invalidMsg = new StringBuilder(INVALID_AREA_MSG_C);
if (appName.equals(AppName.SNOW)) {
invalidMsg.append(".");
@ -1557,8 +1575,8 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
*/
protected void resetStatus() {
this.timeWindowChanged = false;
this.maZonesRemoved = false;
this.maStationsRemoved = false;
this.maZonesChanged = false;
this.maStationsChanged = false;
this.shipDistanceChanged = false;
this.fogChkChanged = false;
}
@ -1572,8 +1590,8 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
if (!configMgr.getAddedZones().isEmpty()
|| !configMgr.getAddedStations().isEmpty()
|| this.timeWindowChanged || this.shipDistanceChanged
|| this.fogChkChanged || this.maZonesRemoved
|| this.maStationsRemoved) {
|| this.fogChkChanged || this.maZonesChanged
|| this.maStationsChanged) {
return true;
}
return false;

View file

@ -232,7 +232,7 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
protected abstract void shellDisposeAction();
/** List of opened plots. **/
private Map<String, CaveSWTDialog> openedDlgs = new HashMap<String, CaveSWTDialog>();
private final Map<String, CaveSWTDialog> openedDlgs = new HashMap<String, CaveSWTDialog>();
/** row index in the station table. **/
public int rowIndex;
@ -793,8 +793,8 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
private void zoomToZone(String zone) throws Exception {
Coordinate zoneCenter = MonitorAreaUtils.getZoneCenter(zone);
if (zoneCenter == null) { // Test a newly added zone.
AreaIdXML zoneXML = configMgr.getAreaXml(zone);
if (zoneXML != null // Coordinates do not the null values.
AreaIdXML zoneXML = getMonitorAreaConfigInstance().getAreaXml(zone);
if (zoneXML != null
&& (zoneXML.getCLon() != null || zoneXML.getCLat() != null)) {
zoneCenter = new Coordinate(zoneXML.getCLon(),
zoneXML.getCLat());
@ -1011,6 +1011,7 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
*/
public void refreshZoneTableData(ObMultiHrsReports obData) {
obData.getObHourReports().updateZones();
obData.updateTableCache();
this.updateTableDlg(obData.getObHourReports());
}
}

View file

@ -59,6 +59,7 @@
<notifyRaise>disabled</notifyRaise>
<notifyPlay>disabled</notifyPlay>
<playFile>None</playFile>
<alertIntervalMinutes>10</alertIntervalMinutes>
<blink>true</blink>
<disallowSend>error</disallowSend>
<loadOrder>latest</loadOrder>

View file

@ -247,7 +247,10 @@ import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations;
* Sep 28, 2015 4898 rferrel Disable sending of TAF when CAVE not in real time.
* Oct 05, 2015 4855 skorolev Fixed an unhandled event loop exception in createErrorStyleRange.
* Oct 16, 2015 4645 skorolev Added updateWordWrap.
* 10/23/2015 18061 zhao Fixed a bug in checkBaiscSyntaxError()
* Nov 12, 2015 4834 njensen Changed LocalizationOpFailedException to LocalizationException
* Nov 12, 2015 4834 njensen Changed LocalizationOpFailedException to LocalizationException
* Dec 09, 2015 4645 skorolev Initiated wrapChk using ResourceTag. Removed popup menu persistance.
*
* </pre>
*
@ -1944,6 +1947,11 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
wrapChk = new Button(controlsComp, SWT.CHECK);
wrapChk.setText("Wrap");
configMgr.setDefaultFontAndColors(wrapChk);
if (configMgr.getDataAsString(ResourceTag.Wrap).equals("word")) {
wrapChk.setSelection(true);
} else {
wrapChk.setSelection(false);
}
wrapChk.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
@ -2036,7 +2044,7 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
tafStartIndex += taf.length() + 2;
}
if (doLogMessage) {
if (doLogMessage && errorFound) {
msgStatComp.setMessageText(msg, qcColors[3].getRGB());
}
@ -2752,6 +2760,8 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
return;
}
editorTafTabComp.getTextEditorControl().cut();
// Remove popup menu.
editorTafTabComp.getTextEditorControl().redraw();
}
}
@ -2793,6 +2803,8 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
}
} else {
editorTafTabComp.getTextEditorControl().copy();
// Remove popup menu.
editorTafTabComp.getTextEditorControl().redraw();
}
}
}
@ -2879,6 +2891,8 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
if (tabFolder.getSelectionIndex() != VIEWER_TAB_SELECTED) {
// Assume editorTafTabComp is for the active tab.
editorTafTabComp.undo();
// Remove popup menu.
editorTafTabComp.getTextEditorControl().redraw();
}
}
@ -2891,6 +2905,8 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
if (tabFolder.getSelectionIndex() != VIEWER_TAB_SELECTED) {
// Assume editorTafTabComp is for the active tab.
editorTafTabComp.redo();
// Remove popup menu.
editorTafTabComp.getTextEditorControl().redraw();
}
}

View file

@ -56,6 +56,8 @@ import com.raytheon.uf.viz.core.requests.ThriftClient;
* Sep 10, 2009 njensen Initial creation
* Apr 10, 2013 1735 rferrel Convert to ThinClient and DbQueryRequests.
* Sep 16, 2015 4880 njensen Optimized requests for data
* Dec 01, 2015 5156 rferrel {@linkplain #getCcfpData(long)} do not shrink dtList
* when it contains 3 or fewer elements.
*
* </pre>
*
@ -136,10 +138,12 @@ public class MonitorDataUtil {
return new CcfpRecord[0];
}
// filter so only the three most recent periods are included
// filter so no more then the three most recent periods are included
Collections.sort(dtList,
Collections.reverseOrder(new DataTimeComparator()));
if (dtList.size() > 3) {
dtList = dtList.subList(0, 3);
}
String[] dts = new String[dtList.size()];
for (int index = 0; index < dts.length; ++index) {
dts[index] = dtList.get(index).toString();

View file

@ -24,6 +24,9 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import com.raytheon.viz.aviation.resource.ResourceConfigMgr;
import com.raytheon.viz.aviation.resource.ResourceConfigMgr.ResourceTag;
import sun.audio.AudioData;
import sun.audio.AudioDataStream;
import sun.audio.AudioPlayer;
@ -36,8 +39,9 @@ import sun.audio.AudioStream;
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* ------------ --------- ----------- --------------------------
* Dec 2, 2009 avarani Initial creation
* Oct 20,2015 17445 yteng Set alert interval
*
* </pre>
*
@ -46,6 +50,9 @@ import sun.audio.AudioStream;
*/
public class NotifyAudioManager {
private static long lastAlertTime = 0;
private static NotifyAudioManager nam;
private String filename;
@ -69,6 +76,14 @@ public class NotifyAudioManager {
}
public void playFile(String filename) throws IOException {
ResourceConfigMgr configMgr = ResourceConfigMgr.getInstance();
int alertIntervalMinutes = configMgr.getResourceAsInt(ResourceTag.AlertIntervalMinutes);
long currentTime = System.currentTimeMillis();
if (currentTime >= (lastAlertTime + alertIntervalMinutes*60*1000)) {
lastAlertTime = currentTime;
if (!filename.equals(this.filename)) {
File soundFile = new File(filename);
InputStream in = new FileInputStream(soundFile);
@ -76,8 +91,12 @@ public class NotifyAudioManager {
AudioData data = as.getData();
ads = new AudioDataStream(data);
}
AudioPlayer.player.stop(ads);
AudioPlayer.player.start(ads);
}
}
public static void resetAlertTime() {
lastAlertTime = 0;
}
}

View file

@ -70,6 +70,7 @@ import com.raytheon.viz.aviation.monitor.GfsMonitorObserver;
import com.raytheon.viz.aviation.monitor.IGridDataRetrieveListener;
import com.raytheon.viz.aviation.monitor.LtgMonitorObserver;
import com.raytheon.viz.aviation.monitor.MetarMonitorObserver;
import com.raytheon.viz.aviation.monitor.NotifyAudioManager;
import com.raytheon.viz.aviation.monitor.PythonMonitorJob;
import com.raytheon.viz.aviation.monitor.RltgMonitorObserver;
import com.raytheon.viz.aviation.monitor.ScheduledMonitorTask;
@ -147,6 +148,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* 03/07/2013 1735 rferrel Performance speed up for retrieving grid data.
* 08/09/2013 2033 mschenke Switched File.separator to IPathManager.SEPARATOR
* Sep 15, 2015 4880 njensen Removed reference to ForecastModel
* 10/20/2015 17445 yteng Reset alert time for audio alert.
*
* </pre>
*
@ -331,6 +333,7 @@ public class TafMonitorDlg extends CaveSWTDialog implements
initializeData();
initializeComponents();
setupMonitoring();
NotifyAudioManager.resetAlertTime();
shell.addShellListener(new ShellAdapter() {
@Override

View file

@ -52,6 +52,7 @@ import com.raytheon.viz.aviation.activator.Activator;
* methods and method to reset data values.
* Dec 9, 2010 7380 rferrel Changed spinner values for text fields.
* Dec 14, 2010 5782 rferrel Fixed numTafs combo string array.
* Oct 20, 2015 17445 yteng Add audio alert interval field.
*
* </pre>
*
@ -90,7 +91,8 @@ public class ResourceConfigMgr implements IResourceAction {
"alertLevel3"), AlertLevel4("alertLevel4"), AlertLevel5(
"alertLevel5"), AlertLevel6("alertLevel6"), NotifyDeiconify(
"notifyDeiconify"), NotifyRaise("notifyRaise"), NotifyPlay(
"notifyPlay"), PlayFile("playFile"), Blink("blink"), DisallowSend(
"notifyPlay"), PlayFile("playFile"), AlertIntervalMinutes(
"alertIntervalMinutes"), Blink("blink"), DisallowSend(
"disallowSend"), LoadOrder("loadOrder"), AutoSave("autoSave"), UpdateTimes(
"updateTimes"), AutoPrint("autoPrint"), Insert("insert"), Wrap(
"wrap"), AmdButtons("amdbuttons"), NumTafs("numTafs"), NumHours(
@ -228,6 +230,8 @@ public class ResourceConfigMgr implements IResourceAction {
ResourceType.COMBO, "Alert level to play file"));
resourceTypeMap.put(ResourceTag.PlayFile, new ResourceInfo(
ResourceType.FILE, "Sound to play on TAF alert"));
resourceTypeMap.put(ResourceTag.AlertIntervalMinutes, new ResourceInfo(
ResourceType.SPINNER, "TAF alert interval in minutes"));
resourceTypeMap.put(ResourceTag.Blink, new ResourceInfo(
ResourceType.CHECK, "Blink on new notification"));
resourceTypeMap.put(ResourceTag.DisallowSend, new ResourceInfo(
@ -297,6 +301,9 @@ public class ResourceConfigMgr implements IResourceAction {
final int htMin = 50;
final int htMax = 1200;
final int inc = 50;
final int aiMin = 1;
final int aiMax = 60;
final int aiInc = 1;
if (resourceTag == ResourceTag.TextWidth) {
return new SpinnerData(wdMin, wdMax, inc);
@ -312,6 +319,8 @@ public class ResourceConfigMgr implements IResourceAction {
return new SpinnerData(wdMin, wdMax, inc);
} else if (resourceTag == ResourceTag.TextViewerHeight) {
return new SpinnerData(htMin, htMax, inc);
} else if (resourceTag == ResourceTag.AlertIntervalMinutes) {
return new SpinnerData(aiMin, aiMax, aiInc);
}
return new SpinnerData(0, 100, 10);

View file

@ -59,6 +59,7 @@ import com.raytheon.viz.aviation.resource.ResourceConfigMgr.ResourceTag;
* 30 Aug 2013 #2164 bkowal Add default case statement for MSFT Windows
* Java. Replaced platform-dependent code with
* code that is not platform-dependent.
* Oct 20, 2015 17445 yteng Add audio alert interval.
*
* </pre>
*
@ -526,6 +527,9 @@ public class ResourceDataManager {
resourceMap.put(ResourceTag.NotifyPlay, notifyPlay);
String playFile = resourceCB.getResourceAsString(ResourceTag.PlayFile);
resourceMap.put(ResourceTag.PlayFile, playFile);
int alertIntervalMinutes = resourceCB
.getResourceAsInt(ResourceTag.TextEditorInsWidth);
resourceMap.put(ResourceTag.AlertIntervalMinutes, alertIntervalMinutes);
boolean blink = resourceCB.getResourceAsBoolean(ResourceTag.Blink);
resourceMap.put(ResourceTag.Blink, Boolean.valueOf(blink));
String disalowSend = resourceCB

View file

@ -31,6 +31,11 @@
# Change Document History:
# %PIRC%
#
#
# Date Ticket# Engineer Description
# ---------- ---------- ----------- --------------------------
# 10/28/2015 15464 zhao Modified mkTempo & mkProb30 to handle case of "TS"+"SKC"
#
import sys,os,copy,cPickle,math,ConfigParser,time,logging
import AvnLib, AvnParser, Avn
@ -325,6 +330,7 @@ class LampProjection(Projection):
visStr = self.vis['str']
if 'TS' in tmpStr:
#make sure cig is below threshold
if skyStr != 'SKC':
cig = int(skyStr[3:])
if cig > self.grpTaf['cbhight']:
cig = self.grpTaf['cbhight']
@ -360,6 +366,7 @@ class LampProjection(Projection):
visStr = self.vis['str']
if 'TS' in tmpStr:
#make sure cig is below threshold
if skyStr != 'SKC':
cig = int(skyStr[3:])
if cig > self.grpTaf['cbhight']:
cig = self.grpTaf['cbhight']

View file

@ -99,7 +99,7 @@ class Tool (SmartScript.SmartScript):
# you could get this from GridInfo, but you can't
#
resolution=1
if (WEname=="QPF"):
if (WEname=="QPF" or WEname=="IceAccum"):
resolution=0.01
if (WEname=="SnowAmt"):
resolution=0.1

View file

@ -41,6 +41,7 @@
# 05/07/2015 4027 randerso Fixed error handling,
# added NOTE about false postives for duplicate ETNs
# 10/16/2015 17771 dgilling Remove __sitesIgnoreNatlEtn.
# 10/29/2015 17701 yteng Correct parm selection for Hazards to exclude Hazardsnc
# 12/07/2015 5129 dgilling Support new IFPClient.
#
@ -1037,10 +1038,8 @@ class HazardsTable(VTECTableUtil.VTECTableUtil):
# pid = filter(lambda x: str(x).find("Hazards") != -1,
# self.__ifpClient.getParmList(self.__databaseID))[0]
parmList = self.__ifpClient.getParmList(dbid)
size = parmList.size()
for x in range(size):
p = parmList.get(x)
if str(p).find("Hazards") != -1:
for p in parmList:
if p.getParmName() == "Hazards":
pid = p
break

View file

@ -1920,6 +1920,14 @@ class FWS_Overrides:
argDict["creationTime"] = self._getTime(self._creationDate, self._creationTime)
return None
def _parseTime(self,date,t,rtz):
try:
cTime = time.strptime(t + ' ' + date + ' ' + rtz, '%H%M %m/%d/%y %Z')
except ValueError:
cTime = time.strptime(t + ' ' + date + ' ' + rtz, '%H%M %m/%d/%Y %Z')
return cTime
def _getTime(self, date, t):
# Make a unix time integer from the given date and time strings
if t == "":
@ -1934,7 +1942,7 @@ class FWS_Overrides:
ptz = rtz[0:1]
offset = 0
if otz == ptz:
cTime = time.strptime(t + ' ' + date + ' ' + rtz, '%H%M %m/%d/%y %Z')
cTime = self._parseTime (date,t,rtz)
else:
if ptz == "E":
if otz == "E":
@ -1973,9 +1981,9 @@ class FWS_Overrides:
elif otz == "P":
offset = 0
if stz[1:3] == rtz[1:3]:
cTime = time.strptime(t + ' ' + date + ' ' + stz, '%H%M %m/%d/%y %Z')
cTime = self._parseTime (date,t,stz)
else:
cTime = time.strptime(t + ' ' + date + ' ' + dtz, '%H%M %m/%d/%y %Z')
cTime = self._parseTime (date,t,dtz)
return time.mktime(cTime) + offset*3600
@ -2004,9 +2012,7 @@ class FWS_Overrides:
otz = stz[0:1]
ptz = rtz[0:1]
if otz == ptz:
self._fireDateTime = time.strptime(
self._fireTime + ' ' + self._fireDate + ' ' + rtz,
'%H%M %m/%d/%y %Z')
self._fireDateTime = self._parseTime (self._fireDate,self._fireTime,rtz)
fcst = fcst + time.strftime(
'Forecast is based on ' + requestWords + ' time of %H%M %Z on %B %d. ',
self._fireDateTime)
@ -2049,19 +2055,19 @@ class FWS_Overrides:
elif otz == "P":
offset = 0
if stz[1:3] == rtz[1:3]:
self._fireDateTime = time.strptime(
self._fireTime + ' ' + self._fireDate + ' ' + stz,
'%H%M %m/%d/%y %Z')
self._fireDateTime = self._parseTime (self._fireDate,self._fireTime,stz)
tempTime = time.mktime(self._fireDateTime) + offset*3600
self._fireDateTime = time.localtime(tempTime)
else:
self._fireDateTime = time.strptime(
self._fireTime + ' ' + self._fireDate + ' ' + dtz,
'%H%M %m/%d/%y %Z')
self._fireDateTime = self._parseTime (self._fireDate,self._fireTime,dtz)
tempTime = time.mktime(self._fireDateTime) + offset*3600
self._fireDateTime = time.localtime(tempTime)
try:
fireDateTime = time.strptime(
self._fireTime + ' ' + self._fireDate, '%H%M %m/%d/%y')
except ValueError:
fireDateTime = time.strptime(
self._fireTime + ' ' + self._fireDate, '%H%M %m/%d/%Y')
fcst = fcst + time.strftime(
'Forecast is based on ' + requestWords + ' time of %H%M ' + rtz + ' on %B %d. ',
fireDateTime)

View file

@ -1795,9 +1795,9 @@ class SampleAnalysis(CommonUtils.CommonUtils):
timeRange = subRange
exec "result = " + primaryMethod
# Handle no data
# If a subRange has no data return None
# If a subRange has no data continue
if result is None:
return None
continue
statsByRange.append((result, subRange))
return statsByRange

View file

@ -964,10 +964,10 @@ class ISC_Utility(SmartScript.SmartScript):
cnt[numpy.less(cnt, 1)] = 1
if GridType.VECTOR.equals(wxType):
sum /= cnt
sum[noISC]= minLimit
sum[noISC]= minlimit
sumv /= cnt
sumv[noISC] = minLimit
sumv[noISC] = minlimit
(mag,direc)=self.UVToMagDir(sum,sumv)
(baseMag,baseDir)=baseGrid

View file

@ -75,6 +75,8 @@ import com.raytheon.viz.ui.simulatedtime.SimulatedTimeProhibitedOpException;
* 24 AUG 2015 4749 dgilling Ensure TextProductFinishListener callbacks execute on UI thread,
* override dispose to aid perspective shutdown.
* 15 SEP 2015 4858 dgilling Handle exception from runFormatterScript.
* 03 NOV 2015 14813 ryu Fix missing VTEC code in generated product. VTEC mode is set
* based on the pil of the product rather than the disply name.
*
* </pre>
*
@ -392,24 +394,11 @@ public class ProductAreaComp extends Composite implements
if (formattingCbo.isVisible()) {
vtecMode = formattingCbo.getText();
} else {
// TODO: part of fix for SS RM DR #14813
// String pil = (String) textProductMgr
// .getDefinitionValue(productName, "pil");
// if (pil != null) {
// pil = pil.substring(0, 3);
// vtecMode = textProductMgr
// .getVtecMessageType(pil);
// }
int hazIndex = productName.indexOf("Hazard_");
if (hazIndex > -1) {
String category = productName.substring(
hazIndex + 7, hazIndex + 10);
vtecMode = textProductMgr
.getVtecMessageType(category);
if (vtecMode == null) {
vtecMode = "";
}
String pil = (String) textProductMgr
.getDefinitionValue(productName, "pil");
if (pil != null) {
pil = pil.substring(0, 3);
vtecMode = textProductMgr.getVtecMessageType(pil);
}
}

View file

@ -84,6 +84,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Both not existing, set as MISSING
* Dec 07, 2012 1353 rferrel Make dialog non-blocking.
* Feb 05, 2013 1578 rferrel Changes for non-blocking singleton TimeSeriesDlg.
* Jun 15, 2015 16579 wkwock Add HSA filter.
*
* </pre>
*
@ -116,6 +117,11 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements
*/
private Combo exceedingCbo;
/**
* HSA combo box.
*/
private Combo hsaCbo;
/**
* Sort by time radio button.
*/
@ -263,7 +269,7 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements
*/
private void createTopControls() {
Composite topControlComp = new Composite(shell, SWT.NONE);
GridLayout topControlGl = new GridLayout(6, false);
GridLayout topControlGl = new GridLayout(8, false);
topControlComp.setLayout(topControlGl);
Label showLbl = new Label(topControlComp, SWT.NONE);
@ -326,6 +332,25 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements
}
});
GridData hsagd = new GridData(100, SWT.DEFAULT);
Label hsaLbl = new Label(topControlComp, SWT.RIGHT);
hsaLbl.setText("HSA");
hsaLbl.setLayoutData(hsagd);
hsaCbo = new Combo(topControlComp, SWT.DROP_DOWN | SWT.READ_ONLY);
populateHsa();
hsaCbo.select(0);
hsaCbo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
queryAlertalarmval();
super.widgetSelected(e);
}
});
gd = new GridData(370, SWT.DEFAULT);
Label noteLbl = new Label(topControlComp, SWT.CENTER);
noteLbl.setText("Note: SupVal is ObsValue for forecast diff threats\n"
@ -333,6 +358,28 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements
noteLbl.setLayoutData(gd);
}
/**
* Populate the HsaCbo
*/
private void populateHsa() {
hsaCbo.add("All HSAs");
String hsaSql = "select distinct(hsa) from location order by hsa";
java.util.List<Object[]> rs;
try {
rs = (java.util.List<Object[]>) DirectDbQuery.executeQuery(
hsaSql , HydroConstants.IHFS, QueryLanguage.SQL);
if (rs.size() > 0) {
for (Object[] oa : rs) {
hsaCbo.add((String) oa[0]);
}
}
} catch (VizException e) {
statusHandler.handle(Priority.PROBLEM, e.getMessage(), e);
}
}
/**
* Create the controls for sorting the data.
*/
@ -499,6 +546,11 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements
myQuery.append(DIFF_CHECKSTR);
}
//HSA filter
if (!hsaCbo.getItem(hsaCbo.getSelectionIndex()).equalsIgnoreCase("All HSAs")) {
myQuery.append(" and hsa='"+hsaCbo.getItem(hsaCbo.getSelectionIndex())+"'");
}
// Build 'sort' options based on toggle buttons on the dialog.
if (locationRdo.getSelection()) {

View file

@ -141,6 +141,7 @@ import com.raytheon.viz.hydrocommon.util.DbUtils;
* 29 May 2013 2016 mpduff Fix TS Toggle Traces.
* 05 Sep 2013 #2332 lvenable Fixed memory leaks.
* 24 Jan 2013 15959 lbousaidi Swap the corner points of the bounding box when zooming.
* 22 Oct 2015 13736 xwei Fixed missing data after zoom, edit, & reset problem
* Nov 18 2015 5073 skorolev Fixed drawing PP time series.
*
* @author lvenable
@ -1138,24 +1139,40 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
td = gd.getTraceData(i);
if (td != null && td.isTraceOn()) {
TimeSeriesPoint[] points = null;
TimeSeriesPoint[] pointsZoomed = null;
if (zoomed) {
points = td.getZoomedTsData();
points = td.getTsData();
pointsZoomed = td.getZoomedTsData();
} else {
points = td.getTsData();
}
if ( points != null) {
List<TimeSeriesPoint> pointListZoomed = new ArrayList<TimeSeriesPoint>();
List<TimeSeriesPoint> pointList = new ArrayList<TimeSeriesPoint>();
/* Delete the specified point */
if ((deleteList.size() > 0) && (i == selectedTraceId)) {
for (int j = 0; j < points.length; j++) {
if (!deleteList.contains(j)) {
pointList.add(points[j]);
}
}
td.setTsData(pointList
.toArray(new TimeSeriesPoint[pointList.size()]));
td.setTsData(pointList.toArray(new TimeSeriesPoint[pointList.size()]));
if ( zoomed && pointsZoomed != null ) {
for (int j = 0; j < pointsZoomed.length; j++) {
if (!deleteList.contains(j)) {
pointListZoomed.add(pointsZoomed[j]);
}
}
td.setZoomedTsData(pointListZoomed.toArray(new TimeSeriesPoint[pointListZoomed.size()]));
}
deleteIndex = HydroConstants.MISSING_VALUE;
deleteList.clear();
}
@ -1167,8 +1184,8 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
pointList.add(points[j]);
}
}
td.setTsData(pointList
.toArray(new TimeSeriesPoint[pointList.size()]));
td.setTsData(pointList.toArray(new TimeSeriesPoint[pointList.size()]));
setMissingIndex = HydroConstants.MISSING_VALUE;
setMissingList.clear();
}
@ -1205,8 +1222,14 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
.toArray(new TimeSeriesPoint[pointList.size()]));
insertedPoint = null;
}
if (!zoomed) {
TimeSeriesPoint[] pointArray = td.getTsData();
TimeSeriesPoint[] pointArray = null;
if (zoomed) {
pointArray = td.getZoomedTsData();
}else{
pointArray = td.getTsData();
}
if (pointArray != null) {
for (int j = 0; j < pointArray.length; j++) {
if (pointArray[j] != null) {
@ -1231,7 +1254,7 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
}
} // end for
}
}
}
}
@ -1940,8 +1963,7 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
for (int i = 0; i < ppl.size(); i++) {
if (ppl.get(i).contains(e.x, e.y)) {
deleteIndex = i;
deleteList.add(deleteIndex);
break;
deleteList.add( getZoomOffset(selectedTraceId) + deleteIndex );
}
}
} else {
@ -1949,13 +1971,20 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
for (int i = 0; i < prl.size(); i++) {
if (prl.get(i).contains(e.x, e.y)) {
deleteIndex = i;
deleteList.add(deleteIndex);
deleteList.add( getZoomOffset(selectedTraceId) + deleteIndex );
break;
}
}
}
TraceData td = graphData.getTraceData(selectedTraceId);
TimeSeriesPoint[] points = td.getTsData();
TimeSeriesPoint[] points = null;
if (zoomed) {
points = td.getZoomedTsData();
} else {
points = td.getTsData();
}
for (int j = 0; j < points.length; j++) {
if (j == deleteIndex) {
@ -1972,7 +2001,7 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
for (int i = 0; i < ppl.size(); i++) {
if (ppl.get(i).contains(e.x, e.y)) {
setMissingIndex = i;
setMissingList.add(setMissingIndex);
setMissingList.add(getZoomOffset(selectedTraceId) + setMissingIndex);
break;
}
}
@ -1981,7 +2010,7 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
for (int i = 0; i < prl.size(); i++) {
if (prl.get(i).contains(e.x, e.y)) {
setMissingIndex = i;
setMissingList.add(setMissingIndex);
setMissingList.add(getZoomOffset(selectedTraceId) + setMissingIndex);
break;
}
}
@ -2097,14 +2126,13 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
}
dialog.addDeletePoint(data);
deleteList.add(i);
}
}
deleteRect = null;
} else if (traceSelected && dialog.isSetMissing()
&& (setMissingRect != null)) {
} else if (traceSelected && dialog.isSetMissing() && (setMissingRect != null) ) {
TraceData td = graphData.getTraces().get(selectedTraceId);
TimeSeriesPoint[] pointArray = td.getTsData();
@ -2115,7 +2143,7 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
ForecastData data = createPoint(td, pointArray[i]);
data.setValue(new Double(HydroConstants.MISSING_VALUE));
dialog.addEditPoint(data);
setMissingList.add(i);
setMissingList.add( getZoomOffset(selectedTraceId) + i );
}
}
setMissingRect = null;
@ -2177,8 +2205,12 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
ForecastData data = createPoint(td, tsp);
dialog.addEditPoint(data);
if (zoomed) {
graphData.getTraceData(selectedTraceId).setZoomedTsData(pa);
} else {
graphData.getTraceData(selectedTraceId).setTsData(pa);
}
}
/**
* Make the regions around the lines and points
@ -2819,4 +2851,13 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
this.zoomed = zoomed;
}
private int getZoomOffset(int pSelectedTraceId) {
if (zoomed){
TraceData td = graphData.getTraceData(pSelectedTraceId);
return td.getZoomIndexOffset();
}
return 0;
}
}

View file

@ -80,6 +80,7 @@ import com.raytheon.viz.hydro.timeseries.util.GraphData;
import com.raytheon.viz.hydro.timeseries.util.GroupInfo;
import com.raytheon.viz.hydro.timeseries.util.LIDData;
import com.raytheon.viz.hydro.timeseries.util.PageInfo;
import com.raytheon.viz.hydro.timeseries.util.PreferredOrderManager;
import com.raytheon.viz.hydro.timeseries.util.TimeSeriesUtil;
import com.raytheon.viz.hydro.timeseries.util.TraceData;
import com.raytheon.viz.hydrocommon.HydroConstants;
@ -126,6 +127,8 @@ import com.raytheon.viz.hydrocommon.util.StnClassSyncUtil;
* Jul 21, 2015 4500 rjpeter Use Number in blind cast.
* Oct 13, 2015 4933 rferrel Log error if unable to find group definition file
* Fixed formatter resource leaks.
* 30 Oct, 2015 15102 wkwock Implements preferred order for PE-D-TS-EXT list
*
* </pre>
*
* @author lvenable
@ -1512,9 +1515,13 @@ public class TimeSeriesDlg extends CaveHydroSWTDialog {
ArrayList<Object[]> data = (ArrayList<Object[]>) dataManager
.getSitePEData(selectedLid);
PreferredOrderManager pom = PreferredOrderManager.getInstance();
Map<String, String[]> peMap = pom.getPreferedOrder(selectedLid);
bottomDataList.removeAll();
/* Get the lists of PE data */
LinkedHashMap<String, ArrayList<SiteInfo>> preferredMap = new LinkedHashMap<String, ArrayList<SiteInfo>>();
LinkedHashMap<String, ArrayList<SiteInfo>> hMap = new LinkedHashMap<String, ArrayList<SiteInfo>>();
LinkedHashMap<String, ArrayList<SiteInfo>> qMap = new LinkedHashMap<String, ArrayList<SiteInfo>>();
LinkedHashMap<String, ArrayList<SiteInfo>> pMap = new LinkedHashMap<String, ArrayList<SiteInfo>>();
@ -1533,7 +1540,30 @@ public class TimeSeriesDlg extends CaveHydroSWTDialog {
si.setExt((String) row[3]);
si.setDur(((Number) row[4]).intValue());
if (si.getPe().startsWith("H")) {
boolean preferredLstFlg = false;
if (peMap!=null){
String[] typeSrcLst = peMap.get(si.getPe());
if (typeSrcLst != null) {
for (String typesrc : typeSrcLst) {
if (typesrc.equalsIgnoreCase(si.getTs())) {
preferredLstFlg = true;
break;
}
}
} else if (peMap.containsKey(si.getPe())) {
preferredLstFlg = true;
}
}
if (preferredLstFlg) {
if (!si.getPe().equals(prevPE)) {
preferredMap.put(si.getPe(), new ArrayList<SiteInfo>());
prevPE = si.getPe();
}
preferredMap.get(si.getPe()).add(si);
} else if (si.getPe().startsWith("H")) {
if (!si.getPe().equals(prevPE)) {
hMap.put(si.getPe(), new ArrayList<SiteInfo>());
prevPE = si.getPe();
@ -1591,6 +1621,7 @@ public class TimeSeriesDlg extends CaveHydroSWTDialog {
tsSelected = false;
}
populatePreferredDataInOrder(preferredMap,peMap);
processDataList(hMap, tsSelected);
processDataList(qMap, tsSelected);
processDataList(pMap, tsSelected);
@ -1601,7 +1632,41 @@ public class TimeSeriesDlg extends CaveHydroSWTDialog {
selectedDataLbl.setText(selectedLid);
bottomDataList.setSelection(0);
} catch (VizException e) {
e.printStackTrace();
statusHandler.error("Failed to populate time series list",e);
}
}
/**
* populate data to bottomDataList base on preferred predefined order
* @param preferredMap
* @param peMap
*/
private void populatePreferredDataInOrder (LinkedHashMap<String, ArrayList<SiteInfo>>preferredMap, Map<String, String[]> peMap) {
if (peMap!=null && preferredMap!=null ){
for (String pe:peMap.keySet()){
java.util.List<SiteInfo> siList = preferredMap.get(pe);
if (siList == null) {
continue;
}
String[] tsList = peMap.get(pe);
if (tsList==null) { //There's PE but no TS in preffered_order.txt
for(SiteInfo si : siList) {
bottomDataList.add(formatDataLine(si));
siteInfoList.add(si);
}
} else { //There's both PE and TS in preferred_order.txt
for (String ts: tsList){
for(SiteInfo si : siList) {
if (ts.equalsIgnoreCase(si.getTs())) {
bottomDataList.add(formatDataLine(si));
siteInfoList.add(si);
}
}
}
}
}
}
}

View file

@ -0,0 +1,156 @@
package com.raytheon.viz.hydro.timeseries.util;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedHashMap;
import java.util.Map;
import com.raytheon.uf.common.localization.FileUpdatedMessage;
import com.raytheon.uf.common.localization.ILocalizationFileObserver;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.localization.exception.LocalizationException;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.viz.hydrocommon.HydroConstants;
/**
* This class read the user preferred predefined PE-D-TS-EXT list from file:
* hydro/preferred_order.txt File format: lines start with # is a comment One
* line per LID LID PE1:TS1,TS2 PE2:TS2,TS3 ... Duplicated LID will replaced by
* last one.
*
* @author wkwock
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ---------- ---------- ----------- --------------------------
* 6/22/2015 DCS15102 wkwock Initial creation.
* </pre>
*/
public class PreferredOrderManager implements ILocalizationFileObserver {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(PreferredOrderManager.class);
private static PreferredOrderManager pom = null;
private Map<String, LinkedHashMap<String, String[]>> lidHm = new LinkedHashMap<String, LinkedHashMap<String, String[]>>();
private boolean readFileFlag = true;
private static final String COMMA_REGEX = "\\s*,\\s*";
// For remove space around commas.
private static final String COLON_REGEX = "\\s*:\\s*";
// For remove spaces around colons.
private static final String SPACE_REGEX = "\\s+";
private PreferredOrderManager() {
IPathManager pm = PathManagerFactory.getPathManager();
LocalizationFile file = pm
.getStaticLocalizationFile(HydroConstants.PREFERRED_ORDER);
if (file == null || !file.exists()) {
return;
}
file.addFileUpdatedObserver(this);
}
private void readPreferredOrderFile() {
IPathManager pm = PathManagerFactory.getPathManager();
LocalizationFile file = pm
.getStaticLocalizationFile(HydroConstants.PREFERRED_ORDER);
lidHm.clear();
if (file == null || !file.exists()) {
return;
}
StringBuilder message = new StringBuilder();
BufferedReader in = null;
try {
in = new BufferedReader(new InputStreamReader(
file.openInputStream()));
String line;
inloop: while ((line = in.readLine()) != null) {
String str = line.trim();
if (str.startsWith("#") || str.length() == 0) {
continue;// This is a comment or blank line
}
str = str.replaceAll(COMMA_REGEX, ",").replaceAll(COLON_REGEX,
":");
String[] lineSplit = str.split(SPACE_REGEX);
if (lineSplit.length < 2) {
message.append(line + "\n");
continue;
}
String lid = lineSplit[0].toUpperCase();
LinkedHashMap<String, String[]> peHm = new LinkedHashMap<String, String[]>();
for (int index = 1; index < lineSplit.length; index++) {
String[] peSplit = lineSplit[index].split(":");
if (peSplit.length > 2) {
message.append(line + "\n");
continue inloop;
}
String pe = peSplit[0].toUpperCase();
if (peSplit.length == 2) {
String[] tsSplit = peSplit[1].split(",");
peHm.put(pe, tsSplit);
} else {
peHm.put(pe, null);
}
}
lidHm.put(lid, peHm);
}
if (message.length() > 0) {
message.insert(0,"Invalid line in file "+HydroConstants.PREFERRED_ORDER+":\n");
message.append("Valid example: ACCM2 PP:RZ,RG TA:RZ\n");
}
} catch (IOException | LocalizationException e) {
message.append("Failed to read file "+HydroConstants.PREFERRED_ORDER);
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
message.append("Failed to close file "+HydroConstants.PREFERRED_ORDER);
}
}
}
if (message.length() > 0) {
statusHandler.warn(message.toString());
}
}
public final static synchronized PreferredOrderManager getInstance() {
if (pom == null) {
pom = new PreferredOrderManager();
}
return pom;
}
public Map<String, String[]> getPreferedOrder(String lid) {
if (readFileFlag) {
readPreferredOrderFile();
readFileFlag = false;
}
Map<String, String[]> peMap = lidHm.get(lid);
return peMap;
}
@Override
public void fileUpdated(FileUpdatedMessage message) {
readFileFlag = true;
}
}

View file

@ -38,6 +38,7 @@ import com.raytheon.viz.hydrocommon.HydroConstants;
* pop up menu
* Apr 05, 2011 8732 jpiatt Added product_id.
* June,1, 2011 9499 djingtao change setDur()
* 22 Oct 2015 13736 xwei Added getZoomIndexOffset() method
*
* </pre>
*
@ -606,4 +607,24 @@ public class TraceData implements Serializable {
public void setProductTime(Date productTime) {
this.productTime = productTime;
}
/**
* @return zoom index offset
*/
public int getZoomIndexOffset() {
if (this.zoomedTsData != null && this.zoomedTsData.length > 0 ){
for (int i = 0; i < this.tsData.length; i++) {
if ( tsData[i].getX().equals(zoomedTsData[0].getX()) &&
tsData[i].getY() == zoomedTsData[0].getY()
){
return i;
}
}
}
return 0;
}
}

View file

@ -21,6 +21,7 @@ package com.raytheon.viz.hydrobase;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
@ -39,6 +40,7 @@ import com.raytheon.viz.hydrocommon.datamanager.HydroDataManager;
* ------------ ---------- ----------- --------------------------
* Sep 2, 2009 2259 mpduff Initial creation
* May 14, 2012 14965 wkwock Fix crash in query for data
* Jun 10, 2015 DCS15095 wkwock Added edit/insert flood event feature.
*
* </pre>
*
@ -149,6 +151,28 @@ public class FloodReportDataManager extends HydroDataManager {
return lidList;
}
/**
* Get a list of lids from the riverstat table.
*
* @param where
* The where clause to constrain the query
* @return ArrayList<String> of location ids
*/
public List<String> getLidListFromRiverStat(String where) {
List<String> lidList = new ArrayList<String>();
String query = "select distinct lid from riverstat ";
List<Object[]> rs = runQuery(query + where);
if (rs!=null) {
for (Object[] oa : rs) {
lidList.add((String) oa[0]);
}
}
return lidList;
}
/**
* Get Flood Report data.
*
@ -157,7 +181,8 @@ public class FloodReportDataManager extends HydroDataManager {
* @return FloodReportData object populated with data, null if problem or no
* data
*/
public ArrayList<FloodReportData> getFloodRptData(String lid, String start, String end) {
public ArrayList<FloodReportData> getFloodRptData(String lid, String start,
String end) {
ArrayList<FloodReportData> dataList = new ArrayList<FloodReportData>();
String lname = HydroDataCache.getInstance().getLocationMap().get(lid);
double fs = getFloodStage(lid);
@ -191,13 +216,12 @@ public class FloodReportDataManager extends HydroDataManager {
* Get the flood stage for the site.
*
* @param lid
* The site
* @return The flood stage for the site
*/
public double getFloodStage(String lid) {
double fs = -999;
ArrayList<Object[]> rs = runQuery("select fs from riverstat where lid = '"
List<Object[]> rs = runQuery("select fs from riverstat where lid = '"
+ lid + "'");
if ((rs != null) && (rs.size() > 0) && rs.get(0)[0] != null) {
fs = (Double) rs.get(0)[0];
@ -216,7 +240,7 @@ public class FloodReportDataManager extends HydroDataManager {
public String getRiverBasin(String lid) {
String basin = null;
ArrayList<Object[]> rs = runQuery("select rb from location where lid = '"
List<Object[]> rs = runQuery("select rb from location where lid = '"
+ lid + "'");
if (rs != null) {
basin = (String) rs.get(0)[0];
@ -235,7 +259,7 @@ public class FloodReportDataManager extends HydroDataManager {
public String getState(String lid) {
String state = null;
ArrayList<Object[]> rs = runQuery("select state from location where lid = '"
List<Object[]> rs = runQuery("select state from location where lid = '"
+ lid + "'");
if (rs != null) {
state = (String) rs.get(0)[0];
@ -254,7 +278,7 @@ public class FloodReportDataManager extends HydroDataManager {
public String getRiver(String lid) {
String river = null;
ArrayList<Object[]> rs = runQuery("select stream from riverstat where lid = '"
List<Object[]> rs = runQuery("select stream from riverstat where lid = '"
+ lid + "'");
if (rs != null) {
river = (String) rs.get(0)[0];
@ -273,8 +297,12 @@ public class FloodReportDataManager extends HydroDataManager {
public int[] getFloodEventIds(String lid, String start, String end) {
int[] id = null;
ArrayList<Object[]> rs = runQuery("select distinct flood_event_id from floodts where lid = '"
+ lid + "' and obstime >= '" + start + "' and obstime <= '" + end + "'");
List<Object[]> rs = runQuery("select distinct flood_event_id from floodts where lid = '"
+ lid
+ "' and obstime >= '"
+ start
+ "' and obstime <= '"
+ end + "'");
if ((rs != null) && (rs.size() > 0)) {
id = new int[rs.size()];
@ -301,7 +329,7 @@ public class FloodReportDataManager extends HydroDataManager {
String query = "Select value, obstime from floodts where lid = '" + lid
+ "' and flood_event_id = " + id + " order by obstime";
ArrayList<Object[]> rs = runQuery(query);
List<Object[]> rs = runQuery(query);
lastCrest = new Object[rs.get(0).length];
Object[] retVal = new Object[2];
if ((rs != null) && (rs.size() > 0)) {
@ -343,6 +371,27 @@ public class FloodReportDataManager extends HydroDataManager {
return retVal;
}
/**
* get the max flood_event_id of a lid. Default to 0.
*
* @param lid
* @return
*/
public int getMaxFloodeventID(String lid) {
String query = "Select max(flood_event_id) from floodts where lid = '"
+ lid + "' and flood_event_id > 0";
List<Object[]> rs = runQuery(query);
Integer feID = new Integer(0);
if ((rs != null) && (rs.size() > 0)) {
feID = (Integer) rs.get(0)[0];
if (feID == null) {
return 0;
}
}
return feID.intValue();
}
/**
* Get the value and obstime from the floodts table.
*
@ -429,8 +478,7 @@ public class FloodReportDataManager extends HydroDataManager {
if ((ptsMissing[INDEX_PT_A] == false)
&& (ptsMissing[INDEX_PT_B] == false)) {
anchor1 = FloodReportUtils
.floodreptInterp(ptA, ptB, floodStage);
anchor1 = FloodReportUtils.floodreptInterp(ptA, ptB, floodStage);
ptsMissing[INDEX_ANCHOR1] = false;
} else {
if (ptA.getCrest() == floodStage) {
@ -443,8 +491,7 @@ public class FloodReportDataManager extends HydroDataManager {
}
/*
* get last Anchor point, use index to continue loop where we left
* off
* get last Anchor point, use index to continue loop where we left off
*/
for (int i = index; i < rs.size(); i++) {
if (findLastAnchor == false) {
@ -495,8 +542,7 @@ public class FloodReportDataManager extends HydroDataManager {
/* interpolate to find time of recession below flood stage */
if ((ptsMissing[INDEX_PT_C] == false)
&& (ptsMissing[INDEX_PT_D] == false)) {
anchor2 = FloodReportUtils
.floodreptInterp(ptC, ptD, floodStage);
anchor2 = FloodReportUtils.floodreptInterp(ptC, ptD, floodStage);
ptsMissing[INDEX_ANCHOR2] = false;
} else {
if (ptC.getCrest() == floodStage) {
@ -650,7 +696,8 @@ public class FloodReportDataManager extends HydroDataManager {
}
/**
* @param selectedKey the selectedKey to set
* @param selectedKey
* the selectedKey to set
*/
public void setSelectedKey(String selectedKey) {
this.selectedKey = selectedKey;

View file

@ -68,6 +68,7 @@ import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.requests.ThriftClient;
import com.raytheon.viz.hydrobase.addEditFloodTS.AddEditFloodEventDlg;
import com.raytheon.viz.hydrocommon.HydroConstants;
import com.raytheon.viz.hydrocommon.util.DbUtils;
import com.raytheon.viz.hydrocommon.util.RatingUtils;
@ -88,6 +89,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* May 14, 2012 14965 wkwock fix crash in query for data
* Jun 18, 2012 14377 wkwock Correct insert data into crest table.
* Jun 27, 2013 2088 rferrel Made dialog non-blocking.
* Jun 10, 2015 DCS15095 wkwock Added edit/insert flood event feature.
*
* </pre>
*
@ -140,6 +142,16 @@ public class FloodReportDlg extends CaveSWTDialog {
*/
private Button deleteBtn;
/**
* Edit event button
*/
private Button editEventBtn;
/**
* New event button
*/
private Button newEventBtn;
/**
* Above flood stage text control.
*/
@ -209,6 +221,8 @@ public class FloodReportDlg extends CaveSWTDialog {
private SimpleDateFormat fr = null;
private AddEditFloodEventDlg efeDlg = null;
/**
* Constructor.
*
@ -335,6 +349,7 @@ public class FloodReportDlg extends CaveSWTDialog {
* Create the middle list and canvas controls.
*/
private void createMiddleControls() {
final int BUTTON_WIDTH=165;
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
Composite mainComp = new Composite(shell, SWT.NONE);
mainComp.setLayout(new GridLayout(2, false));
@ -405,7 +420,7 @@ public class FloodReportDlg extends CaveSWTDialog {
buttonComp.setLayoutData(gd);
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
gd.widthHint = 165;
gd.widthHint = BUTTON_WIDTH;
saveEventsBtn = new Button(buttonComp, SWT.PUSH);
saveEventsBtn.setText("Save Events to File...");
saveEventsBtn.setLayoutData(gd);
@ -417,7 +432,7 @@ public class FloodReportDlg extends CaveSWTDialog {
});
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
gd.widthHint = 165;
gd.widthHint = BUTTON_WIDTH;
deleteBtn = new Button(buttonComp, SWT.PUSH);
deleteBtn.setText("Delete Event");
deleteBtn.setLayoutData(gd);
@ -456,6 +471,30 @@ public class FloodReportDlg extends CaveSWTDialog {
}
});
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
gd.widthHint = BUTTON_WIDTH;
editEventBtn = new Button(buttonComp, SWT.PUSH);
editEventBtn.setText("Edit Event");
editEventBtn.setLayoutData(gd);
editEventBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
editEvent(false);
}
});
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
gd.widthHint = BUTTON_WIDTH;
newEventBtn = new Button(buttonComp, SWT.PUSH);
newEventBtn.setText("New Event");
newEventBtn.setLayoutData(gd);
newEventBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
editEvent(true);
}
});
// ----------------------------------------------------
// Create the Stage canvas composite
// ----------------------------------------------------
@ -980,6 +1019,32 @@ public class FloodReportDlg extends CaveSWTDialog {
}
}
/**
* Edit selected event or edit a new event base on @param newEvent.
*
* @param newEvent
*/
private void editEvent(boolean newEventFlg) {
String key = null;
if (!newEventFlg && locationList.getSelectionIndex() < 0) {
MessageBox mb = new MessageBox(shell, SWT.OK);
mb.setText("Make a Selection");
mb.setMessage("You must select a river observation!");
mb.open();
} else {
if (!newEventFlg) {
key=selectedKey;
}
if (efeDlg==null || efeDlg.isDisposed()) {
efeDlg = new AddEditFloodEventDlg(this.getParent(), key, this);
efeDlg.open();
} else {
efeDlg.bringToTop();
}
}
}
/**
* Get the text to output to the file.
*
@ -1265,4 +1330,9 @@ public class FloodReportDlg extends CaveSWTDialog {
}
shell.setCursor(cursor);
}
public void refreshReport() {
clearCanvas();
updateFloodList();
}
}

View file

@ -0,0 +1,450 @@
package com.raytheon.viz.hydrobase.addEditFloodTS;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.LinkedList;
import java.util.ListIterator;
import java.util.Map;
import java.util.TimeZone;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.viz.core.catalog.DirectDbQuery;
import com.raytheon.uf.viz.core.catalog.DirectDbQuery.QueryLanguage;
import com.raytheon.viz.hydrobase.FloodReportData;
import com.raytheon.viz.hydrobase.FloodReportDataManager;
import com.raytheon.viz.hydrobase.FloodReportDlg;
import com.raytheon.viz.hydrocommon.HydroConstants;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
/**
* This class display the Edit Flood Event dialog.
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ---------- ---------- ----------- --------------------------
* 6/10/2015 DCS15095 wkwock Initial creation
*
* </pre>
*
* @author wkwock
* @version 1.0
*/
public class AddEditFloodEventDlg extends CaveSWTDialog implements ITSCompositeAction {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(AddEditFloodEventDlg.class);
/**
* Location list control.
*/
private List lidsLst;
private Label lidLbl;
private Label stageLbl;
private SimpleDateFormat dateFormat = null;
private String lid = null;
private int floodEventID = -1;
private double floodStage = 0;
private String selectedKey;
private Composite obsComp;
private ScrolledComposite obsSComp;
private FloodReportDlg owner;
private LinkedList<TSComposite> tsLinkedList = null;
/**
* Constructor
*
* @param parent
* @param key
* @param owner
*/
public AddEditFloodEventDlg(Shell parent, String key, FloodReportDlg owner) {
super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
this.owner = owner;
this.selectedKey = key;
if (selectedKey == null) {
setText("Adding New Flood Event");
} else {
FloodReportDataManager dman = FloodReportDataManager.getInstance();
lid = dman.getSelectedLid();
floodStage = dman.getFloodStage(lid);
floodEventID = dman.getReportData().get(selectedKey)
.getFloodEventId();
setText("Editing Flood Event for " + lid);
}
dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm");
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
tsLinkedList = new LinkedList<TSComposite>();
};
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
*/
@Override
protected Layout constructShellLayout() {
// Create the main layout for the shell.
GridLayout mainLayout = new GridLayout(1, false);
mainLayout.marginHeight = 2;
mainLayout.marginWidth = 2;
mainLayout.verticalSpacing = 2;
return mainLayout;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
*/
@Override
protected void disposed() {
}
/*
* initialize components
*
* @see
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
* .eclipse.swt.widgets.Shell)
*/
@Override
protected void initializeComponents(Shell shell) {
setReturnValue(false);
// Initialize all of the controls and layouts
initializeComponents();
}
/**
* Initialize the components on the display.
*/
private void initializeComponents() {
createControls();
createBottomButtons();
populateLIDLst();
populateObsComp();
}
/**
* Create the middle list and canvas controls.
*/
private void createControls() {
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
Composite mainComp = new Composite(shell, SWT.NONE);
mainComp.setLayout(new GridLayout(2, false));
mainComp.setLayoutData(gd);
gd = new GridData(SWT.DEFAULT, SWT.TOP, false, true);
Composite leftComp = new Composite(mainComp, SWT.NONE);
leftComp.setLayout(new GridLayout(1, false));
leftComp.setLayoutData(gd);
Label listLbl = new Label(leftComp, SWT.NONE);
listLbl.setText("Select a LID");
if (selectedKey == null) {
gd = new GridData(50, 400);
gd.horizontalSpan = 2;
lidsLst = new List(leftComp, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL);
lidsLst.setLayoutData(gd);
} else {
listLbl.setText("");// not use it
lidLbl = new Label(leftComp, SWT.None);
lidLbl.setText("LID: " + selectedKey);
stageLbl = new Label(leftComp, SWT.None);
stageLbl.setText("flood stage: " + floodStage);
}
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
Composite rightComp = new Composite(mainComp, SWT.NONE);
rightComp.setLayout(new GridLayout(1, false));
rightComp.setLayoutData(gd);
gd = new GridData();
gd.horizontalIndent = 4;
gd.horizontalSpan = 2;
Label obsListLbl = new Label(rightComp, SWT.NONE);
obsListLbl.setText("Observation");
obsListLbl.setLayoutData(gd);
obsSComp = new ScrolledComposite(rightComp, SWT.BORDER | SWT.V_SCROLL);
obsSComp.setLayoutData(new GridData(350, 400));
obsComp = new Composite(obsSComp, SWT.NONE);
obsComp.setLayout(new FormLayout());
obsSComp.setAlwaysShowScrollBars(true);
obsSComp.setContent(obsComp);
obsSComp.setExpandHorizontal(true);
obsSComp.setExpandVertical(true);
obsSComp.setMinSize(obsComp.computeSize(SWT.DEFAULT, SWT.DEFAULT));
Label topInsertLbl = new Label(obsComp, SWT.NONE);
topInsertLbl.setForeground(obsSComp.getDisplay().getSystemColor(
SWT.COLOR_GREEN));
topInsertLbl.setText("-->");
Cursor handCursor = this.getDisplay().getSystemCursor(SWT.CURSOR_HAND);
topInsertLbl.setCursor(handCursor);
FormData insertFd = new FormData();
insertFd.top = new FormAttachment(0, 4);
insertFd.left = new FormAttachment(0, 4);
topInsertLbl.setLayoutData(insertFd);
final AddEditFloodEventDlg floodEventDlg = this;
topInsertLbl.addMouseListener(new MouseAdapter() {
@Override
public void mouseUp(MouseEvent event) {
TSComposite tsComp= new TSComposite(obsComp, 0.0,TimeUtil.newGmtCalendar(),floodEventDlg );
tsLinkedList.add(0,tsComp);
reorganizeGui();
}
});
}
/**
* Create the buttons at the bottom of the dialog.
*/
private void createBottomButtons() {
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
Composite buttonComp = new Composite(shell, SWT.NONE);
buttonComp.setLayout(new GridLayout(2, true));
buttonComp.setLayoutData(gd);
int buttonWidth = 120;
gd = new GridData(SWT.LEFT, SWT.DEFAULT, true, false);
gd.widthHint = buttonWidth;
Button saveBtn = new Button(buttonComp, SWT.PUSH|SWT.LEFT);
saveBtn.setText("Save Event");
saveBtn.setLayoutData(gd);
saveBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
int status = saveNewEditTS();
if (status >= 0) {
close();
owner.refreshReport();
}
}
});
gd = new GridData(SWT.RIGHT, SWT.DEFAULT, true, false);
gd.widthHint = buttonWidth;
Button cancelBtn = new Button(buttonComp, SWT.PUSH|SWT.RIGHT);
cancelBtn.setText("Cancel");
cancelBtn.setLayoutData(gd);
cancelBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
close();
}
});
}
/**
* populate LIDLst. LIDs are from riverstat table
*/
private void populateLIDLst() {
FloodReportDataManager dman = FloodReportDataManager.getInstance();
if (selectedKey == null) {
java.util.List<String> lidList = dman.getLidListFromRiverStat("");
Collections.sort(lidList);
lidsLst.removeAll();
for (String lid : lidList) {
lidsLst.add(lid);
}
} else {
dman.setSelectedKey(selectedKey);
lidLbl.setText("LID: " + lid);
}
}
/**
* Populate the observation composite
*/
private void populateObsComp() {
if (selectedKey == null) {
TSComposite tsComp= new TSComposite(obsComp, 0.0,TimeUtil.newGmtCalendar(), this);
tsLinkedList.add(0,tsComp);
reorganizeGui();
} else {
FloodReportDataManager dataManager = FloodReportDataManager
.getInstance();
Map<String, FloodReportData> dataMap = dataManager.getReportData();
dataManager.setSelectedKey(selectedKey);
FloodReportData floodData = dataMap.get(selectedKey);
java.util.List<Object[]> eventData = dataManager.getFloodEventData(
floodData.getLid(), floodData.getFloodEventId());
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm");
try {
for (Object[] oa : eventData) {
double val = (Double) oa[0];
String date = dateFormat.format((Date) oa[1]);
Calendar cal = Calendar.getInstance();
cal.setTime(sdf.parse(date));
TSComposite tsComp= new TSComposite(obsComp, val,cal,this);
tsLinkedList.add(tsComp);
reorganizeGui();
}
} catch (ParseException e) {
statusHandler.error("Failed to parse time", e);
}
}
}
/**
* Save this new time series to table floodts
*
* @return status:0 succeed to save data, -1 failed to save data.
*/
private int saveNewEditTS() {
FloodReportDataManager dman = FloodReportDataManager.getInstance();
String tsLID = this.lid;
int eventID = this.floodEventID;
if (selectedKey == null) {
tsLID = lidsLst.getSelection()[0];
eventID = dman.getMaxFloodeventID(tsLID) + 1;
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:00");
StringBuilder sqlStr = new StringBuilder(
"insert into floodts (lid,obstime,flood_event_id,value) ");
boolean firstOneFlg = true;
try {
ListIterator<TSComposite> listIterator = tsLinkedList.listIterator();
while (listIterator.hasNext()) {
if (firstOneFlg) {
sqlStr.append("values ");
} else {
sqlStr.append(",");
}
TSComposite tsComp = listIterator.next();
sqlStr.append("('").append(tsLID).append("','")
.append(sdf.format(tsComp.getDateTime().getTime()))
.append("',").append(eventID).append(",")
.append(tsComp.getValue()).append(")");
firstOneFlg = false;
}
} catch (NumberFormatException nfe) {
MessageBox mbe = new MessageBox(shell, SWT.OK | SWT.ERROR);
mbe.setMessage("Error: an observe value is invalid. Please fix and try again.");
mbe.open();
return -1;
}
int status = 0;
try {
if (selectedKey != null) {
StringBuilder deleteSql = new StringBuilder();
deleteSql.append("delete from floodts where lid='")
.append(tsLID).append("' and flood_event_id=")
.append(eventID);
status = DirectDbQuery.executeStatement(deleteSql.toString(),
HydroConstants.IHFS, QueryLanguage.SQL);
}
status = DirectDbQuery.executeStatement(sqlStr.toString(),
HydroConstants.IHFS, QueryLanguage.SQL);
} catch (Exception e) {
MessageBox mbe = new MessageBox(shell, SWT.OK | SWT.ERROR);
mbe.setMessage("Failed to save data. Please check for observe time confliction.");
mbe.open();
return -1;
}
return status;
}
/**
* add a new TS composite to the linked list and the GUI
*/
@Override
public void addTSComp (TSComposite tsComp) {
int index = tsLinkedList.indexOf(tsComp);
TSComposite newTSComp= new TSComposite(obsComp, 0.0,TimeUtil.newGmtCalendar(),this);
tsLinkedList.add(index+1, newTSComp);
reorganizeGui();
}
/**
* Remove a TS composite from the linked list and the GUI
*/
@Override
public void removeTSComp (TSComposite tsComp) {
if (tsLinkedList.size()>1){
tsLinkedList.remove(tsComp);
tsComp.dispose();
reorganizeGui();
} else {
tsComp.setValue(0.0);
}
}
/**
* Reflect the tsLinkedList on the AddEditFloodEvent GUI
*/
private void reorganizeGui () {
ListIterator<TSComposite> listIterator = tsLinkedList.listIterator();
TSComposite lastTSComp = null;
TSComposite tsComp= null;
while (listIterator.hasNext()) {
tsComp=listIterator.next();
FormData tfd = new FormData();
if (lastTSComp==null) {
tfd.top = new FormAttachment(0, 20);
} else {
tfd.top = new FormAttachment(lastTSComp, 1);
}
tsComp.setLayoutData(tfd);
lastTSComp = tsComp;
}
obsComp.setSize(obsComp.computeSize(SWT.DEFAULT, SWT.DEFAULT));
obsSComp.setMinSize(obsComp.computeSize(SWT.DEFAULT, SWT.DEFAULT));
}
}

View file

@ -0,0 +1,22 @@
package com.raytheon.viz.hydrobase.addEditFloodTS;
/**
* Action interface in AddEditFloodEventDlg
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ---------- ---------- ----------- --------------------------
* 11/09/2015 DCS15095 wkwock Initial creation
*
* </pre>
*
* @author wkwock
* @version 1.0
*/
public interface ITSCompositeAction {
public void removeTSComp (TSComposite tsComp);
public void addTSComp(TSComposite tsComp);
}

View file

@ -0,0 +1,172 @@
package com.raytheon.viz.hydrobase.addEditFloodTS;
import java.util.Calendar;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.DateTime;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
/**
* This composite customized with a insert label, an observation(a value text, 2
* time widgets), and a delete label.
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ---------- ---------- ----------- --------------------------
* 11/05/2015 DCS15095 wkwock Initial creation
*
* </pre>
*
* @author wkwock
* @version 1.0
*/
public class TSComposite extends Composite {
private Text valueTxt;
private DateTime date;
private DateTime time;
private Label deleteLbl;
private Label insertLbl;
private ITSCompositeAction actionCallback = null;
/**
* Constructor for composite with observe value and time
*
* @param parent
* @param obsValue
* @param cal
* @param owner
*/
public TSComposite(Composite parent, double obsValue, Calendar cal, ITSCompositeAction owner) {
super(parent, SWT.NONE);
this.actionCallback = owner;
createAnObsComp();
setValue(obsValue);
setDateTime(cal);
}
/**
* set the value to the value text box
*
* @param obsValue
*/
public void setValue(double obsValue) {
valueTxt.setText(Double.toString(obsValue));
}
/**
* Get the value from the value text box
*
* @return double value
* @throws NumberFormatException
*/
public double getValue() throws NumberFormatException {
return Double.parseDouble(valueTxt.getText());
}
/**
* set date time to both date time box
*
* @param cal
*/
public void setDateTime(Calendar cal) {
date.setDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH),
cal.get(Calendar.DATE));
date.setTime(cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), 0);
time.setDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH),
cal.get(Calendar.DATE));
time.setTime(cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), 0);
}
/**
* Get date time
* @return date time
*/
public Calendar getDateTime() {
Calendar cal = Calendar.getInstance();
cal.set(date.getYear(), date.getMonth(), date.getDay(),
time.getHours(), time.getMinutes(), 0);
return cal;
}
/**
* create an observe composite
*/
private void createAnObsComp() {
FormLayout cfl = new FormLayout();
cfl.marginWidth = 5;
cfl.marginHeight = 2;
this.setLayout(cfl);
valueTxt = new Text(this, SWT.BORDER);
FormData vfd = new FormData();
vfd.width = 50;
vfd.height = 18;
valueTxt.setLayoutData(vfd);
valueTxt.setText("0.0");
date = new DateTime(this, SWT.DATE | SWT.BORDER);
FormData fd = new FormData();
fd.left = new FormAttachment(valueTxt, 10);
fd.width = 100;
date.setLayoutData(fd);
time = new DateTime(this, SWT.TIME | SWT.BORDER | SWT.SHORT);
FormData timeFd = new FormData();
timeFd.left = new FormAttachment(date, 10);
timeFd.width = 100;
time.setLayoutData(timeFd);
Cursor handCursor = this.getDisplay().getSystemCursor(SWT.CURSOR_HAND);
deleteLbl = new Label(this, SWT.NONE);
deleteLbl
.setForeground(this.getDisplay().getSystemColor(SWT.COLOR_RED));
deleteLbl.setText("x");
deleteLbl.setCursor(handCursor);
FormData dfd = new FormData();
dfd.left = new FormAttachment(time, 10);
dfd.top = new FormAttachment(this, 5);
deleteLbl.setLayoutData(dfd);
insertLbl = new Label(this, SWT.NONE);
insertLbl.setForeground(this.getDisplay().getSystemColor(
SWT.COLOR_GREEN));
insertLbl.setText("-->");
insertLbl.setCursor(handCursor);
FormData insertFd = new FormData();
insertFd.top = new FormAttachment(valueTxt, 4);
insertLbl.setLayoutData(insertFd);
final TSComposite tsComp=this;
deleteLbl.addMouseListener(new MouseAdapter() {
@Override
public void mouseUp(MouseEvent event) {
actionCallback.removeTSComp(tsComp);
}
});
insertLbl.addMouseListener(new MouseAdapter() {
@Override
public void mouseUp(MouseEvent event) {
actionCallback.addTSComp(tsComp);
}
});
}
}

View file

@ -33,6 +33,7 @@ import org.eclipse.swt.graphics.RGB;
* ------------ ---------- ----------- --------------------------
* Jun 17, 2008 1194 M. Duff Initial creation.
* 11/18/2008 1662 grichard Added physical element enum type.
* 14 Sep, 2015 15102 wkwock Implements preferred order for PE-D-TS-EXT list
*
* </pre>
*
@ -262,6 +263,8 @@ public class HydroConstants {
public static final String RFCMOSAIC_DIR_TOKEN = "gaq_xmrg_1hr_dir";
public static final String PREFERRED_ORDER = "/hydro/preferred_order.txt";
/**
* Enumeration used for selection of physical element.
*/

View file

@ -43,6 +43,7 @@ import com.raytheon.viz.hydrocommon.datamanager.HydroDataManager;
* 15 Dec 2009 2422 mpduff Added query for rating date and
* USGS rating number.
* Jul 21, 2015 4500 rjpeter Use Number in blind cast.
* 23 Oct 2015 14375 xwei Fixed rating curve saving error. Fixed import rating curve format error.
* </pre>
*
* @version 1.0
@ -334,4 +335,23 @@ public class RatingCurveDataManager extends HydroDataManager {
return label;
}
/**
* delete All Rating Curves for a lid
*
* @param lid
*/
public void clearAllRatingCurveData(RatingCurveData rcd, String lid) {
if (lid != null) {
String query = "DELETE from rating WHERE lid='" + lid + "' ;" ;
try {
DirectDbQuery.executeStatement(query, HydroConstants.IHFS,
QueryLanguage.SQL);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}

View file

@ -77,6 +77,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* 22 Jan 2013 15682 lbousaidi fix openfile problem and changed the path to
* whfs_import_dir for "Import Curve" button.
* 15 Jul 2013 2088 rferrel Make dialog non-blocking.
* 23 Oct 2015 14375 xwei Fixed rating curve saving error. Fixed import rating curve format error.
* </pre>
*
* @author lvenable
@ -291,6 +292,8 @@ public class RatingCurveDlg extends CaveSWTDialog {
*/
private double shiftAmount = 0;
private boolean deleteAllRatingCurve = false;
/**
* Constructor.
*
@ -366,6 +369,7 @@ public class RatingCurveDlg extends CaveSWTDialog {
addSeparator();
createBottomButtons();
populateControls();
curveImportBtnSetEnabled();
}
/**
@ -426,6 +430,23 @@ public class RatingCurveDlg extends CaveSWTDialog {
recordDataLbl.setLayoutData(gd);
}
/**
* Create the rating curve canvas.
*
*/
private void curveImportBtnSetEnabled() {
if ( noShiftCurveDataList.getItemCount() == 0 && shiftCurveDataList.getItemCount() == 0 ) {
curveImportBtn.setEnabled(true);
} else {
curveImportBtn.setEnabled(false);
}
}
/**
* Create the rating curve canvas.
*
@ -577,8 +598,14 @@ public class RatingCurveDlg extends CaveSWTDialog {
int response = messageDialog.open();
if (response == SWT.OK) {
// get rid of every point
removedPoints = noShiftCurveArray;
deleteAllRatingCurve = true;
// Add all rating curve points to the array.
for (RatingCurveData d : noShiftCurveArray) {
removedPoints.add(d);
}
noShiftCurveArray.clear();
noShiftCurveDataList.removeAll();
noShiftCurveDataList.redraw();
@ -1093,7 +1120,7 @@ public class RatingCurveDlg extends CaveSWTDialog {
// Read File Line By Line
while ((strLine = br.readLine()) != null) {
String[] line = strLine.split(" ");
String[] line = strLine.trim().split(" ");
// should be ordered stage, flow separated by a space
if (line.length == 2) {
rci.add(new Double(line[0]), new Double(line[1]));
@ -1121,6 +1148,15 @@ public class RatingCurveDlg extends CaveSWTDialog {
newRatingCurve = false;
}
if (removedPoints.size() != 0 && deleteAllRatingCurve) {
for (RatingCurveData rcd : removedPoints) {
rcdm.clearAllRatingCurveData(rcd,lid);
}
deleteAllRatingCurve=false;
removedPoints = new ArrayList<RatingCurveData>();
}
if (removedPoints.size() != 0) {
for (RatingCurveData rcd : removedPoints) {
rcdm.deleteRatingCurveData(rcd, lid);
@ -1145,6 +1181,8 @@ public class RatingCurveDlg extends CaveSWTDialog {
}
addedCurveShifts = new ArrayList<RatingCurveShiftData>();
}
curveImportBtnSetEnabled();
}
/**

View file

@ -9,6 +9,7 @@
47.5281 -97.3250 2219.321 KMVX
64.5114 -165.2950 1806.983 PAEC
18.1157 -66.0782 1769.318 TJUA
35.3930 -97.6280 1769.318 TPSF
27.7839 -97.5108 1615.021 KCRP
45.7150 -122.9650 1510.339 KRTX
37.5908 -83.3131 1452.663 KJKL

View file

@ -56,6 +56,32 @@ class AirepPlotDelegate(PlotDelegate):
sampleString += turbType
return sampleString
def isValid(self, rec):
# DCS10257
# need icing or hazard
# only show non-severe / no severity
if rec.isValidParameter("iceInten"):
iceInten = rec.getString("iceInten")
else:
iceInten = ""
if rec.isValidParameter("iceType"):
iceType = rec.getString("iceType")
else:
iceType = ""
if rec.isValidParameter("flightHazard"):
flightHazard = rec.getInt("flightHazard")
else:
flightHazard = -1
if (iceInten == "") and (iceType == "") and (flightHazard == -1):
# no icing or hazard data
return False
elif (iceInten == "SEV") or (iceInten == "EXTRM") or (flightHazard == 8) or (flightHazard == 9):
# incorrect severity/hazard level (from AIREPWeather)
return False
else:
# low or no severity, and has some icing data
return True
plotDelegate = AirepPlotDelegate()
</script>
@ -83,6 +109,7 @@ plotDelegate = AirepPlotDelegate()
<symbol overflow="visible" id="plotData" class="info">
<text id="sampleParams1" plotMode="sample" plotParam="stationId,longitude,latitude,timeObs,flightLevel"> </text>
<text id="sampleParams2" plotMode="sample" plotParam="temperature,windDir,windSpeed,turbInten,turbFreq,turbType"> </text>
<text id="validityParams" plotMode="null" class="text" plotParam="iceType,iceInten" x="0" y="0" visibility="hidden">0</text>
<text id="iceInensity" plotMode="table" class="weather" plotLookupTable="airep_icing_intens_trans.txt" plotParam="flightHazard" x="0" y="0">0</text>
<text id="fltLvlText" plotMode="text" plotParam="flightLevel" plotFormat="%3.0f" plotUnit="hft" style="text-anchor: end;" x="-15px" y="0px">75</text>
</symbol>

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View file

@ -0,0 +1,112 @@
<?xml version="1.0"?>
<svg width="80" height="80"
viewBox="0 0 80 80"
overflow="visible"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" style="stroke: rgb(255,255,255);">
<defs>
<script type="text/python" plotDelegate="plotDelegate">
import time
class AirepPlotDelegate(PlotDelegate):
def __init__(self):
PlotDelegate.__init__(self)
def getSampleText(self, rec):
sampleString = "ARP "
sampleString += rec.getString("stationId")
sampleString += " "
lat = rec.getFloat("latitude")
if(lat &lt; 0):
sampleString += "%.3fS " % (-1*lat)
else:
sampleString += "%.3fN " % (lat)
lon = rec.getFloat("longitude")
if(lon &lt; 0):
sampleString += "%.3fW " % (-1*lon)
else:
sampleString += "%.3fE " % (lon)
timeObs = rec.getLong("timeObs")
sampleString += time.strftime("%H%M",time.localtime(timeObs/1000))
sampleString += " F%d" % (rec.getInt("flightLevel")/100)
temp = rec.getFloat("temperature")
if temp &lt; -273.15:
pass
elif temp &lt; 0:
sampleString += " M%d" % (int(-1*temp))
else:
sampleString += " P%d" % (int(temp))
windDir = int(rec.getFloat("windDir"))
windSpeed = int(rec.getFloat("windSpeed"))
if windDir > -1080 or windSpeed > 0:
sampleString += " %d/%dKT" % (windDir, windSpeed)
turbFreq = rec.getString("turbFreq")
turbInten = rec.getString("turbInten")
turbType = rec.getString("turbType")
if turbFreq != "" or turbInten != "" or turbType != "":
sampleString += " TB"
if turbFreq != "":
sampleString += " "
sampleString += turbFreq
if turbInten != "":
sampleString += " "
sampleString += turbInten
if turbType != "":
sampleString += " "
sampleString += turbType
return sampleString
def isValid(self, rec):
# DCS10257
# need icing severity or ice hazard
# only show severe
if rec.isValidParameter("iceInten"):
iceInten = rec.getString("iceInten")
else:
iceInten = ""
if rec.isValidParameter("flightHazard"):
flightHazard = rec.getInt("flightHazard")
else:
flightHazard = -1
if (iceInten == "SEV") or (iceInten == "EXTRM") or (flightHazard == 8) or (flightHazard == 9):
# high severity/hazard level (from AIREPWeather)
return True
else:
# low or no severity, and has some icing data
return False
plotDelegate = AirepPlotDelegate()
</script>
<style type="text/css">
<![CDATA[
@font-face { font-family: "WindSymbolFont";
src: url(WindSymbols.svg#WindSymbols); }
@font-face { font-family: "StandardFont";
src: url(Standard.svg#Standard); }
@font-face { font-family: "WxSymbolFont";
src: url(WxSymbols.svg#WxSymbols); }
@font-face { font-family: "SpecialSymbolFont";
src: url(SpecialSymbols.svg#SpecialSymbols); }
text.text
{
fill: none;
font-size: 1em;
stroke-width: 1px;
font-family: StandardFont;
font-size: 1em;
}
]]>
</style>
<symbol overflow="visible" id="plotData" class="info">
<text id="sampleParams1" plotMode="sample" plotParam="stationId,longitude,latitude,timeObs,flightLevel"> </text>
<text id="sampleParams2" plotMode="sample" plotParam="temperature,windDir,windSpeed,turbInten,turbFreq,turbType"> </text>
<text id="validityParams" plotMode="null" class="text" plotParam="iceType,iceInten" x="0" y="0" visibility="hidden">0</text>
<text id="iceInensity" plotMode="table" class="weather" plotLookupTable="airep_icing_intens_trans.txt" plotParam="flightHazard" x="0" y="0">0</text>
<text id="fltLvlText" plotMode="text" plotParam="flightLevel" plotFormat="%3.0f" plotUnit="hft" style="text-anchor: end;" x="-15px" y="0px">75</text>
</symbol>
</defs>
<use id="wind" x="40" y="40" width="80" height="80" visibility="visible" xlink:href="#plotData"/>
</svg>

After

Width:  |  Height:  |  Size: 4.2 KiB

View file

@ -56,6 +56,32 @@ class AirepPlotDelegate(PlotDelegate):
sampleString += turbType
return sampleString
def isValid(self, rec):
# DCS10257
# need some turbulence data
# only show non-severe / no severity
if rec.isValidParameter("turbInten"):
turbInten = rec.getString("turbInten")
else:
turbInten = ""
if rec.isValidParameter("turbFreq"):
turbFreq = rec.getString("turbFreq")
else:
turbFreq = ""
if rec.isValidParameter("turbType"):
turbType = rec.getString("turbType")
else:
turbType = ""
if (turbInten == "") and (turbFreq == "") and (turbType == ""):
# no turbulence data present
return False
elif (turbInten == "SEV") or (turbInten == "EXTRM"):
# turbulence data present, but not correct severity
return False
else:
# turbulence data present, and if severity is present it is not high
return True
plotDelegate = AirepPlotDelegate()
</script>
@ -91,6 +117,7 @@ plotDelegate = AirepPlotDelegate()
<symbol overflow="visible" id="plotData" class="info">
<text id="sampleParams1" plotMode="sample" plotParam="stationId,longitude,latitude,timeObs,flightLevel"> </text>
<text id="sampleParams2" plotMode="sample" plotParam="temperature,windDir,windSpeed,turbInten,turbFreq,turbType"> </text>
<text id="validityParams" plotMode="null" class="text" plotParam="turbType" x="0" y="0" visibility="hidden">0</text>
<text id="airepturbIntensity" plotMode="table" class="weather" plotLookupTable="turb_intens_trans.txt" plotParam="turbInten" x="0" y="0">0</text>
<text id="airepturbFreq" plotMode="table" class="weather" plotLookupTable="turb_freq_trans.txt" plotParam="turbFreq" style="text-anchor: end" x="0" y="-10">0</text>
<text id="airepfltLvlText" plotMode="text" plotParam="flightLevel" plotFormat="%3.0f" plotUnit="hft" style="text-anchor: end;" x="-15px" y="0px">75</text>

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View file

@ -0,0 +1,116 @@
<?xml version="1.0"?>
<svg width="80" height="80"
viewBox="0 0 80 80"
overflow="visible"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" style="stroke: rgb(255,255,255);">
<defs>
<script type="text/python" plotDelegate="plotDelegate">
import time
class AirepPlotDelegate(PlotDelegate):
def __init__(self):
PlotDelegate.__init__(self)
def getSampleText(self, rec):
sampleString = "ARP "
sampleString += rec.getString("stationId")
sampleString += " "
lat = rec.getFloat("latitude")
if(lat &lt; 0):
sampleString += "%.3fS " % (-1*lat)
else:
sampleString += "%.3fN " % (lat)
lon = rec.getFloat("longitude")
if(lon &lt; 0):
sampleString += "%.3fW " % (-1*lon)
else:
sampleString += "%.3fE " % (lon)
timeObs = rec.getLong("timeObs")
sampleString += time.strftime("%H%M",time.localtime(timeObs/1000))
sampleString += " F%d" % (rec.getInt("flightLevel")/100)
temp = rec.getFloat("temperature")
if temp &lt; -273.15:
pass
elif temp &lt; 0:
sampleString += " M%d" % (int(-1*temp))
else:
sampleString += " P%d" % (int(temp))
windDir = int(rec.getFloat("windDir"))
windSpeed = int(rec.getFloat("windSpeed"))
if windDir > -1080 or windSpeed > 0:
sampleString += " %d/%dKT" % (windDir, windSpeed)
turbFreq = rec.getString("turbFreq")
turbInten = rec.getString("turbInten")
turbType = rec.getString("turbType")
if turbFreq != "" or turbInten != "" or turbType != "":
sampleString += " TB"
if turbFreq != "":
sampleString += " "
sampleString += turbFreq
if turbInten != "":
sampleString += " "
sampleString += turbInten
if turbType != "":
sampleString += " "
sampleString += turbType
return sampleString
def isValid(self, rec):
# DCS10257
# need some turbulence severity data
# only show non-severe / no severity
if rec.isValidParameter("turbInten"):
turbInten = rec.getString("turbInten")
else:
turbInten = ""
if (turbInten == "SEV") or (turbInten == "EXTRM"):
# turbulence data present, high severity
return True
else:
# turbulence data present, low severity
return False
plotDelegate = AirepPlotDelegate()
</script>
<style type="text/css">
<![CDATA[
@font-face { font-family: "WindSymbolFont";
src: url(WindSymbols.svg#WindSymbols); }
@font-face { font-family: "StandardFont";
src: url(Standard.svg#Standard); }
@font-face { font-family: "WxSymbolFont";
src: url(WxSymbols.svg#WxSymbols); }
@font-face { font-family: "SpecialSymbolFont";
src: url(SpecialSymbols.svg#SpecialSymbols); }
text.text
{
fill: none;
font-size: 1em;
stroke-width: 1px;
font-family: StandardFont;
font-size: 1em;
}
text.weather
{
fill: none;
font-size: 1em;
stroke-width: 1px;
font-family: WxSymbolFont;
}
]]>
</style>
<symbol overflow="visible" id="plotData" class="info">
<text id="sampleParams1" plotMode="sample" plotParam="stationId,longitude,latitude,timeObs,flightLevel"> </text>
<text id="sampleParams2" plotMode="sample" plotParam="temperature,windDir,windSpeed,turbInten,turbFreq,turbType"> </text>
<text id="airepturbIntensity" plotMode="table" class="weather" plotLookupTable="turb_intens_trans.txt" plotParam="turbInten" x="0" y="0">0</text>
<text id="airepturbFreq" plotMode="table" class="weather" plotLookupTable="turb_freq_trans.txt" plotParam="turbFreq" style="text-anchor: end" x="0" y="-10">0</text>
<text id="airepfltLvlText" plotMode="text" plotParam="flightLevel" plotFormat="%3.0f" plotUnit="hft" style="text-anchor: end;" x="-15px" y="0px">75</text>
</symbol>
</defs>
<use id="wind" x="40" y="40" width="80" height="80" visibility="visible" xlink:href="#plotData"/>
</svg>

After

Width:  |  Height:  |  Size: 4.3 KiB

View file

@ -7,3 +7,4 @@ LGTMOD : 194
MOD : 126
MODSEV : 195
SEV : 127
EXTRM : 127

View file

@ -5,6 +5,65 @@ overflow="visible"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" style="stroke: rgb(255,255,255);">
<defs>
<script type="text/python" plotDelegate="plotDelegate">
import time
class PirepIcingDelegate(PlotDelegate):
def __init__(self):
PlotDelegate.__init__(self)
def getSampleText(self, rec):
# use obsText for pirep
if rec.isValidParameter("obsText"):
return rec.getString("obsText")
# rebuild text for airep
sampleString = "ARP "
sampleString += " "
sampleString += " F%d" % (rec.getInt("flightLevel")/100)
try:
iceInten = rec.getString("iceInten")
except ValueError:
iceInten = ""
try:
iceType = rec.getString("iceType")
except ValueError:
icetype = ""
if iceInten != "" or iceType != "":
sampleString += " IC"
if iceInten != "":
sampleString += " "
sampleString += iceInten
if iceType != "":
sampleString += " "
sampleString += iceType
return sampleString
def isValid(self, rec):
# DCS10257
# need icing data
# only show non-severe / no severity
if rec.isValidParameter("iceInten"):
iceInten = rec.getString("iceInten")
else:
iceInten = ""
if rec.isValidParameter("iceType"):
iceType = rec.getString("iceType")
else:
iceType = ""
if (iceInten == "") and (iceType == ""):
# no icing data
return False
elif (iceInten == "SEV") or (iceInten == "EXTRM"):
# incorrect severity
return False
else:
# low or no severity, and has some icing data
return True
plotDelegate = PirepIcingDelegate()
</script>
<style type="text/css">
<![CDATA[
@font-face { font-family: "WindSymbolFont";
@ -36,6 +95,7 @@ xmlns:xlink="http://www.w3.org/1999/xlink" style="stroke: rgb(255,255,255);">
</style>
<symbol overflow="visible" id="plotData" class="info">
<text id="sampleText" plotMode="sample" plotParam="obsText"> </text>
<text id="validityParams" plotMode="null" class="text" plotParam="iceType" x="0" y="0" visibility="hidden">0</text>
<text id="iceInensity" plotMode="table" class="weather" plotLookupTable="icing_intens_trans.txt" plotParam="iceInten" x="0" y="0">0</text>
<text id="fltLvlText" plotMode="text" plotParam="flightLevel" plotFormat="%3.0f" plotUnit="hft" style="text-anchor: end;" x="-15px" y="0px">75</text>
<text id="iceType" plotMode="table" class="weather" plotLookupTable="icing_type_trans.txt" plotParam="iceType" style="text-anchor: end" x="0" y="-10">0</text>

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View file

@ -0,0 +1,99 @@
<?xml version="1.0"?>
<svg width="80" height="80"
viewBox="0 0 80 80"
overflow="visible"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" style="stroke: rgb(255,255,255);">
<defs>
<script type="text/python" plotDelegate="plotDelegate">
import time
class PirepIcingDelegate(PlotDelegate):
def __init__(self):
PlotDelegate.__init__(self)
def getSampleText(self, rec):
# use obsText for pirep
if rec.isValidParameter("obsText"):
return rec.getString("obsText")
# rebuild text for airep
sampleString = "ARP "
sampleString += " "
sampleString += " F%d" % (rec.getInt("flightLevel")/100)
try:
iceInten = rec.getString("iceInten")
except ValueError:
iceInten = ""
try:
iceType = rec.getString("iceType")
except ValueError:
icetype = ""
if iceInten != "" or iceType != "":
sampleString += " IC"
if iceInten != "":
sampleString += " "
sampleString += iceInten
if iceType != "":
sampleString += " "
sampleString += iceType
return sampleString
def isValid(self, rec):
# DCS10257
# need icing severity data
# only show severe
if rec.isValidParameter("iceInten"):
iceInten = rec.getString("iceInten")
if (iceInten == "SEV") or (iceInten == "EXTRM"):
# high severity
return True
else:
# low or empty severity
return False
else:
# no severity data
return False
plotDelegate = PirepIcingDelegate()
</script>
<style type="text/css">
<![CDATA[
@font-face { font-family: "WindSymbolFont";
src: url(WindSymbols.svg#WindSymbols); }
@font-face { font-family: "StandardFont";
src: url(Standard.svg#Standard); }
@font-face { font-family: "WxSymbolFont";
src: url(WxSymbols.svg#WxSymbols); }
@font-face { font-family: "SpecialSymbolFont";
src: url(SpecialSymbols.svg#SpecialSymbols); }
text.text
{
fill: none;
font-size: 1em;
stroke-width: 1px;
font-family: StandardFont;
font-size: 1em;
}
text.weather
{
fill: none;
font-size: 1em;
stroke-width: 1px;
font-family: WxSymbolFont;
}
]]>
</style>
<symbol overflow="visible" id="plotData" class="info">
<text id="sampleText" plotMode="sample" plotParam="obsText"> </text>
<text id="iceInensity" plotMode="table" class="weather" plotLookupTable="icing_intens_trans.txt" plotParam="iceInten" x="0" y="0">0</text>
<text id="fltLvlText" plotMode="text" plotParam="flightLevel" plotFormat="%3.0f" plotUnit="hft" style="text-anchor: end;" x="-15px" y="0px">75</text>
<text id="iceType" plotMode="table" class="weather" plotLookupTable="icing_type_trans.txt" plotParam="iceType" style="text-anchor: end" x="0" y="-10">0</text>
</symbol>
</defs>
<use id="wind" x="40" y="40" width="80" height="80" visibility="visible" xlink:href="#plotData"/>
</svg>

After

Width:  |  Height:  |  Size: 3.3 KiB

View file

@ -44,9 +44,19 @@ class PirepPlotDelegate(PlotDelegate):
windSpeed = int(rec.getFloat("windSpeed"))
if windDir > -1080 or windSpeed > 0:
sampleString += " %d/%dKT" % (windDir, windSpeed)
try:
turbFreq = rec.getString("turbFreq")
except ValueError:
turbFreq = ""
try:
turbInten = rec.getString("turbInten")
except ValueError:
turbInten = ""
try:
turbType = rec.getString("turbType")
except ValueError:
turbType = ""
if turbFreq != "" or turbInten != "" or turbType != "":
sampleString += " TB"
if turbFreq != "":
@ -58,8 +68,46 @@ class PirepPlotDelegate(PlotDelegate):
if turbType != "":
sampleString += " "
sampleString += turbType
try:
iceInten = rec.getString("iceInten")
except ValueError:
iceInten = ""
try:
iceType = rec.getString("iceType")
except ValueError:
icetype = ""
if iceInten != "" or iceType != "":
sampleString += " IC"
if iceInten != "":
sampleString += " "
sampleString += iceInten
if iceType != "":
sampleString += " "
sampleString += iceType
return sampleString
def isValid(self, rec):
# DCS10257
# only show non-severe Turb/Ice data, non-UUA (urgent)
if rec.isValidParameter("obsText"):
obsText = rec.getString("obsText")
if "UUA" in obsText:
# urgent message
return False
if rec.isValidParameter("turbInten"):
turbInten = rec.getString("turbInten")
if (turbInten == "SEV") or (turbInten == "EXTRM"):
# high severity turbulence
return False
if rec.isValidParameter("iceInten"):
iceInten = rec.getString("iceInten")
if (iceInten == "SEV") or (iceInten == "EXTRM"):
# high severity turbulence, high severity icing
return False
# low or no severity, non-urgent data
return True
plotDelegate = PirepPlotDelegate()
</script>
@ -92,7 +140,8 @@ plotDelegate = PirepPlotDelegate()
</style>
<symbol overflow="visible" id="plotData" class="info">
<text id="sampleParams1" plotMode="sample" plotParam="obsText,stationId,longitude,latitude,timeObs,flightLevel"> </text>
<text id="sampleParams2" plotMode="sample" plotParam="temperature,windDir,windSpeed,turbInten,turbFreq,turbType"> </text>
<text id="sampleParams2" plotMode="sample" plotParam="temperature,windDir,windSpeed,turbInten,turbFreq,turbType,iceInten,iceType"> </text>
<text id="validityParams" plotMode="null" class="text" plotParam="obsText,turbInten,iceInten" x="0" y="0" visibility="hidden">0</text>
<text id="fltLvlText" plotMode="text" plotParam="flightLevel" plotFormat="%3.0f" plotUnit="hft" style="text-anchor: start;" x="10px" y="-10px">75</text>
<text id="tempText" plotMode="text" plotParam="temperature" plotFormat="%3.0f" style="text-anchor: end;" x="-10px" y="-10px">75</text>
<g id="windVaneText" plotMode="barb" plotParam="windSpeed,windDir" plotUnit="kts" x="0" y="0" transform="rotate(0,0,0)">

Before

Width:  |  Height:  |  Size: 4 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

View file

@ -0,0 +1,155 @@
<?xml version="1.0"?>
<svg width="80" height="80"
viewBox="0 0 80 80"
overflow="visible"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" style="stroke: rgb(255,255,255);">
<defs>
<script type="text/python" plotDelegate="plotDelegate">
import time
class PirepPlotDelegate(PlotDelegate):
def __init__(self):
PlotDelegate.__init__(self)
def getSampleText(self, rec):
# use obsText for pirep
if rec.isValidParameter("obsText"):
return rec.getString("obsText")
# rebuild text for airep
sampleString = "ARP "
sampleString += rec.getString("stationId")
sampleString += " "
lat = rec.getFloat("latitude")
if(lat &lt; 0):
sampleString += "%.3fS " % (-1*lat)
else:
sampleString += "%.3fN " % (lat)
lon = rec.getFloat("longitude")
if(lon &lt; 0):
sampleString += "%.3fW " % (-1*lon)
else:
sampleString += "%.3fE " % (lon)
timeObs = rec.getLong("timeObs")
sampleString += time.strftime("%H%M",time.localtime(timeObs/1000))
sampleString += " F%d" % (rec.getInt("flightLevel")/100)
temp = rec.getFloat("temperature")
if temp &lt; -273.15:
pass
elif temp &lt; 0:
sampleString += " M%d" % (int(-1*temp))
else:
sampleString += " P%d" % (int(temp))
windDir = int(rec.getFloat("windDir"))
windSpeed = int(rec.getFloat("windSpeed"))
if windDir > -1080 or windSpeed > 0:
sampleString += " %d/%dKT" % (windDir, windSpeed)
try:
turbFreq = rec.getString("turbFreq")
except ValueError:
turbFreq = ""
try:
turbInten = rec.getString("turbInten")
except ValueError:
turbInten = ""
try:
turbType = rec.getString("turbType")
except ValueError:
turbType = ""
if turbFreq != "" or turbInten != "" or turbType != "":
sampleString += " TB"
if turbFreq != "":
sampleString += " "
sampleString += turbFreq
if turbInten != "":
sampleString += " "
sampleString += turbInten
if turbType != "":
sampleString += " "
sampleString += turbType
try:
iceInten = rec.getString("iceInten")
except ValueError:
iceInten = ""
try:
iceType = rec.getString("iceType")
except ValueError:
icetype = ""
if iceInten != "" or iceType != "":
sampleString += " IC"
if iceInten != "":
sampleString += " "
sampleString += iceInten
if iceType != "":
sampleString += " "
sampleString += iceType
return sampleString
def isValid(self, rec):
# DCS10257
# only show non-severe Turb/Ice data, non-UUA (urgent)
if rec.isValidParameter("obsText"):
obsText = rec.getString("obsText")
if "UUA" in obsText:
# urgent message
return True
if rec.isValidParameter("turbInten"):
turbInten = rec.getString("turbInten")
if (turbInten == "SEV") or (turbInten == "EXTRM"):
# high severity turbulence
return True
if rec.isValidParameter("iceInten"):
iceInten = rec.getString("iceInten")
if (iceInten == "SEV") or (iceInten == "EXTRM"):
# high severity turbulence, high severity icing
return True
# low or no severity, non-urgent data
return False
plotDelegate = PirepPlotDelegate()
</script>
<style type="text/css">
<![CDATA[
@font-face { font-family: "WindSymbolFont";
src: url(WindSymbols.svg#WindSymbols); }
@font-face { font-family: "StandardFont";
src: url(Standard.svg#Standard); }
@font-face { font-family: "WxSymbolFont";
src: url(WxSymbols.svg#WxSymbols); }
@font-face { font-family: "SpecialSymbolFont";
src: url(SpecialSymbols.svg#SpecialSymbols); }
text.barb
{
fill: none;
font-size: 1em;
font-size: 1em;
font-family: WindSymbolFont;
}
text.text
{
fill: none;
font-size: 1em;
stroke-width: 1px;
font-family: StandardFont;
font-size: 1em;
}
]]>
</style>
<symbol overflow="visible" id="plotData" class="info">
<text id="sampleParams1" plotMode="sample" plotParam="obsText,stationId,longitude,latitude,timeObs,flightLevel"> </text>
<text id="sampleParams2" plotMode="sample" plotParam="temperature,windDir,windSpeed,turbInten,turbFreq,turbType,iceInten,iceType"> </text>
<text id="validityParams" plotMode="null" class="text" plotParam="obsText,turbInten,iceInten" x="0" y="0" visibility="hidden">0</text>
<text id="fltLvlText" plotMode="text" plotParam="flightLevel" plotFormat="%3.0f" plotUnit="hft" style="text-anchor: start;" x="10px" y="-10px">75</text>
<text id="tempText" plotMode="text" plotParam="temperature" plotFormat="%3.0f" style="text-anchor: end;" x="-10px" y="-10px">75</text>
<g id="windVaneText" plotMode="barb" plotParam="windSpeed,windDir" plotUnit="kts" x="0" y="0" transform="rotate(0,0,0)">
<text id="windVaneText" class="arrow" x="0" y="0">0</text>
<text id="windArrowText" class="barb" x="0" y="0">arrow</text>
</g>
</symbol>
</defs>
<use id="wind" x="40" y="40" width="80" height="80" visibility="visible" xlink:href="#plotData"/>
</svg>

After

Width:  |  Height:  |  Size: 5.7 KiB

View file

@ -5,6 +5,65 @@ overflow="visible"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" style="stroke: rgb(255,255,255);">
<defs>
<script type="text/python" plotDelegate="plotDelegate">
import time
class PirepTurbDelegate(PlotDelegate):
def __init__(self):
PlotDelegate.__init__(self)
def getSampleText(self, rec):
# use obsText for pirep
if rec.isValidParameter("obsText"):
return rec.getString("obsText")
# rebuild text for airep
sampleString = "ARP "
sampleString += " "
sampleString += " F%d" % (rec.getInt("flightLevel")/100)
try:
turbFreq = rec.getString("turbFreq")
except ValueError:
turbFreq = ""
try:
turbInten = rec.getString("turbInten")
except ValueError:
turbInten = ""
if turbInten != "" or turbFreq != "":
sampleString += " TB"
if turbInten != "":
sampleString += " "
sampleString += turbInten
if turbFreq != "":
sampleString += " "
sampleString += turbFreq
return sampleString
def isValid(self, rec):
# DCS10257
# need some turbulence data
# only show non-severe
if rec.isValidParameter("turbInten"):
turbInten = rec.getString("turbInten")
else:
turbInten = ""
if rec.isValidParameter("turbFreq"):
turbFreq = rec.getString("turbFreq")
else:
turbFreq = ""
if (turbInten == "") and (turbFreq == ""):
# no turbulence data present
return False
elif (turbInten == "SEV") or (turbInten == "EXTRM"):
# turbulence data present, but not correct severity
return False
else:
# turbulence data present, and if severity is present it is not high
return True
plotDelegate = PirepTurbDelegate()
</script>
<style type="text/css">
<![CDATA[
@font-face { font-family: "WindSymbolFont";

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View file

@ -0,0 +1,99 @@
<?xml version="1.0"?>
<svg width="80" height="80"
viewBox="0 0 80 80"
overflow="visible"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" style="stroke: rgb(255,255,255);">
<defs>
<script type="text/python" plotDelegate="plotDelegate">
import time
class PirepTurbDelegate(PlotDelegate):
def __init__(self):
PlotDelegate.__init__(self)
def getSampleText(self, rec):
# use obsText for pirep
if rec.isValidParameter("obsText"):
return rec.getString("obsText")
# rebuild text for airep
sampleString = "ARP "
sampleString += " "
sampleString += " F%d" % (rec.getInt("flightLevel")/100)
try:
turbFreq = rec.getString("turbFreq")
except ValueError:
turbFreq = ""
try:
turbInten = rec.getString("turbInten")
except ValueError:
turbInten = ""
if turbInten != "" or turbFreq != "":
sampleString += " TB"
if turbInten != "":
sampleString += " "
sampleString += turbInten
if turbFreq != "":
sampleString += " "
sampleString += turbFreq
return sampleString
def isValid(self, rec):
# DCS10257
# need turbulence severity data
# only show severe
if rec.isValidParameter("turbInten"):
turbInten = rec.getString("turbInten")
if (turbInten == "SEV") or (turbInten == "EXTRM"):
# high severity
return True
else:
# low or empty severity
return False
else:
# no turbulence severity data, so cannot have high turbulence severity
return False
plotDelegate = PirepTurbDelegate()
</script>
<style type="text/css">
<![CDATA[
@font-face { font-family: "WindSymbolFont";
src: url(WindSymbols.svg#WindSymbols); }
@font-face { font-family: "StandardFont";
src: url(Standard.svg#Standard); }
@font-face { font-family: "WxSymbolFont";
src: url(WxSymbols.svg#WxSymbols); }
@font-face { font-family: "SpecialSymbolFont";
src: url(SpecialSymbols.svg#SpecialSymbols); }
text.text
{
fill: none;
font-size: 1em;
stroke-width: 1px;
font-family: StandardFont;
font-size: 1em;
}
text.weather
{
fill: none;
font-size: 1em;
stroke-width: 1px;
font-family: WxSymbolFont;
}
]]>
</style>
<symbol overflow="visible" id="plotData" class="info">
<text id="sampleText" plotMode="sample" plotParam="obsText"> </text>
<text id="turbInensity" plotMode="table" class="weather" plotLookupTable="turb_intens_trans.txt" plotParam="turbInten" x="0" y="0">0</text>
<text id="fltLvlText" plotMode="text" plotParam="flightLevel" plotFormat="%3.0f" plotUnit="hft" style="text-anchor: end;" x="-15px" y="0px">75</text>
<text id="turbFreq" plotMode="table" class="weather" plotLookupTable="turb_freq_trans.txt" plotParam="turbFreq" style="text-anchor: end" x="0" y="-10">0</text>
</symbol>
</defs>
<use id="wind" x="40" y="40" width="80" height="80" visibility="visible" xlink:href="#plotData"/>
</svg>

After

Width:  |  Height:  |  Size: 3.4 KiB

View file

@ -822,160 +822,264 @@
</contribute>
<contribute xsi:type="subMenu" menuText="${icao} SW"
id="${icao}TerminalSpectrumWidth">
<contribute xsi:type="bundleItem" file="bundles/DefaultRadar.xml"
<contribute xsi:type="bundleItem" file="bundles/DefaultRadarBestRes.xml"
menuText="${elev0} SW" id="${icao}Terminal${elev0}SpecWidth" suppressErrors="${suppressErrors0}">
<substitute key="icao" value="${icao}" />
<substitute key="product" value="185" />
<substitute key="product1" value="184" />
<substitute key="product2" value="185" />
<substitute key="product3" value="" />
<substitute key="product4" value="" />
<substitute key="mode" value="" />
<substitute key="elevation" value="${elev0}--${elev0}" />
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultRadar.xml"
<contribute xsi:type="bundleItem" file="bundles/DefaultRadarBestRes.xml"
menuText="${elev1} SW" id="${icao}Terminal${elev1}SpecWidth" suppressErrors="${suppressErrors1}">
<substitute key="icao" value="${icao}" />
<substitute key="product" value="185" />
<substitute key="product1" value="184" />
<substitute key="product2" value="185" />
<substitute key="product3" value="" />
<substitute key="product4" value="" />
<substitute key="mode" value="" />
<substitute key="elevation" value="${elev1}--${elev1}" />
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultRadar.xml"
<contribute xsi:type="bundleItem" file="bundles/DefaultRadarBestRes.xml"
menuText="${elev2} SW" id="${icao}Terminal${elev2}SpecWidth" suppressErrors="${suppressErrors2}">
<substitute key="icao" value="${icao}" />
<substitute key="product" value="185" />
<substitute key="product1" value="184" />
<substitute key="product2" value="185" />
<substitute key="product3" value="" />
<substitute key="product4" value="" />
<substitute key="mode" value="" />
<substitute key="elevation" value="${elev2}--${elev2}" />
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultRadar.xml"
<contribute xsi:type="bundleItem" file="bundles/DefaultRadarBestRes.xml"
menuText="${elev3} SW" id="${icao}Terminal${elev3}SpecWidth" suppressErrors="${suppressErrors3}">
<substitute key="icao" value="${icao}" />
<substitute key="product" value="185" />
<substitute key="product1" value="184" />
<substitute key="product2" value="185" />
<substitute key="product3" value="" />
<substitute key="product4" value="" />
<substitute key="mode" value="" />
<substitute key="elevation" value="${elev3}--${elev3}" />
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultRadar.xml"
<contribute xsi:type="bundleItem" file="bundles/DefaultRadarBestRes.xml"
menuText="${elev4} SW" id="${icao}Terminal${elev4}SpecWidth" suppressErrors="${suppressErrors4}">
<substitute key="icao" value="${icao}" />
<substitute key="product" value="185" />
<substitute key="product1" value="184" />
<substitute key="product2" value="185" />
<substitute key="product3" value="" />
<substitute key="product4" value="" />
<substitute key="mode" value="" />
<substitute key="elevation" value="${elev4}--${elev4}" />
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultRadar.xml"
<contribute xsi:type="bundleItem" file="bundles/DefaultRadarBestRes.xml"
menuText="${elev5} SW" id="${icao}Terminal${elev5}SpecWidth" suppressErrors="${suppressErrors5}">
<substitute key="icao" value="${icao}" />
<substitute key="product" value="185" />
<substitute key="product1" value="184" />
<substitute key="product2" value="185" />
<substitute key="product3" value="" />
<substitute key="product4" value="" />
<substitute key="mode" value="" />
<substitute key="elevation" value="${elev5}--${elev5}" />
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultRadar.xml"
<contribute xsi:type="bundleItem" file="bundles/DefaultRadarBestRes.xml"
menuText="${elev6} SW" id="${icao}Terminal${elev6}SpecWidth" suppressErrors="${suppressErrors6}">
<substitute key="icao" value="${icao}" />
<substitute key="product" value="185" />
<substitute key="product1" value="184" />
<substitute key="product2" value="185" />
<substitute key="product3" value="" />
<substitute key="product4" value="" />
<substitute key="mode" value="" />
<substitute key="elevation" value="${elev6}--${elev6}" />
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultRadar.xml"
<contribute xsi:type="bundleItem" file="bundles/DefaultRadarBestRes.xml"
menuText="${elev7} SW" id="${icao}Terminal${elev7}SpecWidth" suppressErrors="${suppressErrors7}">
<substitute key="icao" value="${icao}" />
<substitute key="product" value="185" />
<substitute key="product1" value="184" />
<substitute key="product2" value="185" />
<substitute key="product3" value="" />
<substitute key="product4" value="" />
<substitute key="mode" value="" />
<substitute key="elevation" value="${elev7}--${elev7}" />
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultRadar.xml"
<contribute xsi:type="bundleItem" file="bundles/DefaultRadarBestRes.xml"
menuText="${elev8} SW" id="${icao}Terminal${elev8}SpecWidth" suppressErrors="${suppressErrors8}">
<substitute key="icao" value="${icao}" />
<substitute key="product" value="185" />
<substitute key="product1" value="184" />
<substitute key="product2" value="185" />
<substitute key="product3" value="" />
<substitute key="product4" value="" />
<substitute key="mode" value="" />
<substitute key="elevation" value="${elev8}--${elev8}" />
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultRadar.xml"
<contribute xsi:type="bundleItem" file="bundles/DefaultRadarBestRes.xml"
menuText="${elev9} SW" id="${icao}Terminal${elev9}SpecWidth" suppressErrors="${suppressErrors9}">
<substitute key="icao" value="${icao}" />
<substitute key="product" value="185" />
<substitute key="product1" value="184" />
<substitute key="product2" value="185" />
<substitute key="product3" value="" />
<substitute key="product4" value="" />
<substitute key="mode" value="" />
<substitute key="elevation" value="${elev9}--${elev9}" />
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultRadar.xml"
<contribute xsi:type="bundleItem" file="bundles/DefaultRadarBestRes.xml"
menuText="${elev10} SW" id="${icao}Terminal${elev10}SpecWidth" suppressErrors="${suppressErrors10}">
<substitute key="icao" value="${icao}" />
<substitute key="product" value="185" />
<substitute key="product1" value="184" />
<substitute key="product2" value="185" />
<substitute key="product3" value="" />
<substitute key="product4" value="" />
<substitute key="mode" value="" />
<substitute key="elevation" value="${elev10}--${elev10}" />
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultRadar.xml"
<contribute xsi:type="bundleItem" file="bundles/DefaultRadarBestRes.xml"
menuText="${elev11} SW" id="${icao}Terminal${elev11}SpecWidth" suppressErrors="${suppressErrors11}">
<substitute key="icao" value="${icao}" />
<substitute key="product" value="185" />
<substitute key="product1" value="184" />
<substitute key="product2" value="185" />
<substitute key="product3" value="" />
<substitute key="product4" value="" />
<substitute key="mode" value="" />
<substitute key="elevation" value="${elev11}--${elev11}" />
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultRadar.xml"
<contribute xsi:type="bundleItem" file="bundles/DefaultRadarBestRes.xml"
menuText="${elev12} SW" id="${icao}Terminal${elev12}SpecWidth" suppressErrors="${suppressErrors12}">
<substitute key="icao" value="${icao}" />
<substitute key="product" value="185" />
<substitute key="product1" value="184" />
<substitute key="product2" value="185" />
<substitute key="product3" value="" />
<substitute key="product4" value="" />
<substitute key="mode" value="" />
<substitute key="elevation" value="${elev12}--${elev12}" />
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultRadar.xml"
<contribute xsi:type="bundleItem" file="bundles/DefaultRadarBestRes.xml"
menuText="${elev13} SW" id="${icao}Terminal${elev13}SpecWidth" suppressErrors="${suppressErrors13}">
<substitute key="icao" value="${icao}" />
<substitute key="product" value="185" />
<substitute key="product1" value="184" />
<substitute key="product2" value="185" />
<substitute key="product3" value="" />
<substitute key="product4" value="" />
<substitute key="mode" value="" />
<substitute key="elevation" value="${elev13}--${elev13}" />
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultRadar.xml"
<contribute xsi:type="bundleItem" file="bundles/DefaultRadarBestRes.xml"
menuText="${elev14} SW" id="${icao}Terminal${elev14}SpecWidth" suppressErrors="${suppressErrors14}">
<substitute key="icao" value="${icao}" />
<substitute key="product" value="185" />
<substitute key="product1" value="184" />
<substitute key="product2" value="185" />
<substitute key="product3" value="" />
<substitute key="product4" value="" />
<substitute key="mode" value="" />
<substitute key="elevation" value="${elev14}--${elev14}" />
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultRadar.xml"
<contribute xsi:type="bundleItem" file="bundles/DefaultRadarBestRes.xml"
menuText="${elev15} SW" id="${icao}Terminal${elev15}SpecWidth" suppressErrors="${suppressErrors15}">
<substitute key="icao" value="${icao}" />
<substitute key="product" value="185" />
<substitute key="product1" value="184" />
<substitute key="product2" value="185" />
<substitute key="product3" value="" />
<substitute key="product4" value="" />
<substitute key="mode" value="" />
<substitute key="elevation" value="${elev15}--${elev15}" />
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultRadar.xml"
<contribute xsi:type="bundleItem" file="bundles/DefaultRadarBestRes.xml"
menuText="${elev16} SW" id="${icao}Terminal${elev16}SpecWidth" suppressErrors="${suppressErrors16}">
<substitute key="icao" value="${icao}" />
<substitute key="product" value="185" />
<substitute key="product1" value="184" />
<substitute key="product2" value="185" />
<substitute key="product3" value="" />
<substitute key="product4" value="" />
<substitute key="mode" value="" />
<substitute key="elevation" value="${elev16}--${elev16}" />
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultRadar.xml"
<contribute xsi:type="bundleItem" file="bundles/DefaultRadarBestRes.xml"
menuText="${elev17} SW" id="${icao}Terminal${elev17}SpecWidth" suppressErrors="${suppressErrors17}">
<substitute key="icao" value="${icao}" />
<substitute key="product" value="185" />
<substitute key="product1" value="184" />
<substitute key="product2" value="185" />
<substitute key="product3" value="" />
<substitute key="product4" value="" />
<substitute key="mode" value="" />
<substitute key="elevation" value="${elev17}--${elev17}" />
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultRadar.xml"
<contribute xsi:type="bundleItem" file="bundles/DefaultRadarBestRes.xml"
menuText="${elev18} SW" id="${icao}Terminal${elev18}SpecWidth" suppressErrors="${suppressErrors18}">
<substitute key="icao" value="${icao}" />
<substitute key="product" value="185" />
<substitute key="product1" value="184" />
<substitute key="product2" value="185" />
<substitute key="product3" value="" />
<substitute key="product4" value="" />
<substitute key="mode" value="" />
<substitute key="elevation" value="${elev18}--${elev18}" />
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultRadar.xml"
<contribute xsi:type="bundleItem" file="bundles/DefaultRadarBestRes.xml"
menuText="${elev19} SW" id="${icao}Terminal${elev19}SpecWidth" suppressErrors="${suppressErrors19}">
<substitute key="icao" value="${icao}" />
<substitute key="product" value="185" />
<substitute key="product1" value="184" />
<substitute key="product2" value="185" />
<substitute key="product3" value="" />
<substitute key="product4" value="" />
<substitute key="mode" value="" />
<substitute key="elevation" value="${elev19}--${elev19}" />
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultRadar.xml"
<contribute xsi:type="bundleItem" file="bundles/DefaultRadarBestRes.xml"
menuText="${elev20} SW" id="${icao}Terminal${elev20}SpecWidth" suppressErrors="${suppressErrors20}">
<substitute key="icao" value="${icao}" />
<substitute key="product" value="185" />
<substitute key="product1" value="184" />
<substitute key="product2" value="185" />
<substitute key="product3" value="" />
<substitute key="product4" value="" />
<substitute key="mode" value="" />
<substitute key="elevation" value="${elev20}--${elev20}" />
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultRadar.xml"
<contribute xsi:type="bundleItem" file="bundles/DefaultRadarBestRes.xml"
menuText="${elev21} SW" id="${icao}Terminal${elev21}SpecWidth" suppressErrors="${suppressErrors21}">
<substitute key="icao" value="${icao}" />
<substitute key="product" value="185" />
<substitute key="product1" value="184" />
<substitute key="product2" value="185" />
<substitute key="product3" value="" />
<substitute key="product4" value="" />
<substitute key="mode" value="" />
<substitute key="elevation" value="${elev21}--${elev21}" />
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultRadar.xml"
<contribute xsi:type="bundleItem" file="bundles/DefaultRadarBestRes.xml"
menuText="${elev22} SW" id="${icao}Terminal${elev22}SpecWidth" suppressErrors="${suppressErrors22}">
<substitute key="icao" value="${icao}" />
<substitute key="product" value="185" />
<substitute key="product1" value="184" />
<substitute key="product2" value="185" />
<substitute key="product3" value="" />
<substitute key="product4" value="" />
<substitute key="mode" value="" />
<substitute key="elevation" value="${elev22}--${elev22}" />
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultRadar.xml"
<contribute xsi:type="bundleItem" file="bundles/DefaultRadarBestRes.xml"
menuText="${elev23} SW" id="${icao}Terminal${elev23}SpecWidth" suppressErrors="${suppressErrors23}">
<substitute key="icao" value="${icao}" />
<substitute key="product" value="185" />
<substitute key="product1" value="184" />
<substitute key="product2" value="185" />
<substitute key="product3" value="" />
<substitute key="product4" value="" />
<substitute key="mode" value="" />
<substitute key="elevation" value="${elev23}--${elev23}" />
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultRadar.xml"
<contribute xsi:type="bundleItem" file="bundles/DefaultRadarBestRes.xml"
menuText="${elev24} SW" id="${icao}Terminal${elev24}SpecWidth" suppressErrors="${suppressErrors24}">
<substitute key="icao" value="${icao}" />
<substitute key="product" value="185" />
<substitute key="product1" value="184" />
<substitute key="product2" value="185" />
<substitute key="product3" value="" />
<substitute key="product4" value="" />
<substitute key="mode" value="" />
<substitute key="elevation" value="${elev24}--${elev24}" />
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultRadar.xml"
<contribute xsi:type="bundleItem" file="bundles/DefaultRadarBestRes.xml"
menuText="All SW" id="${icao}TerminalAllSpecWidth" >
<substitute key="icao" value="${icao}" />
<substitute key="product" value="185" />
<substitute key="product1" value="184" />
<substitute key="product2" value="185" />
<substitute key="product3" value="" />
<substitute key="product4" value="" />
<substitute key="mode" value="" />
<substitute key="elevation" value="0.0--360.0" />
</contribute>
</contribute>

View file

@ -25,7 +25,8 @@ Require-Bundle: org.eclipse.ui,
com.raytheon.viz.alerts,
com.raytheon.uf.common.site,
com.raytheon.viz.core.contours,
com.raytheon.uf.viz.core.rsc
com.raytheon.uf.viz.core.rsc,
com.raytheon.uf.viz.d2d.ui
Bundle-ActivationPolicy: lazy
Export-Package: com.raytheon.viz.warngen,
com.raytheon.viz.warngen.gis,

View file

@ -81,6 +81,7 @@ import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.core.maps.MapManager;
import com.raytheon.uf.viz.d2d.ui.map.SideView;
import com.raytheon.viz.awipstools.common.stormtrack.StormTrackState.DisplayType;
import com.raytheon.viz.awipstools.common.stormtrack.StormTrackState.Mode;
import com.raytheon.viz.texteditor.msgs.IWarngenObserver;
@ -170,6 +171,9 @@ import com.vividsolutions.jts.geom.Polygon;
* May 7, 2015 ASM #17438 D. Friedman Clean up debug and performance logging.
* Jun 05, 2015 DR 17428 D. Friedman Fixed duration-related user interface issues. Added duration logging.
* Sep 22, 2015 4859 dgilling Prevent product generation in DRT mode.
* Nov 9, 2015 DR 14905 Qinglu Lin Updated backupSiteSelected(), disposed(), initializeComponents(), populateBackupGroup(), and
* createProductTypeGroup, and moved existing code to newly created setBackupCboColors() and setBackupSite().
* Nov 25, 2015 DR 17464 Qinglu Lin Updated changeTemplate().
* </pre>
*
* @author chammack
@ -351,6 +355,10 @@ public class WarngenDialog extends CaveSWTDialog implements
timer.cancel();
updateTimeTask.cancel();
CurrentWarnings.removeListener(this);
IDisplayPaneContainer container = warngenLayer.getResourceContainer();
if (container != null && ! (container instanceof SideView)) {
WarngenLayer.setLastSelectedBackupSite(warngenLayer.getBackupSite());
}
warngenLayer = null;
}
@ -384,6 +392,7 @@ public class WarngenDialog extends CaveSWTDialog implements
createTimeRangeGroup(mainComposite);
createBulletListAndLabel(mainComposite);
createBottomButtons(mainComposite);
setBackupSite();
setInstructions();
}
@ -501,9 +510,6 @@ public class WarngenDialog extends CaveSWTDialog implements
productType.setLayout(gl);
productType.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true,
false));
createMainProductButtons(productType);
createOtherProductsList(productType);
}
/**
@ -766,14 +772,21 @@ public class WarngenDialog extends CaveSWTDialog implements
backupSiteCbo.add(NO_BACKUP_SELECTED);
String[] CWAs = warngenLayer.getDialogConfig().getBackupCWAs()
.split(",");
int index = 0, selectedIndex = 0;
for (String cwa : CWAs) {
if (cwa.length() > 0) {
index += 1;
BackupData data = new BackupData(cwa);
backupSiteCbo.setData(data.site, data);
backupSiteCbo.add(data.site);
if (data.site.equals(warngenLayer.getBackupSite())) {
selectedIndex = index;
warngenLayer.setBackupSite(data.site);
}
}
backupSiteCbo.select(0);
}
backupSiteCbo.select(selectedIndex);
setBackupCboColors();
}
private void createTrackGroup(Composite backupTrackEditComp) {
@ -1406,15 +1419,16 @@ public class WarngenDialog extends CaveSWTDialog implements
hide();
}
/**
* Action for when something is selected from the backup site combo
*/
private void backupSiteSelected() {
private boolean setBackupSite() {
if ((backupSiteCbo.getSelectionIndex() >= 0)
&& (backupSiteCbo.getItemCount() > 0)) {
int index = backupSiteCbo.getSelectionIndex();
String backupSite = backupSiteCbo.getItem(index);
warngenLayer.setBackupSite(backupSite);
IDisplayPaneContainer container = warngenLayer.getResourceContainer();
if (container != null && ! (container instanceof SideView)) {
WarngenLayer.setLastSelectedBackupSite(backupSite);
}
if (backupSite.equalsIgnoreCase("none")) {
new TemplateRunnerInitJob().schedule();
} else {
@ -1439,11 +1453,24 @@ public class WarngenDialog extends CaveSWTDialog implements
.error("Error occurred while switching to the default template.",
e);
}
return true;
} else {
return false;
}
}
/**
* Action for when something is selected from the backup site combo
*/
private void backupSiteSelected() {
if (setBackupSite()) {
productType.layout(true, true);
getShell().pack(true);
}
setBackupCboColors();
}
private void setBackupCboColors() {
if (backupSiteCbo.getSelectionIndex() == 0) {
backupSiteCbo.setBackground(null);
backupSiteCbo.setForeground(null);
@ -1706,22 +1733,12 @@ public class WarngenDialog extends CaveSWTDialog implements
boolean isDifferentAreaSources = !warngenLayer.getConfiguration()
.getHatchedAreaSource().getAreaSource()
.equalsIgnoreCase(lastAreaSource);
boolean snapHatchedAreaToPolygon = isDifferentAreaSources;
boolean preservedSelection = !isDifferentAreaSources;
if (isDifferentAreaSources
|| !warngenLayer.getConfiguration().getHatchedAreaSource()
.getAreaSource().toLowerCase().equals("marinezones")) {
// If template has a different hatched area source from the previous
// template, then the warned area would be based on the polygon and
// not
// preserved.
try {
warngenLayer.updateWarnedAreas(snapHatchedAreaToPolygon,
preservedSelection);
warngenLayer.updateWarnedAreas(preservedSelection);
} catch (VizException e1) {
statusHandler.handle(Priority.PROBLEM, "WarnGen Error", e1);
}
}
// Properly sets the "Create Text" button.
setInstructions();
}

View file

@ -240,6 +240,9 @@ import com.vividsolutions.jts.io.WKTReader;
* 04/24/2015 ASM #17394 D. Friedman Fix geometries that become invalid in local coordinate space.
* 05/07/2015 ASM #17438 D. Friedman Clean up debug and performance logging.
* 05/08/2015 ASM #17310 D. Friedman Log input polygon when output of AreaHatcher is invalid.
* 11/09/2015 DR 14905 Qinglu Lin Added lastSelectedBackupSite and its accessors, and updated constructor.
* 11/25/2015 DR 17464 Qinglu Lin Updated two updateWarnedAreas(), updateWarnedAreaState(), createSquare(),redrawBoxFromTrack(),
* redrawBoxFromHatched(), createDamThreatArea(), createPolygonFromRecord(), addOrRemoveCounty().
* </pre>
*
* @author mschenke
@ -253,6 +256,8 @@ public class WarngenLayer extends AbstractStormTrackResource {
private static final IPerformanceStatusHandler perfLog = PerformanceStatus
.getHandler("WG:");
static String lastSelectedBackupSite;
String uniqueFip = null;
String backupOfficeShort = null;
@ -814,6 +819,9 @@ public class WarngenLayer extends AbstractStormTrackResource {
statusHandler.handle(Priority.SIGNIFICANT,
"Error loading config.xml", e);
}
setBackupSite(WarngenLayer.getLastSelectedBackupSite());
// Load default template
String defaultTemplate = dialogConfig.getDefaultTemplate();
if (defaultTemplate.equals("")) {
@ -1536,7 +1544,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
}
public void setBackupSite(String site) {
if (site.equalsIgnoreCase("none")) {
if (site == null || site.equalsIgnoreCase("none")) {
backupSite = null;
} else {
backupSite = site;
@ -1947,20 +1955,14 @@ public class WarngenLayer extends AbstractStormTrackResource {
}
}
public void updateWarnedAreas(boolean snapHatchedAreaToPolygon)
throws VizException {
updateWarnedAreas(snapHatchedAreaToPolygon, false);
public void updateWarnedAreas() throws VizException {
updateWarnedAreas(false);
}
/**
*
* @param snapHatchedAreaToPolygon
* If True, any hatched area outside the polygon will be
* eliminated.
* @throws VizException
*/
public void updateWarnedAreas(boolean snapHatchedAreaToPolygon,
boolean preservedSelection) throws VizException {
public void updateWarnedAreas(boolean preservedSelection) throws VizException {
if (getPolygon() == null) {
return;
}
@ -1970,11 +1972,10 @@ public class WarngenLayer extends AbstractStormTrackResource {
Geometry warningArea = state.getWarningArea();
Geometry warningPolygon = state.getWarningPolygon();
Geometry newWarningArea = createWarnedArea(
latLonToLocal((snapHatchedAreaToPolygon || (warningArea == null)) ? warningPolygon
: warningArea), preservedSelection
latLonToLocal(warningPolygon), preservedSelection
&& (warningArea != null) ? latLonToLocal(warningArea)
: null);
updateWarnedAreaState(newWarningArea, snapHatchedAreaToPolygon);
updateWarnedAreaState(newWarningArea);
perfLog.logDuration("Determining hatchedArea",
System.currentTimeMillis() - t0);
@ -2127,8 +2128,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
}
}
private void updateWarnedAreaState(Geometry newHatchedArea,
boolean snapToHatchedArea) throws VizException {
private void updateWarnedAreaState(Geometry newHatchedArea) throws VizException {
try {
// Ensure all geometries in local coords
Geometry warningPolygon = latLonToLocal(state.getWarningPolygon());
@ -2251,7 +2251,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
state.setWarningPolygon((Polygon) state
.getMarkedWarningPolygon().clone());
state.resetMarked();
updateWarnedAreas(snapToHatchedArea);
updateWarnedAreas();
}
} else {
state.setWarningArea(localToLatLon(newHatchedArea));
@ -2447,7 +2447,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
LinearRing lr = gf.createLinearRing(c);
state.setWarningPolygon(gf.createPolygon(lr, null));
updateWarnedAreas(true);
updateWarnedAreas();
}
public void redrawBoxFromTrack() throws VizException {
@ -2619,7 +2619,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
LinearRing lr = gf.createLinearRing(c);
state.setWarningPolygon(gf.createPolygon(lr, null));
updateWarnedAreas(true);
updateWarnedAreas();
/*
* NOT LINE OF STORMS
@ -2664,7 +2664,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
LinearRing lr = gf.createLinearRing(c);
state.setWarningPolygon(gf.createPolygon(lr, null));
updateWarnedAreas(true);
updateWarnedAreas();
}
if (dialog.box.getSelection()) {
displayState.editable = false;
@ -2704,7 +2704,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
if (hatched != null) {
state.setWarningPolygon(hatched);
updateWarnedAreaState(hatchedArea, true);
updateWarnedAreaState(hatchedArea);
issueRefresh();
// End of DR 15559
state.snappedToArea = true;
@ -2752,7 +2752,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
try {
state.setWarningPolygon(gf.createPolygon(lr, null));
state.rightClickSelected = false;
updateWarnedAreas(true);
updateWarnedAreas();
displayState.dragMeGeom = gf.createPoint(pt);
displayState.dragMePoint = gf.createPoint(pt);
displayState.mode = Mode.TRACK;
@ -2868,7 +2868,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
state.setWarningPolygon(warnPolygon);
state.setWarningArea(getWarningAreaFromPolygon(
state.getWarningPolygon(), record));
updateWarnedAreas(true, true);
updateWarnedAreas(true);
}
private DataTime recordFrameTime(AbstractWarningRecord warnRecord) {
@ -3254,7 +3254,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
String fip = getFips(f);
if ((fip != null) && (uniqueFip != null)
&& fip.equals(uniqueFip)) {
updateWarnedAreas(true);
updateWarnedAreas();
}
break;
}
@ -3844,4 +3844,15 @@ public class WarngenLayer extends AbstractStormTrackResource {
return backupOfficeLoc;
}
public String getBackupSite() {
return backupSite;
}
public static String getLastSelectedBackupSite() {
return lastSelectedBackupSite;
}
public static void setLastSelectedBackupSite(String backupSite) {
lastSelectedBackupSite = backupSite;
}
}

View file

@ -67,6 +67,7 @@ import com.vividsolutions.jts.geom.Polygon;
* Jun 25, 2013 DR 16013 Qinglu Lin Called setUniqueFip() in handleMouseUp().
* Aug 15, 2013 DR 16418 D. Friedman Only raise dialog if editable. Don't call featureEdit if not editable.
* Sep 24, 2013 #2403 lvenable Fixed cursor memory leak.
* Nov 25, 2015 DR 17464 Qinglu Lin Updated handleMouseUp(), DeleteVertexAction(), and AddVertexAction class.
*
* </pre>
*
@ -260,7 +261,7 @@ public class WarngenUIManager extends InputAdapter {
LinearRing lr = gf.createLinearRing(coordinates);
state.setWarningPolygon(gf.createPolygon(lr, null));
}
warngenLayer.updateWarnedAreas(true);
warngenLayer.updateWarnedAreas();
} catch (VizException e) {
e.printStackTrace();
}
@ -457,7 +458,7 @@ public class WarngenUIManager extends InputAdapter {
warngenLayer.getWarngenState().setWarningPolygon(newPoly);
try {
warngenLayer.updateWarnedAreas(true);
warngenLayer.updateWarnedAreas();
} catch (VizException e) {
Status s = new Status(Status.ERROR, Activator.PLUGIN_ID,
"Error updating warned area", e);
@ -597,7 +598,7 @@ public class WarngenUIManager extends InputAdapter {
Polygon newPoly = gf.createPolygon(newLs, null);
warngenLayer.getWarngenState().setWarningPolygon(newPoly);
try {
warngenLayer.updateWarnedAreas(true);
warngenLayer.updateWarnedAreas();
} catch (VizException e) {
Status s = new Status(Status.ERROR,
Activator.PLUGIN_ID,

View file

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<bundle>
<displayList>
<displays xsi:type="d2DMapRenderableDisplay"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<descriptor xsi:type="mapDescriptor">
<resource>
<loadProperties loadWithoutData="true">
<capabilities>
<capability xsi:type="outlineCapability"
lineStyle="SOLID" outlineOn="true"
outlineWidth="1" />
<capability xsi:type="colorableCapability"
colorAsString="#bbbbbb" />
</capabilities>
</loadProperties>
<properties isSystemResource="false"
isBlinking="false" isMapLayer="false" isHoverOn="false"
isVisible="true" />
<resourceData xsi:type="cwaspsResourceData"
isUpdatingOnMetadataOnly="false" retrieveData="true"
isRequeryNecessaryOnTimeMatch="false"
name="National Sig Wx Advisories (SPS)"
hideSampling="true">
<metadataMap>
<mapping key="pil">
<constraint constraintValue="SPS"
constraintType="EQUALS" />
</mapping>
<mapping key="pluginName">
<constraint constraintValue="warning"
constraintType="EQUALS" />
</mapping>
<mapping key="officeid">
<constraint constraintValue="${ALLsites}"
constraintType="IN" />
</mapping>
</metadataMap>
</resourceData>
</resource>
</descriptor>
</displays>
</displayList>
</bundle>

Some files were not shown because too many files have changed in this diff Show more