diff --git a/cave/build/static/common/cave/etc/gfe/userPython/utilities/SmartScript.py b/cave/build/static/common/cave/etc/gfe/userPython/utilities/SmartScript.py
index 3e9ca66192..09bb9c0ff6 100644
--- a/cave/build/static/common/cave/etc/gfe/userPython/utilities/SmartScript.py
+++ b/cave/build/static/common/cave/etc/gfe/userPython/utilities/SmartScript.py
@@ -42,6 +42,8 @@
# improve performance.
# Mar 13, 2013 1793 bsteffen Performance improvements for
# TCMWindTool
+# Apr 24, 2013 1947 randerso Fix UVToMagDir to work with scalar arguments
+# Cleaned up some constants
#
########################################################################
import types, string, time, sys
@@ -49,6 +51,7 @@ from math import *
from numpy import *
import os
import numpy
+import math
import re
import jep
import BaseTool, Exceptions
@@ -788,19 +791,26 @@ class SmartScript(BaseTool.BaseTool):
## Conversion methods
def UVToMagDir(self, u, v):
- RAD_TO_DEG = 57.29577951308232
+ RAD_TO_DEG = 180.0 / numpy.pi
# Sign change to make math to meteor. coords work
- u = - u
- v = - v
- speed = numpy.sqrt(u * u + v * v)
- dir = numpy.arctan2(u, v) * RAD_TO_DEG
- # adjust values so that 0
= 360.0:
+ dir = dir - 360.0
return (speed, dir)
def MagDirToUV(self, mag, dir):
- DEG_TO_RAD = 0.017453292519943295
+ DEG_TO_RAD = numpy.pi / 180.0
# Note sign change for components so math to meteor. coords works
uw = - sin(dir * DEG_TO_RAD) * mag
vw = - cos(dir * DEG_TO_RAD) * mag
@@ -808,7 +818,7 @@ class SmartScript(BaseTool.BaseTool):
def convertMsecToKts(self, value_Msec):
# Convert from meters/sec to Kts
- return value_Msec * 1.944
+ return value_Msec * 3600.0 / 1852.0
def convertKtoF(self, t_K):
# Convert the temperature from Kelvin to Fahrenheit
@@ -830,7 +840,7 @@ class SmartScript(BaseTool.BaseTool):
def convertFtToM(self, value_Ft):
# Convert the value in Feet to Meters
- return value_Ft/3.28084
+ return value_Ft * 0.3048
#########################################################################
## Error Handling ##
diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/rsc/ResourceList.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/rsc/ResourceList.java
index b23d686208..e7fb2b91ad 100644
--- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/rsc/ResourceList.java
+++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/rsc/ResourceList.java
@@ -59,6 +59,8 @@ import com.raytheon.uf.viz.core.rsc.capabilities.AbstractCapability;
* ------------ ---------- ----------- --------------------------
* Sep 5, 2007 chammack Initial Creation.
* Apr 9, 2009 1288 rjpeter Added iterator implementation to fix remove.
+ * Apr 24, 2013 1950 bsteffen Sort resources before instantiation.
+ *
*
*
* @author chammack
@@ -76,6 +78,33 @@ public class ResourceList extends CopyOnWriteArrayList implements
private static final int LOWEST = RenderingOrderFactory.ResourceOrder.LOWEST.value;
+ private static final Comparator INSTANTIATION_ORDERER = new Comparator() {
+
+ @Override
+ public int compare(ResourcePair rp1, ResourcePair rp2) {
+ if (rp1.getProperties().isSystemResource()) {
+ if (rp2.getProperties().isSystemResource()) {
+ return 0;
+ } else {
+ return -1;
+ }
+ } else if (rp2.getProperties().isSystemResource()) {
+ return 1;
+ }
+ if (rp1.getProperties().isMapLayer()) {
+ if (rp2.getProperties().isMapLayer()) {
+ return 0;
+ } else {
+ return -1;
+ }
+ } else if (rp2.getProperties().isMapLayer()) {
+ return 1;
+ }
+ return 0;
+ }
+
+ };
+
private final transient Set preAddListeners;
private final transient Set postAddListeners;
@@ -868,17 +897,16 @@ public class ResourceList extends CopyOnWriteArrayList implements
boolean fireListeners) {
List orderedList = null;
synchronized (resourcesToInstantiate) {
- if (descriptor.getTimeMatcher() != null) {
- orderedList = new ArrayList(descriptor
- .getTimeMatcher().getResourceLoadOrder(
- resourcesToInstantiate));
- } else {
- orderedList = new ArrayList(
- resourcesToInstantiate);
- }
+ orderedList = new ArrayList(resourcesToInstantiate);
resourcesToInstantiate.removeAll(orderedList);
}
+ Collections.sort(orderedList, INSTANTIATION_ORDERER);
+ if (descriptor.getTimeMatcher() != null) {
+ orderedList = new ArrayList(descriptor
+ .getTimeMatcher().getResourceLoadOrder(orderedList));
+ }
+
Iterator iterator = orderedList.iterator();
List noTimes = new ArrayList();
List successful = new ArrayList();
@@ -1025,4 +1053,6 @@ public class ResourceList extends CopyOnWriteArrayList implements
}
return resources;
}
+
+
}
diff --git a/cave/com.raytheon.uf.viz.monitor.ffmp/src/com/raytheon/uf/viz/monitor/ffmp/ui/rsc/FFMPDataGenerator.java b/cave/com.raytheon.uf.viz.monitor.ffmp/src/com/raytheon/uf/viz/monitor/ffmp/ui/rsc/FFMPDataGenerator.java
index 19a59baba8..ed4b16d20c 100644
--- a/cave/com.raytheon.uf.viz.monitor.ffmp/src/com/raytheon/uf/viz/monitor/ffmp/ui/rsc/FFMPDataGenerator.java
+++ b/cave/com.raytheon.uf.viz.monitor.ffmp/src/com/raytheon/uf/viz/monitor/ffmp/ui/rsc/FFMPDataGenerator.java
@@ -74,6 +74,7 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FfmpTableConfigData;
* Apr 12, 2013 1902 mpduff Code Cleanup.
* Apr 15, 2013 1890 dhladky Added another constant fix.
* Apr 15, 2013 1911 dhladky Fixed forced FFG for centered aggregates.
+ * Apr 24, 2013 1946 mpduff Fixed FFFG value for ALL when an aggregate is forced
*
*
* @author dhladky
@@ -104,7 +105,7 @@ public class FFMPDataGenerator {
private final String huc;
- private final List domains;
+ private final ArrayList domains;
private final double sliderTime;
@@ -177,6 +178,12 @@ public class FFMPDataGenerator {
ffmpTableCfgData = tableConfig.getTableConfigData(siteKey);
}
+ /**
+ * Generate the FFMP Data.
+ *
+ * @return FFMPTableData object
+ * @throws Exception
+ */
public FFMPTableData generateFFMPData() throws Exception {
// You should always have at least a QPE data source
FFMPTableData tData = null;
@@ -256,8 +263,9 @@ public class FFMPDataGenerator {
* is in the CWA
*/
- List pfafs = ft.getAggregatePfafs(
- key, siteKey, huc);
+ ArrayList pfafs = ft
+ .getAggregatePfafs(key, siteKey,
+ huc);
boolean isVGB = false;
if (ft.checkVGBsInAggregate(key, siteKey,
@@ -493,7 +501,9 @@ public class FFMPDataGenerator {
forced = forceUtil.isForced();
}
- if ((!forcedPfafs.isEmpty()) && forced && centeredAggregationKey == null) {
+ if ((!forcedPfafs.isEmpty()) && forced
+ && centeredAggregationKey == null
+ && !pfafList.isEmpty()) {
// Recalculate the guidance using the forced
// value(s)
guidance = guidRecords
@@ -506,7 +516,9 @@ public class FFMPDataGenerator {
guidance,
forcedPfafs,
resource.getGuidSourceExpiration(guidType));
- } else if (!forcedPfafs.isEmpty() && centeredAggregationKey == null) {
+ } else if (!forcedPfafs.isEmpty()
+ && centeredAggregationKey == null
+ && !pfafList.isEmpty()) {
guidance = guidRecords
.get(guidType)
.getBasinData(ALL)
@@ -518,7 +530,8 @@ public class FFMPDataGenerator {
forcedPfafs,
resource.getGuidSourceExpiration(guidType));
forced = true;
- } else if (!pfafList.isEmpty() && centeredAggregationKey == null) {
+ } else if (!pfafList.isEmpty()
+ && centeredAggregationKey == null) {
guidance = guidRecords
.get(guidType)
.getBasinData(ALL)
@@ -659,7 +672,9 @@ public class FFMPDataGenerator {
forced = forceUtil.isForced();
}
- if ((!forcedPfafs.isEmpty()) && forced && centeredAggregationKey == null) {
+ if ((!forcedPfafs.isEmpty()) && forced
+ && centeredAggregationKey == null
+ && !pfafList.isEmpty()) {
// Recalculate the guidance using the forced
// value(s)
guidance = guidRecords
@@ -672,7 +687,9 @@ public class FFMPDataGenerator {
guidance,
forcedPfafs,
resource.getGuidSourceExpiration(guidType));
- } else if (!forcedPfafs.isEmpty() && centeredAggregationKey == null) {
+ } else if (!forcedPfafs.isEmpty()
+ && centeredAggregationKey == null
+ && !pfafList.isEmpty()) {
guidance = guidRecords
.get(guidType)
.getBasinData(ALL)
@@ -684,7 +701,8 @@ public class FFMPDataGenerator {
forcedPfafs,
resource.getGuidSourceExpiration(guidType));
forced = true;
- } else if (!pfafList.isEmpty() && centeredAggregationKey == null) {
+ } else if (!pfafList.isEmpty()
+ && centeredAggregationKey == null) {
guidance = guidRecords
.get(guidType)
.getBasinData(ALL)
diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/ProductScriptsDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/ProductScriptsDialog.java
index 7ed4999be5..66a94cef21 100644
--- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/ProductScriptsDialog.java
+++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/ProductScriptsDialog.java
@@ -353,11 +353,11 @@ public class ProductScriptsDialog extends CaveJFACEDialog {
start = start - 3;
cmd = cmd.substring(0, start) + returnMsg;
-
- TaskManager.getInstance().createScriptTask(name, cmd);
- }
+ }
}
+ TaskManager.getInstance().createScriptTask(name, cmd);
+
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
e);
diff --git a/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/MPEDisplayManager.java b/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/MPEDisplayManager.java
index e6544bcfad..3cd73cd5bb 100644
--- a/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/MPEDisplayManager.java
+++ b/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/MPEDisplayManager.java
@@ -19,6 +19,7 @@
**/
package com.raytheon.viz.mpe.ui;
+import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
@@ -99,7 +100,8 @@ import com.raytheon.viz.ui.editor.IMultiPaneEditor;
* ------------ ---------- ----------- --------------------------
* Dec 18, 2012 mschenke Initial creation
* Mar 14, 2013 1457 mpduff Reset the gages on the resource.
- * Apr 18, 2013 1920 mpduff Added updateGages method to reload the gage data.
+ * Apr 18, 2013 1920 mpduff Added updateGages method to reload the gage data,
+ * fix formatting of legend for Base field Height.
*
*
*
@@ -979,6 +981,13 @@ public class MPEDisplayManager {
APPLICATION_NAME, cvUse, durationInHrs * 60 * 60, "E",
pColorSetGroup).toArray(new Colorvalue[0]);
+ DisplayFieldData displayField = DisplayFieldData.fromString(cvUse);
+
+ if (displayField == DisplayFieldData.Height) {
+ params.setFormatString("0");
+ }
+ DecimalFormat format = new DecimalFormat(params.getFormatString());
+
int numColors = colorSet.length;
float[] red = new float[numColors];
float[] green = new float[numColors];
@@ -1002,6 +1011,9 @@ public class MPEDisplayManager {
// display
entry.setDisplayValue(dataToDisplay
.convert((short) displayToData.convert(threshold)));
+ if (displayField != DisplayFieldData.Index) {
+ entry.setLabel(format.format(threshold));
+ }
}
entry.setPixelValue((double) i);
@@ -1022,7 +1034,7 @@ public class MPEDisplayManager {
params.setColorMapMax(params.getDataMax());
// Check for Index parameter and set labels to radar sites
- if (DisplayFieldData.fromString(cvUse) == DisplayFieldData.Index) {
+ if (displayField == DisplayFieldData.Index) {
MPERadarLoc[] radars = MPEDataManager.getInstance().getRadars()
.toArray(new MPERadarLoc[0]);
DataMappingEntry[] entries = dm.getEntries().toArray(
@@ -1037,7 +1049,7 @@ public class MPEDisplayManager {
entries[i].setLabel("");
}
}
- }
+ }
return params;
}
diff --git a/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/dialogs/ChooseDataPeriodDialog.java b/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/dialogs/ChooseDataPeriodDialog.java
index b66a76fd36..75114f9e6f 100644
--- a/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/dialogs/ChooseDataPeriodDialog.java
+++ b/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/dialogs/ChooseDataPeriodDialog.java
@@ -61,6 +61,8 @@ import com.raytheon.viz.ui.editor.IMultiPaneEditor;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 23, 2008 randerso Initial creation
+ * Apr 30, 2013 lbousaidi made seconds in the date/Time
+ * fields visible.
*
*
* @author randerso
@@ -259,7 +261,7 @@ public class ChooseDataPeriodDialog extends CaveJFACEDialog {
lastSave = new Label(statusComp, SWT.NONE);
lastSave.setText("NA");
data = new GridData(SWT.DEFAULT, SWT.DEFAULT, false, false);
- data.widthHint = 120;
+ data.widthHint = 140;
lastSave.setLayoutData(data);
Label lab2 = new Label(statusComp, SWT.NONE);
@@ -268,7 +270,7 @@ public class ChooseDataPeriodDialog extends CaveJFACEDialog {
lastExec = new Label(statusComp, SWT.NONE);
lastExec.setText("NA");
data = new GridData(SWT.DEFAULT, SWT.DEFAULT, false, false);
- data.widthHint = 120;
+ data.widthHint = 140;
lastExec.setLayoutData(data);
Label lab3 = new Label(statusComp, SWT.NONE);
diff --git a/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/dialogs/Display7x7Dialog.java b/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/dialogs/Display7x7Dialog.java
index 6a0ed2facf..25c32b0cb8 100644
--- a/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/dialogs/Display7x7Dialog.java
+++ b/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/dialogs/Display7x7Dialog.java
@@ -69,6 +69,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 2, 2008 randerso Initial creation
+ * May 01,2013 15920 lbousaidi gages get updated after clicking on
+ * Regenerate Hour Fields without closing 7x7 Gui.
*
*
* @author randerso
@@ -179,8 +181,7 @@ public class Display7x7Dialog extends CaveSWTDialog {
if (gData != null) {
workingGage = new MPEDataManager.MPEGageData();
- workingGage = gData;
- undoEn = true;
+ workingGage = gData;
} else if (editGage.containsKey(selectedGage.getId())) {
workingGage = editGage.get(selectedGage.getId());
undoEn = true;
@@ -482,6 +483,14 @@ public class Display7x7Dialog extends CaveSWTDialog {
undoMissing.setEnabled(undoEn);
String wid = workingGage.getId();
editGage.put(wid, workingGage);
+
+ if (!editGage.isEmpty()) {
+ Iterator x = editGage.values().iterator();
+ for (int i = 0; i < editGage.size(); i++) {
+ MPEGageData gd = x.next();
+ MPEDataManager.getInstance().addEditedGage(gd);
+ }
+ }
}
});
@@ -557,6 +566,14 @@ public class Display7x7Dialog extends CaveSWTDialog {
oldManedit = workingGage.isManedit();
workingGage.setManedit(true);
editGage.put(wid, workingGage);
+
+ if (!editGage.isEmpty()) {
+ Iterator x = editGage.values().iterator();
+ for (int i = 0; i < editGage.size(); i++) {
+ MPEGageData gd = x.next();
+ MPEDataManager.getInstance().addEditedGage(gd);
+ }
+ }
}
});
@@ -890,10 +907,9 @@ public class Display7x7Dialog extends CaveSWTDialog {
valueLabel.setText(String.format("%4.2f", scaleVal / 100.0f));
if (gageVal.equalsIgnoreCase("bad")) {
setBad.setText("Set Not Bad");
- }
- if (gageVal.equalsIgnoreCase("missing")) {
- setMissing.setEnabled(false);
- }
+ }
+
+ undoMissing.setEnabled(false);
updateGridField(displayTypes[prodSetCbo.getSelectionIndex()]);
}
diff --git a/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/rsc/MPEGageResource.java b/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/rsc/MPEGageResource.java
index 7d8a97d864..dd3c8974fb 100644
--- a/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/rsc/MPEGageResource.java
+++ b/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/rsc/MPEGageResource.java
@@ -47,6 +47,7 @@ import com.raytheon.uf.common.colormap.Color;
import com.raytheon.uf.common.geospatial.ReferencedCoordinate;
import com.raytheon.uf.common.ohd.AppsDefaults;
import com.raytheon.uf.common.status.UFStatus.Priority;
+import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.DrawableCircle;
import com.raytheon.uf.viz.core.DrawableString;
import com.raytheon.uf.viz.core.IExtent;
@@ -95,6 +96,7 @@ import com.vividsolutions.jts.index.strtree.STRtree;
* Sep 5, 2012 15079 snaples Added constant for Milli to inches conversion factor
* Feb 12, 2013 15773 snaples Updated addPoints to display PC gages when token is set to use PC data.
* Mar 14, 2013 1457 mpduff Fixed various bugs.
+ * Apr 19, 2013 1920 mpduff Fixed gage color contrast, add e to display value of manually edited gages.
*
*
*
@@ -349,10 +351,10 @@ public class MPEGageResource extends AbstractMPEInputResource implements
MPEDisplayManager.GageMissingOptions gm = MPEDisplayManager
.getGageMissing();
boolean displayIsEdit = false;
- if (paintProps.getDataTime() != null
- && displayMgr.getCurrentEditDate() != null) {
- displayIsEdit = displayMgr.getCurrentEditDate().equals(
- paintProps.getDataTime().getRefTime());
+ DataTime paintTime = paintProps.getFramesInfo().getCurrentFrame();
+ Date editTime = displayMgr.getCurrentEditDate();
+ if (paintTime != null && editTime != null) {
+ displayIsEdit = editTime.equals(paintTime.getRefTime());
}
boolean xor = MPEDisplayManager.getGageColor() == GageColor.Contrast
&& displayIsEdit;
@@ -420,6 +422,9 @@ public class MPEGageResource extends AbstractMPEInputResource implements
}
if (isGageIdsDisplayed || isGageValuesDisplayed) {
+ if (gageData.isManedit()) {
+ gageValue = gageValue.concat("e");
+ }
DrawableString string = new DrawableString(
new String[] { gageValue, gageId, }, gageColor);
string.font = font;
diff --git a/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/rsc/PlotMeanAreaPrecipResource.java b/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/rsc/PlotMeanAreaPrecipResource.java
index 5e2feb4ac5..ab852f45aa 100644
--- a/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/rsc/PlotMeanAreaPrecipResource.java
+++ b/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/rsc/PlotMeanAreaPrecipResource.java
@@ -71,6 +71,7 @@ import com.vividsolutions.jts.geom.Polygon;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 8, 2009 snaples Initial creation
+ * May 2, 2013 15970 snaples Updated setColor to use the correct color.
*
*
*
@@ -96,7 +97,7 @@ public class PlotMeanAreaPrecipResource extends
private ColorMapParameters parameters = new ColorMapParameters();
- private List colorSet;
+ private final List colorSet;
public PlotMeanAreaPrecipResource(MPEDisplayManager displayMgr,
List colorSet) {
@@ -542,12 +543,23 @@ public class PlotMeanAreaPrecipResource extends
if (i == colorMap.getColors().size()) {
break;
}
+ // DR 15970
+ // Adjusted the index value of the color returned, was
+ // returning one level higher than value should have.
if (value == entry.getDisplayValue()) {
+ if (i == 0){
gcol = convertC(colorMap.getColors().get(i));
+ } else {
+ gcol = convertC(colorMap.getColors().get(i - 1));
+ }
break;
} else if (value < entry.getDisplayValue()) {
- gcol = convertC(colorMap.getColors().get(i));
- break;
+ if (i == 0){
+ gcol = convertC(colorMap.getColors().get(i));
+ } else {
+ gcol = convertC(colorMap.getColors().get(i - 1));
+ }
+ break;
}
i++;
}
diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java
index 18b049b052..230446c510 100644
--- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java
+++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java
@@ -319,6 +319,7 @@ import com.raytheon.viz.ui.dialogs.SWTMessageBox;
* is not a valid WMO heading.
* 31JAN2013 1563 rferrel Force location of airport tooltip.
* 31JAN2013 1568 rferrel Spell checker now tied to this dialog instead of parent.
+ * 26Apr2013 16123 snaples Removed setFocus to TextEditor in postExecute method.
*
*
* @author lvenable
@@ -1101,7 +1102,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
/**
* flag to indicate it a product request is from the GUI or an updated ob.
*/
- private AtomicInteger updateCount = new AtomicInteger(0);
+ private final AtomicInteger updateCount = new AtomicInteger(0);
/**
* The expire notification when editing a warn gen product.
@@ -1199,7 +1200,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
/**
* Job to handle query for products off the UI thread.
*/
- private ProductQueryJob productQueryJob = new ProductQueryJob(this);
+ private final ProductQueryJob productQueryJob = new ProductQueryJob(this);
/**
* Flag to indicate if the dialog is in wait mode.
@@ -3175,10 +3176,12 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
});
afosCmdTF.addSelectionListener(new SelectionListener() {
+ @Override
public void widgetSelected(SelectionEvent event) {
}
+ @Override
public void widgetDefaultSelected(SelectionEvent event) {
String tmp = afosCmdTF.getText();
tmp = tmp.trim();
@@ -3253,6 +3256,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
});
wmoTtaaiiTF.addModifyListener(new ModifyListener() {
+ @Override
public void modifyText(ModifyEvent event) {
if (wmoTtaaiiTF.getCaretPosition() == wmoTtaaiiTF
.getTextLimit()) {
@@ -3262,10 +3266,12 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
});
wmoTtaaiiTF.addSelectionListener(new SelectionListener() {
+ @Override
public void widgetSelected(SelectionEvent event) {
}
+ @Override
public void widgetDefaultSelected(SelectionEvent event) {
wmoTtaaiiTF.setText(wmoTtaaiiTF.getText().toUpperCase());
ccccTF.setText(ccccTF.getText().toUpperCase());
@@ -3320,10 +3326,12 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
});
ccccTF.addSelectionListener(new SelectionListener() {
+ @Override
public void widgetSelected(SelectionEvent event) {
}
+ @Override
public void widgetDefaultSelected(SelectionEvent event) {
wmoTtaaiiTF.setText(wmoTtaaiiTF.getText().toUpperCase());
ccccTF.setText(ccccTF.getText().toUpperCase());
@@ -3381,10 +3389,12 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
});
awipsIdTF.addSelectionListener(new SelectionListener() {
+ @Override
public void widgetSelected(SelectionEvent event) {
}
+ @Override
public void widgetDefaultSelected(SelectionEvent event) {
awipsIdTF.setText(awipsIdTF.getText().trim().toUpperCase());
int charCount = awipsIdTF.getCharCount();
@@ -3794,6 +3804,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
// });
textEditor.addVerifyKeyListener(new VerifyKeyListener() {
+ @Override
public void verifyKey(VerifyEvent event) {
// Ignore edit keys when not in edit mode.
if (textEditor.getEditable() == false) {
@@ -3925,6 +3936,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
mi.setEnabled(isPopItemDefault[items.indexOf(pi)]);
}
mi.addListener(SWT.Selection, new Listener() {
+ @Override
public void handleEvent(Event event) {
handleSelection(event);
}
@@ -5769,6 +5781,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
/**
* Set the dispaly model's AFOS command for this editor.
*/
+ @Override
public void setAfosCmdField(String cmd) {
afosCmdTF.setText(cmd);
TextDisplayModel.getInstance().setAfosCommand(token, cmd);
@@ -5795,6 +5808,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
/**
* Convience method to execuete comand without updating ObsUpdated.
*/
+ @Override
public void executeCommand(ICommand command) {
executeCommand(command, false);
}
@@ -5831,6 +5845,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
* Request for product(s) is finish now update the display with the
* information.
*/
+ @Override
public void requestDone(ICommand command,
final List prodList, final boolean isObsUpdated) {
boolean enterEditor = false;
@@ -6012,11 +6027,6 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
} else {
resendWarningProductnItem.setEnabled(true);
}
-
- // Always give focus to textEditor after populating it.
- if (validExecuteCommand) {
- textEditor.setFocus();
- }
}
}
@@ -7181,6 +7191,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
@Override
public void run() {
getDisplay().syncExec(new Runnable() {
+ @Override
public void run() {
if (!shell.isDisposed()) {
if (autoSave == AutoSaveTask.this) {
diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/config/DbAreaSourceDataAdaptor.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/config/DbAreaSourceDataAdaptor.java
index dad661e6c7..40bddfedc7 100644
--- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/config/DbAreaSourceDataAdaptor.java
+++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/config/DbAreaSourceDataAdaptor.java
@@ -41,6 +41,7 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
* Feb 13, 2012 1605 jsanchez Calculated the point based on lat,lon values.
* Mar 25, 2013 1810 jsanchez Allowed other values to be accepted as a true value for useDirs.
* Mar 25, 2013 1605 jsanchez Set ClosestPoint's prepGeom.
+ * Apr 24, 2013 1944 jsanchez Updated calculateLocationPortion visibility to public.
*
*
*
@@ -119,10 +120,26 @@ public class DbAreaSourceDataAdaptor extends AbstractDbSourceDataAdaptor {
int gid = getGid(ptFields, attributes);
ClosestPoint cp = new ClosestPoint(name, point, population, warngenlev,
partOfArea, gid);
- cp.setPrepGeom(PreparedGeometryFactory.prepare(ptRslt.geometry));
+
+ // Used to determine if a storm location is within an urban bound area
+ if (useDirections(attributes.get(useDirectionField))) {
+ cp.setPrepGeom(PreparedGeometryFactory.prepare(ptRslt.geometry));
+ }
return cp;
}
+ /**
+ * Converts DB value (i.e. 1, t, true) to a boolean true
+ *
+ * @param useDirectionValue
+ * @return
+ */
+ private boolean useDirections(Object useDirectionValue) {
+ String userDir = String.valueOf(useDirectionValue).toLowerCase();
+ return Boolean.valueOf(userDir) || userDir.equals("t")
+ || userDir.equals("1");
+ }
+
/**
* Processes the filter to set the localized site.
*/
@@ -148,7 +165,8 @@ public class DbAreaSourceDataAdaptor extends AbstractDbSourceDataAdaptor {
/**
* Determines the part of area impacted if the userDirectionField is set to
- * true.
+ * true. This method only takes into account areas within the warning
+ * polygon.
*
* @param ptFields
* @param attributes
@@ -158,17 +176,12 @@ public class DbAreaSourceDataAdaptor extends AbstractDbSourceDataAdaptor {
private List getPartOfArea(Set ptFields,
Map attributes, Geometry geom) {
List partOfArea = null;
-
- String userDir = String.valueOf(attributes.get(useDirectionField))
- .toLowerCase();
- boolean userDirections = Boolean.valueOf(userDir)
- || userDir.equals("t") || userDir.equals("1");
- if (userDirections) {
+ if (useDirections(attributes.get(useDirectionField))) {
PreparedGeometry prepGeom = PreparedGeometryFactory.prepare(geom);
if (prepGeom.intersects(searchArea) && !prepGeom.within(searchArea)) {
Geometry intersection = searchArea.intersection(geom);
partOfArea = GisUtil.asStringList(calculateLocationPortion(
- geom, intersection, gc));
+ geom, null, intersection, gc));
if (attributes.get(suppressedDirectionsField) != null) {
String suppressedDirections = String.valueOf(
@@ -243,15 +256,20 @@ public class DbAreaSourceDataAdaptor extends AbstractDbSourceDataAdaptor {
* Calculates the cardinal directions of a location.
*
* @param geom
+ * @param point
* @param intersection
* @param gc
* @return
*/
- private static EnumSet calculateLocationPortion(Geometry geom,
- Geometry intersection, GeodeticCalculator gc) {
+ public static EnumSet calculateLocationPortion(Geometry geom,
+ Coordinate point, Geometry intersection, GeodeticCalculator gc) {
EnumSet directions = EnumSet.noneOf(Direction.class);
- Coordinate geomCentroid = geom.convexHull().getCentroid()
- .getCoordinate();
+ Coordinate geomCentroid = null;
+ if (point != null) {
+ geomCentroid = point;
+ } else {
+ geomCentroid = geom.convexHull().getCentroid().getCoordinate();
+ }
Coordinate intersectCentroid = intersection.convexHull().getCentroid()
.getCoordinate();
diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/Wx.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/Wx.java
index 3c5636ad29..6ce201d60b 100644
--- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/Wx.java
+++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/Wx.java
@@ -73,6 +73,7 @@ import com.raytheon.viz.warngen.PreferenceUtil;
import com.raytheon.viz.warngen.WarngenException;
import com.raytheon.viz.warngen.config.AbstractDbSourceDataAdaptor;
import com.raytheon.viz.warngen.config.DataAdaptorFactory;
+import com.raytheon.viz.warngen.config.DbAreaSourceDataAdaptor;
import com.raytheon.viz.warngen.util.Abbreviation;
import com.raytheon.viz.warngen.util.AdjustAngle;
import com.raytheon.viz.warnings.DateUtil;
@@ -106,6 +107,7 @@ import com.vividsolutions.jts.geom.Point;
* Feb 12, 2013 1600 jsanchez Used adjustAngle method from AbstractStormTrackResource.
* Mar 5, 2013 1600 jsanchez Used AdjustAngle instead of AbstractStormTrackResource to handle angle adjusting.
* Mar 25, 2013 1605 jsanchez Checks if a storm location is over an urban bound area.
+ * Apr 24, 2013 1943 jsanchez Calculated partOfArea for a storm location over an urban bound area.
*
*
*
@@ -723,10 +725,21 @@ public class Wx {
latLonToLocal);
double distance = localDistanceGeom.distance(localPt);
- // Tests if storm location is over an urban bound area
- if (cp.prepGeom != null
- && cp.prepGeom.intersects(stormLocation)) {
- distance = 0;
+ // Tests if storm location is over an urban bound area even if
+ // it may be outside the warning polygon
+ if (cp.prepGeom != null && config.isTrackEnabled()
+ && isWithinPolygon == false) {
+ // When isWithinPolygon is true, partOfArea
+ // has already been set in DbAreaSoureDataAdapter
+ Point reference = gf.createPoint(coords[i]);
+ if (cp.prepGeom.intersects(reference)) {
+ cp.partOfArea = GisUtil
+ .asStringList(DbAreaSourceDataAdaptor
+ .calculateLocationPortion(
+ cp.prepGeom.getGeometry(),
+ cp.point, reference, gc));
+ distance = 0;
+ }
}
if (distance <= thresholdInMeters) {
if (allowDuplicates) {
diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenLayer.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenLayer.java
index 434fb31bae..7c616f863b 100644
--- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenLayer.java
+++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenLayer.java
@@ -58,6 +58,8 @@ import org.opengis.referencing.operation.MathTransform;
import com.raytheon.uf.common.activetable.ActiveTableRecord;
import com.raytheon.uf.common.dataplugin.warning.AbstractWarningRecord;
import com.raytheon.uf.common.dataplugin.warning.WarningRecord.WarningAction;
+import com.raytheon.uf.common.dataplugin.warning.config.AreaSourceConfiguration;
+import com.raytheon.uf.common.dataplugin.warning.config.AreaSourceConfiguration.AreaType;
import com.raytheon.uf.common.dataplugin.warning.config.BulletActionGroup;
import com.raytheon.uf.common.dataplugin.warning.config.DialogConfiguration;
import com.raytheon.uf.common.dataplugin.warning.config.GridSpacing;
@@ -170,6 +172,7 @@ import com.vividsolutions.jts.io.WKTReader;
* 04/10/2013 DR 16044 D. Friedman Fix NPE in getAllFipsInArea.
* 04/11/2013 1894 jsanchez Kept tracked of the currently loaded custom maps.
* 04/12/1013 DR 16045 Qinglu Lin Updated AreaHatcher's run() by calling removeDuplicateCoordinate().
+ * 04/24/2013 1943 jsanchez Replaced used of areaConfig with areaSource.
*
*
* @author mschenke
@@ -2562,8 +2565,13 @@ public class WarngenLayer extends AbstractStormTrackResource {
}
private String getFips(GeospatialData data) {
- return (String) data.attributes.get(configuration.getAreaConfig()
- .getFipsField());
+ for (AreaSourceConfiguration areaSource : configuration
+ .getAreaSources()) {
+ if (areaSource.getType() == AreaType.HATCHING) {
+ return (String) data.attributes.get(areaSource.getFipsField());
+ }
+ }
+ return null;
}
private String getFips(Geometry g) {
diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/text/WrapUtil.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/text/WrapUtil.java
index e1feee56d3..6987ea3715 100644
--- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/text/WrapUtil.java
+++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/text/WrapUtil.java
@@ -204,23 +204,14 @@ public class WrapUtil implements ICommonPatterns {
if (bestDelim != null) {
failed = false;
- int next = indexIgnoringLockMarkers(line,
- bestP + bestDelim.length(), 0);
+ int next = bestP + bestDelim.length();
int segmentEnd = " ".equals(bestDelim) ? bestP : next;
appendRTrim(line, start, segmentEnd, sb);
+ start = splitEndOfLine(line, next, inBullet, sb);
- // Remove any leading space at the start of the next line.
- while (next < line.length() && line.charAt(next) == ' ')
- next = indexIgnoringLockMarkers(line, next, 1);
-
- if (next < line.length()) {
- sb.append('\n');
- if (inBullet) {
- sb.append(INDENT);
- allowLength = maxLength - INDENT.length();
- }
+ if (inBullet) {
+ allowLength = maxLength - INDENT.length();
}
- start = next;
} else if (! failed) {
/*
* Failed to wrap before the margin. Try again, wrapping the
@@ -316,4 +307,54 @@ public class WrapUtil implements ICommonPatterns {
break;
}
}
+
+ /**
+ * Handle whitespace and lock markers between line breaks. Adds line break
+ * and indentation for the next line as necessary.
+ *
+ *
+ * - If there is nothing but whitespace and lock markers remaining, append
+ * all of it to the current line so as to not create an extra empty blank
+ * line.
+ * - If there is an end-lock marker, include it on the current line and
+ * break after it.
+ * - If there is a start-lock marker, break before it.
+ *
+ *
+ * @return The index in text at which processing for the next line should
+ * begin.
+ */
+ private static int splitEndOfLine(String text, int start, boolean inBullet, StringBuilder sb) {
+ int goodBreak = start;
+ int i = start;
+
+ while (i < text.length()) {
+ if (Character.isWhitespace(text.charAt(i))) {
+ ++i;
+ } else if (text.startsWith(LOCK_START, i)) {
+ goodBreak = i;
+ i += LOCK_START.length();
+ break;
+ } else if (text.startsWith(LOCK_END, i)) {
+ i += LOCK_END.length();
+ goodBreak = i;
+ break;
+ } else
+ break;
+ }
+
+ if (i >= text.length())
+ goodBreak = i;
+ if (goodBreak >= start) {
+ appendRTrim(text, start, goodBreak, sb);
+ }
+ if (i < text.length()) {
+ sb.append('\n');
+ if (inBullet) {
+ sb.append(INDENT);
+ }
+ appendRTrim(text, goodBreak, i, sb);
+ }
+ return i;
+ }
}
diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/util/CurrentWarnings.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/util/CurrentWarnings.java
index 6400833ecc..89a0fe84fe 100644
--- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/util/CurrentWarnings.java
+++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/util/CurrentWarnings.java
@@ -68,6 +68,7 @@ import com.vividsolutions.jts.geom.Geometry;
* Mar 28, 2011 mschenke Initial creation
* Feb 12, 2013 1500 mschenke Refactored to not request full records and only request full
* record when actually retrieving for use
+ * Apr 22, 2013 jsanchez Set the issue time for follow up warnings.
*
*
*
@@ -303,6 +304,7 @@ public class CurrentWarnings {
if (getAction(warning.getAct()) == WarningAction.EXT) {
if (rval != null) {
rval.setEndTime(warning.getEndTime());
+ rval.setIssueTime(warning.getInsertTime());
}
}
}
@@ -317,6 +319,7 @@ public class CurrentWarnings {
rval.setUgczones(warning.getUgczones());
rval.setLoc(warning.getLoc());
rval.setRawmessage(warning.getRawmessage());
+ rval.setIssueTime(warning.getInsertTime());
}
}
}
diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/util/FipsUtil.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/util/FipsUtil.java
index bb53428cc0..d3b13b4248 100644
--- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/util/FipsUtil.java
+++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/util/FipsUtil.java
@@ -50,6 +50,7 @@ import com.raytheon.viz.warnings.DateUtil;
* May 6, 2008 bwoodle Initial creation
* Dec 28 2012 DR15599 mgamazaychikov Updated method getListCounties to fix the problem
* with generated list of counties.
+ * Apr 25,2013 1877 jsanchez Sorted the UGC line for cancellations.
*
*
*
@@ -170,6 +171,7 @@ public class FipsUtil {
}
}
+ Collections.sort(countiesOrZones);
rval.append(simplifyHeader(getUgcLine(countiesOrZones)));
rval.append(du
.format(endtime, new SimpleDateFormat("ddHHmm"), interval)
@@ -362,12 +364,12 @@ public class FipsUtil {
}
/*
- * DR15599 - completely re-did how rval is calculated.
+ * DR15599 - completely re-did how rval is calculated.
*/
String[] lines = matchStr.split("[\n]");
matchStr = "";
for (String line : lines) {
- matchStr += line;
+ matchStr += line;
}
String[] ranges = matchStr.split("[-]");
@@ -376,12 +378,12 @@ public class FipsUtil {
for (String range : ranges) {
if (Character.isLetter(range.charAt(0))) {
/*
- * range starts with a character - get the new
- * state or marine zone name
+ * range starts with a character - get the new state or marine
+ * zone name
*/
if (curState != null) {
- for (String zone: curList) {
- rval.add(curState+zone);
+ for (String zone : curList) {
+ rval.add(curState + zone);
}
}
curState = range.substring(0, 3);
@@ -406,8 +408,8 @@ public class FipsUtil {
}
}
if (curState != null) {
- for (String zone: curList) {
- rval.add(curState+zone);
+ for (String zone : curList) {
+ rval.add(curState + zone);
}
}
return rval;
diff --git a/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/AbstractWWAResource.java b/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/AbstractWWAResource.java
index d3d030baa1..e043b53bfd 100644
--- a/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/AbstractWWAResource.java
+++ b/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/AbstractWWAResource.java
@@ -77,7 +77,8 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
* Sep 26, 2012 jsanchez Refactored AbstractWarningResource and AbstractWatchesResource into this class.
* Apr 11, 2013 1877 jsanchez Updated conditions for matching a frame.
* Apr 18, 2013 1877 jsanchez Had the child classes set the comparator. Fixed a null pointer.
- *
+ * Remove frameAltered condition in matchesFrame. It prevented entries from being displayed.
+ * Check if geometry is null when inspecting.
*
*
* @author jsanchez
@@ -106,8 +107,6 @@ public abstract class AbstractWWAResource extends
protected Date timeAltered;
- protected Date frameAltered;
-
/**
* was the alter a partial cancel? if it was then a matching CON should
* be processed and added
@@ -218,7 +217,8 @@ public abstract class AbstractWWAResource extends
WarningEntry entry = entryMap.get(key);
AbstractWarningRecord record = entry.record;
- if (matchesFrame(entry, time, framePeriod, lastFrame)) {
+ if (matchesFrame(entry, time, framePeriod, lastFrame)
+ && record.getGeometry() != null) {
Geometry recordGeom = record.getGeometry();
for (int i = 0; i < recordGeom.getNumGeometries(); i++) {
@@ -448,8 +448,7 @@ public abstract class AbstractWWAResource extends
// version only in the frames prior to the time it was altered
} else if (entry.altered) {
if (frameStart.getTime() >= refTime.getTime()
- && frameStart.getTime() <= (entry.timeAltered.getTime())
- && frameStart.getTime() < entry.frameAltered.getTime()) {
+ && frameStart.getTime() < entry.timeAltered.getTime()) {
return true;
}
} else if (refTime.equals(paintTime)
diff --git a/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/WarningsResource.java b/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/WarningsResource.java
index 79225af4f3..617ba0168a 100644
--- a/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/WarningsResource.java
+++ b/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/WarningsResource.java
@@ -58,7 +58,8 @@ import com.vividsolutions.jts.geom.Geometry;
* Jun 04, 2012 DR14992 mgamazaychikov Fix the problem with plotting expiration time for
* NEW warning when CAN warning is issued
* Sep 27, 2012 1149 jsanchez Refactored methods from AbstractWarningsResource into this class.
- * Arp 18, 2013 1877 jsanchez Ordered the records the same for update and initial load.
+ * Apr 18, 2013 1877 jsanchez Ordered the records the same for update and initial load.
+ * Removed no longer needed frameAltered. Do not set wire frame for a CAN.
*
*
* @author jsanchez
@@ -201,14 +202,21 @@ public class WarningsResource extends AbstractWWAResource {
if (wfs != null) {
wfs.dispose();
}
+ WarningAction act = WarningAction.valueOf(record.getAct());
+ // Do not paint a wire frame shape for a CAN
+ if (act != WarningAction.CAN) {
+ wfs = target.createWireframeShape(false, descriptor);
+ geo = (Geometry) record.getGeometry().clone();
- wfs = target.createWireframeShape(false, descriptor);
- geo = (Geometry) record.getGeometry().clone();
-
- JTSCompiler jtsCompiler = new JTSCompiler(null, wfs, descriptor);
- jtsCompiler.handle(geo);
- wfs.compile();
- entry.wireframeShape = wfs;
+ JTSCompiler jtsCompiler = new JTSCompiler(null, wfs,
+ descriptor);
+ jtsCompiler.handle(geo);
+ wfs.compile();
+ entry.wireframeShape = wfs;
+ } else {
+ // Prevents sampling and a label to be painted
+ entry.record.setGeometry(null);
+ }
} catch (Exception e) {
statusHandler.handle(Priority.ERROR,
"Error creating wireframe", e);
@@ -243,28 +251,18 @@ public class WarningsResource extends AbstractWWAResource {
// changing end time
entry.timeAltered = warnrec.getStartTime()
.getTime();
- // prevents the original entry and the modified
- // entry to be displayed in the same frame
- entry.frameAltered = frames[info
- .getFrameIndex()].getRefTime();
-
- // if cancellation, set end time to start time
- // of this action
// DR14992: fix the problem with plotting
- // expiration time for
- // NEW warning when CAN warning is issued
- if (act == WarningAction.CAN
- && WarningAction.valueOf(entry.record
- .getAct()) == WarningAction.CAN) {
- entry.record.setEndTime((Calendar) warnrec
- .getStartTime().clone());
- }
-
- if (!rec.getCountyheader().equals(
- warnrec.getCountyheader())
- && act == WarningAction.CAN) {
- entry.partialCancel = true;
+ // expiration time for NEW warning when CAN
+ // warning is issued
+ if (act == WarningAction.CAN) {
+ if (!rec.getCountyheader().equals(
+ warnrec.getCountyheader())) {
+ entry.partialCancel = true;
+ } else {
+ // complete cancellation
+ createShape = warnrec;
+ }
}
// if it's a con, need to have a new entry for a
diff --git a/deltaScripts/13.4.1/.removeHdffileidColumn.sh.swp b/deltaScripts/13.4.1/.removeHdffileidColumn.sh.swp
new file mode 100644
index 0000000000..5baa667cff
Binary files /dev/null and b/deltaScripts/13.4.1/.removeHdffileidColumn.sh.swp differ
diff --git a/edexOsgi/build.edex/esb/data/utility/edex_static/base/smartinit/DGEX.py b/edexOsgi/build.edex/esb/data/utility/edex_static/base/smartinit/DGEX.py
old mode 100755
new mode 100644
index 4cf7f3d751..96203527eb
--- a/edexOsgi/build.edex/esb/data/utility/edex_static/base/smartinit/DGEX.py
+++ b/edexOsgi/build.edex/esb/data/utility/edex_static/base/smartinit/DGEX.py
@@ -237,7 +237,7 @@ class DGEXForecaster(Forecaster):
t_BL120150, t_BL150180, rh_FHAG2, rh_BL030, rh_BL3060, rh_BL6090,
rh_BL90120, rh_BL120150, rh_BL150180, wind_FHAG10, wind_BL030,
wind_BL3060, wind_BL6090, wind_BL90120, wind_BL120150, wind_BL150180,
- p_SFC, PoP, T, RH, sli_MB1000500, stopo, topo, gh_c, t_c, rh_c, wind_c,
+ p_SFC, PoP, T, RH, sli_MB0500, stopo, topo, gh_c, t_c, rh_c, wind_c,
ctime):
self.setupBLCube(t_FHAG2, t_BL030, t_BL3060, t_BL6090, t_BL90120,
t_BL120150, t_BL150180, rh_FHAG2, rh_BL030, rh_BL3060, rh_BL6090,
@@ -374,17 +374,17 @@ class DGEXForecaster(Forecaster):
#
# Where LI<2, make showers
#
- sli_MB1000500=where(less(sli_MB1000500,-18.0),10.0,sli_MB1000500)
+ sli_MB0500=where(less(sli_MB0500,-18.0),10.0,sli_MB0500)
- convecMask = less(sli_MB1000500, 2)
+ convecMask = less(sli_MB0500, 2)
wx=where(convecMask,wx+6,wx)
#
# off the DGEX gridpoints need no weather
#
wxgrid = zeros(self._empty.shape, dtype = byte)
keys = ['::::', ]
-# wxgrid=where(less(sli_MB1000500,-18.0),0,wxgrid)
- wxgrid[less(sli_MB1000500, -18.0)] = 0
+# wxgrid=where(less(sli_MB0500,-18.0),0,wxgrid)
+ wxgrid[less(sli_MB0500, -18.0)] = 0
#
# Match PoP, and remove non-occurring wx
#
@@ -439,13 +439,13 @@ class DGEXForecaster(Forecaster):
# the instability. SChc for LI <-1, Chc for LI<-3,
# Lkly for LI<-5, Def for LI<-8
#
- thunder = where(less_equal(sli_MB1000500, -1), 1, 0)
-# thunder=where(less_equal(sli_MB1000500,-3),2,thunder)
-# thunder=where(less_equal(sli_MB1000500,-5),3,thunder)
-# thunder=where(less_equal(sli_MB1000500,-8),4,thunder)
- thunder[less_equal(sli_MB1000500, -3)] = 2
- thunder[less_equal(sli_MB1000500, -5)] = 3
- thunder[less_equal(sli_MB1000500, -8)] = 4
+ thunder = where(less_equal(sli_MB0500, -1), 1, 0)
+# thunder=where(less_equal(sli_MB0500,-3),2,thunder)
+# thunder=where(less_equal(sli_MB0500,-5),3,thunder)
+# thunder=where(less_equal(sli_MB0500,-8),4,thunder)
+ thunder[less_equal(sli_MB0500, -3)] = 2
+ thunder[less_equal(sli_MB0500, -5)] = 3
+ thunder[less_equal(sli_MB0500, -8)] = 4
tprobs = ["None", "SChc", "Chc", "Lkly", "Def"]
for ith in range(1, 5):
@@ -992,7 +992,7 @@ class DGEXForecaster(Forecaster):
t_BL120150, t_BL150180, rh_FHAG2, rh_BL030, rh_BL3060, rh_BL6090,
rh_BL90120, rh_BL120150, rh_BL150180, wind_FHAG10, wind_BL030,
wind_BL3060, wind_BL6090, wind_BL90120, wind_BL120150, wind_BL150180,
- p_SFC, sli_MB1000500, tp_SFC, stopo, topo, gh_c, t_c, rh_c, wind_c, ctime):
+ p_SFC, sli_MB0500, tp_SFC, stopo, topo, gh_c, t_c, rh_c, wind_c, ctime):
self.setupBLCube(t_FHAG2, t_BL030, t_BL3060, t_BL6090, t_BL90120,
t_BL120150, t_BL150180, rh_FHAG2, rh_BL030, rh_BL3060, rh_BL6090,
rh_BL90120, rh_BL120150, rh_BL150180, wind_FHAG10, wind_BL030,
@@ -1004,9 +1004,9 @@ class DGEXForecaster(Forecaster):
# only thing we have is boundary layer lifted index
# set LAL to 2 if LI<0, 3 if LI<-3, 4 if LI<-5
#
- lal=where(less(sli_MB1000500, 0), lal+1, lal)
- lal=where(less(sli_MB1000500, -3), lal+1, lal)
- lal=where(less(sli_MB1000500, -5), lal+1, lal)
+ lal=where(less(sli_MB0500, 0), lal+1, lal)
+ lal=where(less(sli_MB0500, -3), lal+1, lal)
+ lal=where(less(sli_MB0500, -5), lal+1, lal)
#
# Add more when RH at top of BL is greater than
# than 70% and RH at bottom of BL is less than 30
@@ -1019,7 +1019,7 @@ class DGEXForecaster(Forecaster):
#
V = logical_and(greater(BLR[5], 80), less(BLR[0], 20))
lal=where(V,lal+1,lal)
- lal=where(less(sli_MB1000500,-18.0),1,lal)
+ lal=where(less(sli_MB0500,-18.0),1,lal)
return lal
#---------------------------------------------------------------------------
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/database/D2DGridDatabase.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/database/D2DGridDatabase.java
index 1497851218..6d0bf1cf3e 100644
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/database/D2DGridDatabase.java
+++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/database/D2DGridDatabase.java
@@ -421,12 +421,13 @@ public class D2DGridDatabase extends VGridDatabase {
}
}
- String d2dParmName = getD2DParmName(atts.getShort_name());
+ String gfeParmName = atts.getShort_name();
+ String d2dParmName = getD2DParmName(gfeParmName);
D2DParm d2dParm = new D2DParm(pid, gpi, possibleInventorySlots,
d2dParmName);
this.gfeParms.put(pid, d2dParm);
- this.d2dParms.put(compositeName(atts.getShort_name(), level), d2dParm);
+ this.d2dParms.put(compositeName(gfeParmName, level), d2dParm);
}
/**
@@ -464,14 +465,17 @@ public class D2DGridDatabase extends VGridDatabase {
availableTimes.get(i));
}
- String uD2dParmName = getD2DParmName(uatts.getShort_name());
- String vD2dParmName = getD2DParmName(vatts.getShort_name());
+ String uGfeParmName = uatts.getShort_name();
+ String uD2dParmName = getD2DParmName(uGfeParmName);
+
+ String vGfeParmName = vatts.getShort_name();
+ String vD2dParmName = getD2DParmName(vGfeParmName);
D2DParm d2dParm = new D2DParm(pid, gpi, possibleInventorySlots,
uD2dParmName, vD2dParmName);
this.gfeParms.put(pid, d2dParm);
- this.d2dParms.put(compositeName(uatts.getShort_name(), level), d2dParm);
- this.d2dParms.put(compositeName(vatts.getShort_name(), level), d2dParm);
+ this.d2dParms.put(compositeName(uGfeParmName, level), d2dParm);
+ this.d2dParms.put(compositeName(vGfeParmName, level), d2dParm);
}
/**
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/notify/GfeIngestNotificationFilter.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/notify/GfeIngestNotificationFilter.java
index cf101ef2f7..87ec08bec5 100644
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/notify/GfeIngestNotificationFilter.java
+++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/notify/GfeIngestNotificationFilter.java
@@ -187,7 +187,7 @@ public class GfeIngestNotificationFilter {
String otherComponent = null;
String[] components = parm.getComponents();
if (components.length > 1) {
- if (components[0].equals(gfeParamName)) {
+ if (components[0].equals(d2dParamName)) {
otherComponent = components[1];
} else {
otherComponent = components[0];
@@ -207,7 +207,7 @@ public class GfeIngestNotificationFilter {
if (otherTimes == null
|| !otherTimes.remove(fcstHour)) {
// need to wait for other component
- ParmID compPid = new ParmID(gfeParamName,
+ ParmID compPid = new ParmID(d2dParamName,
parmID.getDbId(), parmID.getParmLevel());
Set times = windComps.get(compPid);
if (times == null) {
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/gfeLevelMappingFile.xml b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/gfeLevelMappingFile.xml
index 24e7c21b94..6a6ab2ab3d 100644
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/gfeLevelMappingFile.xml
+++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/gfeLevelMappingFile.xml
@@ -249,13 +249,13 @@
-
-
+
+
-
+
-
+
@@ -399,9 +399,6 @@
-
-
-
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-arwAK.xml b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-arwAK.xml
index 350d111137..3840b3f55e 100644
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-arwAK.xml
+++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-arwAK.xml
@@ -46,7 +46,7 @@
0
FHAG 3000
- FHAG3000
+ FHAG03000
@@ -417,7 +417,7 @@
0
FHAG 6000
- FHAG6000
+ FHAG06000
@@ -592,7 +592,7 @@
0
FHAG 6000
- FHAG6000
+ FHAG06000
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-arwEast.xml b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-arwEast.xml
index 350d111137..3840b3f55e 100644
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-arwEast.xml
+++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-arwEast.xml
@@ -46,7 +46,7 @@
0
FHAG 3000
- FHAG3000
+ FHAG03000
@@ -417,7 +417,7 @@
0
FHAG 6000
- FHAG6000
+ FHAG06000
@@ -592,7 +592,7 @@
0
FHAG 6000
- FHAG6000
+ FHAG06000
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-arwHI.xml b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-arwHI.xml
index 350d111137..3840b3f55e 100644
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-arwHI.xml
+++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-arwHI.xml
@@ -46,7 +46,7 @@
0
FHAG 3000
- FHAG3000
+ FHAG03000
@@ -417,7 +417,7 @@
0
FHAG 6000
- FHAG6000
+ FHAG06000
@@ -592,7 +592,7 @@
0
FHAG 6000
- FHAG6000
+ FHAG06000
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-arwSJU.xml b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-arwSJU.xml
index 350d111137..3840b3f55e 100644
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-arwSJU.xml
+++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-arwSJU.xml
@@ -46,7 +46,7 @@
0
FHAG 3000
- FHAG3000
+ FHAG03000
@@ -417,7 +417,7 @@
0
FHAG 6000
- FHAG6000
+ FHAG06000
@@ -592,7 +592,7 @@
0
FHAG 6000
- FHAG6000
+ FHAG06000
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-arwWest.xml b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-arwWest.xml
index 350d111137..3840b3f55e 100644
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-arwWest.xml
+++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-arwWest.xml
@@ -46,7 +46,7 @@
0
FHAG 3000
- FHAG3000
+ FHAG03000
@@ -417,7 +417,7 @@
0
FHAG 6000
- FHAG6000
+ FHAG06000
@@ -592,7 +592,7 @@
0
FHAG 6000
- FHAG6000
+ FHAG06000
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-nmmAK.xml b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-nmmAK.xml
index 350d111137..3840b3f55e 100644
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-nmmAK.xml
+++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-nmmAK.xml
@@ -46,7 +46,7 @@
0
FHAG 3000
- FHAG3000
+ FHAG03000
@@ -417,7 +417,7 @@
0
FHAG 6000
- FHAG6000
+ FHAG06000
@@ -592,7 +592,7 @@
0
FHAG 6000
- FHAG6000
+ FHAG06000
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-nmmEast.xml b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-nmmEast.xml
index 350d111137..3840b3f55e 100644
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-nmmEast.xml
+++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-nmmEast.xml
@@ -46,7 +46,7 @@
0
FHAG 3000
- FHAG3000
+ FHAG03000
@@ -417,7 +417,7 @@
0
FHAG 6000
- FHAG6000
+ FHAG06000
@@ -592,7 +592,7 @@
0
FHAG 6000
- FHAG6000
+ FHAG06000
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-nmmHI.xml b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-nmmHI.xml
index 350d111137..3840b3f55e 100644
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-nmmHI.xml
+++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-nmmHI.xml
@@ -46,7 +46,7 @@
0
FHAG 3000
- FHAG3000
+ FHAG03000
@@ -417,7 +417,7 @@
0
FHAG 6000
- FHAG6000
+ FHAG06000
@@ -592,7 +592,7 @@
0
FHAG 6000
- FHAG6000
+ FHAG06000
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-nmmSJU.xml b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-nmmSJU.xml
index 350d111137..3840b3f55e 100644
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-nmmSJU.xml
+++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-nmmSJU.xml
@@ -46,7 +46,7 @@
0
FHAG 3000
- FHAG3000
+ FHAG03000
@@ -417,7 +417,7 @@
0
FHAG 6000
- FHAG6000
+ FHAG06000
@@ -592,7 +592,7 @@
0
FHAG 6000
- FHAG6000
+ FHAG06000
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-nmmWest.xml b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-nmmWest.xml
index 350d111137..3840b3f55e 100644
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-nmmWest.xml
+++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/HiResW-nmmWest.xml
@@ -46,7 +46,7 @@
0
FHAG 3000
- FHAG3000
+ FHAG03000
@@ -417,7 +417,7 @@
0
FHAG 6000
- FHAG6000
+ FHAG06000
@@ -592,7 +592,7 @@
0
FHAG 6000
- FHAG6000
+ FHAG06000
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/eta207.xml b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/eta207.xml
index 12c8564171..6c6fe6bbc4 100644
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/eta207.xml
+++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/eta207.xml
@@ -1,4 +1,10 @@
+
0
@@ -154,9 +160,9 @@
1000.0
-99999.0
0
- FHAG 0>30
+ FHAG 3000
- FHAG030
+ FHAG03000
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/eta211.xml b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/eta211.xml
index 731c2196b4..b9d1fac7ec 100644
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/eta211.xml
+++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/eta211.xml
@@ -1,4 +1,10 @@
+
0
@@ -154,9 +160,9 @@
1000.0
-99999.0
0
- FHAG 0>30
+ FHAG 3000
- FHAG030
+ FHAG03000
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/eta218.xml b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/eta218.xml
index 571ab07fed..db3e04e1f6 100644
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/eta218.xml
+++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/eta218.xml
@@ -58,7 +58,7 @@
0
FHAG 3000
- FHAG3000
+ FHAG03000
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/eta242.xml b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/eta242.xml
index 571ab07fed..db3e04e1f6 100644
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/eta242.xml
+++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/eta242.xml
@@ -58,7 +58,7 @@
0
FHAG 3000
- FHAG3000
+ FHAG03000
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/mesoEta215.xml b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/mesoEta215.xml
index a71eee32cd..519399c05b 100644
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/mesoEta215.xml
+++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/mesoEta215.xml
@@ -1,4 +1,10 @@
+
0
@@ -56,9 +62,9 @@
1000.0
-99999.0
0
- FHAG 0>30
+ FHAG 3000
- FHAG030
+ FHAG03000
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/mesoEta217.xml b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/mesoEta217.xml
index 920cd67960..99d0e0089f 100644
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/mesoEta217.xml
+++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/mesoEta217.xml
@@ -1,4 +1,10 @@
+
0
@@ -138,9 +144,9 @@
1000.0
-99999.0
0
- FHAG 0>30
+ FHAG 3000
- FHAG030
+ FHAG03000
@@ -363,9 +369,9 @@
20.0
-99999.0
0
- MB 50>100
+ MB 0>500
- MB50100
+ MB0500
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/ruc130.xml b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/ruc130.xml
index a80f85844e..6e535f06fc 100644
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/ruc130.xml
+++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/ruc130.xml
@@ -49,9 +49,10 @@
1000.0
-99999.0
0
- SFC
+ FHAG 1000 FHAG 3000
- SFC
+ FHAG01000
+ FHAG03000
diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/config/AreaSourceConfiguration.java b/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/config/AreaSourceConfiguration.java
index 19b6e18418..07e25bf5df 100644
--- a/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/config/AreaSourceConfiguration.java
+++ b/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/config/AreaSourceConfiguration.java
@@ -22,6 +22,7 @@ import com.raytheon.uf.common.dataquery.requests.RequestableMetadataMarshaller;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 29, 2012 #14691 Qinglu Lin Added feAreaField and its getter and setter, etc.
+ * Apr 24, 2014 1943 jsanchez Removed unused areaType.
*
*
*
@@ -39,13 +40,6 @@ public class AreaSourceConfiguration {
@XmlElement
private AreaType type = AreaType.HATCHING;
- /*
- * TODO This is for 12.9 to be backwards compatible. This will be removed in
- * 12.10
- */
- @XmlElement
- private AreaType areaType;
-
@XmlAttribute
private String variable;
@@ -277,12 +271,4 @@ public class AreaSourceConfiguration {
this.type = type;
}
- public AreaType getAreaType() {
- return areaType;
- }
-
- public void setAreaType(AreaType areaType) {
- this.areaType = areaType;
- }
-
}
diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/config/WarngenConfiguration.java b/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/config/WarngenConfiguration.java
index 2ebe4da7fb..948179a85f 100644
--- a/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/config/WarngenConfiguration.java
+++ b/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/config/WarngenConfiguration.java
@@ -59,6 +59,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* Nov 21, 2007 chammack Initial Creation.
* Aug 26, 2008 #1502 bclement Added JAXB annotations
* May 26, 2010 #4649 Qinglu Lin Made including TO.A and SV.A mandatory
+ * Apr 24, 2013 1943 jsanchez Marked areaConfig as Deprecated.
*
*
*
@@ -83,6 +84,7 @@ public class WarngenConfiguration implements ISerializableObject {
private AreaSourceConfiguration hatchedAreaSource;
@XmlElement
+ @Deprecated
private AreaConfiguration areaConfig;
@XmlElementWrapper(name = "bulletActionGroups")
@@ -201,8 +203,8 @@ public class WarngenConfiguration implements ISerializableObject {
}
}
- // TODO This section is for 12.9 to be backwards compatible with old
- // configuration files. 12.10 will drop the use of 'areaConfig'.
+ // AreaConfiguration is deprecated. This is only meant for backwards
+ // compatibility while areaConfig is phased out with updated templates from the template team.
if (config.getAreaConfig() != null) {
ArrayList areaSources = null;
@@ -217,18 +219,12 @@ public class WarngenConfiguration implements ISerializableObject {
config.setAreaSources(areaSources
.toArray(new AreaSourceConfiguration[areaSources.size()]));
}
- // 12.9 section end
for (AreaSourceConfiguration asc : config.getAreaSources()) {
if (asc.getAreaSource() == null) {
asc.setAreaSource(config.getGeospatialConfig().getAreaSource());
}
- // 12.9. 12.10 get rid of 'areaType'
- if (asc.getAreaType() != null) {
- asc.setType(asc.getAreaType());
- }
-
if (asc.getType() == AreaType.HATCHING) {
config.setHatchedAreaSource(asc);
}
@@ -252,8 +248,12 @@ public class WarngenConfiguration implements ISerializableObject {
}
/**
+ * This method is depreciated. Please use AreaSourceConfiguration. The type
+ * AreaType.HATCHING will determine which area source is for hatching.
+ *
* @return the areaConfig
*/
+ @Deprecated
public AreaConfiguration getAreaConfig() {
return areaConfig;
}
@@ -262,6 +262,7 @@ public class WarngenConfiguration implements ISerializableObject {
* @param areaConfig
* the areaConfig to set
*/
+ @Deprecated
public void setAreaConfig(AreaConfiguration areaConfig) {
this.areaConfig = areaConfig;
}
diff --git a/edexOsgi/com.raytheon.uf.common.datastorage/src/com/raytheon/uf/common/datastorage/Request.java b/edexOsgi/com.raytheon.uf.common.datastorage/src/com/raytheon/uf/common/datastorage/Request.java
index 64695e28ae..6f32c3184a 100644
--- a/edexOsgi/com.raytheon.uf.common.datastorage/src/com/raytheon/uf/common/datastorage/Request.java
+++ b/edexOsgi/com.raytheon.uf.common.datastorage/src/com/raytheon/uf/common/datastorage/Request.java
@@ -23,6 +23,7 @@ import java.awt.Point;
import java.util.Arrays;
import java.util.LinkedHashSet;
+
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@@ -39,6 +40,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 27, 2009 chammack Initial creation
+ * Jun 18, 2013 DR 15662 dhuffman Cross section terrain disappears if baseline is too short.
*
*
*
@@ -91,9 +93,26 @@ public class Request implements ISerializableObject {
Request request = new Request();
request.type = Type.POINT;
request.points = new LinkedHashSet(Arrays.asList(points))
- .toArray(new Point[points.length]);
+ .toArray(new Point[points.length]);
+
return request;
}
+
+ /**
+ * Build a request that asks for specific cross points to be returned
+ *
+ * @param points
+ * @return
+ */
+ public static Request buildXsectPointRequest(Point... points) {
+ Request request = new Request();
+ request.type = Type.POINT;
+ request.points = new Point[points.length];
+ for(int x=0; x
*
@@ -96,6 +97,15 @@ public class MpeRUCFreezingLevel {
public static String[] models = new String[] { "RUC236" };
public MpeRUCFreezingLevel() {
+ // DR 15914
+ // make sure directory exists, if not make directory before
+ // opening file.
+ File pn = new File(stationFilePath);
+ if (pn.exists() == false) {
+ pn.mkdir();
+ }
+ pn = null;
+
this.stationFile = new File(stationFilePath+"/"+mpeSiteId+"_freezing_station_list");
// correct env vairiable dqcPreprocessorBasetime if needed. Default to 12z
diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/src/com/raytheon/uf/edex/plugin/ffmp/common/FFMPProcessor.java b/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/src/com/raytheon/uf/edex/plugin/ffmp/common/FFMPProcessor.java
index 09ccb736e4..17da3e3e7f 100644
--- a/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/src/com/raytheon/uf/edex/plugin/ffmp/common/FFMPProcessor.java
+++ b/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/src/com/raytheon/uf/edex/plugin/ffmp/common/FFMPProcessor.java
@@ -97,6 +97,7 @@ import com.vividsolutions.jts.geom.Polygon;
* 10/25/12 DR 15514 G. Zhang Fix ConcurrentModificationException
* 02/01/13 1569 D. Hladky Added constants
* 02/25/13 1660 D. Hladky FFTI design change to help mosaic processing.
+ * 05/01/2013 15684 zhao Unlock when Exception caught
*
*
* @author dhladky
@@ -363,13 +364,23 @@ public class FFMPProcessor {
.getRawGeometries(dataKey,
domain.getCwa());
}
-
- sbl = (new RadarSBLGenerator(config)
- .generate(sourceId,
- map.keySet(),
- cwaGeometries, radarRec));
- generator.setSourceBinList(sbl);
- isSBL = true;
+ //DR15684
+ try {
+ sbl = (new RadarSBLGenerator(config)
+ .generate(sourceId,
+ map.keySet(),
+ cwaGeometries, radarRec));
+ } catch (Exception e) {
+ statusHandler.handle(Priority.WARN, "caught an Exception while generating Source Bin List");
+ e.printStackTrace();
+ if (!checkLockStatus()) {
+ ClusterLockUtils.unlock(sourceBinTaskName, sourceId);
+ }
+ }
+ if (sbl != null) {
+ generator.setSourceBinList(sbl);
+ isSBL = true;
+ }
} else {
continue;
diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/src/com/raytheon/uf/edex/plugin/ffmp/common/RadarSBLGenerator.java b/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/src/com/raytheon/uf/edex/plugin/ffmp/common/RadarSBLGenerator.java
index 9fcee2a06a..4886b17ba5 100644
--- a/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/src/com/raytheon/uf/edex/plugin/ffmp/common/RadarSBLGenerator.java
+++ b/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/src/com/raytheon/uf/edex/plugin/ffmp/common/RadarSBLGenerator.java
@@ -65,6 +65,7 @@ import com.vividsolutions.jts.geom.GeometryFactory;
import com.vividsolutions.jts.geom.LinearRing;
import com.vividsolutions.jts.geom.Point;
import com.vividsolutions.jts.geom.Polygon;
+import com.vividsolutions.jts.geom.TopologyException;
/**
* Creates a SourceBinList for given radar and set of basins.
@@ -75,6 +76,7 @@ import com.vividsolutions.jts.geom.Polygon;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 6, 2011 10593 dfriedma Initial creation
+ * May 1, 2013 15684 zhao Add code to handle possible TopologyException
*
*
*
@@ -227,7 +229,15 @@ public class RadarSBLGenerator {
if (i >= 0 && i < searchGridLen && j >= 0 && j < searchGridLen) {
for (Long pfaf : searchGrid[j * searchGridLen + i]) {
Geometry geom = xformedBasinMap.get(pfaf);
- if (geom.contains(p)) {
+ //DR15684
+ boolean geomContainsPointP = false;
+ try {
+ geomContainsPointP = geom.contains(p);
+ } catch (TopologyException e) {
+ logger.warn(String.format("RadarSBLGenerator: caught a TopologyException: %s", e.getMessage()));
+ throw e;
+ }
+ if (geomContainsPointP) {
//lastPfaf = pfaf;
lastBasinGeometry = geom;
lastSBEL = sbeMap.get(pfaf);
diff --git a/edexOsgi/com.raytheon.uf.edex.topo/src/com/raytheon/uf/edex/topo/TopoQuery.java b/edexOsgi/com.raytheon.uf.edex.topo/src/com/raytheon/uf/edex/topo/TopoQuery.java
index d74ec59337..2509efa96f 100644
--- a/edexOsgi/com.raytheon.uf.edex.topo/src/com/raytheon/uf/edex/topo/TopoQuery.java
+++ b/edexOsgi/com.raytheon.uf.edex.topo/src/com/raytheon/uf/edex/topo/TopoQuery.java
@@ -89,6 +89,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* 03/09/2012 DR 14581 D. Friedman Fix grid referencing and use custom
* nearest-neighbor resampling.i
* 01/14/2013 #1469 bkowal Removed the hdf5 data directory.
+ * 04/18/2013 DR 15662 dhuffman Cross section terrain disappears if baseline is too short.
*
*
*
@@ -313,7 +314,7 @@ public class TopoQuery implements ITopoQuery {
index += 2;
}
- Request request = Request.buildPointRequest(points);
+ Request request = Request.buildXsectPointRequest(points);
ShortDataRecord record = (ShortDataRecord) dataStore.retrieve("/",
"full", request);
short[] data = record.getShortData();
diff --git a/edexOsgi/com.raytheon.uf.tools.gfesuite/cli/rsyncGridsToCWF.sh b/edexOsgi/com.raytheon.uf.tools.gfesuite/cli/rsyncGridsToCWF.sh
index c89aa0c53c..2ad040828e 100644
--- a/edexOsgi/com.raytheon.uf.tools.gfesuite/cli/rsyncGridsToCWF.sh
+++ b/edexOsgi/com.raytheon.uf.tools.gfesuite/cli/rsyncGridsToCWF.sh
@@ -8,9 +8,9 @@
# Authors: Virgil Middendorf (BYZ), Steve Sigler (MSO) #
# Contributers: Ahmad Garabi, Ken Sargeant, Dave Pike, Dave Rosenberg, #
# Tim Barker, Maureen Ballard, Jay Smith, Dave Tomalak, #
-# Evelyn Bersack, Juliya Dynina #
+# Evelyn Bersack, Juliya Dynina, Jianning Zeng #
# #
-# Date of last revision: 11/02/12 #
+# Date of last revision: 04/22/13 #
# #
# Script description: This script can create a netcdf file containing IFPS #
# grids, quality control the netcdf file, send the file to a local rsync #
@@ -142,6 +142,7 @@
# the hard-coded path to /awips2/fxa/bin with $FXA_BIN. Removed #
# awips1 code. #
# 11/02/12: Restored error checking for AWIPS2. #
+# 04/22/13: Update the permission of the log directories. #
################################################################################
# check to see if site id was passed as argument
# if not then exit from the script
@@ -176,6 +177,11 @@ currdate=$(date -u +%Y%m%d)
export LOG_FILE="${DXwrkDir}/log/${currdate}/netcdf_rsync.log"
# check to see if log directory structure exists.
+if [ ! -d ${DXwrkDir}/log ] ;then
+ mkdir -p ${DXwrkDir}/log
+ chmod 777 ${DXwrkDir}/log
+ chown awips:fxalpha ${DXwrkDir}/log
+fi
if [ ! -d ${DXwrkDir}/log/${currdate} ] ;then
mkdir -p ${DXwrkDir}/log/${currdate}
chmod 777 ${DXwrkDir}/log/${currdate}
diff --git a/nativeLib/rary.cots.jasper/jasper-1.900.1/src/libjasper/jp2/jp2_cod.c.orig b/nativeLib/rary.cots.jasper/jasper-1.900.1/src/libjasper/jp2/jp2_cod.c.orig
new file mode 100644
index 0000000000..83cecb1f91
--- /dev/null
+++ b/nativeLib/rary.cots.jasper/jasper-1.900.1/src/libjasper/jp2/jp2_cod.c.orig
@@ -0,0 +1,921 @@
+/*
+ * Copyright (c) 1999-2000 Image Power, Inc. and the University of
+ * British Columbia.
+ * Copyright (c) 2001-2002 Michael David Adams.
+ * All rights reserved.
+ */
+
+/* __START_OF_JASPER_LICENSE__
+ *
+ * JasPer License Version 2.0
+ *
+ * Copyright (c) 2001-2006 Michael David Adams
+ * Copyright (c) 1999-2000 Image Power, Inc.
+ * Copyright (c) 1999-2000 The University of British Columbia
+ *
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person (the
+ * "User") obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, and/or sell copies of the Software, and to permit
+ * persons to whom the Software is furnished to do so, subject to the
+ * following conditions:
+ *
+ * 1. The above copyright notices and this permission notice (which
+ * includes the disclaimer below) shall be included in all copies or
+ * substantial portions of the Software.
+ *
+ * 2. The name of a copyright holder shall not be used to endorse or
+ * promote products derived from the Software without specific prior
+ * written permission.
+ *
+ * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
+ * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
+ * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
+ * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
+ * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
+ * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
+ * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
+ * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
+ * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
+ * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
+ * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
+ * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
+ * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
+ * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
+ * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
+ * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
+ * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
+ * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
+ * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
+ * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
+ *
+ * __END_OF_JASPER_LICENSE__
+ */
+
+/*
+ * JP2 Library
+ *
+ * $Id$
+ */
+
+/******************************************************************************\
+* Includes.
+\******************************************************************************/
+
+#include
+#include
+
+#include "jasper/jas_stream.h"
+#include "jasper/jas_malloc.h"
+#include "jasper/jas_debug.h"
+
+#include "jp2_cod.h"
+
+/******************************************************************************\
+* Function prototypes.
+\******************************************************************************/
+
+#define ONES(n) ((1 << (n)) - 1)
+
+jp2_boxinfo_t *jp2_boxinfolookup(int type);
+
+static int jp2_getuint8(jas_stream_t *in, uint_fast8_t *val);
+static int jp2_getuint16(jas_stream_t *in, uint_fast16_t *val);
+static int jp2_getuint32(jas_stream_t *in, uint_fast32_t *val);
+static int jp2_getuint64(jas_stream_t *in, uint_fast64_t *val);
+static int jp2_putuint8(jas_stream_t *out, uint_fast8_t val);
+static int jp2_putuint16(jas_stream_t *out, uint_fast16_t val);
+static int jp2_putuint32(jas_stream_t *out, uint_fast32_t val);
+static int jp2_putuint64(jas_stream_t *out, uint_fast64_t val);
+
+static int jp2_getint(jas_stream_t *in, int s, int n, int_fast32_t *val);
+
+jp2_box_t *jp2_box_get(jas_stream_t *in);
+void jp2_box_dump(jp2_box_t *box, FILE *out);
+
+static int jp2_jp_getdata(jp2_box_t *box, jas_stream_t *in);
+static int jp2_jp_putdata(jp2_box_t *box, jas_stream_t *out);
+static int jp2_ftyp_getdata(jp2_box_t *box, jas_stream_t *in);
+static int jp2_ftyp_putdata(jp2_box_t *box, jas_stream_t *out);
+static int jp2_ihdr_getdata(jp2_box_t *box, jas_stream_t *in);
+static int jp2_ihdr_putdata(jp2_box_t *box, jas_stream_t *out);
+static void jp2_bpcc_destroy(jp2_box_t *box);
+static int jp2_bpcc_getdata(jp2_box_t *box, jas_stream_t *in);
+static int jp2_bpcc_putdata(jp2_box_t *box, jas_stream_t *out);
+static int jp2_colr_getdata(jp2_box_t *box, jas_stream_t *in);
+static int jp2_colr_putdata(jp2_box_t *box, jas_stream_t *out);
+static void jp2_colr_dumpdata(jp2_box_t *box, FILE *out);
+static void jp2_colr_destroy(jp2_box_t *box);
+static void jp2_cdef_destroy(jp2_box_t *box);
+static int jp2_cdef_getdata(jp2_box_t *box, jas_stream_t *in);
+static int jp2_cdef_putdata(jp2_box_t *box, jas_stream_t *out);
+static void jp2_cdef_dumpdata(jp2_box_t *box, FILE *out);
+static void jp2_cmap_destroy(jp2_box_t *box);
+static int jp2_cmap_getdata(jp2_box_t *box, jas_stream_t *in);
+static int jp2_cmap_putdata(jp2_box_t *box, jas_stream_t *out);
+static void jp2_cmap_dumpdata(jp2_box_t *box, FILE *out);
+static void jp2_pclr_destroy(jp2_box_t *box);
+static int jp2_pclr_getdata(jp2_box_t *box, jas_stream_t *in);
+static int jp2_pclr_putdata(jp2_box_t *box, jas_stream_t *out);
+static void jp2_pclr_dumpdata(jp2_box_t *box, FILE *out);
+
+/******************************************************************************\
+* Local data.
+\******************************************************************************/
+
+jp2_boxinfo_t jp2_boxinfos[] = {
+ {JP2_BOX_JP, "JP", 0,
+ {0, 0, jp2_jp_getdata, jp2_jp_putdata, 0}},
+ {JP2_BOX_FTYP, "FTYP", 0,
+ {0, 0, jp2_ftyp_getdata, jp2_ftyp_putdata, 0}},
+ {JP2_BOX_JP2H, "JP2H", JP2_BOX_SUPER,
+ {0, 0, 0, 0, 0}},
+ {JP2_BOX_IHDR, "IHDR", 0,
+ {0, 0, jp2_ihdr_getdata, jp2_ihdr_putdata, 0}},
+ {JP2_BOX_BPCC, "BPCC", 0,
+ {0, jp2_bpcc_destroy, jp2_bpcc_getdata, jp2_bpcc_putdata, 0}},
+ {JP2_BOX_COLR, "COLR", 0,
+ {0, jp2_colr_destroy, jp2_colr_getdata, jp2_colr_putdata, jp2_colr_dumpdata}},
+ {JP2_BOX_PCLR, "PCLR", 0,
+ {0, jp2_pclr_destroy, jp2_pclr_getdata, jp2_pclr_putdata, jp2_pclr_dumpdata}},
+ {JP2_BOX_CMAP, "CMAP", 0,
+ {0, jp2_cmap_destroy, jp2_cmap_getdata, jp2_cmap_putdata, jp2_cmap_dumpdata}},
+ {JP2_BOX_CDEF, "CDEF", 0,
+ {0, jp2_cdef_destroy, jp2_cdef_getdata, jp2_cdef_putdata, jp2_cdef_dumpdata}},
+ {JP2_BOX_RES, "RES", JP2_BOX_SUPER,
+ {0, 0, 0, 0, 0}},
+ {JP2_BOX_RESC, "RESC", 0,
+ {0, 0, 0, 0, 0}},
+ {JP2_BOX_RESD, "RESD", 0,
+ {0, 0, 0, 0, 0}},
+ {JP2_BOX_JP2C, "JP2C", JP2_BOX_NODATA,
+ {0, 0, 0, 0, 0}},
+ {JP2_BOX_JP2I, "JP2I", 0,
+ {0, 0, 0, 0, 0}},
+ {JP2_BOX_XML, "XML", 0,
+ {0, 0, 0, 0, 0}},
+ {JP2_BOX_UUID, "UUID", 0,
+ {0, 0, 0, 0, 0}},
+ {JP2_BOX_UINF, "UINF", JP2_BOX_SUPER,
+ {0, 0, 0, 0, 0}},
+ {JP2_BOX_ULST, "ULST", 0,
+ {0, 0, 0, 0, 0}},
+ {JP2_BOX_URL, "URL", 0,
+ {0, 0, 0, 0, 0}},
+ {0, 0, 0, {0, 0, 0, 0, 0}},
+};
+
+jp2_boxinfo_t jp2_boxinfo_unk = {
+ 0, "Unknown", 0, {0, 0, 0, 0, 0}
+};
+
+/******************************************************************************\
+* Box constructor.
+\******************************************************************************/
+
+jp2_box_t *jp2_box_create(int type)
+{
+ jp2_box_t *box;
+ jp2_boxinfo_t *boxinfo;
+
+ if (!(box = jas_malloc(sizeof(jp2_box_t)))) {
+ return 0;
+ }
+ memset(box, 0, sizeof(jp2_box_t));
+ box->type = type;
+ box->len = 0;
+ if (!(boxinfo = jp2_boxinfolookup(type))) {
+ return 0;
+ }
+ box->info = boxinfo;
+ box->ops = &boxinfo->ops;
+ return box;
+}
+
+/******************************************************************************\
+* Box destructor.
+\******************************************************************************/
+
+void jp2_box_destroy(jp2_box_t *box)
+{
+ if (box->ops->destroy) {
+ (*box->ops->destroy)(box);
+ }
+ jas_free(box);
+}
+
+static void jp2_bpcc_destroy(jp2_box_t *box)
+{
+ jp2_bpcc_t *bpcc = &box->data.bpcc;
+ if (bpcc->bpcs) {
+ jas_free(bpcc->bpcs);
+ bpcc->bpcs = 0;
+ }
+}
+
+static void jp2_cdef_destroy(jp2_box_t *box)
+{
+ jp2_cdef_t *cdef = &box->data.cdef;
+ if (cdef->ents) {
+ jas_free(cdef->ents);
+ cdef->ents = 0;
+ }
+}
+
+/******************************************************************************\
+* Box input.
+\******************************************************************************/
+
+jp2_box_t *jp2_box_get(jas_stream_t *in)
+{
+ jp2_box_t *box;
+ jp2_boxinfo_t *boxinfo;
+ jas_stream_t *tmpstream;
+ uint_fast32_t len;
+ uint_fast64_t extlen;
+ bool dataflag;
+
+ box = 0;
+ tmpstream = 0;
+
+ if (!(box = jas_malloc(sizeof(jp2_box_t)))) {
+ goto error;
+ }
+ box->ops = &jp2_boxinfo_unk.ops;
+ if (jp2_getuint32(in, &len) || jp2_getuint32(in, &box->type)) {
+ goto error;
+ }
+ boxinfo = jp2_boxinfolookup(box->type);
+ box->info = boxinfo;
+ box->ops = &boxinfo->ops;
+ box->len = len;
+ if (box->len == 1) {
+ if (jp2_getuint64(in, &extlen)) {
+ goto error;
+ }
+ if (extlen > 0xffffffffUL) {
+ jas_eprintf("warning: cannot handle large 64-bit box length\n");
+ extlen = 0xffffffffUL;
+ }
+ box->len = extlen;
+ box->datalen = extlen - JP2_BOX_HDRLEN(true);
+ } else {
+ box->datalen = box->len - JP2_BOX_HDRLEN(false);
+ }
+ if (box->len != 0 && box->len < 8) {
+ goto error;
+ }
+
+ dataflag = !(box->info->flags & (JP2_BOX_SUPER | JP2_BOX_NODATA));
+
+ if (dataflag) {
+ if (!(tmpstream = jas_stream_memopen(0, 0))) {
+ goto error;
+ }
+ if (jas_stream_copy(tmpstream, in, box->datalen)) {
+ jas_eprintf("cannot copy box data\n");
+ goto error;
+ }
+ jas_stream_rewind(tmpstream);
+
+ if (box->ops->getdata) {
+ if ((*box->ops->getdata)(box, tmpstream)) {
+ jas_eprintf("cannot parse box data\n");
+ goto error;
+ }
+ }
+ jas_stream_close(tmpstream);
+ }
+
+ if (jas_getdbglevel() >= 1) {
+ jp2_box_dump(box, stderr);
+ }
+
+ return box;
+ abort();
+
+error:
+ if (box) {
+ jp2_box_destroy(box);
+ }
+ if (tmpstream) {
+ jas_stream_close(tmpstream);
+ }
+ return 0;
+}
+
+void jp2_box_dump(jp2_box_t *box, FILE *out)
+{
+ jp2_boxinfo_t *boxinfo;
+ boxinfo = jp2_boxinfolookup(box->type);
+ assert(boxinfo);
+
+ fprintf(out, "JP2 box: ");
+ fprintf(out, "type=%c%s%c (0x%08x); length=%d\n", '"', boxinfo->name,
+ '"', box->type, box->len);
+ if (box->ops->dumpdata) {
+ (*box->ops->dumpdata)(box, out);
+ }
+}
+
+static int jp2_jp_getdata(jp2_box_t *box, jas_stream_t *in)
+{
+ jp2_jp_t *jp = &box->data.jp;
+ if (jp2_getuint32(in, &jp->magic)) {
+ return -1;
+ }
+ return 0;
+}
+
+static int jp2_ftyp_getdata(jp2_box_t *box, jas_stream_t *in)
+{
+ jp2_ftyp_t *ftyp = &box->data.ftyp;
+ unsigned int i;
+ if (jp2_getuint32(in, &ftyp->majver) || jp2_getuint32(in, &ftyp->minver)) {
+ return -1;
+ }
+ ftyp->numcompatcodes = (box->datalen - 8) / 4;
+ if (ftyp->numcompatcodes > JP2_FTYP_MAXCOMPATCODES) {
+ return -1;
+ }
+ for (i = 0; i < ftyp->numcompatcodes; ++i) {
+ if (jp2_getuint32(in, &ftyp->compatcodes[i])) {
+ return -1;
+ }
+ }
+ return 0;
+}
+
+static int jp2_ihdr_getdata(jp2_box_t *box, jas_stream_t *in)
+{
+ jp2_ihdr_t *ihdr = &box->data.ihdr;
+ if (jp2_getuint32(in, &ihdr->height) || jp2_getuint32(in, &ihdr->width) ||
+ jp2_getuint16(in, &ihdr->numcmpts) || jp2_getuint8(in, &ihdr->bpc) ||
+ jp2_getuint8(in, &ihdr->comptype) || jp2_getuint8(in, &ihdr->csunk) ||
+ jp2_getuint8(in, &ihdr->ipr)) {
+ return -1;
+ }
+ return 0;
+}
+
+static int jp2_bpcc_getdata(jp2_box_t *box, jas_stream_t *in)
+{
+ jp2_bpcc_t *bpcc = &box->data.bpcc;
+ unsigned int i;
+ bpcc->numcmpts = box->datalen;
+ if (!(bpcc->bpcs = jas_malloc(bpcc->numcmpts * sizeof(uint_fast8_t)))) {
+ return -1;
+ }
+ for (i = 0; i < bpcc->numcmpts; ++i) {
+ if (jp2_getuint8(in, &bpcc->bpcs[i])) {
+ return -1;
+ }
+ }
+ return 0;
+}
+
+static void jp2_colr_dumpdata(jp2_box_t *box, FILE *out)
+{
+ jp2_colr_t *colr = &box->data.colr;
+ fprintf(out, "method=%d; pri=%d; approx=%d\n", (int)colr->method, (int)colr->pri, (int)colr->approx);
+ switch (colr->method) {
+ case JP2_COLR_ENUM:
+ fprintf(out, "csid=%d\n", (int)colr->csid);
+ break;
+ case JP2_COLR_ICC:
+ jas_memdump(out, colr->iccp, colr->iccplen);
+ break;
+ }
+}
+
+static int jp2_colr_getdata(jp2_box_t *box, jas_stream_t *in)
+{
+ jp2_colr_t *colr = &box->data.colr;
+ colr->csid = 0;
+ colr->iccp = 0;
+ colr->iccplen = 0;
+
+ if (jp2_getuint8(in, &colr->method) || jp2_getuint8(in, &colr->pri) ||
+ jp2_getuint8(in, &colr->approx)) {
+ return -1;
+ }
+ switch (colr->method) {
+ case JP2_COLR_ENUM:
+ if (jp2_getuint32(in, &colr->csid)) {
+ return -1;
+ }
+ break;
+ case JP2_COLR_ICC:
+ colr->iccplen = box->datalen - 3;
+ if (!(colr->iccp = jas_malloc(colr->iccplen * sizeof(uint_fast8_t)))) {
+ return -1;
+ }
+ if (jas_stream_read(in, colr->iccp, colr->iccplen) != colr->iccplen) {
+ return -1;
+ }
+ break;
+ }
+ return 0;
+}
+
+static void jp2_cdef_dumpdata(jp2_box_t *box, FILE *out)
+{
+ jp2_cdef_t *cdef = &box->data.cdef;
+ unsigned int i;
+ for (i = 0; i < cdef->numchans; ++i) {
+ fprintf(out, "channo=%d; type=%d; assoc=%d\n",
+ cdef->ents[i].channo, cdef->ents[i].type, cdef->ents[i].assoc);
+ }
+}
+
+static void jp2_colr_destroy(jp2_box_t *box)
+{
+ jp2_colr_t *colr = &box->data.colr;
+ if (colr->iccp) {
+ jas_free(colr->iccp);
+ }
+}
+
+static int jp2_cdef_getdata(jp2_box_t *box, jas_stream_t *in)
+{
+ jp2_cdef_t *cdef = &box->data.cdef;
+ jp2_cdefchan_t *chan;
+ unsigned int channo;
+ if (jp2_getuint16(in, &cdef->numchans)) {
+ return -1;
+ }
+ if (!(cdef->ents = jas_malloc(cdef->numchans * sizeof(jp2_cdefchan_t)))) {
+ return -1;
+ }
+ for (channo = 0; channo < cdef->numchans; ++channo) {
+ chan = &cdef->ents[channo];
+ if (jp2_getuint16(in, &chan->channo) || jp2_getuint16(in, &chan->type) ||
+ jp2_getuint16(in, &chan->assoc)) {
+ return -1;
+ }
+ }
+ return 0;
+}
+
+/******************************************************************************\
+* Box output.
+\******************************************************************************/
+
+int jp2_box_put(jp2_box_t *box, jas_stream_t *out)
+{
+ jas_stream_t *tmpstream;
+ bool extlen;
+ bool dataflag;
+
+ tmpstream = 0;
+
+ dataflag = !(box->info->flags & (JP2_BOX_SUPER | JP2_BOX_NODATA));
+
+ if (dataflag) {
+ tmpstream = jas_stream_memopen(0, 0);
+ if (box->ops->putdata) {
+ if ((*box->ops->putdata)(box, tmpstream)) {
+ goto error;
+ }
+ }
+ box->len = jas_stream_tell(tmpstream) + JP2_BOX_HDRLEN(false);
+ jas_stream_rewind(tmpstream);
+ }
+ extlen = (box->len >= (((uint_fast64_t)1) << 32)) != 0;
+ if (jp2_putuint32(out, extlen ? 1 : box->len)) {
+ goto error;
+ }
+ if (jp2_putuint32(out, box->type)) {
+ goto error;
+ }
+ if (extlen) {
+ if (jp2_putuint64(out, box->len)) {
+ goto error;
+ }
+ }
+
+ if (dataflag) {
+ if (jas_stream_copy(out, tmpstream, box->len - JP2_BOX_HDRLEN(false))) {
+ goto error;
+ }
+ jas_stream_close(tmpstream);
+ }
+
+ return 0;
+ abort();
+
+error:
+
+ if (tmpstream) {
+ jas_stream_close(tmpstream);
+ }
+ return -1;
+}
+
+static int jp2_jp_putdata(jp2_box_t *box, jas_stream_t *out)
+{
+ jp2_jp_t *jp = &box->data.jp;
+ if (jp2_putuint32(out, jp->magic)) {
+ return -1;
+ }
+ return 0;
+}
+
+static int jp2_ftyp_putdata(jp2_box_t *box, jas_stream_t *out)
+{
+ jp2_ftyp_t *ftyp = &box->data.ftyp;
+ unsigned int i;
+ if (jp2_putuint32(out, ftyp->majver) || jp2_putuint32(out, ftyp->minver)) {
+ return -1;
+ }
+ for (i = 0; i < ftyp->numcompatcodes; ++i) {
+ if (jp2_putuint32(out, ftyp->compatcodes[i])) {
+ return -1;
+ }
+ }
+ return 0;
+}
+
+static int jp2_ihdr_putdata(jp2_box_t *box, jas_stream_t *out)
+{
+ jp2_ihdr_t *ihdr = &box->data.ihdr;
+ if (jp2_putuint32(out, ihdr->height) || jp2_putuint32(out, ihdr->width) ||
+ jp2_putuint16(out, ihdr->numcmpts) || jp2_putuint8(out, ihdr->bpc) ||
+ jp2_putuint8(out, ihdr->comptype) || jp2_putuint8(out, ihdr->csunk) ||
+ jp2_putuint8(out, ihdr->ipr)) {
+ return -1;
+ }
+ return 0;
+}
+
+static int jp2_bpcc_putdata(jp2_box_t *box, jas_stream_t *out)
+{
+ jp2_bpcc_t *bpcc = &box->data.bpcc;
+ unsigned int i;
+ for (i = 0; i < bpcc->numcmpts; ++i) {
+ if (jp2_putuint8(out, bpcc->bpcs[i])) {
+ return -1;
+ }
+ }
+ return 0;
+}
+
+static int jp2_colr_putdata(jp2_box_t *box, jas_stream_t *out)
+{
+ jp2_colr_t *colr = &box->data.colr;
+ if (jp2_putuint8(out, colr->method) || jp2_putuint8(out, colr->pri) ||
+ jp2_putuint8(out, colr->approx)) {
+ return -1;
+ }
+ switch (colr->method) {
+ case JP2_COLR_ENUM:
+ if (jp2_putuint32(out, colr->csid)) {
+ return -1;
+ }
+ break;
+ case JP2_COLR_ICC:
+ if (jas_stream_write(out, colr->iccp,
+ JAS_CAST(int, colr->iccplen)) != JAS_CAST(int, colr->iccplen))
+ return -1;
+ break;
+ }
+ return 0;
+}
+
+static int jp2_cdef_putdata(jp2_box_t *box, jas_stream_t *out)
+{
+ jp2_cdef_t *cdef = &box->data.cdef;
+ unsigned int i;
+ jp2_cdefchan_t *ent;
+
+ if (jp2_putuint16(out, cdef->numchans)) {
+ return -1;
+ }
+
+ for (i = 0; i < cdef->numchans; ++i) {
+ ent = &cdef->ents[i];
+ if (jp2_putuint16(out, ent->channo) ||
+ jp2_putuint16(out, ent->type) ||
+ jp2_putuint16(out, ent->assoc)) {
+ return -1;
+ }
+ }
+ return 0;
+}
+
+/******************************************************************************\
+* Input operations for primitive types.
+\******************************************************************************/
+
+static int jp2_getuint8(jas_stream_t *in, uint_fast8_t *val)
+{
+ int c;
+ if ((c = jas_stream_getc(in)) == EOF) {
+ return -1;
+ }
+ if (val) {
+ *val = c;
+ }
+ return 0;
+}
+
+static int jp2_getuint16(jas_stream_t *in, uint_fast16_t *val)
+{
+ uint_fast16_t v;
+ int c;
+ if ((c = jas_stream_getc(in)) == EOF) {
+ return -1;
+ }
+ v = c;
+ if ((c = jas_stream_getc(in)) == EOF) {
+ return -1;
+ }
+ v = (v << 8) | c;
+ if (val) {
+ *val = v;
+ }
+ return 0;
+}
+
+static int jp2_getuint32(jas_stream_t *in, uint_fast32_t *val)
+{
+ uint_fast32_t v;
+ int c;
+ if ((c = jas_stream_getc(in)) == EOF) {
+ return -1;
+ }
+ v = c;
+ if ((c = jas_stream_getc(in)) == EOF) {
+ return -1;
+ }
+ v = (v << 8) | c;
+ if ((c = jas_stream_getc(in)) == EOF) {
+ return -1;
+ }
+ v = (v << 8) | c;
+ if ((c = jas_stream_getc(in)) == EOF) {
+ return -1;
+ }
+ v = (v << 8) | c;
+ if (val) {
+ *val = v;
+ }
+ return 0;
+}
+
+static int jp2_getuint64(jas_stream_t *in, uint_fast64_t *val)
+{
+ uint_fast64_t tmpval;
+ int i;
+ int c;
+
+ tmpval = 0;
+ for (i = 0; i < 8; ++i) {
+ tmpval <<= 8;
+ if ((c = jas_stream_getc(in)) == EOF) {
+ return -1;
+ }
+ tmpval |= (c & 0xff);
+ }
+ *val = tmpval;
+
+ return 0;
+}
+
+/******************************************************************************\
+* Output operations for primitive types.
+\******************************************************************************/
+
+static int jp2_putuint8(jas_stream_t *out, uint_fast8_t val)
+{
+ if (jas_stream_putc(out, val & 0xff) == EOF) {
+ return -1;
+ }
+ return 0;
+}
+
+static int jp2_putuint16(jas_stream_t *out, uint_fast16_t val)
+{
+ if (jas_stream_putc(out, (val >> 8) & 0xff) == EOF ||
+ jas_stream_putc(out, val & 0xff) == EOF) {
+ return -1;
+ }
+ return 0;
+}
+
+static int jp2_putuint32(jas_stream_t *out, uint_fast32_t val)
+{
+ if (jas_stream_putc(out, (val >> 24) & 0xff) == EOF ||
+ jas_stream_putc(out, (val >> 16) & 0xff) == EOF ||
+ jas_stream_putc(out, (val >> 8) & 0xff) == EOF ||
+ jas_stream_putc(out, val & 0xff) == EOF) {
+ return -1;
+ }
+ return 0;
+}
+
+static int jp2_putuint64(jas_stream_t *out, uint_fast64_t val)
+{
+ if (jp2_putuint32(out, (val >> 32) & 0xffffffffUL) ||
+ jp2_putuint32(out, val & 0xffffffffUL)) {
+ return -1;
+ }
+ return 0;
+}
+
+/******************************************************************************\
+* Miscellaneous code.
+\******************************************************************************/
+
+jp2_boxinfo_t *jp2_boxinfolookup(int type)
+{
+ jp2_boxinfo_t *boxinfo;
+ for (boxinfo = jp2_boxinfos; boxinfo->name; ++boxinfo) {
+ if (boxinfo->type == type) {
+ return boxinfo;
+ }
+ }
+ return &jp2_boxinfo_unk;
+}
+
+
+
+
+
+static void jp2_cmap_destroy(jp2_box_t *box)
+{
+ jp2_cmap_t *cmap = &box->data.cmap;
+ if (cmap->ents) {
+ jas_free(cmap->ents);
+ }
+}
+
+static int jp2_cmap_getdata(jp2_box_t *box, jas_stream_t *in)
+{
+ jp2_cmap_t *cmap = &box->data.cmap;
+ jp2_cmapent_t *ent;
+ unsigned int i;
+
+ cmap->numchans = (box->datalen) / 4;
+ if (!(cmap->ents = jas_malloc(cmap->numchans * sizeof(jp2_cmapent_t)))) {
+ return -1;
+ }
+ for (i = 0; i < cmap->numchans; ++i) {
+ ent = &cmap->ents[i];
+ if (jp2_getuint16(in, &ent->cmptno) ||
+ jp2_getuint8(in, &ent->map) ||
+ jp2_getuint8(in, &ent->pcol)) {
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+static int jp2_cmap_putdata(jp2_box_t *box, jas_stream_t *out)
+{
+ /* Eliminate compiler warning about unused variables. */
+ box = 0;
+ out = 0;
+
+ return -1;
+}
+
+static void jp2_cmap_dumpdata(jp2_box_t *box, FILE *out)
+{
+ jp2_cmap_t *cmap = &box->data.cmap;
+ unsigned int i;
+ jp2_cmapent_t *ent;
+ fprintf(out, "numchans = %d\n", (int) cmap->numchans);
+ for (i = 0; i < cmap->numchans; ++i) {
+ ent = &cmap->ents[i];
+ fprintf(out, "cmptno=%d; map=%d; pcol=%d\n",
+ (int) ent->cmptno, (int) ent->map, (int) ent->pcol);
+ }
+}
+
+static void jp2_pclr_destroy(jp2_box_t *box)
+{
+ jp2_pclr_t *pclr = &box->data.pclr;
+ if (pclr->lutdata) {
+ jas_free(pclr->lutdata);
+ }
+ if (pclr->bpc)
+ jas_free(pclr->bpc);
+}
+
+static int jp2_pclr_getdata(jp2_box_t *box, jas_stream_t *in)
+{
+ jp2_pclr_t *pclr = &box->data.pclr;
+ int lutsize;
+ unsigned int i;
+ unsigned int j;
+ int_fast32_t x;
+
+ pclr->lutdata = 0;
+
+ if (jp2_getuint16(in, &pclr->numlutents) ||
+ jp2_getuint8(in, &pclr->numchans)) {
+ return -1;
+ }
+ lutsize = pclr->numlutents * pclr->numchans;
+ if (!(pclr->lutdata = jas_malloc(lutsize * sizeof(int_fast32_t)))) {
+ return -1;
+ }
+ if (!(pclr->bpc = jas_malloc(pclr->numchans * sizeof(uint_fast8_t)))) {
+ return -1;
+ }
+ for (i = 0; i < pclr->numchans; ++i) {
+ if (jp2_getuint8(in, &pclr->bpc[i])) {
+ return -1;
+ }
+ }
+ for (i = 0; i < pclr->numlutents; ++i) {
+ for (j = 0; j < pclr->numchans; ++j) {
+ if (jp2_getint(in, (pclr->bpc[j] & 0x80) != 0,
+ (pclr->bpc[j] & 0x7f) + 1, &x)) {
+ return -1;
+ }
+ pclr->lutdata[i * pclr->numchans + j] = x;
+ }
+ }
+ return 0;
+}
+
+static int jp2_pclr_putdata(jp2_box_t *box, jas_stream_t *out)
+{
+#if 0
+ jp2_pclr_t *pclr = &box->data.pclr;
+#endif
+/* Eliminate warning about unused variable. */
+box = 0;
+out = 0;
+ return -1;
+}
+
+static void jp2_pclr_dumpdata(jp2_box_t *box, FILE *out)
+{
+ jp2_pclr_t *pclr = &box->data.pclr;
+ unsigned int i;
+ int j;
+ fprintf(out, "numents=%d; numchans=%d\n", (int) pclr->numlutents,
+ (int) pclr->numchans);
+ for (i = 0; i < pclr->numlutents; ++i) {
+ for (j = 0; j < pclr->numchans; ++j) {
+ fprintf(out, "LUT[%d][%d]=%d\n", i, j, pclr->lutdata[i * pclr->numchans + j]);
+ }
+ }
+}
+
+static int jp2_getint(jas_stream_t *in, int s, int n, int_fast32_t *val)
+{
+ int c;
+ int i;
+ uint_fast32_t v;
+ int m;
+
+ m = (n + 7) / 8;
+
+ v = 0;
+ for (i = 0; i < m; ++i) {
+ if ((c = jas_stream_getc(in)) == EOF) {
+ return -1;
+ }
+ v = (v << 8) | c;
+ }
+ v &= ONES(n);
+ if (s) {
+ int sb;
+ sb = v & (1 << (8 * m - 1));
+ *val = ((~v) + 1) & ONES(8 * m);
+ if (sb) {
+ *val = -*val;
+ }
+ } else {
+ *val = v;
+ }
+
+ return 0;
+}
+
+jp2_cdefchan_t *jp2_cdef_lookup(jp2_cdef_t *cdef, int channo)
+{
+ unsigned int i;
+ jp2_cdefchan_t *cdefent;
+ for (i = 0; i < cdef->numchans; ++i) {
+ cdefent = &cdef->ents[i];
+ if (cdefent->channo == JAS_CAST(unsigned int, channo)) {
+ return cdefent;
+ }
+ }
+ return 0;
+}
diff --git a/nativeLib/rary.cots.jasper/jasper-1.900.1/src/libjasper/jp2/jp2_enc.c.orig b/nativeLib/rary.cots.jasper/jasper-1.900.1/src/libjasper/jp2/jp2_enc.c.orig
new file mode 100644
index 0000000000..9e1e1fc47d
--- /dev/null
+++ b/nativeLib/rary.cots.jasper/jasper-1.900.1/src/libjasper/jp2/jp2_enc.c.orig
@@ -0,0 +1,436 @@
+/*
+ * Copyright (c) 1999-2000 Image Power, Inc. and the University of
+ * British Columbia.
+ * Copyright (c) 2001-2003 Michael David Adams.
+ * All rights reserved.
+ */
+
+/* __START_OF_JASPER_LICENSE__
+ *
+ * JasPer License Version 2.0
+ *
+ * Copyright (c) 2001-2006 Michael David Adams
+ * Copyright (c) 1999-2000 Image Power, Inc.
+ * Copyright (c) 1999-2000 The University of British Columbia
+ *
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person (the
+ * "User") obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, and/or sell copies of the Software, and to permit
+ * persons to whom the Software is furnished to do so, subject to the
+ * following conditions:
+ *
+ * 1. The above copyright notices and this permission notice (which
+ * includes the disclaimer below) shall be included in all copies or
+ * substantial portions of the Software.
+ *
+ * 2. The name of a copyright holder shall not be used to endorse or
+ * promote products derived from the Software without specific prior
+ * written permission.
+ *
+ * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
+ * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
+ * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
+ * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
+ * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
+ * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
+ * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
+ * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
+ * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
+ * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
+ * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
+ * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
+ * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
+ * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
+ * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
+ * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
+ * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
+ * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
+ * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
+ * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
+ *
+ * __END_OF_JASPER_LICENSE__
+ */
+
+/*
+ * JP2 Library
+ *
+ * $Id$
+ */
+
+/******************************************************************************\
+* Includes.
+\******************************************************************************/
+
+#include
+#include "jasper/jas_malloc.h"
+#include "jasper/jas_image.h"
+#include "jasper/jas_stream.h"
+#include "jasper/jas_cm.h"
+#include "jasper/jas_icc.h"
+#include "jp2_cod.h"
+
+static uint_fast32_t jp2_gettypeasoc(int colorspace, int ctype);
+static int clrspctojp2(jas_clrspc_t clrspc);
+
+/******************************************************************************\
+* Functions.
+\******************************************************************************/
+
+int jp2_encode(jas_image_t *image, jas_stream_t *out, char *optstr)
+{
+ jp2_box_t *box;
+ jp2_ftyp_t *ftyp;
+ jp2_ihdr_t *ihdr;
+ jas_stream_t *tmpstream;
+ int allcmptssame;
+ jp2_bpcc_t *bpcc;
+ long len;
+ uint_fast16_t cmptno;
+ jp2_colr_t *colr;
+ char buf[4096];
+ uint_fast32_t overhead;
+ jp2_cdefchan_t *cdefchanent;
+ jp2_cdef_t *cdef;
+ int i;
+ uint_fast32_t typeasoc;
+jas_iccprof_t *iccprof;
+jas_stream_t *iccstream;
+int pos;
+int needcdef;
+int prec;
+int sgnd;
+
+ box = 0;
+ tmpstream = 0;
+
+ allcmptssame = 1;
+ sgnd = jas_image_cmptsgnd(image, 0);
+ prec = jas_image_cmptprec(image, 0);
+ for (i = 1; i < jas_image_numcmpts(image); ++i) {
+ if (jas_image_cmptsgnd(image, i) != sgnd ||
+ jas_image_cmptprec(image, i) != prec) {
+ allcmptssame = 0;
+ break;
+ }
+ }
+
+ /* Output the signature box. */
+
+ if (!(box = jp2_box_create(JP2_BOX_JP))) {
+ goto error;
+ }
+ box->data.jp.magic = JP2_JP_MAGIC;
+ if (jp2_box_put(box, out)) {
+ goto error;
+ }
+ jp2_box_destroy(box);
+ box = 0;
+
+ /* Output the file type box. */
+
+ if (!(box = jp2_box_create(JP2_BOX_FTYP))) {
+ goto error;
+ }
+ ftyp = &box->data.ftyp;
+ ftyp->majver = JP2_FTYP_MAJVER;
+ ftyp->minver = JP2_FTYP_MINVER;
+ ftyp->numcompatcodes = 1;
+ ftyp->compatcodes[0] = JP2_FTYP_COMPATCODE;
+ if (jp2_box_put(box, out)) {
+ goto error;
+ }
+ jp2_box_destroy(box);
+ box = 0;
+
+ /*
+ * Generate the data portion of the JP2 header box.
+ * We cannot simply output the header for this box
+ * since we do not yet know the correct value for the length
+ * field.
+ */
+
+ if (!(tmpstream = jas_stream_memopen(0, 0))) {
+ goto error;
+ }
+
+ /* Generate image header box. */
+
+ if (!(box = jp2_box_create(JP2_BOX_IHDR))) {
+ goto error;
+ }
+ ihdr = &box->data.ihdr;
+ ihdr->width = jas_image_width(image);
+ ihdr->height = jas_image_height(image);
+ ihdr->numcmpts = jas_image_numcmpts(image);
+ ihdr->bpc = allcmptssame ? JP2_SPTOBPC(jas_image_cmptsgnd(image, 0),
+ jas_image_cmptprec(image, 0)) : JP2_IHDR_BPCNULL;
+ ihdr->comptype = JP2_IHDR_COMPTYPE;
+ ihdr->csunk = 0;
+ ihdr->ipr = 0;
+ if (jp2_box_put(box, tmpstream)) {
+ goto error;
+ }
+ jp2_box_destroy(box);
+ box = 0;
+
+ /* Generate bits per component box. */
+
+ if (!allcmptssame) {
+ if (!(box = jp2_box_create(JP2_BOX_BPCC))) {
+ goto error;
+ }
+ bpcc = &box->data.bpcc;
+ bpcc->numcmpts = jas_image_numcmpts(image);
+ if (!(bpcc->bpcs = jas_malloc(bpcc->numcmpts *
+ sizeof(uint_fast8_t)))) {
+ goto error;
+ }
+ for (cmptno = 0; cmptno < bpcc->numcmpts; ++cmptno) {
+ bpcc->bpcs[cmptno] = JP2_SPTOBPC(jas_image_cmptsgnd(image,
+ cmptno), jas_image_cmptprec(image, cmptno));
+ }
+ if (jp2_box_put(box, tmpstream)) {
+ goto error;
+ }
+ jp2_box_destroy(box);
+ box = 0;
+ }
+
+ /* Generate color specification box. */
+
+ if (!(box = jp2_box_create(JP2_BOX_COLR))) {
+ goto error;
+ }
+ colr = &box->data.colr;
+ switch (jas_image_clrspc(image)) {
+ case JAS_CLRSPC_SRGB:
+ case JAS_CLRSPC_SYCBCR:
+ case JAS_CLRSPC_SGRAY:
+ colr->method = JP2_COLR_ENUM;
+ colr->csid = clrspctojp2(jas_image_clrspc(image));
+ colr->pri = JP2_COLR_PRI;
+ colr->approx = 0;
+ break;
+ default:
+ colr->method = JP2_COLR_ICC;
+ colr->pri = JP2_COLR_PRI;
+ colr->approx = 0;
+ iccprof = jas_iccprof_createfromcmprof(jas_image_cmprof(image));
+ assert(iccprof);
+ iccstream = jas_stream_memopen(0, 0);
+ assert(iccstream);
+ if (jas_iccprof_save(iccprof, iccstream))
+ abort();
+ if ((pos = jas_stream_tell(iccstream)) < 0)
+ abort();
+ colr->iccplen = pos;
+ colr->iccp = jas_malloc(pos);
+ assert(colr->iccp);
+ jas_stream_rewind(iccstream);
+ if (jas_stream_read(iccstream, colr->iccp, colr->iccplen) != colr->iccplen)
+ abort();
+ jas_stream_close(iccstream);
+ jas_iccprof_destroy(iccprof);
+ break;
+ }
+ if (jp2_box_put(box, tmpstream)) {
+ goto error;
+ }
+ jp2_box_destroy(box);
+ box = 0;
+
+ needcdef = 1;
+ switch (jas_clrspc_fam(jas_image_clrspc(image))) {
+ case JAS_CLRSPC_FAM_RGB:
+ if (jas_image_cmpttype(image, 0) ==
+ JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_R) &&
+ jas_image_cmpttype(image, 1) ==
+ JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_G) &&
+ jas_image_cmpttype(image, 2) ==
+ JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_B))
+ needcdef = 0;
+ break;
+ case JAS_CLRSPC_FAM_YCBCR:
+ if (jas_image_cmpttype(image, 0) ==
+ JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_YCBCR_Y) &&
+ jas_image_cmpttype(image, 1) ==
+ JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_YCBCR_CB) &&
+ jas_image_cmpttype(image, 2) ==
+ JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_YCBCR_CR))
+ needcdef = 0;
+ break;
+ case JAS_CLRSPC_FAM_GRAY:
+ if (jas_image_cmpttype(image, 0) ==
+ JAS_IMAGE_CT_COLOR(JAS_IMAGE_CT_GRAY_Y))
+ needcdef = 0;
+ break;
+ default:
+ abort();
+ break;
+ }
+
+ if (needcdef) {
+ if (!(box = jp2_box_create(JP2_BOX_CDEF))) {
+ goto error;
+ }
+ cdef = &box->data.cdef;
+ cdef->numchans = jas_image_numcmpts(image);
+ cdef->ents = jas_malloc(cdef->numchans * sizeof(jp2_cdefchan_t));
+ for (i = 0; i < jas_image_numcmpts(image); ++i) {
+ cdefchanent = &cdef->ents[i];
+ cdefchanent->channo = i;
+ typeasoc = jp2_gettypeasoc(jas_image_clrspc(image), jas_image_cmpttype(image, i));
+ cdefchanent->type = typeasoc >> 16;
+ cdefchanent->assoc = typeasoc & 0x7fff;
+ }
+ if (jp2_box_put(box, tmpstream)) {
+ goto error;
+ }
+ jp2_box_destroy(box);
+ box = 0;
+ }
+
+ /* Determine the total length of the JP2 header box. */
+
+ len = jas_stream_tell(tmpstream);
+ jas_stream_rewind(tmpstream);
+
+ /*
+ * Output the JP2 header box and all of the boxes which it contains.
+ */
+
+ if (!(box = jp2_box_create(JP2_BOX_JP2H))) {
+ goto error;
+ }
+ box->len = len + JP2_BOX_HDRLEN(false);
+ if (jp2_box_put(box, out)) {
+ goto error;
+ }
+ jp2_box_destroy(box);
+ box = 0;
+
+ if (jas_stream_copy(out, tmpstream, len)) {
+ goto error;
+ }
+
+ jas_stream_close(tmpstream);
+ tmpstream = 0;
+
+ /*
+ * Output the contiguous code stream box.
+ */
+
+ if (!(box = jp2_box_create(JP2_BOX_JP2C))) {
+ goto error;
+ }
+ box->len = 0;
+ if (jp2_box_put(box, out)) {
+ goto error;
+ }
+ jp2_box_destroy(box);
+ box = 0;
+
+ /* Output the JPEG-2000 code stream. */
+
+ overhead = jas_stream_getrwcount(out);
+ sprintf(buf, "%s\n_jp2overhead=%lu\n", (optstr ? optstr : ""),
+ (unsigned long) overhead);
+
+ if (jpc_encode(image, out, buf)) {
+ goto error;
+ }
+
+ return 0;
+ abort();
+
+error:
+
+ if (box) {
+ jp2_box_destroy(box);
+ }
+ if (tmpstream) {
+ jas_stream_close(tmpstream);
+ }
+ return -1;
+}
+
+static uint_fast32_t jp2_gettypeasoc(int colorspace, int ctype)
+{
+ int type;
+ int asoc;
+
+ if (ctype & JAS_IMAGE_CT_OPACITY) {
+ type = JP2_CDEF_TYPE_OPACITY;
+ asoc = JP2_CDEF_ASOC_ALL;
+ goto done;
+ }
+
+ type = JP2_CDEF_TYPE_UNSPEC;
+ asoc = JP2_CDEF_ASOC_NONE;
+ switch (jas_clrspc_fam(colorspace)) {
+ case JAS_CLRSPC_FAM_RGB:
+ switch (JAS_IMAGE_CT_COLOR(ctype)) {
+ case JAS_IMAGE_CT_RGB_R:
+ type = JP2_CDEF_TYPE_COLOR;
+ asoc = JP2_CDEF_RGB_R;
+ break;
+ case JAS_IMAGE_CT_RGB_G:
+ type = JP2_CDEF_TYPE_COLOR;
+ asoc = JP2_CDEF_RGB_G;
+ break;
+ case JAS_IMAGE_CT_RGB_B:
+ type = JP2_CDEF_TYPE_COLOR;
+ asoc = JP2_CDEF_RGB_B;
+ break;
+ }
+ break;
+ case JAS_CLRSPC_FAM_YCBCR:
+ switch (JAS_IMAGE_CT_COLOR(ctype)) {
+ case JAS_IMAGE_CT_YCBCR_Y:
+ type = JP2_CDEF_TYPE_COLOR;
+ asoc = JP2_CDEF_YCBCR_Y;
+ break;
+ case JAS_IMAGE_CT_YCBCR_CB:
+ type = JP2_CDEF_TYPE_COLOR;
+ asoc = JP2_CDEF_YCBCR_CB;
+ break;
+ case JAS_IMAGE_CT_YCBCR_CR:
+ type = JP2_CDEF_TYPE_COLOR;
+ asoc = JP2_CDEF_YCBCR_CR;
+ break;
+ }
+ break;
+ case JAS_CLRSPC_FAM_GRAY:
+ type = JP2_CDEF_TYPE_COLOR;
+ asoc = JP2_CDEF_GRAY_Y;
+ break;
+ }
+
+done:
+ return (type << 16) | asoc;
+}
+
+static int clrspctojp2(jas_clrspc_t clrspc)
+{
+ switch (clrspc) {
+ case JAS_CLRSPC_SRGB:
+ return JP2_COLR_SRGB;
+ case JAS_CLRSPC_SYCBCR:
+ return JP2_COLR_SYCC;
+ case JAS_CLRSPC_SGRAY:
+ return JP2_COLR_SGRAY;
+ default:
+ abort();
+ break;
+ }
+}