Issue #2488 Change to use DejaVu fonts
Change-Id: I82f4b93f340bca0e6dfa4f9c14a9890644c9f224 Former-commit-id:a83d214f40
[formerly7a3c7d530e
] [formerlyd72119409e
] [formerlya83d214f40
[formerly7a3c7d530e
] [formerlyd72119409e
] [formerly633137d8c0
[formerlyd72119409e
[formerly 396cd96c02521a33c65fa9e447275307c2d6168c]]]] Former-commit-id:633137d8c0
Former-commit-id:bbb24dfdbd
[formerly769df41dea
] [formerly ebfd4c9fd692514b821af5e75fe51a87a50ddecc [formerlyf6b9e69738
]] Former-commit-id: 88b789c28703f9bf73991585ff00bcc13e9d24bd [formerlya731f80011
] Former-commit-id:e2f54e78d0
This commit is contained in:
parent
53149f4869
commit
f54ac1014a
10 changed files with 210 additions and 167 deletions
|
@ -24,11 +24,12 @@
|
|||
|
||||
#------*-python-*-------------------------------------------------------------
|
||||
# Config file for the GFE (Graphical Forecast Editor).
|
||||
#
|
||||
# $Id$
|
||||
#-----------------------------------------------------------------------------
|
||||
# Heading
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
# SOFTWARE HISTORY
|
||||
#
|
||||
# Date Ticket# Engineer Description
|
||||
# ------------ ---------- ----------- --------------------------
|
||||
# 11/20/2013 2488 randerso Changed to use DejaVu fonts
|
||||
|
||||
GFESUITE_HOME = "/awips2/GFESuite"
|
||||
GFESUITE_PRDDIR = "/tmp/products"
|
||||
|
@ -262,11 +263,11 @@ MapBackgrounds_default = ['States','CWA']
|
|||
# style is a font style (one of "regular", "bold", "italic", or "bold italic")
|
||||
# height is an integer representing the font height.
|
||||
# Example: Times New Roman-bold-36.
|
||||
TextFont0 = "Bitstream Vera Sans Mono-regular-9"
|
||||
TextFont1 = "Bitstream Vera Sans Mono-regular-9"
|
||||
TextFont2 = "Bitstream Vera Sans Mono-bold-12"
|
||||
TextFont3 = "Bitstream Vera Sans Mono-bold-14"
|
||||
TextFont4 = "Bitstream Vera Sans Mono-bold-20"
|
||||
TextFont0 = "DejaVu Sans Mono-regular-9"
|
||||
TextFont1 = "DejaVu Sans Mono-regular-9"
|
||||
TextFont2 = "DejaVu Sans Mono-bold-12"
|
||||
TextFont3 = "DejaVu Sans Mono-bold-14"
|
||||
TextFont4 = "DejaVu Sans Mono-bold-20"
|
||||
|
||||
# The color which will be used as the background for all of the display
|
||||
# panes.
|
||||
|
|
|
@ -41,6 +41,22 @@ import org.eclipse.swt.layout.GridLayout;
|
|||
import org.eclipse.swt.widgets.Canvas;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
|
||||
/**
|
||||
* Time Duration Scale Composite
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 20, 2013 #2488 randerso Changed to use DejaVu font
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author randerso
|
||||
* @version 1.0
|
||||
*/
|
||||
public class TimeDurScaleComp extends Composite {
|
||||
/**
|
||||
* Parent composite.
|
||||
|
@ -252,13 +268,10 @@ public class TimeDurScaleComp extends Composite {
|
|||
*/
|
||||
private void init() {
|
||||
// Create the font
|
||||
// canvasFont = new Font(parentComp.getDisplay(), "Courier", 10,
|
||||
// SWT.NORMAL);
|
||||
// canvasFont = new Font(parentComp.getDisplay(), "Monospace", 10,
|
||||
// SWT.NORMAL);
|
||||
|
||||
FontData fd = parentComp.getDisplay().getSystemFont().getFontData()[0];
|
||||
fd.setName("Bitstream Vera Sans Mono");
|
||||
// TODO not have hard coded font name
|
||||
fd.setName("DejaVu Sans Mono");
|
||||
canvasFont = new Font(parentComp.getDisplay(), fd);
|
||||
|
||||
// Create the time bar colors
|
||||
|
@ -307,6 +320,7 @@ public class TimeDurScaleComp extends Composite {
|
|||
this.pack();
|
||||
|
||||
this.addDisposeListener(new DisposeListener() {
|
||||
@Override
|
||||
public void widgetDisposed(DisposeEvent arg0) {
|
||||
greyColor.dispose();
|
||||
yellowColor.dispose();
|
||||
|
@ -328,6 +342,7 @@ public class TimeDurScaleComp extends Composite {
|
|||
timeSliderCanvas.setLayoutData(new GridData(CANVAS_WIDTH + 10,
|
||||
CANVAS_HEIGHT));
|
||||
timeSliderCanvas.addPaintListener(new PaintListener() {
|
||||
@Override
|
||||
public void paintControl(PaintEvent e) {
|
||||
drawTimeSliderCanvas(e.gc);
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -63,10 +63,11 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 26, 2011 randerso Initial creation
|
||||
* Oct 26, 2011 randerso Initial creation
|
||||
* Oct 30, 2012 1298 rferrel Code clean for non-blocking dialog.
|
||||
* 02/13/2013 #1597 randerso Made number of concurrent save threads a configurable value.
|
||||
* Feb 13, 2013 1597 randerso Made number of concurrent save threads a configurable value.
|
||||
* Added logging to support GFE Performance metrics
|
||||
* Nov 20, 2013 2488 randerso Changed to use DejaVu font
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -127,7 +128,8 @@ public abstract class AbstractSaveParameterDialog extends CaveJFACEDialog
|
|||
master.addDisposeListener(this);
|
||||
|
||||
FontData fd = master.getDisplay().getSystemFont().getFontData()[0];
|
||||
fd.setName("Bitstream Vera Sans Mono");
|
||||
// TODO not have hard coded font name
|
||||
fd.setName("DejaVu Sans Mono");
|
||||
font = new Font(master.getDisplay(), fd);
|
||||
|
||||
initializeComponents();
|
||||
|
|
|
@ -57,8 +57,9 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 21, 2011 randerso Initial creation
|
||||
* Jan 21, 2011 randerso Initial creation
|
||||
* Oct 25, 2012 1287 rferrel Code clean up for non-blocking dialog.
|
||||
* Nov 20, 2013 2488 randerso Changed to use DejaVu font
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -107,7 +108,8 @@ public class WERevertDialog extends CaveJFACEDialog implements DisposeListener {
|
|||
master.addDisposeListener(this);
|
||||
|
||||
FontData fd = master.getDisplay().getSystemFont().getFontData()[0];
|
||||
fd.setName("Bitstream Vera Sans Mono");
|
||||
// TODO not have hard coded font name
|
||||
fd.setName("DejaVu Sans Mono");
|
||||
font = new Font(master.getDisplay(), fd);
|
||||
|
||||
String t;
|
||||
|
|
|
@ -65,11 +65,12 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
import com.raytheon.uf.viz.core.RGBColors;
|
||||
import com.raytheon.viz.gfe.Activator;
|
||||
import com.raytheon.viz.gfe.dialogs.formatterlauncher.ProductEditorComp.PTypeCategory;
|
||||
import com.raytheon.viz.gfe.rsc.GFEFonts;
|
||||
import com.raytheon.viz.gfe.textformatter.TextFmtParserUtil;
|
||||
|
||||
/**
|
||||
* Composite containing the product editor.
|
||||
*
|
||||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
|
@ -81,12 +82,12 @@ import com.raytheon.viz.gfe.textformatter.TextFmtParserUtil;
|
|||
* 03 Dec 2012 15620 ryu Unlock framed cities list for editing.
|
||||
* 30 APR 2013 16095 ryu Modified updateTextStyle() to not lock edited text.
|
||||
* 04 SEP 2013 16534 ryu Fixed word wrap to not insert duplicate text; refactor.
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @author lvenable
|
||||
* @version 1.0
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class StyledTextComp extends Composite {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
|
@ -189,7 +190,7 @@ public class StyledTextComp extends Composite {
|
|||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
*
|
||||
* @param parent
|
||||
* Parent composite.
|
||||
*/
|
||||
|
@ -207,10 +208,12 @@ public class StyledTextComp extends Composite {
|
|||
private void init() {
|
||||
String fontSetting = Activator.getDefault().getPreferenceStore()
|
||||
.getString("ProductOutputDialog_font");
|
||||
FontData fontData;
|
||||
if (fontSetting.isEmpty()) {
|
||||
fontSetting = "Bitstream Vera Sans Mono-bold-12";
|
||||
fontData = GFEFonts.getFontData(2);
|
||||
} else {
|
||||
fontData = StringConverter.asFontData(fontSetting);
|
||||
}
|
||||
FontData fontData = StringConverter.asFontData(fontSetting);
|
||||
textFont = new Font(parent.getDisplay(), fontData);
|
||||
|
||||
createMouseListner();
|
||||
|
@ -227,6 +230,7 @@ public class StyledTextComp extends Composite {
|
|||
createTextControl();
|
||||
|
||||
this.addDisposeListener(new DisposeListener() {
|
||||
@Override
|
||||
public void widgetDisposed(DisposeEvent arg0) {
|
||||
textFont.dispose();
|
||||
bgColor.dispose();
|
||||
|
@ -307,7 +311,7 @@ public class StyledTextComp extends Composite {
|
|||
|
||||
/**
|
||||
* Get the StyledText editor.
|
||||
*
|
||||
*
|
||||
* @return The StyledText editor.
|
||||
*/
|
||||
public StyledText getTextEditorST() {
|
||||
|
@ -316,7 +320,7 @@ public class StyledTextComp extends Composite {
|
|||
|
||||
/**
|
||||
* Set the product text.
|
||||
*
|
||||
*
|
||||
* @param text
|
||||
* The product text.
|
||||
*/
|
||||
|
@ -398,8 +402,7 @@ public class StyledTextComp extends Composite {
|
|||
// should be unlocked. Cities list is unlocked for editing
|
||||
// when framing codes are present.
|
||||
if (newProduct) {
|
||||
if (cityTip != null &&
|
||||
cityTip.getText().indexOf("|*") > 0) {
|
||||
if (cityTip != null && cityTip.getText().indexOf("|*") > 0) {
|
||||
unlockCitySegs.add(ugc);
|
||||
}
|
||||
}
|
||||
|
@ -411,8 +414,7 @@ public class StyledTextComp extends Composite {
|
|||
|
||||
lockLines(productTextArray, startLine, cityStart);
|
||||
lockLines(productTextArray, cityEnd, endLine);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
lockLines(productTextArray, startLine, endLine);
|
||||
}
|
||||
}
|
||||
|
@ -484,7 +486,7 @@ public class StyledTextComp extends Composite {
|
|||
|
||||
/**
|
||||
* Parse the product text string.
|
||||
*
|
||||
*
|
||||
* @param productText
|
||||
*/
|
||||
private void parseProductText(String productText) {
|
||||
|
@ -564,7 +566,7 @@ public class StyledTextComp extends Composite {
|
|||
replaceText(ff, SPC + newfield);
|
||||
}
|
||||
} else {
|
||||
String s = SPC + newfield;
|
||||
String s = SPC + newfield;
|
||||
if (!ff.getText().equals(s)) {
|
||||
replaceText(ff, s);
|
||||
}
|
||||
|
@ -670,7 +672,7 @@ public class StyledTextComp extends Composite {
|
|||
/**
|
||||
* Handle the verify key event. This event fires after a change has been
|
||||
* made to the control (after the text has been updated, for example)
|
||||
*
|
||||
*
|
||||
* @param event
|
||||
* Verify event that was fired.
|
||||
*/
|
||||
|
@ -731,8 +733,7 @@ public class StyledTextComp extends Composite {
|
|||
// .getStyleRangeAtOffset(event.start + event.length + 1);
|
||||
|
||||
// if it's in a framing code, turn it red
|
||||
if (startRange != null
|
||||
&& endRange != null
|
||||
if (startRange != null && endRange != null
|
||||
&& event.start > startRange.start
|
||||
&& event.start + event.length < endRange.start
|
||||
&& startRange.similarTo(endRange)
|
||||
|
@ -763,7 +764,7 @@ public class StyledTextComp extends Composite {
|
|||
|
||||
/**
|
||||
* Handle the key event when a key is released.
|
||||
*
|
||||
*
|
||||
* @param ke
|
||||
* Key event.
|
||||
*/
|
||||
|
@ -785,7 +786,7 @@ public class StyledTextComp extends Composite {
|
|||
/**
|
||||
* Check if there is selected text and if there is locked text in the
|
||||
* selected text.
|
||||
*
|
||||
*
|
||||
* @return True if there is selected text that contains locked text.
|
||||
*/
|
||||
private boolean selectionHasLockedText() {
|
||||
|
@ -799,12 +800,12 @@ public class StyledTextComp extends Composite {
|
|||
|
||||
/**
|
||||
* Check if there is locked text in the specified range of text.
|
||||
*
|
||||
*
|
||||
* @param offset
|
||||
* The starting point of the locked text search.
|
||||
* @param length
|
||||
* The length of the search.
|
||||
*
|
||||
*
|
||||
* @return Whether or not there is text in the range that contains locked
|
||||
* text.
|
||||
*/
|
||||
|
@ -822,7 +823,7 @@ public class StyledTextComp extends Composite {
|
|||
|
||||
/**
|
||||
* Select the framing code and the text contained in the framing code.
|
||||
*
|
||||
*
|
||||
* @param sr
|
||||
* StyleRange.
|
||||
*/
|
||||
|
@ -834,7 +835,7 @@ public class StyledTextComp extends Composite {
|
|||
|
||||
/**
|
||||
* Check if the key being pressed is a "non-edit" key.
|
||||
*
|
||||
*
|
||||
* @param event
|
||||
* Verify event.
|
||||
* @return True if the key is an arrow or "non-edit" key.
|
||||
|
@ -856,6 +857,7 @@ public class StyledTextComp extends Composite {
|
|||
private void createMouseListner() {
|
||||
mouseListener = new Listener() {
|
||||
|
||||
@Override
|
||||
public void handleEvent(Event e) {
|
||||
if (e.type == SWT.MouseDown) {
|
||||
handleMouseDown(e);
|
||||
|
@ -868,7 +870,7 @@ public class StyledTextComp extends Composite {
|
|||
|
||||
/**
|
||||
* Handle the mouse down event.
|
||||
*
|
||||
*
|
||||
* @param e
|
||||
* Event fired.
|
||||
*/
|
||||
|
@ -903,7 +905,7 @@ public class StyledTextComp extends Composite {
|
|||
|
||||
/**
|
||||
* Handle the mouse up event
|
||||
*
|
||||
*
|
||||
* @param e
|
||||
* Event fired.
|
||||
*/
|
||||
|
@ -1010,7 +1012,7 @@ public class StyledTextComp extends Composite {
|
|||
/**
|
||||
* Checks if the system is editing, e.g. updating the issue time every
|
||||
* minute, vs a user typing text in the text area
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private boolean isSystemTextChange() {
|
||||
|
@ -1035,17 +1037,19 @@ public class StyledTextComp extends Composite {
|
|||
}
|
||||
|
||||
protected boolean isUpperCase(final String word) {
|
||||
for (int index= word.length() - 1; index >= 0; index--) {
|
||||
if (Character.isLowerCase(word.charAt(index)))
|
||||
for (int index = word.length() - 1; index >= 0; index--) {
|
||||
if (Character.isLowerCase(word.charAt(index))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void upper() {
|
||||
String text = textEditorST.getText();
|
||||
if (isUpperCase(text))
|
||||
if (isUpperCase(text)) {
|
||||
return;
|
||||
}
|
||||
int topIdx = textEditorST.getTopIndex();
|
||||
setProductText(textEditorST.getText().toUpperCase());
|
||||
textEditorST.setTopIndex(topIdx);
|
||||
|
@ -1161,7 +1165,7 @@ public class StyledTextComp extends Composite {
|
|||
|
||||
/**
|
||||
* Getter for the column at which wrap and auto-wrap will wrap the text.
|
||||
*
|
||||
*
|
||||
* @return the column number
|
||||
*/
|
||||
public int getWrapColumn() {
|
||||
|
@ -1170,7 +1174,7 @@ public class StyledTextComp extends Composite {
|
|||
|
||||
/**
|
||||
* Getter for the column at which wrap and auto-wrap will wrap the text.
|
||||
*
|
||||
*
|
||||
* @param wrapColumn
|
||||
* the column number
|
||||
*/
|
||||
|
@ -1209,7 +1213,7 @@ public class StyledTextComp extends Composite {
|
|||
/**
|
||||
* Query the prefs for setting. If it does not exist, use colorDft as its
|
||||
* value. Create an SWT Color for display from the value and return it.
|
||||
*
|
||||
*
|
||||
* @param prefs
|
||||
* A preference store which might have config values.
|
||||
* @param display
|
||||
|
@ -1232,7 +1236,7 @@ public class StyledTextComp extends Composite {
|
|||
|
||||
/**
|
||||
* Send a PROBLEM message if color1 is exactly equal to color2.
|
||||
*
|
||||
*
|
||||
* @param color1
|
||||
* the first color
|
||||
* @param color2
|
||||
|
@ -1259,7 +1263,7 @@ public class StyledTextComp extends Composite {
|
|||
* <p>
|
||||
* The getter name is different to avoid confusion with the getFgColor()
|
||||
* method of Control.
|
||||
*
|
||||
*
|
||||
* @return the foreground Color
|
||||
*/
|
||||
public Color getFgndColor() {
|
||||
|
@ -1270,7 +1274,7 @@ public class StyledTextComp extends Composite {
|
|||
* Get the framed text color of the StyledTextComp. This is the actual
|
||||
* color, not a copy. It will be disposed when the StyledTextComp is, and
|
||||
* should not be disposed before then.
|
||||
*
|
||||
*
|
||||
* @return the frameColor
|
||||
*/
|
||||
public Color getFrameColor() {
|
||||
|
@ -1281,7 +1285,7 @@ public class StyledTextComp extends Composite {
|
|||
* Get the insert color of the StyledTextComp. This is the actual color, not
|
||||
* a copy. It will be disposed when the StyledTextComp is, and should not be
|
||||
* disposed before then.
|
||||
*
|
||||
*
|
||||
* @return the insertColor
|
||||
*/
|
||||
public Color getInsertColor() {
|
||||
|
@ -1292,7 +1296,7 @@ public class StyledTextComp extends Composite {
|
|||
* Get the locked text color of the StyledTextComp. This is the actual
|
||||
* color, not a copy. It will be disposed when the StyledTextComp is, and
|
||||
* should not be disposed before then.
|
||||
*
|
||||
*
|
||||
* @return the lockColor
|
||||
*/
|
||||
public Color getLockColor() {
|
||||
|
@ -1302,7 +1306,7 @@ public class StyledTextComp extends Composite {
|
|||
/**
|
||||
* Word wrap the text in the block around cursorIndex. Adjust the cursor
|
||||
* position to account for inserted or deleted whitespace.
|
||||
*
|
||||
*
|
||||
* @param st
|
||||
* The StyledText in which word wrap is to be performed
|
||||
* @param cursorIndex
|
||||
|
@ -1336,7 +1340,7 @@ public class StyledTextComp extends Composite {
|
|||
line = st.getLine(searchLine);
|
||||
int lineOffset = st.getOffsetAtLine(searchLine);
|
||||
|
||||
// if line contains locked text, quit looking.
|
||||
// if line contains locked text, quit looking.
|
||||
if (rangeHasLockedText(lineOffset, line.length())) {
|
||||
break;
|
||||
}
|
||||
|
@ -1393,7 +1397,7 @@ public class StyledTextComp extends Composite {
|
|||
if (endIndex >= st.getCharCount()) {
|
||||
endIndex = st.getCharCount() - 1;
|
||||
}
|
||||
|
||||
|
||||
if (endIndex < startIndex) {
|
||||
return new int[] { startIndex, endIndex, 0 };
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ import com.raytheon.viz.gfe.GFEPreference;
|
|||
* Apr 27, 2011 #9250 bkowal getStyle and getName are now used to
|
||||
* get the style and name associated with
|
||||
* a FontData object.
|
||||
* Nov 20, 2013 #2488 randerso Changed to use DejaVu fonts
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -57,9 +58,9 @@ public class GFEFonts {
|
|||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(GFEFonts.class);
|
||||
|
||||
private static final String DEFAULT_FONT_NAME = "Bitstream Vera Sans";
|
||||
private static final String DEFAULT_FONT_NAME = "DejaVu Sans Mono";
|
||||
|
||||
private static final int[] DEFAULT_FONT_SIZE = { 8, 10, 12, 14, 20 };
|
||||
private static final int[] DEFAULT_FONT_SIZE = { 9, 9, 12, 14, 20 };
|
||||
|
||||
private static final int DEFAULT_FONT_STYLE = SWT.BOLD;
|
||||
|
||||
|
|
|
@ -147,4 +147,12 @@
|
|||
</menu>
|
||||
</menuContribution>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.themes">
|
||||
<fontDefinition
|
||||
id="com.raytheon.viz.radar.rsc.graphic.RadarGraphicsPage"
|
||||
label="Radar Graphics Font"
|
||||
value="Monospaced-regular-12">
|
||||
</fontDefinition>
|
||||
</extension>
|
||||
</plugin>
|
||||
|
|
|
@ -19,13 +19,12 @@
|
|||
**/
|
||||
package com.raytheon.viz.radar.rsc.graphic;
|
||||
|
||||
import java.io.File;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
import javax.measure.converter.UnitConverter;
|
||||
import javax.measure.unit.NonSI;
|
||||
|
@ -42,8 +41,8 @@ import com.raytheon.uf.common.dataplugin.radar.level3.CellTrendDataPacket;
|
|||
import com.raytheon.uf.common.dataplugin.radar.level3.CellTrendVolumeScanPacket;
|
||||
import com.raytheon.uf.common.dataplugin.radar.level3.CorrelatedShearPacket;
|
||||
import com.raytheon.uf.common.dataplugin.radar.level3.DMDPacket.DMDAttributeIDs;
|
||||
import com.raytheon.uf.common.dataplugin.radar.level3.GFMPacket;
|
||||
import com.raytheon.uf.common.dataplugin.radar.level3.ETVSPacket;
|
||||
import com.raytheon.uf.common.dataplugin.radar.level3.GFMPacket;
|
||||
import com.raytheon.uf.common.dataplugin.radar.level3.HailPositivePacket;
|
||||
import com.raytheon.uf.common.dataplugin.radar.level3.HailProbablePacket;
|
||||
import com.raytheon.uf.common.dataplugin.radar.level3.HdaHailPacket;
|
||||
|
@ -78,20 +77,19 @@ import com.raytheon.uf.common.dataplugin.radar.level3.generic.GenericDataCompone
|
|||
import com.raytheon.uf.common.geospatial.ReferencedCoordinate;
|
||||
import com.raytheon.uf.common.geospatial.ReferencedGeometry;
|
||||
import com.raytheon.uf.common.geospatial.ReferencedObject.Type;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.viz.core.DrawableLine;
|
||||
import com.raytheon.uf.viz.core.DrawableString;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget.VerticalAlignment;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget.LineStyle;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget.VerticalAlignment;
|
||||
import com.raytheon.uf.viz.core.data.prep.IODataPreparer;
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
import com.raytheon.uf.viz.core.drawables.IFont;
|
||||
import com.raytheon.uf.viz.core.drawables.IImage;
|
||||
import com.raytheon.uf.viz.core.drawables.IRenderable;
|
||||
import com.raytheon.uf.viz.core.drawables.IWireframeShape;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.ICanvasRenderingExtension;
|
||||
import com.raytheon.uf.viz.core.drawables.IImage;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.viz.core.rsc.jts.JTSCompiler;
|
||||
import com.raytheon.viz.pointdata.PointWindDisplay;
|
||||
|
@ -121,6 +119,7 @@ import com.vividsolutions.jts.geom.LineString;
|
|||
* Jan 8, 2009 chammack Initial creation
|
||||
* 03/05/2013 DCS51 zwang Handle GFM product
|
||||
* 06/24/2013 DR16162 zwang Remove "wind behind"
|
||||
* 11/20/2013 2488 randerso Removed use of VeraMono font file
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -143,7 +142,7 @@ public class RadarGraphicsPage implements IRenderable {
|
|||
private JTSCompiler compiler;
|
||||
|
||||
private IWireframeShape wireframeShape;
|
||||
|
||||
|
||||
private IWireframeShape gfmFcstWireframeShape;
|
||||
|
||||
/** Map of ascii strings in local coordinate system */
|
||||
|
@ -190,14 +189,15 @@ public class RadarGraphicsPage implements IRenderable {
|
|||
private boolean drawBorder = false;
|
||||
|
||||
private int recordsPerPage = 5;
|
||||
|
||||
|
||||
// for GFM product, add gfmFcstWireframeShape
|
||||
public RadarGraphicsPage(IDescriptor descriptor, GeneralGridGeometry gg,
|
||||
IWireframeShape shape, IWireframeShape gfmShape, IGraphicsTarget target, RGB color) {
|
||||
IWireframeShape shape, IWireframeShape gfmShape,
|
||||
IGraphicsTarget target, RGB color) {
|
||||
this(descriptor, gg, shape, target, color);
|
||||
this.gfmFcstWireframeShape = gfmShape;
|
||||
}
|
||||
|
||||
|
||||
public RadarGraphicsPage(IDescriptor descriptor, GeneralGridGeometry gg,
|
||||
IWireframeShape shape, IGraphicsTarget target, RGB color,
|
||||
DmdModifier tableModifier) {
|
||||
|
@ -467,10 +467,10 @@ public class RadarGraphicsPage implements IRenderable {
|
|||
}
|
||||
}
|
||||
// GFM
|
||||
else if (type == 140) {
|
||||
List<PlotObject> gfmImages = new ArrayList<PlotObject>();
|
||||
else if (type == 140) {
|
||||
List<PlotObject> gfmImages = new ArrayList<PlotObject>();
|
||||
|
||||
// Handle each Feature in the GFM Packet
|
||||
// Handle each Feature in the GFM Packet
|
||||
for (GenericDataComponent currComponent : stormData
|
||||
.getDisplayGenericPointData().get(type).values()) {
|
||||
// Handle Graphic portion
|
||||
|
@ -892,104 +892,113 @@ public class RadarGraphicsPage implements IRenderable {
|
|||
|
||||
// Handle GFM product
|
||||
private List<PlotObject> getGfmImage(GenericDataComponent currPt)
|
||||
throws VizException {
|
||||
throws VizException {
|
||||
List<PlotObject> images = new ArrayList<PlotObject>();
|
||||
|
||||
UnitConverter metersPerSecondToKnots = SI.METERS_PER_SECOND.getConverterTo(NonSI.KNOT);
|
||||
|
||||
|
||||
UnitConverter metersPerSecondToKnots = SI.METERS_PER_SECOND
|
||||
.getConverterTo(NonSI.KNOT);
|
||||
|
||||
boolean isFcst = false;
|
||||
double x,y;
|
||||
double x, y;
|
||||
Coordinate pos1, pos2;
|
||||
|
||||
|
||||
int imgSize = 64;
|
||||
|
||||
|
||||
AreaComponent currFeature = (AreaComponent) currPt;
|
||||
|
||||
|
||||
int numPoints = currFeature.getPoints().size();
|
||||
int numParam = currFeature.getParameters().size();
|
||||
|
||||
|
||||
String propU, propV, windX, windY;
|
||||
double pU = 0.0;
|
||||
double pV = 0.0;
|
||||
double pV = 0.0;
|
||||
double wX = 0.0;
|
||||
double wY = 0.0;
|
||||
|
||||
|
||||
// if the component only has dectect ID and DeltaT
|
||||
if (numParam == 2) {
|
||||
isFcst = true;
|
||||
isFcst = true;
|
||||
}
|
||||
// 11 parameters
|
||||
else {
|
||||
propU = currFeature.getValue(GFMPacket.GFMAttributeIDs.PROPU.getName());
|
||||
if ((propU != null) && (propU.length() > 0)) {
|
||||
pU = metersPerSecondToKnots.convert(new Double(propU));
|
||||
}
|
||||
propV = currFeature.getValue(GFMPacket.GFMAttributeIDs.PROPV.getName());
|
||||
if ((propV != null) && (propV.length() > 0)) {
|
||||
pV = metersPerSecondToKnots.convert(new Double(propV));
|
||||
}
|
||||
windX = currFeature.getValue(GFMPacket.GFMAttributeIDs.WINDBEHINDX.getName());
|
||||
if ((windX != null) && (windX.length() > 0)) {
|
||||
wX = Float.parseFloat(windX);
|
||||
}
|
||||
windY = currFeature.getValue(GFMPacket.GFMAttributeIDs.WINDBEHINDY.getName());
|
||||
if ((windY != null) && (windY.length() > 0)) {
|
||||
wY = Float.parseFloat(windY);
|
||||
}
|
||||
|
||||
// Get the nearest point on the MIGFA front to the wind behind point
|
||||
// Plot front movement arrow at this point
|
||||
Coordinate windBehind = new Coordinate(wX, wY);
|
||||
Coordinate plotPoint = getPlotPoint(currFeature, windBehind);
|
||||
wX = plotPoint.x;
|
||||
wY = plotPoint.y;
|
||||
|
||||
// Prop wind arrow
|
||||
PlotObject poWind = new PlotObject();
|
||||
PointWindDisplay barb = new PointWindDisplay(imgSize * 0.4, 0.5, 2, 0);
|
||||
barb.setImageParameters(imgSize, imgSize, 255, 255, 255, 1);
|
||||
barb.setColor(this.color);
|
||||
|
||||
// plot the wind arrow in the same length as 50 kts
|
||||
double spd = Math.sqrt(pU * pU + pV * pV);
|
||||
if (spd > 0) {
|
||||
pU *= 50.0 / spd;
|
||||
pV *= 50.0 / spd;
|
||||
}
|
||||
|
||||
barb.setWind(pU, pV, false);
|
||||
BufferedImage imgBuf = barb.getWindImage(false, DisplayType.ARROW, 0.2);
|
||||
IImage img = this.target.initializeRaster(new IODataPreparer(imgBuf, UUID.randomUUID().toString(), 0), null);
|
||||
poWind.image = img;
|
||||
|
||||
ReferencedCoordinate rc = referencedGfmCoord(wX, wY);
|
||||
try {
|
||||
poWind.coord = rc.asPixel(this.descriptor.getGridGeometry());
|
||||
poWind.pixelOffset = new int[] { 0, 0 };
|
||||
images.add(poWind);
|
||||
} catch (Exception e) {
|
||||
throw new VizException("Unable to transform coordinates", e);
|
||||
}
|
||||
propU = currFeature.getValue(GFMPacket.GFMAttributeIDs.PROPU
|
||||
.getName());
|
||||
if ((propU != null) && (propU.length() > 0)) {
|
||||
pU = metersPerSecondToKnots.convert(new Double(propU));
|
||||
}
|
||||
propV = currFeature.getValue(GFMPacket.GFMAttributeIDs.PROPV
|
||||
.getName());
|
||||
if ((propV != null) && (propV.length() > 0)) {
|
||||
pV = metersPerSecondToKnots.convert(new Double(propV));
|
||||
}
|
||||
windX = currFeature.getValue(GFMPacket.GFMAttributeIDs.WINDBEHINDX
|
||||
.getName());
|
||||
if ((windX != null) && (windX.length() > 0)) {
|
||||
wX = Float.parseFloat(windX);
|
||||
}
|
||||
windY = currFeature.getValue(GFMPacket.GFMAttributeIDs.WINDBEHINDY
|
||||
.getName());
|
||||
if ((windY != null) && (windY.length() > 0)) {
|
||||
wY = Float.parseFloat(windY);
|
||||
}
|
||||
|
||||
// Get the nearest point on the MIGFA front to the wind behind point
|
||||
// Plot front movement arrow at this point
|
||||
Coordinate windBehind = new Coordinate(wX, wY);
|
||||
Coordinate plotPoint = getPlotPoint(currFeature, windBehind);
|
||||
wX = plotPoint.x;
|
||||
wY = plotPoint.y;
|
||||
|
||||
// Prop wind arrow
|
||||
PlotObject poWind = new PlotObject();
|
||||
PointWindDisplay barb = new PointWindDisplay(imgSize * 0.4, 0.5, 2,
|
||||
0);
|
||||
barb.setImageParameters(imgSize, imgSize, 255, 255, 255, 1);
|
||||
barb.setColor(this.color);
|
||||
|
||||
// plot the wind arrow in the same length as 50 kts
|
||||
double spd = Math.sqrt(pU * pU + pV * pV);
|
||||
if (spd > 0) {
|
||||
pU *= 50.0 / spd;
|
||||
pV *= 50.0 / spd;
|
||||
}
|
||||
|
||||
barb.setWind(pU, pV, false);
|
||||
BufferedImage imgBuf = barb.getWindImage(false, DisplayType.ARROW,
|
||||
0.2);
|
||||
IImage img = this.target.initializeRaster(new IODataPreparer(
|
||||
imgBuf, UUID.randomUUID().toString(), 0), null);
|
||||
poWind.image = img;
|
||||
|
||||
ReferencedCoordinate rc = referencedGfmCoord(wX, wY);
|
||||
try {
|
||||
poWind.coord = rc.asPixel(this.descriptor.getGridGeometry());
|
||||
poWind.pixelOffset = new int[] { 0, 0 };
|
||||
images.add(poWind);
|
||||
} catch (Exception e) {
|
||||
throw new VizException("Unable to transform coordinates", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Draw GFM fronts
|
||||
x = currFeature.getPoints().get(0).getCoordinate1();
|
||||
y = currFeature.getPoints().get(0).getCoordinate2();
|
||||
try {
|
||||
pos1 = referencedGfmCoord(x, y).asLatLon();
|
||||
|
||||
|
||||
for (int k = 1; k < numPoints; k++) {
|
||||
x = currFeature.getPoints().get(k).getCoordinate1();
|
||||
y = currFeature.getPoints().get(k).getCoordinate2();
|
||||
//convert xy to latlon
|
||||
pos2 = referencedGfmCoord(x, y).asLatLon();
|
||||
|
||||
// convert xy to latlon
|
||||
pos2 = referencedGfmCoord(x, y).asLatLon();
|
||||
|
||||
// Connect the dots
|
||||
if (isFcst) {
|
||||
gfmFcstWireframeShape.addLineSegment(new Coordinate[] {pos1, pos2 });
|
||||
}
|
||||
else {
|
||||
wireframeShape.addLineSegment(new Coordinate[] {pos1, pos2 });
|
||||
gfmFcstWireframeShape.addLineSegment(new Coordinate[] {
|
||||
pos1, pos2 });
|
||||
} else {
|
||||
wireframeShape
|
||||
.addLineSegment(new Coordinate[] { pos1, pos2 });
|
||||
}
|
||||
pos1 = pos2;
|
||||
}
|
||||
|
@ -1000,7 +1009,7 @@ public class RadarGraphicsPage implements IRenderable {
|
|||
}
|
||||
return images;
|
||||
}
|
||||
|
||||
|
||||
private PlotObject getImage(HdaHailPoint currPt) throws VizException {
|
||||
PlotObject image = null;
|
||||
|
||||
|
@ -1190,9 +1199,7 @@ public class RadarGraphicsPage implements IRenderable {
|
|||
public void paint(IGraphicsTarget target, PaintProperties paintProps)
|
||||
throws VizException {
|
||||
if (font == null) {
|
||||
File fontFile = PathManagerFactory.getPathManager().getStaticFile(
|
||||
"fonts" + File.separator + "VeraMono.ttf");
|
||||
this.font = target.initializeFont(fontFile, 12.0f, null);
|
||||
this.font = target.initializeFont(getClass().getName());
|
||||
this.font.setMagnification((float) magnification, false);
|
||||
this.font.setSmoothing(true);
|
||||
}
|
||||
|
@ -1201,9 +1208,9 @@ public class RadarGraphicsPage implements IRenderable {
|
|||
// GFM forecast positions should be dashed thick lines
|
||||
if (this.gfmFcstWireframeShape != null) {
|
||||
target.drawWireframeShape(this.wireframeShape, this.color, 3.0f);
|
||||
target.drawWireframeShape(this.gfmFcstWireframeShape, this.color, 3.0f, LineStyle.DASHED);
|
||||
}
|
||||
else if (this.wireframeShape != null) {
|
||||
target.drawWireframeShape(this.gfmFcstWireframeShape, this.color,
|
||||
3.0f, LineStyle.DASHED);
|
||||
} else if (this.wireframeShape != null) {
|
||||
target.drawWireframeShape(this.wireframeShape, this.color, 1.0f);
|
||||
}
|
||||
|
||||
|
@ -1478,35 +1485,36 @@ public class RadarGraphicsPage implements IRenderable {
|
|||
this.tableX = this.startTableX;
|
||||
this.tableY = this.startTableY;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Need to convert x/y to lon/lat for GFM product
|
||||
*/
|
||||
public ReferencedCoordinate referencedGfmCoord(double i, double j) {
|
||||
return new ReferencedCoordinate(rectifyCoordinate(new Coordinate(i * 4, j * 4)),
|
||||
this.gridGeometry, Type.GRID_CENTER);
|
||||
return new ReferencedCoordinate(rectifyCoordinate(new Coordinate(i * 4,
|
||||
j * 4)), this.gridGeometry, Type.GRID_CENTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the nearest point from GFM front to wind behind point to plot
|
||||
* front movement arrow
|
||||
* Gets the nearest point from GFM front to wind behind point to plot front
|
||||
* movement arrow
|
||||
*
|
||||
* @param AreaComponent
|
||||
* @param Coordinate
|
||||
* @return Coordinate
|
||||
*
|
||||
*/
|
||||
private Coordinate getPlotPoint(AreaComponent currFeature, Coordinate windBehind) {
|
||||
private Coordinate getPlotPoint(AreaComponent currFeature,
|
||||
Coordinate windBehind) {
|
||||
Coordinate point = new Coordinate();
|
||||
double minDist = Double.MAX_VALUE;
|
||||
|
||||
|
||||
int numPoints = currFeature.getPoints().size();
|
||||
double x1 = windBehind.x;
|
||||
double y1 = windBehind.y;
|
||||
double x2 = 0.0;
|
||||
double y2 = 0.0;
|
||||
double dist = 0.0;
|
||||
|
||||
|
||||
for (int k = 0; k < numPoints; k++) {
|
||||
x2 = currFeature.getPoints().get(k).getCoordinate1();
|
||||
y2 = currFeature.getPoints().get(k).getCoordinate2();
|
||||
|
@ -1517,8 +1525,8 @@ public class RadarGraphicsPage implements IRenderable {
|
|||
minDist = dist;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return point;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -60,7 +60,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* uses the font.
|
||||
* Feb 03, 2012 14317 mhuang Make alarm display window wider
|
||||
* Sep 6, 2012 13365 rferrel Accumulate and Display fix.
|
||||
* Sep 25, 2012 1196 lvenable Dialog refactor for AlarmDisplayWindow.Added DO_NOT_BLOCK.
|
||||
* Sep 25, 2012 1196 lvenable Dialog refactor for AlarmDisplayWindow.Added DO_NOT_BLOCK.
|
||||
* Nov 20, 2013 2488 randerso Changed to use DejaVu font
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -127,7 +128,8 @@ public class AlarmDisplayWindow extends CaveSWTDialog {
|
|||
shell.setMinimumSize(300, 100);
|
||||
|
||||
FontData fd = shell.getDisplay().getSystemFont().getFontData()[0];
|
||||
fd.setName("Bitstream Vera Sans Mono");
|
||||
// TODO not have hard coded font name
|
||||
fd.setName("DejaVu Sans Mono");
|
||||
font = new Font(shell.getDisplay(), fd);
|
||||
|
||||
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
|
@ -207,7 +209,7 @@ public class AlarmDisplayWindow extends CaveSWTDialog {
|
|||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
PrintDisplay.print(text.getText(),
|
||||
text.getFont().getFontData()[0],
|
||||
text.getFont().getFontData()[0],
|
||||
UFStatus.getHandler(AlarmDisplayWindow.class));
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue