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 [formerly 1a675e7e3f [formerly c23c487d0bdf5b0105e1fe297caee2406fcc2ed8]]
Former-commit-id: 1a675e7e3f
Former-commit-id: a232ad326d
This commit is contained in:
Stephen Gilbert 2014-07-23 15:54:48 -04:00
parent 8e79558516
commit 90e2c8b4f8
66 changed files with 7365 additions and 5885 deletions

View file

@ -15,6 +15,7 @@
* a NCMapEditor object as one of the arguments
* Removed the call to setNcEditor()
* 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;
@ -63,7 +64,7 @@ public class NctextuiResource extends
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 pickedSymbolSet = null;
@ -71,55 +72,55 @@ public class NctextuiResource extends
private static NatlCntrsEditor mapEditor = null;
// private static int mapEditorNum=0;
private static NctextuiMouseHandler mouseHandler;
private static NctextuiMouseHandler mouseHandler;
/*
* public static NCMapEditor getOrCreateMapEditor() { if(mapEditor== null)
* createMapEditor(); return mapEditor; }
*/
public static NatlCntrsEditor getMapEditor() {
return mapEditor;
}
return mapEditor;
}
private List<NctextStationInfo> points = new ArrayList<NctextStationInfo>();
private List<NctextStationInfo> pickedStnPt = new ArrayList<NctextStationInfo>();
public List<NctextStationInfo> getPickedStnPt() {
return pickedStnPt;
}
public void setPickedStnPt(List<NctextStationInfo> pickedStnPt) {
if (pickedStnPt == null)
this.pickedStnPt.clear();
else
this.pickedStnPt = pickedStnPt;
}
public List<NctextStationInfo> getPickedStnPt() {
return pickedStnPt;
}
public List<NctextStationInfo> getPoints() {
return points;
}
public void setPickedStnPt(List<NctextStationInfo> pickedStnPt) {
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() {
// create an editor MapEditor
// create an editor MapEditor
if (mapEditor != null)
return;
try {
// TODO: what if the active editor is not a Map Editor ?
// should we find one, create one or prompt
//
AbstractEditor ed = NcDisplayMngr.getActiveNatlCntrsEditor();
return;
try {
// TODO: what if the active editor is not a Map Editor ?
// should we find one, create one or prompt
//
AbstractEditor ed = NcDisplayMngr.getActiveNatlCntrsEditor();
if (NcEditorUtil.getNcDisplayType(ed) == NcDisplayType.NMAP_DISPLAY) {
mapEditor = (NatlCntrsEditor) ed;
} else {
@ -127,33 +128,33 @@ public class NctextuiResource extends
.createNatlCntrsEditor(NcDisplayType.NMAP_DISPLAY,
"Select NCTEXT Data");
// get this to set the editor to 'NCTEXT'
ResourceBndlLoader rbdLoader = new ResourceBndlLoader("NCTEXT");
// get this to set the editor to 'NCTEXT'
ResourceBndlLoader rbdLoader = new ResourceBndlLoader("NCTEXT");
rbdLoader.addDefaultRBD(NcDisplayType.NMAP_DISPLAY, mapEditor);
VizApp.runSync(rbdLoader);
}
}
// register mouse handler
mouseHandler = getMouseHandler();
mouseHandler = getMouseHandler();
mapEditor.registerMouseHandler((IInputHandler) mouseHandler);
// System.out.println("NctextuiPaletteWindow create editor "+
// mapEditor.toString());
} catch (Exception ve) {
System.out.println("Could not load initial editor: "
+ ve.getMessage());
ve.printStackTrace();
}
}
ve.printStackTrace();
}
}
public static NctextuiResource getNctextuiResource() {
public static NctextuiResource getNctextuiResource() {
if (nctextuiResource == null) {
if (mapEditor == null)
createMapEditor();
createMapEditor();
// nctextuiResource = createNewResource(mapEditor);
if (mapEditor != null) {
IMapDescriptor desc = (IMapDescriptor) mapEditor
.getActiveDisplayPane().getRenderableDisplay()
.getDescriptor();
try {
try {
if (nctextuiResourceData == null)
nctextuiResourceData = new NctextuiResourceData();
nctextuiResource = nctextuiResourceData.construct(
@ -161,35 +162,35 @@ public class NctextuiResource extends
desc.getResourceList().add(nctextuiResource);
nctextuiResource.init(mapEditor.getActiveDisplayPane()
.getTarget());
} catch (Exception e) {
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
} catch (Exception e) {
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()
*/
@Override
public void disposeInternal() {
* @see com.raytheon.viz.core.rsc.IVizResource#dispose()
*/
@Override
public void disposeInternal() {
// System.out.println("NctextuiResource:disposeInternal");
if (mapEditor != null) {
mapEditor.unregisterMouseHandler(mouseHandler);
mouseHandler = null;
mouseHandler = null;
// close editor
// if((PlatformUI.getWorkbench()!=
// null)&&(PlatformUI.getWorkbench().getActiveWorkbenchWindow()!=
@ -201,36 +202,36 @@ public class NctextuiResource extends
// PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeEditor(mapEditor,
// false);
// }
mapEditor = null;
mapEditor = null;
// mapEditorNum=0;
}
closeTextView();
nctextuiResource = null;
nctextuiResource = null;
nctextuiResourceData = null;
}
}
public static void registerMouseHandler() {
mouseHandler = getMouseHandler();
mouseHandler = getMouseHandler();
if (mapEditor != null && mouseHandler != null)
mapEditor.registerMouseHandler((IInputHandler) mouseHandler);
}
}
public static void unregisterMouseHandler() {
mouseHandler = getMouseHandler();
mouseHandler = getMouseHandler();
if (mapEditor != null && mouseHandler != null)
mapEditor.unregisterMouseHandler((IInputHandler) mouseHandler);
}
}
@Override
public void propertiesChanged(ResourceProperties updatedProps) {
@Override
public void propertiesChanged(ResourceProperties updatedProps) {
// System.out.println("NctextuiResource:propertiesChanged");
if (updatedProps.isVisible()) {
reopenTextView();
} else {
hideTextView();
}
}
}
private void hideTextView() {
IWorkbenchPage wpage = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage();
@ -239,10 +240,10 @@ public class NctextuiResource extends
if (wpage.isPartVisible(vpart)) {
NctextuiPaletteWindow paletteWin = NctextuiPaletteWindow
.getAccess();
paletteWin.setEditorVisible(false);
wpage.hideView(vpart);
paletteWin.setEditorVisible(false);
wpage.hideView(vpart);
}
}
}
private void closeTextView() {
// System.out.println("NctextuiResource:closeTextView");
@ -253,12 +254,12 @@ public class NctextuiResource extends
IWorkbenchPage wpage = win.getActivePage();
if (wpage != null) {
IViewPart vpart = wpage.findView("gov.noaa.nws.ncep.ui.NCTEXTUI");
wpage.hideView(vpart);
}
wpage.hideView(vpart);
}
NcDisplayMngr.setPanningMode();
}
}
private void reopenTextView() {
// System.out.println("NctextuiResource:reopenTextView");
IWorkbenchPage wpage = PlatformUI.getWorkbench()
@ -268,54 +269,54 @@ public class NctextuiResource extends
if (!wpage.isPartVisible(vpart)) {
NctextuiPaletteWindow paletteWin = NctextuiPaletteWindow
.getAccess();
paletteWin.setEditorVisible(true);
try {
paletteWin.setEditorVisible(true);
try {
vpart = wpage.showView("gov.noaa.nws.ncep.ui.NCTEXTUI");
} catch (Exception e) {
e.printStackTrace();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.core.rsc.IVizResource#getCoordinateReferenceSystem()
*/
public CoordinateReferenceSystem getCoordinateReferenceSystem() {
*/
public CoordinateReferenceSystem getCoordinateReferenceSystem() {
if (descriptor == null)
return null;
if (descriptor == null)
return null;
return descriptor.getCRS();
return descriptor.getCRS();
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.core.rsc.IVizResource#getName()
*/
@Override
public String getName() {
* @see com.raytheon.viz.core.rsc.IVizResource#getName()
*/
@Override
public String getName() {
return "NCText";
return "NCText";
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.core.rsc.IVizResource#init(com.raytheon.viz.core.
* IGraphicsTarget)
*/
@Override
public void initInternal(IGraphicsTarget target) throws VizException {
*/
@Override
public void initInternal(IGraphicsTarget target) throws VizException {
// System.out.println("NctextuiResource:initInternal");
EditableManager.makeEditable(this,
getCapability(EditableCapability.class).isEditable());
}
}
/*
* (non-Javadoc)
@ -323,38 +324,38 @@ public class NctextuiResource extends
* @see
* com.raytheon.viz.core.rsc.IVizResource#isApplicable(com.raytheon.viz.
* core.PixelExtent)
*/
public boolean isApplicable(PixelExtent extent) {
*/
public boolean isApplicable(PixelExtent extent) {
return true;
return true;
}
}
private void generateSymbolForDrawing() {
String type;
String type;
float lineWidth = resourceData.getMarkerWidth();
Boolean clear = false;
;
String category = new String("Marker");
String category = new String("Marker");
double sizeScale = resourceData.getMarkerSize();
// NctextuiPaletteWindow nctextuiPaletteWindow =
// NctextuiPaletteWindow.getAccess();
if (points.isEmpty() == true) {
symbolSet = null;
if (points.isEmpty() == true) {
symbolSet = null;
} else {
// SymbolLocationSet constructor requires a positive-length array of
// Coordinate
Coordinate[] locations = new Coordinate[points.size()];
Coordinate[] locations = new Coordinate[points.size()];
// System.out.println( "generateSymbolSet: size ="+ points.size());
int i = 0;
for (NctextStationInfo p : points) {
double lon, lat;
lon = p.getLongitude();
lat = p.getLatitude();
int i = 0;
for (NctextStationInfo p : points) {
double lon, lat;
lon = p.getLongitude();
lat = p.getLatitude();
locations[i++] = new Coordinate(lon, lat);
}
}
Color[] colors = new Color[] { new Color(
resourceData.getColor().red, resourceData.getColor().green,
@ -363,37 +364,37 @@ public class NctextuiResource extends
// System.out.println( "generateSymbolSet done size ="+ i);
symbolSet = new SymbolLocationSet(null, colors, lineWidth,
sizeScale, clear, locations, category, type);
}
if (pickedStnPt.isEmpty() == true) {
pickedSymbolSet = null;
}
if (pickedStnPt.isEmpty() == true) {
pickedSymbolSet = null;
} else {
// SymbolLocationSet constructor requires a positive-length array of
// Coordinate
Coordinate[] locations = new Coordinate[pickedStnPt.size()];
Coordinate[] locations = new Coordinate[pickedStnPt.size()];
// System.out.println( "generatePickedSymbolSet: size ="+
// pickedStnPt.size());
int i = 0;
for (NctextStationInfo p : pickedStnPt) {
double lon, lat;
lon = p.getLongitude();
lat = p.getLatitude();
int i = 0;
for (NctextStationInfo p : pickedStnPt) {
double lon, lat;
lon = p.getLongitude();
lat = p.getLatitude();
locations[i++] = new Coordinate(lon, lat);
}
}
Color[] colors = new Color[] { new Color(
resourceData.getPkStncolor().red,
resourceData.getPkStncolor().green,
resourceData.getPkStncolor().blue) };
type = resourceData.getPkStnmarkerType().toString();
pickedSymbolSet = new SymbolLocationSet(null, colors, lineWidth,
sizeScale, clear, locations, category, type);
}
}
}
}
/*
* (non-Javadoc)
@ -401,53 +402,53 @@ public class NctextuiResource extends
* @see
* com.raytheon.viz.core.drawables.IRenderable#paint(com.raytheon.viz.core
* .IGraphicsTarget, com.raytheon.viz.core.drawables.PaintProperties)
*/
@Override
public void paintInternal(IGraphicsTarget target, PaintProperties paintProps)
throws VizException {
*/
@Override
public void paintInternal(IGraphicsTarget target, PaintProperties paintProps)
throws VizException {
// System.out.println("paintInternal called!");
IFont font = target.initializeFont("Monospace",
IFont font = target.initializeFont("Monospace",
(float) (12 * resourceData.getMarkerTextSize()
.getSoftwareSize()), null);
generateSymbolForDrawing();
generateSymbolForDrawing();
if (symbolSet != null) {
DisplayElementFactory df = new DisplayElementFactory(target,
this.descriptor);
ArrayList<IDisplayable> elements = df.createDisplayElements(
symbolSet, paintProps);
for (IDisplayable each : elements) {
try {
each.draw(target, paintProps);
each.dispose();
try {
each.draw(target, paintProps);
each.dispose();
} catch (Exception e) {
// e.printStackTrace();
e.printStackTrace();
// System.out.println("paintInternal caught draw exception!");
}
}
}
}
}
}
if (pickedSymbolSet != null) {
DisplayElementFactory df = new DisplayElementFactory(target,
this.descriptor);
ArrayList<IDisplayable> elements = df.createDisplayElements(
pickedSymbolSet, paintProps);
for (IDisplayable each : elements) {
try {
each.draw(target, paintProps);
each.dispose();
try {
each.draw(target, paintProps);
each.dispose();
} catch (Exception e) {
// e.printStackTrace();
// System.out.println("paintInternal caught draw exception on pickedSymbolSet!");
}
}
}
font.dispose();
}
}
}
}
font.dispose();
}
/*
* (non-Javadoc)
@ -455,12 +456,12 @@ public class NctextuiResource extends
* @see
* com.raytheon.viz.core.rsc.capabilities.IProjectableResource#isProjectable
* (org.opengis.referencing.crs.CoordinateReferenceSystem)
*/
public boolean isProjectable(CoordinateReferenceSystem mapData) {
*/
public boolean isProjectable(CoordinateReferenceSystem mapData) {
return true;
return true;
}
}
/*
* (non-Javadoc)
@ -468,22 +469,22 @@ public class NctextuiResource extends
* @see
* com.raytheon.viz.core.rsc.capabilities.IProjectableResource#project(org
* .opengis.referencing.crs.CoordinateReferenceSystem)
*/
@Override
public void project(CoordinateReferenceSystem mapData) throws VizException {
*/
@Override
public void project(CoordinateReferenceSystem mapData) throws VizException {
// System.out.println("NctextuiResource: project ");
}
}
private static NctextuiMouseHandler getMouseHandler() {
private static NctextuiMouseHandler getMouseHandler() {
if (mouseHandler == null) {
mouseHandler = new NctextuiMouseHandler();
mouseHandler = new NctextuiMouseHandler();
}
return mouseHandler;
}
/**

View file

@ -11,6 +11,7 @@
* Date Ticket# Engineer Description
* ------- ------- -------- -----------
* 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>
*
@ -19,13 +20,13 @@
*/
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.ui.nsharp.NsharpConstants;
import gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor;
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.IDialogConstants;
import org.eclipse.jface.window.IShellProvider;
@ -48,445 +49,465 @@ import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.PlatformUI;
public class NsharpEditDataDialog extends Dialog {
//private NcepLogger logger = NcepLoggerManager.getNcepCaveLogger(this.getClass());
private List<NcSoundingLayer> curSoundingLayerList;
private Text curTempText, newTempText, curDewText, newDewText, curWSpText, newWSpText, curWDirText, newWDirText,
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
}
// private NcepLogger logger =
// NcepLoggerManager.getNcepCaveLogger(this.getClass());
private List<NcSoundingLayer> curSoundingLayerList;
public NsharpEditDataDialog(IShellProvider parentShell) {
super(parentShell);
// TODO Auto-generated constructor stub
}
private Text curTempText, newTempText, curDewText, newDewText, curWSpText,
newWSpText, curWDirText, newWDirText, curPressText, newPressText;// curHeightText,
// newHeightText;
public static NsharpEditDataDialog getInstance( Shell parShell){
private static NsharpEditDataDialog thisDialog = null;
if ( thisDialog == null ){
thisDialog = new NsharpEditDataDialog( parShell );
//System.out.println("new parcel dialog INSTANCE created");
private org.eclipse.swt.widgets.List pressureList;
}
else {
//System.out.println("current load dialog INSTANCE returned!");
}
private String tempStr = "", dewStr = "", wspStr = "", wdirStr = "";
return thisDialog;
private org.eclipse.swt.graphics.Color lightGrey = new org.eclipse.swt.graphics.Color(
Display.getDefault(), 211, 211, 211);
}
private void createDialogContents( Composite parent) {
top = parent;//(Composite) super.createDialogArea(parent);
private enum EditType {
SELECTED_LEVEL, NEW_LEVEL
}
// Create the main layout for the shell.
GridLayout mainLayout = new GridLayout(1, false);
mainLayout.marginHeight = 3;
mainLayout.marginWidth = 3;
top.setLayout(mainLayout);
Group topGp = new Group(top,SWT.SHADOW_OUT);
topGp.setLayout( new GridLayout(2, false) );
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 );
pressureList.setBounds(pressureListGp.getBounds().x,pressureListGp.getBounds().y+ NsharpConstants.labelGap, NsharpConstants.listWidth, NsharpConstants.listHeight );
NsharpResourceHandler rsc=null;
if(NsharpEditor.getActiveNsharpEditor()!= null)
rsc = NsharpEditor.getActiveNsharpEditor().getRscHandler();
if (rsc != null && rsc.getSoundingLys() !=null) {
curSoundingLayerList = rsc.getSoundingLys();
for(NcSoundingLayer layer: curSoundingLayerList){
pressureList.add(Float.toString(layer.getPressure()));
}
}
//create a selection listener to handle user's selection on list
pressureList.addListener ( SWT.Selection, new Listener () {
public void handleEvent (Event e) {
selIndex = pressureList.getSelectionIndex();
}
});
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;
}
}
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) {
super(parentShell);
// TODO Auto-generated constructor stub
}
public static NsharpEditDataDialog getInstance(Shell parShell) {
if (thisDialog == null) {
thisDialog = new NsharpEditDataDialog(parShell);
// System.out.println("new parcel dialog INSTANCE created");
} else {
// System.out.println("current load dialog INSTANCE returned!");
}
return thisDialog;
}
private void createDialogContents(Composite parent) {
top = parent;// (Composite) super.createDialogArea(parent);
// Create the main layout for the shell.
GridLayout mainLayout = new GridLayout(1, false);
mainLayout.marginHeight = 3;
mainLayout.marginWidth = 3;
top.setLayout(mainLayout);
Group topGp = new Group(top, SWT.SHADOW_OUT);
topGp.setLayout(new GridLayout(2, false));
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);
pressureList.setBounds(pressureListGp.getBounds().x,
pressureListGp.getBounds().y + NsharpConstants.labelGap,
NsharpConstants.listWidth + 40, NsharpConstants.listHeight);
NsharpResourceHandler rsc = null;
if (NsharpEditor.getActiveNsharpEditor() != null)
rsc = NsharpEditor.getActiveNsharpEditor().getRscHandler();
if (rsc != null && rsc.getSoundingLys() != null) {
curSoundingLayerList = rsc.getSoundingLys();
for (NcSoundingLayer layer : curSoundingLayerList) {
pressureList.add(Float.toString(layer.getPressure()));
}
};
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;
}
}
}
// create a selection listener to handle user's selection on list
pressureList.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
selIndex = pressureList.getSelectionIndex();
}
};
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");
FormData fd = new FormData( 100, 20 );
fd.top = new FormAttachment( 0, 15 );
fd.left = new FormAttachment( 0, 110 );
fd.right = new FormAttachment( 100, -105 );
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 );
FormData fd = new FormData(100, 20);
fd.top = new FormAttachment(0, 15);
fd.left = new FormAttachment(0, 120);
fd.right = new FormAttachment(100, -105);
curlbl.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)");
FormData fd1 = new FormData();
fd1.bottom = new FormAttachment( curPressText, -4, SWT.BOTTOM );
fd1.right = new FormAttachment( curPressText, -10, SWT.LEFT );
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 );
fd1.bottom = new FormAttachment(curPressText, -4, SWT.BOTTOM);
fd1.right = new FormAttachment(curPressText, -10, SWT.LEFT);
presslbl.setLayoutData(fd1);
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)");
fd1 = new FormData();
fd1.bottom = new FormAttachment( curTempText, -4, SWT.BOTTOM );
fd1.right = new FormAttachment( curTempText, -10, SWT.LEFT );
templbl.setLayoutData( fd1 );
newTempText = new Text( top_form, SWT.SINGLE | SWT.BORDER );
fd1.bottom = new FormAttachment(curTempText, -4, SWT.BOTTOM);
fd1.right = new FormAttachment(curTempText, -10, SWT.LEFT);
templbl.setLayoutData(fd1);
newTempText = new Text(top_form, SWT.SINGLE | SWT.BORDER);
newTempText.setText("");
fd2 = new FormData(100, 20 );
fd2.bottom = new FormAttachment(curTempText , 0, SWT.BOTTOM );
fd2.left = new FormAttachment( curTempText, 10, SWT.RIGHT );
newTempText.setLayoutData( fd2 );
newTempText.addListener (SWT.Verify, numberListeener);
curDewText = new Text( top_form, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY );
fd2 = new FormData(100, 20);
fd2.bottom = new FormAttachment(curTempText, 0, SWT.BOTTOM);
fd2.left = new FormAttachment(curTempText, 10, SWT.RIGHT);
newTempText.setLayoutData(fd2);
newTempText.addListener(SWT.Verify, numberListeener);
curDewText = new Text(top_form, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
curDewText.setText(dewStr);
curDewText.setBackground(lightGrey);
fd = new FormData( 100, 20 );
fd.top = new FormAttachment( curTempText, 5, SWT.BOTTOM );
fd.left = new FormAttachment( curTempText, 0, SWT.LEFT );
fd.right = new FormAttachment( curTempText, 0, SWT.RIGHT );
curDewText.setLayoutData( fd );
fd = new FormData(100, 20);
fd.top = new FormAttachment(curTempText, 5, SWT.BOTTOM);
fd.left = new FormAttachment(curTempText, 0, SWT.LEFT);
fd.right = new FormAttachment(curTempText, 0, SWT.RIGHT);
curDewText.setLayoutData(fd);
Label dewlbl = new Label( top_form, SWT.NONE );
Label dewlbl = new Label(top_form, SWT.NONE);
dewlbl.setText("DewPoint (C)");
fd1 = new FormData();
fd1.bottom = new FormAttachment( curDewText, -4, SWT.BOTTOM );
fd1.right = new FormAttachment( curDewText, -10, SWT.LEFT );
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 );
fd1.bottom = new FormAttachment(curDewText, -4, SWT.BOTTOM);
fd1.right = new FormAttachment(curDewText, -10, SWT.LEFT);
dewlbl.setLayoutData(fd1);
Label wsplbl = new Label( top_form, SWT.NONE );
wsplbl.setText("Wind Speed (Knot)");
fd1 = new FormData();
fd1.bottom = new FormAttachment( curWSpText, -4, SWT.BOTTOM );
fd1.right = new FormAttachment( curWSpText, -10, SWT.LEFT );
wsplbl.setLayoutData( fd1 );
newWSpText = new Text( top_form, SWT.SINGLE | SWT.BORDER );
newWSpText.setText("");
fd2 = new FormData(100, 20 );
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 );
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);
curWDirText = new Text(top_form, SWT.SINGLE | SWT.BORDER
| SWT.READ_ONLY);
curWDirText.setText(wdirStr);
curWDirText.setBackground(lightGrey);
fd = new FormData( 100, 20 );
fd.top = new FormAttachment( curWSpText, 5, SWT.BOTTOM );
fd.left = new FormAttachment( curWSpText, 0, SWT.LEFT );
fd.right = new FormAttachment( curWSpText, 0, SWT.RIGHT );
curWDirText.setLayoutData( fd );
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);
curWDirText.setLayoutData(fd);
Label wdirlbl = new Label( top_form, SWT.NONE );
Label wdirlbl = new Label(top_form, SWT.NONE);
wdirlbl.setText("Wind Direction");
fd1 = new FormData();
fd1.bottom = new FormAttachment( curWDirText, -4, SWT.BOTTOM );
fd1.right = new FormAttachment( curWDirText, -10, SWT.LEFT );
wdirlbl.setLayoutData( fd1 );
newWDirText = new Text( top_form, SWT.SINGLE | SWT.BORDER );
fd1.bottom = new FormAttachment(curWDirText, -4, SWT.BOTTOM);
fd1.right = new FormAttachment(curWDirText, -10, SWT.LEFT);
wdirlbl.setLayoutData(fd1);
newWDirText = new Text(top_form, SWT.SINGLE | SWT.BORDER);
newWDirText.setText("");
fd2 = new FormData(100, 20 );
fd2.bottom = new FormAttachment(curWDirText , 0, SWT.BOTTOM );
fd2.left = new FormAttachment( curWDirText, 10, SWT.RIGHT );
newWDirText.setLayoutData( fd2 );
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;
}
fd2 = new FormData(100, 20);
fd2.bottom = new FormAttachment(curWDirText, 0, SWT.BOTTOM);
fd2.left = new FormAttachment(curWDirText, 10, SWT.RIGHT);
newWDirText.setLayoutData(fd2);
newWDirText.addListener(SWT.Verify, positiveNumberListeener);
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());
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(curWDirText, 5, SWT.BOTTOM);
fd.left = new FormAttachment(curWDirText, 0, SWT.LEFT);
fd.right = new FormAttachment(curWDirText, 0, SWT.RIGHT);
curWSpText.setLayoutData(fd);
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);
Label wsplbl = new Label(top_form, SWT.NONE);
wsplbl.setText("Wind Speed (Knot)");
fd1 = new FormData();
fd1.bottom = new FormAttachment(curWSpText, -4, SWT.BOTTOM);
fd1.right = new FormAttachment(curWSpText, -10, SWT.LEFT);
wsplbl.setLayoutData(fd1);
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);
newWSpText = new Text(top_form, SWT.SINGLE | SWT.BORDER);
newWSpText.setText("");
fd2 = new FormData(100, 20);
fd2.bottom = new FormAttachment(curWSpText, 0, SWT.BOTTOM);
fd2.left = new FormAttachment(curWSpText, 10, SWT.RIGHT);
newWSpText.setLayoutData(fd2);
newWSpText.addListener(SWT.Verify, positiveNumberListeener);
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();
}
@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() {
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();
}
}

View file

@ -142,7 +142,7 @@ import com.vividsolutions.jts.linearref.LocationIndexedLine;
* 12/13 #1091 J. Wu Added getLayerMergeOption()
* 05/14 TTR 995 J. Wu Added getContourLabelAutoPlacement().
* 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>
*
* @author
@ -834,12 +834,14 @@ public class PgenUtil {
IMapDescriptor mapDescriptor) {
double[] point = new double[3];
double[][] pixels = new double[pts.length][3];
double[] pixel;
for (int i = 0; i < pts.length; i++) {
point[0] = pts[i].x;
point[1] = pts[i].y;
point[2] = 0.0;
pixels[i] = mapDescriptor.worldToPixel(point);
pixel = mapDescriptor.worldToPixel(point);
if (pixel != null)
pixels[i] = pixel;
}
return pixels;

View file

@ -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.
* 12/13 #1089 B. Yin Modify watch to display county list
* 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>
*
* @author sgilbert
@ -1522,19 +1523,22 @@ public class DisplayElementFactory {
ArrayList<Coordinate> trackPts = new ArrayList<Coordinate>();
// draw wave quarters
slist.addAll(createDisplayElements(tcm.getWaveQuarters(), paintProps));
// draw wind forecast quarters and labels
for (TcmFcst tcmFcst : tcm.getTcmFcst()) {
String[] txt = new String[2];
Calendar fcstHr = (Calendar) tcm.getAdvisoryTime().clone();
fcstHr.add(Calendar.HOUR_OF_DAY, tcmFcst.getFcstHr());
Calendar fcstHr = tcmFcst.getEndtime();
if (fcstHr == null) {
fcstHr = (Calendar) tcm.getAdvisoryTime().clone();
fcstHr.add(Calendar.HOUR_OF_DAY, tcmFcst.getFcstHr());
}
if (tcmFcst.equals(tcm.getTcmFcst().get(0))) {
txt[0] = tcm.getStormName() + "/"
+ (int) tcm.getCentralPressure() + "mb";
txt[1] = String.format("%1$td/%1$tH%1$tM", fcstHr);
txt[1] = tcm.getStormName()
+ "/"
+ (tcm.getCentralPressure() > 0 ? tcm
.getCentralPressure() : "xxx") + "mb";
txt[0] = String.format("%1$td/%1$tH%1$tM", fcstHr);
} else {
txt[0] = String.format("%1$td/%1$tH%1$tM", fcstHr);
txt[1] = "";
@ -1544,6 +1548,12 @@ public class DisplayElementFactory {
trackPts.add(tcmFcst.getQuarters()[0].getLocation());
}
// draw wave quarters
if (tcm.getWaveQuarters() != null) {
slist.addAll(createDisplayElements(tcm.getWaveQuarters(),
paintProps));
}
// draw track
if (trackPts.size() >= 2) {
Line trackLn = new Line(null,
@ -1581,7 +1591,7 @@ public class DisplayElementFactory {
TextJustification.LEFT_JUSTIFY,
tcmFcst.getQuarters()[0].getLocation(), 0.0,
/* TTR 895 TextRotation.NORTH_RELATIVE, */
TextRotation.SCREEN_RELATIVE, txt, FontStyle.REGULAR,
TextRotation.SCREEN_RELATIVE, txt, FontStyle.BOLD,
getDisplayColor(Color.YELLOW), 4, 0, false,
DisplayType.NORMAL, "Text", "General Text");
@ -1592,8 +1602,8 @@ public class DisplayElementFactory {
}
/**
* Returns the TCM symbol according to the wind speed. Hurricane >= 64 knots
* TS >= 50 knots TD >= 32 knots Lx < 32 knots
* Returns the TCM symbol according to the wind speed. Hurricane >= 64
* knots, TS >= 34 knots, TD < 34 knots
*
* @param tcmFcst
* @return
@ -1604,13 +1614,19 @@ public class DisplayElementFactory {
int maxWind = 0;
for (ITcmWindQuarter qtr : quarters) {
double[] radius = qtr.getQuarters();
for (double r : radius) {
if (r > 0) {
if (qtr.getWindSpeed() > maxWind)
maxWind = qtr.getWindSpeed();
break;
if (tcmFcst instanceof TcmFcst) {
maxWind = ((TcmFcst) tcmFcst).getWindMax();
}
if (maxWind == 0) {
for (ITcmWindQuarter qtr : quarters) {
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";
else
ret = "HURRICANE_SH";
} else if (maxWind >= 50) {
} else if (maxWind >= 34) {
if (lat > 0)
ret = "TROPICAL_STORM_NH";
else
ret = "TROPICAL_STORM_SH";
} else if (maxWind >= 32) {
ret = "TROPICAL_DEPRESSION";
} else {
ret = "LOW_X_FILLED";
ret = "TROPICAL_DEPRESSION";
// } else {
// ret = "LOW_X_FILLED";
}
return ret;
@ -1648,13 +1664,58 @@ public class DisplayElementFactory {
ITcmWindQuarter quatros, PaintProperties paintProps) {
ArrayList<IDisplayable> slist = new ArrayList<IDisplayable>();
Coordinate center = quatros.getLocation();
Color color = Color.GREEN;
switch (quatros.getWindSpeed()) {
case 0:
color = Color.GREEN;
break;
case 32:
color = Color.BLUE;
Arc quatro1 = new Arc(null, color, (float) 1.5, 1.0, false, false,
0, null, "Circle", center,
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;
case 50:
color = Color.YELLOW;
@ -1664,10 +1725,10 @@ public class DisplayElementFactory {
break;
}
Coordinate center = quatros.getLocation();
Arc quatro1 = new Arc(null, color, (float) 1.5, 1.0, false, false, 0,
null, "Circle", center, 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);
@ -1704,6 +1765,121 @@ public class DisplayElementFactory {
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
*

View file

@ -60,7 +60,7 @@ public class TcmFcst extends SinglePointElement implements ITcmFcst{
this.fcstHr = fcstHr;
this.setLocation(loc);
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[2] = new TcmWindQuarters( loc, 64, quatros[0][2], quatros[1][2], quatros[2][2], quatros[3][2]);

View file

@ -6,32 +6,31 @@ import java.util.Date;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.exception.VizException;
/**
*
* Model grid attribute sets must allow for a GDATTIM parameter that allows users to control
* the default timeline tic mark pre-selection in terms of forecast hours.
* Typical use cases would be for precipitation (omit the first forecast hour F00), or when
* the desk only performs analyses at F06, F12, F18 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:
*
* LIST: GDATTIM=F1;F2;F3; ... ;Fn (forecast hours separated by semicolons,
* RANGE: GDATTIM=F1-F2[-INCR] (forecast hour range with an increment)
* ALL: GDATTIM=FALL (all forecast hours)
*
* Examples:
* GDATTIM=F06;F12;F18;F24
* GDATTIM=F06-F24-6 (same as above)
* GDATTIM=F12-F48-12
*
*
* Model grid attribute sets must allow for a GDATTIM parameter that allows
* users to control the default timeline tic mark pre-selection in terms of
* forecast hours. Typical use cases would be for precipitation (omit the first
* forecast hour F00), or when the desk only performs analyses at F06, F12, F18
* 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:
*
* LIST: GDATTIM=F1;F2;F3; ... ;Fn (forecast hours separated by semicolons,
* RANGE: GDATTIM=F1-F2[-INCR] (forecast hour range with an increment) ALL:
* GDATTIM=FALL (all forecast hours)
*
* Examples: GDATTIM=F06;F12;F18;F24 GDATTIM=F06-F24-6 (same as above)
* GDATTIM=F12-F48-12
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- --------------- --------------------------
* 11/28/11 #518 Greg Hull created
* 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>
*
@ -41,120 +40,127 @@ import com.raytheon.uf.viz.core.exception.VizException;
public class SelectableFrameTimeMatcher {
private boolean matchAll = false;
private final Integer MAX_FCST_HR = 384;
private ArrayList<DataTime> selectableTimes = new ArrayList<DataTime>();
private boolean matchAll = false;
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;
private final Integer MAX_FCST_HR = 384;
if( startEndIncrStrs.length > 2 ) {
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 ));
private ArrayList<DataTime> selectableTimes = new ArrayList<DataTime>();
}
}
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;
}
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;
}
// for grid analysis GDATTIM in format "ALLFxx" or "FIRSTFxx-LASTFxx"
if (timeMatchStr.toUpperCase().contains("ALLF")
|| (timeMatchStr.toUpperCase().contains("FIRSTF") && timeMatchStr
.toUpperCase().contains("LASTF"))) {
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) {
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;
}
}

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -21,7 +21,7 @@
<Position>LR</Position>
<Color red="205" green="133" blue="0"/>
</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>
<Color red="0" green="255" blue="255"/>
</PlotModelElement>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<predefinedArea areaName="Africa" mapCenter="38.00 3.0 0.0">
<zoomLevel>.22</zoomLevel>
<predefinedArea areaName="Africa" mapCenter="18.00 3.0 0.0">
<zoomLevel>.36</zoomLevel>
<gridGeometry envelopeMaxY="1.3E7" envelopeMinY="-1.3E7" envelopeMaxX="2.0E7" envelopeMinX="-2.0E7" rangeY="0 9999" rangeX="0 15384">
<CRS>PROJCS["Mercator_1SP",
GEOGCS["WGS84",
@ -14,7 +14,7 @@
PARAMETER["semi_major", 6371200.0],
PARAMETER["semi_minor", 6371200.0],
PARAMETER["latitude_of_origin", 0.0],
PARAMETER["central_meridian", -180.0],
PARAMETER["central_meridian", 0.0],
PARAMETER["scale_factor", 1.0],
PARAMETER["false_easting", 0.0],
PARAMETER["false_northing", 0.0],

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -10,6 +10,7 @@ color=RGB {155, 155, 155}
<rscImplementation>SVRL</rscImplementation>
<subTypeGenerator></subTypeGenerator>
<rscTypeGenerator></rscTypeGenerator>
<timeMatchMethod>EVENT</timeMatchMethod>
<frameSpan>10</frameSpan>
<timelineGenMethod>USE_FRAME_INTERVAL</timelineGenMethod>
<dfltFrameCount>37</dfltFrameCount>

View file

@ -10,6 +10,7 @@ color=RGB {155, 155, 155}
<rscImplementation>Warn</rscImplementation>
<subTypeGenerator></subTypeGenerator>
<rscTypeGenerator></rscTypeGenerator>
<timeMatchMethod>EVENT</timeMatchMethod>
<frameSpan>10</frameSpan>
<timelineGenMethod>USE_FRAME_INTERVAL</timelineGenMethod>
<dfltFrameCount>37</dfltFrameCount>

View file

@ -13,6 +13,7 @@ legendName=WATCH
<rscImplementation>WATCH</rscImplementation>
<subTypeGenerator></subTypeGenerator>
<rscTypeGenerator></rscTypeGenerator>
<timeMatchMethod>EVENT</timeMatchMethod>
<frameSpan>10</frameSpan>
<timelineGenMethod>USE_FRAME_INTERVAL</timelineGenMethod>
<dfltFrameCount>37</dfltFrameCount>

View file

@ -10,6 +10,7 @@ color=RGB {155, 155, 155}
<rscImplementation>WCN</rscImplementation>
<subTypeGenerator></subTypeGenerator>
<rscTypeGenerator></rscTypeGenerator>
<timeMatchMethod>EVENT</timeMatchMethod>
<frameSpan>10</frameSpan>
<timelineGenMethod>USE_FRAME_INTERVAL</timelineGenMethod>
<dfltFrameCount>37</dfltFrameCount>

View file

@ -10,6 +10,7 @@ color=RGB {0, 100, 255}
<rscImplementation>WCP</rscImplementation>
<subTypeGenerator></subTypeGenerator>
<rscTypeGenerator></rscTypeGenerator>
<timeMatchMethod>EVENT</timeMatchMethod>
<frameSpan>10</frameSpan>
<timelineGenMethod>USE_FRAME_INTERVAL</timelineGenMethod>
<dfltFrameCount>37</dfltFrameCount>

View file

@ -10,6 +10,7 @@ color=RGB {155, 155, 155}
<rscImplementation>WOU</rscImplementation>
<subTypeGenerator></subTypeGenerator>
<rscTypeGenerator></rscTypeGenerator>
<timeMatchMethod>EVENT</timeMatchMethod>
<frameSpan>10</frameSpan>
<timelineGenMethod>USE_FRAME_INTERVAL</timelineGenMethod>
<dfltFrameCount>37</dfltFrameCount>

View file

@ -11,6 +11,7 @@ legendColor=RGB {255, 255, 255}
<rscImplementation>WSTM</rscImplementation>
<subTypeGenerator></subTypeGenerator>
<rscTypeGenerator></rscTypeGenerator>
<timeMatchMethod>EVENT</timeMatchMethod>
<frameSpan>30</frameSpan>
<timelineGenMethod>USE_FRAME_INTERVAL</timelineGenMethod>
<dfltFrameCount>25</dfltFrameCount>

View file

@ -95,6 +95,9 @@
<ResourceDefinitionFilter isEnabled="true" rscDefnName="SHIP">
<filters>Observed</filters>
</ResourceDefinitionFilter>
<ResourceDefinitionFilter isEnabled="true" rscDefnName="SHIP6HR">
<filters>Observed</filters>
</ResourceDefinitionFilter>
<!-- PGEN Display Resources -->
<ResourceDefinitionFilter isEnabled="true" rscDefnName="CCFP">
<filters>CCFP</filters>
@ -913,7 +916,13 @@
<filters>Forecast,Ensemble,SBN</filters>
</ResourceDefinitionFilter>
<ResourceDefinitionFilter isEnabled="true" rscDefnName="ECMWF_NH">
</ResourceDefinitionFilter>
<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 isEnabled="true" rscDefnName="RAP40">
<filters>Forecast,Regional,SBN</filters>
@ -936,6 +945,9 @@
<ResourceDefinitionFilter isEnabled="true" rscDefnName="GFS">
<filters>Forecast,Global</filters>
</ResourceDefinitionFilter>
<ResourceDefinitionFilter isEnabled="true" rscDefnName="GFS0P5">
<filters>Forecast,Global</filters>
</ResourceDefinitionFilter>
<ResourceDefinitionFilter isEnabled="true" rscDefnName="UKENS_NA">
<filters>Forecast,Ensemble</filters>
</ResourceDefinitionFilter>
@ -1344,10 +1356,10 @@
<ResourceDefinitionFilter isEnabled="false" rscDefnName="METEOSAT8">
<filters>McIdas,METEOSAT</filters>
</ResourceDefinitionFilter>
<ResourceDefinitionFilter isEnabled="true" rscDefnName="METEOSAT9">
<ResourceDefinitionFilter isEnabled="false" rscDefnName="METEOSAT9">
<filters>Standard,McIdas,METEOSAT</filters>
</ResourceDefinitionFilter>
<ResourceDefinitionFilter isEnabled="false" rscDefnName="METEOSAT10">
<ResourceDefinitionFilter isEnabled="true" rscDefnName="METEOSAT10">
<filters>McIdas,METEOSAT</filters>
</ResourceDefinitionFilter>
<ResourceDefinitionFilter isEnabled="true" rscDefnName="GINI_GOES11">

View file

@ -13,7 +13,7 @@ legendColor=RGB {0, 255, 0}
<subTypeGenerator></subTypeGenerator>
<rscTypeGenerator></rscTypeGenerator>
<timeMatchMethod>CLOSEST_BEFORE_OR_AFTER</timeMatchMethod>
<frameSpan>360</frameSpan>
<frameSpan>60</frameSpan>
<timelineGenMethod>USE_FRAME_INTERVAL</timelineGenMethod>
<dfltFrameCount>10</dfltFrameCount>
<dfltTimeRange>48</dfltTimeRange>

View file

@ -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

View file

@ -1,4 +1,5 @@
! Parameters and Attributes for the default UAIR Resource
plotModel=@PlotModels/sfcobs/ship_standard.xml
plotDensity=12
conditionalFilter=
conditionalFilter=
reportType=1003

View file

@ -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>

View file

@ -0,0 +1,5 @@
! Parameters and Attributes for the default UAIR Resource
plotModel=@PlotModels/sfcobs/ship_standard.xml
plotDensity=12
conditionalFilter=
reportType=1003

View file

@ -1,5 +1,5 @@
! Parameters and Attributes for the default UAIR Resource
levelKey=700
plotModel=@PlotModels/ncuair/standard.xml
plotDensity=10
plotDensity=30
conditionalFilter=

View file

@ -13,9 +13,9 @@ legendColor=RGB {0, 255, 0}
<subTypeGenerator></subTypeGenerator>
<rscTypeGenerator></rscTypeGenerator>
<timeMatchMethod>CLOSEST_BEFORE_OR_AFTER</timeMatchMethod>
<frameSpan>720</frameSpan>
<frameSpan>180</frameSpan>
<timelineGenMethod>USE_FRAME_INTERVAL</timelineGenMethod>
<dfltFrameCount>4</dfltFrameCount>
<dfltTimeRange>48</dfltTimeRange>
<dfltGeogArea>BasicWX_US</dfltGeogArea>
</ResourceDefinition>
</ResourceDefinition>

View file

@ -1,5 +1,5 @@
! Parameters and Attributes for the default UAIR Resource
levelKey=500
plotModel=@PlotModels/ncuair/standard.xml
plotDensity=10
plotDensity=30
conditionalFilter=

View file

@ -1,5 +1,5 @@
! Parameters and Attributes for the default UAIR Resource
levelKey=500
plotModel=@PlotModels/ncuair/standard.xml
plotDensity=10
plotDensity=30
conditionalFilter=

View file

@ -86,6 +86,7 @@ import com.raytheon.uf.common.time.DataTime;
* 06/19/12 #657 Greg Hull removeSpinnerListeners() before setting the
* spinner maxvalues.
* 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>
*
@ -304,7 +305,28 @@ public class TimelineControl extends Composite {
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) {
for (int i = 0; i < dom_rsc_combo.getItemCount(); i++) {

View file

@ -1,7 +1,5 @@
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.manager.ResourceName;
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.layout.GridData;
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.Composite;
import org.eclipse.swt.widgets.Dialog;
@ -22,7 +17,7 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
/**
* an interface to edit resource attributes
* an interface to edit resource attributes
*
*
* <pre>
@ -45,105 +40,107 @@ import org.eclipse.swt.widgets.Shell;
* @version 1
*/
public abstract class AbstractEditResourceAttrsDialog extends Dialog {
public abstract class AbstractEditResourceAttrsDialog extends Dialog {
protected Shell shell;
protected String dlgTitle = null;
protected INatlCntrsResourceData rscData;
protected ResourceAttrSet editedRscAttrSet = null;
protected boolean hasApplyBtn=false;
protected boolean ok=false;
public AbstractEditResourceAttrsDialog( Shell parentShell,
INatlCntrsResourceData r, Boolean apply ) {
protected boolean hasApplyBtn = false;
protected boolean ok = false;
public AbstractEditResourceAttrsDialog(Shell parentShell, INatlCntrsResourceData r, Boolean apply) {
super(parentShell);
rscData = r;
ResourceName rscName = rscData.getResourceName();
ResourceName rscName = rscData.getResourceName();
this.dlgTitle = "Edit " + rscName.toString() + " Attributes";
hasApplyBtn = apply;
// editedRscAttrSet = new ResourceAttrSet( rscData.getRscAttrSet().getRscAttrSetName() );
// editedRscAttrSet = new ResourceAttrSet(
// rscData.getRscAttrSet().getRscAttrSetName() );
}
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
public abstract Composite createDialog(Composite topComp);
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() );
// 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);
mainLayout.marginHeight = 1;
mainLayout.marginWidth = 1;
shell.setLayout(mainLayout);
Composite topComp = new Composite(shell, SWT.NONE);
topComp.setLayout(new GridLayout());
GridData gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.grabExcessVerticalSpace = true;
gd.horizontalAlignment = SWT.FILL;
gd.verticalAlignment = SWT.FILL;
topComp.setLayoutData( gd );
Composite editComp = createDialog( topComp );
Label sep = new Label( shell, SWT.SEPARATOR | SWT.HORIZONTAL );
topComp.setLayoutData(gd);
Composite editComp = createDialog(topComp);
Label sep = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
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.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.CENTER;
okCanComp.setLayoutData( gd );
okCanComp.setLayout( new GridLayout( (hasApplyBtn ? 3 : 2), true) );
Button canBtn = new Button( okCanComp, SWT.PUSH );
okCanComp.setLayoutData(gd);
okCanComp.setLayout(new GridLayout((hasApplyBtn ? 3 : 2), true));
Button canBtn = new Button(okCanComp, SWT.PUSH);
canBtn.setText(" Cancel ");
canBtn.addSelectionListener( new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
ok=false;
shell.dispose();
}
});
canBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
ok = false;
shell.dispose();
}
});
if( hasApplyBtn ) {
Button applyBtn = new Button( okCanComp, SWT.PUSH );
applyBtn.setText(" Apply ");
if (hasApplyBtn) {
Button applyBtn = new Button(okCanComp, SWT.PUSH);
applyBtn.setText(" Apply ");
applyBtn.addSelectionListener( new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
rscData.setRscAttrSet( editedRscAttrSet );
rscData.setIsEdited( true );
NcDisplayMngr.getActiveNatlCntrsEditor().refresh();
}
});
applyBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
rscData.setRscAttrSet(editedRscAttrSet);
rscData.setIsEdited(true);
NcDisplayMngr.getActiveNatlCntrsEditor().refresh();
}
});
}
Button okBtn = new Button( okCanComp, SWT.PUSH );
Button okBtn = new Button(okCanComp, SWT.PUSH);
okBtn.setText(" OK ");
okBtn.addSelectionListener( new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
ok=true;
// get the
shell.dispose();
}
});
okBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
ok = true;
// get the
shell.dispose();
}
});
}
public boolean isOpen() {
@ -151,36 +148,36 @@ public abstract class AbstractEditResourceAttrsDialog extends Dialog {
}
public Object open() {
Display display = getParent().getDisplay();
// copy the attrSet
editedRscAttrSet = new ResourceAttrSet( rscData.getRscAttrSet() );
Display display = getParent().getDisplay();
// copy the attrSet
editedRscAttrSet = new ResourceAttrSet(rscData.getRscAttrSet());
createShell();
initWidgets();
shell.pack();
shell.open();
while( !shell.isDisposed() ) {
if( !display.readAndDispatch() ) {
display.sleep();
}
}
// Uses Java Bean utils to set the attributes on the resource
if( ok ) {
rscData.setRscAttrSet( editedRscAttrSet );
rscData.setIsEdited( true );
}
dispose();
return null;
}
shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
// Uses Java Bean utils to set the attributes on the resource
if (ok) {
rscData.setRscAttrSet(editedRscAttrSet);
rscData.setIsEdited(true);
}
dispose();
return null;
}
// allow to override
protected void dispose() {
}
protected void dispose() {
}
}

View file

@ -56,6 +56,7 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties;
* 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
* or size of selectableDataTimes.
* 07/11/14 TTR1032 J. Wu No timeline needed if no data times available.
*
* </pre>
*
@ -267,8 +268,8 @@ public class NCTimeMatcher extends AbstractTimeMatcher implements
}
public boolean isAutoUpdateable() {
return (dominantRscData == null ? false :
dominantRscData.isAutoUpdateable());
return (dominantRscData == null ? false : dominantRscData
.isAutoUpdateable());
}
// set the dominant resource
@ -308,8 +309,8 @@ public class NCTimeMatcher extends AbstractTimeMatcher implements
dfltFrameTimesStr = dominantRscData.getDfltFrameTimes();
// if (isForecast) {
if( dominantRscData.getResourceName().getCycleTime() != null ) {
// if (isForecast) {
if (dominantRscData.getResourceName().getCycleTime() != null) {
refTime = null;
} else {
setCurrentRefTime();
@ -318,17 +319,15 @@ public class NCTimeMatcher extends AbstractTimeMatcher implements
TimelineGenMethod tLineGenMthd = dominantRscData.getTimelineGenMethod();
// the frameInterval here is only used to generate the timeline.
if( tLineGenMthd == TimelineGenMethod.USE_DATA_TIMES ||
tLineGenMthd == TimelineGenMethod.USE_CYCLE_TIME_FCST_HOURS) {
if (tLineGenMthd == TimelineGenMethod.USE_DATA_TIMES
|| tLineGenMthd == TimelineGenMethod.USE_CYCLE_TIME_FCST_HOURS) {
frameInterval = -1;
}
else if( tLineGenMthd == TimelineGenMethod.USE_MANUAL_TIMELINE) {
} else if (tLineGenMthd == TimelineGenMethod.USE_MANUAL_TIMELINE) {
if (frameInterval <= 0) {
frameInterval = 60; // what to use here as a default
}
}
else if( tLineGenMthd == TimelineGenMethod.USE_FRAME_INTERVAL ||
tLineGenMthd == TimelineGenMethod.USE_FCST_FRAME_INTERVAL_FROM_REF_TIME ) {
} else if (tLineGenMthd == TimelineGenMethod.USE_FRAME_INTERVAL
|| tLineGenMthd == TimelineGenMethod.USE_FCST_FRAME_INTERVAL_FROM_REF_TIME) {
frameInterval = dominantRscData.getFrameSpan();
} else { // ???
return;
@ -361,30 +360,50 @@ public class NCTimeMatcher extends AbstractTimeMatcher implements
// if (isForecast) {
// check cycleTime instead of isForecast since some resources may
// be forecast w/o a cycletime
if( dominantResourceName.getCycleTime() != null ) {
if (dominantResourceName.getCycleTime() != null) {
if (!dominantResourceName.isLatestCycleTime()) {
DataTime cyclTime = dominantResourceName.getCycleTime();
refTimeMillisecs = (cyclTime == null ? 0 : cyclTime
.getRefTime().getTime());
}
}
else if( isCurrentRefTime() ) {
} else if (isCurrentRefTime()) {
refTimeMillisecs = Calendar.getInstance().getTimeInMillis();
}
else if( isLatestRefTime() ) {
} else if (isLatestRefTime()) {
refTimeMillisecs = 0;
}
else {
} else {
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 using the data to generate the timeline, or
// if we need to get the cycle time for a forecast resource, then
// we will need to query the times of the dominant resource.
if (refTimeMillisecs == 0 || frameInterval == -1) {
allAvailDataTimes = dominantRscData.getAvailableDataTimes();
// allAvailDataTimes = dominantRscData.getAvailableDataTimes();
if (allAvailDataTimes == null) { // no data
allAvailDataTimes = new ArrayList<DataTime>(); //
@ -436,17 +455,19 @@ public class NCTimeMatcher extends AbstractTimeMatcher implements
long frameTimeMillisecs = refTimeMillisecs;
if (isForecast) {
while (frameTimeMillisecs <= refTimeMillisecs + timeRangeMillisecs) {
DataTime time = new DataTime( new Date( frameTimeMillisecs));
while (frameTimeMillisecs <= refTimeMillisecs
+ timeRangeMillisecs) {
DataTime time = new DataTime(new Date(frameTimeMillisecs));
selectableDataTimes.add(time);
frameTimeMillisecs += frameIntervalMillisecs;
}
} else {
while (frameTimeMillisecs >= refTimeMillisecs - timeRangeMillisecs) {
while (frameTimeMillisecs >= refTimeMillisecs
- timeRangeMillisecs) {
DataTime normRefTime = getNormalizedTime( new DataTime(
DataTime normRefTime = getNormalizedTime(new DataTime(
new Date(frameTimeMillisecs)));
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
// list of available times in the DB
if( dfltFrameTimesStr != null ) {
if (dfltFrameTimesStr != null) {
try {
frmTimeMatcher = new SelectableFrameTimeMatcher( dfltFrameTimesStr );
frmTimeMatcher = new SelectableFrameTimeMatcher(
dfltFrameTimesStr);
for( DataTime dt : allAvailDataTimes ) {
if( frmTimeMatcher.matchTime( dt ) ) {
frameTimes.add( dt );
for (DataTime dt : allAvailDataTimes) {
if (frmTimeMatcher.matchTime(dt)) {
frameTimes.add(dt);
}
}
} catch (VizException e) {
// sanity check since this should already be validated
System.out.println("bad GDATTIM string:"+dfltFrameTimesStr);
System.out.println("bad GDATTIM string:" + dfltFrameTimesStr);
frmTimeMatcher = null;
return false;
}
}
else {
} else {
int skipCount = 0;
// set the initial frameTimes from the skip value and numFrames
for (skipCount = 0; skipCount < selectableDataTimes.size(); skipCount++) {
if (skipCount % (skipValue + 1) == 0) {
if (skipCount % (skipValue + 1) == 0) {
DataTime selectableTime = ( isForecast ?
selectableDataTimes.get( skipCount ) :
selectableDataTimes.get(
selectableDataTimes.size()-skipCount-1) );
DataTime selectableTime = (isForecast ? selectableDataTimes
.get(skipCount) : selectableDataTimes
.get(selectableDataTimes.size() - skipCount - 1));
if( frmTimeMatcher == null ||
frmTimeMatcher.matchTime( selectableTime ) ) {
if (frmTimeMatcher == null
|| frmTimeMatcher.matchTime(selectableTime)) {
if (isForecast) {
frameTimes.add( selectableTime );
frameTimes.add(selectableTime);
} 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) {
// in somecases the dataTime from the data can have a level set which
// 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);
@ -551,7 +571,7 @@ public class NCTimeMatcher extends AbstractTimeMatcher implements
// possible if no updates are received for a complete frame.
// (TODO : is this what we want or should we only update to the
// given data?)
while( (nextFrameTimeMs + (frameInterval * 1000 * 60)) < newFrameTime
while ((nextFrameTimeMs + (frameInterval * 1000 * 60)) < newFrameTime
.getValidTime().getTime().getTime()) {
nextFrameTimeMs += frameInterval * 1000 * 60;
newFrameTimes.add(new DataTime(new Date(nextFrameTimeMs)));

View file

@ -603,12 +603,12 @@ implements INatlCntrsResource, IStationField {
DataTime startTime = new DataTime( svrlData.eventTime.getValidPeriod().getStart() );
DataTime endTime = new DataTime( svrlData.eventTime.getValidPeriod().getEnd() );
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);
}
for (int j=enabledText.size(); j<2; j++)
enabledText.add("");
for (int j=enabledText.size(); j<2; j++){
enabledText.add("");}
text = enabledText.toArray(text);
@ -757,10 +757,11 @@ implements INatlCntrsResource, IStationField {
}
}
if(gw.size() == 0)
continue;
else
if(gw.size() == 0) {
continue;}
else{
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);
if (result != null)
outlineShape = result.outlineShape;
else
return;
if (result != null) {
outlineShape = result.outlineShape;}
else {
return;}
if (outlineShape != null && outlineShape.isDrawable()){

View file

@ -381,7 +381,7 @@ public class WarnResource extends AbstractNatlCntrsResource< WarnResourceData, N
DataTime startTime = new DataTime( warnData.eventTime.getValidPeriod().getStart() );
DataTime endTime = new DataTime( warnData.eventTime.getValidPeriod().getEnd() );
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);
}
@ -876,4 +876,4 @@ public class WarnResource extends AbstractNatlCntrsResource< WarnResourceData, N
}
return legendString + " "+ NmapCommon.getTimeStringFromDataTime( fd.getFrameTime(), "/");
}
}
}

View file

@ -571,7 +571,7 @@ implements INatlCntrsResource, IStationField {
DataTime startTime = new DataTime( wcnData.eventTime.getValidPeriod().getStart() );
DataTime endTime = new DataTime( wcnData.eventTime.getValidPeriod().getEnd() );
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);
}
@ -728,7 +728,7 @@ implements INatlCntrsResource, IStationField {
DataTime startTime = new DataTime( wcnData.eventTime.getValidPeriod().getStart() );
DataTime endTime = new DataTime( wcnData.eventTime.getValidPeriod().getEnd() );
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);
}

View file

@ -922,7 +922,7 @@ implements INatlCntrsResource, IStationField {
DataTime startTime = new DataTime( wData.eventTime.getValidPeriod().getStart() );
DataTime endTime = new DataTime( wData.eventTime.getValidPeriod().getEnd() );
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);
}
@ -1007,7 +1007,7 @@ implements INatlCntrsResource, IStationField {
startTime = new DataTime( wData.eventTime.getValidPeriod().getStart() );
endTime = new DataTime( wData.eventTime.getValidPeriod().getEnd() );
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)) {
timeList.add(temp);
@ -1132,7 +1132,7 @@ implements INatlCntrsResource, IStationField {
startTime = new DataTime( wData.eventTime.getValidPeriod().getStart() );
endTime = new DataTime( wData.eventTime.getValidPeriod().getEnd() );
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)) {
timeList.add(temp);

View file

@ -1,42 +1,36 @@
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.attributes.AbstractEditResourceAttrsDialog;
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.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>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 29 May 2009 #115 Greg Hull Initial Creation.
* 30 Nov 2009 Greg Hull migrate to to11d6
* 21 Mar 2010 #259 Greg Hull add colorbar editor
* 27 Apr 2010 #245 Greg Hull Added Apply Button
* 29 May 2009 #115 Greg Hull Initial Creation.
* 30 Nov 2009 Greg Hull migrate to to11d6
* 21 Mar 2010 #259 Greg Hull add colorbar editor
* 27 Apr 2010 #245 Greg Hull Added Apply Button
* 01 Jul 2014 TTR 1018 Steve Russell Updated call to ColorBarEditor
*
* </pre>
*
@ -44,119 +38,119 @@ import gov.noaa.nws.ncep.viz.common.ui.color.ColorMatrixSelector;
* @version 1
*/
public class EditFFGAttrsDialog extends AbstractEditResourceAttrsDialog {
public class EditFFGAttrsDialog extends AbstractEditResourceAttrsDialog {
public EditFFGAttrsDialog(Shell parentShell, INatlCntrsResourceData r, Boolean apply) {
super(parentShell, r, apply);
// TODO Auto-generated constructor stub
}
super(parentShell, r, apply);
// TODO Auto-generated constructor stub
}
private RscAttrValue dispValsAttr = null;
private RscAttrValue colorBarAttr = null;
private Label symbolLbl = null;
private Combo symbolCombo = 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?");
return 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?");
return null;
}
if( colorBarAttr == null || colorBarAttr.getAttrClass() != ColorBar.class ) {
System.out.println("colorBar is null or not of expected class ColorBar?");
return null;
if (colorBarAttr == null || colorBarAttr.getAttrClass() != ColorBar.class) {
System.out.println("colorBar is null or not of expected class ColorBar?");
return null;
}
FormLayout layout0 = new FormLayout();
topComp.setLayout(layout0);
final Combo showAsCombo = new Combo( topComp, SWT.READ_ONLY | SWT.DROP_DOWN );
FormData fd = new FormData();
fd.left = new FormAttachment( 20, 0 );
fd.top = new FormAttachment( 0, 20 );
showAsCombo.setLayoutData( fd );
showAsCombo.setItems( new String[] { "Values", "Symbols" } );
showAsCombo.select( ((Boolean)dispValsAttr.getAttrValue()).booleanValue() ? 0 : 1 );
showAsCombo.addSelectionListener( new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
boolean dispVals = (showAsCombo.getSelectionIndex() == 0 ? true : false );
dispValsAttr.setAttrValue( new Boolean( dispVals) );
dispVals = false; // symobl selection not implemented
symbolCombo.setEnabled( dispVals );
symbolLbl.setEnabled( dispVals );
}
final Combo showAsCombo = new Combo(topComp, SWT.READ_ONLY | SWT.DROP_DOWN);
FormData fd = new FormData();
fd.left = new FormAttachment(20, 0);
fd.top = new FormAttachment(0, 20);
showAsCombo.setLayoutData(fd);
showAsCombo.setItems(new String[] { "Values", "Symbols" });
showAsCombo.select(((Boolean) dispValsAttr.getAttrValue()).booleanValue() ? 0 : 1);
showAsCombo.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
boolean dispVals = (showAsCombo.getSelectionIndex() == 0 ? true : false);
dispValsAttr.setAttrValue(new Boolean(dispVals));
dispVals = false; // symobl selection not implemented
symbolCombo.setEnabled(dispVals);
symbolLbl.setEnabled(dispVals);
}
});
Label showAsLbl = new Label( topComp, SWT.None );
fd = new FormData();
fd.right = new FormAttachment( showAsCombo, -5, SWT.LEFT );
fd.top = new FormAttachment( showAsCombo, 2, SWT.TOP );
showAsLbl.setLayoutData( fd );
showAsLbl.setText( "Show As" );
Label showAsLbl = new Label(topComp, SWT.None);
fd = new FormData();
fd.right = new FormAttachment(showAsCombo, -5, SWT.LEFT);
fd.top = new FormAttachment(showAsCombo, 2, SWT.TOP);
showAsLbl.setLayoutData(fd);
showAsLbl.setText("Show As");
symbolCombo = new Combo( topComp, SWT.READ_ONLY | SWT.DROP_DOWN );
fd = new FormData();
fd.left = new FormAttachment( 50, 0 );
fd.top = new FormAttachment( showAsCombo, 0, SWT.TOP );
symbolCombo.setLayoutData( fd );
symbolCombo = new Combo(topComp, SWT.READ_ONLY | SWT.DROP_DOWN);
fd = new FormData();
fd.left = new FormAttachment(50, 0);
fd.top = new FormAttachment(showAsCombo, 0, SWT.TOP);
symbolCombo.setLayoutData(fd);
// Symbol Selection is not Implemented
symbolCombo.add("N/A");
symbolCombo.select(0);
symbolCombo.setEnabled(false);
symbolLbl = new Label( topComp, SWT.None );
fd = new FormData();
fd.right = new FormAttachment( symbolCombo, -5, SWT.LEFT );
fd.top = new FormAttachment( symbolCombo, 2, SWT.TOP );
symbolLbl.setLayoutData( fd );
symbolLbl.setText( "Symbol" );
symbolLbl = new Label(topComp, SWT.None);
fd = new FormData();
fd.right = new FormAttachment(symbolCombo, -5, SWT.LEFT);
fd.top = new FormAttachment(symbolCombo, 2, SWT.TOP);
symbolLbl.setLayoutData(fd);
symbolLbl.setText("Symbol");
symbolLbl.setEnabled(false);
Group colorBarGrp = new Group( topComp, SWT.NONE );
Group colorBarGrp = new Group(topComp, SWT.NONE);
colorBarGrp.setText("Edit Color Bar");
fd = new FormData();//400,300);
fd.left = new FormAttachment( 0, 15 );
fd.right = new FormAttachment( 100, -15 );
fd.top = new FormAttachment( showAsCombo, 15, SWT.BOTTOM );
fd.bottom = new FormAttachment( 100, -20 );
colorBarGrp.setLayoutData( fd );
colorBarGrp.setLayout( new FormLayout() );
fd = new FormData();//400,300);
fd.left = new FormAttachment(0, 15);
fd.right = new FormAttachment(100, -15);
fd.top = new FormAttachment(showAsCombo, 15, SWT.BOTTOM);
fd.bottom = new FormAttachment(100, -20);
colorBarGrp.setLayoutData(fd);
colorBarGrp.setLayout(new FormLayout());
ColorBar editedColorBar = null;
editedColorBar = (ColorBar)colorBarAttr.getAttrValue();
editedColorBar = (ColorBar) colorBarAttr.getAttrValue();
colorBarEditor = new ColorBarEditor(colorBarGrp, editedColorBar, true);
colorBarEditor = new ColorBarEditor( colorBarGrp, editedColorBar );
return topComp;
}
@Override
public void initWidgets() {
// done in createDialog
}
// allow to override
@Override
protected void dispose() {
super.dispose();
colorBarEditor.dispose();
}
}
@Override
public void initWidgets() {
// done in createDialog
}
// allow to override
@Override
protected void dispose() {
super.dispose();
colorBarEditor.dispose();
}
}

View file

@ -22,18 +22,17 @@ import java.util.List;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.time.DataTime;
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.PaintProperties;
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;
/**
* HrcnResource - Display Tropical Cyclone data
*
* This code has been developed by the SIB for use in the AWIPS2 system.
*
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
@ -41,423 +40,538 @@ import com.vividsolutions.jts.geom.Coordinate;
* 04 Oct 2011 466 B. Hebbard Initial creation.
* 05/23/12 785 Q. Zhou Added getName for legend.
* 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>
*
* @author bhebbard
* @author bhebbard
* @version 1.0
*/
public class HrcnResource extends AbstractNatlCntrsResource<HrcnResourceData, NCMapDescriptor>
implements INatlCntrsResource {
private HrcnResourceData hrcnResourceData;
public class HrcnResource extends
AbstractNatlCntrsResource<HrcnResourceData, NCMapDescriptor> implements
INatlCntrsResource {
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 {
protected HashMap<String, Tcm> getTcmNameToDrawableElementMap() {
return tcmNameToDrawableElementMap;
}
protected HashMap<String, Tcm> getTcmNameToDrawableElementMap() {
return tcmNameToDrawableElementMap;
}
protected void setTcmNameToDrawableElementMap(
HashMap<String, Tcm> tcmNameToDrawableElementMap) {
this.tcmNameToDrawableElementMap = tcmNameToDrawableElementMap;
}
private HashMap<String, Tcm> tcmNameToDrawableElementMap;
private HashMap<String, Tcm> tcmNameToDrawableElementMap;
private HashMap<String, List<TcmRecord>> datamap = new HashMap<String, List<TcmRecord>>();;
public FrameData(DataTime frameTime, int timeInt) {
super( frameTime, timeInt );
tcmNameToDrawableElementMap = new HashMap<String,Tcm>();
}
public FrameData(DataTime frameTime, int timeInt) {
super(frameTime, timeInt);
tcmNameToDrawableElementMap = new HashMap<String, Tcm>();
}
public boolean updateFrameData(IRscDataObject rscDataObj) {
// Sanity I
if( !(rscDataObj instanceof DfltRecordRscDataObj) ) {
System.out.println("Hrcn.updateFrameData expecting DfltRecordRscDataObj "
+ " instead of: " + rscDataObj.getClass().getName() );
return false;
}
PluginDataObject pdo = ((DfltRecordRscDataObj)rscDataObj).getPDO();
// Sanity I
if (!(rscDataObj instanceof DfltRecordRscDataObj)) {
System.out
.println("Hrcn.updateFrameData expecting DfltRecordRscDataObj "
+ " instead of: "
+ rscDataObj.getClass().getName());
return false;
}
// Sanity II
if( pdo == null ) {
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 "
+ " instead of: " + pdo.getClass().getName() );
return false;
}
TcmRecord tr = (TcmRecord) pdo;
Tcm tcm = buildTcmDrawableElement(tr);
tcmNameToDrawableElementMap.put(tr.getStormName(), tcm);
return true;
PluginDataObject pdo = ((DfltRecordRscDataObj) rscDataObj).getPDO();
// Sanity II
if (pdo == null) {
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 "
+ " instead of: " + pdo.getClass().getName());
return false;
}
TcmRecord tr = (TcmRecord) pdo;
if (datamap.keySet().contains(tr.getBasin() + tr.getStormNumber())) {
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.
*
* @throws VizException
*/
public HrcnResource(HrcnResourceData resourceData,
LoadProperties loadProperties) throws VizException {
super(resourceData, loadProperties);
hrcnResourceData = (HrcnResourceData) resourceData ;
LoadProperties loadProperties) throws VizException {
super(resourceData, loadProperties);
hrcnResourceData = (HrcnResourceData) resourceData;
}
protected AbstractFrameData createNewFrame( DataTime frameTime, int timeInt ) {
return (AbstractFrameData) new FrameData( frameTime, timeInt );
protected AbstractFrameData createNewFrame(DataTime frameTime, int timeInt) {
return (AbstractFrameData) new FrameData(frameTime, timeInt);
}
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
font = target.initializeFont("Monospace", 14, new IFont.Style[] { IFont.Style.BOLD });
double screenToWorldRatio = paintProps.getCanvasBounds().width
/ paintProps.getView().getExtent().getWidth();
Rectangle2D charSize = target.getStringBounds(font, "N");
double charHeight = charSize.getHeight();
double offsetY = charHeight / screenToWorldRatio;
if( paintProps == null ) {
return;
}
FrameData currFrameData = (FrameData) frameData;
// Allocate font and calculate vertical offset parameter for lines of
// text
font = target.initializeFont("Monospace", 14,
new IFont.Style[] { IFont.Style.BOLD });
double screenToWorldRatio = paintProps.getCanvasBounds().width
/ paintProps.getView().getExtent().getWidth();
Rectangle2D charSize = target.getStringBounds(font, "N");
double charHeight = charSize.getHeight();
double offsetY = charHeight / screenToWorldRatio;
if (paintProps == null) {
return;
}
if (currFrameData != null) {
// 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.
// For each storm that has a TCM issued as of the frame time...
DisplayElementFactory df = new DisplayElementFactory(target, getNcMapDescriptor());
ArrayList<IDisplayable> displayEls = df.createDisplayElements(tcm, paintProps);
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};
for (Tcm tcm : currFrameData.getTcmNameToDrawableElementMap()
.values()) {
// Loop through the (preprocessed) convective SIGMET data records
// (This should be fast.)
Collection<HrcnRscDataObj> hrcnDataValues = currFrameData.hrcnDataMap.values();
for (HrcnRscDataObj hrcnData : hrcnDataValues) {
// ...display TCM PGEN object for all forecast hours.
// Check for invalid time range
// TODO: See if this is still needed/valid...
// if (activeFrameTime.compareTo(hrcnData.startTime) < 0 ||
// activeFrameTime.compareTo(hrcnData.endTime) >= 0) continue;
// Just some 'safety' defaults
boolean enable = false;
RGB color = new RGB (155, 155, 155);
int lineWidth = 2;
boolean sequenceIdEnable = true;
// Are we moving? (Decoder uses negative numbers to say no.)
boolean inMotion = (hrcnData.direction >= 0) && (hrcnData.speed > 0);
for (int hour = 0; hour <= 2; hour++) {
switch (hrcnData.classType) {
case AREA:
case LINE:
case ISOL: // these (may) have motion; set hourly parameters
enable = enables[hour] && (hour == 0 || inMotion);
color = colors[hour];
lineWidth = lineWidths[hour];
sequenceIdEnable = sequenceIdEnables[hour];
break;
case OUTLOOK: // no motion; draw only zero hour (if enabled)
enable = (hour == 0) && hrcnResourceData.getOutlookEnable();
color = hrcnResourceData.getOutlookColor();
lineWidth = hrcnResourceData.getOutlookLineWidth();
sequenceIdEnable = true; // cannot disable sequence ID for outlooks unless outlooks disabled altogether
break;
case CS: // nil convective SIGMET
enable = false;
break;
case UNKNOWN: //TODO: Sanity check error! Unrecognized class type.
enable = false;
break;
default:
}
if (enable) {
PixelCoordinate prevLoc = null;
PixelCoordinate topLocation = null; // text placed above (screen, not necessarily north) this won't interfere with the geometry
double longitudeAtTopLocation = 0.0;
for (int i=0; i<hrcnData.numPoints; i++) {
LatLonPoint currentPoint = hrcnData.points[i];
if (currentPoint == null) continue; // gracefully skip over omitted points (say, location lookup failure)
if (hour > 0) {
// extrapolate position in future
double headingRadians = Math.toRadians((double) (360 - (hrcnData.direction + 180) % 360)); // TO instead of FROM; CCW instead of CW);
double distanceRadians = hour * hrcnData.speed * ONE_NM_RADIANS;
currentPoint = currentPoint.positionOf(headingRadians, distanceRadians);
}
double[] latLon = { currentPoint.getLongitude(LatLonPoint.INDEGREES),
currentPoint.getLatitude(LatLonPoint.INDEGREES) };
PixelCoordinate currLoc = new PixelCoordinate(descriptor.worldToPixel(latLon));
if (prevLoc != null) { // skip first location
// draw line/polygon segment
target.drawLine(prevLoc.getX(), prevLoc.getY(), prevLoc.getZ(),
currLoc.getX(), currLoc.getY(), currLoc.getZ(), color, lineWidth);
}
else if (hrcnData.numPoints == 1) { //TODO: Check for classType ISOL instead or in addition?
// single point; draw marker and circle
double delta = offsetY * 0.3; // tune to match NMAP
target.drawLine(currLoc.getX()-delta, currLoc.getY(), currLoc.getZ(),
currLoc.getX()+delta, currLoc.getY(), currLoc.getZ(), color, lineWidth);
target.drawLine(currLoc.getX(), currLoc.getY()-delta, currLoc.getZ(),
currLoc.getX(), currLoc.getY()+delta, currLoc.getZ(), color, lineWidth);
double radius = hrcnData.distance / 2.0;
target.drawCircle(currLoc.getX(), currLoc.getY(), currLoc.getZ(), radius, color, lineWidth);
topLocation = new PixelCoordinate(currLoc.getX(), currLoc.getY()-radius); // circle top
}
if (topLocation == null || topLocation.getY() > currLoc.getY()) {
topLocation = currLoc;
longitudeAtTopLocation = latLon[0];
}
prevLoc = currLoc;
}
// Draw labels
if (topLocation != null) {
// Use an ArrayList since we don't know in advance how big it'll be and would like
List<String> labelList = new ArrayList<String>();
HorizontalAlignment horizontalAlignment = HorizontalAlignment.LEFT;
if (sequenceIdEnable) {
if (hrcnData.classType == ClassType.OUTLOOK) {
// Prevent label overlap when West & Central OR Central & East outlook
// polygons have coincident top points, by flipping some text to left
String outlookLabel = hrcnData.sequenceID + " OUTLOOK";
if (hrcnData.sequenceID.endsWith("C") && longitudeAtTopLocation > -095.0 || //TODO: Tune longitude boundary?
hrcnData.sequenceID.endsWith("W") && longitudeAtTopLocation > -112.0 ) { //TODO: Tune longitude boundary?
horizontalAlignment = HorizontalAlignment.RIGHT;
outlookLabel += " ";
}
labelList.add(outlookLabel);
}
else {
labelList.add(hrcnData.sequenceID);
}
}
if (hour == 0 && hrcnData.classType != ClassType.OUTLOOK) {
if (hrcnResourceData.timeEnable) {
String endTimeS = hrcnData.endTime.toString();
labelList.add(endTimeS.substring(8, 10) + "/" // date
+ endTimeS.substring(11, 13) // hour
+ endTimeS.substring(14, 16)); // minute
}
if (hrcnResourceData.flightLevelEnable) {
labelList.add("FL" + hrcnData.flightLevel);
}
if (hrcnResourceData.motionEnable && inMotion) {
labelList.add(String.format("%03d", // leading zeroes for direction
hrcnData.direction) + " " +
hrcnData.speed + "kt");
}
if (hrcnResourceData.intensityEnable && hrcnData.intensity != null &&
!hrcnData.intensity.isEmpty()) {
labelList.add(hrcnData.intensity);
}
}
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 = null;
DisplayElementFactory df = new DisplayElementFactory(target,
getNcMapDescriptor());
ArrayList<IDisplayable> displayEls = df.createDisplayElements(
tcm, paintProps);
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};
*
*
*
*
* // 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 // TODO: See if this is still
* needed/valid... // if
* (activeFrameTime.compareTo(hrcnData.startTime) < 0 || //
* activeFrameTime.compareTo(hrcnData.endTime) >= 0) continue;
*
* // Just some 'safety' defaults boolean enable = false; RGB color
* = new RGB (155, 155, 155); int lineWidth = 2; boolean
* sequenceIdEnable = true;
*
* // Are we moving? (Decoder uses negative numbers to say no.)
* boolean inMotion = (hrcnData.direction >= 0) && (hrcnData.speed >
* 0);
*
* for (int hour = 0; hour <= 2; hour++) { switch
* (hrcnData.classType) { case AREA: case LINE: case ISOL: // these
* (may) have motion; set hourly parameters enable = enables[hour]
* && (hour == 0 || inMotion); color = colors[hour]; lineWidth =
* lineWidths[hour]; sequenceIdEnable = sequenceIdEnables[hour];
* break; case OUTLOOK: // no motion; draw only zero hour (if
* enabled) enable = (hour == 0) &&
* hrcnResourceData.getOutlookEnable(); color =
* hrcnResourceData.getOutlookColor(); lineWidth =
* hrcnResourceData.getOutlookLineWidth(); sequenceIdEnable = true;
* // cannot disable sequence ID for outlooks unless outlooks
* disabled altogether break; case CS: // nil convective SIGMET
* enable = false; break; case UNKNOWN: //TODO: Sanity check error!
* Unrecognized class type. enable = false; break; default: } if
* (enable) { PixelCoordinate prevLoc = null; PixelCoordinate
* topLocation = null; // text placed above (screen, not necessarily
* north) this won't interfere with the geometry double
* longitudeAtTopLocation = 0.0; for (int i=0; i<hrcnData.numPoints;
* i++) { LatLonPoint currentPoint = hrcnData.points[i]; if
* (currentPoint == null) continue; // gracefully skip over omitted
* points (say, location lookup failure) if (hour > 0) { //
* extrapolate position in future double headingRadians =
* Math.toRadians((double) (360 - (hrcnData.direction + 180) %
* 360)); // TO instead of FROM; CCW instead of CW); double
* distanceRadians = hour * hrcnData.speed * ONE_NM_RADIANS;
* currentPoint = currentPoint.positionOf(headingRadians,
* distanceRadians); } double[] latLon = {
* currentPoint.getLongitude(LatLonPoint.INDEGREES),
* currentPoint.getLatitude(LatLonPoint.INDEGREES) };
* PixelCoordinate currLoc = new
* PixelCoordinate(descriptor.worldToPixel(latLon)); if (prevLoc !=
* null) { // skip first location // draw line/polygon segment
* target.drawLine(prevLoc.getX(), prevLoc.getY(), prevLoc.getZ(),
* currLoc.getX(), currLoc.getY(), currLoc.getZ(), color,
* lineWidth); } else if (hrcnData.numPoints == 1) { //TODO: Check
* for classType ISOL instead or in addition? // single point; draw
* marker and circle double delta = offsetY * 0.3; // tune to match
* NMAP target.drawLine(currLoc.getX()-delta, currLoc.getY(),
* currLoc.getZ(), currLoc.getX()+delta, currLoc.getY(),
* currLoc.getZ(), color, lineWidth);
* target.drawLine(currLoc.getX(), currLoc.getY()-delta,
* currLoc.getZ(), currLoc.getX(), currLoc.getY()+delta,
* currLoc.getZ(), color, lineWidth); double radius =
* hrcnData.distance / 2.0; target.drawCircle(currLoc.getX(),
* currLoc.getY(), currLoc.getZ(), radius, color, lineWidth);
* topLocation = new PixelCoordinate(currLoc.getX(),
* currLoc.getY()-radius); // circle top } if (topLocation == null
* || topLocation.getY() > currLoc.getY()) { topLocation = currLoc;
* longitudeAtTopLocation = latLon[0]; } prevLoc = currLoc; }
*
* // Draw labels
*
* if (topLocation != null) {
*
* // Use an ArrayList since we don't know in advance how big it'll
* be and would like List<String> labelList = new
* ArrayList<String>();
*
* HorizontalAlignment horizontalAlignment =
* HorizontalAlignment.LEFT;
*
* if (sequenceIdEnable) { if (hrcnData.classType ==
* ClassType.OUTLOOK) { // Prevent label overlap when West & Central
* OR Central & East outlook // polygons have coincident top points,
* by flipping some text to left String outlookLabel =
* hrcnData.sequenceID + " OUTLOOK"; if
* (hrcnData.sequenceID.endsWith("C") && longitudeAtTopLocation >
* -095.0 || //TODO: Tune longitude boundary?
* hrcnData.sequenceID.endsWith("W") && longitudeAtTopLocation >
* -112.0 ) { //TODO: Tune longitude boundary? horizontalAlignment =
* HorizontalAlignment.RIGHT; outlookLabel += " "; }
* labelList.add(outlookLabel); } else {
* labelList.add(hrcnData.sequenceID); } }
*
* if (hour == 0 && hrcnData.classType != ClassType.OUTLOOK) { if
* (hrcnResourceData.timeEnable) { String endTimeS =
* hrcnData.endTime.toString(); labelList.add(endTimeS.substring(8,
* 10) + "/" // date + endTimeS.substring(11, 13) // hour +
* endTimeS.substring(14, 16)); // minute }
*
* if (hrcnResourceData.flightLevelEnable) { labelList.add("FL" +
* hrcnData.flightLevel); }
*
* if (hrcnResourceData.motionEnable && inMotion) {
* labelList.add(String.format("%03d", // leading zeroes for
* direction hrcnData.direction) + " " + hrcnData.speed + "kt"); }
*
* if (hrcnResourceData.intensityEnable && hrcnData.intensity !=
* null && !hrcnData.intensity.isEmpty()) {
* labelList.add(hrcnData.intensity); } }
*
* 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 = null;
}
private Tcm buildTcmDrawableElement(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()) {
TcmFcst tf = buildTcmFcstDrawableElement(tpw);
ltf.add(tf);
}
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 buildTcmDrawableElement(TcmRecord tr, boolean obsOnly) {
// 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("F00"))
continue;
TcmFcst tf = buildTcmFcstDrawableElement(tpw);
ltf.add(tf);
// add 12 feet wave
if (tpw.getFcstHour().equalsIgnoreCase("OBS")) {
TcmWindQuarters wave = new TcmWindQuarters(new Coordinate(
tpw.getClon(), tpw.getClat()), 0,
toDouble(tr.getNe12ft()), toDouble(tr.getSe12ft()),
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) {
// Generate a single TcmFcst (DrawableElement) to represent a given
// TcmPositionWinds -- both correspond to one forecast hour.
TcmFcst tf = new TcmFcst (
new Coordinate(tpw.getClon(), tpw.getClat()),
toInt(tpw.getFcstHour().replace("F","")), //TODO: Check replace/replaceAll/replaceFirst, etc...
buildQuatros(tpw));
tf.setGust(tpw.getGust());
tf.setWindMax(tpw.getWindMax());
tf.setDirection(tpw.getStormDrct());
tf.setSpeed(tpw.getStormSped());
return tf;
// Generate a single TcmFcst (DrawableElement) to represent a given
// TcmPositionWinds -- both correspond to one forecast hour.
TcmFcst tf = new TcmFcst(new Coordinate(tpw.getClon(), tpw.getClat()),
toInt(tpw.getFcstHour().replace("F", "")), // TODO: Check
// replace/replaceAll/replaceFirst,
// etc...
buildQuatros(tpw));
tf.setGust(tpw.getGust());
tf.setWindMax(tpw.getWindMax());
tf.setDirection(tpw.getStormDrct());
tf.setSpeed(tpw.getStormSped());
tf.setEndtime(tpw.getValidTime());
return tf;
}
private double[][] buildQuatros(TcmPositionWinds tpw) {
// Generate "quatros" arrays, given a TcmPositionWinds.
// These are needed to feed to the constructor for TcmFcst
// (the only way to get them in there!)
final double[][] quatros = {
{ toDouble(tpw.getNe34k()), toDouble(tpw.getNe50k()), toDouble(tpw.getNe64k()) },
{ toDouble(tpw.getSe34k()), toDouble(tpw.getSe50k()), toDouble(tpw.getSe64k()) },
{ toDouble(tpw.getSw34k()), toDouble(tpw.getSw50k()), toDouble(tpw.getSw64k()) },
{ toDouble(tpw.getNw34k()), toDouble(tpw.getNw50k()), toDouble(tpw.getNw64k()) }
};
return quatros;
// Generate "quatros" arrays, given a TcmPositionWinds.
// These are needed to feed to the constructor for TcmFcst
// (the only way to get them in there!)
final double[][] quatros = {
{ toDouble(tpw.getNe34k()), toDouble(tpw.getNe50k()),
toDouble(tpw.getNe64k()) },
{ toDouble(tpw.getSe34k()), toDouble(tpw.getSe50k()),
toDouble(tpw.getSe64k()) },
{ toDouble(tpw.getSw34k()), toDouble(tpw.getSw50k()),
toDouble(tpw.getSw64k()) },
{ toDouble(tpw.getNw34k()), toDouble(tpw.getNw50k()),
toDouble(tpw.getNw64k()) } };
return quatros;
}
// A couple of utility conversion routines, needed because there are cases
// where we need numbers where the decoder hands us strings.
// TODO: Consider doing this in decoder.
// TODO: Are there public utilities to do this with graceful exception handling?
// A couple of utility conversion routines, needed because there are cases
// where we need numbers where the decoder hands us strings.
// TODO: Consider doing this in decoder.
// TODO: Are there public utilities to do this with graceful exception
// handling?
double toDouble(String s) {
Double d;
try {
d = Double.parseDouble(s);
}
catch (NullPointerException e) {
//TODO: Handle this more gracefully
d = 0.0;
}
catch (NumberFormatException e) {
//TODO: Log as bogus decoder output
d = 0.0;
}
return d;
Double d;
try {
d = Double.parseDouble(s);
} catch (NullPointerException e) {
// TODO: Handle this more gracefully
d = 0.0;
} catch (NumberFormatException e) {
// TODO: Log as bogus decoder output
d = 0.0;
}
return d;
}
int toInt(String s) {
int i;
try {
i = Integer.parseInt(s);
}
catch (NullPointerException e) {
//TODO: Handle this more gracefully
i = 0;
}
catch (NumberFormatException e) {
//TODO: Log as bogus decoder output
i = 0;
}
return i;
}
@Override
public void disposeInternal() {
super.disposeInternal();
// if( font != null ) {
// font.dispose();
// }
int i;
try {
i = Integer.parseInt(s);
} catch (NullPointerException e) {
// TODO: Handle this more gracefully
i = 0;
} catch (NumberFormatException e) {
// TODO: Log as bogus decoder output
i = 0;
}
return i;
}
@Override
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(), "/");
}
}

View file

@ -1,24 +1,19 @@
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.attributes.AbstractEditResourceAttrsDialog;
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.misc.IMiscResourceData.EditElement;
import gov.noaa.nws.ncep.viz.ui.display.ColorBar;
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.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;
@ -27,16 +22,17 @@ import org.eclipse.swt.widgets.Slider;
import org.eclipse.swt.widgets.Text;
/**
* An interface to edit Lightning resource attributes.
* An interface to edit Lightning resource attributes.
*
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 04/10/2010 #257 Greg Hull Initial Creation.
* 04/11/2010 #259 Greg Hull Added ColorBar
* 04/27/2010 #245 Greg Hull Added Apply Button
* 04/10/2010 #257 Greg Hull Initial Creation.
* 04/11/2010 #259 Greg Hull Added ColorBar
* 04/27/2010 #245 Greg Hull Added Apply Button
* 07/01/2014 TTR 1018 Steve Russell Updated call to ColorBarEditor
*
* </pre>
*
@ -44,330 +40,317 @@ import org.eclipse.swt.widgets.Text;
* @version 1
*/
public class EditLightningAttrsDialog extends AbstractEditResourceAttrsDialog {
public EditLightningAttrsDialog(Shell parentShell, INatlCntrsResourceData r, Boolean apply) {
super(parentShell, r, apply);
// TODO Auto-generated constructor stub
}
public class EditLightningAttrsDialog extends AbstractEditResourceAttrsDialog {
private Button enablePosStrikesBtn = null;
private Button enableNegStrikesBtn = null;
public EditLightningAttrsDialog(Shell parentShell, INatlCntrsResourceData r, Boolean apply) {
super(parentShell, r, apply);
// TODO Auto-generated constructor stub
}
private Button enablePosStrikesBtn = null;
private Button enableNegStrikesBtn = null;
private RscAttrValue colorByIntensityAttr = null;
private RscAttrValue enablePosStrikesAttr = null;
private RscAttrValue enableNegStrikesAttr = null;
private RscAttrValue posSymbolSizeAttr = null;
private RscAttrValue negSymbolSizeAttr = null;
private RscAttrValue colorBarAttr = null;
private ColorBar editedColorBar = null;
private Group posStrikesGrp = null;
private Group negStrikesGrp = null;
private Group posStrikesGrp = null;
private Group negStrikesGrp = null;
private Composite lineWidComp1 = null;
private Composite lineWidComp2 = null;
private Label lwLbl1 = null;
private Label lwLbl2 = null;
private ColorBarEditor colorBarEditor = null;
//
@Override
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" );
@Override
public Composite createDialog(Composite topComp) {
if( colorByIntensityAttr == null ||
colorByIntensityAttr.getAttrClass() != Boolean.class ) {
System.out.println("colorByIntensity is null or not of expected class Boolean?");
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.getAttrClass() != Boolean.class) {
System.out.println("colorByIntensity is null or not of expected class Boolean?");
}
if( enablePosStrikesAttr == null ||
enablePosStrikesAttr.getAttrClass() != Boolean.class ) {
System.out.println("enablePositiveStrikes is null or not of expected class Boolean?");
if (enablePosStrikesAttr == null || enablePosStrikesAttr.getAttrClass() != Boolean.class) {
System.out.println("enablePositiveStrikes is null or not of expected class Boolean?");
}
if( enableNegStrikesAttr == null ||
enableNegStrikesAttr.getAttrClass() != Boolean.class ) {
System.out.println("enableNegativeStrikes is null or not of expected class Boolean?");
if (enableNegStrikesAttr == null || enableNegStrikesAttr.getAttrClass() != Boolean.class) {
System.out.println("enableNegativeStrikes is null or not of expected class Boolean?");
}
if( posSymbolSizeAttr == null ||
posSymbolSizeAttr.getAttrClass() != Integer.class ) {
System.out.println("posSymbolSize is null or not of expected class Integer?");
if (posSymbolSizeAttr == null || posSymbolSizeAttr.getAttrClass() != Integer.class) {
System.out.println("posSymbolSize is null or not of expected class Integer?");
}
if( negSymbolSizeAttr == null ||
negSymbolSizeAttr.getAttrClass() != Integer.class ) {
System.out.println("negSymbolSize is null or not of expected class Integer?");
if (negSymbolSizeAttr == null || negSymbolSizeAttr.getAttrClass() != Integer.class) {
System.out.println("negSymbolSize is null or not of expected class Integer?");
}
if( colorBarAttr == null ||
colorBarAttr.getAttrClass() != ColorBar.class ) {
System.out.println("colorBar is null or not of expected class colorBar?");
if (colorBarAttr == null || colorBarAttr.getAttrClass() != ColorBar.class) {
System.out.println("colorBar is null or not of expected class colorBar?");
}
editedColorBar = (ColorBar)colorBarAttr.getAttrValue();
editedColorBar = (ColorBar) colorBarAttr.getAttrValue();
FormLayout layout0 = new FormLayout();
topComp.setLayout(layout0);
posStrikesGrp = new Group( topComp, SWT.SHADOW_NONE );
posStrikesGrp.setText( "Positive Strikes");
posStrikesGrp = new Group(topComp, SWT.SHADOW_NONE);
posStrikesGrp.setText("Positive Strikes");
FormData fd = new FormData();
fd.left = new FormAttachment( 0, 15 );
fd.top = new FormAttachment( 0, 20 );
fd.right = new FormAttachment( 50, -7 );
posStrikesGrp.setLayoutData( fd );
posStrikesGrp.setLayout( new GridLayout(2,false) );
enablePosStrikesBtn = new Button( posStrikesGrp, SWT.CHECK );
enablePosStrikesBtn.setText( "Enable " );
fd.left = new FormAttachment(0, 15);
fd.top = new FormAttachment(0, 20);
fd.right = new FormAttachment(50, -7);
posStrikesGrp.setLayoutData(fd);
posStrikesGrp.setLayout(new GridLayout(2, false));
// fd = new FormData();
// fd.left = new FormAttachment( 0, 20 );
// fd.top = new FormAttachment( colbarLbl, 30, SWT.BOTTOM );
// enablePosStrikesBtn.setLayoutData( fd );
enablePosStrikesBtn.setSelection( ((Boolean)enablePosStrikesAttr.getAttrValue()).booleanValue() );
enablePosStrikesBtn.addSelectionListener( new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
enablePosStrikesAttr.setAttrValue( new Boolean( enablePosStrikesBtn.getSelection() ) );
lineWidComp1.setEnabled( enablePosStrikesBtn.getSelection() );
lwLbl1.setEnabled( enablePosStrikesBtn.getSelection() );
}
enablePosStrikesBtn = new Button(posStrikesGrp, SWT.CHECK);
enablePosStrikesBtn.setText("Enable ");
// fd = new FormData();
// fd.left = new FormAttachment( 0, 20 );
// fd.top = new FormAttachment( colbarLbl, 30, SWT.BOTTOM );
// enablePosStrikesBtn.setLayoutData( fd );
enablePosStrikesBtn.setSelection(((Boolean) enablePosStrikesAttr.getAttrValue()).booleanValue());
enablePosStrikesBtn.addSelectionListener(new SelectionAdapter() {
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.left = new FormAttachment( posStrikesGrp, 20, SWT.RIGHT );
fd.top = new FormAttachment( posStrikesGrp, 0, SWT.TOP );
fd.right = new FormAttachment( 100, -15 );
fd.left = new FormAttachment(posStrikesGrp, 20, SWT.RIGHT);
fd.top = new FormAttachment(posStrikesGrp, 0, SWT.TOP);
fd.right = new FormAttachment(100, -15);
//fd.right = new FormAttachment( 100, -20 );
negStrikesGrp.setLayoutData( fd );
negStrikesGrp.setLayout( new GridLayout(2,false) );
enableNegStrikesBtn = new Button( negStrikesGrp, SWT.CHECK );
enableNegStrikesBtn.setText( "Enable " );
// fd = new FormData();
// fd.left = new FormAttachment( enablePosStrikesBtn, 0, SWT.LEFT );
// fd.top = new FormAttachment( enablePosStrikesBtn, 10, SWT.BOTTOM );
// enableNegStrikesBtn.setLayoutData( fd );
enableNegStrikesBtn.setAlignment( SWT.RIGHT );
enableNegStrikesBtn.setSelection( ((Boolean)enableNegStrikesAttr.getAttrValue()).booleanValue() );
enableNegStrikesBtn.addSelectionListener( new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
enableNegStrikesAttr.setAttrValue( new Boolean( enableNegStrikesBtn.getSelection() ) );
lineWidComp2.setEnabled( enableNegStrikesBtn.getSelection() );
lwLbl2.setEnabled( enableNegStrikesBtn.getSelection() );
}
negStrikesGrp.setLayoutData(fd);
negStrikesGrp.setLayout(new GridLayout(2, false));
enableNegStrikesBtn = new Button(negStrikesGrp, SWT.CHECK);
enableNegStrikesBtn.setText("Enable ");
// fd = new FormData();
// fd.left = new FormAttachment( enablePosStrikesBtn, 0, SWT.LEFT );
// fd.top = new FormAttachment( enablePosStrikesBtn, 10, SWT.BOTTOM );
// enableNegStrikesBtn.setLayoutData( fd );
enableNegStrikesBtn.setAlignment(SWT.RIGHT);
enableNegStrikesBtn.setSelection(((Boolean) enableNegStrikesAttr.getAttrValue()).booleanValue());
enableNegStrikesBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
enableNegStrikesAttr.setAttrValue(new Boolean(enableNegStrikesBtn.getSelection()));
lineWidComp2.setEnabled(enableNegStrikesBtn.getSelection());
lwLbl2.setEnabled(enableNegStrikesBtn.getSelection());
}
});
lineWidComp1 = new Composite( posStrikesGrp, SWT.NONE );
lineWidComp1.setLayout( new FormLayout() );
// fd = new FormData( );
// fd.top = new FormAttachment( enableNegStrikesBtn, 20, SWT.BOTTOM );
// fd.left = new FormAttachment( enableNegStrikesBtn, 0, SWT.LEFT );
// lineWidComp1.setLayoutData( fd );
lineWidComp1 = new Composite(posStrikesGrp, SWT.NONE);
lineWidComp1.setLayout(new FormLayout());
// 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.setText( "Symbol Size" );
fd = new FormData( );
fd.top = new FormAttachment( 0, 10 );
fd.left = new FormAttachment( 0, 0 );
lwLbl1.setLayoutData( fd );
lwLbl1 = new Label(lineWidComp1, SWT.NONE);
lwLbl1.setText("Symbol Size");
fd = new FormData();
fd.top = new FormAttachment(0, 10);
fd.left = new FormAttachment(0, 0);
lwLbl1.setLayoutData(fd);
final Slider widthSlider1 = new Slider( lineWidComp1, SWT.HORIZONTAL );
widthSlider1.setValues( ((Integer)posSymbolSizeAttr.getAttrValue()).intValue(), 1, 11, 1, 1, 2 );
final Slider widthSlider1 = new Slider(lineWidComp1, SWT.HORIZONTAL);
widthSlider1.setValues(((Integer) posSymbolSizeAttr.getAttrValue()).intValue(), 1, 11, 1, 1, 2);
fd = new FormData();//180,20);
fd.left = new FormAttachment( lwLbl1, 0, SWT.LEFT );
fd.top = new FormAttachment( lwLbl1, 5, SWT.BOTTOM );
widthSlider1.setLayoutData( fd );
fd.left = new FormAttachment(lwLbl1, 0, SWT.LEFT);
fd.top = new FormAttachment(lwLbl1, 5, SWT.BOTTOM);
widthSlider1.setLayoutData(fd);
final Text widthText1 = new Text( lineWidComp1, SWT.BORDER );
widthText1.setText( ((Integer)posSymbolSizeAttr.getAttrValue()).toString() );
fd = new FormData( 20, 20 );
fd.left = new FormAttachment( widthSlider1, 5, SWT.RIGHT );
fd.bottom = new FormAttachment( widthSlider1, 0, SWT.BOTTOM );
fd.right = new FormAttachment( 100, -10 );
widthText1.setLayoutData( fd );
final Text widthText1 = new Text(lineWidComp1, SWT.BORDER);
widthText1.setText(((Integer) posSymbolSizeAttr.getAttrValue()).toString());
fd = new FormData(20, 20);
fd.left = new FormAttachment(widthSlider1, 5, SWT.RIGHT);
fd.bottom = new FormAttachment(widthSlider1, 0, SWT.BOTTOM);
fd.right = new FormAttachment(100, -10);
widthText1.setLayoutData(fd);
widthSlider1.addSelectionListener( new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
posSymbolSizeAttr.setAttrValue( new Integer( widthSlider1.getSelection() ) );
widthText1.setText( Integer.toString( widthSlider1.getSelection() ) );
}
widthSlider1.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
posSymbolSizeAttr.setAttrValue(new Integer(widthSlider1.getSelection()));
widthText1.setText(Integer.toString(widthSlider1.getSelection()));
}
});
widthText1.addSelectionListener( new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
int ival;
try {
ival = Integer.parseInt( widthText1.getText() );
}
catch( NumberFormatException exc ) {
ival = ((Integer)posSymbolSizeAttr.getAttrValue()).intValue();
widthText1.setText( Integer.toString( ival ) );
}
widthText1.addSelectionListener(new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
int ival;
try {
ival = Integer.parseInt(widthText1.getText());
} catch (NumberFormatException exc) {
ival = ((Integer) posSymbolSizeAttr.getAttrValue()).intValue();
widthText1.setText(Integer.toString(ival));
}
if( ival < widthSlider1.getMinimum() ) {
ival = widthSlider1.getMinimum();
widthText1.setText( Integer.toString( ival ) );
}
else if( ival > widthSlider1.getMaximum() ) {
ival = widthSlider1.getMaximum();
widthText1.setText( Integer.toString( ival ) );
}
if (ival < widthSlider1.getMinimum()) {
ival = widthSlider1.getMinimum();
widthText1.setText(Integer.toString(ival));
} else if (ival > widthSlider1.getMaximum()) {
ival = widthSlider1.getMaximum();
widthText1.setText(Integer.toString(ival));
}
widthSlider1.setSelection( ival );
widthSlider1.setSelection(ival);
posSymbolSizeAttr.setAttrValue( new Integer( ival ) );
}
posSymbolSizeAttr.setAttrValue(new Integer(ival));
}
// not called
public void widgetSelected(SelectionEvent e) {
System.out.println("widgetSelected called");
}
// not called
public void widgetSelected(SelectionEvent e) {
System.out.println("widgetSelected called");
}
});
lineWidComp2 = new Composite( negStrikesGrp, SWT.NONE );
lineWidComp2.setLayout( new FormLayout() );
lineWidComp2 = new Composite(negStrikesGrp, SWT.NONE);
lineWidComp2.setLayout(new FormLayout());
// fd = new FormData( );
// fd.top = new FormAttachment( lineWidComp1, 10, SWT.BOTTOM );
// fd.left = new FormAttachment( lineWidComp1, 0, SWT.LEFT );
// lineWidComp2.setLayoutData( fd );
// fd = new FormData( );
// fd.top = new FormAttachment( lineWidComp1, 10, SWT.BOTTOM );
// fd.left = new FormAttachment( lineWidComp1, 0, SWT.LEFT );
// 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 );
lwLbl2.setText( "Symbol Size" );
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 );
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.left = new FormAttachment( lwLbl2, 0, SWT.LEFT );
fd.top = new FormAttachment( lwLbl2, 5, SWT.BOTTOM );
widthSlider2.setLayoutData( fd );
fd.left = new FormAttachment(lwLbl2, 0, SWT.LEFT);
fd.top = new FormAttachment(lwLbl2, 5, SWT.BOTTOM);
widthSlider2.setLayoutData(fd);
final Text widthText2 = new Text( lineWidComp2, SWT.BORDER );
widthText2.setText( ((Integer)negSymbolSizeAttr.getAttrValue()).toString() );
fd = new FormData( 20, 20 );
fd.left = new FormAttachment( widthSlider2, 5, SWT.RIGHT );
fd.bottom = new FormAttachment( widthSlider2, 0, SWT.BOTTOM );
fd.right = new FormAttachment( 100, -10 );
widthText2.setLayoutData( fd );
final Text widthText2 = new Text(lineWidComp2, SWT.BORDER);
widthText2.setText(((Integer) negSymbolSizeAttr.getAttrValue()).toString());
fd = new FormData(20, 20);
fd.left = new FormAttachment(widthSlider2, 5, SWT.RIGHT);
fd.bottom = new FormAttachment(widthSlider2, 0, SWT.BOTTOM);
fd.right = new FormAttachment(100, -10);
widthText2.setLayoutData(fd);
widthSlider2.addSelectionListener( new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
negSymbolSizeAttr.setAttrValue( new Integer( widthSlider2.getSelection() ) );
widthText2.setText( Integer.toString( widthSlider2.getSelection() ) );
}
widthSlider2.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
negSymbolSizeAttr.setAttrValue(new Integer(widthSlider2.getSelection()));
widthText2.setText(Integer.toString(widthSlider2.getSelection()));
}
});
widthText2.addSelectionListener( new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
int ival;
try {
ival = Integer.parseInt( widthText2.getText() );
}
catch( NumberFormatException exc ) {
ival = ((Integer)negSymbolSizeAttr.getAttrValue()).intValue();
widthText2.setText( Integer.toString( ival ) );
}
widthText2.addSelectionListener(new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
int ival;
try {
ival = Integer.parseInt(widthText2.getText());
} catch (NumberFormatException exc) {
ival = ((Integer) negSymbolSizeAttr.getAttrValue()).intValue();
widthText2.setText(Integer.toString(ival));
}
if( ival < widthSlider2.getMinimum() ) {
ival = widthSlider2.getMinimum();
widthText2.setText( Integer.toString( ival ) );
}
else if( ival > widthSlider2.getMaximum() ) {
ival = widthSlider2.getMaximum();
widthText2.setText( Integer.toString( ival ) );
}
if (ival < widthSlider2.getMinimum()) {
ival = widthSlider2.getMinimum();
widthText2.setText(Integer.toString(ival));
} else if (ival > widthSlider2.getMaximum()) {
ival = widthSlider2.getMaximum();
widthText2.setText(Integer.toString(ival));
}
widthSlider2.setSelection( ival );
widthSlider2.setSelection(ival);
negSymbolSizeAttr.setAttrValue( new Integer( ival ) );
}
negSymbolSizeAttr.setAttrValue(new Integer(ival));
}
// not called
public void widgetSelected(SelectionEvent e) {
System.out.println("widgetSelected called");
}
// not called
public void widgetSelected(SelectionEvent e) {
System.out.println("widgetSelected called");
}
});
lineWidComp1.setEnabled( enablePosStrikesBtn.getSelection() );
lineWidComp2.setEnabled( enableNegStrikesBtn.getSelection() );
Group colorBarGrp = new Group( topComp, SWT.NONE );
lineWidComp1.setEnabled(enablePosStrikesBtn.getSelection());
lineWidComp2.setEnabled(enableNegStrikesBtn.getSelection());
Group colorBarGrp = new Group(topComp, SWT.NONE);
colorBarGrp.setText("Edit Color Bar");
fd = new FormData();//400,300);
fd.left = new FormAttachment( 0, 15 );
fd.right = new FormAttachment( 100, -15 );
fd.top = new FormAttachment( posStrikesGrp, 15, SWT.BOTTOM );
fd.bottom = new FormAttachment( 100, -20 );
colorBarGrp.setLayoutData( fd );
colorBarGrp.setLayout( new FormLayout() );
// final Combo colorByCombo = new Combo( colorBarGrp, SWT.DROP_DOWN | SWT.READ_ONLY );
// fd = new FormData();
// fd.left = new FormAttachment( 0, 15 );
// fd.top = new FormAttachment( 0, 35 );
// colorByCombo.setLayoutData( fd );
//
// colorByCombo.add("Time");
// colorByCombo.add("Intensity");
//
// colorByCombo.select( ((Boolean)colorByIntensityAttr.getAttrValue()).booleanValue() ? 1 : 0 );
//
// colorByCombo.addSelectionListener( new SelectionAdapter() {
// public void widgetSelected(SelectionEvent e) {
// colorByIntensityAttr.setAttrValue(
// new Boolean( (colorByCombo.getSelectionIndex() == 0 ? false : true ) ) );
// }
// });
//
// Label colbarLbl = new Label( colorBarGrp, SWT.NONE );
// colbarLbl.setText( "Apply To:" );
// fd = new FormData( );
// fd.left = new FormAttachment( colorByCombo, 0, SWT.LEFT );
// fd.bottom = new FormAttachment( colorByCombo, -3, SWT.TOP );
// colbarLbl.setLayoutData( fd );
colorBarEditor = new ColorBarEditor( colorBarGrp, editedColorBar );
fd = new FormData();//400,300);
fd.left = new FormAttachment(0, 15);
fd.right = new FormAttachment(100, -15);
fd.top = new FormAttachment(posStrikesGrp, 15, SWT.BOTTOM);
fd.bottom = new FormAttachment(100, -20);
colorBarGrp.setLayoutData(fd);
colorBarGrp.setLayout(new FormLayout());
// final Combo colorByCombo = new Combo( colorBarGrp, SWT.DROP_DOWN | SWT.READ_ONLY );
// fd = new FormData();
// fd.left = new FormAttachment( 0, 15 );
// fd.top = new FormAttachment( 0, 35 );
// colorByCombo.setLayoutData( fd );
//
// colorByCombo.add("Time");
// colorByCombo.add("Intensity");
//
// colorByCombo.select( ((Boolean)colorByIntensityAttr.getAttrValue()).booleanValue() ? 1 : 0 );
//
// colorByCombo.addSelectionListener( new SelectionAdapter() {
// public void widgetSelected(SelectionEvent e) {
// colorByIntensityAttr.setAttrValue(
// new Boolean( (colorByCombo.getSelectionIndex() == 0 ? false : true ) ) );
// }
// });
//
// Label colbarLbl = new Label( colorBarGrp, SWT.NONE );
// colbarLbl.setText( "Apply To:" );
// fd = new FormData( );
// fd.left = new FormAttachment( colorByCombo, 0, SWT.LEFT );
// fd.bottom = new FormAttachment( colorByCombo, -3, SWT.TOP );
// colbarLbl.setLayoutData( fd );
colorBarEditor = new ColorBarEditor(colorBarGrp, editedColorBar, true);
return topComp;
}
@Override
public void initWidgets() {
// done in createDialog
}
// allow to override
@Override
protected void dispose() {
super.dispose();
colorBarEditor.dispose();
}
}
@Override
public void initWidgets() {
// done in createDialog
}
// allow to override
@Override
protected void dispose() {
super.dispose();
colorBarEditor.dispose();
}
}

View file

@ -606,22 +606,31 @@ public class ContourSupport {
return env;
}
private static void createContourLabel(IExtent extent,
ContourGroup contourGroup, float contourValue, double[][] valsArr,
IMapDescriptor descriptor) {
private void createContourLabel(IExtent extent, ContourGroup contourGroup,
float contourValue, Coordinate[] llcoords, IMapDescriptor descriptor) {
double minx = extent.getMinX();
double miny = extent.getMinY();
double maxx = extent.getMaxX();
double maxy = extent.getMaxY();
double[][] visiblePts = new double[valsArr.length][valsArr[0].length];
double[][] visiblePts = new double[llcoords.length][2];
int actualLength = 0;
for (double[] dl : valsArr) {
if (dl[0] > minx && dl[0] < maxx && dl[1] > miny && dl[1] < maxy) {
visiblePts[actualLength][0] = dl[0];
visiblePts[actualLength][1] = dl[1];
double[] in = new double[2];
double[] out = new double[2];
for (Coordinate coord : llcoords) {
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++;
}
}
@ -1052,9 +1061,6 @@ public class ContourSupport {
int n = 0;
double[][] screen = null;
double[][] screenx = null;
for (Double cval : contourGroup.cvalues) {
float fval = (float) (cval * 1.0f);
boolean toLabel = false;
@ -1083,22 +1089,13 @@ public class ContourSupport {
for (int i = 0; i < correctedGeom.getNumGeometries(); i++) {
Geometry gn = correctedGeom.getGeometryN(i);
// System.out.println("GEOMETRY " + i + ":");
// System.out.println(gn.toString());
contourGroup.negValueShape.addLineSegment(gn
.getCoordinates());
if (toLabel) {
long tl0 = System.currentTimeMillis();
// prepareLabel(contourGroup, zoom, fval,
// labelPoints, screen);
if (screen != null)
createContourLabel(extent, contourGroup, fval,
screen, descriptor);
if (screenx != null) {
createContourLabel(extent, contourGroup, fval,
screenx, descriptor);
}
createContourLabel(extent, contourGroup, fval,
gn.getCoordinates(), descriptor);
long tl1 = System.currentTimeMillis();
total_labeling_time += (tl1 - tl0);
}
@ -1622,6 +1619,11 @@ public class ContourSupport {
try {
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);
} catch (TransformException e) {
}

View file

@ -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/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
* 06/27/2014 ? B. Yin Handle grid analysis (cycle time is null).
* </pre>
*
* @author mli
@ -1735,15 +1736,16 @@ public class NcgridResource extends
DataTime cycleTime = rscName.getCycleTime();
if (cycleTime == null || rscName.isLatestCycleTime()) { // latest should
// already be
// resolved
// here.
if (rscName.isLatestCycleTime()) { // latest should
// already be
// resolved
// here.
return;
}
List<DataTime> availableTimes = new ArrayList<DataTime>();
if (gridRscData.getPluginName().equalsIgnoreCase(
if ( cycleTime != null && gridRscData.getPluginName().equalsIgnoreCase(
GempakGrid.gempakPluginName)) {
try {
String dataLocation = null;
@ -1848,16 +1850,22 @@ public class NcgridResource extends
DataTime availTime = new DataTime(dt.getRefTime(), dt.getFcstTime());
DataTime refTime = new DataTime(dt.getRefTime());
if (cycleTime.equals(refTime)) {
if (!dataTimes.contains(availTime)) {
dataTimes.add(availTime);
// reuse the same gribRec this is a bit of a hack but hey.
// gribRec.setDataTime(availTime);
// for( IRscDataObject dataObject : processRecord( availTime
// ) ) { // gribRec ) ) {
// newRscDataObjsQueue.add(dataObject);
// }
if (cycleTime != null) {
if (cycleTime.equals(refTime)) {
if (!dataTimes.contains(availTime)) {
dataTimes.add(availTime);
// reuse the same gribRec this is a bit of a hack but
// hey.
// gribRec.setDataTime(availTime);
// for( IRscDataObject dataObject : processRecord(
// availTime
// ) ) { // gribRec ) ) {
// newRscDataObjsQueue.add(dataObject);
// }
}
}
} else { // for grid analysis
dataTimes.add(availTime);
}
}
setDataTimesForDgdriv(dataTimes);

View file

@ -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.resources.AbstractNatlCntrsRequestableResourceData;
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.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
* 08/29/2012 #743 Archana Added CLRBAR
* 09/14/2013 #1036 S. Gurung Added TEXT
*
* 07/02/2014 ? B. Yin Handle grid analysis.
*
* </pre>
*
* @author mli
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
@XmlType(name="NC-NcgridResourceData")
public class NcgridResourceData extends AbstractNatlCntrsRequestableResourceData
implements INatlCntrsResourceData {
@XmlType(name = "NC-NcgridResourceData")
public class NcgridResourceData extends
AbstractNatlCntrsRequestableResourceData implements
INatlCntrsResourceData {
@XmlElement
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
protected String type;
@XmlElement
protected int grdlbl;
@XmlElement
protected String fint;
@XmlElement
protected String fline;
@XmlElement
protected String hilo;
@XmlElement
protected String hlsym;
@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
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() {
super();
}
@Override
@Override
protected AbstractVizResource<?, ?> constructResource(
LoadProperties loadProperties, PluginDataObject[] objects) {
return new NcgridResource(this, loadProperties);
return new NcgridResource(this, loadProperties);
}
@Override
@ -132,7 +142,7 @@ public class NcgridResourceData extends AbstractNatlCntrsRequestableResourceData
}
NcgridResourceData other = (NcgridResourceData) obj;
if (this.resourceName != null && other.resourceName == null) {
return false;
} else if (this.resourceName == null && other.resourceName != null) {
@ -141,25 +151,23 @@ public class NcgridResourceData extends AbstractNatlCntrsRequestableResourceData
&& this.resourceName.equals(other.resourceName) == false) {
return false;
}
if (this.type != null && other.type == null) {
return false;
} else if (this.type == null && other.type != null) {
return false;
} else if (this.type != null
&& this.type.equals(other.type) == false) {
} else if (this.type != null && this.type.equals(other.type) == false) {
return false;
}
if (this.cint != null && other.cint == null) {
return false;
} else if (this.cint == null && other.cint != null) {
return false;
} else if (this.cint != null
&& this.cint.equals(other.cint) == false) {
} else if (this.cint != null && this.cint.equals(other.cint) == false) {
return false;
}
if (this.gdfile != null && other.gdfile == null) {
return false;
} else if (this.gdfile == null && other.gdfile != null) {
@ -168,7 +176,7 @@ public class NcgridResourceData extends AbstractNatlCntrsRequestableResourceData
&& this.gdfile.equals(other.gdfile) == false) {
return false;
}
if (this.gvcord != null && other.gvcord == null) {
return false;
} else if (this.gvcord == null && other.gvcord != null) {
@ -177,7 +185,7 @@ public class NcgridResourceData extends AbstractNatlCntrsRequestableResourceData
&& this.gvcord.equals(other.gvcord) == false) {
return false;
}
if (this.glevel != null && other.glevel == null) {
return false;
} else if (this.glevel == null && other.glevel != null) {
@ -186,7 +194,7 @@ public class NcgridResourceData extends AbstractNatlCntrsRequestableResourceData
&& this.glevel.equals(other.glevel) == false) {
return false;
}
if (this.gdpfun != null && other.gdpfun == null) {
return false;
} else if (this.gdpfun == null && other.gdpfun != null) {
@ -195,16 +203,15 @@ public class NcgridResourceData extends AbstractNatlCntrsRequestableResourceData
&& this.gdpfun.equals(other.gdpfun) == false) {
return false;
}
if (this.skip != null && other.skip == null) {
return false;
} else if (this.skip == null && other.skip != null) {
return false;
} else if (this.skip != null
&& this.skip.equals(other.skip) == false) {
} else if (this.skip != null && this.skip.equals(other.skip) == false) {
return false;
}
if (this.filter != null && other.filter == null) {
return false;
} else if (this.filter == null && other.filter != null) {
@ -213,7 +220,7 @@ public class NcgridResourceData extends AbstractNatlCntrsRequestableResourceData
&& this.filter.equals(other.filter) == false) {
return false;
}
if (this.scale != null && other.scale == null) {
return false;
} else if (this.scale == null && other.scale != null) {
@ -222,7 +229,7 @@ public class NcgridResourceData extends AbstractNatlCntrsRequestableResourceData
&& this.scale.equals(other.scale) == false) {
return false;
}
if (this.title != null && other.title == null) {
return false;
} else if (this.title == null && other.title != null) {
@ -231,7 +238,7 @@ public class NcgridResourceData extends AbstractNatlCntrsRequestableResourceData
&& this.title.equals(other.title) == false) {
return false;
}
if (this.lineAttributes != null && other.lineAttributes == null) {
return false;
} else if (this.lineAttributes == null && other.lineAttributes != null) {
@ -240,7 +247,7 @@ public class NcgridResourceData extends AbstractNatlCntrsRequestableResourceData
&& this.lineAttributes.equals(other.lineAttributes) == false) {
return false;
}
if (this.colors != null && other.colors == null) {
return false;
} else if (this.colors == null && other.colors != null) {
@ -249,7 +256,7 @@ public class NcgridResourceData extends AbstractNatlCntrsRequestableResourceData
&& this.colors.equals(other.colors) == false) {
return false;
}
if (this.marker != null && other.marker == null) {
return false;
} else if (this.marker == null && other.marker != null) {
@ -258,20 +265,19 @@ public class NcgridResourceData extends AbstractNatlCntrsRequestableResourceData
&& this.marker.equals(other.marker) == false) {
return false;
}
if (this.grdlbl != other.grdlbl) {
return false;
}
if (this.fint != null && other.fint == null) {
return false;
} else if (this.fint == null && other.fint != null) {
return false;
} else if (this.fint != null
&& this.fint.equals(other.fint) == false) {
} else if (this.fint != null && this.fint.equals(other.fint) == false) {
return false;
}
if (this.fline != null && other.fline == null) {
return false;
} else if (this.fline == null && other.fline != null) {
@ -280,16 +286,15 @@ public class NcgridResourceData extends AbstractNatlCntrsRequestableResourceData
&& this.fline.equals(other.fline) == false) {
return false;
}
if (this.hilo != null && other.hilo == null) {
return false;
} else if (this.hilo == null && other.hilo != null) {
return false;
} else if (this.hilo != null
&& this.hilo.equals(other.hilo) == false) {
} else if (this.hilo != null && this.hilo.equals(other.hilo) == false) {
return false;
}
if (this.hlsym != null && other.hlsym == null) {
return false;
} else if (this.hlsym == null && other.hlsym != null) {
@ -306,275 +311,425 @@ public class NcgridResourceData extends AbstractNatlCntrsRequestableResourceData
} else if (this.clrbar != null
&& this.clrbar.equals(other.clrbar) == false) {
return false;
}
}
if (this.text != null && other.text == null) {
return false;
} else if (this.text == null && other.text != null) {
return false;
} else if (this.text != null
&& this.text.equals(other.text) == false) {
} else if (this.text != null && this.text.equals(other.text) == false) {
return false;
}
return true;
}
public String getCint() {
return cint;
}
public String getCint() {
return cint;
}
public void setCint(String cint) {
this.cint = cint;
}
public void setCint(String cint) {
this.cint = cint;
}
public String getGdfile() {
return gdfile;
}
public String getGdfile() {
return gdfile;
}
public void setGdfile(String gdfile) {
this.gdfile = gdfile;
}
public void setGdfile(String gdfile) {
this.gdfile = gdfile;
}
public String getGvcord() {
return gvcord;
}
public String getGvcord() {
return gvcord;
}
public void setGvcord(String gvcord) {
this.gvcord = gvcord;
}
public void setGvcord(String gvcord) {
this.gvcord = gvcord;
}
public String getGlevel() {
return glevel;
}
public String getGlevel() {
return glevel;
}
public void setGlevel(String glevel) {
this.glevel = glevel;
}
public void setGlevel(String glevel) {
this.glevel = glevel;
}
public String getGdpfun() {
return gdpfun;
}
public void setGdpfun(String gdpfun) {
this.gdpfun = gdpfun;
}
public String getGdpfun() {
return gdpfun;
}
public String getSkip() {
return skip;
}
public void setGdpfun(String gdpfun) {
this.gdpfun = gdpfun;
}
public void setSkip(String skip) {
this.skip = skip;
}
public String getSkip() {
return skip;
}
public String getFilter() {
return filter;
}
public void setSkip(String skip) {
this.skip = skip;
}
public void setFilter(String filter) {
this.filter = filter;
}
public String getFilter() {
return filter;
}
public String getScale() {
return scale;
}
public void setFilter(String filter) {
this.filter = filter;
}
public void setScale(String scale) {
this.scale = scale;
}
public String getScale() {
return scale;
}
public String getTitle() {
return title;
}
public void setScale(String scale) {
this.scale = scale;
}
public void setTitle(String title) {
this.title = title;
}
public String getTitle() {
return title;
}
public String getType() {
return type;
}
public void setTitle(String title) {
this.title = title;
}
public void setType(String type) {
this.type = type;
}
public String getType() {
return type;
}
/*
* public DisplayType getVectorType() { 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 void setType(String type) {
this.type = type;
}
public String getLineAttributes() {
return lineAttributes;
}
/*
public DisplayType getVectorType() {
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 void setLineAttributes(String lineAttributes) {
this.lineAttributes = lineAttributes;
}
public String getLineAttributes() {
return lineAttributes;
}
public String getColors() {
return colors;
}
public void setLineAttributes(String lineAttributes) {
this.lineAttributes = lineAttributes;
}
public void setColors(String colors) {
this.colors = colors;
}
public String getColors() {
return colors;
}
public String getMarker() {
return marker;
}
public void setColors(String colors) {
this.colors = colors;
}
public void setMarker(String marker) {
this.marker = marker;
}
public String getMarker() {
return marker;
}
public int getGrdlbl() {
return grdlbl;
}
public void setMarker(String marker) {
this.marker = marker;
}
public void setGrdlbl(int grdlbl) {
this.grdlbl = grdlbl;
}
public int getGrdlbl() {
return grdlbl;
}
public String getFint() {
return fint;
}
public void setGrdlbl(int grdlbl) {
this.grdlbl = grdlbl;
}
public void setFint(String fint) {
this.fint = fint;
}
public String getFint() {
return fint;
}
public String getFline() {
return fline;
}
public void setFint(String fint) {
this.fint = fint;
}
public void setFline(String fline) {
this.fline = fline;
}
public String getFline() {
return fline;
}
public String getWind() {
return wind;
}
public void setFline(String fline) {
this.fline = fline;
}
public void setWind(String wind) {
this.wind = wind;
}
public String getWind() {
return wind;
}
public String getHilo() {
return hilo;
}
public void setWind(String wind) {
this.wind = wind;
}
public void setHilo(String hilo) {
this.hilo = hilo;
}
public String getHilo() {
return hilo;
}
public String getHlsym() {
return hlsym;
}
public void setHilo(String hilo) {
this.hilo = hilo;
}
public String getHlsym() {
return hlsym;
}
public void setHlsym(String hlsym) {
this.hlsym = 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
*/
public void setClrbar(String clrbar) {
this.clrbar = clrbar;
}
public String getText() {
return text;
}
/**
* @param clrbar
* the clrbar to set
*/
public void setClrbar(String clrbar) {
this.clrbar = clrbar;
}
public void setText(String text) {
this.text = text;
}
public String getText() {
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
// (This is overridden by the NcEnsembleResourceData
//
// public HashMap<String, RequestConstraint> getMetadataMap() {
// HashMap<String, RequestConstraint> queryList = super.getMetadataMap();
//
// queryList.put("modelInfo.modelName",
// new RequestConstraint( getGdfile(), ConstraintType.EQUALS ) );
//
// return queryList;
// }
//
// public HashMap<String, RequestConstraint> getMetadataMap() {
// HashMap<String, RequestConstraint> queryList = super.getMetadataMap();
//
// queryList.put("modelInfo.modelName",
// new RequestConstraint( getGdfile(), ConstraintType.EQUALS ) );
//
// return queryList;
// }
@Override
public DataTime[] getAvailableTimes() throws VizException {
if ( getPluginName().equalsIgnoreCase( GempakGrid.gempakPluginName )) {
@Override
public DataTime[] getAvailableTimes() throws VizException {
if (getPluginName().equalsIgnoreCase(GempakGrid.gempakPluginName)) {
try {
String currentCycle = getResourceName().getCycleTime()
.toString();
String dataLoc = null;
try {
String currentCycle = getResourceName().getCycleTime().toString();
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];
dataLoc = GempakGrid.getGempakGridPath(getGdfile());
for ( int ii=0; ii<gridAvailableTimes.length; ii++) {
availableTimes[ii] = new DataTime (gridAvailableTimes[ii]);
}
return availableTimes;
} catch (Exception e) {
// TODO Auto-generated catch block
throw new VizException();
} 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++) {
availableTimes[ii] = new DataTime(gridAvailableTimes[ii]);
}
}
else {
DataTime[] availableTimes = super.getAvailableTimes();
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;
}
}
}

View file

@ -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 altered method setUpSymbolMappingTables()
* 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 {
@ -1460,7 +1461,7 @@ public class NcPlotImageCreator {
/*
* Remove the corresponding string that was
* previously rendered at the current plot
* positionfor this station
* position for this station
*/
if (obsoleteStation != null
&& obsoleteStation.stnPlotMap != null) {
@ -1978,7 +1979,14 @@ public class NcPlotImageCreator {
// System.out.print(s.info.stationId + ",");
// }
// 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();
@ -1992,6 +2000,9 @@ public class NcPlotImageCreator {
} else {
// Note: Now dead code (see note above). Left in for
// future analysis and possible reuse in refactoring.
if (hasStationDensityChanged) {
/*
* If the station density is different from the
@ -2101,7 +2112,7 @@ public class NcPlotImageCreator {
}
sm.release();
}
// End of newly-dead code. See note above.
}
}

View file

@ -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)
* 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
* 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>
*
* @author brockwoo
@ -995,6 +1001,13 @@ public class NcPlotResource2 extends
return;
FrameData frameData = (FrameData) fd;
if (frameData.progressiveDisclosureInProgress) {
Tracer.print("Progressive disclosure in progress...aborting paintFrame for "
+ frameData.getShortFrameTime());
return;
}
Semaphore sem = new Semaphore(1);
if (progressiveDisclosure == null) {
progressiveDisclosure = new ProgressiveDisclosure(this, spi);// assumes
@ -1420,6 +1433,19 @@ public class NcPlotResource2 extends
dataRequestor.imageCreator
.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 */
synchronized (newPMEList) {
for (PlotModelElement newPME : newPMEList) {

View file

@ -29,6 +29,7 @@ package gov.noaa.nws.ncep.viz.rsc.plotdata.rsc;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 16, 2013 bhebbard Initial creation
* Jul 07, 2014 bhebbard Assorted updates
*
* </pre>
*
@ -45,14 +46,17 @@ import java.lang.reflect.Method;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.HashSet;
import com.raytheon.uf.common.time.DataTime;
public class Tracer {
// ACTIVATE HERE ------------------v
private static boolean enabled = false;
// save it static to have it available on every call
@ -65,7 +69,7 @@ public class Tracer {
Calendar cal = Calendar.getInstance();
String logFileName = "/export/cdbsrv/bhebbard/pointdatadisplay/"
String logFileName = "" // optional custom directory
+ dateFormat.format(cal.getTime());
private static PrintWriter writer = null;
@ -145,34 +149,35 @@ public class Tracer {
// NcPlotResource2.FrameData.getShortFrameTime(), somehow
@SuppressWarnings("deprecation")
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");
String returnString = Integer.toString(frameDate.getDate()) + "/"
+ df.format(frameDate.getHours() + 4) // TODOhorror!!
+ df.format(frameDate.getMinutes());
String returnString = Integer.toString(date) + "/" + df.format(hours)
+ df.format(minutes);
if (dt.getFcstTime() != 0) {
returnString += "(" + dt.getFcstTime() + ")";
}
return returnString;
}
public static boolean sanityCheckStationSet(
Collection<Station> stationsWithData) {
for (Station s : stationsWithData) {
if (s.info.stationId.equals("KJFK")) {
String timeString = Tracer.shortTimeString(s.info.dataTime);
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!");
}
public static String printableStationList(Collection<Station> stations) {
String returnString = "";
for (Station s : stations) {
if (s != null && s.info != null) {
returnString += s.info.stationId + " ";
}
}
return true;
return returnString;
}
public static String printableStationList(Station[] stations) {
return printableStationList(new HashSet<Station>(
Arrays.asList(stations)));
}
}

View file

@ -1,41 +1,38 @@
package gov.noaa.nws.ncep.viz.rsc.wavesat.rsc;
import org.eclipse.swt.SWT;
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.common.ui.color.ColorButtonSelector;
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.ResourceAttrSet.RscAttrValue;
import gov.noaa.nws.ncep.viz.resources.colorBar.ColorBarEditor;
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>
* SOFTWARE HISTORY
* 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>
*
@ -43,236 +40,235 @@ import gov.noaa.nws.ncep.viz.common.ui.color.ColorMatrixSelector;
* @version 1
*/
public class EditWaveSatAttrsDialog extends AbstractEditResourceAttrsDialog {
public class EditWaveSatAttrsDialog extends AbstractEditResourceAttrsDialog {
public EditWaveSatAttrsDialog(Shell parentShell, INatlCntrsResourceData r, Boolean apply) {
super(parentShell, r, apply);
}
super(parentShell, r, apply);
}
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 ) {
System.out.println("colorBar is null or not of expected class ColorBar?");
return 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) {
System.out.println("colorBar is null or not of expected class ColorBar?");
return null;
}
if( fontNameAttr == null || fontNameAttr.getAttrClass() != String.class ) {
System.out.println("fontName is null or not of expected class String?");
return null;
if (fontNameAttr == null || fontNameAttr.getAttrClass() != String.class) {
System.out.println("fontName is null or not of expected class String?");
return null;
}
if( fontSizeAttr == null || fontSizeAttr.getAttrClass() != Integer.class ) {
System.out.println("fontSize is null or not of expected class Integer?");
return null;
if (fontSizeAttr == null || fontSizeAttr.getAttrClass() != Integer.class) {
System.out.println("fontSize is null or not of expected class Integer?");
return null;
}
if( timeDisplayIntervalAttr == null || timeDisplayIntervalAttr.getAttrClass() != Integer.class ) {
System.out.println("timeDisplayInterval is null or not of expected class Integer?");
return null;
if (timeDisplayIntervalAttr == null || timeDisplayIntervalAttr.getAttrClass() != Integer.class) {
System.out.println("timeDisplayInterval is null or not of expected class Integer?");
return null;
}
if( timeDisplayColorAttr == null || timeDisplayColorAttr.getAttrClass() != RGB.class ) {
System.out.println("timeDisplayColor is null or not of expected class RGB?");
return null;
if (timeDisplayColorAttr == null || timeDisplayColorAttr.getAttrClass() != RGB.class) {
System.out.println("timeDisplayColor is null or not of expected class RGB?");
return null;
}
FormLayout layout0 = new FormLayout();
topComp.setLayout(layout0);
Group selFontGrp = new Group( topComp, SWT.BORDER );
FormData fd = new FormData();
selFontGrp.setText( "Select Font");
selFontGrp.setLayout( new FormLayout() );
Group selFontGrp = new Group(topComp, SWT.BORDER);
FormData fd = new FormData();
selFontGrp.setText("Select Font");
selFontGrp.setLayout(new FormLayout());
fd.width = 300;
fd.left = new FormAttachment( 0, 10 );
// fd.right = new FormAttachment( 35, 0 );
fd.bottom = new FormAttachment( 0, 100 );
fd.top = new FormAttachment( 0, 10 );
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());
// }
fd.left = new FormAttachment(0, 10);
// fd.right = new FormAttachment( 35, 0 );
fd.bottom = new FormAttachment(0, 100);
fd.top = new FormAttachment(0, 10);
selFontGrp.setLayoutData(fd);
final Combo fontNameCombo = new Combo( selFontGrp, SWT.READ_ONLY | SWT.DROP_DOWN );
fd = new FormData();
fd.left = new FormAttachment( 10, 0 );
fd.top = new FormAttachment( 0, 30 );
fontNameCombo.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());
// }
fontNameCombo.setItems( availFonts );
fontNameCombo.setText( ((String)fontNameAttr.getAttrValue()) );
fontNameCombo.addSelectionListener( new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
int selIndx = fontNameCombo.getSelectionIndex();
fontNameAttr.setAttrValue( availFonts[selIndx] );
}
final Combo fontNameCombo = new Combo(selFontGrp, SWT.READ_ONLY | SWT.DROP_DOWN);
fd = new FormData();
fd.left = new FormAttachment(10, 0);
fd.top = new FormAttachment(0, 30);
fontNameCombo.setLayoutData(fd);
fontNameCombo.setItems(availFonts);
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 );
fd = new FormData();
fd.left = new FormAttachment( fontNameCombo, 0, SWT.LEFT );
fd.bottom = new FormAttachment( fontNameCombo, -3, SWT.TOP );
nameLbl.setLayoutData( fd );
nameLbl.setText( "Name" );
// nameLbl.setVisible( false );
Label nameLbl = new Label(selFontGrp, SWT.None);
fd = new FormData();
fd.left = new FormAttachment(fontNameCombo, 0, SWT.LEFT);
fd.bottom = new FormAttachment(fontNameCombo, -3, SWT.TOP);
nameLbl.setLayoutData(fd);
nameLbl.setText("Name");
// nameLbl.setVisible( false );
final Combo fontSizeCombo = new Combo( selFontGrp, SWT.READ_ONLY | SWT.DROP_DOWN );
fd = new FormData();
fd.left = new FormAttachment( fontNameCombo, 20, SWT.RIGHT );
fd.top = new FormAttachment( fontNameCombo, 0, SWT.TOP );
fontSizeCombo.setLayoutData( fd );
final Combo fontSizeCombo = new Combo(selFontGrp, SWT.READ_ONLY | SWT.DROP_DOWN);
fd = new FormData();
fd.left = new FormAttachment(fontNameCombo, 20, SWT.RIGHT);
fd.top = new FormAttachment(fontNameCombo, 0, SWT.TOP);
fontSizeCombo.setLayoutData(fd);
fontSizeCombo.setItems( availFontsSizes );
fontSizeCombo.setItems(availFontsSizes);
fontSizeCombo.select(0);
for( int i=0 ; i<availFontsSizes.length ; i++ ) {
if( Integer.parseInt( availFontsSizes[i] ) ==
(Integer)fontSizeAttr.getAttrValue() ) {
fontSizeCombo.select( i );
break;
}
for (int i = 0; i < availFontsSizes.length; i++) {
if (Integer.parseInt(availFontsSizes[i]) == (Integer) fontSizeAttr.getAttrValue()) {
fontSizeCombo.select(i);
break;
}
}
Label fontSizeLbl = new Label( selFontGrp, SWT.None );
fd = new FormData();
fd.left = new FormAttachment( fontSizeCombo, 0, SWT.LEFT );
fd.bottom = new FormAttachment( fontSizeCombo, -3, SWT.TOP );
fontSizeLbl.setLayoutData( fd );
fontSizeLbl.setText( "Size" );
// fontSizeLbl.setVisible( false );
fontSizeCombo.addSelectionListener( new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
int selIndx = fontSizeCombo.getSelectionIndex();
fontSizeAttr.setAttrValue( Integer.parseInt( availFontsSizes[selIndx] ) );
}
Label fontSizeLbl = new Label(selFontGrp, SWT.None);
fd = new FormData();
fd.left = new FormAttachment(fontSizeCombo, 0, SWT.LEFT);
fd.bottom = new FormAttachment(fontSizeCombo, -3, SWT.TOP);
fontSizeLbl.setLayoutData(fd);
fontSizeLbl.setText("Size");
// fontSizeLbl.setVisible( false );
fontSizeCombo.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
int selIndx = fontSizeCombo.getSelectionIndex();
fontSizeAttr.setAttrValue(Integer.parseInt(availFontsSizes[selIndx]));
}
});
Group selTimeStampGrp = new Group( topComp, SWT.BORDER );
fd = new FormData();
selTimeStampGrp.setText( "Time Stamp");
selTimeStampGrp.setLayout( new FormLayout() );
Group selTimeStampGrp = new Group(topComp, SWT.BORDER);
fd = new FormData();
selTimeStampGrp.setText("Time Stamp");
fd.top = new FormAttachment( selFontGrp, 0, SWT.TOP );
fd.left = new FormAttachment( 50, 10 );
fd.right = new FormAttachment( 100, -10 );
fd.bottom = new FormAttachment( selFontGrp, 0, SWT.BOTTOM );
selTimeStampGrp.setLayoutData( fd );
selTimeStampGrp.setLayout(new FormLayout());
fd.top = new FormAttachment(selFontGrp, 0, SWT.TOP);
fd.left = new FormAttachment(50, 10);
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.
//
timeStampIntCombo.setItems( availTimeIntStrs );
for( int t=0 ; t< availTimeIntMins.length ; t++ ) {
if( availTimeIntMins[t].equals(
(Integer)timeDisplayIntervalAttr.getAttrValue()) ) {
timeStampIntCombo.select( t );
timeStampIntCombo.setItems(availTimeIntStrs);
for (int t = 0; t < availTimeIntMins.length; t++) {
if (availTimeIntMins[t].equals((Integer) timeDisplayIntervalAttr.getAttrValue())) {
timeStampIntCombo.select(t);
break;
}
}
}
timeStampIntCombo.addSelectionListener( new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
int selIndx = timeStampIntCombo.getSelectionIndex();
timeDisplayIntervalAttr.setAttrValue( availTimeIntMins[selIndx] );
}
timeStampIntCombo.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
int selIndx = timeStampIntCombo.getSelectionIndex();
timeDisplayIntervalAttr.setAttrValue(availTimeIntMins[selIndx]);
}
});
Label timeStampIntLbl = new Label( selTimeStampGrp, SWT.None );
fd = new FormData();
fd.left = new FormAttachment( timeStampIntCombo, 0, SWT.LEFT );
fd.bottom = new FormAttachment( timeStampIntCombo, -3, SWT.TOP );
timeStampIntLbl.setLayoutData( fd );
timeStampIntLbl.setText( "Interval" );
// timeStampIntLbl.setVisible( false );
Label timeStampIntLbl = new Label(selTimeStampGrp, SWT.None);
fd = new FormData();
fd.left = new FormAttachment(timeStampIntCombo, 0, SWT.LEFT);
fd.bottom = new FormAttachment(timeStampIntCombo, -3, SWT.TOP);
timeStampIntLbl.setLayoutData(fd);
timeStampIntLbl.setText("Interval");
// timeStampIntLbl.setVisible( false );
Composite selColComp = new Composite( selTimeStampGrp, SWT.NONE );
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() );
}
});
Composite selColComp = new Composite(selTimeStampGrp, SWT.NONE);
fd = new FormData();
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");
fd = new FormData();//400,300);
fd.left = new FormAttachment( 0, 15 );
fd.right = new FormAttachment( 100, -15 );
fd.top = new FormAttachment( selFontGrp, 15, SWT.BOTTOM );
fd.bottom = new FormAttachment( 100, -20 );
colorBarGrp.setLayoutData( fd );
colorBarGrp.setLayout( new FormLayout() );
fd = new FormData();//400,300);
fd.left = new FormAttachment(0, 15);
fd.right = new FormAttachment(100, -15);
fd.top = new FormAttachment(selFontGrp, 15, SWT.BOTTOM);
fd.bottom = new FormAttachment(100, -20);
colorBarGrp.setLayoutData(fd);
colorBarGrp.setLayout(new FormLayout());
ColorBar editedColorBar = null;
editedColorBar = (ColorBar)colorBarAttr.getAttrValue();
editedColorBar = (ColorBar) colorBarAttr.getAttrValue();
colorBarEditor = new ColorBarEditor(colorBarGrp, editedColorBar, true);
colorBarEditor = new ColorBarEditor( colorBarGrp, editedColorBar );
return topComp;
}
@Override
public void initWidgets() {
// done in createDialog
}
@Override
public void initWidgets() {
// done in createDialog
}
@Override
protected void dispose() {
super.dispose();
colorBarEditor.dispose();
}
@Override
protected void dispose() {
super.dispose();
colorBarEditor.dispose();
}
}