Merge "Omaha #4597 better labels for lightning resources" into omaha_15.1.1

Former-commit-id: 012b25ea74cafa905d88dc6b6ac266a3cb5e6547
This commit is contained in:
Nate Jensen 2015-07-01 14:51:48 -05:00 committed by Gerrit Code Review
commit f6ca835ee9
2 changed files with 69 additions and 50 deletions

View file

@ -59,6 +59,7 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
import com.raytheon.uf.viz.core.rsc.capabilities.DensityCapability;
import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability;
import com.raytheon.viz.lightning.LightningResourceData.DisplayType;
import com.raytheon.viz.lightning.cache.LightningFrame;
import com.raytheon.viz.lightning.cache.LightningFrameMetadata;
import com.raytheon.viz.lightning.cache.LightningFrameRetriever;
@ -97,6 +98,7 @@ import com.raytheon.viz.lightning.cache.LightningFrameRetriever;
* Mar 05, 2015 4233 bsteffen include source in cache key.
* Apr 09, 2015 4386 bclement added updateLightningFrames()
* Jul 01, 2015 4592 bclement cloud flashes are now points instead of circles
* Jul 01, 2015 4597 bclement reworked resource name using DisplayType
*
* </pre>
*
@ -210,26 +212,14 @@ public class LightningResource extends
} else {
rval = convertTimeIntervalToString(absTimeInterval);
}
if (resourceData.isExclusiveForType()) {
String modifier;
if (resourceData.isHandlingCloudFlashes()) {
modifier = "Cloud Flash ";
} else if (resourceData.isHandlingNegativeStrikes()) {
modifier = "Negative ";
} else if (resourceData.isHandlingPositiveStrikes()) {
modifier = "Positive ";
} else if (resourceData.isHandlingPulses()) {
modifier = "Pulse ";
} else {
/* space to preserve formatting */
modifier = " ";
}
rval += modifier;
DisplayType displayType = resourceData.getDisplayType();
if (!displayType.equals(DisplayType.UNDEFINED)) {
rval += displayType.label + ' ';
}
String source = resourceData.getSource();
if (source != null) {
rval += source + " ";
rval += source + ' ';
}
return rval;
}

View file

@ -49,6 +49,7 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties;
* Jun 19, 2014 3214 bclement added pulse and cloud flash support
* Jul 07, 2014 3333 bclement removed plotLightSource field
* Mar 05, 2015 4233 bsteffen include source in cache key.
* Jul 01, 2015 4597 bclement added DisplayType
* </pre>
*
* @author chammack
@ -59,6 +60,20 @@ public class LightningResourceData extends AbstractRequestableResourceData {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(LightningResourceData.class);
/*
* certain combination of lightning types get specific display labels
*/
public static enum DisplayType {
UNDEFINED(""), CLOUD_FLASH("Cloud Flash"), NEGATIVE("Negative"), POSITIVE(
"Positive"), PULSE("Pulse"), TOTAL_FLASH("Total"), CLOUD_TO_GROUND(
"Cloud to Ground");
public final String label;
private DisplayType(String name) {
this.label = name;
}
}
@XmlAttribute
private boolean handlingPositiveStrikes = true;
@ -159,32 +174,6 @@ public class LightningResourceData extends AbstractRequestableResourceData {
return handlingPulses;
}
/**
* @see #isHandlingCloudFlashes()
* @see #isHandlingNegativeStrikes()
* @see #isHandlingPositiveStrikes()
* @see #isHandlingPulses()
* @return true if resource data handles exactly one type of data
*/
public boolean isExclusiveForType() {
boolean[] bools = { isHandlingCloudFlashes(),
isHandlingNegativeStrikes(), isHandlingPositiveStrikes(),
isHandlingPulses() };
boolean handlingZero = true;
boolean handlingMoreThanOne = false;
for (boolean handlingSomething : bools) {
if (handlingSomething) {
if (handlingZero) {
handlingZero = false;
} else {
handlingMoreThanOne = true;
break;
}
}
}
return !handlingZero && !handlingMoreThanOne;
}
/**
* @param handlingPulses
* the handlingPulses to set
@ -194,8 +183,7 @@ public class LightningResourceData extends AbstractRequestableResourceData {
}
/**
* @return countPosition
* the countPosition to get - JJG
* @return countPosition the countPosition to get - JJG
*/
public int getCountPosition() {
return countPosition;
@ -218,6 +206,47 @@ public class LightningResourceData extends AbstractRequestableResourceData {
return null;
}
public DisplayType getDisplayType() {
DisplayType rval;
byte bitset = 0x00;
if (handlingCloudFlashes) {
bitset |= 0x01;
}
if (handlingNegativeStrikes) {
bitset |= 0x02;
}
if (handlingPositiveStrikes) {
bitset |= 0x04;
}
if (handlingPulses) {
bitset |= 0x08;
}
switch (bitset) {
case 0x01:
rval = DisplayType.CLOUD_FLASH;
break;
case 0x02:
rval = DisplayType.NEGATIVE;
break;
case 0x04:
rval = DisplayType.POSITIVE;
break;
case 0x06:
rval = DisplayType.CLOUD_TO_GROUND;
break;
case 0x07:
rval = DisplayType.TOTAL_FLASH;
break;
case 0x08:
rval = DisplayType.PULSE;
break;
default:
rval = DisplayType.UNDEFINED;
}
return rval;
}
/*
* (non-Javadoc)
*