Merge branch 'master_13.3.1' (13.3.1-17) into omaha_13.3.1

Conflicts:
	rpms/legal/FOSS_licenses/qpid/gentools/lib/LICENSE

Former-commit-id: 74a47b9bd9 [formerly 74a47b9bd9 [formerly 98ddc22749f0e5cdb0f4f8f0084ee742486461d5]]
Former-commit-id: 14c9de2259
Former-commit-id: a6dd28cc82
This commit is contained in:
Steve Harris 2013-04-01 12:15:04 -05:00
commit 0fee31b1a8
35 changed files with 1932 additions and 1016 deletions

View file

@ -128,5 +128,5 @@
</lineProperty>
</Line>
</linePropertyMap>
<dataPageProperty severePotentialPage="10" convectiveInitiationPage="9" meanWindPage="8" stormRelativePage="7" mixingHeightPage="6" opcDataPage="5" thermodynamicDataPage="4" parcelDataPage="3" summary2Page="2" summary1Page="1"/>
<dataPageProperty numberPagePerDisplay="1" severePotentialPage="10" convectiveInitiationPage="9" meanWindPage="8" stormRelativePage="7" mixingHeightPage="6" opcDataPage="5" thermodynamicDataPage="4" parcelDataPage="3" summary2Page="2" summary1Page="1"/>
</NsharpConfigStore>

View file

@ -134,7 +134,8 @@ import com.vividsolutions.jts.geom.Polygon;
* setPolygonLocked(true) below conSelected() is called in corSelected(),
* and removed it from updateListSelected().
* Feb 18, 2013 #1633 rferrel Changed checkFollowupSelection to use SimulatedTime.
*
* Mar 28, 2013 DR 15974 D. Friedman Do not track removed GIDs.
*
* </pre>
*
* @author chammack
@ -1587,7 +1588,6 @@ public class WarngenDialog extends CaveSWTDialog implements
warngenLayer.getStormTrackState().endTime = null;
WarningAction action = WarningAction.valueOf(data.getAct());
warngenLayer.setWarningAction(action);
warngenLayer.initRemovedGids();
if (action == WarningAction.CON) {
oldWarning = conSelected(data);
} else if (action == WarningAction.COR) {

View file

@ -160,6 +160,10 @@ import com.vividsolutions.jts.io.WKTReader;
* 12/18/2012 DR 15571 Qinglu Lin Resolved coordinate issue in TML line caused by clicking Restart button.
* 01/24/2013 DR 15723 Qinglu Lin Added initRemovedGids() and updated updateWarnedAreas() to prevent the removed
* counties from being re-hatched.
* 03/06/2013 DR 15831 D. Friedman Use area inclusion filter in followups.
* 03/28/2013 DR 15973 Qinglu Lin Added adjustVertex() and applied it invalid polygon.
* 03/28/2013 DR 15974 D. Friedman Preserve the set of selected counties when recreating the polygon from the
* hatched area and remember marked counties outside the polygon on followup.
* </pre>
*
* @author mschenke
@ -278,7 +282,9 @@ public class WarngenLayer extends AbstractStormTrackResource {
try {
Polygon hatched = polygonUtil.hatchWarningArea(
warningPolygon, warningArea);
warningPolygon,
removeCounties(warningArea,
state.getFipsOutsidePolygon()));
if (hatched != null) {
// DR 15559
Coordinate[] coords = hatched.getCoordinates();
@ -287,7 +293,11 @@ public class WarngenLayer extends AbstractStormTrackResource {
GeometryFactory gf = new GeometryFactory();
LinearRing lr = gf.createLinearRing(coords);
hatchedArea = gf.createPolygon(lr, null);
hatchedWarningArea = createWarnedArea(latLonToLocal(hatchedArea));
if (! hatchedArea.isValid())
hatchedArea = adjustVertex(hatchedArea);
hatchedWarningArea = createWarnedArea(
latLonToLocal(hatchedArea),
latLonToLocal(warningArea));
} else {
this.hatchedArea = null;
this.hatchedWarningArea = null;
@ -387,8 +397,6 @@ public class WarngenLayer extends AbstractStormTrackResource {
private WarningAction warningAction = WarningAction.NEW;
private final Set<String> removedGids = new HashSet<String>();
static {
for (int i = 0; i < 128; i++) {
if (i % 32 == 0) {
@ -1059,11 +1067,15 @@ public class WarngenLayer extends AbstractStormTrackResource {
public void setOldWarningPolygon(AbstractWarningRecord record) {
if (record != null) {
state.setOldWarningPolygon((Polygon) record.getGeometry().clone());
state.setOldWarningArea(getWarningAreaFromPolygon(
state.getOldWarningPolygon(), record));
Geometry oldArea = getWarningAreaFromPolygon(
state.getOldWarningPolygon(), record);
if (oldArea.getUserData() instanceof Set)
state.setFipsOutsidePolygon((Set<String>) oldArea.getUserData());
state.setOldWarningArea(oldArea);
} else {
state.setOldWarningArea(null);
state.setOldWarningPolygon(null);
state.setFipsOutsidePolygon(null);
}
}
@ -1114,7 +1126,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
Map<String, String[]> countyMap = FipsUtil
.parseCountyHeader(activeTableRecord.getUgcZone());
// get area with precalculated area
activeTableRecord.setGeometry(getArea(area, countyMap));
activeTableRecord.setGeometry(getArea(area, countyMap, false));
}
}
@ -1154,35 +1166,59 @@ public class WarngenLayer extends AbstractStormTrackResource {
}
/**
* Give the intersection area and polygon, build the area for the county map
* Given the intersection area and polygon, build the area for the county
* map
*
* @param area
* @param polygon
* @param countyMap
* @return
* @param includeAllEntries
* if true, ensure all entries in countyMap are represented in
* the result even if not in {@code area}.
* @return the resulting area. If includeAllEntries is true and there are
* areas in countyMap not inside {@code area}, the user data will be
* set to a Set of the FIPS IDs (or equivalent) of those outside
* areas.
*/
private Geometry getArea(Geometry area, Map<String, String[]> countyMap) {
private Geometry getArea(Geometry area, Map<String, String[]> countyMap,
boolean includeAllEntries) {
if (area == null) {
return null;
}
// Now remove counties not present in warning
Set<String> idsOutsidePolygon = null;
Set<String> fipsOutsidePolygon = null;
if (includeAllEntries) {
idsOutsidePolygon = new HashSet<String>();
for (Map.Entry<String, String[]> entry : countyMap.entrySet()) {
String state = entry.getKey();
for (String id : entry.getValue()) {
idsOutsidePolygon.add(state + '-' + id);
}
}
}
List<Geometry> geoms = new ArrayList<Geometry>();
GeometryUtil.buildGeometryList(geoms, area);
List<Geometry> newList = new ArrayList<Geometry>();
boolean isMarineZone = configuration.getGeospatialConfig()
.getAreaSource().equalsIgnoreCase(MARINE);
for (Geometry geom : geoms) {
CountyUserData data = (CountyUserData) geom.getUserData();
String fips = null;
String[] ids = null;
if (configuration.getGeospatialConfig().getAreaSource()
.equalsIgnoreCase(MARINE)) {
if (isMarineZone) {
fips = String.valueOf(data.entry.attributes.get(configuration
.getHatchedAreaSource().getFipsField()));
if (countyMap.containsKey(fips.substring(0, 2))) {
ids = countyMap.get(fips.substring(0, 2));
for (String id : ids) {
if (fips.endsWith(id)) {
if (idsOutsidePolygon != null) {
idsOutsidePolygon.remove(fips.substring(0, 2) + '-' + id);
}
newList.add(geom);
break;
}
@ -1199,6 +1235,9 @@ public class WarngenLayer extends AbstractStormTrackResource {
.getFipsField()));
for (String id : ids) {
if (fips.endsWith(id)) {
if (idsOutsidePolygon != null) {
idsOutsidePolygon.remove(stateAbbr + '-' + id);
}
newList.add(geom);
break;
}
@ -1206,8 +1245,39 @@ public class WarngenLayer extends AbstractStormTrackResource {
}
}
}
return area.getFactory().createGeometryCollection(
if (includeAllEntries && !idsOutsidePolygon.isEmpty()) {
if (geoData != null) {
fipsOutsidePolygon = new HashSet<String>();
for (GeospatialData f : geoData.features) {
CountyUserData data = (CountyUserData) f.geometry
.getUserData();
String fips = String.valueOf(data.entry.attributes
.get(configuration.getHatchedAreaSource()
.getFipsField()));
String key;
if (isMarineZone) {
key = fips.substring(0, 2) + '-' + fips.substring(3);
} else {
String stateAbbr = String.valueOf(data.entry.attributes
.get(configuration.getHatchedAreaSource()
.getAreaNotationField()));
key = stateAbbr + '-' + fips.substring(2);
}
if (idsOutsidePolygon.contains(key)) {
newList.add((Geometry) f.geometry.clone());
fipsOutsidePolygon.add(getFips(f));
}
}
}
}
Geometry result = area.getFactory().createGeometryCollection(
newList.toArray(new Geometry[newList.size()]));
if (fipsOutsidePolygon != null)
result.setUserData(fipsOutsidePolygon);
return result;
}
/**
@ -1219,7 +1289,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
* @return
*/
private Geometry getArea(Polygon polygon, Map<String, String[]> countyMap) {
return getArea(buildArea(polygon), countyMap);
return getArea(buildArea(polygon), countyMap, true);
}
/**
@ -1250,6 +1320,10 @@ public class WarngenLayer extends AbstractStormTrackResource {
}
}
public void updateWarnedAreas(boolean snapHatchedAreaToPolygon) throws VizException {
updateWarnedAreas(snapHatchedAreaToPolygon, false);
}
/**
*
* @param snapHatchedAreaToPolygon
@ -1257,7 +1331,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
* eliminated.
* @throws VizException
*/
public void updateWarnedAreas(boolean snapHatchedAreaToPolygon)
public void updateWarnedAreas(boolean snapHatchedAreaToPolygon, boolean preservedSelection)
throws VizException {
if (getPolygon() == null) {
return;
@ -1268,7 +1342,8 @@ public class WarngenLayer extends AbstractStormTrackResource {
Geometry warningArea = state.getWarningArea();
Geometry warningPolygon = state.getWarningPolygon();
Geometry newWarningArea = createWarnedArea(latLonToLocal((snapHatchedAreaToPolygon || warningArea == null) ? warningPolygon
: warningArea));
: warningArea),
preservedSelection && warningArea != null ? latLonToLocal(warningArea) : null);
updateWarnedAreaState(newWarningArea, snapHatchedAreaToPolygon);
System.out.println("determining hatchedArea took "
@ -1279,26 +1354,63 @@ public class WarngenLayer extends AbstractStormTrackResource {
* Creates a warning area based on the hatched area in local coordinates
*
* @param hatchedArea
* @param preservedSelection
* if not null, the result contains all entities in this Geometry
* even if they do not intersect hatchedArea or do not pass the
* inclusion filter
* @return
*/
private Geometry createWarnedArea(Geometry hatchedArea) {
private Geometry createWarnedArea(Geometry hatchedArea, Geometry preservedSelection) {
Geometry oldWarningPolygon = latLonToLocal(state.getOldWarningPolygon());
Geometry oldWarningArea = latLonToLocal(state.getOldWarningArea());
Geometry newHatchedArea = null;
Set<String> selectedFips = null;
List<Geometry> selectedGeoms = null;
if (preservedSelection != null)
selectedFips = getAllFipsInArea(preservedSelection);
// Loop through each of our counties returned from the query
for (GeospatialData f : geoData.features) {
// get the geometry of the county and make sure it intersects
// with our hatched area
PreparedGeometry prepGeom = (PreparedGeometry) f.attributes
.get(GeospatialDataList.LOCAL_PREP_GEOM);
Geometry geom = (Geometry) f.attributes
.get(GeospatialDataList.LOCAL_GEOM);
Geometry intersection = null;
try {
// Get intersection between county and hatched boundary
intersection = GeometryUtil.intersection(hatchedArea, prepGeom);
if (oldWarningArea != null) {
intersection = GeometryUtil.intersection(intersection, oldWarningArea);
}
if (intersection.isEmpty()) {
continue;
if (selectedFips == null
|| !selectedFips.contains(getFips(f))) {
continue;
} else if (! selectedFips.isEmpty()) {
/*
* Add whatever part of the area was previously hatched
* despite being outside the new polygon.
*/
if (selectedGeoms == null) {
selectedGeoms = new ArrayList<Geometry>();
GeometryUtil.buildGeometryList(selectedGeoms, preservedSelection);
}
intersection = null;
String prefix = GeometryUtil.getPrefix(f.geometry.getUserData());
for (Geometry g : selectedGeoms) {
if (g.getUserData() != null) {
if (prefix.equals(GeometryUtil.getPrefix(g.getUserData()))) {
intersection = intersection == null ? g :
GeometryUtil.union(intersection, g);
}
}
}
if (intersection == null) {
// This part of the area was not previously selected.
continue;
}
}
}
} catch (RuntimeException e) {
continue;
@ -1306,33 +1418,15 @@ public class WarngenLayer extends AbstractStormTrackResource {
}
try {
double ratio = intersection.getArea() / geom.getArea();
double ratioInPercent = ratio * 100.;
Double areaOfGeom = (Double) f.attributes.get(AREA);
double areaInKmSqOfIntersection = meterSqToKmSq
.convert(areaOfGeom * ratio);
boolean includeArea = false;
if (getConfiguration().getHatchedAreaSource()
.getInclusionAndOr().equalsIgnoreCase("AND")) {
if ((ratioInPercent >= getConfiguration()
.getHatchedAreaSource().getInclusionPercent())
&& (areaInKmSqOfIntersection > getConfiguration()
.getHatchedAreaSource().getInclusionArea())) {
includeArea = true;
}
} else {
if ((ratioInPercent >= getConfiguration()
.getHatchedAreaSource().getInclusionPercent())
|| (areaInKmSqOfIntersection > getConfiguration()
.getHatchedAreaSource().getInclusionArea())) {
includeArea = true;
}
}
if (includeArea
&& (oldWarningPolygon == null || prepGeom
.intersects(oldWarningPolygon))) {
boolean include;
if (selectedFips != null)
include = selectedFips.contains(getFips(f));
else
include = filterArea(f, intersection, true)
&& (oldWarningPolygon == null
|| prepGeom.intersects(oldWarningPolygon)
|| isOldAreaOutsidePolygon(f));
if (include) {
if (newHatchedArea == null) {
newHatchedArea = intersection;
} else {
@ -1397,31 +1491,51 @@ public class WarngenLayer extends AbstractStormTrackResource {
state.resetMarked();
} else if (warningPolygon != null) {
// want intersection of warningPolygon and oldWarningArea
Set<String> selectedGids = new HashSet<String>(
Arrays.asList(GeometryUtil.getGID(newHatchedArea)));
Geometry selectedArea = newHatchedArea;
newHatchedArea = GeometryUtil.intersection(warningPolygon,
oldWarningArea);
if (removedGids.size() > 0) {
Set<String> newGids = new HashSet<String>(
Arrays.asList(GeometryUtil.getGID(newHatchedArea)));
if (!selectedGids.equals(newGids)) {
// Remove areas with gid in removedGids
List<Geometry> areas = new ArrayList<Geometry>(
newHatchedArea.getNumGeometries());
Set<String> seenGids = new HashSet<String>();
for (int n = 0; n < newHatchedArea.getNumGeometries(); ++n) {
Geometry newArea = newHatchedArea.getGeometryN(n);
String[] gids = GeometryUtil.getGID(newArea);
boolean flag = false;
for (String gid : gids) {
if (removedGids.contains(gid)) {
if (! selectedGids.contains(gid)) {
flag = true;
break;
}
}
if (!flag) {
areas.add(newArea);
seenGids.addAll(Arrays.asList(gids));
}
}
if (areas.size() != newHatchedArea.getNumGeometries()) {
// Areas were removed, recreate newHatchedArea
newHatchedArea = GeometryUtil.union(areas
.toArray(new Geometry[0]));
selectedGids.removeAll(seenGids);
if (!selectedGids.isEmpty()) {
for (int n = 0; n < selectedArea.getNumGeometries(); ++n) {
Geometry area = selectedArea.getGeometryN(n);
String[] gids = GeometryUtil.getGID(area);
boolean flag = false;
for (String gid : gids) {
if (selectedGids.contains(gid)) {
flag = true;
break;
}
}
if (flag)
areas.add(area);
}
}
newHatchedArea = GeometryUtil.union(areas
.toArray(new Geometry[0]));
}
}
}
@ -1470,6 +1584,94 @@ public class WarngenLayer extends AbstractStormTrackResource {
warningAreaChanged();
}
}
/** Determine if the given area of the reference area passes the
* inclusion filter. Subroutine of {@link #filterArea}.
* @param areaToConsider
* @param wholeArea
* @param areaInMetersSq
* @param anyAmountOfArea
* @return
*/
private boolean filterCheck(Geometry areaToConsider, Geometry wholeArea,
double areaInMetersSq) {
double ratio = areaToConsider.getArea() / wholeArea.getArea();
double ratioInPercent = ratio * 100.;
double areaInKmSqOfIntersection = meterSqToKmSq.convert(areaInMetersSq
* ratio);
boolean percentOk = ratioInPercent >= getConfiguration()
.getHatchedAreaSource().getInclusionPercent();
boolean areaOk = areaInKmSqOfIntersection > getConfiguration()
.getHatchedAreaSource().getInclusionArea();
return getConfiguration().getHatchedAreaSource().getInclusionAndOr()
.equalsIgnoreCase("AND") ?
percentOk && areaOk : percentOk || areaOk;
}
/** Determine if a feature should be included based on how much of it
* is hatched and the configured inclusion criteria.
* @param feature
* @param featureAreaToConsider the portion of the feature that is hatched
* @param localCoordinates if true, use local CRS; otherwise, use lat/lon
* @param anyAmountOfArea if true, ignore the configured criteria and
* include the feature if event a small amount is hatched.
* @return true if the feature should be included
*/
private boolean filterArea(GeospatialData feature, Geometry featureAreaToConsider, boolean localCRS) {
Geometry geom = localCRS ?
(Geometry) feature.attributes.get(GeospatialDataList.LOCAL_GEOM) :
feature.geometry;
double areaOfGeom = (Double) feature.attributes.get(AREA);
if (filterCheck(featureAreaToConsider, geom, areaOfGeom))
return true;
else if (state.getOldWarningArea() != null) {
/*
* Second chance: If the county slipped by the filter in the initial
* warning, allow it now as long as the hatched area is (nearly) the
* same as the hatched area in the initial warning.
*
* This test assumes that the followup filter is not more permissive
* that the initial warning filter. OTOH, if the followup filter is
* more permissive, this test is not really necessary.
*/
Geometry oldWarningArea = state.getOldWarningArea();
if (localCRS)
oldWarningArea = latLonToLocal(oldWarningArea);
List<Geometry> geoms = new ArrayList<Geometry>();
GeometryUtil.buildGeometryList(geoms, oldWarningArea);
Geometry oldSelectedArea = null;
String prefix = GeometryUtil.getPrefix(feature.geometry.getUserData());
for (Geometry g : geoms) {
if (g.getUserData() != null) {
if (prefix.equals(GeometryUtil.getPrefix(g.getUserData()))) {
oldSelectedArea = oldSelectedArea == null ? g :
GeometryUtil.union(oldSelectedArea, g);
}
}
}
if (oldSelectedArea != null) {
double ratioOfOldArea = featureAreaToConsider.getArea() /
oldSelectedArea.getArea();
/*
* Ideally, we would only allow the exact same area, but due to
* possible loss of precision in all of the calculations, we
* allow >= 0.999.
*/
return ratioOfOldArea >= .999
&& !filterCheck(oldSelectedArea, geom, areaOfGeom);
}
}
return false;
}
private boolean isOldAreaOutsidePolygon(GeospatialData f) {
Set<String> fipsOutsidePolygon = state.getFipsOutsidePolygon();
if (fipsOutsidePolygon != null)
return fipsOutsidePolygon.contains(getFips(f));
return false;
}
/**
* Warned area to shade in lat/lon space
@ -1888,7 +2090,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
state.setWarningPolygon(warnPolygon);
state.setWarningArea(getWarningAreaFromPolygon(
state.getWarningPolygon(), record));
updateWarnedAreas(true);
updateWarnedAreas(true, true);
}
private DataTime recordFrameTime(AbstractWarningRecord warnRecord) {
@ -2266,9 +2468,6 @@ public class WarngenLayer extends AbstractStormTrackResource {
}
state.setWarningArea(tmp);
for (String gid : gids) {
removedGids.add(gid);
}
} else {
String featureFips = getFips(f);
Collection<GeospatialData> dataWithFips = getDataWithFips(featureFips);
@ -2277,7 +2476,8 @@ public class WarngenLayer extends AbstractStormTrackResource {
Set<String> fipsIds = getAllFipsInArea(oldWarningArea);
if (fipsIds.contains(featureFips) == false) {
break;
} else if (oldWarningPolygon.contains(point) == true) {
} else if (oldWarningPolygon.contains(point) == true
|| isOldAreaOutsidePolygon(f)) {
// Get intersecting parts for each geom with
// matching fips
List<Geometry> fipsParts = new ArrayList<Geometry>(
@ -2294,10 +2494,9 @@ public class WarngenLayer extends AbstractStormTrackResource {
geom = GeometryUtil.intersection(
warningPolygon, geom);
}
state.setWarningArea(GeometryUtil.union(
state.getWarningArea(), geom));
for (String gid : gids) {
removedGids.remove(gid);
if (filterArea(f, geom, false)) {
state.setWarningArea(GeometryUtil.union(
state.getWarningArea(), geom));
}
}
} else {
@ -2335,6 +2534,23 @@ public class WarngenLayer extends AbstractStormTrackResource {
.getFipsField());
}
private String getFips(Geometry g) {
Object o = g.getUserData();
if (o != null) {
return getFips(((CountyUserData) o).entry);
} else {
for (int n = 0; n < g.getNumGeometries(); ++n) {
Geometry g2 = g.getGeometryN(n);
if (g != g2) {
String fips = getFips(g2);
if (fips != null)
return fips;
}
}
}
return null;
}
private void warningAreaChanged() {
state.snappedToArea = false;
if (areaHatcher != null) {
@ -2363,13 +2579,20 @@ public class WarngenLayer extends AbstractStormTrackResource {
}
private Geometry removeCounty(Geometry warningArea, String fipsToRemove) {
Set<String> set = new HashSet<String>();
set.add(fipsToRemove);
return removeCounties(warningArea, set);
}
private Geometry removeCounties(Geometry warningArea, Set<String> fipsToRemove) {
if (fipsToRemove == null || fipsToRemove.isEmpty())
return warningArea;
List<Geometry> toKeep = new ArrayList<Geometry>(
warningArea.getNumGeometries());
for (int n = 0; n < warningArea.getNumGeometries(); ++n) {
Geometry area = warningArea.getGeometryN(n);
CountyUserData userData = (CountyUserData) area.getUserData();
String areaFips = getFips(userData.entry);
if (fipsToRemove.equals(areaFips) == false) {
String areaFips = getFips(area);
if (fipsToRemove.contains(areaFips) == false) {
toKeep.add(area);
}
}
@ -2571,7 +2794,113 @@ public class WarngenLayer extends AbstractStormTrackResource {
this.warningAction = warningAction;
}
public void initRemovedGids() {
removedGids.clear();
/**
* Adjust the location of vertexes that cause polygon self-crossing.
*/
private Polygon adjustVertex(Polygon p) {
GeometryFactory gf = new GeometryFactory();
LinearRing lr;
Coordinate coord[] = p.getCoordinates();
int length = coord.length;
Coordinate intersectCoord = null;
int index[] = new int[6];
LineSegment ls1, ls2;
double d[] = new double[6];
int indexOfTheOtherEnd[] = new int[2];
boolean isPolygonValid = false;
outerLoop: for (int skippedSegment = 1; skippedSegment < length - 3; skippedSegment++) {
for (int i = 0; i < length - 1; i++) {
index[0] = i;
index[1] = index[0] + 1;
index[2] = index[1] + skippedSegment;
if (index[2] >= length)
index[2] = index[2] - length + 1;
index[3] = index[2] + 1;
if (index[3] >= length)
index[3] = index[3] - length + 1;
ls1 = new LineSegment(coord[index[0]],coord[index[1]]);
ls2 = new LineSegment(coord[index[2]],coord[index[3]]);
intersectCoord = ls1.intersection(ls2);
if (intersectCoord != null) {
for (int j = 0; j < index.length-2; j++) {
d[j] = calculateDistance(intersectCoord,coord[index[j]]);
}
if (d[0] < d[1]) {
index[4] = index[0];
d[4] = d[0];
indexOfTheOtherEnd[0] = index[1];
} else {
index[4] = index[1];
d[4] = d[1];
indexOfTheOtherEnd[0] = index[0];
}
if (d[2] < d[3]) {
index[5] = index[2];
d[5] = d[2];
indexOfTheOtherEnd[1] = index[3];
} else {
index[5] = index[3];
d[5] = d[3];
indexOfTheOtherEnd[1] = index[2];
}
// index of the vertex on a line segment (line segment A), which will be moved along line segment A.
int replaceIndex;
// index of the vertex at the other end of line segment A.
int theOtherIndex;
if (d[4] < d[5]) {
replaceIndex = index[4];
theOtherIndex = indexOfTheOtherEnd[0];
} else {
replaceIndex= index[5];
theOtherIndex = indexOfTheOtherEnd[1];
}
// move the bad vertex, which is on line segment A and has the shortest distance to intersectCoord,
// along line segment A to the other side of line segment B which intersects with line segment A.
double delta;
double min = 0.00001;
if (Math.abs(intersectCoord.x - coord[replaceIndex].x) < min) {
// move the bad vertex along a vertical line segment.
delta = intersectCoord.y - coord[theOtherIndex].y;
coord[replaceIndex].y += 0.01 * (delta / Math.abs(delta));
} else if (Math.abs(intersectCoord.y - coord[replaceIndex].y) < min) {
// move the bad vertex along a horizontal line segment.
delta = intersectCoord.x - coord[theOtherIndex].x;
coord[replaceIndex].x += 0.01 * (delta / Math.abs(delta));
} else {
// move the bad vertex along a line segment which is neither vertical nor horizontal.
double slope = computeSlope(coord, replaceIndex, theOtherIndex);
delta = coord[theOtherIndex].y - intersectCoord.y;
coord[replaceIndex].y = intersectCoord.y + 0.005 * (delta / Math.abs(delta));
coord[replaceIndex].x = (coord[replaceIndex].y - coord[theOtherIndex].y) / slope
+ coord[theOtherIndex].x;
}
PolygonUtil.round(coord, 2);
if (replaceIndex == 0)
coord[length-1] = new Coordinate(coord[replaceIndex]);
else if (replaceIndex == length - 1)
coord[0] = new Coordinate(coord[replaceIndex]);
lr = gf.createLinearRing(coord);
p = gf.createPolygon(lr, null);
isPolygonValid = p.isValid();
if (isPolygonValid)
break outerLoop;
}
}
}
return p;
}
private double calculateDistance(Coordinate c1, Coordinate c2) {
return Math.sqrt(Math.pow(c1.x - c2.x, 2) + Math.pow(c1.y - c2.y, 2));
}
public double computeSlope(Coordinate[] coords, int i, int j) {
double min = 1.0E-08;
double dx = coords[i].x-coords[j].x;
double slope = 0.0;
if (Math.abs(dx)>min) {
slope = (coords[i].y-coords[j].y)/dx;
}
return slope;
}
}

View file

@ -63,6 +63,7 @@ import com.vividsolutions.jts.geom.Polygon;
* AddVertexAction, DeleteVertextAction and MoveElementAction inner classes.
* Jan 30, 2013 15439 Qinglu Lin Code were added to prevent nullPointException from occurring
* when c2 is null for "case SINGLE_POINT" in move().
* Mar 28, 2013 DR 15974 D. Friedman Do not track removed GIDs.
*
* </pre>
*
@ -360,7 +361,6 @@ public class WarngenUIManager extends InputAdapter {
}
private void move(int x, int y) {
warngenLayer.initRemovedGids();
IDisplayPaneContainer container = warngenLayer.getResourceContainer();
WarngenUIState state = warngenLayer.getWarngenState();
@ -416,7 +416,6 @@ public class WarngenUIManager extends InputAdapter {
return;
}
warngenLayer.initRemovedGids();
Coordinate[] coords = warngenLayer.getPolygon().getCoordinates();
int idx = StormTrackUIManager.getCoordinateIndex(warngenLayer,
@ -519,7 +518,6 @@ public class WarngenUIManager extends InputAdapter {
private class MoveElementAction extends AbstractRightClickAction {
@Override
public void run() {
warngenLayer.initRemovedGids();
moveType = MoveType.ALL_POINTS;
movePointIndex = StormTrackUIManager.getCoordinateIndex(
warngenLayer, warngenLayer.getPolygon().getCoordinates(),
@ -549,7 +547,6 @@ public class WarngenUIManager extends InputAdapter {
return;
}
warngenLayer.initRemovedGids();
Coordinate c = new Coordinate(lastMouseX, lastMouseY);
Polygon poly = warngenLayer.getPolygon();

View file

@ -44,6 +44,7 @@ import com.vividsolutions.jts.geom.Polygon;
* 12/06/2012 DR 15559 Qinglu Lin Added computeSlope(), computeCoordinate(),
* and adjustPolygon().
* Feb 15, 2013 1624 jsanchez Fix NullPointerException in removeDuplicateCoordinate.
* 03/28/2013 DR 15974 D. Friedman Track marked areas outside polygon.
*
* </pre>
*
@ -77,6 +78,8 @@ public class WarngenUIState {
public FollowupData followupData = null;
private Set<String> fipsOutsidePolygon = null;
/**
* Get the warning area in lat/lon projection
*
@ -326,6 +329,14 @@ public class WarngenUIState {
this.warningPolygon = removeDuplicateCoordinate(warningPolygon);
}
public Set<String> getFipsOutsidePolygon() {
return fipsOutsidePolygon;
}
public void setFipsOutsidePolygon(Set<String> gidsOutsidePolygon) {
this.fipsOutsidePolygon = gidsOutsidePolygon;
}
public void clear() {
warningPolygon = null;
clear2();
@ -344,6 +355,7 @@ public class WarngenUIState {
warningArea = null;
markedWarningArea = null;
markedWarningPolygon = null;
fipsOutsidePolygon = null;
}
/**

View file

@ -95,6 +95,7 @@ import com.raytheon.uf.edex.database.query.DatabaseQuery;
* 1-3-2013 DR 15667 M.Porricelli Made EnvironParamsLevelTable.xml
* accessible from SITE level
* 03/04/2013 DR 14770 D. Friedman Correct clipped grid coordinates.
* 03/21/2013 DR 15872 D. Friedman Correct grid orientation.
**/
public class RPGEnvironmentalDataManager {
private static final transient IUFStatusHandler statusHandler = UFStatus
@ -584,6 +585,12 @@ public class RPGEnvironmentalDataManager {
double cx2 = stationXY.x + delta;
double cy2 = stationXY.y + delta;
/*
* Note the y-coordinate flipping below. The output grid scans west
* to east, south to north, while the input grid from EDEX scans
* north to south.
*/
DirectPosition2D c = new DirectPosition2D();
crsToGrid.transform(new DirectPosition2D(cx1, cy1), c);
i1 = (int) Math.round(c.x);
@ -785,17 +792,24 @@ public class RPGEnvironmentalDataManager {
return null;
}
/*
* Note the y-coordinate flipping below. The output grid scans west
* to east, south to north, while the input grid from EDEX scans
* north to south.
*/
float[] data = dataRecord.getFloatData();
float[] clippedData = new float[grid.getPointCount()];
int stride = domain.getSpan(0);
int iidx = clip.getLow(0) + clip.getLow(1) * stride;
int iidx = clip.getLow(0) +
(domain.getHigh(1) - clip.getLow(1)) * stride;
int oidx = 0;
for (int j = 0; j < clippedNy; ++j) {
for (int i = 0; i < clippedNx; ++i) {
clippedData[oidx++] = data[iidx + i];
}
iidx += stride;
iidx -= stride;
}
grid.data = clippedData;

View file

@ -29,23 +29,23 @@
<!-- EDEX unit is actually "gpm" -->
<field name="GH" units="m" description="Geopotential Height">
<level name="MB" description="Pressure Level" units="mb"
levels="1000 950 900 850 800 750 700 650 600 550 500 450 400 350 300 250 200 150 100" />
levels="1000 975 950 925 900 875 850 825 800 775 750 725 700 675 650 625 600 575 550 525 500 475 450 425 400 375 350 325 300 250 200 150 100" />
</field>
<field name="RH" units="%" description="Relative Humidity">
<level name="MB" description="Pressure Level" units="mb"
levels="1000 950 900 850 800 750 700 650 600 550 500 450 400 350 300" />
levels="1000 975 950 925 900 875 850 825 800 775 750 725 700 675 650 625 600 575 550 525 500 475 450 425 400 375 350 325 300 250 200 150 100" />
</field>
<field name="T" units="K" description="Temperature">
<level name="MB" description="Pressure Level" units="mb"
levels="1000 950 900 850 800 750 700 650 600 550 500 450 400 350 300 250 200 150 100" />
levels="1000 975 950 925 900 875 850 825 800 775 750 725 700 675 650 625 600 575 550 525 500 475 450 425 400 375 350 325 300 250 200 150 100" />
</field>
<field name="uW" description="U Wind Component" units="m/s">
<level name="MB" description="Pressure Level" units="mb"
levels="1000 950 900 850 800 750 700 650 600 550 500 450 400 350 300 250 200 150 100" />
levels="1000 975 950 925 900 875 850 825 800 775 750 725 700 675 650 625 600 575 550 525 500 475 450 425 400 375 350 325 300 250 200 150 100" />
</field>
<field name="vW" description="V Wind Component" units="m/s">
<level name="MB" description="Pressure Level" units="mb"
levels="1000 950 900 850 800 750 700 650 600 550 500 450 400 350 300 250 200 150 100" />
levels="1000 975 950 925 900 875 850 825 800 775 750 725 700 675 650 625 600 575 550 525 500 475 450 425 400 375 350 325 300 250 200 150 100" />
</field>
<field name="P" units="Pa" description="Pressure">
<level name="SFC" description="Surface Level" units="" />

View file

@ -7,5 +7,9 @@ Bundle-Vendor: RAYTHEON
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: com.raytheon.edex.common;bundle-version="1.12.1174",
com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1174",
javax.persistence;bundle-version="1.0.0"
javax.persistence;bundle-version="1.0.0",
org.apache.commons.lang;bundle-version="2.3.0",
com.raytheon.uf.common.status;bundle-version="1.12.1174"
Export-Package: com.raytheon.uf.common.tafqueue
Import-Package: com.raytheon.uf.common.localization,
org.apache.commons.configuration

View file

@ -48,6 +48,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* ------------ ---------- ----------- --------------------------
* Aug 27, 2009 avarani Initial creation
* Apr 30, 2012 14715 rferrel Refactored and moved.
* Mar 21, 2013 15375 zhao Modified getInfo() to also handle VFT product
*
* </pre>
*
@ -117,9 +118,9 @@ public class TafQueueRecord implements IPersistableDataObject,
@Column
private boolean display;
public TafQueueRecord() {
super();
}
public TafQueueRecord() {
super();
}
/**
* Construct a record with the desired values.
@ -157,10 +158,14 @@ public class TafQueueRecord implements IPersistableDataObject,
* @return info
*/
public String getInfo() {
String productTag = "TAF";
if ( forecasterId == TafQueueVftConfigMgr.getInstance().getFcstid() ) { // for VFT product (DR15375)
productTag = "VFT";
}
return String
.format("%1$03d-%7$s%8$s%5$s-%6$s-%7$s-%2$ty%2$tm%2$td%2$tH%2$tM-%4$s-%9$d",
forecasterId, headerTime, tafText, bbb, siteId, wmoId,
stationId, "TAF", (xmitTime.getTime() / 1000));
stationId, productTag, (xmitTime.getTime() / 1000));
}
/**

View file

@ -0,0 +1,173 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.tafqueue;
import java.io.File;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.HierarchicalINIConfiguration;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
/**
* This class is used to read in configuration for AvnFPS verification (VFT) product.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 21, 2013 15375 zhao Initial creation
*
* </pre>
*
* @author zhao
*
*/
public class TafQueueVftConfigMgr {
private final IUFStatusHandler statusHandler = UFStatus.getHandler(TafQueueVftConfigMgr.class);
private static TafQueueVftConfigMgr instance = null;
private String wmoid = "NXUS98"; // default, to be replaced by wmo in config file
private String siteid = "OAX"; // default (siteid in taf_queue table)
private String stationid = "KOAX"; // default (stationid in taf_queue table)
private int fcstid = 0; // default forecasterid for VFT
private int period = 6; // number of hours; default period for VFT product creation, to be replaced by period in config file
/**
* BBB field for VFT product; non-configurable
*/
private String bbb = "___";
private static final String XMIT_FILE = "aviation" + File.separator + "config" + File.separator + "xmit.cfg";
private HierarchicalINIConfiguration xmitConfig = null;
public static TafQueueVftConfigMgr getInstance() {
if ( instance == null ) {
instance = new TafQueueVftConfigMgr();
}
return instance;
}
private TafQueueVftConfigMgr() {
// read in configuration
loadXmitConfigFile();
if ( xmitConfig != null ) {
readConfiguration();
}
}
private void loadXmitConfigFile() {
IPathManager pm = PathManagerFactory.getPathManager();
LocalizationContext context = pm.getContext(LocalizationType.CAVE_STATIC, LocalizationLevel.SITE);
LocalizationFile lFile = pm.getLocalizationFile(context, XMIT_FILE);
HierarchicalINIConfiguration config = new HierarchicalINIConfiguration();
config.setDelimiterParsingDisabled(true);
try {
config.load(lFile.getFile());
} catch (ConfigurationException e) {
statusHandler.handle(Priority.PROBLEM, "Tafqueue VFT Configuration Manager: loading xmit.cfg file failed.\n" + e.getLocalizedMessage(), e);
return;
}
this.xmitConfig =config;
}
private void readConfiguration() {
try {
String wmo = xmitConfig.getString("verification.wmo");
String [] wmosplits = wmo.split(" ");
wmoid = wmosplits[0];
stationid = wmosplits[1];
siteid = stationid.substring(1);
String fcstidStr = xmitConfig.getString("verification.fcstid");
fcstid = Integer.parseInt(fcstidStr);
String periodStr = xmitConfig.getString("verification.period");
period = Integer.parseInt(periodStr);
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM, "Tafqueue VFT Configuration Manager: error occurred while reading configuration.\n" + e.getLocalizedMessage(), e);
e.printStackTrace();
return;
}
statusHandler.handle(Priority.INFO, "Tafqueue VFT Configuration Manager: wmo = " + wmoid + " " + stationid + "; forecasterid = " + fcstid + "; period = " + period );
return;
}
public String getWmoid() {
return wmoid;
}
public void setWmoid(String wmoid) {
this.wmoid = wmoid;
}
public String getSiteid() {
return siteid;
}
public void setSiteid(String siteid) {
this.siteid = siteid;
}
public String getStationid() {
return stationid;
}
public void setStationid(String stationid) {
this.stationid = stationid;
}
public int getFcstid() {
return fcstid;
}
public void setFcstid(int fcstid) {
this.fcstid = fcstid;
}
public int getPeriod() {
return period;
}
public void setPeriod(int period) {
this.period = period;
}
public String getBbb() {
return bbb;
}
public void setBbb(String bbb) {
this.bbb = bbb;
}
}

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry exported="true" kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -10,4 +10,8 @@ Require-Bundle: com.raytheon.edex.common;bundle-version="1.12.1174",
com.raytheon.uf.common.tafqueue;bundle-version="1.0.0",
com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1174",
com.raytheon.uf.common.status;bundle-version="1.12.1174",
javax.persistence;bundle-version="1.0.0"
javax.persistence;bundle-version="1.0.0",
org.apache.commons.lang;bundle-version="2.3.0"
Import-Package: com.raytheon.uf.common.localization,
org.apache.commons.configuration
Export-Package: com.raytheon.uf.edex.tafqueue

View file

@ -44,6 +44,7 @@ import com.raytheon.uf.edex.database.query.DatabaseQuery;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 1, 2012 14715 rferrel Initial creation
* Mar 21, 2013 15375 zhao Added methods for handling VFT product
*
* </pre>
*
@ -274,4 +275,42 @@ public class TafQueueDao extends CoreDao {
}
return records.size();
}
/**
* (for DR15375)
* Get last xmit time for a forecaster id (for VFT purpose)
* @param forecasterid
* @return last xmittime; return null if no record exists
* @throws DataAccessLayerException
*/
@SuppressWarnings("unchecked")
public Date getLastXmitTimeByForecasterId(int forecasterid) throws DataAccessLayerException {
Date lastXmittime = null;
DatabaseQuery query = new DatabaseQuery(TafQueueRecord.class.getName());
query.addQueryParam("forecasterId", forecasterid, QueryOperand.EQUALS);
query.addOrder("xmitTime", false);
List<TafQueueRecord> records = (List<TafQueueRecord>) queryByCriteria(query);
if ( records.size() > 0 ) {
lastXmittime = records.get(0).getXmitTime();
}
return lastXmittime;
}
/** (for DR15375)
* Retrieves a list of TAF records sent since the last VFT product was created
* @param lastVftTime (last VFT creation time)
* @param forecasterid (forecaster ID for VFT)
* @return a list of TAF records sent since lastVftTime or null when no such records exit
* @throws DataAccessLayerException
*/
@SuppressWarnings("unchecked")
public List<TafQueueRecord> getRecordsForVFT(Date lastVftTime, int forecasterid) throws DataAccessLayerException {
DatabaseQuery query = new DatabaseQuery(TafQueueRecord.class.getName());
query.addQueryParam("xmitTime", lastVftTime, QueryOperand.GREATERTHANEQUALS);
query.addQueryParam("forecasterId", forecasterid, QueryOperand.NOTEQUALS);
query.addQueryParam("state", TafQueueState.SENT, QueryOperand.EQUALS);
query.addOrder("xmitTime", true);
List<TafQueueRecord> records = (List<TafQueueRecord>) queryByCriteria(query);
return records;
}
}

View file

@ -48,6 +48,7 @@ import com.raytheon.uf.edex.database.DataAccessLayerException;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 10, 2012 14715 rferrel Initial creation
* Mar 21, 2013 15375 zhao Modified to also handle AvnFPS VFT product
*
* </pre>
*
@ -240,9 +241,16 @@ public class TafQueueManager implements Runnable {
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
Date nextPurgeTime = cal.getTime();
/**
* (for DR15375)
*/
TafQueueVFTMgr vftMgr = TafQueueVFTMgr.getInstance();
Date nextVftTime = null;
while (true) {
try {
processList = dao.getRecordsToSend();
if (processList.size() > 0) {
@ -250,6 +258,16 @@ public class TafQueueManager implements Runnable {
// more PENDING may have been added while sending
continue;
}
/**
* (for DR15375)
*/
nextVftTime = vftMgr.getNextVftTime();
if ( nextVftTime.compareTo(Calendar.getInstance().getTime()) <= 0 ) {
vftMgr.makeVftProduct();
// transmit immediately
continue;
}
if (nextPurgeTime.compareTo(Calendar.getInstance().getTime()) <= 0) {
purgeExpiredData(dao);
@ -266,11 +284,18 @@ public class TafQueueManager implements Runnable {
nextProccessTime = nextPurgeTime;
} else if (nextProccessTime.compareTo(nextPurgeTime) > 0) {
nextProccessTime = nextPurgeTime;
} else if (nextProccessTime.compareTo(Calendar.getInstance()
.getTime()) <= 0) {
} else if (nextProccessTime.compareTo(Calendar.getInstance().getTime()) <= 0) {
// immediate transmit placed on queue while processing.
continue;
}
/**
* (DR15375)
*/
nextVftTime = vftMgr.getNextVftTime();
if ( nextVftTime.compareTo(nextProccessTime) < 0 ) {
nextProccessTime = nextVftTime;
}
synchronized (this) {
long timeOut = nextProccessTime.getTime()

View file

@ -0,0 +1,204 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.edex.tafqueue;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.TimeZone;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.tafqueue.TafQueueRecord;
import com.raytheon.uf.common.tafqueue.TafQueueVftConfigMgr;
import com.raytheon.uf.edex.database.DataAccessLayerException;
/**
* This class is used to create AvnFPS verification (VFT) products.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 07, 2013 15375 zhao Initial creation
*
* </pre>
*
* @author zhao
*
*/
public class TafQueueVFTMgr {
private final IUFStatusHandler statusHandler = UFStatus.getHandler(TafQueueVFTMgr.class);
private static TafQueueVFTMgr instance = null;
private TafQueueVftConfigMgr config = null;
private String wmoid = "NXUS98"; // default, to be replaced by wmo in config file
private String siteid = "OAX"; // default (siteid in taf_queue table)
private String stationid = "KOAX"; // default (stationid in taf_queue table)
private int fcstid = 0; // default forecasterid for VFT
private int period = 6; // number of hours; default period of VFT product creation, to be replaced by period in config file
private String bbb = "___"; // default BBB field for a VFT product
private Date lastVftTime = null;
private Date nextVftTime = null;
private TafQueueVFTMgr() {
init();
statusHandler.handle(Priority.INFO, "Tafqueue VFT manager created.");
}
/**
* Create an AvnFPS VFT product, and updates time for next VFT product
*/
public void makeVftProduct() {
TafQueueDao dao = new TafQueueDao();
Calendar cal = Calendar.getInstance();
cal.setTimeZone(TimeZone.getTimeZone("GMT"));
nextVftTime = cal.getTime();
try {
List<TafQueueRecord> records = dao.getRecordsForVFT(lastVftTime, fcstid);
if (records != null) {
if (records.size() > 0) {
StringBuilder sb = new StringBuilder();
for (TafQueueRecord record : records) {
sb.append(formatVftTafRecord(record));
sb.append("\n");
}
String vftText = sb.toString();
vftText = vftText.substring(0, vftText.length()-1);
TafQueueRecord vftRecord = new TafQueueRecord(fcstid, nextVftTime, vftText, bbb, siteid, wmoid, stationid, nextVftTime);
dao.create(vftRecord);
}
}
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM,"Tafqueue VFT manager: error occurred while making a VFT product.\n" + e.getLocalizedMessage(), e);
}
lastVftTime = nextVftTime;
statusHandler.handle(Priority.INFO, "Tafqueue VFT manager: Last VFT xmit time = " + lastVftTime.toString());
cal.add(Calendar.HOUR_OF_DAY, period);
nextVftTime = cal.getTime();
statusHandler.handle(Priority.INFO, "Tafqueue VFT manager: Next VFT xmit time = " + nextVftTime.toString());
}
private String formatVftTafRecord(TafQueueRecord record) {
String tafText = record.getTafText();
int indexOfTafPeriod = tafText.indexOf('/');
String tafPeriod = tafText.substring(indexOfTafPeriod-4, indexOfTafPeriod+5);
String tafBbb = record.getBbb();
if ( tafBbb.equals("") || tafBbb.equals(" ") ) {
tafBbb = "___";
}
return String.format("%1$s %2$s %3$ty%3$tm%3$td%3$tH%4$s " +
"%5$s %6$s %7$ty%7$tm%7$td%7$tH%7$tm%8$s %9$s %10$03d",
record.getWmoId(), record.getStationId(), record.getHeaderTime(), "00",
tafBbb, record.getStationId().charAt(0)+record.getSiteId(),
record.getXmitTime(), "Z", tafPeriod, record.getForecasterId());
}
private void init() {
config = TafQueueVftConfigMgr.getInstance();
wmoid = config.getWmoid();
siteid = config.getSiteid();
stationid = config.getStationid();
fcstid = config.getFcstid();
period = config.getPeriod();
bbb = config.getBbb();
// determine lastVftTime and nextVftTime
TafQueueDao dao = new TafQueueDao();
try {
lastVftTime = dao.getLastXmitTimeByForecasterId(fcstid);
} catch (DataAccessLayerException e) {
statusHandler.handle(Priority.PROBLEM, "Tafqueue VFT manager: error occurred while querying for last VFT xmit time.\n" + e.getLocalizedMessage(), e);
}
Calendar cal = Calendar.getInstance();
cal.setTimeZone(TimeZone.getTimeZone("GMT"));
if ( lastVftTime == null ) {
nextVftTime = cal.getTime();
cal.add(Calendar.HOUR_OF_DAY, -period);
lastVftTime = cal.getTime();
} else {
cal.setTime(lastVftTime);
cal.add(Calendar.HOUR_OF_DAY, period);
nextVftTime = cal.getTime();
}
statusHandler.handle(Priority.INFO, "Tafqueue VFT manager: Last VFT xmit time = " + lastVftTime.toString());
statusHandler.handle(Priority.INFO, "Tafqueue VFT manager: Next VFT xmit time = " + nextVftTime.toString());
}
public static TafQueueVFTMgr getInstance() {
if ( instance == null ) {
instance = new TafQueueVFTMgr();
}
return instance;
}
public void setWmoid(String wmoid) {
this.wmoid = wmoid;
}
public String getWmoid() {
return wmoid;
}
public void setPeriod(int period) {
this.period = period;
}
public int getPeriod() {
return period;
}
public void setSiteid(String siteid) {
this.siteid = siteid;
}
public String getSiteid() {
return siteid;
}
public void setStationid(String stationid) {
this.stationid = stationid;
}
public String getStationid() {
return stationid;
}
public void setFcstid(int fcstid) {
this.fcstid = fcstid;
}
public int getFcstid() {
return fcstid;
}
public Date getNextVftTime() {
return nextVftTime;
}
}

View file

@ -57,6 +57,9 @@ public class NsharpDataPageProperty implements ISerializableObject{
@XmlAttribute
private int severePotentialPage=NsharpConstants.PAGE_SEVERE_POTENTIAL;
@XmlAttribute
private int numberPagePerDisplay = 1;
public int getSummary1Page() {
return summary1Page;
}
@ -136,5 +139,13 @@ public class NsharpDataPageProperty implements ISerializableObject{
public void setSeverePotentialPage(int severePotentialPage) {
this.severePotentialPage = severePotentialPage;
}
public int getNumberPagePerDisplay() {
return numberPagePerDisplay;
}
public void setNumberPagePerDisplay(int numberPagePerDisplay) {
this.numberPagePerDisplay = numberPagePerDisplay;
}
}

View file

@ -870,14 +870,14 @@ public class NsharpEditor extends AbstractEditor implements AddListener,
super.init(site, edInput);
//System.out.println("SkewtEditor title " + this.getTitle() );
if (editorNum == 0 ){
editorNum = EditorManager.getEditorNumber();
}
// a new instance, do the registration
EditorManager.registerEditorNumber(editorNum);
this.setTabTitle(editorNum+"-NsharpEditor");
//System.out.println("SkewtEditor title " + this.getTitle() );
if (editorNum == 0 ){
editorNum = EditorManager.getEditorNumber();
}
// a new instance, do the registration
EditorManager.registerEditorNumber(editorNum);
this.setTabTitle(editorNum+"-NsharpEditor");
//Note: NsharpResourceHandler should be created after editor is created, so all display pane properties and
// pane resource are also constructed
@ -969,9 +969,9 @@ public class NsharpEditor extends AbstractEditor implements AddListener,
// bsteffen only dispose the rscHandler if not swapping.
if(!displayArray[DISPLAY_SKEWT].isSwapping()){
if(rscHandler!=null){
rscHandler.disposeInternal();
}
}
rscHandler.disposeInternal();
}
}
rscHandler = null;
}
}
@ -1030,10 +1030,10 @@ public class NsharpEditor extends AbstractEditor implements AddListener,
displayArray = null;
nsharpComp=null;
if(displayPane!=null){
for (VizDisplayPane pane: displayPane){
for (VizDisplayPane pane: displayPane){
if(pane!=null)
pane.dispose();
}
pane.dispose();
}
}
displayPane = null;
rightTopGp= leftTopGp= leftBotGp= leftGp= rightGp= topGp= botGp=null;
@ -1060,10 +1060,10 @@ public class NsharpEditor extends AbstractEditor implements AddListener,
@Override
public void refresh() {
if(displayPane!= null)
for (IDisplayPane pane : displayPane) {
for (IDisplayPane pane : displayPane) {
if(pane!=null)
pane.refresh();
}
pane.refresh();
}
//System.out.println("NsharpEditor refresh called");
}
@Override
@ -1093,14 +1093,14 @@ public class NsharpEditor extends AbstractEditor implements AddListener,
}
if(rscHandler!=null) {
if(rscHandler.getWitoPaneRsc()!=null){
rscHandler.getWitoPaneRsc().createAllWireFrameShapes();
}
rscHandler.getWitoPaneRsc().createAllWireFrameShapes();
}
//rscHandler.getSkewtPaneRsc().handleZooming();
}
}
public void registerMouseHandler(IInputHandler handler, IInputHandler.InputPriority priority) {
if(skewtInputManager!=null)
skewtInputManager.registerMouseHandler(handler, priority);
skewtInputManager.registerMouseHandler(handler, priority);
}
/**
@ -1112,7 +1112,7 @@ public class NsharpEditor extends AbstractEditor implements AddListener,
@Override
public void registerMouseHandler(IInputHandler handler) {
if(skewtInputManager != null)
skewtInputManager.registerMouseHandler(handler);
skewtInputManager.registerMouseHandler(handler);
}
/**
@ -1254,9 +1254,9 @@ public class NsharpEditor extends AbstractEditor implements AddListener,
DISPLAY_FUTURE = -1;
DISPLAY_SPC_GRAPHS = -1;
}
nsharpComp = new Composite[DISPLAY_TOTAL];
displayPane = new VizDisplayPane[DISPLAY_TOTAL];
displayArray = new IRenderableDisplay[DISPLAY_TOTAL];
nsharpComp = new Composite[DISPLAY_TOTAL];
displayPane = new VizDisplayPane[DISPLAY_TOTAL];
displayArray = new IRenderableDisplay[DISPLAY_TOTAL];
}
/*
* Note: initDisplayPublicParms() should be called before calling this function
@ -1276,7 +1276,7 @@ public class NsharpEditor extends AbstractEditor implements AddListener,
displayArray[DISPLAY_DATA]= new NsharpDataPaneDisplay(new PixelExtent(NsharpConstants.DATA_DISPLAY_REC),DISPLAY_DATA);
displayArray[DISPLAY_TIMESTN]= new NsharpTimeStnPaneDisplay(new PixelExtent(NsharpConstants.TIMESTN_DISPLAY_REC),DISPLAY_TIMESTN);
displayArray[DISPLAY_FUTURE]= new NsharpAbstractPaneDisplay(new PixelExtent(NsharpConstants.FUTURE_DISPLAY_REC),DISPLAY_FUTURE);
}
}
else { // case of default1 and default 2 pane configurations
displayArray[DISPLAY_SKEWT]= new NsharpSkewTPaneDisplay(new PixelExtent(NsharpConstants.SKEWT_DISPLAY_REC),DISPLAY_SKEWT);
displayArray[DISPLAY_WITO]= new NsharpWitoPaneDisplay(new PixelExtent(NsharpConstants.WITO_DISPLAY_REC),DISPLAY_WITO);
@ -1284,76 +1284,76 @@ public class NsharpEditor extends AbstractEditor implements AddListener,
displayArray[DISPLAY_DATA]= new NsharpDataPaneDisplay(new PixelExtent(NsharpConstants.DATA_DISPLAY_REC),DISPLAY_DATA);
displayArray[DISPLAY_INSET]= new NsharpInsetPaneDisplay(new PixelExtent(NsharpConstants.INSET_DISPLAY_REC),DISPLAY_INSET);
displayArray[DISPLAY_TIMESTN]= new NsharpTimeStnPaneDisplay(new PixelExtent(NsharpConstants.TIMESTN_DISPLAY_REC),DISPLAY_TIMESTN);
}
}
return displayArray;
}
}
/*
* Note: initDisplayPublicParms() and createRenderableDisplayArray() should be called before calling this function
*/
private void createPaneResource(){
ResourcePair skewtRscPair = displayArray[DISPLAY_SKEWT].getDescriptor().getResourceList().get(0);
ResourcePair skewtRscPair = displayArray[DISPLAY_SKEWT].getDescriptor().getResourceList().get(0);
NsharpSkewTPaneResource skewtPaneRsc=null;
if (skewtRscPair.getResource() instanceof NsharpSkewTPaneResource){
if (skewtRscPair.getResource() instanceof NsharpSkewTPaneResource){
skewtPaneRsc = (NsharpSkewTPaneResource)skewtRscPair.getResource() ;
skewtPaneRsc.setRscHandler(rscHandler);
}
ResourcePair dataRscPair = displayArray[DISPLAY_DATA].getDescriptor().getResourceList().get(0);
if (dataRscPair.getResource() instanceof NsharpDataPaneResource){
NsharpDataPaneResource dataPaneRsc = (NsharpDataPaneResource)dataRscPair.getResource() ;
dataPaneRsc.setRscHandler(rscHandler);
}
ResourcePair hodoRscPair = displayArray[DISPLAY_HODO].getDescriptor().getResourceList().get(0);
if (hodoRscPair.getResource() instanceof NsharpHodoPaneResource){
NsharpHodoPaneResource hodoPaneRsc = (NsharpHodoPaneResource)hodoRscPair.getResource() ;
hodoPaneRsc.setRscHandler(rscHandler);
skewtPaneRsc.setRscHandler(rscHandler);
}
ResourcePair dataRscPair = displayArray[DISPLAY_DATA].getDescriptor().getResourceList().get(0);
if (dataRscPair.getResource() instanceof NsharpDataPaneResource){
NsharpDataPaneResource dataPaneRsc = (NsharpDataPaneResource)dataRscPair.getResource() ;
dataPaneRsc.setRscHandler(rscHandler);
}
ResourcePair hodoRscPair = displayArray[DISPLAY_HODO].getDescriptor().getResourceList().get(0);
if (hodoRscPair.getResource() instanceof NsharpHodoPaneResource){
NsharpHodoPaneResource hodoPaneRsc = (NsharpHodoPaneResource)hodoRscPair.getResource() ;
hodoPaneRsc.setRscHandler(rscHandler);
}
if(paneConfigurationName.equals(NsharpConstants.PANE_SPCWS_CFG_STR)||
paneConfigurationName.equals(NsharpConstants.PANE_DEF_CFG_1_STR)||
paneConfigurationName.equals(NsharpConstants.PANE_DEF_CFG_2_STR)){
ResourcePair witoRscPair = displayArray[DISPLAY_WITO].getDescriptor().getResourceList().get(0);
if (witoRscPair.getResource() instanceof NsharpWitoPaneResource){
NsharpWitoPaneResource witoPaneRsc = (NsharpWitoPaneResource)witoRscPair.getResource() ;
witoPaneRsc.setRscHandler(rscHandler);
}
if(paneConfigurationName.equals(NsharpConstants.PANE_SPCWS_CFG_STR)||
paneConfigurationName.equals(NsharpConstants.PANE_DEF_CFG_1_STR)||
paneConfigurationName.equals(NsharpConstants.PANE_DEF_CFG_2_STR)){
ResourcePair witoRscPair = displayArray[DISPLAY_WITO].getDescriptor().getResourceList().get(0);
if (witoRscPair.getResource() instanceof NsharpWitoPaneResource){
NsharpWitoPaneResource witoPaneRsc = (NsharpWitoPaneResource)witoRscPair.getResource() ;
witoPaneRsc.setRscHandler(rscHandler);
}
ResourcePair insetRscPair = displayArray[DISPLAY_INSET].getDescriptor().getResourceList().get(0);
if (insetRscPair.getResource() instanceof NsharpInsetPaneResource){
NsharpInsetPaneResource insetPaneRsc = (NsharpInsetPaneResource)insetRscPair.getResource() ;
insetPaneRsc.setRscHandler(rscHandler);
}
ResourcePair insetRscPair = displayArray[DISPLAY_INSET].getDescriptor().getResourceList().get(0);
if (insetRscPair.getResource() instanceof NsharpInsetPaneResource){
NsharpInsetPaneResource insetPaneRsc = (NsharpInsetPaneResource)insetRscPair.getResource() ;
insetPaneRsc.setRscHandler(rscHandler);
}
if(paneConfigurationName.equals(NsharpConstants.PANE_SPCWS_CFG_STR)){
ResourcePair spcGraphRscPair = displayArray[DISPLAY_SPC_GRAPHS].getDescriptor().getResourceList().get(0);
if (spcGraphRscPair.getResource() instanceof NsharpSpcGraphsPaneResource){
NsharpSpcGraphsPaneResource spcPaneRsc = (NsharpSpcGraphsPaneResource)spcGraphRscPair.getResource() ;
spcPaneRsc.setRscHandler(rscHandler);
}
}
if(paneConfigurationName.equals(NsharpConstants.PANE_SPCWS_CFG_STR)){
ResourcePair spcGraphRscPair = displayArray[DISPLAY_SPC_GRAPHS].getDescriptor().getResourceList().get(0);
if (spcGraphRscPair.getResource() instanceof NsharpSpcGraphsPaneResource){
NsharpSpcGraphsPaneResource spcPaneRsc = (NsharpSpcGraphsPaneResource)spcGraphRscPair.getResource() ;
spcPaneRsc.setRscHandler(rscHandler);
}
if(paneConfigurationName.equals(NsharpConstants.PANE_SIMPLE_D2D_CFG_STR)){
ResourcePair futureRscPair = displayArray[DISPLAY_FUTURE].getDescriptor().getResourceList().get(0);
}
if(paneConfigurationName.equals(NsharpConstants.PANE_SIMPLE_D2D_CFG_STR)){
ResourcePair futureRscPair = displayArray[DISPLAY_FUTURE].getDescriptor().getResourceList().get(0);
if (futureRscPair.getResource() instanceof NsharpAbstractPaneResource){
NsharpAbstractPaneResource futurePaneRsc = (NsharpAbstractPaneResource)futureRscPair.getResource() ;
futurePaneRsc.setRscHandler(rscHandler);
}
futurePaneRsc.setRscHandler(rscHandler);
}
if(paneConfigurationName.equals(NsharpConstants.PANE_SIMPLE_D2D_CFG_STR)||
paneConfigurationName.equals(NsharpConstants.PANE_DEF_CFG_1_STR)||
paneConfigurationName.equals(NsharpConstants.PANE_DEF_CFG_2_STR)){
ResourcePair timeStnRscPair = displayArray[DISPLAY_TIMESTN].getDescriptor().getResourceList().get(0);
if (timeStnRscPair.getResource() instanceof NsharpTimeStnPaneResource){
NsharpTimeStnPaneResource timeStnPaneRsc = (NsharpTimeStnPaneResource)timeStnRscPair.getResource() ;
timeStnPaneRsc.setRscHandler(rscHandler);
}
}
if(paneConfigurationName.equals(NsharpConstants.PANE_SIMPLE_D2D_CFG_STR)||
paneConfigurationName.equals(NsharpConstants.PANE_DEF_CFG_1_STR)||
paneConfigurationName.equals(NsharpConstants.PANE_DEF_CFG_2_STR)){
ResourcePair timeStnRscPair = displayArray[DISPLAY_TIMESTN].getDescriptor().getResourceList().get(0);
if (timeStnRscPair.getResource() instanceof NsharpTimeStnPaneResource){
NsharpTimeStnPaneResource timeStnPaneRsc = (NsharpTimeStnPaneResource)timeStnRscPair.getResource() ;
timeStnPaneRsc.setRscHandler(rscHandler);
}
}
if(skewtPaneRsc!=null){
skewtPaneRsc.setCurrentGraphMode(rscHandler.getCurrentGraphMode());
//skewtPaneRsc.handleResize();
}
}
}
private void updateEditor() {
initDisplayPublicParms();
@ -1706,7 +1706,7 @@ public class NsharpEditor extends AbstractEditor implements AddListener,
//System.out.println("After resizing...nsharpComp[1] w= " + nsharpComp[1].getBounds().width + " h= "+ nsharpComp[1].getBounds().height);
for(int i=0; i< DISPLAY_TOTAL; i++){
if(displayArray[i]!=null){
if(displayArray[i]!=null && displayArray[i].getDescriptor().getResourceList().isEmpty()== false){
ResourcePair rscPair = displayArray[i].getDescriptor().getResourceList().get(0);
if (rscPair.getResource() instanceof NsharpAbstractPaneResource){
NsharpAbstractPaneResource paneRsc = (NsharpAbstractPaneResource)rscPair.getResource() ;
@ -1799,10 +1799,10 @@ public class NsharpEditor extends AbstractEditor implements AddListener,
//System.out.println("Editor="+this.toString()+" renderableDisplayChanged ADD but not swapping"+" newRenderableDisplay="+newRenderableDisplay.toString());
}
return;
}
}
}
}
}
}
// else
// System.out.println("Editor="+this.toString()+" renderableDisplayChanged REMOVE called, pane = " + pane.toString()+" newRenderableDisplay="+newRenderableDisplay.toString());
}
}
}

View file

@ -124,7 +124,8 @@ public class NsharpAbstractPaneResource extends AbstractVizResource<AbstractReso
protected void paintInternal(IGraphicsTarget target,
PaintProperties paintProps) throws VizException {
this.paintProps = paintProps;
if(rscHandler== null)
this.target = target;
if(rscHandler== null || rscHandler.getSoundingLys()==null)
return;
float zoomLevel = paintProps.getZoomLevel();
/*if( currentCanvasBoundWidth!= paintProps.getCanvasBounds().width || currentCanvasBoundHeight!=paintProps.getCanvasBounds().height){
@ -311,6 +312,8 @@ public class NsharpAbstractPaneResource extends AbstractVizResource<AbstractReso
}
protected void defineCharHeight(IFont font){
if(paintProps == null)
return;
DrawableString str =new DrawableString("CHINCHEN",NsharpConstants.color_black);
str.font = font;
double vertRatio = paintProps.getView().getExtent().getHeight() / paintProps.getCanvasBounds().height;

View file

@ -86,7 +86,7 @@ public class NsharpResourceHandler {
private NsharpAbstractPaneResource futurePaneRsc;
//private Coordinate hodoStmCenter; //hodo storm motion center
NsharpNative nsharpNative=null;
private static final int DATAPAGEMAX = NsharpConstants.PAGE_MAX_NUMBER/ 2;
private int displayDataPageMax;
private static final int INSETPAGEMAX =2;
private int currentTextChapter= 1;
private int currentInsetPage= 1;
@ -266,7 +266,7 @@ public class NsharpResourceHandler {
public void setNextTextChapter(){
if(currentTextChapter == DATAPAGEMAX){
if(currentTextChapter == displayDataPageMax){
currentTextChapter = 1;
}
else
@ -431,14 +431,6 @@ public class NsharpResourceHandler {
this.soundingType = soundingType;
}
/*public static NsharpSkewTResource createSkewtResource() {
LoadProperties loadProperties1 = new LoadProperties();
ColorableCapability colorable1 = new ColorableCapability();
colorable1.setColor(NsharpConstants.backgroundColor);
loadProperties1.getCapabilities().addCapability(colorable1);
return new NsharpSkewTResource(new NsharpSkewTResourceData(),
loadProperties1);
}*/
public List<List<NcSoundingLayer>> getSoundingLysList() {
return soundingLysList;
@ -447,7 +439,7 @@ public class NsharpResourceHandler {
public void setCurrentParcel(short currentParcel) {
this.currentParcel = currentParcel;
currentParcelLayerPressure=NsharpNativeConstants.parcelToLayerMap.get(currentParcel);
//inform draw panel as well
//inform data/skewT panel as well
if(dataPaneRsc!=null){
dataPaneRsc.setCurrentParcel(currentParcel);
}
@ -455,64 +447,20 @@ public class NsharpResourceHandler {
if(currentParcel == NsharpNativeConstants.PARCELTYPE_USER_DEFINED)
currentParcelLayerPressure = NsharpParcelDialog.getUserDefdParcelMb();
skewtPaneRsc.createRscParcelTraceShapes(currentParcel,currentParcelLayerPressure);
skewtPaneRsc.createRscParcelRtTraceShapesList(currentParcel,currentParcelLayerPressure);
skewtPaneRsc.createLCLEtcLinesShape();
}
}
public void setCurrentParcelData(short currentParcel, float pressure) {
this.currentParcel = currentParcel;
currentParcelLayerPressure=pressure;
//inform draw panel as well
if(dataPaneRsc!=null){
dataPaneRsc.setCurrentParcel(currentParcel);
}
}
/*
* NOTE:::ONly one parcel will be in parcel list as current design changed to only show one configured parcel
* This is how BigNsharp does.
* Todo: replace List<ParcelData> with just one ParcelData
*/
/*public void setParcelList(List<ParcelData> parcelList) {
this.parcelList = parcelList;
if(skewtPaneRsc!=null)
skewtPaneRsc.createParcelShapes(parcelList);
}*/
public void updateParcelFromPanel(short currentParcel){
this.currentParcel = currentParcel;
currentParcelLayerPressure=NsharpNativeConstants.parcelToLayerMap.get(currentParcel);
if(skewtPaneRsc!=null){
skewtPaneRsc.createRscParcelTraceShapes(currentParcel,currentParcelLayerPressure);
skewtPaneRsc.createRscParcelRtTraceShapesList(currentParcel,currentParcelLayerPressure);
skewtPaneRsc.createLCLEtcLinesShape();
}
//update parcel shape
/*List<ParcelData> parcelList = new ArrayList<ParcelData>();
ParcelData pd= new ParcelData();
pd.setParcelType(currentParcel);
pd.setParcelLayerPressure(currentParcelLayerPressure);
parcelList.add(pd);
setParcelList(parcelList);*/
}
/*
* NOTE:::when called, it assumed that this new element is current parcel. Therefore caller has to make sure of this.
*
public void addParcelToList(ParcelData parceldata) {
boolean addToList = true;
for(ParcelData pdata : parcelList){
if((pdata.parcelType == parceldata.parcelType) && (pdata.parcelLayerPressure == parceldata.parcelLayerPressure)){
addToList= false;
break;
}
}
if(addToList== true)
this.parcelList.add(parceldata);
currentParcel = parceldata.getParcelType();
currentParcelLayerPressure = parceldata.getParcelLayerPressure();
NsharpBackgroundResource bkRsc = descriptor.getSkewTBkGResource();
WGraphics WGc = bkRsc.getSkewTBackground().getWorld();
createRscParcelTraceShape( WGc, parceldata.parcelType,parceldata.parcelLayerPressure);
}*/
public void setSoundingLysList(List<List<NcSoundingLayer>> soundingLysList) {
this.soundingLysList = soundingLysList;
@ -689,10 +637,13 @@ public class NsharpResourceHandler {
if(NsharpParcelDialog.getAccess()!=null){
NsharpParcelDialog.getAccess().resetUserDefParcel();
}
/* TBD
//reset draw panel as well
if(drawPanel!=null){
drawPanel.resetCurrentParcel();
/* Chin:::
* This api is called in may scenarios.
* User may want to keep his previous picked parcel type.
* Therefore, thdataPaneRsc.resetCurrentParcel should be called from
* other area that really meant to reset parcel type.
if(dataPaneRsc!=null){
dataPaneRsc.resetCurrentParcel();
}*/
}
//Chin: TBD remove handle resize here to fix sizing issue when swapped nsharp from side pane back to main pane
@ -1518,6 +1469,31 @@ public class NsharpResourceHandler {
}
}
public void addRsc(Map<String, List<NcSoundingLayer>> soundMap, NsharpStationInfo stnInfo, boolean displayNewData){
/* testing code
stnInfo.setStnId("KG RI");
{
Set<String> keyset= new HashSet<String>(soundMap.keySet());
for(String key: keyset) {
List<NcSoundingLayer> sndLy = soundMap.remove(key);
String newkey= key.replace("KGRI", "KG RI");
soundMap.put(newkey, sndLy);
}
}*/
if(stnInfo.getStnId() != null && stnInfo.getStnId().indexOf(" ")>=0){
//take care stnId with SPACE case.
String stnId= stnInfo.getStnId();
String newStnId = stnId.replace(" ", "_");
stnInfo.setStnId(newStnId);
String dspInfo= stnInfo.getStnDisplayInfo();
stnInfo.setStnDisplayInfo(dspInfo.replace(stnId, newStnId));
Set<String> keyset= new HashSet<String>(soundMap.keySet());
for(String key: keyset) {
List<NcSoundingLayer> sndLy = soundMap.remove(key);
String newkey= key.replace(stnId, newStnId);
soundMap.put(newkey, sndLy);
}
}
deepCopyDataMap(this.originalDataTimelineSndLysListMap,this.dataTimelineSndLysListMap);
//make sure not adding duplicated sounding data
//System.out.println("NsharpSkewTResource addRsc called");
@ -1627,6 +1603,7 @@ public class NsharpResourceHandler {
public void addRsc(Map<String, List<NcSoundingLayer>> soundMap, NsharpStationInfo stnInfo){
//by default, display new data
//NCP always call from this route.
this.addRsc(soundMap, stnInfo,true);
return;
}
@ -2177,7 +2154,7 @@ public class NsharpResourceHandler {
dataPaneRsc.setLinePropertyMap(linePropertyMap);
dataPaneRsc.setGraphConfigProperty(graphConfigProperty);
dataPaneRsc.setNsharpNative(nsharpNative);
dataPaneRsc.setPageDisplayOrderNumberArray(pageDisplayOrderNumberArray);
dataPaneRsc.setPageDisplayOrderNumberArray(pageDisplayOrderNumberArray, dataPageProperty.getNumberPagePerDisplay());
}
else if (absPaneRsc instanceof NsharpHodoPaneResource){
hodoPaneRsc = (NsharpHodoPaneResource)absPaneRsc;
@ -2249,7 +2226,7 @@ public class NsharpResourceHandler {
public NsharpResourceHandler(IRenderableDisplay[] displayArray, NsharpEditor editor) {
//System.out.println("NsharpResourceHandler constructed");
System.out.println("NsharpResourceHandler constructed");
//myNsharpEditor = editor;
this.soundingMap = new HashMap<Date, SoundingParams>();
elementColorMap.put(NsharpConstants.State.CURRENT,NsharpConstants.color_green); //green
@ -2284,6 +2261,7 @@ public class NsharpResourceHandler {
dataPageProperty = configStore.getDataPageProperty();
updatePageOrderArray();
updateDisplay(displayArray,paneConfigurationName);
displayDataPageMax = NsharpConstants.PAGE_MAX_NUMBER / dataPageProperty.getNumberPagePerDisplay();
//pspLsner = new NsharpPerspectiveListener();
//pspLsner.setRscHandler(this);
//pspLsner.setMyPerspectiveId(VizPerspectiveListener.getCurrentPerspectiveManager().getPerspectiveId());
@ -2328,7 +2306,7 @@ public class NsharpResourceHandler {
resetData();
}
public void disposeInternal() {
//System.out.println("NsharpSkewTResource disposeInternal called");
System.out.println("NsharpResourceHandler disposeInternal called");
soundingMap= null;
//parcelList= null;
listenerList=null;
@ -3014,7 +2992,7 @@ public class NsharpResourceHandler {
this.dataPageProperty = dataPageProperty;
updatePageOrderArray();
if(dataPaneRsc!=null)
dataPaneRsc.setPageDisplayOrderNumberArray(pageDisplayOrderNumberArray);
dataPaneRsc.setPageDisplayOrderNumberArray(pageDisplayOrderNumberArray, dataPageProperty.getNumberPagePerDisplay());
}
@ -3168,6 +3146,11 @@ public class NsharpResourceHandler {
}
public NsharpDataPaneResource getDataPaneRsc() {
return dataPaneRsc;
}
/*public void setCnYOrig(int cnYOrig) {
this.cnYOrig = cnYOrig;
}

View file

@ -41,6 +41,7 @@ import gov.noaa.nws.ncep.viz.common.ui.NmapCommon;
import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.locks.ReentrantLock;
@ -120,8 +121,9 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
private IShadedShape cloudFMShape = null;
private IWireframeShape cloudFMLabelShape = null;
private IShadedShape cloudCEShape = null;
private IWireframeShape parcelVtTraceRscShape; //Virtual temp Parcel trace
private IWireframeShape parcelRtRscShape; //Real temp parcel trace
private IWireframeShape parcelVtTraceRscShape; //Virtual temperature Parcel trace
//Real temperature parcel trace also considering comparison/overlay, therefore using a list
private List<NsharpShapeAndLineProperty> parcelRtShapeList = new ArrayList<NsharpShapeAndLineProperty>();
private IWireframeShape dacpeTraceRscShape;
private List<NsharpShapeAndLineProperty>pressureTempRscShapeList = new ArrayList<NsharpShapeAndLineProperty>();
//ICING wireframe shape
@ -192,7 +194,7 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
disposeRscWireFrameShapes();
titleBoxShape.dispose();
pressureTempRscShapeList=null;
//parcelTraceRscShapeList = null;
parcelRtShapeList = null;
super.disposeInternal();
}
private void plotPressureTempEditPoints(IGraphicsTarget target,
@ -357,6 +359,8 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
}
@SuppressWarnings("deprecation")
public void createLCLEtcLinesShape(){
if(target==null)
return;
if(lclShape != null){
lclShape.dispose();
lclShape = null;
@ -615,7 +619,7 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
}
return gap;
}
@SuppressWarnings("deprecation")
@SuppressWarnings("deprecation")
private void plotNsharpMovingTempLine(IGraphicsTarget target,
WGraphics world, RGB color) throws VizException{
float currentLayerTemp, currentLayerDewP;
@ -731,43 +735,119 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
commonLinewidth, LineStyle.DASHED);
//System.out.println("In pressure="+ inPressure+ " above P="+aboveLayerPressure+ " below P="+belowLayerPressure);
}
public static Comparator<NcSoundingLayer> windSpeedComparator() {
return new Comparator<NcSoundingLayer>() {
@Override
public int compare(NcSoundingLayer layerA, NcSoundingLayer layerB) {
int retValue = 0;
if (layerA != layerB) {
// reverse sort relative to pressure!
retValue = Double.compare(layerB.getWindSpeed(), layerA.getWindSpeed());
}
return retValue;
}
};
}
enum eleState {
RE_MAX_WIND, PICKED, UNPICKED
};
class windPickedElement {
NcSoundingLayer layer;
eleState myState;
public windPickedElement(NcSoundingLayer layer, eleState myState) {
super();
this.layer = layer;
this.myState = myState;
}
};
/**
*
* Draws Wind barb and wind speed vs height into box
* Draws Wind barb vs height
* This function followed algorithm in plot_barbs (void) at xwvid1.c
* to choose wind bulb for drawing around every 400m
*
*/
private void drawNsharpWindBarb(IGraphicsTarget target, double zoomLevel,
WGraphics world, RGB icolor, List<NcSoundingLayer> sndLys, double xPosition, double botPress)throws VizException {
ArrayList<List<LineStroke>> windList = new ArrayList<List<LineStroke>>();
if(sndLys.size()< 4)
return;
ArrayList<List<LineStroke>> windList = new ArrayList<List<LineStroke>>();
List<windPickedElement> layerStateList = new ArrayList<windPickedElement>();
float lastHeight = -9999;
double windX = xPosition;
float lastHeight = -999;
//#1: find relative max wind layers. I.e. a layer's wind is stronger than immediate above and below layers
NcSoundingLayer curLayer, aboveLayer, belowLayer;
for (int i=0; i < sndLys.size(); i++) {
curLayer = sndLys.get(i);
float spd = curLayer.getWindSpeed();
if(spd <0)
continue;
windPickedElement newEle = new windPickedElement(curLayer, eleState.UNPICKED);
layerStateList.add(newEle);
if ( i==0 || i== sndLys.size()-1) {
continue;
}
aboveLayer = sndLys.get(i+1);
belowLayer = sndLys.get(i-1);
if (spd> aboveLayer.getWindSpeed() && spd > belowLayer.getWindSpeed()){
newEle.myState = eleState.RE_MAX_WIND;
//System.out.println( "layer#"+ i+ " RE_MAX_WIND =" + spd );
}
}
//#2: apply minimum distance rule, i.e no two wind layer closer than the minimum distance, also make sure
// relative max wind layer is picked.
lastHeight = -9999;
windPickedElement lastEle=layerStateList.get(0);
for(windPickedElement ele: layerStateList){
float pressure = ele.layer.getPressure();
float spd = ele.layer.getWindSpeed();
if ( pressure < botPress || spd < 0 ) {
continue;
}
if ((ele.layer.getGeoHeight() - lastHeight) < graphConfigProperty.getWindBarbDistance()){// *zoomLevel ){
if(ele.myState.equals(eleState.RE_MAX_WIND) && spd > lastEle.layer.getWindSpeed()){
//swapped last picked layer with this relative max wind layer
lastEle.myState = eleState.UNPICKED;
lastHeight = ele.layer.getGeoHeight();
lastEle = ele;
continue;
}
else{
ele.myState = eleState.UNPICKED;
continue;
}
}
else{
if(ele.myState.equals(eleState.UNPICKED))
ele.myState = eleState.PICKED;
lastHeight = ele.layer.getGeoHeight();
lastEle = ele;
}
}
double windX = xPosition;
double windY=0;
double barbScaleFactorx, barbScaleFactory;
barbScaleFactorx = zoomLevel;
barbScaleFactory = zoomLevel;
List<double[]> locations = new ArrayList<double[]>();
//System.out.println("zoom="+zoomLevel +"world viewYmin="+world.getViewYmin()+" viewYmax="+world.getViewYmax()+" wolrdYmin="+ world.getWorldYmin()+" wolrdYmax="+ world.getWorldYmax()
// +"world viewXmin="+world.getViewXmin()+" viewXmax="+world.getViewXmax()+" wolrdXmin="+ world.getWorldXmin()+" wolrdXmax="+ world.getWorldXmax());
for (NcSoundingLayer layer : sndLys) {
//plot wind barbs
for(windPickedElement ele: layerStateList){
NcSoundingLayer layer = ele.layer;
float pressure = layer.getPressure();
float spd = layer.getWindSpeed();
float dir = layer.getWindDirection();
if ( pressure < botPress || spd < 0 ) {
continue;
}
if(spd > 140)
spd = 140;
if ((layer.getGeoHeight() - lastHeight) < graphConfigProperty.getWindBarbDistance()*zoomLevel){
continue;
}
// Get the vertical ordinate.
if(currentGraphMode== NsharpConstants.GRAPH_SKEWT){
windY = NsharpWxMath.getSkewTXY(pressure, 0).y;
barbScaleFactorx = 0.5*zoomLevel;
barbScaleFactorx = 0.6*zoomLevel;
barbScaleFactory= zoomLevel;
}
else if(currentGraphMode== NsharpConstants.GRAPH_ICING ){
@ -786,6 +866,11 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
else
continue;
if(ele.myState.equals(eleState.UNPICKED)){
double[] loc= {world.mapX(windX), world.mapY(windY)};
locations.add(loc);
continue;
}
List<LineStroke> barb = WindBarbFactory.getWindGraphics((double) (spd), (double) dir);
if (barb != null) {
// WindBarbFactory.scaleBarb(barb, zoomLevel*barbScaleFactor);
@ -796,9 +881,9 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
WindBarbFactory.translateBarb(barb, windX, windY);
windList.add(barb);
}
lastHeight = layer.getGeoHeight();
}
//#3: plot "unpicked" layer with a small dot
target.drawPoints(locations, icolor, PointStyle.POINT,2);
for (List<LineStroke> barb : windList) {
//System.out.println("barb");
for (LineStroke stroke : barb) {
@ -1129,7 +1214,7 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
str6.setCoordinates(dispX, dispY);
str6.horizontalAlignment = HorizontalAlignment.LEFT;
str6.verticallAlignment = VerticalAlignment.TOP;
//column 3: Theta, ThetaW, ThetaE
dispX = dispX +target.getStringsBounds(str5).getWidth()*hRatio;
dispY = ymin + 35 * zoomLevel* yRatio+target.getStringsBounds(str).getHeight()*vRatio ;
@ -1155,7 +1240,7 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
else {
boxExt = new PixelExtent(dispX,dispX+(rect.getWidth()+1)*hRatio,dispY-1*vRatio, dispY+rect.getHeight()*vRatio);
target.drawShadedRect(boxExt, NsharpConstants.color_black, 1f, null); //blank out box
}
}
target.drawStrings(str);
target.drawRect(boxExt, wwTypeColor, 2f, 1f); // box border line colored with "Psbl Watch Type" color
}
@ -1225,8 +1310,18 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
target.setupClippingPlane(pe);
//plot temp curve, when constructing pressureTempRscShapeList, it already considered
// comparison, overlay, etc..so, just draw it.
for(NsharpShapeAndLineProperty shapeNColor: pressureTempRscShapeList){
target.drawWireframeShape(shapeNColor.getShape(), shapeNColor.getLp().getLineColor(), shapeNColor.getLp().getLineWidth(), shapeNColor.getLp().getLineStyle(),font10);//commonLinewidth*2,commonLineStyle,font10);
for(NsharpShapeAndLineProperty shapeNLp: pressureTempRscShapeList){
target.drawWireframeShape(shapeNLp.getShape(), shapeNLp.getLp().getLineColor(), shapeNLp.getLp().getLineWidth(), shapeNLp.getLp().getLineStyle(),font10);//commonLinewidth*2,commonLineStyle,font10);
}
//plot real temp parcel trace, when constructing parcelRtShapeList, it already considered
// comparison, overlay, etc..so, just draw it.
//color is following comparison/overlay lines' configuration.
//line width and line style are following parcel line configuration
if(graphConfigProperty.isParcel() == true ){
NsharpLineProperty parcelLp =linePropertyMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_PARCEL]);
for(NsharpShapeAndLineProperty shapeNLp: parcelRtShapeList){
target.drawWireframeShape(shapeNLp.getShape(), shapeNLp.getLp().getLineColor(), parcelLp.getLineWidth(), parcelLp.getLineStyle(),font10);//commonLinewidth*2,commonLineStyle,font10);
}
}
boolean compareStnIsOn = rscHandler.isCompareStnIsOn();
boolean compareTmIsOn = rscHandler.isCompareTmIsOn();
@ -1242,35 +1337,29 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
if(editGraphOn)
plotPressureTempEditPoints(target, world, NsharpConstants.color_green, DEWPOINT_TYPE, this.soundingLys);
}
//plot wetbulb trace
//plot wet bulb trace
if(graphConfigProperty.isWetBulb() == true && !compareStnIsOn && !compareTmIsOn){
NsharpLineProperty lp =linePropertyMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_WETBULB]);
target.drawWireframeShape(wetBulbTraceRscShape, lp.getLineColor(),lp.getLineWidth(),lp.getLineStyle(),font10);
}
//plot virtual temp trace
//plot virtual temperature trace
if(graphConfigProperty.isVTemp() == true && !compareStnIsOn && !compareTmIsOn){
NsharpLineProperty lp =linePropertyMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_VIRTUAL_TEMP]);
target.drawWireframeShape(vtempTraceCurveRscShape,lp.getLineColor(),lp.getLineWidth(),lp.getLineStyle(),font10);
}
// parcel trace curve
if(graphConfigProperty.isParcelTv() == true && !compareStnIsOn && !compareTmIsOn){
// virtual temperature parcel trace curve
if(graphConfigProperty.isParcelTv() == true && !compareStnIsOn && !compareTmIsOn && !overlayIsOn){
if(soundingLys.size() > 0){
NsharpLineProperty lp =linePropertyMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_PARCEL_TV]);
target.drawWireframeShape(parcelVtTraceRscShape, lp.getLineColor(),lp.getLineWidth(),lp.getLineStyle(),font10);
}
}
if(graphConfigProperty.isParcel() == true && !compareStnIsOn && !compareTmIsOn){
if(soundingLys.size() > 0){
NsharpLineProperty lp =linePropertyMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_PARCEL]);
target.drawWireframeShape(parcelRtRscShape, lp.getLineColor(),lp.getLineWidth(),lp.getLineStyle(),font10);
}
}
if(graphConfigProperty.isDcape() == true && dacpeTraceRscShape != null && !compareStnIsOn && !compareTmIsOn){
if(graphConfigProperty.isDcape() == true && dacpeTraceRscShape != null && !compareStnIsOn && !compareTmIsOn && !overlayIsOn){
if(soundingLys.size() > 0){
NsharpLineProperty lp =linePropertyMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_DCAPE]);
target.drawWireframeShape(dacpeTraceRscShape, lp.getLineColor(),lp.getLineWidth(),lp.getLineStyle(),font10);
}
}
if(graphConfigProperty.isEffLayer() == true && !compareStnIsOn && !compareTmIsOn ){
@ -1313,14 +1402,14 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
lp =linePropertyMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_VIRTUAL_TEMP]);
target.drawWireframeShape(vtempTraceCurveRscShape,lp.getLineColor(),lp.getLineWidth(),lp.getLineStyle(),font10);
// parcel trace curve
lp =linePropertyMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_PARCEL_TV]);
target.drawWireframeShape(parcelVtTraceRscShape, lp.getLineColor(),lp.getLineWidth(),lp.getLineStyle(),font10);
lp =linePropertyMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_PARCEL]);
target.drawWireframeShape(parcelRtRscShape, lp.getLineColor(),lp.getLineWidth(),lp.getLineStyle(),font10);
if(dacpeTraceRscShape != null){
lp =linePropertyMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_DCAPE]);
target.drawWireframeShape(dacpeTraceRscShape, lp.getLineColor(),lp.getLineWidth(),lp.getLineStyle(),font10);
//virtual temperature parcel trace curve
if(!overlayIsOn){
lp =linePropertyMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_PARCEL_TV]);
target.drawWireframeShape(parcelVtTraceRscShape, lp.getLineColor(),lp.getLineWidth(),lp.getLineStyle(),font10);
if(dacpeTraceRscShape != null){
lp =linePropertyMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_DCAPE]);
target.drawWireframeShape(dacpeTraceRscShape, lp.getLineColor(),lp.getLineWidth(),lp.getLineStyle(),font10);
}
}
//draw effective layer lines
//drawEffectiveLayerLines(target);
@ -1359,6 +1448,41 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
NsharpLineProperty lp =linePropertyMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_WIND_BARB]);
drawNsharpWindBarb(target, currentZoomLevel, world, lp.getLineColor()/*NsharpConstants.color_yellow*/, this.soundingLys, xPos,100);
}
else{
int currentTimeLineStateListIndex = rscHandler.getCurrentTimeLineStateListIndex();
int currentStnStateListIndex = rscHandler.getCurrentStnStateListIndex();
List<NsharpStationStateProperty> stnStateList = rscHandler.getStnStateList();
List<NsharpTimeLineStateProperty> timeLineStateList = rscHandler.getTimeLineStateList();
List<List<NsharpSoundingElementStateProperty>> stnTimeTable = rscHandler.getStnTimeTable();
HashMap<String, List<NcSoundingLayer>> dataTimelineSndLysListMap = rscHandler.getDataTimelineSndLysListMap();
if(compareTmIsOn && currentStnStateListIndex >=0 ){
int colorIndex =NsharpConstants.LINE_COMP1;
for(NsharpTimeLineStateProperty elm: timeLineStateList) {
if(elm.getTimeState() == NsharpConstants.State.ACTIVE &&
stnTimeTable.get(currentStnStateListIndex).get(timeLineStateList.indexOf(elm)).getElementState() == NsharpConstants.State.AVAIL){
List<NcSoundingLayer> soundingLayeys = dataTimelineSndLysListMap.get(stnTimeTable.get(currentStnStateListIndex).get(timeLineStateList.indexOf(elm)).getElementDescription());
NsharpLineProperty lp = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]);
colorIndex++;
if(colorIndex > NsharpConstants.LINE_COMP10)
colorIndex =NsharpConstants.LINE_COMP1;
drawNsharpWindBarb(target, currentZoomLevel, world, lp.getLineColor(), soundingLayeys, xPos,100);
}
}
} else if(compareStnIsOn && currentTimeLineStateListIndex >=0){
int colorIndex =NsharpConstants.LINE_COMP1;
for(NsharpStationStateProperty elm: stnStateList) {
if(elm.getStnState() == NsharpConstants.State.ACTIVE &&
stnTimeTable.get(stnStateList.indexOf(elm)).get(currentTimeLineStateListIndex).getElementState() == NsharpConstants.State.AVAIL){
List<NcSoundingLayer> soundingLayeys = dataTimelineSndLysListMap.get(stnTimeTable.get(stnStateList.indexOf(elm)).get(currentTimeLineStateListIndex).getElementDescription());
NsharpLineProperty lp = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]);
colorIndex++;
if(colorIndex > NsharpConstants.LINE_COMP10)
colorIndex =NsharpConstants.LINE_COMP1;
drawNsharpWindBarb(target, currentZoomLevel, world, lp.getLineColor(), soundingLayeys, xPos,100);
}
}
}
}
}
//System.out.println("x1 pos"+xPos+ " x2 pos="+ (xPos - NsharpResourceHandler.BARB_LENGTH));
}
@ -1454,24 +1578,162 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
}
return "";
}
//Creating real temperature parcel trace shape list - considering normal/comparison/overlay scenarios
public void createRscParcelRtTraceShapesList( short parcelType, float userPre){
if(target==null)
return;
if(parcelRtShapeList.size()>0){
for(NsharpShapeAndLineProperty shapeColor: parcelRtShapeList){
shapeColor.getShape().dispose();
}
parcelRtShapeList.clear();
}
int currentTimeLineStateListIndex = rscHandler.getCurrentTimeLineStateListIndex();
int currentStnStateListIndex = rscHandler.getCurrentStnStateListIndex();
List<NsharpStationStateProperty> stnStateList = rscHandler.getStnStateList();
List<NsharpTimeLineStateProperty> timeLineStateList = rscHandler.getTimeLineStateList();
List<List<NsharpSoundingElementStateProperty>> stnTimeTable = rscHandler.getStnTimeTable();
HashMap<String, List<NcSoundingLayer>> dataTimelineSndLysListMap = rscHandler.getDataTimelineSndLysListMap();
if(rscHandler.isCompareStnIsOn() && currentTimeLineStateListIndex >=0){
int lpIndex =NsharpConstants.LINE_COMP1;
for(NsharpStationStateProperty elm: stnStateList) {
if(elm.getStnState() == NsharpConstants.State.ACTIVE &&
stnTimeTable.get(stnStateList.indexOf(elm)).get(currentTimeLineStateListIndex).getElementState() == NsharpConstants.State.AVAIL){
List<NcSoundingLayer> soundingLayeys = dataTimelineSndLysListMap.get(stnTimeTable.get(stnStateList.indexOf(elm)).get(currentTimeLineStateListIndex).getElementDescription());
NsharpLineProperty lp = linePropertyMap.get(NsharpConstants.lineNameArray[lpIndex]);
lpIndex++;
if(lpIndex > NsharpConstants.LINE_COMP10)
lpIndex =NsharpConstants.LINE_COMP1;
IWireframeShape shape = createRTParcelTraceShapes( parcelType, userPre, soundingLayeys);
NsharpShapeAndLineProperty shNLp = new NsharpShapeAndLineProperty();
shNLp.setShape(shape);
shNLp.setLp(lp);
parcelRtShapeList.add(shNLp);
}
}
}
else if(rscHandler.isCompareTmIsOn() && currentStnStateListIndex >=0 ){
int lpIndex =NsharpConstants.LINE_COMP1;
for(NsharpTimeLineStateProperty elm: timeLineStateList) {
if(elm.getTimeState() == NsharpConstants.State.ACTIVE &&
stnTimeTable.get(currentStnStateListIndex).get(timeLineStateList.indexOf(elm)).getElementState() == NsharpConstants.State.AVAIL){
List<NcSoundingLayer> soundingLayeys = dataTimelineSndLysListMap.get(stnTimeTable.get(currentStnStateListIndex).get(timeLineStateList.indexOf(elm)).getElementDescription());
NsharpLineProperty lp = linePropertyMap.get(NsharpConstants.lineNameArray[lpIndex]);
lpIndex++;
if(lpIndex > NsharpConstants.LINE_COMP10)
lpIndex =NsharpConstants.LINE_COMP1;
IWireframeShape shape = createRTParcelTraceShapes( parcelType, userPre, soundingLayeys);
NsharpShapeAndLineProperty shNLp = new NsharpShapeAndLineProperty();
shNLp.setShape(shape);
shNLp.setLp(lp);
parcelRtShapeList.add(shNLp);
}
}
}
else if(rscHandler.isOverlayIsOn() == true ){
previousSoundingLys = rscHandler.getPreviousSoundingLys();
IWireframeShape shape = createRTParcelTraceShapes( parcelType, userPre, this.soundingLys);
NsharpShapeAndLineProperty shNLp = new NsharpShapeAndLineProperty();
shNLp.setShape(shape);
shNLp.setLp(linePropertyMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_OVERLAY1]));
parcelRtShapeList.add(shNLp);
if(this.previousSoundingLys!=null && !previousSoundingLys.equals(soundingLys)){
shape = createRTParcelTraceShapes( parcelType, userPre, previousSoundingLys);
shNLp = new NsharpShapeAndLineProperty();
shNLp.setShape(shape);
shNLp.setLp(linePropertyMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_OVERLAY2]));
parcelRtShapeList.add(shNLp);
}
}
else {
IWireframeShape shape = createRTParcelTraceShapes( parcelType, userPre, this.soundingLys);
NsharpShapeAndLineProperty shNLp = new NsharpShapeAndLineProperty();
shNLp.setShape(shape);
shNLp.setLp(linePropertyMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_PARCEL]));
parcelRtShapeList.add(shNLp);
}
}
//Creating real temperature parcel trace shape
private IWireframeShape createRTParcelTraceShapes( short parcelType, float userPre, List<NcSoundingLayer> soundingLays){
IWireframeShape parcelRtShape;
parcelRtShape= target.createWireframeShape(false,descriptor );
parcelRtShape.allocate(40);
//the input soundingLays list may not be current sounding list, therfore need to populate it to
//native library.
nsharpNative.populateSndgData(soundingLays);
//call native define_parcel() with parcel type and user defined pressure (if user defined it)
nsharpNative.nsharpLib.define_parcel(parcelType,userPre);
_lplvalues lpvls = new _lplvalues();
nsharpNative.nsharpLib.get_lpvaluesData(lpvls);
float sfctemp, sfcdwpt, sfcpres;
sfctemp = lpvls.temp;
sfcdwpt = lpvls.dwpt;
sfcpres = lpvls.pres;
FloatByReference p2 = new FloatByReference(0), t2 = new FloatByReference(0);;
nsharpNative.nsharpLib.drylift (sfcpres, sfctemp, sfcdwpt, p2, t2);
Coordinate a1 = NsharpWxMath.getSkewTXY(sfcpres, sfctemp);
a1.x = world.mapX(a1.x);
a1.y = world.mapY(a1.y);
Coordinate a2 = NsharpWxMath.getSkewTXY(p2.getValue(), t2.getValue());
a2.x = world.mapX(a2.x);
a2.y = world.mapY(a2.y);
double [][] alines = {{a1.x, a1.y},{a2.x, a2.y}};
parcelRtShape.addLineSegment(alines);
a1 = a2;
float t3;
for (float i = p2.getValue() - 50; i >= 100; i = i - 50)
{
t3 = nsharpNative.nsharpLib.wetlift (p2.getValue(), t2.getValue(), i);
a2 = NsharpWxMath.getSkewTXY(i, t3);
a2.x = world.mapX(a2.x);
a2.y = world.mapY(a2.y);
double [][] alines1 = {{a1.x, a1.y},{a2.x, a2.y}};
parcelRtShape.addLineSegment(alines1);
a1 = a2;
}
t3 = nsharpNative.nsharpLib.wetlift (p2.getValue(), t2.getValue(), 100);
a2 = NsharpWxMath.getSkewTXY(100, t3);
a2.x = world.mapX(a2.x);
a2.y = world.mapY(a2.y);
double [][] alines1 = {{a1.x, a1.y},{a2.x, a2.y}};
parcelRtShape.addLineSegment(alines1);
parcelRtShape.compile();
//re-populate sounding data back to current sounding
nsharpNative.populateSndgData(this.soundingLys);
return parcelRtShape;
}
//Creating Virtual Temperature parcel and DCAPE trace Shapes
public void createRscParcelTraceShapes( short parcelType, float userPre){
if(target==null)
return;
//System.out.println("createRscParcelTraceShape called defoine_parcel pType="+parcelType+" pre="+ userPre+ " BY:"+this.toString());
if(parcelVtTraceRscShape != null){
parcelVtTraceRscShape.dispose();
parcelVtTraceRscShape = null;
}
if(parcelRtRscShape != null){
parcelRtRscShape.dispose();
parcelRtRscShape = null;
}
if(dacpeTraceRscShape != null){
dacpeTraceRscShape.dispose();
dacpeTraceRscShape = null;
}
parcelVtTraceRscShape= target.createWireframeShape(false,descriptor );
parcelVtTraceRscShape.allocate(40);
parcelRtRscShape= target.createWireframeShape(false,descriptor );
parcelRtRscShape.allocate(40);
dacpeTraceRscShape= target.createWireframeShape(false,descriptor );
dacpeTraceRscShape.allocate(40);
//call native define_parcel() with parcel type and user defined pressure (if user defined it)
@ -1500,17 +1762,6 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
parcelVtTraceRscShape.addLineSegment(lines);
c1 = c2;
Coordinate a1 = NsharpWxMath.getSkewTXY(sfcpres, sfctemp);
a1.x = world.mapX(a1.x);
a1.y = world.mapY(a1.y);
Coordinate a2 = NsharpWxMath.getSkewTXY(p2.getValue(), t2.getValue());
a2.x = world.mapX(a2.x);
a2.y = world.mapY(a2.y);
double [][] alines = {{a1.x, a1.y},{a2.x, a2.y}};
parcelRtRscShape.addLineSegment(alines);
a1 = a2;
float t3;
for (float i = p2.getValue() - 50; i >= 100; i = i - 50)
{
@ -1524,12 +1775,6 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
parcelVtTraceRscShape.addLineSegment(lines1);
c1 = c2;
a2 = NsharpWxMath.getSkewTXY(i, t3);
a2.x = world.mapX(a2.x);
a2.y = world.mapY(a2.y);
double [][] alines1 = {{a1.x, a1.y},{a2.x, a2.y}};
parcelRtRscShape.addLineSegment(alines1);
a1 = a2;
}
t3 = nsharpNative.nsharpLib.wetlift (p2.getValue(), t2.getValue(), 100);
@ -1541,13 +1786,6 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
double [][] lines2 = {{c1.x, c1.y},{c2.x, c2.y}};
parcelVtTraceRscShape.addLineSegment(lines2);
a2 = NsharpWxMath.getSkewTXY(100, t3);
a2.x = world.mapX(a2.x);
a2.y = world.mapY(a2.y);
double [][] alines1 = {{a1.x, a1.y},{a2.x, a2.y}};
parcelRtRscShape.addLineSegment(alines1);
parcelRtRscShape.compile();
parcelVtTraceRscShape.compile();
//DCAPE------------------
@ -1571,7 +1809,7 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
}
}
}
/* ----- Find min ThetaE layer ----- */
mine=1000; minep=-999;
@ -1601,7 +1839,7 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
if(layer.getPressure() > upper){
uptr = i;
break;
}
}
}
@ -1643,22 +1881,6 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
dacpeTraceRscShape.compile();
}
/*public void createParcelShapes(List<ParcelData> parcelList) {
if(parcelTraceRscShapeList.size()>0){
for(IWireframeShape shape: parcelTraceRscShapeList){
shape.dispose();
}
parcelTraceRscShapeList.clear();
}
for (ParcelData parData: parcelList){
createRscParcelTraceShape( parData.parcelType,parData.parcelLayerPressure);
}
}*/
// Chin: to handle dynamically moving height mark within viewable zone when zooming, I could not use wireframeShape successfully
// It will chop off lower part of marks. Therefore use this draw function.
@SuppressWarnings("deprecation")
@ -2337,11 +2559,8 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
createRscwetBulbTraceShape();
createRscPressTempCurveShapeAll(target);
createRscVTempTraceShape();
/*List<ParcelData> parcelList = rscHandler.getParcelList();
for (ParcelData parData: parcelList){
createRscParcelTraceShape( parData.parcelType,parData.parcelLayerPressure);
}*/
createRscParcelTraceShapes(rscHandler.getCurrentParcel(),rscHandler.getCurrentParcelLayerPressure());
createRscParcelRtTraceShapesList(rscHandler.getCurrentParcel(),rscHandler.getCurrentParcelLayerPressure());//real temp trace
createRscParcelTraceShapes(rscHandler.getCurrentParcel(),rscHandler.getCurrentParcelLayerPressure()); //Virtual Temp Trace and DCAPE trace
createLCLEtcLinesShape();
createEffectiveLayerLinesShape();
createCloudsShape();
@ -2403,21 +2622,16 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
turbLnShape.dispose();
turbLnShape=null;
}
/*if(parcelTraceRscShapeList.size()>0){
for(IWireframeShape shape: parcelTraceRscShapeList){
shape.dispose();
if(parcelRtShapeList.size()>0){
for(NsharpShapeAndLineProperty shapeColor: parcelRtShapeList){
shapeColor.getShape().dispose();
}
parcelTraceRscShapeList.clear();
}*/
parcelRtShapeList.clear();
}
if(parcelVtTraceRscShape != null){
parcelVtTraceRscShape.dispose();
parcelVtTraceRscShape = null;
}
if(parcelRtRscShape != null){
parcelRtRscShape.dispose();
parcelRtRscShape = null;
}
if(dacpeTraceRscShape != null){
dacpeTraceRscShape.dispose();
dacpeTraceRscShape = null;
@ -2639,12 +2853,12 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
omegaYEnd = omegaYOrig + omegaHeight;
createRscWireFrameShapes();
if(currentGraphMode== NsharpConstants.GRAPH_SKEWT)
skewTBackground.handleResize(ext);
skewTBackground.handleResize(ext);
else if(currentGraphMode == NsharpConstants.GRAPH_ICING)
icingBackground.handleResize(ext);
icingBackground.handleResize(ext);
else if(currentGraphMode == NsharpConstants.GRAPH_TURB)
turbBackground.handleResize(ext);
//System.out.println(descriptor.getPaneNumber()+":calling wito handle resize");
if(rscHandler != null && rscHandler.getWitoPaneRsc()!=null )
//simple D2D pane does not display WITO pane

View file

@ -135,7 +135,7 @@ public class NsharpSpcGraphsPaneResource extends NsharpAbstractPaneResource{
if(side == left ){
xstart = spcLeftXOrig+ 0.5*charWidth;
xend = spcLeftXOrig + spcFrameWidth;
}
}
else{
xstart = spcRightXOrig + 0.5*charWidth;
xend = spcRightXOrig + spcFrameWidth;
@ -251,7 +251,7 @@ public class NsharpSpcGraphsPaneResource extends NsharpAbstractPaneResource{
// System.out.println("java hail str #"+ (i+1)+ " "+ hailStr);
}
/*
/*
ypos = spcYEnd - 4 * charHeight;
for(int i=0; i < 2; i++){
String supStr = new String(sarsInfo.getTorStr(), (i*60), 60);
@ -975,7 +975,7 @@ public class NsharpSpcGraphsPaneResource extends NsharpAbstractPaneResource{
_parcel pcl = new _parcel();;
_lplvalues lpvls = new _lplvalues();
nsharpNative.nsharpLib.get_lpvaluesData(lpvls);
oldlplchoice = lpvls.flag;
//oldlplchoice = lpvls.flag;
//lift ML parcel
nsharpNative.nsharpLib.define_parcel(NsharpNativeConstants.PARCELTYPE_MEAN_MIXING, NsharpNativeConstants.MML_LAYER);
float sfctemp, sfcdwpt, sfcpres;
@ -1079,7 +1079,7 @@ public class NsharpSpcGraphsPaneResource extends NsharpAbstractPaneResource{
valueLCL.verticallAlignment = VerticalAlignment.TOP;
valueLCL.setCoordinates(tboxValueStart, ypos);
strList.add(valueLCL);
oldlplchoice = rscHandler.getCurrentParcel();
float pres = NsharpNativeConstants.parcelToLayerMap.get(oldlplchoice);
nsharpNative.nsharpLib.define_parcel(oldlplchoice,pres);
//Calculates and plots the probability of an F2+ tornado
@ -1154,8 +1154,8 @@ public class NsharpSpcGraphsPaneResource extends NsharpAbstractPaneResource{
// (given a supercell) based on effective bulk shear alone.
// Probabilities are derived from Thompson et al. 2005 RUC soundings
// based on prob_sigt_eshear() of xwvid3.c
nsharpNative.nsharpLib.get_lpvaluesData(lpvls);
oldlplchoice = lpvls.flag;
//nsharpNative.nsharpLib.get_lpvaluesData(lpvls);
//oldlplchoice = lpvls.flag;
//lift MU parcel
nsharpNative.nsharpLib.define_parcel(NsharpNativeConstants.PARCELTYPE_MOST_UNSTABLE, NsharpNativeConstants.MU_LAYER);
@ -1386,7 +1386,7 @@ public class NsharpSpcGraphsPaneResource extends NsharpAbstractPaneResource{
subTStr2.setCoordinates(xpos, ypos);
strList.add(subTStr2);
//target.drawStrings(subTStr1, subTStr2);
ypos = ypos + 1.5* charHeight;
//----- Plot Y-Coordinate hash marks, 0 - 70 kt -----
int maxval = 70;
@ -1459,7 +1459,7 @@ public class NsharpSpcGraphsPaneResource extends NsharpAbstractPaneResource{
_parcel pcl = new _parcel();;
_lplvalues lpvls = new _lplvalues();
nsharpNative.nsharpLib.get_lpvaluesData(lpvls);
oldlplchoice = lpvls.flag;
//oldlplchoice = lpvls.flag;
nsharpNative.nsharpLib.define_parcel(NsharpNativeConstants.PARCELTYPE_MOST_UNSTABLE,400f);
@ -1512,6 +1512,7 @@ public class NsharpSpcGraphsPaneResource extends NsharpAbstractPaneResource{
pres = NsharpNativeConstants.parcelToLayerMap.get(oldlplchoice);
}
else*/
oldlplchoice = rscHandler.getCurrentParcel();
pres = NsharpNativeConstants.parcelToLayerMap.get(oldlplchoice);
nsharpNative.nsharpLib.define_parcel(oldlplchoice,pres);
target.drawStrings(strList.toArray(new DrawableString[strList.size()])); // x-axis mark number
@ -1522,7 +1523,7 @@ public class NsharpSpcGraphsPaneResource extends NsharpAbstractPaneResource{
PaintProperties paintProps) throws VizException {
super.paintInternal(target, paintProps);
//defineCharHeight(font10);
if(rscHandler== null)
if(rscHandler== null || rscHandler.getSoundingLys()==null)
return;
this.font10.setSmoothing(false);
this.font10.setScaleFont(false);
@ -1555,7 +1556,7 @@ public class NsharpSpcGraphsPaneResource extends NsharpAbstractPaneResource{
underDevelopment(0); //plotWinter(left);
break;
case HAIL:
underDevelopment(0);
underDevelopment(0);
break;
case SARS:
underDevelopment(0); //plotSars(left);
@ -1581,7 +1582,7 @@ public class NsharpSpcGraphsPaneResource extends NsharpAbstractPaneResource{
underDevelopment(1);//plotWinter(right);
break;
case HAIL:
underDevelopment(1);
underDevelopment(1);
break;
case SARS:
underDevelopment(1);//plotSars(right);

View file

@ -249,7 +249,7 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
if(compareTmIsOn && elm.timeState == NsharpConstants.State.ACTIVE && avail){
colorIndex = (compIndex-1)%(NsharpConstants.LINE_COMP10-NsharpConstants.LINE_COMP1+1)+ NsharpConstants.LINE_COMP1;
strBD = target.getStringBounds(font10, s);
s ="Cp "+ compIndex;
s =""+ compIndex;
x=x+ strBD.getWidth()*hRatio+5;
target.drawString(font10,s, x,
ly, 0.0,
@ -382,7 +382,7 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
if(compareStnIsOn && elm.stnState == NsharpConstants.State.ACTIVE && avail){
strBD = target.getStringBounds(font10, stnId);
colorIndex = (compIndex-1)%(NsharpConstants.LINE_COMP10-NsharpConstants.LINE_COMP1+1)+ NsharpConstants.LINE_COMP1;
s ="Cp "+ compIndex;
s =""+ compIndex;
x=x+ strBD.getWidth()*hRatio+5;
target.drawString(font10,s, x,
ly, 0.0,

View file

@ -121,7 +121,7 @@ public class ModelSoundingDialogContents {
//gribDecoderName = NcSoundingQuery.GRIB_PLUGIN_NAME;
//System.out.println("perspective id = " + VizPerspectiveListener.getCurrentPerspectiveManager().getPerspectiveId());
}*/
}
}
private void createMDLAvailableFileList() {
if(sndTimeList!=null)
@ -154,7 +154,7 @@ public class ModelSoundingDialogContents {
//Chin: a same refTime may be returned more than once.
int index = availableFileList.indexOf(refTime);
if(index == -1) // index = -1 means it is not in the list
availableFileList.add(refTime);
availableFileList.add(refTime);
}
}
ldDia.stopWaitCursor();
@ -204,33 +204,33 @@ public class ModelSoundingDialogContents {
String fl = selectedFlLst.get(i);
long reftimeMs= NcSoundingQuery.convertRefTimeStr(fl);
NcSoundingTimeLines timeLines = NcSoundingQuery.mdlSoundingRangeTimeLineQuery(selectedModel, fl, gribDecoderName);
if(timeLines != null && timeLines.getTimeLines().length >0) {
if(timeLines != null && timeLines.getTimeLines().length >0){
for(Object obj : timeLines.getTimeLines()){
Timestamp rangestart = (Timestamp)obj;
//need to format rangestart to GMT time string. Timestamp.toString produce a local time Not GMT time
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
cal.setTimeInMillis(rangestart.getTime());
long vHour = (cal.getTimeInMillis()- reftimeMs)/3600000;
String gmtTimeStr = String.format("%1$ty%1$tm%1$td/%1$tH%1$tMV%2$03d %3$s", cal, vHour,modelName);
//String gmtTimeStr = String.format("%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS", cal);
if(sndTimeList.indexOf(gmtTimeStr) != -1){
//need to format rangestart to GMT time string. Timestamp.toString produce a local time Not GMT time
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
cal.setTimeInMillis(rangestart.getTime());
long vHour = (cal.getTimeInMillis()- reftimeMs)/3600000;
String gmtTimeStr = String.format("%1$ty%1$tm%1$td/%1$tH%1$tMV%2$03d %3$s", cal, vHour,modelName);
//String gmtTimeStr = String.format("%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS", cal);
if(sndTimeList.indexOf(gmtTimeStr) != -1){
// this indicate that gmtTimeStr is already in the sndTimeList, then we dont need to add it to list again.
continue;
}
//System.out.println("GMT time " + gmtTimeStr);
if(!timeLimit){
sndTimeList.add(gmtTimeStr);
continue;
}
//System.out.println("GMT time " + gmtTimeStr);
if(!timeLimit){
sndTimeList.add(gmtTimeStr);
timeLineToFileMap.put(gmtTimeStr, fl);
}
else {
int hour = cal.get(Calendar.HOUR_OF_DAY);
if((hour == 0) || (hour == 12)){
sndTimeList.add(gmtTimeStr);
timeLineToFileMap.put(gmtTimeStr, fl);
}
else {
int hour = cal.get(Calendar.HOUR_OF_DAY);
if((hour == 0) || (hour == 12)){
sndTimeList.add(gmtTimeStr);
timeLineToFileMap.put(gmtTimeStr, fl);
}
}
}
}
}
}
@ -272,7 +272,9 @@ public class ModelSoundingDialogContents {
//System.out.println(lat+";"+lon+" "+timeLine);
}
else{
soundingLysLstMap.put(stnStr+" "+timeLine, rtnSndLst);
// replaced space to _ in stnStr.
String stnStrPacked = stnStr.replace(" ", "_");
soundingLysLstMap.put(stnStrPacked+" "+timeLine, rtnSndLst);
//System.out.println(stnStr+" "+timeLine);
}
continue;
@ -318,6 +320,7 @@ public class ModelSoundingDialogContents {
stnInfo.setSndType(selectedModel);
stnInfo.setLatitude(lat);
stnInfo.setLongitude(lon);
stnInfo.setStnId(stnStr);
skewRsc.addRsc(soundingLysLstMap, stnInfo);
skewRsc.setSoundingType(selectedModel);
NsharpEditor.bringEditorToTop();
@ -359,7 +362,7 @@ public class ModelSoundingDialogContents {
else
modelTypeList.add(modelName);
}
}
}
ldDia.stopWaitCursor();
}
@ -378,7 +381,7 @@ public class ModelSoundingDialogContents {
private void handleSndTimeSelection(){
String selectedSndTime=null;
if (sndTimeList.getSelectionCount() > 0 && sndTimeList.getSelection()[0].equals(SND_TIMELINE_NOT_AVAIL_STRING)== false) {
selectedTimeList.clear();
for(int i=0; i < sndTimeList.getSelectionCount(); i++) {
selectedSndTime = sndTimeList.getSelection()[i];
@ -414,7 +417,7 @@ public class ModelSoundingDialogContents {
}
}
} );
availableFileGp = new Group(topGp,SWT.SHADOW_ETCHED_IN);
availableFileGp.setText("Available Grid files:");
@ -438,7 +441,7 @@ public class ModelSoundingDialogContents {
sndTimeList.setFont(newFont);
sndTimeList.setBounds(sndTimeListGp.getBounds().x, sndTimeListGp.getBounds().y + NsharpConstants.labelGap, NsharpConstants.listWidth, NsharpConstants.listHeight *32/5);
sndTimeList.addListener ( SWT.Selection, new Listener () {
public void handleEvent (Event e) {
public void handleEvent (Event e) {
handleSndTimeSelection();
}
});
@ -592,7 +595,7 @@ public class ModelSoundingDialogContents {
//ldDia.close();
}
}
} );
} );
if(selectedModel != null && selectedModel.equals("")== false){
String[] selectedModelArray = {selectedModel};
@ -611,7 +614,7 @@ public class ModelSoundingDialogContents {
handleSndTimeSelection();
}
}
}
public void cleanup(){
@ -643,7 +646,7 @@ public class ModelSoundingDialogContents {
} */
if(modelTypeList!=null){
if(modelTypeList.getListeners(SWT.Selection).length >0)
modelTypeList.removeListener(SWT.Selection, modelTypeList.getListeners(SWT.Selection)[0]);
modelTypeList.removeListener(SWT.Selection, modelTypeList.getListeners(SWT.Selection)[0]);
modelTypeList.dispose();
modelTypeList = null;
}

View file

@ -190,8 +190,8 @@ public class NsharpConfigDialog extends Dialog {
}
} );
paneCfgBtn = new Button(parent, SWT.PUSH);
paneCfgBtn.setText("Diaplay Pane Configuration");
paneCfgBtn = new Button(parent, SWT.PUSH);
paneCfgBtn.setText("Display Pane Configuration");
paneCfgBtn.setEnabled( true );
//lineBtn.setSize(btnWidth,pushbtnHeight);
paneCfgBtn.addListener( SWT.MouseUp, new Listener() {
@ -215,7 +215,7 @@ public class NsharpConfigDialog extends Dialog {
}
}
} );
mdlCfgBtn = new Button(parent, SWT.PUSH);
mdlCfgBtn.setText("Grid Model Type Configuration");
mdlCfgBtn.setEnabled( true );

View file

@ -1,5 +1,6 @@
package gov.noaa.nws.ncep.ui.nsharp.view;
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingProfile;
import gov.noaa.nws.ncep.ui.nsharp.NsharpConfigManager;
import gov.noaa.nws.ncep.ui.nsharp.NsharpConfigStore;
import gov.noaa.nws.ncep.ui.nsharp.NsharpConstants;
@ -38,6 +39,8 @@ public class NsharpDataPageConfigDialog extends Dialog {
private int lblWidth = 200;
private int lblHeight = 20;
private int textWidth = 80;
private int numberPagePerDisplay = 2;
private Label curLbl;
private Text newText;
private Text[] newOrderTextArray= new Text[NsharpConstants.PAGE_MAX_NUMBER+1];//element 0 is dummy one
@ -65,6 +68,7 @@ public class NsharpDataPageConfigDialog extends Dialog {
pageOrderNumberArray[NsharpConstants.PAGE_CONVECTIVE_INITIATION ] = dpp.getConvectiveInitiationPage();
pageOrderNumberArray[NsharpConstants.PAGE_SEVERE_POTENTIAL ] = dpp.getSeverePotentialPage();
editingOrderNumberArray = pageOrderNumberArray.clone();
numberPagePerDisplay = dpp.getNumberPagePerDisplay();
mb = new MessageBox(parentShell, SWT.ICON_WARNING
| SWT.OK );
@ -77,7 +81,7 @@ public class NsharpDataPageConfigDialog extends Dialog {
@Override
protected void configureShell( Shell shell ) {
super.configureShell( shell );
shell.setText( "Data Page Display Order Configuration" );
shell.setText( "Data Page Display Configuration" );
}
@Override
@ -119,6 +123,7 @@ public class NsharpDataPageConfigDialog extends Dialog {
dpp.setMeanWindPage(pageOrderNumberArray[NsharpConstants.PAGE_MEAN_WIND ] );
dpp.setConvectiveInitiationPage(pageOrderNumberArray[NsharpConstants.PAGE_CONVECTIVE_INITIATION ] );
dpp.setSeverePotentialPage(pageOrderNumberArray[NsharpConstants.PAGE_SEVERE_POTENTIAL ] );
dpp.setNumberPagePerDisplay(numberPagePerDisplay);
try {
//save to xml
mgr.saveConfigStoreToFs(configStore);
@ -190,6 +195,7 @@ public class NsharpDataPageConfigDialog extends Dialog {
editingDpp.setMeanWindPage(pageOrderNumberArray[NsharpConstants.PAGE_MEAN_WIND ] );
editingDpp.setConvectiveInitiationPage(pageOrderNumberArray[NsharpConstants.PAGE_CONVECTIVE_INITIATION ] );
editingDpp.setSeverePotentialPage(pageOrderNumberArray[NsharpConstants.PAGE_SEVERE_POTENTIAL ] );
editingDpp.setNumberPagePerDisplay(numberPagePerDisplay);
rsc.setDataPageProperty(editingDpp);
editor.refresh();
}
@ -231,6 +237,37 @@ public class NsharpDataPageConfigDialog extends Dialog {
mainLayout.marginHeight = 3;
mainLayout.marginWidth = 3;
top.setLayout(mainLayout);
Group btnGp = new Group(top, SWT.SHADOW_ETCHED_IN);
btnGp.setText("number of page per display");
//.setFont(newFont);
Button oneBtn = new Button(btnGp, SWT.RADIO | SWT.BORDER);
oneBtn.setText("1");
oneBtn.setEnabled( true );
oneBtn.setBounds(btnGp.getBounds().x+ NsharpConstants.btnGapX, btnGp.getBounds().y + NsharpConstants.labelGap, NsharpConstants.btnWidth,NsharpConstants.btnHeight);
//oneBtn.setFont(newFont);
oneBtn.addListener( SWT.MouseUp, new Listener() {
public void handleEvent(Event event) {
numberPagePerDisplay=1;
//System.out.println("new obvSnd dialog uair btn");
}
} );
Button twoBtn = new Button(btnGp, SWT.RADIO | SWT.BORDER);
twoBtn.setText("2");
twoBtn.setEnabled( true );
twoBtn.setBounds(btnGp.getBounds().x+ NsharpConstants.btnGapX, oneBtn.getBounds().y + oneBtn.getBounds().height+ NsharpConstants.btnGapY, NsharpConstants.btnWidth,NsharpConstants.btnHeight);
//twoBtn.setFont(newFont);
twoBtn.addListener( SWT.MouseUp, new Listener() {
public void handleEvent(Event event) {
numberPagePerDisplay=2;
}
} );
if(numberPagePerDisplay==1)
oneBtn.setSelection(true);
else
twoBtn.setSelection(true);
Group configGp = new Group(top, SWT.SHADOW_ETCHED_IN | SWT.NO_RADIO_GROUP);
Label nameLbl = new Label(configGp, SWT.BORDER );
nameLbl.setText(" Page Name");

View file

@ -43,9 +43,9 @@ import org.eclipse.swt.widgets.Shell;
public class NsharpHandleArchiveFile {
public static void openArchiveFile(Shell shell){
/*
/* Chin: 3/14/2013
* A typical saved file contents is as following....
* PFC NAMSND KSWF 2010-12-12 11:00:00 LAT=41.52 LON=-74.19
* SNDTYPE=MDL TITLE=KMFR 130131/1200 NCUAIR STNID=KMFR LAT=42.38 LON=-122.87
* PRESSURE HGHT TEMP DWPT WDIR WSPD OMEG
* 997.500000 129.000000 -3.250006 -3.381190 10.619656 1.627882 0.000000
* ........
@ -66,8 +66,8 @@ public class NsharpHandleArchiveFile {
if(selecteds!= null && selecteds.length > 0){
Map<String, List<NcSoundingLayer>> soundingLysLstMap = new HashMap<String, List<NcSoundingLayer>>();
//List<String> timeList = new ArrayList<String>();
String timeLine ;
String stnDispInfoStr;
//String timeLine ;
String stnDispInfoStr="N/A N/A";
//read in archive file
InputStream is = null;
NsharpStationInfo stninfo = new NsharpStationInfo();
@ -89,23 +89,65 @@ public class NsharpHandleArchiveFile {
strContent.append((char)byteread);
//System.out.println((char)byteread);
}
if(strContent.length() <=100)
return;
//System.out.println(strContent);
//hash map, use stn display info as key
//Chin-T Map<String, List<SoundingLayer>> soundingLysLstMap = new HashMap<String, List<SoundingLayer>>();
timeLine = new String("");
stnDispInfoStr = new String("");
int lat = strContent.indexOf("LAT=");
if(lat > 0 )
{
lat = lat+4;
int endIndex = strContent.substring(lat).indexOf(";");
if(endIndex>0){
String latStr= strContent.substring(lat,lat+endIndex);
stninfo.setLatitude(Float.parseFloat(latStr));
}
}
int lon = strContent.indexOf("LON=");
if(lon > 0 )
{
lon = lon+4;
int endIndex = strContent.substring(lon).indexOf(";");
if(endIndex>0){
String lonStr= strContent.substring(lon,lon+endIndex);
stninfo.setLongitude(Float.parseFloat(lonStr));
}
}
int snd = strContent.indexOf("SNDTYPE=");
if(snd > 0 )
{
snd = snd+8;
int endIndex = strContent.substring(snd).indexOf(";");
if(endIndex>0){
String sndStr= strContent.substring(snd,snd+endIndex);
stninfo.setSndType(sndStr);
if(NsharpLoadDialog.getAccess()!= null ){
if(sndStr.equals("PFC"))
NsharpLoadDialog.getAccess().setActiveLoadSoundingType(NsharpLoadDialog.PFC_SND);
else if(sndStr.equals("MDL"))
NsharpLoadDialog.getAccess().setActiveLoadSoundingType(NsharpLoadDialog.MODEL_SND);
else if(sndStr.equals("OBS"))
NsharpLoadDialog.getAccess().setActiveLoadSoundingType(NsharpLoadDialog.OBSER_SND);
}
}
}
int title = strContent.indexOf("TITLE=");
if(title > 0 )
{
title = title+6;
int endIndex = strContent.substring(title).indexOf(";");
if(endIndex>0){
String titleStr= strContent.substring(title,title+endIndex);
stninfo.setStnDisplayInfo(titleStr);
stnDispInfoStr = titleStr;
}
}
//timeLine = new String("");
//stnDispInfoStr = new String("");
List<NcSoundingLayer> sndLyList = new ArrayList<NcSoundingLayer>();
NcSoundingLayer sndLy = null;
StringTokenizer st = new StringTokenizer(strContent.toString());
int i =0;
int loadSndTypeIndex = 1;
int sndTypeIndex = 2;
int dataStartIndex = 15;
int stnInfoIndexEnd = 5;
int stnLatIndex = 6;
int stnLonIndex = 7;
int latlonTokenHdrLength = 4; // either "LAT=" or "LON="
int dataCycleLength = 7;
while (st.hasMoreTokens()) {
i++;
@ -119,43 +161,10 @@ public class NsharpHandleArchiveFile {
//From token 13, we have pressure, height, temp,..., omega, pressure, height,..omega.
//These weather data will be repeated every 7 tokens.
String tok = st.nextToken();
if(i == loadSndTypeIndex){
if(NsharpLoadDialog.getAccess()!= null ){
if(tok.equals("PFC"))
NsharpLoadDialog.getAccess().setActiveLoadSoundingType(NsharpLoadDialog.PFC_SND);
else if(tok.equals("MDL"))
NsharpLoadDialog.getAccess().setActiveLoadSoundingType(NsharpLoadDialog.MODEL_SND);
else
NsharpLoadDialog.getAccess().setActiveLoadSoundingType(NsharpLoadDialog.OBSER_SND);
}
//System.out.println("loadsnd type "+ tok);
if(tok.equals("OMEG")){
dataStartIndex = i+1;
}
else if(i == sndTypeIndex){
sndType = tok;
stninfo.setSndType(sndType);
//System.out.println("snd type "+ sndType);
}
else if (i > sndTypeIndex && i<= stnInfoIndexEnd){
//stn display info
stnDispInfoStr = stnDispInfoStr + tok + " ";
if( i >=3){
//time line
timeLine = timeLine + tok + " ";
}
} else if (i == stnLatIndex){
float lat=0;
if(tok.length() > latlonTokenHdrLength) {
lat = Float.parseFloat(tok.substring(latlonTokenHdrLength));
}
stninfo.setLatitude(lat);
} else if (i == stnLonIndex){
float lon=0;
if(tok.length() > latlonTokenHdrLength) {
lon = Float.parseFloat(tok.substring(latlonTokenHdrLength));
}
stninfo.setLongitude(lon);
} else if (i >=dataStartIndex){
if (i >=dataStartIndex){
if((i-dataStartIndex)%dataCycleLength ==0){
sndLy = new NcSoundingLayer();
@ -227,16 +236,6 @@ public class NsharpHandleArchiveFile {
mb.setMessage("Invalid sounding data retrieved from archive file!!");
mb.open();
}
//test
//textToShow="";
//for (NcSoundingLayer layer: sndLyList){
// tempText = String.format("%7.2f\t%8.2f %7.2f %7.2f %6.2f %6.2f %9.6f\n", layer.getPressure(),
// layer.getGeoHeight(),layer.getTemperature(),layer.getDewpoint(), layer.getWindDirection(),
// layer.getWindSpeed(), layer.getOmega());
// textToShow = textToShow + tempText;
//}
//System.out.println("Endof openArchiveFile");
//end test
} catch (FileNotFoundException e) {
e.printStackTrace();

View file

@ -547,9 +547,17 @@ DisposeListener, IPartListener{
graphEditBtn.setText(EDIT_GRAPH_OFF);
currentGraphMode= NsharpConstants.GRAPH_SKEWT;
NsharpEditor editor = NsharpEditor.getActiveNsharpEditor();
if(editor != null){
if(editor != null && editor.getRscHandler()!=null){
//note: resetRsc will reset currentPage, overlay, compare, interpolate flag in Resource
editor.getRscHandler().resetRsc();
//issue#18 - issue list
if(editor.getRscHandler().getDataPaneRsc()!=null){
editor.getRscHandler().getDataPaneRsc().resetCurrentParcel();
}
NsharpParcelDialog parcelDia = NsharpParcelDialog.getInstance(shell);
if ( parcelDia != null ) {
parcelDia.reset();
}
//editor.getNsharpSkewTDescriptor().getSkewtResource().resetRsc();// need to called it twice to make refresh worked...dont know why
//know that current editor is NsharpSkewT editor, refresh it.
editor.refresh();

View file

@ -292,7 +292,7 @@ public class NsharpParametersSelectionConfigDialog extends Dialog {
parcelTvBtn.setText(NsharpNativeConstants.PARCEL_VT_TRACE);
parcelTvBtn.setEnabled( true );
parcelTvBtn.setBounds(btnGp.getBounds().x+ btnGapX, dewpBtn.getBounds().y + dewpBtn.getBounds().height+ btnGapY, btnWidth,btnHeight);
if(parcel == true)
if(parcelTv == true)
parcelTvBtn.setSelection(true);
else
parcelTvBtn.setSelection(false);
@ -309,7 +309,7 @@ public class NsharpParametersSelectionConfigDialog extends Dialog {
parcelBtn.setText(NsharpNativeConstants.PARCEL_T_TRACE);
parcelBtn.setEnabled( true );
parcelBtn.setBounds(btnGp.getBounds().x+ btnGapX, parcelTvBtn.getBounds().y + parcelTvBtn.getBounds().height+ btnGapY, btnWidth,btnHeight);
if(parcelTv == true)
if(parcel == true)
parcelBtn.setSelection(true);
else
parcelBtn.setSelection(false);
@ -321,7 +321,7 @@ public class NsharpParametersSelectionConfigDialog extends Dialog {
parcel=true;
applyChange();
}
} );
} );
dcapeBtn = new Button(btnGp, SWT.RADIO | SWT.BORDER);
dcapeBtn.setText(NsharpNativeConstants.DCAPE_TRACE);
dcapeBtn.setEnabled( true );

View file

@ -49,10 +49,6 @@ public class NsharpParcelDialog extends Dialog {
private String MUP = "Most Unstable Parcel";
private String UDL= "User Defined Level";
private String EFF = "Mean Effective Layer";
//private boolean surface=false, forcast=false, mml=false, mup=true, udl=false, eff=false;
//ParcelData surfacePar=null, forcastPar=null, mmlPar=null, mupPar=null, udlPar=null, effPar=null;
//private static short currentParcel = NsharpNativeConstants.PARCELTYPE_MOST_UNSTABLE;
//private static short prevParcel = currentParcel;
private static int userDefdParcelMb = 850; //default value
private int btnWidth = 300;
private int btnHeight = 20;
@ -62,7 +58,6 @@ public class NsharpParcelDialog extends Dialog {
private short curParcelType;
private Button curSfcBtn,frcstBtn,effBtn,mmlBtn, mupBtn,udlBtn;
private Text userDefdMbtext;
//private List<ParcelData> parcelList = new ArrayList<ParcelData>();
public static int getUserDefdParcelMb() {
return userDefdParcelMb;
}
@ -72,38 +67,9 @@ public class NsharpParcelDialog extends Dialog {
userDefdParcelMb = 850;
}
public void reset(){
//parcelList.clear();
//addParcelToList(mupPar);
userDefdParcelMb = 850;
curParcelType = NsharpNativeConstants.PARCELTYPE_MOST_UNSTABLE;
//mup=true;
//surface= forcast=mml= udl= eff=false;
}
/*
public void setCurrentParcelButton(int parcelType){
switch(parcelType){
case NsharpNativeConstants.PARCELTYPE_OBS_SFC:
curSfcBtn.setSelection(true);
break;
case NsharpNativeConstants.PARCELTYPE_EFF:
effBtn.setSelection(true);
break;
case NsharpNativeConstants.PARCELTYPE_FCST_SFC:
frcstBtn.setSelection(true);
break;
case NsharpNativeConstants.PARCELTYPE_MEAN_MIXING:
mmlBtn.setSelection(true);
break;
case NsharpNativeConstants.PARCELTYPE_MOST_UNSTABLE:
mupBtn.setSelection(true);
break;
case NsharpNativeConstants.PARCELTYPE_USER_DEFINED:
udlBtn.setSelection(true);
break;
default:
break;
}
}*/
public static NsharpParcelDialog getInstance( Shell parShell){
if ( thisDialog == null ){
@ -129,41 +95,7 @@ public class NsharpParcelDialog extends Dialog {
protected NsharpParcelDialog(Shell parentShell) throws VizException {
super(parentShell);
thisDialog = this;
/*NsharpResourceHandler skewtRsc = NsharpEditor.getActiveNsharpEditor().getRscHandler();
if(skewtRsc!=null){
surfacePar = skewtRsc.new ParcelData();
surfacePar.setParcelLayerPressure(NsharpNativeConstants.OBS_LAYER);
surfacePar.setParcelType(NsharpNativeConstants.PARCELTYPE_OBS_SFC);
forcastPar = skewtRsc.new ParcelData();
forcastPar.setParcelLayerPressure(NsharpNativeConstants.FCST_LAYER);
forcastPar.setParcelType(NsharpNativeConstants.PARCELTYPE_FCST_SFC);
mmlPar = skewtRsc.new ParcelData();
mmlPar.setParcelLayerPressure(NsharpNativeConstants.MML_LAYER);
mmlPar.setParcelType(NsharpNativeConstants.PARCELTYPE_MEAN_MIXING);
mupPar = skewtRsc.new ParcelData();
mupPar.setParcelLayerPressure(NsharpNativeConstants.MU_LAYER);
mupPar.setParcelType(NsharpNativeConstants.PARCELTYPE_MOST_UNSTABLE);
udlPar = skewtRsc.new ParcelData();
udlPar.setParcelLayerPressure(NsharpNativeConstants.USER_LAYER);
udlPar.setParcelType(NsharpNativeConstants.PARCELTYPE_USER_DEFINED);
effPar = skewtRsc.new ParcelData();
effPar.setParcelLayerPressure(NsharpNativeConstants.EFF_LAYER);
effPar.setParcelType(NsharpNativeConstants.PARCELTYPE_EFF);
//addParcelToList(mupPar);
}*/
}
//private void addParcelToList(ParcelData parcel){
// if(parcel!=null){
// parcelList.add(parcel);
// }
//}
/*private void deleteParcelFromList(ParcelData parceldata){
if( parceldata!=null){
parcelList.remove(parceldata);
}
}*/
}
private void createDialogContents(Composite parent){
@ -178,34 +110,6 @@ public class NsharpParcelDialog extends Dialog {
Button button = (Button) child;
if (button.getSelection()) {
curParcelType = Short.parseShort(button.getData().toString());
/*switch(parcelType){
case NsharpNativeConstants.PARCELTYPE_OBS_SFC:
parcelList.clear();
parcelList.add(surfacePar);
break;
case NsharpNativeConstants.PARCELTYPE_EFF:
parcelList.clear();
parcelList.add(effPar);
break;
case NsharpNativeConstants.PARCELTYPE_FCST_SFC:
parcelList.clear();
parcelList.add(forcastPar);
break;
case NsharpNativeConstants.PARCELTYPE_MEAN_MIXING:
parcelList.clear();
parcelList.add(mmlPar);
break;
case NsharpNativeConstants.PARCELTYPE_MOST_UNSTABLE:
parcelList.clear();
parcelList.add(mupPar);
break;
case NsharpNativeConstants.PARCELTYPE_USER_DEFINED:
parcelList.clear();
parcelList.add(udlPar);
break;
default:
return;
}*/
NsharpEditor editor = NsharpEditor.getActiveNsharpEditor();
if(editor != null){
@ -229,25 +133,6 @@ public class NsharpParcelDialog extends Dialog {
curSfcBtn.setData(NsharpNativeConstants.PARCELTYPE_OBS_SFC);
curSfcBtn.addListener( SWT.MouseUp,radioGpLsner);
/*
if(surface == true)
curSfcBtn.setSelection(true);
else
curSfcBtn.setSelection(false);
curSfcBtn.addListener( SWT.MouseUp, new Listener() {
public void handleEvent(Event event) {
if(surface == true){
surface=false;
deleteParcelFromList(surfacePar);
}
else{
surface=true;
addParcelToList(surfacePar);
}
}
} );
*/
frcstBtn = new Button(btnGp, SWT.RADIO | SWT.BORDER);
frcstBtn.setText(FRCST_SFC);
frcstBtn.setEnabled( true );
@ -255,98 +140,24 @@ public class NsharpParcelDialog extends Dialog {
frcstBtn.setData(NsharpNativeConstants.PARCELTYPE_FCST_SFC);
frcstBtn.addListener( SWT.MouseUp,radioGpLsner);
/*if(forcast==true)
frcstBtn.setSelection(true);
else
frcstBtn.setSelection(false);
frcstBtn.addListener( SWT.MouseUp, new Listener() {
public void handleEvent(Event event) {
if(forcast == true){
forcast=false;
deleteParcelFromList(forcastPar);
}
else{
forcast=true;
addParcelToList(forcastPar);
}
//prevParcel = currentParcel;
//currentParcel = NsharpNativeConstants.PARCELTYPE_FCST_SFC;
//userDefdMbtext.setEnabled(false);
//userDefdMbtext.setVisible(false);
}
} ); */
mmlBtn = new Button(btnGp, SWT.RADIO | SWT.BORDER);
mmlBtn.setText(MML);
mmlBtn.setEnabled( true );
mmlBtn.setBounds(btnGp.getBounds().x+ btnGapX, frcstBtn.getBounds().y + frcstBtn.getBounds().height+ btnGapY, btnWidth,btnHeight);
mmlBtn.setData(NsharpNativeConstants.PARCELTYPE_MEAN_MIXING);
mmlBtn.addListener( SWT.MouseUp,radioGpLsner);
/*if(mml == true)
mmlBtn.setSelection(true);
else
mmlBtn.setSelection(false);
mmlBtn.addListener( SWT.MouseUp, new Listener() {
public void handleEvent(Event event) {
if(mml == true){
mml=false;
deleteParcelFromList(mmlPar);
}
else{
mml=true;
addParcelToList(mmlPar);
}
}
} ); */
mupBtn = new Button(btnGp, SWT.RADIO | SWT.BORDER);
mupBtn.setText(MUP);
mupBtn.setEnabled( true );
mupBtn.setBounds(btnGp.getBounds().x+ btnGapX, mmlBtn.getBounds().y + mmlBtn.getBounds().height+ btnGapY, btnWidth,btnHeight);
mupBtn.setData(NsharpNativeConstants.PARCELTYPE_MOST_UNSTABLE);
mupBtn.addListener( SWT.MouseUp,radioGpLsner);
/*if(mup == true)
mupBtn.setSelection(true);
else
mupBtn.setSelection(false);
mupBtn.addListener( SWT.MouseUp, new Listener() {
public void handleEvent(Event event) {
if(mup == true){
mup=false;
deleteParcelFromList(mupPar);
}
else{
mup=true;
addParcelToList(mupPar);
}
//prevParcel = currentParcel;
//currentParcel = NsharpNativeConstants.PARCELTYPE_MOST_UNSTABLE ;
//userDefdMbtext.setEnabled(false);
//userDefdMbtext.setVisible(false);
}
} ); */
effBtn = new Button(btnGp, SWT.RADIO | SWT.BORDER);
effBtn.setText(EFF);
effBtn.setEnabled( true );
effBtn.setBounds(btnGp.getBounds().x+ btnGapX, mupBtn.getBounds().y + mupBtn.getBounds().height+ btnGapY, btnWidth,btnHeight);
effBtn.setData(NsharpNativeConstants.PARCELTYPE_EFF);
effBtn.addListener( SWT.MouseUp,radioGpLsner);
/*if(eff == true)
effBtn.setSelection(true);
else
effBtn.setSelection(false);
effBtn.addListener( SWT.MouseUp, new Listener() {
public void handleEvent(Event event) {
System.out.println("EFF picked");
if(eff == true){
eff=false;
deleteParcelFromList(effPar);
}
else{
eff=true;
addParcelToList(effPar);
}
}
} ); */
udlBtn = new Button(btnGp, SWT.RADIO | SWT.BORDER);
udlBtn.setText(UDL);
@ -354,27 +165,6 @@ public class NsharpParcelDialog extends Dialog {
udlBtn.setBounds(btnGp.getBounds().x+ btnGapX, effBtn.getBounds().y + effBtn.getBounds().height+ btnGapY, btnWidth,btnHeight);
udlBtn.setData(NsharpNativeConstants.PARCELTYPE_USER_DEFINED);
udlBtn.addListener( SWT.MouseUp,radioGpLsner);
/*if(udl == true)
udlBtn.setSelection(true);
else
udlBtn.setSelection(false);
udlBtn.addListener( SWT.MouseUp, new Listener() {
public void handleEvent(Event event) {
System.out.println("UDL picked");
if(udl == true){
udl=false;
deleteParcelFromList(udlPar);
}
else{
udl=true;
addParcelToList(udlPar);
}
//prevParcel = currentParcel;
//currentParcel = NsharpNativeConstants.PARCELTYPE_USER_DEFINED ;
//userDefdMbtext.setEnabled(true);
//userDefdMbtext.setVisible(true);
}
} ); */
udlBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
@ -388,15 +178,8 @@ public class NsharpParcelDialog extends Dialog {
userDefdMbtext = new Text (btnGp, SWT.BORDER | SWT.SINGLE);
userDefdMbtext.setBounds (btnGp.getBounds().x+ btnGapX, udlBtn.getBounds().y + udlBtn.getBounds().height+ btnGapY, btnWidth/4,btnHeight);
userDefdMbtext.setText(Integer.toString(userDefdParcelMb));
//if(udlBtn.getSelection()){
userDefdMbtext.setEnabled(true);
userDefdMbtext.setVisible(true);
//}
//else {
//// userDefdMbtext.setEnabled(false);
// userDefdMbtext.setVisible(false);
//}
userDefdMbtext.setEnabled(true);
userDefdMbtext.setVisible(true);
//to make sure user enter digits only
userDefdMbtext.addListener (SWT.Verify, new Listener () {
@ -416,8 +199,8 @@ public class NsharpParcelDialog extends Dialog {
});
NsharpResourceHandler skewtRsc = NsharpEditor.getActiveNsharpEditor().getRscHandler();
if(skewtRsc!=null){
int parcelType = skewtRsc.getCurrentParcel();
switch(parcelType){
curParcelType = skewtRsc.getCurrentParcel();
switch(curParcelType){
case NsharpNativeConstants.PARCELTYPE_OBS_SFC:
curSfcBtn.setSelection(true);
break;
@ -457,27 +240,15 @@ public class NsharpParcelDialog extends Dialog {
}
NsharpResourceHandler skewtRsc = NsharpEditor.getActiveNsharpEditor().getRscHandler();
skewtRsc.setCurrentParcel(curParcelType);
//if(udl == true)
//udlPar.setParcelLayerPressure(userDefdParcelMb);
//skewtRsc.setParcelList(parcelList);
//skewtRsc.setCurrentParcelData(NsharpNativeConstants.PARCELTYPE_USER_DEFINED,userDefdParcelMb);
//else {
// parceldata.setParcelLayerPressure(NsharpNativeConstants.parcelToLayerMap.get(currentParcel));
//}
//skewtRsc.addParcelToList(parceldata);
//skewtRsc.setCurrentTextPage(2);
//move close from okPressed() to here
close();
}
} );
Button canBtn = createButton(parent, IDialogConstants.CANCEL_ID,
IDialogConstants.CANCEL_LABEL, false);
IDialogConstants.CLOSE_LABEL, false);
canBtn.addListener( SWT.MouseUp, new Listener() {
public void handleEvent(Event event) {
//System.out.println("cancel listener is called");
//currentParcel = prevParcel;
close();
}
} );
}
@ -541,6 +312,4 @@ public class NsharpParcelDialog extends Dialog {
return (super.close());
}
}

View file

@ -34,6 +34,9 @@ import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.viz.d2d.ui.perspectives.D2D5Pane;
import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
public class NsharpSaveHandle {
public static void saveFile(Shell shell) {
FileDialog dlg = new FileDialog(shell, SWT.SAVE);
@ -118,48 +121,90 @@ public class NsharpSaveHandle {
String textToSave = new String("");
if(rsc!=null && rsc.getSoundingLys()!= null){
List<NcSoundingLayer> soundLyList = rsc.getSoundingLys();
String latlonstr;
NsharpStationInfo stnInfo=rsc.getPickedStnInfo();
if( stnInfo!= null){
latlonstr = " LAT=" + stnInfo.getLatitude() + " LON="+ stnInfo.getLongitude();
}
else {
latlonstr = " LAT= LON= ";
}
int loadsoundingType= NsharpLoadDialog.OBSER_SND;
String loadsoundingTypeStr= "OBS";;
if(NsharpLoadDialog.getAccess()!= null ){
loadsoundingType = NsharpLoadDialog.getAccess().getActiveLoadSoundingType();
switch(loadsoundingType ){
case NsharpLoadDialog.PFC_SND:
loadsoundingTypeStr = "PFC";
break;
case NsharpLoadDialog.MODEL_SND:
loadsoundingTypeStr = "MDL";
break;
case NsharpLoadDialog.OBSER_SND:
default:
loadsoundingTypeStr = "OBS";
break;
if( VizPerspectiveListener.getCurrentPerspectiveManager()!= null &&
VizPerspectiveListener.getCurrentPerspectiveManager().getPerspectiveId().equals(D2D5Pane.ID_PERSPECTIVE))
{
List<NcSoundingLayer> soundLyList = rsc.getSoundingLys();
String latlonstr;
NsharpStationInfo stnInfo=rsc.getPickedStnInfo();
if( stnInfo!= null){
latlonstr = " LAT=" + stnInfo.getLatitude() + " LON="+ stnInfo.getLongitude();
}
else {
latlonstr = " LAT= LON= ";
}
int loadsoundingType= NsharpLoadDialog.OBSER_SND;
String loadsoundingTypeStr= "OBS";;
if(NsharpLoadDialog.getAccess()!= null ){
loadsoundingType = NsharpLoadDialog.getAccess().getActiveLoadSoundingType();
switch(loadsoundingType ){
case NsharpLoadDialog.PFC_SND:
loadsoundingTypeStr = "PFC";
break;
case NsharpLoadDialog.MODEL_SND:
loadsoundingTypeStr = "MDL";
break;
case NsharpLoadDialog.OBSER_SND:
default:
loadsoundingTypeStr = "OBS";
break;
}
}
textToSave = loadsoundingTypeStr+ " "+rsc.getPickedStnInfo().getSndType() +" "+rsc.getPickedStnInfoStr() + latlonstr
+ "\n" + "PRESSURE HGHT\t TEMP\t DWPT WDIR WSPD OMEG\n";
String tempText="";
for (NcSoundingLayer layer: soundLyList){
tempText = String.format("%f %f %f %f %f %f %f\n", layer.getPressure(),
layer.getGeoHeight(),layer.getTemperature(),layer.getDewpoint(), layer.getWindDirection(),
layer.getWindSpeed(), layer.getOmega());
textToSave = textToSave + tempText;
}
}
textToSave = loadsoundingTypeStr+ " "+rsc.getPickedStnInfo().getSndType() +" "+rsc.getPickedStnInfoStr() + latlonstr
+ "\n" + "PRESSURE HGHT\t TEMP\t DWPT WDIR WSPD OMEG\n";
String tempText="";
for (NcSoundingLayer layer: soundLyList){
tempText = String.format("%f %f %f %f %f %f %f\n", layer.getPressure(),
layer.getGeoHeight(),layer.getTemperature(),layer.getDewpoint(), layer.getWindDirection(),
layer.getWindSpeed(), layer.getOmega());
textToSave = textToSave + tempText;
else{
List<NcSoundingLayer> soundLyList = rsc.getSoundingLys();
String latlonstr;
NsharpStationInfo stnInfo=rsc.getPickedStnInfo();
if( stnInfo!= null){
latlonstr = "LAT=" + stnInfo.getLatitude() + "; LON="+ stnInfo.getLongitude()+";";
}
else {
latlonstr = "LAT=; LON=; ";
}
int loadsoundingType= NsharpLoadDialog.OBSER_SND;
String loadsoundingTypeStr= "OBS";;
if(NsharpLoadDialog.getAccess()!= null ){
loadsoundingType = NsharpLoadDialog.getAccess().getActiveLoadSoundingType();
switch(loadsoundingType ){
case NsharpLoadDialog.PFC_SND:
loadsoundingTypeStr = "PFC";
break;
case NsharpLoadDialog.MODEL_SND:
loadsoundingTypeStr = "MDL";
break;
case NsharpLoadDialog.OBSER_SND:
default:
loadsoundingTypeStr = "OBS";
break;
}
}
textToSave ="SNDTYPE="+ loadsoundingTypeStr+"; TITLE="+rsc.getPickedStnInfoStr() + "; STNID="+rsc.getPickedStnInfo().getStnId() +"; " + latlonstr
+ "\n " + "PRESSURE HGHT\t TEMP\t DWPT WDIR WSPD OMEG \n";
String tempText="";
for (NcSoundingLayer layer: soundLyList){
tempText = String.format("%f %f %f %f %f %f %f\n", layer.getPressure(),
layer.getGeoHeight(),layer.getTemperature(),layer.getDewpoint(), layer.getWindDirection(),
layer.getWindSpeed(), layer.getOmega());
textToSave = textToSave + tempText;
}
}
out.write(textToSave);
//Close the output stream
out.close();
}
out.write(textToSave);
//Close the output stream
out.close();
}catch (Exception e){//Catch exception if any
System.err.println("Error: " + e.getMessage());
}
}
}
}

View file

@ -55,7 +55,7 @@ public class NsharpShowTextDialog extends Dialog {
private Group textGp;
private Font newFont ;
private static boolean iAmClosed;
private static String textToSave="";
//private static String textToSave="";
public Text getText() {
return text;
}
@ -287,7 +287,7 @@ public class NsharpShowTextDialog extends Dialog {
latlonstr = " LAT= LON= ";
}
String textToShow = rsc.getPickedStnInfo().getSndType() +" "+rsc.getPickedStnInfoStr() + latlonstr+ "\n" + hdr;
textToSave = rsc.getPickedStnInfo().getSndType() +" "+rsc.getPickedStnInfoStr() + latlonstr + "\n" + hdr;
//textToSave = rsc.getPickedStnInfo().getSndType() +" "+rsc.getPickedStnInfoStr() + latlonstr + "\n" + hdr;
String tempText="", tempSaveText="";
for (NcSoundingLayer layer: soundLyList){
tempText = String.format("%7.2f\t%8.2f %7.2f %7.2f %6.2f %6.2f %9.6f\n", layer.getPressure(),
@ -297,7 +297,7 @@ public class NsharpShowTextDialog extends Dialog {
layer.getGeoHeight(),layer.getTemperature(),layer.getDewpoint(), layer.getWindDirection(),
layer.getWindSpeed(), layer.getOmega());
textToShow = textToShow + tempText;
textToSave = textToSave + tempSaveText;
//textToSave = textToSave + tempSaveText;
}
text.setText(textToShow);

View file

@ -131,10 +131,11 @@ public class ObservedSoundingDialogContents {
//convert to Nsharp's own station info struct
NsharpStationInfo stn = new NsharpStationInfo();
stn.setStnDisplayInfo(stnInfoStr + " " + selectedSndTime+ " "+currentSndType.toString());
String packedStnInfoStr= stnInfoStr.replace(" ", "_");
stn.setStnDisplayInfo(packedStnInfoStr + " " + selectedSndTime+ " "+currentSndType.toString());
stn.setLongitude(lon);
stn.setLatitude(lat);
//stn.setElevation(elv);
stn.setStnId(stnInfoStr);
stn.setReftime(synoptictime);
stn.setRangestarttime(synoptictime);
stn.setSndType(currentSndType.toString());
@ -144,9 +145,9 @@ public class ObservedSoundingDialogContents {
}
NsharpMapResource.bringMapEditorToTop();
}
}
}
private void handleSndTimeSelection(){
String selectedSndTime=null;
if (sndTimeList.getSelectionCount() > 0 ) {
@ -209,7 +210,7 @@ public class ObservedSoundingDialogContents {
createObsvdSndUairList();
}
} );
midGp = new Group(parent,SWT.SHADOW_ETCHED_IN);
midGp.setLayout( new GridLayout( 2, false ) );
timeBtn = new Button(midGp, SWT.CHECK | SWT.BORDER);
@ -257,7 +258,7 @@ public class ObservedSoundingDialogContents {
//create a selection listener to handle user's selection on list
sndTimeList.addListener ( SWT.Selection, new Listener () {
//private String selectedSndTime=null;
public void handleEvent (Event e) {
public void handleEvent (Event e) {
handleSndTimeSelection();
}
});
@ -265,7 +266,7 @@ public class ObservedSoundingDialogContents {
if(currentSndType== NcSoundingProfile.ObsSndType.NCUAIR || currentSndType == NcSoundingProfile.ObsSndType.BUFRUA){
if(currentSndType== NcSoundingProfile.ObsSndType.NCUAIR )
uairBtn.setSelection(true);
else
else
bufruaBtn.setSelection(true);
createObsvdSndUairList();
selectedTimeList = ldDia.getObsSelectedTimeList();
@ -273,7 +274,7 @@ public class ObservedSoundingDialogContents {
String[] selTimeStringArray = Arrays.copyOf(selTimeObjectArray, selTimeObjectArray.length, String[].class);
sndTimeList.setSelection(selTimeStringArray);
handleSndTimeSelection();
}
}
}
public void cleanup(){
if(sndTimeList != null){

View file

@ -140,7 +140,7 @@ public class PfcSoundingDialogContents {
private void handleAvailFileListSelection(){
String selectedFile=null;
if (availablefileList.getSelectionCount() > 0 ) {
selectedFileList.clear();
selectedFileList.clear();
for(int i=0; i < availablefileList.getSelectionCount(); i++) {
selectedFile = availablefileList.getSelection()[i];
//System.out.println("selected sounding file is " + selectedFile);
@ -250,7 +250,7 @@ public class PfcSoundingDialogContents {
//create a selection listener to handle user's selection on list
availablefileList.setFont(newFont);
availablefileList.addListener ( SWT.Selection, new Listener () {
public void handleEvent (Event e) {
public void handleEvent (Event e) {
handleAvailFileListSelection();
}
} );
@ -265,15 +265,15 @@ public class PfcSoundingDialogContents {
sndTimeList.setBounds(sndTimeListGp.getBounds().x, sndTimeListGp.getBounds().y + NsharpConstants.labelGap, NsharpConstants.listWidth, NsharpConstants.listHeight*36/5 );
sndTimeList.addListener ( SWT.Selection, new Listener () {
// private String selectedSndTime=null;
public void handleEvent (Event e) {
public void handleEvent (Event e) {
handleSndTimeSelection();
}
}
});
if(currentSndType==NcSoundingProfile.PfcSndType.GFSSND || currentSndType==NcSoundingProfile.PfcSndType.NAMSND){
if(currentSndType==NcSoundingProfile.PfcSndType.GFSSND)
gfsBtn.setSelection(true);
else
else
namBtn.setSelection(true);
createPFCAvailableFileList();
selectedFileList = ldDia.getPfcSelectedFileList();
@ -289,7 +289,7 @@ public class PfcSoundingDialogContents {
handleSndTimeSelection();
}
}
}
private void addStnPtWithoutQuery(String refTimeStr,String rangeStartStr, String selectedSndTime) {
@ -324,7 +324,8 @@ public class PfcSoundingDialogContents {
NsharpStationInfo.timeLineSpecific timeLinsSpc = stn.new timeLineSpecific();
int endIndex= Math.min(4, sndTypeStr.length());
String dispInfo = stnInfo.getStnId() + " " + selectedSndTime+" "+sndTypeStr.substring(0,endIndex);
String packedStnIdStr= stnInfo.getStnId().replace(" ", "_");
String dispInfo = packedStnIdStr + " " + selectedSndTime+" "+sndTypeStr.substring(0,endIndex);
timeLinsSpc.setDisplayInfo(dispInfo);
timeLinsSpc.setTiemLine(stnInfo.getRangeStartTime());
stn.addToTimeLineSpList(timeLinsSpc);
@ -336,7 +337,6 @@ public class PfcSoundingDialogContents {
//if(i <10)
// System.out.println( "disP="+dispInfo+" refT= "+stnInfo.getSynopTime()+ " rangSt="+stnInfo.getRangeStartTime());
stnPoints.add(stn);
;
}

View file

@ -148,6 +148,7 @@ if [ "${1}" = "-delta" ]; then
buildRPM "Installer.ncep-database"
buildRPM "awips2-gfesuite-client"
buildRPM "awips2-gfesuite-server"
buildRPM "awips2-python"
buildRPM "awips2-python-dynamicserialize"
buildRPM "awips2-python-ufpy"
buildRPM "awips2-python-qpid"
@ -156,19 +157,19 @@ if [ "${1}" = "-delta" ]; then
buildRPM "awips2-aviation-shared"
buildRPM "awips2-cli"
buildRPM "awips2-database"
buildRPM "awips2-database-server-configuration"
buildRPM "awips2-database-standalone-configuration"
buildRPM "awips2-data.hdf5-gfe.climo"
buildRPM "awips2-hydroapps-shared"
buildRPM "awips2-localapps-environment"
buildRPM "awips2-maps-database"
# buildRPM "awips2-database-server-configuration"
# buildRPM "awips2-database-standalone-configuration"
# buildRPM "awips2-data.hdf5-gfe.climo"
# buildRPM "awips2-hydroapps-shared"
# buildRPM "awips2-localapps-environment"
# buildRPM "awips2-maps-database"
buildRPM "awips2-notification"
buildRPM "awips2-pypies"
buildRPM "awips2-data.hdf5-topo"
buildRPM "awips2-data.gfe"
# buildRPM "awips2-pypies"
# buildRPM "awips2-data.hdf5-topo"
# buildRPM "awips2-data.gfe"
buildRPM "awips2-rcm"
buildRPM "awips2-edex-environment"
buildLocalizationRPMs
# buildLocalizationRPMs
if [ $? -ne 0 ]; then
exit 1
fi