VLab Issue #4003 - NCEP CAVE Plugins delivery for 14.2.1-n
Many configuration changes. Fixes for various display resources Change-Id: I590a5c3770372ea234d693bbf53748793c7a4c47 Former-commit-id:7c15e79189
[formerly1a675e7e3f
[formerly c23c487d0bdf5b0105e1fe297caee2406fcc2ed8]] Former-commit-id:1a675e7e3f
Former-commit-id:a232ad326d
This commit is contained in:
parent
8e79558516
commit
90e2c8b4f8
66 changed files with 7365 additions and 5885 deletions
File diff suppressed because it is too large
Load diff
|
@ -15,6 +15,7 @@
|
||||||
* a NCMapEditor object as one of the arguments
|
* a NCMapEditor object as one of the arguments
|
||||||
* Removed the call to setNcEditor()
|
* Removed the call to setNcEditor()
|
||||||
* 08/17/2012 T655 B. Hebbard Added paintProps as parameter to IDisplayable draw (2)
|
* 08/17/2012 T655 B. Hebbard Added paintProps as parameter to IDisplayable draw (2)
|
||||||
|
* 07/10/2014 Chin Chen added NcText new Admin Message Group
|
||||||
*/
|
*/
|
||||||
package gov.noaa.nws.ncep.ui.nctextui.rsc;
|
package gov.noaa.nws.ncep.ui.nctextui.rsc;
|
||||||
|
|
||||||
|
@ -63,7 +64,7 @@ public class NctextuiResource extends
|
||||||
|
|
||||||
private static NctextuiResource nctextuiResource = null;
|
private static NctextuiResource nctextuiResource = null;
|
||||||
|
|
||||||
/** The set of symbols with similar attributes across many locations */
|
/** The set of symbols with similar attributes across many locations */
|
||||||
private SymbolLocationSet symbolSet = null;
|
private SymbolLocationSet symbolSet = null;
|
||||||
|
|
||||||
private SymbolLocationSet pickedSymbolSet = null;
|
private SymbolLocationSet pickedSymbolSet = null;
|
||||||
|
@ -71,55 +72,55 @@ public class NctextuiResource extends
|
||||||
private static NatlCntrsEditor mapEditor = null;
|
private static NatlCntrsEditor mapEditor = null;
|
||||||
|
|
||||||
// private static int mapEditorNum=0;
|
// private static int mapEditorNum=0;
|
||||||
private static NctextuiMouseHandler mouseHandler;
|
private static NctextuiMouseHandler mouseHandler;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* public static NCMapEditor getOrCreateMapEditor() { if(mapEditor== null)
|
* public static NCMapEditor getOrCreateMapEditor() { if(mapEditor== null)
|
||||||
* createMapEditor(); return mapEditor; }
|
* createMapEditor(); return mapEditor; }
|
||||||
*/
|
*/
|
||||||
public static NatlCntrsEditor getMapEditor() {
|
public static NatlCntrsEditor getMapEditor() {
|
||||||
|
|
||||||
return mapEditor;
|
return mapEditor;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<NctextStationInfo> points = new ArrayList<NctextStationInfo>();
|
private List<NctextStationInfo> points = new ArrayList<NctextStationInfo>();
|
||||||
|
|
||||||
private List<NctextStationInfo> pickedStnPt = new ArrayList<NctextStationInfo>();
|
private List<NctextStationInfo> pickedStnPt = new ArrayList<NctextStationInfo>();
|
||||||
|
|
||||||
public List<NctextStationInfo> getPickedStnPt() {
|
|
||||||
return pickedStnPt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPickedStnPt(List<NctextStationInfo> pickedStnPt) {
|
public List<NctextStationInfo> getPickedStnPt() {
|
||||||
if (pickedStnPt == null)
|
return pickedStnPt;
|
||||||
this.pickedStnPt.clear();
|
}
|
||||||
else
|
|
||||||
this.pickedStnPt = pickedStnPt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<NctextStationInfo> getPoints() {
|
public void setPickedStnPt(List<NctextStationInfo> pickedStnPt) {
|
||||||
return points;
|
if (pickedStnPt == null)
|
||||||
}
|
this.pickedStnPt.clear();
|
||||||
|
else
|
||||||
|
this.pickedStnPt = pickedStnPt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<NctextStationInfo> getPoints() {
|
||||||
|
return points;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPoints(List<NctextStationInfo> points) {
|
||||||
|
if (points == null)
|
||||||
|
this.points.clear();
|
||||||
|
else
|
||||||
|
this.points = points;
|
||||||
|
}
|
||||||
|
|
||||||
public void setPoints(List<NctextStationInfo> points) {
|
|
||||||
if (points == null)
|
|
||||||
this.points.clear();
|
|
||||||
else
|
|
||||||
this.points = points;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void createMapEditor() {
|
private static void createMapEditor() {
|
||||||
// create an editor MapEditor
|
// create an editor MapEditor
|
||||||
if (mapEditor != null)
|
if (mapEditor != null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// TODO: what if the active editor is not a Map Editor ?
|
// TODO: what if the active editor is not a Map Editor ?
|
||||||
// should we find one, create one or prompt
|
// should we find one, create one or prompt
|
||||||
//
|
//
|
||||||
AbstractEditor ed = NcDisplayMngr.getActiveNatlCntrsEditor();
|
AbstractEditor ed = NcDisplayMngr.getActiveNatlCntrsEditor();
|
||||||
|
|
||||||
if (NcEditorUtil.getNcDisplayType(ed) == NcDisplayType.NMAP_DISPLAY) {
|
if (NcEditorUtil.getNcDisplayType(ed) == NcDisplayType.NMAP_DISPLAY) {
|
||||||
mapEditor = (NatlCntrsEditor) ed;
|
mapEditor = (NatlCntrsEditor) ed;
|
||||||
} else {
|
} else {
|
||||||
|
@ -127,33 +128,33 @@ public class NctextuiResource extends
|
||||||
.createNatlCntrsEditor(NcDisplayType.NMAP_DISPLAY,
|
.createNatlCntrsEditor(NcDisplayType.NMAP_DISPLAY,
|
||||||
"Select NCTEXT Data");
|
"Select NCTEXT Data");
|
||||||
|
|
||||||
// get this to set the editor to 'NCTEXT'
|
// get this to set the editor to 'NCTEXT'
|
||||||
ResourceBndlLoader rbdLoader = new ResourceBndlLoader("NCTEXT");
|
ResourceBndlLoader rbdLoader = new ResourceBndlLoader("NCTEXT");
|
||||||
rbdLoader.addDefaultRBD(NcDisplayType.NMAP_DISPLAY, mapEditor);
|
rbdLoader.addDefaultRBD(NcDisplayType.NMAP_DISPLAY, mapEditor);
|
||||||
VizApp.runSync(rbdLoader);
|
VizApp.runSync(rbdLoader);
|
||||||
}
|
}
|
||||||
// register mouse handler
|
// register mouse handler
|
||||||
mouseHandler = getMouseHandler();
|
mouseHandler = getMouseHandler();
|
||||||
mapEditor.registerMouseHandler((IInputHandler) mouseHandler);
|
mapEditor.registerMouseHandler((IInputHandler) mouseHandler);
|
||||||
// System.out.println("NctextuiPaletteWindow create editor "+
|
// System.out.println("NctextuiPaletteWindow create editor "+
|
||||||
// mapEditor.toString());
|
// mapEditor.toString());
|
||||||
} catch (Exception ve) {
|
} catch (Exception ve) {
|
||||||
System.out.println("Could not load initial editor: "
|
System.out.println("Could not load initial editor: "
|
||||||
+ ve.getMessage());
|
+ ve.getMessage());
|
||||||
ve.printStackTrace();
|
ve.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static NctextuiResource getNctextuiResource() {
|
public static NctextuiResource getNctextuiResource() {
|
||||||
if (nctextuiResource == null) {
|
if (nctextuiResource == null) {
|
||||||
if (mapEditor == null)
|
if (mapEditor == null)
|
||||||
createMapEditor();
|
createMapEditor();
|
||||||
// nctextuiResource = createNewResource(mapEditor);
|
// nctextuiResource = createNewResource(mapEditor);
|
||||||
if (mapEditor != null) {
|
if (mapEditor != null) {
|
||||||
IMapDescriptor desc = (IMapDescriptor) mapEditor
|
IMapDescriptor desc = (IMapDescriptor) mapEditor
|
||||||
.getActiveDisplayPane().getRenderableDisplay()
|
.getActiveDisplayPane().getRenderableDisplay()
|
||||||
.getDescriptor();
|
.getDescriptor();
|
||||||
try {
|
try {
|
||||||
if (nctextuiResourceData == null)
|
if (nctextuiResourceData == null)
|
||||||
nctextuiResourceData = new NctextuiResourceData();
|
nctextuiResourceData = new NctextuiResourceData();
|
||||||
nctextuiResource = nctextuiResourceData.construct(
|
nctextuiResource = nctextuiResourceData.construct(
|
||||||
|
@ -161,35 +162,35 @@ public class NctextuiResource extends
|
||||||
desc.getResourceList().add(nctextuiResource);
|
desc.getResourceList().add(nctextuiResource);
|
||||||
nctextuiResource.init(mapEditor.getActiveDisplayPane()
|
nctextuiResource.init(mapEditor.getActiveDisplayPane()
|
||||||
.getTarget());
|
.getTarget());
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nctextuiResource;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Default constructor
|
|
||||||
*/
|
|
||||||
protected NctextuiResource(NctextuiResourceData resourceData,
|
|
||||||
LoadProperties loadProperties) {
|
|
||||||
super(resourceData, loadProperties);
|
|
||||||
getCapability(EditableCapability.class).setEditable(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
} catch (Exception e) {
|
||||||
* Called when resource is disposed
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nctextuiResource;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default constructor
|
||||||
|
*/
|
||||||
|
protected NctextuiResource(NctextuiResourceData resourceData,
|
||||||
|
LoadProperties loadProperties) {
|
||||||
|
super(resourceData, loadProperties);
|
||||||
|
getCapability(EditableCapability.class).setEditable(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when resource is disposed
|
||||||
*
|
*
|
||||||
* @see com.raytheon.viz.core.rsc.IVizResource#dispose()
|
* @see com.raytheon.viz.core.rsc.IVizResource#dispose()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void disposeInternal() {
|
public void disposeInternal() {
|
||||||
// System.out.println("NctextuiResource:disposeInternal");
|
// System.out.println("NctextuiResource:disposeInternal");
|
||||||
if (mapEditor != null) {
|
if (mapEditor != null) {
|
||||||
mapEditor.unregisterMouseHandler(mouseHandler);
|
mapEditor.unregisterMouseHandler(mouseHandler);
|
||||||
mouseHandler = null;
|
mouseHandler = null;
|
||||||
// close editor
|
// close editor
|
||||||
// if((PlatformUI.getWorkbench()!=
|
// if((PlatformUI.getWorkbench()!=
|
||||||
// null)&&(PlatformUI.getWorkbench().getActiveWorkbenchWindow()!=
|
// null)&&(PlatformUI.getWorkbench().getActiveWorkbenchWindow()!=
|
||||||
|
@ -201,36 +202,36 @@ public class NctextuiResource extends
|
||||||
// PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeEditor(mapEditor,
|
// PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeEditor(mapEditor,
|
||||||
// false);
|
// false);
|
||||||
// }
|
// }
|
||||||
mapEditor = null;
|
mapEditor = null;
|
||||||
// mapEditorNum=0;
|
// mapEditorNum=0;
|
||||||
}
|
}
|
||||||
closeTextView();
|
closeTextView();
|
||||||
nctextuiResource = null;
|
nctextuiResource = null;
|
||||||
nctextuiResourceData = null;
|
nctextuiResourceData = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerMouseHandler() {
|
public static void registerMouseHandler() {
|
||||||
mouseHandler = getMouseHandler();
|
mouseHandler = getMouseHandler();
|
||||||
if (mapEditor != null && mouseHandler != null)
|
if (mapEditor != null && mouseHandler != null)
|
||||||
mapEditor.registerMouseHandler((IInputHandler) mouseHandler);
|
mapEditor.registerMouseHandler((IInputHandler) mouseHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void unregisterMouseHandler() {
|
public static void unregisterMouseHandler() {
|
||||||
mouseHandler = getMouseHandler();
|
mouseHandler = getMouseHandler();
|
||||||
if (mapEditor != null && mouseHandler != null)
|
if (mapEditor != null && mouseHandler != null)
|
||||||
mapEditor.unregisterMouseHandler((IInputHandler) mouseHandler);
|
mapEditor.unregisterMouseHandler((IInputHandler) mouseHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void propertiesChanged(ResourceProperties updatedProps) {
|
public void propertiesChanged(ResourceProperties updatedProps) {
|
||||||
// System.out.println("NctextuiResource:propertiesChanged");
|
// System.out.println("NctextuiResource:propertiesChanged");
|
||||||
if (updatedProps.isVisible()) {
|
if (updatedProps.isVisible()) {
|
||||||
reopenTextView();
|
reopenTextView();
|
||||||
} else {
|
} else {
|
||||||
hideTextView();
|
hideTextView();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void hideTextView() {
|
private void hideTextView() {
|
||||||
IWorkbenchPage wpage = PlatformUI.getWorkbench()
|
IWorkbenchPage wpage = PlatformUI.getWorkbench()
|
||||||
.getActiveWorkbenchWindow().getActivePage();
|
.getActiveWorkbenchWindow().getActivePage();
|
||||||
|
@ -239,10 +240,10 @@ public class NctextuiResource extends
|
||||||
if (wpage.isPartVisible(vpart)) {
|
if (wpage.isPartVisible(vpart)) {
|
||||||
NctextuiPaletteWindow paletteWin = NctextuiPaletteWindow
|
NctextuiPaletteWindow paletteWin = NctextuiPaletteWindow
|
||||||
.getAccess();
|
.getAccess();
|
||||||
paletteWin.setEditorVisible(false);
|
paletteWin.setEditorVisible(false);
|
||||||
wpage.hideView(vpart);
|
wpage.hideView(vpart);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void closeTextView() {
|
private void closeTextView() {
|
||||||
// System.out.println("NctextuiResource:closeTextView");
|
// System.out.println("NctextuiResource:closeTextView");
|
||||||
|
@ -253,12 +254,12 @@ public class NctextuiResource extends
|
||||||
IWorkbenchPage wpage = win.getActivePage();
|
IWorkbenchPage wpage = win.getActivePage();
|
||||||
if (wpage != null) {
|
if (wpage != null) {
|
||||||
IViewPart vpart = wpage.findView("gov.noaa.nws.ncep.ui.NCTEXTUI");
|
IViewPart vpart = wpage.findView("gov.noaa.nws.ncep.ui.NCTEXTUI");
|
||||||
wpage.hideView(vpart);
|
wpage.hideView(vpart);
|
||||||
}
|
}
|
||||||
|
|
||||||
NcDisplayMngr.setPanningMode();
|
NcDisplayMngr.setPanningMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void reopenTextView() {
|
private void reopenTextView() {
|
||||||
// System.out.println("NctextuiResource:reopenTextView");
|
// System.out.println("NctextuiResource:reopenTextView");
|
||||||
IWorkbenchPage wpage = PlatformUI.getWorkbench()
|
IWorkbenchPage wpage = PlatformUI.getWorkbench()
|
||||||
|
@ -268,54 +269,54 @@ public class NctextuiResource extends
|
||||||
if (!wpage.isPartVisible(vpart)) {
|
if (!wpage.isPartVisible(vpart)) {
|
||||||
NctextuiPaletteWindow paletteWin = NctextuiPaletteWindow
|
NctextuiPaletteWindow paletteWin = NctextuiPaletteWindow
|
||||||
.getAccess();
|
.getAccess();
|
||||||
paletteWin.setEditorVisible(true);
|
paletteWin.setEditorVisible(true);
|
||||||
try {
|
try {
|
||||||
vpart = wpage.showView("gov.noaa.nws.ncep.ui.NCTEXTUI");
|
vpart = wpage.showView("gov.noaa.nws.ncep.ui.NCTEXTUI");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see
|
* @see
|
||||||
* com.raytheon.viz.core.rsc.IVizResource#getCoordinateReferenceSystem()
|
* com.raytheon.viz.core.rsc.IVizResource#getCoordinateReferenceSystem()
|
||||||
*/
|
*/
|
||||||
public CoordinateReferenceSystem getCoordinateReferenceSystem() {
|
public CoordinateReferenceSystem getCoordinateReferenceSystem() {
|
||||||
|
|
||||||
if (descriptor == null)
|
if (descriptor == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return descriptor.getCRS();
|
return descriptor.getCRS();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see com.raytheon.viz.core.rsc.IVizResource#getName()
|
* @see com.raytheon.viz.core.rsc.IVizResource#getName()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
|
||||||
return "NCText";
|
return "NCText";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see com.raytheon.viz.core.rsc.IVizResource#init(com.raytheon.viz.core.
|
* @see com.raytheon.viz.core.rsc.IVizResource#init(com.raytheon.viz.core.
|
||||||
* IGraphicsTarget)
|
* IGraphicsTarget)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void initInternal(IGraphicsTarget target) throws VizException {
|
public void initInternal(IGraphicsTarget target) throws VizException {
|
||||||
// System.out.println("NctextuiResource:initInternal");
|
// System.out.println("NctextuiResource:initInternal");
|
||||||
EditableManager.makeEditable(this,
|
EditableManager.makeEditable(this,
|
||||||
getCapability(EditableCapability.class).isEditable());
|
getCapability(EditableCapability.class).isEditable());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
|
@ -323,38 +324,38 @@ public class NctextuiResource extends
|
||||||
* @see
|
* @see
|
||||||
* com.raytheon.viz.core.rsc.IVizResource#isApplicable(com.raytheon.viz.
|
* com.raytheon.viz.core.rsc.IVizResource#isApplicable(com.raytheon.viz.
|
||||||
* core.PixelExtent)
|
* core.PixelExtent)
|
||||||
*/
|
*/
|
||||||
public boolean isApplicable(PixelExtent extent) {
|
public boolean isApplicable(PixelExtent extent) {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void generateSymbolForDrawing() {
|
private void generateSymbolForDrawing() {
|
||||||
String type;
|
String type;
|
||||||
float lineWidth = resourceData.getMarkerWidth();
|
float lineWidth = resourceData.getMarkerWidth();
|
||||||
Boolean clear = false;
|
Boolean clear = false;
|
||||||
;
|
;
|
||||||
String category = new String("Marker");
|
String category = new String("Marker");
|
||||||
double sizeScale = resourceData.getMarkerSize();
|
double sizeScale = resourceData.getMarkerSize();
|
||||||
// NctextuiPaletteWindow nctextuiPaletteWindow =
|
// NctextuiPaletteWindow nctextuiPaletteWindow =
|
||||||
// NctextuiPaletteWindow.getAccess();
|
// NctextuiPaletteWindow.getAccess();
|
||||||
if (points.isEmpty() == true) {
|
if (points.isEmpty() == true) {
|
||||||
symbolSet = null;
|
symbolSet = null;
|
||||||
} else {
|
} else {
|
||||||
// SymbolLocationSet constructor requires a positive-length array of
|
// SymbolLocationSet constructor requires a positive-length array of
|
||||||
// Coordinate
|
// Coordinate
|
||||||
Coordinate[] locations = new Coordinate[points.size()];
|
Coordinate[] locations = new Coordinate[points.size()];
|
||||||
|
|
||||||
// System.out.println( "generateSymbolSet: size ="+ points.size());
|
// System.out.println( "generateSymbolSet: size ="+ points.size());
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (NctextStationInfo p : points) {
|
for (NctextStationInfo p : points) {
|
||||||
double lon, lat;
|
double lon, lat;
|
||||||
lon = p.getLongitude();
|
lon = p.getLongitude();
|
||||||
lat = p.getLatitude();
|
lat = p.getLatitude();
|
||||||
locations[i++] = new Coordinate(lon, lat);
|
locations[i++] = new Coordinate(lon, lat);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Color[] colors = new Color[] { new Color(
|
Color[] colors = new Color[] { new Color(
|
||||||
resourceData.getColor().red, resourceData.getColor().green,
|
resourceData.getColor().red, resourceData.getColor().green,
|
||||||
|
@ -363,37 +364,37 @@ public class NctextuiResource extends
|
||||||
// System.out.println( "generateSymbolSet done size ="+ i);
|
// System.out.println( "generateSymbolSet done size ="+ i);
|
||||||
symbolSet = new SymbolLocationSet(null, colors, lineWidth,
|
symbolSet = new SymbolLocationSet(null, colors, lineWidth,
|
||||||
sizeScale, clear, locations, category, type);
|
sizeScale, clear, locations, category, type);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (pickedStnPt.isEmpty() == true) {
|
if (pickedStnPt.isEmpty() == true) {
|
||||||
pickedSymbolSet = null;
|
pickedSymbolSet = null;
|
||||||
} else {
|
} else {
|
||||||
// SymbolLocationSet constructor requires a positive-length array of
|
// SymbolLocationSet constructor requires a positive-length array of
|
||||||
// Coordinate
|
// Coordinate
|
||||||
Coordinate[] locations = new Coordinate[pickedStnPt.size()];
|
Coordinate[] locations = new Coordinate[pickedStnPt.size()];
|
||||||
|
|
||||||
// System.out.println( "generatePickedSymbolSet: size ="+
|
// System.out.println( "generatePickedSymbolSet: size ="+
|
||||||
// pickedStnPt.size());
|
// pickedStnPt.size());
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (NctextStationInfo p : pickedStnPt) {
|
for (NctextStationInfo p : pickedStnPt) {
|
||||||
double lon, lat;
|
double lon, lat;
|
||||||
lon = p.getLongitude();
|
lon = p.getLongitude();
|
||||||
lat = p.getLatitude();
|
lat = p.getLatitude();
|
||||||
locations[i++] = new Coordinate(lon, lat);
|
locations[i++] = new Coordinate(lon, lat);
|
||||||
}
|
}
|
||||||
|
|
||||||
Color[] colors = new Color[] { new Color(
|
Color[] colors = new Color[] { new Color(
|
||||||
resourceData.getPkStncolor().red,
|
resourceData.getPkStncolor().red,
|
||||||
resourceData.getPkStncolor().green,
|
resourceData.getPkStncolor().green,
|
||||||
resourceData.getPkStncolor().blue) };
|
resourceData.getPkStncolor().blue) };
|
||||||
type = resourceData.getPkStnmarkerType().toString();
|
type = resourceData.getPkStnmarkerType().toString();
|
||||||
|
|
||||||
pickedSymbolSet = new SymbolLocationSet(null, colors, lineWidth,
|
pickedSymbolSet = new SymbolLocationSet(null, colors, lineWidth,
|
||||||
sizeScale, clear, locations, category, type);
|
sizeScale, clear, locations, category, type);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
|
@ -401,53 +402,53 @@ public class NctextuiResource extends
|
||||||
* @see
|
* @see
|
||||||
* com.raytheon.viz.core.drawables.IRenderable#paint(com.raytheon.viz.core
|
* com.raytheon.viz.core.drawables.IRenderable#paint(com.raytheon.viz.core
|
||||||
* .IGraphicsTarget, com.raytheon.viz.core.drawables.PaintProperties)
|
* .IGraphicsTarget, com.raytheon.viz.core.drawables.PaintProperties)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void paintInternal(IGraphicsTarget target, PaintProperties paintProps)
|
public void paintInternal(IGraphicsTarget target, PaintProperties paintProps)
|
||||||
throws VizException {
|
throws VizException {
|
||||||
// System.out.println("paintInternal called!");
|
// System.out.println("paintInternal called!");
|
||||||
IFont font = target.initializeFont("Monospace",
|
IFont font = target.initializeFont("Monospace",
|
||||||
(float) (12 * resourceData.getMarkerTextSize()
|
(float) (12 * resourceData.getMarkerTextSize()
|
||||||
.getSoftwareSize()), null);
|
.getSoftwareSize()), null);
|
||||||
|
|
||||||
generateSymbolForDrawing();
|
generateSymbolForDrawing();
|
||||||
|
|
||||||
if (symbolSet != null) {
|
if (symbolSet != null) {
|
||||||
|
|
||||||
DisplayElementFactory df = new DisplayElementFactory(target,
|
DisplayElementFactory df = new DisplayElementFactory(target,
|
||||||
this.descriptor);
|
this.descriptor);
|
||||||
ArrayList<IDisplayable> elements = df.createDisplayElements(
|
ArrayList<IDisplayable> elements = df.createDisplayElements(
|
||||||
symbolSet, paintProps);
|
symbolSet, paintProps);
|
||||||
for (IDisplayable each : elements) {
|
for (IDisplayable each : elements) {
|
||||||
try {
|
try {
|
||||||
each.draw(target, paintProps);
|
each.draw(target, paintProps);
|
||||||
each.dispose();
|
each.dispose();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
||||||
// e.printStackTrace();
|
e.printStackTrace();
|
||||||
// System.out.println("paintInternal caught draw exception!");
|
// System.out.println("paintInternal caught draw exception!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pickedSymbolSet != null) {
|
if (pickedSymbolSet != null) {
|
||||||
|
|
||||||
DisplayElementFactory df = new DisplayElementFactory(target,
|
DisplayElementFactory df = new DisplayElementFactory(target,
|
||||||
this.descriptor);
|
this.descriptor);
|
||||||
ArrayList<IDisplayable> elements = df.createDisplayElements(
|
ArrayList<IDisplayable> elements = df.createDisplayElements(
|
||||||
pickedSymbolSet, paintProps);
|
pickedSymbolSet, paintProps);
|
||||||
for (IDisplayable each : elements) {
|
for (IDisplayable each : elements) {
|
||||||
try {
|
try {
|
||||||
each.draw(target, paintProps);
|
each.draw(target, paintProps);
|
||||||
each.dispose();
|
each.dispose();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
||||||
// e.printStackTrace();
|
// e.printStackTrace();
|
||||||
// System.out.println("paintInternal caught draw exception on pickedSymbolSet!");
|
// System.out.println("paintInternal caught draw exception on pickedSymbolSet!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
font.dispose();
|
font.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
|
@ -455,12 +456,12 @@ public class NctextuiResource extends
|
||||||
* @see
|
* @see
|
||||||
* com.raytheon.viz.core.rsc.capabilities.IProjectableResource#isProjectable
|
* com.raytheon.viz.core.rsc.capabilities.IProjectableResource#isProjectable
|
||||||
* (org.opengis.referencing.crs.CoordinateReferenceSystem)
|
* (org.opengis.referencing.crs.CoordinateReferenceSystem)
|
||||||
*/
|
*/
|
||||||
public boolean isProjectable(CoordinateReferenceSystem mapData) {
|
public boolean isProjectable(CoordinateReferenceSystem mapData) {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
|
@ -468,22 +469,22 @@ public class NctextuiResource extends
|
||||||
* @see
|
* @see
|
||||||
* com.raytheon.viz.core.rsc.capabilities.IProjectableResource#project(org
|
* com.raytheon.viz.core.rsc.capabilities.IProjectableResource#project(org
|
||||||
* .opengis.referencing.crs.CoordinateReferenceSystem)
|
* .opengis.referencing.crs.CoordinateReferenceSystem)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void project(CoordinateReferenceSystem mapData) throws VizException {
|
public void project(CoordinateReferenceSystem mapData) throws VizException {
|
||||||
// System.out.println("NctextuiResource: project ");
|
// System.out.println("NctextuiResource: project ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static NctextuiMouseHandler getMouseHandler() {
|
||||||
|
|
||||||
private static NctextuiMouseHandler getMouseHandler() {
|
|
||||||
|
|
||||||
if (mouseHandler == null) {
|
if (mouseHandler == null) {
|
||||||
|
|
||||||
mouseHandler = new NctextuiMouseHandler();
|
mouseHandler = new NctextuiMouseHandler();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return mouseHandler;
|
return mouseHandler;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------- ------- -------- -----------
|
* ------- ------- -------- -----------
|
||||||
* 04/26/2011 229 Chin Chen Initial coding
|
* 04/26/2011 229 Chin Chen Initial coding
|
||||||
|
* 07/16/2014 TTR828 Chin Chen swapped wind direction and wind speed lines at edit dialog
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -19,13 +20,13 @@
|
||||||
*/
|
*/
|
||||||
package gov.noaa.nws.ncep.ui.nsharp.view;
|
package gov.noaa.nws.ncep.ui.nsharp.view;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingLayer;
|
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingLayer;
|
||||||
import gov.noaa.nws.ncep.ui.nsharp.NsharpConstants;
|
import gov.noaa.nws.ncep.ui.nsharp.NsharpConstants;
|
||||||
import gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor;
|
import gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor;
|
||||||
import gov.noaa.nws.ncep.ui.nsharp.display.rsc.NsharpResourceHandler;
|
import gov.noaa.nws.ncep.ui.nsharp.display.rsc.NsharpResourceHandler;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.jface.dialogs.Dialog;
|
import org.eclipse.jface.dialogs.Dialog;
|
||||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||||
import org.eclipse.jface.window.IShellProvider;
|
import org.eclipse.jface.window.IShellProvider;
|
||||||
|
@ -48,445 +49,465 @@ import org.eclipse.swt.widgets.Text;
|
||||||
import org.eclipse.ui.PlatformUI;
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
|
||||||
public class NsharpEditDataDialog extends Dialog {
|
public class NsharpEditDataDialog extends Dialog {
|
||||||
//private NcepLogger logger = NcepLoggerManager.getNcepCaveLogger(this.getClass());
|
// private NcepLogger logger =
|
||||||
private List<NcSoundingLayer> curSoundingLayerList;
|
// NcepLoggerManager.getNcepCaveLogger(this.getClass());
|
||||||
private Text curTempText, newTempText, curDewText, newDewText, curWSpText, newWSpText, curWDirText, newWDirText,
|
private List<NcSoundingLayer> curSoundingLayerList;
|
||||||
curPressText, newPressText;//curHeightText, newHeightText;
|
|
||||||
private static NsharpEditDataDialog thisDialog=null;
|
|
||||||
private org.eclipse.swt.widgets.List pressureList;
|
|
||||||
private String tempStr="",dewStr="", wspStr="", wdirStr="";
|
|
||||||
private org.eclipse.swt.graphics.Color lightGrey = new org.eclipse.swt.graphics.Color(Display.getDefault(), 211,211,211);
|
|
||||||
private enum EditType {
|
|
||||||
SELECTED_LEVEL, NEW_LEVEL
|
|
||||||
}
|
|
||||||
private EditType currentEditType;
|
|
||||||
private int selIndex=-1;
|
|
||||||
|
|
||||||
protected Composite top;
|
|
||||||
public NsharpEditDataDialog(Shell parentShell) {
|
|
||||||
super(parentShell);
|
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
}
|
|
||||||
|
|
||||||
public NsharpEditDataDialog(IShellProvider parentShell) {
|
private Text curTempText, newTempText, curDewText, newDewText, curWSpText,
|
||||||
super(parentShell);
|
newWSpText, curWDirText, newWDirText, curPressText, newPressText;// curHeightText,
|
||||||
// TODO Auto-generated constructor stub
|
// newHeightText;
|
||||||
}
|
|
||||||
|
|
||||||
public static NsharpEditDataDialog getInstance( Shell parShell){
|
private static NsharpEditDataDialog thisDialog = null;
|
||||||
|
|
||||||
if ( thisDialog == null ){
|
private org.eclipse.swt.widgets.List pressureList;
|
||||||
thisDialog = new NsharpEditDataDialog( parShell );
|
|
||||||
//System.out.println("new parcel dialog INSTANCE created");
|
|
||||||
|
|
||||||
}
|
private String tempStr = "", dewStr = "", wspStr = "", wdirStr = "";
|
||||||
else {
|
|
||||||
//System.out.println("current load dialog INSTANCE returned!");
|
|
||||||
}
|
|
||||||
|
|
||||||
return thisDialog;
|
private org.eclipse.swt.graphics.Color lightGrey = new org.eclipse.swt.graphics.Color(
|
||||||
|
Display.getDefault(), 211, 211, 211);
|
||||||
|
|
||||||
}
|
private enum EditType {
|
||||||
|
SELECTED_LEVEL, NEW_LEVEL
|
||||||
private void createDialogContents( Composite parent) {
|
}
|
||||||
top = parent;//(Composite) super.createDialogArea(parent);
|
|
||||||
|
|
||||||
// Create the main layout for the shell.
|
private EditType currentEditType;
|
||||||
GridLayout mainLayout = new GridLayout(1, false);
|
|
||||||
mainLayout.marginHeight = 3;
|
private int selIndex = -1;
|
||||||
mainLayout.marginWidth = 3;
|
|
||||||
top.setLayout(mainLayout);
|
protected Composite top;
|
||||||
|
|
||||||
Group topGp = new Group(top,SWT.SHADOW_OUT);
|
public NsharpEditDataDialog(Shell parentShell) {
|
||||||
topGp.setLayout( new GridLayout(2, false) );
|
super(parentShell);
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
Group pressureListGp = new Group(topGp,SWT.SHADOW_ETCHED_IN);
|
}
|
||||||
pressureListGp.setText("Pressure Level:");
|
|
||||||
pressureList = new org.eclipse.swt.widgets.List(pressureListGp, SWT.BORDER | SWT.V_SCROLL );
|
public NsharpEditDataDialog(IShellProvider parentShell) {
|
||||||
pressureList.setBounds(pressureListGp.getBounds().x,pressureListGp.getBounds().y+ NsharpConstants.labelGap, NsharpConstants.listWidth, NsharpConstants.listHeight );
|
super(parentShell);
|
||||||
NsharpResourceHandler rsc=null;
|
// TODO Auto-generated constructor stub
|
||||||
if(NsharpEditor.getActiveNsharpEditor()!= null)
|
}
|
||||||
rsc = NsharpEditor.getActiveNsharpEditor().getRscHandler();
|
|
||||||
if (rsc != null && rsc.getSoundingLys() !=null) {
|
public static NsharpEditDataDialog getInstance(Shell parShell) {
|
||||||
curSoundingLayerList = rsc.getSoundingLys();
|
|
||||||
for(NcSoundingLayer layer: curSoundingLayerList){
|
if (thisDialog == null) {
|
||||||
pressureList.add(Float.toString(layer.getPressure()));
|
thisDialog = new NsharpEditDataDialog(parShell);
|
||||||
}
|
// System.out.println("new parcel dialog INSTANCE created");
|
||||||
}
|
|
||||||
//create a selection listener to handle user's selection on list
|
} else {
|
||||||
pressureList.addListener ( SWT.Selection, new Listener () {
|
// System.out.println("current load dialog INSTANCE returned!");
|
||||||
public void handleEvent (Event e) {
|
}
|
||||||
selIndex = pressureList.getSelectionIndex();
|
|
||||||
}
|
return thisDialog;
|
||||||
});
|
|
||||||
Group buttonGp = new Group(topGp,SWT.SHADOW_OUT);
|
}
|
||||||
buttonGp.setLayout( new GridLayout(1, false) );
|
|
||||||
buttonGp.setText("Edit Option:");
|
private void createDialogContents(Composite parent) {
|
||||||
Button useSelectedBtn = new Button(buttonGp, SWT.PUSH);
|
top = parent;// (Composite) super.createDialogArea(parent);
|
||||||
useSelectedBtn.setText(" Edit Selected Level ");
|
|
||||||
useSelectedBtn.setEnabled( true );
|
// Create the main layout for the shell.
|
||||||
useSelectedBtn.addListener( SWT.MouseUp, new Listener() {
|
GridLayout mainLayout = new GridLayout(1, false);
|
||||||
public void handleEvent(Event event) {
|
mainLayout.marginHeight = 3;
|
||||||
currentEditType = EditType.SELECTED_LEVEL;
|
mainLayout.marginWidth = 3;
|
||||||
if(selIndex != -1){
|
top.setLayout(mainLayout);
|
||||||
NcSoundingLayer selLevelSounding = curSoundingLayerList.get(selIndex);
|
|
||||||
curTempText.setText( ""+selLevelSounding.getTemperature());
|
Group topGp = new Group(top, SWT.SHADOW_OUT);
|
||||||
curDewText.setText("" + selLevelSounding.getDewpoint());
|
topGp.setLayout(new GridLayout(2, false));
|
||||||
curWSpText.setText("" + selLevelSounding.getWindSpeed());
|
|
||||||
curWDirText.setText("" + selLevelSounding.getWindDirection());
|
Group pressureListGp = new Group(topGp, SWT.SHADOW_ETCHED_IN);
|
||||||
curPressText.setText(""+selLevelSounding.getPressure());
|
pressureListGp.setText("Pressure Level:");
|
||||||
newTempText.setText( ""+selLevelSounding.getTemperature());
|
pressureList = new org.eclipse.swt.widgets.List(pressureListGp,
|
||||||
newDewText.setText("" + selLevelSounding.getDewpoint());
|
SWT.BORDER | SWT.V_SCROLL);
|
||||||
newWSpText.setText("" + selLevelSounding.getWindSpeed());
|
pressureList.setBounds(pressureListGp.getBounds().x,
|
||||||
newWDirText.setText("" + selLevelSounding.getWindDirection());
|
pressureListGp.getBounds().y + NsharpConstants.labelGap,
|
||||||
newPressText.setText(""+selLevelSounding.getPressure());
|
NsharpConstants.listWidth + 40, NsharpConstants.listHeight);
|
||||||
}
|
NsharpResourceHandler rsc = null;
|
||||||
}
|
if (NsharpEditor.getActiveNsharpEditor() != null)
|
||||||
} );
|
rsc = NsharpEditor.getActiveNsharpEditor().getRscHandler();
|
||||||
Button addNewLevelBtn = new Button(buttonGp, SWT.PUSH);
|
if (rsc != null && rsc.getSoundingLys() != null) {
|
||||||
addNewLevelBtn.setText(" Add New Level ");
|
curSoundingLayerList = rsc.getSoundingLys();
|
||||||
addNewLevelBtn.setEnabled( true );
|
for (NcSoundingLayer layer : curSoundingLayerList) {
|
||||||
addNewLevelBtn.addListener( SWT.MouseUp, new Listener() {
|
pressureList.add(Float.toString(layer.getPressure()));
|
||||||
public void handleEvent(Event event) {
|
|
||||||
currentEditType = EditType.NEW_LEVEL;
|
|
||||||
curTempText.setText( " N/A ");
|
|
||||||
curDewText.setText(" N/A " );
|
|
||||||
curWSpText.setText(" N/A " );
|
|
||||||
curWDirText.setText(" N/A ");
|
|
||||||
curPressText.setText(" N/A ");
|
|
||||||
newTempText.setText( "");
|
|
||||||
newDewText.setText("" );
|
|
||||||
newWSpText.setText("");
|
|
||||||
newWDirText.setText("");
|
|
||||||
newPressText.setText("");
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
|
|
||||||
Group top_form = new Group(top,SWT.SHADOW_ETCHED_IN);
|
|
||||||
FormLayout formlayout = new FormLayout() ;
|
|
||||||
formlayout.marginRight = 20;
|
|
||||||
formlayout.marginLeft = 20;
|
|
||||||
top_form.setLayout( formlayout );
|
|
||||||
|
|
||||||
Listener positiveNumberListeener = new Listener() {
|
|
||||||
public void handleEvent(Event e) {
|
|
||||||
String string = e.text;
|
|
||||||
char [] chars = new char [string.length()];
|
|
||||||
string.getChars (0, chars.length, chars, 0);
|
|
||||||
//to make sure user enter digits only
|
|
||||||
for (int i=0; i<chars.length; i++) {
|
|
||||||
if (!('0' <= chars [i] && chars [i] <= '9') && chars [i] != '.' ) {
|
|
||||||
e.doit = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
Listener numberListeener = new Listener() {
|
// create a selection listener to handle user's selection on list
|
||||||
public void handleEvent(Event e) {
|
pressureList.addListener(SWT.Selection, new Listener() {
|
||||||
String string = e.text;
|
public void handleEvent(Event e) {
|
||||||
char [] chars = new char [string.length()];
|
selIndex = pressureList.getSelectionIndex();
|
||||||
string.getChars (0, chars.length, chars, 0);
|
|
||||||
//to make sure user enter digits only
|
|
||||||
for (int i=0; i<chars.length; i++) {
|
|
||||||
if (!('0' <= chars [i] && chars [i] <= '9') && chars [i] != '.' && chars [i] != '-') {
|
|
||||||
e.doit = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
Label curlbl = new Label( top_form, SWT.NONE );
|
Group buttonGp = new Group(topGp, SWT.SHADOW_OUT);
|
||||||
|
buttonGp.setLayout(new GridLayout(1, false));
|
||||||
|
buttonGp.setText("Edit Option:");
|
||||||
|
Button useSelectedBtn = new Button(buttonGp, SWT.PUSH);
|
||||||
|
useSelectedBtn.setText(" Edit Selected Level ");
|
||||||
|
useSelectedBtn.setEnabled(true);
|
||||||
|
useSelectedBtn.addListener(SWT.MouseUp, new Listener() {
|
||||||
|
public void handleEvent(Event event) {
|
||||||
|
currentEditType = EditType.SELECTED_LEVEL;
|
||||||
|
if (selIndex != -1) {
|
||||||
|
NcSoundingLayer selLevelSounding = curSoundingLayerList
|
||||||
|
.get(selIndex);
|
||||||
|
curTempText.setText("" + selLevelSounding.getTemperature());
|
||||||
|
curDewText.setText("" + selLevelSounding.getDewpoint());
|
||||||
|
curWSpText.setText("" + selLevelSounding.getWindSpeed());
|
||||||
|
curWDirText.setText(""
|
||||||
|
+ selLevelSounding.getWindDirection());
|
||||||
|
curPressText.setText("" + selLevelSounding.getPressure());
|
||||||
|
newTempText.setText("" + selLevelSounding.getTemperature());
|
||||||
|
newDewText.setText("" + selLevelSounding.getDewpoint());
|
||||||
|
newWSpText.setText("" + selLevelSounding.getWindSpeed());
|
||||||
|
newWDirText.setText(""
|
||||||
|
+ selLevelSounding.getWindDirection());
|
||||||
|
newPressText.setText("" + selLevelSounding.getPressure());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Button addNewLevelBtn = new Button(buttonGp, SWT.PUSH);
|
||||||
|
addNewLevelBtn.setText(" Add New Level ");
|
||||||
|
addNewLevelBtn.setEnabled(true);
|
||||||
|
addNewLevelBtn.addListener(SWT.MouseUp, new Listener() {
|
||||||
|
public void handleEvent(Event event) {
|
||||||
|
currentEditType = EditType.NEW_LEVEL;
|
||||||
|
curTempText.setText(" N/A ");
|
||||||
|
curDewText.setText(" N/A ");
|
||||||
|
curWSpText.setText(" N/A ");
|
||||||
|
curWDirText.setText(" N/A ");
|
||||||
|
curPressText.setText(" N/A ");
|
||||||
|
newTempText.setText("");
|
||||||
|
newDewText.setText("");
|
||||||
|
newWSpText.setText("");
|
||||||
|
newWDirText.setText("");
|
||||||
|
newPressText.setText("");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Group top_form = new Group(top, SWT.SHADOW_ETCHED_IN);
|
||||||
|
FormLayout formlayout = new FormLayout();
|
||||||
|
formlayout.marginRight = 20;
|
||||||
|
formlayout.marginLeft = 20;
|
||||||
|
top_form.setLayout(formlayout);
|
||||||
|
|
||||||
|
Listener positiveNumberListeener = new Listener() {
|
||||||
|
public void handleEvent(Event e) {
|
||||||
|
String string = e.text;
|
||||||
|
char[] chars = new char[string.length()];
|
||||||
|
string.getChars(0, chars.length, chars, 0);
|
||||||
|
// to make sure user enter digits only
|
||||||
|
for (int i = 0; i < chars.length; i++) {
|
||||||
|
if (!('0' <= chars[i] && chars[i] <= '9')
|
||||||
|
&& chars[i] != '.') {
|
||||||
|
e.doit = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Listener numberListeener = new Listener() {
|
||||||
|
public void handleEvent(Event e) {
|
||||||
|
String string = e.text;
|
||||||
|
char[] chars = new char[string.length()];
|
||||||
|
string.getChars(0, chars.length, chars, 0);
|
||||||
|
// to make sure user enter digits only
|
||||||
|
for (int i = 0; i < chars.length; i++) {
|
||||||
|
if (!('0' <= chars[i] && chars[i] <= '9')
|
||||||
|
&& chars[i] != '.' && chars[i] != '-') {
|
||||||
|
e.doit = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Label curlbl = new Label(top_form, SWT.NONE);
|
||||||
curlbl.setText("Current Value");
|
curlbl.setText("Current Value");
|
||||||
FormData fd = new FormData( 100, 20 );
|
FormData fd = new FormData(100, 20);
|
||||||
fd.top = new FormAttachment( 0, 15 );
|
fd.top = new FormAttachment(0, 15);
|
||||||
fd.left = new FormAttachment( 0, 110 );
|
fd.left = new FormAttachment(0, 120);
|
||||||
fd.right = new FormAttachment( 100, -105 );
|
fd.right = new FormAttachment(100, -105);
|
||||||
curlbl.setLayoutData( fd );
|
curlbl.setLayoutData(fd);
|
||||||
|
|
||||||
Label newlbl = new Label( top_form, SWT.NONE );
|
|
||||||
newlbl.setText("New Value");
|
|
||||||
FormData fd2 = new FormData(100, 20 );
|
|
||||||
fd2.bottom = new FormAttachment(curlbl , 0, SWT.BOTTOM );
|
|
||||||
fd2.left = new FormAttachment( curlbl, 10, SWT.RIGHT );
|
|
||||||
newlbl.setLayoutData( fd2 );
|
|
||||||
|
|
||||||
curPressText = new Text( top_form, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY );
|
|
||||||
curPressText.setBackground(lightGrey);
|
|
||||||
fd = new FormData( 100, 20 );
|
|
||||||
fd.top = new FormAttachment( curlbl, 5, SWT.BOTTOM );
|
|
||||||
fd.left = new FormAttachment( curlbl, 0, SWT.LEFT );
|
|
||||||
fd.right = new FormAttachment( curlbl, 0, SWT.RIGHT );
|
|
||||||
curPressText.setLayoutData( fd );
|
|
||||||
|
|
||||||
Label presslbl = new Label( top_form, SWT.NONE );
|
Label newlbl = new Label(top_form, SWT.NONE);
|
||||||
|
newlbl.setText("New Value");
|
||||||
|
FormData fd2 = new FormData(100, 20);
|
||||||
|
fd2.bottom = new FormAttachment(curlbl, 0, SWT.BOTTOM);
|
||||||
|
fd2.left = new FormAttachment(curlbl, 10, SWT.RIGHT);
|
||||||
|
newlbl.setLayoutData(fd2);
|
||||||
|
|
||||||
|
curPressText = new Text(top_form, SWT.SINGLE | SWT.BORDER
|
||||||
|
| SWT.READ_ONLY);
|
||||||
|
curPressText.setBackground(lightGrey);
|
||||||
|
fd = new FormData(100, 20);
|
||||||
|
fd.top = new FormAttachment(curlbl, 5, SWT.BOTTOM);
|
||||||
|
fd.left = new FormAttachment(curlbl, 0, SWT.LEFT);
|
||||||
|
fd.right = new FormAttachment(curlbl, 0, SWT.RIGHT);
|
||||||
|
curPressText.setLayoutData(fd);
|
||||||
|
|
||||||
|
Label presslbl = new Label(top_form, SWT.NONE);
|
||||||
presslbl.setText("Pressure (mb)");
|
presslbl.setText("Pressure (mb)");
|
||||||
FormData fd1 = new FormData();
|
FormData fd1 = new FormData();
|
||||||
fd1.bottom = new FormAttachment( curPressText, -4, SWT.BOTTOM );
|
fd1.bottom = new FormAttachment(curPressText, -4, SWT.BOTTOM);
|
||||||
fd1.right = new FormAttachment( curPressText, -10, SWT.LEFT );
|
fd1.right = new FormAttachment(curPressText, -10, SWT.LEFT);
|
||||||
presslbl.setLayoutData( fd1 );
|
presslbl.setLayoutData(fd1);
|
||||||
|
|
||||||
newPressText = new Text( top_form, SWT.SINGLE | SWT.BORDER );
|
|
||||||
newPressText.setText("");
|
|
||||||
fd2 = new FormData(100, 20 );
|
|
||||||
fd2.bottom = new FormAttachment(curPressText , 0, SWT.BOTTOM );
|
|
||||||
fd2.left = new FormAttachment( curPressText, 10, SWT.RIGHT );
|
|
||||||
newPressText.setLayoutData( fd2 );
|
|
||||||
newPressText.addListener (SWT.Verify, positiveNumberListeener);
|
|
||||||
|
|
||||||
|
|
||||||
curTempText = new Text( top_form, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY );
|
|
||||||
curTempText.setText(tempStr);
|
|
||||||
curTempText.setBackground(lightGrey);
|
|
||||||
fd = new FormData( 100, 20 );
|
|
||||||
fd.top = new FormAttachment( curPressText, 5, SWT.BOTTOM );
|
|
||||||
fd.left = new FormAttachment( curPressText, 0, SWT.LEFT );
|
|
||||||
fd.right = new FormAttachment( curPressText, 0, SWT.RIGHT );
|
|
||||||
curTempText.setLayoutData( fd );
|
|
||||||
|
|
||||||
Label templbl = new Label( top_form, SWT.NONE );
|
newPressText = new Text(top_form, SWT.SINGLE | SWT.BORDER);
|
||||||
|
newPressText.setText("");
|
||||||
|
fd2 = new FormData(100, 20);
|
||||||
|
fd2.bottom = new FormAttachment(curPressText, 0, SWT.BOTTOM);
|
||||||
|
fd2.left = new FormAttachment(curPressText, 10, SWT.RIGHT);
|
||||||
|
newPressText.setLayoutData(fd2);
|
||||||
|
newPressText.addListener(SWT.Verify, positiveNumberListeener);
|
||||||
|
|
||||||
|
curTempText = new Text(top_form, SWT.SINGLE | SWT.BORDER
|
||||||
|
| SWT.READ_ONLY);
|
||||||
|
curTempText.setText(tempStr);
|
||||||
|
curTempText.setBackground(lightGrey);
|
||||||
|
fd = new FormData(100, 20);
|
||||||
|
fd.top = new FormAttachment(curPressText, 5, SWT.BOTTOM);
|
||||||
|
fd.left = new FormAttachment(curPressText, 0, SWT.LEFT);
|
||||||
|
fd.right = new FormAttachment(curPressText, 0, SWT.RIGHT);
|
||||||
|
curTempText.setLayoutData(fd);
|
||||||
|
|
||||||
|
Label templbl = new Label(top_form, SWT.NONE);
|
||||||
templbl.setText("Temperature (C)");
|
templbl.setText("Temperature (C)");
|
||||||
fd1 = new FormData();
|
fd1 = new FormData();
|
||||||
fd1.bottom = new FormAttachment( curTempText, -4, SWT.BOTTOM );
|
fd1.bottom = new FormAttachment(curTempText, -4, SWT.BOTTOM);
|
||||||
fd1.right = new FormAttachment( curTempText, -10, SWT.LEFT );
|
fd1.right = new FormAttachment(curTempText, -10, SWT.LEFT);
|
||||||
templbl.setLayoutData( fd1 );
|
templbl.setLayoutData(fd1);
|
||||||
|
|
||||||
newTempText = new Text( top_form, SWT.SINGLE | SWT.BORDER );
|
newTempText = new Text(top_form, SWT.SINGLE | SWT.BORDER);
|
||||||
newTempText.setText("");
|
newTempText.setText("");
|
||||||
fd2 = new FormData(100, 20 );
|
fd2 = new FormData(100, 20);
|
||||||
fd2.bottom = new FormAttachment(curTempText , 0, SWT.BOTTOM );
|
fd2.bottom = new FormAttachment(curTempText, 0, SWT.BOTTOM);
|
||||||
fd2.left = new FormAttachment( curTempText, 10, SWT.RIGHT );
|
fd2.left = new FormAttachment(curTempText, 10, SWT.RIGHT);
|
||||||
newTempText.setLayoutData( fd2 );
|
newTempText.setLayoutData(fd2);
|
||||||
newTempText.addListener (SWT.Verify, numberListeener);
|
newTempText.addListener(SWT.Verify, numberListeener);
|
||||||
|
|
||||||
curDewText = new Text( top_form, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY );
|
curDewText = new Text(top_form, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
|
||||||
curDewText.setText(dewStr);
|
curDewText.setText(dewStr);
|
||||||
curDewText.setBackground(lightGrey);
|
curDewText.setBackground(lightGrey);
|
||||||
fd = new FormData( 100, 20 );
|
fd = new FormData(100, 20);
|
||||||
fd.top = new FormAttachment( curTempText, 5, SWT.BOTTOM );
|
fd.top = new FormAttachment(curTempText, 5, SWT.BOTTOM);
|
||||||
fd.left = new FormAttachment( curTempText, 0, SWT.LEFT );
|
fd.left = new FormAttachment(curTempText, 0, SWT.LEFT);
|
||||||
fd.right = new FormAttachment( curTempText, 0, SWT.RIGHT );
|
fd.right = new FormAttachment(curTempText, 0, SWT.RIGHT);
|
||||||
curDewText.setLayoutData( fd );
|
curDewText.setLayoutData(fd);
|
||||||
|
|
||||||
Label dewlbl = new Label( top_form, SWT.NONE );
|
Label dewlbl = new Label(top_form, SWT.NONE);
|
||||||
dewlbl.setText("DewPoint (C)");
|
dewlbl.setText("DewPoint (C)");
|
||||||
fd1 = new FormData();
|
fd1 = new FormData();
|
||||||
fd1.bottom = new FormAttachment( curDewText, -4, SWT.BOTTOM );
|
fd1.bottom = new FormAttachment(curDewText, -4, SWT.BOTTOM);
|
||||||
fd1.right = new FormAttachment( curDewText, -10, SWT.LEFT );
|
fd1.right = new FormAttachment(curDewText, -10, SWT.LEFT);
|
||||||
dewlbl.setLayoutData( fd1 );
|
dewlbl.setLayoutData(fd1);
|
||||||
|
|
||||||
newDewText = new Text( top_form, SWT.SINGLE | SWT.BORDER );
|
|
||||||
newDewText.setText("");
|
|
||||||
fd2 = new FormData(100, 20 );
|
|
||||||
fd2.bottom = new FormAttachment(curDewText , 0, SWT.BOTTOM );
|
|
||||||
fd2.left = new FormAttachment( curDewText, 10, SWT.RIGHT );
|
|
||||||
newDewText.setLayoutData( fd2 );
|
|
||||||
newDewText.addListener (SWT.Verify, numberListeener);
|
|
||||||
|
|
||||||
curWSpText = new Text( top_form, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY );
|
|
||||||
curWSpText.setText(wspStr);
|
|
||||||
curWSpText.setBackground(lightGrey);
|
|
||||||
fd = new FormData( 100, 20 );
|
|
||||||
fd.top = new FormAttachment( curDewText, 5, SWT.BOTTOM );
|
|
||||||
fd.left = new FormAttachment( curDewText, 0, SWT.LEFT );
|
|
||||||
fd.right = new FormAttachment( curDewText, 0, SWT.RIGHT );
|
|
||||||
curWSpText.setLayoutData( fd );
|
|
||||||
|
|
||||||
Label wsplbl = new Label( top_form, SWT.NONE );
|
newDewText = new Text(top_form, SWT.SINGLE | SWT.BORDER);
|
||||||
wsplbl.setText("Wind Speed (Knot)");
|
newDewText.setText("");
|
||||||
fd1 = new FormData();
|
fd2 = new FormData(100, 20);
|
||||||
fd1.bottom = new FormAttachment( curWSpText, -4, SWT.BOTTOM );
|
fd2.bottom = new FormAttachment(curDewText, 0, SWT.BOTTOM);
|
||||||
fd1.right = new FormAttachment( curWSpText, -10, SWT.LEFT );
|
fd2.left = new FormAttachment(curDewText, 10, SWT.RIGHT);
|
||||||
wsplbl.setLayoutData( fd1 );
|
newDewText.setLayoutData(fd2);
|
||||||
|
newDewText.addListener(SWT.Verify, numberListeener);
|
||||||
newWSpText = new Text( top_form, SWT.SINGLE | SWT.BORDER );
|
|
||||||
newWSpText.setText("");
|
curWDirText = new Text(top_form, SWT.SINGLE | SWT.BORDER
|
||||||
fd2 = new FormData(100, 20 );
|
| SWT.READ_ONLY);
|
||||||
fd2.bottom = new FormAttachment(curWSpText , 0, SWT.BOTTOM );
|
|
||||||
fd2.left = new FormAttachment( curWSpText, 10, SWT.RIGHT );
|
|
||||||
newWSpText.setLayoutData( fd2 );
|
|
||||||
newWSpText.addListener (SWT.Verify, positiveNumberListeener);
|
|
||||||
|
|
||||||
curWDirText = new Text( top_form, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY );
|
|
||||||
curWDirText.setText(wdirStr);
|
curWDirText.setText(wdirStr);
|
||||||
curWDirText.setBackground(lightGrey);
|
curWDirText.setBackground(lightGrey);
|
||||||
fd = new FormData( 100, 20 );
|
fd = new FormData(100, 20);
|
||||||
fd.top = new FormAttachment( curWSpText, 5, SWT.BOTTOM );
|
fd.top = new FormAttachment(curDewText, 5, SWT.BOTTOM);
|
||||||
fd.left = new FormAttachment( curWSpText, 0, SWT.LEFT );
|
fd.left = new FormAttachment(curDewText, 0, SWT.LEFT);
|
||||||
fd.right = new FormAttachment( curWSpText, 0, SWT.RIGHT );
|
fd.right = new FormAttachment(curDewText, 0, SWT.RIGHT);
|
||||||
curWDirText.setLayoutData( fd );
|
curWDirText.setLayoutData(fd);
|
||||||
|
|
||||||
Label wdirlbl = new Label( top_form, SWT.NONE );
|
Label wdirlbl = new Label(top_form, SWT.NONE);
|
||||||
wdirlbl.setText("Wind Direction");
|
wdirlbl.setText("Wind Direction");
|
||||||
fd1 = new FormData();
|
fd1 = new FormData();
|
||||||
fd1.bottom = new FormAttachment( curWDirText, -4, SWT.BOTTOM );
|
fd1.bottom = new FormAttachment(curWDirText, -4, SWT.BOTTOM);
|
||||||
fd1.right = new FormAttachment( curWDirText, -10, SWT.LEFT );
|
fd1.right = new FormAttachment(curWDirText, -10, SWT.LEFT);
|
||||||
wdirlbl.setLayoutData( fd1 );
|
wdirlbl.setLayoutData(fd1);
|
||||||
|
|
||||||
newWDirText = new Text( top_form, SWT.SINGLE | SWT.BORDER );
|
newWDirText = new Text(top_form, SWT.SINGLE | SWT.BORDER);
|
||||||
newWDirText.setText("");
|
newWDirText.setText("");
|
||||||
fd2 = new FormData(100, 20 );
|
fd2 = new FormData(100, 20);
|
||||||
fd2.bottom = new FormAttachment(curWDirText , 0, SWT.BOTTOM );
|
fd2.bottom = new FormAttachment(curWDirText, 0, SWT.BOTTOM);
|
||||||
fd2.left = new FormAttachment( curWDirText, 10, SWT.RIGHT );
|
fd2.left = new FormAttachment(curWDirText, 10, SWT.RIGHT);
|
||||||
newWDirText.setLayoutData( fd2 );
|
newWDirText.setLayoutData(fd2);
|
||||||
newWDirText.addListener (SWT.Verify, positiveNumberListeener);
|
newWDirText.addListener(SWT.Verify, positiveNumberListeener);
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
protected void configureShell( Shell shell ) {
|
|
||||||
super.configureShell( shell );
|
|
||||||
shell.setText( "Sounding Data Editor" );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Control createDialogArea(Composite parent) {
|
|
||||||
Composite top;
|
|
||||||
top = (Composite) super.createDialogArea(parent);
|
|
||||||
|
|
||||||
// Create the main layout for the shell.
|
|
||||||
GridLayout mainLayout = new GridLayout(1, false);
|
|
||||||
top.setLayout(mainLayout);
|
|
||||||
top.setLocation(0, 0);
|
|
||||||
createDialogContents(top);
|
|
||||||
return top;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void handleEditing(){
|
curWSpText = new Text(top_form, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
|
||||||
String textStr = newWDirText.getText();
|
curWSpText.setText(wspStr);
|
||||||
float winDir=0, winSpd=0, tp=0, dp=0, press=0;
|
curWSpText.setBackground(lightGrey);
|
||||||
try{
|
fd = new FormData(100, 20);
|
||||||
if((textStr != null) && !(textStr.isEmpty())){
|
fd.top = new FormAttachment(curWDirText, 5, SWT.BOTTOM);
|
||||||
winDir = Float.parseFloat(textStr);
|
fd.left = new FormAttachment(curWDirText, 0, SWT.LEFT);
|
||||||
}
|
fd.right = new FormAttachment(curWDirText, 0, SWT.RIGHT);
|
||||||
else
|
curWSpText.setLayoutData(fd);
|
||||||
winDir = Float.parseFloat(curWDirText.getText());
|
|
||||||
textStr = newWSpText.getText();
|
|
||||||
if((textStr != null) && !(textStr.isEmpty())){
|
|
||||||
winSpd = Float.parseFloat(textStr);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
winSpd = Float.parseFloat(curWSpText.getText());
|
|
||||||
textStr = newDewText.getText();
|
|
||||||
if((textStr != null) && !(textStr.isEmpty())){
|
|
||||||
dp = Float.parseFloat(textStr);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
dp = Float.parseFloat(curDewText.getText());
|
|
||||||
textStr = newTempText.getText();
|
|
||||||
if((textStr != null) && !(textStr.isEmpty())){
|
|
||||||
tp = Float.parseFloat(textStr);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
tp = Float.parseFloat(curTempText.getText());
|
|
||||||
|
|
||||||
textStr = newPressText.getText();
|
Label wsplbl = new Label(top_form, SWT.NONE);
|
||||||
if((textStr != null) && !(textStr.isEmpty())){
|
wsplbl.setText("Wind Speed (Knot)");
|
||||||
press = Float.parseFloat(textStr);
|
fd1 = new FormData();
|
||||||
}
|
fd1.bottom = new FormAttachment(curWSpText, -4, SWT.BOTTOM);
|
||||||
else
|
fd1.right = new FormAttachment(curWSpText, -10, SWT.LEFT);
|
||||||
press = Float.parseFloat(curPressText.getText());
|
wsplbl.setLayoutData(fd1);
|
||||||
|
|
||||||
if((dp > tp) || winDir >= 360.0 ){
|
|
||||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
|
||||||
MessageBox mb = new MessageBox(shell, SWT.ICON_WARNING
|
|
||||||
| SWT.OK);
|
|
||||||
|
|
||||||
mb.setMessage( "Invalid Data! (Dew Point > Temperature or Wind direction > 360)");
|
newWSpText = new Text(top_form, SWT.SINGLE | SWT.BORDER);
|
||||||
mb.open();
|
newWSpText.setText("");
|
||||||
}
|
fd2 = new FormData(100, 20);
|
||||||
else {
|
fd2.bottom = new FormAttachment(curWSpText, 0, SWT.BOTTOM);
|
||||||
NsharpEditor editor = NsharpEditor.getActiveNsharpEditor();
|
fd2.left = new FormAttachment(curWSpText, 10, SWT.RIGHT);
|
||||||
if(editor != null){
|
newWSpText.setLayoutData(fd2);
|
||||||
NsharpResourceHandler rscHandler = editor.getRscHandler();
|
newWSpText.addListener(SWT.Verify, positiveNumberListeener);
|
||||||
switch(currentEditType) {
|
|
||||||
case NEW_LEVEL:
|
|
||||||
rscHandler.addNewLayer(tp, dp, winSpd, winDir, press);
|
|
||||||
break;
|
|
||||||
case SELECTED_LEVEL:
|
|
||||||
rscHandler.updateLayer(selIndex,tp, dp, winSpd, winDir, press);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
editor.refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
//System.out.println("bad input entered " );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private boolean verifyNewlevelInput() {
|
|
||||||
|
|
||||||
if((newWDirText.getText().isEmpty()) || curWDirText.getText().isEmpty()
|
|
||||||
|| curWSpText.getText().isEmpty() || curDewText.getText().isEmpty()
|
|
||||||
|| curTempText.getText().isEmpty()){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void createButtonsForButtonBar(Composite parent) {
|
|
||||||
// create Apply and Close buttons by default
|
|
||||||
Button okBtn = createButton(parent, IDialogConstants.CLIENT_ID, "Apply", true);
|
|
||||||
okBtn.addListener( SWT.MouseUp, new Listener() {
|
|
||||||
public void handleEvent(Event event) {
|
|
||||||
//System.out.println("OK listener is called");
|
|
||||||
if(currentEditType == EditType.NEW_LEVEL && verifyNewlevelInput()== false){
|
|
||||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
|
||||||
MessageBox mb = new MessageBox(shell, SWT.ICON_WARNING
|
|
||||||
| SWT.OK);
|
|
||||||
|
|
||||||
mb.setMessage( "Missing input data! Should fill up all 5 entries!");
|
|
||||||
mb.open();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
handleEditing();
|
|
||||||
//move close from okPressed() to here
|
|
||||||
//close();
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
Button canBtn = createButton(parent, IDialogConstants.CANCEL_ID,
|
|
||||||
IDialogConstants.CLOSE_LABEL, false);
|
|
||||||
canBtn.addListener( SWT.MouseUp, new Listener() {
|
|
||||||
public void handleEvent(Event event) {
|
|
||||||
//currentParcel = prevParcel ;
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//@Override
|
|
||||||
//This function name is miss leading....
|
|
||||||
//This function is called when CR is preseed, but NOT "ok" button.
|
|
||||||
//Override this and move close() from here to OK button Listener
|
|
||||||
//So, we only close when "OK" is pressed, not "CR".
|
|
||||||
//public void okPressed() {
|
|
||||||
//System.out.println("CR is pressed");
|
|
||||||
// setReturnCode(OK);
|
|
||||||
//close();
|
|
||||||
//}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int open( ) {
|
|
||||||
//System.out.println("parcel dialog opened");
|
|
||||||
if ( this.getShell() == null ){
|
|
||||||
this.create();
|
|
||||||
}
|
|
||||||
return super.open();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean close() {
|
protected void configureShell(Shell shell) {
|
||||||
|
super.configureShell(shell);
|
||||||
thisDialog=null;
|
shell.setText("Sounding Data Editor");
|
||||||
return super.close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Control createDialogArea(Composite parent) {
|
||||||
|
Composite top;
|
||||||
|
top = (Composite) super.createDialogArea(parent);
|
||||||
|
|
||||||
|
// Create the main layout for the shell.
|
||||||
|
GridLayout mainLayout = new GridLayout(1, false);
|
||||||
|
top.setLayout(mainLayout);
|
||||||
|
top.setLocation(0, 0);
|
||||||
|
createDialogContents(top);
|
||||||
|
return top;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleEditing() {
|
||||||
|
String textStr = newWDirText.getText();
|
||||||
|
float winDir = 0, winSpd = 0, tp = 0, dp = 0, press = 0;
|
||||||
|
try {
|
||||||
|
if ((textStr != null) && !(textStr.isEmpty())) {
|
||||||
|
winDir = Float.parseFloat(textStr);
|
||||||
|
} else
|
||||||
|
winDir = Float.parseFloat(curWDirText.getText());
|
||||||
|
textStr = newWSpText.getText();
|
||||||
|
if ((textStr != null) && !(textStr.isEmpty())) {
|
||||||
|
winSpd = Float.parseFloat(textStr);
|
||||||
|
} else
|
||||||
|
winSpd = Float.parseFloat(curWSpText.getText());
|
||||||
|
textStr = newDewText.getText();
|
||||||
|
if ((textStr != null) && !(textStr.isEmpty())) {
|
||||||
|
dp = Float.parseFloat(textStr);
|
||||||
|
} else
|
||||||
|
dp = Float.parseFloat(curDewText.getText());
|
||||||
|
textStr = newTempText.getText();
|
||||||
|
if ((textStr != null) && !(textStr.isEmpty())) {
|
||||||
|
tp = Float.parseFloat(textStr);
|
||||||
|
} else
|
||||||
|
tp = Float.parseFloat(curTempText.getText());
|
||||||
|
|
||||||
|
textStr = newPressText.getText();
|
||||||
|
if ((textStr != null) && !(textStr.isEmpty())) {
|
||||||
|
press = Float.parseFloat(textStr);
|
||||||
|
} else
|
||||||
|
press = Float.parseFloat(curPressText.getText());
|
||||||
|
|
||||||
|
if ((dp > tp) || winDir >= 360.0) {
|
||||||
|
Shell shell = PlatformUI.getWorkbench()
|
||||||
|
.getActiveWorkbenchWindow().getShell();
|
||||||
|
MessageBox mb = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK);
|
||||||
|
|
||||||
|
mb.setMessage("Invalid Data! (Dew Point > Temperature or Wind direction > 360)");
|
||||||
|
mb.open();
|
||||||
|
} else {
|
||||||
|
NsharpEditor editor = NsharpEditor.getActiveNsharpEditor();
|
||||||
|
if (editor != null) {
|
||||||
|
NsharpResourceHandler rscHandler = editor.getRscHandler();
|
||||||
|
switch (currentEditType) {
|
||||||
|
case NEW_LEVEL:
|
||||||
|
rscHandler.addNewLayer(tp, dp, winSpd, winDir, press);
|
||||||
|
break;
|
||||||
|
case SELECTED_LEVEL:
|
||||||
|
rscHandler.updateLayer(selIndex, tp, dp, winSpd,
|
||||||
|
winDir, press);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
editor.refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
// System.out.println("bad input entered " );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean verifyNewlevelInput() {
|
||||||
|
|
||||||
|
if ((newWDirText.getText().isEmpty())
|
||||||
|
|| curWDirText.getText().isEmpty()
|
||||||
|
|| curWSpText.getText().isEmpty()
|
||||||
|
|| curDewText.getText().isEmpty()
|
||||||
|
|| curTempText.getText().isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void createButtonsForButtonBar(Composite parent) {
|
||||||
|
// create Apply and Close buttons by default
|
||||||
|
Button okBtn = createButton(parent, IDialogConstants.CLIENT_ID,
|
||||||
|
"Apply", true);
|
||||||
|
okBtn.addListener(SWT.MouseUp, new Listener() {
|
||||||
|
public void handleEvent(Event event) {
|
||||||
|
// System.out.println("OK listener is called");
|
||||||
|
if (currentEditType == EditType.NEW_LEVEL
|
||||||
|
&& verifyNewlevelInput() == false) {
|
||||||
|
Shell shell = PlatformUI.getWorkbench()
|
||||||
|
.getActiveWorkbenchWindow().getShell();
|
||||||
|
MessageBox mb = new MessageBox(shell, SWT.ICON_WARNING
|
||||||
|
| SWT.OK);
|
||||||
|
|
||||||
|
mb.setMessage("Missing input data! Should fill up all 5 entries!");
|
||||||
|
mb.open();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
handleEditing();
|
||||||
|
// move close from okPressed() to here
|
||||||
|
// close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Button canBtn = createButton(parent, IDialogConstants.CANCEL_ID,
|
||||||
|
IDialogConstants.CLOSE_LABEL, false);
|
||||||
|
canBtn.addListener(SWT.MouseUp, new Listener() {
|
||||||
|
public void handleEvent(Event event) {
|
||||||
|
// currentParcel = prevParcel ;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// This function name is miss leading....
|
||||||
|
// This function is called when CR is preseed, but NOT "ok" button.
|
||||||
|
// Override this and move close() from here to OK button Listener
|
||||||
|
// So, we only close when "OK" is pressed, not "CR".
|
||||||
|
// public void okPressed() {
|
||||||
|
// System.out.println("CR is pressed");
|
||||||
|
// setReturnCode(OK);
|
||||||
|
// close();
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int open() {
|
||||||
|
// System.out.println("parcel dialog opened");
|
||||||
|
if (this.getShell() == null) {
|
||||||
|
this.create();
|
||||||
|
}
|
||||||
|
return super.open();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean close() {
|
||||||
|
|
||||||
|
thisDialog = null;
|
||||||
|
return super.close();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,7 +142,7 @@ import com.vividsolutions.jts.linearref.LocationIndexedLine;
|
||||||
* 12/13 #1091 J. Wu Added getLayerMergeOption()
|
* 12/13 #1091 J. Wu Added getLayerMergeOption()
|
||||||
* 05/14 TTR 995 J. Wu Added getContourLabelAutoPlacement().
|
* 05/14 TTR 995 J. Wu Added getContourLabelAutoPlacement().
|
||||||
* 05/14 TTR998 J. Wu Added pixelToLatlon().
|
* 05/14 TTR998 J. Wu Added pixelToLatlon().
|
||||||
*
|
* 07/14 Chin Chen In latlonToPixel(), make sure not to add null pixel to its return pixel array
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author
|
* @author
|
||||||
|
@ -834,12 +834,14 @@ public class PgenUtil {
|
||||||
IMapDescriptor mapDescriptor) {
|
IMapDescriptor mapDescriptor) {
|
||||||
double[] point = new double[3];
|
double[] point = new double[3];
|
||||||
double[][] pixels = new double[pts.length][3];
|
double[][] pixels = new double[pts.length][3];
|
||||||
|
double[] pixel;
|
||||||
for (int i = 0; i < pts.length; i++) {
|
for (int i = 0; i < pts.length; i++) {
|
||||||
point[0] = pts[i].x;
|
point[0] = pts[i].x;
|
||||||
point[1] = pts[i].y;
|
point[1] = pts[i].y;
|
||||||
point[2] = 0.0;
|
point[2] = 0.0;
|
||||||
pixels[i] = mapDescriptor.worldToPixel(point);
|
pixel = mapDescriptor.worldToPixel(point);
|
||||||
|
if (pixel != null)
|
||||||
|
pixels[i] = pixel;
|
||||||
}
|
}
|
||||||
|
|
||||||
return pixels;
|
return pixels;
|
||||||
|
|
|
@ -141,6 +141,7 @@ import com.vividsolutions.jts.operation.distance.DistanceOp;
|
||||||
* 11/13 TTR 752 J. Wu added methods to compute an element's range record.
|
* 11/13 TTR 752 J. Wu added methods to compute an element's range record.
|
||||||
* 12/13 #1089 B. Yin Modify watch to display county list
|
* 12/13 #1089 B. Yin Modify watch to display county list
|
||||||
* 05/14 TTR 995 J. Wu Make contour label auto-placement an option.
|
* 05/14 TTR 995 J. Wu Make contour label auto-placement an option.
|
||||||
|
* 07/14 ? B. Yin Added support for dashed-line circle for TCM 12 feet sea.
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author sgilbert
|
* @author sgilbert
|
||||||
|
@ -1522,19 +1523,22 @@ public class DisplayElementFactory {
|
||||||
|
|
||||||
ArrayList<Coordinate> trackPts = new ArrayList<Coordinate>();
|
ArrayList<Coordinate> trackPts = new ArrayList<Coordinate>();
|
||||||
|
|
||||||
// draw wave quarters
|
|
||||||
slist.addAll(createDisplayElements(tcm.getWaveQuarters(), paintProps));
|
|
||||||
|
|
||||||
// draw wind forecast quarters and labels
|
// draw wind forecast quarters and labels
|
||||||
for (TcmFcst tcmFcst : tcm.getTcmFcst()) {
|
for (TcmFcst tcmFcst : tcm.getTcmFcst()) {
|
||||||
|
|
||||||
String[] txt = new String[2];
|
String[] txt = new String[2];
|
||||||
Calendar fcstHr = (Calendar) tcm.getAdvisoryTime().clone();
|
Calendar fcstHr = tcmFcst.getEndtime();
|
||||||
fcstHr.add(Calendar.HOUR_OF_DAY, tcmFcst.getFcstHr());
|
if (fcstHr == null) {
|
||||||
|
fcstHr = (Calendar) tcm.getAdvisoryTime().clone();
|
||||||
|
fcstHr.add(Calendar.HOUR_OF_DAY, tcmFcst.getFcstHr());
|
||||||
|
}
|
||||||
|
|
||||||
if (tcmFcst.equals(tcm.getTcmFcst().get(0))) {
|
if (tcmFcst.equals(tcm.getTcmFcst().get(0))) {
|
||||||
txt[0] = tcm.getStormName() + "/"
|
txt[1] = tcm.getStormName()
|
||||||
+ (int) tcm.getCentralPressure() + "mb";
|
+ "/"
|
||||||
txt[1] = String.format("%1$td/%1$tH%1$tM", fcstHr);
|
+ (tcm.getCentralPressure() > 0 ? tcm
|
||||||
|
.getCentralPressure() : "xxx") + "mb";
|
||||||
|
txt[0] = String.format("%1$td/%1$tH%1$tM", fcstHr);
|
||||||
} else {
|
} else {
|
||||||
txt[0] = String.format("%1$td/%1$tH%1$tM", fcstHr);
|
txt[0] = String.format("%1$td/%1$tH%1$tM", fcstHr);
|
||||||
txt[1] = "";
|
txt[1] = "";
|
||||||
|
@ -1544,6 +1548,12 @@ public class DisplayElementFactory {
|
||||||
trackPts.add(tcmFcst.getQuarters()[0].getLocation());
|
trackPts.add(tcmFcst.getQuarters()[0].getLocation());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// draw wave quarters
|
||||||
|
if (tcm.getWaveQuarters() != null) {
|
||||||
|
slist.addAll(createDisplayElements(tcm.getWaveQuarters(),
|
||||||
|
paintProps));
|
||||||
|
}
|
||||||
|
|
||||||
// draw track
|
// draw track
|
||||||
if (trackPts.size() >= 2) {
|
if (trackPts.size() >= 2) {
|
||||||
Line trackLn = new Line(null,
|
Line trackLn = new Line(null,
|
||||||
|
@ -1581,7 +1591,7 @@ public class DisplayElementFactory {
|
||||||
TextJustification.LEFT_JUSTIFY,
|
TextJustification.LEFT_JUSTIFY,
|
||||||
tcmFcst.getQuarters()[0].getLocation(), 0.0,
|
tcmFcst.getQuarters()[0].getLocation(), 0.0,
|
||||||
/* TTR 895 TextRotation.NORTH_RELATIVE, */
|
/* TTR 895 TextRotation.NORTH_RELATIVE, */
|
||||||
TextRotation.SCREEN_RELATIVE, txt, FontStyle.REGULAR,
|
TextRotation.SCREEN_RELATIVE, txt, FontStyle.BOLD,
|
||||||
getDisplayColor(Color.YELLOW), 4, 0, false,
|
getDisplayColor(Color.YELLOW), 4, 0, false,
|
||||||
DisplayType.NORMAL, "Text", "General Text");
|
DisplayType.NORMAL, "Text", "General Text");
|
||||||
|
|
||||||
|
@ -1592,8 +1602,8 @@ public class DisplayElementFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the TCM symbol according to the wind speed. Hurricane >= 64 knots
|
* Returns the TCM symbol according to the wind speed. Hurricane >= 64
|
||||||
* TS >= 50 knots TD >= 32 knots Lx < 32 knots
|
* knots, TS >= 34 knots, TD < 34 knots
|
||||||
*
|
*
|
||||||
* @param tcmFcst
|
* @param tcmFcst
|
||||||
* @return
|
* @return
|
||||||
|
@ -1604,13 +1614,19 @@ public class DisplayElementFactory {
|
||||||
|
|
||||||
int maxWind = 0;
|
int maxWind = 0;
|
||||||
|
|
||||||
for (ITcmWindQuarter qtr : quarters) {
|
if (tcmFcst instanceof TcmFcst) {
|
||||||
double[] radius = qtr.getQuarters();
|
maxWind = ((TcmFcst) tcmFcst).getWindMax();
|
||||||
for (double r : radius) {
|
}
|
||||||
if (r > 0) {
|
|
||||||
if (qtr.getWindSpeed() > maxWind)
|
if (maxWind == 0) {
|
||||||
maxWind = qtr.getWindSpeed();
|
for (ITcmWindQuarter qtr : quarters) {
|
||||||
break;
|
double[] radius = qtr.getQuarters();
|
||||||
|
for (double r : radius) {
|
||||||
|
if (r > 0) {
|
||||||
|
if (qtr.getWindSpeed() > maxWind)
|
||||||
|
maxWind = qtr.getWindSpeed();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1621,15 +1637,15 @@ public class DisplayElementFactory {
|
||||||
ret = "HURRICANE_NH";
|
ret = "HURRICANE_NH";
|
||||||
else
|
else
|
||||||
ret = "HURRICANE_SH";
|
ret = "HURRICANE_SH";
|
||||||
} else if (maxWind >= 50) {
|
} else if (maxWind >= 34) {
|
||||||
if (lat > 0)
|
if (lat > 0)
|
||||||
ret = "TROPICAL_STORM_NH";
|
ret = "TROPICAL_STORM_NH";
|
||||||
else
|
else
|
||||||
ret = "TROPICAL_STORM_SH";
|
ret = "TROPICAL_STORM_SH";
|
||||||
} else if (maxWind >= 32) {
|
|
||||||
ret = "TROPICAL_DEPRESSION";
|
|
||||||
} else {
|
} else {
|
||||||
ret = "LOW_X_FILLED";
|
ret = "TROPICAL_DEPRESSION";
|
||||||
|
// } else {
|
||||||
|
// ret = "LOW_X_FILLED";
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -1648,13 +1664,58 @@ public class DisplayElementFactory {
|
||||||
ITcmWindQuarter quatros, PaintProperties paintProps) {
|
ITcmWindQuarter quatros, PaintProperties paintProps) {
|
||||||
ArrayList<IDisplayable> slist = new ArrayList<IDisplayable>();
|
ArrayList<IDisplayable> slist = new ArrayList<IDisplayable>();
|
||||||
|
|
||||||
|
Coordinate center = quatros.getLocation();
|
||||||
Color color = Color.GREEN;
|
Color color = Color.GREEN;
|
||||||
switch (quatros.getWindSpeed()) {
|
switch (quatros.getWindSpeed()) {
|
||||||
case 0:
|
case 0:
|
||||||
color = Color.GREEN;
|
color = Color.GREEN;
|
||||||
break;
|
Arc quatro1 = new Arc(null, color, (float) 1.5, 1.0, false, false,
|
||||||
case 32:
|
0, null, "Circle", center,
|
||||||
color = Color.BLUE;
|
this.calculateDestinationPointMap(center, 0,
|
||||||
|
quatros.getQuarters()[0]), "Arc", 1, 0, 90);
|
||||||
|
|
||||||
|
Arc quatro2 = new Arc(null, color, (float) 1.5, 1.0, false, false,
|
||||||
|
0, null, "Circle", center,
|
||||||
|
this.calculateDestinationPointMap(center, 0,
|
||||||
|
quatros.getQuarters()[1]), "Arc", 1, 90, 180);
|
||||||
|
Arc quatro3 = new Arc(null, color, (float) 1.5, 1.0, false, false,
|
||||||
|
0, null, "Circle", center,
|
||||||
|
this.calculateDestinationPointMap(center, 0,
|
||||||
|
quatros.getQuarters()[2]), "Arc", 1, 180, 270);
|
||||||
|
Arc quatro4 = new Arc(null, color, (float) 1.5, 1.0, false, false,
|
||||||
|
0, null, "Circle", center,
|
||||||
|
this.calculateDestinationPointMap(center, 0,
|
||||||
|
quatros.getQuarters()[3]), "Arc", 1, 270, 360);
|
||||||
|
slist.addAll(createDisplayElements((IArc) quatro1, paintProps, 3));
|
||||||
|
slist.addAll(createDisplayElements((IArc) quatro2, paintProps, 3));
|
||||||
|
slist.addAll(createDisplayElements((IArc) quatro3, paintProps, 3));
|
||||||
|
slist.addAll(createDisplayElements((IArc) quatro4, paintProps, 3));
|
||||||
|
|
||||||
|
Line ln1 = getWindQuatroLine(getPointOnArc(quatro1, 0),
|
||||||
|
getPointOnArc(quatro2, 0), color);
|
||||||
|
ln1.setPgenType("LINE_DASHED_4");
|
||||||
|
|
||||||
|
Line ln2 = getWindQuatroLine(getPointOnArc(quatro2, 90),
|
||||||
|
getPointOnArc(quatro3, 90), color);
|
||||||
|
ln2.setPgenType("LINE_DASHED_4");
|
||||||
|
|
||||||
|
Line ln3 = getWindQuatroLine(getPointOnArc(quatro3, 180),
|
||||||
|
getPointOnArc(quatro4, 180), color);
|
||||||
|
ln3.setPgenType("LINE_DASHED_4");
|
||||||
|
|
||||||
|
Line ln4 = getWindQuatroLine(getPointOnArc(quatro4, 270),
|
||||||
|
getPointOnArc(quatro1, 270), color);
|
||||||
|
ln4.setPgenType("LINE_DASHED_4");
|
||||||
|
|
||||||
|
slist.addAll(createDisplayElements((ILine) ln1, paintProps));
|
||||||
|
slist.addAll(createDisplayElements((ILine) ln2, paintProps));
|
||||||
|
slist.addAll(createDisplayElements((ILine) ln3, paintProps));
|
||||||
|
slist.addAll(createDisplayElements((ILine) ln4, paintProps));
|
||||||
|
|
||||||
|
return slist;
|
||||||
|
case 34:
|
||||||
|
// make it consistent with NMAP
|
||||||
|
color = new Color(0, 150, 255);
|
||||||
break;
|
break;
|
||||||
case 50:
|
case 50:
|
||||||
color = Color.YELLOW;
|
color = Color.YELLOW;
|
||||||
|
@ -1664,10 +1725,10 @@ public class DisplayElementFactory {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Coordinate center = quatros.getLocation();
|
|
||||||
Arc quatro1 = new Arc(null, color, (float) 1.5, 1.0, false, false, 0,
|
Arc quatro1 = new Arc(null, color, (float) 1.5, 1.0, false, false, 0,
|
||||||
null, "Circle", center, this.calculateDestinationPointMap(
|
null, "Circle", center, this.calculateDestinationPointMap(
|
||||||
center, 0, quatros.getQuarters()[0]), "Arc", 1, 0, 90);
|
center, 0, quatros.getQuarters()[0]), "Arc", 1, 0, 90);
|
||||||
|
|
||||||
Arc quatro2 = new Arc(null, color, (float) 1.5, 1.0, false, false, 0,
|
Arc quatro2 = new Arc(null, color, (float) 1.5, 1.0, false, false, 0,
|
||||||
null, "Circle", center, this.calculateDestinationPointMap(
|
null, "Circle", center, this.calculateDestinationPointMap(
|
||||||
center, 0, quatros.getQuarters()[1]), "Arc", 1, 90, 180);
|
center, 0, quatros.getQuarters()[1]), "Arc", 1, 90, 180);
|
||||||
|
@ -1704,6 +1765,121 @@ public class DisplayElementFactory {
|
||||||
return slist;
|
return slist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a list of IDisplayable Objects from an IArc object using
|
||||||
|
* dashed-line.
|
||||||
|
*
|
||||||
|
* @param arc
|
||||||
|
* A PGEN Drawable Element of an arc object
|
||||||
|
* @param paintProps
|
||||||
|
* The paint properties associated with the target
|
||||||
|
* @param dashlength
|
||||||
|
* length of dash segment in screen pixel.
|
||||||
|
* @return A list of IDisplayable elements
|
||||||
|
*/
|
||||||
|
public ArrayList<IDisplayable> createDisplayElements(IArc arc,
|
||||||
|
PaintProperties paintProps, double dashlength) {
|
||||||
|
setScales(paintProps);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create the List to be returned, and wireframe shape
|
||||||
|
*/
|
||||||
|
ArrayList<IDisplayable> slist = new ArrayList<IDisplayable>();
|
||||||
|
IWireframeShape arcpts = target
|
||||||
|
.createWireframeShape(false, iDescriptor);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Convert center and circumference point from lat/lon to pixel
|
||||||
|
* coordinates.
|
||||||
|
*/
|
||||||
|
double[] tmp = { arc.getCenterPoint().x, arc.getCenterPoint().y, 0.0 };
|
||||||
|
double[] center = iDescriptor.worldToPixel(tmp);
|
||||||
|
double[] tmp2 = { arc.getCircumferencePoint().x,
|
||||||
|
arc.getCircumferencePoint().y, 0.0 };
|
||||||
|
double[] circum = iDescriptor.worldToPixel(tmp2);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* calculate angle of major axis
|
||||||
|
*/
|
||||||
|
double axisAngle = Math.toDegrees(Math.atan2((circum[1] - center[1]),
|
||||||
|
(circum[0] - center[0])));
|
||||||
|
double cosineAxis = Math.cos(Math.toRadians(axisAngle));
|
||||||
|
double sineAxis = Math.sin(Math.toRadians(axisAngle));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* calculate half lengths of major and minor axes
|
||||||
|
*/
|
||||||
|
double diff[] = { circum[0] - center[0], circum[1] - center[1] };
|
||||||
|
double major = Math.sqrt((diff[0] * diff[0]) + (diff[1] * diff[1]));
|
||||||
|
double minor = major * arc.getAxisRatio();
|
||||||
|
|
||||||
|
// calculate length of a single dash segment in degree.
|
||||||
|
double deltaAngle = (dashlength / (major / this.screenToExtent)) * 180;
|
||||||
|
int deltaA = (int) Math.round(deltaAngle);
|
||||||
|
if (deltaA <= 1)
|
||||||
|
deltaA = 2;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Calculate points along the arc
|
||||||
|
*/
|
||||||
|
double angle = arc.getStartAngle();
|
||||||
|
int numpts = (int) Math.round(arc.getEndAngle() - arc.getStartAngle()
|
||||||
|
+ 1.0);
|
||||||
|
double[][] path = new double[deltaA + 1][3];
|
||||||
|
int kk = 0;
|
||||||
|
boolean dash = false;
|
||||||
|
|
||||||
|
for (int j = 0; j < numpts; j++) {
|
||||||
|
|
||||||
|
if (!dash) {
|
||||||
|
double thisSine = Math.sin(Math.toRadians(angle));
|
||||||
|
double thisCosine = Math.cos(Math.toRadians(angle));
|
||||||
|
// Can maybe use simpler less expensive calculations for circle,
|
||||||
|
// if ever necessary.
|
||||||
|
// if ( arc.getAxisRatio() == 1.0 ) {
|
||||||
|
// path[j][0] = center[0] + (major * thisCosine );
|
||||||
|
// path[j][1] = center[1] + (minor * thisSine );
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
path[kk][0] = center[0] + (major * cosineAxis * thisCosine)
|
||||||
|
- (minor * sineAxis * thisSine);
|
||||||
|
path[kk][1] = center[1] + (major * sineAxis * thisCosine)
|
||||||
|
+ (minor * cosineAxis * thisSine);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// add a line segment for dash line
|
||||||
|
kk++;
|
||||||
|
if (kk - 1 == deltaA) {
|
||||||
|
arcpts.addLineSegment(path);
|
||||||
|
kk = 0;
|
||||||
|
dash = !dash;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// add a blank segement for the dash line
|
||||||
|
kk++;
|
||||||
|
if (kk >= deltaA - 2) {
|
||||||
|
dash = !dash;
|
||||||
|
kk = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
angle += 1.0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create new LineDisplayElement from wireframe shapes and add it to
|
||||||
|
* return list
|
||||||
|
*/
|
||||||
|
arcpts.compile();
|
||||||
|
slist.add(new LineDisplayElement(arcpts, getDisplayColor(arc
|
||||||
|
.getColors()[0]), arc.getLineWidth()));
|
||||||
|
|
||||||
|
// slist.addAll(adjustContourCircleLabel(arc, paintProps, path));
|
||||||
|
|
||||||
|
return slist;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a list of IDisplayable Objects from an IArc object
|
* Creates a list of IDisplayable Objects from an IArc object
|
||||||
*
|
*
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class TcmFcst extends SinglePointElement implements ITcmFcst{
|
||||||
this.fcstHr = fcstHr;
|
this.fcstHr = fcstHr;
|
||||||
this.setLocation(loc);
|
this.setLocation(loc);
|
||||||
winds = new TcmWindQuarters[3];
|
winds = new TcmWindQuarters[3];
|
||||||
winds[0] = new TcmWindQuarters( loc, 32, quatros[0][0], quatros[1][0], quatros[2][0], quatros[3][0]);
|
winds[0] = new TcmWindQuarters( loc, 34, quatros[0][0], quatros[1][0], quatros[2][0], quatros[3][0]);
|
||||||
winds[1] = new TcmWindQuarters( loc, 50, quatros[0][1], quatros[1][1], quatros[2][1], quatros[3][1]);
|
winds[1] = new TcmWindQuarters( loc, 50, quatros[0][1], quatros[1][1], quatros[2][1], quatros[3][1]);
|
||||||
winds[2] = new TcmWindQuarters( loc, 64, quatros[0][2], quatros[1][2], quatros[2][2], quatros[3][2]);
|
winds[2] = new TcmWindQuarters( loc, 64, quatros[0][2], quatros[1][2], quatros[2][2], quatros[3][2]);
|
||||||
|
|
||||||
|
|
|
@ -6,32 +6,31 @@ import java.util.Date;
|
||||||
import com.raytheon.uf.common.time.DataTime;
|
import com.raytheon.uf.common.time.DataTime;
|
||||||
import com.raytheon.uf.viz.core.exception.VizException;
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Model grid attribute sets must allow for a GDATTIM parameter that allows users to control
|
* Model grid attribute sets must allow for a GDATTIM parameter that allows
|
||||||
* the default timeline tic mark pre-selection in terms of forecast hours.
|
* users to control the default timeline tic mark pre-selection in terms of
|
||||||
* Typical use cases would be for precipitation (omit the first forecast hour F00), or when
|
* forecast hours. Typical use cases would be for precipitation (omit the first
|
||||||
* the desk only performs analyses at F06, F12, F18 and F24 but the model data is of a much
|
* forecast hour F00), or when the desk only performs analyses at F06, F12, F18
|
||||||
* higher frequency. These are just two examples.
|
* and F24 but the model data is of a much higher frequency. These are just two
|
||||||
*
|
* examples.
|
||||||
* Valid formats are numerous but currently only the following are implemented:
|
*
|
||||||
*
|
* Valid formats are numerous but currently only the following are implemented:
|
||||||
* LIST: GDATTIM=F1;F2;F3; ... ;Fn (forecast hours separated by semicolons,
|
*
|
||||||
* RANGE: GDATTIM=F1-F2[-INCR] (forecast hour range with an increment)
|
* LIST: GDATTIM=F1;F2;F3; ... ;Fn (forecast hours separated by semicolons,
|
||||||
* ALL: GDATTIM=FALL (all forecast hours)
|
* RANGE: GDATTIM=F1-F2[-INCR] (forecast hour range with an increment) ALL:
|
||||||
*
|
* GDATTIM=FALL (all forecast hours)
|
||||||
* Examples:
|
*
|
||||||
* GDATTIM=F06;F12;F18;F24
|
* Examples: GDATTIM=F06;F12;F18;F24 GDATTIM=F06-F24-6 (same as above)
|
||||||
* GDATTIM=F06-F24-6 (same as above)
|
* GDATTIM=F12-F48-12
|
||||||
* GDATTIM=F12-F48-12
|
*
|
||||||
*
|
|
||||||
* <pre>
|
* <pre>
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- --------------- --------------------------
|
* ------------ ---------- --------------- --------------------------
|
||||||
* 11/28/11 #518 Greg Hull created
|
* 11/28/11 #518 Greg Hull created
|
||||||
* 04/24/13 689 Xiaochuan Add the frame should include end of time.
|
* 04/24/13 689 Xiaochuan Add the frame should include end of time.
|
||||||
|
* 07/23/14 ? B. Yin Handle AllFxx and FirstFxx-LastFxx for grid analysis.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -41,120 +40,127 @@ import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
|
|
||||||
public class SelectableFrameTimeMatcher {
|
public class SelectableFrameTimeMatcher {
|
||||||
|
|
||||||
private boolean matchAll = false;
|
private boolean matchAll = false;
|
||||||
|
|
||||||
private final Integer MAX_FCST_HR = 384;
|
|
||||||
|
|
||||||
private ArrayList<DataTime> selectableTimes = new ArrayList<DataTime>();
|
|
||||||
|
|
||||||
|
|
||||||
|
private final Integer MAX_FCST_HR = 384;
|
||||||
public SelectableFrameTimeMatcher( String timeMatchStr ) throws VizException {
|
|
||||||
|
|
||||||
// parse the string and create a list of times
|
|
||||||
//
|
|
||||||
if( timeMatchStr == null || timeMatchStr.isEmpty() ) {
|
|
||||||
throw new VizException("SelectableFrameTimeMatcher: null/empty string");
|
|
||||||
}
|
|
||||||
|
|
||||||
timeMatchStr = timeMatchStr.toLowerCase().trim();
|
|
||||||
|
|
||||||
if( timeMatchStr.equals( "fall") ) {
|
|
||||||
matchAll = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String[] subStrs = timeMatchStr.split(";");
|
|
||||||
|
|
||||||
// each semi-colon delimited subString may be either
|
|
||||||
// a range or single time.
|
|
||||||
//
|
|
||||||
for( String subStr : subStrs ) {
|
|
||||||
|
|
||||||
// if matching a range of times
|
|
||||||
//
|
|
||||||
if( subStr.indexOf('-') > 0 ) {
|
|
||||||
String startEndIncrStrs[] = subStr.split("-");
|
|
||||||
if( startEndIncrStrs.length < 2 ||
|
|
||||||
startEndIncrStrs.length > 3 ) {
|
|
||||||
// System.out.println("Error Parsing GDATTIME string "+timeMatchStr );
|
|
||||||
throw new VizException("SelectableFrameTimeMatcher: Error Parsing GDATTIME string: "
|
|
||||||
+ timeMatchStr);
|
|
||||||
}
|
|
||||||
|
|
||||||
DataTime startTime = parseTime( startEndIncrStrs[0].trim() );
|
|
||||||
DataTime endTime = parseTime( startEndIncrStrs[1].trim() );
|
|
||||||
|
|
||||||
if( startTime == null || endTime == null ) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Integer incr = 60*60;
|
|
||||||
|
|
||||||
if( startEndIncrStrs.length > 2 ) {
|
private ArrayList<DataTime> selectableTimes = new ArrayList<DataTime>();
|
||||||
incr = Integer.parseInt( startEndIncrStrs[2].trim() ) * 60 * 60;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Note : this logic will need to change when we add parsing of
|
|
||||||
// full GDATTIM syntax.
|
|
||||||
for( Integer f = startTime.getFcstTime() ; f <= endTime.getFcstTime() ; f += incr ) {
|
|
||||||
selectableTimes.add(
|
|
||||||
new DataTime( startTime.getRefTime(), f ));
|
|
||||||
|
|
||||||
}
|
public SelectableFrameTimeMatcher(String timeMatchStr) throws VizException {
|
||||||
|
|
||||||
}
|
// parse the string and create a list of times
|
||||||
else { // else if matching a single time
|
//
|
||||||
DataTime dt = parseTime( subStr.trim() );
|
if (timeMatchStr == null || timeMatchStr.isEmpty()) {
|
||||||
|
throw new VizException(
|
||||||
if( dt != null ) {
|
"SelectableFrameTimeMatcher: null/empty string");
|
||||||
selectableTimes.add( dt );
|
}
|
||||||
}
|
|
||||||
}
|
timeMatchStr = timeMatchStr.toLowerCase().trim();
|
||||||
}
|
|
||||||
}
|
if (timeMatchStr.equals("fall")) {
|
||||||
|
matchAll = true;
|
||||||
// Currently only parsing forecast times.
|
return;
|
||||||
//
|
}
|
||||||
private DataTime parseTime( String timeStr ) throws VizException {
|
|
||||||
//DataTime parsedTime = new DataTime();
|
// for grid analysis GDATTIM in format "ALLFxx" or "FIRSTFxx-LASTFxx"
|
||||||
|
if (timeMatchStr.toUpperCase().contains("ALLF")
|
||||||
if( timeStr.startsWith("f") ) {
|
|| (timeMatchStr.toUpperCase().contains("FIRSTF") && timeMatchStr
|
||||||
Integer fcstHr = Integer.parseInt( timeStr.substring(1) );
|
.toUpperCase().contains("LASTF"))) {
|
||||||
|
matchAll = true;
|
||||||
// 'null' refTime and fcst time in seconds
|
return;
|
||||||
return new DataTime( new Date(0), fcstHr*60*60 ); //
|
}
|
||||||
}
|
|
||||||
else if( timeStr.equals("last") ) {
|
String[] subStrs = timeMatchStr.split(";");
|
||||||
// 'null' refTime and fcst time in seconds
|
|
||||||
return new DataTime( new Date(0), MAX_FCST_HR*60*60 ); //
|
// each semi-colon delimited subString may be either
|
||||||
}
|
// a range or single time.
|
||||||
else {
|
//
|
||||||
// System.out.println("SelectableFrameTimeMatcher can't parse GDATTIM token"+timeStr);
|
for (String subStr : subStrs) {
|
||||||
throw new VizException("SelectableFrameTimeMatcher: Error Parsing GDATTIME token: "
|
|
||||||
+ timeStr);
|
// if matching a range of times
|
||||||
}
|
//
|
||||||
}
|
if (subStr.indexOf('-') > 0) {
|
||||||
|
String startEndIncrStrs[] = subStr.split("-");
|
||||||
public boolean matchTime( DataTime dataTime ) {
|
if (startEndIncrStrs.length < 2 || startEndIncrStrs.length > 3) {
|
||||||
if( matchAll ) {
|
// System.out.println("Error Parsing GDATTIME string "+timeMatchStr
|
||||||
return true;
|
// );
|
||||||
}
|
throw new VizException(
|
||||||
|
"SelectableFrameTimeMatcher: Error Parsing GDATTIME string: "
|
||||||
for( DataTime dt : selectableTimes ) {
|
+ timeMatchStr);
|
||||||
|
}
|
||||||
// TODO : add check for ref time later. For now just test the forecast times.
|
|
||||||
//
|
DataTime startTime = parseTime(startEndIncrStrs[0].trim());
|
||||||
// if( dt.getRefTime() != null ) {
|
DataTime endTime = parseTime(startEndIncrStrs[1].trim());
|
||||||
//
|
|
||||||
// }
|
if (startTime == null || endTime == null) {
|
||||||
|
continue;
|
||||||
if( dt.getFcstTime() == dataTime.getFcstTime() ) {
|
}
|
||||||
return true;
|
|
||||||
}
|
Integer incr = 60 * 60;
|
||||||
}
|
|
||||||
|
if (startEndIncrStrs.length > 2) {
|
||||||
return false;
|
incr = Integer.parseInt(startEndIncrStrs[2].trim()) * 60 * 60;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Note : this logic will need to change when we add parsing of
|
||||||
|
// full GDATTIM syntax.
|
||||||
|
for (Integer f = startTime.getFcstTime(); f <= endTime
|
||||||
|
.getFcstTime(); f += incr) {
|
||||||
|
selectableTimes
|
||||||
|
.add(new DataTime(startTime.getRefTime(), f));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} else { // else if matching a single time
|
||||||
|
DataTime dt = parseTime(subStr.trim());
|
||||||
|
|
||||||
|
if (dt != null) {
|
||||||
|
selectableTimes.add(dt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Currently only parsing forecast times.
|
||||||
|
//
|
||||||
|
private DataTime parseTime(String timeStr) throws VizException {
|
||||||
|
// DataTime parsedTime = new DataTime();
|
||||||
|
|
||||||
|
if (timeStr.startsWith("f")) {
|
||||||
|
Integer fcstHr = Integer.parseInt(timeStr.substring(1));
|
||||||
|
|
||||||
|
// 'null' refTime and fcst time in seconds
|
||||||
|
return new DataTime(new Date(0), fcstHr * 60 * 60); //
|
||||||
|
} else if (timeStr.equals("last")) {
|
||||||
|
// 'null' refTime and fcst time in seconds
|
||||||
|
return new DataTime(new Date(0), MAX_FCST_HR * 60 * 60); //
|
||||||
|
} else {
|
||||||
|
// System.out.println("SelectableFrameTimeMatcher can't parse GDATTIM token"+timeStr);
|
||||||
|
throw new VizException(
|
||||||
|
"SelectableFrameTimeMatcher: Error Parsing GDATTIME token: "
|
||||||
|
+ timeStr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean matchTime(DataTime dataTime) {
|
||||||
|
if (matchAll) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (DataTime dt : selectableTimes) {
|
||||||
|
|
||||||
|
// TODO : add check for ref time later. For now just test the
|
||||||
|
// forecast times.
|
||||||
|
//
|
||||||
|
// if( dt.getRefTime() != null ) {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (dt.getFcstTime() == dataTime.getFcstTime()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<AttributeSetGroup xmlns:ns2="http://www.example.org/productType" xmlns:ns3="group">
|
||||||
|
<resource>ECMWF0P25</resource>
|
||||||
|
<attrSetGroupName>standard</attrSetGroupName>
|
||||||
|
<attrSetNames>500mb_hght_geoabsv,850mb_tmp,ethkn,pmsl_ethkn</attrSetNames>
|
||||||
|
</AttributeSetGroup>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<AttributeSetGroup xmlns:ns2="http://www.example.org/productType" xmlns:ns3="group">
|
||||||
|
<resource>ECMWF_HR</resource>
|
||||||
|
<attrSetGroupName>standard</attrSetGroupName>
|
||||||
|
<attrSetNames>500mb_hght_geoabsv,850mb_tmp,ethkn,pmsl_ethkn</attrSetNames>
|
||||||
|
</AttributeSetGroup>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<AttributeSetGroup xmlns:ns2="http://www.example.org/productType">
|
||||||
|
<resource>GFS0P5</resource>
|
||||||
|
<attrSetGroupName>basic_wx</attrSetGroupName>
|
||||||
|
<attrSetNames>1000-470mb_rh_rs_t_700mb_vv_global,1000-500mb_rh,200mb_vorticity_pw,250mb_vorticity_pw,300-700_q-vctrs_thkn,300mb_vorticity_pw,bl_thte_wind_global,ct_index_global,great_lakes_snow_global,great_lakes_snow2_global,lifted_index_global,pmsl_thkn_wind,pmsl_1000-850_thk_global,pmsl_bl_temp_wind,precip_6hr_1000-500_thkn,precip_type_global,precip_type_vv_global,pmsl_thkn</attrSetNames>
|
||||||
|
</AttributeSetGroup>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<AttributeSetGroup xmlns:ns2="http://www.example.org/productType" xmlns:ns3="group">
|
||||||
|
<resource>GFS0P5</resource>
|
||||||
|
<attrSetGroupName>hurricane</attrSetGroupName>
|
||||||
|
<attrSetNames>250mb_hght_wind,250mb_wind_and_rel_vort,500mb_hght_absv,500mb_wind_and_rel_vort,700mb_wind_and_rel_vort,850-300mb_wind_shear,850mb_wind_and_rel_vort</attrSetNames>
|
||||||
|
</AttributeSetGroup>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<AttributeSetGroup xmlns:ns2="http://www.example.org/productType" xmlns:ns3="group">
|
||||||
|
<resource>GFS0P5</resource>
|
||||||
|
<attrSetGroupName>intl_sam</attrSetGroupName>
|
||||||
|
<attrSetNames>bl_2-meter_temp_c,bl_dwpt_c,svrwx_intl</attrSetNames>
|
||||||
|
</AttributeSetGroup>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<AttributeSetGroup xmlns:ns2="http://www.example.org/productType" xmlns:ns3="group">
|
||||||
|
<resource>GFS0P5</resource>
|
||||||
|
<attrSetGroupName>marine</attrSetGroupName>
|
||||||
|
<attrSetNames>1000mb_hght_absv,500mb_hght_absv,850mb_hght_absv,bl_moisture_conv_thtae,pmsl_1000-850_thk_global,pmsl_bl_temp_wind,pmsl_and_bl_wind_global,pmsl_and_bl_wind_global,precip_water_pmsl,stability_850mb_wnd_global,stability_950mb_wnd</attrSetNames>
|
||||||
|
</AttributeSetGroup>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<AttributeSetGroup xmlns:ns2="http://www.example.org/productType" xmlns:ns3="group">
|
||||||
|
<resource>GFS0P5</resource>
|
||||||
|
<attrSetGroupName>medr</attrSetGroupName>
|
||||||
|
<attrSetNames>1000-500_thkn,bl_1000mb_temp,bl_2-meter_temp,bl_sgma_9950_temp</attrSetNames>
|
||||||
|
</AttributeSetGroup>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<AttributeSetGroup xmlns:ns2="http://www.example.org/productType" xmlns:ns3="group">
|
||||||
|
<resource>GFS0P5</resource>
|
||||||
|
<attrSetGroupName>misc</attrSetGroupName>
|
||||||
|
<attrSetNames>300-700_q-vctrs_thkn</attrSetNames>
|
||||||
|
</AttributeSetGroup>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<AttributeSetGroup xmlns:ns2="http://www.example.org/productType" xmlns:ns3="group">
|
||||||
|
<resource>GFS0P5</resource>
|
||||||
|
<attrSetGroupName>monochrome</attrSetGroupName>
|
||||||
|
<attrSetNames>bl_thte_wind_mono_global,pmsl_thkn_wind_mono_global</attrSetNames>
|
||||||
|
</AttributeSetGroup>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<AttributeSetGroup xmlns:ns2="http://www.example.org/productType" xmlns:ns3="group">
|
||||||
|
<resource>GFS0P5</resource>
|
||||||
|
<attrSetGroupName>no_col-fill</attrSetGroupName>
|
||||||
|
<attrSetNames>250mb_hght_wind_ncf,400mb_avg_rh_ncf,500mb_absv_ncf,500mb_hght_absv_ncf,700mb_hght_rh_omega_ncf,850mb_hght_tmp_wind_ncf,850mb_wind_pw,850mb_wind_pw_mm_ncf,bl_h2o_conv_ncf_global,lifted_index_ncf,pcpn_potential_ncf_global,precip_type_vv_ncf_global</attrSetNames>
|
||||||
|
</AttributeSetGroup>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<AttributeSetGroup xmlns:ns2="http://www.example.org/productType">
|
||||||
|
<resource>GFS0P5</resource>
|
||||||
|
<attrSetGroupName>precip</attrSetGroupName>
|
||||||
|
<attrSetNames>precip_12hr,precip_12hr_mm,precip_24hr,precip_24hr_mm,precip_3-day,precip_4-day,precip_48hr,precip_5-day,precip_54hr,precip_60hr,precip_66hr,precip_6hr,precip_6hr_mslp,precip_6hr_mslp_sfchght,precip_6hr_mslphilo,precip_72hr,precip_78hr</attrSetNames>
|
||||||
|
</AttributeSetGroup>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<AttributeSetGroup xmlns:ns2="http://www.example.org/productType" xmlns:ns3="group">
|
||||||
|
<resource>GFS0P5</resource>
|
||||||
|
<attrSetGroupName>qpf</attrSetGroupName>
|
||||||
|
<attrSetNames>300mb_ageo_div_isotachs,700mb_hght_wind_dwpt,850mb_h2o_transport,850mb_hght_wind_dwpt,850mb_thtae_advection,850mb_wind_pw,bl_moistconv_wind_dwpt_global,kindex_700mbtemp_bldwpt_mslp_global,lifted_index_global,pcpn_potential_global,pw_emsl_c-vec,ransnocsi_500-850,ransnocsi_700-850,svrwx_global,hud_hvyqpf_stnd</attrSetNames>
|
||||||
|
</AttributeSetGroup>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<AttributeSetGroup xmlns:ns2="http://www.example.org/productType">
|
||||||
|
<resource>GFS0P5</resource>
|
||||||
|
<attrSetGroupName>standard</attrSetGroupName>
|
||||||
|
<attrSetNames>1000-500_thkn,1000-850_thkn,1000mb_hght_tmp_wind,100mb_hght_wind,150mb_hght_wind,200mb_div_isotachs,200mb_hght_wind,250mb_ageo_div_isotachs,250mb_hght_wind,250mb_wind_and_rel_vort,300mb_div_isotachs,300mb_hght_absv_adv,300mb_hght_wind,300mb_hght_tmp_wind,500mb_hght_absv,500mb_hght_absv_adv,500mb_hght_absv_wnd,500mb_hght_color,500mb_hght_geoabsv,500mb_hght_wind,500mb_hght_tmp_wind,50mb_hght_wind,600mb_hght_rh_omega,700mb_hght_rh_omega,700mb_hght_tmp_wind,700mb_rh_rs_temp_global,70mb_hght_wind,850-700_thkn,850mb_hght_tmp_wind,pmsl,pmsl_thkn,pmsl_and_bl_wind_global,300-200mb_pv,400-200mb_pv,400-250mb_pv_global,500-250mb_pv,500-300mb_pv,500mb_hght</attrSetNames>
|
||||||
|
</AttributeSetGroup>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<AttributeSetGroup xmlns:ns2="http://www.example.org/productType" xmlns:ns3="group">
|
||||||
|
<resource>GFS0P5</resource>
|
||||||
|
<attrSetGroupName>surface</attrSetGroupName>
|
||||||
|
<attrSetNames>1000-500_thkn,1000-850_thkn,500mb_absv_ncf,500mb_hght,850-700_thkn,850mb_thtae_ncf,bl_thte_ncf,pmsl</attrSetNames>
|
||||||
|
</AttributeSetGroup>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<AttributeSetGroup xmlns:ns2="http://www.example.org/productType" xmlns:ns3="group">
|
||||||
|
<resource>GFS0P5</resource>
|
||||||
|
<attrSetGroupName>tropical</attrSetGroupName>
|
||||||
|
<attrSetNames>1000-500mb_rh,500mb_hght_absv,850-300mb_wind_shear,850mb_wind_pw_mm,bl_moisture_conv_thtae,bl_thte_wind_global,mlw_pmsl,pmsl_bl_temp_wind,pmsl_thkn_850mb_wind,pmsl_and_bl_wind_global,precip_water_pmsl,precip_water_pmsl_mm</attrSetNames>
|
||||||
|
</AttributeSetGroup>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<AttributeSetGroup xmlns:ns2="http://www.example.org/productType">
|
||||||
|
<resource>RTMA_HR</resource>
|
||||||
|
<attrSetGroupName>standard</attrSetGroupName>
|
||||||
|
<attrSetNames>surface_pressure</attrSetNames>
|
||||||
|
</AttributeSetGroup>
|
|
@ -21,7 +21,7 @@
|
||||||
<Position>LR</Position>
|
<Position>LR</Position>
|
||||||
<Color red="205" green="133" blue="0"/>
|
<Color red="205" green="133" blue="0"/>
|
||||||
</PlotModelElement>
|
</PlotModelElement>
|
||||||
<PlotModelElement symbolSize="2" textStyle="Bold" textFont="Courier" textSize="14" paramName="BRBK">
|
<PlotModelElement symbolSize="1" textStyle="Bold" textFont="Courier" textSize="14" paramName="BRBK">
|
||||||
<Position>WD</Position>
|
<Position>WD</Position>
|
||||||
<Color red="0" green="255" blue="255"/>
|
<Color red="0" green="255" blue="255"/>
|
||||||
</PlotModelElement>
|
</PlotModelElement>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
<predefinedArea areaName="Africa" mapCenter="38.00 3.0 0.0">
|
<predefinedArea areaName="Africa" mapCenter="18.00 3.0 0.0">
|
||||||
<zoomLevel>.22</zoomLevel>
|
<zoomLevel>.36</zoomLevel>
|
||||||
<gridGeometry envelopeMaxY="1.3E7" envelopeMinY="-1.3E7" envelopeMaxX="2.0E7" envelopeMinX="-2.0E7" rangeY="0 9999" rangeX="0 15384">
|
<gridGeometry envelopeMaxY="1.3E7" envelopeMinY="-1.3E7" envelopeMaxX="2.0E7" envelopeMinX="-2.0E7" rangeY="0 9999" rangeX="0 15384">
|
||||||
<CRS>PROJCS["Mercator_1SP",
|
<CRS>PROJCS["Mercator_1SP",
|
||||||
GEOGCS["WGS84",
|
GEOGCS["WGS84",
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
PARAMETER["semi_major", 6371200.0],
|
PARAMETER["semi_major", 6371200.0],
|
||||||
PARAMETER["semi_minor", 6371200.0],
|
PARAMETER["semi_minor", 6371200.0],
|
||||||
PARAMETER["latitude_of_origin", 0.0],
|
PARAMETER["latitude_of_origin", 0.0],
|
||||||
PARAMETER["central_meridian", -180.0],
|
PARAMETER["central_meridian", 0.0],
|
||||||
PARAMETER["scale_factor", 1.0],
|
PARAMETER["scale_factor", 1.0],
|
||||||
PARAMETER["false_easting", 0.0],
|
PARAMETER["false_easting", 0.0],
|
||||||
PARAMETER["false_northing", 0.0],
|
PARAMETER["false_northing", 0.0],
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<ResourceDefinition xmlns:ns2="group" xmlns:ns3="http://www.example.org/productType">
|
||||||
|
<inventoryEnabled>true</inventoryEnabled>
|
||||||
|
<resourceDefnName>ECMWF0P25</resourceDefnName>
|
||||||
|
<resourceCategory>GRID</resourceCategory>
|
||||||
|
<resourceParameters>
|
||||||
|
GDFILE=ecmwf0p25
|
||||||
|
pluginName=grid
|
||||||
|
</resourceParameters>
|
||||||
|
<rscImplementation>ModelFcstGridContours</rscImplementation>
|
||||||
|
<subTypeGenerator></subTypeGenerator>
|
||||||
|
<rscTypeGenerator></rscTypeGenerator>
|
||||||
|
<timeMatchMethod>CLOSEST_BEFORE_OR_AFTER</timeMatchMethod>
|
||||||
|
<frameSpan>60</frameSpan>
|
||||||
|
<timelineGenMethod>USE_CYCLE_TIME_FCST_HOURS</timelineGenMethod>
|
||||||
|
<dfltFrameCount>999</dfltFrameCount>
|
||||||
|
<dfltTimeRange>48</dfltTimeRange>
|
||||||
|
<dfltGeogArea>BasicWX_US</dfltGeogArea>
|
||||||
|
</ResourceDefinition>
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<ResourceDefinition xmlns:ns2="http://www.example.org/productType">
|
||||||
|
<resourceDefnName>ECMWF_HR</resourceDefnName>
|
||||||
|
<resourceCategory>GRID</resourceCategory>
|
||||||
|
<rscImplementation>ModelFcstGridContours</rscImplementation>
|
||||||
|
<subTypeGenerator></subTypeGenerator>
|
||||||
|
<rscTypeGenerator></rscTypeGenerator>
|
||||||
|
<timeMatchMethod>CLOSEST_BEFORE_OR_AFTER</timeMatchMethod>
|
||||||
|
<frameSpan>60</frameSpan>
|
||||||
|
<timelineGenMethod>USE_CYCLE_TIME_FCST_HOURS</timelineGenMethod>
|
||||||
|
<dfltFrameCount>999</dfltFrameCount>
|
||||||
|
<dfltTimeRange>48</dfltTimeRange>
|
||||||
|
<dfltGeogArea>BasicWX_US</dfltGeogArea>
|
||||||
|
<resourceParameters>
|
||||||
|
pluginName=grid
|
||||||
|
GDFILE=ecmwfP25
|
||||||
|
</resourceParameters>
|
||||||
|
<inventoryEnabled>true</inventoryEnabled>
|
||||||
|
</ResourceDefinition>
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<ResourceDefinition xmlns:ns2="group" xmlns:ns3="http://www.example.org/productType">
|
||||||
|
<inventoryEnabled>true</inventoryEnabled>
|
||||||
|
<resourceDefnName>GFS0P5</resourceDefnName>
|
||||||
|
<resourceCategory>GRID</resourceCategory>
|
||||||
|
<resourceParameters>
|
||||||
|
GDFILE=GFS230
|
||||||
|
pluginName=grid
|
||||||
|
</resourceParameters>
|
||||||
|
<rscImplementation>ModelFcstGridContours</rscImplementation>
|
||||||
|
<subTypeGenerator></subTypeGenerator>
|
||||||
|
<rscTypeGenerator></rscTypeGenerator>
|
||||||
|
<timeMatchMethod>CLOSEST_BEFORE_OR_AFTER</timeMatchMethod>
|
||||||
|
<frameSpan>60</frameSpan>
|
||||||
|
<timelineGenMethod>USE_CYCLE_TIME_FCST_HOURS</timelineGenMethod>
|
||||||
|
<dfltFrameCount>999</dfltFrameCount>
|
||||||
|
<dfltTimeRange>384</dfltTimeRange>
|
||||||
|
<dfltGeogArea>BasicWX_US</dfltGeogArea>
|
||||||
|
</ResourceDefinition>
|
|
@ -10,6 +10,7 @@ color=RGB {155, 155, 155}
|
||||||
<rscImplementation>SVRL</rscImplementation>
|
<rscImplementation>SVRL</rscImplementation>
|
||||||
<subTypeGenerator></subTypeGenerator>
|
<subTypeGenerator></subTypeGenerator>
|
||||||
<rscTypeGenerator></rscTypeGenerator>
|
<rscTypeGenerator></rscTypeGenerator>
|
||||||
|
<timeMatchMethod>EVENT</timeMatchMethod>
|
||||||
<frameSpan>10</frameSpan>
|
<frameSpan>10</frameSpan>
|
||||||
<timelineGenMethod>USE_FRAME_INTERVAL</timelineGenMethod>
|
<timelineGenMethod>USE_FRAME_INTERVAL</timelineGenMethod>
|
||||||
<dfltFrameCount>37</dfltFrameCount>
|
<dfltFrameCount>37</dfltFrameCount>
|
||||||
|
|
|
@ -10,6 +10,7 @@ color=RGB {155, 155, 155}
|
||||||
<rscImplementation>Warn</rscImplementation>
|
<rscImplementation>Warn</rscImplementation>
|
||||||
<subTypeGenerator></subTypeGenerator>
|
<subTypeGenerator></subTypeGenerator>
|
||||||
<rscTypeGenerator></rscTypeGenerator>
|
<rscTypeGenerator></rscTypeGenerator>
|
||||||
|
<timeMatchMethod>EVENT</timeMatchMethod>
|
||||||
<frameSpan>10</frameSpan>
|
<frameSpan>10</frameSpan>
|
||||||
<timelineGenMethod>USE_FRAME_INTERVAL</timelineGenMethod>
|
<timelineGenMethod>USE_FRAME_INTERVAL</timelineGenMethod>
|
||||||
<dfltFrameCount>37</dfltFrameCount>
|
<dfltFrameCount>37</dfltFrameCount>
|
||||||
|
|
|
@ -13,6 +13,7 @@ legendName=WATCH
|
||||||
<rscImplementation>WATCH</rscImplementation>
|
<rscImplementation>WATCH</rscImplementation>
|
||||||
<subTypeGenerator></subTypeGenerator>
|
<subTypeGenerator></subTypeGenerator>
|
||||||
<rscTypeGenerator></rscTypeGenerator>
|
<rscTypeGenerator></rscTypeGenerator>
|
||||||
|
<timeMatchMethod>EVENT</timeMatchMethod>
|
||||||
<frameSpan>10</frameSpan>
|
<frameSpan>10</frameSpan>
|
||||||
<timelineGenMethod>USE_FRAME_INTERVAL</timelineGenMethod>
|
<timelineGenMethod>USE_FRAME_INTERVAL</timelineGenMethod>
|
||||||
<dfltFrameCount>37</dfltFrameCount>
|
<dfltFrameCount>37</dfltFrameCount>
|
||||||
|
|
|
@ -10,6 +10,7 @@ color=RGB {155, 155, 155}
|
||||||
<rscImplementation>WCN</rscImplementation>
|
<rscImplementation>WCN</rscImplementation>
|
||||||
<subTypeGenerator></subTypeGenerator>
|
<subTypeGenerator></subTypeGenerator>
|
||||||
<rscTypeGenerator></rscTypeGenerator>
|
<rscTypeGenerator></rscTypeGenerator>
|
||||||
|
<timeMatchMethod>EVENT</timeMatchMethod>
|
||||||
<frameSpan>10</frameSpan>
|
<frameSpan>10</frameSpan>
|
||||||
<timelineGenMethod>USE_FRAME_INTERVAL</timelineGenMethod>
|
<timelineGenMethod>USE_FRAME_INTERVAL</timelineGenMethod>
|
||||||
<dfltFrameCount>37</dfltFrameCount>
|
<dfltFrameCount>37</dfltFrameCount>
|
||||||
|
|
|
@ -10,6 +10,7 @@ color=RGB {0, 100, 255}
|
||||||
<rscImplementation>WCP</rscImplementation>
|
<rscImplementation>WCP</rscImplementation>
|
||||||
<subTypeGenerator></subTypeGenerator>
|
<subTypeGenerator></subTypeGenerator>
|
||||||
<rscTypeGenerator></rscTypeGenerator>
|
<rscTypeGenerator></rscTypeGenerator>
|
||||||
|
<timeMatchMethod>EVENT</timeMatchMethod>
|
||||||
<frameSpan>10</frameSpan>
|
<frameSpan>10</frameSpan>
|
||||||
<timelineGenMethod>USE_FRAME_INTERVAL</timelineGenMethod>
|
<timelineGenMethod>USE_FRAME_INTERVAL</timelineGenMethod>
|
||||||
<dfltFrameCount>37</dfltFrameCount>
|
<dfltFrameCount>37</dfltFrameCount>
|
||||||
|
|
|
@ -10,6 +10,7 @@ color=RGB {155, 155, 155}
|
||||||
<rscImplementation>WOU</rscImplementation>
|
<rscImplementation>WOU</rscImplementation>
|
||||||
<subTypeGenerator></subTypeGenerator>
|
<subTypeGenerator></subTypeGenerator>
|
||||||
<rscTypeGenerator></rscTypeGenerator>
|
<rscTypeGenerator></rscTypeGenerator>
|
||||||
|
<timeMatchMethod>EVENT</timeMatchMethod>
|
||||||
<frameSpan>10</frameSpan>
|
<frameSpan>10</frameSpan>
|
||||||
<timelineGenMethod>USE_FRAME_INTERVAL</timelineGenMethod>
|
<timelineGenMethod>USE_FRAME_INTERVAL</timelineGenMethod>
|
||||||
<dfltFrameCount>37</dfltFrameCount>
|
<dfltFrameCount>37</dfltFrameCount>
|
||||||
|
|
|
@ -11,6 +11,7 @@ legendColor=RGB {255, 255, 255}
|
||||||
<rscImplementation>WSTM</rscImplementation>
|
<rscImplementation>WSTM</rscImplementation>
|
||||||
<subTypeGenerator></subTypeGenerator>
|
<subTypeGenerator></subTypeGenerator>
|
||||||
<rscTypeGenerator></rscTypeGenerator>
|
<rscTypeGenerator></rscTypeGenerator>
|
||||||
|
<timeMatchMethod>EVENT</timeMatchMethod>
|
||||||
<frameSpan>30</frameSpan>
|
<frameSpan>30</frameSpan>
|
||||||
<timelineGenMethod>USE_FRAME_INTERVAL</timelineGenMethod>
|
<timelineGenMethod>USE_FRAME_INTERVAL</timelineGenMethod>
|
||||||
<dfltFrameCount>25</dfltFrameCount>
|
<dfltFrameCount>25</dfltFrameCount>
|
||||||
|
|
|
@ -95,6 +95,9 @@
|
||||||
<ResourceDefinitionFilter isEnabled="true" rscDefnName="SHIP">
|
<ResourceDefinitionFilter isEnabled="true" rscDefnName="SHIP">
|
||||||
<filters>Observed</filters>
|
<filters>Observed</filters>
|
||||||
</ResourceDefinitionFilter>
|
</ResourceDefinitionFilter>
|
||||||
|
<ResourceDefinitionFilter isEnabled="true" rscDefnName="SHIP6HR">
|
||||||
|
<filters>Observed</filters>
|
||||||
|
</ResourceDefinitionFilter>
|
||||||
<!-- PGEN Display Resources -->
|
<!-- PGEN Display Resources -->
|
||||||
<ResourceDefinitionFilter isEnabled="true" rscDefnName="CCFP">
|
<ResourceDefinitionFilter isEnabled="true" rscDefnName="CCFP">
|
||||||
<filters>CCFP</filters>
|
<filters>CCFP</filters>
|
||||||
|
@ -913,7 +916,13 @@
|
||||||
<filters>Forecast,Ensemble,SBN</filters>
|
<filters>Forecast,Ensemble,SBN</filters>
|
||||||
</ResourceDefinitionFilter>
|
</ResourceDefinitionFilter>
|
||||||
<ResourceDefinitionFilter isEnabled="true" rscDefnName="ECMWF_NH">
|
<ResourceDefinitionFilter isEnabled="true" rscDefnName="ECMWF_NH">
|
||||||
|
</ResourceDefinitionFilter>
|
||||||
<filters>Forecast,SBN</filters>
|
<filters>Forecast,SBN</filters>
|
||||||
|
<ResourceDefinitionFilter isEnabled="true" rscDefnName="ECMWF_HR">
|
||||||
|
<filters>Forecast,NSBN</filters>
|
||||||
|
</ResourceDefinitionFilter>
|
||||||
|
<ResourceDefinitionFilter isEnabled="true" rscDefnName="ECMWF0P25">
|
||||||
|
<filters>Forecast,NSBN</filters>
|
||||||
</ResourceDefinitionFilter>
|
</ResourceDefinitionFilter>
|
||||||
<ResourceDefinitionFilter isEnabled="true" rscDefnName="RAP40">
|
<ResourceDefinitionFilter isEnabled="true" rscDefnName="RAP40">
|
||||||
<filters>Forecast,Regional,SBN</filters>
|
<filters>Forecast,Regional,SBN</filters>
|
||||||
|
@ -936,6 +945,9 @@
|
||||||
<ResourceDefinitionFilter isEnabled="true" rscDefnName="GFS">
|
<ResourceDefinitionFilter isEnabled="true" rscDefnName="GFS">
|
||||||
<filters>Forecast,Global</filters>
|
<filters>Forecast,Global</filters>
|
||||||
</ResourceDefinitionFilter>
|
</ResourceDefinitionFilter>
|
||||||
|
<ResourceDefinitionFilter isEnabled="true" rscDefnName="GFS0P5">
|
||||||
|
<filters>Forecast,Global</filters>
|
||||||
|
</ResourceDefinitionFilter>
|
||||||
<ResourceDefinitionFilter isEnabled="true" rscDefnName="UKENS_NA">
|
<ResourceDefinitionFilter isEnabled="true" rscDefnName="UKENS_NA">
|
||||||
<filters>Forecast,Ensemble</filters>
|
<filters>Forecast,Ensemble</filters>
|
||||||
</ResourceDefinitionFilter>
|
</ResourceDefinitionFilter>
|
||||||
|
@ -1344,10 +1356,10 @@
|
||||||
<ResourceDefinitionFilter isEnabled="false" rscDefnName="METEOSAT8">
|
<ResourceDefinitionFilter isEnabled="false" rscDefnName="METEOSAT8">
|
||||||
<filters>McIdas,METEOSAT</filters>
|
<filters>McIdas,METEOSAT</filters>
|
||||||
</ResourceDefinitionFilter>
|
</ResourceDefinitionFilter>
|
||||||
<ResourceDefinitionFilter isEnabled="true" rscDefnName="METEOSAT9">
|
<ResourceDefinitionFilter isEnabled="false" rscDefnName="METEOSAT9">
|
||||||
<filters>Standard,McIdas,METEOSAT</filters>
|
<filters>Standard,McIdas,METEOSAT</filters>
|
||||||
</ResourceDefinitionFilter>
|
</ResourceDefinitionFilter>
|
||||||
<ResourceDefinitionFilter isEnabled="false" rscDefnName="METEOSAT10">
|
<ResourceDefinitionFilter isEnabled="true" rscDefnName="METEOSAT10">
|
||||||
<filters>McIdas,METEOSAT</filters>
|
<filters>McIdas,METEOSAT</filters>
|
||||||
</ResourceDefinitionFilter>
|
</ResourceDefinitionFilter>
|
||||||
<ResourceDefinitionFilter isEnabled="true" rscDefnName="GINI_GOES11">
|
<ResourceDefinitionFilter isEnabled="true" rscDefnName="GINI_GOES11">
|
||||||
|
|
|
@ -13,7 +13,7 @@ legendColor=RGB {0, 255, 0}
|
||||||
<subTypeGenerator></subTypeGenerator>
|
<subTypeGenerator></subTypeGenerator>
|
||||||
<rscTypeGenerator></rscTypeGenerator>
|
<rscTypeGenerator></rscTypeGenerator>
|
||||||
<timeMatchMethod>CLOSEST_BEFORE_OR_AFTER</timeMatchMethod>
|
<timeMatchMethod>CLOSEST_BEFORE_OR_AFTER</timeMatchMethod>
|
||||||
<frameSpan>360</frameSpan>
|
<frameSpan>60</frameSpan>
|
||||||
<timelineGenMethod>USE_FRAME_INTERVAL</timelineGenMethod>
|
<timelineGenMethod>USE_FRAME_INTERVAL</timelineGenMethod>
|
||||||
<dfltFrameCount>10</dfltFrameCount>
|
<dfltFrameCount>10</dfltFrameCount>
|
||||||
<dfltTimeRange>48</dfltTimeRange>
|
<dfltTimeRange>48</dfltTimeRange>
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
! Parameters and Attributes for the default UAIR Resource
|
||||||
|
plotModel=@PlotModels/sfcobs/ship_standard.xml
|
||||||
|
plotDensity=12
|
||||||
|
conditionalFilter=
|
||||||
|
reportType=1003,1004,1005,1006,1007
|
|
@ -1,4 +1,5 @@
|
||||||
! Parameters and Attributes for the default UAIR Resource
|
! Parameters and Attributes for the default UAIR Resource
|
||||||
plotModel=@PlotModels/sfcobs/ship_standard.xml
|
plotModel=@PlotModels/sfcobs/ship_standard.xml
|
||||||
plotDensity=12
|
plotDensity=12
|
||||||
conditionalFilter=
|
conditionalFilter=
|
||||||
|
reportType=1003
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<ResourceDefinition xmlns:ns2="group" xmlns:ns3="http://www.example.org/productType">
|
||||||
|
<resourceDefnName>SHIP6HR</resourceDefnName>
|
||||||
|
<resourceCategory>SURFACE</resourceCategory>
|
||||||
|
<resourceParameters>
|
||||||
|
legendString=SHIP
|
||||||
|
pluginName=sfcobs
|
||||||
|
reportType=1003
|
||||||
|
spiFile=MTR.spi
|
||||||
|
legendColor=RGB {0, 255, 0}
|
||||||
|
</resourceParameters>
|
||||||
|
<rscImplementation>SurfacePlot</rscImplementation>
|
||||||
|
<subTypeGenerator></subTypeGenerator>
|
||||||
|
<rscTypeGenerator></rscTypeGenerator>
|
||||||
|
<timeMatchMethod>CLOSEST_AFTER_OR_EQUAL</timeMatchMethod>
|
||||||
|
<frameSpan>360</frameSpan>
|
||||||
|
<timelineGenMethod>USE_FRAME_INTERVAL</timelineGenMethod>
|
||||||
|
<dfltFrameCount>10</dfltFrameCount>
|
||||||
|
<dfltTimeRange>48</dfltTimeRange>
|
||||||
|
<dfltGeogArea>BasicWX_US</dfltGeogArea>
|
||||||
|
</ResourceDefinition>
|
|
@ -0,0 +1,5 @@
|
||||||
|
! Parameters and Attributes for the default UAIR Resource
|
||||||
|
plotModel=@PlotModels/sfcobs/ship_standard.xml
|
||||||
|
plotDensity=12
|
||||||
|
conditionalFilter=
|
||||||
|
reportType=1003
|
|
@ -1,5 +1,5 @@
|
||||||
! Parameters and Attributes for the default UAIR Resource
|
! Parameters and Attributes for the default UAIR Resource
|
||||||
levelKey=700
|
levelKey=700
|
||||||
plotModel=@PlotModels/ncuair/standard.xml
|
plotModel=@PlotModels/ncuair/standard.xml
|
||||||
plotDensity=10
|
plotDensity=30
|
||||||
conditionalFilter=
|
conditionalFilter=
|
|
@ -13,9 +13,9 @@ legendColor=RGB {0, 255, 0}
|
||||||
<subTypeGenerator></subTypeGenerator>
|
<subTypeGenerator></subTypeGenerator>
|
||||||
<rscTypeGenerator></rscTypeGenerator>
|
<rscTypeGenerator></rscTypeGenerator>
|
||||||
<timeMatchMethod>CLOSEST_BEFORE_OR_AFTER</timeMatchMethod>
|
<timeMatchMethod>CLOSEST_BEFORE_OR_AFTER</timeMatchMethod>
|
||||||
<frameSpan>720</frameSpan>
|
<frameSpan>180</frameSpan>
|
||||||
<timelineGenMethod>USE_FRAME_INTERVAL</timelineGenMethod>
|
<timelineGenMethod>USE_FRAME_INTERVAL</timelineGenMethod>
|
||||||
<dfltFrameCount>4</dfltFrameCount>
|
<dfltFrameCount>4</dfltFrameCount>
|
||||||
<dfltTimeRange>48</dfltTimeRange>
|
<dfltTimeRange>48</dfltTimeRange>
|
||||||
<dfltGeogArea>BasicWX_US</dfltGeogArea>
|
<dfltGeogArea>BasicWX_US</dfltGeogArea>
|
||||||
</ResourceDefinition>
|
</ResourceDefinition>
|
|
@ -1,5 +1,5 @@
|
||||||
! Parameters and Attributes for the default UAIR Resource
|
! Parameters and Attributes for the default UAIR Resource
|
||||||
levelKey=500
|
levelKey=500
|
||||||
plotModel=@PlotModels/ncuair/standard.xml
|
plotModel=@PlotModels/ncuair/standard.xml
|
||||||
plotDensity=10
|
plotDensity=30
|
||||||
conditionalFilter=
|
conditionalFilter=
|
|
@ -1,5 +1,5 @@
|
||||||
! Parameters and Attributes for the default UAIR Resource
|
! Parameters and Attributes for the default UAIR Resource
|
||||||
levelKey=500
|
levelKey=500
|
||||||
plotModel=@PlotModels/ncuair/standard.xml
|
plotModel=@PlotModels/ncuair/standard.xml
|
||||||
plotDensity=10
|
plotDensity=30
|
||||||
conditionalFilter=
|
conditionalFilter=
|
|
@ -86,6 +86,7 @@ import com.raytheon.uf.common.time.DataTime;
|
||||||
* 06/19/12 #657 Greg Hull removeSpinnerListeners() before setting the
|
* 06/19/12 #657 Greg Hull removeSpinnerListeners() before setting the
|
||||||
* spinner maxvalues.
|
* spinner maxvalues.
|
||||||
* 06/24/14 TTR1029 J. Wu Distinguish clicks in/outside of the slider box.
|
* 06/24/14 TTR1029 J. Wu Distinguish clicks in/outside of the slider box.
|
||||||
|
* 07/11/14 TTR1032 J. Wu reload data times as necessary to keep timeline current.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -304,7 +305,28 @@ public class TimelineControl extends Composite {
|
||||||
|
|
||||||
timeMatcher = tm;
|
timeMatcher = tm;
|
||||||
|
|
||||||
timeMatcher.loadTimes(false);
|
// timeMatcher.loadTimes(false);
|
||||||
|
/*
|
||||||
|
* TTR1032 - when current time passes the latest previously-loaded time
|
||||||
|
* for given frame interval, we need to reload times to keep timeline
|
||||||
|
* current.
|
||||||
|
*/
|
||||||
|
boolean reload = false;
|
||||||
|
if (timeMatcher.isCurrentRefTime()) {
|
||||||
|
reload = true;
|
||||||
|
if (timeMatcher.getSelectableDataTimes() != null
|
||||||
|
&& !timeMatcher.getSelectableDataTimes().isEmpty()) {
|
||||||
|
long curtime = Calendar.getInstance().getTimeInMillis();
|
||||||
|
long pretime = timeMatcher.getSelectableDataTimes()
|
||||||
|
.get(timeMatcher.getSelectableDataTimes().size() - 1)
|
||||||
|
.getRefTime().getTime();
|
||||||
|
if (curtime < (pretime + timeMatcher.getFrameInterval() * 60 * 1000)) {
|
||||||
|
reload = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
timeMatcher.loadTimes(reload);
|
||||||
|
|
||||||
if (timeMatcher.getDominantResourceName() != null) {
|
if (timeMatcher.getDominantResourceName() != null) {
|
||||||
for (int i = 0; i < dom_rsc_combo.getItemCount(); i++) {
|
for (int i = 0; i < dom_rsc_combo.getItemCount(); i++) {
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,7 +1,5 @@
|
||||||
package gov.noaa.nws.ncep.viz.resources.attributes;
|
package gov.noaa.nws.ncep.viz.resources.attributes;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
import gov.noaa.nws.ncep.viz.resources.INatlCntrsResourceData;
|
import gov.noaa.nws.ncep.viz.resources.INatlCntrsResourceData;
|
||||||
import gov.noaa.nws.ncep.viz.resources.manager.ResourceName;
|
import gov.noaa.nws.ncep.viz.resources.manager.ResourceName;
|
||||||
import gov.noaa.nws.ncep.viz.ui.display.NcDisplayMngr;
|
import gov.noaa.nws.ncep.viz.ui.display.NcDisplayMngr;
|
||||||
|
@ -11,9 +9,6 @@ import org.eclipse.swt.events.SelectionAdapter;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
import org.eclipse.swt.layout.FormData;
|
|
||||||
import org.eclipse.swt.layout.FormLayout;
|
|
||||||
import org.eclipse.swt.layout.FormAttachment;
|
|
||||||
import org.eclipse.swt.widgets.Button;
|
import org.eclipse.swt.widgets.Button;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Dialog;
|
import org.eclipse.swt.widgets.Dialog;
|
||||||
|
@ -22,7 +17,7 @@ import org.eclipse.swt.widgets.Label;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* an interface to edit resource attributes
|
* an interface to edit resource attributes
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
|
@ -45,105 +40,107 @@ import org.eclipse.swt.widgets.Shell;
|
||||||
* @version 1
|
* @version 1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public abstract class AbstractEditResourceAttrsDialog extends Dialog {
|
public abstract class AbstractEditResourceAttrsDialog extends Dialog {
|
||||||
protected Shell shell;
|
protected Shell shell;
|
||||||
|
|
||||||
protected String dlgTitle = null;
|
protected String dlgTitle = null;
|
||||||
|
|
||||||
protected INatlCntrsResourceData rscData;
|
protected INatlCntrsResourceData rscData;
|
||||||
|
|
||||||
protected ResourceAttrSet editedRscAttrSet = null;
|
protected ResourceAttrSet editedRscAttrSet = null;
|
||||||
|
|
||||||
protected boolean hasApplyBtn=false;
|
protected boolean hasApplyBtn = false;
|
||||||
protected boolean ok=false;
|
|
||||||
|
protected boolean ok = false;
|
||||||
public AbstractEditResourceAttrsDialog( Shell parentShell,
|
|
||||||
INatlCntrsResourceData r, Boolean apply ) {
|
public AbstractEditResourceAttrsDialog(Shell parentShell, INatlCntrsResourceData r, Boolean apply) {
|
||||||
super(parentShell);
|
super(parentShell);
|
||||||
rscData = r;
|
rscData = r;
|
||||||
ResourceName rscName = rscData.getResourceName();
|
ResourceName rscName = rscData.getResourceName();
|
||||||
this.dlgTitle = "Edit " + rscName.toString() + " Attributes";
|
this.dlgTitle = "Edit " + rscName.toString() + " Attributes";
|
||||||
|
|
||||||
hasApplyBtn = apply;
|
hasApplyBtn = apply;
|
||||||
// editedRscAttrSet = new ResourceAttrSet( rscData.getRscAttrSet().getRscAttrSetName() );
|
// editedRscAttrSet = new ResourceAttrSet(
|
||||||
|
// rscData.getRscAttrSet().getRscAttrSetName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract Composite createDialog( Composite topComp );
|
public abstract Composite createDialog(Composite topComp);
|
||||||
|
|
||||||
// initialize the GUI from editedRscAttrSet
|
|
||||||
public abstract void initWidgets();
|
|
||||||
|
|
||||||
public void createShell( ) {
|
|
||||||
int style = SWT.DIALOG_TRIM | SWT.RESIZE ;
|
|
||||||
if( !hasApplyBtn ) {
|
|
||||||
style |= SWT.APPLICATION_MODAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
shell = new Shell( getParent(), style );
|
|
||||||
shell.setText( dlgTitle );
|
|
||||||
//shell.setSize( 600, 800 ); // pack later
|
|
||||||
|
|
||||||
GridLayout mainLayout = new GridLayout(1, true);
|
// initialize the GUI from editedRscAttrSet
|
||||||
mainLayout.marginHeight = 1;
|
public abstract void initWidgets();
|
||||||
mainLayout.marginWidth = 1;
|
|
||||||
shell.setLayout(mainLayout);
|
public void createShell() {
|
||||||
|
int style = SWT.DIALOG_TRIM | SWT.RESIZE;
|
||||||
Composite topComp = new Composite( shell, SWT.NONE );
|
if (!hasApplyBtn) {
|
||||||
topComp.setLayout( new GridLayout() );
|
style |= SWT.APPLICATION_MODAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
shell = new Shell(getParent(), style);
|
||||||
|
shell.setText(dlgTitle);
|
||||||
|
// shell.setSize( 600, 800 ); // pack later
|
||||||
|
|
||||||
|
GridLayout mainLayout = new GridLayout(1, true);
|
||||||
|
mainLayout.marginHeight = 1;
|
||||||
|
mainLayout.marginWidth = 1;
|
||||||
|
shell.setLayout(mainLayout);
|
||||||
|
|
||||||
|
Composite topComp = new Composite(shell, SWT.NONE);
|
||||||
|
topComp.setLayout(new GridLayout());
|
||||||
GridData gd = new GridData();
|
GridData gd = new GridData();
|
||||||
gd.grabExcessHorizontalSpace = true;
|
gd.grabExcessHorizontalSpace = true;
|
||||||
gd.grabExcessVerticalSpace = true;
|
gd.grabExcessVerticalSpace = true;
|
||||||
gd.horizontalAlignment = SWT.FILL;
|
gd.horizontalAlignment = SWT.FILL;
|
||||||
gd.verticalAlignment = SWT.FILL;
|
gd.verticalAlignment = SWT.FILL;
|
||||||
topComp.setLayoutData( gd );
|
topComp.setLayoutData(gd);
|
||||||
|
|
||||||
Composite editComp = createDialog( topComp );
|
Composite editComp = createDialog(topComp);
|
||||||
Label sep = new Label( shell, SWT.SEPARATOR | SWT.HORIZONTAL );
|
Label sep = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
|
||||||
gd = new GridData();
|
gd = new GridData();
|
||||||
gd.grabExcessHorizontalSpace = true;
|
gd.grabExcessHorizontalSpace = true;
|
||||||
gd.horizontalAlignment = SWT.FILL;
|
gd.horizontalAlignment = SWT.FILL;
|
||||||
sep.setLayoutData( gd );
|
sep.setLayoutData(gd);
|
||||||
|
|
||||||
|
Composite okCanComp = new Composite(shell, SWT.NONE);
|
||||||
Composite okCanComp = new Composite( shell, SWT.NONE );
|
|
||||||
gd = new GridData();
|
gd = new GridData();
|
||||||
gd.grabExcessHorizontalSpace = true;
|
gd.grabExcessHorizontalSpace = true;
|
||||||
gd.horizontalAlignment = SWT.CENTER;
|
gd.horizontalAlignment = SWT.CENTER;
|
||||||
okCanComp.setLayoutData( gd );
|
okCanComp.setLayoutData(gd);
|
||||||
|
|
||||||
okCanComp.setLayout( new GridLayout( (hasApplyBtn ? 3 : 2), true) );
|
okCanComp.setLayout(new GridLayout((hasApplyBtn ? 3 : 2), true));
|
||||||
|
|
||||||
Button canBtn = new Button( okCanComp, SWT.PUSH );
|
Button canBtn = new Button(okCanComp, SWT.PUSH);
|
||||||
canBtn.setText(" Cancel ");
|
canBtn.setText(" Cancel ");
|
||||||
|
|
||||||
canBtn.addSelectionListener( new SelectionAdapter() {
|
canBtn.addSelectionListener(new SelectionAdapter() {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
ok=false;
|
ok = false;
|
||||||
shell.dispose();
|
shell.dispose();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if( hasApplyBtn ) {
|
if (hasApplyBtn) {
|
||||||
Button applyBtn = new Button( okCanComp, SWT.PUSH );
|
Button applyBtn = new Button(okCanComp, SWT.PUSH);
|
||||||
applyBtn.setText(" Apply ");
|
applyBtn.setText(" Apply ");
|
||||||
|
|
||||||
applyBtn.addSelectionListener( new SelectionAdapter() {
|
applyBtn.addSelectionListener(new SelectionAdapter() {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
rscData.setRscAttrSet( editedRscAttrSet );
|
rscData.setRscAttrSet(editedRscAttrSet);
|
||||||
rscData.setIsEdited( true );
|
rscData.setIsEdited(true);
|
||||||
NcDisplayMngr.getActiveNatlCntrsEditor().refresh();
|
NcDisplayMngr.getActiveNatlCntrsEditor().refresh();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Button okBtn = new Button( okCanComp, SWT.PUSH );
|
Button okBtn = new Button(okCanComp, SWT.PUSH);
|
||||||
okBtn.setText(" OK ");
|
okBtn.setText(" OK ");
|
||||||
|
|
||||||
okBtn.addSelectionListener( new SelectionAdapter() {
|
okBtn.addSelectionListener(new SelectionAdapter() {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
ok=true;
|
ok = true;
|
||||||
// get the
|
// get the
|
||||||
shell.dispose();
|
shell.dispose();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isOpen() {
|
public boolean isOpen() {
|
||||||
|
@ -151,36 +148,36 @@ public abstract class AbstractEditResourceAttrsDialog extends Dialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object open() {
|
public Object open() {
|
||||||
Display display = getParent().getDisplay();
|
Display display = getParent().getDisplay();
|
||||||
|
|
||||||
// copy the attrSet
|
// copy the attrSet
|
||||||
editedRscAttrSet = new ResourceAttrSet( rscData.getRscAttrSet() );
|
editedRscAttrSet = new ResourceAttrSet(rscData.getRscAttrSet());
|
||||||
|
|
||||||
createShell();
|
createShell();
|
||||||
|
|
||||||
initWidgets();
|
initWidgets();
|
||||||
|
|
||||||
shell.pack();
|
|
||||||
shell.open();
|
|
||||||
|
|
||||||
while( !shell.isDisposed() ) {
|
shell.pack();
|
||||||
if( !display.readAndDispatch() ) {
|
shell.open();
|
||||||
display.sleep();
|
|
||||||
}
|
while (!shell.isDisposed()) {
|
||||||
}
|
if (!display.readAndDispatch()) {
|
||||||
// Uses Java Bean utils to set the attributes on the resource
|
display.sleep();
|
||||||
if( ok ) {
|
}
|
||||||
|
}
|
||||||
rscData.setRscAttrSet( editedRscAttrSet );
|
// Uses Java Bean utils to set the attributes on the resource
|
||||||
rscData.setIsEdited( true );
|
if (ok) {
|
||||||
}
|
|
||||||
|
rscData.setRscAttrSet(editedRscAttrSet);
|
||||||
dispose();
|
rscData.setIsEdited(true);
|
||||||
|
}
|
||||||
return null;
|
|
||||||
}
|
dispose();
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// allow to override
|
// allow to override
|
||||||
protected void dispose() {
|
protected void dispose() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -56,6 +56,7 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||||
* 02/12/13 972 Greg Hull changed to work with INatlCntrsDescriptor
|
* 02/12/13 972 Greg Hull changed to work with INatlCntrsDescriptor
|
||||||
* 04/24/13 689 Xiaochuan Loop length in slctFrames that is set based on default
|
* 04/24/13 689 Xiaochuan Loop length in slctFrames that is set based on default
|
||||||
* or size of selectableDataTimes.
|
* or size of selectableDataTimes.
|
||||||
|
* 07/11/14 TTR1032 J. Wu No timeline needed if no data times available.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -267,8 +268,8 @@ public class NCTimeMatcher extends AbstractTimeMatcher implements
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAutoUpdateable() {
|
public boolean isAutoUpdateable() {
|
||||||
return (dominantRscData == null ? false :
|
return (dominantRscData == null ? false : dominantRscData
|
||||||
dominantRscData.isAutoUpdateable());
|
.isAutoUpdateable());
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the dominant resource
|
// set the dominant resource
|
||||||
|
@ -308,8 +309,8 @@ public class NCTimeMatcher extends AbstractTimeMatcher implements
|
||||||
|
|
||||||
dfltFrameTimesStr = dominantRscData.getDfltFrameTimes();
|
dfltFrameTimesStr = dominantRscData.getDfltFrameTimes();
|
||||||
|
|
||||||
// if (isForecast) {
|
// if (isForecast) {
|
||||||
if( dominantRscData.getResourceName().getCycleTime() != null ) {
|
if (dominantRscData.getResourceName().getCycleTime() != null) {
|
||||||
refTime = null;
|
refTime = null;
|
||||||
} else {
|
} else {
|
||||||
setCurrentRefTime();
|
setCurrentRefTime();
|
||||||
|
@ -318,17 +319,15 @@ public class NCTimeMatcher extends AbstractTimeMatcher implements
|
||||||
TimelineGenMethod tLineGenMthd = dominantRscData.getTimelineGenMethod();
|
TimelineGenMethod tLineGenMthd = dominantRscData.getTimelineGenMethod();
|
||||||
|
|
||||||
// the frameInterval here is only used to generate the timeline.
|
// the frameInterval here is only used to generate the timeline.
|
||||||
if( tLineGenMthd == TimelineGenMethod.USE_DATA_TIMES ||
|
if (tLineGenMthd == TimelineGenMethod.USE_DATA_TIMES
|
||||||
tLineGenMthd == TimelineGenMethod.USE_CYCLE_TIME_FCST_HOURS) {
|
|| tLineGenMthd == TimelineGenMethod.USE_CYCLE_TIME_FCST_HOURS) {
|
||||||
frameInterval = -1;
|
frameInterval = -1;
|
||||||
}
|
} else if (tLineGenMthd == TimelineGenMethod.USE_MANUAL_TIMELINE) {
|
||||||
else if( tLineGenMthd == TimelineGenMethod.USE_MANUAL_TIMELINE) {
|
|
||||||
if (frameInterval <= 0) {
|
if (frameInterval <= 0) {
|
||||||
frameInterval = 60; // what to use here as a default
|
frameInterval = 60; // what to use here as a default
|
||||||
}
|
}
|
||||||
}
|
} else if (tLineGenMthd == TimelineGenMethod.USE_FRAME_INTERVAL
|
||||||
else if( tLineGenMthd == TimelineGenMethod.USE_FRAME_INTERVAL ||
|
|| tLineGenMthd == TimelineGenMethod.USE_FCST_FRAME_INTERVAL_FROM_REF_TIME) {
|
||||||
tLineGenMthd == TimelineGenMethod.USE_FCST_FRAME_INTERVAL_FROM_REF_TIME ) {
|
|
||||||
frameInterval = dominantRscData.getFrameSpan();
|
frameInterval = dominantRscData.getFrameSpan();
|
||||||
} else { // ???
|
} else { // ???
|
||||||
return;
|
return;
|
||||||
|
@ -361,30 +360,50 @@ public class NCTimeMatcher extends AbstractTimeMatcher implements
|
||||||
// if (isForecast) {
|
// if (isForecast) {
|
||||||
// check cycleTime instead of isForecast since some resources may
|
// check cycleTime instead of isForecast since some resources may
|
||||||
// be forecast w/o a cycletime
|
// be forecast w/o a cycletime
|
||||||
if( dominantResourceName.getCycleTime() != null ) {
|
if (dominantResourceName.getCycleTime() != null) {
|
||||||
if (!dominantResourceName.isLatestCycleTime()) {
|
if (!dominantResourceName.isLatestCycleTime()) {
|
||||||
DataTime cyclTime = dominantResourceName.getCycleTime();
|
DataTime cyclTime = dominantResourceName.getCycleTime();
|
||||||
refTimeMillisecs = (cyclTime == null ? 0 : cyclTime
|
refTimeMillisecs = (cyclTime == null ? 0 : cyclTime
|
||||||
.getRefTime().getTime());
|
.getRefTime().getTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} else if (isCurrentRefTime()) {
|
||||||
else if( isCurrentRefTime() ) {
|
|
||||||
refTimeMillisecs = Calendar.getInstance().getTimeInMillis();
|
refTimeMillisecs = Calendar.getInstance().getTimeInMillis();
|
||||||
}
|
} else if (isLatestRefTime()) {
|
||||||
else if( isLatestRefTime() ) {
|
|
||||||
refTimeMillisecs = 0;
|
refTimeMillisecs = 0;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
refTimeMillisecs = refTime.getRefTime().getTime();
|
refTimeMillisecs = refTime.getRefTime().getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Always check all available times. If none of the available data times
|
||||||
|
* falls within the specified time range, then no time line should be
|
||||||
|
* created.
|
||||||
|
*
|
||||||
|
* J. Wu - To do? - When the time line ticks are built from frame time
|
||||||
|
* (frameInterval > 0) and the time line is "Current", and only some
|
||||||
|
* frame times are in "allAvailableTimes", how should we build the time
|
||||||
|
* line?
|
||||||
|
*/
|
||||||
|
allAvailDataTimes = dominantRscData.getAvailableDataTimes();
|
||||||
|
|
||||||
|
List<DataTime> availTimes = allAvailDataTimes;
|
||||||
|
if (availTimes == null || availTimes.isEmpty()) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
long latestTime = availTimes.get(availTimes.size() - 1)
|
||||||
|
.getRefTime().getTime();
|
||||||
|
if (latestTime < (refTimeMillisecs - timeRangeMillisecs)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// if refTime is Latest or
|
// if refTime is Latest or
|
||||||
// if using the data to generate the timeline, or
|
// if using the data to generate the timeline, or
|
||||||
// if we need to get the cycle time for a forecast resource, then
|
// if we need to get the cycle time for a forecast resource, then
|
||||||
// we will need to query the times of the dominant resource.
|
// we will need to query the times of the dominant resource.
|
||||||
if (refTimeMillisecs == 0 || frameInterval == -1) {
|
if (refTimeMillisecs == 0 || frameInterval == -1) {
|
||||||
allAvailDataTimes = dominantRscData.getAvailableDataTimes();
|
// allAvailDataTimes = dominantRscData.getAvailableDataTimes();
|
||||||
|
|
||||||
if (allAvailDataTimes == null) { // no data
|
if (allAvailDataTimes == null) { // no data
|
||||||
allAvailDataTimes = new ArrayList<DataTime>(); //
|
allAvailDataTimes = new ArrayList<DataTime>(); //
|
||||||
|
@ -436,17 +455,19 @@ public class NCTimeMatcher extends AbstractTimeMatcher implements
|
||||||
long frameTimeMillisecs = refTimeMillisecs;
|
long frameTimeMillisecs = refTimeMillisecs;
|
||||||
|
|
||||||
if (isForecast) {
|
if (isForecast) {
|
||||||
while (frameTimeMillisecs <= refTimeMillisecs + timeRangeMillisecs) {
|
while (frameTimeMillisecs <= refTimeMillisecs
|
||||||
DataTime time = new DataTime( new Date( frameTimeMillisecs));
|
+ timeRangeMillisecs) {
|
||||||
|
DataTime time = new DataTime(new Date(frameTimeMillisecs));
|
||||||
selectableDataTimes.add(time);
|
selectableDataTimes.add(time);
|
||||||
|
|
||||||
frameTimeMillisecs += frameIntervalMillisecs;
|
frameTimeMillisecs += frameIntervalMillisecs;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
while (frameTimeMillisecs >= refTimeMillisecs - timeRangeMillisecs) {
|
while (frameTimeMillisecs >= refTimeMillisecs
|
||||||
|
- timeRangeMillisecs) {
|
||||||
|
|
||||||
DataTime normRefTime = getNormalizedTime( new DataTime(
|
DataTime normRefTime = getNormalizedTime(new DataTime(
|
||||||
new Date(frameTimeMillisecs)));
|
new Date(frameTimeMillisecs)));
|
||||||
|
|
||||||
selectableDataTimes.add(0, normRefTime); // new DataTime(
|
selectableDataTimes.add(0, normRefTime); // new DataTime(
|
||||||
|
@ -460,43 +481,42 @@ public class NCTimeMatcher extends AbstractTimeMatcher implements
|
||||||
|
|
||||||
// if there is a GDATTIM then use this to compute the frameList from the
|
// if there is a GDATTIM then use this to compute the frameList from the
|
||||||
// list of available times in the DB
|
// list of available times in the DB
|
||||||
if( dfltFrameTimesStr != null ) {
|
if (dfltFrameTimesStr != null) {
|
||||||
try {
|
try {
|
||||||
frmTimeMatcher = new SelectableFrameTimeMatcher( dfltFrameTimesStr );
|
frmTimeMatcher = new SelectableFrameTimeMatcher(
|
||||||
|
dfltFrameTimesStr);
|
||||||
|
|
||||||
for( DataTime dt : allAvailDataTimes ) {
|
for (DataTime dt : allAvailDataTimes) {
|
||||||
if( frmTimeMatcher.matchTime( dt ) ) {
|
if (frmTimeMatcher.matchTime(dt)) {
|
||||||
frameTimes.add( dt );
|
frameTimes.add(dt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (VizException e) {
|
} catch (VizException e) {
|
||||||
// sanity check since this should already be validated
|
// sanity check since this should already be validated
|
||||||
System.out.println("bad GDATTIM string:"+dfltFrameTimesStr);
|
System.out.println("bad GDATTIM string:" + dfltFrameTimesStr);
|
||||||
frmTimeMatcher = null;
|
frmTimeMatcher = null;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
int skipCount = 0;
|
int skipCount = 0;
|
||||||
// set the initial frameTimes from the skip value and numFrames
|
// set the initial frameTimes from the skip value and numFrames
|
||||||
|
|
||||||
for (skipCount = 0; skipCount < selectableDataTimes.size(); skipCount++) {
|
for (skipCount = 0; skipCount < selectableDataTimes.size(); skipCount++) {
|
||||||
if (skipCount % (skipValue + 1) == 0) {
|
if (skipCount % (skipValue + 1) == 0) {
|
||||||
|
|
||||||
DataTime selectableTime = ( isForecast ?
|
DataTime selectableTime = (isForecast ? selectableDataTimes
|
||||||
selectableDataTimes.get( skipCount ) :
|
.get(skipCount) : selectableDataTimes
|
||||||
selectableDataTimes.get(
|
.get(selectableDataTimes.size() - skipCount - 1));
|
||||||
selectableDataTimes.size()-skipCount-1) );
|
|
||||||
|
|
||||||
if( frmTimeMatcher == null ||
|
if (frmTimeMatcher == null
|
||||||
frmTimeMatcher.matchTime( selectableTime ) ) {
|
|| frmTimeMatcher.matchTime(selectableTime)) {
|
||||||
|
|
||||||
if (isForecast) {
|
if (isForecast) {
|
||||||
frameTimes.add( selectableTime );
|
frameTimes.add(selectableTime);
|
||||||
} else {
|
} else {
|
||||||
frameTimes.add( 0, selectableTime );
|
frameTimes.add(0, selectableTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -522,7 +542,7 @@ public class NCTimeMatcher extends AbstractTimeMatcher implements
|
||||||
public ArrayList<DataTime> determineNewFrameTimes(DataTime newDataTime) {
|
public ArrayList<DataTime> determineNewFrameTimes(DataTime newDataTime) {
|
||||||
// in somecases the dataTime from the data can have a level set which
|
// in somecases the dataTime from the data can have a level set which
|
||||||
// can mess up the equals() method.
|
// can mess up the equals() method.
|
||||||
DataTime newFrameTime = new DataTime( newDataTime.getValidTime() );
|
DataTime newFrameTime = new DataTime(newDataTime.getValidTime());
|
||||||
|
|
||||||
ArrayList<DataTime> newFrameTimes = new ArrayList<DataTime>(1);
|
ArrayList<DataTime> newFrameTimes = new ArrayList<DataTime>(1);
|
||||||
|
|
||||||
|
@ -551,7 +571,7 @@ public class NCTimeMatcher extends AbstractTimeMatcher implements
|
||||||
// possible if no updates are received for a complete frame.
|
// possible if no updates are received for a complete frame.
|
||||||
// (TODO : is this what we want or should we only update to the
|
// (TODO : is this what we want or should we only update to the
|
||||||
// given data?)
|
// given data?)
|
||||||
while( (nextFrameTimeMs + (frameInterval * 1000 * 60)) < newFrameTime
|
while ((nextFrameTimeMs + (frameInterval * 1000 * 60)) < newFrameTime
|
||||||
.getValidTime().getTime().getTime()) {
|
.getValidTime().getTime().getTime()) {
|
||||||
nextFrameTimeMs += frameInterval * 1000 * 60;
|
nextFrameTimeMs += frameInterval * 1000 * 60;
|
||||||
newFrameTimes.add(new DataTime(new Date(nextFrameTimeMs)));
|
newFrameTimes.add(new DataTime(new Date(nextFrameTimeMs)));
|
||||||
|
|
|
@ -603,12 +603,12 @@ implements INatlCntrsResource, IStationField {
|
||||||
DataTime startTime = new DataTime( svrlData.eventTime.getValidPeriod().getStart() );
|
DataTime startTime = new DataTime( svrlData.eventTime.getValidPeriod().getStart() );
|
||||||
DataTime endTime = new DataTime( svrlData.eventTime.getValidPeriod().getEnd() );
|
DataTime endTime = new DataTime( svrlData.eventTime.getValidPeriod().getEnd() );
|
||||||
String temp = startTime.toString().substring(11, 13) + startTime.toString().substring(14,16)
|
String temp = startTime.toString().substring(11, 13) + startTime.toString().substring(14,16)
|
||||||
+ "-" + endTime.toString().substring(11, 13) + startTime.toString().substring(14,16);
|
+ "-" + endTime.toString().substring(11, 13) + endTime.toString().substring(14,16);
|
||||||
enabledText.add(temp);
|
enabledText.add(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int j=enabledText.size(); j<2; j++)
|
for (int j=enabledText.size(); j<2; j++){
|
||||||
enabledText.add("");
|
enabledText.add("");}
|
||||||
|
|
||||||
text = enabledText.toArray(text);
|
text = enabledText.toArray(text);
|
||||||
|
|
||||||
|
@ -757,10 +757,11 @@ implements INatlCntrsResource, IStationField {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(gw.size() == 0)
|
if(gw.size() == 0) {
|
||||||
continue;
|
continue;}
|
||||||
else
|
else{
|
||||||
keyResultMap.put(sd.datauri, new Result(getEachWrdoShape(gw),null,null,null));//TODO: other key
|
keyResultMap.put(sd.datauri, new Result(getEachWrdoShape(gw),null,null,null));//TODO: other key
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -798,10 +799,10 @@ String key = wData.datauri;//.getKey(); //TODO other key?
|
||||||
CountyResultJob.Result result = crjob.keyResultMap.get(key);
|
CountyResultJob.Result result = crjob.keyResultMap.get(key);
|
||||||
|
|
||||||
|
|
||||||
if (result != null)
|
if (result != null) {
|
||||||
outlineShape = result.outlineShape;
|
outlineShape = result.outlineShape;}
|
||||||
else
|
else {
|
||||||
return;
|
return;}
|
||||||
|
|
||||||
|
|
||||||
if (outlineShape != null && outlineShape.isDrawable()){
|
if (outlineShape != null && outlineShape.isDrawable()){
|
||||||
|
|
|
@ -381,7 +381,7 @@ public class WarnResource extends AbstractNatlCntrsResource< WarnResourceData, N
|
||||||
DataTime startTime = new DataTime( warnData.eventTime.getValidPeriod().getStart() );
|
DataTime startTime = new DataTime( warnData.eventTime.getValidPeriod().getStart() );
|
||||||
DataTime endTime = new DataTime( warnData.eventTime.getValidPeriod().getEnd() );
|
DataTime endTime = new DataTime( warnData.eventTime.getValidPeriod().getEnd() );
|
||||||
String temp = startTime.toString().substring(11, 13) +startTime.toString().substring(14, 16)
|
String temp = startTime.toString().substring(11, 13) +startTime.toString().substring(14, 16)
|
||||||
+ "-" + endTime.toString().substring(11, 13) +startTime.toString().substring(14, 16);
|
+ "-" + endTime.toString().substring(11, 13) +endTime.toString().substring(14, 16);
|
||||||
enabledText.add(temp);
|
enabledText.add(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -876,4 +876,4 @@ public class WarnResource extends AbstractNatlCntrsResource< WarnResourceData, N
|
||||||
}
|
}
|
||||||
return legendString + " "+ NmapCommon.getTimeStringFromDataTime( fd.getFrameTime(), "/");
|
return legendString + " "+ NmapCommon.getTimeStringFromDataTime( fd.getFrameTime(), "/");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -571,7 +571,7 @@ implements INatlCntrsResource, IStationField {
|
||||||
DataTime startTime = new DataTime( wcnData.eventTime.getValidPeriod().getStart() );
|
DataTime startTime = new DataTime( wcnData.eventTime.getValidPeriod().getStart() );
|
||||||
DataTime endTime = new DataTime( wcnData.eventTime.getValidPeriod().getEnd() );
|
DataTime endTime = new DataTime( wcnData.eventTime.getValidPeriod().getEnd() );
|
||||||
String temp = startTime.toString().substring(11, 13) + startTime.toString().substring(14,16)
|
String temp = startTime.toString().substring(11, 13) + startTime.toString().substring(14,16)
|
||||||
+ "-" + endTime.toString().substring(11, 13) + startTime.toString().substring(14,16);
|
+ "-" + endTime.toString().substring(11, 13) + endTime.toString().substring(14,16);
|
||||||
enabledText.add(temp);
|
enabledText.add(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -728,7 +728,7 @@ implements INatlCntrsResource, IStationField {
|
||||||
DataTime startTime = new DataTime( wcnData.eventTime.getValidPeriod().getStart() );
|
DataTime startTime = new DataTime( wcnData.eventTime.getValidPeriod().getStart() );
|
||||||
DataTime endTime = new DataTime( wcnData.eventTime.getValidPeriod().getEnd() );
|
DataTime endTime = new DataTime( wcnData.eventTime.getValidPeriod().getEnd() );
|
||||||
String temp = startTime.toString().substring(11, 13) + startTime.toString().substring(14,16)
|
String temp = startTime.toString().substring(11, 13) + startTime.toString().substring(14,16)
|
||||||
+ "-" + endTime.toString().substring(11, 13) + startTime.toString().substring(14,16);
|
+ "-" + endTime.toString().substring(11, 13) + endTime.toString().substring(14,16);
|
||||||
enabledText.add(temp);
|
enabledText.add(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -922,7 +922,7 @@ implements INatlCntrsResource, IStationField {
|
||||||
DataTime startTime = new DataTime( wData.eventTime.getValidPeriod().getStart() );
|
DataTime startTime = new DataTime( wData.eventTime.getValidPeriod().getStart() );
|
||||||
DataTime endTime = new DataTime( wData.eventTime.getValidPeriod().getEnd() );
|
DataTime endTime = new DataTime( wData.eventTime.getValidPeriod().getEnd() );
|
||||||
String temp = startTime.toString().substring(11, 13) + startTime.toString().substring(14,16)
|
String temp = startTime.toString().substring(11, 13) + startTime.toString().substring(14,16)
|
||||||
+ "-" + endTime.toString().substring(11, 13) + startTime.toString().substring(14,16);
|
+ "-" + endTime.toString().substring(11, 13) + endTime.toString().substring(14,16);
|
||||||
enabledText.add(temp);
|
enabledText.add(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1007,7 +1007,7 @@ implements INatlCntrsResource, IStationField {
|
||||||
startTime = new DataTime( wData.eventTime.getValidPeriod().getStart() );
|
startTime = new DataTime( wData.eventTime.getValidPeriod().getStart() );
|
||||||
endTime = new DataTime( wData.eventTime.getValidPeriod().getEnd() );
|
endTime = new DataTime( wData.eventTime.getValidPeriod().getEnd() );
|
||||||
temp = startTime.toString().substring(11, 13) + startTime.toString().substring(14,16)
|
temp = startTime.toString().substring(11, 13) + startTime.toString().substring(14,16)
|
||||||
+ "-" + endTime.toString().substring(11, 13) + startTime.toString().substring(14,16);
|
+ "-" + endTime.toString().substring(11, 13) + endTime.toString().substring(14,16);
|
||||||
|
|
||||||
if (time.equalsIgnoreCase("") || !time.equalsIgnoreCase(temp)) {
|
if (time.equalsIgnoreCase("") || !time.equalsIgnoreCase(temp)) {
|
||||||
timeList.add(temp);
|
timeList.add(temp);
|
||||||
|
@ -1132,7 +1132,7 @@ implements INatlCntrsResource, IStationField {
|
||||||
startTime = new DataTime( wData.eventTime.getValidPeriod().getStart() );
|
startTime = new DataTime( wData.eventTime.getValidPeriod().getStart() );
|
||||||
endTime = new DataTime( wData.eventTime.getValidPeriod().getEnd() );
|
endTime = new DataTime( wData.eventTime.getValidPeriod().getEnd() );
|
||||||
temp = startTime.toString().substring(11, 13) + startTime.toString().substring(14,16)
|
temp = startTime.toString().substring(11, 13) + startTime.toString().substring(14,16)
|
||||||
+ "-" + endTime.toString().substring(11, 13) + startTime.toString().substring(14,16);
|
+ "-" + endTime.toString().substring(11, 13) + endTime.toString().substring(14,16);
|
||||||
|
|
||||||
if (time.equalsIgnoreCase("") || !time.equalsIgnoreCase(temp)) {
|
if (time.equalsIgnoreCase("") || !time.equalsIgnoreCase(temp)) {
|
||||||
timeList.add(temp);
|
timeList.add(temp);
|
||||||
|
|
|
@ -1,42 +1,36 @@
|
||||||
package gov.noaa.nws.ncep.viz.rsc.ffg.rsc;
|
package gov.noaa.nws.ncep.viz.rsc.ffg.rsc;
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
|
||||||
import org.eclipse.swt.events.SelectionAdapter;
|
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
|
||||||
import org.eclipse.swt.graphics.RGB;
|
|
||||||
import org.eclipse.swt.layout.FormData;
|
|
||||||
import org.eclipse.swt.layout.FormLayout;
|
|
||||||
import org.eclipse.swt.layout.FormAttachment;
|
|
||||||
import org.eclipse.swt.widgets.Button;
|
|
||||||
import org.eclipse.swt.widgets.Combo;
|
|
||||||
import org.eclipse.swt.widgets.Composite;
|
|
||||||
import org.eclipse.swt.widgets.Group;
|
|
||||||
import org.eclipse.swt.widgets.Label;
|
|
||||||
import org.eclipse.swt.widgets.Shell;
|
|
||||||
import org.eclipse.jface.util.IPropertyChangeListener;
|
|
||||||
import org.eclipse.jface.util.PropertyChangeEvent;
|
|
||||||
import org.geotools.referencing.wkt.Symbols;
|
|
||||||
|
|
||||||
import gov.noaa.nws.ncep.viz.resources.INatlCntrsResourceData;
|
import gov.noaa.nws.ncep.viz.resources.INatlCntrsResourceData;
|
||||||
import gov.noaa.nws.ncep.viz.resources.attributes.AbstractEditResourceAttrsDialog;
|
import gov.noaa.nws.ncep.viz.resources.attributes.AbstractEditResourceAttrsDialog;
|
||||||
import gov.noaa.nws.ncep.viz.resources.attributes.ResourceAttrSet.RscAttrValue;
|
import gov.noaa.nws.ncep.viz.resources.attributes.ResourceAttrSet.RscAttrValue;
|
||||||
import gov.noaa.nws.ncep.viz.resources.colorBar.ColorBarEditor;
|
import gov.noaa.nws.ncep.viz.resources.colorBar.ColorBarEditor;
|
||||||
import gov.noaa.nws.ncep.viz.ui.display.ColorBar;
|
import gov.noaa.nws.ncep.viz.ui.display.ColorBar;
|
||||||
import gov.noaa.nws.ncep.viz.common.ui.color.ColorButtonSelector;
|
|
||||||
import gov.noaa.nws.ncep.viz.common.ui.color.ColorMatrixSelector;
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
|
import org.eclipse.swt.layout.FormAttachment;
|
||||||
|
import org.eclipse.swt.layout.FormData;
|
||||||
|
import org.eclipse.swt.layout.FormLayout;
|
||||||
|
import org.eclipse.swt.widgets.Combo;
|
||||||
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.swt.widgets.Group;
|
||||||
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An interface to edit FFG resource attributes.
|
* An interface to edit FFG resource attributes.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* 29 May 2009 #115 Greg Hull Initial Creation.
|
* 29 May 2009 #115 Greg Hull Initial Creation.
|
||||||
* 30 Nov 2009 Greg Hull migrate to to11d6
|
* 30 Nov 2009 Greg Hull migrate to to11d6
|
||||||
* 21 Mar 2010 #259 Greg Hull add colorbar editor
|
* 21 Mar 2010 #259 Greg Hull add colorbar editor
|
||||||
* 27 Apr 2010 #245 Greg Hull Added Apply Button
|
* 27 Apr 2010 #245 Greg Hull Added Apply Button
|
||||||
|
* 01 Jul 2014 TTR 1018 Steve Russell Updated call to ColorBarEditor
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -44,119 +38,119 @@ import gov.noaa.nws.ncep.viz.common.ui.color.ColorMatrixSelector;
|
||||||
* @version 1
|
* @version 1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class EditFFGAttrsDialog extends AbstractEditResourceAttrsDialog {
|
public class EditFFGAttrsDialog extends AbstractEditResourceAttrsDialog {
|
||||||
|
|
||||||
public EditFFGAttrsDialog(Shell parentShell, INatlCntrsResourceData r, Boolean apply) {
|
public EditFFGAttrsDialog(Shell parentShell, INatlCntrsResourceData r, Boolean apply) {
|
||||||
super(parentShell, r, apply);
|
super(parentShell, r, apply);
|
||||||
// TODO Auto-generated constructor stub
|
// TODO Auto-generated constructor stub
|
||||||
}
|
}
|
||||||
|
|
||||||
private RscAttrValue dispValsAttr = null;
|
private RscAttrValue dispValsAttr = null;
|
||||||
|
|
||||||
private RscAttrValue colorBarAttr = null;
|
private RscAttrValue colorBarAttr = null;
|
||||||
|
|
||||||
private Label symbolLbl = null;
|
private Label symbolLbl = null;
|
||||||
|
|
||||||
private Combo symbolCombo = null;
|
private Combo symbolCombo = null;
|
||||||
|
|
||||||
private ColorBarEditor colorBarEditor = null;
|
private ColorBarEditor colorBarEditor = null;
|
||||||
|
|
||||||
//
|
|
||||||
@Override
|
|
||||||
public Composite createDialog( Composite topComp ) {
|
|
||||||
|
|
||||||
dispValsAttr = editedRscAttrSet.getRscAttr( "displayValues" );
|
|
||||||
colorBarAttr = editedRscAttrSet.getRscAttr( "colorBar" );
|
|
||||||
|
|
||||||
if( dispValsAttr == null || dispValsAttr.getAttrClass() != Boolean.class ) {
|
//
|
||||||
System.out.println("displayValues is null or not of expected class Boolean?");
|
@Override
|
||||||
return null;
|
public Composite createDialog(Composite topComp) {
|
||||||
|
|
||||||
|
dispValsAttr = editedRscAttrSet.getRscAttr("displayValues");
|
||||||
|
colorBarAttr = editedRscAttrSet.getRscAttr("colorBar");
|
||||||
|
|
||||||
|
if (dispValsAttr == null || dispValsAttr.getAttrClass() != Boolean.class) {
|
||||||
|
System.out.println("displayValues is null or not of expected class Boolean?");
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
if( colorBarAttr == null || colorBarAttr.getAttrClass() != ColorBar.class ) {
|
if (colorBarAttr == null || colorBarAttr.getAttrClass() != ColorBar.class) {
|
||||||
System.out.println("colorBar is null or not of expected class ColorBar?");
|
System.out.println("colorBar is null or not of expected class ColorBar?");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
FormLayout layout0 = new FormLayout();
|
FormLayout layout0 = new FormLayout();
|
||||||
topComp.setLayout(layout0);
|
topComp.setLayout(layout0);
|
||||||
|
|
||||||
final Combo showAsCombo = new Combo( topComp, SWT.READ_ONLY | SWT.DROP_DOWN );
|
final Combo showAsCombo = new Combo(topComp, SWT.READ_ONLY | SWT.DROP_DOWN);
|
||||||
FormData fd = new FormData();
|
FormData fd = new FormData();
|
||||||
fd.left = new FormAttachment( 20, 0 );
|
fd.left = new FormAttachment(20, 0);
|
||||||
fd.top = new FormAttachment( 0, 20 );
|
fd.top = new FormAttachment(0, 20);
|
||||||
showAsCombo.setLayoutData( fd );
|
showAsCombo.setLayoutData(fd);
|
||||||
|
|
||||||
showAsCombo.setItems( new String[] { "Values", "Symbols" } );
|
showAsCombo.setItems(new String[] { "Values", "Symbols" });
|
||||||
|
|
||||||
showAsCombo.select( ((Boolean)dispValsAttr.getAttrValue()).booleanValue() ? 0 : 1 );
|
showAsCombo.select(((Boolean) dispValsAttr.getAttrValue()).booleanValue() ? 0 : 1);
|
||||||
|
|
||||||
showAsCombo.addSelectionListener( new SelectionAdapter() {
|
showAsCombo.addSelectionListener(new SelectionAdapter() {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
boolean dispVals = (showAsCombo.getSelectionIndex() == 0 ? true : false );
|
boolean dispVals = (showAsCombo.getSelectionIndex() == 0 ? true : false);
|
||||||
dispValsAttr.setAttrValue( new Boolean( dispVals) );
|
dispValsAttr.setAttrValue(new Boolean(dispVals));
|
||||||
|
|
||||||
dispVals = false; // symobl selection not implemented
|
dispVals = false; // symobl selection not implemented
|
||||||
symbolCombo.setEnabled( dispVals );
|
symbolCombo.setEnabled(dispVals);
|
||||||
symbolLbl.setEnabled( dispVals );
|
symbolLbl.setEnabled(dispVals);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Label showAsLbl = new Label( topComp, SWT.None );
|
Label showAsLbl = new Label(topComp, SWT.None);
|
||||||
fd = new FormData();
|
fd = new FormData();
|
||||||
fd.right = new FormAttachment( showAsCombo, -5, SWT.LEFT );
|
fd.right = new FormAttachment(showAsCombo, -5, SWT.LEFT);
|
||||||
fd.top = new FormAttachment( showAsCombo, 2, SWT.TOP );
|
fd.top = new FormAttachment(showAsCombo, 2, SWT.TOP);
|
||||||
showAsLbl.setLayoutData( fd );
|
showAsLbl.setLayoutData(fd);
|
||||||
showAsLbl.setText( "Show As" );
|
showAsLbl.setText("Show As");
|
||||||
|
|
||||||
symbolCombo = new Combo( topComp, SWT.READ_ONLY | SWT.DROP_DOWN );
|
symbolCombo = new Combo(topComp, SWT.READ_ONLY | SWT.DROP_DOWN);
|
||||||
fd = new FormData();
|
fd = new FormData();
|
||||||
fd.left = new FormAttachment( 50, 0 );
|
fd.left = new FormAttachment(50, 0);
|
||||||
fd.top = new FormAttachment( showAsCombo, 0, SWT.TOP );
|
fd.top = new FormAttachment(showAsCombo, 0, SWT.TOP);
|
||||||
symbolCombo.setLayoutData( fd );
|
symbolCombo.setLayoutData(fd);
|
||||||
|
|
||||||
// Symbol Selection is not Implemented
|
// Symbol Selection is not Implemented
|
||||||
symbolCombo.add("N/A");
|
symbolCombo.add("N/A");
|
||||||
symbolCombo.select(0);
|
symbolCombo.select(0);
|
||||||
symbolCombo.setEnabled(false);
|
symbolCombo.setEnabled(false);
|
||||||
|
|
||||||
symbolLbl = new Label( topComp, SWT.None );
|
symbolLbl = new Label(topComp, SWT.None);
|
||||||
fd = new FormData();
|
fd = new FormData();
|
||||||
fd.right = new FormAttachment( symbolCombo, -5, SWT.LEFT );
|
fd.right = new FormAttachment(symbolCombo, -5, SWT.LEFT);
|
||||||
fd.top = new FormAttachment( symbolCombo, 2, SWT.TOP );
|
fd.top = new FormAttachment(symbolCombo, 2, SWT.TOP);
|
||||||
symbolLbl.setLayoutData( fd );
|
symbolLbl.setLayoutData(fd);
|
||||||
symbolLbl.setText( "Symbol" );
|
symbolLbl.setText("Symbol");
|
||||||
|
|
||||||
symbolLbl.setEnabled(false);
|
symbolLbl.setEnabled(false);
|
||||||
|
|
||||||
|
Group colorBarGrp = new Group(topComp, SWT.NONE);
|
||||||
Group colorBarGrp = new Group( topComp, SWT.NONE );
|
|
||||||
colorBarGrp.setText("Edit Color Bar");
|
colorBarGrp.setText("Edit Color Bar");
|
||||||
fd = new FormData();//400,300);
|
fd = new FormData();//400,300);
|
||||||
fd.left = new FormAttachment( 0, 15 );
|
fd.left = new FormAttachment(0, 15);
|
||||||
fd.right = new FormAttachment( 100, -15 );
|
fd.right = new FormAttachment(100, -15);
|
||||||
fd.top = new FormAttachment( showAsCombo, 15, SWT.BOTTOM );
|
fd.top = new FormAttachment(showAsCombo, 15, SWT.BOTTOM);
|
||||||
fd.bottom = new FormAttachment( 100, -20 );
|
fd.bottom = new FormAttachment(100, -20);
|
||||||
colorBarGrp.setLayoutData( fd );
|
colorBarGrp.setLayoutData(fd);
|
||||||
|
|
||||||
colorBarGrp.setLayout( new FormLayout() );
|
colorBarGrp.setLayout(new FormLayout());
|
||||||
|
|
||||||
ColorBar editedColorBar = null;
|
ColorBar editedColorBar = null;
|
||||||
|
|
||||||
editedColorBar = (ColorBar)colorBarAttr.getAttrValue();
|
editedColorBar = (ColorBar) colorBarAttr.getAttrValue();
|
||||||
|
|
||||||
|
colorBarEditor = new ColorBarEditor(colorBarGrp, editedColorBar, true);
|
||||||
|
|
||||||
colorBarEditor = new ColorBarEditor( colorBarGrp, editedColorBar );
|
|
||||||
|
|
||||||
return topComp;
|
return topComp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initWidgets() {
|
public void initWidgets() {
|
||||||
// done in createDialog
|
// done in createDialog
|
||||||
}
|
}
|
||||||
|
|
||||||
// allow to override
|
|
||||||
@Override
|
|
||||||
protected void dispose() {
|
|
||||||
super.dispose();
|
|
||||||
colorBarEditor.dispose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// allow to override
|
||||||
|
@Override
|
||||||
|
protected void dispose() {
|
||||||
|
super.dispose();
|
||||||
|
colorBarEditor.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -22,18 +22,17 @@ import java.util.List;
|
||||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||||
import com.raytheon.uf.common.time.DataTime;
|
import com.raytheon.uf.common.time.DataTime;
|
||||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
|
||||||
import com.raytheon.uf.viz.core.drawables.IFont;
|
import com.raytheon.uf.viz.core.drawables.IFont;
|
||||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||||
import com.raytheon.uf.viz.core.exception.VizException;
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
import com.raytheon.uf.viz.core.map.IMapDescriptor;
|
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
import com.vividsolutions.jts.geom.Coordinate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HrcnResource - Display Tropical Cyclone data
|
* HrcnResource - Display Tropical Cyclone data
|
||||||
*
|
*
|
||||||
* This code has been developed by the SIB for use in the AWIPS2 system.
|
* This code has been developed by the SIB for use in the AWIPS2 system.
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
|
@ -41,423 +40,538 @@ import com.vividsolutions.jts.geom.Coordinate;
|
||||||
* 04 Oct 2011 466 B. Hebbard Initial creation.
|
* 04 Oct 2011 466 B. Hebbard Initial creation.
|
||||||
* 05/23/12 785 Q. Zhou Added getName for legend.
|
* 05/23/12 785 Q. Zhou Added getName for legend.
|
||||||
* 17 Aug 2012 655 B. Hebbard Added paintProps as parameter to IDisplayable draw
|
* 17 Aug 2012 655 B. Hebbard Added paintProps as parameter to IDisplayable draw
|
||||||
|
* 07/14 ? B. Yin Fixed several TCM issues (12 feet sea, 24-hour records).
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author bhebbard
|
* @author bhebbard
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
public class HrcnResource extends AbstractNatlCntrsResource<HrcnResourceData, NCMapDescriptor>
|
public class HrcnResource extends
|
||||||
implements INatlCntrsResource {
|
AbstractNatlCntrsResource<HrcnResourceData, NCMapDescriptor> implements
|
||||||
|
INatlCntrsResource {
|
||||||
private HrcnResourceData hrcnResourceData;
|
|
||||||
|
private HrcnResourceData hrcnResourceData;
|
||||||
|
|
||||||
|
// A map from an identifier string (which is unique within a single frame
|
||||||
|
// to a structure for a single displayable element
|
||||||
|
|
||||||
// A map from an identifier string (which is unique within a single frame
|
|
||||||
// to a structure for a single displayable element
|
|
||||||
|
|
||||||
private class FrameData extends AbstractFrameData {
|
private class FrameData extends AbstractFrameData {
|
||||||
|
|
||||||
protected HashMap<String, Tcm> getTcmNameToDrawableElementMap() {
|
protected HashMap<String, Tcm> getTcmNameToDrawableElementMap() {
|
||||||
return tcmNameToDrawableElementMap;
|
return tcmNameToDrawableElementMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setTcmNameToDrawableElementMap(
|
private HashMap<String, Tcm> tcmNameToDrawableElementMap;
|
||||||
HashMap<String, Tcm> tcmNameToDrawableElementMap) {
|
|
||||||
this.tcmNameToDrawableElementMap = tcmNameToDrawableElementMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
private HashMap<String, Tcm> tcmNameToDrawableElementMap;
|
private HashMap<String, List<TcmRecord>> datamap = new HashMap<String, List<TcmRecord>>();;
|
||||||
|
|
||||||
public FrameData(DataTime frameTime, int timeInt) {
|
public FrameData(DataTime frameTime, int timeInt) {
|
||||||
super( frameTime, timeInt );
|
super(frameTime, timeInt);
|
||||||
tcmNameToDrawableElementMap = new HashMap<String,Tcm>();
|
tcmNameToDrawableElementMap = new HashMap<String, Tcm>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean updateFrameData(IRscDataObject rscDataObj) {
|
public boolean updateFrameData(IRscDataObject rscDataObj) {
|
||||||
|
// Sanity I
|
||||||
// Sanity I
|
if (!(rscDataObj instanceof DfltRecordRscDataObj)) {
|
||||||
if( !(rscDataObj instanceof DfltRecordRscDataObj) ) {
|
System.out
|
||||||
System.out.println("Hrcn.updateFrameData expecting DfltRecordRscDataObj "
|
.println("Hrcn.updateFrameData expecting DfltRecordRscDataObj "
|
||||||
+ " instead of: " + rscDataObj.getClass().getName() );
|
+ " instead of: "
|
||||||
return false;
|
+ rscDataObj.getClass().getName());
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
PluginDataObject pdo = ((DfltRecordRscDataObj)rscDataObj).getPDO();
|
|
||||||
|
|
||||||
// Sanity II
|
PluginDataObject pdo = ((DfltRecordRscDataObj) rscDataObj).getPDO();
|
||||||
|
|
||||||
if( pdo == null ) {
|
// Sanity II
|
||||||
System.out.println("Hrcn.updateFrameData expecting TcmRecord "
|
|
||||||
+ " instead of: " + "null" );
|
if (pdo == null) {
|
||||||
return false;
|
System.out.println("Hrcn.updateFrameData expecting TcmRecord "
|
||||||
}
|
+ " instead of: " + "null");
|
||||||
|
return false;
|
||||||
// Sanity III
|
}
|
||||||
if( !(pdo instanceof TcmRecord) ) {
|
|
||||||
System.out.println("Hrcn.updateFrameData expecting TcmRecord "
|
// Sanity III
|
||||||
+ " instead of: " + pdo.getClass().getName() );
|
if (!(pdo instanceof TcmRecord)) {
|
||||||
return false;
|
System.out.println("Hrcn.updateFrameData expecting TcmRecord "
|
||||||
}
|
+ " instead of: " + pdo.getClass().getName());
|
||||||
|
return false;
|
||||||
TcmRecord tr = (TcmRecord) pdo;
|
}
|
||||||
Tcm tcm = buildTcmDrawableElement(tr);
|
|
||||||
|
TcmRecord tr = (TcmRecord) pdo;
|
||||||
tcmNameToDrawableElementMap.put(tr.getStormName(), tcm);
|
|
||||||
|
if (datamap.keySet().contains(tr.getBasin() + tr.getStormNumber())) {
|
||||||
return true;
|
datamap.get(tr.getBasin() + tr.getStormNumber()).add(tr);
|
||||||
|
} else {
|
||||||
|
ArrayList<TcmRecord> tcmList = new ArrayList<TcmRecord>();
|
||||||
|
tcmList.add(tr);
|
||||||
|
datamap.put(tr.getBasin() + tr.getStormNumber(), tcmList);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void createTcmMap() {
|
||||||
|
|
||||||
|
for (List<TcmRecord> listTcms : datamap.values()) {
|
||||||
|
|
||||||
|
// Sort the list by time
|
||||||
|
Collections.sort(listTcms, new Comparator<TcmRecord>() {
|
||||||
|
public int compare(TcmRecord tr1, TcmRecord tr2) {
|
||||||
|
return (tr1.getDataTime().getRefTimeAsCalendar()
|
||||||
|
.compareTo(tr2.getDataTime()
|
||||||
|
.getRefTimeAsCalendar()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// build tcm
|
||||||
|
for (TcmRecord tr : listTcms) {
|
||||||
|
if (tr == listTcms.get(listTcms.size() - 1)) {
|
||||||
|
tcmNameToDrawableElementMap.put(tr.getStormName()
|
||||||
|
+ tr.getDataTime().getRefTimeAsCalendar()
|
||||||
|
.getTimeInMillis(),
|
||||||
|
buildTcmDrawableElement(tr, false));
|
||||||
|
} else {
|
||||||
|
tcmNameToDrawableElementMap.put(tr.getStormName()
|
||||||
|
+ tr.getDataTime().getRefTimeAsCalendar()
|
||||||
|
.getTimeInMillis(),
|
||||||
|
buildObsTcmDrawableElement(tr));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// return -1 if the data doesn't match. if the return value is 0 or
|
||||||
|
// positive
|
||||||
|
// then this is the number of seconds from the perfect match.
|
||||||
|
@Override
|
||||||
|
public long timeMatch(DataTime dataTime) {
|
||||||
|
|
||||||
|
long diff = frameTime.getValidTime().getTimeInMillis()
|
||||||
|
- dataTime.getValidTime().getTimeInMillis();
|
||||||
|
|
||||||
|
// get HRCN data in previous 24 hours
|
||||||
|
if (diff > 0 && diff <= 24 * 60 * 60 * 1000) {
|
||||||
|
return diff;
|
||||||
|
} else {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private IFont font=null;
|
private IFont font = null;
|
||||||
|
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a HRCN resource.
|
* Create a HRCN resource.
|
||||||
*
|
*
|
||||||
* @throws VizException
|
* @throws VizException
|
||||||
*/
|
*/
|
||||||
public HrcnResource(HrcnResourceData resourceData,
|
public HrcnResource(HrcnResourceData resourceData,
|
||||||
LoadProperties loadProperties) throws VizException {
|
LoadProperties loadProperties) throws VizException {
|
||||||
super(resourceData, loadProperties);
|
super(resourceData, loadProperties);
|
||||||
hrcnResourceData = (HrcnResourceData) resourceData ;
|
hrcnResourceData = (HrcnResourceData) resourceData;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected AbstractFrameData createNewFrame( DataTime frameTime, int timeInt ) {
|
protected AbstractFrameData createNewFrame(DataTime frameTime, int timeInt) {
|
||||||
return (AbstractFrameData) new FrameData( frameTime, timeInt );
|
return (AbstractFrameData) new FrameData(frameTime, timeInt);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initResource(IGraphicsTarget grphTarget) throws VizException {
|
public void initResource(IGraphicsTarget grphTarget) throws VizException {
|
||||||
queryRecords();
|
queryRecords();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void paintFrame(AbstractFrameData frameData, IGraphicsTarget target, PaintProperties paintProps) throws VizException {
|
|
||||||
|
|
||||||
FrameData currFrameData = (FrameData) frameData;
|
public void paintFrame(AbstractFrameData frameData, IGraphicsTarget target,
|
||||||
|
PaintProperties paintProps) throws VizException {
|
||||||
|
|
||||||
// Allocate font and calculate vertical offset parameter for lines of text
|
FrameData currFrameData = (FrameData) frameData;
|
||||||
font = target.initializeFont("Monospace", 14, new IFont.Style[] { IFont.Style.BOLD });
|
|
||||||
double screenToWorldRatio = paintProps.getCanvasBounds().width
|
// Allocate font and calculate vertical offset parameter for lines of
|
||||||
/ paintProps.getView().getExtent().getWidth();
|
// text
|
||||||
Rectangle2D charSize = target.getStringBounds(font, "N");
|
font = target.initializeFont("Monospace", 14,
|
||||||
double charHeight = charSize.getHeight();
|
new IFont.Style[] { IFont.Style.BOLD });
|
||||||
double offsetY = charHeight / screenToWorldRatio;
|
double screenToWorldRatio = paintProps.getCanvasBounds().width
|
||||||
|
/ paintProps.getView().getExtent().getWidth();
|
||||||
if( paintProps == null ) {
|
Rectangle2D charSize = target.getStringBounds(font, "N");
|
||||||
return;
|
double charHeight = charSize.getHeight();
|
||||||
}
|
double offsetY = charHeight / screenToWorldRatio;
|
||||||
|
|
||||||
|
if (paintProps == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (currFrameData != null) {
|
if (currFrameData != null) {
|
||||||
|
|
||||||
// For each storm that has a TCM issued as of the frame time...
|
// For each storm that has a TCM issued as of the frame time...
|
||||||
|
|
||||||
for (Tcm tcm : currFrameData.getTcmNameToDrawableElementMap().values()) {
|
|
||||||
|
|
||||||
// ...display TCM PGEN object for all forecast hours.
|
|
||||||
|
|
||||||
DisplayElementFactory df = new DisplayElementFactory(target, getNcMapDescriptor());
|
for (Tcm tcm : currFrameData.getTcmNameToDrawableElementMap()
|
||||||
ArrayList<IDisplayable> displayEls = df.createDisplayElements(tcm, paintProps);
|
.values()) {
|
||||||
for (IDisplayable each : displayEls) {
|
|
||||||
each.draw(target, paintProps);
|
|
||||||
each.dispose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
// Put per-hour options into arrays for easy lookup
|
|
||||||
final Boolean[] enables = {hrcnResourceData.hour0Enable,
|
|
||||||
hrcnResourceData.hour1Enable,
|
|
||||||
hrcnResourceData.hour2Enable};
|
|
||||||
final RGB[] colors = {hrcnResourceData.hour0Color,
|
|
||||||
hrcnResourceData.hour1Color,
|
|
||||||
hrcnResourceData.hour2Color};
|
|
||||||
final int[] lineWidths = {hrcnResourceData.hour0LineWidth,
|
|
||||||
hrcnResourceData.hour1LineWidth,
|
|
||||||
hrcnResourceData.hour2LineWidth};
|
|
||||||
final Boolean[] sequenceIdEnables = {hrcnResourceData.hour0sequenceIdEnable,
|
|
||||||
hrcnResourceData.hour1sequenceIdEnable,
|
|
||||||
hrcnResourceData.hour2sequenceIdEnable};
|
|
||||||
|
|
||||||
|
// ...display TCM PGEN object for all forecast hours.
|
||||||
|
|
||||||
|
|
||||||
// Loop through the (preprocessed) convective SIGMET data records
|
|
||||||
// (This should be fast.)
|
|
||||||
Collection<HrcnRscDataObj> hrcnDataValues = currFrameData.hrcnDataMap.values();
|
|
||||||
|
|
||||||
for (HrcnRscDataObj hrcnData : hrcnDataValues) {
|
|
||||||
|
|
||||||
// Check for invalid time range
|
DisplayElementFactory df = new DisplayElementFactory(target,
|
||||||
// TODO: See if this is still needed/valid...
|
getNcMapDescriptor());
|
||||||
// if (activeFrameTime.compareTo(hrcnData.startTime) < 0 ||
|
ArrayList<IDisplayable> displayEls = df.createDisplayElements(
|
||||||
// activeFrameTime.compareTo(hrcnData.endTime) >= 0) continue;
|
tcm, paintProps);
|
||||||
|
for (IDisplayable each : displayEls) {
|
||||||
// Just some 'safety' defaults
|
each.draw(target, paintProps);
|
||||||
boolean enable = false;
|
each.dispose();
|
||||||
RGB color = new RGB (155, 155, 155);
|
}
|
||||||
int lineWidth = 2;
|
}
|
||||||
boolean sequenceIdEnable = true;
|
/*
|
||||||
|
* // Put per-hour options into arrays for easy lookup final
|
||||||
// Are we moving? (Decoder uses negative numbers to say no.)
|
* Boolean[] enables = {hrcnResourceData.hour0Enable,
|
||||||
boolean inMotion = (hrcnData.direction >= 0) && (hrcnData.speed > 0);
|
* hrcnResourceData.hour1Enable, hrcnResourceData.hour2Enable};
|
||||||
|
* final RGB[] colors = {hrcnResourceData.hour0Color,
|
||||||
for (int hour = 0; hour <= 2; hour++) {
|
* hrcnResourceData.hour1Color, hrcnResourceData.hour2Color}; final
|
||||||
switch (hrcnData.classType) {
|
* int[] lineWidths = {hrcnResourceData.hour0LineWidth,
|
||||||
case AREA:
|
* hrcnResourceData.hour1LineWidth,
|
||||||
case LINE:
|
* hrcnResourceData.hour2LineWidth}; final Boolean[]
|
||||||
case ISOL: // these (may) have motion; set hourly parameters
|
* sequenceIdEnables = {hrcnResourceData.hour0sequenceIdEnable,
|
||||||
enable = enables[hour] && (hour == 0 || inMotion);
|
* hrcnResourceData.hour1sequenceIdEnable,
|
||||||
color = colors[hour];
|
* hrcnResourceData.hour2sequenceIdEnable};
|
||||||
lineWidth = lineWidths[hour];
|
*
|
||||||
sequenceIdEnable = sequenceIdEnables[hour];
|
*
|
||||||
break;
|
*
|
||||||
case OUTLOOK: // no motion; draw only zero hour (if enabled)
|
*
|
||||||
enable = (hour == 0) && hrcnResourceData.getOutlookEnable();
|
* // Loop through the (preprocessed) convective SIGMET data records
|
||||||
color = hrcnResourceData.getOutlookColor();
|
* // (This should be fast.) Collection<HrcnRscDataObj>
|
||||||
lineWidth = hrcnResourceData.getOutlookLineWidth();
|
* hrcnDataValues = currFrameData.hrcnDataMap.values();
|
||||||
sequenceIdEnable = true; // cannot disable sequence ID for outlooks unless outlooks disabled altogether
|
*
|
||||||
break;
|
* for (HrcnRscDataObj hrcnData : hrcnDataValues) {
|
||||||
case CS: // nil convective SIGMET
|
*
|
||||||
enable = false;
|
* // Check for invalid time range // TODO: See if this is still
|
||||||
break;
|
* needed/valid... // if
|
||||||
case UNKNOWN: //TODO: Sanity check error! Unrecognized class type.
|
* (activeFrameTime.compareTo(hrcnData.startTime) < 0 || //
|
||||||
enable = false;
|
* activeFrameTime.compareTo(hrcnData.endTime) >= 0) continue;
|
||||||
break;
|
*
|
||||||
default:
|
* // Just some 'safety' defaults boolean enable = false; RGB color
|
||||||
}
|
* = new RGB (155, 155, 155); int lineWidth = 2; boolean
|
||||||
if (enable) {
|
* sequenceIdEnable = true;
|
||||||
PixelCoordinate prevLoc = null;
|
*
|
||||||
PixelCoordinate topLocation = null; // text placed above (screen, not necessarily north) this won't interfere with the geometry
|
* // Are we moving? (Decoder uses negative numbers to say no.)
|
||||||
double longitudeAtTopLocation = 0.0;
|
* boolean inMotion = (hrcnData.direction >= 0) && (hrcnData.speed >
|
||||||
for (int i=0; i<hrcnData.numPoints; i++) {
|
* 0);
|
||||||
LatLonPoint currentPoint = hrcnData.points[i];
|
*
|
||||||
if (currentPoint == null) continue; // gracefully skip over omitted points (say, location lookup failure)
|
* for (int hour = 0; hour <= 2; hour++) { switch
|
||||||
if (hour > 0) {
|
* (hrcnData.classType) { case AREA: case LINE: case ISOL: // these
|
||||||
// extrapolate position in future
|
* (may) have motion; set hourly parameters enable = enables[hour]
|
||||||
double headingRadians = Math.toRadians((double) (360 - (hrcnData.direction + 180) % 360)); // TO instead of FROM; CCW instead of CW);
|
* && (hour == 0 || inMotion); color = colors[hour]; lineWidth =
|
||||||
double distanceRadians = hour * hrcnData.speed * ONE_NM_RADIANS;
|
* lineWidths[hour]; sequenceIdEnable = sequenceIdEnables[hour];
|
||||||
currentPoint = currentPoint.positionOf(headingRadians, distanceRadians);
|
* break; case OUTLOOK: // no motion; draw only zero hour (if
|
||||||
}
|
* enabled) enable = (hour == 0) &&
|
||||||
double[] latLon = { currentPoint.getLongitude(LatLonPoint.INDEGREES),
|
* hrcnResourceData.getOutlookEnable(); color =
|
||||||
currentPoint.getLatitude(LatLonPoint.INDEGREES) };
|
* hrcnResourceData.getOutlookColor(); lineWidth =
|
||||||
PixelCoordinate currLoc = new PixelCoordinate(descriptor.worldToPixel(latLon));
|
* hrcnResourceData.getOutlookLineWidth(); sequenceIdEnable = true;
|
||||||
if (prevLoc != null) { // skip first location
|
* // cannot disable sequence ID for outlooks unless outlooks
|
||||||
// draw line/polygon segment
|
* disabled altogether break; case CS: // nil convective SIGMET
|
||||||
target.drawLine(prevLoc.getX(), prevLoc.getY(), prevLoc.getZ(),
|
* enable = false; break; case UNKNOWN: //TODO: Sanity check error!
|
||||||
currLoc.getX(), currLoc.getY(), currLoc.getZ(), color, lineWidth);
|
* Unrecognized class type. enable = false; break; default: } if
|
||||||
}
|
* (enable) { PixelCoordinate prevLoc = null; PixelCoordinate
|
||||||
else if (hrcnData.numPoints == 1) { //TODO: Check for classType ISOL instead or in addition?
|
* topLocation = null; // text placed above (screen, not necessarily
|
||||||
// single point; draw marker and circle
|
* north) this won't interfere with the geometry double
|
||||||
double delta = offsetY * 0.3; // tune to match NMAP
|
* longitudeAtTopLocation = 0.0; for (int i=0; i<hrcnData.numPoints;
|
||||||
target.drawLine(currLoc.getX()-delta, currLoc.getY(), currLoc.getZ(),
|
* i++) { LatLonPoint currentPoint = hrcnData.points[i]; if
|
||||||
currLoc.getX()+delta, currLoc.getY(), currLoc.getZ(), color, lineWidth);
|
* (currentPoint == null) continue; // gracefully skip over omitted
|
||||||
target.drawLine(currLoc.getX(), currLoc.getY()-delta, currLoc.getZ(),
|
* points (say, location lookup failure) if (hour > 0) { //
|
||||||
currLoc.getX(), currLoc.getY()+delta, currLoc.getZ(), color, lineWidth);
|
* extrapolate position in future double headingRadians =
|
||||||
double radius = hrcnData.distance / 2.0;
|
* Math.toRadians((double) (360 - (hrcnData.direction + 180) %
|
||||||
target.drawCircle(currLoc.getX(), currLoc.getY(), currLoc.getZ(), radius, color, lineWidth);
|
* 360)); // TO instead of FROM; CCW instead of CW); double
|
||||||
topLocation = new PixelCoordinate(currLoc.getX(), currLoc.getY()-radius); // circle top
|
* distanceRadians = hour * hrcnData.speed * ONE_NM_RADIANS;
|
||||||
}
|
* currentPoint = currentPoint.positionOf(headingRadians,
|
||||||
if (topLocation == null || topLocation.getY() > currLoc.getY()) {
|
* distanceRadians); } double[] latLon = {
|
||||||
topLocation = currLoc;
|
* currentPoint.getLongitude(LatLonPoint.INDEGREES),
|
||||||
longitudeAtTopLocation = latLon[0];
|
* currentPoint.getLatitude(LatLonPoint.INDEGREES) };
|
||||||
}
|
* PixelCoordinate currLoc = new
|
||||||
prevLoc = currLoc;
|
* PixelCoordinate(descriptor.worldToPixel(latLon)); if (prevLoc !=
|
||||||
}
|
* null) { // skip first location // draw line/polygon segment
|
||||||
|
* target.drawLine(prevLoc.getX(), prevLoc.getY(), prevLoc.getZ(),
|
||||||
// Draw labels
|
* currLoc.getX(), currLoc.getY(), currLoc.getZ(), color,
|
||||||
|
* lineWidth); } else if (hrcnData.numPoints == 1) { //TODO: Check
|
||||||
if (topLocation != null) {
|
* for classType ISOL instead or in addition? // single point; draw
|
||||||
|
* marker and circle double delta = offsetY * 0.3; // tune to match
|
||||||
// Use an ArrayList since we don't know in advance how big it'll be and would like
|
* NMAP target.drawLine(currLoc.getX()-delta, currLoc.getY(),
|
||||||
List<String> labelList = new ArrayList<String>();
|
* currLoc.getZ(), currLoc.getX()+delta, currLoc.getY(),
|
||||||
|
* currLoc.getZ(), color, lineWidth);
|
||||||
HorizontalAlignment horizontalAlignment = HorizontalAlignment.LEFT;
|
* target.drawLine(currLoc.getX(), currLoc.getY()-delta,
|
||||||
|
* currLoc.getZ(), currLoc.getX(), currLoc.getY()+delta,
|
||||||
if (sequenceIdEnable) {
|
* currLoc.getZ(), color, lineWidth); double radius =
|
||||||
if (hrcnData.classType == ClassType.OUTLOOK) {
|
* hrcnData.distance / 2.0; target.drawCircle(currLoc.getX(),
|
||||||
// Prevent label overlap when West & Central OR Central & East outlook
|
* currLoc.getY(), currLoc.getZ(), radius, color, lineWidth);
|
||||||
// polygons have coincident top points, by flipping some text to left
|
* topLocation = new PixelCoordinate(currLoc.getX(),
|
||||||
String outlookLabel = hrcnData.sequenceID + " OUTLOOK";
|
* currLoc.getY()-radius); // circle top } if (topLocation == null
|
||||||
if (hrcnData.sequenceID.endsWith("C") && longitudeAtTopLocation > -095.0 || //TODO: Tune longitude boundary?
|
* || topLocation.getY() > currLoc.getY()) { topLocation = currLoc;
|
||||||
hrcnData.sequenceID.endsWith("W") && longitudeAtTopLocation > -112.0 ) { //TODO: Tune longitude boundary?
|
* longitudeAtTopLocation = latLon[0]; } prevLoc = currLoc; }
|
||||||
horizontalAlignment = HorizontalAlignment.RIGHT;
|
*
|
||||||
outlookLabel += " ";
|
* // Draw labels
|
||||||
}
|
*
|
||||||
labelList.add(outlookLabel);
|
* if (topLocation != null) {
|
||||||
}
|
*
|
||||||
else {
|
* // Use an ArrayList since we don't know in advance how big it'll
|
||||||
labelList.add(hrcnData.sequenceID);
|
* be and would like List<String> labelList = new
|
||||||
}
|
* ArrayList<String>();
|
||||||
}
|
*
|
||||||
|
* HorizontalAlignment horizontalAlignment =
|
||||||
if (hour == 0 && hrcnData.classType != ClassType.OUTLOOK) {
|
* HorizontalAlignment.LEFT;
|
||||||
if (hrcnResourceData.timeEnable) {
|
*
|
||||||
String endTimeS = hrcnData.endTime.toString();
|
* if (sequenceIdEnable) { if (hrcnData.classType ==
|
||||||
labelList.add(endTimeS.substring(8, 10) + "/" // date
|
* ClassType.OUTLOOK) { // Prevent label overlap when West & Central
|
||||||
+ endTimeS.substring(11, 13) // hour
|
* OR Central & East outlook // polygons have coincident top points,
|
||||||
+ endTimeS.substring(14, 16)); // minute
|
* by flipping some text to left String outlookLabel =
|
||||||
}
|
* hrcnData.sequenceID + " OUTLOOK"; if
|
||||||
|
* (hrcnData.sequenceID.endsWith("C") && longitudeAtTopLocation >
|
||||||
if (hrcnResourceData.flightLevelEnable) {
|
* -095.0 || //TODO: Tune longitude boundary?
|
||||||
labelList.add("FL" + hrcnData.flightLevel);
|
* hrcnData.sequenceID.endsWith("W") && longitudeAtTopLocation >
|
||||||
}
|
* -112.0 ) { //TODO: Tune longitude boundary? horizontalAlignment =
|
||||||
|
* HorizontalAlignment.RIGHT; outlookLabel += " "; }
|
||||||
if (hrcnResourceData.motionEnable && inMotion) {
|
* labelList.add(outlookLabel); } else {
|
||||||
labelList.add(String.format("%03d", // leading zeroes for direction
|
* labelList.add(hrcnData.sequenceID); } }
|
||||||
hrcnData.direction) + " " +
|
*
|
||||||
hrcnData.speed + "kt");
|
* if (hour == 0 && hrcnData.classType != ClassType.OUTLOOK) { if
|
||||||
}
|
* (hrcnResourceData.timeEnable) { String endTimeS =
|
||||||
|
* hrcnData.endTime.toString(); labelList.add(endTimeS.substring(8,
|
||||||
if (hrcnResourceData.intensityEnable && hrcnData.intensity != null &&
|
* 10) + "/" // date + endTimeS.substring(11, 13) // hour +
|
||||||
!hrcnData.intensity.isEmpty()) {
|
* endTimeS.substring(14, 16)); // minute }
|
||||||
labelList.add(hrcnData.intensity);
|
*
|
||||||
}
|
* if (hrcnResourceData.flightLevelEnable) { labelList.add("FL" +
|
||||||
}
|
* hrcnData.flightLevel); }
|
||||||
|
*
|
||||||
if (!labelList.isEmpty()) {
|
* if (hrcnResourceData.motionEnable && inMotion) {
|
||||||
target.drawStrings(font, labelList.toArray(new String[0]),
|
* labelList.add(String.format("%03d", // leading zeroes for
|
||||||
topLocation.getX(),
|
* direction hrcnData.direction) + " " + hrcnData.speed + "kt"); }
|
||||||
topLocation.getY() - offsetY * (labelList.size()+0.5),
|
*
|
||||||
0.0,
|
* if (hrcnResourceData.intensityEnable && hrcnData.intensity !=
|
||||||
TextStyle.NORMAL,
|
* null && !hrcnData.intensity.isEmpty()) {
|
||||||
new RGB[] {color, color, color, color, color, color}, //TODO: Dorky!!
|
* labelList.add(hrcnData.intensity); } }
|
||||||
horizontalAlignment,
|
*
|
||||||
VerticalAlignment.TOP);
|
* if (!labelList.isEmpty()) { target.drawStrings(font,
|
||||||
}
|
* labelList.toArray(new String[0]), topLocation.getX(),
|
||||||
}
|
* topLocation.getY() - offsetY * (labelList.size()+0.5), 0.0,
|
||||||
}
|
* TextStyle.NORMAL, new RGB[] {color, color, color, color, color,
|
||||||
}
|
* color}, //TODO: Dorky!! horizontalAlignment,
|
||||||
}
|
* VerticalAlignment.TOP); } } } } }
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
font.dispose();
|
font.dispose();
|
||||||
font = null;
|
font = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Tcm buildTcmDrawableElement(TcmRecord tr) {
|
private Tcm buildTcmDrawableElement(TcmRecord tr, boolean obsOnly) {
|
||||||
// Generate a Tcm (DrawableElement) to represent all
|
// Generate a Tcm (DrawableElement) to represent all
|
||||||
// forecast hours covered by the TcmRecord (PDO).
|
// forecast hours covered by the TcmRecord (PDO).
|
||||||
|
|
||||||
Tcm t = new Tcm(
|
Tcm t = new Tcm(tr.getStormType(), toInt(tr.getStormNumber()),
|
||||||
tr.getStormType(),
|
toInt(tr.getAdvisoryNumber()),
|
||||||
toInt(tr.getStormNumber()),
|
tr.getStormName(),
|
||||||
toInt(tr.getAdvisoryNumber()),
|
tr.getBasin(),
|
||||||
tr.getStormName(),
|
tr.getEyeSize() == null ? 0 : tr.getEyeSize(), // TODO: check
|
||||||
tr.getBasin(),
|
// this out!!
|
||||||
tr.getEyeSize() == null ? 0 : tr.getEyeSize(), //TODO: check this out!!
|
tr.getPositionAccuracy() == null ? 0 : tr.getPositionAccuracy(), // TODO:
|
||||||
tr.getPositionAccuracy() == null ? 0 : tr.getPositionAccuracy(), //TODO: check this out!!
|
// check
|
||||||
tr.getCorr(),
|
// this
|
||||||
tr.getObsTime(),
|
// out!!
|
||||||
tr.getCentralPressure());
|
tr.getCorr(), tr.getObsTime(), tr.getCentralPressure());
|
||||||
|
|
||||||
List<TcmFcst> ltf = new ArrayList<TcmFcst>();
|
List<TcmFcst> ltf = new ArrayList<TcmFcst>();
|
||||||
for (TcmPositionWinds tpw : tr.getTcmPosWinds()) {
|
for (TcmPositionWinds tpw : tr.getTcmPosWinds()) {
|
||||||
TcmFcst tf = buildTcmFcstDrawableElement(tpw);
|
// skip F00 like NMAP
|
||||||
ltf.add(tf);
|
if (tpw.getFcstHour().equalsIgnoreCase("F00"))
|
||||||
}
|
continue;
|
||||||
Collections.sort(ltf, new Comparator<TcmFcst>() {
|
|
||||||
public int compare (TcmFcst tf1, TcmFcst tf2) {
|
TcmFcst tf = buildTcmFcstDrawableElement(tpw);
|
||||||
return tf1.getFcstHr() - tf2.getFcstHr();
|
ltf.add(tf);
|
||||||
}
|
|
||||||
});
|
// add 12 feet wave
|
||||||
t.setTcmFcst(ltf);
|
|
||||||
|
if (tpw.getFcstHour().equalsIgnoreCase("OBS")) {
|
||||||
TcmWindQuarters twq = new TcmWindQuarters(new Coordinate(0.0, 0.0), 0, 1.0, 1.0, 1.0, 1.0);
|
TcmWindQuarters wave = new TcmWindQuarters(new Coordinate(
|
||||||
t.setWaveQuatro(twq);
|
tpw.getClon(), tpw.getClat()), 0,
|
||||||
|
toDouble(tr.getNe12ft()), toDouble(tr.getSe12ft()),
|
||||||
return t;
|
toDouble(tr.getSw12ft()), toDouble(tr.getNw12ft()));
|
||||||
|
t.setWaveQuatro(wave);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Collections.sort(ltf, new Comparator<TcmFcst>() {
|
||||||
|
public int compare(TcmFcst tf1, TcmFcst tf2) {
|
||||||
|
return tf1.getFcstHr() - tf2.getFcstHr();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
t.setTcmFcst(ltf);
|
||||||
|
|
||||||
|
// TcmWindQuarters twq = new TcmWindQuarters(new Coordinate(0.0, 0.0),
|
||||||
|
// 0, 1.0, 1.0, 1.0, 1.0);
|
||||||
|
// t.setWaveQuatro(twq);
|
||||||
|
|
||||||
|
return t;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private Tcm buildObsTcmDrawableElement(TcmRecord tr) {
|
||||||
|
// Generate a Tcm (DrawableElement) to represent all
|
||||||
|
// forecast hours covered by the TcmRecord (PDO).
|
||||||
|
|
||||||
|
Tcm t = new Tcm(tr.getStormType(), toInt(tr.getStormNumber()),
|
||||||
|
toInt(tr.getAdvisoryNumber()),
|
||||||
|
tr.getStormName(),
|
||||||
|
tr.getBasin(),
|
||||||
|
tr.getEyeSize() == null ? 0 : tr.getEyeSize(), // TODO: check
|
||||||
|
// this out!!
|
||||||
|
tr.getPositionAccuracy() == null ? 0 : tr.getPositionAccuracy(), // TODO:
|
||||||
|
// check
|
||||||
|
// this
|
||||||
|
// out!!
|
||||||
|
tr.getCorr(), tr.getObsTime(), tr.getCentralPressure());
|
||||||
|
|
||||||
|
List<TcmFcst> ltf = new ArrayList<TcmFcst>();
|
||||||
|
for (TcmPositionWinds tpw : tr.getTcmPosWinds()) {
|
||||||
|
// skip F00 like NMAP
|
||||||
|
if (tpw.getFcstHour().equalsIgnoreCase("OBS")) {
|
||||||
|
|
||||||
|
final double[][] quatros = { { 0, 0, 0 }, { 0, 0, 0 },
|
||||||
|
{ 0, 0, 0 }, { 0, 0, 0 }, };
|
||||||
|
|
||||||
|
TcmFcst tf = new TcmFcst(new Coordinate(tpw.getClon(),
|
||||||
|
tpw.getClat()), toInt(tpw.getFcstHour()
|
||||||
|
.replace("F", "")), // TODO: Check
|
||||||
|
// replace/replaceAll/replaceFirst,
|
||||||
|
// etc...
|
||||||
|
quatros);
|
||||||
|
|
||||||
|
tf.setGust(tpw.getGust());
|
||||||
|
tf.setWindMax(tpw.getWindMax());
|
||||||
|
tf.setDirection(tpw.getStormDrct());
|
||||||
|
tf.setSpeed(tpw.getStormSped());
|
||||||
|
tf.setEndtime(tpw.getValidTime());
|
||||||
|
|
||||||
|
ltf.add(tf);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
t.setTcmFcst(ltf);
|
||||||
|
|
||||||
|
TcmWindQuarters twq = new TcmWindQuarters(new Coordinate(0.0, 0.0), 0,
|
||||||
|
1.0, 1.0, 1.0, 1.0);
|
||||||
|
t.setWaveQuatro(twq);
|
||||||
|
|
||||||
|
return t;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private TcmFcst buildTcmFcstDrawableElement(TcmPositionWinds tpw) {
|
private TcmFcst buildTcmFcstDrawableElement(TcmPositionWinds tpw) {
|
||||||
// Generate a single TcmFcst (DrawableElement) to represent a given
|
// Generate a single TcmFcst (DrawableElement) to represent a given
|
||||||
// TcmPositionWinds -- both correspond to one forecast hour.
|
// TcmPositionWinds -- both correspond to one forecast hour.
|
||||||
|
|
||||||
TcmFcst tf = new TcmFcst (
|
TcmFcst tf = new TcmFcst(new Coordinate(tpw.getClon(), tpw.getClat()),
|
||||||
new Coordinate(tpw.getClon(), tpw.getClat()),
|
toInt(tpw.getFcstHour().replace("F", "")), // TODO: Check
|
||||||
toInt(tpw.getFcstHour().replace("F","")), //TODO: Check replace/replaceAll/replaceFirst, etc...
|
// replace/replaceAll/replaceFirst,
|
||||||
buildQuatros(tpw));
|
// etc...
|
||||||
|
buildQuatros(tpw));
|
||||||
tf.setGust(tpw.getGust());
|
|
||||||
tf.setWindMax(tpw.getWindMax());
|
tf.setGust(tpw.getGust());
|
||||||
tf.setDirection(tpw.getStormDrct());
|
tf.setWindMax(tpw.getWindMax());
|
||||||
tf.setSpeed(tpw.getStormSped());
|
tf.setDirection(tpw.getStormDrct());
|
||||||
|
tf.setSpeed(tpw.getStormSped());
|
||||||
return tf;
|
tf.setEndtime(tpw.getValidTime());
|
||||||
|
|
||||||
|
return tf;
|
||||||
}
|
}
|
||||||
|
|
||||||
private double[][] buildQuatros(TcmPositionWinds tpw) {
|
private double[][] buildQuatros(TcmPositionWinds tpw) {
|
||||||
// Generate "quatros" arrays, given a TcmPositionWinds.
|
// Generate "quatros" arrays, given a TcmPositionWinds.
|
||||||
// These are needed to feed to the constructor for TcmFcst
|
// These are needed to feed to the constructor for TcmFcst
|
||||||
// (the only way to get them in there!)
|
// (the only way to get them in there!)
|
||||||
|
|
||||||
final double[][] quatros = {
|
final double[][] quatros = {
|
||||||
{ toDouble(tpw.getNe34k()), toDouble(tpw.getNe50k()), toDouble(tpw.getNe64k()) },
|
{ toDouble(tpw.getNe34k()), toDouble(tpw.getNe50k()),
|
||||||
{ toDouble(tpw.getSe34k()), toDouble(tpw.getSe50k()), toDouble(tpw.getSe64k()) },
|
toDouble(tpw.getNe64k()) },
|
||||||
{ toDouble(tpw.getSw34k()), toDouble(tpw.getSw50k()), toDouble(tpw.getSw64k()) },
|
{ toDouble(tpw.getSe34k()), toDouble(tpw.getSe50k()),
|
||||||
{ toDouble(tpw.getNw34k()), toDouble(tpw.getNw50k()), toDouble(tpw.getNw64k()) }
|
toDouble(tpw.getSe64k()) },
|
||||||
};
|
{ toDouble(tpw.getSw34k()), toDouble(tpw.getSw50k()),
|
||||||
|
toDouble(tpw.getSw64k()) },
|
||||||
return quatros;
|
{ toDouble(tpw.getNw34k()), toDouble(tpw.getNw50k()),
|
||||||
|
toDouble(tpw.getNw64k()) } };
|
||||||
|
|
||||||
|
return quatros;
|
||||||
}
|
}
|
||||||
|
|
||||||
// A couple of utility conversion routines, needed because there are cases
|
// A couple of utility conversion routines, needed because there are cases
|
||||||
// where we need numbers where the decoder hands us strings.
|
// where we need numbers where the decoder hands us strings.
|
||||||
// TODO: Consider doing this in decoder.
|
// TODO: Consider doing this in decoder.
|
||||||
// TODO: Are there public utilities to do this with graceful exception handling?
|
// TODO: Are there public utilities to do this with graceful exception
|
||||||
|
// handling?
|
||||||
|
|
||||||
double toDouble(String s) {
|
double toDouble(String s) {
|
||||||
Double d;
|
Double d;
|
||||||
try {
|
try {
|
||||||
d = Double.parseDouble(s);
|
d = Double.parseDouble(s);
|
||||||
}
|
} catch (NullPointerException e) {
|
||||||
catch (NullPointerException e) {
|
// TODO: Handle this more gracefully
|
||||||
//TODO: Handle this more gracefully
|
d = 0.0;
|
||||||
d = 0.0;
|
} catch (NumberFormatException e) {
|
||||||
}
|
// TODO: Log as bogus decoder output
|
||||||
catch (NumberFormatException e) {
|
d = 0.0;
|
||||||
//TODO: Log as bogus decoder output
|
}
|
||||||
d = 0.0;
|
return d;
|
||||||
}
|
|
||||||
return d;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int toInt(String s) {
|
int toInt(String s) {
|
||||||
int i;
|
int i;
|
||||||
try {
|
try {
|
||||||
i = Integer.parseInt(s);
|
i = Integer.parseInt(s);
|
||||||
}
|
} catch (NullPointerException e) {
|
||||||
catch (NullPointerException e) {
|
// TODO: Handle this more gracefully
|
||||||
//TODO: Handle this more gracefully
|
i = 0;
|
||||||
i = 0;
|
} catch (NumberFormatException e) {
|
||||||
}
|
// TODO: Log as bogus decoder output
|
||||||
catch (NumberFormatException e) {
|
i = 0;
|
||||||
//TODO: Log as bogus decoder output
|
}
|
||||||
i = 0;
|
return i;
|
||||||
}
|
}
|
||||||
return i;
|
|
||||||
}
|
@Override
|
||||||
|
public void disposeInternal() {
|
||||||
|
super.disposeInternal();
|
||||||
|
// if( font != null ) {
|
||||||
@Override
|
// font.dispose();
|
||||||
public void disposeInternal() {
|
// }
|
||||||
super.disposeInternal();
|
}
|
||||||
// if( font != null ) {
|
|
||||||
// font.dispose();
|
public void resourceAttrsModified() {
|
||||||
// }
|
// don't need to do anything
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
String legendString = super.getName();
|
||||||
|
FrameData fd = (FrameData) getCurrentFrame();
|
||||||
|
if (fd == null || fd.getFrameTime() == null
|
||||||
|
|| fd.tcmNameToDrawableElementMap.size() == 0) {
|
||||||
|
return legendString + "-No Data";
|
||||||
|
}
|
||||||
|
return legendString + " "
|
||||||
|
+ NmapCommon.getTimeStringFromDataTime(fd.getFrameTime(), "/");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected synchronized boolean processNewRscDataList() {
|
||||||
|
super.processNewRscDataList();
|
||||||
|
|
||||||
|
for (AbstractFrameData frameData : frameDataMap.values()) {
|
||||||
|
if (frameData != null
|
||||||
|
&& frameData instanceof HrcnResource.FrameData) {
|
||||||
|
((HrcnResource.FrameData) frameData).createTcmMap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resourceAttrsModified() {
|
|
||||||
// don't need to do anything
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
String legendString = super.getName();
|
|
||||||
FrameData fd = (FrameData) getCurrentFrame();
|
|
||||||
if (fd == null || fd.getFrameTime() == null || fd.tcmNameToDrawableElementMap.size() == 0) {
|
|
||||||
return legendString + "-No Data";
|
|
||||||
}
|
|
||||||
return legendString + " "+ NmapCommon.getTimeStringFromDataTime( fd.getFrameTime(), "/");
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,24 +1,19 @@
|
||||||
package gov.noaa.nws.ncep.viz.rsc.lightning.rsc;
|
package gov.noaa.nws.ncep.viz.rsc.lightning.rsc;
|
||||||
|
|
||||||
import gov.noaa.nws.ncep.viz.common.ui.color.ColorButtonSelector;
|
|
||||||
import gov.noaa.nws.ncep.viz.common.ui.color.ColorMatrixSelector;
|
|
||||||
import gov.noaa.nws.ncep.viz.resources.INatlCntrsResourceData;
|
import gov.noaa.nws.ncep.viz.resources.INatlCntrsResourceData;
|
||||||
import gov.noaa.nws.ncep.viz.resources.attributes.AbstractEditResourceAttrsDialog;
|
import gov.noaa.nws.ncep.viz.resources.attributes.AbstractEditResourceAttrsDialog;
|
||||||
import gov.noaa.nws.ncep.viz.resources.attributes.ResourceAttrSet.RscAttrValue;
|
import gov.noaa.nws.ncep.viz.resources.attributes.ResourceAttrSet.RscAttrValue;
|
||||||
import gov.noaa.nws.ncep.viz.resources.colorBar.ColorBarEditor;
|
import gov.noaa.nws.ncep.viz.resources.colorBar.ColorBarEditor;
|
||||||
import gov.noaa.nws.ncep.viz.resources.misc.IMiscResourceData.EditElement;
|
|
||||||
import gov.noaa.nws.ncep.viz.ui.display.ColorBar;
|
import gov.noaa.nws.ncep.viz.ui.display.ColorBar;
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.SelectionAdapter;
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
import org.eclipse.swt.graphics.RGB;
|
|
||||||
import org.eclipse.swt.layout.FormAttachment;
|
import org.eclipse.swt.layout.FormAttachment;
|
||||||
import org.eclipse.swt.layout.FormData;
|
import org.eclipse.swt.layout.FormData;
|
||||||
import org.eclipse.swt.layout.FormLayout;
|
import org.eclipse.swt.layout.FormLayout;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
import org.eclipse.swt.widgets.Button;
|
import org.eclipse.swt.widgets.Button;
|
||||||
import org.eclipse.swt.widgets.Combo;
|
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Group;
|
import org.eclipse.swt.widgets.Group;
|
||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
@ -27,16 +22,17 @@ import org.eclipse.swt.widgets.Slider;
|
||||||
import org.eclipse.swt.widgets.Text;
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An interface to edit Lightning resource attributes.
|
* An interface to edit Lightning resource attributes.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* 04/10/2010 #257 Greg Hull Initial Creation.
|
* 04/10/2010 #257 Greg Hull Initial Creation.
|
||||||
* 04/11/2010 #259 Greg Hull Added ColorBar
|
* 04/11/2010 #259 Greg Hull Added ColorBar
|
||||||
* 04/27/2010 #245 Greg Hull Added Apply Button
|
* 04/27/2010 #245 Greg Hull Added Apply Button
|
||||||
|
* 07/01/2014 TTR 1018 Steve Russell Updated call to ColorBarEditor
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -44,330 +40,317 @@ import org.eclipse.swt.widgets.Text;
|
||||||
* @version 1
|
* @version 1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class EditLightningAttrsDialog extends AbstractEditResourceAttrsDialog {
|
public class EditLightningAttrsDialog extends AbstractEditResourceAttrsDialog {
|
||||||
|
|
||||||
public EditLightningAttrsDialog(Shell parentShell, INatlCntrsResourceData r, Boolean apply) {
|
|
||||||
super(parentShell, r, apply);
|
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
}
|
|
||||||
|
|
||||||
private Button enablePosStrikesBtn = null;
|
public EditLightningAttrsDialog(Shell parentShell, INatlCntrsResourceData r, Boolean apply) {
|
||||||
private Button enableNegStrikesBtn = null;
|
super(parentShell, r, apply);
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
private Button enablePosStrikesBtn = null;
|
||||||
|
|
||||||
|
private Button enableNegStrikesBtn = null;
|
||||||
|
|
||||||
private RscAttrValue colorByIntensityAttr = null;
|
private RscAttrValue colorByIntensityAttr = null;
|
||||||
|
|
||||||
private RscAttrValue enablePosStrikesAttr = null;
|
private RscAttrValue enablePosStrikesAttr = null;
|
||||||
|
|
||||||
private RscAttrValue enableNegStrikesAttr = null;
|
private RscAttrValue enableNegStrikesAttr = null;
|
||||||
|
|
||||||
private RscAttrValue posSymbolSizeAttr = null;
|
private RscAttrValue posSymbolSizeAttr = null;
|
||||||
|
|
||||||
private RscAttrValue negSymbolSizeAttr = null;
|
private RscAttrValue negSymbolSizeAttr = null;
|
||||||
|
|
||||||
private RscAttrValue colorBarAttr = null;
|
private RscAttrValue colorBarAttr = null;
|
||||||
|
|
||||||
private ColorBar editedColorBar = null;
|
private ColorBar editedColorBar = null;
|
||||||
|
|
||||||
private Group posStrikesGrp = null;
|
private Group posStrikesGrp = null;
|
||||||
private Group negStrikesGrp = null;
|
|
||||||
|
private Group negStrikesGrp = null;
|
||||||
|
|
||||||
private Composite lineWidComp1 = null;
|
private Composite lineWidComp1 = null;
|
||||||
|
|
||||||
private Composite lineWidComp2 = null;
|
private Composite lineWidComp2 = null;
|
||||||
|
|
||||||
private Label lwLbl1 = null;
|
private Label lwLbl1 = null;
|
||||||
|
|
||||||
private Label lwLbl2 = null;
|
private Label lwLbl2 = null;
|
||||||
|
|
||||||
private ColorBarEditor colorBarEditor = null;
|
private ColorBarEditor colorBarEditor = null;
|
||||||
|
|
||||||
|
|
||||||
//
|
@Override
|
||||||
@Override
|
public Composite createDialog(Composite topComp) {
|
||||||
public Composite createDialog( Composite topComp ) {
|
|
||||||
|
|
||||||
colorByIntensityAttr = editedRscAttrSet.getRscAttr( "colorByIntensity" );
|
|
||||||
enablePosStrikesAttr = editedRscAttrSet.getRscAttr( "enablePositiveStrikes" );
|
|
||||||
enableNegStrikesAttr = editedRscAttrSet.getRscAttr( "enableNegativeStrikes" );
|
|
||||||
posSymbolSizeAttr = editedRscAttrSet.getRscAttr( "positiveSymbolSize" );
|
|
||||||
negSymbolSizeAttr = editedRscAttrSet.getRscAttr( "negativeSymbolSize" );
|
|
||||||
colorBarAttr = editedRscAttrSet.getRscAttr( "colorBar" );
|
|
||||||
|
|
||||||
if( colorByIntensityAttr == null ||
|
colorByIntensityAttr = editedRscAttrSet.getRscAttr("colorByIntensity");
|
||||||
colorByIntensityAttr.getAttrClass() != Boolean.class ) {
|
enablePosStrikesAttr = editedRscAttrSet.getRscAttr("enablePositiveStrikes");
|
||||||
System.out.println("colorByIntensity is null or not of expected class Boolean?");
|
enableNegStrikesAttr = editedRscAttrSet.getRscAttr("enableNegativeStrikes");
|
||||||
|
posSymbolSizeAttr = editedRscAttrSet.getRscAttr("positiveSymbolSize");
|
||||||
|
negSymbolSizeAttr = editedRscAttrSet.getRscAttr("negativeSymbolSize");
|
||||||
|
colorBarAttr = editedRscAttrSet.getRscAttr("colorBar");
|
||||||
|
|
||||||
|
if (colorByIntensityAttr == null || colorByIntensityAttr.getAttrClass() != Boolean.class) {
|
||||||
|
System.out.println("colorByIntensity is null or not of expected class Boolean?");
|
||||||
}
|
}
|
||||||
if( enablePosStrikesAttr == null ||
|
if (enablePosStrikesAttr == null || enablePosStrikesAttr.getAttrClass() != Boolean.class) {
|
||||||
enablePosStrikesAttr.getAttrClass() != Boolean.class ) {
|
System.out.println("enablePositiveStrikes is null or not of expected class Boolean?");
|
||||||
System.out.println("enablePositiveStrikes is null or not of expected class Boolean?");
|
|
||||||
}
|
}
|
||||||
if( enableNegStrikesAttr == null ||
|
if (enableNegStrikesAttr == null || enableNegStrikesAttr.getAttrClass() != Boolean.class) {
|
||||||
enableNegStrikesAttr.getAttrClass() != Boolean.class ) {
|
System.out.println("enableNegativeStrikes is null or not of expected class Boolean?");
|
||||||
System.out.println("enableNegativeStrikes is null or not of expected class Boolean?");
|
|
||||||
}
|
}
|
||||||
if( posSymbolSizeAttr == null ||
|
if (posSymbolSizeAttr == null || posSymbolSizeAttr.getAttrClass() != Integer.class) {
|
||||||
posSymbolSizeAttr.getAttrClass() != Integer.class ) {
|
System.out.println("posSymbolSize is null or not of expected class Integer?");
|
||||||
System.out.println("posSymbolSize is null or not of expected class Integer?");
|
|
||||||
}
|
}
|
||||||
if( negSymbolSizeAttr == null ||
|
if (negSymbolSizeAttr == null || negSymbolSizeAttr.getAttrClass() != Integer.class) {
|
||||||
negSymbolSizeAttr.getAttrClass() != Integer.class ) {
|
System.out.println("negSymbolSize is null or not of expected class Integer?");
|
||||||
System.out.println("negSymbolSize is null or not of expected class Integer?");
|
|
||||||
}
|
}
|
||||||
if( colorBarAttr == null ||
|
if (colorBarAttr == null || colorBarAttr.getAttrClass() != ColorBar.class) {
|
||||||
colorBarAttr.getAttrClass() != ColorBar.class ) {
|
System.out.println("colorBar is null or not of expected class colorBar?");
|
||||||
System.out.println("colorBar is null or not of expected class colorBar?");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
editedColorBar = (ColorBar)colorBarAttr.getAttrValue();
|
editedColorBar = (ColorBar) colorBarAttr.getAttrValue();
|
||||||
|
|
||||||
FormLayout layout0 = new FormLayout();
|
FormLayout layout0 = new FormLayout();
|
||||||
topComp.setLayout(layout0);
|
topComp.setLayout(layout0);
|
||||||
|
|
||||||
|
posStrikesGrp = new Group(topComp, SWT.SHADOW_NONE);
|
||||||
posStrikesGrp = new Group( topComp, SWT.SHADOW_NONE );
|
posStrikesGrp.setText("Positive Strikes");
|
||||||
posStrikesGrp.setText( "Positive Strikes");
|
|
||||||
FormData fd = new FormData();
|
FormData fd = new FormData();
|
||||||
fd.left = new FormAttachment( 0, 15 );
|
fd.left = new FormAttachment(0, 15);
|
||||||
fd.top = new FormAttachment( 0, 20 );
|
fd.top = new FormAttachment(0, 20);
|
||||||
fd.right = new FormAttachment( 50, -7 );
|
fd.right = new FormAttachment(50, -7);
|
||||||
posStrikesGrp.setLayoutData( fd );
|
posStrikesGrp.setLayoutData(fd);
|
||||||
posStrikesGrp.setLayout( new GridLayout(2,false) );
|
posStrikesGrp.setLayout(new GridLayout(2, false));
|
||||||
|
|
||||||
enablePosStrikesBtn = new Button( posStrikesGrp, SWT.CHECK );
|
|
||||||
enablePosStrikesBtn.setText( "Enable " );
|
|
||||||
|
|
||||||
// fd = new FormData();
|
enablePosStrikesBtn = new Button(posStrikesGrp, SWT.CHECK);
|
||||||
// fd.left = new FormAttachment( 0, 20 );
|
enablePosStrikesBtn.setText("Enable ");
|
||||||
// fd.top = new FormAttachment( colbarLbl, 30, SWT.BOTTOM );
|
|
||||||
// enablePosStrikesBtn.setLayoutData( fd );
|
// fd = new FormData();
|
||||||
enablePosStrikesBtn.setSelection( ((Boolean)enablePosStrikesAttr.getAttrValue()).booleanValue() );
|
// fd.left = new FormAttachment( 0, 20 );
|
||||||
|
// fd.top = new FormAttachment( colbarLbl, 30, SWT.BOTTOM );
|
||||||
enablePosStrikesBtn.addSelectionListener( new SelectionAdapter() {
|
// enablePosStrikesBtn.setLayoutData( fd );
|
||||||
public void widgetSelected(SelectionEvent e) {
|
enablePosStrikesBtn.setSelection(((Boolean) enablePosStrikesAttr.getAttrValue()).booleanValue());
|
||||||
enablePosStrikesAttr.setAttrValue( new Boolean( enablePosStrikesBtn.getSelection() ) );
|
|
||||||
lineWidComp1.setEnabled( enablePosStrikesBtn.getSelection() );
|
enablePosStrikesBtn.addSelectionListener(new SelectionAdapter() {
|
||||||
lwLbl1.setEnabled( enablePosStrikesBtn.getSelection() );
|
public void widgetSelected(SelectionEvent e) {
|
||||||
}
|
enablePosStrikesAttr.setAttrValue(new Boolean(enablePosStrikesBtn.getSelection()));
|
||||||
|
lineWidComp1.setEnabled(enablePosStrikesBtn.getSelection());
|
||||||
|
lwLbl1.setEnabled(enablePosStrikesBtn.getSelection());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
negStrikesGrp = new Group(topComp, SWT.SHADOW_NONE);
|
||||||
|
negStrikesGrp.setText("Negative Strikes");
|
||||||
negStrikesGrp = new Group( topComp, SWT.SHADOW_NONE );
|
|
||||||
negStrikesGrp.setText( "Negative Strikes");
|
|
||||||
fd = new FormData();
|
fd = new FormData();
|
||||||
fd.left = new FormAttachment( posStrikesGrp, 20, SWT.RIGHT );
|
fd.left = new FormAttachment(posStrikesGrp, 20, SWT.RIGHT);
|
||||||
fd.top = new FormAttachment( posStrikesGrp, 0, SWT.TOP );
|
fd.top = new FormAttachment(posStrikesGrp, 0, SWT.TOP);
|
||||||
fd.right = new FormAttachment( 100, -15 );
|
fd.right = new FormAttachment(100, -15);
|
||||||
//fd.right = new FormAttachment( 100, -20 );
|
//fd.right = new FormAttachment( 100, -20 );
|
||||||
negStrikesGrp.setLayoutData( fd );
|
negStrikesGrp.setLayoutData(fd);
|
||||||
negStrikesGrp.setLayout( new GridLayout(2,false) );
|
negStrikesGrp.setLayout(new GridLayout(2, false));
|
||||||
|
|
||||||
enableNegStrikesBtn = new Button( negStrikesGrp, SWT.CHECK );
|
enableNegStrikesBtn = new Button(negStrikesGrp, SWT.CHECK);
|
||||||
enableNegStrikesBtn.setText( "Enable " );
|
enableNegStrikesBtn.setText("Enable ");
|
||||||
// fd = new FormData();
|
// fd = new FormData();
|
||||||
// fd.left = new FormAttachment( enablePosStrikesBtn, 0, SWT.LEFT );
|
// fd.left = new FormAttachment( enablePosStrikesBtn, 0, SWT.LEFT );
|
||||||
// fd.top = new FormAttachment( enablePosStrikesBtn, 10, SWT.BOTTOM );
|
// fd.top = new FormAttachment( enablePosStrikesBtn, 10, SWT.BOTTOM );
|
||||||
// enableNegStrikesBtn.setLayoutData( fd );
|
// enableNegStrikesBtn.setLayoutData( fd );
|
||||||
enableNegStrikesBtn.setAlignment( SWT.RIGHT );
|
enableNegStrikesBtn.setAlignment(SWT.RIGHT);
|
||||||
enableNegStrikesBtn.setSelection( ((Boolean)enableNegStrikesAttr.getAttrValue()).booleanValue() );
|
enableNegStrikesBtn.setSelection(((Boolean) enableNegStrikesAttr.getAttrValue()).booleanValue());
|
||||||
|
|
||||||
enableNegStrikesBtn.addSelectionListener( new SelectionAdapter() {
|
enableNegStrikesBtn.addSelectionListener(new SelectionAdapter() {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
enableNegStrikesAttr.setAttrValue( new Boolean( enableNegStrikesBtn.getSelection() ) );
|
enableNegStrikesAttr.setAttrValue(new Boolean(enableNegStrikesBtn.getSelection()));
|
||||||
lineWidComp2.setEnabled( enableNegStrikesBtn.getSelection() );
|
lineWidComp2.setEnabled(enableNegStrikesBtn.getSelection());
|
||||||
lwLbl2.setEnabled( enableNegStrikesBtn.getSelection() );
|
lwLbl2.setEnabled(enableNegStrikesBtn.getSelection());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
lineWidComp1 = new Composite( posStrikesGrp, SWT.NONE );
|
|
||||||
lineWidComp1.setLayout( new FormLayout() );
|
|
||||||
|
|
||||||
// fd = new FormData( );
|
lineWidComp1 = new Composite(posStrikesGrp, SWT.NONE);
|
||||||
// fd.top = new FormAttachment( enableNegStrikesBtn, 20, SWT.BOTTOM );
|
lineWidComp1.setLayout(new FormLayout());
|
||||||
// fd.left = new FormAttachment( enableNegStrikesBtn, 0, SWT.LEFT );
|
|
||||||
// lineWidComp1.setLayoutData( fd );
|
|
||||||
|
|
||||||
|
// fd = new FormData( );
|
||||||
|
// fd.top = new FormAttachment( enableNegStrikesBtn, 20, SWT.BOTTOM );
|
||||||
|
// fd.left = new FormAttachment( enableNegStrikesBtn, 0, SWT.LEFT );
|
||||||
|
// lineWidComp1.setLayoutData( fd );
|
||||||
|
|
||||||
lwLbl1 = new Label( lineWidComp1, SWT.NONE );
|
lwLbl1 = new Label(lineWidComp1, SWT.NONE);
|
||||||
lwLbl1.setText( "Symbol Size" );
|
lwLbl1.setText("Symbol Size");
|
||||||
fd = new FormData( );
|
fd = new FormData();
|
||||||
fd.top = new FormAttachment( 0, 10 );
|
fd.top = new FormAttachment(0, 10);
|
||||||
fd.left = new FormAttachment( 0, 0 );
|
fd.left = new FormAttachment(0, 0);
|
||||||
lwLbl1.setLayoutData( fd );
|
lwLbl1.setLayoutData(fd);
|
||||||
|
|
||||||
final Slider widthSlider1 = new Slider( lineWidComp1, SWT.HORIZONTAL );
|
final Slider widthSlider1 = new Slider(lineWidComp1, SWT.HORIZONTAL);
|
||||||
widthSlider1.setValues( ((Integer)posSymbolSizeAttr.getAttrValue()).intValue(), 1, 11, 1, 1, 2 );
|
widthSlider1.setValues(((Integer) posSymbolSizeAttr.getAttrValue()).intValue(), 1, 11, 1, 1, 2);
|
||||||
fd = new FormData();//180,20);
|
fd = new FormData();//180,20);
|
||||||
fd.left = new FormAttachment( lwLbl1, 0, SWT.LEFT );
|
fd.left = new FormAttachment(lwLbl1, 0, SWT.LEFT);
|
||||||
fd.top = new FormAttachment( lwLbl1, 5, SWT.BOTTOM );
|
fd.top = new FormAttachment(lwLbl1, 5, SWT.BOTTOM);
|
||||||
widthSlider1.setLayoutData( fd );
|
widthSlider1.setLayoutData(fd);
|
||||||
|
|
||||||
final Text widthText1 = new Text( lineWidComp1, SWT.BORDER );
|
final Text widthText1 = new Text(lineWidComp1, SWT.BORDER);
|
||||||
widthText1.setText( ((Integer)posSymbolSizeAttr.getAttrValue()).toString() );
|
widthText1.setText(((Integer) posSymbolSizeAttr.getAttrValue()).toString());
|
||||||
fd = new FormData( 20, 20 );
|
fd = new FormData(20, 20);
|
||||||
fd.left = new FormAttachment( widthSlider1, 5, SWT.RIGHT );
|
fd.left = new FormAttachment(widthSlider1, 5, SWT.RIGHT);
|
||||||
fd.bottom = new FormAttachment( widthSlider1, 0, SWT.BOTTOM );
|
fd.bottom = new FormAttachment(widthSlider1, 0, SWT.BOTTOM);
|
||||||
fd.right = new FormAttachment( 100, -10 );
|
fd.right = new FormAttachment(100, -10);
|
||||||
widthText1.setLayoutData( fd );
|
widthText1.setLayoutData(fd);
|
||||||
|
|
||||||
widthSlider1.addSelectionListener( new SelectionAdapter() {
|
widthSlider1.addSelectionListener(new SelectionAdapter() {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
posSymbolSizeAttr.setAttrValue( new Integer( widthSlider1.getSelection() ) );
|
posSymbolSizeAttr.setAttrValue(new Integer(widthSlider1.getSelection()));
|
||||||
widthText1.setText( Integer.toString( widthSlider1.getSelection() ) );
|
widthText1.setText(Integer.toString(widthSlider1.getSelection()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
widthText1.addSelectionListener( new SelectionAdapter() {
|
widthText1.addSelectionListener(new SelectionAdapter() {
|
||||||
public void widgetDefaultSelected(SelectionEvent e) {
|
public void widgetDefaultSelected(SelectionEvent e) {
|
||||||
int ival;
|
int ival;
|
||||||
try {
|
try {
|
||||||
ival = Integer.parseInt( widthText1.getText() );
|
ival = Integer.parseInt(widthText1.getText());
|
||||||
}
|
} catch (NumberFormatException exc) {
|
||||||
catch( NumberFormatException exc ) {
|
ival = ((Integer) posSymbolSizeAttr.getAttrValue()).intValue();
|
||||||
ival = ((Integer)posSymbolSizeAttr.getAttrValue()).intValue();
|
widthText1.setText(Integer.toString(ival));
|
||||||
widthText1.setText( Integer.toString( ival ) );
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if( ival < widthSlider1.getMinimum() ) {
|
if (ival < widthSlider1.getMinimum()) {
|
||||||
ival = widthSlider1.getMinimum();
|
ival = widthSlider1.getMinimum();
|
||||||
widthText1.setText( Integer.toString( ival ) );
|
widthText1.setText(Integer.toString(ival));
|
||||||
}
|
} else if (ival > widthSlider1.getMaximum()) {
|
||||||
else if( ival > widthSlider1.getMaximum() ) {
|
ival = widthSlider1.getMaximum();
|
||||||
ival = widthSlider1.getMaximum();
|
widthText1.setText(Integer.toString(ival));
|
||||||
widthText1.setText( Integer.toString( ival ) );
|
}
|
||||||
}
|
|
||||||
|
|
||||||
widthSlider1.setSelection( ival );
|
widthSlider1.setSelection(ival);
|
||||||
|
|
||||||
posSymbolSizeAttr.setAttrValue( new Integer( ival ) );
|
posSymbolSizeAttr.setAttrValue(new Integer(ival));
|
||||||
}
|
}
|
||||||
|
|
||||||
// not called
|
// not called
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
System.out.println("widgetSelected called");
|
System.out.println("widgetSelected called");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
lineWidComp2 = new Composite(negStrikesGrp, SWT.NONE);
|
||||||
lineWidComp2 = new Composite( negStrikesGrp, SWT.NONE );
|
lineWidComp2.setLayout(new FormLayout());
|
||||||
lineWidComp2.setLayout( new FormLayout() );
|
|
||||||
|
|
||||||
// fd = new FormData( );
|
// fd = new FormData( );
|
||||||
// fd.top = new FormAttachment( lineWidComp1, 10, SWT.BOTTOM );
|
// fd.top = new FormAttachment( lineWidComp1, 10, SWT.BOTTOM );
|
||||||
// fd.left = new FormAttachment( lineWidComp1, 0, SWT.LEFT );
|
// fd.left = new FormAttachment( lineWidComp1, 0, SWT.LEFT );
|
||||||
// lineWidComp2.setLayoutData( fd );
|
// lineWidComp2.setLayoutData( fd );
|
||||||
|
|
||||||
|
lwLbl2 = new Label(lineWidComp2, SWT.NONE);
|
||||||
|
lwLbl2.setText("Symbol Size");
|
||||||
|
fd = new FormData();
|
||||||
|
fd.top = new FormAttachment(0, 10);
|
||||||
|
fd.left = new FormAttachment(0, 0);
|
||||||
|
lwLbl2.setLayoutData(fd);
|
||||||
|
|
||||||
lwLbl2 = new Label( lineWidComp2, SWT.NONE );
|
final Slider widthSlider2 = new Slider(lineWidComp2, SWT.HORIZONTAL);
|
||||||
lwLbl2.setText( "Symbol Size" );
|
widthSlider2.setValues(((Integer) negSymbolSizeAttr.getAttrValue()).intValue(), 1, 11, 1, 1, 2);
|
||||||
fd = new FormData( );
|
|
||||||
fd.top = new FormAttachment( 0, 10 );
|
|
||||||
fd.left = new FormAttachment( 0, 0 );
|
|
||||||
lwLbl2.setLayoutData( fd );
|
|
||||||
|
|
||||||
final Slider widthSlider2 = new Slider( lineWidComp2, SWT.HORIZONTAL );
|
|
||||||
widthSlider2.setValues( ((Integer)negSymbolSizeAttr.getAttrValue()).intValue(), 1, 11, 1, 1, 2 );
|
|
||||||
fd = new FormData();//180,20);
|
fd = new FormData();//180,20);
|
||||||
fd.left = new FormAttachment( lwLbl2, 0, SWT.LEFT );
|
fd.left = new FormAttachment(lwLbl2, 0, SWT.LEFT);
|
||||||
fd.top = new FormAttachment( lwLbl2, 5, SWT.BOTTOM );
|
fd.top = new FormAttachment(lwLbl2, 5, SWT.BOTTOM);
|
||||||
widthSlider2.setLayoutData( fd );
|
widthSlider2.setLayoutData(fd);
|
||||||
|
|
||||||
final Text widthText2 = new Text( lineWidComp2, SWT.BORDER );
|
final Text widthText2 = new Text(lineWidComp2, SWT.BORDER);
|
||||||
widthText2.setText( ((Integer)negSymbolSizeAttr.getAttrValue()).toString() );
|
widthText2.setText(((Integer) negSymbolSizeAttr.getAttrValue()).toString());
|
||||||
fd = new FormData( 20, 20 );
|
fd = new FormData(20, 20);
|
||||||
fd.left = new FormAttachment( widthSlider2, 5, SWT.RIGHT );
|
fd.left = new FormAttachment(widthSlider2, 5, SWT.RIGHT);
|
||||||
fd.bottom = new FormAttachment( widthSlider2, 0, SWT.BOTTOM );
|
fd.bottom = new FormAttachment(widthSlider2, 0, SWT.BOTTOM);
|
||||||
fd.right = new FormAttachment( 100, -10 );
|
fd.right = new FormAttachment(100, -10);
|
||||||
widthText2.setLayoutData( fd );
|
widthText2.setLayoutData(fd);
|
||||||
|
|
||||||
widthSlider2.addSelectionListener( new SelectionAdapter() {
|
widthSlider2.addSelectionListener(new SelectionAdapter() {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
negSymbolSizeAttr.setAttrValue( new Integer( widthSlider2.getSelection() ) );
|
negSymbolSizeAttr.setAttrValue(new Integer(widthSlider2.getSelection()));
|
||||||
widthText2.setText( Integer.toString( widthSlider2.getSelection() ) );
|
widthText2.setText(Integer.toString(widthSlider2.getSelection()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
widthText2.addSelectionListener( new SelectionAdapter() {
|
widthText2.addSelectionListener(new SelectionAdapter() {
|
||||||
public void widgetDefaultSelected(SelectionEvent e) {
|
public void widgetDefaultSelected(SelectionEvent e) {
|
||||||
int ival;
|
int ival;
|
||||||
try {
|
try {
|
||||||
ival = Integer.parseInt( widthText2.getText() );
|
ival = Integer.parseInt(widthText2.getText());
|
||||||
}
|
} catch (NumberFormatException exc) {
|
||||||
catch( NumberFormatException exc ) {
|
ival = ((Integer) negSymbolSizeAttr.getAttrValue()).intValue();
|
||||||
ival = ((Integer)negSymbolSizeAttr.getAttrValue()).intValue();
|
widthText2.setText(Integer.toString(ival));
|
||||||
widthText2.setText( Integer.toString( ival ) );
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if( ival < widthSlider2.getMinimum() ) {
|
if (ival < widthSlider2.getMinimum()) {
|
||||||
ival = widthSlider2.getMinimum();
|
ival = widthSlider2.getMinimum();
|
||||||
widthText2.setText( Integer.toString( ival ) );
|
widthText2.setText(Integer.toString(ival));
|
||||||
}
|
} else if (ival > widthSlider2.getMaximum()) {
|
||||||
else if( ival > widthSlider2.getMaximum() ) {
|
ival = widthSlider2.getMaximum();
|
||||||
ival = widthSlider2.getMaximum();
|
widthText2.setText(Integer.toString(ival));
|
||||||
widthText2.setText( Integer.toString( ival ) );
|
}
|
||||||
}
|
|
||||||
|
|
||||||
widthSlider2.setSelection( ival );
|
widthSlider2.setSelection(ival);
|
||||||
|
|
||||||
negSymbolSizeAttr.setAttrValue( new Integer( ival ) );
|
negSymbolSizeAttr.setAttrValue(new Integer(ival));
|
||||||
}
|
}
|
||||||
|
|
||||||
// not called
|
// not called
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
System.out.println("widgetSelected called");
|
System.out.println("widgetSelected called");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
lineWidComp1.setEnabled( enablePosStrikesBtn.getSelection() );
|
lineWidComp1.setEnabled(enablePosStrikesBtn.getSelection());
|
||||||
lineWidComp2.setEnabled( enableNegStrikesBtn.getSelection() );
|
lineWidComp2.setEnabled(enableNegStrikesBtn.getSelection());
|
||||||
|
|
||||||
|
Group colorBarGrp = new Group(topComp, SWT.NONE);
|
||||||
|
|
||||||
Group colorBarGrp = new Group( topComp, SWT.NONE );
|
|
||||||
colorBarGrp.setText("Edit Color Bar");
|
colorBarGrp.setText("Edit Color Bar");
|
||||||
fd = new FormData();//400,300);
|
fd = new FormData();//400,300);
|
||||||
fd.left = new FormAttachment( 0, 15 );
|
fd.left = new FormAttachment(0, 15);
|
||||||
fd.right = new FormAttachment( 100, -15 );
|
fd.right = new FormAttachment(100, -15);
|
||||||
fd.top = new FormAttachment( posStrikesGrp, 15, SWT.BOTTOM );
|
fd.top = new FormAttachment(posStrikesGrp, 15, SWT.BOTTOM);
|
||||||
fd.bottom = new FormAttachment( 100, -20 );
|
fd.bottom = new FormAttachment(100, -20);
|
||||||
colorBarGrp.setLayoutData( fd );
|
colorBarGrp.setLayoutData(fd);
|
||||||
|
|
||||||
colorBarGrp.setLayout( new FormLayout() );
|
colorBarGrp.setLayout(new FormLayout());
|
||||||
|
|
||||||
|
// final Combo colorByCombo = new Combo( colorBarGrp, SWT.DROP_DOWN | SWT.READ_ONLY );
|
||||||
// final Combo colorByCombo = new Combo( colorBarGrp, SWT.DROP_DOWN | SWT.READ_ONLY );
|
// fd = new FormData();
|
||||||
// fd = new FormData();
|
// fd.left = new FormAttachment( 0, 15 );
|
||||||
// fd.left = new FormAttachment( 0, 15 );
|
// fd.top = new FormAttachment( 0, 35 );
|
||||||
// fd.top = new FormAttachment( 0, 35 );
|
// colorByCombo.setLayoutData( fd );
|
||||||
// colorByCombo.setLayoutData( fd );
|
//
|
||||||
//
|
// colorByCombo.add("Time");
|
||||||
// colorByCombo.add("Time");
|
// colorByCombo.add("Intensity");
|
||||||
// colorByCombo.add("Intensity");
|
//
|
||||||
//
|
// colorByCombo.select( ((Boolean)colorByIntensityAttr.getAttrValue()).booleanValue() ? 1 : 0 );
|
||||||
// colorByCombo.select( ((Boolean)colorByIntensityAttr.getAttrValue()).booleanValue() ? 1 : 0 );
|
//
|
||||||
//
|
// colorByCombo.addSelectionListener( new SelectionAdapter() {
|
||||||
// colorByCombo.addSelectionListener( new SelectionAdapter() {
|
// public void widgetSelected(SelectionEvent e) {
|
||||||
// public void widgetSelected(SelectionEvent e) {
|
// colorByIntensityAttr.setAttrValue(
|
||||||
// colorByIntensityAttr.setAttrValue(
|
// new Boolean( (colorByCombo.getSelectionIndex() == 0 ? false : true ) ) );
|
||||||
// new Boolean( (colorByCombo.getSelectionIndex() == 0 ? false : true ) ) );
|
// }
|
||||||
// }
|
// });
|
||||||
// });
|
//
|
||||||
//
|
// Label colbarLbl = new Label( colorBarGrp, SWT.NONE );
|
||||||
// Label colbarLbl = new Label( colorBarGrp, SWT.NONE );
|
// colbarLbl.setText( "Apply To:" );
|
||||||
// colbarLbl.setText( "Apply To:" );
|
// fd = new FormData( );
|
||||||
// fd = new FormData( );
|
// fd.left = new FormAttachment( colorByCombo, 0, SWT.LEFT );
|
||||||
// fd.left = new FormAttachment( colorByCombo, 0, SWT.LEFT );
|
// fd.bottom = new FormAttachment( colorByCombo, -3, SWT.TOP );
|
||||||
// fd.bottom = new FormAttachment( colorByCombo, -3, SWT.TOP );
|
// colbarLbl.setLayoutData( fd );
|
||||||
// colbarLbl.setLayoutData( fd );
|
|
||||||
|
colorBarEditor = new ColorBarEditor(colorBarGrp, editedColorBar, true);
|
||||||
|
|
||||||
colorBarEditor = new ColorBarEditor( colorBarGrp, editedColorBar );
|
|
||||||
|
|
||||||
return topComp;
|
return topComp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initWidgets() {
|
public void initWidgets() {
|
||||||
// done in createDialog
|
// done in createDialog
|
||||||
}
|
}
|
||||||
|
|
||||||
// allow to override
|
|
||||||
@Override
|
|
||||||
protected void dispose() {
|
|
||||||
super.dispose();
|
|
||||||
colorBarEditor.dispose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// allow to override
|
||||||
|
@Override
|
||||||
|
protected void dispose() {
|
||||||
|
super.dispose();
|
||||||
|
colorBarEditor.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -606,22 +606,31 @@ public class ContourSupport {
|
||||||
return env;
|
return env;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void createContourLabel(IExtent extent,
|
private void createContourLabel(IExtent extent, ContourGroup contourGroup,
|
||||||
ContourGroup contourGroup, float contourValue, double[][] valsArr,
|
float contourValue, Coordinate[] llcoords, IMapDescriptor descriptor) {
|
||||||
IMapDescriptor descriptor) {
|
|
||||||
|
|
||||||
double minx = extent.getMinX();
|
double minx = extent.getMinX();
|
||||||
double miny = extent.getMinY();
|
double miny = extent.getMinY();
|
||||||
double maxx = extent.getMaxX();
|
double maxx = extent.getMaxX();
|
||||||
double maxy = extent.getMaxY();
|
double maxy = extent.getMaxY();
|
||||||
|
|
||||||
double[][] visiblePts = new double[valsArr.length][valsArr[0].length];
|
double[][] visiblePts = new double[llcoords.length][2];
|
||||||
int actualLength = 0;
|
int actualLength = 0;
|
||||||
|
|
||||||
for (double[] dl : valsArr) {
|
double[] in = new double[2];
|
||||||
if (dl[0] > minx && dl[0] < maxx && dl[1] > miny && dl[1] < maxy) {
|
double[] out = new double[2];
|
||||||
visiblePts[actualLength][0] = dl[0];
|
for (Coordinate coord : llcoords) {
|
||||||
visiblePts[actualLength][1] = dl[1];
|
in[0] = coord.x;
|
||||||
|
in[1] = coord.y;
|
||||||
|
try {
|
||||||
|
rastPosLatLonToWorldGrid.transform(in, 0, out, 0, 1);
|
||||||
|
} catch (TransformException e) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (out[0] > minx && out[0] < maxx && out[1] > miny
|
||||||
|
&& out[1] < maxy) {
|
||||||
|
visiblePts[actualLength][0] = out[0];
|
||||||
|
visiblePts[actualLength][1] = out[1];
|
||||||
actualLength++;
|
actualLength++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1052,9 +1061,6 @@ public class ContourSupport {
|
||||||
|
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
double[][] screen = null;
|
|
||||||
double[][] screenx = null;
|
|
||||||
|
|
||||||
for (Double cval : contourGroup.cvalues) {
|
for (Double cval : contourGroup.cvalues) {
|
||||||
float fval = (float) (cval * 1.0f);
|
float fval = (float) (cval * 1.0f);
|
||||||
boolean toLabel = false;
|
boolean toLabel = false;
|
||||||
|
@ -1083,22 +1089,13 @@ public class ContourSupport {
|
||||||
|
|
||||||
for (int i = 0; i < correctedGeom.getNumGeometries(); i++) {
|
for (int i = 0; i < correctedGeom.getNumGeometries(); i++) {
|
||||||
Geometry gn = correctedGeom.getGeometryN(i);
|
Geometry gn = correctedGeom.getGeometryN(i);
|
||||||
// System.out.println("GEOMETRY " + i + ":");
|
|
||||||
// System.out.println(gn.toString());
|
|
||||||
contourGroup.negValueShape.addLineSegment(gn
|
contourGroup.negValueShape.addLineSegment(gn
|
||||||
.getCoordinates());
|
.getCoordinates());
|
||||||
|
|
||||||
if (toLabel) {
|
if (toLabel) {
|
||||||
long tl0 = System.currentTimeMillis();
|
long tl0 = System.currentTimeMillis();
|
||||||
// prepareLabel(contourGroup, zoom, fval,
|
createContourLabel(extent, contourGroup, fval,
|
||||||
// labelPoints, screen);
|
gn.getCoordinates(), descriptor);
|
||||||
if (screen != null)
|
|
||||||
createContourLabel(extent, contourGroup, fval,
|
|
||||||
screen, descriptor);
|
|
||||||
if (screenx != null) {
|
|
||||||
createContourLabel(extent, contourGroup, fval,
|
|
||||||
screenx, descriptor);
|
|
||||||
}
|
|
||||||
long tl1 = System.currentTimeMillis();
|
long tl1 = System.currentTimeMillis();
|
||||||
total_labeling_time += (tl1 - tl0);
|
total_labeling_time += (tl1 - tl0);
|
||||||
}
|
}
|
||||||
|
@ -1622,6 +1619,11 @@ public class ContourSupport {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
xform.transform(tmp, 0, out, 0, 1);
|
xform.transform(tmp, 0, out, 0, 1);
|
||||||
|
if (out[0] < -180 || out[0] > 180.) {
|
||||||
|
out[0] = ((out[0] + 180) % 360) - 180;
|
||||||
|
}
|
||||||
|
if (out[0] == 0.0)
|
||||||
|
out[0] = 0.001;
|
||||||
clist.add(new Coordinate(out[0], out[1]), true);
|
clist.add(new Coordinate(out[0], out[1]), true);
|
||||||
} catch (TransformException e) {
|
} catch (TransformException e) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,6 +131,7 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||||
* 04/11/2014 #981 D.Sushon Added fault tolerance for when some data is bad to display the good data rather than fall-through entire frame
|
* 04/11/2014 #981 D.Sushon Added fault tolerance for when some data is bad to display the good data rather than fall-through entire frame
|
||||||
* 04/14/2014 S.Gilbert Cleaned up old unused methods
|
* 04/14/2014 S.Gilbert Cleaned up old unused methods
|
||||||
* 04/22/2014 #1129 B. Hebbard Feed HILO point count limits to GridRelativeHiLoDisplay constructor instead of HILORelativeMinAndMaxLocator, so can apply dynamically based on current extent
|
* 04/22/2014 #1129 B. Hebbard Feed HILO point count limits to GridRelativeHiLoDisplay constructor instead of HILORelativeMinAndMaxLocator, so can apply dynamically based on current extent
|
||||||
|
* 06/27/2014 ? B. Yin Handle grid analysis (cycle time is null).
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author mli
|
* @author mli
|
||||||
|
@ -1735,15 +1736,16 @@ public class NcgridResource extends
|
||||||
|
|
||||||
DataTime cycleTime = rscName.getCycleTime();
|
DataTime cycleTime = rscName.getCycleTime();
|
||||||
|
|
||||||
if (cycleTime == null || rscName.isLatestCycleTime()) { // latest should
|
if (rscName.isLatestCycleTime()) { // latest should
|
||||||
// already be
|
// already be
|
||||||
// resolved
|
// resolved
|
||||||
// here.
|
// here.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<DataTime> availableTimes = new ArrayList<DataTime>();
|
List<DataTime> availableTimes = new ArrayList<DataTime>();
|
||||||
if (gridRscData.getPluginName().equalsIgnoreCase(
|
|
||||||
|
if ( cycleTime != null && gridRscData.getPluginName().equalsIgnoreCase(
|
||||||
GempakGrid.gempakPluginName)) {
|
GempakGrid.gempakPluginName)) {
|
||||||
try {
|
try {
|
||||||
String dataLocation = null;
|
String dataLocation = null;
|
||||||
|
@ -1848,16 +1850,22 @@ public class NcgridResource extends
|
||||||
DataTime availTime = new DataTime(dt.getRefTime(), dt.getFcstTime());
|
DataTime availTime = new DataTime(dt.getRefTime(), dt.getFcstTime());
|
||||||
DataTime refTime = new DataTime(dt.getRefTime());
|
DataTime refTime = new DataTime(dt.getRefTime());
|
||||||
|
|
||||||
if (cycleTime.equals(refTime)) {
|
if (cycleTime != null) {
|
||||||
if (!dataTimes.contains(availTime)) {
|
if (cycleTime.equals(refTime)) {
|
||||||
dataTimes.add(availTime);
|
if (!dataTimes.contains(availTime)) {
|
||||||
// reuse the same gribRec this is a bit of a hack but hey.
|
dataTimes.add(availTime);
|
||||||
// gribRec.setDataTime(availTime);
|
// reuse the same gribRec this is a bit of a hack but
|
||||||
// for( IRscDataObject dataObject : processRecord( availTime
|
// hey.
|
||||||
// ) ) { // gribRec ) ) {
|
// gribRec.setDataTime(availTime);
|
||||||
// newRscDataObjsQueue.add(dataObject);
|
// for( IRscDataObject dataObject : processRecord(
|
||||||
// }
|
// availTime
|
||||||
|
// ) ) { // gribRec ) ) {
|
||||||
|
// newRscDataObjsQueue.add(dataObject);
|
||||||
|
// }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else { // for grid analysis
|
||||||
|
dataTimes.add(availTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setDataTimesForDgdriv(dataTimes);
|
setDataTimesForDgdriv(dataTimes);
|
||||||
|
|
|
@ -3,6 +3,14 @@ package gov.noaa.nws.ncep.viz.rsc.ncgrid.rsc;
|
||||||
import gov.noaa.nws.ncep.viz.gempak.util.GempakGrid;
|
import gov.noaa.nws.ncep.viz.gempak.util.GempakGrid;
|
||||||
import gov.noaa.nws.ncep.viz.resources.AbstractNatlCntrsRequestableResourceData;
|
import gov.noaa.nws.ncep.viz.resources.AbstractNatlCntrsRequestableResourceData;
|
||||||
import gov.noaa.nws.ncep.viz.resources.INatlCntrsResourceData;
|
import gov.noaa.nws.ncep.viz.resources.INatlCntrsResourceData;
|
||||||
|
import gov.noaa.nws.ncep.viz.resources.manager.ResourceDefinition;
|
||||||
|
import gov.noaa.nws.ncep.viz.resources.manager.ResourceDefnsMngr;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
@ -37,88 +45,90 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||||
* 03/28/2012 X. Guo Don't need to convert gdfile toUppercase
|
* 03/28/2012 X. Guo Don't need to convert gdfile toUppercase
|
||||||
* 08/29/2012 #743 Archana Added CLRBAR
|
* 08/29/2012 #743 Archana Added CLRBAR
|
||||||
* 09/14/2013 #1036 S. Gurung Added TEXT
|
* 09/14/2013 #1036 S. Gurung Added TEXT
|
||||||
*
|
* 07/02/2014 ? B. Yin Handle grid analysis.
|
||||||
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author mli
|
* @author mli
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
@XmlAccessorType(XmlAccessType.NONE)
|
@XmlAccessorType(XmlAccessType.NONE)
|
||||||
@XmlType(name="NC-NcgridResourceData")
|
@XmlType(name = "NC-NcgridResourceData")
|
||||||
public class NcgridResourceData extends AbstractNatlCntrsRequestableResourceData
|
public class NcgridResourceData extends
|
||||||
implements INatlCntrsResourceData {
|
AbstractNatlCntrsRequestableResourceData implements
|
||||||
|
INatlCntrsResourceData {
|
||||||
|
|
||||||
@XmlElement
|
@XmlElement
|
||||||
protected String type;
|
protected String type;
|
||||||
|
|
||||||
@XmlElement
|
|
||||||
protected String cint;
|
|
||||||
|
|
||||||
@XmlElement
|
|
||||||
protected String gdfile;
|
|
||||||
|
|
||||||
@XmlElement
|
|
||||||
protected String gvcord;
|
|
||||||
|
|
||||||
@XmlElement
|
|
||||||
protected String glevel;
|
|
||||||
|
|
||||||
@XmlElement
|
|
||||||
protected String gdpfun;
|
|
||||||
|
|
||||||
@XmlElement
|
|
||||||
protected String skip;
|
|
||||||
|
|
||||||
@XmlElement
|
|
||||||
protected String filter;
|
|
||||||
|
|
||||||
@XmlElement
|
|
||||||
protected String scale="0";
|
|
||||||
|
|
||||||
@XmlElement
|
|
||||||
protected String wind = "18/1/1";
|
|
||||||
|
|
||||||
@XmlElement
|
|
||||||
protected String title;
|
|
||||||
|
|
||||||
@XmlElement
|
|
||||||
protected String lineAttributes;
|
|
||||||
|
|
||||||
@XmlElement
|
|
||||||
protected String colors;
|
|
||||||
|
|
||||||
@XmlElement
|
|
||||||
protected String marker;
|
|
||||||
|
|
||||||
@XmlElement
|
@XmlElement
|
||||||
protected int grdlbl;
|
protected String cint;
|
||||||
|
|
||||||
@XmlElement
|
@XmlElement
|
||||||
protected String fint;
|
protected String gdfile;
|
||||||
|
|
||||||
@XmlElement
|
@XmlElement
|
||||||
protected String fline;
|
protected String gvcord;
|
||||||
|
|
||||||
@XmlElement
|
@XmlElement
|
||||||
protected String hilo;
|
protected String glevel;
|
||||||
|
|
||||||
@XmlElement
|
@XmlElement
|
||||||
protected String hlsym;
|
protected String gdpfun;
|
||||||
|
|
||||||
|
@XmlElement
|
||||||
|
protected String skip;
|
||||||
|
|
||||||
|
@XmlElement
|
||||||
|
protected String filter;
|
||||||
|
|
||||||
|
@XmlElement
|
||||||
|
protected String scale = "0";
|
||||||
|
|
||||||
|
@XmlElement
|
||||||
|
protected String wind = "18/1/1";
|
||||||
|
|
||||||
|
@XmlElement
|
||||||
|
protected String title;
|
||||||
|
|
||||||
|
@XmlElement
|
||||||
|
protected String lineAttributes;
|
||||||
|
|
||||||
|
@XmlElement
|
||||||
|
protected String colors;
|
||||||
|
|
||||||
|
@XmlElement
|
||||||
|
protected String marker;
|
||||||
|
|
||||||
|
@XmlElement
|
||||||
|
protected int grdlbl;
|
||||||
|
|
||||||
|
@XmlElement
|
||||||
|
protected String fint;
|
||||||
|
|
||||||
|
@XmlElement
|
||||||
|
protected String fline;
|
||||||
|
|
||||||
|
@XmlElement
|
||||||
|
protected String hilo;
|
||||||
|
|
||||||
|
@XmlElement
|
||||||
|
protected String hlsym;
|
||||||
|
|
||||||
|
@XmlElement
|
||||||
|
protected String clrbar;
|
||||||
|
|
||||||
|
@XmlElement
|
||||||
|
protected String text;
|
||||||
|
|
||||||
@XmlElement
|
|
||||||
protected String clrbar;
|
|
||||||
|
|
||||||
@XmlElement
|
|
||||||
protected String text;
|
|
||||||
|
|
||||||
public NcgridResourceData() {
|
public NcgridResourceData() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected AbstractVizResource<?, ?> constructResource(
|
protected AbstractVizResource<?, ?> constructResource(
|
||||||
LoadProperties loadProperties, PluginDataObject[] objects) {
|
LoadProperties loadProperties, PluginDataObject[] objects) {
|
||||||
return new NcgridResource(this, loadProperties);
|
return new NcgridResource(this, loadProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -132,7 +142,7 @@ public class NcgridResourceData extends AbstractNatlCntrsRequestableResourceData
|
||||||
}
|
}
|
||||||
|
|
||||||
NcgridResourceData other = (NcgridResourceData) obj;
|
NcgridResourceData other = (NcgridResourceData) obj;
|
||||||
|
|
||||||
if (this.resourceName != null && other.resourceName == null) {
|
if (this.resourceName != null && other.resourceName == null) {
|
||||||
return false;
|
return false;
|
||||||
} else if (this.resourceName == null && other.resourceName != null) {
|
} else if (this.resourceName == null && other.resourceName != null) {
|
||||||
|
@ -141,25 +151,23 @@ public class NcgridResourceData extends AbstractNatlCntrsRequestableResourceData
|
||||||
&& this.resourceName.equals(other.resourceName) == false) {
|
&& this.resourceName.equals(other.resourceName) == false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.type != null && other.type == null) {
|
if (this.type != null && other.type == null) {
|
||||||
return false;
|
return false;
|
||||||
} else if (this.type == null && other.type != null) {
|
} else if (this.type == null && other.type != null) {
|
||||||
return false;
|
return false;
|
||||||
} else if (this.type != null
|
} else if (this.type != null && this.type.equals(other.type) == false) {
|
||||||
&& this.type.equals(other.type) == false) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.cint != null && other.cint == null) {
|
if (this.cint != null && other.cint == null) {
|
||||||
return false;
|
return false;
|
||||||
} else if (this.cint == null && other.cint != null) {
|
} else if (this.cint == null && other.cint != null) {
|
||||||
return false;
|
return false;
|
||||||
} else if (this.cint != null
|
} else if (this.cint != null && this.cint.equals(other.cint) == false) {
|
||||||
&& this.cint.equals(other.cint) == false) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.gdfile != null && other.gdfile == null) {
|
if (this.gdfile != null && other.gdfile == null) {
|
||||||
return false;
|
return false;
|
||||||
} else if (this.gdfile == null && other.gdfile != null) {
|
} else if (this.gdfile == null && other.gdfile != null) {
|
||||||
|
@ -168,7 +176,7 @@ public class NcgridResourceData extends AbstractNatlCntrsRequestableResourceData
|
||||||
&& this.gdfile.equals(other.gdfile) == false) {
|
&& this.gdfile.equals(other.gdfile) == false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.gvcord != null && other.gvcord == null) {
|
if (this.gvcord != null && other.gvcord == null) {
|
||||||
return false;
|
return false;
|
||||||
} else if (this.gvcord == null && other.gvcord != null) {
|
} else if (this.gvcord == null && other.gvcord != null) {
|
||||||
|
@ -177,7 +185,7 @@ public class NcgridResourceData extends AbstractNatlCntrsRequestableResourceData
|
||||||
&& this.gvcord.equals(other.gvcord) == false) {
|
&& this.gvcord.equals(other.gvcord) == false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.glevel != null && other.glevel == null) {
|
if (this.glevel != null && other.glevel == null) {
|
||||||
return false;
|
return false;
|
||||||
} else if (this.glevel == null && other.glevel != null) {
|
} else if (this.glevel == null && other.glevel != null) {
|
||||||
|
@ -186,7 +194,7 @@ public class NcgridResourceData extends AbstractNatlCntrsRequestableResourceData
|
||||||
&& this.glevel.equals(other.glevel) == false) {
|
&& this.glevel.equals(other.glevel) == false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.gdpfun != null && other.gdpfun == null) {
|
if (this.gdpfun != null && other.gdpfun == null) {
|
||||||
return false;
|
return false;
|
||||||
} else if (this.gdpfun == null && other.gdpfun != null) {
|
} else if (this.gdpfun == null && other.gdpfun != null) {
|
||||||
|
@ -195,16 +203,15 @@ public class NcgridResourceData extends AbstractNatlCntrsRequestableResourceData
|
||||||
&& this.gdpfun.equals(other.gdpfun) == false) {
|
&& this.gdpfun.equals(other.gdpfun) == false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.skip != null && other.skip == null) {
|
if (this.skip != null && other.skip == null) {
|
||||||
return false;
|
return false;
|
||||||
} else if (this.skip == null && other.skip != null) {
|
} else if (this.skip == null && other.skip != null) {
|
||||||
return false;
|
return false;
|
||||||
} else if (this.skip != null
|
} else if (this.skip != null && this.skip.equals(other.skip) == false) {
|
||||||
&& this.skip.equals(other.skip) == false) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.filter != null && other.filter == null) {
|
if (this.filter != null && other.filter == null) {
|
||||||
return false;
|
return false;
|
||||||
} else if (this.filter == null && other.filter != null) {
|
} else if (this.filter == null && other.filter != null) {
|
||||||
|
@ -213,7 +220,7 @@ public class NcgridResourceData extends AbstractNatlCntrsRequestableResourceData
|
||||||
&& this.filter.equals(other.filter) == false) {
|
&& this.filter.equals(other.filter) == false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.scale != null && other.scale == null) {
|
if (this.scale != null && other.scale == null) {
|
||||||
return false;
|
return false;
|
||||||
} else if (this.scale == null && other.scale != null) {
|
} else if (this.scale == null && other.scale != null) {
|
||||||
|
@ -222,7 +229,7 @@ public class NcgridResourceData extends AbstractNatlCntrsRequestableResourceData
|
||||||
&& this.scale.equals(other.scale) == false) {
|
&& this.scale.equals(other.scale) == false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.title != null && other.title == null) {
|
if (this.title != null && other.title == null) {
|
||||||
return false;
|
return false;
|
||||||
} else if (this.title == null && other.title != null) {
|
} else if (this.title == null && other.title != null) {
|
||||||
|
@ -231,7 +238,7 @@ public class NcgridResourceData extends AbstractNatlCntrsRequestableResourceData
|
||||||
&& this.title.equals(other.title) == false) {
|
&& this.title.equals(other.title) == false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.lineAttributes != null && other.lineAttributes == null) {
|
if (this.lineAttributes != null && other.lineAttributes == null) {
|
||||||
return false;
|
return false;
|
||||||
} else if (this.lineAttributes == null && other.lineAttributes != null) {
|
} else if (this.lineAttributes == null && other.lineAttributes != null) {
|
||||||
|
@ -240,7 +247,7 @@ public class NcgridResourceData extends AbstractNatlCntrsRequestableResourceData
|
||||||
&& this.lineAttributes.equals(other.lineAttributes) == false) {
|
&& this.lineAttributes.equals(other.lineAttributes) == false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.colors != null && other.colors == null) {
|
if (this.colors != null && other.colors == null) {
|
||||||
return false;
|
return false;
|
||||||
} else if (this.colors == null && other.colors != null) {
|
} else if (this.colors == null && other.colors != null) {
|
||||||
|
@ -249,7 +256,7 @@ public class NcgridResourceData extends AbstractNatlCntrsRequestableResourceData
|
||||||
&& this.colors.equals(other.colors) == false) {
|
&& this.colors.equals(other.colors) == false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.marker != null && other.marker == null) {
|
if (this.marker != null && other.marker == null) {
|
||||||
return false;
|
return false;
|
||||||
} else if (this.marker == null && other.marker != null) {
|
} else if (this.marker == null && other.marker != null) {
|
||||||
|
@ -258,20 +265,19 @@ public class NcgridResourceData extends AbstractNatlCntrsRequestableResourceData
|
||||||
&& this.marker.equals(other.marker) == false) {
|
&& this.marker.equals(other.marker) == false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.grdlbl != other.grdlbl) {
|
if (this.grdlbl != other.grdlbl) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.fint != null && other.fint == null) {
|
if (this.fint != null && other.fint == null) {
|
||||||
return false;
|
return false;
|
||||||
} else if (this.fint == null && other.fint != null) {
|
} else if (this.fint == null && other.fint != null) {
|
||||||
return false;
|
return false;
|
||||||
} else if (this.fint != null
|
} else if (this.fint != null && this.fint.equals(other.fint) == false) {
|
||||||
&& this.fint.equals(other.fint) == false) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.fline != null && other.fline == null) {
|
if (this.fline != null && other.fline == null) {
|
||||||
return false;
|
return false;
|
||||||
} else if (this.fline == null && other.fline != null) {
|
} else if (this.fline == null && other.fline != null) {
|
||||||
|
@ -280,16 +286,15 @@ public class NcgridResourceData extends AbstractNatlCntrsRequestableResourceData
|
||||||
&& this.fline.equals(other.fline) == false) {
|
&& this.fline.equals(other.fline) == false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.hilo != null && other.hilo == null) {
|
if (this.hilo != null && other.hilo == null) {
|
||||||
return false;
|
return false;
|
||||||
} else if (this.hilo == null && other.hilo != null) {
|
} else if (this.hilo == null && other.hilo != null) {
|
||||||
return false;
|
return false;
|
||||||
} else if (this.hilo != null
|
} else if (this.hilo != null && this.hilo.equals(other.hilo) == false) {
|
||||||
&& this.hilo.equals(other.hilo) == false) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.hlsym != null && other.hlsym == null) {
|
if (this.hlsym != null && other.hlsym == null) {
|
||||||
return false;
|
return false;
|
||||||
} else if (this.hlsym == null && other.hlsym != null) {
|
} else if (this.hlsym == null && other.hlsym != null) {
|
||||||
|
@ -306,275 +311,425 @@ public class NcgridResourceData extends AbstractNatlCntrsRequestableResourceData
|
||||||
} else if (this.clrbar != null
|
} else if (this.clrbar != null
|
||||||
&& this.clrbar.equals(other.clrbar) == false) {
|
&& this.clrbar.equals(other.clrbar) == false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.text != null && other.text == null) {
|
if (this.text != null && other.text == null) {
|
||||||
return false;
|
return false;
|
||||||
} else if (this.text == null && other.text != null) {
|
} else if (this.text == null && other.text != null) {
|
||||||
return false;
|
return false;
|
||||||
} else if (this.text != null
|
} else if (this.text != null && this.text.equals(other.text) == false) {
|
||||||
&& this.text.equals(other.text) == false) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getCint() {
|
||||||
|
return cint;
|
||||||
|
}
|
||||||
|
|
||||||
public String getCint() {
|
public void setCint(String cint) {
|
||||||
return cint;
|
this.cint = cint;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCint(String cint) {
|
public String getGdfile() {
|
||||||
this.cint = cint;
|
return gdfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getGdfile() {
|
public void setGdfile(String gdfile) {
|
||||||
return gdfile;
|
this.gdfile = gdfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGdfile(String gdfile) {
|
public String getGvcord() {
|
||||||
this.gdfile = gdfile;
|
return gvcord;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getGvcord() {
|
public void setGvcord(String gvcord) {
|
||||||
return gvcord;
|
this.gvcord = gvcord;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGvcord(String gvcord) {
|
public String getGlevel() {
|
||||||
this.gvcord = gvcord;
|
return glevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getGlevel() {
|
public void setGlevel(String glevel) {
|
||||||
return glevel;
|
this.glevel = glevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGlevel(String glevel) {
|
public String getGdpfun() {
|
||||||
this.glevel = glevel;
|
return gdpfun;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setGdpfun(String gdpfun) {
|
||||||
|
this.gdpfun = gdpfun;
|
||||||
|
}
|
||||||
|
|
||||||
public String getGdpfun() {
|
public String getSkip() {
|
||||||
return gdpfun;
|
return skip;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGdpfun(String gdpfun) {
|
public void setSkip(String skip) {
|
||||||
this.gdpfun = gdpfun;
|
this.skip = skip;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSkip() {
|
public String getFilter() {
|
||||||
return skip;
|
return filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSkip(String skip) {
|
public void setFilter(String filter) {
|
||||||
this.skip = skip;
|
this.filter = filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFilter() {
|
public String getScale() {
|
||||||
return filter;
|
return scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFilter(String filter) {
|
public void setScale(String scale) {
|
||||||
this.filter = filter;
|
this.scale = scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getScale() {
|
public String getTitle() {
|
||||||
return scale;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setScale(String scale) {
|
public void setTitle(String title) {
|
||||||
this.scale = scale;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle() {
|
public String getType() {
|
||||||
return title;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTitle(String title) {
|
public void setType(String type) {
|
||||||
this.title = title;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
public String getType() {
|
* public DisplayType getVectorType() { if
|
||||||
return type;
|
* (this.type.toUpperCase().contains("B")) { return DisplayType.BARB; } else
|
||||||
}
|
* if (this.type.toUpperCase().contains("A") ||
|
||||||
|
* this.type.toUpperCase().contains("D")) { return DisplayType.ARROW; } else
|
||||||
|
* if (this.type.toUpperCase().contains("S")) { return
|
||||||
|
* DisplayType.STREAMLINE; } else { return null; } }
|
||||||
|
*/
|
||||||
|
|
||||||
public void setType(String type) {
|
public String getLineAttributes() {
|
||||||
this.type = type;
|
return lineAttributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
public void setLineAttributes(String lineAttributes) {
|
||||||
public DisplayType getVectorType() {
|
this.lineAttributes = lineAttributes;
|
||||||
if (this.type.toUpperCase().contains("B")) {
|
}
|
||||||
return DisplayType.BARB;
|
|
||||||
} else if (this.type.toUpperCase().contains("A") || this.type.toUpperCase().contains("D")) {
|
|
||||||
return DisplayType.ARROW;
|
|
||||||
} else if (this.type.toUpperCase().contains("S")) {
|
|
||||||
return DisplayType.STREAMLINE;
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
public String getLineAttributes() {
|
public String getColors() {
|
||||||
return lineAttributes;
|
return colors;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLineAttributes(String lineAttributes) {
|
public void setColors(String colors) {
|
||||||
this.lineAttributes = lineAttributes;
|
this.colors = colors;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getColors() {
|
public String getMarker() {
|
||||||
return colors;
|
return marker;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setColors(String colors) {
|
public void setMarker(String marker) {
|
||||||
this.colors = colors;
|
this.marker = marker;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMarker() {
|
public int getGrdlbl() {
|
||||||
return marker;
|
return grdlbl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMarker(String marker) {
|
public void setGrdlbl(int grdlbl) {
|
||||||
this.marker = marker;
|
this.grdlbl = grdlbl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getGrdlbl() {
|
public String getFint() {
|
||||||
return grdlbl;
|
return fint;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGrdlbl(int grdlbl) {
|
public void setFint(String fint) {
|
||||||
this.grdlbl = grdlbl;
|
this.fint = fint;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFint() {
|
public String getFline() {
|
||||||
return fint;
|
return fline;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFint(String fint) {
|
public void setFline(String fline) {
|
||||||
this.fint = fint;
|
this.fline = fline;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFline() {
|
public String getWind() {
|
||||||
return fline;
|
return wind;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFline(String fline) {
|
public void setWind(String wind) {
|
||||||
this.fline = fline;
|
this.wind = wind;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getWind() {
|
public String getHilo() {
|
||||||
return wind;
|
return hilo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWind(String wind) {
|
public void setHilo(String hilo) {
|
||||||
this.wind = wind;
|
this.hilo = hilo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getHilo() {
|
public String getHlsym() {
|
||||||
return hilo;
|
return hlsym;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHilo(String hilo) {
|
public void setHlsym(String hlsym) {
|
||||||
this.hilo = hilo;
|
this.hlsym = hlsym;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getHlsym() {
|
|
||||||
return hlsym;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHlsym(String hlsym) {
|
/**
|
||||||
this.hlsym = hlsym;
|
* @return the clrbar
|
||||||
}
|
*/
|
||||||
|
public String getClrbar() {
|
||||||
/**
|
return clrbar;
|
||||||
* @return the clrbar
|
}
|
||||||
*/
|
|
||||||
public String getClrbar() {
|
|
||||||
return clrbar;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param clrbar the clrbar to set
|
* @param clrbar
|
||||||
*/
|
* the clrbar to set
|
||||||
public void setClrbar(String clrbar) {
|
*/
|
||||||
this.clrbar = clrbar;
|
public void setClrbar(String clrbar) {
|
||||||
}
|
this.clrbar = clrbar;
|
||||||
|
}
|
||||||
public String getText() {
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setText(String text) {
|
public String getText() {
|
||||||
this.text = text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setText(String text) {
|
||||||
|
this.text = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEventName() {
|
||||||
|
if (getMetadataMap().containsKey("info.secondaryId")) {
|
||||||
|
String eventName = getMetadataMap().get("info.secondaryId")
|
||||||
|
.getConstraintValue();
|
||||||
|
|
||||||
|
return (eventName.equals("%") ? null : eventName);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEnsembelMember() {
|
||||||
|
if (getMetadataMap().containsKey("info.ensembleId")) {
|
||||||
|
String ensembleMember = getMetadataMap().get("info.ensembleId")
|
||||||
|
.getConstraintValue();
|
||||||
|
|
||||||
|
return (ensembleMember.equals("%") ? null : ensembleMember);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getEventName() {
|
|
||||||
if( getMetadataMap().containsKey("info.secondaryId") ) {
|
|
||||||
String eventName = getMetadataMap().get("info.secondaryId").getConstraintValue();
|
|
||||||
|
|
||||||
return (eventName.equals("%") ? null : eventName );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEnsembelMember() {
|
|
||||||
if( getMetadataMap().containsKey("info.ensembleId") ) {
|
|
||||||
String ensembleMember = getMetadataMap().get("info.ensembleId").getConstraintValue();
|
|
||||||
|
|
||||||
return (ensembleMember.equals("%") ? null : ensembleMember );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// set metadataMap with the modelName constraint and return it
|
// set metadataMap with the modelName constraint and return it
|
||||||
// (This is overridden by the NcEnsembleResourceData
|
// (This is overridden by the NcEnsembleResourceData
|
||||||
//
|
//
|
||||||
// public HashMap<String, RequestConstraint> getMetadataMap() {
|
// public HashMap<String, RequestConstraint> getMetadataMap() {
|
||||||
// HashMap<String, RequestConstraint> queryList = super.getMetadataMap();
|
// HashMap<String, RequestConstraint> queryList = super.getMetadataMap();
|
||||||
//
|
//
|
||||||
// queryList.put("modelInfo.modelName",
|
// queryList.put("modelInfo.modelName",
|
||||||
// new RequestConstraint( getGdfile(), ConstraintType.EQUALS ) );
|
// new RequestConstraint( getGdfile(), ConstraintType.EQUALS ) );
|
||||||
//
|
//
|
||||||
// return queryList;
|
// return queryList;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DataTime[] getAvailableTimes() throws VizException {
|
public DataTime[] getAvailableTimes() throws VizException {
|
||||||
|
|
||||||
if ( getPluginName().equalsIgnoreCase( GempakGrid.gempakPluginName )) {
|
if (getPluginName().equalsIgnoreCase(GempakGrid.gempakPluginName)) {
|
||||||
|
try {
|
||||||
|
String currentCycle = getResourceName().getCycleTime()
|
||||||
|
.toString();
|
||||||
|
String dataLoc = null;
|
||||||
try {
|
try {
|
||||||
String currentCycle = getResourceName().getCycleTime().toString();
|
dataLoc = GempakGrid.getGempakGridPath(getGdfile());
|
||||||
String dataLoc = null;
|
|
||||||
try {
|
|
||||||
dataLoc = GempakGrid.getGempakGridPath( getGdfile() );
|
|
||||||
|
|
||||||
} catch (VizException e) {
|
|
||||||
throw new VizException (e);
|
|
||||||
}
|
|
||||||
String [] gridAvailableTimes = GempakGrid
|
|
||||||
.getAvailableGridTimes(dataLoc, currentCycle,getGdfile().toLowerCase());
|
|
||||||
DataTime[] availableTimes = new DataTime[gridAvailableTimes.length];
|
|
||||||
|
|
||||||
for ( int ii=0; ii<gridAvailableTimes.length; ii++) {
|
} catch (VizException e) {
|
||||||
availableTimes[ii] = new DataTime (gridAvailableTimes[ii]);
|
throw new VizException(e);
|
||||||
}
|
}
|
||||||
return availableTimes;
|
String[] gridAvailableTimes = GempakGrid.getAvailableGridTimes(
|
||||||
} catch (Exception e) {
|
dataLoc, currentCycle, getGdfile().toLowerCase());
|
||||||
// TODO Auto-generated catch block
|
DataTime[] availableTimes = new DataTime[gridAvailableTimes.length];
|
||||||
throw new VizException();
|
|
||||||
|
for (int ii = 0; ii < gridAvailableTimes.length; ii++) {
|
||||||
|
availableTimes[ii] = new DataTime(gridAvailableTimes[ii]);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
|
||||||
DataTime[] availableTimes = super.getAvailableTimes();
|
|
||||||
return availableTimes;
|
return availableTimes;
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
throw new VizException();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
DataTime[] availableTimes = super.getAvailableTimes();
|
||||||
|
return availableTimes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DataTime> getAvailableDataTimes() {
|
||||||
|
if (getResourceName().getCycleTime() != null) {
|
||||||
|
return super.getAvailableDataTimes();
|
||||||
|
} else {
|
||||||
|
// For grid analysis
|
||||||
|
List<DataTime> availTimesList = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
ResourceDefinition rscDefn = ResourceDefnsMngr.getInstance()
|
||||||
|
.getResourceDefinition(getResourceName());
|
||||||
|
|
||||||
|
if (rscDefn.getInventoryEnabled()
|
||||||
|
&& rscDefn.isInventoryInitialized()) {
|
||||||
|
availTimesList = rscDefn.getDataTimes(getResourceName());
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
DataTime[] availTimes = null;
|
||||||
|
availTimes = getAvailableTimes();
|
||||||
|
if (availTimes == null) {
|
||||||
|
return new ArrayList<DataTime>();
|
||||||
|
}
|
||||||
|
availTimesList = Arrays.asList(availTimes);
|
||||||
|
|
||||||
|
} catch (VizException e) {
|
||||||
|
System.out.println("Error getting Available Times: "
|
||||||
|
+ e.getMessage());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (VizException e1) {
|
||||||
|
return availTimesList;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sort the time by ref-time then by forecast hours.
|
||||||
|
Collections.sort(availTimesList);
|
||||||
|
Iterator<DataTime> it = availTimesList.iterator();
|
||||||
|
|
||||||
|
// test dfltFrameTimes ="firstf00-lastf06" All f00 plus last f06;
|
||||||
|
// test dfltFrameTimes ="firstf00 - lastf06";
|
||||||
|
// test dfltFrameTimes ="allf00";
|
||||||
|
// test dfltFrameTimes = null;
|
||||||
|
// test dfltFrameTimes = "";
|
||||||
|
// dfltFrameTimes ="allf000";
|
||||||
|
|
||||||
|
List<DataTime> availAnlsList = new ArrayList<DataTime>();
|
||||||
|
|
||||||
|
if (dfltFrameTimes == null || dfltFrameTimes.isEmpty()) { // Default
|
||||||
|
// is
|
||||||
|
// "AllF00"
|
||||||
|
while (it.hasNext()) {
|
||||||
|
DataTime dt = (DataTime) it.next();
|
||||||
|
if (dt.getFcstTime() == 0) {
|
||||||
|
availAnlsList.add(dt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
String dft = dfltFrameTimes.toUpperCase();
|
||||||
|
|
||||||
|
if (dft.contains("ALLF")) { // For GDATTIM = "allfxx". Default
|
||||||
|
// is "ALLF00"
|
||||||
|
int fxx = 0;
|
||||||
|
try {
|
||||||
|
int idx1 = dft.indexOf("ALLF");
|
||||||
|
fxx = Integer.parseInt(dft.substring(idx1 + 4));
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
fxx = 0;
|
||||||
|
}
|
||||||
|
fxx *= 3600;
|
||||||
|
while (it.hasNext()) {
|
||||||
|
DataTime dt = (DataTime) it.next();
|
||||||
|
if (dt.getFcstTime() == fxx) {
|
||||||
|
availAnlsList.add(dt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (dft.contains("FIRSTF") && dft.contains("LASTF")) { // For
|
||||||
|
// GDATTIM
|
||||||
|
// =
|
||||||
|
// "firstfxx - lastfyy".
|
||||||
|
int fxx = 0;
|
||||||
|
int fyy = 0;
|
||||||
|
|
||||||
|
int idx1 = dft.indexOf("FIRSTF");
|
||||||
|
if (idx1 >= 0) {
|
||||||
|
int idx2 = dft.indexOf('-');
|
||||||
|
if (idx2 > 0 && idx2 > idx1 + 6) {
|
||||||
|
try {
|
||||||
|
fxx = Integer.parseInt(dft.substring(idx1 + 6,
|
||||||
|
idx2));
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
fxx = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
idx1 = dft.indexOf("LASTF");
|
||||||
|
if (idx1 >= 0) {
|
||||||
|
try {
|
||||||
|
fyy = Integer.parseInt(dft.substring(idx1 + 5));
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
fyy = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DataTime lastItem = null;
|
||||||
|
// find the last item
|
||||||
|
for (int ii = availTimesList.size() - 1; ii >= 0; ii--) {
|
||||||
|
|
||||||
|
DataTime dt = availTimesList.get(ii);
|
||||||
|
if (dt.getFcstTime() == fyy * 3600) {
|
||||||
|
lastItem = dt;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int ii = availTimesList.size() - 1; ii >= 0; ii--) {
|
||||||
|
DataTime dt = availTimesList.get(ii);
|
||||||
|
System.out.println("Time: " + dt.getRefTime()
|
||||||
|
+ "FCST: " + dt.getFcstTime() / 3600);
|
||||||
|
}
|
||||||
|
while (it.hasNext()) {
|
||||||
|
DataTime dt = (DataTime) it.next();
|
||||||
|
if (dt == lastItem) {
|
||||||
|
availAnlsList.add(dt);
|
||||||
|
break;
|
||||||
|
} else if (dt.getFcstTime() == fxx) {
|
||||||
|
availAnlsList.add(dt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else { // for anything else in GDATTIM
|
||||||
|
while (it.hasNext()) {
|
||||||
|
DataTime dt = (DataTime) it.next();
|
||||||
|
if (dt.getFcstTime() == 0) {
|
||||||
|
availAnlsList.add(dt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return availAnlsList;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the GDATTIM is in format "ALLFXX" or "FIRSTFxx-LASTFxx"
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean isGdattimForGridAnalysis() {
|
||||||
|
if (dfltFrameTimes != null && !dfltFrameTimes.isEmpty()) {
|
||||||
|
return (dfltFrameTimes.toUpperCase().contains("ALLF") || (dfltFrameTimes
|
||||||
|
.toUpperCase().contains("FIRSTF") && dfltFrameTimes
|
||||||
|
.toUpperCase().contains("LASTF")));
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -78,6 +78,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
||||||
* 06/17/2014 923 S. Russell added method getLastCharInPosition()
|
* 06/17/2014 923 S. Russell added method getLastCharInPosition()
|
||||||
* 06/17/2014 923 S. Russell altered method setUpSymbolMappingTables()
|
* 06/17/2014 923 S. Russell altered method setUpSymbolMappingTables()
|
||||||
* 06/17/2014 923 S. Russell altered method createRenderableData()
|
* 06/17/2014 923 S. Russell altered method createRenderableData()
|
||||||
|
* 07/08/2014 TTR1027 B. Hebbard Force createRenderableData to recreate wind vectors each time.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class NcPlotImageCreator {
|
public class NcPlotImageCreator {
|
||||||
|
@ -1460,7 +1461,7 @@ public class NcPlotImageCreator {
|
||||||
/*
|
/*
|
||||||
* Remove the corresponding string that was
|
* Remove the corresponding string that was
|
||||||
* previously rendered at the current plot
|
* previously rendered at the current plot
|
||||||
* positionfor this station
|
* position for this station
|
||||||
*/
|
*/
|
||||||
if (obsoleteStation != null
|
if (obsoleteStation != null
|
||||||
&& obsoleteStation.stnPlotMap != null) {
|
&& obsoleteStation.stnPlotMap != null) {
|
||||||
|
@ -1978,7 +1979,14 @@ public class NcPlotImageCreator {
|
||||||
// System.out.print(s.info.stationId + ",");
|
// System.out.print(s.info.stationId + ",");
|
||||||
// }
|
// }
|
||||||
// System.out.println("stnColl = " + stnColl);
|
// System.out.println("stnColl = " + stnColl);
|
||||||
if (drawVectorsFirstTime) {
|
|
||||||
|
// Following changed (= true) to force recreation of wind
|
||||||
|
// vectors each time, and so bypass (at negligible cost)
|
||||||
|
// problems in the "else" block below. (That block attempts
|
||||||
|
// to create/remove vectors selectively based on changes
|
||||||
|
// from previous set, but doesn't quite get it right --
|
||||||
|
// dropping vectors after panning in at least some cases.
|
||||||
|
if (drawVectorsFirstTime = true) { // NOT == ! See above.
|
||||||
|
|
||||||
sm.acquireUninterruptibly();
|
sm.acquireUninterruptibly();
|
||||||
|
|
||||||
|
@ -1992,6 +2000,9 @@ public class NcPlotImageCreator {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
// Note: Now dead code (see note above). Left in for
|
||||||
|
// future analysis and possible reuse in refactoring.
|
||||||
|
|
||||||
if (hasStationDensityChanged) {
|
if (hasStationDensityChanged) {
|
||||||
/*
|
/*
|
||||||
* If the station density is different from the
|
* If the station density is different from the
|
||||||
|
@ -2101,7 +2112,7 @@ public class NcPlotImageCreator {
|
||||||
}
|
}
|
||||||
sm.release();
|
sm.release();
|
||||||
}
|
}
|
||||||
|
// End of newly-dead code. See note above.
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -131,6 +131,12 @@ import com.vividsolutions.jts.geom.Coordinate;
|
||||||
* 11/07/2013 sgurung Added fix for "no data for every other frame" issue (earlier fix was added to 13.5.2 on 10/24/2013)
|
* 11/07/2013 sgurung Added fix for "no data for every other frame" issue (earlier fix was added to 13.5.2 on 10/24/2013)
|
||||||
* 03/18/2013 1064 B. Hebbard Added handling of matrixType request constraint, for PAFM
|
* 03/18/2013 1064 B. Hebbard Added handling of matrixType request constraint, for PAFM
|
||||||
* 06/24/2014 1009 kbugenhagen Reload framedata if no stations found
|
* 06/24/2014 1009 kbugenhagen Reload framedata if no stations found
|
||||||
|
* 07/08/2014 TTR1028 B. Hebbard Modified paintFrame() to return right away if prog disc in progress, instead of
|
||||||
|
* allowing multiple PD/HDF5/image trains to run concurrently for the same frame
|
||||||
|
* in case of pan/zoom continuing after PD launched. Improves performance and
|
||||||
|
* reduces 'trickling in' of stations after pan/zoom. Also changed resourceAttrsModified()
|
||||||
|
* to remove all stations' met parameter data if requeryDataAndReCreateAllStnImages true,
|
||||||
|
* to force re-query (now that we're bypassing stations that already have data).
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author brockwoo
|
* @author brockwoo
|
||||||
|
@ -995,6 +1001,13 @@ public class NcPlotResource2 extends
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FrameData frameData = (FrameData) fd;
|
FrameData frameData = (FrameData) fd;
|
||||||
|
|
||||||
|
if (frameData.progressiveDisclosureInProgress) {
|
||||||
|
Tracer.print("Progressive disclosure in progress...aborting paintFrame for "
|
||||||
|
+ frameData.getShortFrameTime());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Semaphore sem = new Semaphore(1);
|
Semaphore sem = new Semaphore(1);
|
||||||
if (progressiveDisclosure == null) {
|
if (progressiveDisclosure == null) {
|
||||||
progressiveDisclosure = new ProgressiveDisclosure(this, spi);// assumes
|
progressiveDisclosure = new ProgressiveDisclosure(this, spi);// assumes
|
||||||
|
@ -1420,6 +1433,19 @@ public class NcPlotResource2 extends
|
||||||
dataRequestor.imageCreator
|
dataRequestor.imageCreator
|
||||||
.setUpPlotPositionToPlotModelElementMapping(editedPlotModel);
|
.setUpPlotPositionToPlotModelElementMapping(editedPlotModel);
|
||||||
|
|
||||||
|
// Remove all met param data from all stations in all frames.
|
||||||
|
// (Since we need to requery all of it anyway, this will force
|
||||||
|
// that to occur.
|
||||||
|
// TODO: factor this out to something like clearImages() ?)
|
||||||
|
|
||||||
|
for (AbstractFrameData afd : frameDataMap.values()) {
|
||||||
|
// TODO sanity check type?
|
||||||
|
FrameData fd = (FrameData) afd;
|
||||||
|
for (Station station : fd.stationMap.values()) {
|
||||||
|
station.listOfParamsToPlot.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* To remove the obsolete strings from the diff maps */
|
/* To remove the obsolete strings from the diff maps */
|
||||||
synchronized (newPMEList) {
|
synchronized (newPMEList) {
|
||||||
for (PlotModelElement newPME : newPMEList) {
|
for (PlotModelElement newPME : newPMEList) {
|
||||||
|
|
|
@ -29,6 +29,7 @@ package gov.noaa.nws.ncep.viz.rsc.plotdata.rsc;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Dec 16, 2013 bhebbard Initial creation
|
* Dec 16, 2013 bhebbard Initial creation
|
||||||
|
* Jul 07, 2014 bhebbard Assorted updates
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -45,14 +46,17 @@ import java.lang.reflect.Method;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
import com.raytheon.uf.common.time.DataTime;
|
import com.raytheon.uf.common.time.DataTime;
|
||||||
|
|
||||||
public class Tracer {
|
public class Tracer {
|
||||||
|
|
||||||
|
// ACTIVATE HERE ------------------v
|
||||||
private static boolean enabled = false;
|
private static boolean enabled = false;
|
||||||
|
|
||||||
// save it static to have it available on every call
|
// save it static to have it available on every call
|
||||||
|
@ -65,7 +69,7 @@ public class Tracer {
|
||||||
|
|
||||||
Calendar cal = Calendar.getInstance();
|
Calendar cal = Calendar.getInstance();
|
||||||
|
|
||||||
String logFileName = "/export/cdbsrv/bhebbard/pointdatadisplay/"
|
String logFileName = "" // optional custom directory
|
||||||
+ dateFormat.format(cal.getTime());
|
+ dateFormat.format(cal.getTime());
|
||||||
|
|
||||||
private static PrintWriter writer = null;
|
private static PrintWriter writer = null;
|
||||||
|
@ -145,34 +149,35 @@ public class Tracer {
|
||||||
// NcPlotResource2.FrameData.getShortFrameTime(), somehow
|
// NcPlotResource2.FrameData.getShortFrameTime(), somehow
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
Date frameDate = dt.getRefTime();
|
Date frameDate = dt.getRefTime();
|
||||||
|
int date = frameDate.getDate();
|
||||||
|
int hours = frameDate.getHours();
|
||||||
|
hours += 4; // TODO use actual current local time offset from UTC
|
||||||
|
if (hours > 23) {
|
||||||
|
date += 1; // TODO: eom condition
|
||||||
|
hours -= 24;
|
||||||
|
}
|
||||||
|
int minutes = frameDate.getMinutes();
|
||||||
DecimalFormat df = new DecimalFormat("00");
|
DecimalFormat df = new DecimalFormat("00");
|
||||||
String returnString = Integer.toString(frameDate.getDate()) + "/"
|
String returnString = Integer.toString(date) + "/" + df.format(hours)
|
||||||
+ df.format(frameDate.getHours() + 4) // TODOhorror!!
|
+ df.format(minutes);
|
||||||
+ df.format(frameDate.getMinutes());
|
|
||||||
if (dt.getFcstTime() != 0) {
|
if (dt.getFcstTime() != 0) {
|
||||||
returnString += "(" + dt.getFcstTime() + ")";
|
returnString += "(" + dt.getFcstTime() + ")";
|
||||||
}
|
}
|
||||||
return returnString;
|
return returnString;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean sanityCheckStationSet(
|
public static String printableStationList(Collection<Station> stations) {
|
||||||
Collection<Station> stationsWithData) {
|
String returnString = "";
|
||||||
for (Station s : stationsWithData) {
|
for (Station s : stations) {
|
||||||
if (s.info.stationId.equals("KJFK")) {
|
if (s != null && s.info != null) {
|
||||||
String timeString = Tracer.shortTimeString(s.info.dataTime);
|
returnString += s.info.stationId + " ";
|
||||||
if (s.listOfParamsToPlot == null)
|
|
||||||
print("KJFK in frame " + timeString
|
|
||||||
+ " has NULL listOfParamsToPlot");
|
|
||||||
else if (s.listOfParamsToPlot.isEmpty()) {
|
|
||||||
print("KJFK in frame " + timeString
|
|
||||||
+ " has EMPTY listOf ParamsToPlot !!!");
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
print("KJFK in frame " + timeString
|
|
||||||
+ " has FULL listOf ParamsToPlot!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return returnString;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String printableStationList(Station[] stations) {
|
||||||
|
return printableStationList(new HashSet<Station>(
|
||||||
|
Arrays.asList(stations)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,41 +1,38 @@
|
||||||
package gov.noaa.nws.ncep.viz.rsc.wavesat.rsc;
|
package gov.noaa.nws.ncep.viz.rsc.wavesat.rsc;
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
import gov.noaa.nws.ncep.viz.common.ui.color.ColorButtonSelector;
|
||||||
import org.eclipse.swt.events.SelectionAdapter;
|
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
|
||||||
import org.eclipse.swt.graphics.FontData;
|
|
||||||
import org.eclipse.swt.graphics.RGB;
|
|
||||||
import org.eclipse.swt.layout.FormData;
|
|
||||||
import org.eclipse.swt.layout.FormLayout;
|
|
||||||
import org.eclipse.swt.layout.FormAttachment;
|
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
|
||||||
import org.eclipse.swt.widgets.Button;
|
|
||||||
import org.eclipse.swt.widgets.Combo;
|
|
||||||
import org.eclipse.swt.widgets.Composite;
|
|
||||||
import org.eclipse.swt.widgets.Group;
|
|
||||||
import org.eclipse.swt.widgets.Label;
|
|
||||||
import org.eclipse.swt.widgets.Shell;
|
|
||||||
import org.eclipse.jface.util.IPropertyChangeListener;
|
|
||||||
import org.eclipse.jface.util.PropertyChangeEvent;
|
|
||||||
import org.geotools.referencing.wkt.Symbols;
|
|
||||||
|
|
||||||
import gov.noaa.nws.ncep.viz.resources.INatlCntrsResourceData;
|
import gov.noaa.nws.ncep.viz.resources.INatlCntrsResourceData;
|
||||||
import gov.noaa.nws.ncep.viz.resources.attributes.AbstractEditResourceAttrsDialog;
|
import gov.noaa.nws.ncep.viz.resources.attributes.AbstractEditResourceAttrsDialog;
|
||||||
import gov.noaa.nws.ncep.viz.resources.attributes.ResourceAttrSet.RscAttrValue;
|
import gov.noaa.nws.ncep.viz.resources.attributes.ResourceAttrSet.RscAttrValue;
|
||||||
import gov.noaa.nws.ncep.viz.resources.colorBar.ColorBarEditor;
|
import gov.noaa.nws.ncep.viz.resources.colorBar.ColorBarEditor;
|
||||||
import gov.noaa.nws.ncep.viz.ui.display.ColorBar;
|
import gov.noaa.nws.ncep.viz.ui.display.ColorBar;
|
||||||
import gov.noaa.nws.ncep.viz.common.ui.color.ColorButtonSelector;
|
|
||||||
import gov.noaa.nws.ncep.viz.common.ui.color.ColorMatrixSelector;
|
import org.eclipse.jface.util.IPropertyChangeListener;
|
||||||
|
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
|
import org.eclipse.swt.graphics.RGB;
|
||||||
|
import org.eclipse.swt.layout.FormAttachment;
|
||||||
|
import org.eclipse.swt.layout.FormData;
|
||||||
|
import org.eclipse.swt.layout.FormLayout;
|
||||||
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
|
import org.eclipse.swt.widgets.Combo;
|
||||||
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.swt.widgets.Group;
|
||||||
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Dialog to edit SGWH resource attributes.
|
* A Dialog to edit SGWH resource attributes.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* 09/25/11 #248 Greg Hull Initial Creation.
|
* 09/25/11 #248 Greg Hull Initial Creation.
|
||||||
|
* 07/01/14 TTR 1018 Steve Russell Updated call to ColorBarEditor
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -43,236 +40,235 @@ import gov.noaa.nws.ncep.viz.common.ui.color.ColorMatrixSelector;
|
||||||
* @version 1
|
* @version 1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class EditWaveSatAttrsDialog extends AbstractEditResourceAttrsDialog {
|
public class EditWaveSatAttrsDialog extends AbstractEditResourceAttrsDialog {
|
||||||
|
|
||||||
public EditWaveSatAttrsDialog(Shell parentShell, INatlCntrsResourceData r, Boolean apply) {
|
public EditWaveSatAttrsDialog(Shell parentShell, INatlCntrsResourceData r, Boolean apply) {
|
||||||
super(parentShell, r, apply);
|
super(parentShell, r, apply);
|
||||||
}
|
}
|
||||||
|
|
||||||
private RscAttrValue colorBarAttr = null;
|
private RscAttrValue colorBarAttr = null;
|
||||||
private RscAttrValue fontNameAttr = null;
|
|
||||||
private RscAttrValue fontSizeAttr = null;
|
|
||||||
private RscAttrValue timeDisplayIntervalAttr = null;
|
|
||||||
private RscAttrValue timeDisplayColorAttr = null;
|
|
||||||
|
|
||||||
private String[] availFonts = { "Times", "Serif", "Sans", "Utopia", "Roman", "Courier" };
|
|
||||||
private String[] availFontsSizes = { "6", "10","12","14","16","18","20","24", "28" };
|
|
||||||
private String[] availTimeIntStrs = { "10 Mins", "20 Mins", "30 Mins", "45 Mins",
|
|
||||||
"1 Hour", "1 1/2 Hours", "2 Hours",
|
|
||||||
"3 Hours", "6 Hours", "12 Hours", "24 Hours" };
|
|
||||||
private Integer[] availTimeIntMins = { 10, 20, 30, 45, 60, 90,
|
|
||||||
120, 180, 360, 720, 1440 };
|
|
||||||
|
|
||||||
private ColorBarEditor colorBarEditor = null;
|
|
||||||
|
|
||||||
//
|
|
||||||
@Override
|
|
||||||
public Composite createDialog( Composite topComp ) {
|
|
||||||
|
|
||||||
colorBarAttr = editedRscAttrSet.getRscAttr( "colorBar" );
|
|
||||||
fontNameAttr = editedRscAttrSet.getRscAttr( "fontName" );
|
|
||||||
fontSizeAttr = editedRscAttrSet.getRscAttr( "fontSize" );
|
|
||||||
timeDisplayIntervalAttr = editedRscAttrSet.getRscAttr( "timeDisplayInterval" );
|
|
||||||
timeDisplayColorAttr = editedRscAttrSet.getRscAttr( "timeDisplayColor" );
|
|
||||||
|
|
||||||
if( colorBarAttr == null || colorBarAttr.getAttrClass() != ColorBar.class ) {
|
private RscAttrValue fontNameAttr = null;
|
||||||
System.out.println("colorBar is null or not of expected class ColorBar?");
|
|
||||||
return null;
|
private RscAttrValue fontSizeAttr = null;
|
||||||
|
|
||||||
|
private RscAttrValue timeDisplayIntervalAttr = null;
|
||||||
|
|
||||||
|
private RscAttrValue timeDisplayColorAttr = null;
|
||||||
|
|
||||||
|
private String[] availFonts = { "Times", "Serif", "Sans", "Utopia", "Roman", "Courier" };
|
||||||
|
|
||||||
|
private String[] availFontsSizes = { "6", "10", "12", "14", "16", "18", "20", "24", "28" };
|
||||||
|
|
||||||
|
private String[] availTimeIntStrs = { "10 Mins", "20 Mins", "30 Mins", "45 Mins", "1 Hour", "1 1/2 Hours", "2 Hours", "3 Hours", "6 Hours", "12 Hours", "24 Hours" };
|
||||||
|
|
||||||
|
private Integer[] availTimeIntMins = { 10, 20, 30, 45, 60, 90, 120, 180, 360, 720, 1440 };
|
||||||
|
|
||||||
|
private ColorBarEditor colorBarEditor = null;
|
||||||
|
|
||||||
|
//
|
||||||
|
@Override
|
||||||
|
public Composite createDialog(Composite topComp) {
|
||||||
|
|
||||||
|
colorBarAttr = editedRscAttrSet.getRscAttr("colorBar");
|
||||||
|
fontNameAttr = editedRscAttrSet.getRscAttr("fontName");
|
||||||
|
fontSizeAttr = editedRscAttrSet.getRscAttr("fontSize");
|
||||||
|
timeDisplayIntervalAttr = editedRscAttrSet.getRscAttr("timeDisplayInterval");
|
||||||
|
timeDisplayColorAttr = editedRscAttrSet.getRscAttr("timeDisplayColor");
|
||||||
|
|
||||||
|
if (colorBarAttr == null || colorBarAttr.getAttrClass() != ColorBar.class) {
|
||||||
|
System.out.println("colorBar is null or not of expected class ColorBar?");
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
if( fontNameAttr == null || fontNameAttr.getAttrClass() != String.class ) {
|
if (fontNameAttr == null || fontNameAttr.getAttrClass() != String.class) {
|
||||||
System.out.println("fontName is null or not of expected class String?");
|
System.out.println("fontName is null or not of expected class String?");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if( fontSizeAttr == null || fontSizeAttr.getAttrClass() != Integer.class ) {
|
if (fontSizeAttr == null || fontSizeAttr.getAttrClass() != Integer.class) {
|
||||||
System.out.println("fontSize is null or not of expected class Integer?");
|
System.out.println("fontSize is null or not of expected class Integer?");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if( timeDisplayIntervalAttr == null || timeDisplayIntervalAttr.getAttrClass() != Integer.class ) {
|
if (timeDisplayIntervalAttr == null || timeDisplayIntervalAttr.getAttrClass() != Integer.class) {
|
||||||
System.out.println("timeDisplayInterval is null or not of expected class Integer?");
|
System.out.println("timeDisplayInterval is null or not of expected class Integer?");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if( timeDisplayColorAttr == null || timeDisplayColorAttr.getAttrClass() != RGB.class ) {
|
if (timeDisplayColorAttr == null || timeDisplayColorAttr.getAttrClass() != RGB.class) {
|
||||||
System.out.println("timeDisplayColor is null or not of expected class RGB?");
|
System.out.println("timeDisplayColor is null or not of expected class RGB?");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
FormLayout layout0 = new FormLayout();
|
FormLayout layout0 = new FormLayout();
|
||||||
topComp.setLayout(layout0);
|
topComp.setLayout(layout0);
|
||||||
|
|
||||||
Group selFontGrp = new Group( topComp, SWT.BORDER );
|
Group selFontGrp = new Group(topComp, SWT.BORDER);
|
||||||
FormData fd = new FormData();
|
FormData fd = new FormData();
|
||||||
selFontGrp.setText( "Select Font");
|
selFontGrp.setText("Select Font");
|
||||||
|
|
||||||
selFontGrp.setLayout( new FormLayout() );
|
selFontGrp.setLayout(new FormLayout());
|
||||||
fd.width = 300;
|
fd.width = 300;
|
||||||
fd.left = new FormAttachment( 0, 10 );
|
fd.left = new FormAttachment(0, 10);
|
||||||
// fd.right = new FormAttachment( 35, 0 );
|
// fd.right = new FormAttachment( 35, 0 );
|
||||||
fd.bottom = new FormAttachment( 0, 100 );
|
fd.bottom = new FormAttachment(0, 100);
|
||||||
fd.top = new FormAttachment( 0, 10 );
|
fd.top = new FormAttachment(0, 10);
|
||||||
selFontGrp.setLayoutData( fd );
|
selFontGrp.setLayoutData(fd);
|
||||||
|
|
||||||
// FontData[] fontdata = shell.getDisplay().getFontList(null, true);
|
|
||||||
// for( int x = 0; x < fontdata.length; x++ ) {
|
|
||||||
// System.out.println(fontdata[x].getName());
|
|
||||||
// }
|
|
||||||
// // and the non-scalable ones
|
|
||||||
// fontdata = shell.getDisplay().getFontList(null, false);
|
|
||||||
// for( int x = 0; x < fontdata.length; x++ ) {
|
|
||||||
// System.out.println(fontdata[x].getName());
|
|
||||||
// }
|
|
||||||
|
|
||||||
final Combo fontNameCombo = new Combo( selFontGrp, SWT.READ_ONLY | SWT.DROP_DOWN );
|
// FontData[] fontdata = shell.getDisplay().getFontList(null, true);
|
||||||
fd = new FormData();
|
// for( int x = 0; x < fontdata.length; x++ ) {
|
||||||
fd.left = new FormAttachment( 10, 0 );
|
// System.out.println(fontdata[x].getName());
|
||||||
fd.top = new FormAttachment( 0, 30 );
|
// }
|
||||||
fontNameCombo.setLayoutData( fd );
|
// // and the non-scalable ones
|
||||||
|
// fontdata = shell.getDisplay().getFontList(null, false);
|
||||||
|
// for( int x = 0; x < fontdata.length; x++ ) {
|
||||||
|
// System.out.println(fontdata[x].getName());
|
||||||
|
// }
|
||||||
|
|
||||||
fontNameCombo.setItems( availFonts );
|
final Combo fontNameCombo = new Combo(selFontGrp, SWT.READ_ONLY | SWT.DROP_DOWN);
|
||||||
|
fd = new FormData();
|
||||||
fontNameCombo.setText( ((String)fontNameAttr.getAttrValue()) );
|
fd.left = new FormAttachment(10, 0);
|
||||||
|
fd.top = new FormAttachment(0, 30);
|
||||||
fontNameCombo.addSelectionListener( new SelectionAdapter() {
|
fontNameCombo.setLayoutData(fd);
|
||||||
public void widgetSelected(SelectionEvent e) {
|
|
||||||
int selIndx = fontNameCombo.getSelectionIndex();
|
fontNameCombo.setItems(availFonts);
|
||||||
|
|
||||||
fontNameAttr.setAttrValue( availFonts[selIndx] );
|
fontNameCombo.setText(((String) fontNameAttr.getAttrValue()));
|
||||||
}
|
|
||||||
|
fontNameCombo.addSelectionListener(new SelectionAdapter() {
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
int selIndx = fontNameCombo.getSelectionIndex();
|
||||||
|
|
||||||
|
fontNameAttr.setAttrValue(availFonts[selIndx]);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Label nameLbl = new Label( selFontGrp, SWT.None );
|
Label nameLbl = new Label(selFontGrp, SWT.None);
|
||||||
fd = new FormData();
|
fd = new FormData();
|
||||||
fd.left = new FormAttachment( fontNameCombo, 0, SWT.LEFT );
|
fd.left = new FormAttachment(fontNameCombo, 0, SWT.LEFT);
|
||||||
fd.bottom = new FormAttachment( fontNameCombo, -3, SWT.TOP );
|
fd.bottom = new FormAttachment(fontNameCombo, -3, SWT.TOP);
|
||||||
nameLbl.setLayoutData( fd );
|
nameLbl.setLayoutData(fd);
|
||||||
nameLbl.setText( "Name" );
|
nameLbl.setText("Name");
|
||||||
// nameLbl.setVisible( false );
|
// nameLbl.setVisible( false );
|
||||||
|
|
||||||
final Combo fontSizeCombo = new Combo( selFontGrp, SWT.READ_ONLY | SWT.DROP_DOWN );
|
final Combo fontSizeCombo = new Combo(selFontGrp, SWT.READ_ONLY | SWT.DROP_DOWN);
|
||||||
fd = new FormData();
|
fd = new FormData();
|
||||||
fd.left = new FormAttachment( fontNameCombo, 20, SWT.RIGHT );
|
fd.left = new FormAttachment(fontNameCombo, 20, SWT.RIGHT);
|
||||||
fd.top = new FormAttachment( fontNameCombo, 0, SWT.TOP );
|
fd.top = new FormAttachment(fontNameCombo, 0, SWT.TOP);
|
||||||
fontSizeCombo.setLayoutData( fd );
|
fontSizeCombo.setLayoutData(fd);
|
||||||
|
|
||||||
fontSizeCombo.setItems( availFontsSizes );
|
fontSizeCombo.setItems(availFontsSizes);
|
||||||
fontSizeCombo.select(0);
|
fontSizeCombo.select(0);
|
||||||
|
|
||||||
for( int i=0 ; i<availFontsSizes.length ; i++ ) {
|
for (int i = 0; i < availFontsSizes.length; i++) {
|
||||||
if( Integer.parseInt( availFontsSizes[i] ) ==
|
if (Integer.parseInt(availFontsSizes[i]) == (Integer) fontSizeAttr.getAttrValue()) {
|
||||||
(Integer)fontSizeAttr.getAttrValue() ) {
|
fontSizeCombo.select(i);
|
||||||
fontSizeCombo.select( i );
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Label fontSizeLbl = new Label( selFontGrp, SWT.None );
|
Label fontSizeLbl = new Label(selFontGrp, SWT.None);
|
||||||
fd = new FormData();
|
fd = new FormData();
|
||||||
fd.left = new FormAttachment( fontSizeCombo, 0, SWT.LEFT );
|
fd.left = new FormAttachment(fontSizeCombo, 0, SWT.LEFT);
|
||||||
fd.bottom = new FormAttachment( fontSizeCombo, -3, SWT.TOP );
|
fd.bottom = new FormAttachment(fontSizeCombo, -3, SWT.TOP);
|
||||||
fontSizeLbl.setLayoutData( fd );
|
fontSizeLbl.setLayoutData(fd);
|
||||||
fontSizeLbl.setText( "Size" );
|
fontSizeLbl.setText("Size");
|
||||||
// fontSizeLbl.setVisible( false );
|
// fontSizeLbl.setVisible( false );
|
||||||
|
|
||||||
fontSizeCombo.addSelectionListener( new SelectionAdapter() {
|
fontSizeCombo.addSelectionListener(new SelectionAdapter() {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
int selIndx = fontSizeCombo.getSelectionIndex();
|
int selIndx = fontSizeCombo.getSelectionIndex();
|
||||||
|
|
||||||
fontSizeAttr.setAttrValue( Integer.parseInt( availFontsSizes[selIndx] ) );
|
fontSizeAttr.setAttrValue(Integer.parseInt(availFontsSizes[selIndx]));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Group selTimeStampGrp = new Group(topComp, SWT.BORDER);
|
||||||
Group selTimeStampGrp = new Group( topComp, SWT.BORDER );
|
fd = new FormData();
|
||||||
fd = new FormData();
|
selTimeStampGrp.setText("Time Stamp");
|
||||||
selTimeStampGrp.setText( "Time Stamp");
|
|
||||||
|
|
||||||
selTimeStampGrp.setLayout( new FormLayout() );
|
|
||||||
|
|
||||||
fd.top = new FormAttachment( selFontGrp, 0, SWT.TOP );
|
selTimeStampGrp.setLayout(new FormLayout());
|
||||||
fd.left = new FormAttachment( 50, 10 );
|
|
||||||
fd.right = new FormAttachment( 100, -10 );
|
fd.top = new FormAttachment(selFontGrp, 0, SWT.TOP);
|
||||||
fd.bottom = new FormAttachment( selFontGrp, 0, SWT.BOTTOM );
|
fd.left = new FormAttachment(50, 10);
|
||||||
selTimeStampGrp.setLayoutData( fd );
|
fd.right = new FormAttachment(100, -10);
|
||||||
|
fd.bottom = new FormAttachment(selFontGrp, 0, SWT.BOTTOM);
|
||||||
|
selTimeStampGrp.setLayoutData(fd);
|
||||||
|
|
||||||
|
final Combo timeStampIntCombo = new Combo(selTimeStampGrp, SWT.READ_ONLY | SWT.DROP_DOWN);
|
||||||
|
fd = new FormData();
|
||||||
|
fd.left = new FormAttachment(10, 0);
|
||||||
|
fd.top = new FormAttachment(0, 30);
|
||||||
|
timeStampIntCombo.setLayoutData(fd);
|
||||||
|
|
||||||
final Combo timeStampIntCombo = new Combo( selTimeStampGrp, SWT.READ_ONLY | SWT.DROP_DOWN );
|
|
||||||
fd = new FormData();
|
|
||||||
fd.left = new FormAttachment( 10, 0 );
|
|
||||||
fd.top = new FormAttachment( 0, 30 );
|
|
||||||
timeStampIntCombo.setLayoutData( fd );
|
|
||||||
|
|
||||||
// set the list of time Intervals and initialize to the currently selected one.
|
// set the list of time Intervals and initialize to the currently selected one.
|
||||||
//
|
//
|
||||||
timeStampIntCombo.setItems( availTimeIntStrs );
|
timeStampIntCombo.setItems(availTimeIntStrs);
|
||||||
|
|
||||||
for( int t=0 ; t< availTimeIntMins.length ; t++ ) {
|
for (int t = 0; t < availTimeIntMins.length; t++) {
|
||||||
if( availTimeIntMins[t].equals(
|
if (availTimeIntMins[t].equals((Integer) timeDisplayIntervalAttr.getAttrValue())) {
|
||||||
(Integer)timeDisplayIntervalAttr.getAttrValue()) ) {
|
timeStampIntCombo.select(t);
|
||||||
timeStampIntCombo.select( t );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
timeStampIntCombo.addSelectionListener( new SelectionAdapter() {
|
timeStampIntCombo.addSelectionListener(new SelectionAdapter() {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
int selIndx = timeStampIntCombo.getSelectionIndex();
|
int selIndx = timeStampIntCombo.getSelectionIndex();
|
||||||
|
|
||||||
timeDisplayIntervalAttr.setAttrValue( availTimeIntMins[selIndx] );
|
timeDisplayIntervalAttr.setAttrValue(availTimeIntMins[selIndx]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Label timeStampIntLbl = new Label( selTimeStampGrp, SWT.None );
|
Label timeStampIntLbl = new Label(selTimeStampGrp, SWT.None);
|
||||||
fd = new FormData();
|
fd = new FormData();
|
||||||
fd.left = new FormAttachment( timeStampIntCombo, 0, SWT.LEFT );
|
fd.left = new FormAttachment(timeStampIntCombo, 0, SWT.LEFT);
|
||||||
fd.bottom = new FormAttachment( timeStampIntCombo, -3, SWT.TOP );
|
fd.bottom = new FormAttachment(timeStampIntCombo, -3, SWT.TOP);
|
||||||
timeStampIntLbl.setLayoutData( fd );
|
timeStampIntLbl.setLayoutData(fd);
|
||||||
timeStampIntLbl.setText( "Interval" );
|
timeStampIntLbl.setText("Interval");
|
||||||
// timeStampIntLbl.setVisible( false );
|
// timeStampIntLbl.setVisible( false );
|
||||||
|
|
||||||
Composite selColComp = new Composite( selTimeStampGrp, SWT.NONE );
|
Composite selColComp = new Composite(selTimeStampGrp, SWT.NONE);
|
||||||
fd = new FormData();
|
fd = new FormData();
|
||||||
|
|
||||||
fd.bottom = new FormAttachment( timeStampIntCombo, 0, SWT.BOTTOM );
|
|
||||||
fd.left = new FormAttachment( timeStampIntCombo, 30, SWT.RIGHT );
|
|
||||||
selColComp.setLayoutData( fd );
|
|
||||||
selColComp.setLayout( new GridLayout() );
|
|
||||||
|
|
||||||
final ColorButtonSelector colBtnSel = new ColorButtonSelector(
|
|
||||||
selColComp, 60,30 );
|
|
||||||
colBtnSel.setColorValue((RGB)timeDisplayColorAttr.getAttrValue());
|
|
||||||
colBtnSel.addListener(new IPropertyChangeListener() {
|
|
||||||
public void propertyChange( PropertyChangeEvent event ) {
|
|
||||||
timeDisplayColorAttr.setAttrValue( event.getNewValue() );
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Group colorBarGrp = new Group( topComp, SWT.NONE );
|
fd.bottom = new FormAttachment(timeStampIntCombo, 0, SWT.BOTTOM);
|
||||||
|
fd.left = new FormAttachment(timeStampIntCombo, 30, SWT.RIGHT);
|
||||||
|
selColComp.setLayoutData(fd);
|
||||||
|
selColComp.setLayout(new GridLayout());
|
||||||
|
|
||||||
|
final ColorButtonSelector colBtnSel = new ColorButtonSelector(selColComp, 60, 30);
|
||||||
|
colBtnSel.setColorValue((RGB) timeDisplayColorAttr.getAttrValue());
|
||||||
|
colBtnSel.addListener(new IPropertyChangeListener() {
|
||||||
|
public void propertyChange(PropertyChangeEvent event) {
|
||||||
|
timeDisplayColorAttr.setAttrValue(event.getNewValue());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Group colorBarGrp = new Group(topComp, SWT.NONE);
|
||||||
colorBarGrp.setText("Edit Color Bar");
|
colorBarGrp.setText("Edit Color Bar");
|
||||||
fd = new FormData();//400,300);
|
fd = new FormData();//400,300);
|
||||||
fd.left = new FormAttachment( 0, 15 );
|
fd.left = new FormAttachment(0, 15);
|
||||||
fd.right = new FormAttachment( 100, -15 );
|
fd.right = new FormAttachment(100, -15);
|
||||||
fd.top = new FormAttachment( selFontGrp, 15, SWT.BOTTOM );
|
fd.top = new FormAttachment(selFontGrp, 15, SWT.BOTTOM);
|
||||||
fd.bottom = new FormAttachment( 100, -20 );
|
fd.bottom = new FormAttachment(100, -20);
|
||||||
colorBarGrp.setLayoutData( fd );
|
colorBarGrp.setLayoutData(fd);
|
||||||
|
|
||||||
colorBarGrp.setLayout( new FormLayout() );
|
colorBarGrp.setLayout(new FormLayout());
|
||||||
|
|
||||||
ColorBar editedColorBar = null;
|
ColorBar editedColorBar = null;
|
||||||
|
|
||||||
editedColorBar = (ColorBar)colorBarAttr.getAttrValue();
|
editedColorBar = (ColorBar) colorBarAttr.getAttrValue();
|
||||||
|
|
||||||
|
colorBarEditor = new ColorBarEditor(colorBarGrp, editedColorBar, true);
|
||||||
|
|
||||||
colorBarEditor = new ColorBarEditor( colorBarGrp, editedColorBar );
|
|
||||||
|
|
||||||
return topComp;
|
return topComp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initWidgets() {
|
public void initWidgets() {
|
||||||
// done in createDialog
|
// done in createDialog
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void dispose() {
|
protected void dispose() {
|
||||||
super.dispose();
|
super.dispose();
|
||||||
colorBarEditor.dispose();
|
colorBarEditor.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue