Merge branch 'omaha_13.5.1' (13.5.1-15) into development
Conflicts: cave/com.raytheon.uf.viz.d2d.core/src/com/raytheon/uf/viz/d2d/core/time/D2DTimeMatcher.java cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/FollowupData.java edexOsgi/com.raytheon.edex.plugin.bufrua/res/pointdata/bufruadb.xml edexOsgi/com.raytheon.edex.plugin.gfe/res/spring/gfe-spring.xml edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/db/dao/GFEDao.java edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/ifpnetCDF.py edexOsgi/com.raytheon.edex.plugin.modelsounding/META-INF/MANIFEST.MF edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/AbstractWarningRecord.java Former-commit-id:5e5047cc4f
[formerly e1aa1aa51e2325b005604aa971e842bccfcd8375] Former-commit-id:2a9276c728
This commit is contained in:
commit
db7c941f6f
117 changed files with 140381 additions and 269330 deletions
|
@ -8,11 +8,11 @@
|
|||
Modify:
|
||||
|
||||
06/14/2013 Xiaochuan DR 15733 Initial creation
|
||||
|
||||
-->
|
||||
07/25/2013 Greg Hull DR 15733 Deleted. moved to TextEditorCfg.xml
|
||||
-->
|
||||
|
||||
<fontSizeCfg>
|
||||
<SizeButtonCfg>
|
||||
<!--<fontSizeCfg>
|
||||
<SizeButt
|
||||
<LabelName>Small Font</LabelName>
|
||||
<SizeEnabled>true</SizeEnabled>
|
||||
<FontSize>9</FontSize>
|
||||
|
@ -22,12 +22,12 @@
|
|||
<LabelName>Medium Font</LabelName>
|
||||
<SizeEnabled>true</SizeEnabled>
|
||||
<FontSize>11</FontSize>
|
||||
<Selected>false</Selected>
|
||||
<Selected>true</Selected>
|
||||
</SizeButtonCfg>
|
||||
<SizeButtonCfg>
|
||||
<LabelName>Large Font</LabelName>
|
||||
<SizeEnabled>true</SizeEnabled>
|
||||
<FontSize>13</FontSize>
|
||||
<Selected>true</Selected>
|
||||
<Selected>false</Selected>
|
||||
</SizeButtonCfg>
|
||||
</fontSizeCfg>
|
||||
</fontSizeCfg>-->
|
|
@ -10,14 +10,12 @@
|
|||
|
||||
Modify:
|
||||
|
||||
06/14/2013 Xiaochuan DR 15733 Initial creation
|
||||
07/18/2013 B. Hebbard per G. Hull DR 15733 Update highlightBG & FG
|
||||
|
||||
-->
|
||||
|
||||
<textColorsCfg>
|
||||
06/14/2013 Xiaochuan DR 15733 Initial creation
|
||||
07/25/2013 Greg Hull DR 15733 Deleted. moved to TextEditorCfg.xml
|
||||
-->
|
||||
<!--<textColorsCfg
|
||||
<TextColorElement paramName="textBG" color="255, 255, 255"/>
|
||||
<TextColorElement paramName="textFG" color="0, 0,0"/>
|
||||
<TextColorElement paramName="textFG" color="BLACK"/>
|
||||
<TextColorElement paramName="highlightBG" color="85, 152, 215"/>
|
||||
<TextColorElement paramName="highlightFG" color="255, 255, 255"/>
|
||||
</textColorsCfg>
|
||||
<TextColorElement paramName="highlightFG" color="PINK"/>
|
||||
</textColorsCfg> -->
|
|
@ -0,0 +1,54 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<!--
|
||||
The file is used to set user preferences for the TextEditor.
|
||||
|
||||
|
||||
History:
|
||||
|
||||
07/25/2013 Greg Hull DR 15733 Created (and modified) from FontSizeCfg.xml and TextColorsCfg.xml
|
||||
07/31/2013 B. Hebbard DR 15733 Changed highlightTextForegroundColor from "0, 0, 0" to "WHITE"
|
||||
(per Joshua Huber and Greg Hull)
|
||||
|
||||
|
||||
-->
|
||||
<textEditorCfg>
|
||||
|
||||
<defaultNumEditors>4</defaultNumEditors>
|
||||
|
||||
<maxNumEditors>8</maxNumEditors>
|
||||
|
||||
<!-- The format can be either the name of a color or RGB values
|
||||
-->
|
||||
<textForegroundColor>BLACK</textForegroundColor>
|
||||
<textBackgroundColor>WHITE</textBackgroundColor>
|
||||
<highlightTextForegroundColor>WHITE</highlightTextForegroundColor>
|
||||
<highlightTextBackgroundColor>85, 152, 215</highlightTextBackgroundColor>
|
||||
|
||||
<!-- The fonts available under the Options menu. Only one should be selected -->
|
||||
<fontSizeCfg>
|
||||
<SizeButtonCfg>
|
||||
<LabelName>Small</LabelName>
|
||||
<FontSize>9</FontSize>
|
||||
<Selected>false</Selected>
|
||||
</SizeButtonCfg>
|
||||
<SizeButtonCfg>
|
||||
<LabelName>Medium</LabelName>
|
||||
<FontSize>11</FontSize>
|
||||
<Selected>true</Selected>
|
||||
</SizeButtonCfg>
|
||||
<SizeButtonCfg>
|
||||
<LabelName>Large</LabelName>
|
||||
<FontSize>13</FontSize>
|
||||
<Selected>false</Selected>
|
||||
</SizeButtonCfg>
|
||||
<!-- Can add more buttons/fonts like this .....
|
||||
<SizeButtonCfg>
|
||||
<LabelName>Giant</LabelName>
|
||||
<FontSize>20</FontSize>
|
||||
<FontName>Helvetica</FontName>
|
||||
<Selected>false</Selected>
|
||||
</SizeButtonCfg>
|
||||
-->
|
||||
</fontSizeCfg>
|
||||
|
||||
</textEditorCfg>
|
|
@ -30,6 +30,7 @@ import org.eclipse.swt.widgets.Event;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 7/1/06 chammack Initial Creation.
|
||||
* 08/02/2013 DR 16427 Qinglu Lin (David's approach) Added SYSTEM_RESOURCE_LOW(1) to InputPriority.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -38,9 +39,13 @@ import org.eclipse.swt.widgets.Event;
|
|||
*/
|
||||
public interface IInputHandler {
|
||||
|
||||
/*
|
||||
* Note that these values are not only used for priority. They are also used
|
||||
* to determine which event handlers are swapped in SideView.swapPanes.
|
||||
*/
|
||||
public static enum InputPriority {
|
||||
LOWEST(0), RESOURCE(3), SYSTEM_RESOURCE(4), PART(5), PERSPECTIVE(6), WINDOW(
|
||||
7);
|
||||
LOWEST(0), SYSTEM_RESOURCE_LOW(1), RESOURCE(3), SYSTEM_RESOURCE(4), PART(5), PERSPECTIVE(6),
|
||||
WINDOW(7);
|
||||
|
||||
public Integer value;
|
||||
|
||||
|
|
|
@ -71,6 +71,8 @@ import com.raytheon.viz.ui.actions.DummyAction;
|
|||
* drawn into the smaller pane.
|
||||
* Sep 4, 2012 15335 kshresth Will now display lightning/wind fields
|
||||
* when magnification set to 0
|
||||
* Aug 2, 2013 DR 16427 Qinglu Lin (David's approach) Changing InputPriority.SYSTEM_RESOURCE to
|
||||
* InputPriority.SYSTEM_RESOURCE_LOW in initInternal().
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -499,9 +501,15 @@ public class D2DLegendResource extends
|
|||
legendFont = target.initializeFont(D2DLegendResource.class.getName());
|
||||
IDisplayPaneContainer rc = getResourceContainer();
|
||||
if (rc != null) {
|
||||
/*
|
||||
* The legendHandler needs to have higher priority that the
|
||||
* changeModeHandler. The following assumes that the legendHandler,
|
||||
* by being added later, runs before the changeModelHandler. See
|
||||
* InputManager.handeMouseXxx.
|
||||
*/
|
||||
rc.registerMouseHandler(changeModeHandler, InputPriority.SYSTEM_RESOURCE_LOW);
|
||||
rc.registerMouseHandler(legendHandler,
|
||||
InputPriority.SYSTEM_RESOURCE);
|
||||
rc.registerMouseHandler(changeModeHandler, InputPriority.RESOURCE);
|
||||
InputPriority.SYSTEM_RESOURCE_LOW);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -74,6 +74,7 @@ import com.raytheon.uf.viz.d2d.core.D2DLoadProperties;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 10, 2009 chammack Initial creation
|
||||
* Jul 03, 2013 2159 bsteffen Synchronize TimeCache access.
|
||||
* Aug 9, 2013 DR 16448 D. Friedman Validate time match basis in redoTimeMatching
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -228,6 +229,8 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
|
|||
@Override
|
||||
public void redoTimeMatching(IDescriptor descriptor) throws VizException {
|
||||
synchronized (this) {
|
||||
if (timeMatchBasis != null && ! validateTimeMatchBasis(descriptor.getResourceList()))
|
||||
timeMatchBasis = null;
|
||||
if (timeMatchBasis != null) {
|
||||
IDescriptor tmDescriptor = timeMatchBasis.getDescriptor();
|
||||
if (tmDescriptor != null) {
|
||||
|
@ -1050,4 +1053,22 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
|
|||
configFactory.resetMultiload();
|
||||
}
|
||||
|
||||
private boolean validateTimeMatchBasis(ResourceList list) {
|
||||
for (ResourcePair rp : list) {
|
||||
AbstractVizResource<?, ?> rsc = rp.getResource();
|
||||
if (rsc == timeMatchBasis) {
|
||||
return true;
|
||||
} else if (rp.getProperties().isMapLayer()
|
||||
|| rp.getProperties().isSystemResource()) {
|
||||
continue;
|
||||
} else if (rsc.getResourceData() instanceof IResourceGroup) {
|
||||
if (validateTimeMatchBasis(((IResourceGroup) rsc.getResourceData())
|
||||
.getResourceList())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -87,8 +87,8 @@ public class NSharpPrintScreenAction extends PrintScreenAction {
|
|||
if (frameMode == null || frameMode.equalsIgnoreCase("current")) {
|
||||
// selection doesn't seem to work.
|
||||
pd.setScope(PrinterData.PAGE_RANGE);
|
||||
pd.setStartPage(NsharpFrameIndexUtil.getCurrentIndex(handler) + 1);
|
||||
pd.setEndPage(NsharpFrameIndexUtil.getCurrentIndex(handler) + 1);
|
||||
pd.setStartPage(handler.getCurrentIndex()+1);//Chin NsharpFrameIndexUtil.getCurrentIndex(handler) + 1);
|
||||
pd.setEndPage(handler.getCurrentIndex()+1); // Chin NsharpFrameIndexUtil.getCurrentIndex(handler) + 1);
|
||||
} else if (frameMode.equalsIgnoreCase("all")) {
|
||||
pd.setScope(PrinterData.ALL_PAGES);
|
||||
} else {
|
||||
|
@ -138,24 +138,26 @@ public class NSharpPrintScreenAction extends PrintScreenAction {
|
|||
|
||||
private void printAllFrames(NsharpPrintHandle printer, NsharpEditor editor)
|
||||
throws VizException {
|
||||
printFrames(printer, editor, 0, NsharpFrameIndexUtil.getFrameCount(editor.getRscHandler()));
|
||||
printFrames(printer, editor, 0, editor.getRscHandler().getFrameCount()); //Chin NsharpFrameIndexUtil.getFrameCount(editor.getRscHandler()));
|
||||
}
|
||||
|
||||
private void printFrames(NsharpPrintHandle printer, NsharpEditor editor,
|
||||
int startIndex, int endIndex) throws VizException {
|
||||
NsharpResourceHandler handler = ((NsharpEditor) editor).getRscHandler();
|
||||
IDisplayPane pane = editor.getActiveDisplayPane();
|
||||
int startingIndex = NsharpFrameIndexUtil.getCurrentIndex(handler);
|
||||
int startingIndex = handler.getCurrentIndex();//Chin NsharpFrameIndexUtil.getCurrentIndex(handler);
|
||||
LoopProperties loopProperties = ((AbstractEditor) editor)
|
||||
.getLoopProperties();
|
||||
renderPane(pane, loopProperties);
|
||||
for (int i = startIndex; i < endIndex; i++) {
|
||||
NsharpFrameIndexUtil.setCurrentIndex(handler, i);
|
||||
//Chin NsharpFrameIndexUtil.setCurrentIndex(handler, i);
|
||||
if(handler.setCurrentIndex(i)== false)
|
||||
continue;
|
||||
pane.refresh();
|
||||
renderPane(pane, loopProperties);
|
||||
printImage(printer);
|
||||
}
|
||||
NsharpFrameIndexUtil.setCurrentIndex(handler, startingIndex);
|
||||
handler.setCurrentIndex(startingIndex); // Chin NsharpFrameIndexUtil.setCurrentIndex(handler, startingIndex);
|
||||
pane.refresh();
|
||||
renderPane(pane, loopProperties);
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ public class NSharpSaveScreenAction extends SaveScreenAction {
|
|||
}
|
||||
NsharpResourceHandler handler = ((NsharpEditor) editor).getRscHandler();
|
||||
int startIndex = 0;
|
||||
int endIndex = NsharpFrameIndexUtil.getFrameCount(handler);
|
||||
int endIndex = handler .getFrameCount(); // Chin NsharpFrameIndexUtil.getFrameCount(handler);
|
||||
return captureFrames(editor, startIndex, endIndex);
|
||||
}
|
||||
|
||||
|
@ -75,18 +75,20 @@ public class NSharpSaveScreenAction extends SaveScreenAction {
|
|||
IDisplayPane pane = editor.getActiveDisplayPane();
|
||||
NsharpResourceHandler handler = ((NsharpEditor) editor).getRscHandler();
|
||||
// save the frame we are on;
|
||||
int startingIndex = NsharpFrameIndexUtil.getCurrentIndex(handler);
|
||||
int startingIndex = handler.getCurrentIndex(); // Chin NsharpFrameIndexUtil.getCurrentIndex(handler);
|
||||
List<BufferedImage> images = new ArrayList<BufferedImage>();
|
||||
LoopProperties loopProperties = ((AbstractEditor) editor)
|
||||
.getLoopProperties();
|
||||
renderPane(pane, loopProperties);
|
||||
for (int i = startIndex; i < endIndex; i++) {
|
||||
NsharpFrameIndexUtil.setCurrentIndex(handler, i);
|
||||
//Chin NsharpFrameIndexUtil.setCurrentIndex(handler, i);
|
||||
if(handler.setCurrentIndex(i)== false)
|
||||
continue;
|
||||
pane.refresh();
|
||||
renderPane(pane, loopProperties);
|
||||
images.add(captureCurrentFrames(editor));
|
||||
}
|
||||
NsharpFrameIndexUtil.setCurrentIndex(handler, startingIndex);
|
||||
handler.setCurrentIndex(startingIndex); // Chin NsharpFrameIndexUtil.setCurrentIndex(handler, startingIndex);
|
||||
pane.refresh();
|
||||
renderPane(pane, loopProperties);
|
||||
return images;
|
||||
|
|
|
@ -46,7 +46,7 @@ import com.raytheon.uf.viz.core.drawables.IFrameCoordinator.FrameChangeOperation
|
|||
*/
|
||||
|
||||
public class NsharpFrameIndexUtil {
|
||||
|
||||
/* Chin
|
||||
public static int getFrameCount(NsharpResourceHandler handler){
|
||||
int count = 0;
|
||||
for (List<NsharpSoundingElementStateProperty> list : handler.getStnTimeTable()) {
|
||||
|
@ -104,5 +104,5 @@ public class NsharpFrameIndexUtil {
|
|||
current = handler.getCurSndProfileProp();
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
package com.raytheon.uf.viz.d2d.ui.map;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
@ -96,6 +97,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* Nov 20, 2012 DR 15524 M.Porricelli Changed so interactive screens still editable when
|
||||
* swapped to side panel
|
||||
* Mar 21, 2013 1638 mschenke Changed map scales not tied to d2d
|
||||
* Aug 9, 2013 DR 16427 D. Friedman Swap additional input handlers.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -347,37 +349,38 @@ public class SideView extends ViewPart implements IMultiPaneEditor,
|
|||
|
||||
// First thing to do, swap input handlers
|
||||
// Get editor resource handlers and unregister on editor
|
||||
IInputHandler[] editorResourceHandlers = theEditor
|
||||
.getMouseManager().getHandlersForPriority(
|
||||
InputPriority.RESOURCE);
|
||||
IInputHandler[] editorSystemRscHandlers = theEditor
|
||||
.getMouseManager().getHandlersForPriority(
|
||||
InputPriority.SYSTEM_RESOURCE);
|
||||
for (IInputHandler handler : editorResourceHandlers) {
|
||||
theEditor.getMouseManager().unregisterMouseHandler(handler);
|
||||
}
|
||||
for (IInputHandler handler : editorSystemRscHandlers) {
|
||||
theEditor.getMouseManager().unregisterMouseHandler(handler);
|
||||
final InputPriority[] SWAPPABLE_PRIORITIES = { InputPriority.RESOURCE,
|
||||
InputPriority.SYSTEM_RESOURCE,
|
||||
InputPriority.SYSTEM_RESOURCE_LOW };
|
||||
HashMap<InputPriority, IInputHandler[]> editorHandlers =
|
||||
new HashMap<IInputHandler.InputPriority, IInputHandler[]>();
|
||||
for (InputPriority priority : SWAPPABLE_PRIORITIES) {
|
||||
IInputHandler[] handlers = theEditor.getMouseManager()
|
||||
.getHandlersForPriority(priority);
|
||||
editorHandlers.put(priority, handlers);
|
||||
for (IInputHandler handler : handlers) {
|
||||
theEditor.getMouseManager().unregisterMouseHandler(handler);
|
||||
}
|
||||
}
|
||||
|
||||
// Store and unregister input handlers on ourself
|
||||
IInputHandler[] myResourceHandlers = paneManager.getMouseManager()
|
||||
.getHandlersForPriority(InputPriority.RESOURCE);
|
||||
IInputHandler[] mySystemRscHandlers = paneManager.getMouseManager()
|
||||
.getHandlersForPriority(InputPriority.SYSTEM_RESOURCE);
|
||||
for (IInputHandler handler : myResourceHandlers) {
|
||||
unregisterMouseHandler(handler);
|
||||
}
|
||||
for (IInputHandler handler : mySystemRscHandlers) {
|
||||
unregisterMouseHandler(handler);
|
||||
HashMap<InputPriority, IInputHandler[]> myHandlers =
|
||||
new HashMap<IInputHandler.InputPriority, IInputHandler[]>();
|
||||
for (InputPriority priority : SWAPPABLE_PRIORITIES) {
|
||||
IInputHandler[] handlers = paneManager.getMouseManager()
|
||||
.getHandlersForPriority(priority);
|
||||
myHandlers.put(priority, handlers);
|
||||
for (IInputHandler handler : handlers) {
|
||||
unregisterMouseHandler(handler);
|
||||
}
|
||||
}
|
||||
|
||||
// Register editor handlers on ourself
|
||||
for (IInputHandler handler : editorResourceHandlers) {
|
||||
registerMouseHandler(handler, InputPriority.RESOURCE);
|
||||
}
|
||||
for (IInputHandler handler : editorSystemRscHandlers) {
|
||||
registerMouseHandler(handler, InputPriority.SYSTEM_RESOURCE);
|
||||
for (InputPriority priority : SWAPPABLE_PRIORITIES) {
|
||||
IInputHandler[] handlers = editorHandlers.get(priority);
|
||||
for (IInputHandler handler : handlers) {
|
||||
registerMouseHandler(handler, priority);
|
||||
}
|
||||
}
|
||||
|
||||
IDisplayPane[] editorPanes = theEditor.getDisplayPanes();
|
||||
|
@ -587,13 +590,12 @@ public class SideView extends ViewPart implements IMultiPaneEditor,
|
|||
D2DLegendResource.LegendMode.PRODUCT,
|
||||
D2DLegendResource.LegendMode.SHORT_PRODUCT);
|
||||
|
||||
for (IInputHandler handler : myResourceHandlers) {
|
||||
theEditor.registerMouseHandler(handler,
|
||||
InputPriority.RESOURCE);
|
||||
}
|
||||
for (IInputHandler handler : mySystemRscHandlers) {
|
||||
theEditor.registerMouseHandler(handler,
|
||||
InputPriority.SYSTEM_RESOURCE);
|
||||
for (InputPriority priority : SWAPPABLE_PRIORITIES) {
|
||||
IInputHandler[] handlers = myHandlers.get(priority);
|
||||
for (IInputHandler handler : handlers) {
|
||||
theEditor.registerMouseHandler(handler,
|
||||
priority);
|
||||
}
|
||||
}
|
||||
|
||||
// Set up editableness
|
||||
|
|
|
@ -99,6 +99,7 @@ import com.raytheon.uf.viz.monitor.listeners.IMonitorListener;
|
|||
* Jun 07, 2013 2075 njensen Extracted FFMPProcessUris to separate class
|
||||
* Jul 09, 2013 2152 njensen Synchronize uri requests to avoid duplicating effort
|
||||
* Jul 15, 2013 2184 dhladky Remove all HUC's for storage except ALL
|
||||
* Jul 16, 2013 2197 njensen Use FFMPBasinData.hasAnyBasins() for efficiency
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -295,6 +296,7 @@ public class FFMPMonitor extends ResourceMonitor {
|
|||
* @param phuc
|
||||
* @return
|
||||
*/
|
||||
|
||||
protected List<String> getLoadedUris(String siteKey, String source) {
|
||||
FFMPSiteData siteData = siteDataMap.get(siteKey);
|
||||
FFMPSourceData sourceData = siteData.getSourceData(source);
|
||||
|
@ -333,6 +335,7 @@ public class FFMPMonitor extends ResourceMonitor {
|
|||
try {
|
||||
populateFFMPRecord(siteKey, new FFMPRecord(
|
||||
uri), source);
|
||||
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"FFMP Can't retrieve FFMP URI, "
|
||||
|
@ -712,7 +715,7 @@ public class FFMPMonitor extends ResourceMonitor {
|
|||
FFMPRecord record = siteDataMap.get(siteKey).getSourceData(sourceName)
|
||||
.getRecord();
|
||||
|
||||
if ((record != null) && (record.getBasinData().getBasins().size() > 0)) {
|
||||
if ((record != null) && (record.getBasinData().hasAnyBasins())) {
|
||||
|
||||
SourceXML sourceXML = getSourceConfig().getSource(sourceName);
|
||||
|
||||
|
@ -787,11 +790,13 @@ public class FFMPMonitor extends ResourceMonitor {
|
|||
} else {
|
||||
populateFFMPRecord(siteKey, dataKey, sourceName,
|
||||
ptime, retrieveNew);
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
populateFFMPRecord(siteKey, dataKey, sourceName, ptime,
|
||||
retrieveNew);
|
||||
|
||||
}
|
||||
} else {
|
||||
// special case where FFG is the primary source
|
||||
|
@ -1651,6 +1656,7 @@ public class FFMPMonitor extends ResourceMonitor {
|
|||
public void processUris(NavigableMap<Date, List<String>> uriMap,
|
||||
String siteKey, String sourceName, Date barrierTime,
|
||||
SubMonitor smonitor) {
|
||||
|
||||
FFMPProcessUris processor = new FFMPProcessUris(this, uriMap, siteKey,
|
||||
sourceName, barrierTime);
|
||||
processor.run(smonitor);
|
||||
|
@ -2191,6 +2197,7 @@ public class FFMPMonitor extends ResourceMonitor {
|
|||
statusHandler.handle(Priority.PROBLEM,
|
||||
"FFMP Can't retrieve FFMP URI, " + dataUri, e);
|
||||
}
|
||||
|
||||
sourceData.addLoadedUri(dataUri);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,6 +79,7 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FfmpTableConfigData;
|
|||
* multi-threaded row creation.
|
||||
* July 1, 2013 2155 dhladky Fixed bug that created more rows than were actually needed.
|
||||
* Jul 15, 2013 2184 dhladky Remove all HUC's for storage except ALL
|
||||
* Jul 16, 2013 2197 njensen Use FFMPBasinData.hasAnyBasins() for efficiency
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -163,7 +164,9 @@ public class FFMPDataGenerator {
|
|||
* @return FFMPTableData object
|
||||
* @throws Exception
|
||||
*/
|
||||
|
||||
public FFMPTableData generateFFMPData() throws Exception {
|
||||
|
||||
// You should always have at least a QPE data source
|
||||
FFMPTableData tData = null;
|
||||
// update the FFFGDataManager
|
||||
|
@ -174,23 +177,27 @@ public class FFMPDataGenerator {
|
|||
FIELDS field = getBaseField();
|
||||
|
||||
if (field == null || baseRec == null) {
|
||||
|
||||
return tData;
|
||||
}
|
||||
|
||||
List<DomainXML> domains = resource.getDomains();
|
||||
|
||||
if ((centeredAggregationKey == null) || huc.equals(FFMPRecord.ALL)) {
|
||||
// System.out.println(fbd.getBasins().keySet().size()
|
||||
// + " rows in the table");
|
||||
|
||||
if (huc.equals(FFMPRecord.ALL)) {
|
||||
|
||||
FFMPBasinData fbd = baseRec.getBasinData();
|
||||
tData = new FFMPTableData(fbd.getBasins().size());
|
||||
|
||||
for (Long key : fbd.getBasins().keySet()) {
|
||||
|
||||
FFMPBasinMetaData fmdb = ft.getBasin(siteKey, key);
|
||||
|
||||
if (fmdb == null) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
for (DomainXML domain : domains) {
|
||||
|
@ -200,26 +207,36 @@ public class FFMPDataGenerator {
|
|||
if ((cwa.equals(fmdb.getCwa()))
|
||||
|| (domain.isPrimary() && fmdb
|
||||
.isPrimaryCwa())) {
|
||||
|
||||
try {
|
||||
setFFMPRow(fbd.get(key), tData, false, cwa);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Couldn't create table row", e);
|
||||
}
|
||||
|
||||
if (virtualBasin != null) {
|
||||
|
||||
for (Long id : ft
|
||||
.getVirtualGageBasinLookupIds(
|
||||
siteKey, key, huc,
|
||||
resource.basinTableDlg
|
||||
.getRowName())) {
|
||||
|
||||
try {
|
||||
|
||||
setFFMPRow(virtualBasin.get(id),
|
||||
tData, true, cwa);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
statusHandler.handle(
|
||||
Priority.PROBLEM,
|
||||
"Couldn't create table row"
|
||||
+ e);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -237,9 +254,10 @@ public class FFMPDataGenerator {
|
|||
|
||||
List<Long> pfafs = ft.getAggregatePfafs(key, siteKey,
|
||||
huc);
|
||||
|
||||
boolean isVGB = false;
|
||||
|
||||
if (ft.checkVGBsInAggregate(key, siteKey, huc)) {
|
||||
|
||||
isVGB = true;
|
||||
}
|
||||
|
||||
|
@ -249,23 +267,28 @@ public class FFMPDataGenerator {
|
|||
siteKey, domains, pfafs);
|
||||
|
||||
if (fmdb != null) {
|
||||
|
||||
try {
|
||||
|
||||
FFMPBasin basin = new FFMPBasin(key, true);
|
||||
setFFMPRow(basin, tData, isVGB, null);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Couldn't create table row", e);
|
||||
|
||||
"Couldn't create table row", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// show pfafs in aggregation
|
||||
|
||||
else {
|
||||
|
||||
FFMPBasinData fbd = baseRec.getBasinData();
|
||||
List<Long> centerAggPfafs = resource
|
||||
.getCenteredAggregatePfafs();
|
||||
|
@ -288,6 +311,7 @@ public class FFMPDataGenerator {
|
|||
// We *DO NOT* want all of the aggregate
|
||||
// VGB's,
|
||||
// just the one's for this individual basin.
|
||||
|
||||
List<Long> virtuals = ft
|
||||
.getVirtualGageBasinLookupIds(
|
||||
siteKey, key,
|
||||
|
@ -299,7 +323,9 @@ public class FFMPDataGenerator {
|
|||
try {
|
||||
setFFMPRow(virtualBasin.get(id),
|
||||
tData, true, null);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
statusHandler
|
||||
.handle(Priority.PROBLEM,
|
||||
"Couldn't create table row",
|
||||
|
@ -312,17 +338,23 @@ public class FFMPDataGenerator {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Failed to load FFMP table data!", e);
|
||||
|
||||
}
|
||||
|
||||
// wait for all the rows to finish being created before continuing on
|
||||
|
||||
long t0 = System.currentTimeMillis();
|
||||
jobPool.join();
|
||||
System.out.println("Waited on FFMP job pool for: "
|
||||
+ (System.currentTimeMillis() - t0));
|
||||
|
||||
return tData;
|
||||
|
||||
}
|
||||
|
||||
private void setFFMPRow(FFMPBasin cBasin, FFMPTableData tData,
|
||||
|
@ -368,7 +400,6 @@ public class FFMPDataGenerator {
|
|||
}
|
||||
|
||||
monitor.setQpeWindow(new FFMPTimeWindow(tableTime, qpeTime));
|
||||
|
||||
FFMPRecord rateRecord = monitor.getRateRecord(product, siteKey,
|
||||
dataKey, product.getRate(), paintRefTime, true);
|
||||
FFMPRecord qpeRecord = monitor.getQPERecord(product, siteKey, dataKey,
|
||||
|
@ -383,14 +414,15 @@ public class FFMPDataGenerator {
|
|||
try {
|
||||
if (rateRecord != null) {
|
||||
rateBasin = rateRecord.getBasinData();
|
||||
if (!rateBasin.getBasins().isEmpty()) {
|
||||
if (rateBasin.hasAnyBasins()) {
|
||||
field = FIELDS.RATE;
|
||||
baseRec = rateRecord;
|
||||
}
|
||||
}
|
||||
if (qpeRecord != null) {
|
||||
qpeBasin = qpeRecord.getBasinData();
|
||||
if (!qpeBasin.getBasins().isEmpty()) {
|
||||
if (qpeBasin.hasAnyBasins()) {
|
||||
|
||||
field = FIELDS.QPE;
|
||||
if (baseRec == null) {
|
||||
baseRec = qpeRecord;
|
||||
|
|
|
@ -171,7 +171,7 @@ import com.vividsolutions.jts.geom.Point;
|
|||
* refactored updates
|
||||
* Jun 27, 2013 2152 njensen More thorough disposeInternal()
|
||||
* Jul 15, 2013 2184 dhladky Remove all HUC's for storage except ALL
|
||||
*
|
||||
* Jul 17, 2013 2197 njensen Improved speed of getName()
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -866,23 +866,10 @@ public class FFMPResource extends
|
|||
sfield = FFMPRecord.FIELDS.QPE;
|
||||
}
|
||||
|
||||
PluginDataObject pdo = null;
|
||||
|
||||
try {
|
||||
pdo = getRecord(sfield, paintTime.getRefTime());
|
||||
} catch (NullPointerException npe) {
|
||||
return "No Data Available";
|
||||
}
|
||||
|
||||
if (pdo == null) {
|
||||
return "No Data Available";
|
||||
}
|
||||
|
||||
FFMPRecord record = (FFMPRecord) pdo;
|
||||
prefix = new StringBuilder();
|
||||
prefix.append(record.getPluginName());
|
||||
prefix.append("ffmp");
|
||||
prefix.append(" ");
|
||||
prefix.append(record.getSiteKey());
|
||||
prefix.append(resourceData.siteKey);
|
||||
prefix.append(" ");
|
||||
if (getResourceData().tableLoad) {
|
||||
prefix.append("Table Display ");
|
||||
|
|
|
@ -32,6 +32,7 @@ import javax.xml.bind.annotation.XmlType;
|
|||
|
||||
import org.eclipse.core.runtime.SubMonitor;
|
||||
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
|
@ -81,6 +82,7 @@ import com.raytheon.uf.viz.monitor.ffmp.xml.FFMPConfigBasinXML;
|
|||
* Apr 26, 2013 1954 bsteffen Minor code cleanup throughout FFMP.
|
||||
* Jun 06, 2013 2075 njensen Use new load jobs
|
||||
* Jul 15, 2013 2184 dhladky Remove all HUC's for storage except ALL
|
||||
* Jul 17, 2013 2197 njensen Broke background loading into chunks
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -94,6 +96,12 @@ public class FFMPResourceData extends AbstractRequestableResourceData {
|
|||
/** Performance log entry prefix */
|
||||
private static final String prefix = "FFMP ResourceData:";
|
||||
|
||||
/** Number of hours back from the most recent time to load data for **/
|
||||
private static final int HOURS_BACK = 24;
|
||||
|
||||
/** Number of hours a background data job should request data for **/
|
||||
private static final int LOAD_INCREMENT = 1;
|
||||
|
||||
/** Performance logger */
|
||||
private final IPerformanceStatusHandler perfLog = PerformanceStatus
|
||||
.getHandler(prefix);
|
||||
|
@ -215,6 +223,7 @@ public class FFMPResourceData extends AbstractRequestableResourceData {
|
|||
final double configTimeFrame = cfgBasinXML.getTimeFrame();
|
||||
final Date timeBack = new Date(
|
||||
(long) (mostRecentTime.getTime() - (configTimeFrame * TimeUtil.MILLIS_PER_HOUR)));
|
||||
|
||||
final List<String> onlyAllHuc = new ArrayList<String>();
|
||||
onlyAllHuc.add(FFMPRecord.ALL);
|
||||
InitialLoadJob initialJob = new InitialLoadJob(this, timeBack,
|
||||
|
@ -225,13 +234,52 @@ public class FFMPResourceData extends AbstractRequestableResourceData {
|
|||
initialJob.addJobChangeListener(new JobChangeAdapter() {
|
||||
@Override
|
||||
public void done(IJobChangeEvent event) {
|
||||
Date backgroundStartTime = new Date(mostRecentTime
|
||||
.getTime() - (24 * TimeUtil.MILLIS_PER_HOUR));
|
||||
BackgroundLoadJob backgroundJob = new BackgroundLoadJob(
|
||||
"Background FFMP Load", FFMPResourceData.this,
|
||||
backgroundStartTime, timeBack, onlyAllHuc);
|
||||
backgroundJob.setPreloadAvailableUris(true);
|
||||
backgroundJob.schedule();
|
||||
// step back in time in increments and
|
||||
// load the data in chunks all the way
|
||||
// back to 24 hours
|
||||
// before the current time
|
||||
Date farthestBack = new Date(mostRecentTime.getTime()
|
||||
- (HOURS_BACK * TimeUtil.MILLIS_PER_HOUR));
|
||||
int hourBack = (int) configTimeFrame;
|
||||
Date loadedUpTo = new Date(timeBack.getTime());
|
||||
BackgroundLoadJob firstJob = null;
|
||||
Job previousJob = null;
|
||||
while (loadedUpTo.after(farthestBack)) {
|
||||
Date startTime = new Date(
|
||||
loadedUpTo.getTime()
|
||||
- (LOAD_INCREMENT * TimeUtil.MILLIS_PER_HOUR));
|
||||
hourBack += LOAD_INCREMENT;
|
||||
if (startTime.before(farthestBack)) {
|
||||
startTime = farthestBack;
|
||||
hourBack = HOURS_BACK;
|
||||
}
|
||||
|
||||
String jobName = "FFMP loading to hr " + hourBack;
|
||||
if (previousJob == null) {
|
||||
firstJob = new BackgroundLoadJob(jobName,
|
||||
FFMPResourceData.this, startTime,
|
||||
loadedUpTo, onlyAllHuc);
|
||||
firstJob.setPreloadAvailableUris(true);
|
||||
previousJob = firstJob;
|
||||
} else {
|
||||
final BackgroundLoadJob nextJob = new BackgroundLoadJob(
|
||||
jobName, FFMPResourceData.this,
|
||||
startTime, loadedUpTo, onlyAllHuc);
|
||||
nextJob.setPreloadAvailableUris(true);
|
||||
previousJob
|
||||
.addJobChangeListener(new JobChangeAdapter() {
|
||||
@Override
|
||||
public void done(
|
||||
IJobChangeEvent event) {
|
||||
nextJob.schedule();
|
||||
}
|
||||
});
|
||||
previousJob = nextJob;
|
||||
}
|
||||
|
||||
loadedUpTo = startTime;
|
||||
}
|
||||
firstJob.schedule();
|
||||
}
|
||||
});
|
||||
initialJob.schedule();
|
||||
|
@ -241,6 +289,7 @@ public class FFMPResourceData extends AbstractRequestableResourceData {
|
|||
// will be faster
|
||||
List<String> earlyLoadHucs = new ArrayList<String>();
|
||||
earlyLoadHucs.addAll(onlyAllHuc);
|
||||
|
||||
for (String otherHuc : FFMPTemplateConfigurationManager
|
||||
.getInstance().getHucLevels()) {
|
||||
if (!earlyLoadHucs.contains(otherHuc)) {
|
||||
|
@ -291,12 +340,12 @@ public class FFMPResourceData extends AbstractRequestableResourceData {
|
|||
standAloneTime);
|
||||
monitor.processUris(sourceURIs, siteKey, sourceName,
|
||||
standAloneTime, SubMonitor.convert(null));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new FFMPResource(this, loadProperties);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.monitor.ffmp.ui.thread;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.NavigableMap;
|
||||
|
@ -51,6 +52,9 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.rsc.FFMPResourceData;
|
|||
|
||||
public class BackgroundLoadJob extends AbstractLoadJob {
|
||||
|
||||
private static final SimpleDateFormat sdf = new SimpleDateFormat(
|
||||
"yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
protected boolean preloadAvailableUris = false;
|
||||
|
||||
public BackgroundLoadJob(String name, FFMPResourceData resourceData,
|
||||
|
@ -66,6 +70,9 @@ public class BackgroundLoadJob extends AbstractLoadJob {
|
|||
*/
|
||||
@Override
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
System.out.println("FFMP background load job running for: "
|
||||
+ sdf.format(startTime) + " to " + sdf.format(endTime));
|
||||
|
||||
try {
|
||||
SubMonitor smonitor = SubMonitor.convert(monitor, "Loading Data",
|
||||
2500);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -62,6 +62,7 @@ import com.vividsolutions.jts.geom.Point;
|
|||
* the Storm Track Display that it
|
||||
* needs to update the track because
|
||||
* the point has been moved.
|
||||
* 08-12-2013 DR 16427 D. Friedman Prevent NPE.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -260,7 +261,7 @@ public class StormTrackUIManager extends InputAdapter {
|
|||
StormTrackState state = controller.getStormTrackState();
|
||||
boolean rval = false;
|
||||
if (((mouseButton == 1) || (mouseButton == 2 && pointCreated))
|
||||
&& moveType != null) {
|
||||
&& moveType != null && state.mouseDownGeom != null) {
|
||||
state.dragMeGeom = state.mouseDownGeom;
|
||||
state.mouseDownGeom = null;
|
||||
if (state.mode == Mode.DRAG_ME) {
|
||||
|
|
|
@ -99,8 +99,9 @@ import com.vividsolutions.jts.io.WKBReader;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 11, 2011 randerso Initial creation
|
||||
* Apr 10, 2013 #1854 randerso Fix for compatibility with PostGIS 2.0
|
||||
* May 30, 2013 #2028 randerso Fixed date line issue with map display
|
||||
* Apr 10, 2013 #1854 randerso Fix for compatibility with PostGIS 2.0
|
||||
* May 30, 2013 #2028 randerso Fixed date line issue with map display
|
||||
* Jul 31, 2013 #2239 randerso Fixed scaling of maps that cross the date line
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -271,7 +272,7 @@ public class ZoneSelectorResource extends DbMapResource {
|
|||
numPoints += g.getNumPoints();
|
||||
resultingGeoms.put(zoneName, g);
|
||||
|
||||
if (myWfo != null && myWfo.equals(wfo)) {
|
||||
if ((myWfo != null) && myWfo.equals(wfo)) {
|
||||
if (existingGeom != null) {
|
||||
wfoPoints -= existingGeom.getNumPoints();
|
||||
}
|
||||
|
@ -636,7 +637,8 @@ public class ZoneSelectorResource extends DbMapResource {
|
|||
info.setColor(color);
|
||||
|
||||
int index = info.getShapeIndex();
|
||||
if (this.target != null && index >= 0 && index < shapeList.length) {
|
||||
if ((this.target != null) && (index >= 0)
|
||||
&& (index < shapeList.length)) {
|
||||
shapeList[index].dispose();
|
||||
shapeList[index] = computeShape(this.target, this.descriptor,
|
||||
info.getGeometry(), color);
|
||||
|
@ -698,8 +700,8 @@ public class ZoneSelectorResource extends DbMapResource {
|
|||
// + Arrays.toString(c2) + " dpp:" + dppX);
|
||||
double simpLev = getSimpLev(dppX);
|
||||
|
||||
if (simpLev < lastSimpLev
|
||||
|| lastExtent == null
|
||||
if ((simpLev < lastSimpLev)
|
||||
|| (lastExtent == null)
|
||||
|| !lastExtent.getEnvelope().contains(
|
||||
clipToProjExtent(screenExtent).getEnvelope())) {
|
||||
if (!paintProps.isZooming()) {
|
||||
|
@ -742,27 +744,27 @@ public class ZoneSelectorResource extends DbMapResource {
|
|||
aTarget.drawShadedShapes(paintProps.getAlpha(), 1.0f, shapeList);
|
||||
}
|
||||
|
||||
if (outlineShape != null && outlineShape.isDrawable()
|
||||
if ((outlineShape != null) && outlineShape.isDrawable()
|
||||
&& getCapability(OutlineCapability.class).isOutlineOn()) {
|
||||
aTarget.drawWireframeShape(outlineShape, this.outlineColor,
|
||||
getCapability(OutlineCapability.class).getOutlineWidth(),
|
||||
getCapability(OutlineCapability.class).getLineStyle());
|
||||
} else if (outlineShape == null
|
||||
} else if ((outlineShape == null)
|
||||
&& getCapability(OutlineCapability.class).isOutlineOn()) {
|
||||
issueRefresh();
|
||||
}
|
||||
|
||||
if (wfoShape != null && wfoShape.isDrawable()
|
||||
if ((wfoShape != null) && wfoShape.isDrawable()
|
||||
&& getCapability(OutlineCapability.class).isOutlineOn()) {
|
||||
aTarget.drawWireframeShape(wfoShape, this.wfoOutlineColor,
|
||||
getCapability(OutlineCapability.class).getOutlineWidth(),
|
||||
getCapability(OutlineCapability.class).getLineStyle());
|
||||
} else if (wfoShape == null
|
||||
} else if ((wfoShape == null)
|
||||
&& getCapability(OutlineCapability.class).isOutlineOn()) {
|
||||
issueRefresh();
|
||||
}
|
||||
|
||||
if (labels != null && (this.labelZones || this.labelZoneGroups)) {
|
||||
if ((labels != null) && (this.labelZones || this.labelZoneGroups)) {
|
||||
if (font == null) {
|
||||
font = GFEFonts.getFont(aTarget, 2);
|
||||
}
|
||||
|
@ -792,7 +794,7 @@ public class ZoneSelectorResource extends DbMapResource {
|
|||
+ Math.abs(tuple.y - y);
|
||||
minDistance = Math.min(distance, minDistance);
|
||||
}
|
||||
if (minDistance > 100 * worldToScreenRatio) {
|
||||
if (minDistance > (100 * worldToScreenRatio)) {
|
||||
String[] text = new String[] { "", "" };
|
||||
if (this.labelZones) {
|
||||
text[0] = zone;
|
||||
|
@ -1048,15 +1050,24 @@ public class ZoneSelectorResource extends DbMapResource {
|
|||
byte[] b = (byte[]) mappedResult.getRowColumnValue(i,
|
||||
"extent");
|
||||
if (b != null) {
|
||||
Geometry g = wkbReader.read(b);
|
||||
Envelope env = g.getEnvelopeInternal();
|
||||
Geometry geom = wkbReader.read(b);
|
||||
|
||||
ReferencedEnvelope llEnv = new ReferencedEnvelope(env,
|
||||
MapUtil.LATLON_PROJECTION);
|
||||
ReferencedEnvelope projEnv = llEnv.transform(
|
||||
gloc.getCrs(), true);
|
||||
// world wrap correct the geometry and then
|
||||
// get the envelope of each geometry in the collection
|
||||
geom = this.worldWrapCorrector.correct(geom);
|
||||
|
||||
this.boundingEnvelope.expandToInclude(projEnv);
|
||||
for (int n = 0; n < geom.getNumGeometries(); n++) {
|
||||
Geometry g = geom.getGeometryN(n);
|
||||
|
||||
Envelope env = g.getEnvelopeInternal();
|
||||
|
||||
ReferencedEnvelope llEnv = new ReferencedEnvelope(
|
||||
env, MapUtil.LATLON_PROJECTION);
|
||||
ReferencedEnvelope projEnv = llEnv.transform(
|
||||
gloc.getCrs(), true);
|
||||
|
||||
this.boundingEnvelope.expandToInclude(projEnv);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1101,8 +1112,8 @@ public class ZoneSelectorResource extends DbMapResource {
|
|||
latLonToCRS.transform(new double[] { 0, 90 }, 0, output, 0, 1);
|
||||
Coordinate northPole = new Coordinate(output[0], output[1]);
|
||||
|
||||
if (northPole.x >= ll.x && northPole.x <= ur.x
|
||||
&& northPole.y >= ll.y && northPole.y <= ur.y) {
|
||||
if ((northPole.x >= ll.x) && (northPole.x <= ur.x)
|
||||
&& (northPole.y >= ll.y) && (northPole.y <= ur.y)) {
|
||||
pole = northPole;
|
||||
|
||||
}
|
||||
|
@ -1115,8 +1126,8 @@ public class ZoneSelectorResource extends DbMapResource {
|
|||
latLonToCRS.transform(new double[] { 0, -90 }, 0, output,
|
||||
0, 1);
|
||||
Coordinate southPole = new Coordinate(output[0], output[1]);
|
||||
if (southPole.x >= ll.x && southPole.x <= ur.x
|
||||
&& southPole.y >= ll.y && southPole.y <= ur.y) {
|
||||
if ((southPole.x >= ll.x) && (southPole.x <= ur.x)
|
||||
&& (southPole.y >= ll.y) && (southPole.y <= ur.y)) {
|
||||
pole = southPole;
|
||||
}
|
||||
} catch (TransformException e) {
|
||||
|
@ -1149,7 +1160,7 @@ public class ZoneSelectorResource extends DbMapResource {
|
|||
|
||||
List<Polygon> polygons = new ArrayList<Polygon>(4);
|
||||
for (Coordinate[] q : quadrant) {
|
||||
if (q[1].x > q[0].x && q[1].y > q[0].y) {
|
||||
if ((q[1].x > q[0].x) && (q[1].y > q[0].y)) {
|
||||
polygons.add(polygonFromGloc(gloc, delta, q[0], q[1]));
|
||||
}
|
||||
}
|
||||
|
@ -1186,19 +1197,19 @@ public class ZoneSelectorResource extends DbMapResource {
|
|||
double dx = width / nx;
|
||||
double dy = height / ny;
|
||||
|
||||
Coordinate[] coordinates = new Coordinate[2 * (nx + ny) + 1];
|
||||
Coordinate[] coordinates = new Coordinate[(2 * (nx + ny)) + 1];
|
||||
int i = 0;
|
||||
for (int x = 0; x < nx; x++) {
|
||||
coordinates[i++] = new Coordinate(x * dx + ll.x, ll.y);
|
||||
coordinates[i++] = new Coordinate((x * dx) + ll.x, ll.y);
|
||||
}
|
||||
for (int y = 0; y < ny; y++) {
|
||||
coordinates[i++] = new Coordinate(ur.x, y * dy + ll.y);
|
||||
coordinates[i++] = new Coordinate(ur.x, (y * dy) + ll.y);
|
||||
}
|
||||
for (int x = nx; x > 0; x--) {
|
||||
coordinates[i++] = new Coordinate(x * dx + ll.x, ur.y);
|
||||
coordinates[i++] = new Coordinate((x * dx) + ll.x, ur.y);
|
||||
}
|
||||
for (int y = ny; y > 0; y--) {
|
||||
coordinates[i++] = new Coordinate(ll.x, y * dy + ll.y);
|
||||
coordinates[i++] = new Coordinate(ll.x, (y * dy) + ll.y);
|
||||
}
|
||||
coordinates[i++] = coordinates[0];
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
package com.raytheon.viz.gfe.vtec;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
|
@ -44,6 +46,9 @@ import com.raytheon.viz.texteditor.util.VtecUtil;
|
|||
* Jul 19, 2013 #1842 dgilling Use VtecUtil.replaceFirstVtecString()
|
||||
* to ensure start times of in progress
|
||||
* events aren't set to the wrong time.
|
||||
* Aug 07, 2013 #1842 dgilling Fix ETN assignment for products with
|
||||
* multiple NEW segments with the same
|
||||
* phensig.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -82,6 +87,13 @@ public class GFEVtecUtil {
|
|||
return message;
|
||||
}
|
||||
|
||||
// With GFE VTEC products, it's possible to have multiple segments with
|
||||
// NEW vtec action codes and the same phensig. For this reason,
|
||||
// HazardsTable.py implemented a "cache" that would ensure all NEWs for
|
||||
// the same phensig would be assigned the same ETN. This Map replicates
|
||||
// that legacy behavior.
|
||||
Map<String, Integer> etnCache = new HashMap<String, Integer>();
|
||||
|
||||
Matcher vtecMatcher = VtecUtil.VTEC_REGEX.matcher(message);
|
||||
StringBuffer finalOutput = new StringBuffer();
|
||||
while (vtecMatcher.find()) {
|
||||
|
@ -93,8 +105,13 @@ public class GFEVtecUtil {
|
|||
&& ((!NATIONAL_PHENSIGS.contains(vtec.getPhensig())) || (IGNORE_NATIONAL_ETN
|
||||
.contains(vtec.getOffice()) && TROPICAL_PHENSIGS
|
||||
.contains(vtec.getPhensig())))) {
|
||||
int newEtn = VtecUtil.getNextEtn(vtec.getOffice(),
|
||||
vtec.getPhensig(), true);
|
||||
String cacheKey = vtec.getPhensig();
|
||||
Integer newEtn = etnCache.get(cacheKey);
|
||||
if (newEtn == null) {
|
||||
newEtn = VtecUtil.getNextEtn(vtec.getOffice(),
|
||||
vtec.getPhensig(), true);
|
||||
etnCache.put(cacheKey, newEtn);
|
||||
}
|
||||
vtec.setSequence(newEtn);
|
||||
}
|
||||
vtecMatcher
|
||||
|
|
|
@ -710,7 +710,6 @@ public class MPEDisplayManager {
|
|||
|| accumulationHrs != displayedAccumHrs
|
||||
|| arealDisplay != displayedArealDisplay) {
|
||||
DisplayFieldData oldField = displayedField;
|
||||
|
||||
displayedField = fieldToDisplay;
|
||||
displayedAccumHrs = accumulationHrs;
|
||||
displayedArealDisplay = arealDisplay;
|
||||
|
@ -751,7 +750,7 @@ public class MPEDisplayManager {
|
|||
listener.displayFieldChanged(oldField, fieldToDisplay);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
displayedFieldResource.issueRefresh();
|
||||
}
|
||||
|
@ -1027,7 +1026,7 @@ public class MPEDisplayManager {
|
|||
.convert((short) displayToData.convert(threshold)));
|
||||
if (displayField != DisplayFieldData.Index) {
|
||||
entry.setLabel(format.format(threshold));
|
||||
}
|
||||
}
|
||||
}
|
||||
entry.setPixelValue((double) i);
|
||||
|
||||
|
|
|
@ -27,8 +27,12 @@ import java.util.Map;
|
|||
import java.util.TimeZone;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.ScrolledComposite;
|
||||
import org.eclipse.swt.events.ControlAdapter;
|
||||
import org.eclipse.swt.events.ControlEvent;
|
||||
import org.eclipse.swt.events.ModifyEvent;
|
||||
import org.eclipse.swt.events.ModifyListener;
|
||||
import org.eclipse.swt.graphics.Rectangle;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.graphics.Font;
|
||||
|
@ -64,7 +68,7 @@ import com.raytheon.viz.mpe.ui.radartable.ReadBiasTableParam;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 14, 2009 snaples Initial creation
|
||||
* Jun 18, 2013 16053 snaples Removed reference to setRadarEditFlag
|
||||
*
|
||||
* Aug 06, 2013 16243 Changed the Gui to a ScrolledComposite.
|
||||
* </pre>
|
||||
*
|
||||
* @author snaples
|
||||
|
@ -311,9 +315,17 @@ public class RadarBiasTableDialog extends Dialog {
|
|||
*/
|
||||
private void createBiasListComp() {
|
||||
|
||||
// Create a container to hold the label and the combo box.
|
||||
final ScrolledComposite biasListScrollComp = new ScrolledComposite(
|
||||
shell, SWT.BORDER | SWT.V_SCROLL);
|
||||
GridLayout gl = new GridLayout(1, false);
|
||||
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, true);
|
||||
Composite biasListComp = new Composite(bcLblComp, SWT.V_SCROLL);
|
||||
gd.heightHint = 300;
|
||||
biasListScrollComp.setLayout(gl);
|
||||
biasListScrollComp.setLayoutData(gd);
|
||||
// Create a container to hold the label and the combo box.
|
||||
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, true);
|
||||
final Composite biasListComp = new Composite(biasListScrollComp,
|
||||
SWT.BORDER);
|
||||
GridLayout biasListCompLayout = new GridLayout(7, true);
|
||||
biasListComp.setLayout(biasListCompLayout);
|
||||
gd.horizontalSpan = 7;
|
||||
|
@ -386,7 +398,7 @@ public class RadarBiasTableDialog extends Dialog {
|
|||
|
||||
gd = new GridData(SWT.FILL, SWT.CENTER, true, true);
|
||||
final Text lbiasTxt = new Text(biasListComp, SWT.SINGLE
|
||||
| SWT.CENTER);
|
||||
| SWT.CENTER | SWT.BORDER);
|
||||
if (radarresultdata.getProductDate() == null) {
|
||||
ridBtn.setEnabled(false);
|
||||
}
|
||||
|
@ -476,6 +488,16 @@ public class RadarBiasTableDialog extends Dialog {
|
|||
offcLbl.setText(ooffice);
|
||||
offcLbl.setLayoutData(gd);
|
||||
}
|
||||
biasListScrollComp.setContent(biasListComp);
|
||||
biasListScrollComp.setExpandVertical(true);
|
||||
biasListScrollComp.setExpandHorizontal(true);
|
||||
biasListScrollComp.addControlListener(new ControlAdapter() {
|
||||
public void controlResized(ControlEvent e) {
|
||||
Rectangle r = biasListScrollComp.getClientArea();
|
||||
biasListScrollComp.setMinSize(biasListComp.computeSize(r.width,
|
||||
SWT.DEFAULT));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void applyBiasUpdate(String obstime) {
|
||||
|
|
|
@ -39,7 +39,6 @@ import org.eclipse.swt.widgets.Spinner;
|
|||
import com.raytheon.uf.common.dataplugin.shef.tables.Rwradarresult;
|
||||
import com.raytheon.viz.hydrocommon.whfslib.IHFSDbGenerated;
|
||||
import com.raytheon.viz.mpe.MPEDateFormatter;
|
||||
import com.raytheon.viz.mpe.core.MPEDataManager;
|
||||
import com.raytheon.viz.mpe.ui.MPEDisplayManager;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
|
||||
|
|
|
@ -78,7 +78,6 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* updating RawPP records
|
||||
* Nov 24, 2008 1748 snaples Added getters to MPEGageData
|
||||
* Jun 18, 2013 16053 snaples Removed methods set and getRadarEditFlag
|
||||
* July 9, 2013 2172 bkowal Added a polygon edit flag
|
||||
* </pre>
|
||||
*
|
||||
* @author randerso
|
||||
|
@ -672,8 +671,6 @@ public class MPEDataManager {
|
|||
|
||||
private ArrayList<String> badGages = new ArrayList<String>();
|
||||
|
||||
private boolean polygonEditFlag = false;
|
||||
|
||||
private Map<Date, MPEDateInfo> dateMap;
|
||||
|
||||
private Date latestAvailableDate = null;
|
||||
|
@ -748,8 +745,8 @@ public class MPEDataManager {
|
|||
}
|
||||
|
||||
public Map<Date, MPEDateInfo> getDateMap(boolean update) {
|
||||
|
||||
getDates(update);
|
||||
|
||||
getDates(update);
|
||||
return dateMap;
|
||||
}
|
||||
|
||||
|
@ -1486,14 +1483,6 @@ public class MPEDataManager {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean isPolygonEditFlag() {
|
||||
return polygonEditFlag;
|
||||
}
|
||||
|
||||
public void setPolygonEditFlag(boolean polygonEditFlag) {
|
||||
this.polygonEditFlag = polygonEditFlag;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rFC
|
||||
*/
|
||||
|
|
|
@ -56,8 +56,6 @@ import com.raytheon.viz.mpe.core.MPEDataManager.MPEGageData;
|
|||
* Jan 02, 2013 15565 snaples Fixed problem with wrong time being sent to mpe_fieldgen
|
||||
* Mar 14, 2013 1457 mpduff Fixed memory leak.
|
||||
* Jun 18, 2013 16053 snaples Removed check for Radar Edit flag
|
||||
* July 7, 2013 2172 bkowal Polygon Edits will now also trigger an hourly
|
||||
* mpe field regeneration.
|
||||
* </pre>
|
||||
*
|
||||
* @author snaples
|
||||
|
@ -165,10 +163,6 @@ public class RegenHrFlds {
|
|||
int pCount = pseudoList.size();
|
||||
num_gage_edit += pCount;
|
||||
}
|
||||
|
||||
private boolean polygonsModified() {
|
||||
return MPEDataManager.getInstance().isPolygonEditFlag();
|
||||
}
|
||||
|
||||
public double round(final double x) {
|
||||
double tmp = x + 0.5;
|
||||
|
@ -187,8 +181,7 @@ public class RegenHrFlds {
|
|||
.getShell();
|
||||
this.checkGages();
|
||||
/* Store any gage edits into the HourlyPP or PseudoGageVal table. */
|
||||
|
||||
options.shef_duplicate = shef_dup.USE_REVCODE;
|
||||
options.shef_duplicate = shef_dup.USE_REVCODE;
|
||||
|
||||
for (MPEGageData gData : gages.values()) {
|
||||
|
||||
|
@ -274,7 +267,6 @@ public class RegenHrFlds {
|
|||
}
|
||||
}
|
||||
|
||||
MPEDataManager.getInstance().setPolygonEditFlag(false);
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* Read Gage Data and store in structure */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
@ -303,7 +295,6 @@ public class RegenHrFlds {
|
|||
|
||||
MPEDataManager.getInstance().clearEditGages();
|
||||
shell.setCursor(null);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -92,6 +92,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* menu choice
|
||||
* Apr 29, 2013 1958 bgonzale New class RedbookBlockHeader.
|
||||
* May 21, 2013 2001 njensen Fixed error handling
|
||||
* Jul 19, 2013 DR 16401 D. Friedman Fix unknown block processing.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -283,7 +284,7 @@ public class RedbookFrame implements IRenderable {
|
|||
} else {
|
||||
|
||||
DefaultBlock block = new DefaultBlock(header, dataBuf);
|
||||
if (!currBlock.equals("")) {
|
||||
if (!RedbookBlockHeader.DEFAULT.equals(currBlock)) {
|
||||
status.unhandledPackets = true;
|
||||
statusHandler
|
||||
.debug("Unhandled redbook packet: (mode="
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
**/
|
||||
package com.raytheon.viz.texteditor.dialogs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
|
@ -38,7 +39,8 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 07, 2013 DR 15733 Xiaochuan Initial creation
|
||||
* Jun 07, 2013 DR 15733 Xiaochuan Initial creation
|
||||
* Jul 25, 2013 DR 15733 Greg Hull Now part of TextEditorCfg ; don't return null array
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -52,7 +54,7 @@ public class FontSizeCfg implements ISerializableObject {
|
|||
private List<SizeButtonCfg> buttons;
|
||||
|
||||
public List<SizeButtonCfg> getButtons() {
|
||||
return buttons;
|
||||
return ( buttons != null ? buttons : new ArrayList<SizeButtonCfg>() );
|
||||
}
|
||||
|
||||
public void setButtons(List<SizeButtonCfg> buttons) {
|
||||
|
|
|
@ -57,8 +57,6 @@ public class RGBColorAdapter extends XmlAdapter<String, RGB> {
|
|||
|
||||
int sz = colorString.split(",").length;
|
||||
if( colorString.split(",").length == 1) {
|
||||
System.out.println(" Convert string color "
|
||||
+ colorString + ",,,");
|
||||
rgb = RGBColors.getRGBColor(colorString);
|
||||
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 07, 2013 DR 15733 Xiaochuan Initial creation
|
||||
* July 25, 2013 DR 15733 G. Hull now part of TextEditorCfg ; rm sizeEnabled
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -25,17 +26,20 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
|
|||
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
public class SizeButtonCfg implements ISerializableObject {
|
||||
|
||||
private final int DEFAULT_FONT_SIZE = 11;
|
||||
|
||||
@XmlElement(name = "LabelName")
|
||||
private String labelName;
|
||||
private String labelName="Medium";
|
||||
|
||||
@XmlElement(name = "SizeEnabled")
|
||||
private boolean sizeEnabled;
|
||||
|
||||
@XmlElement(name = "FontSize")
|
||||
private int fontSize;
|
||||
@XmlElement(name = "FontName")
|
||||
private String fontName = "Courier";
|
||||
|
||||
@XmlElement(name = "FontSize")
|
||||
private int fontSize= DEFAULT_FONT_SIZE;
|
||||
|
||||
@XmlElement(name = "Selected")
|
||||
private boolean selected;
|
||||
private boolean selected=true;
|
||||
|
||||
public String getLabelName() {
|
||||
return labelName;
|
||||
|
@ -45,20 +49,15 @@ public class SizeButtonCfg implements ISerializableObject {
|
|||
this.labelName = labelName;
|
||||
}
|
||||
|
||||
public boolean isSizeEnabled() {
|
||||
return sizeEnabled;
|
||||
}
|
||||
|
||||
public void setSizeEnabled(boolean sizeEnabled) {
|
||||
this.sizeEnabled = sizeEnabled;
|
||||
}
|
||||
|
||||
public int getFontSize() {
|
||||
return fontSize;
|
||||
if( fontSize < 5 || fontSize > 40 ) { // sanity check
|
||||
return DEFAULT_FONT_SIZE;
|
||||
}
|
||||
return fontSize;
|
||||
}
|
||||
|
||||
public void setFontSize(int fontSize) {
|
||||
this.fontSize = fontSize;
|
||||
this.fontSize = fontSize;
|
||||
}
|
||||
|
||||
public boolean isSelected() {
|
||||
|
@ -68,4 +67,12 @@ public class SizeButtonCfg implements ISerializableObject {
|
|||
public void setSelected(boolean selected) {
|
||||
this.selected = selected;
|
||||
}
|
||||
|
||||
public String getFontName() {
|
||||
return fontName;
|
||||
}
|
||||
|
||||
public void setFontName(String fontName) {
|
||||
this.fontName = fontName;
|
||||
}
|
||||
}
|
|
@ -1,18 +1,7 @@
|
|||
package com.raytheon.viz.texteditor.dialogs;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||
|
||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* OBSOLETE - Class removed
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -21,6 +10,7 @@ import org.eclipse.swt.graphics.RGB;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 24, 2013 DR 15733 Xiaochuan Initial creation
|
||||
* Jul 29, 2013 DR 15733 B. Hebbard Mark class deleted (per G. Hull)
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -28,31 +18,6 @@ import org.eclipse.swt.graphics.RGB;
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlRootElement(name = "TextColorElement")
|
||||
public class TextColorElement implements ISerializableObject {
|
||||
|
||||
@XmlAttribute
|
||||
@XmlJavaTypeAdapter(RGBColorAdapter.class)
|
||||
private RGB color;
|
||||
|
||||
@XmlAttribute
|
||||
private String paramName;
|
||||
|
||||
public RGB getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public void setColor(RGB color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public String getParamName() {
|
||||
return paramName;
|
||||
}
|
||||
|
||||
public void setParamName(String paramName) {
|
||||
this.paramName = paramName;
|
||||
}
|
||||
|
||||
public class TextColorElement {
|
||||
// OBSOLETE - Class removed as part of refactor by G. Hull for DR 15733
|
||||
}
|
|
@ -1,36 +1,7 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.viz.texteditor.dialogs;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlElements;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* OBSOLETE - Class removed
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -39,28 +10,13 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 15, 2013 DR 15733 Xiaochuan Initial creation
|
||||
* Jul 29, 2013 DR 15733 B. Hebbard Mark class deleted (per G. Hull)
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author XHuang
|
||||
* @version 1.0
|
||||
*/
|
||||
@XmlRootElement(name = "textColorsCfg")
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
public class TextColorsCfg implements ISerializableObject {
|
||||
@XmlElements({ @XmlElement(name = "TextColorElement", type = TextColorElement.class) })
|
||||
private List<TextColorElement> colorElements;
|
||||
|
||||
public List<TextColorElement> getTextColorElements() {
|
||||
return colorElements;
|
||||
}
|
||||
|
||||
public void setTextColorElements(List<TextColorElement> colorElements) {
|
||||
this.colorElements = colorElements;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class TextColorsCfg {
|
||||
// OBSOLETE - Class removed as part of refactor by G. Hull for DR 15733
|
||||
}
|
||||
|
|
|
@ -0,0 +1,217 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.viz.texteditor.dialogs;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.JAXB;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlElements;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
|
||||
import com.raytheon.uf.common.localization.IPathManager;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 15, 2013 DR 15733 Xiaochuan Initial creation
|
||||
* Jul 25, 2013 DR 15733 Greg Hull Combined FontSizeCfg, elements from TextColorsCfg
|
||||
* and added defaultNumEditors and maxNumEditors
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author XHuang
|
||||
* @version 1.0
|
||||
*/
|
||||
@XmlRootElement(name = "textEditorCfg")
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
public class TextEditorCfg implements ISerializableObject {
|
||||
|
||||
@XmlElement
|
||||
private Integer defaultNumEditors=4;
|
||||
|
||||
@XmlElement
|
||||
private Integer maxNumEditors=8;
|
||||
|
||||
@XmlElement
|
||||
private FontSizeCfg fontSizeCfg=new FontSizeCfg();
|
||||
|
||||
private static SizeButtonCfg selectedFontButton = null;
|
||||
|
||||
@XmlElement
|
||||
@XmlJavaTypeAdapter(RGBColorAdapter.class)
|
||||
private RGB textForegroundColor = new RGB( 0, 0, 0 );
|
||||
|
||||
@XmlElement
|
||||
@XmlJavaTypeAdapter(RGBColorAdapter.class)
|
||||
private RGB textBackgroundColor = new RGB( 255, 255, 255 );
|
||||
|
||||
@XmlElement
|
||||
@XmlJavaTypeAdapter(RGBColorAdapter.class)
|
||||
private RGB highlightTextForegroundColor = new RGB( 0, 0, 0 );
|
||||
|
||||
@XmlElement
|
||||
@XmlJavaTypeAdapter(RGBColorAdapter.class)
|
||||
private RGB highlightTextBackgroundColor = new RGB( 85, 152, 215 );
|
||||
|
||||
public Integer getDefaultNumEditors() {
|
||||
return defaultNumEditors;
|
||||
}
|
||||
|
||||
public void setDefaultNumEditors(Integer defaultNumEditors) {
|
||||
if( defaultNumEditors > 0 && defaultNumEditors < 100 ) { // sanity check
|
||||
this.defaultNumEditors = defaultNumEditors;
|
||||
}
|
||||
}
|
||||
|
||||
public Integer getMaxNumEditors() {
|
||||
return maxNumEditors;
|
||||
}
|
||||
|
||||
public void setMaxNumEditors(Integer maxNumEditors) {
|
||||
if( maxNumEditors > 0 && maxNumEditors < 200 ) { // sanity check
|
||||
this.maxNumEditors = maxNumEditors;
|
||||
}
|
||||
}
|
||||
|
||||
public FontSizeCfg getFontSizeCfg() {
|
||||
return fontSizeCfg;
|
||||
}
|
||||
|
||||
public void setFontSizeCfg(FontSizeCfg fontSizeCfg) {
|
||||
this.fontSizeCfg = fontSizeCfg;
|
||||
}
|
||||
|
||||
public static SizeButtonCfg getSelectedFontButton() {
|
||||
return selectedFontButton;
|
||||
}
|
||||
|
||||
public RGB getTextForegroundColor() {
|
||||
return textForegroundColor;
|
||||
}
|
||||
|
||||
public void setTextForegroundColor(RGB textForegroundColor) {
|
||||
this.textForegroundColor = textForegroundColor;
|
||||
}
|
||||
|
||||
public RGB getTextBackgroundColor() {
|
||||
return textBackgroundColor;
|
||||
}
|
||||
|
||||
public void setTextBackgroundColor(RGB textBackgroundColor) {
|
||||
this.textBackgroundColor = textBackgroundColor;
|
||||
}
|
||||
|
||||
public RGB getHighlightTextForegroundColor() {
|
||||
return highlightTextForegroundColor;
|
||||
}
|
||||
|
||||
public void setHighlightTextForegroundColor(RGB highlightTextForegroundColor) {
|
||||
this.highlightTextForegroundColor = highlightTextForegroundColor;
|
||||
}
|
||||
|
||||
public RGB getHighlightTextBackgroundColor() {
|
||||
return highlightTextBackgroundColor;
|
||||
}
|
||||
|
||||
public void setHighlightTextBackgroundColor(RGB highlightTextBackgroundColor) {
|
||||
this.highlightTextBackgroundColor = highlightTextBackgroundColor;
|
||||
}
|
||||
|
||||
private static TextEditorCfg textEditorCfg = null;
|
||||
|
||||
public static TextEditorCfg getTextEditorCfg() {
|
||||
|
||||
if( textEditorCfg == null ) {
|
||||
try {
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
File path = pm.getStaticFile("textws/gui/TextEditorCfg.xml");
|
||||
if( path == null ) {
|
||||
throw new Exception("localization file textws/gui/TextEditorCfg.xml not found");
|
||||
}
|
||||
|
||||
textEditorCfg = JAXB.unmarshal(path, TextEditorCfg.class);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(TextEditorDialog.class);
|
||||
statusHandler.handle(Priority.ERROR, "Error with TextEditorCfg.xml file. Using defaults: ", ex);
|
||||
textEditorCfg = new TextEditorCfg();
|
||||
}
|
||||
|
||||
FontSizeCfg fontSizeCfg = textEditorCfg.getFontSizeCfg();
|
||||
|
||||
if( fontSizeCfg == null ) {
|
||||
// set meaningful dflt values
|
||||
FontSizeCfg fscfg = new FontSizeCfg();
|
||||
fscfg.setButtons( new ArrayList<SizeButtonCfg>() );
|
||||
textEditorCfg.setFontSizeCfg( fscfg );
|
||||
}
|
||||
|
||||
// do some sanity checking
|
||||
if( fontSizeCfg.getButtons() == null ||
|
||||
fontSizeCfg.getButtons().isEmpty() ) {
|
||||
// default to 1 medium button
|
||||
selectedFontButton = new SizeButtonCfg();
|
||||
fontSizeCfg.setButtons( new ArrayList<SizeButtonCfg>() );
|
||||
fontSizeCfg.getButtons().add( selectedFontButton );
|
||||
}
|
||||
else {
|
||||
for( SizeButtonCfg buttonCfg : fontSizeCfg.getButtons()) {
|
||||
if( buttonCfg.isSelected() ) {
|
||||
if( selectedFontButton == null ) {
|
||||
selectedFontButton = buttonCfg;
|
||||
}
|
||||
else {
|
||||
buttonCfg.setSelected( false );
|
||||
System.out.println("Sanity check in textEditorCfg.xml file:" +
|
||||
" only 1 font button can be selected" );
|
||||
}
|
||||
}
|
||||
}
|
||||
if( selectedFontButton == null ) {
|
||||
System.out.println("Sanity check in textEditorCfg.xml file:" +
|
||||
" no font button set asselected. Defaulting to the first" );
|
||||
selectedFontButton = fontSizeCfg.getButtons().get(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
return textEditorCfg;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -51,6 +51,7 @@ import com.raytheon.viz.texteditor.TextWorkstationConstants;
|
|||
import com.raytheon.viz.texteditor.alarmalert.dialogs.CurrentAlarmQueue;
|
||||
import com.raytheon.viz.texteditor.alarmalert.util.AlarmAlertFunctions;
|
||||
import com.raytheon.viz.texteditor.alarmalert.util.AlarmAlertNotificationObserver;
|
||||
import com.raytheon.viz.texteditor.dialogs.TextEditorCfg;
|
||||
import com.raytheon.viz.texteditor.dialogs.TextEditorDialog;
|
||||
import com.raytheon.viz.texteditor.msgs.ITextEditorCallback;
|
||||
import com.raytheon.viz.texteditor.msgs.ITextWorkstationCallback;
|
||||
|
@ -92,6 +93,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* 13Dec2012 1353 rferrel Fix bug introduced in the Show all dialogs.
|
||||
* 30Jan2013 DR 14736 D. Friedman Display local time.
|
||||
* 24Jun2013 DR 15733 XHuang Display MAX_BUTTON_CNT (8 button).
|
||||
* 25July2013 DR 15733 Greg Hull Make dflt and max number of Text Buttons configurable.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -100,9 +102,9 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
public class TextWorkstationDlg extends CaveSWTDialog implements
|
||||
ITextEditorCallback, INotificationObserver {
|
||||
|
||||
private final int INIT_BUTTON_CNT = 4;
|
||||
private int INIT_BUTTON_CNT = 4;
|
||||
|
||||
private final int MAX_BUTTON_CNT = 8;
|
||||
private int MAX_BUTTON_CNT = 8;
|
||||
|
||||
private String productToDisplay = null;
|
||||
|
||||
|
@ -203,6 +205,9 @@ public class TextWorkstationDlg extends CaveSWTDialog implements
|
|||
fontAwipsLabel = new Font(shell.getDisplay(), "Helvetica", 24,
|
||||
SWT.ITALIC);
|
||||
|
||||
INIT_BUTTON_CNT = TextEditorCfg.getTextEditorCfg().getDefaultNumEditors();
|
||||
MAX_BUTTON_CNT = TextEditorCfg.getTextEditorCfg().getMaxNumEditors();
|
||||
|
||||
// Initialize all of the controls and layouts
|
||||
initializeComponents();
|
||||
}
|
||||
|
@ -437,7 +442,7 @@ public class TextWorkstationDlg extends CaveSWTDialog implements
|
|||
textBtnArray = new ArrayList<Button>();
|
||||
textEditorArray = new ArrayList<TextEditorDialog>();
|
||||
|
||||
for (int x = 1; x <= MAX_BUTTON_CNT; ++x) {
|
||||
for (int x = 1; x <= INIT_BUTTON_CNT; ++x) {
|
||||
createButtonAndTextEditor(x);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ import com.vividsolutions.jts.geom.Envelope;
|
|||
import com.vividsolutions.jts.geom.Geometry;
|
||||
import com.vividsolutions.jts.geom.GeometryFactory;
|
||||
import com.vividsolutions.jts.geom.LineSegment;
|
||||
import com.vividsolutions.jts.geom.LinearRing;
|
||||
import com.vividsolutions.jts.geom.Point;
|
||||
import com.vividsolutions.jts.geom.Polygon;
|
||||
import com.vividsolutions.jts.geom.prep.PreparedGeometry;
|
||||
|
@ -68,8 +69,10 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
|
|||
* 06/17/2013 DR 15787 Qinglu Lin Added removeOverlaidLinesegments() and removeTriplyOverlaidLinesegments().
|
||||
* 07/11/2013 DR 16376 Qinglu Lin Removed removeTriplyOverlaidLinesegments() and updated computeSlope()
|
||||
* and removeOverlaidLinesegments().
|
||||
|
||||
*
|
||||
* 07/25/2013 DR 16376 Qinglu Lin Move adjustVertex() and computeSlope() here from WarngenLayer; replaced
|
||||
* the call to removeIntersectedSeg() with a call to adjustVertex(); updated
|
||||
* removeDuplicateCoordinate(), computeCoordinate(), adjustPolygon() prolog, and
|
||||
* removeOverlaidLinesegments(); added alterVertexes() and calcShortestDistance().
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
|
@ -441,13 +444,13 @@ public class PolygonUtil {
|
|||
|
||||
if (rval.isValid() == false) {
|
||||
System.out.println("Fixing intersected segments");
|
||||
points.remove(points.size() - 1);
|
||||
removeIntersectedSeg(points);
|
||||
points.add(new Coordinate(points.get(0)));
|
||||
rval = gf.createPolygon(gf.createLinearRing(points
|
||||
.toArray(new Coordinate[points.size()])), null);
|
||||
Coordinate[] coords = rval.getCoordinates();
|
||||
adjustVertex(coords);
|
||||
PolygonUtil.round(coords, 2);
|
||||
coords = PolygonUtil.removeDuplicateCoordinate(coords);
|
||||
coords = PolygonUtil.removeOverlaidLinesegments(coords);
|
||||
rval = gf.createPolygon(gf.createLinearRing(coords), null);
|
||||
}
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
|
@ -1090,13 +1093,20 @@ public class PolygonUtil {
|
|||
if (polygon == null) {
|
||||
return null;
|
||||
}
|
||||
Coordinate[] coords = removeDuplicateCoordinate(polygon.getCoordinates());
|
||||
GeometryFactory gf = new GeometryFactory();
|
||||
return gf.createPolygon(gf.createLinearRing(coords), null);
|
||||
}
|
||||
|
||||
Coordinate[] verts = polygon.getCoordinates();
|
||||
public static Coordinate[] removeDuplicateCoordinate(Coordinate[] verts) {
|
||||
if (verts == null) {
|
||||
return null;
|
||||
}
|
||||
Set<Coordinate> coords = new LinkedHashSet<Coordinate>();
|
||||
for (Coordinate c : verts)
|
||||
coords.add(c);
|
||||
if ((verts.length - coords.size()) < 2)
|
||||
return polygon;
|
||||
return verts;
|
||||
Coordinate[] vertices = new Coordinate[coords.size() + 1];
|
||||
Iterator<Coordinate> iter = coords.iterator();
|
||||
int i = 0;
|
||||
|
@ -1105,8 +1115,7 @@ public class PolygonUtil {
|
|||
i += 1;
|
||||
}
|
||||
vertices[i] = new Coordinate(vertices[0]);
|
||||
GeometryFactory gf = new GeometryFactory();
|
||||
return gf.createPolygon(gf.createLinearRing(vertices), null);
|
||||
return vertices;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1226,6 +1235,8 @@ public class PolygonUtil {
|
|||
c[j].y = y;
|
||||
if (j == 0)
|
||||
c[c.length - 1] = c[j];
|
||||
if (j == c.length - 1)
|
||||
c[0] = c[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1233,8 +1244,7 @@ public class PolygonUtil {
|
|||
/**
|
||||
* adjustPolygon When a point is very close to a line in the initial warning
|
||||
* polygon, the resulting coordinates cause the failure of polygon drawing
|
||||
* in follow-up. The method move that kind of points away from the line, and
|
||||
* return a Polygon.
|
||||
* in follow-up. The method move that kind of points away from the line.
|
||||
*
|
||||
* History 12/06/2012 DR 15559 Qinglu Lin Created.
|
||||
*/
|
||||
|
@ -1276,7 +1286,7 @@ public class PolygonUtil {
|
|||
slope1 = slope;
|
||||
count += 1;
|
||||
} else {
|
||||
if (Math.abs(slope - slope1) < min) {
|
||||
if (Math.abs(Math.abs(slope) - Math.abs(slope1)) <= min) {
|
||||
count += 1;
|
||||
} else {
|
||||
count = 0;
|
||||
|
@ -1310,4 +1320,186 @@ public class PolygonUtil {
|
|||
}
|
||||
return coords;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjust the location of one vertex that cause polygon self-crossing.
|
||||
*/
|
||||
static public Coordinate[] adjustVertex(Coordinate[] coord) {
|
||||
GeometryFactory gf = new GeometryFactory();
|
||||
LinearRing lr;
|
||||
Polygon p;
|
||||
int length = coord.length;
|
||||
Coordinate intersectCoord = null;
|
||||
int index[] = new int[6];
|
||||
LineSegment ls1, ls2;
|
||||
double d[] = new double[6];
|
||||
int indexOfTheOtherEnd[] = new int[2];
|
||||
boolean isPolygonValid = false;
|
||||
outerLoop: for (int skippedSegment = 1; skippedSegment < length - 3; skippedSegment++) {
|
||||
for (int i = 0; i < length - 1; i++) {
|
||||
index[0] = i;
|
||||
index[1] = index[0] + 1;
|
||||
index[2] = index[1] + skippedSegment;
|
||||
if (index[2] >= length)
|
||||
index[2] = index[2] - length + 1;
|
||||
index[3] = index[2] + 1;
|
||||
if (index[3] >= length)
|
||||
index[3] = index[3] - length + 1;
|
||||
ls1 = new LineSegment(coord[index[0]], coord[index[1]]);
|
||||
ls2 = new LineSegment(coord[index[2]], coord[index[3]]);
|
||||
intersectCoord = ls1.intersection(ls2);
|
||||
if (intersectCoord != null) {
|
||||
for (int j = 0; j < index.length - 2; j++) {
|
||||
d[j] = intersectCoord.distance(coord[index[j]]);
|
||||
}
|
||||
if (d[0] < d[1]) {
|
||||
index[4] = index[0];
|
||||
d[4] = d[0];
|
||||
indexOfTheOtherEnd[0] = index[1];
|
||||
} else {
|
||||
index[4] = index[1];
|
||||
d[4] = d[1];
|
||||
indexOfTheOtherEnd[0] = index[0];
|
||||
}
|
||||
if (d[2] < d[3]) {
|
||||
index[5] = index[2];
|
||||
d[5] = d[2];
|
||||
indexOfTheOtherEnd[1] = index[3];
|
||||
} else {
|
||||
index[5] = index[3];
|
||||
d[5] = d[3];
|
||||
indexOfTheOtherEnd[1] = index[2];
|
||||
}
|
||||
// index of the vertex on a line segment (line segment A),
|
||||
// which will be moved along line segment A.
|
||||
int replaceIndex;
|
||||
// index of the vertex at the other end of line segment A.
|
||||
int theOtherIndex;
|
||||
if (d[4] < d[5]) {
|
||||
replaceIndex = index[4];
|
||||
theOtherIndex = indexOfTheOtherEnd[0];
|
||||
} else {
|
||||
replaceIndex = index[5];
|
||||
theOtherIndex = indexOfTheOtherEnd[1];
|
||||
}
|
||||
// move the bad vertex, which is on line segment A and has
|
||||
// the shortest distance to intersectCoord,
|
||||
// along line segment A to the other side of line segment B
|
||||
// which intersects with line segment A.
|
||||
double delta;
|
||||
double min = 0.00001;
|
||||
if (Math.abs(intersectCoord.x - coord[replaceIndex].x) < min) {
|
||||
// move the bad vertex along a vertical line segment.
|
||||
delta = intersectCoord.y - coord[theOtherIndex].y;
|
||||
coord[replaceIndex].y += 0.01 * (delta / Math
|
||||
.abs(delta));
|
||||
} else if (Math.abs(intersectCoord.y
|
||||
- coord[replaceIndex].y) < min) {
|
||||
// move the bad vertex along a horizontal line segment.
|
||||
delta = intersectCoord.x - coord[theOtherIndex].x;
|
||||
coord[replaceIndex].x += 0.01 * (delta / Math
|
||||
.abs(delta));
|
||||
} else {
|
||||
// move the bad vertex along a line segment which is
|
||||
// neither vertical nor horizontal.
|
||||
double slope = computeSlope(coord, replaceIndex,
|
||||
theOtherIndex);
|
||||
delta = coord[theOtherIndex].y - intersectCoord.y;
|
||||
coord[replaceIndex].y = intersectCoord.y + 0.005
|
||||
* (delta / Math.abs(delta));
|
||||
coord[replaceIndex].x = (coord[replaceIndex].y - coord[theOtherIndex].y)
|
||||
/ slope + coord[theOtherIndex].x;
|
||||
}
|
||||
//PolygonUtil.round(coord, 2);
|
||||
PolygonUtil.round(coord[replaceIndex], 2);
|
||||
if (replaceIndex == 0)
|
||||
coord[length - 1] = new Coordinate(coord[replaceIndex]);
|
||||
else if (replaceIndex == length - 1)
|
||||
coord[0] = new Coordinate(coord[replaceIndex]);
|
||||
lr = gf.createLinearRing(coord);
|
||||
p = gf.createPolygon(lr, null);
|
||||
isPolygonValid = p.isValid();
|
||||
if (isPolygonValid)
|
||||
break outerLoop;
|
||||
}
|
||||
}
|
||||
}
|
||||
return coord;
|
||||
}
|
||||
|
||||
/**
|
||||
* Alter the location of two vertexes that cause polygon self-crossing.
|
||||
* This method would be used if polygon is still invalid after using adjustVertex().
|
||||
*/
|
||||
static public Coordinate[] alterVertexes(Coordinate[] coord) {
|
||||
GeometryFactory gf = new GeometryFactory();
|
||||
LinearRing lr;
|
||||
Polygon p;
|
||||
int length = coord.length;
|
||||
Coordinate intersectCoord = null;
|
||||
int index[] = new int[6];
|
||||
LineSegment ls1, ls2;
|
||||
boolean isPolygonValid = false;
|
||||
int index1, index2;
|
||||
outerLoop: for (int skippedSegment = 1; skippedSegment < length - 3; skippedSegment++) {
|
||||
for (int i = 0; i < length - 1; i++) {
|
||||
index[0] = i;
|
||||
index[1] = index[0] + 1;
|
||||
index[2] = index[1] + skippedSegment;
|
||||
if (index[2] >= length)
|
||||
index[2] = index[2] - length + 1;
|
||||
index[3] = index[2] + 1;
|
||||
if (index[3] >= length)
|
||||
index[3] = index[3] - length + 1;
|
||||
ls1 = new LineSegment(coord[index[0]], coord[index[1]]);
|
||||
ls2 = new LineSegment(coord[index[2]], coord[index[3]]);
|
||||
intersectCoord = null;
|
||||
intersectCoord = ls1.intersection(ls2);
|
||||
if (intersectCoord != null) {
|
||||
index1 = calcShortestDistance(intersectCoord, ls1);
|
||||
index2 = calcShortestDistance(intersectCoord, ls2);
|
||||
Coordinate c = new Coordinate(0.5*(coord[index1].x + coord[2+index2].x),
|
||||
0.5*(coord[index1].y + coord[2+index2].y));
|
||||
PolygonUtil.round(c, 2);
|
||||
coord[index[index1]] = new Coordinate(c);
|
||||
coord[index[2+index2]] = new Coordinate(c);
|
||||
if (index[index1] == 0) {
|
||||
coord[coord.length-1] = new Coordinate(c);
|
||||
} else if (index[index1] == coord.length-1) {
|
||||
coord[0] = new Coordinate(c);
|
||||
}
|
||||
if (index[2+index2] == 0) {
|
||||
coord[coord.length-1] = new Coordinate(c);
|
||||
} else if (index[2+index2] == coord.length-1) {
|
||||
coord[0] = new Coordinate(c);
|
||||
}
|
||||
lr = gf.createLinearRing(coord);
|
||||
p = gf.createPolygon(lr, null);
|
||||
isPolygonValid = p.isValid();
|
||||
if (isPolygonValid)
|
||||
break outerLoop;
|
||||
}
|
||||
}
|
||||
}
|
||||
return coord;
|
||||
}
|
||||
|
||||
static public int calcShortestDistance(Coordinate p, LineSegment ls) {
|
||||
double d1 = p.distance(ls.p0);
|
||||
double d2 = p.distance(ls.p1);
|
||||
if (d1 <= d2)
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
static public double computeSlope(Coordinate[] coords, int i, int j) {
|
||||
double min = 1.0E-08;
|
||||
double dx = coords[i].x - coords[j].x;
|
||||
double slope = 0.0;
|
||||
if (Math.abs(dx) > min) {
|
||||
slope = (coords[i].y - coords[j].y) / dx;
|
||||
}
|
||||
return slope;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
**/
|
||||
package com.raytheon.viz.warngen.gui;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.warning.AbstractWarningRecord;
|
||||
import com.raytheon.uf.common.dataplugin.warning.WarningRecord;
|
||||
import com.raytheon.uf.common.time.SimulatedTime;
|
||||
|
@ -38,6 +36,7 @@ import com.raytheon.uf.common.time.util.TimeUtil;
|
|||
* Initial creation
|
||||
* May 7, 2013 1973 rferrel Changes to properly display Issue Time.
|
||||
* Jul 22, 2013 2176 jsanchez Added EMER to the display string in the update list.
|
||||
* Aug 7, 2013 2243 jsanchez Set all the attributes of an AbstractWarningRecord and added an expiration string. Removed calendar object.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -51,22 +50,25 @@ public class FollowupData extends WarningRecord {
|
|||
/**
|
||||
* String displayed in the drop down update list.
|
||||
*/
|
||||
public String displayString;
|
||||
private String displayString;
|
||||
|
||||
/**
|
||||
* String used to test if this object is equivalent to one of the updated
|
||||
* items in the drop down.
|
||||
*/
|
||||
public String equvialentString;
|
||||
private String equvialentString;
|
||||
|
||||
/**
|
||||
* Information string used when the follow up is no longer valid or allowed.
|
||||
*/
|
||||
private String expirationString;
|
||||
|
||||
public FollowupData(WarningAction action, AbstractWarningRecord record) {
|
||||
super((WarningRecord) record);
|
||||
setAct(action.toString());
|
||||
setOfficeid(record.getOfficeid());
|
||||
setPhen(record.getPhen());
|
||||
setSig(record.getSig());
|
||||
setEtn(record.getEtn());
|
||||
|
||||
displayString = getDisplayString(action, record);
|
||||
displayString = createDisplayString(action, record);
|
||||
expirationString = createExpirationString(action);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -77,7 +79,7 @@ public class FollowupData extends WarningRecord {
|
|||
* @param record
|
||||
* @return
|
||||
*/
|
||||
private String getDisplayString(WarningAction status,
|
||||
private String createDisplayString(WarningAction status,
|
||||
AbstractWarningRecord record) {
|
||||
StringBuilder rval = new StringBuilder();
|
||||
if (record.getProductClass().equals("T")) {
|
||||
|
@ -102,6 +104,31 @@ public class FollowupData extends WarningRecord {
|
|||
return rval.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the expiration string based on the action. The expiration string
|
||||
* provides an explanation of why the follow up data is no longer valid.
|
||||
*
|
||||
* @param action
|
||||
* @return
|
||||
*/
|
||||
private String createExpirationString(WarningAction action) {
|
||||
String message = null;
|
||||
if (action == WarningAction.NEW) {
|
||||
message = "Reissue no longer allowed; after 30 minutes of warning expiration.";
|
||||
} else if (action == WarningAction.COR) {
|
||||
message = "Correction no longer allowed; after 10 minutes of warning issuance.";
|
||||
} else if (action == WarningAction.CAN) {
|
||||
message = "Cancellation no longer allowed; within 10 minutes of warning expiration.";
|
||||
} else if (action == WarningAction.CON) {
|
||||
message = "Continuation no longer allowed; within 5 minutes of warning expiration.";
|
||||
} else if (action == WarningAction.EXP) {
|
||||
message = "Expiration no longer allowed; after 10 minutes of warning expiration.";
|
||||
} else if (action == WarningAction.EXT) {
|
||||
message = "Extention no longer allowed; within 5 minutes of warning expiration.";
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a string informing the user when a product was issued or when it
|
||||
* will expire. This is appended to the product in the "Update List"
|
||||
|
@ -114,12 +141,11 @@ public class FollowupData extends WarningRecord {
|
|||
private String buildExpStr(WarningAction status,
|
||||
AbstractWarningRecord record) {
|
||||
StringBuilder rval = new StringBuilder();
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(SimulatedTime.getSystemTime().getTime());
|
||||
long timeInMillis = SimulatedTime.getSystemTime().getMillis();
|
||||
if (status != WarningAction.COR) {
|
||||
// Positive means not yet expired
|
||||
long diffMins = (record.getEndTime().getTimeInMillis() - cal
|
||||
.getTimeInMillis()) / TimeUtil.MILLIS_PER_MINUTE;
|
||||
long diffMins = (record.getEndTime().getTimeInMillis() - timeInMillis)
|
||||
/ TimeUtil.MILLIS_PER_MINUTE;
|
||||
if (diffMins == 0) {
|
||||
rval.append(" Expired");
|
||||
} else if (diffMins > 0) {
|
||||
|
@ -128,7 +154,7 @@ public class FollowupData extends WarningRecord {
|
|||
rval.append(" Exp ").append(-diffMins).append(" min ago");
|
||||
}
|
||||
} else {
|
||||
long diffMins = (cal.getTimeInMillis() - record.getIssueTime()
|
||||
long diffMins = (timeInMillis - record.getIssueTime()
|
||||
.getTimeInMillis()) / TimeUtil.MILLIS_PER_MINUTE;
|
||||
if (diffMins == 0) {
|
||||
rval.append(" Just Issued");
|
||||
|
@ -147,4 +173,16 @@ public class FollowupData extends WarningRecord {
|
|||
&& this.getEtn().equals(obj.getEtn());
|
||||
}
|
||||
|
||||
public String getDisplayString() {
|
||||
return displayString;
|
||||
}
|
||||
|
||||
public String getEquvialentString() {
|
||||
return equvialentString;
|
||||
}
|
||||
|
||||
public String getExpirationString() {
|
||||
return expirationString;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -70,6 +70,7 @@ import com.raytheon.uf.common.status.UFStatus;
|
|||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.common.time.SimulatedTime;
|
||||
import com.raytheon.uf.common.time.TimeRange;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
@ -141,6 +142,8 @@ import com.vividsolutions.jts.geom.Polygon;
|
|||
* May 17, 2013 2012 jsanchez Preserved the warned area if the hatched area source is the same when changing templates.
|
||||
* Jun 24, 2013 DR 16317 D. Friedman Handle "motionless" track.
|
||||
* Jul 16, 2013 DR 16387 Qinglu Lin Reset totalSegments for each followup product.
|
||||
* Jul 29, 2013 DR 16352 D. Friedman Move 'result' to okPressed().
|
||||
* Aug 6, 2013 2243 jsanchez Refreshed the follow up list every minute.
|
||||
* </pre>
|
||||
*
|
||||
* @author chammack
|
||||
|
@ -168,8 +171,6 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
}.schedule();
|
||||
}
|
||||
|
||||
private String result;
|
||||
|
||||
private static String UPDATELISTTEXT = "UPDATE LIST ";
|
||||
|
||||
public static String NO_BACKUP_SELECTED = "none";
|
||||
|
@ -193,11 +194,11 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
|
||||
final DateFormat df = new SimpleDateFormat("HH:mm EEE d-MMM");
|
||||
|
||||
private java.util.List<String> mapsLoaded = new ArrayList<String>();
|
||||
private final java.util.List<String> mapsLoaded = new ArrayList<String>();
|
||||
|
||||
private Button okButton;
|
||||
|
||||
private BulletListManager bulletListManager;
|
||||
private final BulletListManager bulletListManager;
|
||||
|
||||
private List bulletList;
|
||||
|
||||
|
@ -275,9 +276,9 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
|
||||
private Group productType;
|
||||
|
||||
private IWarngenObserver wed = new WarningSender();
|
||||
private boolean invalidFollowUpAction = false;
|
||||
|
||||
private TimeRange timeRange = null;
|
||||
private final IWarngenObserver wed = new WarningSender();
|
||||
|
||||
public WarngenDialog(Shell parentShell, WarngenLayer layer) {
|
||||
super(parentShell, SWT.CLOSE | SWT.MODELESS | SWT.BORDER | SWT.TITLE,
|
||||
|
@ -392,8 +393,7 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
durationList.setLayoutData(gd);
|
||||
durationList.setEnabled(config.isEnableDuration());
|
||||
|
||||
startTime = Calendar.getInstance();
|
||||
startTime.setTime(SimulatedTime.getSystemTime().getTime());
|
||||
startTime = TimeUtil.newCalendar();
|
||||
endTime = DurationUtil.calcEndTime(this.startTime,
|
||||
defaultDuration.minutes);
|
||||
|
||||
|
@ -481,7 +481,7 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
|
||||
String defaultTemplate = warngenLayer.getDialogConfig()
|
||||
.getDefaultTemplate();
|
||||
if (defaultTemplate == null || defaultTemplate.equals("")) {
|
||||
if ((defaultTemplate == null) || defaultTemplate.equals("")) {
|
||||
defaultTemplate = mainProducts.get(0).split("/")[1];
|
||||
}
|
||||
|
||||
|
@ -820,10 +820,13 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
createTextButtonEnabled = false;
|
||||
} else if (warngenLayer.getStormTrackState().mode == Mode.NONE) {
|
||||
createTextButtonEnabled = false;
|
||||
} else if (warngenLayer.getPolygon() == null
|
||||
} else if ((warngenLayer.getPolygon() == null)
|
||||
|| warngenLayer.getPolygon().isEmpty()) {
|
||||
str += WarngenConstants.INSTRUCTION_NO_SHADED_AREA;
|
||||
createTextButtonEnabled = false;
|
||||
} else if (invalidFollowUpAction) {
|
||||
str += "Select a different follow up item";
|
||||
createTextButtonEnabled = false;
|
||||
}
|
||||
if (okButton != null) {
|
||||
okButton.setEnabled(createTextButtonEnabled);
|
||||
|
@ -832,8 +835,8 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
if (warngenLayer.getWarningArea() == null) {
|
||||
str = "Area selected has no overlap with current area of responsibility";
|
||||
} else {
|
||||
if (warngenLayer.getStormTrackState().isInitiallyMotionless() &&
|
||||
! warngenLayer.getStormTrackState().isNonstationary()) {
|
||||
if (warngenLayer.getStormTrackState().isInitiallyMotionless()
|
||||
&& !warngenLayer.getStormTrackState().isNonstationary()) {
|
||||
str += WarngenConstants.INSTRUCTION_DRAG_STORM + "\n";
|
||||
} else if (warngenLayer.getStormTrackState().trackVisible) {
|
||||
str += "Adjust Centroid in any Frame" + "\n";
|
||||
|
@ -881,19 +884,19 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
if (FollowUpUtil.checkApplicable(site,
|
||||
warngenLayer.getConfiguration(), warnings.get(i), act)) {
|
||||
FollowupData data = new FollowupData(act, warnings.get(i));
|
||||
updateListCbo.setData(data.displayString, data);
|
||||
updateListCbo.setData(data.getDisplayString(), data);
|
||||
if (act == WarningAction.NEW) {
|
||||
newYes = true;
|
||||
} else if (act == WarningAction.EXT) {
|
||||
extYes = true;
|
||||
} else if (act == WarningAction.CON
|
||||
|| act == WarningAction.CAN
|
||||
|| act == WarningAction.EXP) {
|
||||
} else if ((act == WarningAction.CON)
|
||||
|| (act == WarningAction.CAN)
|
||||
|| (act == WarningAction.EXP)) {
|
||||
follow = true;
|
||||
} else if (act == WarningAction.COR) {
|
||||
corYes = true;
|
||||
}
|
||||
dropDownItems.add(data.displayString);
|
||||
dropDownItems.add(data.getDisplayString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -931,19 +934,62 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
updateListCbo.add(dropDownItems.get(i));
|
||||
}
|
||||
// Select the previously selected item.
|
||||
invalidFollowUpAction = false;
|
||||
if (currentSelection != null) {
|
||||
boolean isValid = false;
|
||||
for (int i = 0; i < updateListCbo.getItemCount(); i++) {
|
||||
if (updateListCbo.getItem(i).startsWith(
|
||||
currentSelection.equvialentString)) {
|
||||
currentSelection.getEquvialentString())) {
|
||||
updateListCbo.select(i);
|
||||
isValid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
WarningAction action = WarningAction.valueOf(currentSelection
|
||||
.getAct());
|
||||
TimeRange timeRange = FollowUpUtil.getTimeRange(action,
|
||||
currentSelection);
|
||||
// Checks if selection is invalid based on the time range. A follow
|
||||
// up option could be removed due to an action such as a CAN or an
|
||||
// EXP. If an action removes the follow up, then no warning message
|
||||
// should be displayed.
|
||||
if (!timeRange.contains(SimulatedTime.getSystemTime().getTime())) {
|
||||
invalidFollowUpAction = true;
|
||||
preventFollowUpAction(currentSelection);
|
||||
}
|
||||
} else {
|
||||
updateListCbo.select(0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevents the user from creating text when the current selection is no
|
||||
* longer valid or available in the update list. The polygon will also be
|
||||
* locked from being modified and return to it's last issued state if the
|
||||
* polygon was temporarily modified.
|
||||
*
|
||||
* @param currentSelection
|
||||
*/
|
||||
private void preventFollowUpAction(FollowupData currentSelection) {
|
||||
|
||||
try {
|
||||
warngenLayer.createPolygonFromRecord(currentSelection);
|
||||
} catch (VizException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error resetting the polygon\n", e);
|
||||
}
|
||||
|
||||
bulletList.setEnabled(false);
|
||||
setPolygonLocked(true);
|
||||
setTrackLocked(true);
|
||||
refreshDisplay();
|
||||
|
||||
// Provide an info message when this situation occurs
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
currentSelection.getExpirationString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the possible durations
|
||||
*
|
||||
|
@ -996,13 +1042,13 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
return;
|
||||
}
|
||||
|
||||
if (followupData != null && WarningAction.valueOf(followupData
|
||||
.getAct()) == WarningAction.NEW) {
|
||||
if ((followupData != null)
|
||||
&& (WarningAction.valueOf(followupData.getAct()) == WarningAction.NEW)) {
|
||||
redrawFromWarned();
|
||||
}
|
||||
|
||||
if ((followupData == null || (WarningAction.valueOf(followupData
|
||||
.getAct()) == WarningAction.CON && warngenLayer
|
||||
|
||||
if (((followupData == null) || ((WarningAction.valueOf(followupData
|
||||
.getAct()) == WarningAction.CON) && warngenLayer
|
||||
.conWarnAreaChanged(followupData)))
|
||||
&& !polygonLocked) {
|
||||
redrawFromWarned();
|
||||
|
@ -1012,19 +1058,22 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
.getCurrent().getActiveShell());
|
||||
pmd.setCancelable(false);
|
||||
|
||||
result = null;
|
||||
final String[] resultContainer = new String[1];
|
||||
|
||||
try {
|
||||
pmd.run(false, false, new IRunnableWithProgress() {
|
||||
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor)
|
||||
throws InvocationTargetException, InterruptedException {
|
||||
try {
|
||||
monitor.beginTask("Generating product", 1);
|
||||
long t0 = System.currentTimeMillis();
|
||||
result = TemplateRunner.runTemplate(warngenLayer,
|
||||
startTime.getTime(), endTime.getTime(),
|
||||
selectedBullets, followupData, backupData);
|
||||
String result = TemplateRunner.runTemplate(
|
||||
warngenLayer, startTime.getTime(),
|
||||
endTime.getTime(), selectedBullets,
|
||||
followupData, backupData);
|
||||
resultContainer[0] = result;
|
||||
Matcher m = FollowUpUtil.vtecPtrn.matcher(result);
|
||||
totalSegments = 0;
|
||||
while (m.find()) {
|
||||
|
@ -1056,6 +1105,7 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
// Launch the text editor display as the warngen editor
|
||||
// dialog using the result aka the warngen text product.
|
||||
try {
|
||||
String result = resultContainer[0];
|
||||
if (result != null) {
|
||||
wed.setTextWarngenDisplay(result, true);
|
||||
updateWarngenUIState(result);
|
||||
|
@ -1083,7 +1133,7 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
|
||||
private boolean checkDamSelection() {
|
||||
if (bulletListManager.isDamNameSeletcted()
|
||||
&& bulletListManager.isDamCauseSelected() == false) {
|
||||
&& (bulletListManager.isDamCauseSelected() == false)) {
|
||||
/*
|
||||
* On WES 'Instructions' became 'Warning' but didn't prevent a
|
||||
* created text
|
||||
|
@ -1104,9 +1154,9 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
}
|
||||
|
||||
private void updateWarngenUIState(String result) {
|
||||
if (VtecUtil.parseMessage(result) != null
|
||||
&& WarningAction.valueOf(VtecUtil.parseMessage(result)
|
||||
.getAction()) != WarningAction.NEW) {
|
||||
if ((VtecUtil.parseMessage(result) != null)
|
||||
&& (WarningAction.valueOf(VtecUtil.parseMessage(result)
|
||||
.getAction()) != WarningAction.NEW)) {
|
||||
// TODO Use warningsArrived method to set old
|
||||
// polygon and warning area
|
||||
warngenLayer.state.setOldWarningPolygon((Polygon) warngenLayer
|
||||
|
@ -1121,16 +1171,8 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
// An error dialog is to appear if a user tries to press Create Text
|
||||
// again after a product was issued.AWIPS I does not auto update their
|
||||
// update list, this is their solution.
|
||||
if (followupData != null && totalSegments > 1) {
|
||||
multiSegmentMessage(followupData.equvialentString);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (timeRange != null
|
||||
&& timeRange.contains(SimulatedTime.getSystemTime().getTime()) == false) {
|
||||
// The action is no longer available in the follow up/update list
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Follow up product has nothing to follow up.");
|
||||
if ((followupData != null) && (totalSegments > 1)) {
|
||||
multiSegmentMessage(followupData.getEquvialentString());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1187,7 +1229,6 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
bulletList.setEnabled(true);
|
||||
recreateUpdates();
|
||||
damBreakInstruct = null;
|
||||
timeRange = null;
|
||||
extEndTime = null;
|
||||
totalSegments = 0;
|
||||
bulletListManager.recreateBullets(warngenLayer.getConfiguration()
|
||||
|
@ -1198,8 +1239,8 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
warngenLayer.getStormTrackState().mode = Mode.TRACK;
|
||||
warngenLayer.lastMode = Mode.DRAG_ME;
|
||||
}
|
||||
if (warngenLayer.getConfiguration().isTrackEnabled() == false
|
||||
|| warngenLayer.getConfiguration().getPathcastConfig() == null) {
|
||||
if ((warngenLayer.getConfiguration().isTrackEnabled() == false)
|
||||
|| (warngenLayer.getConfiguration().getPathcastConfig() == null)) {
|
||||
warngenLayer.getStormTrackState().setInitiallyMotionless(true);
|
||||
}
|
||||
warngenLayer.resetInitialFrame();
|
||||
|
@ -1219,8 +1260,8 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
* Action for when something is selected from the backup site combo
|
||||
*/
|
||||
private void backupSiteSelected() {
|
||||
if (backupSiteCbo.getSelectionIndex() >= 0
|
||||
&& backupSiteCbo.getItemCount() > 0) {
|
||||
if ((backupSiteCbo.getSelectionIndex() >= 0)
|
||||
&& (backupSiteCbo.getItemCount() > 0)) {
|
||||
warngenLayer.setBackupSite(backupSiteCbo.getItems()[backupSiteCbo
|
||||
.getSelectionIndex()]);
|
||||
// Refresh template
|
||||
|
@ -1328,8 +1369,8 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
DamInfoBullet damBullet = bulletListManager.getSelectedDamInfoBullet();
|
||||
if (damBullet != null) {
|
||||
|
||||
if (damBullet.getCoords() == null
|
||||
|| damBullet.getCoords().length() == 0) {
|
||||
if ((damBullet.getCoords() == null)
|
||||
|| (damBullet.getCoords().length() == 0)) {
|
||||
damBreakInstruct = "LAT...LON can not be found in 'coords' parameter";
|
||||
} else {
|
||||
ArrayList<Coordinate> coordinates = new ArrayList<Coordinate>();
|
||||
|
@ -1342,8 +1383,8 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
if (m.find()) {
|
||||
m = latLonPtrn.matcher(damBullet.getCoords());
|
||||
while (m.find()) {
|
||||
coordinates.add(new Coordinate(-1
|
||||
* Double.parseDouble(m.group(2)) / 100, Double
|
||||
coordinates.add(new Coordinate((-1 * Double
|
||||
.parseDouble(m.group(2))) / 100, Double
|
||||
.parseDouble(m.group(1)) / 100));
|
||||
}
|
||||
|
||||
|
@ -1409,8 +1450,9 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
private void changeTemplate(String templateName) {
|
||||
|
||||
// DR 14515
|
||||
if (templateName.equals(warngenLayer.getTemplateName()))
|
||||
if (templateName.equals(warngenLayer.getTemplateName())) {
|
||||
return;
|
||||
}
|
||||
|
||||
String lastAreaSource = warngenLayer.getConfiguration()
|
||||
.getHatchedAreaSource().getAreaSource();
|
||||
|
@ -1424,7 +1466,6 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
warngenLayer.state.followupData = null;
|
||||
warngenLayer.getStormTrackState().endTime = null;
|
||||
damBreakInstruct = null;
|
||||
timeRange = null;
|
||||
extEndTime = null;
|
||||
totalSegments = 0;
|
||||
|
||||
|
@ -1447,6 +1488,8 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
changeBtn.setEnabled(!enableDuration);
|
||||
recreateDurations(durationList);
|
||||
|
||||
// Current selection doesn't matter anymore
|
||||
updateListCbo.select(0);
|
||||
// update list
|
||||
recreateUpdates();
|
||||
|
||||
|
@ -1463,9 +1506,9 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
.getSelection() ? DisplayType.POLY : DisplayType.POINT;
|
||||
}
|
||||
warngenLayer.getStormTrackState().setInitiallyMotionless(
|
||||
warngenLayer.getConfiguration().isTrackEnabled() == false
|
||||
|| warngenLayer.getConfiguration()
|
||||
.getPathcastConfig() == null);
|
||||
(warngenLayer.getConfiguration().isTrackEnabled() == false)
|
||||
|| (warngenLayer.getConfiguration()
|
||||
.getPathcastConfig() == null));
|
||||
if (warngenLayer.getStormTrackState().isInitiallyMotionless()) {
|
||||
warngenLayer.getStormTrackState().speed = 0;
|
||||
warngenLayer.getStormTrackState().angle = 0;
|
||||
|
@ -1493,6 +1536,8 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
} catch (VizException e1) {
|
||||
statusHandler.handle(Priority.PROBLEM, "WarnGen Error", e1);
|
||||
}
|
||||
// Properly sets the "Create Text" button.
|
||||
setInstructions();
|
||||
}
|
||||
|
||||
protected void recreateDurations(Combo durList) {
|
||||
|
@ -1566,11 +1611,12 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
// (AWIPS 1)
|
||||
if (warngenLayer.state.followupData != null) {
|
||||
if (data.equals(warngenLayer.state.followupData)) {
|
||||
if (WarningAction
|
||||
if ((WarningAction
|
||||
.valueOf(warngenLayer.state.followupData
|
||||
.getAct()) == WarningAction.CON
|
||||
&& totalSegments > 1) {
|
||||
sameProductMessage(warngenLayer.state.followupData.equvialentString);
|
||||
.getAct()) == WarningAction.CON)
|
||||
&& (totalSegments > 1)) {
|
||||
sameProductMessage(warngenLayer.state.followupData
|
||||
.getEquvialentString());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -1580,7 +1626,8 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
// Sets the updatelist with the last selected vtec option
|
||||
for (int i = 0; i < updateListCbo.getItemCount(); i++) {
|
||||
String item = updateListCbo.getItem(i);
|
||||
if (item.equals(warngenLayer.state.followupData.displayString)) {
|
||||
if (item.equals(warngenLayer.state.followupData
|
||||
.getDisplayString())) {
|
||||
updateListCbo.select(i);
|
||||
updateListCbo.setText(item);
|
||||
data = warngenLayer.state.followupData;
|
||||
|
@ -1634,7 +1681,7 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
if (warngenLayer.getConfiguration().getEnableDamBreakThreat()) {
|
||||
for (BulletActionGroup bulletActionGroup : warngenLayer
|
||||
.getConfiguration().getBulletActionGroups()) {
|
||||
if (bulletActionGroup.getAction() != null
|
||||
if ((bulletActionGroup.getAction() != null)
|
||||
&& bulletActionGroup.getAction().equals(
|
||||
data.getAct())) {
|
||||
warngenLayer.getConfiguration().setDamInfoBullets(
|
||||
|
@ -1655,14 +1702,14 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
bulletListManager.recreateBulletsFromFollowup(
|
||||
warngenLayer.getConfiguration(), action, oldWarning);
|
||||
if (bulletListManager.isDamNameSeletcted()
|
||||
&& action != WarningAction.NEW) {
|
||||
&& (action != WarningAction.NEW)) {
|
||||
setPolygonLocked(true);
|
||||
}
|
||||
}
|
||||
refreshBulletList();
|
||||
recreateUpdates();
|
||||
if (action == null || action == WarningAction.NEW
|
||||
|| action == WarningAction.EXT) {
|
||||
if ((action == null) || (action == WarningAction.NEW)
|
||||
|| (action == WarningAction.EXT)) {
|
||||
recreateDurations(durationList);
|
||||
}
|
||||
}
|
||||
|
@ -1697,7 +1744,7 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
}
|
||||
|
||||
private void changeSelected() {
|
||||
if (validPeriodDlg == null || validPeriodDlg.isDisposed()) {
|
||||
if ((validPeriodDlg == null) || validPeriodDlg.isDisposed()) {
|
||||
validPeriodDlg = new ValidPeriodDialog(shell, startTime, endTime);
|
||||
validPeriodDlg.setCloseCallback(new ICloseCallback() {
|
||||
|
||||
|
@ -1802,6 +1849,7 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
public void run() {
|
||||
|
||||
getDisplay().syncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
changeStartEndTimes();
|
||||
|
@ -1822,6 +1870,33 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
}
|
||||
|
||||
timer.schedule(updateTimeTask, delay, delay);
|
||||
|
||||
TimerTask recreateUpdatesTask = new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
getDisplay().syncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
recreateUpdates();
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"WarnGen Error", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// Update the follow up list every minute
|
||||
long currentTimeInSeconds = SimulatedTime.getSystemTime().getMillis() / 1000;
|
||||
long secondsToNextMinute = 0;
|
||||
if ((currentTimeInSeconds % 60) != 0) {
|
||||
secondsToNextMinute = 60 - (currentTimeInSeconds % 60);
|
||||
}
|
||||
timer.schedule(recreateUpdatesTask, secondsToNextMinute * 1000,
|
||||
60 * 1000);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1839,16 +1914,14 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
FollowupData fd = (FollowupData) updateListCbo
|
||||
.getData(updateListCbo.getItem(updateListCbo
|
||||
.getSelectionIndex()));
|
||||
if (fd == null
|
||||
if ((fd == null)
|
||||
|| (WarningAction.valueOf(fd.getAct()) == WarningAction.NEW)) {
|
||||
startTime = Calendar.getInstance();
|
||||
startTime.setTime(SimulatedTime.getSystemTime().getTime());
|
||||
startTime = TimeUtil.newCalendar();
|
||||
endTime = DurationUtil.calcEndTime(this.startTime, duration);
|
||||
start.setText(df.format(this.startTime.getTime()));
|
||||
end.setText(df.format(this.endTime.getTime()));
|
||||
} else if (WarningAction.valueOf(fd.getAct()) == WarningAction.EXT) {
|
||||
startTime = Calendar.getInstance();
|
||||
startTime.setTime(SimulatedTime.getSystemTime().getTime());
|
||||
startTime = TimeUtil.newCalendar();
|
||||
endTime = DurationUtil.calcEndTime(extEndTime, duration);
|
||||
end.setText(df.format(this.endTime.getTime()));
|
||||
}
|
||||
|
@ -1896,7 +1969,7 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error creating polygon from the record\n", e);
|
||||
}
|
||||
timeRange = FollowUpUtil.getTimeRange(WarningAction.CON, newWarn);
|
||||
|
||||
return newWarn;
|
||||
}
|
||||
|
||||
|
@ -1942,7 +2015,7 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
"Error creating polygon from the record\n", e);
|
||||
}
|
||||
}
|
||||
timeRange = FollowUpUtil.getTimeRange(WarningAction.COR, newWarn);
|
||||
|
||||
return newWarn;
|
||||
}
|
||||
|
||||
|
@ -1980,7 +2053,7 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error creating polygon from the record\n", e);
|
||||
}
|
||||
timeRange = FollowUpUtil.getTimeRange(WarningAction.EXP, newWarn);
|
||||
|
||||
return newWarn;
|
||||
}
|
||||
|
||||
|
@ -2018,7 +2091,7 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error creating polygon from the record\n", e);
|
||||
}
|
||||
timeRange = FollowUpUtil.getTimeRange(WarningAction.CAN, newWarn);
|
||||
|
||||
return newWarn;
|
||||
}
|
||||
|
||||
|
@ -2043,7 +2116,7 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error creating polygon from the record\n", e);
|
||||
}
|
||||
timeRange = null;
|
||||
|
||||
return newWarn;
|
||||
}
|
||||
|
||||
|
@ -2072,8 +2145,7 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
.getItem(durationList.getSelectionIndex()))).minutes;
|
||||
warngenLayer.getStormTrackState().duration = duration;
|
||||
|
||||
startTime = Calendar.getInstance();
|
||||
startTime.setTime(SimulatedTime.getSystemTime().getTime());
|
||||
startTime = TimeUtil.newCalendar();
|
||||
extEndTime = newWarn.getEndTime();
|
||||
endTime = DurationUtil.calcEndTime(extEndTime, duration);
|
||||
end.setText(df.format(this.endTime.getTime()));
|
||||
|
@ -2086,7 +2158,7 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error creating polygon from the record\n", e);
|
||||
}
|
||||
timeRange = FollowUpUtil.getTimeRange(WarningAction.EXT, newWarn);
|
||||
|
||||
return newWarn;
|
||||
}
|
||||
|
||||
|
@ -2112,7 +2184,7 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
* Set the shell to visible and then move it on top of the CAVE dialog.
|
||||
*/
|
||||
public void showDialog(boolean show) {
|
||||
if (shell != null && shell.isDisposed() == false) {
|
||||
if ((shell != null) && (shell.isDisposed() == false)) {
|
||||
if (show) {
|
||||
if (shell.isVisible() == false) {
|
||||
shell.setVisible(true);
|
||||
|
@ -2199,8 +2271,9 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
Polygon rval = gf.createPolygon(gf.createLinearRing(points
|
||||
.toArray(new Coordinate[points.size()])), null);
|
||||
|
||||
if (adjusted)
|
||||
if (adjusted) {
|
||||
oldWarning.setGeometry(rval);
|
||||
}
|
||||
|
||||
boolean invalidPolyFlag = false;
|
||||
if (rval.isValid() == false) {
|
||||
|
@ -2225,10 +2298,12 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
int size = coords.length;
|
||||
java.util.List<Coordinate> coords2 = new ArrayList<Coordinate>();
|
||||
coords2.add(coords[0]);
|
||||
for (int i = 1; i < size; i++)
|
||||
if (Math.abs(coords[i].x - coords[i - 1].x) > MIN_LATLON_DIFF
|
||||
|| Math.abs(coords[i].y - coords[i - 1].y) > MIN_LATLON_DIFF)
|
||||
for (int i = 1; i < size; i++) {
|
||||
if ((Math.abs(coords[i].x - coords[i - 1].x) > MIN_LATLON_DIFF)
|
||||
|| (Math.abs(coords[i].y - coords[i - 1].y) > MIN_LATLON_DIFF)) {
|
||||
coords2.add(coords[i]);
|
||||
}
|
||||
}
|
||||
size = coords2.size();
|
||||
Coordinate[] coords3 = coords2.toArray(new Coordinate[size]);
|
||||
return coords3;
|
||||
|
@ -2241,7 +2316,7 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
double diffx1, diffx2, diffy1, diffy2;
|
||||
double ratio1, ratio2;
|
||||
boolean adjusted = false;
|
||||
for (int i = 2; i < coords.length - 2; i++) {
|
||||
for (int i = 2; i < (coords.length - 2); i++) {
|
||||
diffx1 = coords[i - 1].x - coords[i].x;
|
||||
if (Math.abs(diffx1) > MIN_LATLON_DIFF) {
|
||||
ratio1 = (coords[i - 1].y - coords[i].y) / diffx1;
|
||||
|
@ -2249,8 +2324,8 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
if (Math.abs(diffx2) > MIN_LATLON_DIFF) {
|
||||
ratio2 = (coords[i].y - coords[i + 1].y) / diffx2;
|
||||
if (Math.abs(ratio1 - ratio2) < MIN_DIFF) {
|
||||
if (diffx1 > 0.0 && diffx2 > 0.0 || diffx1 < 0.0
|
||||
&& diffx2 < 0.0) {
|
||||
if (((diffx1 > 0.0) && (diffx2 > 0.0))
|
||||
|| ((diffx1 < 0.0) && (diffx2 < 0.0))) {
|
||||
// three vertices on a straight line. Not overlaid.
|
||||
} else {
|
||||
// two segments overlaid
|
||||
|
@ -2268,8 +2343,8 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
if (Math.abs(diffy2) > MIN_LATLON_DIFF) {
|
||||
ratio2 = (coords[i].x - coords[i + 1].x) / diffy2;
|
||||
if (Math.abs(ratio1 - ratio2) < MIN_DIFF) {
|
||||
if (diffy1 > 0.0 && diffy2 > 0.0 || diffy1 < 0.0
|
||||
&& diffy2 < 0.0) {
|
||||
if (((diffy1 > 0.0) && (diffy2 > 0.0))
|
||||
|| ((diffy1 < 0.0) && (diffy2 < 0.0))) {
|
||||
// three vertices on a straight line. Not overlaid.
|
||||
} else {
|
||||
// two segments overlaid
|
||||
|
@ -2301,29 +2376,33 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
if (Math.abs(diffx) > MIN_LATLON_DIFF) {
|
||||
if (coords[i - 1].y > coords[i].y) {
|
||||
factor = 1;
|
||||
} else
|
||||
} else {
|
||||
factor = -1;
|
||||
}
|
||||
if (diffx < 0.0) {
|
||||
coords[i + 1].x -= factor * adjustedValue;
|
||||
} else {
|
||||
coords[i - 1].x += factor * adjustedValue;
|
||||
}
|
||||
if (i == n - 3)
|
||||
if (i == (n - 3)) {
|
||||
coords[0].x = coords[i - 1].x;
|
||||
}
|
||||
} else {
|
||||
diffx = coords[i + 2].x - coords[i + 1].x;
|
||||
if (Math.abs(diffx) > MIN_LATLON_DIFF) {
|
||||
if (coords[i + 1].y > coords[i].y) {
|
||||
factor = -1;
|
||||
} else
|
||||
} else {
|
||||
factor = 1;
|
||||
}
|
||||
if (diffx < 0.0) {
|
||||
coords[i - 1].x -= factor * adjustedValue;
|
||||
} else {
|
||||
coords[i + 1].x += factor * adjustedValue;
|
||||
}
|
||||
if (i == n - 3)
|
||||
if (i == (n - 3)) {
|
||||
coords[0].x = coords[i - 1].x;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -2332,29 +2411,33 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
if (Math.abs(diffy) > MIN_LATLON_DIFF) {
|
||||
if (coords[i - 1].x > coords[i].x) {
|
||||
factor = -1;
|
||||
} else
|
||||
} else {
|
||||
factor = 1;
|
||||
}
|
||||
if (diffy > 0.0) {
|
||||
coords[i + 1].y -= factor * adjustedValue;
|
||||
} else {
|
||||
coords[i - 1].y += factor * adjustedValue;
|
||||
}
|
||||
if (i == n - 3)
|
||||
if (i == (n - 3)) {
|
||||
coords[0].y = coords[i - 1].y;
|
||||
}
|
||||
} else {
|
||||
diffy = coords[i + 2].y - coords[i + 1].y;
|
||||
if (Math.abs(diffy) > MIN_LATLON_DIFF) {
|
||||
if (coords[i + 1].x > coords[i].x) {
|
||||
factor = -1;
|
||||
} else
|
||||
} else {
|
||||
factor = 1;
|
||||
}
|
||||
if (diffy < 0.0) {
|
||||
coords[i - 1].y -= factor * adjustedValue;
|
||||
} else {
|
||||
coords[i + 1].y += factor * adjustedValue;
|
||||
}
|
||||
if (i == n - 3)
|
||||
if (i == (n - 3)) {
|
||||
coords[0].y = coords[i - 1].y;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -182,6 +182,9 @@ import com.vividsolutions.jts.io.WKTReader;
|
|||
* 06/24/2013 DR 16317 D. Friedman Handle "motionless" track.
|
||||
* 06/25/2013 DR 16013 Qinglu Lin Added setUniqueFip() and code for re-hatching polygon.
|
||||
* 07/09/2013 DR 16376 Qinglu Lin Removed calling removeOverTriplylaidLinesegment() but called removeOverlaidLinesegment().
|
||||
* 07/26/2013 DR 16376 Qinglu Lin Moved adjustVertex() and computeSlope() to PolygonUtil; removed calculateDistance();
|
||||
* updated AreaHatcher's run().
|
||||
* 07/26/2013 DR 16450 D. Friedman Fix logic errors when frame count is one.
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
|
@ -404,7 +407,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
|||
}
|
||||
|
||||
try {
|
||||
warningPolygon = PolygonUtil.removeDuplicateCoordinate(warningPolygon);
|
||||
warningPolygon = PolygonUtil.removeDuplicateCoordinate(warningPolygon);
|
||||
Polygon hatched = polygonUtil.hatchWarningArea(
|
||||
warningPolygon,
|
||||
removeCounties(warningArea,
|
||||
|
@ -415,12 +418,50 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
|||
Coordinate[] coords = hatched.getCoordinates();
|
||||
PolygonUtil.round(coords, 2);
|
||||
PolygonUtil.adjustPolygon(coords);
|
||||
PolygonUtil.removeOverlaidLinesegments(coords);
|
||||
PolygonUtil.round(coords, 2);
|
||||
coords = PolygonUtil.removeDuplicateCoordinate(coords);
|
||||
coords = PolygonUtil.removeOverlaidLinesegments(coords);
|
||||
GeometryFactory gf = new GeometryFactory();
|
||||
LinearRing lr = gf.createLinearRing(coords);
|
||||
hatchedArea = gf.createPolygon(lr, null);
|
||||
if (!hatchedArea.isValid()) {
|
||||
hatchedArea = adjustVertex(hatchedArea);
|
||||
int adjustPolygon_counter = 0;
|
||||
while (!hatchedArea.isValid() && adjustPolygon_counter < 1) {
|
||||
System.out.println("Calling adjustPolygon #" + adjustPolygon_counter);
|
||||
PolygonUtil.adjustPolygon(coords);
|
||||
PolygonUtil.round(coords, 2);
|
||||
coords = PolygonUtil.removeDuplicateCoordinate(coords);
|
||||
coords = PolygonUtil.removeOverlaidLinesegments(coords);
|
||||
lr = gf.createLinearRing(coords);
|
||||
hatchedArea = gf.createPolygon(lr, null);
|
||||
adjustPolygon_counter += 1;
|
||||
}
|
||||
int counter = 0;
|
||||
if (!hatchedArea.isValid() && counter < 2) {
|
||||
System.out.println("calling adjustVertex & alterVertexes: loop #" + counter);
|
||||
int adjustVertex_counter = 0;
|
||||
lr = gf.createLinearRing(coords);
|
||||
hatchedArea = gf.createPolygon(lr, null);
|
||||
while (!hatchedArea.isValid() && adjustVertex_counter < 5) {
|
||||
System.out.println(" Calling adjustVertex #" + adjustVertex_counter);
|
||||
coords = PolygonUtil.adjustVertex(coords);
|
||||
coords = PolygonUtil.removeDuplicateCoordinate(coords);
|
||||
coords = PolygonUtil.removeOverlaidLinesegments(coords);
|
||||
lr = gf.createLinearRing(coords);
|
||||
hatchedArea = gf.createPolygon(lr, null);
|
||||
adjustVertex_counter += 1;
|
||||
}
|
||||
int inner_counter = 0;
|
||||
System.out.println("");
|
||||
while (!hatchedArea.isValid() && inner_counter < 5) {
|
||||
System.out.println(" Calling alterVertexes #" + inner_counter);
|
||||
coords = PolygonUtil.alterVertexes(coords);
|
||||
coords = PolygonUtil.removeDuplicateCoordinate(coords);
|
||||
coords = PolygonUtil.removeOverlaidLinesegments(coords);
|
||||
lr = gf.createLinearRing(coords);
|
||||
hatchedArea = gf.createPolygon(lr, null);
|
||||
inner_counter += 1;
|
||||
}
|
||||
counter += 1;
|
||||
}
|
||||
hatchedWarningArea = createWarnedArea(
|
||||
latLonToLocal(hatchedArea),
|
||||
|
@ -1896,12 +1937,14 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
|||
if (displayState.mode == Mode.DRAG_ME) {
|
||||
return;
|
||||
}
|
||||
if ((configuration.isTrackEnabled() == false ||
|
||||
configuration.getPathcastConfig() == null)
|
||||
&& !this.displayState.isNonstationary()
|
||||
&& this.displayState.displayType != DisplayType.POLY) {
|
||||
createSquare();
|
||||
return;
|
||||
if (warningAction == null || warningAction == WarningAction.NEW) {
|
||||
if ((configuration.isTrackEnabled() == false ||
|
||||
configuration.getPathcastConfig() == null)
|
||||
&& !this.displayState.isNonstationary()
|
||||
&& this.displayState.displayType != DisplayType.POLY) {
|
||||
createSquare();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
DestinationGeodeticCalculator gc = new DestinationGeodeticCalculator();
|
||||
|
@ -2228,7 +2271,8 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
|||
}
|
||||
|
||||
Point point = displayState.dragMePoint;
|
||||
if (motdir != null && motspd != null) {
|
||||
if (motdir != null && motspd != null &&
|
||||
(motspd != 0 || configuration.isTrackEnabled())) {
|
||||
displayState.setInitiallyMotionless(false);
|
||||
displayState.angle = adjustAngle(motdir);
|
||||
displayState.speed = knotToMeterPerSec.convert(motspd);
|
||||
|
@ -2993,126 +3037,6 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
|||
this.warningAction = warningAction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjust the location of vertexes that cause polygon self-crossing.
|
||||
*/
|
||||
private Polygon adjustVertex(Polygon p) {
|
||||
GeometryFactory gf = new GeometryFactory();
|
||||
LinearRing lr;
|
||||
Coordinate coord[] = p.getCoordinates();
|
||||
int length = coord.length;
|
||||
Coordinate intersectCoord = null;
|
||||
int index[] = new int[6];
|
||||
LineSegment ls1, ls2;
|
||||
double d[] = new double[6];
|
||||
int indexOfTheOtherEnd[] = new int[2];
|
||||
boolean isPolygonValid = false;
|
||||
outerLoop: for (int skippedSegment = 1; skippedSegment < length - 3; skippedSegment++) {
|
||||
for (int i = 0; i < length - 1; i++) {
|
||||
index[0] = i;
|
||||
index[1] = index[0] + 1;
|
||||
index[2] = index[1] + skippedSegment;
|
||||
if (index[2] >= length)
|
||||
index[2] = index[2] - length + 1;
|
||||
index[3] = index[2] + 1;
|
||||
if (index[3] >= length)
|
||||
index[3] = index[3] - length + 1;
|
||||
ls1 = new LineSegment(coord[index[0]], coord[index[1]]);
|
||||
ls2 = new LineSegment(coord[index[2]], coord[index[3]]);
|
||||
intersectCoord = ls1.intersection(ls2);
|
||||
if (intersectCoord != null) {
|
||||
for (int j = 0; j < index.length - 2; j++) {
|
||||
d[j] = calculateDistance(intersectCoord,
|
||||
coord[index[j]]);
|
||||
}
|
||||
if (d[0] < d[1]) {
|
||||
index[4] = index[0];
|
||||
d[4] = d[0];
|
||||
indexOfTheOtherEnd[0] = index[1];
|
||||
} else {
|
||||
index[4] = index[1];
|
||||
d[4] = d[1];
|
||||
indexOfTheOtherEnd[0] = index[0];
|
||||
}
|
||||
if (d[2] < d[3]) {
|
||||
index[5] = index[2];
|
||||
d[5] = d[2];
|
||||
indexOfTheOtherEnd[1] = index[3];
|
||||
} else {
|
||||
index[5] = index[3];
|
||||
d[5] = d[3];
|
||||
indexOfTheOtherEnd[1] = index[2];
|
||||
}
|
||||
// index of the vertex on a line segment (line segment A),
|
||||
// which will be moved along line segment A.
|
||||
int replaceIndex;
|
||||
// index of the vertex at the other end of line segment A.
|
||||
int theOtherIndex;
|
||||
if (d[4] < d[5]) {
|
||||
replaceIndex = index[4];
|
||||
theOtherIndex = indexOfTheOtherEnd[0];
|
||||
} else {
|
||||
replaceIndex = index[5];
|
||||
theOtherIndex = indexOfTheOtherEnd[1];
|
||||
}
|
||||
// move the bad vertex, which is on line segment A and has
|
||||
// the shortest distance to intersectCoord,
|
||||
// along line segment A to the other side of line segment B
|
||||
// which intersects with line segment A.
|
||||
double delta;
|
||||
double min = 0.00001;
|
||||
if (Math.abs(intersectCoord.x - coord[replaceIndex].x) < min) {
|
||||
// move the bad vertex along a vertical line segment.
|
||||
delta = intersectCoord.y - coord[theOtherIndex].y;
|
||||
coord[replaceIndex].y += 0.01 * (delta / Math
|
||||
.abs(delta));
|
||||
} else if (Math.abs(intersectCoord.y
|
||||
- coord[replaceIndex].y) < min) {
|
||||
// move the bad vertex along a horizontal line segment.
|
||||
delta = intersectCoord.x - coord[theOtherIndex].x;
|
||||
coord[replaceIndex].x += 0.01 * (delta / Math
|
||||
.abs(delta));
|
||||
} else {
|
||||
// move the bad vertex along a line segment which is
|
||||
// neither vertical nor horizontal.
|
||||
double slope = computeSlope(coord, replaceIndex,
|
||||
theOtherIndex);
|
||||
delta = coord[theOtherIndex].y - intersectCoord.y;
|
||||
coord[replaceIndex].y = intersectCoord.y + 0.005
|
||||
* (delta / Math.abs(delta));
|
||||
coord[replaceIndex].x = (coord[replaceIndex].y - coord[theOtherIndex].y)
|
||||
/ slope + coord[theOtherIndex].x;
|
||||
}
|
||||
PolygonUtil.round(coord, 2);
|
||||
if (replaceIndex == 0)
|
||||
coord[length - 1] = new Coordinate(coord[replaceIndex]);
|
||||
else if (replaceIndex == length - 1)
|
||||
coord[0] = new Coordinate(coord[replaceIndex]);
|
||||
lr = gf.createLinearRing(coord);
|
||||
p = gf.createPolygon(lr, null);
|
||||
isPolygonValid = p.isValid();
|
||||
if (isPolygonValid)
|
||||
break outerLoop;
|
||||
}
|
||||
}
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
private double calculateDistance(Coordinate c1, Coordinate c2) {
|
||||
return Math.sqrt(Math.pow(c1.x - c2.x, 2) + Math.pow(c1.y - c2.y, 2));
|
||||
}
|
||||
|
||||
public double computeSlope(Coordinate[] coords, int i, int j) {
|
||||
double min = 1.0E-08;
|
||||
double dx = coords[i].x - coords[j].x;
|
||||
double slope = 0.0;
|
||||
if (Math.abs(dx) > min) {
|
||||
slope = (coords[i].y - coords[j].y) / dx;
|
||||
}
|
||||
return slope;
|
||||
}
|
||||
|
||||
/**
|
||||
* Some counties/forecast zones have two GIDs, one is for the large portion
|
||||
* of that county and the other is for the small portion, e.g., inlets of a
|
||||
|
|
|
@ -46,6 +46,7 @@ import com.raytheon.uf.common.status.UFStatus;
|
|||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.common.time.SimulatedTime;
|
||||
import com.raytheon.uf.common.time.TimeRange;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
import com.raytheon.uf.viz.core.RecordFactory;
|
||||
import com.raytheon.uf.viz.core.alerts.AlertMessage;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
@ -257,9 +258,8 @@ public class CurrentWarnings {
|
|||
public List<AbstractWarningRecord> getCorrectableWarnings(
|
||||
AbstractWarningRecord warnRec) {
|
||||
List<AbstractWarningRecord> rval = new ArrayList<AbstractWarningRecord>();
|
||||
Calendar current = Calendar.getInstance();
|
||||
Calendar current = TimeUtil.newCalendar();
|
||||
Calendar end = Calendar.getInstance();
|
||||
current.setTime(SimulatedTime.getSystemTime().getTime());
|
||||
|
||||
synchronized (officeId) {
|
||||
List<AbstractWarningRecord> records = warningMap.get(toKey(
|
||||
|
@ -373,8 +373,7 @@ public class CurrentWarnings {
|
|||
List<AbstractWarningRecord> warnings = warningMap.get(toKey(
|
||||
phensig, etn));
|
||||
if (warnings != null) {
|
||||
Calendar c = Calendar.getInstance();
|
||||
c.setTime(SimulatedTime.getSystemTime().getTime());
|
||||
Calendar c = TimeUtil.newCalendar();
|
||||
c.add(Calendar.MINUTE, -10);
|
||||
TimeRange t = new TimeRange(c.getTime(), SimulatedTime
|
||||
.getSystemTime().getTime());
|
||||
|
@ -413,8 +412,7 @@ public class CurrentWarnings {
|
|||
AbstractWarningRecord newProd = null;
|
||||
boolean conMatchesCan = false;
|
||||
ArrayList<AbstractWarningRecord> conProds = new ArrayList<AbstractWarningRecord>();
|
||||
Calendar c = Calendar.getInstance();
|
||||
c.setTime(SimulatedTime.getSystemTime().getTime());
|
||||
Calendar c = TimeUtil.newCalendar();
|
||||
c.add(Calendar.MINUTE, -10);
|
||||
TimeRange t = new TimeRange(c.getTime(), SimulatedTime
|
||||
.getSystemTime().getTime());
|
||||
|
|
|
@ -12,6 +12,7 @@ import com.raytheon.uf.common.dataplugin.warning.WarningRecord.WarningAction;
|
|||
import com.raytheon.uf.common.dataplugin.warning.config.WarngenConfiguration;
|
||||
import com.raytheon.uf.common.time.SimulatedTime;
|
||||
import com.raytheon.uf.common.time.TimeRange;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
import com.raytheon.viz.warngen.gis.AffectedAreas;
|
||||
import com.raytheon.viz.warngen.gis.GisUtil;
|
||||
import com.raytheon.viz.warngen.gis.GisUtil.Direction;
|
||||
|
@ -29,6 +30,8 @@ import com.raytheon.viz.warngen.text.ICommonPatterns;
|
|||
* Jul 22, 2008 #1284 bwoodle Initial creation
|
||||
* Oct 18, 2012 15332 jsanchez Fixed refactor bugs.
|
||||
* Mar 13, 2013 DR 15892 D. Friedman Handle SMW format in canceledAreasFromText
|
||||
* Aug 6, 2013 2243 jsanchez Updated the time ranges to be removed from the follow up list correctly.
|
||||
* Aug 13, 2013 2243 jsanchez Removed calendar object.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -54,10 +57,6 @@ public class FollowUpUtil {
|
|||
WarngenConfiguration config, AbstractWarningRecord record,
|
||||
WarningAction action) {
|
||||
|
||||
// Current Time
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(SimulatedTime.getSystemTime().getTime());
|
||||
|
||||
boolean rval = false;
|
||||
if (record == null) {
|
||||
return rval;
|
||||
|
@ -73,7 +72,8 @@ public class FollowUpUtil {
|
|||
for (String s : config.getFollowUps()) {
|
||||
WarningAction act = WarningAction.valueOf(s);
|
||||
if (act == action
|
||||
&& getTimeRange(act, record).contains(cal.getTime())
|
||||
&& getTimeRange(act, record).contains(
|
||||
SimulatedTime.getSystemTime().getTime())
|
||||
&& act != WarningAction.COR) {
|
||||
rval = true;
|
||||
}
|
||||
|
@ -202,7 +202,8 @@ public class FollowUpUtil {
|
|||
headline += line;
|
||||
}
|
||||
}
|
||||
String[] ugcs = FipsUtil.getListCounties(ugcLine).toArray(new String[0]);
|
||||
String[] ugcs = FipsUtil.getListCounties(ugcLine)
|
||||
.toArray(new String[0]);
|
||||
String[] names;
|
||||
boolean smwAreas = false;
|
||||
if (namesLine.length() > 0)
|
||||
|
@ -233,7 +234,7 @@ public class FollowUpUtil {
|
|||
areasNotation = "COUNTIES";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (ugc.length() < 3)
|
||||
continue; // TODO: log?
|
||||
|
||||
|
@ -242,7 +243,8 @@ public class FollowUpUtil {
|
|||
if (i < names.length) {
|
||||
if (!smwAreas && names[i].length() >= 3) {
|
||||
name = names[i].substring(0, names[i].length() - 3);
|
||||
stateAbbreviation = names[i].substring(names[i].length() - 2);
|
||||
stateAbbreviation = names[i]
|
||||
.substring(names[i].length() - 2);
|
||||
} else {
|
||||
name = names[i];
|
||||
}
|
||||
|
@ -307,55 +309,59 @@ public class FollowUpUtil {
|
|||
AbstractWarningRecord record) {
|
||||
/* Calendars for time calculations */
|
||||
|
||||
Calendar start = Calendar.getInstance();
|
||||
Calendar end = Calendar.getInstance();
|
||||
start.setTime(SimulatedTime.getSystemTime().getTime());
|
||||
end.setTime(SimulatedTime.getSystemTime().getTime());
|
||||
Calendar start = TimeUtil.newCalendar();
|
||||
Calendar end = TimeUtil.newCalendar();
|
||||
|
||||
TimeRange rval = null;
|
||||
|
||||
// The time ranges are offset by 1 minute so that after a refresh and on
|
||||
// the final minute of the time range the follow up data will be
|
||||
// removed. For example, if a CON is only a available until 5 minutes
|
||||
// before a warnings expiration, when the time reaches 5 minutes the
|
||||
// follow up data for a CON is correctly removed.
|
||||
if (action == WarningAction.NEW) {
|
||||
/* Calculate NEW Time Range */
|
||||
start.setTime(record.getEndTime().getTime());
|
||||
start.add(Calendar.MINUTE, -20);
|
||||
start.add(Calendar.MINUTE, -21);
|
||||
end.setTime(record.getEndTime().getTime());
|
||||
end.add(Calendar.MINUTE, 30);
|
||||
end.add(Calendar.MINUTE, 29);
|
||||
rval = new TimeRange(start, end);
|
||||
} else if (action == WarningAction.COR) {
|
||||
/* Calculate COR Time Range */
|
||||
end.setTime(record.getIssueTime().getTime());
|
||||
end.add(Calendar.MINUTE, 10);
|
||||
end.add(Calendar.MINUTE, 9);
|
||||
rval = new TimeRange(record.getStartTime(), end);
|
||||
} else if (action == WarningAction.CAN) {
|
||||
/* Calculate CAN Time Range */
|
||||
end.setTime(record.getEndTime().getTime());
|
||||
end.add(Calendar.MINUTE, -10);
|
||||
end.add(Calendar.MINUTE, -11);
|
||||
rval = new TimeRange(record.getStartTime(), end);
|
||||
} else if (action == WarningAction.CON) {
|
||||
/* Calculate CON Time Range */
|
||||
end.setTime(record.getEndTime().getTime());
|
||||
end.add(Calendar.MINUTE, -5);
|
||||
end.add(Calendar.MINUTE, -6);
|
||||
rval = new TimeRange(record.getStartTime(), end);
|
||||
} else if (action == WarningAction.EXP) {
|
||||
/* Calculate EXP Time Range */
|
||||
start.setTime(record.getEndTime().getTime());
|
||||
start.add(Calendar.MINUTE, -10);
|
||||
start.add(Calendar.MINUTE, -11);
|
||||
end.setTime(record.getEndTime().getTime());
|
||||
end.add(Calendar.MINUTE, 10);
|
||||
end.add(Calendar.MINUTE, 9);
|
||||
rval = new TimeRange(start, end);
|
||||
} else if (action == WarningAction.EXT) {
|
||||
/* Calculate EXT Time Range */
|
||||
start.setTime(record.getStartTime().getTime());
|
||||
end.setTime(record.getEndTime().getTime());
|
||||
end.add(Calendar.MINUTE, -5);
|
||||
end.add(Calendar.MINUTE, -6);
|
||||
rval = new TimeRange(start, end);
|
||||
}
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
/** Parses the canceled areas of an SMW, which have a different format
|
||||
* from other products.
|
||||
/**
|
||||
* Parses the canceled areas of an SMW, which have a different format from
|
||||
* other products.
|
||||
*/
|
||||
private static String[] parseSMWCanceledAreas(String[] splitLines) {
|
||||
StringBuilder text = new StringBuilder(64);
|
||||
|
|
|
@ -31,4 +31,4 @@
|
|||
<parameter name="relTime" queryName="dataTime.refTime" numDims="1" type="LONG" unit="ms" />
|
||||
<parameter name="refTime" queryName="dataTime.refTime" numDims="1" type="LONG" unit="ms" />
|
||||
<parameter name="forecastHr" queryName="dataTime.fcstTime" numDims="1" type="INT" unit="h" dbunit="s" />
|
||||
</pointDataDbDescription>
|
||||
</pointDataDbDescription>
|
||||
|
|
|
@ -143,7 +143,7 @@
|
|||
<!-- Convert the topic into a queue so only one consumer gets each message and we still have competing consumers. -->
|
||||
<route id="gfeDataURINotificationQueueRoute">
|
||||
<from
|
||||
uri="jms-gfe-notify:topic:edex.alerts?clientId=gfeNotify&durableSubscriptionName=gfeNotificationSubscription"/>
|
||||
uri="jms-gfe-notify:topic:edex.alerts"/>
|
||||
<doTry>
|
||||
<to uri="jms-generic:queue:gfeDataURINotification"/>
|
||||
<doCatch>
|
||||
|
@ -169,40 +169,6 @@
|
|||
|
||||
</camelContext>
|
||||
|
||||
<!-- Beans to define a custom jms connection which will allow a durable subscription -->
|
||||
<bean id="gfeNotifyConnectionFactory" class="org.apache.qpid.client.AMQConnectionFactory">
|
||||
<constructor-arg type="java.lang.String"
|
||||
value="amqp://guest:guest@gfeNotify/edex?brokerlist='tcp://${BROKER_ADDR}?retries='9999'&connecttimeout='5000'&connectdelay='5000''&maxprefetch='0'&sync_publish='all'&sync_ack='true'"/>
|
||||
</bean>
|
||||
|
||||
<bean id="gfeNotifyPooledConnectionFactory" class="com.raytheon.uf.common.jms.JmsPooledConnectionFactory">
|
||||
<constructor-arg ref="gfeNotifyConnectionFactory"/>
|
||||
<property name="provider" value="QPID"/>
|
||||
<property name="reconnectInterval" value="5000"/>
|
||||
<!-- After connection has been closed by thread keep it allocated for another 90 seconds in case thread needs it
|
||||
again -->
|
||||
<property name="connectionHoldTime" value="90000"/>
|
||||
<!-- Any resource that has been available in the pool for more than 1 minute will be closed -->
|
||||
<property name="resourceRetention" value="60000"/>
|
||||
<property name="maxSpareConnections" value="1"/>
|
||||
</bean>
|
||||
|
||||
<bean id="gfeNotifyJmsConfig" class="org.apache.camel.component.jms.JmsConfiguration" factory-bean="jmsConfig"
|
||||
factory-method="copy">
|
||||
<property name="listenerConnectionFactory" ref="gfeNotifyPooledConnectionFactory"/>
|
||||
<property name="templateConnectionFactory" ref="gfeNotifyPooledConnectionFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="gfeNotifyThreadPool" class="com.raytheon.uf.edex.esb.camel.spring.JmsThreadPoolTaskExecutor">
|
||||
<property name="corePoolSize" value="1"/>
|
||||
<property name="maxPoolSize" value="1"/>
|
||||
</bean>
|
||||
|
||||
<bean id="jms-gfe-notify" class="org.apache.camel.component.jms.JmsComponent">
|
||||
<constructor-arg ref="gfeNotifyJmsConfig"/>
|
||||
<property name="taskExecutor" ref="gfeNotifyThreadPool"/>
|
||||
</bean>
|
||||
<!-- end of custom JMS beans -->
|
||||
|
||||
<bean factory-bean="clusteredCamelContextMgr" factory-method="register">
|
||||
<constructor-arg ref="clusteredGfeIngestRoutes"/>
|
||||
|
|
|
@ -96,6 +96,8 @@ import com.raytheon.uf.edex.database.query.DatabaseQuery;
|
|||
* 05/20/13 #2127 rjpeter Set session's to read only and switched to stateless where possible.
|
||||
* 06/13/13 #2044 randerso Refactored to use IFPServer, code cleanup
|
||||
* 07/30/13 #2057 randerso Added support marking and eventually purging obsolete databases
|
||||
* 08/08/13 DR16485 ryu Remove call to getDatabaseId() from getMaxInsertTimeByDbId()
|
||||
* so new GFE databases aren't accidentally created.
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -1197,7 +1199,13 @@ public class GFEDao extends DefaultPluginDao {
|
|||
public Date getMaxInsertTimeByDbId(final DatabaseID dbId)
|
||||
throws DataAccessLayerException {
|
||||
DatabaseQuery query = new DatabaseQuery(this.daoClass);
|
||||
query.addQueryParam("parmId.dbId", getDatabaseId(dbId),
|
||||
query.addQueryParam("parmId.dbId.siteId", dbId.getSiteId(),
|
||||
QueryOperand.EQUALS);
|
||||
query.addQueryParam("parmId.dbId.format", dbId.getFormat(),
|
||||
QueryOperand.EQUALS);
|
||||
query.addQueryParam("parmId.dbId.modelName", dbId.getModelName(),
|
||||
QueryOperand.EQUALS);
|
||||
query.addQueryParam("parmId.dbId.modelTime", dbId.getModelTime(),
|
||||
QueryOperand.EQUALS);
|
||||
query.addReturnedField("insertTime");
|
||||
query.addOrder("insertTime", false);
|
||||
|
|
|
@ -66,6 +66,7 @@ from com.raytheon.uf.common.localization import LocalizationContext_Localization
|
|||
# A1, big perf improvement.
|
||||
# 05/23/13 1759 dgilling Remove unnecessary imports.
|
||||
# 06/13/13 2044 randerso Updated for changes to TopoDatabaseManager
|
||||
# 07/25/13 2233 randerso Improved memory utilization and performance
|
||||
#
|
||||
#
|
||||
|
||||
|
@ -366,7 +367,7 @@ def getMaskGrid(client, editAreaName, dbId):
|
|||
return mask
|
||||
|
||||
###-------------------------------------------------------------------------###
|
||||
def storeLatLonGrids(client, file, databaseID, maskGrid, krunch, clipArea):
|
||||
def storeLatLonGrids(client, file, databaseID, invMask, krunch, clipArea):
|
||||
# db = client[databaseID]
|
||||
|
||||
# Get the grid location and projection information
|
||||
|
@ -461,7 +462,7 @@ def storeLatLonGrids(client, file, databaseID, maskGrid, krunch, clipArea):
|
|||
logEvent("Saved Latitude/Longitude Grid")
|
||||
|
||||
###-------------------------------------------------------------------------###
|
||||
def storeTopoGrid(client, file, databaseID, maskGrid, clipArea):
|
||||
def storeTopoGrid(client, file, databaseID, invMask, clipArea):
|
||||
"Stores the topo grid in the database"
|
||||
|
||||
# Get the grid location and projection information
|
||||
|
@ -669,7 +670,8 @@ def storeWEAttributes(var, we, timeList, databaseID, clipArea):
|
|||
# Note that geo information is modified based on the clip info.
|
||||
|
||||
# TimeRanges
|
||||
setattr(var, "validTimes", timeList)
|
||||
import itertools
|
||||
setattr(var, "validTimes", list(itertools.chain.from_iterable(timeList)))
|
||||
|
||||
# Descriptive Name
|
||||
setattr(var, "descriptiveName", we.getGpi().getDescriptiveName())
|
||||
|
@ -727,30 +729,41 @@ def storeWEAttributes(var, we, timeList, databaseID, clipArea):
|
|||
return
|
||||
|
||||
|
||||
def findOverlappingTimes(trList, timeRange):
|
||||
timeList = []
|
||||
overlappingTimes = []
|
||||
for t in trList:
|
||||
interTR = intersection(t, timeRange)
|
||||
if interTR is not None:
|
||||
overlappingTimes.append(t)
|
||||
timeList.append(interTR)
|
||||
|
||||
return timeList, overlappingTimes
|
||||
|
||||
###-------------------------------------------------------------------------###
|
||||
### Stores the specified Scalar WE in the netCDF file whose grids fall within
|
||||
### the specified timeRange.
|
||||
def storeScalarWE(we, trList, file, timeRange, databaseID,
|
||||
mask, trim, clipArea, krunch):
|
||||
invMask, trim, clipArea, krunch):
|
||||
"Stores a weather element to the netCDF file"
|
||||
|
||||
# get the data and store it in a Numeric array.
|
||||
cube = []
|
||||
timeList = []
|
||||
wec = WECache(we, trList)
|
||||
for t in trList:
|
||||
interTR = intersection(t, timeRange)
|
||||
if interTR is not None:
|
||||
grid = clipToExtrema(wec[t][0], clipArea)
|
||||
#adjust for time changes
|
||||
if we.getGpi().isRateParm():
|
||||
durRatio = (float(interTR[1]-interTR[0]))/float((t[1]-t[0]))
|
||||
grid = (grid * durRatio).astype(numpy.float32)
|
||||
cube.append(grid)
|
||||
timeList.append(interTR[0])
|
||||
timeList.append(interTR[1])
|
||||
timeList, overlappingTimes = findOverlappingTimes(trList, timeRange)
|
||||
|
||||
cube = numpy.array(cube).astype(numpy.float32)
|
||||
# clipped size
|
||||
clipSize = (clipArea[1] - clipArea[0] + 1, clipArea[3] - clipArea[2] + 1)
|
||||
gridCount = len(overlappingTimes)
|
||||
|
||||
cube = numpy.empty(shape=(gridCount, clipSize[1], clipSize[0]), dtype=numpy.float32)
|
||||
|
||||
wec = WECache(we, overlappingTimes)
|
||||
for i,t in enumerate(overlappingTimes):
|
||||
grid = clipToExtrema(wec[t][0], clipArea)
|
||||
#adjust for time changes
|
||||
if we.getGpi().isRateParm():
|
||||
durRatio = (float(timeList[i][1]-timeList[i][0]))/float((t[1]-t[0]))
|
||||
grid *= durRatio
|
||||
cube[i]= grid
|
||||
|
||||
### Make sure we found some grids
|
||||
# make the variable name
|
||||
|
@ -759,21 +772,12 @@ def storeScalarWE(we, trList, file, timeRange, databaseID,
|
|||
if len(cube) == 0:
|
||||
logVerbose("No", varName, "grids found")
|
||||
|
||||
# clipped size
|
||||
clipSize = (clipArea[1] - clipArea[0] + 1, clipArea[3] - clipArea[2] + 1)
|
||||
|
||||
gridCount = len(timeList) / 2
|
||||
newsize = (gridCount, clipSize[1], clipSize[0]) #y,x
|
||||
cube = numpy.resize(cube, newsize) # necessary when no grids
|
||||
|
||||
#get the dimension List
|
||||
dimNames = ["ngrids_" + varName, "y", "x"]
|
||||
dims = getDims(file, cube.shape, dimNames)
|
||||
|
||||
# Round the values according to the precision
|
||||
if trim:
|
||||
precision = pow(10, we.getGpi().getPrecision())
|
||||
|
||||
if krunch:
|
||||
format, multiplier, offset, fillValue, pythonType = \
|
||||
calcKrunchValues(we)
|
||||
|
@ -783,23 +787,21 @@ def storeScalarWE(we, trList, file, timeRange, databaseID,
|
|||
|
||||
# krunch
|
||||
if multiplier is not None:
|
||||
cube = ((cube - offset) * multiplier)
|
||||
roundMask = numpy.where(numpy.greater(cube, 0), 1.0, -1.0)
|
||||
cube = (cube + (0.5 * roundMask)).astype(pythonType)
|
||||
cube -= offset
|
||||
cube *= multiplier
|
||||
numpy.around(cube,out=cube)
|
||||
# normal trim
|
||||
else:
|
||||
roundMask = numpy.where(numpy.greater(cube, 0), 1.0, -1.0)
|
||||
trimmed = (cube * precision + (0.5 * roundMask))
|
||||
trimmed = numpy.array(trimmed).astype(numpy.int32)
|
||||
cube = numpy.array(trimmed).astype(numpy.float32)
|
||||
cube = numpy.array(cube / precision).astype(numpy.float32)
|
||||
digits = we.getGpi().getPrecision()
|
||||
numpy.around(cube, digits, cube)
|
||||
cube = cube.astype(pythonType)
|
||||
|
||||
else:
|
||||
format, multiplier, offset, fillValue, pythonType = \
|
||||
('f', None, None, -30000.0, numpy.float32)
|
||||
|
||||
# mask the data
|
||||
cube = numpy.where(mask, cube, fillValue).astype(pythonType)
|
||||
cube[:,invMask] = fillValue
|
||||
|
||||
# create the variable
|
||||
var = file.createVariable(varName, format, dims)
|
||||
|
@ -826,44 +828,36 @@ def storeScalarWE(we, trList, file, timeRange, databaseID,
|
|||
### Stores the specified Vector WE in the netCDF file whose grids fall within
|
||||
### the specified timeRange.
|
||||
def storeVectorWE(we, trList, file, timeRange,
|
||||
databaseID, mask, trim, clipArea, krunch):
|
||||
databaseID, invMask, trim, clipArea, krunch):
|
||||
"Stores a vector weather element to the netCDF file"
|
||||
|
||||
# get the data and store it in a Numeric array.
|
||||
magCube = []
|
||||
dirCube = []
|
||||
timeList = []
|
||||
wec = WECache(we, trList)
|
||||
for t in trList:
|
||||
interTR = intersection(t, timeRange)
|
||||
if interTR is not None:
|
||||
vecData = wec[t][0]
|
||||
mag = clipToExtrema(vecData[0], clipArea)
|
||||
dir = clipToExtrema(vecData[1], clipArea)
|
||||
if we.getGpi().isRateParm():
|
||||
durRatio = (float(interTR[1]-interTR[0]))/float((t[1]-t[0]))
|
||||
mag = (mag * durRatio).astype(numpy.float32)
|
||||
magCube.append(mag)
|
||||
dirCube.append(dir)
|
||||
timeList.append(interTR[0])
|
||||
timeList.append(interTR[1])
|
||||
timeList, overlappingTimes = findOverlappingTimes(trList, timeRange)
|
||||
|
||||
# clipped size
|
||||
clipSize = (clipArea[1] - clipArea[0] + 1, clipArea[3] - clipArea[2] + 1)
|
||||
gridCount = len(overlappingTimes)
|
||||
|
||||
magCube = numpy.empty(shape=(gridCount, clipSize[1], clipSize[0]),dtype=numpy.float32)
|
||||
dirCube = numpy.empty(shape=(gridCount, clipSize[1], clipSize[0]),dtype=numpy.float32)
|
||||
|
||||
wec = WECache(we, overlappingTimes)
|
||||
for i,t in enumerate(overlappingTimes):
|
||||
vecData = wec[t][0]
|
||||
mag = clipToExtrema(vecData[0], clipArea)
|
||||
dir = clipToExtrema(vecData[1], clipArea)
|
||||
if we.getGpi().isRateParm():
|
||||
durRatio = (float(timeList[i][1]-timeList[i][0]))/float((t[1]-t[0]))
|
||||
mag *= durRatio
|
||||
magCube[i] = mag
|
||||
dirCube[i] = dir
|
||||
|
||||
magCube = numpy.array(magCube).astype(numpy.float32)
|
||||
dirCube = numpy.array(dirCube).astype(numpy.float32)
|
||||
varName = we.getParmid().getParmName() + "_" + we.getParmid().getParmLevel()
|
||||
|
||||
### Make sure we found some grids
|
||||
if len(magCube) == 0:
|
||||
logVerbose("No", varName, "grids found")
|
||||
|
||||
# clipped size
|
||||
clipSize = (clipArea[1] - clipArea[0] + 1, clipArea[3] - clipArea[2] + 1)
|
||||
|
||||
gridCount = len(timeList) / 2
|
||||
newsize = (gridCount, clipSize[1], clipSize[0]) #y,x
|
||||
magCube = numpy.resize(magCube, newsize) # necessary when no grids
|
||||
dirCube = numpy.resize(dirCube, newsize) # necessary when no grids
|
||||
|
||||
# make the variable name
|
||||
magVarName = we.getParmid().getParmName() + "_Mag_" + we.getParmid().getParmLevel()
|
||||
dirVarName = we.getParmid().getParmName() + "_Dir_" + we.getParmid().getParmLevel()
|
||||
|
@ -874,8 +868,6 @@ def storeVectorWE(we, trList, file, timeRange,
|
|||
|
||||
# Round the values according to the precision
|
||||
if trim:
|
||||
mprecision = pow(10, we.getGpi().getPrecision())
|
||||
|
||||
if krunch:
|
||||
mformat, mmultiplier, moffset, mfillValue, mpythonType = \
|
||||
calcKrunchValues(we)
|
||||
|
@ -889,29 +881,27 @@ def storeVectorWE(we, trList, file, timeRange,
|
|||
|
||||
# krunch magnitude
|
||||
if mmultiplier is not None:
|
||||
magCube = ((magCube - moffset) * mmultiplier)
|
||||
roundMask = numpy.where(numpy.greater(magCube, 0), 1.0, -1.0)
|
||||
magCube = (magCube + (0.5 * roundMask)).astype(mpythonType)
|
||||
magCube -= moffset
|
||||
magCube *= mmultiplier
|
||||
numpy.around(magCube,out=magCube)
|
||||
|
||||
# normal trim for magnitude
|
||||
else:
|
||||
roundMask = numpy.where(numpy.greater(magCube, 0), 1.0, -1.0)
|
||||
trimmed = (magCube * mprecision + (0.5 * roundMask))
|
||||
trimmed = numpy.array(trimmed).astype(numpy.int32)
|
||||
magCube = numpy.array(trimmed).astype(numpy.float32)
|
||||
magCube = numpy.array(magCube / mprecision).astype(numpy.float32)
|
||||
digits = we.getGpi().getPrecision()
|
||||
numpy.around(magCube, digits, magCube)
|
||||
magCube = magCube.astype(mpythonType)
|
||||
|
||||
# krunch direction
|
||||
if dmultiplier is not None:
|
||||
dirCube = ((dirCube - doffset) * dmultiplier)
|
||||
roundMask = numpy.where(numpy.greater(dirCube, 0), 1.0, -1.0)
|
||||
dirCube = (dirCube + (0.5 * roundMask)).astype(dpythonType)
|
||||
dirCube -= doffset
|
||||
dirCube *= dmultiplier
|
||||
numpy.around(dirCube,out=dirCube)
|
||||
|
||||
# normal trim for direction
|
||||
else:
|
||||
dirCube = numpy.array((dirCube + (0.5 * 10)) / 10).astype(numpy.int32)
|
||||
dirCube = numpy.array(dirCube * 10).astype(numpy.float32)
|
||||
mask360 = numpy.greater_equal(dirCube, 360.0)
|
||||
dirCube = numpy.where(mask360, dirCube - 360.0, dirCube).astype(numpy.float32)
|
||||
numpy.around(dirCube, -1, dirCube)
|
||||
dirCube[numpy.greater_equal(dirCube, 360.0)] -= 360.0
|
||||
dirCube = dirCube.astype(dpythonType)
|
||||
|
||||
else:
|
||||
mformat, mmultiplier, moffset, mfillValue, mpythonType = \
|
||||
|
@ -919,9 +909,8 @@ def storeVectorWE(we, trList, file, timeRange,
|
|||
dformat, dmultiplier, doffset, dfillValue, dpythonType = \
|
||||
('f', None, None, -30000.0, numpy.float32)
|
||||
|
||||
|
||||
magCube = numpy.where(mask, magCube, mfillValue).astype(mpythonType)
|
||||
dirCube = numpy.where(mask, dirCube, dfillValue).astype(dpythonType)
|
||||
magCube[:,invMask] = mfillValue
|
||||
dirCube[:,invMask] = dfillValue
|
||||
|
||||
# create the variable
|
||||
magVar = file.createVariable(magVarName, mformat, dims)
|
||||
|
@ -999,26 +988,25 @@ def collapseKey(keys, grid):
|
|||
###-------------------------------------------------------------------------###
|
||||
# Stores the specified Weather WE in the netCDF file whose grids fall within
|
||||
### the specified timeRange.
|
||||
def storeWeatherWE(we, trList, file, timeRange, databaseID, mask, clipArea):
|
||||
def storeWeatherWE(we, trList, file, timeRange, databaseID, invMask, clipArea):
|
||||
"Stores the Weather weather element to the netCDF file"
|
||||
|
||||
# get the data and store it in a Numeric array.
|
||||
byteCube = []
|
||||
keyList = []
|
||||
timeList = []
|
||||
wec = WECache(we, trList)
|
||||
for t in trList:
|
||||
interTR = intersection(t, timeRange)
|
||||
if interTR is not None:
|
||||
wx = wec[t][0]
|
||||
grid = clipToExtrema(wx[0], clipArea)
|
||||
byteCube.append(grid)
|
||||
# Save times for these grids in a list
|
||||
timeList.append(interTR[0])
|
||||
timeList.append(interTR[1])
|
||||
keyList.append(wx[1])
|
||||
timeList, overlappingTimes = findOverlappingTimes(trList, timeRange)
|
||||
|
||||
byteCube = numpy.array(byteCube).astype(numpy.int8)
|
||||
# clipped size
|
||||
clipSize = (clipArea[1] - clipArea[0] + 1, clipArea[3] - clipArea[2] + 1)
|
||||
gridCount = len(overlappingTimes)
|
||||
|
||||
byteCube = numpy.empty(shape=(gridCount, clipSize[1], clipSize[0]), dtype=numpy.int8)
|
||||
|
||||
keyList = []
|
||||
wec = WECache(we, overlappingTimes)
|
||||
for i,t in enumerate(overlappingTimes):
|
||||
wx = wec[t][0]
|
||||
grid = clipToExtrema(wx[0], clipArea)
|
||||
byteCube[i] = grid
|
||||
keyList.append(wx[1])
|
||||
|
||||
# make the variable name
|
||||
varName = we.getParmid().getParmName() + "_" + we.getParmid().getParmLevel()
|
||||
|
@ -1027,13 +1015,6 @@ def storeWeatherWE(we, trList, file, timeRange, databaseID, mask, clipArea):
|
|||
if len(byteCube) == 0:
|
||||
logVerbose("No", varName, "grids found")
|
||||
|
||||
# clipped size
|
||||
clipSize = (clipArea[1] - clipArea[0] + 1, clipArea[3] - clipArea[2] + 1)
|
||||
|
||||
gridCount = len(timeList) / 2
|
||||
newsize = (gridCount, clipSize[1], clipSize[0]) #y,x
|
||||
byteCube = numpy.resize(byteCube, newsize)
|
||||
|
||||
#get the dimension List
|
||||
dimNames = ["ngrids_" + varName, "y", "x"]
|
||||
dims = getDims(file, byteCube.shape, dimNames)
|
||||
|
@ -1048,7 +1029,7 @@ def storeWeatherWE(we, trList, file, timeRange, databaseID, mask, clipArea):
|
|||
|
||||
# Mask the values
|
||||
fillValue = -127
|
||||
byteCube = numpy.where(mask, byteCube, fillValue).astype(numpy.int8)
|
||||
byteCube[:,invMask] =fillValue
|
||||
|
||||
# Save the grids to the netCDF file
|
||||
for i in range(len(byteCube)):
|
||||
|
@ -1098,26 +1079,26 @@ def storeWeatherWE(we, trList, file, timeRange, databaseID, mask, clipArea):
|
|||
###-------------------------------------------------------------------------###
|
||||
# Stores the specified Discrete WE in the netCDF file whose grids fall within
|
||||
### the specified timeRange.
|
||||
def storeDiscreteWE(we, trList, file, timeRange, databaseID, mask, clipArea):
|
||||
def storeDiscreteWE(we, trList, file, timeRange, databaseID, invMask, clipArea):
|
||||
"Stores the Weather weather element to the netCDF file"
|
||||
|
||||
# get the data and store it in a Numeric array.
|
||||
byteCube = []
|
||||
keyList = []
|
||||
timeList = []
|
||||
wec = WECache(we, trList)
|
||||
for t in trList:
|
||||
interTR = intersection(t, timeRange)
|
||||
if interTR is not None:
|
||||
dis = wec[t][0]
|
||||
grid = clipToExtrema(dis[0], clipArea)
|
||||
byteCube.append(grid)
|
||||
# Save times for these grids in a list
|
||||
timeList.append(interTR[0])
|
||||
timeList.append(interTR[1])
|
||||
keyList.append(dis[1])
|
||||
timeList, overlappingTimes = findOverlappingTimes(trList, timeRange)
|
||||
|
||||
byteCube = numpy.array(byteCube).astype(numpy.int8)
|
||||
# clipped size
|
||||
clipSize = (clipArea[1] - clipArea[0] + 1, clipArea[3] - clipArea[2] + 1)
|
||||
gridCount = len(overlappingTimes)
|
||||
|
||||
byteCube = numpy.empty(shape=(gridCount, clipSize[1], clipSize[0]), dtype=numpy.int8)
|
||||
|
||||
keyList = []
|
||||
wec = WECache(we, overlappingTimes)
|
||||
for i,t in enumerate(overlappingTimes):
|
||||
dis = wec[t][0]
|
||||
grid = clipToExtrema(dis[0], clipArea)
|
||||
byteCube[i] = grid
|
||||
keyList.append(dis[1])
|
||||
|
||||
|
||||
# make the variable name
|
||||
varName = we.getParmid().getParmName() + "_" + we.getParmid().getParmLevel()
|
||||
|
@ -1126,13 +1107,6 @@ def storeDiscreteWE(we, trList, file, timeRange, databaseID, mask, clipArea):
|
|||
if len(byteCube) == 0:
|
||||
logVerbose("No", varName, "grids found")
|
||||
|
||||
# clipped size
|
||||
clipSize = (clipArea[1] - clipArea[0] + 1, clipArea[3] - clipArea[2] + 1)
|
||||
|
||||
gridCount = len(timeList) / 2
|
||||
newsize = (gridCount, clipSize[1], clipSize[0]) #y,x
|
||||
byteCube = numpy.resize(byteCube, newsize) # necessary when no grids
|
||||
|
||||
#get the dimension List
|
||||
dimNames = ["ngrids_" + varName, "y", "x"]
|
||||
dims = getDims(file, byteCube.shape, dimNames)
|
||||
|
@ -1147,7 +1121,7 @@ def storeDiscreteWE(we, trList, file, timeRange, databaseID, mask, clipArea):
|
|||
|
||||
# Mask the values
|
||||
fillValue = -127
|
||||
byteCube = numpy.where(mask, byteCube, fillValue).astype(numpy.int8)
|
||||
byteCube[:,invMask] = fillValue
|
||||
|
||||
# Save the grids to the netCDF file
|
||||
for i in range(len(byteCube)):
|
||||
|
@ -1375,7 +1349,11 @@ def main(outputFilename, parmList, databaseID, startTime,
|
|||
clipArea = extremaOfSetBits(maskGrid)
|
||||
maskGrid = clipToExtrema(maskGrid, clipArea)
|
||||
clippedGridSize = maskGrid.shape
|
||||
validPointCount = numpy.add.reduce(numpy.add.reduce(maskGrid))
|
||||
validPointCount = numpy.add.reduce(numpy.add.reduce(maskGrid))
|
||||
|
||||
#invert the mask grid
|
||||
invMask = numpy.logical_not(maskGrid)
|
||||
#del maskGrid
|
||||
|
||||
# Determine sampling definition
|
||||
samplingDef = getSamplingDefinition(client, argDict['configFileName'])
|
||||
|
@ -1395,18 +1373,18 @@ def main(outputFilename, parmList, databaseID, startTime,
|
|||
gridType = str(we.getGpi().getGridType())
|
||||
if gridType == "SCALAR":
|
||||
nGrids = storeScalarWE(we, weInv, file, timeRange,
|
||||
argDict['databaseID'], maskGrid, argDict['trim'], clipArea,
|
||||
argDict['databaseID'], invMask, argDict['trim'], clipArea,
|
||||
argDict['krunch'])
|
||||
elif gridType == "VECTOR":
|
||||
nGrids = storeVectorWE(we, weInv, file, timeRange,
|
||||
argDict['databaseID'], maskGrid, argDict['trim'], clipArea,
|
||||
argDict['databaseID'], invMask, argDict['trim'], clipArea,
|
||||
argDict['krunch'])
|
||||
elif gridType == "WEATHER":
|
||||
nGrids = storeWeatherWE(we, weInv, file, timeRange,
|
||||
argDict['databaseID'], maskGrid, clipArea)
|
||||
argDict['databaseID'], invMask, clipArea)
|
||||
elif gridType == "DISCRETE":
|
||||
nGrids = storeDiscreteWE(we, weInv, file, timeRange,
|
||||
argDict['databaseID'], maskGrid, clipArea)
|
||||
argDict['databaseID'], invMask, clipArea)
|
||||
else:
|
||||
s = "Grids of type: " + we.gridType + " are not supported, " + \
|
||||
"parm=" + p
|
||||
|
@ -1417,8 +1395,8 @@ def main(outputFilename, parmList, databaseID, startTime,
|
|||
|
||||
# store the topo and lat, lon grids if the -g was present
|
||||
if argDict["geoInfo"]:
|
||||
storeTopoGrid(client, file, argDict['databaseID'], maskGrid, clipArea)
|
||||
storeLatLonGrids(client, file, argDict['databaseID'], maskGrid,
|
||||
storeTopoGrid(client, file, argDict['databaseID'], invMask, clipArea)
|
||||
storeLatLonGrids(client, file, argDict['databaseID'], invMask,
|
||||
argDict['krunch'], clipArea)
|
||||
totalGrids = totalGrids + 3
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ Bundle-SymbolicName: com.raytheon.edex.plugin.modelsounding
|
|||
Bundle-Version: 1.12.1174.qualifier
|
||||
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
|
||||
Bundle-Vendor: RAYTHEON
|
||||
com.google.guava;bundle-version="1.0.0"
|
||||
Export-Package: com.raytheon.edex.plugin.modelsounding,
|
||||
com.raytheon.edex.plugin.modelsounding.common,
|
||||
com.raytheon.edex.plugin.modelsounding.dao,
|
||||
|
@ -23,7 +24,8 @@ Require-Bundle: com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174",
|
|||
com.raytheon.uf.edex.decodertools;bundle-version="1.12.1174",
|
||||
javax.persistence;bundle-version="1.0.0",
|
||||
org.hibernate;bundle-version="1.0.0",
|
||||
org.springframework;bundle-version="3.1.4"
|
||||
org.springframework;bundle-version="3.1.4",
|
||||
com.google.guava;bundle-version="1.0.0"
|
||||
Import-Package: com.raytheon.edex.esb,
|
||||
com.raytheon.edex.exception,
|
||||
com.raytheon.edex.plugin,
|
||||
|
|
|
@ -3,13 +3,17 @@
|
|||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
|
||||
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
|
||||
|
||||
<bean id="modelsoundingDecoder"
|
||||
class="com.raytheon.edex.plugin.modelsounding.ModelSoundingDecoder" />
|
||||
|
||||
<bean id="mdlsndgSeparator" class="com.raytheon.edex.plugin.modelsounding.ModelSoundingSeparator" >
|
||||
<property name="chunkSize" value="500000" />
|
||||
<bean id="modelsoundingPersistenceManager"
|
||||
class="com.raytheon.edex.plugin.modelsounding.ModelSoundingPersistenceManager">
|
||||
</bean>
|
||||
|
||||
<bean id="modelsoundingDecoder"
|
||||
class="com.raytheon.edex.plugin.modelsounding.ModelSoundingDecoder"
|
||||
init-method="start"
|
||||
destroy-method="shutdown">
|
||||
<property name="modelSoundingPersistenceManager" ref="modelsoundingPersistenceManager" />
|
||||
</bean>
|
||||
|
||||
<!-- Filter down sounding data -->
|
||||
<!-- bean id="mdlsndgFilter" class="com.raytheon.uf.edex.decodertools.core.filterimpl.PluginDataObjectFilter">
|
||||
<constructor-arg type="java.lang.String" value="modelSounding_filters.xml" />
|
||||
|
@ -30,6 +34,7 @@
|
|||
xmlns="http://camel.apache.org/schema/spring"
|
||||
errorHandlerRef="errorHandler"
|
||||
autoStartup="false">
|
||||
|
||||
<!--
|
||||
<endpoint id="modelsndgFileEndpoint"
|
||||
uri="file:${edex.home}/data/sbn/mdlsndg?noop=true&idempotent=false" />
|
||||
|
@ -53,19 +58,9 @@
|
|||
<doTry>
|
||||
<pipeline>
|
||||
<bean ref="stringToFile" />
|
||||
<split streaming="true">
|
||||
<method bean="mdlsndgSeparator" method="getSeparator"/>
|
||||
<doTry>
|
||||
<pipeline>
|
||||
<bean ref="modelsoundingDecoder" method="decode"/>
|
||||
<to uri="direct-vm:persistIndexAlert" />
|
||||
</pipeline>
|
||||
<doCatch>
|
||||
<exception>java.lang.Throwable</exception>
|
||||
<to uri="log:modelsounding?level=ERROR"/>
|
||||
</doCatch>
|
||||
</doTry>
|
||||
</split>
|
||||
<bean ref="modelsoundingDecoder" method="decode"/>
|
||||
<!-- model sounding decoder has dedicated store thread, only need to forward to log -->
|
||||
<bean ref="processUtil" method="log"/>
|
||||
</pipeline>
|
||||
<doCatch>
|
||||
<exception>java.lang.Throwable</exception>
|
||||
|
@ -73,5 +68,14 @@
|
|||
</doCatch>
|
||||
</doTry>
|
||||
</route>
|
||||
|
||||
<!-- Copy of persist route without the log call -->
|
||||
<route id="modelSoundingPersistIndexAlert">
|
||||
<from uri="direct-vm:modelSoundingPersistIndexAlert"/>
|
||||
<bean ref="persist" method="persist"/>
|
||||
<bean ref="index" method="index"/>
|
||||
<bean ref="toDataURI" method="toDataURI"/>
|
||||
<to uri="vm:stageNotification"/>
|
||||
</route>
|
||||
</camelContext>
|
||||
</beans>
|
||||
</beans>
|
||||
|
|
|
@ -20,15 +20,12 @@
|
|||
package com.raytheon.edex.plugin.modelsounding;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import java.util.Set;
|
||||
|
||||
import com.raytheon.edex.esb.Headers;
|
||||
import com.raytheon.edex.exception.DecoderException;
|
||||
|
@ -39,6 +36,9 @@ import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
|||
import com.raytheon.uf.common.dataplugin.PluginException;
|
||||
import com.raytheon.uf.common.pointdata.PointDataContainer;
|
||||
import com.raytheon.uf.common.pointdata.PointDataDescription;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.edex.decodertools.bufr.BUFRDataDocument;
|
||||
import com.raytheon.uf.edex.decodertools.bufr.BUFRDocument;
|
||||
import com.raytheon.uf.edex.decodertools.bufr.BUFRFile;
|
||||
|
@ -69,6 +69,11 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader;
|
|||
* by forecast hour and reftime when completing
|
||||
* a decode operation. Overrode default
|
||||
* Point Data Container size.
|
||||
* 07/16/13 #2161 bkowal Store the records in a container that will
|
||||
* be persisted every X (configurable) seconds
|
||||
* by a timer. The timer is started during spring
|
||||
* initialization and destroyed during spring
|
||||
* container destruction.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -86,7 +91,8 @@ public class ModelSoundingDecoder extends AbstractDecoder implements
|
|||
private static final int PDC_SIZE = 20;
|
||||
|
||||
/** The logger */
|
||||
private Log logger = LogFactory.getLog(getClass());
|
||||
private final IUFStatusHandler logger = UFStatus
|
||||
.getHandler(ModelSoundingDecoder.class);
|
||||
|
||||
private PointDataDescription pdd;
|
||||
|
||||
|
@ -96,6 +102,8 @@ public class ModelSoundingDecoder extends AbstractDecoder implements
|
|||
|
||||
private IDescriptorFactoryDelegate delegate;
|
||||
|
||||
private ModelSoundingPersistenceManager modelSoundingPersistenceManager;
|
||||
|
||||
/**
|
||||
* Construct a ProfilerDecoder instance.
|
||||
*/
|
||||
|
@ -114,6 +122,14 @@ public class ModelSoundingDecoder extends AbstractDecoder implements
|
|||
}
|
||||
}
|
||||
|
||||
public void start() {
|
||||
this.modelSoundingPersistenceManager.start();
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
this.modelSoundingPersistenceManager.shutdown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get one entry from the separator and interpret that data as a single
|
||||
* profiler observation.
|
||||
|
@ -132,10 +148,11 @@ public class ModelSoundingDecoder extends AbstractDecoder implements
|
|||
return new PluginDataObject[0];
|
||||
}
|
||||
|
||||
PluginDataObject[] decodedData = null;
|
||||
if (logger.isPriorityEnabled(Priority.DEBUG)) {
|
||||
logger.debug(traceId + "- Starting decode process");
|
||||
}
|
||||
|
||||
logger.debug(traceId + "- Starting decode process");
|
||||
if (data != null && data.length > 0) {
|
||||
if ((data != null) && (data.length > 0)) {
|
||||
|
||||
WMOHeader wmoHeader = new WMOHeader(data, headers);
|
||||
|
||||
|
@ -157,9 +174,7 @@ public class ModelSoundingDecoder extends AbstractDecoder implements
|
|||
messageData = null;
|
||||
|
||||
Iterator<BUFRDataDocument> iterator = document.iterator();
|
||||
List<SoundingSite> pdoList = new ArrayList<SoundingSite>();
|
||||
|
||||
Map<SoundingTemporalData, PointDataContainer> pdcTemporalMap = new HashMap<SoundingTemporalData, PointDataContainer>();
|
||||
Map<String, ModelSoundingStorageContainer> containerMap = new HashMap<String, ModelSoundingStorageContainer>();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
BUFRDataDocument dataDoc = iterator.next();
|
||||
|
@ -167,29 +182,41 @@ public class ModelSoundingDecoder extends AbstractDecoder implements
|
|||
continue;
|
||||
}
|
||||
|
||||
SoundingTemporalData soundingTemporalData = ModelSoundingDataAdapter
|
||||
.getSoundingTemporalInformation(dataDoc);
|
||||
SoundingModelTemporalData soundingTemporalData = ModelSoundingDataAdapter
|
||||
.getSoundingTemporalInformation(dataDoc,
|
||||
wmoHeader);
|
||||
|
||||
PointDataContainer container = pdcTemporalMap
|
||||
.get(soundingTemporalData);
|
||||
String pdcKey = (soundingTemporalData == null) ? " NULL"
|
||||
: soundingTemporalData.toString();
|
||||
ModelSoundingStorageContainer container = containerMap
|
||||
.get(pdcKey);
|
||||
if (container == null) {
|
||||
container = PointDataContainer.build(pdd, PDC_SIZE);
|
||||
pdcTemporalMap.put(soundingTemporalData, container);
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Added Point Data Container to Map with: "
|
||||
+ ((soundingTemporalData == null) ? " NULL"
|
||||
: soundingTemporalData
|
||||
.toString()));
|
||||
// haven't yet decoded a sounding for the given
|
||||
// refTime/forecasthour, check the persistence
|
||||
// manager for one from a previous decode
|
||||
container = modelSoundingPersistenceManager
|
||||
.checkOut(pdcKey);
|
||||
|
||||
if (container == null) {
|
||||
if (logger.isPriorityEnabled(Priority.DEBUG)) {
|
||||
logger.debug("Creating new Point Data Container: "
|
||||
+ pdcKey);
|
||||
}
|
||||
|
||||
container = new ModelSoundingStorageContainer(
|
||||
PointDataContainer.build(pdd, PDC_SIZE));
|
||||
} else if (logger.isPriorityEnabled(Priority.DEBUG)) {
|
||||
logger.debug("Reusing Point Data Container: "
|
||||
+ pdcKey);
|
||||
}
|
||||
} else if (logger.isDebugEnabled()) {
|
||||
logger.debug("Retrieved Point Data Container from Map with: "
|
||||
+ ((soundingTemporalData == null) ? " NULL"
|
||||
: soundingTemporalData.toString()));
|
||||
|
||||
containerMap.put(pdcKey, container);
|
||||
}
|
||||
|
||||
PointDataContainer pdc = container.getPdc();
|
||||
SoundingSite soundingData = ModelSoundingDataAdapter
|
||||
.createSoundingData(dataDoc, wmoHeader,
|
||||
container, soundingTemporalData);
|
||||
.createSoundingData(dataDoc, wmoHeader, pdc,
|
||||
soundingTemporalData);
|
||||
if (soundingData != null) {
|
||||
soundingData.setTraceId(traceId);
|
||||
soundingData.setPluginName(PLUGIN_NAME);
|
||||
|
@ -201,30 +228,31 @@ public class ModelSoundingDecoder extends AbstractDecoder implements
|
|||
}
|
||||
String uri = soundingData.getDataURI();
|
||||
if (dataSet.add(uri)) {
|
||||
pdoList.add(soundingData);
|
||||
container.addPdo(soundingData);
|
||||
}
|
||||
}
|
||||
}
|
||||
decodedData = pdoList.toArray(new PluginDataObject[pdoList
|
||||
.size()]);
|
||||
|
||||
for (Map.Entry<String, ModelSoundingStorageContainer> entry : containerMap
|
||||
.entrySet()) {
|
||||
modelSoundingPersistenceManager.checkIn(entry.getKey(),
|
||||
entry.getValue());
|
||||
}
|
||||
} catch (Exception ee) {
|
||||
logger.error(traceId + "- Decoder error", ee);
|
||||
} finally {
|
||||
if (decodedData == null) {
|
||||
decodedData = new PluginDataObject[0];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logger.error(traceId + "- Missing or invalid WMOHeader");
|
||||
decodedData = new PluginDataObject[0];
|
||||
}
|
||||
} else {
|
||||
logger.info(traceId + "- No data in file");
|
||||
decodedData = new PluginDataObject[0];
|
||||
}
|
||||
logger.debug(traceId + "- ModelSounding decode complete");
|
||||
|
||||
return decodedData;
|
||||
if (logger.isPriorityEnabled(Priority.DEBUG)) {
|
||||
logger.debug(traceId + "- ModelSounding decode complete");
|
||||
}
|
||||
|
||||
return new PluginDataObject[0];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -272,4 +300,13 @@ public class ModelSoundingDecoder extends AbstractDecoder implements
|
|||
return "DEFAULT";
|
||||
}
|
||||
|
||||
public ModelSoundingPersistenceManager getModelSoundingPersistenceManager() {
|
||||
return modelSoundingPersistenceManager;
|
||||
}
|
||||
|
||||
public void setModelSoundingPersistenceManager(
|
||||
ModelSoundingPersistenceManager modelSoundingPersistenceManager) {
|
||||
this.modelSoundingPersistenceManager = modelSoundingPersistenceManager;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,178 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.edex.plugin.modelsounding;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.edex.core.EDEXUtil;
|
||||
import com.raytheon.uf.edex.core.EdexException;
|
||||
|
||||
/**
|
||||
* Thread for storing Model Soundings asynchronously. If decode thread decodes
|
||||
* more data for an hdf5 record that hasn't been stored yet it will allow
|
||||
* appending to the pending store.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 17, 2013 2161 bkowal Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bkowal
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class ModelSoundingPersistenceManager extends Thread {
|
||||
/** The logger */
|
||||
private final IUFStatusHandler logger = UFStatus
|
||||
.getHandler(ModelSoundingPersistenceManager.class);
|
||||
|
||||
private final LinkedHashMap<String, ModelSoundingStorageContainer> containerMap;
|
||||
|
||||
private final AtomicBoolean run = new AtomicBoolean(true);
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public ModelSoundingPersistenceManager() {
|
||||
super("ModelSoundingStore");
|
||||
this.containerMap = new LinkedHashMap<String, ModelSoundingStorageContainer>(
|
||||
64, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
boolean keepStoring = true;
|
||||
while (keepStoring) {
|
||||
try {
|
||||
ModelSoundingStorageContainer container = null;
|
||||
synchronized (containerMap) {
|
||||
while (containerMap.isEmpty() && this.run.get()) {
|
||||
try {
|
||||
containerMap.wait();
|
||||
} catch (InterruptedException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
Iterator<String> iter = containerMap.keySet().iterator();
|
||||
if (iter.hasNext()) {
|
||||
// remove first entry and process
|
||||
String key = iter.next();
|
||||
container = containerMap.remove(key);
|
||||
if (logger.isPriorityEnabled(Priority.DEBUG)) {
|
||||
logger.debug("Persisting "
|
||||
+ container.getPdos().size()
|
||||
+ " PluginDataObject(s) for : " + key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (container != null) {
|
||||
List<PluginDataObject> pdoList = container.getPdos();
|
||||
PluginDataObject[] pdos = pdoList
|
||||
.toArray(new PluginDataObject[pdoList.size()]);
|
||||
try {
|
||||
EDEXUtil.getMessageProducer().sendSync(
|
||||
"modelSoundingPersistIndexAlert", pdos);
|
||||
} catch (EdexException e) {
|
||||
logger.error("Failed to persist " + pdos.length
|
||||
+ " PluginDataObject(s)!", e);
|
||||
}
|
||||
} else if (!this.run.get()) {
|
||||
// received shutdown flag
|
||||
keepStoring = false;
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
// fail safe so store thread doesn't fail
|
||||
logger.error(
|
||||
"Caught unknown exception on modelsounding store thread",
|
||||
e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checking in a model sounding container makes it available for the store
|
||||
* thread to store. A decode thread can check out the model sounding
|
||||
* container for appending more data to if the store thread has not yet
|
||||
* stored the container.
|
||||
*
|
||||
* @param persistRecordKey
|
||||
* @param container
|
||||
* @return
|
||||
*/
|
||||
public boolean checkIn(String persistRecordKey,
|
||||
ModelSoundingStorageContainer container) {
|
||||
boolean rval = run.get();
|
||||
synchronized (containerMap) {
|
||||
if (rval) {
|
||||
ModelSoundingStorageContainer prev = containerMap.put(
|
||||
persistRecordKey, container);
|
||||
if (prev != null) {
|
||||
// technically only possible in an environment where there
|
||||
// are multiple decode threads running, just append the
|
||||
// pdo's from the first, their pdc will not be used again
|
||||
if (logger.isPriorityEnabled(Priority.DEBUG)) {
|
||||
logger.debug("PDC for time already exists, appending previous PDC data");
|
||||
}
|
||||
|
||||
container.addPdos(prev.getPdos());
|
||||
}
|
||||
containerMap.notify();
|
||||
}
|
||||
}
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks out a sounding container if one is pending store. This allows a
|
||||
* decode thread to append more data to the store if the writing thread has
|
||||
* not yet gotten to the data.
|
||||
*
|
||||
* @param persistRecordKey
|
||||
* @return
|
||||
*/
|
||||
public ModelSoundingStorageContainer checkOut(String persistRecordKey) {
|
||||
synchronized (containerMap) {
|
||||
return containerMap.remove(persistRecordKey);
|
||||
}
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
run.set(false);
|
||||
|
||||
synchronized (containerMap) {
|
||||
containerMap.notify();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.edex.plugin.modelsounding;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.pointdata.PointDataContainer;
|
||||
|
||||
/**
|
||||
* Associates a PointDataContainer with a list of plugin data objects.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 15, 2013 2161 bkowal Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bkowal
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class ModelSoundingStorageContainer {
|
||||
private final PointDataContainer pdc;
|
||||
|
||||
private final List<PluginDataObject> pdos;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public ModelSoundingStorageContainer(PointDataContainer pdc) {
|
||||
this.pdos = new LinkedList<PluginDataObject>();
|
||||
this.pdc = pdc;
|
||||
}
|
||||
|
||||
public PointDataContainer getPdc() {
|
||||
return pdc;
|
||||
}
|
||||
|
||||
public List<PluginDataObject> getPdos() {
|
||||
return pdos;
|
||||
}
|
||||
|
||||
public void addPdo(PluginDataObject pdo) {
|
||||
this.pdos.add(pdo);
|
||||
}
|
||||
|
||||
public void addPdos(List<PluginDataObject> pdos) {
|
||||
this.pdos.addAll(pdos);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,127 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.edex.plugin.modelsounding;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
import com.raytheon.edex.plugin.modelsounding.common.SoundingModels;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
|
||||
/**
|
||||
* Stores temporal information associated with sounding data.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 3, 2013 2161 bkowal Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bkowal
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class SoundingModelTemporalData {
|
||||
private Calendar obsTime;
|
||||
|
||||
private DataTime dt;
|
||||
|
||||
private long refTime;
|
||||
|
||||
private long validTime;
|
||||
|
||||
private int forecastHr;
|
||||
|
||||
private SoundingModels model;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public SoundingModelTemporalData() {
|
||||
this.obsTime = null;
|
||||
this.dt = null;
|
||||
this.refTime = -1L;
|
||||
this.validTime = -1L;
|
||||
this.forecastHr = -1;
|
||||
}
|
||||
|
||||
public Calendar getObsTime() {
|
||||
return obsTime;
|
||||
}
|
||||
|
||||
public void setObsTime(Calendar obsTime) {
|
||||
this.obsTime = obsTime;
|
||||
}
|
||||
|
||||
public DataTime getDt() {
|
||||
return dt;
|
||||
}
|
||||
|
||||
public void setDt(DataTime dt) {
|
||||
this.dt = dt;
|
||||
}
|
||||
|
||||
public long getRefTime() {
|
||||
return refTime;
|
||||
}
|
||||
|
||||
public void setRefTime(long refTime) {
|
||||
this.refTime = refTime;
|
||||
}
|
||||
|
||||
public long getValidTime() {
|
||||
return validTime;
|
||||
}
|
||||
|
||||
public void setValidTime(long validTime) {
|
||||
this.validTime = validTime;
|
||||
}
|
||||
|
||||
public int getForecastHr() {
|
||||
return forecastHr;
|
||||
}
|
||||
|
||||
public void setForecastHr(int forecastHr) {
|
||||
this.forecastHr = forecastHr;
|
||||
}
|
||||
|
||||
public SoundingModels getModel() {
|
||||
return model;
|
||||
}
|
||||
|
||||
public void setModel(SoundingModels model) {
|
||||
this.model = model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder stringBuilder = new StringBuilder(40);
|
||||
stringBuilder.append("model = ").append(model.getReportType());
|
||||
stringBuilder.append(", refTime = ");
|
||||
stringBuilder.append(this.refTime);
|
||||
stringBuilder.append(", forecastHr = ");
|
||||
stringBuilder.append(this.forecastHr);
|
||||
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
}
|
|
@ -28,7 +28,7 @@ import java.util.List;
|
|||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.raytheon.edex.plugin.modelsounding.SoundingTemporalData;
|
||||
import com.raytheon.edex.plugin.modelsounding.SoundingModelTemporalData;
|
||||
import com.raytheon.edex.plugin.modelsounding.common.SoundingModels;
|
||||
import com.raytheon.edex.plugin.modelsounding.common.SoundingSite;
|
||||
import com.raytheon.uf.common.geospatial.spi.SPIContainer;
|
||||
|
@ -119,8 +119,15 @@ public class ModelSoundingDataAdapter {
|
|||
}
|
||||
}
|
||||
|
||||
public static SoundingTemporalData getSoundingTemporalInformation(
|
||||
BUFRDataDocument dataDoc) {
|
||||
/**
|
||||
* Get the temporal and model information.
|
||||
*
|
||||
* @param dataDoc
|
||||
* @param wmoHeader
|
||||
* @return
|
||||
*/
|
||||
public static SoundingModelTemporalData getSoundingTemporalInformation(
|
||||
BUFRDataDocument dataDoc, WMOHeader wmoHeader) {
|
||||
Calendar obsTime = dataDoc.getEnclosingDocument().getSection1()
|
||||
.getSectionDate();
|
||||
if (obsTime == null) {
|
||||
|
@ -138,7 +145,7 @@ public class ModelSoundingDataAdapter {
|
|||
.longValue() : null;
|
||||
}
|
||||
|
||||
SoundingTemporalData soundingTemporalData = new SoundingTemporalData();
|
||||
SoundingModelTemporalData soundingTemporalData = new SoundingModelTemporalData();
|
||||
soundingTemporalData.setObsTime(obsTime);
|
||||
|
||||
DataTime dt = new DataTime(obsTime, forecastSeconds.intValue());
|
||||
|
@ -152,6 +159,9 @@ public class ModelSoundingDataAdapter {
|
|||
|
||||
soundingTemporalData.setForecastHr((int) (forecastSeconds / 3600));
|
||||
|
||||
soundingTemporalData.setModel(SoundingModels.getModel(wmoHeader
|
||||
.getCccc()));
|
||||
|
||||
return soundingTemporalData;
|
||||
}
|
||||
|
||||
|
@ -167,14 +177,13 @@ public class ModelSoundingDataAdapter {
|
|||
*/
|
||||
public static SoundingSite createSoundingData(BUFRDataDocument dataDoc,
|
||||
WMOHeader wmoHeader, PointDataContainer container,
|
||||
SoundingTemporalData soundingTemporalData) {
|
||||
SoundingModelTemporalData soundingTemporalData) {
|
||||
|
||||
SoundingSite obsData = null;
|
||||
|
||||
synchronized (LOCK) {
|
||||
try {
|
||||
SoundingModels model = SoundingModels.getModel(wmoHeader
|
||||
.getCccc());
|
||||
SoundingModels model = soundingTemporalData.getModel();
|
||||
// Get the primary data list.
|
||||
List<IBUFRDataPacket> dataList = dataDoc.getList();
|
||||
// Extract the header data.
|
||||
|
|
|
@ -47,6 +47,7 @@ import com.raytheon.uf.common.util.ReflectionUtil;
|
|||
* and moved reflective calls to the
|
||||
* mapping population method. Map now
|
||||
* contains factory objects.
|
||||
* Jul 19, 2013 DR 16401 D. Friedman Fix end-of-product block decoding.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -99,8 +100,11 @@ public class RedbookBlockBuilder {
|
|||
byte rawMode = dataBuffer.get();
|
||||
byte rawSubMode = dataBuffer.get();
|
||||
|
||||
// Must have at least MIN_REMAINING
|
||||
if (dataBuffer.remaining() >= MIN_REMAINING) {
|
||||
/* Must have at least MIN_REMAINING,
|
||||
* but allow the the end-of-product block (mode=1,sub=2)
|
||||
*/
|
||||
if (dataBuffer.remaining() >= MIN_REMAINING ||
|
||||
(rawMode == 1 && rawSubMode == 2)) {
|
||||
header = new RedbookBlockHeader(rawHdr, rawMode, rawSubMode);
|
||||
} else {
|
||||
header = RedbookBlockHeader.DEFAULT;
|
||||
|
|
|
@ -88,6 +88,8 @@ public class AlertalarmStdTextProductUtil {
|
|||
setCurrentReportfile();
|
||||
|
||||
reportAlarm();
|
||||
|
||||
System.exit(reportWriter.getAlarmCount());
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -230,7 +232,7 @@ public class AlertalarmStdTextProductUtil {
|
|||
if (alarmCount > 0) {
|
||||
log.info(alarmCount + " alarms reported, report written to "
|
||||
+ reportWriter.getFilename());
|
||||
saveReportTotextDb();
|
||||
//saveReportTotextDb();
|
||||
} else {
|
||||
log.info("No alarms reported, info sent to "
|
||||
+ reportWriter.getFilename());
|
||||
|
|
|
@ -27,6 +27,7 @@ import java.io.FileNotFoundException;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
@ -63,6 +64,7 @@ import com.raytheon.uf.edex.decodertools.core.filterimpl.PluginDataObjectFilter;
|
|||
* ---------- ------- -------- --------------------------
|
||||
* 1/10/2013 15497 wkwock Initial creation
|
||||
* 2/13/2013 1584 mpduff Fix creation of "dummy" config.
|
||||
* 08/08/2013 16408 wkwock Use different metar.cfg file and options
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -167,16 +169,13 @@ public class MetarToShefFilter {
|
|||
}
|
||||
}
|
||||
|
||||
private PluginDataObject[] filterARun(PluginDataObject[] reports,
|
||||
private PluginDataObject filterARun(PluginDataObject report,
|
||||
List<AbstractFilterElement> filterElements) {
|
||||
int reportCount = 0;
|
||||
if (reports != null) {
|
||||
|
||||
for (int i = 0; i < reports.length; i++) {
|
||||
PluginDataObject r = null;
|
||||
boolean keep = true;
|
||||
for (AbstractFilterElement element : filterElements) {
|
||||
r = element.filter(reports[i]);
|
||||
if (report != null) {
|
||||
PluginDataObject r = null;
|
||||
boolean keep = true;
|
||||
for (AbstractFilterElement element : filterElements) {
|
||||
r = element.filter(report);
|
||||
|
||||
// Only allow keep to be set to true. Once true it stays
|
||||
// that way.
|
||||
|
@ -200,26 +199,12 @@ public class MetarToShefFilter {
|
|||
}
|
||||
}
|
||||
if (keep) {
|
||||
reportCount++;
|
||||
report = r;
|
||||
} else {
|
||||
reports[i] = null;
|
||||
report = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (reportCount == 0) {
|
||||
reports = new PluginDataObject[0];
|
||||
} else {
|
||||
PluginDataObject[] newReports = new PluginDataObject[reportCount];
|
||||
int i = 0;
|
||||
// Copy in the reports that passed filtering.
|
||||
for (PluginDataObject report : reports) {
|
||||
if (report != null) {
|
||||
newReports[i++] = report;
|
||||
}
|
||||
}
|
||||
reports = newReports;
|
||||
}
|
||||
return reports;
|
||||
return report;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -228,19 +213,20 @@ public class MetarToShefFilter {
|
|||
*/
|
||||
// @Override
|
||||
public PluginDataObject[] filter(PluginDataObject[] reports) {
|
||||
PluginDataObject[] resultRpt = null;
|
||||
for (MetarToShefRun mtsr : metarToShefRun) {
|
||||
PluginDataObject[] tmpRprts = reports.clone();
|
||||
resultRpt = filterARun(tmpRprts, mtsr.getFilterElements());
|
||||
if (resultRpt != null && resultRpt.length >= 1) {
|
||||
logger.info("Report matchs in filter " + mtsr.getFilterName());
|
||||
MetarToShefTransformer.setCfgNOption(mtsr.getConfigFileName(),
|
||||
mtsr.getMetarToShefOptions());
|
||||
break;
|
||||
HashMap<String,MetarToShefRun> matchList = new HashMap<String,MetarToShefRun>();
|
||||
ArrayList<PluginDataObject> reportList = new ArrayList<PluginDataObject> ();
|
||||
for (PluginDataObject report : reports) {
|
||||
for (MetarToShefRun mtsr : metarToShefRun) {
|
||||
PluginDataObject resultRpt = filterARun(report, mtsr.getFilterElements());
|
||||
if (resultRpt != null ) {
|
||||
reportList.add(resultRpt);
|
||||
matchList.put(resultRpt.getDataURI(), mtsr);
|
||||
MetarToShefTransformer.setMatchList (matchList);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return resultRpt;
|
||||
return (PluginDataObject[])reportList.toArray(new PluginDataObject[reportList.size()]);
|
||||
}
|
||||
|
||||
private void createDummyFilter() {
|
||||
|
|
|
@ -22,6 +22,7 @@ package com.raytheon.edex.transform.shef;
|
|||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.TimeZone;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
@ -51,6 +52,7 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader;
|
|||
* AWIPS2 DR Work
|
||||
* 20120918 1185 jkorman Added save to archive capability.
|
||||
* Jan 30, 2010 15779 lbousaidi added 4 letter to station id for ACR
|
||||
* Aug 08, 2013 16408 wkwock Use different metar.cfg file and options
|
||||
* </pre>
|
||||
*
|
||||
* @author jkorman
|
||||
|
@ -81,10 +83,23 @@ public class MetarToShefTransformer extends
|
|||
private static final int P1_MIN = 50;
|
||||
private static final int P2_MAX = 5;
|
||||
|
||||
private static String cfgFileName="metar.cfg";
|
||||
private static String cmdLnOptions="";
|
||||
private static boolean refreshOptions=true;
|
||||
/*
|
||||
* Max list for optionsList and matchList to prevent memory leak.
|
||||
* (500 or any big number should be fine)
|
||||
*/
|
||||
private static final int MAX_LIST = 500;
|
||||
|
||||
/*
|
||||
* MetarToShefRun list which has metar.cfg file and options to used by conversion
|
||||
*/
|
||||
private static HashMap<String,MetarToShefRun> mtsrList = new HashMap<String,MetarToShefRun>();
|
||||
|
||||
/*
|
||||
* List of metar.cfg files + options.
|
||||
*/
|
||||
private HashMap<String,ObsToSHEFOptions> optionsList = new HashMap<String,ObsToSHEFOptions>();
|
||||
private ObsToSHEFOptions defaultOptions =null;
|
||||
|
||||
/**
|
||||
* Construct an instance of this transformer.
|
||||
* @param cmdLine Command line options that may be used if these
|
||||
|
@ -92,6 +107,7 @@ public class MetarToShefTransformer extends
|
|||
*/
|
||||
public MetarToShefTransformer(String cmdLine) {
|
||||
super(cmdLine, WMO_HEADER_FMT);
|
||||
defaultOptions = options;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -421,21 +437,38 @@ public class MetarToShefTransformer extends
|
|||
|
||||
public final byte[] transformMetar(MetarRecord report, Headers headers)
|
||||
throws TransformerException {
|
||||
if (refreshOptions) {
|
||||
logger.info("Metar to SHEF now use config file: "+cfgFileName+" with options:"+cmdLnOptions);
|
||||
options.setCfgFileName(cfgFileName);
|
||||
options.updateCommandLine(cmdLnOptions);
|
||||
options.updateOptions();
|
||||
refreshOptions=false;
|
||||
ObsToSHEFOptions tmpOptions=null;
|
||||
MetarToShefRun mtsr = mtsrList.get(report.getDataURI());
|
||||
if (mtsr==null) {
|
||||
tmpOptions = defaultOptions;
|
||||
} else {
|
||||
tmpOptions = optionsList.get(mtsr.getConfigFileName()+mtsr.getMetarToShefOptions());
|
||||
if (tmpOptions==null) {
|
||||
//just to prevent t memory leak
|
||||
if (optionsList.size()>MAX_LIST) {
|
||||
optionsList.clear();
|
||||
}
|
||||
tmpOptions = new ObsToSHEFOptions(mtsr.getConfigFileName(),mtsr.getMetarToShefOptions(),true);
|
||||
optionsList.put(mtsr.getConfigFileName()+mtsr.getMetarToShefOptions(), tmpOptions);
|
||||
}
|
||||
mtsrList.remove(report.getDataURI());
|
||||
}
|
||||
options=tmpOptions;
|
||||
logger.info("Metar to SHEF for "+report.getStationId()+" use config file: "+options.getCfgFileName()+" with options:"+mtsr.getMetarToShefOptions());
|
||||
configureArchiveDir();
|
||||
|
||||
return transformReport(report, headers);
|
||||
}
|
||||
|
||||
public static void setCfgNOption (String cfg, String options){
|
||||
cfgFileName=cfg;
|
||||
cmdLnOptions=options;
|
||||
refreshOptions=true;
|
||||
/*
|
||||
* set matchList
|
||||
*/
|
||||
public static void setMatchList (HashMap<String,MetarToShefRun> matchLst) {
|
||||
//should add to the list and remove after use. clear if reach certain big number
|
||||
if (mtsrList.size()>MAX_LIST) {
|
||||
mtsrList.clear();
|
||||
}
|
||||
|
||||
mtsrList.putAll(matchLst);
|
||||
}
|
||||
}
|
|
@ -57,7 +57,8 @@ import com.raytheon.uf.common.localization.PathManagerFactory;
|
|||
* May 24, 2010 jkorman Initial creation
|
||||
* ======================================
|
||||
* AWIPS2 DR Work
|
||||
* 20120918 1185 jkorman Added save to archive capability.
|
||||
* 20120918 1185 jkorman Added save to archive capability.
|
||||
* Aug 08, 2013 16408 wkwock Added get configuration file name function
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -66,9 +67,6 @@ import com.raytheon.uf.common.localization.PathManagerFactory;
|
|||
*/
|
||||
|
||||
public class ObsToSHEFOptions {
|
||||
// 1 minute update delta.
|
||||
private static final long UPDATE_DELTA = 60L * 1000L;
|
||||
|
||||
private static final String METAR_CFG = "metar.cfg";
|
||||
|
||||
private static final String ERROR_1_FMT = "Could not create {%s} context for file \"%s\"";
|
||||
|
@ -399,8 +397,6 @@ public class ObsToSHEFOptions {
|
|||
|
||||
private final boolean localized;
|
||||
|
||||
private long updateTime = 0;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param cmdLine
|
||||
|
@ -414,7 +410,20 @@ public class ObsToSHEFOptions {
|
|||
} else {
|
||||
readConfig(cfgFileName, optConfigContext);
|
||||
}
|
||||
updateTime = System.currentTimeMillis();
|
||||
}
|
||||
localized = useLocalized;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param cmdLine
|
||||
*/
|
||||
public ObsToSHEFOptions(String configFileName, String cmdLine, boolean useLocalized) {
|
||||
cfgFileName = configFileName;
|
||||
initOptions();
|
||||
parseCommandLine(cmdLine);
|
||||
if (useLocalized) {
|
||||
readConfig(cfgFileName, optConfigContext);
|
||||
}
|
||||
localized = useLocalized;
|
||||
}
|
||||
|
@ -845,15 +854,11 @@ public class ObsToSHEFOptions {
|
|||
* Check if the metar.cfg needs to be reread.
|
||||
*/
|
||||
public void updateOptions() {
|
||||
long cTime = System.currentTimeMillis() - updateTime;
|
||||
if (cTime > UPDATE_DELTA) {
|
||||
if (loaded && localized) {
|
||||
if (cfgFileName==null) {
|
||||
readConfig(METAR_CFG, optConfigContext);
|
||||
} else {
|
||||
readConfig(cfgFileName, optConfigContext);
|
||||
}
|
||||
updateTime = System.currentTimeMillis();
|
||||
if (loaded && localized) {
|
||||
if (cfgFileName==null) {
|
||||
readConfig(METAR_CFG, optConfigContext);
|
||||
} else {
|
||||
readConfig(cfgFileName, optConfigContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -888,6 +893,8 @@ public class ObsToSHEFOptions {
|
|||
}else{
|
||||
readConfig(cfgFileName, optConfigContext);
|
||||
}
|
||||
} else {
|
||||
logger.warn("Uanble to read file "+cfgFileName);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -990,6 +997,10 @@ public class ObsToSHEFOptions {
|
|||
cfgFileName=fileName;
|
||||
}
|
||||
|
||||
public String getCfgFileName () {
|
||||
return cfgFileName;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
|
|
@ -28,6 +28,8 @@ import java.util.TreeMap;
|
|||
|
||||
import javax.persistence.Transient;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.ffmp.collections.ArrayBackedMap;
|
||||
import com.raytheon.uf.common.dataplugin.ffmp.collections.BasinMapFactory;
|
||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
|
@ -48,6 +50,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
* TreeMap creation to the tertiary loader.
|
||||
* Apr 26, 2013 1954 bsteffen Minor code cleanup throughout FFMP.
|
||||
* Jul 15, 2013 2184 dhladky Remove all HUC's for storage except ALL
|
||||
* Jul 31, 2013 2242 bsteffen Optimize FFMP NavigableMap memory.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -71,6 +74,13 @@ public class FFMPBasin implements ISerializableObject, Cloneable {
|
|||
@Transient
|
||||
protected NavigableMap<Date, Float> values;
|
||||
|
||||
/**
|
||||
* Set to either the values map or the BasinMapFactory that was used to
|
||||
* create it to enable correct synchronization.
|
||||
*/
|
||||
@Transient
|
||||
protected Object valuesSynchronization;
|
||||
|
||||
/** object used for serialization **/
|
||||
@DynamicSerializeElement
|
||||
public float[] serializedValues;
|
||||
|
@ -172,9 +182,9 @@ public class FFMPBasin implements ISerializableObject, Cloneable {
|
|||
Date prevDate = null;
|
||||
|
||||
// map ordered newest first, so grab from newest date to oldest date
|
||||
if (afterDate.before(beforeDate) && (values.size() > 0)) {
|
||||
if (afterDate.before(beforeDate) && (!values.isEmpty())) {
|
||||
|
||||
synchronized (values) {
|
||||
synchronized (valuesSynchronization) {
|
||||
|
||||
float factor = 0.0f;
|
||||
|
||||
|
@ -226,7 +236,7 @@ public class FFMPBasin implements ISerializableObject, Cloneable {
|
|||
*/
|
||||
public Float getValue(Date afterDate, Date beforeDate) {
|
||||
Float val = 0.0f;
|
||||
synchronized (values) {
|
||||
synchronized (valuesSynchronization) {
|
||||
Date checkDate = values.ceilingKey(afterDate);
|
||||
if ((checkDate != null) && checkDate.before(beforeDate)) {
|
||||
val = values.get(checkDate);
|
||||
|
@ -260,7 +270,7 @@ public class FFMPBasin implements ISerializableObject, Cloneable {
|
|||
Float val = 0.0f;
|
||||
int i = 0;
|
||||
|
||||
synchronized (values) {
|
||||
synchronized (valuesSynchronization) {
|
||||
|
||||
for (Date date : values.keySet()) {
|
||||
if (date.before(beforeDate) && date.after(afterDate)) {
|
||||
|
@ -290,7 +300,7 @@ public class FFMPBasin implements ISerializableObject, Cloneable {
|
|||
public Float getMaxValue(Date afterDate, Date beforeDate) {
|
||||
Float val = 0.0f;
|
||||
|
||||
synchronized (values) {
|
||||
synchronized (valuesSynchronization) {
|
||||
|
||||
for (Date date : values.keySet()) {
|
||||
if (date.before(beforeDate) && date.after(afterDate)) {
|
||||
|
@ -312,13 +322,7 @@ public class FFMPBasin implements ISerializableObject, Cloneable {
|
|||
* @param value
|
||||
*/
|
||||
public void setValue(Date date, Float dvalue) {
|
||||
synchronized (values) {
|
||||
if (!(values instanceof TreeMap) && !values.containsKey(dvalue)) {
|
||||
// ArrayBackedMap may have been used if this basin was
|
||||
// deserialized. It is much faster to do inserts on a TreeMap so
|
||||
// convert now.
|
||||
values = new TreeMap<Date, Float>(values);
|
||||
}
|
||||
synchronized (valuesSynchronization) {
|
||||
values.put(date, dvalue);
|
||||
}
|
||||
}
|
||||
|
@ -339,6 +343,7 @@ public class FFMPBasin implements ISerializableObject, Cloneable {
|
|||
*/
|
||||
public void setValues(TreeMap<Date, Float> values) {
|
||||
this.values = values;
|
||||
this.valuesSynchronization = values;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -347,6 +352,7 @@ public class FFMPBasin implements ISerializableObject, Cloneable {
|
|||
public FFMPBasin() {
|
||||
|
||||
values = new TreeMap<Date, Float>(Collections.reverseOrder());
|
||||
valuesSynchronization = values;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -358,23 +364,32 @@ public class FFMPBasin implements ISerializableObject, Cloneable {
|
|||
setPfaf(pfaf);
|
||||
setAggregated(aggregated);
|
||||
values = new TreeMap<Date, Float>(Collections.reverseOrder());
|
||||
valuesSynchronization = values;
|
||||
}
|
||||
|
||||
public FFMPBasin(Long pfaf, boolean aggregated,
|
||||
BasinMapFactory<Date> mapFactory) {
|
||||
setPfaf(pfaf);
|
||||
setAggregated(aggregated);
|
||||
values = mapFactory.getMap();
|
||||
valuesSynchronization = mapFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates the map from the serialized values
|
||||
*
|
||||
* @param times
|
||||
*/
|
||||
public void deserialize(long[] times) {
|
||||
public void deserialize(long[] times, BasinMapFactory<Date> mapFactory) {
|
||||
// safe to avoid Array Index Exceptions / shouldn't happen but.....
|
||||
|
||||
if (serializedValues != null
|
||||
&& (times.length == serializedValues.length)) {
|
||||
NavigableMap<Date, Float> fastMap = new ArrayBackedMap(times,
|
||||
serializedValues);
|
||||
values = fastMap.descendingMap();
|
||||
|
||||
// values = new TreeMap<Date, Float>(fastMap.descendingMap());
|
||||
values = mapFactory.getMap(fastMap.descendingMap());
|
||||
valuesSynchronization = mapFactory;
|
||||
}
|
||||
serializedValues = null;
|
||||
}
|
||||
|
@ -401,7 +416,7 @@ public class FFMPBasin implements ISerializableObject, Cloneable {
|
|||
*/
|
||||
public void purgeData(Date date) {
|
||||
if (values != null) {
|
||||
synchronized (values) {
|
||||
synchronized (valuesSynchronization) {
|
||||
ArrayList<Date> removes = new ArrayList<Date>();
|
||||
for (Date mdate : values.keySet()) {
|
||||
if (mdate.before(date)) {
|
||||
|
|
|
@ -22,6 +22,7 @@ package com.raytheon.uf.common.dataplugin.ffmp;
|
|||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
@ -29,6 +30,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.ffmp.FFMPDataRecordLoader.LoadTask;
|
||||
import com.raytheon.uf.common.dataplugin.ffmp.collections.BasinMapFactory;
|
||||
import com.raytheon.uf.common.datastorage.DataStoreFactory;
|
||||
import com.raytheon.uf.common.datastorage.records.FloatDataRecord;
|
||||
import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager;
|
||||
|
@ -54,6 +56,9 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
* 05/09/13 1919 mpduff Use parent pfaf instead of lookupId.
|
||||
* 07/09/13 2152 njensen Ensure purgeData() does not load data
|
||||
* Jul 15, 2013 2184 dhladky Remove all HUC's for storage except ALL
|
||||
* 07/16/13 2197 njensen Added hasAnyBasins() and moved getBasins() calls out of loops
|
||||
* Jul 31, 2013 2242 bsteffen Optimize FFMP NavigableMap memory.
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -82,6 +87,20 @@ public class FFMPBasinData implements ISerializableObject {
|
|||
*/
|
||||
private final Map<String, FFMPBasin[]> orderedBasinsCache = new HashMap<String, FFMPBasin[]>();
|
||||
|
||||
/**
|
||||
* Shared factory for efficient storage of data in basins.
|
||||
*/
|
||||
private BasinMapFactory<Date> mapFactory = null;
|
||||
|
||||
/**
|
||||
* Public one arg constructor
|
||||
*
|
||||
* @param huc_level
|
||||
*/
|
||||
public FFMPBasinData(String hucLevel) {
|
||||
setHucLevel(hucLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
* No arg hibernate constructor
|
||||
*/
|
||||
|
@ -171,11 +190,11 @@ public class FFMPBasinData implements ISerializableObject {
|
|||
*/
|
||||
public float getAverageValue(ArrayList<Long> pfaf_ids, Date beforeDate,
|
||||
Date afterDate) {
|
||||
|
||||
float tvalue = 0.0f;
|
||||
int i = 0;
|
||||
Map<Long, FFMPBasin> localBasins = getBasins();
|
||||
for (Long pfaf : pfaf_ids) {
|
||||
FFMPBasin basin = getBasins().get(pfaf);
|
||||
FFMPBasin basin = localBasins.get(pfaf);
|
||||
if (basin != null) {
|
||||
tvalue += basin.getValue(beforeDate, afterDate);
|
||||
i++;
|
||||
|
@ -195,11 +214,11 @@ public class FFMPBasinData implements ISerializableObject {
|
|||
* @return
|
||||
*/
|
||||
public float getAverageValue(ArrayList<Long> pfaf_ids, Date date) {
|
||||
|
||||
float tvalue = 0.0f;
|
||||
int i = 0;
|
||||
for (Long pfaf : pfaf_ids) {
|
||||
FFMPBasin basin = getBasins().get(pfaf);
|
||||
Map<Long, FFMPBasin> localBasins = getBasins();
|
||||
for (long pfaf : pfaf_ids) {
|
||||
FFMPBasin basin = localBasins.get(pfaf);
|
||||
if (basin != null) {
|
||||
tvalue += basin.getValue(date);
|
||||
i++;
|
||||
|
@ -248,8 +267,9 @@ public class FFMPBasinData implements ISerializableObject {
|
|||
float tvalue = 0.0f;
|
||||
float tarea = 0.0f;
|
||||
int i = 0;
|
||||
Map<Long, FFMPBasin> localBasins = getBasins();
|
||||
for (Long pfaf : pfaf_ids) {
|
||||
FFMPBasin basin = getBasins().get(pfaf);
|
||||
FFMPBasin basin = localBasins.get(pfaf);
|
||||
if (basin != null) {
|
||||
if (basin.getValue() != FFMPUtils.MISSING) {
|
||||
tvalue += (basin.getValue() * areas.get(i));
|
||||
|
@ -275,11 +295,11 @@ public class FFMPBasinData implements ISerializableObject {
|
|||
*/
|
||||
public float getAccumAverageValue(List<Long> pfaf_ids, Date beforeDate,
|
||||
Date afterDate, long expirationTime, boolean rate) {
|
||||
|
||||
float tvalue = 0.0f;
|
||||
int i = 0;
|
||||
Map<Long, FFMPBasin> localBasins = getBasins();
|
||||
for (Long pfaf : pfaf_ids) {
|
||||
FFMPBasin basin = getBasins().get(pfaf);
|
||||
FFMPBasin basin = localBasins.get(pfaf);
|
||||
if (basin != null) {
|
||||
tvalue += basin.getAccumValue(beforeDate, afterDate,
|
||||
expirationTime, rate);
|
||||
|
@ -300,10 +320,10 @@ public class FFMPBasinData implements ISerializableObject {
|
|||
*/
|
||||
public float getMaxValue(ArrayList<Long> pfaf_ids, Date beforeDate,
|
||||
Date afterDate) {
|
||||
|
||||
float tvalue = 0.0f;
|
||||
Map<Long, FFMPBasin> localBasins = getBasins();
|
||||
for (Long pfaf : pfaf_ids) {
|
||||
FFMPBasin basin = getBasins().get(pfaf);
|
||||
FFMPBasin basin = localBasins.get(pfaf);
|
||||
if (basin != null) {
|
||||
Float value = basin.getValue(beforeDate, afterDate);
|
||||
if (value > tvalue) {
|
||||
|
@ -324,10 +344,10 @@ public class FFMPBasinData implements ISerializableObject {
|
|||
*/
|
||||
public float getAverageMaxValue(List<Long> pfaf_ids, Date date,
|
||||
long expiration) {
|
||||
|
||||
float tvalue = 0.0f;
|
||||
Map<Long, FFMPBasin> localBasins = getBasins();
|
||||
for (Long pfaf : pfaf_ids) {
|
||||
FFMPBasin basin = getBasins().get(pfaf);
|
||||
FFMPBasin basin = localBasins.get(pfaf);
|
||||
if (basin != null) {
|
||||
Float value = basin.getAverageValue(date, expiration);
|
||||
if (value > tvalue) {
|
||||
|
@ -348,10 +368,10 @@ public class FFMPBasinData implements ISerializableObject {
|
|||
*/
|
||||
public float getAverageMaxValue(ArrayList<Long> pfaf_ids, Date afterDate,
|
||||
Date beforeDate) {
|
||||
|
||||
float tvalue = 0.0f;
|
||||
Map<Long, FFMPBasin> localBasins = getBasins();
|
||||
for (Long pfaf : pfaf_ids) {
|
||||
FFMPBasin basin = getBasins().get(pfaf);
|
||||
FFMPBasin basin = localBasins.get(pfaf);
|
||||
if (basin != null) {
|
||||
Float value = basin.getAverageValue(afterDate, beforeDate);
|
||||
if (value > tvalue) {
|
||||
|
@ -370,10 +390,10 @@ public class FFMPBasinData implements ISerializableObject {
|
|||
* @return
|
||||
*/
|
||||
public float getMaxValue(List<Long> pfaf_ids, Date date) {
|
||||
|
||||
float tvalue = 0.0f;
|
||||
Map<Long, FFMPBasin> localBasins = getBasins();
|
||||
for (Long pfaf : pfaf_ids) {
|
||||
FFMPBasin basin = getBasins().get(pfaf);
|
||||
FFMPBasin basin = localBasins.get(pfaf);
|
||||
if (basin != null) {
|
||||
Float value = basin.getValue(date);
|
||||
if (value > tvalue) {
|
||||
|
@ -394,12 +414,12 @@ public class FFMPBasinData implements ISerializableObject {
|
|||
public float getAverageGuidanceValue(List<Long> pfaf_ids,
|
||||
FFMPGuidanceInterpolation interpolation, float guidance,
|
||||
List<Long> forcedPfafs, long expiration) {
|
||||
|
||||
float tvalue = 0.0f;
|
||||
float value;
|
||||
int i = 0;
|
||||
Map<Long, FFMPBasin> localBasins = getBasins();
|
||||
for (Long pfaf : pfaf_ids) {
|
||||
FFMPBasin basin = getBasins().get(pfaf);
|
||||
FFMPBasin basin = localBasins.get(pfaf);
|
||||
|
||||
if (basin == null) {
|
||||
return guidance;
|
||||
|
@ -478,8 +498,9 @@ public class FFMPBasinData implements ISerializableObject {
|
|||
FFMPGuidanceInterpolation interpolation, long expiration,
|
||||
long parentPfaf) {
|
||||
float tvalue = Float.NaN;
|
||||
Map<Long, FFMPBasin> localBasins = getBasins();
|
||||
for (Long pfaf : pfaf_ids) {
|
||||
FFMPBasin basin = getBasins().get(pfaf);
|
||||
FFMPBasin basin = localBasins.get(pfaf);
|
||||
if (basin != null) {
|
||||
FFMPGuidanceBasin fgb = (FFMPGuidanceBasin) basin;
|
||||
fgb.setCountyFips(parentPfaf);
|
||||
|
@ -530,11 +551,10 @@ public class FFMPBasinData implements ISerializableObject {
|
|||
*/
|
||||
public float getAccumMaxValue(List<Long> pfaf_ids, Date beforeDate,
|
||||
Date afterDate, long expirationTime, boolean rate) {
|
||||
|
||||
float tvalue = 0.0f;
|
||||
Map<Long, FFMPBasin> localBasins = getBasins();
|
||||
for (Long pfaf : pfaf_ids) {
|
||||
|
||||
FFMPBasin basin = getBasins().get(pfaf);
|
||||
FFMPBasin basin = localBasins.get(pfaf);
|
||||
if (basin != null) {
|
||||
|
||||
float val = basin.getAccumValue(afterDate, beforeDate,
|
||||
|
@ -559,8 +579,9 @@ public class FFMPBasinData implements ISerializableObject {
|
|||
public List<Float> getGuidanceValues(List<Long> pfaf_ids,
|
||||
FFMPGuidanceInterpolation interpolation, long expiration) {
|
||||
List<Float> values = new ArrayList<Float>();
|
||||
Map<Long, FFMPBasin> localBasins = getBasins();
|
||||
for (Long pfaf : pfaf_ids) {
|
||||
FFMPBasin basin = getBasins().get(pfaf);
|
||||
FFMPBasin basin = localBasins.get(pfaf);
|
||||
if (basin != null) {
|
||||
FFMPGuidanceBasin fgb = (FFMPGuidanceBasin) basin;
|
||||
if (interpolation.isInterpolate()) {
|
||||
|
@ -618,8 +639,9 @@ public class FFMPBasinData implements ISerializableObject {
|
|||
public List<Float> getAccumValues(List<Long> pfaf_ids, Date beforeDate,
|
||||
Date afterDate, long expirationTime, boolean rate) {
|
||||
List<Float> values = new ArrayList<Float>();
|
||||
Map<Long, FFMPBasin> localBasins = getBasins();
|
||||
for (Long pfaf : pfaf_ids) {
|
||||
FFMPBasin basin = getBasins().get(pfaf);
|
||||
FFMPBasin basin = localBasins.get(pfaf);
|
||||
if (basin != null) {
|
||||
values.add(basin.getAccumValue(beforeDate, afterDate,
|
||||
expirationTime, rate));
|
||||
|
@ -666,13 +688,18 @@ public class FFMPBasinData implements ISerializableObject {
|
|||
* @param times
|
||||
*/
|
||||
public void populate(List<Long> times) {
|
||||
|
||||
if (mapFactory == null) {
|
||||
mapFactory = new BasinMapFactory<Date>(Collections.reverseOrder(),
|
||||
getBasins().size());
|
||||
}
|
||||
|
||||
long[] timesArr = new long[times.size()];
|
||||
for (int i = 0; i < timesArr.length; i += 1) {
|
||||
timesArr[i] = times.get(i);
|
||||
}
|
||||
for (FFMPBasin basin : getBasins().values()) {
|
||||
basin.deserialize(timesArr);
|
||||
basin.deserialize(timesArr, mapFactory);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -730,7 +757,12 @@ public class FFMPBasinData implements ISerializableObject {
|
|||
if (guidance) {
|
||||
basin = new FFMPGuidanceBasin(pfaf, aggregate);
|
||||
} else {
|
||||
basin = new FFMPBasin(pfaf, aggregate);
|
||||
if (mapFactory == null) {
|
||||
mapFactory = new BasinMapFactory<Date>(
|
||||
Collections.reverseOrder(),
|
||||
orderedPfafs.size());
|
||||
}
|
||||
basin = new FFMPBasin(pfaf, aggregate, mapFactory);
|
||||
}
|
||||
this.basins.put(pfaf, basin);
|
||||
}
|
||||
|
@ -793,6 +825,16 @@ public class FFMPBasinData implements ISerializableObject {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether or not any basins have been put in the basins map. Faster
|
||||
* than calling getBasins().size() or getBasins().isEmpty().
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean hasAnyBasins() {
|
||||
return !basins.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load now.
|
||||
*/
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.dataplugin.ffmp;
|
||||
package com.raytheon.uf.common.dataplugin.ffmp.collections;
|
||||
|
||||
import java.util.AbstractMap;
|
||||
import java.util.AbstractSet;
|
||||
|
@ -34,7 +34,6 @@ import java.util.NavigableSet;
|
|||
import java.util.NoSuchElementException;
|
||||
import java.util.Set;
|
||||
import java.util.SortedMap;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeMap;
|
||||
|
||||
/**
|
||||
|
@ -66,7 +65,9 @@ import java.util.TreeMap;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 18, 2013 bsteffen Initial creation
|
||||
* Apr 18, 2013 bsteffen Initial creation
|
||||
* Jul 31, 2013 2242 bsteffen Extracted NavigableKeySet to its own
|
||||
* file and moved to collections package.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -264,7 +265,7 @@ public class ArrayBackedMap extends AbstractMap<Date, Float> implements
|
|||
|
||||
@Override
|
||||
public NavigableSet<Date> navigableKeySet() {
|
||||
return new NavigableKeySet(this);
|
||||
return new NavigableKeySet<Date>(this);
|
||||
}
|
||||
|
||||
private int lowerIndex(Date key, boolean inclusive) {
|
||||
|
@ -592,113 +593,7 @@ public class ArrayBackedMap extends AbstractMap<Date, Float> implements
|
|||
|
||||
}
|
||||
|
||||
private static class NavigableKeySet extends AbstractSet<Date> implements
|
||||
NavigableSet<Date> {
|
||||
|
||||
private final NavigableMap<Date, Float> map;
|
||||
|
||||
public NavigableKeySet(NavigableMap<Date, Float> map) {
|
||||
this.map = map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<Date> iterator() {
|
||||
return map.keySet().iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return map.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Comparator<? super Date> comparator() {
|
||||
return map.comparator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date first() {
|
||||
return map.firstKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date last() {
|
||||
return map.lastKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date lower(Date e) {
|
||||
return map.lowerKey(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date floor(Date e) {
|
||||
return map.floorKey(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date ceiling(Date e) {
|
||||
return map.ceilingKey(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date higher(Date e) {
|
||||
return map.higherKey(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date pollFirst() {
|
||||
return map.pollFirstEntry().getKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date pollLast() {
|
||||
return map.pollLastEntry().getKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NavigableSet<Date> descendingSet() {
|
||||
return map.descendingKeySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<Date> descendingIterator() {
|
||||
return descendingSet().iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NavigableSet<Date> subSet(Date fromElement,
|
||||
boolean fromInclusive, Date toElement, boolean toInclusive) {
|
||||
return map.subMap(fromElement, fromInclusive, toElement,
|
||||
toInclusive).navigableKeySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NavigableSet<Date> headSet(Date toElement, boolean inclusive) {
|
||||
return map.headMap(toElement, inclusive).navigableKeySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NavigableSet<Date> tailSet(Date fromElement, boolean inclusive) {
|
||||
return map.tailMap(fromElement, inclusive).navigableKeySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SortedSet<Date> subSet(Date fromElement, Date toElement) {
|
||||
return subSet(fromElement, true, toElement, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SortedSet<Date> headSet(Date toElement) {
|
||||
return headSet(toElement, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SortedSet<Date> tailSet(Date fromElement) {
|
||||
return tailSet(fromElement, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class SubMap extends AbstractMap<Date, Float> implements
|
||||
NavigableMap<Date, Float> {
|
||||
|
@ -854,7 +749,7 @@ public class ArrayBackedMap extends AbstractMap<Date, Float> implements
|
|||
|
||||
@Override
|
||||
public NavigableSet<Date> navigableKeySet() {
|
||||
return new NavigableKeySet(this);
|
||||
return new NavigableKeySet<Date>(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1066,7 +961,7 @@ public class ArrayBackedMap extends AbstractMap<Date, Float> implements
|
|||
|
||||
@Override
|
||||
public NavigableSet<Date> navigableKeySet() {
|
||||
return new NavigableKeySet(this);
|
||||
return new NavigableKeySet<Date>(this);
|
||||
}
|
||||
|
||||
@Override
|
|
@ -0,0 +1,621 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.dataplugin.ffmp.collections;
|
||||
|
||||
import java.util.AbstractMap;
|
||||
import java.util.AbstractSet;
|
||||
import java.util.Arrays;
|
||||
import java.util.BitSet;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.NavigableMap;
|
||||
import java.util.NavigableSet;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
|
||||
/**
|
||||
* Factory for constructing maps to use in FFMPBasins for organizing values.
|
||||
*
|
||||
* Each basin in FFMP requires a NavigableMap<Date,Float> in order to achieve
|
||||
* fast dynamic calculations. Unfortunately due to the large number of basins
|
||||
* TreeMaps require too much memory. This factory produces maps that have the
|
||||
* same performance as TreeMaps but are much more memory efficient.
|
||||
*
|
||||
* This factory achieves efficiency by taking advantage of the fact that all
|
||||
* basins will have data for the same times, so it can use a single TreeMap as
|
||||
* the backing map for all basins. Each NavigableMap returned from this factory
|
||||
* is simply a view into the backing map.
|
||||
*
|
||||
* Because all maps returned from this factory use the same backing map, they
|
||||
* cannot be synchronized individually. Internally all map modifications are
|
||||
* synchronized on the factory object to prevent concurrent modification. If any
|
||||
* iterators are being used from any maps then the iteration should also be
|
||||
* synchronized on the factory.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 30, 2013 2242 bsteffen Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bsteffen
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class BasinMapFactory<K> {
|
||||
|
||||
/*
|
||||
* How much to grow the backing arrays to make room for new maps, this is
|
||||
* much more conservative than the algorithms used by ArrayList or HashMap
|
||||
* because typically growth will occur very briefly during initialization
|
||||
* and the extra overhead of a slower growth rate is minimal. Once all
|
||||
* basins are created, growth will stop and a conservative growth algorithm
|
||||
* limits wasted memory after the initial growth phase.
|
||||
*/
|
||||
private static final int GROWTH_RATE = 32;
|
||||
|
||||
/* The amount of space allocated in each value. */
|
||||
protected volatile int allocated_size;
|
||||
|
||||
/* The number of indices used in maps so far. */
|
||||
private volatile int used_size;
|
||||
|
||||
/* This is the real navigable map, responsible for all real work. */
|
||||
private final NavigableMap<K, MultiValue> backingMap;
|
||||
|
||||
/**
|
||||
* Create a new factory
|
||||
*
|
||||
* @param comparator
|
||||
* the comparator to use for map keys
|
||||
* @param initialSize
|
||||
* the amount of space to preallocate for basin maps.
|
||||
*/
|
||||
public BasinMapFactory(Comparator<? super K> comparator, int initialSize) {
|
||||
allocated_size = initialSize;
|
||||
used_size = 0;
|
||||
this.backingMap = new TreeMap<K, MultiValue>(comparator);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a new map from this factory.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public NavigableMap<K, Float> getMap() {
|
||||
return new MapView<K>(this, getNextIndex(),
|
||||
backingMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a new map from this factory, populated with all the values from m. If
|
||||
* m has the same keyset as other maps in this factory than this will
|
||||
* populate the new map faster than putAll.
|
||||
*
|
||||
* @param m
|
||||
* NavigableMap, must have the same comparator as this factory.
|
||||
* @return
|
||||
*/
|
||||
public NavigableMap<K, Float> getMap(NavigableMap<K, Float> m) {
|
||||
Comparator<? super K> bc = backingMap.comparator();
|
||||
Comparator<? super K> mc = m.comparator();
|
||||
if (mc != bc && (mc == null || !mc.equals(bc))) {
|
||||
throw new IllegalArgumentException(
|
||||
"Maps can only be constructed if the compators are the same.");
|
||||
}
|
||||
int index = getNextIndex();
|
||||
Iterator<Entry<K, MultiValue>> bit = backingMap.entrySet().iterator();
|
||||
Iterator<Entry<K, Float>> mit = m.entrySet().iterator();
|
||||
NavigableMap<K, Float> r = new MapView<K>(this, index,
|
||||
backingMap);
|
||||
/*
|
||||
* If both maps have the same keys, then iterating both simultaneously
|
||||
* is faster than multiple puts because it avoids doing multiple lookups
|
||||
*/
|
||||
while (bit.hasNext() && mit.hasNext()) {
|
||||
Entry<K, MultiValue> bent = bit.next();
|
||||
Entry<K, Float> ment = mit.next();
|
||||
if (ment.getKey().equals(bent.getKey())) {
|
||||
bent.getValue().put(index, ment.getValue());
|
||||
} else {
|
||||
/* It turns out keys are not equals */
|
||||
r.put(ment.getKey(), ment.getValue());
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This loop is only used if the backingMap was empty or if for some
|
||||
* reason the backingMap and the new map do not have the same keys.
|
||||
*/
|
||||
while (mit.hasNext()) {
|
||||
Entry<K, Float> ment = mit.next();
|
||||
r.put(ment.getKey(), ment.getValue());
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
/* get the next free index for use in a MapView */
|
||||
private int getNextIndex() {
|
||||
synchronized (this) {
|
||||
int index = used_size;
|
||||
used_size += 1;
|
||||
if (used_size >= allocated_size) {
|
||||
allocated_size += GROWTH_RATE;
|
||||
for (MultiValue v : backingMap.values()) {
|
||||
v.grow(allocated_size);
|
||||
|
||||
}
|
||||
}
|
||||
return index;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Value within the backing map. This contains the raw data values for each
|
||||
* basin. In addition it contains a boolean for each basin indicating if the
|
||||
* value has been set. While most of the time all basins will be set, the
|
||||
* extra boolean is needed to allow different views to function as
|
||||
* independent maps, which is needed while new data is getting added.
|
||||
*/
|
||||
private static class MultiValue {
|
||||
|
||||
/* actual values for all basins. */
|
||||
private float[] data;
|
||||
|
||||
/* booleans indicating whether a value has been set yet for a basin */
|
||||
private BitSet occupied;
|
||||
|
||||
/*
|
||||
* The number of occupied basins for this time, when its zero the time
|
||||
* can be removed from the backing map.
|
||||
*/
|
||||
private int size = 0;
|
||||
|
||||
public MultiValue(int allocated_size) {
|
||||
this.data = new float[allocated_size];
|
||||
this.occupied = new BitSet(allocated_size);
|
||||
}
|
||||
|
||||
public void grow(int allocated_size) {
|
||||
data = Arrays.copyOf(data, allocated_size);
|
||||
BitSet occupied = new BitSet(allocated_size);
|
||||
occupied.or(this.occupied);
|
||||
this.occupied = occupied;
|
||||
}
|
||||
|
||||
public Float put(int index, float value) {
|
||||
Float oldValue = null;
|
||||
if (occupied.get(index)) {
|
||||
oldValue = data[index];
|
||||
} else {
|
||||
occupied.set(index);
|
||||
size += 1;
|
||||
}
|
||||
data[index] = value;
|
||||
return oldValue;
|
||||
}
|
||||
|
||||
public Float get(int index) {
|
||||
if (occupied.get(index)) {
|
||||
return data[index];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean contains(int index) {
|
||||
return occupied.get(index);
|
||||
}
|
||||
|
||||
public Float remove(int index) {
|
||||
if (occupied.get(index)) {
|
||||
occupied.clear(index);
|
||||
size -= 1;
|
||||
return data[index];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return size == 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* NavigableMap implementation which provides a view into the backingMap at
|
||||
* a specific index. This class can map any NavigableMap<K, MultiValue>
|
||||
* which simplifies creating sub maps or descending map because all that is
|
||||
* required is getting new maps from the backingMap and wrapping them in a
|
||||
* new MapView.
|
||||
*/
|
||||
private static class MapView<K> extends AbstractMap<K, Float> implements
|
||||
NavigableMap<K, Float> {
|
||||
|
||||
/* Factory, for syncronization */
|
||||
private final BasinMapFactory<K> factory;
|
||||
|
||||
/* index into the MultiValue */
|
||||
private final int index;
|
||||
|
||||
/* backingMap where all the data really lives. */
|
||||
private final NavigableMap<K, MultiValue> backingMap;
|
||||
|
||||
public MapView(BasinMapFactory<K> factory, int index,
|
||||
NavigableMap<K, MultiValue> backingMap) {
|
||||
this.factory = factory;
|
||||
this.index = index;
|
||||
this.backingMap = backingMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Float put(K key, Float value) {
|
||||
synchronized (factory) {
|
||||
MultiValue v = backingMap.get(key);
|
||||
if (v == null) {
|
||||
v = new MultiValue(factory.allocated_size);
|
||||
backingMap.put(key, v);
|
||||
}
|
||||
return v.put(index, value);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsKey(Object key) {
|
||||
MultiValue v = backingMap.get(key);
|
||||
if (v != null) {
|
||||
return v.contains(index);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Float get(Object key) {
|
||||
MultiValue v = backingMap.get(key);
|
||||
if (v != null) {
|
||||
return v.get(index);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Float remove(Object key) {
|
||||
Float oldValue = null;
|
||||
MultiValue v = backingMap.get(key);
|
||||
if (v != null) {
|
||||
synchronized (factory) {
|
||||
oldValue = v.remove(index);
|
||||
if (v.isEmpty()) {
|
||||
backingMap.remove(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
return oldValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
/*
|
||||
* The default implementation uses size() which will iterate over
|
||||
* all elements, this is much faster.
|
||||
*/
|
||||
return !entrySet().iterator().hasNext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Comparator<? super K> comparator() {
|
||||
return backingMap.comparator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public K firstKey() {
|
||||
Entry<K, Float> e = firstEntry();
|
||||
if (e != null) {
|
||||
return e.getKey();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public K lastKey() {
|
||||
Entry<K, Float> e = lastEntry();
|
||||
if (e != null) {
|
||||
return e.getKey();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entry<K, Float> lowerEntry(K key) {
|
||||
return headMap(key).lastEntry();
|
||||
}
|
||||
|
||||
@Override
|
||||
public K lowerKey(K key) {
|
||||
return headMap(key).lastKey();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entry<K, Float> floorEntry(K key) {
|
||||
return headMap(key, true).lastEntry();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public K floorKey(K key) {
|
||||
return headMap(key, true).lastKey();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entry<K, Float> ceilingEntry(K key) {
|
||||
return tailMap(key).firstEntry();
|
||||
}
|
||||
|
||||
@Override
|
||||
public K ceilingKey(K key) {
|
||||
return tailMap(key).firstKey();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entry<K, Float> higherEntry(K key) {
|
||||
return tailMap(key, false).firstEntry();
|
||||
}
|
||||
|
||||
@Override
|
||||
public K higherKey(K key) {
|
||||
return tailMap(key, false).firstKey();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entry<K, Float> firstEntry() {
|
||||
for (Entry<K, Float> e : entrySet()) {
|
||||
return e;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entry<K, Float> lastEntry() {
|
||||
return descendingMap().firstEntry();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entry<K, Float> pollFirstEntry() {
|
||||
Iterator<Entry<K, Float>> it = entrySet().iterator();
|
||||
if (it.hasNext()) {
|
||||
Entry<K, Float> e = it.next();
|
||||
it.remove();
|
||||
return e;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entry<K, Float> pollLastEntry() {
|
||||
return descendingMap().pollFirstEntry();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NavigableMap<K, Float> descendingMap() {
|
||||
return new MapView<K>(factory, index, backingMap.descendingMap());
|
||||
}
|
||||
|
||||
@Override
|
||||
public NavigableSet<K> navigableKeySet() {
|
||||
return new NavigableKeySet<K>(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NavigableSet<K> descendingKeySet() {
|
||||
return descendingMap().navigableKeySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NavigableMap<K, Float> subMap(K fromKey, boolean fromInclusive,
|
||||
K toKey, boolean toInclusive) {
|
||||
return new MapView<K>(factory, index, backingMap.subMap(fromKey,
|
||||
fromInclusive, toKey, toInclusive));
|
||||
}
|
||||
|
||||
@Override
|
||||
public NavigableMap<K, Float> headMap(K toKey, boolean inclusive) {
|
||||
return new MapView<K>(factory, index, backingMap.headMap(toKey,
|
||||
inclusive));
|
||||
}
|
||||
|
||||
@Override
|
||||
public NavigableMap<K, Float> tailMap(K fromKey, boolean inclusive) {
|
||||
return new MapView<K>(factory, index, backingMap.tailMap(fromKey,
|
||||
inclusive));
|
||||
}
|
||||
|
||||
@Override
|
||||
public NavigableMap<K, Float> subMap(K fromKey, K toKey) {
|
||||
return new MapView<K>(factory, index, backingMap.subMap(fromKey,
|
||||
true, toKey, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public NavigableMap<K, Float> headMap(K toKey) {
|
||||
return new MapView<K>(factory, index, backingMap.headMap(toKey,
|
||||
false));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public NavigableMap<K, Float> tailMap(K fromKey) {
|
||||
return new MapView<K>(factory, index, backingMap.headMap(fromKey,
|
||||
true));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Entry<K, Float>> entrySet() {
|
||||
return new EntrySet<K>(index, backingMap.entrySet());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Entry set for a MapView, just a wrapper over a Set<Entry<K, MultiValue>>
|
||||
*/
|
||||
private static class EntrySet<K> extends AbstractSet<Entry<K, Float>> {
|
||||
|
||||
private final int index;
|
||||
|
||||
private final Set<Entry<K, MultiValue>> backingSet;
|
||||
|
||||
public EntrySet(int index, Set<Entry<K, MultiValue>> backingSet) {
|
||||
this.index = index;
|
||||
this.backingSet = backingSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<Entry<K, Float>> iterator() {
|
||||
return new EntryIterator<K>(index, backingSet.iterator());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
Iterator<Entry<K, Float>> it = iterator();
|
||||
int i = 0;
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
i += 1;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterator implementation for an EntrySet, This wraps an Iterator<Entry<K,
|
||||
* MultiValue>> but has extra logic for skipping over values that exist in
|
||||
* the backingSet but are not occupied within the MultiValue.
|
||||
*/
|
||||
private static class EntryIterator<K> implements Iterator<Entry<K, Float>> {
|
||||
|
||||
private final int index;
|
||||
|
||||
private final Iterator<Entry<K, MultiValue>> backingIterator;
|
||||
|
||||
/* The next valid entry in the backingMap */
|
||||
private transient Entry<K, MultiValue> next;
|
||||
|
||||
/* Previous Value returned by next() */
|
||||
private transient Entry<K, MultiValue> previous;
|
||||
|
||||
public EntryIterator(int index,
|
||||
Iterator<Entry<K, MultiValue>> backingIterator) {
|
||||
this.index = index;
|
||||
this.backingIterator = backingIterator;
|
||||
}
|
||||
|
||||
private Entry<K, MultiValue> checkNext() {
|
||||
if (next == null) {
|
||||
while (backingIterator.hasNext()) {
|
||||
Entry<K, MultiValue> e = backingIterator.next();
|
||||
previous = null;
|
||||
MultiValue v = e.getValue();
|
||||
if (v.contains(index)) {
|
||||
next = e;
|
||||
return next;
|
||||
}
|
||||
}
|
||||
}
|
||||
return next;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return checkNext() != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entry<K, Float> next() {
|
||||
Entry<K, MultiValue> next = checkNext();
|
||||
previous = next;
|
||||
if (next == null) {
|
||||
return null;
|
||||
} else {
|
||||
this.next = null;
|
||||
return new EntryImpl<K>(index, next);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
if (previous == null) {
|
||||
throw new IllegalStateException(
|
||||
"Cannot remove from iterator because next() was not called.");
|
||||
}
|
||||
MultiValue v = previous.getValue();
|
||||
previous = null;
|
||||
v.remove(index);
|
||||
if (v.isEmpty()) {
|
||||
backingIterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Entry for a MapView, just a wrapper over a Entry<K, MultiValue>.
|
||||
*/
|
||||
private static class EntryImpl<K> implements Entry<K, Float> {
|
||||
|
||||
private final int index;
|
||||
|
||||
private final Entry<K, MultiValue> backingEntry;
|
||||
|
||||
public EntryImpl(int index, Entry<K, MultiValue> timeEntry) {
|
||||
this.index = index;
|
||||
this.backingEntry = timeEntry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public K getKey() {
|
||||
return backingEntry.getKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Float getValue() {
|
||||
return backingEntry.getValue().get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Float setValue(Float value) {
|
||||
return backingEntry.getValue().put(index, value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,153 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.dataplugin.ffmp.collections;
|
||||
|
||||
import java.util.AbstractSet;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.NavigableMap;
|
||||
import java.util.NavigableSet;
|
||||
import java.util.SortedSet;
|
||||
|
||||
/**
|
||||
*
|
||||
* Generic NavigableSet which is implemented by wrapping a fully implemented
|
||||
* NavigableMap. Very useful for custom NavigableMap implementations.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 31, 2013 2242 bsteffen Extracted from ArrayBackedMap
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bsteffen
|
||||
* @version 1.0
|
||||
* @param <K>
|
||||
*/
|
||||
class NavigableKeySet<K> extends AbstractSet<K> implements NavigableSet<K> {
|
||||
|
||||
private final NavigableMap<K, ?> map;
|
||||
|
||||
public NavigableKeySet(NavigableMap<K, ?> map) {
|
||||
this.map = map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<K> iterator() {
|
||||
return map.keySet().iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return map.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Comparator<? super K> comparator() {
|
||||
return map.comparator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public K first() {
|
||||
return map.firstKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
public K last() {
|
||||
return map.lastKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
public K lower(K e) {
|
||||
return map.lowerKey(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public K floor(K e) {
|
||||
return map.floorKey(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public K ceiling(K e) {
|
||||
return map.ceilingKey(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public K higher(K e) {
|
||||
return map.higherKey(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public K pollFirst() {
|
||||
return map.pollFirstEntry().getKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
public K pollLast() {
|
||||
return map.pollLastEntry().getKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NavigableSet<K> descendingSet() {
|
||||
return map.descendingKeySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<K> descendingIterator() {
|
||||
return descendingSet().iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NavigableSet<K> subSet(K fromElement, boolean fromInclusive,
|
||||
K toElement, boolean toInclusive) {
|
||||
return map.subMap(fromElement, fromInclusive, toElement,
|
||||
toInclusive).navigableKeySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NavigableSet<K> headSet(K toElement, boolean inclusive) {
|
||||
return map.headMap(toElement, inclusive).navigableKeySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NavigableSet<K> tailSet(K fromElement, boolean inclusive) {
|
||||
return map.tailMap(fromElement, inclusive).navigableKeySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SortedSet<K> subSet(K fromElement, K toElement) {
|
||||
return subSet(fromElement, true, toElement, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SortedSet<K> headSet(K toElement) {
|
||||
return headSet(toElement, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SortedSet<K> tailSet(K fromElement) {
|
||||
return tailSet(fromElement, true);
|
||||
}
|
||||
|
||||
}
|
|
@ -55,6 +55,7 @@ import com.vividsolutions.jts.geom.Geometry;
|
|||
* table.
|
||||
* Jul 16, 2013 2181 bsteffen Convert geometry types to use hibernate-
|
||||
* spatial
|
||||
* 08/08/2013 2243 jsanchez Removed super method in copy constructor.
|
||||
* </pre>
|
||||
*
|
||||
* @author bwoodle
|
||||
|
@ -236,7 +237,6 @@ public abstract class AbstractWarningRecord extends PluginDataObject {
|
|||
* The text of the message
|
||||
*/
|
||||
public AbstractWarningRecord(AbstractWarningRecord old) {
|
||||
super((String) old.getMessageData());
|
||||
this.setCountyheader(old.getCountyheader());
|
||||
this.setDataTime(old.getDataTime());
|
||||
this.setForecaster(old.getForecaster());
|
||||
|
|
|
@ -58,6 +58,8 @@ import com.vividsolutions.jts.io.WKTReader;
|
|||
* ETN values.
|
||||
* Feb 26, 2013 #1447 dgilling Rewrite based on MergeActiveTableRequest
|
||||
* and use MergeVTEC.py to perform merge.
|
||||
* Jul 23, 2013 #2212 dgilling Fix ClassCastExceptions on flood
|
||||
* fields.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -181,31 +183,32 @@ public class MergeActiveTableHandler implements
|
|||
atr.setProductClass(template.get("productClass").toString());
|
||||
atr.setUgcZone(template.get("id").toString());
|
||||
atr.setRawmessage(template.get("rawMessage").toString());
|
||||
|
||||
atr.setCountyheader((String) template.get("countyheader"));
|
||||
Integer floodBeginInt = (Integer) template
|
||||
.get("floodBegin");
|
||||
if (floodBeginInt != null) {
|
||||
|
||||
Number floodBeginTime = (Number) template.get("floodBegin");
|
||||
if (floodBeginTime != null) {
|
||||
Calendar floodBegin = GregorianCalendar.getInstance();
|
||||
floodBegin.setTimeInMillis(floodBeginInt * 1000L);
|
||||
floodBegin
|
||||
.setTimeInMillis(floodBeginTime.longValue() * 1000L);
|
||||
atr.setFloodBegin(floodBegin);
|
||||
}
|
||||
Integer floodCrestInt = (Integer) template
|
||||
.get("floodCrest");
|
||||
if (floodCrestInt != null) {
|
||||
Number floodCrestTime = (Number) template.get("floodCrest");
|
||||
if (floodCrestTime != null) {
|
||||
Calendar floodCrest = GregorianCalendar.getInstance();
|
||||
floodCrest.setTimeInMillis(floodCrestInt * 1000L);
|
||||
floodCrest
|
||||
.setTimeInMillis(floodCrestTime.longValue() * 1000L);
|
||||
atr.setFloodCrest(floodCrest);
|
||||
}
|
||||
Integer floodEndInt = (Integer) template.get("floodEnd");
|
||||
if (floodEndInt != null) {
|
||||
Number floodEndTime = (Number) template.get("floodEnd");
|
||||
if (floodEndTime != null) {
|
||||
Calendar floodEnd = GregorianCalendar.getInstance();
|
||||
floodEnd.setTimeInMillis(floodEndInt * 1000L);
|
||||
floodEnd.setTimeInMillis(floodEndTime.longValue() * 1000L);
|
||||
atr.setFloodEnd(floodEnd);
|
||||
}
|
||||
atr.setFloodRecordStatus((String) template
|
||||
.get("floodRecordStatus"));
|
||||
atr.setFloodSeverity((String) template.get("floodseverity"));
|
||||
|
||||
atr.setImmediateCause((String) template
|
||||
.get("immediateCause"));
|
||||
atr.setLoc((String) template.get("loc"));
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
# 12/20/09 njensen Initial Creation.
|
||||
# 02/26/13 1447 dgilling Implement __eq__() and
|
||||
# __ne__().
|
||||
#
|
||||
#
|
||||
# 07/23/13 2212 dgilling Fix typo in __eq__().
|
||||
#
|
||||
#
|
||||
|
||||
|
||||
|
@ -154,7 +154,7 @@ class ActiveTableRecord(object):
|
|||
return ActiveTableRecord(self.atr.clone(), self.state)
|
||||
|
||||
def __eq__(self, other):
|
||||
return self.javaRecord().equals(other.javeRecord())
|
||||
return self.javaRecord().equals(other.javaRecord())
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self.__eq__(other)
|
||||
|
|
|
@ -1 +1 @@
|
|||
8c6dca9fe87ba72219b27ed3dcb8c74cc4f0e53d
|
||||
c28b0356ba38c6aa1c3ad220caf3ad27f2534f33
|
|
@ -1 +1 @@
|
|||
8c6dca9fe87ba72219b27ed3dcb8c74cc4f0e53d
|
||||
c28b0356ba38c6aa1c3ad220caf3ad27f2534f33
|
|
@ -28,10 +28,10 @@
|
|||
|
||||
void display_field_data_RFCW ( enum DisplayFieldData,
|
||||
int ** data_array_tmp , date_struct date ,
|
||||
int addition_flag ) ;
|
||||
int addition_flag , int rowSize, int colSize) ;
|
||||
|
||||
void display_field_read_xmrg ( int ** data_array_tmp , char * fname ,
|
||||
int addition_flag ) ;
|
||||
int addition_flag , int rowSize, int colSize ) ;
|
||||
|
||||
void display_field_read_spe ( int ** data_array_tmp , char * fname ,
|
||||
int addition_flag ) ;
|
||||
|
|
|
@ -52,8 +52,8 @@
|
|||
|
||||
/* Ordering of the elements in this list must be the same as the beginning
|
||||
* of the enum DisplayFieldData type in the mpe_field_names.h header file. */
|
||||
typedef enum {rmosaic = 0, avgrmosaic, maxrmosaic, gaugeonly, bmosaic, lmosaic,
|
||||
mmosaic, mlmosaic, satpre, lsatpre, p3lmosaic, srmosaic, sgmosaic, srgmosaic,
|
||||
typedef enum {rmosaic = 0, avgrmosaic, maxrmosaic, bmosaic, lmosaic, gaugeonly,
|
||||
satpre, lsatpre, mmosaic, mlmosaic, p3lmosaic, srmosaic, sgmosaic, srgmosaic,
|
||||
qmosaic, lqmosaic, mlqmosaic, rfcmosaic, rfcbmosaic, rfcmmosaic, num_mosaics
|
||||
}mosaicType ;
|
||||
|
||||
|
|
|
@ -174,7 +174,9 @@ void main_mpe_fieldgen_for_calls_from_editor(int num_args, char ** args)
|
|||
sprintf ( message , "\t\tMPE Precip Processing -- %s\n", strTempTime) ;
|
||||
printMessage( message, logFile );
|
||||
|
||||
sprintf ( message , "\t\tVersion OB11.7 -- Jun 01, 2011 \n") ;
|
||||
sprintf ( message , "\t\tLast Modification: August 1, 2013 \n") ;
|
||||
printMessage( message, logFile );
|
||||
sprintf ( message , "\t\t \n") ;
|
||||
printMessage( message, logFile );
|
||||
|
||||
sprintf( message , "STATUS: Processing %d hour(s)\n",
|
||||
|
|
|
@ -436,8 +436,12 @@ static void accum_show_data ( Widget w , XtPointer clientdata ,
|
|||
for ( i = index ; ( i < ( index + interval_value ) ) &&
|
||||
( i < NUMHRS ) ; ++ i )
|
||||
{
|
||||
/*
|
||||
* Set to zeros; it is known that this code is unused in AWIPS II
|
||||
* due to the existence of the X functions in this source file.
|
||||
*/
|
||||
display_field_data_RFCW ( display_Xmrg , rad_data[0].data_array ,
|
||||
dates [ i ] , 1 ) ;
|
||||
dates [ i ] , 1 , 0, 0) ;
|
||||
}
|
||||
|
||||
/* If the type of this precipitation accumulation is anything other
|
||||
|
|
|
@ -793,7 +793,7 @@ static void apply_edit_polygon(const rubber_poly_data * pPolyNode,
|
|||
|
||||
display_field_data_RFCW(
|
||||
( enum DisplayFieldData ) pPolyNode->draw_source, temp_array,
|
||||
(date_struct ) * pDate, ( int ) add_flag );
|
||||
(date_struct ) * pDate, ( int ) add_flag , num_rows, num_columns );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -829,9 +829,14 @@ static void apply_edit_polygon(const rubber_poly_data * pPolyNode,
|
|||
case display_rfcbMosaic:
|
||||
case display_rfcmMosaic:
|
||||
case display_Xmrg:
|
||||
case display_lqMosaic:
|
||||
case display_qMosaic:
|
||||
case display_mlqMosaic:
|
||||
|
||||
data_array[x_adj][y_adj] = temp_array[x_adj][y_adj];
|
||||
|
||||
break;
|
||||
|
||||
case display_subValue:
|
||||
|
||||
if (pPolyNode->raise_flag == True)
|
||||
|
|
|
@ -335,9 +335,13 @@ void create_gage_table_RFCW ( draw_struct * data )
|
|||
|
||||
for ( m = 0; m < SIZE; ++m )
|
||||
{
|
||||
/*
|
||||
* defaulting to 0 since this source is not used in
|
||||
* AWIPS II due to the existence of the X functions.
|
||||
*/
|
||||
display_field_data_RFCW ( display_array[m] ,
|
||||
data_array_field , date_st3 ,
|
||||
addition_flag );
|
||||
addition_flag , 0, 0);
|
||||
|
||||
lookup_mosaic_data ( data_array_field ,
|
||||
gage ,
|
||||
|
@ -1085,7 +1089,7 @@ void lookup_radar_index ( int ** data_array_tmp ,
|
|||
sprintf(fname,"%s/%s%sz",dirname,cv_use_tmp,date_st3.cdate);
|
||||
len_fname = strlen(fname);
|
||||
|
||||
display_field_read_xmrg ( data_array_tmp , fname, addition_flag );
|
||||
display_field_read_xmrg ( data_array_tmp , fname, addition_flag , 0, 0 );
|
||||
|
||||
for(k=0; k<ngages; k++)
|
||||
{
|
||||
|
|
|
@ -32,7 +32,7 @@ Called by function:
|
|||
|
||||
void display_field_data_RFCW ( enum DisplayFieldData display_data ,
|
||||
int ** data_array_tmp , date_struct date ,
|
||||
int addition_flag )
|
||||
int addition_flag , int rowSize, int colSize )
|
||||
{
|
||||
char dirname [ 100 ] ;
|
||||
char fname [ 128 ] ;
|
||||
|
@ -160,6 +160,24 @@ void display_field_data_RFCW ( enum DisplayFieldData display_data ,
|
|||
strcpy(cv_use_tmp,"RFCMMOSAIC");
|
||||
break;
|
||||
|
||||
case display_lqMosaic:
|
||||
len = strlen("mpe_lqmosaic_dir");
|
||||
get_apps_defaults("mpe_lqmosaic_dir",&len,dirname,&len);
|
||||
strcpy(cv_use_tmp,"LQMOSAIC");
|
||||
break;
|
||||
|
||||
case display_qMosaic:
|
||||
len = strlen("mpe_qmosaic_dir");
|
||||
get_apps_defaults("mpe_qmosaic_dir",&len,dirname,&len);
|
||||
strcpy(cv_use_tmp,"QMOSAIC");
|
||||
break;
|
||||
|
||||
case display_mlqMosaic:
|
||||
len = strlen("mpe_mlqmosaic_dir");
|
||||
get_apps_defaults("mpe_mlqmosaic_dir",&len,dirname,&len);
|
||||
strcpy(cv_use_tmp,"MLQMOSAIC");
|
||||
break;
|
||||
|
||||
case display_subValue:
|
||||
len = strlen("rfcwide_gageonly_dir");
|
||||
get_apps_defaults("rfcwide_gageonly_dir",&len,dirname,&len);
|
||||
|
@ -171,7 +189,8 @@ void display_field_data_RFCW ( enum DisplayFieldData display_data ,
|
|||
return;
|
||||
|
||||
default:
|
||||
logMessage("ERROR: invalid selection");
|
||||
flogMessage(stderr, "\nIn routine 'display_field_data_RFCW':\n"
|
||||
"Invalid Selection: %d.\n", (int) display_data);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -209,7 +228,7 @@ void display_field_data_RFCW ( enum DisplayFieldData display_data ,
|
|||
if ( display_data != display_satPrecip )
|
||||
{
|
||||
len_fname = strlen ( fname ) ;
|
||||
display_field_read_xmrg ( data_array_tmp , fname, addition_flag );
|
||||
display_field_read_xmrg ( data_array_tmp , fname, addition_flag , rowSize, colSize );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -220,13 +239,22 @@ void display_field_data_RFCW ( enum DisplayFieldData display_data ,
|
|||
}
|
||||
|
||||
void display_field_read_xmrg (int ** data_array_tmp , char * fname,
|
||||
int addition_flag )
|
||||
int addition_flag , int rowSize, int colSize )
|
||||
{
|
||||
int len_fname;
|
||||
int i, j, ifile;
|
||||
short **temp = NULL ;
|
||||
enum TestByteResult result ;
|
||||
|
||||
|
||||
if (colSize > 0)
|
||||
{
|
||||
MAXX = colSize;
|
||||
}
|
||||
if (rowSize > 0)
|
||||
{
|
||||
MAXY = rowSize;
|
||||
}
|
||||
|
||||
len_fname = strlen(fname);
|
||||
temp = ( short ** ) malloc ( MAXY * sizeof ( short *) ) ;
|
||||
|
||||
|
@ -297,14 +325,16 @@ void display_field_read_xmrg (int ** data_array_tmp , char * fname,
|
|||
return ;
|
||||
}
|
||||
|
||||
bool success = true;
|
||||
for ( i = 0 ; i < MAXY ; ++ i )
|
||||
{
|
||||
read_xmrg ( & MAXX , & MAXY , & i , fname , & len_fname , & ifile ,
|
||||
temp [ i ] ) ;
|
||||
temp[i] ) ;
|
||||
|
||||
if (ifile != 0)
|
||||
{
|
||||
logMessage("error reading %s -- missing data substituted....\n",fname);
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -314,8 +344,11 @@ void display_field_read_xmrg (int ** data_array_tmp , char * fname,
|
|||
}
|
||||
}
|
||||
|
||||
if (ifile == 0)
|
||||
if (success)
|
||||
{
|
||||
flogMessage ( stderr , "In routine \"display_field\":\n"
|
||||
"addition_flag = %d\n" , fname , addition_flag ) ;
|
||||
|
||||
for (i=0;i<MAXX;i++)
|
||||
for (j=0;j<MAXY;j++)
|
||||
{
|
||||
|
@ -331,10 +364,11 @@ void display_field_read_xmrg (int ** data_array_tmp , char * fname,
|
|||
data_array_tmp[i][j] = temp[j][i];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
flogMessage(stderr, "\nIn routine 'display_field_read_xmrg':\n"
|
||||
"failed to read file; defaulting data to -999\n");
|
||||
for (i=0;i<MAXX;i++)
|
||||
for (j=0;j<MAXY;j++)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <stdio.h>
|
||||
#include "mpe_log_utils.h"
|
||||
|
||||
const int MPEUtil_num_bytes_to_discard = 94 ;
|
||||
|
||||
|
|
|
@ -8,9 +8,8 @@
|
|||
<bean id="edexIngestUtilWebServer" class="org.eclipse.jetty.server.Server" init-method="start" destroy-method="stop">
|
||||
|
||||
<property name="threadPool">
|
||||
<bean id="ThreadPool" class="org.eclipse.jetty.util.thread.OldQueuedThreadPool">
|
||||
<bean id="ThreadPool" class="org.eclipse.jetty.util.thread.QueuedThreadPool">
|
||||
<property name="minThreads" value="25"/>
|
||||
<property name="lowThreads" value="25"/>
|
||||
<property name="maxThreads" value="50"/>
|
||||
</bean>
|
||||
</property>
|
||||
|
|
|
@ -7,13 +7,26 @@
|
|||
id="gov.noaa.nws.ncep.ui.nsharp.palette"
|
||||
name="Nsharp">
|
||||
</command>
|
||||
<command
|
||||
id="gov.noaa.nws.ncep.ui.nsharp.key"
|
||||
name="Manage shift key">
|
||||
<commandParameter
|
||||
id="action"
|
||||
name="action"
|
||||
optional="false">
|
||||
</commandParameter>
|
||||
</command>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.handlers">
|
||||
<handler
|
||||
class="gov.noaa.nws.ncep.ui.nsharp.NsharpViewAction"
|
||||
commandId="gov.noaa.nws.ncep.ui.nsharp.palette">
|
||||
</handler>
|
||||
</handler>
|
||||
<handler
|
||||
class="gov.noaa.nws.ncep.ui.nsharp.NsharpKeyHandler"
|
||||
commandId="gov.noaa.nws.ncep.ui.nsharp.key">
|
||||
</handler>
|
||||
</extension>
|
||||
|
||||
<extension
|
||||
|
@ -66,4 +79,31 @@
|
|||
extensionFilter=".xml,.txt">
|
||||
</path>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.contexts">
|
||||
<context
|
||||
description="The Natl Centers Nsharp Context"
|
||||
id="gov.noaa.nws.ncep.ui.nsharp.nsharpContext"
|
||||
name="Natl Centers Nsharp Context">
|
||||
</context>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.bindings"
|
||||
id="gov.noaa.nws.ncep.ui.nsharp.nsharpKeyBinding"
|
||||
name="Nsharp Shift Key Binding">
|
||||
<key
|
||||
commandId="gov.noaa.nws.ncep.ui.nsharp.key"
|
||||
contextId="gov.noaa.nws.ncep.ui.nsharp.nsharpContext"
|
||||
schemeId="com.raytheon.viz.ui.awips.scheme"
|
||||
sequence="SHIFT+ARROW_DOWN">
|
||||
<parameter id="action" value="arrowdown" />
|
||||
</key>
|
||||
<key
|
||||
commandId="gov.noaa.nws.ncep.ui.nsharp.key"
|
||||
contextId="gov.noaa.nws.ncep.ui.nsharp.nsharpContext"
|
||||
schemeId="com.raytheon.viz.ui.awips.scheme"
|
||||
sequence="SHIFT+ARROW_UP">
|
||||
<parameter id="action" value="arrowup" />
|
||||
</key>
|
||||
</extension>
|
||||
</plugin>
|
||||
|
|
|
@ -104,6 +104,7 @@ public class NsharpConfigManager {
|
|||
try {
|
||||
//System.out.println("lFile name="+ lFile.getName());
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
Object xmlObj = SerializationUtil.jaxbUnmarshalFromXmlFile(
|
||||
lFile.getFile().getAbsolutePath() );
|
||||
|
||||
|
|
|
@ -523,18 +523,24 @@ public class NsharpConstants {
|
|||
|
||||
public static final int DATA_TIMELINE_X_ORIG = 0;
|
||||
public static final int DATA_TIMELINE_Y_ORIG = 40;
|
||||
public static final int DATA_TIMELINE_WIDTH = TIMESTN_PANE_REC_WIDTH/2;
|
||||
public static final int COLOR_NOTATION_HEIGHT = 110;
|
||||
public static final int DATA_TIMELINE_WIDTH = TIMESTN_PANE_REC_WIDTH * 40 /100;
|
||||
public static final int COLOR_NOTATION_HEIGHT = 165;
|
||||
public static final int DATA_TIMELINE_HEIGHT = TIMESTN_PANE_REC_HEIGHT-DATA_TIMELINE_Y_ORIG-COLOR_NOTATION_HEIGHT;
|
||||
public static final int DATA_TIMELINE_X_END = DATA_TIMELINE_X_ORIG+DATA_TIMELINE_WIDTH;
|
||||
public static final int DATA_TIMELINE_Y_END = DATA_TIMELINE_Y_ORIG+DATA_TIMELINE_HEIGHT;
|
||||
public static final int DATA_TIMELINE_NEXT_PAGE_END_ = DATA_TIMELINE_Y_ORIG+ CHAR_HEIGHT_;
|
||||
public static final int STATION_ID_X_ORIG = DATA_TIMELINE_X_END;
|
||||
public static final int STATION_ID_Y_ORIG = DATA_TIMELINE_Y_ORIG;
|
||||
public static final int STATION_ID_WIDTH = DATA_TIMELINE_WIDTH;
|
||||
public static final int STATION_ID_WIDTH = (TIMESTN_PANE_REC_WIDTH - DATA_TIMELINE_WIDTH)/2;
|
||||
public static final int STATION_ID_HEIGHT = DATA_TIMELINE_HEIGHT;
|
||||
public static final int STATION_ID_X_END = STATION_ID_X_ORIG+STATION_ID_WIDTH;
|
||||
public static final int STATION_ID_Y_END = STATION_ID_Y_ORIG+STATION_ID_HEIGHT;
|
||||
public static final int SND_TYPE_X_ORIG = STATION_ID_X_END;
|
||||
public static final int SND_TYPE_Y_ORIG = DATA_TIMELINE_Y_ORIG;
|
||||
public static final int SND_TYPE_WIDTH = STATION_ID_WIDTH;
|
||||
public static final int SND_TYPE_HEIGHT = DATA_TIMELINE_HEIGHT;
|
||||
public static final int SND_TYPE_X_END = SND_TYPE_X_ORIG+SND_TYPE_WIDTH;
|
||||
public static final int SND_TYPE_Y_END = SND_TYPE_Y_ORIG+ SND_TYPE_HEIGHT;
|
||||
public static final int COLOR_NOTATION_X_ORIG = DATA_TIMELINE_X_ORIG;
|
||||
public static final int COLOR_NOTATION_Y_ORIG = DATA_TIMELINE_Y_END;
|
||||
public static final int COLOR_NOTATION_WIDTH = DATA_TIMELINE_WIDTH+STATION_ID_WIDTH;
|
||||
|
@ -799,8 +805,10 @@ public class NsharpConstants {
|
|||
"Severe Potential Page"
|
||||
};
|
||||
public enum State {
|
||||
CURRENT, ACTIVE, INACTIVE,NOTAVAIL ,OVERLAY, AVAIL//was , DISABLED
|
||||
CURRENT, ACTIVE, INACTIVE,NOTAVAIL , AVAIL, ACTIVE_SRC_COMP, INACTIVE_SRC_COMP,ACTIVE_TM_COMP, INACTIVE_TM_COMP
|
||||
}
|
||||
//public enum LoadState { NOTAVAIL , AVAIL}
|
||||
public enum ActState {CURRENT, ACTIVE, INACTIVE}//, ACTIVE_SRC_COMP, INACTIVE_SRC_COMP,ACTIVE_TM_COMP, INACTIVE_TM_COMP}
|
||||
public enum SPCGraph {
|
||||
EBS, STP, SHIP, WINTER, FIRE, HAIL, SARS
|
||||
}
|
||||
|
|
|
@ -121,6 +121,9 @@ public class NsharpGraphProperty implements ISerializableObject{
|
|||
@XmlJavaTypeAdapter(RGBColorAdapter.class)
|
||||
private RGB windBarbColor= NsharpConstants.color_yellow;
|
||||
|
||||
@XmlAttribute
|
||||
private boolean showFilteredWindInCircle=false;
|
||||
|
||||
public boolean isTemp() {
|
||||
return temp;
|
||||
}
|
||||
|
@ -347,5 +350,13 @@ public class NsharpGraphProperty implements ISerializableObject{
|
|||
this.windBarbColor = windBarbColor;
|
||||
}
|
||||
|
||||
public boolean isShowFilteredWindInCircle() {
|
||||
return showFilteredWindInCircle;
|
||||
}
|
||||
|
||||
public void setShowFilteredWindInCircle(boolean showFilteredWindInCircle) {
|
||||
this.showFilteredWindInCircle = showFilteredWindInCircle;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
package gov.noaa.nws.ncep.ui.nsharp;
|
||||
|
||||
import gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor;
|
||||
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
|
||||
import com.raytheon.uf.viz.core.drawables.IFrameCoordinator;
|
||||
import com.raytheon.viz.ui.tools.AbstractTool;
|
||||
|
||||
public class NsharpKeyHandler extends AbstractTool {
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
NsharpEditor edtor = NsharpEditor.getActiveNsharpEditor();
|
||||
if(edtor!= null&& event.getParameter("action") != null && !event.getParameter("action").isEmpty()){
|
||||
String actionToDo = new String(event.getParameter("action"));
|
||||
|
||||
if( actionToDo.equals("arrowdown")){
|
||||
//System.out.println("Nsharp shift + arrow down ");
|
||||
if(edtor.getRscHandler()!= null)
|
||||
edtor.getRscHandler().setSteppingSndTypeList(IFrameCoordinator.FrameChangeOperation.PREVIOUS );
|
||||
}else if(actionToDo.equals("arrowup")){
|
||||
//System.out.println("Nsharp shift + arrow up");
|
||||
if(edtor.getRscHandler()!= null)
|
||||
edtor.getRscHandler().setSteppingSndTypeList(IFrameCoordinator.FrameChangeOperation.NEXT);
|
||||
}
|
||||
else
|
||||
System.out.println("Nsharp key error");
|
||||
}
|
||||
return super.execute(event);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package gov.noaa.nws.ncep.ui.nsharp;
|
||||
|
||||
import gov.noaa.nws.ncep.ui.nsharp.NsharpConstants.ActState;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* gov.noaa.nws.ncep.ui.nsharp.NsharpSoundingStateProperty
|
||||
*
|
||||
*
|
||||
* This code has been developed by the NCEP-SIB for use in the AWIPS2 system.
|
||||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------- ------- -------- -----------
|
||||
* 06/26/2013 Chin Chen Initial coding
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author Chin Chen
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
|
||||
public class NsharpOperationElement {
|
||||
public String elementDescription;
|
||||
public NsharpConstants.ActState actionState; //possible values are ACTIVE, INACTIVE, CURRENT. set by User. Default is Active
|
||||
public NsharpOperationElement(String elementDescription,
|
||||
ActState actionState) {
|
||||
super();
|
||||
this.elementDescription = elementDescription;
|
||||
this.actionState = actionState;
|
||||
}
|
||||
public String getElementDescription() {
|
||||
return elementDescription;
|
||||
}
|
||||
public void setElementDescription(String elementDescription) {
|
||||
this.elementDescription = elementDescription;
|
||||
}
|
||||
public NsharpConstants.ActState getActionState() {
|
||||
return actionState;
|
||||
}
|
||||
public void setActionState(NsharpConstants.ActState actionState) {
|
||||
this.actionState = actionState;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,5 +1,10 @@
|
|||
package gov.noaa.nws.ncep.ui.nsharp;
|
||||
|
||||
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingLayer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -22,21 +27,36 @@ package gov.noaa.nws.ncep.ui.nsharp;
|
|||
*/
|
||||
|
||||
public class NsharpSoundingElementStateProperty {
|
||||
public String elementDescription;
|
||||
public NsharpConstants.State elementState; // possible values are AVAIL,NOTAVAIL
|
||||
private String elementDescription; //stnId_timeLine_sndType
|
||||
//private NsharpConstants.LoadState elementState; // possible values are AVAIL,NOTAVAIL
|
||||
// NOTAVAIL is set when there is no sounding data loaded for this stn at this time line.
|
||||
public String stnDescription;
|
||||
public String timeDescription;
|
||||
public NsharpStationInfo stnInfo;
|
||||
private String stnDescription;
|
||||
private String timeDescription;
|
||||
private String sndType;
|
||||
private NsharpStationInfo stnInfo;
|
||||
private int compColorIndex;
|
||||
private List<NcSoundingLayer> sndLyLst;
|
||||
private List<NcSoundingLayer> sndLyLstBk;
|
||||
public NsharpSoundingElementStateProperty(String elementDescription,
|
||||
NsharpConstants.State elementState, String stnDescription,
|
||||
String timeDescription, NsharpStationInfo stnInfo) {
|
||||
String stnDescription,
|
||||
String timeDescription, NsharpStationInfo stnInfo, List<NcSoundingLayer> sndLyLst) {
|
||||
super();
|
||||
this.elementDescription = elementDescription;
|
||||
this.elementState = elementState;
|
||||
//this.elementState = elementState;
|
||||
this.stnDescription = stnDescription;
|
||||
this.timeDescription = timeDescription;
|
||||
this.stnInfo = stnInfo;
|
||||
this.sndType = stnInfo.getSndType();
|
||||
this.compColorIndex = NsharpConstants.LINE_COMP1;;
|
||||
this.sndLyLst = sndLyLst;
|
||||
sndLyLstBk= new ArrayList<NcSoundingLayer>(sndLyLst.size());
|
||||
for(NcSoundingLayer ly : sndLyLst){
|
||||
try {
|
||||
sndLyLstBk.add((NcSoundingLayer)ly.clone());
|
||||
} catch (CloneNotSupportedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public NsharpSoundingElementStateProperty() {
|
||||
|
@ -50,12 +70,7 @@ public class NsharpSoundingElementStateProperty {
|
|||
public void setElementDescription(String elementDescription) {
|
||||
this.elementDescription = elementDescription;
|
||||
}
|
||||
public NsharpConstants.State getElementState() {
|
||||
return elementState;
|
||||
}
|
||||
public void setElementState(NsharpConstants.State elementState) {
|
||||
this.elementState = elementState;
|
||||
}
|
||||
|
||||
public String getStnDescription() {
|
||||
return stnDescription;
|
||||
}
|
||||
|
@ -77,12 +92,47 @@ public class NsharpSoundingElementStateProperty {
|
|||
this.stnInfo = stnInfo;
|
||||
}
|
||||
|
||||
public void copy(NsharpSoundingElementStateProperty target){
|
||||
elementDescription = target.getElementDescription();
|
||||
elementState= target.getElementState();
|
||||
stnDescription=target.getStnDescription();
|
||||
stnInfo = target.getStnInfo();
|
||||
timeDescription=target.getTimeDescription();
|
||||
|
||||
public int getCompColorIndex() {
|
||||
return compColorIndex;
|
||||
}
|
||||
|
||||
public void setCompColorIndex(int compColorIndex) {
|
||||
this.compColorIndex = compColorIndex;
|
||||
}
|
||||
|
||||
public String getSndType() {
|
||||
return sndType;
|
||||
}
|
||||
|
||||
public void setSndType(String sndType) {
|
||||
this.sndType = sndType;
|
||||
}
|
||||
|
||||
public List<NcSoundingLayer> getSndLyLst() {
|
||||
return sndLyLst;
|
||||
}
|
||||
|
||||
public void setSndLyLst(List<NcSoundingLayer> sndLyLst) {
|
||||
this.sndLyLst = sndLyLst;
|
||||
}
|
||||
|
||||
public List<NcSoundingLayer> getSndLyLstBk() {
|
||||
return sndLyLstBk;
|
||||
}
|
||||
|
||||
public void setSndLyLstBk(List<NcSoundingLayer> sndLyLstBk) {
|
||||
this.sndLyLstBk = sndLyLstBk;
|
||||
}
|
||||
public void restoreSndLyLstFromBackup(){
|
||||
sndLyLst.clear();
|
||||
for(NcSoundingLayer ly : sndLyLstBk){
|
||||
try {
|
||||
sndLyLst.add((NcSoundingLayer)ly.clone());
|
||||
} catch (CloneNotSupportedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -43,14 +43,12 @@ public class NsharpStationInfo {
|
|||
|
||||
}
|
||||
protected List<timeLineSpecific> timeLineSpList = new ArrayList<timeLineSpecific>();
|
||||
//Chin PER protected float latitude;
|
||||
//protected float longitude;
|
||||
protected double latitude;
|
||||
protected double longitude;
|
||||
protected Timestamp reftime; //uair (same as Synoptictime in uair)
|
||||
protected Timestamp rangestarttime; //rangestart used by model sounding e.g. PFC sounding, or uair (same as Synoptictime in uair)
|
||||
protected String stnDisplayInfo;
|
||||
protected String sndType;
|
||||
protected String sndType="N/A";
|
||||
protected String stnId;
|
||||
|
||||
|
||||
|
|
|
@ -261,6 +261,7 @@ public class NsharpSkewTPaneBackground extends NsharpGenericPaneBackground {
|
|||
if(target==null)
|
||||
return;
|
||||
String s = "";
|
||||
|
||||
presslinesNumbersShape = target.createWireframeShape(false,desc );
|
||||
presslinesNumbersShape.allocate(150);
|
||||
// System.out.println("NsharpConstants.left="+NsharpConstants.left+"NsharpConstants.right"+NsharpConstants.right+" top="+NsharpConstants.top + " bot="+ NsharpConstants.bottom);
|
||||
|
@ -288,9 +289,9 @@ public class NsharpSkewTPaneBackground extends NsharpGenericPaneBackground {
|
|||
double [][] lines = {{world.mapX(NsharpConstants.left), world.mapY(coor.y)},{ world.mapX(NsharpConstants.left)+15* currentZoomLevel*xRatio,
|
||||
world.mapY(coor.y)}};
|
||||
presslinesNumbersShape.addLineSegment(lines);
|
||||
//System.out.println("coor.x="+coor.x+"coor.y="+coor.y);
|
||||
//System.out.println("lines="+ lines[0] + "; "+ lines[1]);
|
||||
//System.out.println("x1="+world.mapX(NsharpConstants.left)+"y1=" +world.mapY(coor.y)+"x2="+world.mapX(NsharpConstants.right)+"y2="+
|
||||
// world.mapY(coor.y));
|
||||
// world.mapY(coor.y));
|
||||
}
|
||||
IExtent ext = desc.getRenderableDisplay().getExtent();
|
||||
double xmin = ext.getMinX(); //Extent's viewable envelope min x and y
|
||||
|
@ -372,6 +373,7 @@ public class NsharpSkewTPaneBackground extends NsharpGenericPaneBackground {
|
|||
target.drawLine(xmin, world.mapY(coor.y), 0.0, xend,
|
||||
world.mapY(coor.y), 0.0,
|
||||
NsharpConstants.pressureColor, 1);
|
||||
//System.out.println("lines ="+ NsharpConstants.PRESSURE_MARK_LEVELS[i] + "; "+ world.mapY(coor.y));
|
||||
} catch (VizException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -39,7 +39,7 @@ import com.raytheon.viz.ui.panes.VizDisplayPane;
|
|||
public class NsharpAbstractMouseHandler extends InputHandlerDefaultImpl{//implements IInputHandler {
|
||||
|
||||
protected enum Mode {
|
||||
CREATE, SKEWT_DOWN, HODO_DOWN, HODO_DOWN_MOVE, TIMELINE_DOWN, STATIONID_DOWN, PARCELLINE_DOWN, HODO_WIND_MOTION_DOWN
|
||||
CREATE, SKEWT_DOWN, HODO_DOWN, HODO_DOWN_MOVE, TIMELINE_DOWN, STATIONID_DOWN,SNDTYPE_DOWN, PARCELLINE_DOWN, HODO_WIND_MOTION_DOWN
|
||||
};
|
||||
protected static Display display;
|
||||
protected NsharpEditor editor;
|
||||
|
|
|
@ -27,7 +27,6 @@ import java.util.List;
|
|||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import org.geotools.referencing.crs.DefaultEngineeringCRS;
|
||||
|
||||
|
|
|
@ -67,7 +67,6 @@ import com.raytheon.uf.viz.core.IDisplayPane;
|
|||
import com.raytheon.uf.viz.core.IRenderableDisplayChangedListener;
|
||||
import com.raytheon.uf.viz.core.PixelExtent;
|
||||
import com.raytheon.uf.viz.core.datastructure.LoopProperties;
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
|
||||
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
@ -796,6 +795,8 @@ public class NsharpEditor extends AbstractEditor implements IRenderableDisplayC
|
|||
NsharpConfigStore configStore = configMgr.retrieveNsharpConfigStoreFromFs();
|
||||
NsharpGraphProperty graphConfigProperty = configStore.getGraphProperty();
|
||||
paneConfigurationName = graphConfigProperty.getPaneConfigurationName();
|
||||
if(!paneConfigurationName.equals(NsharpConstants.PANE_SPCWS_CFG_STR) && !paneConfigurationName.equals(NsharpConstants.PANE_SIMPLE_D2D_CFG_STR))
|
||||
paneConfigurationName = NsharpConstants.PANE_SIMPLE_D2D_CFG_STR;
|
||||
initDisplayPublicParms();
|
||||
createRenderableDisplayArray();
|
||||
/*
|
||||
|
@ -881,7 +882,7 @@ public class NsharpEditor extends AbstractEditor implements IRenderableDisplayC
|
|||
if(paletteWin!=null){
|
||||
paletteWin.restorePaletteWindow(paneConfigurationName, rscHandler.getCurrentGraphMode(),
|
||||
rscHandler.isInterpolateIsOn(), rscHandler.isOverlayIsOn(),
|
||||
rscHandler.isCompareStnIsOn(),rscHandler.isCompareTmIsOn(),rscHandler.isEditGraphOn());
|
||||
rscHandler.isCompareStnIsOn(),rscHandler.isCompareTmIsOn(),rscHandler.isEditGraphOn(), rscHandler.isCompareSndIsOn());
|
||||
}
|
||||
createPaneResource();
|
||||
|
||||
|
@ -1122,8 +1123,17 @@ public class NsharpEditor extends AbstractEditor implements IRenderableDisplayC
|
|||
//System.out.println("SkewtEditor getDisplayPanes called");
|
||||
//return getDisplayPaneArray();//this.displayPane;
|
||||
// changed for D2D
|
||||
if(displayPane.length <=0)
|
||||
try {
|
||||
throw new VizException("Display pane is not available!");
|
||||
} catch (VizException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
IDisplayPane[] pan = { displayPane[DISPLAY_SKEWT]};
|
||||
return pan;
|
||||
|
||||
|
||||
}
|
||||
public IRenderableDisplay[] getRenderableDisplays() {
|
||||
IRenderableDisplay[] displays = new IRenderableDisplay[displayPane.length];
|
||||
|
@ -1171,7 +1181,7 @@ public class NsharpEditor extends AbstractEditor implements IRenderableDisplayC
|
|||
|
||||
@Override
|
||||
protected PaneManager getNewPaneManager() {
|
||||
|
||||
//return new PaneManager();
|
||||
return null;
|
||||
}
|
||||
private void initDisplayPublicParms(){
|
||||
|
|
|
@ -99,8 +99,8 @@ public class NsharpSkewTPaneDescriptor extends NsharpAbstractPaneDescriptor {
|
|||
waitTime = loopProperties.getFwdFrameTime();
|
||||
else
|
||||
waitTime = loopProperties.getRevFrameTime();
|
||||
int frameSize= rscHandler.getTimeLineStateListSize();
|
||||
int curFrameIndex = rscHandler.getCurrentTimeLineStateListIndex();
|
||||
int frameSize= rscHandler.getTimeElementListSize();
|
||||
int curFrameIndex = rscHandler.getCurrentTimeElementListIndex();
|
||||
if(curFrameIndex == 0)
|
||||
waitTime = loopProperties.getFirstFrameDwell();
|
||||
else if(curFrameIndex == frameSize-1)
|
||||
|
@ -135,7 +135,7 @@ public class NsharpSkewTPaneDescriptor extends NsharpAbstractPaneDescriptor {
|
|||
//Chin Note: there are multiple (6) panes.
|
||||
//However, we only need to step once. Therefore, only handle stepping by skewt pane.
|
||||
//From stepping commands
|
||||
//System.out.println("NsharpAbstractPaneDescriptor changeFrame called pane= "+paneNumber);
|
||||
//System.out.println("NsharpAbstractPaneDescriptor changeFrame called ");
|
||||
if( VizPerspectiveListener.getCurrentPerspectiveManager()!= null){
|
||||
//System.out.println("changeFrame: current perspective ="+VizPerspectiveListener.getCurrentPerspectiveManager().getPerspectiveId());
|
||||
if(!VizPerspectiveListener.getCurrentPerspectiveManager().getPerspectiveId().equals(NmapCommon.NatlCntrsPerspectiveID)){
|
||||
|
|
|
@ -51,9 +51,10 @@ public class NsharpSkewTPaneMouseHandler extends NsharpAbstractMouseHandler{
|
|||
@Override
|
||||
public boolean handleKeyDown(int keyCode) {
|
||||
//System.out.println("key down="+(char)keyCode+ " code ="+keyCode);
|
||||
|
||||
if ((keyCode & SWT.SHIFT) != 0) {
|
||||
shiftDown = true;
|
||||
//System.out.println("shift pressed");
|
||||
|
||||
return true;
|
||||
} else if (shiftDown && keyCode == KEY_Z ) {
|
||||
zDownWhileShiftDown=true;
|
||||
|
@ -70,23 +71,7 @@ public class NsharpSkewTPaneMouseHandler extends NsharpAbstractMouseHandler{
|
|||
return false;
|
||||
}
|
||||
NsharpSkewTPaneResource skewRsc = (NsharpSkewTPaneResource)getDescriptor().getPaneResource();
|
||||
// Arrow key handling is now under NsharpSkewTPaneDescriptor.frameCoordinator.changeFrame()
|
||||
/*if (keyCode == SWT.ARROW_DOWN) {
|
||||
skewRsc.getRscHandler().setSteppingStnIdList(FrameChangeOperation.NEXT) ;
|
||||
return true;
|
||||
}else if (keyCode == SWT.ARROW_UP) {
|
||||
//System.out.println("Arrow up");
|
||||
skewRsc.getRscHandler().setSteppingStnIdList(FrameChangeOperation.PREVIOUS) ;
|
||||
return true;
|
||||
}else if (keyCode == SWT.ARROW_LEFT) {
|
||||
//System.out.println("Arrow left");
|
||||
skewRsc.getRscHandler().setSteppingTimeLine(FrameChangeOperation.PREVIOUS, FrameChangeMode.TIME_ONLY) ;
|
||||
return true;
|
||||
}else if (keyCode == SWT.ARROW_RIGHT) {
|
||||
//System.out.println("Arrow right");
|
||||
skewRsc.getRscHandler().setSteppingTimeLine(FrameChangeOperation.NEXT, FrameChangeMode.TIME_ONLY) ;
|
||||
return true;
|
||||
} else */if (keyCode == SWT.SHIFT) {
|
||||
if (keyCode == SWT.SHIFT) {
|
||||
shiftDown = false;
|
||||
return true;
|
||||
}else if (zDownWhileShiftDown && keyCode == KEY_Z ) {
|
||||
|
@ -97,21 +82,7 @@ public class NsharpSkewTPaneMouseHandler extends NsharpAbstractMouseHandler{
|
|||
}
|
||||
return false;
|
||||
}
|
||||
/*public static void startEditingCursor(){
|
||||
editingCursor = new Cursor( display, SWT.CURSOR_CROSS);
|
||||
cursorControl = display.getCursorControl();
|
||||
if(cursorControl!=null && editingCursor!=null)
|
||||
cursorControl.setCursor(editingCursor);
|
||||
}
|
||||
public static void stopEditingCursor(){
|
||||
if(editingCursor!=null&&cursorControl!=null ){
|
||||
cursorControl.setCursor(null);
|
||||
}
|
||||
if(editingCursor!=null){
|
||||
editingCursor.dispose();
|
||||
editingCursor= null;
|
||||
}
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public boolean handleMouseDown(int x, int y, int mouseButton) {
|
||||
//ystem.out.println("handleMouseDown x="+ x+ " y="+y);
|
||||
|
@ -256,18 +227,15 @@ public class NsharpSkewTPaneMouseHandler extends NsharpAbstractMouseHandler{
|
|||
this.mode = Mode.CREATE;
|
||||
NsharpSkewTPaneResource skewRsc = (NsharpSkewTPaneResource)getDescriptor().getPaneResource();
|
||||
if(editor != null && skewRsc !=null) {
|
||||
Coordinate c = editor.translateClick(x, y);
|
||||
Coordinate currentCursorCoord = editor.translateClick(x, y);
|
||||
//System.out.println(" skewt-handleMouseMove! x="+x+" y="+y+" C.x="+c.x + " c.y="+c.y);
|
||||
if (skewRsc.getSkewTBackground().contains(c)){
|
||||
if (skewRsc.getSkewTBackground().contains(currentCursorCoord)){
|
||||
//always update coordinate C to SkewT editor
|
||||
boolean graphEditOn = skewRsc.getRscHandler().isEditGraphOn();
|
||||
if(graphEditOn == true){
|
||||
//Point curPoint = display.getCursorLocation();
|
||||
//int xdiff = x- curPoint.x;
|
||||
//int ydiff = y- curPoint.y;
|
||||
Coordinate anchoredPtC;
|
||||
//get editing cursor point
|
||||
anchoredPtC= skewRsc.getPickedTempPoint(c);
|
||||
anchoredPtC= skewRsc.getPickedTempPoint(currentCursorCoord);
|
||||
int currentSkewTEditMode = skewRsc.getCurrentSkewTEditMode();
|
||||
if(anchoredPtC.x != 0 || anchoredPtC.y!=0){
|
||||
//cursor is within editing range ( i.e within 2 degree range from temp/dew line)
|
||||
|
@ -281,10 +249,16 @@ public class NsharpSkewTPaneMouseHandler extends NsharpAbstractMouseHandler{
|
|||
display.getCursorControl().setCursor(null);
|
||||
}
|
||||
}
|
||||
//cursorInSkewT=true;
|
||||
/* TBDWB
|
||||
else if(false){
|
||||
//find wind barb point that closet to current cursor position
|
||||
skewRsc.findClosestWindBarbPoint(currentCursorCoord);
|
||||
//do nothing here now. findClosestWindBarbPoint() already handle things for wind barb plotting to use
|
||||
}*/
|
||||
|
||||
skewRsc.setCursorInSkewT(true);
|
||||
try {
|
||||
skewRsc.updateDynamicData(c);
|
||||
skewRsc.updateDynamicData(currentCursorCoord);
|
||||
editor.refresh();
|
||||
} catch (VizException e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -50,11 +50,12 @@ public class NsharpTimeStnPaneMouseHandler extends NsharpAbstractMouseHandler{
|
|||
NsharpTimeStnPaneResource timeStnRsc = (NsharpTimeStnPaneResource)getDescriptor().getPaneResource();
|
||||
if(timeStnRsc.getTimeLineRectangle().contains((int) c.x, (int) c.y)== true) {
|
||||
this.mode = Mode.TIMELINE_DOWN;
|
||||
//changeMouse(this.mode);
|
||||
}
|
||||
else if(timeStnRsc.getStnIdRectangle().contains((int) c.x, (int) c.y) == true) {
|
||||
this.mode = Mode.STATIONID_DOWN;
|
||||
//changeMouse(this.mode);
|
||||
}
|
||||
else if(timeStnRsc.getSndRectangle().contains((int) c.x, (int) c.y) == true) {
|
||||
this.mode = Mode.SNDTYPE_DOWN;
|
||||
}
|
||||
editor.refresh();
|
||||
}
|
||||
|
@ -89,6 +90,11 @@ public class NsharpTimeStnPaneMouseHandler extends NsharpAbstractMouseHandler{
|
|||
timeStnRsc.getRscHandler().handleUserClickOnStationId(c);
|
||||
handleMouseMove(x,y);
|
||||
}
|
||||
else if(timeStnRsc.getSndRectangle().contains((int) c.x, (int) c.y) == true && this.mode == Mode.SNDTYPE_DOWN) {
|
||||
//stn id line has been touched, and may be changed
|
||||
timeStnRsc.getRscHandler().handleUserClickOnSndLine(c);
|
||||
handleMouseMove(x,y);
|
||||
}
|
||||
|
||||
this.mode = Mode.CREATE;
|
||||
} else if(mouseButton == 3){
|
||||
|
|
|
@ -22,56 +22,48 @@
|
|||
package gov.noaa.nws.ncep.ui.nsharp.display.map;
|
||||
|
||||
|
||||
import java.awt.Color;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Cursor;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.IViewPart;
|
||||
import org.eclipse.ui.IWorkbenchPage;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.opengis.referencing.crs.CoordinateReferenceSystem;
|
||||
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.PixelExtent;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
||||
import com.raytheon.uf.viz.core.map.IMapDescriptor;
|
||||
import com.raytheon.uf.viz.core.map.MapDescriptor;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
||||
import com.raytheon.uf.viz.core.rsc.IInputHandler;
|
||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||
import com.raytheon.uf.viz.core.rsc.ResourceProperties;
|
||||
import com.raytheon.uf.viz.core.rsc.ResourceList.RemoveListener;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.EditableCapability;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.viz.ui.EditorUtil;
|
||||
import com.raytheon.viz.ui.editor.AbstractEditor;
|
||||
import com.raytheon.viz.ui.input.EditableManager;
|
||||
|
||||
import gov.noaa.nws.ncep.viz.common.display.NcDisplayType;
|
||||
import gov.noaa.nws.ncep.viz.localization.NcPathManager;
|
||||
import gov.noaa.nws.ncep.viz.localization.NcPathManager.NcPathConstants;
|
||||
import gov.noaa.nws.ncep.viz.resources.manager.ResourceBndlLoader;
|
||||
import gov.noaa.nws.ncep.viz.ui.display.NatlCntrsEditor;
|
||||
import gov.noaa.nws.ncep.viz.ui.display.AbstractNcEditor;
|
||||
import gov.noaa.nws.ncep.viz.ui.display.NcEditorUtil;
|
||||
import gov.noaa.nws.ncep.viz.ui.display.NatlCntrsEditor;
|
||||
import gov.noaa.nws.ncep.viz.ui.display.NcDisplayMngr;
|
||||
|
||||
import gov.noaa.nws.ncep.ui.nsharp.NsharpConstants;
|
||||
import gov.noaa.nws.ncep.ui.nsharp.NsharpStationInfo;
|
||||
import gov.noaa.nws.ncep.ui.nsharp.view.NsharpPaletteWindow;
|
||||
import gov.noaa.nws.ncep.ui.pgen.display.DisplayElementFactory;
|
||||
import gov.noaa.nws.ncep.ui.pgen.display.IDisplayable;
|
||||
import gov.noaa.nws.ncep.ui.pgen.elements.SymbolLocationSet;
|
||||
import gov.noaa.nws.ncep.viz.common.display.NcDisplayType;
|
||||
import gov.noaa.nws.ncep.viz.resources.manager.ResourceBndlLoader;
|
||||
import gov.noaa.nws.ncep.viz.ui.display.NatlCntrsEditor;
|
||||
import gov.noaa.nws.ncep.viz.ui.display.NcDisplayMngr;
|
||||
import gov.noaa.nws.ncep.viz.ui.display.NcEditorUtil;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Cursor;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.ui.IViewPart;
|
||||
import org.eclipse.ui.IWorkbenchPage;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.opengis.referencing.crs.CoordinateReferenceSystem;
|
||||
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.PixelExtent;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.map.IMapDescriptor;
|
||||
import com.raytheon.uf.viz.core.map.MapDescriptor;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
||||
import com.raytheon.uf.viz.core.rsc.IInputHandler;
|
||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||
import com.raytheon.uf.viz.core.rsc.ResourceList.RemoveListener;
|
||||
import com.raytheon.uf.viz.core.rsc.ResourceProperties;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.EditableCapability;
|
||||
import com.raytheon.viz.ui.editor.AbstractEditor;
|
||||
import com.raytheon.viz.ui.input.EditableManager;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
|
||||
|
||||
public class NsharpMapResource extends AbstractVizResource<NsharpMapResourceData,MapDescriptor>
|
||||
|
@ -160,7 +152,6 @@ public class NsharpMapResource extends AbstractVizResource<NsharpMapResourceDat
|
|||
waitCursor= null;
|
||||
}
|
||||
}
|
||||
@SuppressWarnings("unused")
|
||||
private static void createMapEditor(){
|
||||
// create an editor MapEditor
|
||||
try {
|
||||
|
|
|
@ -337,9 +337,7 @@ public class NsharpDataPaneResource extends NsharpAbstractPaneResource{
|
|||
float layerPressure1 = NsharpNativeConstants.parcelToLayerMap.get(parcelNumber);
|
||||
if(parcelNumber == NsharpNativeConstants.PARCELTYPE_USER_DEFINED){
|
||||
//get user selected parcel type, if available
|
||||
if(NsharpParcelDialog.getAccess() != null){
|
||||
layerPressure1 = NsharpParcelDialog.getAccess().getUserDefdParcelMb();
|
||||
}
|
||||
layerPressure1 = NsharpParcelDialog.getUserDefdParcelMb();
|
||||
}
|
||||
//System.out.println("drawPanel1-1 called define_parcel pType="+parcelNumber+" pre="+ layerPressure1);
|
||||
|
||||
|
@ -439,11 +437,7 @@ public class NsharpDataPaneResource extends NsharpAbstractPaneResource{
|
|||
target.drawLine(rect.x, curY, 0.0, rect.x+rect.width, curY, 0.0, NsharpConstants.color_white, 1);
|
||||
parcelLineYEnd= curY;
|
||||
if(currentParcel == NsharpNativeConstants.PARCELTYPE_USER_DEFINED){
|
||||
if(NsharpParcelDialog.getAccess() != null){
|
||||
layerPressure = NsharpParcelDialog.getAccess().getUserDefdParcelMb();
|
||||
}
|
||||
else
|
||||
layerPressure = NsharpNativeConstants.parcelToLayerMap.get(currentParcel);
|
||||
layerPressure = NsharpParcelDialog.getUserDefdParcelMb();
|
||||
}
|
||||
else
|
||||
layerPressure = NsharpNativeConstants.parcelToLayerMap.get(currentParcel);
|
||||
|
@ -1099,11 +1093,7 @@ public class NsharpDataPaneResource extends NsharpAbstractPaneResource{
|
|||
//System.out.println("drawPanel2-2 called define_parcel pType="+oldlplchoice+" pre="+ pres);
|
||||
try{
|
||||
if(oldlplchoice == NsharpNativeConstants.PARCELTYPE_USER_DEFINED){
|
||||
if(NsharpParcelDialog.getAccess() != null){
|
||||
pres = NsharpParcelDialog.getAccess().getUserDefdParcelMb();
|
||||
}
|
||||
else
|
||||
pres = NsharpNativeConstants.parcelToLayerMap.get(oldlplchoice);
|
||||
pres = NsharpParcelDialog.getUserDefdParcelMb();
|
||||
}
|
||||
else
|
||||
pres = NsharpNativeConstants.parcelToLayerMap.get(oldlplchoice);
|
||||
|
@ -1429,10 +1419,7 @@ public class NsharpDataPaneResource extends NsharpAbstractPaneResource{
|
|||
hdrStr = NsharpNativeConstants.parcelToHdrStrMap.get(currentParcel);
|
||||
layerPressure = NsharpNativeConstants.parcelToLayerMap.get(currentParcel);
|
||||
if(currentParcel == NsharpNativeConstants.PARCELTYPE_USER_DEFINED ){
|
||||
if(NsharpParcelDialog.getAccess() != null){
|
||||
layerPressure = NsharpParcelDialog.getAccess().getUserDefdParcelMb();
|
||||
}
|
||||
|
||||
layerPressure = NsharpParcelDialog.getUserDefdParcelMb();
|
||||
hdrStr = String.format(hdrStr, layerPressure);
|
||||
}
|
||||
curY = curY + charHeight;
|
||||
|
@ -2744,8 +2731,8 @@ public class NsharpDataPaneResource extends NsharpAbstractPaneResource{
|
|||
// set default
|
||||
//short currentParcel;
|
||||
float layerPressure;
|
||||
if(currentParcel == NsharpNativeConstants.PARCELTYPE_USER_DEFINED && NsharpParcelDialog.getAccess() != null){
|
||||
layerPressure = NsharpParcelDialog.getAccess().getUserDefdParcelMb();
|
||||
if(currentParcel == NsharpNativeConstants.PARCELTYPE_USER_DEFINED ){
|
||||
layerPressure = NsharpParcelDialog.getUserDefdParcelMb();
|
||||
}
|
||||
else
|
||||
layerPressure = NsharpNativeConstants.parcelToLayerMap.get(currentParcel);
|
||||
|
|
|
@ -20,15 +20,13 @@ package gov.noaa.nws.ncep.ui.nsharp.display.rsc;
|
|||
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingLayer;
|
||||
import gov.noaa.nws.ncep.ui.nsharp.NsharpConstants;
|
||||
import gov.noaa.nws.ncep.ui.nsharp.NsharpGraphProperty;
|
||||
import gov.noaa.nws.ncep.ui.nsharp.NsharpOperationElement;
|
||||
import gov.noaa.nws.ncep.ui.nsharp.NsharpShapeAndLineProperty;
|
||||
import gov.noaa.nws.ncep.ui.nsharp.NsharpSoundingElementStateProperty;
|
||||
import gov.noaa.nws.ncep.ui.nsharp.NsharpStationStateProperty;
|
||||
import gov.noaa.nws.ncep.ui.nsharp.NsharpTimeLineStateProperty;
|
||||
import gov.noaa.nws.ncep.ui.nsharp.background.NsharpHodoPaneBackground;
|
||||
import gov.noaa.nws.ncep.ui.nsharp.display.NsharpHodoPaneDescriptor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.swt.graphics.GC;
|
||||
|
@ -69,16 +67,9 @@ public class NsharpHodoPaneResource extends NsharpAbstractPaneResource{
|
|||
private IWireframeShape hodoWindMotionBoxShape = null;
|
||||
private boolean cursorInHodo=false;
|
||||
private Integer markerWidth = 1;
|
||||
private List<NsharpTimeLineStateProperty> timeLineStateList;
|
||||
private List<NsharpStationStateProperty> stnStateList;
|
||||
private IFont fixedFont;
|
||||
private int hodoWidth = NsharpConstants.HODO_WIDTH;
|
||||
private int hodoHeight = NsharpConstants.HODO_HEIGHT;
|
||||
//private int hodoXOrig = NsharpConstants.HODO_X_ORIG;
|
||||
//private int hodoYOrig = NsharpConstants.HODO_Y_ORIG;
|
||||
//private int hodoXEnd = NsharpConstants.HODO_X_END;
|
||||
//private int hodoYEnd = NsharpConstants.HODO_Y_ORIG+ NsharpConstants.HODO_HEIGHT;
|
||||
//private Coordinate hodoHouseC = new Coordinate(NsharpConstants.HODO_CENTER_X_, NsharpConstants.HODO_CENTER_Y_);
|
||||
private float xRatio=1;
|
||||
private float yRatio=1;
|
||||
public NsharpHodoPaneResource(AbstractResourceData resourceData,
|
||||
|
@ -188,38 +179,46 @@ public class NsharpHodoPaneResource extends NsharpAbstractPaneResource{
|
|||
}
|
||||
world = hodoBackground.computeWorld();
|
||||
boolean compareStnIsOn = rscHandler.isCompareStnIsOn();
|
||||
int currentTimeLineStateListIndex = rscHandler.getCurrentTimeLineStateListIndex();
|
||||
int currentTimeListIndex = rscHandler.getCurrentTimeElementListIndex();
|
||||
int currentStnListIndex = rscHandler.getCurrentStnElementListIndex();
|
||||
int currentSndListIndex = rscHandler.getCurrentSndElementListIndex();
|
||||
List<NsharpOperationElement> stnElemList = rscHandler.getStnElementList();
|
||||
List<NsharpOperationElement> timeElemList = rscHandler.getTimeElementList();
|
||||
List<NsharpOperationElement> sndElemList = rscHandler.getSndElementList();
|
||||
List<List<List<NsharpSoundingElementStateProperty>>> stnTimeSndTable = rscHandler.getStnTimeSndTable();
|
||||
boolean compareTmIsOn = rscHandler.isCompareTmIsOn();
|
||||
boolean compareSndIsOn = rscHandler.isCompareSndIsOn();
|
||||
boolean overlayIsOn = rscHandler.isOverlayIsOn();
|
||||
int currentStnStateListIndex = rscHandler.getCurrentStnStateListIndex();
|
||||
stnStateList = rscHandler.getStnStateList();
|
||||
timeLineStateList = rscHandler.getTimeLineStateList();
|
||||
List<List<NsharpSoundingElementStateProperty>> stnTimeTable = rscHandler.getStnTimeTable();
|
||||
HashMap<String, List<NcSoundingLayer>> dataTimelineSndLysListMap = rscHandler.getDataTimelineSndLysListMap();
|
||||
if(compareStnIsOn && currentTimeLineStateListIndex >=0){
|
||||
int colorIndex =NsharpConstants.LINE_COMP1;
|
||||
for(NsharpStationStateProperty elm: stnStateList) {
|
||||
if(elm.stnState == NsharpConstants.State.ACTIVE &&
|
||||
stnTimeTable.get(stnStateList.indexOf(elm)).get(currentTimeLineStateListIndex).elementState == NsharpConstants.State.AVAIL){
|
||||
List<NcSoundingLayer> soundingLayeys = dataTimelineSndLysListMap.get(stnTimeTable.get(stnStateList.indexOf(elm)).get(currentTimeLineStateListIndex).elementDescription);
|
||||
|
||||
if(compareStnIsOn && currentTimeListIndex >=0 && currentSndListIndex >=0){
|
||||
for(NsharpOperationElement elm: stnElemList) {
|
||||
if(elm.getActionState() == NsharpConstants.ActState.ACTIVE &&
|
||||
stnTimeSndTable.get(stnElemList.indexOf(elm)).get(currentTimeListIndex).get(currentSndListIndex)!=null){
|
||||
List<NcSoundingLayer> soundingLayeys = stnTimeSndTable.get(stnElemList.indexOf(elm)).get(currentTimeListIndex).get(currentSndListIndex).getSndLyLst();
|
||||
int colorIndex = stnTimeSndTable.get(stnElemList.indexOf(elm)).get(currentTimeListIndex).get(currentSndListIndex).getCompColorIndex();
|
||||
RGB color = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]).getLineColor();
|
||||
colorIndex++;
|
||||
if(colorIndex > NsharpConstants.LINE_COMP10)
|
||||
colorIndex =NsharpConstants.LINE_COMP1;
|
||||
createRscHodoWindShape(world, soundingLayeys, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(compareTmIsOn && currentStnStateListIndex >=0 ){
|
||||
int colorIndex =NsharpConstants.LINE_COMP1;
|
||||
for(NsharpTimeLineStateProperty elm: timeLineStateList) {
|
||||
if(elm.timeState == NsharpConstants.State.ACTIVE &&
|
||||
stnTimeTable.get(currentStnStateListIndex).get(timeLineStateList.indexOf(elm)).elementState == NsharpConstants.State.AVAIL){
|
||||
List<NcSoundingLayer> soundingLayeys = dataTimelineSndLysListMap.get(stnTimeTable.get(currentStnStateListIndex).get(timeLineStateList.indexOf(elm)).elementDescription);
|
||||
else if(compareTmIsOn && currentStnListIndex >=0 && currentSndListIndex >=0 ){
|
||||
for(NsharpOperationElement elm: timeElemList) {
|
||||
if(elm.getActionState() == NsharpConstants.ActState.ACTIVE &&
|
||||
stnTimeSndTable.get(currentStnListIndex).get(timeElemList.indexOf(elm)).get(currentSndListIndex)!=null){
|
||||
List<NcSoundingLayer> soundingLayeys = stnTimeSndTable.get(currentStnListIndex).get(timeElemList.indexOf(elm)).get(currentSndListIndex).getSndLyLst(); // dataTimelineSndLysListMap.get(stnTimeSndTable.get(currentStnListIndex).get(timeElemList.indexOf(elm)).get(currentSndListIndex).getElementDescription());
|
||||
int colorIndex = stnTimeSndTable.get(currentStnListIndex).get(timeElemList.indexOf(elm)).get(currentSndListIndex).getCompColorIndex();
|
||||
RGB color = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]).getLineColor();
|
||||
createRscHodoWindShape(world, soundingLayeys, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(compareSndIsOn && currentStnListIndex >=0 && currentTimeListIndex >=0){
|
||||
for(NsharpOperationElement elm: sndElemList) {
|
||||
if(elm.getActionState() == NsharpConstants.ActState.ACTIVE &&
|
||||
stnTimeSndTable.get(currentStnListIndex).get(currentTimeListIndex).get(sndElemList.indexOf(elm))!=null){
|
||||
List<NcSoundingLayer> soundingLayeys = stnTimeSndTable.get(currentStnListIndex).get(currentTimeListIndex).get(sndElemList.indexOf(elm)).getSndLyLst(); //dataTimelineSndLysListMap.get(stnTimeSndTable.get(currentStnListIndex).get(currentTimeListIndex).get(sndElemList.indexOf(elm)).getElementDescription());
|
||||
int colorIndex = stnTimeSndTable.get(currentStnListIndex).get(currentTimeListIndex).get(sndElemList.indexOf(elm)).getCompColorIndex();
|
||||
RGB color = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]).getLineColor();
|
||||
colorIndex++;
|
||||
if(colorIndex > NsharpConstants.LINE_COMP10)
|
||||
colorIndex =NsharpConstants.LINE_COMP1;
|
||||
createRscHodoWindShape(world, soundingLayeys, color);
|
||||
}
|
||||
}
|
||||
|
@ -560,8 +559,6 @@ public class NsharpHodoPaneResource extends NsharpAbstractPaneResource{
|
|||
if(rscHandler==null)
|
||||
return;
|
||||
|
||||
timeLineStateList = rscHandler.getTimeLineStateList(); //System.out.println("NsharpHodoPaneResource "+ descriptor.getPaneNumber());
|
||||
stnStateList = rscHandler.getStnStateList();
|
||||
hodoBackground.paintInternal(target, paintProps);
|
||||
if((soundingLys != null) && (soundingLys.size()>= 4))
|
||||
{
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -21,11 +21,10 @@ package gov.noaa.nws.ncep.ui.nsharp.display.rsc;
|
|||
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingLayer;
|
||||
import gov.noaa.nws.ncep.ui.nsharp.NsharpConstants;
|
||||
import gov.noaa.nws.ncep.ui.nsharp.NsharpLineProperty;
|
||||
import gov.noaa.nws.ncep.ui.nsharp.NsharpOperationElement;
|
||||
import gov.noaa.nws.ncep.ui.nsharp.NsharpShapeAndLineProperty;
|
||||
import gov.noaa.nws.ncep.ui.nsharp.NsharpSoundingElementStateProperty;
|
||||
import gov.noaa.nws.ncep.ui.nsharp.NsharpStationInfo;
|
||||
import gov.noaa.nws.ncep.ui.nsharp.NsharpStationStateProperty;
|
||||
import gov.noaa.nws.ncep.ui.nsharp.NsharpTimeLineStateProperty;
|
||||
import gov.noaa.nws.ncep.ui.nsharp.NsharpWxMath;
|
||||
import gov.noaa.nws.ncep.ui.nsharp.background.NsharpGenericPaneBackground;
|
||||
import gov.noaa.nws.ncep.ui.nsharp.background.NsharpIcingPaneBackground;
|
||||
|
@ -49,7 +48,6 @@ import java.awt.Color;
|
|||
import java.awt.geom.Rectangle2D;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
|
@ -81,9 +79,7 @@ import com.raytheon.uf.viz.core.exception.VizException;
|
|||
import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
|
||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||
import com.raytheon.uf.viz.d2d.ui.perspectives.D2D5Pane;
|
||||
import com.raytheon.viz.core.graphing.LineStroke;
|
||||
import com.raytheon.viz.core.graphing.WGraphics;
|
||||
import com.raytheon.viz.core.graphing.WindBarbFactory;
|
||||
import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
|
||||
import com.sun.jna.ptr.FloatByReference;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
|
@ -102,14 +98,11 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
private int skewtHeight = NsharpConstants.SKEWT_HEIGHT;
|
||||
private int skewtXOrig = NsharpConstants.SKEWT_X_ORIG;
|
||||
private int skewtYOrig = NsharpConstants.SKEWT_Y_ORIG;
|
||||
//private int skewtXEnd = NsharpConstants.SKEWT_X_END;
|
||||
//private int skewtYEnd = NsharpConstants.SKEWT_Y_END;
|
||||
private float omegaXOrig = NsharpConstants.OMEGA_X_ORIG;
|
||||
private float omegaYOrig = NsharpConstants.OMEGA_Y_ORIG;
|
||||
private float omegaWidth = NsharpConstants.OMEGA_WIDTH;
|
||||
private float omegaHeight = NsharpConstants.OMEGA_HEIGHT;
|
||||
private float omegaYEnd = NsharpConstants.OMEGA_Y_END;
|
||||
//private float omegaMF = NsharpConstants.OMEGA_MAGNIFICATION_FACTOR;
|
||||
private float xRatio=1;
|
||||
private float yRatio=1;
|
||||
private String sTemperatureC= "";
|
||||
|
@ -153,7 +146,6 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
private int currentTempCurveType;
|
||||
private Coordinate interactiveTempPointCoordinate;
|
||||
private boolean plotInteractiveTemp= false;
|
||||
//private double mycurrentZoomLevel=1;
|
||||
private boolean cursorInSkewT = false;
|
||||
private static int CURSER_FONT_INC_STEP = 3;
|
||||
private static int CURSER_FONT_10 =10;
|
||||
|
@ -162,7 +154,28 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
private String myPerspective= NmapCommon.NatlCntrsPerspectiveID;
|
||||
public static ReentrantLock reentryLock = new ReentrantLock ();
|
||||
private boolean justMoveToSidePane = false;
|
||||
public boolean isJustMoveToSidePane() {
|
||||
private boolean cursorTopWindBarb = false;
|
||||
private boolean windBarbMagnify = false;
|
||||
private int currentWindBarbSoundingLayerIndex;
|
||||
|
||||
|
||||
public boolean isWindBarbMagnify() {
|
||||
return windBarbMagnify;
|
||||
}
|
||||
|
||||
public void setWindBarbMagnify(boolean windBarbMagnify) {
|
||||
this.windBarbMagnify = windBarbMagnify;
|
||||
}
|
||||
|
||||
public boolean isCursorTopWindBarb() {
|
||||
return cursorTopWindBarb;
|
||||
}
|
||||
|
||||
public void setCursorTopWindBarb(boolean cursorTopWindBarb) {
|
||||
this.cursorTopWindBarb = cursorTopWindBarb;
|
||||
}
|
||||
|
||||
public boolean isJustMoveToSidePane() {
|
||||
return justMoveToSidePane;
|
||||
}
|
||||
|
||||
|
@ -777,14 +790,14 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
*
|
||||
* Draws Wind barb vs height
|
||||
* This function followed algorithm in plot_barbs (void) at xwvid1.c
|
||||
* to choose wind bulb for drawing around every 400m
|
||||
* to choose wind bulbs with minimum distance defined @ graphConfigProperty.getWindBarbDistance()
|
||||
*
|
||||
*/
|
||||
private void drawNsharpWindBarb(IGraphicsTarget target, double zoomLevel,
|
||||
WGraphics world, RGB iicolor, List<NcSoundingLayer> sndLys, double xPosition, double botPress)throws VizException {
|
||||
if(sndLys.size()< 4)
|
||||
return;
|
||||
//ArrayList<List<LineStroke>> windList = new ArrayList<List<LineStroke>>();
|
||||
//ArrayList<List<LineStroke>> windList = new ArrayList<List<LineStroke>>();
|
||||
List<windPickedElement> layerStateList = new ArrayList<windPickedElement>();
|
||||
float lastHeight = -9999;
|
||||
RGB icolor = iicolor;//graphConfigProperty.getWindBarbColor();
|
||||
|
@ -807,6 +820,7 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
//System.out.println( "layer#"+ i+ " RE_MAX_WIND =" + spd );
|
||||
}
|
||||
}
|
||||
//DR16384 : handle when all winds are not positive case
|
||||
if (layerStateList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
@ -820,8 +834,7 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
if ( pressure < botPress || spd < 0 ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((ele.layer.getGeoHeight() - lastHeight) < graphConfigProperty.getWindBarbDistance()){// *zoomLevel ){
|
||||
if ((ele.layer.getGeoHeight() - lastHeight) < graphConfigProperty.getWindBarbDistance() *zoomLevel ){
|
||||
if(ele.myState.equals(eleState.RE_MAX_WIND) && spd > lastEle.layer.getWindSpeed()){
|
||||
//swapped last picked layer with this relative max wind layer
|
||||
lastEle.myState = eleState.UNPICKED;
|
||||
|
@ -840,80 +853,58 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
lastHeight = ele.layer.getGeoHeight();
|
||||
lastEle = ele;
|
||||
}
|
||||
|
||||
}
|
||||
double windX = xPosition;
|
||||
double windY=0;
|
||||
//double barbScaleFactorx, barbScaleFactory;
|
||||
//barbScaleFactorx = zoomLevel;
|
||||
// barbScaleFactory = zoomLevel;
|
||||
//List<double[]> locations = new ArrayList<double[]>();
|
||||
//System.out.println("zoom="+zoomLevel +"world viewYmin="+world.getViewYmin()+" viewYmax="+world.getViewYmax()+" wolrdYmin="+ world.getWorldYmin()+" wolrdYmax="+ world.getWorldYmax()
|
||||
// +"world viewXmin="+world.getViewXmin()+" viewXmax="+world.getViewXmax()+" wolrdXmin="+ world.getWorldXmin()+" wolrdXmax="+ world.getWorldXmax());
|
||||
//plot wind barbs
|
||||
List<IVector> windVectList = new ArrayList<IVector>();
|
||||
Color[] colors = new Color[1];
|
||||
Color color = new Color(icolor.red, icolor.green, icolor.blue);
|
||||
colors[0]= color;
|
||||
DisplayElementFactory df = new DisplayElementFactory (target, this.descriptor);
|
||||
ArrayList<IDisplayable> elements = new ArrayList<IDisplayable> ();
|
||||
//double shift=2;
|
||||
//int shiftDirection=1;
|
||||
|
||||
float wbSize = graphConfigProperty.getWindBarbSize();
|
||||
float wbWidth = graphConfigProperty.getWindBarbLineWidth();
|
||||
for(windPickedElement ele: layerStateList){
|
||||
/*shift = shift + shiftDirection;
|
||||
if(shift >=1 || shift <= -1)
|
||||
shiftDirection=-1* shiftDirection;
|
||||
if(shift==2)
|
||||
shift=0;
|
||||
else
|
||||
shift=2;*/
|
||||
NcSoundingLayer layer = ele.layer;
|
||||
float pressure = layer.getPressure();
|
||||
if(pressure < 100)
|
||||
continue;
|
||||
float spd = layer.getWindSpeed();
|
||||
float dir = layer.getWindDirection();
|
||||
|
||||
//test
|
||||
//dir= (dir+50)%360;
|
||||
// Get the vertical ordinate.
|
||||
if(currentGraphMode== NsharpConstants.GRAPH_SKEWT){
|
||||
windY = NsharpWxMath.getSkewTXY(pressure, 0).y;
|
||||
//barbScaleFactorx = 0.6*zoomLevel;
|
||||
//barbScaleFactory= zoomLevel;
|
||||
}
|
||||
else if(currentGraphMode== NsharpConstants.GRAPH_ICING ){
|
||||
//Chin:Y axis (pressure) is scaled using log scale and increaing downward
|
||||
//WorldYmin= at pressure 1000,its value actually is 1000 (max), wolrdYmax = at pressure 300, its value is 825 (min)
|
||||
windY = world.getWorldYmax() + (world.getWorldYmin()-icingBackground.toLogScale(pressure));
|
||||
//barbScaleFactorx = 1.3*zoomLevel;
|
||||
//barbScaleFactory= 2.5*zoomLevel;//experimental value: depends on the world coordinate size set
|
||||
}else if( currentGraphMode== NsharpConstants.GRAPH_TURB){
|
||||
//Chin:Y axis (pressure) is scaled using log scale and increaing downward
|
||||
//WorldYmin= at pressure 1000,its value actually is 1000 (max), wolrdYmax = at pressure 300, its value is 825 (min)
|
||||
windY = world.getWorldYmax() + (world.getWorldYmin()-turbBackground.toLogScale(pressure));
|
||||
//barbScaleFactorx = .12*zoomLevel;//experimental value: depends on the world coordinate size set
|
||||
//barbScaleFactory=3.8*zoomLevel;
|
||||
}
|
||||
else
|
||||
continue;
|
||||
|
||||
float curWbSize = wbSize;
|
||||
float curWbWidth = wbWidth;
|
||||
if(ele.myState.equals(eleState.UNPICKED)){
|
||||
//double[] loc= {world.mapX(windX), world.mapY(windY)};
|
||||
//locations.add(loc);
|
||||
continue;
|
||||
//spd=0.1f;//Chin::if we want pgen to draw unpicked wind as a circle, then set this.
|
||||
}
|
||||
//System.out.println("spd="+spd+" dir="+dir);
|
||||
/*
|
||||
List<LineStroke> barb = WindBarbFactory.getWindGraphics((double) (spd), (double) dir);
|
||||
if (barb != null) {
|
||||
// WindBarbFactory.scaleBarb(barb, zoomLevel*barbScaleFactor);
|
||||
for (LineStroke stroke : barb) {
|
||||
stroke.scale(barbScaleFactorx, barbScaleFactory);
|
||||
}
|
||||
|
||||
WindBarbFactory.translateBarb(barb, windX, windY);
|
||||
windList.add(barb);
|
||||
if(graphConfigProperty.isShowFilteredWindInCircle()){
|
||||
//Chin::if we want pgen to draw un-picked wind as a circle, then set this.
|
||||
spd=0.1f;
|
||||
curWbSize = 1;
|
||||
}
|
||||
else
|
||||
continue;
|
||||
}
|
||||
/* TBDWB
|
||||
else if(windBarbMagnify==true && cursorTopWindBarb == true && currentWindBarbSoundingLayerIndex == this.soundingLys.indexOf(layer)){
|
||||
curWbSize = wbSize*2;
|
||||
curWbWidth = wbWidth*2;
|
||||
}*/
|
||||
|
||||
//use PGEN tool
|
||||
Vector vect= new Vector();
|
||||
vect.setVectorType(VectorType.WIND_BARB);
|
||||
|
@ -921,18 +912,15 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
dir= (dir+180.0f)%360.0f;
|
||||
vect.setDirection(dir);
|
||||
vect.setSpeed(spd);
|
||||
vect.setSizeScale(graphConfigProperty.getWindBarbSize());
|
||||
vect.setLineWidth(graphConfigProperty.getWindBarbLineWidth());
|
||||
vect.setSizeScale(curWbSize);
|
||||
vect.setLineWidth(curWbWidth);
|
||||
vect.setClear(true);
|
||||
vect.setColors(colors);
|
||||
Coordinate location = new Coordinate(world.mapX(windX/*-shift*/), world.mapY(windY));
|
||||
Coordinate location = new Coordinate(world.mapX(windX), world.mapY(windY));
|
||||
vect.setLocation(location);
|
||||
windVectList.add(vect);
|
||||
ArrayList<IDisplayable> subelements = df.createDisplayElements(vect,paintProps);
|
||||
elements.addAll(subelements);
|
||||
}
|
||||
|
||||
//ArrayList<IDisplayable> elements = df.createDisplayElements(windVectList,paintProps);
|
||||
for (IDisplayable each : elements)
|
||||
{
|
||||
try {
|
||||
|
@ -944,16 +932,6 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
//System.out.println("paintInternal caught draw exception!");
|
||||
}
|
||||
}
|
||||
//#3: plot "unpicked" layer with a small dot
|
||||
/*
|
||||
target.drawPoints(locations, icolor, PointStyle.POINT,2);
|
||||
for (List<LineStroke> barb : windList) {
|
||||
//System.out.println("barb");
|
||||
for (LineStroke stroke : barb) {
|
||||
//System.out.println("p1x="+(int)stroke.getPoint().x+" p1y="+(int)stroke.getPoint().y);
|
||||
stroke.render(target, world, icolor);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1329,8 +1307,8 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
NsharpSoundingElementStateProperty preSndProfileProp= rscHandler.getPreSndProfileProp();
|
||||
if(preSndProfileProp!= null){
|
||||
pickedStnColor = linePropertyMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_OVERLAY2]).getLineColor();
|
||||
String stnInfoStr = preSndProfileProp.elementDescription;
|
||||
latlonStr = Math.rint(preSndProfileProp.stnInfo.getLatitude()*100)/100 + "," + Math.rint(preSndProfileProp.stnInfo.getLongitude()*100)/100;
|
||||
String stnInfoStr = preSndProfileProp.getElementDescription();
|
||||
latlonStr = Math.rint(preSndProfileProp.getStnInfo().getLatitude()*100)/100 + "," + Math.rint(preSndProfileProp.getStnInfo().getLongitude()*100)/100;
|
||||
DrawableString str =new DrawableString( stnInfoStr+" "+latlonStr,pickedStnColor);
|
||||
str.font = font10;
|
||||
str.setCoordinates(dispX + 300 * zoomLevel* xRatio, dispY);
|
||||
|
@ -1438,9 +1416,6 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
@Override
|
||||
protected void paintInternal(IGraphicsTarget target,
|
||||
PaintProperties paintProps) throws VizException {
|
||||
//System.out.println("NsharpSkewTPaneResource paintInternal called! I am pane "+ this.toString());
|
||||
//double X = NsharpConstants.WIND_BX_X_ORIG;
|
||||
//double Y = 80;
|
||||
this.paintProps = paintProps;
|
||||
if(soundingLys==null)
|
||||
return;
|
||||
|
@ -1454,12 +1429,21 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
//rscHandler.repopulateSndgData();//CHIN swapping
|
||||
if(justMoveToSidePane){
|
||||
reentryLock.lock();
|
||||
rscHandler.repopulateSndgData();//CHIN swapping TBDDD???
|
||||
//to check a scenario that sounding data is removed while thread is locked
|
||||
if(soundingLys==null ||(soundingLys!=null && soundingLys.size()<=0)){
|
||||
reentryLock.unlock();
|
||||
return;
|
||||
}
|
||||
rscHandler.repopulateSndgData();
|
||||
handleResize();
|
||||
justMoveToSidePane = false;
|
||||
reentryLock.unlock();
|
||||
}else if(justBackToMainPane ){
|
||||
reentryLock.lock();
|
||||
if(soundingLys==null ||(soundingLys!=null && soundingLys.size()<=0)){
|
||||
reentryLock.unlock();
|
||||
return;
|
||||
}
|
||||
rscHandler.repopulateSndgData();//CHIN swapping
|
||||
createRscWireFrameShapes();
|
||||
justBackToMainPane = false;
|
||||
|
@ -1468,7 +1452,7 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
if(paletteWin!=null){
|
||||
paletteWin.restorePaletteWindow(paneConfigurationName, rscHandler.getCurrentGraphMode(),
|
||||
rscHandler.isInterpolateIsOn(), rscHandler.isOverlayIsOn(),
|
||||
rscHandler.isCompareStnIsOn(),rscHandler.isCompareTmIsOn(),rscHandler.isEditGraphOn());
|
||||
rscHandler.isCompareStnIsOn(),rscHandler.isCompareTmIsOn(),rscHandler.isEditGraphOn(), rscHandler.isCompareSndIsOn());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1514,6 +1498,7 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
}
|
||||
}
|
||||
boolean compareStnIsOn = rscHandler.isCompareStnIsOn();
|
||||
boolean compareSndIsOn = rscHandler.isCompareSndIsOn();
|
||||
boolean compareTmIsOn = rscHandler.isCompareTmIsOn();
|
||||
boolean editGraphOn= rscHandler.isEditGraphOn();
|
||||
boolean overlayIsOn = rscHandler.isOverlayIsOn();
|
||||
|
@ -1634,40 +1619,47 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
drawNsharpWindBarb(target, currentZoomLevel, world, linePropertyMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_OVERLAY2]).getLineColor(), this.previousSoundingLys, xPos - NsharpResourceHandler.BARB_LENGTH,100);
|
||||
}
|
||||
else{
|
||||
if(!compareStnIsOn && !compareTmIsOn){
|
||||
//NsharpLineProperty lp =linePropertyMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_WIND_BARB]);
|
||||
drawNsharpWindBarb(target, currentZoomLevel, world, graphConfigProperty.getWindBarbColor()/*lp.getLineColor()*/, this.soundingLys, xPos,100);
|
||||
if(!compareStnIsOn && !compareTmIsOn && !compareSndIsOn){
|
||||
drawNsharpWindBarb(target, currentZoomLevel, world, graphConfigProperty.getWindBarbColor(), this.soundingLys, xPos,100);
|
||||
}
|
||||
else{
|
||||
int currentTimeLineStateListIndex = rscHandler.getCurrentTimeLineStateListIndex();
|
||||
int currentStnStateListIndex = rscHandler.getCurrentStnStateListIndex();
|
||||
List<NsharpStationStateProperty> stnStateList = rscHandler.getStnStateList();
|
||||
List<NsharpTimeLineStateProperty> timeLineStateList = rscHandler.getTimeLineStateList();
|
||||
List<List<NsharpSoundingElementStateProperty>> stnTimeTable = rscHandler.getStnTimeTable();
|
||||
HashMap<String, List<NcSoundingLayer>> dataTimelineSndLysListMap = rscHandler.getDataTimelineSndLysListMap();
|
||||
if(compareTmIsOn && currentStnStateListIndex >=0 ){
|
||||
int colorIndex =NsharpConstants.LINE_COMP1;
|
||||
for(NsharpTimeLineStateProperty elm: timeLineStateList) {
|
||||
if(elm.getTimeState() == NsharpConstants.State.ACTIVE &&
|
||||
stnTimeTable.get(currentStnStateListIndex).get(timeLineStateList.indexOf(elm)).getElementState() == NsharpConstants.State.AVAIL){
|
||||
List<NcSoundingLayer> soundingLayeys = dataTimelineSndLysListMap.get(stnTimeTable.get(currentStnStateListIndex).get(timeLineStateList.indexOf(elm)).getElementDescription());
|
||||
int currentTimeListIndex = rscHandler.getCurrentTimeElementListIndex();
|
||||
int currentStnListIndex = rscHandler.getCurrentStnElementListIndex();
|
||||
int currentSndListIndex = rscHandler.getCurrentSndElementListIndex();
|
||||
List<NsharpOperationElement> stnElemList = rscHandler.getStnElementList();
|
||||
List<NsharpOperationElement> timeElemList = rscHandler.getTimeElementList();
|
||||
List<NsharpOperationElement> sndElemList = rscHandler.getSndElementList();
|
||||
List<List<List<NsharpSoundingElementStateProperty>>> stnTimeSndTable = rscHandler.getStnTimeSndTable();
|
||||
if(compareTmIsOn && currentStnListIndex >=0 && currentSndListIndex >=0){
|
||||
int colorIndex;
|
||||
for(NsharpOperationElement elm: timeElemList) {
|
||||
if(elm.getActionState() == NsharpConstants.ActState.ACTIVE &&
|
||||
stnTimeSndTable.get(currentStnListIndex).get(timeElemList.indexOf(elm)).get(currentSndListIndex)!=null){
|
||||
List<NcSoundingLayer> soundingLayeys = stnTimeSndTable.get(currentStnListIndex).get(timeElemList.indexOf(elm)).get(currentSndListIndex).getSndLyLst();
|
||||
colorIndex = stnTimeSndTable.get(currentStnListIndex).get(timeElemList.indexOf(elm)).get(currentSndListIndex).getCompColorIndex();
|
||||
NsharpLineProperty lp = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]);
|
||||
colorIndex++;
|
||||
if(colorIndex > NsharpConstants.LINE_COMP10)
|
||||
colorIndex =NsharpConstants.LINE_COMP1;
|
||||
drawNsharpWindBarb(target, currentZoomLevel, world, lp.getLineColor(), soundingLayeys, xPos,100);
|
||||
}
|
||||
}
|
||||
} else if(compareStnIsOn && currentTimeLineStateListIndex >=0){
|
||||
int colorIndex =NsharpConstants.LINE_COMP1;
|
||||
for(NsharpStationStateProperty elm: stnStateList) {
|
||||
if(elm.getStnState() == NsharpConstants.State.ACTIVE &&
|
||||
stnTimeTable.get(stnStateList.indexOf(elm)).get(currentTimeLineStateListIndex).getElementState() == NsharpConstants.State.AVAIL){
|
||||
List<NcSoundingLayer> soundingLayeys = dataTimelineSndLysListMap.get(stnTimeTable.get(stnStateList.indexOf(elm)).get(currentTimeLineStateListIndex).getElementDescription());
|
||||
} else if(compareStnIsOn && currentTimeListIndex >=0 && currentSndListIndex >=0){
|
||||
int colorIndex ;
|
||||
for(NsharpOperationElement elm: stnElemList) {
|
||||
if(elm.getActionState() == NsharpConstants.ActState.ACTIVE &&
|
||||
stnTimeSndTable.get(stnElemList.indexOf(elm)).get(currentTimeListIndex).get(currentSndListIndex)!=null){
|
||||
List<NcSoundingLayer> soundingLayeys = stnTimeSndTable.get(stnElemList.indexOf(elm)).get(currentTimeListIndex).get(currentSndListIndex).getSndLyLst();
|
||||
colorIndex = stnTimeSndTable.get(stnElemList.indexOf(elm)).get(currentTimeListIndex).get(currentSndListIndex).getCompColorIndex();
|
||||
NsharpLineProperty lp = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]);
|
||||
drawNsharpWindBarb(target, currentZoomLevel, world, lp.getLineColor(), soundingLayeys, xPos,100);
|
||||
}
|
||||
}
|
||||
} else if(compareSndIsOn && currentStnListIndex >=0 && currentTimeListIndex >=0){
|
||||
int colorIndex;
|
||||
for(NsharpOperationElement elm: sndElemList) {
|
||||
if(elm.getActionState() == NsharpConstants.ActState.ACTIVE &&
|
||||
stnTimeSndTable.get(currentStnListIndex).get(currentTimeListIndex).get(sndElemList.indexOf(elm))!=null){
|
||||
List<NcSoundingLayer> soundingLayeys = stnTimeSndTable.get(currentStnListIndex).get(currentTimeListIndex).get(sndElemList.indexOf(elm)).getSndLyLst();
|
||||
colorIndex = stnTimeSndTable.get(currentStnListIndex).get(currentTimeListIndex).get(sndElemList.indexOf(elm)).getCompColorIndex();
|
||||
NsharpLineProperty lp = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]);
|
||||
colorIndex++;
|
||||
if(colorIndex > NsharpConstants.LINE_COMP10)
|
||||
colorIndex =NsharpConstants.LINE_COMP1;
|
||||
drawNsharpWindBarb(target, currentZoomLevel, world, lp.getLineColor(), soundingLayeys, xPos,100);
|
||||
}
|
||||
}
|
||||
|
@ -1677,9 +1669,6 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
//System.out.println("x1 pos"+xPos+ " x2 pos="+ (xPos - NsharpResourceHandler.BARB_LENGTH));
|
||||
}
|
||||
drawHeightMark(target);
|
||||
//target.drawWireframeShape(heightMarkRscShape, NsharpConstants.color_red, 1, LineStyle.SOLID, font10);
|
||||
|
||||
//if(!compareStnIsOn){
|
||||
//draw EL, LFC, LCL, FZL, -20C, -30C lines
|
||||
//drawLclLine(target);
|
||||
target.drawWireframeShape(lclShape,NsharpConstants.color_green, 2,LineStyle.SOLID, font10);
|
||||
|
@ -1688,7 +1677,9 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
target.drawWireframeShape(fzlShape,NsharpConstants.color_cyan, 2,LineStyle.SOLID, font10);
|
||||
// draw cursor data
|
||||
if(cursorInSkewT== true){
|
||||
if(curseToggledFontLevel < CURSER_STRING_OFF)
|
||||
if((curseToggledFontLevel < CURSER_STRING_OFF)&&
|
||||
(cursorTopWindBarb == false || windBarbMagnify == false)
|
||||
)
|
||||
drawNsharpSkewtCursorData(target);
|
||||
}
|
||||
}// end of currentGraphMode= NsharpConstants.GRAPH_SKEWT
|
||||
|
@ -1777,22 +1768,20 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
parcelRtShapeList.clear();
|
||||
}
|
||||
|
||||
int currentTimeLineStateListIndex = rscHandler.getCurrentTimeLineStateListIndex();
|
||||
int currentStnStateListIndex = rscHandler.getCurrentStnStateListIndex();
|
||||
List<NsharpStationStateProperty> stnStateList = rscHandler.getStnStateList();
|
||||
List<NsharpTimeLineStateProperty> timeLineStateList = rscHandler.getTimeLineStateList();
|
||||
List<List<NsharpSoundingElementStateProperty>> stnTimeTable = rscHandler.getStnTimeTable();
|
||||
HashMap<String, List<NcSoundingLayer>> dataTimelineSndLysListMap = rscHandler.getDataTimelineSndLysListMap();
|
||||
if(rscHandler.isCompareStnIsOn() && currentTimeLineStateListIndex >=0){
|
||||
int lpIndex =NsharpConstants.LINE_COMP1;
|
||||
for(NsharpStationStateProperty elm: stnStateList) {
|
||||
if(elm.getStnState() == NsharpConstants.State.ACTIVE &&
|
||||
stnTimeTable.get(stnStateList.indexOf(elm)).get(currentTimeLineStateListIndex).getElementState() == NsharpConstants.State.AVAIL){
|
||||
List<NcSoundingLayer> soundingLayeys = dataTimelineSndLysListMap.get(stnTimeTable.get(stnStateList.indexOf(elm)).get(currentTimeLineStateListIndex).getElementDescription());
|
||||
NsharpLineProperty lp = linePropertyMap.get(NsharpConstants.lineNameArray[lpIndex]);
|
||||
lpIndex++;
|
||||
if(lpIndex > NsharpConstants.LINE_COMP10)
|
||||
lpIndex =NsharpConstants.LINE_COMP1;
|
||||
int currentTimeListIndex = rscHandler.getCurrentTimeElementListIndex();
|
||||
int currentStnListIndex = rscHandler.getCurrentStnElementListIndex();
|
||||
int currentSndListIndex = rscHandler.getCurrentSndElementListIndex();
|
||||
List<NsharpOperationElement> stnElemList = rscHandler.getStnElementList();
|
||||
List<NsharpOperationElement> timeElemList = rscHandler.getTimeElementList();
|
||||
List<NsharpOperationElement> sndElemList = rscHandler.getSndElementList();
|
||||
List<List<List<NsharpSoundingElementStateProperty>>> stnTimeSndTable = rscHandler.getStnTimeSndTable();
|
||||
if(rscHandler.isCompareStnIsOn() && currentTimeListIndex >=0 && currentSndListIndex >=0){
|
||||
for(NsharpOperationElement elm: stnElemList) {
|
||||
if(elm.getActionState() == NsharpConstants.ActState.ACTIVE &&
|
||||
stnTimeSndTable.get(stnElemList.indexOf(elm)).get(currentTimeListIndex).get(currentSndListIndex)!=null){
|
||||
List<NcSoundingLayer> soundingLayeys = stnTimeSndTable.get(stnElemList.indexOf(elm)).get(currentTimeListIndex).get(currentSndListIndex).getSndLyLst();
|
||||
int colorIndex = stnTimeSndTable.get(stnElemList.indexOf(elm)).get(currentTimeListIndex).get(currentSndListIndex).getCompColorIndex();
|
||||
NsharpLineProperty lp = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]);
|
||||
IWireframeShape shape = createRTParcelTraceShapes( parcelType, userPre, soundingLayeys);
|
||||
NsharpShapeAndLineProperty shNLp = new NsharpShapeAndLineProperty();
|
||||
shNLp.setShape(shape);
|
||||
|
@ -1801,16 +1790,29 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
}
|
||||
}
|
||||
}
|
||||
else if(rscHandler.isCompareTmIsOn() && currentStnStateListIndex >=0 ){
|
||||
int lpIndex =NsharpConstants.LINE_COMP1;
|
||||
for(NsharpTimeLineStateProperty elm: timeLineStateList) {
|
||||
if(elm.getTimeState() == NsharpConstants.State.ACTIVE &&
|
||||
stnTimeTable.get(currentStnStateListIndex).get(timeLineStateList.indexOf(elm)).getElementState() == NsharpConstants.State.AVAIL){
|
||||
List<NcSoundingLayer> soundingLayeys = dataTimelineSndLysListMap.get(stnTimeTable.get(currentStnStateListIndex).get(timeLineStateList.indexOf(elm)).getElementDescription());
|
||||
NsharpLineProperty lp = linePropertyMap.get(NsharpConstants.lineNameArray[lpIndex]);
|
||||
lpIndex++;
|
||||
if(lpIndex > NsharpConstants.LINE_COMP10)
|
||||
lpIndex =NsharpConstants.LINE_COMP1;
|
||||
else if(rscHandler.isCompareTmIsOn() && currentStnListIndex >=0 && currentSndListIndex >=0 ){
|
||||
//tk#1004int lpIndex =NsharpConstants.LINE_COMP1;
|
||||
for(NsharpOperationElement elm: timeElemList) {
|
||||
if(elm.getActionState() == NsharpConstants.ActState.ACTIVE &&
|
||||
stnTimeSndTable.get(currentStnListIndex).get(timeElemList.indexOf(elm)).get(currentSndListIndex)!=null){
|
||||
List<NcSoundingLayer> soundingLayeys = stnTimeSndTable.get(currentStnListIndex).get(timeElemList.indexOf(elm)).get(currentSndListIndex).getSndLyLst();
|
||||
int colorIndex = stnTimeSndTable.get(currentStnListIndex).get(timeElemList.indexOf(elm)).get(currentSndListIndex).getCompColorIndex();
|
||||
NsharpLineProperty lp = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]);
|
||||
IWireframeShape shape = createRTParcelTraceShapes( parcelType, userPre, soundingLayeys);
|
||||
NsharpShapeAndLineProperty shNLp = new NsharpShapeAndLineProperty();
|
||||
shNLp.setShape(shape);
|
||||
shNLp.setLp(lp);
|
||||
parcelRtShapeList.add(shNLp);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(rscHandler.isCompareSndIsOn() && currentStnListIndex >=0 && currentTimeListIndex >=0){
|
||||
for(NsharpOperationElement elm: sndElemList) {
|
||||
if(elm.getActionState() == NsharpConstants.ActState.ACTIVE &&
|
||||
stnTimeSndTable.get(currentStnListIndex).get(currentTimeListIndex).get(sndElemList.indexOf(elm))!=null){
|
||||
List<NcSoundingLayer> soundingLayeys = stnTimeSndTable.get(currentStnListIndex).get(currentTimeListIndex).get(sndElemList.indexOf(elm)).getSndLyLst();
|
||||
int colorIndex = stnTimeSndTable.get(currentStnListIndex).get(currentTimeListIndex).get(sndElemList.indexOf(elm)).getCompColorIndex();
|
||||
NsharpLineProperty lp = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]);
|
||||
IWireframeShape shape = createRTParcelTraceShapes( parcelType, userPre, soundingLayeys);
|
||||
NsharpShapeAndLineProperty shNLp = new NsharpShapeAndLineProperty();
|
||||
shNLp.setShape(shape);
|
||||
|
@ -2455,7 +2457,7 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
|
||||
shNcolorT.setShape(shapeT);
|
||||
shNcolorD.setShape(shapeD);
|
||||
if(!rscHandler.isOverlayIsOn() && !rscHandler.isCompareStnIsOn() && !rscHandler.isCompareTmIsOn()){
|
||||
if(!rscHandler.isOverlayIsOn() && !rscHandler.isCompareStnIsOn() && !rscHandler.isCompareTmIsOn() && !rscHandler.isCompareSndIsOn()){
|
||||
//use default color
|
||||
|
||||
if(linePropertyMap!=null){
|
||||
|
@ -2487,36 +2489,45 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
pressureTempRscShapeList.clear();
|
||||
}
|
||||
|
||||
int currentTimeLineStateListIndex = rscHandler.getCurrentTimeLineStateListIndex();
|
||||
int currentStnStateListIndex = rscHandler.getCurrentStnStateListIndex();
|
||||
List<NsharpStationStateProperty> stnStateList = rscHandler.getStnStateList();
|
||||
List<NsharpTimeLineStateProperty> timeLineStateList = rscHandler.getTimeLineStateList();
|
||||
List<List<NsharpSoundingElementStateProperty>> stnTimeTable = rscHandler.getStnTimeTable();
|
||||
HashMap<String, List<NcSoundingLayer>> dataTimelineSndLysListMap = rscHandler.getDataTimelineSndLysListMap();
|
||||
if(rscHandler.isCompareStnIsOn() && currentTimeLineStateListIndex >=0){
|
||||
int colorIndex =NsharpConstants.LINE_COMP1;
|
||||
for(NsharpStationStateProperty elm: stnStateList) {
|
||||
if(elm.getStnState() == NsharpConstants.State.ACTIVE &&
|
||||
stnTimeTable.get(stnStateList.indexOf(elm)).get(currentTimeLineStateListIndex).getElementState() == NsharpConstants.State.AVAIL){
|
||||
List<NcSoundingLayer> soundingLayeys = dataTimelineSndLysListMap.get(stnTimeTable.get(stnStateList.indexOf(elm)).get(currentTimeLineStateListIndex).getElementDescription());
|
||||
int currentTimeListIndex = rscHandler.getCurrentTimeElementListIndex();
|
||||
int currentStnListIndex = rscHandler.getCurrentStnElementListIndex();
|
||||
int currentSndListIndex = rscHandler.getCurrentSndElementListIndex();
|
||||
List<NsharpOperationElement> stnElemList = rscHandler.getStnElementList();
|
||||
List<NsharpOperationElement> timeElemList = rscHandler.getTimeElementList();
|
||||
List<NsharpOperationElement> sndElemList = rscHandler.getSndElementList();
|
||||
List<List<List<NsharpSoundingElementStateProperty>>> stnTimeSndTable = rscHandler.getStnTimeSndTable();
|
||||
if(rscHandler.isCompareStnIsOn()&& currentTimeListIndex >=0 && currentSndListIndex >=0){
|
||||
int colorIndex ;
|
||||
for(NsharpOperationElement elm: stnElemList) {
|
||||
if(elm.getActionState() == NsharpConstants.ActState.ACTIVE &&
|
||||
stnTimeSndTable.get(stnElemList.indexOf(elm)).get(currentTimeListIndex).get(currentSndListIndex)!=null){
|
||||
List<NcSoundingLayer> soundingLayeys = stnTimeSndTable.get(stnElemList.indexOf(elm)).get(currentTimeListIndex).get(currentSndListIndex).getSndLyLst();
|
||||
colorIndex = stnTimeSndTable.get(stnElemList.indexOf(elm)).get(currentTimeListIndex).get(currentSndListIndex).getCompColorIndex();
|
||||
NsharpLineProperty lp = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]);
|
||||
colorIndex++;
|
||||
if(colorIndex > NsharpConstants.LINE_COMP10)
|
||||
colorIndex =NsharpConstants.LINE_COMP1;
|
||||
createRscPressTempCurveShape(world, soundingLayeys, lp, target);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(rscHandler.isCompareTmIsOn() && currentStnStateListIndex >=0 ){
|
||||
int colorIndex =NsharpConstants.LINE_COMP1;
|
||||
for(NsharpTimeLineStateProperty elm: timeLineStateList) {
|
||||
if(elm.getTimeState() == NsharpConstants.State.ACTIVE &&
|
||||
stnTimeTable.get(currentStnStateListIndex).get(timeLineStateList.indexOf(elm)).getElementState() == NsharpConstants.State.AVAIL){
|
||||
List<NcSoundingLayer> soundingLayeys = dataTimelineSndLysListMap.get(stnTimeTable.get(currentStnStateListIndex).get(timeLineStateList.indexOf(elm)).getElementDescription());
|
||||
else if(rscHandler.isCompareTmIsOn() && currentStnListIndex >=0 && currentSndListIndex >=0){
|
||||
int colorIndex;
|
||||
for(NsharpOperationElement elm: timeElemList) {
|
||||
if(elm.getActionState() == NsharpConstants.ActState.ACTIVE &&
|
||||
stnTimeSndTable.get(currentStnListIndex).get(timeElemList.indexOf(elm)).get(currentSndListIndex)!=null){
|
||||
List<NcSoundingLayer> soundingLayeys = stnTimeSndTable.get(currentStnListIndex).get(timeElemList.indexOf(elm)).get(currentSndListIndex).getSndLyLst();
|
||||
colorIndex = stnTimeSndTable.get(currentStnListIndex).get(timeElemList.indexOf(elm)).get(currentSndListIndex).getCompColorIndex();
|
||||
NsharpLineProperty lp = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]);
|
||||
createRscPressTempCurveShape(world, soundingLayeys, lp, target);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(rscHandler.isCompareSndIsOn() & currentStnListIndex >=0 && currentTimeListIndex >=0){
|
||||
int colorIndex;
|
||||
for(NsharpOperationElement elm: sndElemList) {
|
||||
if(elm.getActionState() == NsharpConstants.ActState.ACTIVE &&
|
||||
stnTimeSndTable.get(currentStnListIndex).get(currentTimeListIndex).get(sndElemList.indexOf(elm))!=null){
|
||||
List<NcSoundingLayer> soundingLayeys = stnTimeSndTable.get(currentStnListIndex).get(currentTimeListIndex).get(sndElemList.indexOf(elm)).getSndLyLst();
|
||||
colorIndex = stnTimeSndTable.get(currentStnListIndex).get(currentTimeListIndex).get(sndElemList.indexOf(elm)).getCompColorIndex();
|
||||
NsharpLineProperty lp = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]);
|
||||
colorIndex++;
|
||||
if(colorIndex > NsharpConstants.LINE_COMP10)
|
||||
colorIndex =NsharpConstants.LINE_COMP1;
|
||||
createRscPressTempCurveShape(world, soundingLayeys, lp, target);
|
||||
}
|
||||
}
|
||||
|
@ -2848,6 +2859,86 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
|
|||
lfcShape = null;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Return the closest wind barb origin point to the input point
|
||||
* Also set currentWindBarbSoundingLayerIndex for wind barb magnification plotting later
|
||||
*/
|
||||
public Coordinate findClosestWindBarbPoint(Coordinate currentCursorSkewTCoord){
|
||||
//wind barb X position
|
||||
double windX = skewTBackground.getWindBarbXPosition();
|
||||
|
||||
Coordinate currentCursorPresTempCoord = NsharpWxMath.reverseSkewTXY(world.unMap(currentCursorSkewTCoord));
|
||||
double curCursorPressure = currentCursorPresTempCoord.y;
|
||||
double curCursorTemp = currentCursorPresTempCoord.x;
|
||||
double prevPressure=1000;
|
||||
double prevT=0;
|
||||
Coordinate closetWindBarbCoord = new Coordinate(0,0,0);
|
||||
|
||||
/*
|
||||
* Note: soundingLys list sorted with highest pressure as first element
|
||||
*/
|
||||
for (NcSoundingLayer layer : this.soundingLys) {
|
||||
|
||||
if( layer.getPressure() < 100 )
|
||||
continue;
|
||||
double pressure = layer.getPressure();
|
||||
double temperatureAtWBOrigin;
|
||||
// get windBrb Y position at temp 0
|
||||
double windY = NsharpWxMath.getSkewTXY(pressure, 0).y;
|
||||
|
||||
// get wind barb temperature at windX(= skewTBackground.getWindBarbXPosition()), windY
|
||||
temperatureAtWBOrigin = NsharpWxMath.reverseSkewTXY(new Coordinate(windX,windY)).x;
|
||||
//System.out.println(" pressure "+ pressure + " temp "+ temperatureAtWBOrigin + " prevPressure="+prevPressure);
|
||||
if( pressure <= curCursorPressure){
|
||||
// decide which pressure (layer) should be used. current one or previous one
|
||||
double disCurrentP = Math.abs(pressure -curCursorPressure );
|
||||
double disPreviousP = Math.abs(prevPressure -curCursorPressure );
|
||||
double pickedPressure, pickedTemp;
|
||||
|
||||
if(disPreviousP <= disCurrentP){
|
||||
pickedPressure = prevPressure;
|
||||
pickedTemp = prevT;
|
||||
|
||||
if(this.soundingLys.indexOf(layer) == 0)
|
||||
currentWindBarbSoundingLayerIndex = this.soundingLys.indexOf(layer);
|
||||
else
|
||||
currentWindBarbSoundingLayerIndex = this.soundingLys.indexOf(layer)-1;
|
||||
}
|
||||
else {
|
||||
pickedPressure = pressure;
|
||||
pickedTemp = temperatureAtWBOrigin;
|
||||
|
||||
currentWindBarbSoundingLayerIndex = this.soundingLys.indexOf(layer);
|
||||
}
|
||||
double disTemp = Math.abs(pickedTemp- curCursorTemp);
|
||||
//if distancw is not within 5 * currentZoomLevel degree, then return with (0,0);
|
||||
if(disTemp > 5 * currentZoomLevel){
|
||||
setCursorTopWindBarb(false);
|
||||
return closetWindBarbCoord;
|
||||
}
|
||||
else {
|
||||
//System.out.println("pickedP="+pickedPressure+" pickedT="+pickedTemp+ " inPressure"+inPressure+" inTemp="+ inTemp+" temp dis="+disTemp+ " rangeT="+ 5 * currentZoomLevel);
|
||||
closetWindBarbCoord = NsharpWxMath.getSkewTXY(pickedPressure, pickedTemp);
|
||||
closetWindBarbCoord = world.map(closetWindBarbCoord);
|
||||
setCursorTopWindBarb(true);
|
||||
return closetWindBarbCoord;
|
||||
}
|
||||
}
|
||||
prevPressure = pressure;
|
||||
prevT = temperatureAtWBOrigin;
|
||||
|
||||
}
|
||||
//This is the case that inC is above highest layer (lowest pressure), then we picked highest layer, if within temp range
|
||||
if(Math.abs(prevT- curCursorTemp) > 5 * currentZoomLevel){
|
||||
setCursorTopWindBarb(false);
|
||||
return closetWindBarbCoord;
|
||||
}
|
||||
closetWindBarbCoord = NsharpWxMath.getSkewTXY(prevPressure, prevT);
|
||||
closetWindBarbCoord = world.map(closetWindBarbCoord);
|
||||
//System.out.println("pickedP="+prevPressure+" pickedT="+prevT+ " inPressure"+inPressure+" inTemp="+ inTemp);
|
||||
setCursorTopWindBarb(true);
|
||||
return closetWindBarbCoord;
|
||||
}
|
||||
/*
|
||||
* Return the closest point to the input point on either Temp or Dewpoint trace line
|
||||
* Also set currentSoundingLayerIndex for plotting later
|
||||
|
|
|
@ -18,8 +18,8 @@ package gov.noaa.nws.ncep.ui.nsharp.display.rsc;
|
|||
*/
|
||||
|
||||
import gov.noaa.nws.ncep.ui.nsharp.NsharpConstants;
|
||||
import gov.noaa.nws.ncep.ui.nsharp.NsharpStationStateProperty;
|
||||
import gov.noaa.nws.ncep.ui.nsharp.NsharpTimeLineStateProperty;
|
||||
import gov.noaa.nws.ncep.ui.nsharp.NsharpOperationElement;
|
||||
import gov.noaa.nws.ncep.ui.nsharp.NsharpSoundingElementStateProperty;
|
||||
import gov.noaa.nws.ncep.ui.nsharp.display.NsharpAbstractPaneDescriptor;
|
||||
|
||||
import java.awt.geom.Rectangle2D;
|
||||
|
@ -43,13 +43,21 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
|||
public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
|
||||
private Rectangle timeLineRectangle;
|
||||
private Rectangle stnIdRectangle;
|
||||
private Rectangle sndRectangle;
|
||||
private Rectangle colorNoteRectangle;
|
||||
private List<NsharpTimeLineStateProperty> timeLineStateList;
|
||||
private List<NsharpStationStateProperty> stnStateList;
|
||||
private List<NsharpOperationElement> stnElemList;
|
||||
private List<NsharpOperationElement> timeElemList;
|
||||
private List<NsharpOperationElement> sndElemList;
|
||||
private List<List<List<NsharpSoundingElementStateProperty>>> stnTimeSndTable;
|
||||
private int curTimeLineIndex=0;
|
||||
private int curStnIndex=0;
|
||||
private int curSndIndex=0;
|
||||
private int curTimeLinePage=1;
|
||||
private int curStnIdPage=1;
|
||||
private int curSndPage=1;
|
||||
private int totalTimeLinePage=1;
|
||||
private int totalStnIdPage=1;
|
||||
private int totalSndPage=1;
|
||||
private int paneWidth = NsharpConstants.TIMESTN_PANE_REC_WIDTH;
|
||||
private int paneHeight = NsharpConstants.TIMESTN_PANE_REC_HEIGHT;
|
||||
private int dtXOrig = NsharpConstants.DATA_TIMELINE_X_ORIG;
|
||||
|
@ -63,6 +71,11 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
|
|||
private int stnXEnd = NsharpConstants.STATION_ID_X_END;
|
||||
private int stnWidth = NsharpConstants.STATION_ID_WIDTH;
|
||||
private int stnHeight = NsharpConstants.STATION_ID_HEIGHT;
|
||||
private int sndXOrig = NsharpConstants.SND_TYPE_X_ORIG;
|
||||
private int sndYOrig = NsharpConstants.SND_TYPE_Y_ORIG;
|
||||
private int sndXEnd = NsharpConstants.SND_TYPE_X_END;
|
||||
private int sndWidth = NsharpConstants.SND_TYPE_WIDTH;
|
||||
private int sndHeight = NsharpConstants.SND_TYPE_HEIGHT;
|
||||
private int cnXOrig = NsharpConstants.COLOR_NOTATION_X_ORIG;
|
||||
private int cnYOrig = NsharpConstants.COLOR_NOTATION_Y_ORIG;
|
||||
//private int cnXEnd = NsharpConstants.COLOR_NOTATION_X_END;
|
||||
|
@ -70,6 +83,13 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
|
|||
private int cnHeight = NsharpConstants.COLOR_NOTATION_HEIGHT;
|
||||
private float xRatio=1;
|
||||
private float yRatio=1;
|
||||
private static String sndTypeStr="NA";
|
||||
private static String timelineStr="NA";
|
||||
private static String stationStr="NA";
|
||||
private boolean compareStnIsOn;
|
||||
private boolean compareTmIsOn;
|
||||
private boolean compareSndIsOn;
|
||||
|
||||
public NsharpTimeStnPaneResource(AbstractResourceData resourceData,
|
||||
LoadProperties loadProperties, NsharpAbstractPaneDescriptor desc) {
|
||||
super(resourceData, loadProperties, desc);
|
||||
|
@ -78,6 +98,8 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
|
|||
dtWidth,dtHeight);
|
||||
stnIdRectangle = new Rectangle(stnXOrig,stnYOrig,
|
||||
stnWidth,stnHeight);
|
||||
sndRectangle = new Rectangle(sndXOrig,sndYOrig,
|
||||
sndWidth,sndHeight);
|
||||
colorNoteRectangle = new Rectangle(cnXOrig,cnYOrig,
|
||||
cnWidth,cnHeight);
|
||||
}
|
||||
|
@ -91,12 +113,13 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
|
|||
//plot notations:
|
||||
if(dtHeight >= paneHeight)
|
||||
return;
|
||||
//draw time line page title etc. only when pane box height is larger than timeline box height
|
||||
//draw time line page title etc. only when pane box height is larger than timeline box height
|
||||
double x = cnXOrig+5*xRatio;
|
||||
double y = cnYOrig+1.5*charHeight;
|
||||
|
||||
//double xGap = paneWidth/3*xRatio;
|
||||
color = NsharpConstants.color_white;
|
||||
DrawableString str =new DrawableString( "State:",color);
|
||||
DrawableString str =new DrawableString( "Line State:",color);
|
||||
str.font = font10;
|
||||
str.setCoordinates(x, y);
|
||||
double horizRatio = paintProps.getView().getExtent().getWidth() / paintProps.getCanvasBounds().width;
|
||||
|
@ -105,31 +128,74 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
|
|||
color = NsharpConstants.color_green;
|
||||
DrawableString str1 =new DrawableString( "Current", color);
|
||||
str1.setCoordinates(x, y);
|
||||
str1.font = font10;
|
||||
x = x + target.getStringsBounds(str1).getWidth() * horizRatio *1.1;
|
||||
|
||||
color = NsharpConstants.color_yellow;
|
||||
DrawableString str2 =new DrawableString( "Active", color);
|
||||
str2.setCoordinates(x, y);
|
||||
str2.font = font10;
|
||||
x = x + target.getStringsBounds(str2).getWidth() * horizRatio * 1.1;
|
||||
|
||||
color = NsharpConstants.color_white;
|
||||
DrawableString str3 =new DrawableString( "InActive", color);
|
||||
str3.setCoordinates(x, y);
|
||||
str3.font = font10;
|
||||
|
||||
x = cnXOrig+5*xRatio;
|
||||
y=y+charHeight;
|
||||
y=y+charHeight*1.3;
|
||||
color = NsharpConstants.color_white;
|
||||
DrawableString str4 =new DrawableString( "Status:", color);
|
||||
DrawableString str4 =new DrawableString( "Load Status:", color);
|
||||
str4.setCoordinates(x, y);
|
||||
str4.font = font10;
|
||||
x = x + target.getStringsBounds(str4).getWidth() * horizRatio * 1.1;
|
||||
color = NsharpConstants.color_red;
|
||||
DrawableString str5 =new DrawableString( "* :Loaded", color);
|
||||
str5.setCoordinates(x, y);
|
||||
str5.font = font10;
|
||||
x = x + target.getStringsBounds(str5).getWidth() * horizRatio * 1.1;
|
||||
color = NsharpConstants.color_cyan;
|
||||
color = NsharpConstants.color_purple;
|
||||
DrawableString str6 =new DrawableString( "* :UnLoaded", color);
|
||||
str6.setCoordinates(x, y);
|
||||
str6.font = font10;
|
||||
target.drawStrings(str,str1,str2,str3,str4,str5,str6);
|
||||
|
||||
if(compareStnIsOn || compareSndIsOn || compareTmIsOn){
|
||||
x = cnXOrig+5*xRatio;
|
||||
y=y+charHeight*1.3;
|
||||
color = NsharpConstants.color_white;
|
||||
String baseStr="";
|
||||
String cursndType, stnId, tl;
|
||||
if(curTimeLineIndex<0){
|
||||
tl=timelineStr;
|
||||
}
|
||||
else {
|
||||
timelineStr = tl = timeElemList.get(curTimeLineIndex).getElementDescription();
|
||||
}
|
||||
if(curSndIndex<0){
|
||||
cursndType = sndTypeStr;
|
||||
}
|
||||
else {
|
||||
sndTypeStr = cursndType = sndElemList.get(curSndIndex).getElementDescription() ;
|
||||
}
|
||||
if(curStnIndex <0){
|
||||
stnId=stationStr;
|
||||
}
|
||||
else{
|
||||
stationStr = stnId = stnElemList.get(curStnIndex).getElementDescription() ;
|
||||
}
|
||||
if(compareStnIsOn)
|
||||
baseStr = "Comp Stn Based on: "+ tl + "-" + cursndType;
|
||||
else if(compareSndIsOn)
|
||||
baseStr = "Comp Src Based on: "+ tl + "-" + stnId;
|
||||
else
|
||||
baseStr = "Comp Tm Based on: "+ cursndType + "-" +stnId;
|
||||
|
||||
DrawableString baseDrawStr =new DrawableString(baseStr, color);
|
||||
baseDrawStr.setCoordinates(x, y);
|
||||
baseDrawStr.font = font10;
|
||||
target.drawStrings( baseDrawStr);
|
||||
}
|
||||
target.clearClippingPlane();
|
||||
|
||||
}
|
||||
|
@ -145,7 +211,7 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
|
|||
//draw time line page title etc. only when pane box height is larger than timeline box height
|
||||
x = dtXOrig;
|
||||
y = dtYOrig-1.5*charHeight*yRatio;
|
||||
s = timeLineStateList.size() + " time lines, page " + curTimeLinePage+"/"+totalTimeLinePage;
|
||||
s = timeElemList.size() + " time lines, page " + curTimeLinePage+"/"+totalTimeLinePage;
|
||||
target.drawString(font10, s, x,
|
||||
y, 0.0,
|
||||
IGraphicsTarget.TextStyle.NORMAL,
|
||||
|
@ -154,7 +220,7 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
|
|||
VerticalAlignment.TOP, null);
|
||||
y = dtYOrig;
|
||||
target.drawLine(dtXOrig, y, 0.0,dtXEnd , y, 0.0,NsharpConstants.color_white,1, LineStyle.SOLID);
|
||||
//System.out.println("drawNsharpDataTimelines picked stn info: "+ pickedStnInfoStr);
|
||||
|
||||
|
||||
x = dtXOrig +dtWidth/2;
|
||||
// line divide nextPage and prevPage strings
|
||||
|
@ -195,36 +261,34 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
|
|||
int startIndex = (curTimeLinePage-1) * numTimeLineToShowPerPage;
|
||||
if(startIndex<0)
|
||||
startIndex =0;
|
||||
if(timeLineStateList!= null){
|
||||
int compIndex= 1;
|
||||
if(timeElemList!= null){
|
||||
int colorIndex;
|
||||
boolean compareTmIsOn = rscHandler.isCompareTmIsOn();
|
||||
int currentStnStateListIndex = rscHandler.getCurrentStnStateListIndex();
|
||||
int currentTimeLineStateListIndex = rscHandler.getCurrentTimeLineStateListIndex();
|
||||
double ly = dtNextPageEnd + charHeight;
|
||||
RGB color;
|
||||
double hRatio = paintProps.getView().getExtent().getWidth() / paintProps.getCanvasBounds().width;
|
||||
Rectangle2D strBD = target.getStringBounds(font10, "*");
|
||||
double xGap = 2*strBD.getWidth()*hRatio;
|
||||
for (int j = startIndex; j< timeLineStateList.size(); j++)
|
||||
for (int j = startIndex; j< timeElemList.size(); j++)
|
||||
{
|
||||
x = dtXOrig + 5;
|
||||
boolean avail=false;
|
||||
NsharpTimeLineStateProperty elm = timeLineStateList.get(j);
|
||||
NsharpConstants.State sta = elm.getTimeState();
|
||||
NsharpOperationElement elm = timeElemList.get(j);
|
||||
NsharpConstants.ActState sta = elm.getActionState();
|
||||
|
||||
if(sta == NsharpConstants.State.ACTIVE && j == currentTimeLineStateListIndex)
|
||||
sta = NsharpConstants.State.CURRENT;
|
||||
if(currentStnStateListIndex>=0){
|
||||
if(sta == NsharpConstants.ActState.ACTIVE && j == curTimeLineIndex)
|
||||
sta = NsharpConstants.ActState.CURRENT;
|
||||
if(curStnIndex>=0 && curSndIndex >=0) {
|
||||
s = "*";
|
||||
if ( rscHandler.getStnTimeTable().get(currentStnStateListIndex).get(j).elementState == NsharpConstants.State.AVAIL ){
|
||||
if ( stnTimeSndTable.get(curStnIndex).get(j).get(curSndIndex)!=null){
|
||||
avail = true;
|
||||
}
|
||||
if(avail){
|
||||
color = NsharpConstants.color_red;
|
||||
if(sta == NsharpConstants.ActState.CURRENT)
|
||||
color = NsharpConstants.color_green;
|
||||
}
|
||||
else {
|
||||
color = NsharpConstants.color_cyan;
|
||||
color = NsharpConstants.color_purple;
|
||||
}
|
||||
//System.out.println("selectedTimeList: "+ s);
|
||||
|
||||
|
@ -237,28 +301,44 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
|
|||
}
|
||||
|
||||
x=x+xGap;
|
||||
color = rscHandler.getElementColorMap().get(sta);
|
||||
s = elm.timeDescription;
|
||||
target.drawString(font10, s, x,
|
||||
ly, 0.0,
|
||||
IGraphicsTarget.TextStyle.NORMAL,
|
||||
color,
|
||||
HorizontalAlignment.LEFT,
|
||||
VerticalAlignment.BOTTOM, null);
|
||||
RGB tmLnColor = rscHandler.getElementColorMap().get(sta.name());
|
||||
String tmDesStr = elm.getElementDescription();
|
||||
double tmX=x;
|
||||
|
||||
if(compareTmIsOn && elm.timeState == NsharpConstants.State.ACTIVE && avail){
|
||||
colorIndex = (compIndex-1)%(NsharpConstants.LINE_COMP10-NsharpConstants.LINE_COMP1+1)+ NsharpConstants.LINE_COMP1;
|
||||
strBD = target.getStringBounds(font10, s);
|
||||
s =""+ compIndex;
|
||||
if(compareTmIsOn && elm.getActionState() == NsharpConstants.ActState.ACTIVE
|
||||
&& avail){
|
||||
colorIndex = stnTimeSndTable.get(curStnIndex).get(j).get(curSndIndex).getCompColorIndex();
|
||||
strBD = target.getStringBounds(font10, tmDesStr);
|
||||
String colorIndexStr =""+ (colorIndex % NsharpConstants.LINE_COMP1 + 1);//compIndex;
|
||||
x=x+ strBD.getWidth()*hRatio+5;
|
||||
target.drawString(font10,s, x,
|
||||
target.drawString(font10,colorIndexStr, x,
|
||||
ly, 0.0,
|
||||
IGraphicsTarget.TextStyle.NORMAL,
|
||||
linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]).getLineColor(),
|
||||
HorizontalAlignment.LEFT,
|
||||
VerticalAlignment.BOTTOM, null);
|
||||
compIndex++;
|
||||
}
|
||||
tmLnColor = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]).getLineColor();
|
||||
}
|
||||
else if((compareStnIsOn||compareSndIsOn) && elm.getActionState() == NsharpConstants.ActState.ACTIVE && timeElemList.indexOf(elm) == curTimeLineIndex
|
||||
&& avail){
|
||||
colorIndex = stnTimeSndTable.get(curStnIndex).get(curTimeLineIndex).get(curSndIndex).getCompColorIndex();
|
||||
strBD = target.getStringBounds(font10, tmDesStr);
|
||||
String colorIndexStr =""+ (colorIndex % NsharpConstants.LINE_COMP1 + 1);//compIndex;
|
||||
x=x+ strBD.getWidth()*hRatio+5;
|
||||
target.drawString(font10,colorIndexStr, x,
|
||||
ly, 0.0,
|
||||
IGraphicsTarget.TextStyle.NORMAL,
|
||||
linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]).getLineColor(),
|
||||
HorizontalAlignment.LEFT,
|
||||
VerticalAlignment.BOTTOM, null);
|
||||
tmLnColor = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]).getLineColor();
|
||||
}
|
||||
target.drawString(font10, tmDesStr, tmX,
|
||||
ly, 0.0,
|
||||
IGraphicsTarget.TextStyle.NORMAL,
|
||||
tmLnColor,
|
||||
HorizontalAlignment.LEFT,
|
||||
VerticalAlignment.BOTTOM, null);
|
||||
ly = ly + charHeight;
|
||||
if (ly >= cnYOrig)//-charHeight)
|
||||
//we dont show time line that extends below time line box
|
||||
|
@ -278,7 +358,7 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
|
|||
//draw time line page title etc. only when pane box height is larger than timeline box height
|
||||
x = stnXOrig;
|
||||
y = stnYOrig -1.5*charHeight*yRatio;
|
||||
s = stnStateList.size() + " stations, page " + curStnIdPage+"/"+totalStnIdPage;
|
||||
s = stnElemList.size() + " stations, page " + curStnIdPage+"/"+totalStnIdPage;
|
||||
target.drawString(font10, s, x,
|
||||
y, 0.0,
|
||||
IGraphicsTarget.TextStyle.NORMAL,
|
||||
|
@ -288,7 +368,7 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
|
|||
y = dtYOrig;
|
||||
target.drawLine(stnXOrig, y, 0.0,stnXEnd , y, 0.0,NsharpConstants.color_white,1, LineStyle.SOLID);
|
||||
//System.out.println("drawNsharpDataTimelines picked stn info: "+ pickedStnInfoStr);
|
||||
x = stnXOrig +dtWidth/2;
|
||||
x = stnXOrig +stnWidth/2;
|
||||
// line divide nextPage and prevPage strings
|
||||
target.drawLine(x, y, 0.0,
|
||||
x , y+1.2*charHeight*yRatio, 0.0,
|
||||
|
@ -304,7 +384,7 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
|
|||
HorizontalAlignment.LEFT,
|
||||
VerticalAlignment.BOTTOM, null);
|
||||
|
||||
x= stnXOrig + dtWidth/2 + 5;
|
||||
x= stnXOrig + stnWidth/2 + 5;
|
||||
s = "prevPage";
|
||||
target.drawString(font10, s, x,
|
||||
y, 0.0,
|
||||
|
@ -328,39 +408,34 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
|
|||
int startIndex = (rscHandler.getCurStnIdPage()-1) * numStnToShow;
|
||||
if(startIndex<0)
|
||||
startIndex =0;
|
||||
int compIndex= 1;
|
||||
int colorIndex;
|
||||
boolean compareStnIsOn = rscHandler.isCompareStnIsOn();
|
||||
int currentStnStateListIndex = rscHandler.getCurrentStnStateListIndex();
|
||||
int currentTimeLineStateListIndex = rscHandler.getCurrentTimeLineStateListIndex();
|
||||
double ly = dtNextPageEnd + charHeight;
|
||||
int colorIndex;
|
||||
double ly = dtNextPageEnd + charHeight;
|
||||
RGB color;
|
||||
Rectangle2D strBD = target.getStringBounds(font10, "*");
|
||||
double hRatio = paintProps.getView().getExtent().getWidth() / paintProps.getCanvasBounds().width;
|
||||
double xGap = 2*strBD.getWidth()*hRatio;
|
||||
for (int j = startIndex; j< stnStateList.size(); j++)
|
||||
for (int j = startIndex; j< stnElemList.size(); j++)
|
||||
{
|
||||
boolean avail=false;
|
||||
x = stnXOrig + 5;
|
||||
NsharpStationStateProperty elm = stnStateList.get(j);
|
||||
NsharpConstants.State sta ;
|
||||
if(elm.stnState == NsharpConstants.State.ACTIVE && j == currentStnStateListIndex)
|
||||
sta = NsharpConstants.State.CURRENT;
|
||||
else
|
||||
sta = elm.stnState; // set its state based on stn state
|
||||
NsharpOperationElement elm = stnElemList.get(j);
|
||||
NsharpConstants.ActState sta = elm.getActionState();
|
||||
if(sta == NsharpConstants.ActState.ACTIVE && j == curStnIndex)
|
||||
sta = NsharpConstants.ActState.CURRENT;
|
||||
|
||||
|
||||
if (currentTimeLineStateListIndex>=0){
|
||||
if(rscHandler.getStnTimeTable().get(j).get(currentTimeLineStateListIndex).elementState == NsharpConstants.State.AVAIL ){
|
||||
if (curTimeLineIndex>=0 && curSndIndex >=0){
|
||||
if(stnTimeSndTable.get(j).get(curTimeLineIndex).get(curSndIndex)!=null ){
|
||||
avail =true;
|
||||
}
|
||||
s = "*";
|
||||
if(avail){
|
||||
color = NsharpConstants.color_red;
|
||||
s = "*";
|
||||
if(sta == NsharpConstants.ActState.CURRENT)
|
||||
color = NsharpConstants.color_green;
|
||||
}
|
||||
else {
|
||||
color = NsharpConstants.color_cyan;
|
||||
s = "*";
|
||||
color = NsharpConstants.color_purple;
|
||||
}
|
||||
target.drawString(font10, s, x,
|
||||
ly, 0.0,
|
||||
|
@ -370,32 +445,46 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
|
|||
VerticalAlignment.BOTTOM, null);
|
||||
}
|
||||
x=x+xGap;
|
||||
String stnId = elm.stnDescription;
|
||||
|
||||
color = rscHandler.getElementColorMap().get(sta);
|
||||
target.drawString(font10, stnId, x,
|
||||
String stnId = elm.elementDescription;
|
||||
double stnIdX = x;
|
||||
color = rscHandler.getElementColorMap().get(sta.name());
|
||||
|
||||
if( elm.getActionState() == NsharpConstants.ActState.ACTIVE && avail){
|
||||
if(compareStnIsOn){
|
||||
strBD = target.getStringBounds(font10, stnId);
|
||||
//colorIndex = (compIndex-1)%(NsharpConstants.LINE_COMP10-NsharpConstants.LINE_COMP1+1)+ NsharpConstants.LINE_COMP1;
|
||||
colorIndex = stnTimeSndTable.get(j).get(curTimeLineIndex).get(curSndIndex).getCompColorIndex();
|
||||
color = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]).getLineColor();
|
||||
s =""+ (colorIndex % NsharpConstants.LINE_COMP1 + 1);
|
||||
x=x+ strBD.getWidth()*hRatio+5;
|
||||
target.drawString(font10,s, x,
|
||||
ly, 0.0,
|
||||
IGraphicsTarget.TextStyle.NORMAL,
|
||||
color,
|
||||
HorizontalAlignment.LEFT,
|
||||
VerticalAlignment.BOTTOM, null);
|
||||
}
|
||||
else if((compareTmIsOn||compareSndIsOn) && j == curStnIndex){
|
||||
strBD = target.getStringBounds(font10, stnId);
|
||||
//colorIndex = (compIndex-1)%(NsharpConstants.LINE_COMP10-NsharpConstants.LINE_COMP1+1)+ NsharpConstants.LINE_COMP1;
|
||||
colorIndex = stnTimeSndTable.get(curStnIndex).get(curTimeLineIndex).get(curSndIndex).getCompColorIndex();
|
||||
color = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]).getLineColor();
|
||||
s =""+ (colorIndex % NsharpConstants.LINE_COMP1 + 1);
|
||||
x=x+ strBD.getWidth()*hRatio+5;
|
||||
target.drawString(font10,s, x,
|
||||
ly, 0.0,
|
||||
IGraphicsTarget.TextStyle.NORMAL,
|
||||
color,
|
||||
HorizontalAlignment.LEFT,
|
||||
VerticalAlignment.BOTTOM, null);
|
||||
}
|
||||
}
|
||||
target.drawString(font10, stnId, stnIdX,
|
||||
ly, 0.0,
|
||||
IGraphicsTarget.TextStyle.NORMAL,
|
||||
color,
|
||||
HorizontalAlignment.LEFT,
|
||||
VerticalAlignment.BOTTOM, null);
|
||||
if(compareStnIsOn && elm.stnState == NsharpConstants.State.ACTIVE && avail){
|
||||
strBD = target.getStringBounds(font10, stnId);
|
||||
colorIndex = (compIndex-1)%(NsharpConstants.LINE_COMP10-NsharpConstants.LINE_COMP1+1)+ NsharpConstants.LINE_COMP1;
|
||||
s =""+ compIndex;
|
||||
x=x+ strBD.getWidth()*hRatio+5;
|
||||
target.drawString(font10,s, x,
|
||||
ly, 0.0,
|
||||
IGraphicsTarget.TextStyle.NORMAL,
|
||||
linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]).getLineColor(),
|
||||
HorizontalAlignment.LEFT,
|
||||
VerticalAlignment.BOTTOM, null);
|
||||
compIndex++;
|
||||
|
||||
}//else if(compareTmIsOn){
|
||||
//anything to do?
|
||||
//}
|
||||
|
||||
ly = ly + charHeight;
|
||||
if (ly >= cnYOrig)
|
||||
//we dont show stn id that extends below box
|
||||
|
@ -403,6 +492,151 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void drawNsharpSndTypeBox(IGraphicsTarget target, Rectangle rect) throws VizException {
|
||||
PixelExtent extent = new PixelExtent(rect);
|
||||
target.setupClippingPlane(extent);
|
||||
target.drawRect(extent,NsharpConstants.backgroundColor, 1.0f, 1.0f);
|
||||
double x;
|
||||
double y;
|
||||
String s;
|
||||
if(dtHeight < paneHeight){
|
||||
//draw time line page title etc. only when pane box height is larger than timeline box height
|
||||
x = sndXOrig;
|
||||
y = sndYOrig -1.5*charHeight*yRatio;
|
||||
s = sndElemList.size() + " srcs, page " + curSndPage+"/"+totalSndPage;
|
||||
target.drawString(font10, s, x,
|
||||
y, 0.0,
|
||||
IGraphicsTarget.TextStyle.NORMAL,
|
||||
NsharpConstants.color_green,
|
||||
HorizontalAlignment.LEFT,
|
||||
VerticalAlignment.TOP, null);
|
||||
y = sndYOrig;
|
||||
target.drawLine(sndXOrig, y, 0.0,sndXEnd , y, 0.0,NsharpConstants.color_white,1, LineStyle.SOLID);
|
||||
//System.out.println("drawNsharpDataTimelines picked stn info: "+ pickedStnInfoStr);
|
||||
x = sndXOrig +sndWidth/2;
|
||||
// line divide nextPage and prevPage strings
|
||||
target.drawLine(x, y, 0.0,
|
||||
x , y+1.2*charHeight*yRatio, 0.0,
|
||||
NsharpConstants.color_white,1, LineStyle.SOLID);
|
||||
|
||||
x = sndXOrig + 5;
|
||||
y = y+1.2*charHeight*yRatio;
|
||||
s = "nextPage";
|
||||
target.drawString(font10, s, x,
|
||||
y, 0.0,
|
||||
IGraphicsTarget.TextStyle.NORMAL,
|
||||
NsharpConstants.color_yellow,
|
||||
HorizontalAlignment.LEFT,
|
||||
VerticalAlignment.BOTTOM, null);
|
||||
|
||||
x= sndXOrig + sndWidth/2 + 5;
|
||||
s = "prevPage";
|
||||
target.drawString(font10, s, x,
|
||||
y, 0.0,
|
||||
IGraphicsTarget.TextStyle.NORMAL,
|
||||
NsharpConstants.color_yellow,
|
||||
HorizontalAlignment.LEFT,
|
||||
VerticalAlignment.BOTTOM, null);
|
||||
|
||||
//line below neextPage string
|
||||
target.drawLine(sndXOrig, y, 0.0,
|
||||
sndXEnd , y, 0.0,
|
||||
NsharpConstants.color_white,1, LineStyle.SOLID);
|
||||
}
|
||||
|
||||
int numStnToShow = (cnYOrig-dtNextPageEnd)/charHeight;
|
||||
if(numStnToShow <1){
|
||||
numStnToShow = dtHeight/charHeight;
|
||||
if(numStnToShow <1)
|
||||
numStnToShow=1;
|
||||
}
|
||||
int startIndex = (rscHandler.getCurStnIdPage()-1) * numStnToShow;
|
||||
if(startIndex<0)
|
||||
startIndex =0;
|
||||
int colorIndex;
|
||||
double ly = dtNextPageEnd + charHeight;
|
||||
RGB color;
|
||||
Rectangle2D strBD = target.getStringBounds(font10, "*");
|
||||
double hRatio = paintProps.getView().getExtent().getWidth() / paintProps.getCanvasBounds().width;
|
||||
double xGap = 2*strBD.getWidth()*hRatio;
|
||||
for (int j = startIndex; j< sndElemList.size(); j++)
|
||||
{
|
||||
boolean avail=false;
|
||||
x = sndXOrig + 5;
|
||||
NsharpOperationElement elm = sndElemList.get(j);
|
||||
NsharpConstants.ActState sta = elm.getActionState();
|
||||
if(sta == NsharpConstants.ActState.ACTIVE && j == curSndIndex)
|
||||
sta = NsharpConstants.ActState.CURRENT;
|
||||
|
||||
|
||||
if (curTimeLineIndex>=0 && curStnIndex >=0){
|
||||
if(stnTimeSndTable.get(curStnIndex).get(curTimeLineIndex).get(j)!=null ){
|
||||
avail =true;
|
||||
}
|
||||
s = "*";
|
||||
if(avail){
|
||||
color = NsharpConstants.color_red;
|
||||
if(sta == NsharpConstants.ActState.CURRENT)
|
||||
color = NsharpConstants.color_green;
|
||||
}
|
||||
else {
|
||||
color = NsharpConstants.color_purple;
|
||||
}
|
||||
target.drawString(font10, s, x,
|
||||
ly, 0.0,
|
||||
IGraphicsTarget.TextStyle.NORMAL,
|
||||
color,
|
||||
HorizontalAlignment.LEFT,
|
||||
VerticalAlignment.BOTTOM, null);
|
||||
}
|
||||
x=x+xGap;
|
||||
String sndType = elm.elementDescription;
|
||||
double sndX = x;
|
||||
color = rscHandler.getElementColorMap().get(sta.name());
|
||||
|
||||
if( elm.getActionState() == NsharpConstants.ActState.ACTIVE && avail){
|
||||
if(compareSndIsOn){
|
||||
strBD = target.getStringBounds(font10, sndType);
|
||||
//colorIndex = (compIndex-1)%(NsharpConstants.LINE_COMP10-NsharpConstants.LINE_COMP1+1)+ NsharpConstants.LINE_COMP1;
|
||||
colorIndex = stnTimeSndTable.get(curStnIndex).get(curTimeLineIndex).get(j).getCompColorIndex();
|
||||
color = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]).getLineColor();
|
||||
s =""+ (colorIndex % NsharpConstants.LINE_COMP1 + 1);
|
||||
x=x+ strBD.getWidth()*hRatio+5;
|
||||
target.drawString(font10,s, x,
|
||||
ly, 0.0,
|
||||
IGraphicsTarget.TextStyle.NORMAL,
|
||||
color,
|
||||
HorizontalAlignment.LEFT,
|
||||
VerticalAlignment.BOTTOM, null);
|
||||
}
|
||||
else if((compareTmIsOn||compareStnIsOn) && j == curSndIndex){
|
||||
strBD = target.getStringBounds(font10, sndType);
|
||||
//colorIndex = (compIndex-1)%(NsharpConstants.LINE_COMP10-NsharpConstants.LINE_COMP1+1)+ NsharpConstants.LINE_COMP1;
|
||||
colorIndex = stnTimeSndTable.get(curStnIndex).get(curTimeLineIndex).get(curSndIndex).getCompColorIndex();
|
||||
color = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]).getLineColor();
|
||||
s =""+ (colorIndex % NsharpConstants.LINE_COMP1 + 1);
|
||||
x=x+ strBD.getWidth()*hRatio+5;
|
||||
target.drawString(font10,s, x,
|
||||
ly, 0.0,
|
||||
IGraphicsTarget.TextStyle.NORMAL,
|
||||
color,
|
||||
HorizontalAlignment.LEFT,
|
||||
VerticalAlignment.BOTTOM, null);
|
||||
}
|
||||
}
|
||||
target.drawString(font10, sndType, sndX,
|
||||
ly, 0.0,
|
||||
IGraphicsTarget.TextStyle.NORMAL,
|
||||
color,
|
||||
HorizontalAlignment.LEFT,
|
||||
VerticalAlignment.BOTTOM, null);
|
||||
ly = ly + charHeight;
|
||||
if (ly >= cnYOrig)
|
||||
//we dont show stn id that extends below box
|
||||
break;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void paintInternal(IGraphicsTarget target,
|
||||
PaintProperties paintProps) throws VizException {
|
||||
|
@ -411,12 +645,22 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
|
|||
//System.out.println("timeStn paintInternal zoomL="+currentZoomLevel);
|
||||
if(rscHandler== null)
|
||||
return;
|
||||
timeLineStateList = rscHandler.getTimeLineStateList(); //System.out.println("NsharpTimeStnPaneResource "+ descriptor.getPaneNumber());
|
||||
stnStateList = rscHandler.getStnStateList();
|
||||
stnElemList = rscHandler.getStnElementList();
|
||||
timeElemList = rscHandler.getTimeElementList();
|
||||
sndElemList = rscHandler.getSndElementList();
|
||||
curTimeLineIndex = rscHandler.getCurrentTimeElementListIndex();
|
||||
curStnIndex = rscHandler.getCurrentStnElementListIndex();
|
||||
curSndIndex = rscHandler.getCurrentSndElementListIndex();
|
||||
curTimeLinePage = rscHandler.getCurTimeLinePage();
|
||||
curStnIdPage = rscHandler.getCurStnIdPage();
|
||||
curSndPage = rscHandler.getCurSndPage();
|
||||
totalTimeLinePage = rscHandler.getTotalTimeLinePage();
|
||||
totalStnIdPage = rscHandler.getTotalStnIdPage();
|
||||
totalSndPage = rscHandler.getTotalSndPage();
|
||||
compareStnIsOn = rscHandler.isCompareStnIsOn();
|
||||
compareSndIsOn = rscHandler.isCompareSndIsOn();
|
||||
compareTmIsOn = rscHandler.isCompareTmIsOn();
|
||||
stnTimeSndTable = rscHandler.getStnTimeSndTable();
|
||||
this.font10.setSmoothing(false);
|
||||
this.font10.setScaleFont(false);
|
||||
this.font9.setSmoothing(false);
|
||||
|
@ -429,6 +673,8 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
|
|||
|
||||
//plot station id
|
||||
drawNsharpStationIdBox(target, stnIdRectangle);
|
||||
|
||||
drawNsharpSndTypeBox(target, sndRectangle);
|
||||
//plot color notations
|
||||
drawNsharpColorNotation(target, colorNoteRectangle );
|
||||
|
||||
|
@ -460,6 +706,11 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
|
|||
public Rectangle getStnIdRectangle() {
|
||||
return stnIdRectangle;
|
||||
}
|
||||
|
||||
public Rectangle getSndRectangle() {
|
||||
return sndRectangle;
|
||||
}
|
||||
|
||||
public Rectangle getColorNoteRectangle() {
|
||||
return colorNoteRectangle;
|
||||
}
|
||||
|
@ -474,10 +725,7 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
|
|||
pe = new PixelExtent(this.rectangle);
|
||||
getDescriptor().setNewPe(pe);
|
||||
defineCharHeight(font10);
|
||||
//rscHandler.setCharHeight(charHeight);
|
||||
//float prevHeight = paneHeight;
|
||||
//float prevWidth = paneWidth;
|
||||
paneHeight = (int) ext.getHeight();
|
||||
paneHeight = (int) ext.getHeight();
|
||||
paneWidth = (int) (ext.getWidth());
|
||||
//xRatio = xRatio* paneWidth/prevWidth;
|
||||
//DEBUGGING yRatio = yRatio* paneHeight/prevHeight;
|
||||
|
@ -486,8 +734,8 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
|
|||
//if pane height is less than 10 char height, then just plot time line. not plot "messages/title/notations" etc..
|
||||
if(paneHeight > (int)(10* charHeight*yRatio)){
|
||||
dtYOrig = (int) ext.getMinY()+(int)(2* charHeight*yRatio);
|
||||
cnHeight = (int)(3* charHeight*yRatio);
|
||||
dtHeight = paneHeight-(int)(5* charHeight*yRatio);
|
||||
cnHeight = (int)(4* charHeight*yRatio);
|
||||
dtHeight = paneHeight-(int)(6* charHeight*yRatio);
|
||||
dtNextPageEnd = dtYOrig+ (int) (2*charHeight*yRatio);
|
||||
}
|
||||
else {
|
||||
|
@ -497,12 +745,16 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
|
|||
dtNextPageEnd = dtYOrig;
|
||||
}
|
||||
dtXOrig = (int) (ext.getMinX());
|
||||
dtWidth = paneWidth/2;
|
||||
dtWidth = paneWidth* 40/100;
|
||||
dtXEnd = dtXOrig + dtWidth;
|
||||
stnXOrig = dtXEnd;
|
||||
stnYOrig = dtYOrig;
|
||||
stnWidth = dtWidth;
|
||||
stnWidth = paneWidth * 30/100;
|
||||
stnXEnd = stnXOrig+ stnWidth;
|
||||
sndXOrig = stnXEnd;
|
||||
sndYOrig = stnYOrig;
|
||||
sndWidth = paneWidth * 30/100;
|
||||
sndXEnd = sndXOrig+ sndWidth;
|
||||
stnHeight = dtHeight;
|
||||
cnXOrig = dtXOrig;
|
||||
cnYOrig = dtYOrig+ dtHeight;
|
||||
|
@ -512,14 +764,10 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
|
|||
dtWidth,paneHeight-cnHeight);
|
||||
stnIdRectangle = new Rectangle(stnXOrig,(int) ext.getMinY(),
|
||||
stnWidth,paneHeight-cnHeight);
|
||||
sndRectangle = new Rectangle(sndXOrig,(int) ext.getMinY(),
|
||||
sndWidth,paneHeight-cnHeight);
|
||||
colorNoteRectangle = new Rectangle(cnXOrig,cnYOrig,
|
||||
cnWidth,cnHeight);
|
||||
rscHandler.setTimeStnBoxData( cnYOrig, dtNextPageEnd, dtYOrig ,dtXOrig, dtWidth, charHeight);
|
||||
/*rscHandler.setDtNextPageEnd(dtNextPageEnd);
|
||||
rscHandler.setDtYOrig(dtYOrig);
|
||||
rscHandler.setCnYOrig(cnYOrig);
|
||||
rscHandler.setCharHeight(charHeight);*/
|
||||
|
||||
//System.out.println("pane 4 height="+paneHeight);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -352,7 +352,6 @@ public class NsharpWitoPaneResource extends NsharpAbstractPaneResource{
|
|||
shapeC.compile();
|
||||
shapePline.compile();
|
||||
}
|
||||
private static int k=0;
|
||||
/*
|
||||
* Chin:: NOTE:::
|
||||
* This plotting function is based on the algorithm of plot_advectionprofile() at xwvid5.c of Bignsharp source code
|
||||
|
|
|
@ -35,13 +35,14 @@ import org.eclipse.ui.PlatformUI;
|
|||
|
||||
|
||||
public class NsharpConfigDialog extends Dialog {
|
||||
private Button parameterBtn, dataDisplayBtn,dataPageBtn, timeLineBtn, stnBtn, paneCfgBtn, mdlCfgBtn;
|
||||
private Button parameterBtn, dataDisplayBtn,dataPageBtn, timeLineBtn, stnBtn, sndBtn,paneCfgBtn, mdlCfgBtn;
|
||||
private static NsharpConfigDialog thisDialog=null;
|
||||
private static NsharpParametersSelectionConfigDialog parameterSelDialog = null;
|
||||
private static NsharpDataDisplayConfigDialog dataDislpayDialog = null;
|
||||
private static NsharpDataPageConfigDialog dataPageDialog = null;
|
||||
private static NsharpTimeLineConfigDialog timelineDialog = null;
|
||||
private static NsharpStnConfigDialog stnDialog = null;
|
||||
private static NsharpSndConfigDialog sndDialog = null;
|
||||
private static NsharpPaneConfigDialog paneCfgDialog = null;
|
||||
private static NsharpGribModelTypeConfigDialog mdlCfgDialog = null;
|
||||
public NsharpConfigDialog(Shell parentShell) {
|
||||
|
@ -67,52 +68,26 @@ public class NsharpConfigDialog extends Dialog {
|
|||
parameterBtn = new Button(parent, SWT.PUSH);
|
||||
parameterBtn.setText("Parameters Selection");
|
||||
parameterBtn.setEnabled( true );
|
||||
//graphBtn.setSize(btnWidth,pushbtnHeight);
|
||||
|
||||
parameterBtn.addListener( SWT.MouseUp, new Listener() {
|
||||
public void handleEvent(Event event) {
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
||||
parameterSelDialog = NsharpParametersSelectionConfigDialog.getInstance(shell);
|
||||
if ( parameterSelDialog != null ) {
|
||||
parameterSelDialog.open();
|
||||
/*timeLineBtn.setEnabled( false );
|
||||
dataDisplayBtn.setEnabled(false);
|
||||
stnBtn.setEnabled( false );
|
||||
dataPageBtn.setEnabled( false );
|
||||
paneCfgBtn.setEnabled( false );
|
||||
mdlCfgBtn.setEnabled( false );
|
||||
parameterSelDialog.open();
|
||||
dataDisplayBtn.setEnabled(true);
|
||||
timeLineBtn.setEnabled( true );
|
||||
stnBtn.setEnabled( true );
|
||||
dataPageBtn.setEnabled( true );
|
||||
paneCfgBtn.setEnabled( true );
|
||||
mdlCfgBtn.setEnabled( true );*/
|
||||
}
|
||||
}
|
||||
} );
|
||||
dataDisplayBtn = new Button(parent, SWT.PUSH);
|
||||
dataDisplayBtn.setText("Data Display Configuration");
|
||||
dataDisplayBtn.setEnabled( true );
|
||||
//lineBtn.setSize(btnWidth,pushbtnHeight);
|
||||
|
||||
dataDisplayBtn.addListener( SWT.MouseUp, new Listener() {
|
||||
public void handleEvent(Event event) {
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
||||
dataDislpayDialog = NsharpDataDisplayConfigDialog.getInstance(shell);
|
||||
if ( dataDislpayDialog != null ) {
|
||||
dataDislpayDialog.open();
|
||||
/*timeLineBtn.setEnabled( false );
|
||||
parameterBtn.setEnabled(false);
|
||||
stnBtn.setEnabled( false );
|
||||
dataPageBtn.setEnabled( false );
|
||||
paneCfgBtn.setEnabled( false );
|
||||
mdlCfgBtn.setEnabled( false );
|
||||
dataDislpayDialog.open();
|
||||
parameterBtn.setEnabled(true);
|
||||
timeLineBtn.setEnabled( true );
|
||||
stnBtn.setEnabled( true );
|
||||
dataPageBtn.setEnabled( true );
|
||||
paneCfgBtn.setEnabled( true );
|
||||
mdlCfgBtn.setEnabled( true );*/
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
@ -120,78 +95,53 @@ public class NsharpConfigDialog extends Dialog {
|
|||
dataPageBtn = new Button(parent, SWT.PUSH);
|
||||
dataPageBtn.setText("Data Page Configuration");
|
||||
dataPageBtn.setEnabled( true );
|
||||
//lineBtn.setSize(btnWidth,pushbtnHeight);
|
||||
|
||||
dataPageBtn.addListener( SWT.MouseUp, new Listener() {
|
||||
public void handleEvent(Event event) {
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
||||
dataPageDialog = NsharpDataPageConfigDialog.getInstance(shell);
|
||||
if ( dataPageDialog != null ) {
|
||||
/*timeLineBtn.setEnabled( false );
|
||||
parameterBtn.setEnabled(false);
|
||||
stnBtn.setEnabled( false );
|
||||
dataDisplayBtn.setEnabled(false);
|
||||
paneCfgBtn.setEnabled( false );
|
||||
mdlCfgBtn.setEnabled( false );
|
||||
dataPageDialog.open();
|
||||
parameterBtn.setEnabled(true);
|
||||
timeLineBtn.setEnabled( true );
|
||||
stnBtn.setEnabled( true );
|
||||
dataDisplayBtn.setEnabled(true);
|
||||
paneCfgBtn.setEnabled( true );
|
||||
mdlCfgBtn.setEnabled( true );*/
|
||||
dataPageDialog.open();
|
||||
}
|
||||
}
|
||||
} );
|
||||
timeLineBtn = new Button(parent, SWT.PUSH);
|
||||
timeLineBtn.setText("Time Line Activation");
|
||||
|
||||
timeLineBtn.setEnabled( true );
|
||||
//lineBtn.setSize(btnWidth,pushbtnHeight);
|
||||
|
||||
timeLineBtn.addListener( SWT.MouseUp, new Listener() {
|
||||
public void handleEvent(Event event) {
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
||||
timelineDialog = NsharpTimeLineConfigDialog.getInstance(shell);
|
||||
if ( timelineDialog != null ) {
|
||||
timelineDialog.open();
|
||||
/*dataDisplayBtn.setEnabled(false);
|
||||
parameterBtn.setEnabled(false);
|
||||
stnBtn.setEnabled( false );
|
||||
dataPageBtn.setEnabled( false );
|
||||
paneCfgBtn.setEnabled( false );
|
||||
mdlCfgBtn.setEnabled( false );
|
||||
timelineDialog.open();
|
||||
parameterBtn.setEnabled(true);
|
||||
dataDisplayBtn.setEnabled(true);
|
||||
stnBtn.setEnabled( true );
|
||||
dataPageBtn.setEnabled( true );
|
||||
paneCfgBtn.setEnabled( true );
|
||||
mdlCfgBtn.setEnabled( true );*/
|
||||
}
|
||||
}
|
||||
} );
|
||||
stnBtn = new Button(parent, SWT.PUSH);
|
||||
stnBtn.setText("Station Activation");
|
||||
stnBtn.setEnabled( true );
|
||||
//lineBtn.setSize(btnWidth,pushbtnHeight);
|
||||
|
||||
stnBtn.addListener( SWT.MouseUp, new Listener() {
|
||||
public void handleEvent(Event event) {
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
||||
stnDialog = NsharpStnConfigDialog.getInstance(shell);
|
||||
if ( stnDialog != null ) {
|
||||
stnDialog.open();
|
||||
/*dataDisplayBtn.setEnabled(false);
|
||||
parameterBtn.setEnabled(false);
|
||||
timeLineBtn.setEnabled( false );
|
||||
dataPageBtn.setEnabled( false );
|
||||
paneCfgBtn.setEnabled( false );
|
||||
mdlCfgBtn.setEnabled( false );
|
||||
stnDialog.open();
|
||||
parameterBtn.setEnabled(true);
|
||||
dataDisplayBtn.setEnabled(true);
|
||||
timeLineBtn.setEnabled( true );
|
||||
dataPageBtn.setEnabled( true );
|
||||
paneCfgBtn.setEnabled( true );
|
||||
mdlCfgBtn.setEnabled( true );*/
|
||||
}
|
||||
}
|
||||
} );
|
||||
sndBtn = new Button(parent, SWT.PUSH);
|
||||
sndBtn.setText("Sounding Source Activation");
|
||||
sndBtn.setEnabled( true );
|
||||
|
||||
sndBtn.addListener( SWT.MouseUp, new Listener() {
|
||||
public void handleEvent(Event event) {
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
||||
sndDialog = NsharpSndConfigDialog.getInstance(shell);
|
||||
if ( sndDialog != null ) {
|
||||
sndDialog.open();
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
@ -199,7 +149,7 @@ public class NsharpConfigDialog extends Dialog {
|
|||
paneCfgBtn = new Button(parent, SWT.PUSH);
|
||||
paneCfgBtn.setText("Display Pane Configuration");
|
||||
paneCfgBtn.setEnabled( true );
|
||||
//lineBtn.setSize(btnWidth,pushbtnHeight);
|
||||
|
||||
paneCfgBtn.addListener( SWT.MouseUp, new Listener() {
|
||||
public void handleEvent(Event event) {
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
||||
|
@ -207,46 +157,19 @@ public class NsharpConfigDialog extends Dialog {
|
|||
if ( paneCfgDialog != null ) {
|
||||
paneCfgDialog.open();
|
||||
}
|
||||
/*dataDisplayBtn.setEnabled(false);
|
||||
parameterBtn.setEnabled(false);
|
||||
timeLineBtn.setEnabled( false );
|
||||
dataPageBtn.setEnabled( false );
|
||||
stnBtn.setEnabled( false );
|
||||
mdlCfgBtn.setEnabled( false );
|
||||
paneCfgDialog.open();
|
||||
parameterBtn.setEnabled(true);
|
||||
dataDisplayBtn.setEnabled(true);
|
||||
timeLineBtn.setEnabled( true );
|
||||
dataPageBtn.setEnabled( true );
|
||||
stnBtn.setEnabled( true );
|
||||
mdlCfgBtn.setEnabled( true );
|
||||
*/
|
||||
}
|
||||
} );
|
||||
|
||||
mdlCfgBtn = new Button(parent, SWT.PUSH);
|
||||
mdlCfgBtn.setText("Grid Model Type Configuration");
|
||||
mdlCfgBtn.setEnabled( true );
|
||||
//lineBtn.setSize(btnWidth,pushbtnHeight);
|
||||
|
||||
mdlCfgBtn.addListener( SWT.MouseUp, new Listener() {
|
||||
public void handleEvent(Event event) {
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
||||
mdlCfgDialog = NsharpGribModelTypeConfigDialog.getInstance(shell);
|
||||
if ( mdlCfgDialog != null ) {
|
||||
mdlCfgDialog.open();
|
||||
/*dataDisplayBtn.setEnabled(false);
|
||||
parameterBtn.setEnabled(false);
|
||||
timeLineBtn.setEnabled( false );
|
||||
dataPageBtn.setEnabled( false );
|
||||
stnBtn.setEnabled( false );
|
||||
paneCfgBtn.setEnabled( false );
|
||||
mdlCfgDialog.open();
|
||||
parameterBtn.setEnabled(true);
|
||||
dataDisplayBtn.setEnabled(true);
|
||||
timeLineBtn.setEnabled( true );
|
||||
dataPageBtn.setEnabled( true );
|
||||
stnBtn.setEnabled( true );
|
||||
paneCfgBtn.setEnabled(true);*/
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
@ -254,7 +177,7 @@ public class NsharpConfigDialog extends Dialog {
|
|||
Button windbarbCfgBtn = new Button(parent, SWT.PUSH);
|
||||
windbarbCfgBtn.setText("Wind Barb Configuration");
|
||||
windbarbCfgBtn.setEnabled( true );
|
||||
//lineBtn.setSize(btnWidth,pushbtnHeight);
|
||||
|
||||
windbarbCfgBtn.addListener( SWT.MouseUp, new Listener() {
|
||||
public void handleEvent(Event event) {
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
||||
|
@ -262,19 +185,6 @@ public class NsharpConfigDialog extends Dialog {
|
|||
|
||||
if ( windBarbDlg != null ) {
|
||||
windBarbDlg.open();
|
||||
/*dataDisplayBtn.setEnabled(false);
|
||||
parameterBtn.setEnabled(false);
|
||||
timeLineBtn.setEnabled( false );
|
||||
dataPageBtn.setEnabled( false );
|
||||
stnBtn.setEnabled( false );
|
||||
paneCfgBtn.setEnabled( false );
|
||||
windBarbDlg.open();
|
||||
parameterBtn.setEnabled(true);
|
||||
dataDisplayBtn.setEnabled(true);
|
||||
timeLineBtn.setEnabled( true );
|
||||
dataPageBtn.setEnabled( true );
|
||||
stnBtn.setEnabled( true );
|
||||
paneCfgBtn.setEnabled(true);*/
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
@ -313,7 +223,7 @@ public class NsharpConfigDialog extends Dialog {
|
|||
protected void configureShell( Shell shell ) {
|
||||
super.configureShell( shell );
|
||||
shell.setText( "Nsharp Configuration" );
|
||||
shell.setSize(250, 370);
|
||||
shell.setSize(250, 450);
|
||||
}
|
||||
@Override
|
||||
public int open( ) {
|
||||
|
|
|
@ -57,6 +57,8 @@ import org.eclipse.ui.IWorkbenchPage;
|
|||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.PartInitException;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.contexts.IContextActivation;
|
||||
import org.eclipse.ui.contexts.IContextService;
|
||||
import org.eclipse.ui.part.ViewPart;
|
||||
|
||||
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
|
||||
|
@ -71,13 +73,13 @@ public class NsharpPaletteWindow extends ViewPart implements SelectionListener,
|
|||
DisposeListener, IPartListener{
|
||||
private MessageBox mb ;
|
||||
protected Button loadBtn, unloadBtn, overlayBtn, interpBtn,dataEditBtn,
|
||||
compareStnBtn,compareTmBtn, graphEditBtn,graphModeBtnSkew, graphModeBtnIcing,
|
||||
graphModeBtnTurb, effBulkShearBtn, stpBtn, shipBtn, winterBtn, fireBtn,hailBtn,sarsBtn;
|
||||
compareStnBtn,compareSndBtn,compareTmBtn, graphEditBtn,graphModeBtnSkew, graphModeBtnIcing,
|
||||
graphModeBtnTurb, effBulkShearBtn, stpBtn, shipBtn, winterBtn, fireBtn,hailBtn,sarsBtn,cfgBtn;
|
||||
private Shell shell;
|
||||
private Label spcGplbl;
|
||||
private Composite parent;
|
||||
private Group spcGp;
|
||||
private boolean overlayIsOn=false, compareStnIsOn=false, compareTmIsOn=false;
|
||||
private boolean overlayIsOn=false, compareStnIsOn=false, compareSndIsOn=false,compareTmIsOn=false;
|
||||
protected boolean interpolateIsOn=false, editGraphOn=false;
|
||||
private static String INTP_OFF = " Interp(off) ";
|
||||
private static String INTP_ON = " Interp(on) ";
|
||||
|
@ -85,6 +87,8 @@ DisposeListener, IPartListener{
|
|||
private static String COMP_STN_ON= "CompStn(on) ";
|
||||
private static String COMP_TM_OFF= "CompTm(off)";
|
||||
private static String COMP_TM_ON= "CompTm(on) ";
|
||||
private static String COMP_SND_OFF= "CompSrc(off)";
|
||||
private static String COMP_SND_ON= "CompSrc(on) ";
|
||||
private static String OVLY_OFF= "Ovrlay2(off) ";
|
||||
private static String OVLY_ON= "Ovrlay2(on) ";
|
||||
protected static String EDIT_GRAPH_OFF= "EditGraph(off)";
|
||||
|
@ -116,13 +120,14 @@ DisposeListener, IPartListener{
|
|||
}
|
||||
|
||||
public void restorePaletteWindow( String paneConfigurationName,int currentGraphMode, boolean interpolateIsOn, boolean overlayIsOn, boolean compareStnIsOn,
|
||||
boolean compareTmIsOn, boolean editGraphOn) {
|
||||
boolean compareTmIsOn, boolean editGraphOn, boolean compareSndIsOn) {
|
||||
//System.out.println("restorePaletteWindow "+ this.toString());
|
||||
updateSpcGraphBtn(paneConfigurationName);
|
||||
this.currentGraphMode = currentGraphMode;
|
||||
this.interpolateIsOn = interpolateIsOn;
|
||||
this.overlayIsOn = overlayIsOn;
|
||||
this.compareStnIsOn = compareStnIsOn;
|
||||
this.compareSndIsOn = compareSndIsOn;
|
||||
this.compareTmIsOn = compareTmIsOn;
|
||||
this.editGraphOn = editGraphOn;
|
||||
graphModeBtnSkew.setEnabled(true);
|
||||
|
@ -135,6 +140,7 @@ DisposeListener, IPartListener{
|
|||
graphEditBtn.setEnabled(true);
|
||||
dataEditBtn.setEnabled(true);
|
||||
compareTmBtn.setEnabled( true );
|
||||
compareSndBtn.setEnabled( true );
|
||||
compareStnBtn.setEnabled( true );
|
||||
overlayBtn.setEnabled( true );
|
||||
interpBtn.setEnabled(true);
|
||||
|
@ -142,11 +148,13 @@ DisposeListener, IPartListener{
|
|||
interpBtn.setText(INTP_OFF);
|
||||
graphEditBtn.setText(EDIT_GRAPH_OFF);
|
||||
compareTmBtn.setText(COMP_TM_OFF);
|
||||
compareSndBtn.setText(COMP_SND_OFF);
|
||||
compareStnBtn.setText(COMP_STN_OFF);
|
||||
if(interpolateIsOn) {
|
||||
graphEditBtn.setEnabled(false);
|
||||
dataEditBtn.setEnabled(false);
|
||||
compareTmBtn.setEnabled( false );
|
||||
compareSndBtn.setEnabled( false );
|
||||
compareStnBtn.setEnabled( false );
|
||||
overlayBtn.setEnabled( false );
|
||||
interpBtn.setText(INTP_ON);
|
||||
|
@ -156,6 +164,7 @@ DisposeListener, IPartListener{
|
|||
graphEditBtn.setEnabled(false);
|
||||
dataEditBtn.setEnabled(false);
|
||||
compareTmBtn.setEnabled( false );
|
||||
compareSndBtn.setEnabled( false );
|
||||
compareStnBtn.setEnabled( false );
|
||||
interpBtn.setEnabled(false);
|
||||
graphModeBtnIcing.setEnabled(false);
|
||||
|
@ -166,6 +175,18 @@ DisposeListener, IPartListener{
|
|||
graphEditBtn.setEnabled(false);
|
||||
dataEditBtn.setEnabled(false);
|
||||
compareTmBtn.setEnabled( false );
|
||||
compareSndBtn.setEnabled( false );
|
||||
overlayBtn.setEnabled( false );
|
||||
interpBtn.setEnabled(false);
|
||||
graphModeBtnIcing.setEnabled(false);
|
||||
graphModeBtnTurb.setEnabled(false);
|
||||
}
|
||||
else if(compareSndIsOn){
|
||||
compareSndBtn.setText(COMP_SND_ON);
|
||||
graphEditBtn.setEnabled(false);
|
||||
dataEditBtn.setEnabled(false);
|
||||
compareTmBtn.setEnabled( false );
|
||||
compareStnBtn.setEnabled( false );
|
||||
overlayBtn.setEnabled( false );
|
||||
interpBtn.setEnabled(false);
|
||||
graphModeBtnIcing.setEnabled(false);
|
||||
|
@ -173,6 +194,7 @@ DisposeListener, IPartListener{
|
|||
}
|
||||
else if(compareTmIsOn){
|
||||
compareTmBtn.setText(COMP_TM_ON);
|
||||
compareSndBtn.setEnabled( false );
|
||||
graphEditBtn.setEnabled(false);
|
||||
dataEditBtn.setEnabled(false);
|
||||
compareStnBtn.setEnabled( false );
|
||||
|
@ -186,6 +208,7 @@ DisposeListener, IPartListener{
|
|||
dataEditBtn.setEnabled(false);
|
||||
compareStnBtn.setEnabled( false );
|
||||
compareTmBtn.setEnabled( false );
|
||||
compareSndBtn.setEnabled( false );
|
||||
overlayBtn.setEnabled( false );
|
||||
interpBtn.setEnabled(false);
|
||||
graphModeBtnIcing.setEnabled(false);
|
||||
|
@ -200,6 +223,7 @@ DisposeListener, IPartListener{
|
|||
graphEditBtn.setEnabled(false);
|
||||
dataEditBtn.setEnabled(false);
|
||||
compareTmBtn.setEnabled( false );
|
||||
compareSndBtn.setEnabled( false );
|
||||
compareStnBtn.setEnabled( false );
|
||||
overlayBtn.setEnabled( false );
|
||||
if(interpolateIsOn)
|
||||
|
@ -215,6 +239,7 @@ DisposeListener, IPartListener{
|
|||
graphEditBtn.setEnabled(false);
|
||||
dataEditBtn.setEnabled(false);
|
||||
compareTmBtn.setEnabled( false );
|
||||
compareSndBtn.setEnabled( false );
|
||||
compareStnBtn.setEnabled( false );
|
||||
overlayBtn.setEnabled( false );
|
||||
if(interpolateIsOn)
|
||||
|
@ -304,7 +329,7 @@ DisposeListener, IPartListener{
|
|||
}
|
||||
//System.out.println("view NsharpPaletteWindow constructed!! "+ this.toString());
|
||||
printHandle = NsharpPrintHandle.getPrintHandle();
|
||||
shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
||||
shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
||||
|
||||
mb = new MessageBox(shell, SWT.ICON_WARNING
|
||||
| SWT.OK );
|
||||
|
@ -350,7 +375,9 @@ DisposeListener, IPartListener{
|
|||
interpolateIsOn = rsc.isInterpolateIsOn();
|
||||
overlayIsOn = rsc.isOverlayIsOn();
|
||||
compareStnIsOn = rsc.isCompareStnIsOn();
|
||||
editGraphOn = rsc.isEditGraphOn();
|
||||
editGraphOn = rsc.isEditGraphOn();
|
||||
compareSndIsOn = rsc.isCompareSndIsOn();
|
||||
compareTmIsOn = rsc.isCompareTmIsOn();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -437,7 +464,7 @@ DisposeListener, IPartListener{
|
|||
}
|
||||
|
||||
public void createDataControlGp(Composite parent){
|
||||
this.parent = parent;
|
||||
this.parent = parent;
|
||||
Group textModeGp = new Group(parent,SWT.SHADOW_OUT);
|
||||
textModeGp.setLayout( new RowLayout(SWT.HORIZONTAL) );
|
||||
textModeGp.setLayoutData( new GridData(GridData.FILL_HORIZONTAL) );
|
||||
|
@ -466,7 +493,7 @@ DisposeListener, IPartListener{
|
|||
}
|
||||
}
|
||||
} );
|
||||
|
||||
|
||||
unloadBtn = new Button(textModeGp, SWT.PUSH);
|
||||
unloadBtn.setFont(newFont);
|
||||
unloadBtn.setText(" UnLoad ");
|
||||
|
@ -505,7 +532,7 @@ DisposeListener, IPartListener{
|
|||
} );
|
||||
|
||||
// Push buttons for CONFIGURE
|
||||
Button cfgBtn = new Button(textModeGp, SWT.PUSH);
|
||||
cfgBtn = new Button(textModeGp, SWT.PUSH);
|
||||
cfgBtn.setFont(newFont);
|
||||
cfgBtn.setText(" Configure ");
|
||||
cfgBtn.setEnabled(true);
|
||||
|
@ -532,7 +559,7 @@ DisposeListener, IPartListener{
|
|||
public void handleEvent(Event event) {
|
||||
//RESET should turn off everything...
|
||||
shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
||||
|
||||
cfgBtn.setEnabled(true);
|
||||
overlayIsOn = false;
|
||||
overlayBtn.setText(OVLY_OFF);
|
||||
overlayBtn.setEnabled(true);
|
||||
|
@ -542,6 +569,9 @@ DisposeListener, IPartListener{
|
|||
compareTmIsOn = false;
|
||||
compareTmBtn.setText(COMP_TM_OFF);
|
||||
compareTmBtn.setEnabled(true);
|
||||
compareSndIsOn = false;
|
||||
compareSndBtn.setText(COMP_SND_OFF);
|
||||
compareSndBtn.setEnabled(true);
|
||||
interpolateIsOn = false;
|
||||
interpBtn.setText(INTP_OFF);
|
||||
interpBtn.setEnabled(true);
|
||||
|
@ -665,6 +695,7 @@ DisposeListener, IPartListener{
|
|||
graphEditBtn.setEnabled(false);
|
||||
dataEditBtn.setEnabled(false);
|
||||
compareTmBtn.setEnabled( false );
|
||||
compareSndBtn.setEnabled( false );
|
||||
compareStnBtn.setEnabled( false );
|
||||
overlayBtn.setEnabled( false );
|
||||
}
|
||||
|
@ -675,6 +706,7 @@ DisposeListener, IPartListener{
|
|||
graphEditBtn.setEnabled(true);
|
||||
dataEditBtn.setEnabled(true);
|
||||
compareTmBtn.setEnabled( true );
|
||||
compareSndBtn.setEnabled( true );
|
||||
compareStnBtn.setEnabled( true );
|
||||
overlayBtn.setEnabled( true );
|
||||
}
|
||||
|
@ -711,7 +743,7 @@ DisposeListener, IPartListener{
|
|||
else{
|
||||
overlayBtn.setText(OVLY_OFF);
|
||||
//comparison and overlay is mutual exclusive
|
||||
if((rscHandler!= null) && (rscHandler.isCompareStnIsOn() || rscHandler.isCompareTmIsOn()))
|
||||
if((rscHandler!= null) && (rscHandler.isCompareStnIsOn() || rscHandler.isCompareTmIsOn()|| rscHandler.isCompareSndIsOn()))
|
||||
overlayBtn.setEnabled( false );
|
||||
else
|
||||
overlayBtn.setEnabled( true );
|
||||
|
@ -725,22 +757,26 @@ DisposeListener, IPartListener{
|
|||
overlayBtn.setText(OVLY_ON);
|
||||
compareStnBtn.setEnabled(false);
|
||||
compareTmBtn.setEnabled(false);
|
||||
compareSndBtn.setEnabled(false);
|
||||
graphEditBtn.setEnabled(false);
|
||||
dataEditBtn.setEnabled(false);
|
||||
graphModeBtnTurb.setEnabled( false );
|
||||
graphModeBtnIcing.setEnabled( false );
|
||||
interpBtn.setEnabled( false );
|
||||
cfgBtn.setEnabled( false );
|
||||
}
|
||||
else {
|
||||
overlayIsOn = false;
|
||||
overlayBtn.setText(OVLY_OFF);
|
||||
compareStnBtn.setEnabled(true);
|
||||
compareTmBtn.setEnabled(true);
|
||||
compareSndBtn.setEnabled(true);
|
||||
graphEditBtn.setEnabled(true);
|
||||
dataEditBtn.setEnabled(true);
|
||||
graphModeBtnTurb.setEnabled( true );
|
||||
graphModeBtnIcing.setEnabled( true );
|
||||
interpBtn.setEnabled( true );
|
||||
cfgBtn.setEnabled( true );
|
||||
}
|
||||
NsharpResourceHandler rsc = getRscHandler();
|
||||
if(rsc!= null){
|
||||
|
@ -759,7 +795,7 @@ DisposeListener, IPartListener{
|
|||
else{
|
||||
//comparison and overlay is mutual exclusive
|
||||
compareStnBtn.setText(COMP_STN_OFF);
|
||||
if((rscHandler!= null) && (rscHandler.isOverlayIsOn() || rscHandler.isCompareTmIsOn()))
|
||||
if((rscHandler!= null) && (rscHandler.isOverlayIsOn() || rscHandler.isCompareTmIsOn()|| rscHandler.isCompareSndIsOn()))
|
||||
compareStnBtn.setEnabled( false );
|
||||
else
|
||||
compareStnBtn.setEnabled( true );
|
||||
|
@ -773,22 +809,26 @@ DisposeListener, IPartListener{
|
|||
compareStnBtn.setText(COMP_STN_ON);
|
||||
overlayBtn.setEnabled(false);
|
||||
compareTmBtn.setEnabled( false );
|
||||
compareSndBtn.setEnabled(false);
|
||||
graphEditBtn.setEnabled(false);
|
||||
dataEditBtn.setEnabled(false);
|
||||
graphModeBtnTurb.setEnabled( false );
|
||||
graphModeBtnIcing.setEnabled( false );
|
||||
interpBtn.setEnabled( false );
|
||||
cfgBtn.setEnabled( false );
|
||||
}
|
||||
else {
|
||||
compareStnIsOn = false;
|
||||
compareStnBtn.setText(COMP_STN_OFF);
|
||||
overlayBtn.setEnabled(true);
|
||||
compareTmBtn.setEnabled( true );
|
||||
compareSndBtn.setEnabled(true);
|
||||
graphEditBtn.setEnabled(true);
|
||||
dataEditBtn.setEnabled(true);
|
||||
graphModeBtnTurb.setEnabled( true );
|
||||
graphModeBtnIcing.setEnabled( true );
|
||||
interpBtn.setEnabled( true );
|
||||
cfgBtn.setEnabled( true );
|
||||
}
|
||||
NsharpResourceHandler rsc = getRscHandler();
|
||||
if(rsc!= null){
|
||||
|
@ -808,7 +848,7 @@ DisposeListener, IPartListener{
|
|||
else{
|
||||
//comparison and overlay is mutual exclusive
|
||||
compareTmBtn.setText(COMP_TM_OFF);
|
||||
if((rscHandler!= null) && (rscHandler.isOverlayIsOn() || rscHandler.isCompareStnIsOn()))
|
||||
if((rscHandler!= null) && (rscHandler.isOverlayIsOn() || rscHandler.isCompareStnIsOn() || rscHandler.isCompareSndIsOn()))
|
||||
compareTmBtn.setEnabled( false );
|
||||
else
|
||||
compareTmBtn.setEnabled( true );
|
||||
|
@ -820,6 +860,7 @@ DisposeListener, IPartListener{
|
|||
|
||||
compareTmIsOn = true;
|
||||
compareTmBtn.setText(COMP_TM_ON);
|
||||
compareSndBtn.setEnabled(false);
|
||||
overlayBtn.setEnabled(false);
|
||||
compareStnBtn.setEnabled( false );
|
||||
graphEditBtn.setEnabled(false);
|
||||
|
@ -827,17 +868,20 @@ DisposeListener, IPartListener{
|
|||
graphModeBtnTurb.setEnabled( false );
|
||||
graphModeBtnIcing.setEnabled( false );
|
||||
interpBtn.setEnabled( false );
|
||||
cfgBtn.setEnabled( false );
|
||||
}
|
||||
else {
|
||||
compareTmIsOn = false;
|
||||
compareTmBtn.setText(COMP_TM_OFF);
|
||||
compareSndBtn.setEnabled(true);
|
||||
overlayBtn.setEnabled(true);
|
||||
compareStnBtn.setEnabled( true );
|
||||
graphEditBtn.setEnabled(true);
|
||||
dataEditBtn.setEnabled(true);
|
||||
graphModeBtnTurb.setEnabled( true );
|
||||
graphModeBtnIcing.setEnabled( true );
|
||||
interpBtn.setEnabled( true );
|
||||
interpBtn.setEnabled( true );
|
||||
cfgBtn.setEnabled( true );
|
||||
}
|
||||
NsharpResourceHandler rsc = getRscHandler();
|
||||
if(rsc!= null){
|
||||
|
@ -847,6 +891,59 @@ DisposeListener, IPartListener{
|
|||
|
||||
}
|
||||
} );
|
||||
// Push buttons for CompBySrc info
|
||||
compareSndBtn = new Button(textModeGp, SWT.PUSH);
|
||||
compareSndBtn.setFont(newFont);
|
||||
if(compareSndIsOn){
|
||||
compareSndBtn.setText(COMP_SND_ON);
|
||||
compareSndBtn.setEnabled( true );
|
||||
}
|
||||
else{
|
||||
//comparison and overlay is mutual exclusive
|
||||
compareSndBtn.setText(COMP_SND_OFF);
|
||||
if((rscHandler!= null) && (rscHandler.isOverlayIsOn() || rscHandler.isCompareStnIsOn() || rscHandler.isCompareTmIsOn()))
|
||||
compareSndBtn.setEnabled( false );
|
||||
else
|
||||
compareSndBtn.setEnabled( true );
|
||||
}
|
||||
compareSndBtn.addListener( SWT.MouseUp, new Listener() {
|
||||
public void handleEvent(Event event) {
|
||||
shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
||||
if(compareSndIsOn == false){
|
||||
compareSndIsOn = true;
|
||||
compareSndBtn.setText(COMP_SND_ON);
|
||||
overlayBtn.setEnabled(false);
|
||||
compareStnBtn.setEnabled( false );
|
||||
compareTmBtn.setEnabled( false );
|
||||
graphEditBtn.setEnabled(false);
|
||||
dataEditBtn.setEnabled(false);
|
||||
graphModeBtnTurb.setEnabled( false );
|
||||
graphModeBtnIcing.setEnabled( false );
|
||||
interpBtn.setEnabled( false );
|
||||
cfgBtn.setEnabled( false );
|
||||
}
|
||||
else {
|
||||
compareSndIsOn = false;
|
||||
compareSndBtn.setText(COMP_SND_OFF);
|
||||
overlayBtn.setEnabled(true);
|
||||
compareStnBtn.setEnabled( true );
|
||||
compareTmBtn.setEnabled( true );
|
||||
graphEditBtn.setEnabled(true);
|
||||
dataEditBtn.setEnabled(true);
|
||||
graphModeBtnTurb.setEnabled( true );
|
||||
graphModeBtnIcing.setEnabled( true );
|
||||
interpBtn.setEnabled( true );
|
||||
cfgBtn.setEnabled( true );
|
||||
}
|
||||
NsharpResourceHandler rsc = getRscHandler();
|
||||
if(rsc!= null){
|
||||
rsc.setCompareSndIsOn(compareSndIsOn);
|
||||
rsc.refreshPane();
|
||||
}
|
||||
|
||||
}
|
||||
} );
|
||||
|
||||
dataEditBtn = new Button(textModeGp, SWT.PUSH);
|
||||
dataEditBtn.setFont(newFont);
|
||||
dataEditBtn.setText(" Edit Data ");
|
||||
|
@ -890,6 +987,7 @@ DisposeListener, IPartListener{
|
|||
dataEditBtn.setEnabled( true );
|
||||
interpBtn.setEnabled( true );
|
||||
compareTmBtn.setEnabled( true );
|
||||
compareSndBtn.setEnabled( true );
|
||||
compareStnBtn.setEnabled( true );
|
||||
overlayBtn.setEnabled( true );
|
||||
}
|
||||
|
@ -901,6 +999,7 @@ DisposeListener, IPartListener{
|
|||
dataEditBtn.setEnabled( false );
|
||||
interpBtn.setEnabled( false );
|
||||
compareTmBtn.setEnabled( false );
|
||||
compareSndBtn.setEnabled( false );
|
||||
compareStnBtn.setEnabled( false );
|
||||
overlayBtn.setEnabled( false );
|
||||
}
|
||||
|
@ -965,6 +1064,7 @@ DisposeListener, IPartListener{
|
|||
graphEditBtn.setEnabled(true);
|
||||
dataEditBtn.setEnabled(true);
|
||||
compareTmBtn.setEnabled( true );
|
||||
compareSndBtn.setEnabled( true );
|
||||
compareStnBtn.setEnabled( true );
|
||||
overlayBtn.setEnabled( true );
|
||||
}
|
||||
|
@ -972,6 +1072,7 @@ DisposeListener, IPartListener{
|
|||
graphEditBtn.setEnabled(false);
|
||||
dataEditBtn.setEnabled(false);
|
||||
compareTmBtn.setEnabled( false );
|
||||
compareSndBtn.setEnabled( false );
|
||||
compareStnBtn.setEnabled( false );
|
||||
overlayBtn.setEnabled( false );
|
||||
}
|
||||
|
@ -998,6 +1099,7 @@ DisposeListener, IPartListener{
|
|||
graphEditBtn.setEnabled(false);
|
||||
dataEditBtn.setEnabled(false);
|
||||
compareTmBtn.setEnabled( false );
|
||||
compareSndBtn.setEnabled( false );
|
||||
compareStnBtn.setEnabled( false );
|
||||
overlayBtn.setEnabled( false );
|
||||
NsharpResourceHandler rsc = getRscHandler();
|
||||
|
@ -1022,6 +1124,7 @@ DisposeListener, IPartListener{
|
|||
graphEditBtn.setEnabled(false);
|
||||
dataEditBtn.setEnabled(false);
|
||||
compareTmBtn.setEnabled( false );
|
||||
compareSndBtn.setEnabled( false );
|
||||
compareStnBtn.setEnabled( false );
|
||||
overlayBtn.setEnabled( false );
|
||||
NsharpResourceHandler rsc = getRscHandler();
|
||||
|
@ -1070,7 +1173,7 @@ DisposeListener, IPartListener{
|
|||
if(rscHandler!= null){
|
||||
restorePaletteWindow(paneConfigurationName, rscHandler.getCurrentGraphMode(),
|
||||
rscHandler.isInterpolateIsOn(), rscHandler.isOverlayIsOn(),
|
||||
rscHandler.isCompareStnIsOn(),rscHandler.isCompareTmIsOn(),rscHandler.isEditGraphOn());
|
||||
rscHandler.isCompareStnIsOn(),rscHandler.isCompareTmIsOn(),rscHandler.isEditGraphOn(),rscHandler.isCompareSndIsOn());
|
||||
}
|
||||
parent.redraw();
|
||||
}
|
||||
|
@ -1294,10 +1397,15 @@ DisposeListener, IPartListener{
|
|||
|
||||
|
||||
}
|
||||
private IContextActivation context;
|
||||
@Override
|
||||
public void partActivated(IWorkbenchPart part) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
if(context==null){
|
||||
IContextService ctxSvc = (IContextService) PlatformUI
|
||||
.getWorkbench().getService(IContextService.class);
|
||||
context = ctxSvc.activateContext("gov.noaa.nws.ncep.ui.nsharp.nsharpContext");
|
||||
//System.out.println("Activated " + context.getContextId());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void partBroughtToTop(IWorkbenchPart part) {
|
||||
|
@ -1309,7 +1417,14 @@ DisposeListener, IPartListener{
|
|||
}
|
||||
@Override
|
||||
public void partDeactivated(IWorkbenchPart part) {
|
||||
// TODO Auto-generated method stub
|
||||
if (context != null) {
|
||||
|
||||
IContextService ctxSvc = (IContextService) PlatformUI
|
||||
.getWorkbench().getService(IContextService.class);
|
||||
ctxSvc.deactivateContext(context);
|
||||
//System.out.println("Deactivated " + context.getContextId());
|
||||
context = null;
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,202 @@
|
|||
package gov.noaa.nws.ncep.ui.nsharp.view;
|
||||
/**
|
||||
*
|
||||
* gov.noaa.nws.ncep.ui.nsharp.palette.NsharpSndConfigDialog
|
||||
*
|
||||
*
|
||||
* This code has been developed by the NCEP-SIB for use in the AWIPS2 system.
|
||||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------- ------- -------- -----------
|
||||
* 04/23/2012 229 Chin Chen Initial coding
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author Chin Chen
|
||||
* @version 1.0
|
||||
*/
|
||||
import gov.noaa.nws.ncep.ui.nsharp.NsharpConstants;
|
||||
import gov.noaa.nws.ncep.ui.nsharp.NsharpOperationElement;
|
||||
import gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor;
|
||||
import gov.noaa.nws.ncep.ui.nsharp.display.rsc.NsharpResourceHandler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.jface.dialogs.Dialog;
|
||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Group;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
import org.eclipse.swt.widgets.MessageBox;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
public class NsharpSndConfigDialog extends Dialog {
|
||||
private static NsharpSndConfigDialog INSTANCE = null;
|
||||
private org.eclipse.swt.widgets.List sndList;
|
||||
private List<String> selectedsndList = new ArrayList<String>();
|
||||
protected Composite top;
|
||||
private MessageBox mb;
|
||||
protected NsharpSndConfigDialog(Shell parentShell) {
|
||||
super(parentShell);
|
||||
mb = new MessageBox(parentShell, SWT.ICON_WARNING
|
||||
| SWT.OK );
|
||||
mb.setMessage( "Current sounding type can't be deactivated!");
|
||||
}
|
||||
public static NsharpSndConfigDialog getInstance( Shell parShell){
|
||||
|
||||
if ( INSTANCE == null ){
|
||||
INSTANCE = new NsharpSndConfigDialog( parShell );
|
||||
|
||||
}
|
||||
return INSTANCE;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int open() {
|
||||
return super.open();
|
||||
}
|
||||
@Override
|
||||
public boolean close() {
|
||||
|
||||
if(sndList!=null){
|
||||
sndList.removeListener(SWT.Selection, sndList.getListeners(SWT.Selection)[0]);
|
||||
sndList.dispose();
|
||||
sndList = null;
|
||||
}
|
||||
if(selectedsndList!= null){
|
||||
selectedsndList.clear();
|
||||
selectedsndList = null;
|
||||
}
|
||||
INSTANCE = null;
|
||||
return super.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configureShell( Shell shell ) {
|
||||
super.configureShell( shell );
|
||||
shell.setText( "Sounding Configuration" );
|
||||
}
|
||||
@Override
|
||||
protected void createButtonsForButtonBar(Composite parent) {
|
||||
createButton(parent, IDialogConstants.CANCEL_ID,
|
||||
IDialogConstants.CANCEL_LABEL, false);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Control createDialogArea(Composite parent) {
|
||||
top = (Composite) super.createDialogArea(parent);
|
||||
|
||||
// Create the main layout for the shell.
|
||||
GridLayout mainLayout = new GridLayout(1, false);
|
||||
mainLayout.marginHeight = 3;
|
||||
mainLayout.marginWidth = 3;
|
||||
|
||||
top.setLayout(mainLayout);
|
||||
|
||||
// Initialize all of the menus, controls, and layouts
|
||||
createDiaContents(top);
|
||||
|
||||
return top;
|
||||
}
|
||||
|
||||
|
||||
private void createDiaContents(Composite parent) {
|
||||
//create file widget list
|
||||
Group sndListGp = new Group(parent,SWT.SHADOW_ETCHED_IN);
|
||||
sndList = new org.eclipse.swt.widgets.List(sndListGp, SWT.BORDER | SWT.MULTI| SWT.V_SCROLL );
|
||||
sndList.setBounds(0,0, 2*NsharpConstants.listWidth, NsharpConstants.listHeight * 8);
|
||||
createsndList();
|
||||
//create a selection listener to handle user's selection on list
|
||||
sndList.addListener ( SWT.Selection, new Listener () {
|
||||
private String selectedSndType=null;
|
||||
public void handleEvent (Event e) {
|
||||
if (sndList.getSelectionCount() > 0 ) {
|
||||
selectedsndList.clear();
|
||||
for(int i=0; i < sndList.getSelectionCount(); i++) {
|
||||
selectedSndType = sndList.getSelection()[i];
|
||||
if(selectedSndType.contains("Active-Current") == true){
|
||||
sndList.deselect(sndList.indexOf(selectedSndType));
|
||||
mb.open();
|
||||
break;
|
||||
}
|
||||
//remove "--InActive" or "--Active" from string
|
||||
selectedSndType= selectedSndType.substring(0, selectedSndType.indexOf('-'));
|
||||
selectedsndList.add(selectedSndType);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Group buttonGp = new Group(parent,SWT.SHADOW_OUT);
|
||||
buttonGp.setLayout( new GridLayout(2, false) );
|
||||
|
||||
Button activateBtn = new Button(buttonGp, SWT.PUSH);
|
||||
activateBtn.setText("Activate");
|
||||
activateBtn.setEnabled( true );
|
||||
activateBtn.addListener( SWT.MouseUp, new Listener() {
|
||||
public void handleEvent(Event event) {
|
||||
NsharpResourceHandler rsc = NsharpEditor.getActiveNsharpEditor().getRscHandler();
|
||||
rsc.handleSndTypeActConfig(selectedsndList, NsharpConstants.ActState.ACTIVE);
|
||||
selectedsndList.clear();
|
||||
close();
|
||||
}
|
||||
|
||||
} );
|
||||
Button deactivateBtn = new Button(buttonGp, SWT.PUSH);
|
||||
deactivateBtn.setText("DeActivate");
|
||||
deactivateBtn.setEnabled( true );
|
||||
deactivateBtn.addListener( SWT.MouseUp, new Listener() {
|
||||
public void handleEvent(Event event) {
|
||||
//System.out.println("Unload Selected");
|
||||
NsharpResourceHandler rsc = NsharpEditor.getActiveNsharpEditor().getRscHandler();
|
||||
rsc.handleSndTypeActConfig(selectedsndList, NsharpConstants.ActState.INACTIVE);
|
||||
selectedsndList.clear();
|
||||
close();
|
||||
}
|
||||
} );
|
||||
}
|
||||
private boolean checkLoadedRsc() {
|
||||
NsharpEditor editor = NsharpEditor.getActiveNsharpEditor();
|
||||
if (editor == null) {
|
||||
return false;
|
||||
}
|
||||
NsharpResourceHandler rsc = editor.getRscHandler();
|
||||
if (rsc == null) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private void createsndList(){
|
||||
if(checkLoadedRsc()== false)
|
||||
return;
|
||||
//after checking, rsc is not null guaranteed.
|
||||
NsharpResourceHandler rsc = NsharpEditor.getActiveNsharpEditor().getRscHandler();
|
||||
List<NsharpOperationElement> sndTypeList = rsc.getSndElementList();
|
||||
int curStnIndex = rsc.getCurrentSndElementListIndex();
|
||||
for(NsharpOperationElement snd: sndTypeList){
|
||||
String s;
|
||||
if(snd.getActionState() == NsharpConstants.ActState.INACTIVE)
|
||||
s = "--(InActive)";
|
||||
else{
|
||||
if(sndTypeList.indexOf(snd)== curStnIndex)
|
||||
s="--(Active-Current)";
|
||||
else
|
||||
s="--(Active)";
|
||||
}
|
||||
sndList.add(snd.getElementDescription() +s);
|
||||
}
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue