VLab Issue #3721 - NCEP CAVE plugin delivery for 14.3.1
PGEN Bug Fixes Change-Id: Ie50d8f829e0dfb00fab254945a46592553cdb59c Former-commit-id:be04b1b1d9
[formerlye71b522740
] [formerlyd6f370db60
[formerly 2f93fd7bdbcf1fa4698dfc2dd51c377db6d809b6]] Former-commit-id:d6f370db60
Former-commit-id:c0e6cd6c50
This commit is contained in:
parent
cc68098978
commit
2c95dc0f33
19 changed files with 4248 additions and 3046 deletions
|
@ -304,6 +304,13 @@
|
||||||
id="action"
|
id="action"
|
||||||
name="action"/>
|
name="action"/>
|
||||||
</command>
|
</command>
|
||||||
|
<command
|
||||||
|
id="gov.noaa.nws.ncep.ui.pgen.tools.PgenContoursHotkeyCommand"
|
||||||
|
name="Contour level up/down">
|
||||||
|
<commandParameter
|
||||||
|
id="action"
|
||||||
|
name="action"/>
|
||||||
|
</command>
|
||||||
<command categoryId="gov.noaa.nws.ncep.viz.ui.modalTool"
|
<command categoryId="gov.noaa.nws.ncep.viz.ui.modalTool"
|
||||||
id="gov.noaa.nws.ncep.ui.pgen.rsc.PgenClip"
|
id="gov.noaa.nws.ncep.ui.pgen.rsc.PgenClip"
|
||||||
name="Pgen Clip">
|
name="Pgen Clip">
|
||||||
|
@ -553,6 +560,10 @@
|
||||||
class="gov.noaa.nws.ncep.ui.pgen.tools.PgenCopypasteHotkeyHandler"
|
class="gov.noaa.nws.ncep.ui.pgen.tools.PgenCopypasteHotkeyHandler"
|
||||||
commandId="gov.noaa.nws.ncep.ui.pgen.tools.PgenCopypasteHotkeyCommand">
|
commandId="gov.noaa.nws.ncep.ui.pgen.tools.PgenCopypasteHotkeyCommand">
|
||||||
</handler>
|
</handler>
|
||||||
|
<handler
|
||||||
|
class="gov.noaa.nws.ncep.ui.pgen.tools.PgenContoursHotkeyHandler"
|
||||||
|
commandId="gov.noaa.nws.ncep.ui.pgen.tools.PgenContoursHotkeyCommand">
|
||||||
|
</handler>
|
||||||
<handler
|
<handler
|
||||||
class="gov.noaa.nws.ncep.ui.pgen.tools.PgenClippingTool"
|
class="gov.noaa.nws.ncep.ui.pgen.tools.PgenClippingTool"
|
||||||
commandId="gov.noaa.nws.ncep.ui.pgen.rsc.PgenClip">
|
commandId="gov.noaa.nws.ncep.ui.pgen.rsc.PgenClip">
|
||||||
|
@ -2728,7 +2739,7 @@
|
||||||
label="Solid Line"
|
label="Solid Line"
|
||||||
className="Lines"
|
className="Lines"
|
||||||
commandId="gov.noaa.nws.ncep.ui.pgen.rsc.PgenMultiDraw"
|
commandId="gov.noaa.nws.ncep.ui.pgen.rsc.PgenMultiDraw"
|
||||||
icon="icons/cntr.gif" />
|
icon="icons/solidln.gif" />
|
||||||
<object
|
<object
|
||||||
name="POINTED_ARROW"
|
name="POINTED_ARROW"
|
||||||
label="Line with open arrow head"
|
label="Line with open arrow head"
|
||||||
|
@ -3340,6 +3351,22 @@
|
||||||
sequence="M1+A">
|
sequence="M1+A">
|
||||||
<parameter id="action" value="SELECTALL" />
|
<parameter id="action" value="SELECTALL" />
|
||||||
</key>
|
</key>
|
||||||
|
<!-- Hot keys to move contour level up/down -->
|
||||||
|
<key
|
||||||
|
commandId="gov.noaa.nws.ncep.ui.pgen.tools.PgenContoursHotkeyCommand"
|
||||||
|
contextId="gov.noaa.nws.ncep.ui.pgen.pgenContext"
|
||||||
|
schemeId="com.raytheon.viz.ui.awips.scheme"
|
||||||
|
sequence="ARROW_UP">
|
||||||
|
<parameter id="action" value="ARROW_UP" />
|
||||||
|
</key>
|
||||||
|
<key
|
||||||
|
commandId="gov.noaa.nws.ncep.ui.pgen.tools.PgenContoursHotkeyCommand"
|
||||||
|
contextId="gov.noaa.nws.ncep.ui.pgen.pgenContext"
|
||||||
|
schemeId="com.raytheon.viz.ui.awips.scheme"
|
||||||
|
sequence="ARROW_DOWN">
|
||||||
|
<parameter id="action" value="ARROW_DOWN" />
|
||||||
|
</key>
|
||||||
|
|
||||||
|
|
||||||
</extension>
|
</extension>
|
||||||
|
|
||||||
|
|
|
@ -205,8 +205,7 @@ public class PgenUtil {
|
||||||
public static final String FIVE_ZERO = "00000";
|
public static final String FIVE_ZERO = "00000";
|
||||||
|
|
||||||
// Default CAVE window title string
|
// Default CAVE window title string
|
||||||
// public static String caveTitle = "CAVE";
|
public static String caveTitle = "CAVE";
|
||||||
public static String caveTitle = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check the given editor for a PgenResource. If editor is null then the
|
* Check the given editor for a PgenResource. If editor is null then the
|
||||||
|
@ -1961,7 +1960,7 @@ public class PgenUtil {
|
||||||
&& PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
&& PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||||
.getShell() != null) {
|
.getShell() != null) {
|
||||||
// Save the existing title to reset.
|
// Save the existing title to reset.
|
||||||
if (caveTitle == null) {
|
if (caveTitle.equalsIgnoreCase("CAVE")) {
|
||||||
caveTitle = PlatformUI.getWorkbench()
|
caveTitle = PlatformUI.getWorkbench()
|
||||||
.getActiveWorkbenchWindow().getShell().getText();
|
.getActiveWorkbenchWindow().getShell().getText();
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -10,9 +10,9 @@ package gov.noaa.nws.ncep.ui.pgen.contours;
|
||||||
|
|
||||||
import gov.noaa.nws.ncep.ui.pgen.annotation.ElementOperations;
|
import gov.noaa.nws.ncep.ui.pgen.annotation.ElementOperations;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.annotation.Operation;
|
import gov.noaa.nws.ncep.ui.pgen.annotation.Operation;
|
||||||
|
import gov.noaa.nws.ncep.ui.pgen.display.IAttribute;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.elements.AbstractDrawableComponent;
|
import gov.noaa.nws.ncep.ui.pgen.elements.AbstractDrawableComponent;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.elements.DECollection;
|
import gov.noaa.nws.ncep.ui.pgen.elements.DECollection;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.display.IAttribute;
|
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -34,211 +34,225 @@ import com.vividsolutions.jts.geom.Coordinate;
|
||||||
* a set of lines.
|
* a set of lines.
|
||||||
* 11/10 #345 J. Wu Added support for Contours Circle
|
* 11/10 #345 J. Wu Added support for Contours Circle
|
||||||
* 07/13 TTR765 J. Wu DEL_PART between vertexes.
|
* 07/13 TTR765 J. Wu DEL_PART between vertexes.
|
||||||
|
* 05/14 TTR1008 J. Wu Added getKey() method.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author J. Wu
|
* @author J. Wu
|
||||||
*/
|
*/
|
||||||
@ElementOperations ( {Operation.COPY_MOVE} )
|
@ElementOperations({ Operation.COPY_MOVE })
|
||||||
public class Contours extends DECollection implements IContours {
|
public class Contours extends DECollection implements IContours {
|
||||||
|
|
||||||
private String parm;
|
private String parm;
|
||||||
private String level;
|
|
||||||
private String forecastHour;
|
|
||||||
private String cint;
|
|
||||||
private Calendar time1;
|
|
||||||
private Calendar time2;
|
|
||||||
|
|
||||||
/**
|
private String level;
|
||||||
* public constructor
|
|
||||||
*/
|
|
||||||
public Contours(){
|
|
||||||
|
|
||||||
super("Contours");
|
private String forecastHour;
|
||||||
setPgenCategory( "MET" );
|
|
||||||
setPgenType( "Contours" );
|
|
||||||
|
|
||||||
this.setParm("");
|
private String cint;
|
||||||
this.setLevel("");
|
|
||||||
this.setForecastHour("");
|
|
||||||
this.setTime1( (Calendar)Calendar.getInstance() );
|
|
||||||
this.setTime2( (Calendar)Calendar.getInstance() );
|
|
||||||
this.setCint("");
|
|
||||||
|
|
||||||
}
|
private Calendar time1;
|
||||||
|
|
||||||
public Contours( String name ){
|
private Calendar time2;
|
||||||
super(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Contours( IAttribute attr, ArrayList<Coordinate> points ){
|
/**
|
||||||
|
* public constructor
|
||||||
|
*/
|
||||||
|
public Contours() {
|
||||||
|
|
||||||
super("Contours");
|
super("Contours");
|
||||||
setPgenCategory( "MET" );
|
setPgenCategory("MET");
|
||||||
setPgenType( "Contours" );
|
setPgenType("Contours");
|
||||||
|
|
||||||
}
|
this.setParm("");
|
||||||
|
this.setLevel("");
|
||||||
|
this.setForecastHour("");
|
||||||
|
this.setTime1((Calendar) Calendar.getInstance());
|
||||||
|
this.setTime2((Calendar) Calendar.getInstance());
|
||||||
|
this.setCint("");
|
||||||
|
|
||||||
/**
|
}
|
||||||
* @param parm the parm to set
|
|
||||||
*/
|
|
||||||
public void setParm(String parm) {
|
|
||||||
this.parm = parm;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public Contours(String name) {
|
||||||
* @return the parm
|
super(name);
|
||||||
*/
|
}
|
||||||
public String getParm() {
|
|
||||||
return parm;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public Contours(IAttribute attr, ArrayList<Coordinate> points) {
|
||||||
* @return the level
|
|
||||||
*/
|
|
||||||
public String getLevel() {
|
|
||||||
return level;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
super("Contours");
|
||||||
* @param level the level to set
|
setPgenCategory("MET");
|
||||||
*/
|
setPgenType("Contours");
|
||||||
public void setLevel(String level) {
|
|
||||||
this.level = level;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
}
|
||||||
* @return the forecastHour
|
|
||||||
*/
|
|
||||||
public String getForecastHour() {
|
|
||||||
return forecastHour;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param forecastHour the forecastHour to set
|
* @param parm
|
||||||
*/
|
* the parm to set
|
||||||
public void setForecastHour(String forecastHour) {
|
*/
|
||||||
this.forecastHour = forecastHour;
|
public void setParm(String parm) {
|
||||||
}
|
this.parm = parm;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the cint
|
* @return the parm
|
||||||
*/
|
*/
|
||||||
public String getCint() {
|
public String getParm() {
|
||||||
return cint;
|
return parm;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param cint the cint to set
|
* @return the level
|
||||||
*/
|
*/
|
||||||
public void setCint(String cint) {
|
public String getLevel() {
|
||||||
this.cint = cint;
|
return level;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the time1
|
* @param level
|
||||||
*/
|
* the level to set
|
||||||
public Calendar getTime1() {
|
*/
|
||||||
return time1;
|
public void setLevel(String level) {
|
||||||
}
|
this.level = level;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param time the time to set
|
* @return the forecastHour
|
||||||
*/
|
*/
|
||||||
public void setTime1(Calendar time) {
|
public String getForecastHour() {
|
||||||
this.time1 = time;
|
return forecastHour;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the time2
|
* @param forecastHour
|
||||||
*/
|
* the forecastHour to set
|
||||||
public Calendar getTime2() {
|
*/
|
||||||
return time2;
|
public void setForecastHour(String forecastHour) {
|
||||||
}
|
this.forecastHour = forecastHour;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param time the time2 to set
|
* @return the cint
|
||||||
*/
|
*/
|
||||||
public void setTime2(Calendar time) {
|
public String getCint() {
|
||||||
this.time2 = time;
|
return cint;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/**
|
||||||
/**
|
* @param cint
|
||||||
* make a deep copy of the Contours
|
* the cint to set
|
||||||
*/
|
*/
|
||||||
public Contours copy() {
|
public void setCint(String cint) {
|
||||||
|
this.cint = cint;
|
||||||
|
}
|
||||||
|
|
||||||
Contours newContours = new Contours();
|
/**
|
||||||
|
* @return the time1
|
||||||
|
*/
|
||||||
|
public Calendar getTime1() {
|
||||||
|
return time1;
|
||||||
|
}
|
||||||
|
|
||||||
Iterator<AbstractDrawableComponent> iterator = this.getComponentIterator();
|
/**
|
||||||
|
* @param time
|
||||||
|
* the time to set
|
||||||
|
*/
|
||||||
|
public void setTime1(Calendar time) {
|
||||||
|
this.time1 = time;
|
||||||
|
}
|
||||||
|
|
||||||
while ( iterator.hasNext() ) {
|
/**
|
||||||
AbstractDrawableComponent adc = iterator.next().copy();
|
* @return the time2
|
||||||
adc.setParent( newContours );
|
*/
|
||||||
newContours.add( adc );
|
public Calendar getTime2() {
|
||||||
|
return time2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param time
|
||||||
|
* the time2 to set
|
||||||
|
*/
|
||||||
|
public void setTime2(Calendar time) {
|
||||||
|
this.time2 = time;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
/**
|
||||||
|
* make a deep copy of the Contours
|
||||||
|
*/
|
||||||
|
public Contours copy() {
|
||||||
|
|
||||||
|
Contours newContours = new Contours();
|
||||||
|
|
||||||
|
Iterator<AbstractDrawableComponent> iterator = this
|
||||||
|
.getComponentIterator();
|
||||||
|
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
AbstractDrawableComponent adc = iterator.next().copy();
|
||||||
|
adc.setParent(newContours);
|
||||||
|
newContours.add(adc);
|
||||||
}
|
}
|
||||||
|
|
||||||
newContours.update( this );
|
newContours.update(this);
|
||||||
|
|
||||||
return newContours;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* update the attributes for a Contours element
|
|
||||||
*/
|
|
||||||
public void update( IContours attr ) {
|
|
||||||
this.setParm(attr.getParm());
|
|
||||||
this.setLevel(attr.getLevel());
|
|
||||||
this.setForecastHour(attr.getForecastHour());
|
|
||||||
this.setTime1(attr.getTime1());
|
|
||||||
this.setTime2(attr.getTime2());
|
|
||||||
this.setCint(attr.getCint());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Split a contour line in a Contours. - using index
|
|
||||||
*
|
|
||||||
* Older version - use only the points on the original (un-smoothed) line
|
|
||||||
*/
|
|
||||||
public Contours split( ContourLine cline, int start, int end ) {
|
|
||||||
|
|
||||||
Contours newContours = new Contours();
|
|
||||||
|
|
||||||
Iterator<AbstractDrawableComponent> iterator = this.getComponentIterator();
|
|
||||||
|
|
||||||
while ( iterator.hasNext() ) {
|
|
||||||
|
|
||||||
AbstractDrawableComponent oldAdc = iterator.next();
|
|
||||||
AbstractDrawableComponent newAdc = oldAdc.copy();
|
|
||||||
|
|
||||||
if ( oldAdc.equals( cline ) ) {
|
|
||||||
ArrayList<ContourLine> newLines = ((ContourLine)newAdc).split( start, end );
|
|
||||||
for ( ContourLine cln : newLines ) {
|
|
||||||
cln.setParent( newContours );
|
|
||||||
newContours.add( cln );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
newAdc.setParent( newContours );
|
|
||||||
newContours.add( newAdc );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
newContours.update( this );
|
|
||||||
|
|
||||||
return newContours;
|
return newContours;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the string
|
* update the attributes for a Contours element
|
||||||
*/
|
*/
|
||||||
public String toString() {
|
public void update(IContours attr) {
|
||||||
StringBuilder result = new StringBuilder( getClass().getSimpleName());
|
this.setParm(attr.getParm());
|
||||||
|
this.setLevel(attr.getLevel());
|
||||||
|
this.setForecastHour(attr.getForecastHour());
|
||||||
|
this.setTime1(attr.getTime1());
|
||||||
|
this.setTime2(attr.getTime2());
|
||||||
|
this.setCint(attr.getCint());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Split a contour line in a Contours. - using index
|
||||||
|
*
|
||||||
|
* Older version - use only the points on the original (un-smoothed) line
|
||||||
|
*/
|
||||||
|
public Contours split(ContourLine cline, int start, int end) {
|
||||||
|
|
||||||
|
Contours newContours = new Contours();
|
||||||
|
|
||||||
|
Iterator<AbstractDrawableComponent> iterator = this
|
||||||
|
.getComponentIterator();
|
||||||
|
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
|
||||||
|
AbstractDrawableComponent oldAdc = iterator.next();
|
||||||
|
AbstractDrawableComponent newAdc = oldAdc.copy();
|
||||||
|
|
||||||
|
if (oldAdc.equals(cline)) {
|
||||||
|
ArrayList<ContourLine> newLines = ((ContourLine) newAdc).split(
|
||||||
|
start, end);
|
||||||
|
for (ContourLine cln : newLines) {
|
||||||
|
cln.setParent(newContours);
|
||||||
|
newContours.add(cln);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
newAdc.setParent(newContours);
|
||||||
|
newContours.add(newAdc);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
newContours.update(this);
|
||||||
|
|
||||||
|
return newContours;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the string
|
||||||
|
*/
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder result = new StringBuilder(getClass().getSimpleName());
|
||||||
|
|
||||||
result.append("Category:\t" + pgenCategory + "\n");
|
result.append("Category:\t" + pgenCategory + "\n");
|
||||||
result.append("Type:\t" + pgenType + "\n");
|
result.append("Type:\t" + pgenType + "\n");
|
||||||
|
@ -248,74 +262,77 @@ public class Contours extends DECollection implements IContours {
|
||||||
result.append("Time1:\t" + time1 + "\n");
|
result.append("Time1:\t" + time1 + "\n");
|
||||||
result.append("Time2:\t" + time2 + "\n");
|
result.append("Time2:\t" + time2 + "\n");
|
||||||
|
|
||||||
return result.toString();
|
return result.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a list of all ContourLines
|
* @return a list of all ContourLines
|
||||||
*/
|
*/
|
||||||
public ArrayList<ContourLine> getContourLines() {
|
public ArrayList<ContourLine> getContourLines() {
|
||||||
|
|
||||||
ArrayList<ContourLine> lines = new ArrayList<ContourLine>();
|
ArrayList<ContourLine> lines = new ArrayList<ContourLine>();
|
||||||
|
|
||||||
Iterator<AbstractDrawableComponent> iterator = this.getComponentIterator();
|
Iterator<AbstractDrawableComponent> iterator = this
|
||||||
|
.getComponentIterator();
|
||||||
|
|
||||||
while ( iterator.hasNext() ) {
|
while (iterator.hasNext()) {
|
||||||
AbstractDrawableComponent adc = iterator.next();
|
AbstractDrawableComponent adc = iterator.next();
|
||||||
if ( adc instanceof ContourLine ) {
|
if (adc instanceof ContourLine) {
|
||||||
lines.add( (ContourLine)adc );
|
lines.add((ContourLine) adc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return lines;
|
return lines;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a list of all ContourMinmaxs
|
* @return a list of all ContourMinmaxs
|
||||||
*/
|
*/
|
||||||
public ArrayList<ContourMinmax> getContourMinmaxs() {
|
public ArrayList<ContourMinmax> getContourMinmaxs() {
|
||||||
|
|
||||||
ArrayList<ContourMinmax> cmms = new ArrayList<ContourMinmax>();
|
ArrayList<ContourMinmax> cmms = new ArrayList<ContourMinmax>();
|
||||||
|
|
||||||
Iterator<AbstractDrawableComponent> iterator = this.getComponentIterator();
|
Iterator<AbstractDrawableComponent> iterator = this
|
||||||
|
.getComponentIterator();
|
||||||
|
|
||||||
while ( iterator.hasNext() ) {
|
while (iterator.hasNext()) {
|
||||||
AbstractDrawableComponent adc = iterator.next();
|
AbstractDrawableComponent adc = iterator.next();
|
||||||
if ( adc instanceof ContourMinmax ) {
|
if (adc instanceof ContourMinmax) {
|
||||||
cmms.add( (ContourMinmax)adc );
|
cmms.add((ContourMinmax) adc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return cmms;
|
return cmms;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a list of all ContourCircles
|
* @return a list of all ContourCircles
|
||||||
*/
|
*/
|
||||||
public ArrayList<ContourCircle> getContourCircles() {
|
public ArrayList<ContourCircle> getContourCircles() {
|
||||||
|
|
||||||
ArrayList<ContourCircle> cmms = new ArrayList<ContourCircle>();
|
ArrayList<ContourCircle> cmms = new ArrayList<ContourCircle>();
|
||||||
|
|
||||||
Iterator<AbstractDrawableComponent> iterator = this.getComponentIterator();
|
Iterator<AbstractDrawableComponent> iterator = this
|
||||||
|
.getComponentIterator();
|
||||||
|
|
||||||
while ( iterator.hasNext() ) {
|
while (iterator.hasNext()) {
|
||||||
AbstractDrawableComponent adc = iterator.next();
|
AbstractDrawableComponent adc = iterator.next();
|
||||||
if ( adc instanceof ContourCircle) {
|
if (adc instanceof ContourCircle) {
|
||||||
cmms.add( (ContourCircle)adc );
|
cmms.add((ContourCircle) adc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return cmms;
|
return cmms;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a new Contours from a set of lines generated from a grid.
|
* @return a new Contours from a set of lines generated from a grid.
|
||||||
*/
|
*/
|
||||||
public Contours createContours( int nContours, int[] nContourPts,
|
public Contours createContours(int nContours, int[] nContourPts,
|
||||||
double[] latlons, float[] contourValue, Color clr ) {
|
double[] latlons, float[] contourValue, Color clr) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create a new Contours element from the contour lines
|
* Create a new Contours element from the contour lines
|
||||||
|
@ -323,41 +340,42 @@ public class Contours extends DECollection implements IContours {
|
||||||
Contours gridContours = this.copy();
|
Contours gridContours = this.copy();
|
||||||
gridContours.clear();
|
gridContours.clear();
|
||||||
|
|
||||||
int tPts = 0;
|
int tPts = 0;
|
||||||
ArrayList<Coordinate> linePts = new ArrayList<Coordinate>();
|
ArrayList<Coordinate> linePts = new ArrayList<Coordinate>();
|
||||||
for ( int mm = 0; mm < nContours; mm++ ) {
|
for (int mm = 0; mm < nContours; mm++) {
|
||||||
|
|
||||||
for ( int nn = 0; nn < nContourPts[ mm ]; nn++ ) {
|
for (int nn = 0; nn < nContourPts[mm]; nn++) {
|
||||||
Coordinate point = new Coordinate();
|
Coordinate point = new Coordinate();
|
||||||
point.x = latlons[ tPts + nn*2 ];
|
point.x = latlons[tPts + nn * 2];
|
||||||
point.y = latlons[ tPts + nn*2 + 1 ];
|
point.y = latlons[tPts + nn * 2 + 1];
|
||||||
|
|
||||||
linePts.add( point );
|
linePts.add(point);
|
||||||
}
|
}
|
||||||
|
|
||||||
tPts = tPts + nContourPts[ mm ] * 2;
|
tPts = tPts + nContourPts[mm] * 2;
|
||||||
|
|
||||||
int nLabels = 2;
|
int nLabels = 2;
|
||||||
ContourLine cline = new ContourLine( linePts, false,
|
ContourLine cline = new ContourLine(linePts, false,
|
||||||
new String[]{ "" + contourValue[ mm ] }, nLabels );
|
new String[] { "" + contourValue[mm] }, nLabels);
|
||||||
|
|
||||||
cline.setParent( gridContours );
|
cline.setParent(gridContours);
|
||||||
if ( clr != null ) cline.getLine().setColors( new Color[]{ clr } );
|
if (clr != null)
|
||||||
cline.getLine().setLineWidth( 2 );
|
cline.getLine().setColors(new Color[] { clr });
|
||||||
gridContours.add( cline );
|
cline.getLine().setLineWidth(2);
|
||||||
|
gridContours.add(cline);
|
||||||
|
|
||||||
linePts.clear();
|
linePts.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
return gridContours;
|
return gridContours;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a new Contours from a set of lines generated from a grid.
|
* @return a new Contours from a set of lines generated from a grid.
|
||||||
*/
|
*/
|
||||||
public Contours createContours( int nContours, int[] nContourPts,
|
public Contours createContours(int nContours, int[] nContourPts,
|
||||||
double[] latlons, String[] contourValue, Color clr ) {
|
double[] latlons, String[] contourValue, Color clr) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create a new Contours element from the contour lines
|
* Create a new Contours element from the contour lines
|
||||||
|
@ -365,71 +383,91 @@ public class Contours extends DECollection implements IContours {
|
||||||
Contours gridContours = this.copy();
|
Contours gridContours = this.copy();
|
||||||
gridContours.clear();
|
gridContours.clear();
|
||||||
|
|
||||||
int tPts = 0;
|
int tPts = 0;
|
||||||
ArrayList<Coordinate> linePts = new ArrayList<Coordinate>();
|
ArrayList<Coordinate> linePts = new ArrayList<Coordinate>();
|
||||||
for ( int mm = 0; mm < nContours; mm++ ) {
|
for (int mm = 0; mm < nContours; mm++) {
|
||||||
|
|
||||||
for ( int nn = 0; nn < nContourPts[ mm ]; nn++ ) {
|
for (int nn = 0; nn < nContourPts[mm]; nn++) {
|
||||||
Coordinate point = new Coordinate();
|
Coordinate point = new Coordinate();
|
||||||
point.x = latlons[ tPts + nn*2 ];
|
point.x = latlons[tPts + nn * 2];
|
||||||
point.y = latlons[ tPts + nn*2 + 1 ];
|
point.y = latlons[tPts + nn * 2 + 1];
|
||||||
|
|
||||||
linePts.add( point );
|
linePts.add(point);
|
||||||
}
|
}
|
||||||
|
|
||||||
tPts = tPts + nContourPts[ mm ] * 2;
|
tPts = tPts + nContourPts[mm] * 2;
|
||||||
|
|
||||||
int nLabels = 2;
|
int nLabels = 2;
|
||||||
ContourLine cline = new ContourLine( linePts, false,
|
ContourLine cline = new ContourLine(linePts, false,
|
||||||
new String[]{ contourValue[ mm ] }, nLabels );
|
new String[] { contourValue[mm] }, nLabels);
|
||||||
|
|
||||||
cline.setParent( gridContours );
|
cline.setParent(gridContours);
|
||||||
if ( clr != null ) cline.getLine().setColors( new Color[]{ clr } );
|
if (clr != null)
|
||||||
cline.getLine().setLineWidth( 2 );
|
cline.getLine().setColors(new Color[] { clr });
|
||||||
gridContours.add( cline );
|
cline.getLine().setLineWidth(2);
|
||||||
|
gridContours.add(cline);
|
||||||
|
|
||||||
linePts.clear();
|
linePts.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
return gridContours;
|
return gridContours;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Split a contour line in a Contours - using coordinate
|
* Split a contour line in a Contours - using coordinate
|
||||||
*/
|
*/
|
||||||
public Contours split( ContourLine cline, Coordinate start, Coordinate end ) {
|
public Contours split(ContourLine cline, Coordinate start, Coordinate end) {
|
||||||
|
|
||||||
Contours newContours = new Contours();
|
Contours newContours = new Contours();
|
||||||
|
|
||||||
Iterator<AbstractDrawableComponent> iterator = this.getComponentIterator();
|
Iterator<AbstractDrawableComponent> iterator = this
|
||||||
|
.getComponentIterator();
|
||||||
|
|
||||||
while ( iterator.hasNext() ) {
|
while (iterator.hasNext()) {
|
||||||
|
|
||||||
AbstractDrawableComponent oldAdc = iterator.next();
|
AbstractDrawableComponent oldAdc = iterator.next();
|
||||||
AbstractDrawableComponent newAdc = oldAdc.copy();
|
AbstractDrawableComponent newAdc = oldAdc.copy();
|
||||||
|
|
||||||
if ( oldAdc.equals( cline ) ) {
|
if (oldAdc.equals(cline)) {
|
||||||
ArrayList<ContourLine> newLines = ((ContourLine)newAdc).split( start, end );
|
ArrayList<ContourLine> newLines = ((ContourLine) newAdc).split(
|
||||||
for ( ContourLine cln : newLines ) {
|
start, end);
|
||||||
cln.setParent( newContours );
|
for (ContourLine cln : newLines) {
|
||||||
newContours.add( cln );
|
cln.setParent(newContours);
|
||||||
|
newContours.add(cln);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
newAdc.setParent(newContours);
|
||||||
newAdc.setParent( newContours );
|
newContours.add(newAdc);
|
||||||
newContours.add( newAdc );
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
newContours.update( this );
|
newContours.update(this);
|
||||||
|
|
||||||
return newContours;
|
return newContours;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Form a key that could be used to ID this contour
|
||||||
|
*/
|
||||||
|
public String getKey() {
|
||||||
|
return getKey(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Form a key that could be used to ID a given contour
|
||||||
|
*/
|
||||||
|
public static String getKey(IContours ctr) {
|
||||||
|
String key = ctr.getParm() + "," + ctr.getLevel() + ","
|
||||||
|
+ ctr.getForecastHour() + "|"
|
||||||
|
+ ctr.getTime1().get(Calendar.YEAR) + "-"
|
||||||
|
+ (ctr.getTime1().get(Calendar.MONTH) + 1) + "-"
|
||||||
|
+ ctr.getTime1().get(Calendar.DAY_OF_MONTH) + ","
|
||||||
|
+ ctr.getTime1().get(Calendar.HOUR_OF_DAY) + ":"
|
||||||
|
+ ctr.getTime1().get(Calendar.MINUTE) + "Z";
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,8 @@ import gov.noaa.nws.ncep.ui.pgen.store.StorageUtils;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.tools.PgenSnapJet;
|
import gov.noaa.nws.ncep.ui.pgen.tools.PgenSnapJet;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
@ -69,6 +71,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- -----------------------------------
|
* ------------ ---------- ----------- -----------------------------------
|
||||||
* 03/13 #977 S.gilbert Modified from PgenFileManageDialog1
|
* 03/13 #977 S.gilbert Modified from PgenFileManageDialog1
|
||||||
|
* 01/2014 #1105 jwu Ues "subtype" for query as well.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -85,6 +88,10 @@ public class RetrieveActivityDialog extends CaveJFACEDialog {
|
||||||
class ActivityElement {
|
class ActivityElement {
|
||||||
String dataURI;
|
String dataURI;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This will be a combo of "Product"'s activity type/subtype in format
|
||||||
|
* of type(subtype).
|
||||||
|
*/
|
||||||
String activityType;
|
String activityType;
|
||||||
|
|
||||||
String activityLabel;
|
String activityLabel;
|
||||||
|
@ -119,6 +126,10 @@ public class RetrieveActivityDialog extends CaveJFACEDialog {
|
||||||
|
|
||||||
private ListViewer fileListViewer = null;
|
private ListViewer fileListViewer = null;
|
||||||
|
|
||||||
|
private Button listLatestBtn = null;
|
||||||
|
|
||||||
|
private Button listAllBtn = null;
|
||||||
|
|
||||||
private Button browseBtn = null;
|
private Button browseBtn = null;
|
||||||
|
|
||||||
private Button autoSaveOffBtn = null;
|
private Button autoSaveOffBtn = null;
|
||||||
|
@ -173,7 +184,7 @@ public class RetrieveActivityDialog extends CaveJFACEDialog {
|
||||||
private void setTitle(String btnName) {
|
private void setTitle(String btnName) {
|
||||||
|
|
||||||
if (btnName.equals("Open")) {
|
if (btnName.equals("Open")) {
|
||||||
title = "Rretrive a PGEN Activity";
|
title = "Retrieve a PGEN Activity";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -285,16 +296,18 @@ public class RetrieveActivityDialog extends CaveJFACEDialog {
|
||||||
|
|
||||||
dirList.addListener(SWT.Selection, new Listener() {
|
dirList.addListener(SWT.Selection, new Listener() {
|
||||||
public void handleEvent(Event e) {
|
public void handleEvent(Event e) {
|
||||||
if (dirList.getSelectionCount() > 0) {
|
listActivities();
|
||||||
|
/*
|
||||||
selectedDir = dirList.getSelection()[0];
|
* if (dirList.getSelectionCount() > 0) {
|
||||||
fileListViewer.setInput(activityMap.get(selectedDir));
|
*
|
||||||
fileListViewer.getList().setToolTipText(null);
|
* selectedDir = dirList.getSelection()[0];
|
||||||
fileListViewer.refresh();
|
* fileListViewer.setInput(activityMap.get(selectedDir));
|
||||||
|
* fileListViewer.getList().setToolTipText(null);
|
||||||
// Update the full file name with the new path
|
* fileListViewer.refresh();
|
||||||
fullName = null;
|
*
|
||||||
}
|
* // Update the full file name with the new path fullName =
|
||||||
|
* null; }
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -310,6 +323,33 @@ public class RetrieveActivityDialog extends CaveJFACEDialog {
|
||||||
|
|
||||||
fileLbl.setLayoutData(layoutData8);
|
fileLbl.setLayoutData(layoutData8);
|
||||||
|
|
||||||
|
listLatestBtn = new Button(topForm, SWT.RADIO);
|
||||||
|
listLatestBtn.setText("Latest");
|
||||||
|
listLatestBtn.setSelection(true);
|
||||||
|
|
||||||
|
FormData layoutData20 = new FormData();
|
||||||
|
layoutData20.top = new FormAttachment(dirList, 20, SWT.BOTTOM);
|
||||||
|
layoutData20.left = new FormAttachment(fileLbl, 10, SWT.RIGHT);
|
||||||
|
listLatestBtn.setLayoutData(layoutData20);
|
||||||
|
listLatestBtn.addSelectionListener(new SelectionAdapter() {
|
||||||
|
public void widgetSelected(SelectionEvent ev) {
|
||||||
|
listActivities();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
listAllBtn = new Button(topForm, SWT.RADIO);
|
||||||
|
listAllBtn.setText("All");
|
||||||
|
|
||||||
|
FormData layoutData21 = new FormData();
|
||||||
|
layoutData21.top = new FormAttachment(dirList, 20, SWT.BOTTOM);
|
||||||
|
layoutData21.left = new FormAttachment(listLatestBtn, 10, SWT.RIGHT);
|
||||||
|
listAllBtn.setLayoutData(layoutData21);
|
||||||
|
listAllBtn.addSelectionListener(new SelectionAdapter() {
|
||||||
|
public void widgetSelected(SelectionEvent ev) {
|
||||||
|
listActivities();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
fileListViewer = new ListViewer(topForm, SWT.SINGLE | SWT.BORDER
|
fileListViewer = new ListViewer(topForm, SWT.SINGLE | SWT.BORDER
|
||||||
| SWT.V_SCROLL);
|
| SWT.V_SCROLL);
|
||||||
|
|
||||||
|
@ -414,6 +454,7 @@ public class RetrieveActivityDialog extends CaveJFACEDialog {
|
||||||
DbQueryRequest request = new DbQueryRequest();
|
DbQueryRequest request = new DbQueryRequest();
|
||||||
request.setEntityClass(PgenRecord.class.getName());
|
request.setEntityClass(PgenRecord.class.getName());
|
||||||
request.addRequestField(PgenRecord.ACTIVITY_TYPE);
|
request.addRequestField(PgenRecord.ACTIVITY_TYPE);
|
||||||
|
request.addRequestField(PgenRecord.ACTIVITY_SUBTYPE);
|
||||||
request.addRequestField(PgenRecord.ACTIVITY_LABEL);
|
request.addRequestField(PgenRecord.ACTIVITY_LABEL);
|
||||||
request.addRequestField(PgenRecord.DATAURI);
|
request.addRequestField(PgenRecord.DATAURI);
|
||||||
request.addRequestField(PgenRecord.REF_TIME);
|
request.addRequestField(PgenRecord.REF_TIME);
|
||||||
|
@ -426,6 +467,15 @@ public class RetrieveActivityDialog extends CaveJFACEDialog {
|
||||||
ActivityElement elem = new ActivityElement();
|
ActivityElement elem = new ActivityElement();
|
||||||
elem.activityType = (String) result
|
elem.activityType = (String) result
|
||||||
.get(PgenRecord.ACTIVITY_TYPE);
|
.get(PgenRecord.ACTIVITY_TYPE);
|
||||||
|
|
||||||
|
if (result.get(PgenRecord.ACTIVITY_SUBTYPE) != null) {
|
||||||
|
String subtype = (String) result
|
||||||
|
.get(PgenRecord.ACTIVITY_SUBTYPE);
|
||||||
|
if (!subtype.isEmpty() && !subtype.equalsIgnoreCase("NONE")) {
|
||||||
|
elem.activityType += "(" + subtype + ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
elem.activityLabel = (String) result
|
elem.activityLabel = (String) result
|
||||||
.get(PgenRecord.ACTIVITY_LABEL);
|
.get(PgenRecord.ACTIVITY_LABEL);
|
||||||
elem.dataURI = (String) result.get(PgenRecord.DATAURI);
|
elem.dataURI = (String) result.get(PgenRecord.DATAURI);
|
||||||
|
@ -692,4 +742,51 @@ public class RetrieveActivityDialog extends CaveJFACEDialog {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List all activities for an activity type/subtype or just the latest ones.
|
||||||
|
*/
|
||||||
|
private void listActivities() {
|
||||||
|
|
||||||
|
boolean listLatest = listLatestBtn.getSelection();
|
||||||
|
if (dirList.getSelectionCount() > 0) {
|
||||||
|
|
||||||
|
selectedDir = dirList.getSelection()[0];
|
||||||
|
java.util.List<ActivityElement> elems = activityMap
|
||||||
|
.get(selectedDir);
|
||||||
|
|
||||||
|
java.util.List<ActivityElement> filterElms = new ArrayList<ActivityElement>();
|
||||||
|
|
||||||
|
if (elems.size() > 0) {
|
||||||
|
if (listLatest) {
|
||||||
|
|
||||||
|
// Sort all entries based on time, latest first.
|
||||||
|
Collections.sort(elems, new Comparator<ActivityElement>() {
|
||||||
|
@Override
|
||||||
|
public int compare(ActivityElement ae1,
|
||||||
|
ActivityElement ae2) {
|
||||||
|
return -1 * ae1.refTime.compareTo(ae2.refTime);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Pick unique labels.
|
||||||
|
java.util.List<String> actLbls = new ArrayList<String>();
|
||||||
|
for (ActivityElement ae : elems) {
|
||||||
|
if (!actLbls.contains(ae.activityLabel)) {
|
||||||
|
actLbls.add(ae.activityLabel);
|
||||||
|
filterElms.add(ae);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
filterElms.addAll(elems);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fileListViewer.setInput(filterElms);
|
||||||
|
fileListViewer.getList().setToolTipText(null);
|
||||||
|
fileListViewer.refresh();
|
||||||
|
|
||||||
|
// Update the full file name with the new path
|
||||||
|
fullName = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -15,6 +15,7 @@ import gov.noaa.nws.ncep.ui.pgen.rsc.PgenResource;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.store.PgenStorageException;
|
import gov.noaa.nws.ncep.ui.pgen.store.PgenStorageException;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.store.StorageUtils;
|
import gov.noaa.nws.ncep.ui.pgen.store.StorageUtils;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
|
@ -24,16 +25,18 @@ import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
import org.eclipse.swt.widgets.Button;
|
import org.eclipse.swt.widgets.Button;
|
||||||
|
import org.eclipse.swt.widgets.Combo;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Control;
|
import org.eclipse.swt.widgets.Control;
|
||||||
import org.eclipse.swt.widgets.DateTime;
|
import org.eclipse.swt.widgets.DateTime;
|
||||||
import org.eclipse.swt.widgets.Group;
|
|
||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.swt.widgets.Text;
|
import org.eclipse.swt.widgets.Text;
|
||||||
import org.eclipse.ui.PlatformUI;
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
||||||
import com.raytheon.uf.viz.core.exception.VizException;
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
|
import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
||||||
import com.raytheon.viz.core.mode.CAVEMode;
|
import com.raytheon.viz.core.mode.CAVEMode;
|
||||||
import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
||||||
|
|
||||||
|
@ -45,6 +48,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- -----------------------------------
|
* ------------ ---------- ----------- -----------------------------------
|
||||||
* 03/13 #977 S. Gilbert Initial creation
|
* 03/13 #977 S. Gilbert Initial creation
|
||||||
|
* 01/14 #1105 J. Wu Pre-fill for each activity info.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -83,7 +87,7 @@ public class StoreActivityDialog extends CaveJFACEDialog {
|
||||||
|
|
||||||
private Text forecasterText = null;
|
private Text forecasterText = null;
|
||||||
|
|
||||||
private Text modeText;
|
private Combo modeCombo;
|
||||||
|
|
||||||
private Text statusText;
|
private Text statusText;
|
||||||
|
|
||||||
|
@ -99,7 +103,7 @@ public class StoreActivityDialog extends CaveJFACEDialog {
|
||||||
|
|
||||||
private Product activity;
|
private Product activity;
|
||||||
|
|
||||||
private Text messageText;
|
// private Text messageText;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -120,11 +124,11 @@ public class StoreActivityDialog extends CaveJFACEDialog {
|
||||||
private void setStoreMode(String btnName) {
|
private void setStoreMode(String btnName) {
|
||||||
|
|
||||||
if (btnName.equals("Open")) {
|
if (btnName.equals("Open")) {
|
||||||
title = "Open a PGEN Product file";
|
title = "Open a PGEN Activity file";
|
||||||
} else if (btnName.equals("Save") || btnName.equals("Save All")) {
|
} else if (btnName.equals("Save") || btnName.equals("Save All")) {
|
||||||
title = "Save the PGEN Product";
|
title = "Save the PGEN Activity";
|
||||||
} else if (btnName.equals("Save As")) {
|
} else if (btnName.equals("Save As")) {
|
||||||
title = "Save the PGEN Product as";
|
title = "Save the PGEN Activity as";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -185,9 +189,10 @@ public class StoreActivityDialog extends CaveJFACEDialog {
|
||||||
/*
|
/*
|
||||||
* Initialize the Message Area
|
* Initialize the Message Area
|
||||||
*/
|
*/
|
||||||
Group g4 = new Group(dlgAreaForm, SWT.NONE);
|
/*
|
||||||
g4.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
* Group g4 = new Group(dlgAreaForm, SWT.NONE); g4.setLayoutData(new
|
||||||
createMessageArea(g4);
|
* GridData(GridData.FILL_HORIZONTAL)); createMessageArea(g4);
|
||||||
|
*/
|
||||||
|
|
||||||
setDialogFields();
|
setDialogFields();
|
||||||
return dlgAreaForm;
|
return dlgAreaForm;
|
||||||
|
@ -199,58 +204,84 @@ public class StoreActivityDialog extends CaveJFACEDialog {
|
||||||
GridData gdata = new GridData(SWT.FILL, SWT.CENTER, true, false);
|
GridData gdata = new GridData(SWT.FILL, SWT.CENTER, true, false);
|
||||||
|
|
||||||
Label infoLabel = new Label(g1, SWT.NONE);
|
Label infoLabel = new Label(g1, SWT.NONE);
|
||||||
infoLabel.setText("Activity Label:");
|
infoLabel.setText("Activity Label*:");
|
||||||
|
|
||||||
infoText = new Text(g1, SWT.NONE);
|
infoText = new Text(g1, SWT.NONE);
|
||||||
infoText.setLayoutData(gdata);
|
infoText.setLayoutData(gdata);
|
||||||
|
infoText.setToolTipText("Input a file name - required.");
|
||||||
|
|
||||||
Label nameLabel = new Label(g1, SWT.NONE);
|
Label nameLabel = new Label(g1, SWT.NONE);
|
||||||
nameLabel.setText("Activity Name:");
|
nameLabel.setText("Activity Name*:");
|
||||||
|
|
||||||
nameText = new Text(g1, SWT.NONE);
|
nameText = new Text(g1, SWT.NONE);
|
||||||
nameText.setLayoutData(gdata);
|
nameText.setLayoutData(gdata);
|
||||||
|
nameText.setToolTipText("Alias for this activity, just like your first name while activity "
|
||||||
|
+ "type/subtype is the last name. Leave it as is");
|
||||||
|
|
||||||
Label typeLabel = new Label(g1, SWT.NONE);
|
Label typeLabel = new Label(g1, SWT.NONE);
|
||||||
typeLabel.setText("Activity Type:");
|
typeLabel.setText("Activity Type*:");
|
||||||
|
typeLabel.setEnabled(false);
|
||||||
|
|
||||||
typeText = new Text(g1, SWT.NONE);
|
typeText = new Text(g1, SWT.NONE);
|
||||||
typeText.setLayoutData(gdata);
|
typeText.setLayoutData(gdata);
|
||||||
|
typeText.setEditable(false);
|
||||||
|
typeText.setToolTipText("Activity type as defined. Leave it as is");
|
||||||
|
|
||||||
Label subtypeLabel = new Label(g1, SWT.NONE);
|
Label subtypeLabel = new Label(g1, SWT.NONE);
|
||||||
subtypeLabel.setText("Activity Subtype:");
|
subtypeLabel.setText("Activity Subtype*:");
|
||||||
|
subtypeLabel.setEnabled(false);
|
||||||
|
|
||||||
subtypeText = new Text(g1, SWT.NONE);
|
subtypeText = new Text(g1, SWT.NONE);
|
||||||
subtypeText.setLayoutData(gdata);
|
subtypeText.setLayoutData(gdata);
|
||||||
|
subtypeText.setEditable(false);
|
||||||
|
subtypeText
|
||||||
|
.setToolTipText("Activity subtype as defined. Leave it as is");
|
||||||
|
|
||||||
Label siteLabel = new Label(g1, SWT.NONE);
|
Label siteLabel = new Label(g1, SWT.NONE);
|
||||||
siteLabel.setText("Site:");
|
siteLabel.setText("Site*:");
|
||||||
|
siteLabel.setEnabled(false);
|
||||||
|
|
||||||
siteText = new Text(g1, SWT.NONE);
|
siteText = new Text(g1, SWT.NONE);
|
||||||
siteText.setLayoutData(gdata);
|
siteText.setLayoutData(gdata);
|
||||||
|
siteText.setEditable(false);
|
||||||
|
siteText.setToolTipText("Site defined in localization. Leave it as is");
|
||||||
|
|
||||||
Label deskLabel = new Label(g1, SWT.NONE);
|
Label deskLabel = new Label(g1, SWT.NONE);
|
||||||
deskLabel.setText("Desk:");
|
deskLabel.setText("Desk:");
|
||||||
|
deskLabel.setEnabled(false);
|
||||||
|
|
||||||
deskText = new Text(g1, SWT.NONE);
|
deskText = new Text(g1, SWT.NONE);
|
||||||
deskText.setLayoutData(gdata);
|
deskText.setLayoutData(gdata);
|
||||||
|
deskText.setEditable(false);
|
||||||
|
deskText.setToolTipText("Desk defined in localization or set when starting CAVE. Leave it as is");
|
||||||
|
|
||||||
Label forecasterLabel = new Label(g1, SWT.NONE);
|
Label forecasterLabel = new Label(g1, SWT.NONE);
|
||||||
forecasterLabel.setText("Forecaster:");
|
forecasterLabel.setText("Forecaster:");
|
||||||
|
|
||||||
forecasterText = new Text(g1, SWT.NONE);
|
forecasterText = new Text(g1, SWT.NONE);
|
||||||
forecasterText.setLayoutData(gdata);
|
forecasterText.setLayoutData(gdata);
|
||||||
|
forecasterText
|
||||||
|
.setToolTipText("Forecaster's name, default is your user name, not required");
|
||||||
|
|
||||||
Label modeLabel = new Label(g1, SWT.NONE);
|
Label modeLabel = new Label(g1, SWT.NONE);
|
||||||
modeLabel.setText("Operating Mode:");
|
modeLabel.setText("Operating Mode:");
|
||||||
|
|
||||||
modeText = new Text(g1, SWT.NONE);
|
modeCombo = new Combo(g1, SWT.DROP_DOWN | SWT.READ_ONLY);
|
||||||
modeText.setLayoutData(gdata);
|
|
||||||
|
for (CAVEMode cm : CAVEMode.values()) {
|
||||||
|
modeCombo.add(cm.name());
|
||||||
|
}
|
||||||
|
|
||||||
|
modeCombo.select(0);
|
||||||
|
modeCombo
|
||||||
|
.setToolTipText("CAVE mode set at starting, or pick one here.");
|
||||||
|
|
||||||
Label statusLabel = new Label(g1, SWT.NONE);
|
Label statusLabel = new Label(g1, SWT.NONE);
|
||||||
statusLabel.setText("Activity Status:");
|
statusLabel.setText("Activity Status:");
|
||||||
|
|
||||||
statusText = new Text(g1, SWT.NONE);
|
statusText = new Text(g1, SWT.NONE);
|
||||||
statusText.setLayoutData(gdata);
|
statusText.setLayoutData(gdata);
|
||||||
|
statusText.setToolTipText("Activity status, not in use yet.");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,11 +290,20 @@ public class StoreActivityDialog extends CaveJFACEDialog {
|
||||||
g2.setLayout(new GridLayout(4, false));
|
g2.setLayout(new GridLayout(4, false));
|
||||||
|
|
||||||
Label refTimeLabel = new Label(g2, SWT.NONE);
|
Label refTimeLabel = new Label(g2, SWT.NONE);
|
||||||
refTimeLabel.setText("Ref Time:");
|
refTimeLabel.setText("Ref Time*:");
|
||||||
|
|
||||||
validDate = new DateTime(g2, SWT.BORDER | SWT.DATE);
|
validDate = new DateTime(g2, SWT.BORDER | SWT.DATE);
|
||||||
|
|
||||||
|
validDate
|
||||||
|
.setToolTipText("Activity's reference date, changing it and saving the "
|
||||||
|
+ "activity will save the current activity as a new entry in PGEN DB.");
|
||||||
|
|
||||||
validTime = new DateTime(g2, SWT.BORDER | SWT.TIME | SWT.SHORT);
|
validTime = new DateTime(g2, SWT.BORDER | SWT.TIME | SWT.SHORT);
|
||||||
|
|
||||||
|
validTime
|
||||||
|
.setToolTipText("Activity's reference time, changing it and saving the "
|
||||||
|
+ "activity will save the current activity as a new entry in PGEN DB.");
|
||||||
|
|
||||||
Label utcLabel = new Label(g2, SWT.NONE);
|
Label utcLabel = new Label(g2, SWT.NONE);
|
||||||
utcLabel.setText("UTC");
|
utcLabel.setText("UTC");
|
||||||
|
|
||||||
|
@ -285,15 +325,14 @@ public class StoreActivityDialog extends CaveJFACEDialog {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createMessageArea(Composite g4) {
|
/*
|
||||||
g4.setLayout(new GridLayout(1, true));
|
* private void createMessageArea(Composite g4) { g4.setLayout(new
|
||||||
GridData gdata = new GridData(SWT.FILL, SWT.CENTER, true, false);
|
* GridLayout(1, true)); GridData gdata = new GridData(SWT.FILL, SWT.CENTER,
|
||||||
|
* true, false);
|
||||||
messageText = new Text(g4, SWT.MULTI | SWT.READ_ONLY | SWT.H_SCROLL
|
*
|
||||||
| SWT.V_SCROLL);
|
* messageText = new Text(g4, SWT.MULTI | SWT.READ_ONLY | SWT.H_SCROLL |
|
||||||
messageText.setLayoutData(gdata);
|
* SWT.V_SCROLL); messageText.setLayoutData(gdata); }
|
||||||
}
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save/Cancel button for "Save" a product file.
|
* Save/Cancel button for "Save" a product file.
|
||||||
*/
|
*/
|
||||||
|
@ -318,17 +357,63 @@ public class StoreActivityDialog extends CaveJFACEDialog {
|
||||||
|
|
||||||
private void setDialogFields() {
|
private void setDialogFields() {
|
||||||
|
|
||||||
if (activity.getOutputFile() != null)
|
if (activity.getOutputFile() != null) {
|
||||||
infoText.setText(activity.getOutputFile());
|
infoText.setText(activity.getOutputFile());
|
||||||
|
} else {
|
||||||
|
String filename = PgenSession.getInstance().getPgenResource()
|
||||||
|
.buildFileName(activity);
|
||||||
|
filename = filename
|
||||||
|
.substring(filename.lastIndexOf(File.separator) + 1);
|
||||||
|
// filename = filename.replace(".xml", ""); // remove ending ".xml"
|
||||||
|
|
||||||
|
infoText.setText(filename);
|
||||||
|
}
|
||||||
|
|
||||||
if (activity.getName() != null)
|
if (activity.getName() != null)
|
||||||
nameText.setText(activity.getName());
|
nameText.setText(activity.getName());
|
||||||
if (activity.getType() != null)
|
|
||||||
typeText.setText(activity.getType());
|
/*
|
||||||
if (activity.getCenter() != null)
|
* Activity type/subtype is stored in Product as "type(subtype)", so we
|
||||||
siteText.setText(activity.getCenter());
|
* need to split it up here.
|
||||||
if (activity.getForecaster() != null)
|
*/
|
||||||
forecasterText.setText(activity.getForecaster());
|
String type = activity.getType();
|
||||||
modeText.setText(CAVEMode.getMode().name());
|
if (type != null) {
|
||||||
|
int loc1 = type.indexOf("(");
|
||||||
|
if (loc1 > 0) {
|
||||||
|
typeText.setText(type.substring(0, loc1));
|
||||||
|
String subtype = type.substring(loc1 + 1).replace(")", "");
|
||||||
|
if (subtype.length() > 0 && !subtype.equalsIgnoreCase("NONE"))
|
||||||
|
subtypeText.setText(subtype);
|
||||||
|
} else {
|
||||||
|
typeText.setText(type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
siteText.setText(PgenUtil.getCurrentOffice());
|
||||||
|
|
||||||
|
// get the desk info.
|
||||||
|
String desk = LocalizationManager.getContextName(LocalizationLevel
|
||||||
|
.valueOf("DESK"));
|
||||||
|
|
||||||
|
if (desk != null && !desk.equalsIgnoreCase("none")) {
|
||||||
|
deskText.setText(desk);
|
||||||
|
}
|
||||||
|
|
||||||
|
forecasterText.setText(System.getProperty("user.name"));
|
||||||
|
|
||||||
|
// Select the cave mode.
|
||||||
|
String mode = CAVEMode.getMode().name();
|
||||||
|
int index = 0;
|
||||||
|
int ii = 0;
|
||||||
|
for (String md : modeCombo.getItems()) {
|
||||||
|
if (md.equals(mode)) {
|
||||||
|
index = ii;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ii++;
|
||||||
|
}
|
||||||
|
modeCombo.select(index);
|
||||||
|
|
||||||
statusText.setText("Unknown");
|
statusText.setText("Unknown");
|
||||||
|
|
||||||
Calendar datetime = activity.getTime().getStartTime();
|
Calendar datetime = activity.getTime().getStartTime();
|
||||||
|
@ -369,28 +454,34 @@ public class StoreActivityDialog extends CaveJFACEDialog {
|
||||||
|
|
||||||
// PgenSession.getInstance().getPgenPalette().setActiveIcon("Select");
|
// PgenSession.getInstance().getPgenPalette().setActiveIcon("Select");
|
||||||
|
|
||||||
activity.setInputFile(activityLabel);
|
// activity.setInputFile(activityLabel);
|
||||||
activity.setOutputFile(activityLabel);
|
// activity.setOutputFile(activityLabel);
|
||||||
|
|
||||||
ActivityInfo info = getActivityInfo();
|
ActivityInfo info = getActivityInfo();
|
||||||
messageText.setText("Sending Activity...");
|
activity.setInputFile(info.getActivityLabel());
|
||||||
messageText.setBackground(shell.getDisplay().getSystemColor(
|
activity.setOutputFile(info.getActivityLabel());
|
||||||
SWT.COLOR_WIDGET_BACKGROUND));
|
activity.setCenter(info.getSite());
|
||||||
messageText.redraw();
|
activity.setForecaster(info.getForecaster());
|
||||||
|
|
||||||
|
/*
|
||||||
|
* messageText.setText("Sending Activity...");
|
||||||
|
* messageText.setBackground(shell.getDisplay().getSystemColor(
|
||||||
|
* SWT.COLOR_WIDGET_BACKGROUND)); messageText.redraw();
|
||||||
|
*/
|
||||||
try {
|
try {
|
||||||
StorageUtils.storeProduct(info, activity, true);
|
// StorageUtils.storeProduct(info, activity, true);
|
||||||
|
String uri = StorageUtils.storeProduct(info, activity, true);
|
||||||
|
// System.out.println("Activity saved at dataURI: " + uri);
|
||||||
} catch (PgenStorageException e) {
|
} catch (PgenStorageException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
messageText.setText(e.getMessage());
|
/*
|
||||||
messageText.setBackground(shell.getDisplay().getSystemColor(
|
* messageText.setText(e.getMessage());
|
||||||
SWT.COLOR_RED));
|
* messageText.setBackground(shell.getDisplay().getSystemColor(
|
||||||
if (e.getMessage().contains("\n")) {
|
* SWT.COLOR_RED)); if (e.getMessage().contains("\n")) {
|
||||||
messageText.setSize(SWT.DEFAULT,
|
* messageText.setSize(SWT.DEFAULT, 5 *
|
||||||
5 * messageText.getLineHeight());
|
* messageText.getLineHeight()); messageText.getShell().pack();
|
||||||
messageText.getShell().pack();
|
* messageText.getShell().layout(); }
|
||||||
messageText.getShell().layout();
|
*/
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -403,14 +494,18 @@ public class StoreActivityDialog extends CaveJFACEDialog {
|
||||||
private ActivityInfo getActivityInfo() {
|
private ActivityInfo getActivityInfo() {
|
||||||
|
|
||||||
ActivityInfo info = new ActivityInfo();
|
ActivityInfo info = new ActivityInfo();
|
||||||
info.setActivityLabel(infoText.getText());
|
String lbl = infoText.getText();
|
||||||
|
if (!lbl.endsWith(".xml")) {
|
||||||
|
lbl += ".xml";
|
||||||
|
}
|
||||||
|
info.setActivityLabel(lbl);
|
||||||
info.setActivityName(nameText.getText());
|
info.setActivityName(nameText.getText());
|
||||||
info.setActivityType(typeText.getText());
|
info.setActivityType(typeText.getText());
|
||||||
info.setActivitySubtype(subtypeText.getText());
|
info.setActivitySubtype(subtypeText.getText());
|
||||||
info.setSite(siteText.getText());
|
info.setSite(siteText.getText());
|
||||||
info.setDesk(deskText.getText());
|
info.setDesk(deskText.getText());
|
||||||
info.setForecaster(forecasterText.getText());
|
info.setForecaster(forecasterText.getText());
|
||||||
info.setMode(modeText.getText());
|
info.setMode(modeCombo.getText());
|
||||||
info.setStatus(statusText.getText());
|
info.setStatus(statusText.getText());
|
||||||
|
|
||||||
Calendar refTime = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
|
Calendar refTime = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
|
||||||
|
|
|
@ -141,6 +141,7 @@ import com.vividsolutions.jts.operation.distance.DistanceOp;
|
||||||
* 11/13 TTR 752 J. Wu added methods to compute an element's range record.
|
* 11/13 TTR 752 J. Wu added methods to compute an element's range record.
|
||||||
* 12/13 #1089 B. Yin Modify watch to display county list
|
* 12/13 #1089 B. Yin Modify watch to display county list
|
||||||
* 02/14 #2819 R. Anderson Removed unnecessary .clone() call
|
* 02/14 #2819 R. Anderson Removed unnecessary .clone() call
|
||||||
|
* 02/14 #2819 R. Anderson Removed unnecessary .clone() call
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author sgilbert
|
* @author sgilbert
|
||||||
|
@ -629,20 +630,25 @@ public class DisplayElementFactory {
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a list of IDisplayable Objects from an IWatchBox object
|
* Creates a list of IDisplayable Objects from an IWatchBox object
|
||||||
* @param de A PGEN Drawable Element of a WatchBox object
|
*
|
||||||
* @param paintProps The paint properties associated with the target
|
* @param de
|
||||||
* @return A list of IDisplayable elements
|
* A PGEN Drawable Element of a WatchBox object
|
||||||
*/
|
* @param paintProps
|
||||||
public ArrayList<IDisplayable> createDisplayElements(IWatchBox watchBox, PaintProperties paintProps) {
|
* The paint properties associated with the target
|
||||||
|
* @return A list of IDisplayable elements
|
||||||
|
*/
|
||||||
|
public ArrayList<IDisplayable> createDisplayElements(IWatchBox watchBox,
|
||||||
|
PaintProperties paintProps) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create the List to be returned
|
* Create the List to be returned
|
||||||
*/
|
*/
|
||||||
ArrayList<IDisplayable> dlist = new ArrayList<IDisplayable>();
|
ArrayList<IDisplayable> dlist = new ArrayList<IDisplayable>();
|
||||||
|
|
||||||
List<SPCCounty> counties = watchBox.getOriginalCountyList();
|
List<SPCCounty> counties = watchBox.getOriginalCountyList();
|
||||||
|
<<<<<<< HEAD
|
||||||
if ( counties == null || counties.isEmpty()){ //if the watch is not issued yet, the original county list is not set.
|
if ( counties == null || counties.isEmpty()){ //if the watch is not issued yet, the original county list is not set.
|
||||||
counties = watchBox.getCountyList();
|
counties = watchBox.getCountyList();
|
||||||
}
|
}
|
||||||
|
@ -745,66 +751,189 @@ public class DisplayElementFactory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
=======
|
||||||
|
if (counties == null || counties.isEmpty()) { // if the watch is not
|
||||||
|
// issued yet, the
|
||||||
|
// original county list is
|
||||||
|
// not set.
|
||||||
|
counties = watchBox.getCountyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (counties != null && !counties.isEmpty()) {
|
||||||
|
if (watchBox.getFillFlag()) {
|
||||||
|
|
||||||
|
Geometry cntyUnion = null;
|
||||||
|
;
|
||||||
|
Color[] colors = null;
|
||||||
|
|
||||||
|
Collection<Geometry> gCollection = new ArrayList<Geometry>();
|
||||||
|
|
||||||
|
// draw county border
|
||||||
|
for (SPCCounty cnty : counties) {
|
||||||
|
Geometry countyGeo = cnty.getShape();
|
||||||
|
|
||||||
|
colors = watchBox.getColors();
|
||||||
|
colors[1] = watchBox.getFillColor();
|
||||||
|
|
||||||
|
for (int ii = 0; ii < countyGeo.getNumGeometries(); ii++) {
|
||||||
|
Polygon poly = (Polygon) countyGeo.getGeometryN(ii);
|
||||||
|
List<Coordinate> pts = new ArrayList<Coordinate>(
|
||||||
|
Arrays.asList(poly.getCoordinates()));
|
||||||
|
|
||||||
|
Line cntyBorder = new Line(null, colors, .5f, .5, true,
|
||||||
|
false, pts, 0, FillPattern.FILL_PATTERN_6,
|
||||||
|
"Lines", "LINE_SOLID");
|
||||||
|
ArrayList<IDisplayable> cntyLine = createDisplayElements(
|
||||||
|
cntyBorder, paintProps);
|
||||||
|
dlist.addAll(cntyLine);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (countyGeo != null) {
|
||||||
|
gCollection.add(countyGeo.buffer(.02));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Merge counties together and fill the whole area
|
||||||
|
GeometryFactory gf = new GeometryFactory();
|
||||||
|
|
||||||
|
if (gCollection.size() > 1) {
|
||||||
|
GeometryCollection geometryCollection = (GeometryCollection) gf
|
||||||
|
.buildGeometry(gCollection);
|
||||||
|
|
||||||
|
cntyUnion = geometryCollection.union();
|
||||||
|
} else
|
||||||
|
cntyUnion = gf.buildGeometry(gCollection);
|
||||||
|
|
||||||
|
IShadedShape theShadedShape = target.createShadedShape(false,
|
||||||
|
iDescriptor, true);
|
||||||
|
|
||||||
|
// IWireframeShape theWireframeShape =
|
||||||
|
// target.createWireframeShape(false, mapDescriptor);
|
||||||
|
|
||||||
|
JTSCompiler compiler = new JTSCompiler(theShadedShape, null,
|
||||||
|
iDescriptor, PointStyle.CROSS);
|
||||||
|
|
||||||
|
try {
|
||||||
|
compiler.handle(cntyUnion,
|
||||||
|
new RGB(colors[1].getRed(), colors[1].getGreen(),
|
||||||
|
colors[1].getBlue()));
|
||||||
|
|
||||||
|
if (elem.getFillPattern() != FillPattern.TRANSPARENCY
|
||||||
|
&& elem.getFillPattern() != FillPattern.SOLID) {
|
||||||
|
FillPatternList fpl = new FillPatternList();
|
||||||
|
byte[] fpattern = fpl.getFillPattern(elem
|
||||||
|
.getFillPattern());
|
||||||
|
theShadedShape.setFillPattern(fpattern);
|
||||||
|
}
|
||||||
|
theShadedShape.compile();
|
||||||
|
|
||||||
|
// theWireframeShape.compile();
|
||||||
|
// dlist.add(new LineDisplayElement(theWireframeShape,
|
||||||
|
// colors[1], .5f));
|
||||||
|
dlist.add(new FillDisplayElement(theShadedShape, 1f));
|
||||||
|
|
||||||
|
} catch (VizException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (SPCCounty cnty : counties) {
|
||||||
|
|
||||||
|
Symbol cSymbol = new Symbol(null, watchBox.getColors(),
|
||||||
|
watchBox.getWatchSymbolWidth(),
|
||||||
|
watchBox.getWatchSymbolSize(), false,
|
||||||
|
cnty.getCentriod(), "Marker",
|
||||||
|
watchBox.getWatchSymbolType());
|
||||||
|
ArrayList<IDisplayable> cList = createDisplayElements(
|
||||||
|
cSymbol, paintProps);
|
||||||
|
dlist.addAll(cList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// if already issued, draw the list of active counties with OCTAGON
|
||||||
|
// symbols.
|
||||||
|
if (watchBox.getIssueFlag() != 0) {
|
||||||
|
List<SPCCounty> activeCounties = watchBox.getCountyList();
|
||||||
|
if (activeCounties != null && !activeCounties.isEmpty()) {
|
||||||
|
for (SPCCounty cnty : activeCounties) {
|
||||||
|
|
||||||
|
Symbol cSymbol = new Symbol(null,
|
||||||
|
IWatchBox.WATCH_LIST_COLOR, 3, 2, false,
|
||||||
|
cnty.getCentriod(), "Marker", "OCTAGON");
|
||||||
|
ArrayList<IDisplayable> cList = createDisplayElements(
|
||||||
|
cSymbol, paintProps);
|
||||||
|
dlist.addAll(cList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
>>>>>>> d3a1e1a... VLab Issue #3721 - NCEP CAVE plugin delivery for 14.3.1
|
||||||
Coordinate[] points = watchBox.getLinePoints();
|
Coordinate[] points = watchBox.getLinePoints();
|
||||||
ArrayList<Coordinate> ptsList = new ArrayList<Coordinate>();
|
ArrayList<Coordinate> ptsList = new ArrayList<Coordinate>();
|
||||||
|
|
||||||
for ( int ii = 0; ii < points.length; ii++ ){
|
for (int ii = 0; ii < points.length; ii++) {
|
||||||
ptsList.add(points[ii]);
|
ptsList.add(points[ii]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//get displayElements for the watch box.
|
// get displayElements for the watch box.
|
||||||
Line box = new Line(null, watchBox.getColors(),3.0f,3.0,true,
|
Line box = new Line(null, watchBox.getColors(), 3.0f, 3.0, true, false,
|
||||||
false, ptsList,
|
ptsList, 0, FillPattern.SOLID, "Lines", "LINE_SOLID");
|
||||||
0,FillPattern.SOLID,"Lines","LINE_SOLID");
|
ArrayList<IDisplayable> dBox = createDisplayElements(box, paintProps);
|
||||||
ArrayList<IDisplayable> dBox = createDisplayElements(box,paintProps);
|
|
||||||
dlist.addAll(dBox);
|
dlist.addAll(dBox);
|
||||||
|
|
||||||
//get displayElements for the center line in the watch box
|
// get displayElements for the center line in the watch box
|
||||||
ptsList.clear();
|
ptsList.clear();
|
||||||
ptsList.add(points[0]);
|
ptsList.add(points[0]);
|
||||||
ptsList.add(new Coordinate((points[0].x+points[4].x)/2,
|
ptsList.add(new Coordinate((points[0].x + points[4].x) / 2,
|
||||||
(points[0].y+points[4].y)/2));
|
(points[0].y + points[4].y) / 2));
|
||||||
ptsList.add(points[4]);
|
ptsList.add(points[4]);
|
||||||
|
|
||||||
Line centerLine = new Line(null, watchBox.getColors(),3.0f,3.0,false,
|
Line centerLine = new Line(null, watchBox.getColors(), 3.0f, 3.0,
|
||||||
false, ptsList, 0,FillPattern.SOLID,"Lines","LINE_SOLID");
|
false, false, ptsList, 0, FillPattern.SOLID, "Lines",
|
||||||
|
"LINE_SOLID");
|
||||||
|
|
||||||
ArrayList<IDisplayable> dLine = createDisplayElements(centerLine,paintProps);
|
ArrayList<IDisplayable> dLine = createDisplayElements(centerLine,
|
||||||
|
paintProps);
|
||||||
dlist.addAll(dLine);
|
dlist.addAll(dLine);
|
||||||
|
|
||||||
Station[] anchors = watchBox.getAnchors();
|
Station[] anchors = watchBox.getAnchors();
|
||||||
Symbol anchor1 = new Symbol(null, watchBox.getColors(), 1.5f, 0.7, false,
|
Symbol anchor1 = new Symbol(null, watchBox.getColors(), 1.5f, 0.7,
|
||||||
new Coordinate(anchors[0].getLongitude(),anchors[0].getLatitude()),
|
false, new Coordinate(anchors[0].getLongitude(),
|
||||||
"Marker", "DIAMOND");
|
anchors[0].getLatitude()), "Marker", "DIAMOND");
|
||||||
|
|
||||||
ArrayList<IDisplayable> aList1 = createDisplayElements(anchor1,paintProps);
|
ArrayList<IDisplayable> aList1 = createDisplayElements(anchor1,
|
||||||
|
paintProps);
|
||||||
dlist.addAll(aList1);
|
dlist.addAll(aList1);
|
||||||
|
|
||||||
Symbol anchor2 = new Symbol(null, watchBox.getColors(), 1.5f, 0.7, false,
|
Symbol anchor2 = new Symbol(null, watchBox.getColors(), 1.5f, 0.7,
|
||||||
new Coordinate(anchors[1].getLongitude(),anchors[1].getLatitude()),
|
false, new Coordinate(anchors[1].getLongitude(),
|
||||||
"Marker", "DIAMOND");
|
anchors[1].getLatitude()), "Marker", "DIAMOND");
|
||||||
|
|
||||||
ArrayList<IDisplayable> aList2 = createDisplayElements(anchor2,paintProps);
|
ArrayList<IDisplayable> aList2 = createDisplayElements(anchor2,
|
||||||
|
paintProps);
|
||||||
dlist.addAll(aList2);
|
dlist.addAll(aList2);
|
||||||
|
|
||||||
//Add watch number if the watch is issued
|
// Add watch number if the watch is issued
|
||||||
if ( watchBox.getIssueFlag() != 0 ){
|
if (watchBox.getIssueFlag() != 0) {
|
||||||
|
|
||||||
String[] wtext = { String.valueOf(watchBox.getWatchNumber())};
|
String[] wtext = { String.valueOf(watchBox.getWatchNumber()) };
|
||||||
Text wNumber= new Text(null, "Courier", 18f,
|
Text wNumber = new Text(null, "Courier", 18f,
|
||||||
TextJustification.CENTER, new Coordinate(watchBox.getLinePoints()[7].x -.05,
|
TextJustification.CENTER, new Coordinate(
|
||||||
watchBox.getLinePoints()[7].y - .1), 0., TextRotation.SCREEN_RELATIVE,
|
watchBox.getLinePoints()[7].x - .05,
|
||||||
wtext, FontStyle.REGULAR, watchBox.getColors()[0],
|
watchBox.getLinePoints()[7].y - .1), 0.,
|
||||||
0, 0, true, DisplayType.NORMAL, "Text", "Text" );
|
TextRotation.SCREEN_RELATIVE, wtext, FontStyle.REGULAR,
|
||||||
ArrayList<IDisplayable> tList = createDisplayElements((IText)wNumber,paintProps);
|
watchBox.getColors()[0], 0, 0, true, DisplayType.NORMAL,
|
||||||
|
"Text", "Text");
|
||||||
|
ArrayList<IDisplayable> tList = createDisplayElements(
|
||||||
|
(IText) wNumber, paintProps);
|
||||||
|
|
||||||
dlist.addAll(tList);
|
dlist.addAll(tList);
|
||||||
}
|
}
|
||||||
|
|
||||||
return dlist;
|
return dlist;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to add ALL symbols of the same color into a single wire-frame.
|
* Method to add ALL symbols of the same color into a single wire-frame.
|
||||||
|
@ -1555,7 +1684,8 @@ public class DisplayElementFactory {
|
||||||
Text label = new Text(null, "Courier", 14.0f,
|
Text label = new Text(null, "Courier", 14.0f,
|
||||||
TextJustification.LEFT_JUSTIFY,
|
TextJustification.LEFT_JUSTIFY,
|
||||||
tcmFcst.getQuarters()[0].getLocation(), 0.0,
|
tcmFcst.getQuarters()[0].getLocation(), 0.0,
|
||||||
TextRotation.NORTH_RELATIVE, txt, FontStyle.REGULAR,
|
/* TTR 895 TextRotation.NORTH_RELATIVE, */
|
||||||
|
TextRotation.SCREEN_RELATIVE, txt, FontStyle.REGULAR,
|
||||||
getDisplayColor(Color.YELLOW), 4, 0, false,
|
getDisplayColor(Color.YELLOW), 4, 0, false,
|
||||||
DisplayType.NORMAL, "Text", "General Text");
|
DisplayType.NORMAL, "Text", "General Text");
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
*/
|
*/
|
||||||
package gov.noaa.nws.ncep.ui.pgen.display;
|
package gov.noaa.nws.ncep.ui.pgen.display;
|
||||||
|
|
||||||
import java.awt.geom.Rectangle2D;
|
|
||||||
|
|
||||||
import gov.noaa.nws.ncep.ui.pgen.display.IText.DisplayType;
|
import gov.noaa.nws.ncep.ui.pgen.display.IText.DisplayType;
|
||||||
|
|
||||||
import org.eclipse.swt.graphics.RGB;
|
import org.eclipse.swt.graphics.RGB;
|
||||||
|
@ -16,169 +14,189 @@ import org.eclipse.swt.graphics.RGB;
|
||||||
import com.raytheon.uf.viz.core.DrawableString;
|
import com.raytheon.uf.viz.core.DrawableString;
|
||||||
import com.raytheon.uf.viz.core.IExtent;
|
import com.raytheon.uf.viz.core.IExtent;
|
||||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||||
import com.raytheon.uf.viz.core.IGraphicsTarget.HorizontalAlignment;
|
|
||||||
import com.raytheon.uf.viz.core.IGraphicsTarget.TextStyle;
|
import com.raytheon.uf.viz.core.IGraphicsTarget.TextStyle;
|
||||||
import com.raytheon.uf.viz.core.IGraphicsTarget.VerticalAlignment;
|
|
||||||
import com.raytheon.uf.viz.core.PixelExtent;
|
|
||||||
import com.raytheon.uf.viz.core.drawables.IFont;
|
|
||||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||||
import com.raytheon.uf.viz.core.exception.VizException;
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
import com.raytheon.viz.ui.color.BackgroundColor;
|
import com.raytheon.viz.ui.color.BackgroundColor;
|
||||||
import com.raytheon.viz.ui.color.IBackgroundColorChangedListener.BGColorMode;
|
import com.raytheon.viz.ui.color.IBackgroundColorChangedListener.BGColorMode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains information needed to readily display "text" information to a graphics target.
|
* @prologue TTR 737
|
||||||
|
* @assigned dsushon
|
||||||
|
* status: TTR 737 is dependendent on a code-fix from Raytheon, the class GLTarget needs a mask flag implemented
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains information needed to readily display "text" information to a
|
||||||
|
* graphics target.
|
||||||
* <P>
|
* <P>
|
||||||
* Objects of this class are typically created from PGEN "drawable elements" using the DisplayElementFactory
|
* Objects of this class are typically created from PGEN "drawable elements"
|
||||||
* class.
|
* using the DisplayElementFactory class.
|
||||||
|
*
|
||||||
* @author sgilbert
|
* @author sgilbert
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TextDisplayElement implements IDisplayable {
|
public class TextDisplayElement implements IDisplayable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The text to be displayed. Each element of the String array is displayed on a separate line.
|
* The text to be displayed. Each element of the String array is displayed
|
||||||
private String[] text;
|
* on a separate line. private String[] text;
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The font used to display the text private IFont font;
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Screen coordinates for the text loation private double xpos, ypos;
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates whether any additional style should be applied to the text
|
||||||
|
* display such as a background mask, outline box, etc... private TextStyle
|
||||||
|
* textStyle;
|
||||||
|
*/
|
||||||
|
|
||||||
|
private boolean mask;
|
||||||
|
|
||||||
|
// private RGB color;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* specifies the text justification to use. private HorizontalAlignment
|
||||||
|
* horizontalAlignment;
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The rotation angle (relative to the screen) at which to display the text.
|
||||||
|
* private Double rotation;
|
||||||
|
*/
|
||||||
|
private IExtent box;
|
||||||
|
|
||||||
|
private DisplayType displayType;
|
||||||
|
|
||||||
|
private DrawableString dstring;
|
||||||
|
|
||||||
|
/**
|
||||||
*/
|
*/
|
||||||
|
public TextDisplayElement(DrawableString dstring, boolean mask,
|
||||||
|
DisplayType dType, IExtent box) {
|
||||||
|
|
||||||
/**
|
this.mask = mask;
|
||||||
* The font used to display the text
|
this.box = box;
|
||||||
private IFont font;
|
// this.xpos = xpos;
|
||||||
*/
|
// this.ypos = ypos;
|
||||||
|
this.displayType = dType;
|
||||||
|
this.dstring = dstring;
|
||||||
|
|
||||||
/**
|
// TODO: uncomment this single line below when DrawableString has
|
||||||
* Screen coordinates for the text loation
|
// backgroundMaskFlag implemented (requires change from Raytheon)
|
||||||
private double xpos, ypos;
|
// this.dstring.backgroundMaskFlag = mask;
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
// this.horizontalAlignment = horizontalAlignment;
|
||||||
* Indicates whether any additional style should be applied to the text display
|
// this.rotation = rotation;
|
||||||
* such as a background mask, outline box, etc...
|
|
||||||
private TextStyle textStyle;
|
|
||||||
*/
|
|
||||||
|
|
||||||
private boolean mask;
|
/*
|
||||||
//private RGB color;
|
* dstring = new DrawableString( text, color); dstring.font = font;
|
||||||
|
* dstring.setCoordinates(xpos, ypos); dstring.textStyle =
|
||||||
|
* TextStyle.NORMAL; dstring.horizontalAlignment = horizontalAlignment;
|
||||||
|
* dstring.verticallAlignment = VerticalAlignment.MIDDLE;
|
||||||
|
* dstring.rotation = rotation;
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
// if ( mask || (dType != DisplayType.NORMAL) )
|
||||||
* specifies the text justification to use.
|
// box = createBox(bounds);
|
||||||
private HorizontalAlignment horizontalAlignment;
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* The rotation angle (relative to the screen) at which to display the text.
|
* private IExtent createBox(Rectangle2D bounds) {
|
||||||
private Double rotation;
|
*
|
||||||
*/
|
* System.out.println("bounds: "+bounds);
|
||||||
private IExtent box;
|
*
|
||||||
private DisplayType displayType;
|
* PixelExtent box = new PixelExtent(bounds.getMinX(),bounds.getMaxX(),
|
||||||
private DrawableString dstring;
|
* bounds.getMinY(), bounds.getMaxY());
|
||||||
|
*
|
||||||
|
* return box; }
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
* Disposes any graphic resources held by this object.
|
||||||
public TextDisplayElement(DrawableString dstring, boolean mask, DisplayType dType,
|
*
|
||||||
IExtent box) {
|
* @see gov.noaa.nws.ncep.ui.pgen.display.IDisplayable#dispose()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void dispose() {
|
||||||
|
|
||||||
this.mask = mask;
|
dstring.font.dispose();
|
||||||
this.box = box;
|
|
||||||
//this.xpos = xpos;
|
|
||||||
//this.ypos = ypos;
|
|
||||||
this.displayType = dType;
|
|
||||||
this.dstring = dstring;
|
|
||||||
//this.horizontalAlignment = horizontalAlignment;
|
|
||||||
//this.rotation = rotation;
|
|
||||||
|
|
||||||
/*
|
}
|
||||||
dstring = new DrawableString( text, color);
|
|
||||||
dstring.font = font;
|
|
||||||
dstring.setCoordinates(xpos, ypos);
|
|
||||||
dstring.textStyle = TextStyle.NORMAL;
|
|
||||||
dstring.horizontalAlignment = horizontalAlignment;
|
|
||||||
dstring.verticallAlignment = VerticalAlignment.MIDDLE;
|
|
||||||
dstring.rotation = rotation;
|
|
||||||
*/
|
|
||||||
|
|
||||||
//if ( mask || (dType != DisplayType.NORMAL) )
|
/**
|
||||||
// box = createBox(bounds);
|
* Draws the text strings to the specified graphics target
|
||||||
}
|
*
|
||||||
|
* @param target
|
||||||
|
* Destination graphics target
|
||||||
|
* @see gov.noaa.nws.ncep.ui.pgen.display.IDisplayable#draw(com.raytheon.viz.core.IGraphicsTarget)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void draw(IGraphicsTarget target, PaintProperties paintProps) {
|
||||||
|
|
||||||
/*
|
// target.setRotateTextAroundPoint(true);
|
||||||
private IExtent createBox(Rectangle2D bounds) {
|
|
||||||
|
|
||||||
System.out.println("bounds: "+bounds);
|
try {
|
||||||
|
if (mask) {
|
||||||
|
RGB bg = BackgroundColor.getActivePerspectiveInstance()
|
||||||
|
.getColor(BGColorMode.EDITOR);
|
||||||
|
dstring.boxColor = bg;
|
||||||
|
|
||||||
PixelExtent box = new PixelExtent(bounds.getMinX(),bounds.getMaxX(),
|
// !!! Keep this before Raytheon implements the mask flag in
|
||||||
bounds.getMinY(), bounds.getMaxY());
|
// DrawableString.
|
||||||
|
target.drawShadedRect(box, bg, 1.0, null);
|
||||||
|
}
|
||||||
|
|
||||||
return box;
|
switch (displayType) {
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
case NORMAL:
|
||||||
* Disposes any graphic resources held by this object.
|
dstring.textStyle = TextStyle.NORMAL;
|
||||||
* @see gov.noaa.nws.ncep.ui.pgen.display.IDisplayable#dispose()
|
break;
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void dispose() {
|
|
||||||
|
|
||||||
dstring.font.dispose();
|
case BOX:
|
||||||
|
dstring.textStyle = TextStyle.BOXED;
|
||||||
|
// target.drawRect(box, dstring.getColors()[0], 1.0f, 1.0);
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
case OVERLINE:
|
||||||
|
dstring.textStyle = TextStyle.OVERLINE;
|
||||||
|
// target.drawLine(box.getMinX(), box.getMinY(), 0.0,
|
||||||
|
// box.getMaxX(), box.getMinY(), 0.0,
|
||||||
|
// dstring.getColors()[0], 1.0f);
|
||||||
|
break;
|
||||||
|
|
||||||
/**
|
case UNDERLINE:
|
||||||
* Draws the text strings to the specified graphics target
|
dstring.textStyle = TextStyle.UNDERLINE;
|
||||||
* @param target Destination graphics target
|
// target.drawLine(box.getMinX(), box.getMaxY(), 0.0,
|
||||||
* @see gov.noaa.nws.ncep.ui.pgen.display.IDisplayable#draw(com.raytheon.viz.core.IGraphicsTarget)
|
// box.getMaxX(), box.getMaxY(), 0.0,
|
||||||
*/
|
// dstring.getColors()[0], 1.0f);
|
||||||
@Override
|
break;
|
||||||
public void draw(IGraphicsTarget target, PaintProperties paintProps) {
|
|
||||||
|
|
||||||
//target.setRotateTextAroundPoint(true);
|
}
|
||||||
|
|
||||||
try {
|
target.drawStrings(dstring);
|
||||||
if ( mask ) {
|
|
||||||
RGB bg = BackgroundColor.getActivePerspectiveInstance().getColor(BGColorMode.EDITOR);
|
|
||||||
target.drawShadedRect(box, bg, 1.0, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (displayType) {
|
/*
|
||||||
|
* if ( text.length == 1 ) { target.drawString(font, text[0], xpos,
|
||||||
case BOX:
|
* ypos, 0.0, textStyle, color, horizontalAlignment,
|
||||||
target.drawRect(box, dstring.getColors()[0], 1.0f, 1.0);
|
* VerticalAlignment.MIDDLE, rotation); } else { RGB[] colors = new
|
||||||
break;
|
* RGB[text.length]; for ( int j=0; j<text.length; j++ ) { colors[j]
|
||||||
|
* = color; } target.drawStrings1Box(font, text, xpos, ypos, 0.0,
|
||||||
case OVERLINE:
|
* textStyle, colors, horizontalAlignment, rotation); }
|
||||||
target.drawLine(box.getMinX(), box.getMinY(), 0.0, box.getMaxX(), box.getMinY(),
|
*/
|
||||||
0.0, dstring.getColors()[0], 1.0f);
|
} catch (VizException ve) {
|
||||||
break;
|
ve.printStackTrace();
|
||||||
|
}
|
||||||
case UNDERLINE:
|
// finally {
|
||||||
target.drawLine(box.getMinX(), box.getMaxY(), 0.0, box.getMaxX(), box.getMaxY(),
|
// target.setRotateTextAroundPoint(false);
|
||||||
0.0, dstring.getColors()[0], 1.0f);
|
// }
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
target.drawStrings(dstring);
|
|
||||||
/*
|
|
||||||
if ( text.length == 1 ) {
|
|
||||||
target.drawString(font, text[0], xpos, ypos, 0.0, textStyle, color, horizontalAlignment, VerticalAlignment.MIDDLE, rotation);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
RGB[] colors = new RGB[text.length];
|
|
||||||
for ( int j=0; j<text.length; j++ ) {
|
|
||||||
colors[j] = color;
|
|
||||||
}
|
|
||||||
target.drawStrings1Box(font, text, xpos, ypos, 0.0, textStyle, colors, horizontalAlignment, rotation);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
catch (VizException ve) {
|
|
||||||
ve.printStackTrace();
|
|
||||||
}
|
|
||||||
//finally {
|
|
||||||
// target.setRotateTextAroundPoint(false);
|
|
||||||
//}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,6 @@ import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TimeZone;
|
|
||||||
|
|
||||||
import javax.xml.transform.Source;
|
import javax.xml.transform.Source;
|
||||||
import javax.xml.transform.Transformer;
|
import javax.xml.transform.Transformer;
|
||||||
|
@ -70,6 +69,7 @@ import com.vividsolutions.jts.geom.Polygon;
|
||||||
* 04/13 #977 S. Gilbert PGEN Database support
|
* 04/13 #977 S. Gilbert PGEN Database support
|
||||||
* 12/13 TTR904 B. Yin Increased county name column to 17 characters
|
* 12/13 TTR904 B. Yin Increased county name column to 17 characters
|
||||||
* 12/13 TTR800 B. Yin Added original county list
|
* 12/13 TTR800 B. Yin Added original county list
|
||||||
|
* 04/14 TRAC 1112 S. Russell Added updateActiveCountiesInWatchBox()
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author B. Yin
|
* @author B. Yin
|
||||||
|
@ -77,9 +77,7 @@ import com.vividsolutions.jts.geom.Polygon;
|
||||||
@ElementOperations({ Operation.COPY_MOVE, Operation.EXTRAPOLATE })
|
@ElementOperations({ Operation.COPY_MOVE, Operation.EXTRAPOLATE })
|
||||||
public class WatchBox extends MultiPointElement implements IWatchBox {
|
public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
|
|
||||||
/*
|
/* default half width for watch box in statute miles. */
|
||||||
* default half width for watch box in statute miles.
|
|
||||||
*/
|
|
||||||
public final static float HALF_WIDTH = 60f;
|
public final static float HALF_WIDTH = 60f;
|
||||||
|
|
||||||
// State names
|
// State names
|
||||||
|
@ -89,8 +87,7 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
NS, EW, ESOL
|
NS, EW, ESOL
|
||||||
};
|
};
|
||||||
|
|
||||||
public static String dirs[] = { "N", "NNE", "NE", "ENE", "E", "ESE", "SE",
|
public static String dirs[] = { "N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW", "N" };
|
||||||
"SSE", "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW", "N" };
|
|
||||||
|
|
||||||
private WatchShape boxShape;
|
private WatchShape boxShape;
|
||||||
|
|
||||||
|
@ -107,6 +104,7 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
private Station anchors[];
|
private Station anchors[];
|
||||||
|
|
||||||
private List<SPCCounty> countyList;
|
private List<SPCCounty> countyList;
|
||||||
|
|
||||||
private List<SPCCounty> originalCountyList;
|
private List<SPCCounty> originalCountyList;
|
||||||
|
|
||||||
// Watch Issue Information
|
// Watch Issue Information
|
||||||
|
@ -193,42 +191,31 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
* County list is NOT copied
|
* County list is NOT copied
|
||||||
*/
|
*/
|
||||||
public AbstractDrawableComponent copy() {
|
public AbstractDrawableComponent copy() {
|
||||||
/*
|
/* create a new Line object and initially set its attributes to this
|
||||||
* create a new Line object and initially set its attributes to this
|
* one's */
|
||||||
* one's
|
|
||||||
*/
|
|
||||||
WatchBox newWatchBox = new WatchBox();
|
WatchBox newWatchBox = new WatchBox();
|
||||||
|
|
||||||
newWatchBox.setAnchors(anchors[0], anchors[1]);
|
newWatchBox.setAnchors(anchors[0], anchors[1]);
|
||||||
newWatchBox.update(this);
|
newWatchBox.update(this);
|
||||||
|
|
||||||
/*
|
/* new Coordinates points are created and set, so we don't just set
|
||||||
* new Coordinates points are created and set, so we don't just set
|
* references */
|
||||||
* references
|
|
||||||
*/
|
|
||||||
ArrayList<Coordinate> ptsCopy = new ArrayList<Coordinate>();
|
ArrayList<Coordinate> ptsCopy = new ArrayList<Coordinate>();
|
||||||
for (int i = 0; i < this.getPoints().size(); i++) {
|
for (int i = 0; i < this.getPoints().size(); i++) {
|
||||||
ptsCopy.add(new Coordinate(this.getPoints().get(i)));
|
ptsCopy.add(new Coordinate(this.getPoints().get(i)));
|
||||||
}
|
}
|
||||||
newWatchBox.setPoints(ptsCopy);
|
newWatchBox.setPoints(ptsCopy);
|
||||||
|
|
||||||
/*
|
/* new colors are created and set, so we don't just set references */
|
||||||
* new colors are created and set, so we don't just set references
|
|
||||||
*/
|
|
||||||
Color[] colorCopy = new Color[this.getColors().length];
|
Color[] colorCopy = new Color[this.getColors().length];
|
||||||
for (int i = 0; i < this.getColors().length; i++) {
|
for (int i = 0; i < this.getColors().length; i++) {
|
||||||
colorCopy[i] = new Color(this.getColors()[i].getRed(),
|
colorCopy[i] = new Color(this.getColors()[i].getRed(), this.getColors()[i].getGreen(), this.getColors()[i].getBlue());
|
||||||
this.getColors()[i].getGreen(),
|
|
||||||
this.getColors()[i].getBlue());
|
|
||||||
}
|
}
|
||||||
newWatchBox.setColors(colorCopy);
|
newWatchBox.setColors(colorCopy);
|
||||||
if (fillColor != null) {
|
if (fillColor != null) {
|
||||||
newWatchBox.setFillColor(new Color(fillColor.getRed(), fillColor
|
newWatchBox.setFillColor(new Color(fillColor.getRed(), fillColor.getGreen(), fillColor.getBlue()));
|
||||||
.getGreen(), fillColor.getBlue()));
|
|
||||||
}
|
}
|
||||||
/*
|
/* new Strings are created for Type and LinePattern */
|
||||||
* new Strings are created for Type and LinePattern
|
|
||||||
*/
|
|
||||||
newWatchBox.setPgenCategory(new String(this.getPgenCategory()));
|
newWatchBox.setPgenCategory(new String(this.getPgenCategory()));
|
||||||
newWatchBox.setPgenType(new String(this.getPgenType()));
|
newWatchBox.setPgenType(new String(this.getPgenType()));
|
||||||
newWatchBox.setParent(this.getParent());
|
newWatchBox.setParent(this.getParent());
|
||||||
|
@ -237,37 +224,37 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
newWatchBox.setWatchSymbolSize(symbolSize);
|
newWatchBox.setWatchSymbolSize(symbolSize);
|
||||||
newWatchBox.setWatchSymbolWidth(symbolWidth);
|
newWatchBox.setWatchSymbolWidth(symbolWidth);
|
||||||
|
|
||||||
newWatchBox.setIssueStatus(getIssueStatus());
|
newWatchBox.setIssueStatus(getIssueStatus());
|
||||||
newWatchBox.setWatchNumber(watchNumber);
|
newWatchBox.setWatchNumber(watchNumber);
|
||||||
newWatchBox.setIssueFlag(getIssueFlag());
|
newWatchBox.setIssueFlag(getIssueFlag());
|
||||||
newWatchBox.setForecaster(forecaster);
|
newWatchBox.setForecaster(forecaster);
|
||||||
newWatchBox.setIssueTime(getIssueTime());
|
newWatchBox.setIssueTime(getIssueTime());
|
||||||
newWatchBox.setExpTime(this.getExpTime());
|
newWatchBox.setExpTime(this.getExpTime());
|
||||||
newWatchBox.setSeverity(this.getSeverity());
|
newWatchBox.setSeverity(this.getSeverity());
|
||||||
newWatchBox.setTimeZone(this.getTimeZone());
|
newWatchBox.setTimeZone(this.getTimeZone());
|
||||||
newWatchBox.setHailSize(this.getHailSize());
|
newWatchBox.setHailSize(this.getHailSize());
|
||||||
newWatchBox.setGust(this.getGust());
|
newWatchBox.setGust(this.getGust());
|
||||||
newWatchBox.setTop(this.getTop());
|
newWatchBox.setTop(this.getTop());
|
||||||
newWatchBox.setMoveDir(this.getMoveDir());
|
newWatchBox.setMoveDir(this.getMoveDir());
|
||||||
newWatchBox.setMoveSpeed(this.getMoveSpeed());
|
newWatchBox.setMoveSpeed(this.getMoveSpeed());
|
||||||
newWatchBox.setStatesIncl(this.getStatesIncl());
|
newWatchBox.setStatesIncl(this.getStatesIncl());
|
||||||
newWatchBox.setAdjAreas( this.getAdjAreas() );
|
newWatchBox.setAdjAreas(this.getAdjAreas());
|
||||||
newWatchBox.setWatchType(getWatchType());
|
newWatchBox.setWatchType(getWatchType());
|
||||||
|
|
||||||
newWatchBox.setEndPointAnc(this.getEndPointAnc());
|
newWatchBox.setEndPointAnc(this.getEndPointAnc());
|
||||||
newWatchBox.setEndPointVor(this.getEndPointVor());
|
newWatchBox.setEndPointVor(this.getEndPointVor());
|
||||||
newWatchBox.setHalfWidthSm(this.getHalfWidthSm());
|
newWatchBox.setHalfWidthSm(this.getHalfWidthSm());
|
||||||
newWatchBox.setHalfWidthNm(this.getHalfWidthNm());
|
newWatchBox.setHalfWidthNm(this.getHalfWidthNm());
|
||||||
newWatchBox.setWathcAreaNm(this.getWathcAreaNm());
|
newWatchBox.setWathcAreaNm(this.getWathcAreaNm());
|
||||||
newWatchBox.setCntyInfo(this.getCntyInfo());
|
newWatchBox.setCntyInfo(this.getCntyInfo());
|
||||||
|
|
||||||
newWatchBox.setContWatch( this.getContWatch());
|
newWatchBox.setContWatch(this.getContWatch());
|
||||||
newWatchBox.setReplWatch(this.getReplWatch());
|
newWatchBox.setReplWatch(this.getReplWatch());
|
||||||
|
|
||||||
newWatchBox.setCountyList(new ArrayList<SPCCounty>( this.getCountyList()));
|
newWatchBox.setCountyList(new ArrayList<SPCCounty>(this.getCountyList()));
|
||||||
if ( this.getOriginalCountyList() != null ){
|
if (this.getOriginalCountyList() != null) {
|
||||||
newWatchBox.setOriginalCountyList( this.getOriginalCountyList());
|
newWatchBox.setOriginalCountyList(this.getOriginalCountyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
return newWatchBox;
|
return newWatchBox;
|
||||||
}
|
}
|
||||||
|
@ -341,8 +328,7 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
GeodeticCalculator gc = new GeodeticCalculator(DefaultEllipsoid.WGS84);
|
GeodeticCalculator gc = new GeodeticCalculator(DefaultEllipsoid.WGS84);
|
||||||
|
|
||||||
gc.setStartingGeographicPoint(linePoints.get(0).x, linePoints.get(0).y);
|
gc.setStartingGeographicPoint(linePoints.get(0).x, linePoints.get(0).y);
|
||||||
gc.setDestinationGeographicPoint(linePoints.get(1).x,
|
gc.setDestinationGeographicPoint(linePoints.get(1).x, linePoints.get(1).y);
|
||||||
linePoints.get(1).y);
|
|
||||||
|
|
||||||
return gc.getOrthodromicDistance();
|
return gc.getOrthodromicDistance();
|
||||||
}
|
}
|
||||||
|
@ -355,32 +341,11 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
public String getSpec() {
|
public String getSpec() {
|
||||||
String spec;
|
String spec;
|
||||||
|
|
||||||
spec = String.format("%1$5.2f%2$10.2f", linePoints.get(0).y,
|
spec = String.format("%1$5.2f%2$10.2f", linePoints.get(0).y, linePoints.get(0).x) + " " + getRelative(linePoints.get(0), anchors[0]) + " "
|
||||||
linePoints.get(0).x)
|
+ getRelative(linePoints.get(0), getNearestVor(linePoints.get(0))) + "\n" + String.format("%1$5.2f%2$10.2f", linePoints.get(4).y, linePoints.get(4).x) + " "
|
||||||
+ " "
|
+ getRelative(linePoints.get(4), anchors[1]) + " " + getRelative(linePoints.get(4), getNearestVor(linePoints.get(4))) + "\n" + "ORIENT: " + boxShape.toString()
|
||||||
+ getRelative(linePoints.get(0), anchors[0])
|
+ " - HALF WIDTH: " + String.format("%1$4.0f", getHalfWidth() / PgenUtil.SM2M) + "sm (" + Math.round(getHalfWidth() / PgenUtil.NM2M / 5.0) * 5 + " nm)\n"
|
||||||
+ " "
|
+ "AREA(sq nautical miles): " + String.format("%1$-8.0f", getWatchArea()) + "\n";
|
||||||
+ getRelative(linePoints.get(0),
|
|
||||||
getNearestVor(linePoints.get(0)))
|
|
||||||
+ "\n"
|
|
||||||
+ String.format("%1$5.2f%2$10.2f", linePoints.get(4).y,
|
|
||||||
linePoints.get(4).x)
|
|
||||||
+ " "
|
|
||||||
+ getRelative(linePoints.get(4), anchors[1])
|
|
||||||
+ " "
|
|
||||||
+ getRelative(linePoints.get(4),
|
|
||||||
getNearestVor(linePoints.get(4)))
|
|
||||||
+ "\n"
|
|
||||||
+ "ORIENT: "
|
|
||||||
+ boxShape.toString()
|
|
||||||
+ " - HALF WIDTH: "
|
|
||||||
+ String.format("%1$4.0f", getHalfWidth() / PgenUtil.SM2M)
|
|
||||||
+ "sm ("
|
|
||||||
+ Math.round(getHalfWidth() / PgenUtil.NM2M / 5.0)
|
|
||||||
* 5
|
|
||||||
+ " nm)\n"
|
|
||||||
+ "AREA(sq nautical miles): "
|
|
||||||
+ String.format("%1$-8.0f", getWatchArea()) + "\n";
|
|
||||||
|
|
||||||
return spec;
|
return spec;
|
||||||
}
|
}
|
||||||
|
@ -404,8 +369,7 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
long dir = Math.round(gc.getAzimuth());
|
long dir = Math.round(gc.getAzimuth());
|
||||||
if (dir < 0)
|
if (dir < 0)
|
||||||
dir += 360;
|
dir += 360;
|
||||||
String str = String.format("%1$4d%2$5s%3$5s", dist,
|
String str = String.format("%1$4d%2$5s%3$5s", dist, dirs[(int) Math.round(dir / 22.5)], st.getStid());
|
||||||
dirs[(int) Math.round(dir / 22.5)], st.getStid());
|
|
||||||
// String str = dist + " " + dirs[(int)Math.round(dir/22.5)]+ " " +
|
// String str = dist + " " + dirs[(int)Math.round(dir/22.5)]+ " " +
|
||||||
// st.getStid() ;
|
// st.getStid() ;
|
||||||
return str;
|
return str;
|
||||||
|
@ -419,8 +383,7 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
*/
|
*/
|
||||||
public Station getNearestVor(Coordinate loc) {
|
public Station getNearestVor(Coordinate loc) {
|
||||||
|
|
||||||
return PgenStaticDataProvider.getProvider().getVorTbl()
|
return PgenStaticDataProvider.getProvider().getVorTbl().getNearestStation(loc);
|
||||||
.getNearestStation(loc);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -433,14 +396,12 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
GeodeticCalculator gc = new GeodeticCalculator(DefaultEllipsoid.WGS84);
|
GeodeticCalculator gc = new GeodeticCalculator(DefaultEllipsoid.WGS84);
|
||||||
|
|
||||||
gc.setStartingGeographicPoint(linePoints.get(0).x, linePoints.get(0).y);
|
gc.setStartingGeographicPoint(linePoints.get(0).x, linePoints.get(0).y);
|
||||||
gc.setDestinationGeographicPoint(linePoints.get(4).x,
|
gc.setDestinationGeographicPoint(linePoints.get(4).x, linePoints.get(4).y);
|
||||||
linePoints.get(4).y);
|
|
||||||
|
|
||||||
double base = gc.getOrthodromicDistance();
|
double base = gc.getOrthodromicDistance();
|
||||||
|
|
||||||
Coordinate intrPt = new Coordinate();
|
Coordinate intrPt = new Coordinate();
|
||||||
getDistanceFromLine(linePoints.get(1), linePoints.get(0),
|
getDistanceFromLine(linePoints.get(1), linePoints.get(0), linePoints.get(4), intrPt);
|
||||||
linePoints.get(4), intrPt);
|
|
||||||
|
|
||||||
gc.setStartingGeographicPoint(linePoints.get(1).x, linePoints.get(1).y);
|
gc.setStartingGeographicPoint(linePoints.get(1).x, linePoints.get(1).y);
|
||||||
gc.setDestinationGeographicPoint(intrPt.x, intrPt.y);
|
gc.setDestinationGeographicPoint(intrPt.x, intrPt.y);
|
||||||
|
@ -464,8 +425,7 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
* - the nearest point on the line
|
* - the nearest point on the line
|
||||||
* @return - the distance from the input point to the input line
|
* @return - the distance from the input point to the input line
|
||||||
*/
|
*/
|
||||||
private double getDistanceFromLine(Coordinate point, Coordinate lnPt1,
|
private double getDistanceFromLine(Coordinate point, Coordinate lnPt1, Coordinate lnPt2, Coordinate intrsctPt) {
|
||||||
Coordinate lnPt2, Coordinate intrsctPt) {
|
|
||||||
if (lnPt1.x == lnPt2.x) {
|
if (lnPt1.x == lnPt2.x) {
|
||||||
intrsctPt.x = lnPt1.x;
|
intrsctPt.x = lnPt1.x;
|
||||||
intrsctPt.y = point.y;
|
intrsctPt.y = point.y;
|
||||||
|
@ -481,8 +441,7 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
double b = point.y - m * point.x;
|
double b = point.y - m * point.x;
|
||||||
intrsctPt.x = (b - bi) / (mi - m);
|
intrsctPt.x = (b - bi) / (mi - m);
|
||||||
intrsctPt.y = m * (intrsctPt.x) + b;
|
intrsctPt.y = m * (intrsctPt.x) + b;
|
||||||
double d = (intrsctPt.x - point.x) * (intrsctPt.x - point.x)
|
double d = (intrsctPt.x - point.x) * (intrsctPt.x - point.x) + (intrsctPt.y - point.y) * (intrsctPt.y - point.y);
|
||||||
+ (intrsctPt.y - point.y) * (intrsctPt.y - point.y);
|
|
||||||
return Math.sqrt(d);
|
return Math.sqrt(d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -590,8 +549,7 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
// wfo can be more than one
|
// wfo can be more than one
|
||||||
if (wfo != null) {
|
if (wfo != null) {
|
||||||
for (int ii = 0; ii < wfo.length(); ii += 3) {
|
for (int ii = 0; ii < wfo.length(); ii += 3) {
|
||||||
String wfoStr = wfo.substring(ii,
|
String wfoStr = wfo.substring(ii, wfo.length() > ii + 3 ? ii + 3 : wfo.length());
|
||||||
wfo.length() > ii + 3 ? ii + 3 : wfo.length());
|
|
||||||
if (!wfos.contains(wfoStr))
|
if (!wfos.contains(wfoStr))
|
||||||
wfos.add(wfoStr);
|
wfos.add(wfoStr);
|
||||||
}
|
}
|
||||||
|
@ -613,8 +571,7 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
if (countyList != null && !countyList.isEmpty()) {
|
if (countyList != null && !countyList.isEmpty()) {
|
||||||
for (SPCCounty cnty : countyList) {
|
for (SPCCounty cnty : countyList) {
|
||||||
|
|
||||||
if (cnty.getState() != null
|
if (cnty.getState() != null && !states.contains(cnty.getState())) {
|
||||||
&& !states.contains(cnty.getState())) {
|
|
||||||
states.add(cnty.getState());
|
states.add(cnty.getState());
|
||||||
// System.out.println(obj[2]+"...");
|
// System.out.println(obj[2]+"...");
|
||||||
|
|
||||||
|
@ -636,8 +593,7 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
Iterator<SPCCounty> it = countyList.iterator();
|
Iterator<SPCCounty> it = countyList.iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
SPCCounty cnty = it.next();
|
SPCCounty cnty = it.next();
|
||||||
if (cnty.getState() != null
|
if (cnty.getState() != null && cnty.getState().equalsIgnoreCase(state)) {
|
||||||
&& cnty.getState().equalsIgnoreCase(state)) {
|
|
||||||
it.remove();
|
it.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -654,8 +610,7 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
Iterator<SPCCounty> it = countyList.iterator();
|
Iterator<SPCCounty> it = countyList.iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
SPCCounty cnty = it.next();
|
SPCCounty cnty = it.next();
|
||||||
if (cnty.getWfo() != null
|
if (cnty.getWfo() != null && cnty.getWfo().equalsIgnoreCase(cwa)) {
|
||||||
&& cnty.getWfo().equalsIgnoreCase(cwa)) {
|
|
||||||
it.remove();
|
it.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -668,14 +623,11 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
* @param cwa
|
* @param cwa
|
||||||
*/
|
*/
|
||||||
public void addCwa(String cwa) {
|
public void addCwa(String cwa) {
|
||||||
List<SPCCounty> allCounties = PgenStaticDataProvider.getProvider()
|
List<SPCCounty> allCounties = PgenStaticDataProvider.getProvider().getSPCCounties();
|
||||||
.getSPCCounties();
|
|
||||||
|
|
||||||
if (allCounties != null) {
|
if (allCounties != null) {
|
||||||
for (SPCCounty cnty : allCounties) {
|
for (SPCCounty cnty : allCounties) {
|
||||||
if (cnty.getWfo() != null
|
if (cnty.getWfo() != null && cnty.getWfo().equalsIgnoreCase(cwa) && !countyList.contains(cnty)) {
|
||||||
&& cnty.getWfo().equalsIgnoreCase(cwa)
|
|
||||||
&& !countyList.contains(cnty)) {
|
|
||||||
countyList.add(cnty);
|
countyList.add(cnty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -731,8 +683,7 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Check any county centeriod inside the hole
|
// Check any county centeriod inside the hole
|
||||||
for (SPCCounty cnty : PgenStaticDataProvider.getProvider()
|
for (SPCCounty cnty : PgenStaticDataProvider.getProvider().getSPCCounties()) {
|
||||||
.getSPCCounties()) {
|
|
||||||
|
|
||||||
if (p.contains(gf.createPoint(cnty.getCentriod()))) {
|
if (p.contains(gf.createPoint(cnty.getCentriod()))) {
|
||||||
rt.add(cnty);
|
rt.add(cnty);
|
||||||
|
@ -809,8 +760,7 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
|
|
||||||
GeometryFactory gf = new GeometryFactory();
|
GeometryFactory gf = new GeometryFactory();
|
||||||
|
|
||||||
GeometryCollection geometryCollection = (GeometryCollection) gf
|
GeometryCollection geometryCollection = (GeometryCollection) gf.buildGeometry(gCollection);
|
||||||
.buildGeometry(gCollection);
|
|
||||||
|
|
||||||
return geometryCollection.union();
|
return geometryCollection.union();
|
||||||
|
|
||||||
|
@ -964,34 +914,20 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
msg += String.format("PDS/Normal:\t\t%1$s\n", getSeverity());
|
msg += String.format("PDS/Normal:\t\t%1$s\n", getSeverity());
|
||||||
msg += "ISSUE TIME:\t\tXX XX XXXX XXXX\n";
|
msg += "ISSUE TIME:\t\tXX XX XXXX XXXX\n";
|
||||||
msg += "VALID TIME:\t\tXX XX XXXX XXXX\n";
|
msg += "VALID TIME:\t\tXX XX XXXX XXXX\n";
|
||||||
msg += String.format("EXPIRATION TIME:\t%1$tm %1$td %1$tY %1$tY\n",
|
msg += String.format("EXPIRATION TIME:\t%1$tm %1$td %1$tY %1$tY\n", getExpTime());
|
||||||
getExpTime());
|
msg += String.format("ENDPOINT (ANC,sm):\t%1$s - %2$s\n", getRelative(getPoints().get(0), getAnchors()[0]).trim(), getRelative(getPoints().get(4), getAnchors()[1]).trim());
|
||||||
msg += String.format("ENDPOINT (ANC,sm):\t%1$s - %2$s\n",
|
msg += String.format("ENDPOINT (VOR,nm):\t%1$s - %2$s\n", getRelative(getPoints().get(0), getNearestVor(getPoints().get(0))).trim(),
|
||||||
getRelative(getPoints().get(0), getAnchors()[0]).trim(),
|
getRelative(getPoints().get(4), getNearestVor(getPoints().get(4))).trim());
|
||||||
getRelative(getPoints().get(4), getAnchors()[1]).trim());
|
msg += String.format("ATTRIB (ANC,sm):\t%1$-4.0f\n", getHalfWidth() / PgenUtil.SM2M);
|
||||||
msg += String.format(
|
msg += String.format("ATTRIB (VOR,nm):\t%1$-4d\n", Math.round(getHalfWidth() / PgenUtil.NM2M / 5.0) * 5);
|
||||||
"ENDPOINT (VOR,nm):\t%1$s - %2$s\n",
|
msg += String.format("WATCH CORNER POINT:\t%1$-6.2f %2$-6.2f\n", getPoints().get(1).y, getPoints().get(1).x);
|
||||||
getRelative(getPoints().get(0),
|
msg += String.format("WATCH CORNER POINT:\t%1$-6.2f %2$-6.2f\n", getPoints().get(3).y, getPoints().get(3).x);
|
||||||
getNearestVor(getPoints().get(0))).trim(),
|
msg += String.format("WATCH CORNER POINT:\t%1$-6.2f %2$-6.2f\n", getPoints().get(5).y, getPoints().get(5).x);
|
||||||
getRelative(getPoints().get(4),
|
msg += String.format("WATCH CORNER POINT:\t%1$-6.2f %2$-6.2f\n", getPoints().get(7).y, getPoints().get(7).x);
|
||||||
getNearestVor(getPoints().get(4))).trim());
|
|
||||||
msg += String.format("ATTRIB (ANC,sm):\t%1$-4.0f\n", getHalfWidth()
|
|
||||||
/ PgenUtil.SM2M);
|
|
||||||
msg += String.format("ATTRIB (VOR,nm):\t%1$-4d\n",
|
|
||||||
Math.round(getHalfWidth() / PgenUtil.NM2M / 5.0) * 5);
|
|
||||||
msg += String.format("WATCH CORNER POINT:\t%1$-6.2f %2$-6.2f\n",
|
|
||||||
getPoints().get(1).y, getPoints().get(1).x);
|
|
||||||
msg += String.format("WATCH CORNER POINT:\t%1$-6.2f %2$-6.2f\n",
|
|
||||||
getPoints().get(3).y, getPoints().get(3).x);
|
|
||||||
msg += String.format("WATCH CORNER POINT:\t%1$-6.2f %2$-6.2f\n",
|
|
||||||
getPoints().get(5).y, getPoints().get(5).x);
|
|
||||||
msg += String.format("WATCH CORNER POINT:\t%1$-6.2f %2$-6.2f\n",
|
|
||||||
getPoints().get(7).y, getPoints().get(7).x);
|
|
||||||
msg += String.format("HAIL SIZE (in):\t\t%1$-4.2f\n", getHailSize());
|
msg += String.format("HAIL SIZE (in):\t\t%1$-4.2f\n", getHailSize());
|
||||||
msg += String.format("MAX GUSTS (kts):\t%1$-4d\n", getGust());
|
msg += String.format("MAX GUSTS (kts):\t%1$-4d\n", getGust());
|
||||||
msg += String.format("MAX TOPS (100s ft):\t%1$-6d\n", getTop());
|
msg += String.format("MAX TOPS (100s ft):\t%1$-6d\n", getTop());
|
||||||
msg += String.format("MOTION (deg,kts):\t%1$-4d %2$-4d\n",
|
msg += String.format("MOTION (deg,kts):\t%1$-4d %2$-4d\n", getMoveDir(), getMoveSpeed());
|
||||||
getMoveDir(), getMoveSpeed());
|
|
||||||
msg += String.format("TIME ZONE:\t\t%1$s\n", getTimeZone());
|
msg += String.format("TIME ZONE:\t\t%1$s\n", getTimeZone());
|
||||||
msg += String.format("REPL WATCH NUMBER:\t%1$s\n", getReplWatch());
|
msg += String.format("REPL WATCH NUMBER:\t%1$s\n", getReplWatch());
|
||||||
msg += String.format("STATES INCLUDED:\t%1$s\n", getStatesIncl());
|
msg += String.format("STATES INCLUDED:\t%1$s\n", getStatesIncl());
|
||||||
|
@ -1010,37 +946,25 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
String wbFile = "ww0002.xml";
|
String wbFile = "ww0002.xml";
|
||||||
String xsltFile = "wou.xlt";
|
String xsltFile = "wou.xlt";
|
||||||
|
|
||||||
/*
|
/* Convert XML string into xmlSourse */
|
||||||
* Convert XML string into xmlSourse
|
|
||||||
*/
|
|
||||||
Source xmlSource = new StreamSource(wbFile);
|
Source xmlSource = new StreamSource(wbFile);
|
||||||
|
|
||||||
/*
|
/* Construct xsltSource from xslfFile */
|
||||||
* Construct xsltSource from xslfFile
|
|
||||||
*/
|
|
||||||
Source xsltSource = new StreamSource(xsltFile);
|
Source xsltSource = new StreamSource(xsltFile);
|
||||||
|
|
||||||
/*
|
/* Use the factory for XSLT transformer */
|
||||||
* Use the factory for XSLT transformer
|
|
||||||
*/
|
|
||||||
TransformerFactory transFact = TransformerFactory.newInstance();
|
TransformerFactory transFact = TransformerFactory.newInstance();
|
||||||
try {
|
try {
|
||||||
Transformer trans = transFact.newTransformer(xsltSource);
|
Transformer trans = transFact.newTransformer(xsltSource);
|
||||||
|
|
||||||
/*
|
/* Create object for the transformation product */
|
||||||
* Create object for the transformation product
|
|
||||||
*/
|
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
|
|
||||||
trans.transform(xmlSource, new StreamResult(baos));
|
trans.transform(xmlSource, new StreamResult(baos));
|
||||||
/*
|
/* Convert transformation product to string */
|
||||||
* Convert transformation product to string
|
|
||||||
*/
|
|
||||||
res = new String(baos.toByteArray());
|
res = new String(baos.toByteArray());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
/*
|
/* Catch invalid control characters in the report */
|
||||||
* Catch invalid control characters in the report
|
|
||||||
*/
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1056,14 +980,11 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
public boolean hasStatusLine() {
|
public boolean hasStatusLine() {
|
||||||
|
|
||||||
AbstractDrawableComponent adc = this.getParent();
|
AbstractDrawableComponent adc = this.getParent();
|
||||||
if (adc instanceof DECollection
|
if (adc instanceof DECollection && adc.getName().equalsIgnoreCase("Watch")) {
|
||||||
&& adc.getName().equalsIgnoreCase("Watch")) {
|
Iterator<DrawableElement> it = ((DECollection) adc).createDEIterator();
|
||||||
Iterator<DrawableElement> it = ((DECollection) adc)
|
|
||||||
.createDEIterator();
|
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
DrawableElement de = it.next();
|
DrawableElement de = it.next();
|
||||||
if (de instanceof Line
|
if (de instanceof Line && de.getPgenType().equalsIgnoreCase("POINTED_ARROW")) {
|
||||||
&& de.getPgenType().equalsIgnoreCase("POINTED_ARROW")) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1103,20 +1024,18 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
Layer defaultLayer = new Layer();
|
Layer defaultLayer = new Layer();
|
||||||
//defaultLayer.addElement(this.getParent());
|
//defaultLayer.addElement(this.getParent());
|
||||||
|
|
||||||
DECollection dec = new DECollection("Watch");
|
DECollection dec = new DECollection("Watch");
|
||||||
dec.setPgenType("WatchBox");
|
dec.setPgenType("WatchBox");
|
||||||
dec.setPgenCategory("MET");
|
dec.setPgenCategory("MET");
|
||||||
dec.add( this.copy() );
|
dec.add(this.copy());
|
||||||
defaultLayer.addElement(dec);
|
defaultLayer.addElement(dec);
|
||||||
|
|
||||||
|
|
||||||
ArrayList<Layer> layerList = new ArrayList<Layer>();
|
ArrayList<Layer> layerList = new ArrayList<Layer>();
|
||||||
layerList.add(defaultLayer);
|
layerList.add(defaultLayer);
|
||||||
|
|
||||||
ProductTime refTime = new ProductTime(getIssueTime());
|
ProductTime refTime = new ProductTime(getIssueTime());
|
||||||
|
|
||||||
Product defaultProduct = new Product("WatchBox", "WATCHBOX", forecaster, null,
|
Product defaultProduct = new Product("WatchBox", "WATCHBOX", forecaster, null, refTime, layerList);
|
||||||
refTime, layerList);
|
|
||||||
|
|
||||||
defaultProduct.setOutputFile(label);
|
defaultProduct.setOutputFile(label);
|
||||||
defaultProduct.setCenter(PgenUtil.getCurrentOffice());
|
defaultProduct.setCenter(PgenUtil.getCurrentOffice());
|
||||||
|
@ -1260,12 +1179,10 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
public static Coordinate snapOnAnchor(Station anchor, Coordinate point) {
|
public static Coordinate snapOnAnchor(Station anchor, Coordinate point) {
|
||||||
|
|
||||||
GeodeticCalculator gc = new GeodeticCalculator(DefaultEllipsoid.WGS84);
|
GeodeticCalculator gc = new GeodeticCalculator(DefaultEllipsoid.WGS84);
|
||||||
gc.setStartingGeographicPoint(anchor.getLongitude(),
|
gc.setStartingGeographicPoint(anchor.getLongitude(), anchor.getLatitude());
|
||||||
anchor.getLatitude());
|
|
||||||
gc.setDestinationGeographicPoint(point.x, point.y);
|
gc.setDestinationGeographicPoint(point.x, point.y);
|
||||||
|
|
||||||
double dis = Math
|
double dis = Math.round((float) (gc.getOrthodromicDistance() / PgenUtil.SM2M) / 5) * 5.0;
|
||||||
.round((float) (gc.getOrthodromicDistance() / PgenUtil.SM2M) / 5) * 5.0;
|
|
||||||
double angle = Math.round(gc.getAzimuth() / 22.5) * 22.5;
|
double angle = Math.round(gc.getAzimuth() / 22.5) * 22.5;
|
||||||
|
|
||||||
gc.setDirection(angle, dis * PgenUtil.SM2M);
|
gc.setDirection(angle, dis * PgenUtil.SM2M);
|
||||||
|
@ -1284,8 +1201,7 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
* - a list of anchor points
|
* - a list of anchor points
|
||||||
* @return - the nearest acnhor point
|
* @return - the nearest acnhor point
|
||||||
*/
|
*/
|
||||||
public static Station getNearestAnchorPt(Coordinate pt,
|
public static Station getNearestAnchorPt(Coordinate pt, List<Station> anchorList) {
|
||||||
List<Station> anchorList) {
|
|
||||||
|
|
||||||
GeodeticCalculator gc = new GeodeticCalculator(DefaultEllipsoid.WGS84);
|
GeodeticCalculator gc = new GeodeticCalculator(DefaultEllipsoid.WGS84);
|
||||||
gc.setStartingGeographicPoint(pt.x, pt.y);
|
gc.setStartingGeographicPoint(pt.x, pt.y);
|
||||||
|
@ -1296,8 +1212,7 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
;
|
;
|
||||||
|
|
||||||
for (Station stn : anchorList) {
|
for (Station stn : anchorList) {
|
||||||
gc.setDestinationGeographicPoint(stn.getLongitude(),
|
gc.setDestinationGeographicPoint(stn.getLongitude(), stn.getLatitude());
|
||||||
stn.getLatitude());
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
dist = gc.getOrthodromicDistance();
|
dist = gc.getOrthodromicDistance();
|
||||||
|
@ -1328,8 +1243,7 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
* : second input location
|
* : second input location
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static ArrayList<Coordinate> generateWatchBoxPts(WatchShape ws,
|
public static ArrayList<Coordinate> generateWatchBoxPts(WatchShape ws, double halfWidth, Coordinate point1, Coordinate point2) {
|
||||||
double halfWidth, Coordinate point1, Coordinate point2) {
|
|
||||||
|
|
||||||
ArrayList<Coordinate> watchBoxPts;
|
ArrayList<Coordinate> watchBoxPts;
|
||||||
|
|
||||||
|
@ -1343,9 +1257,7 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
if (Math.abs(point1.x - point2.x) < 0.0001) {
|
if (Math.abs(point1.x - point2.x) < 0.0001) {
|
||||||
dir = 90;
|
dir = 90;
|
||||||
} else {
|
} else {
|
||||||
dir = 180
|
dir = 180 - Math.atan((point2.y - point1.y) / (point2.x - point1.x)) * 180 / Math.PI;
|
||||||
- Math.atan((point2.y - point1.y)
|
|
||||||
/ (point2.x - point1.x)) * 180 / Math.PI;
|
|
||||||
if (dir > 180)
|
if (dir > 180)
|
||||||
dir -= 360;
|
dir -= 360;
|
||||||
|
|
||||||
|
@ -1371,8 +1283,7 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
* @param point2
|
* @param point2
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private static ArrayList<Coordinate> generateWatchBoxPts(double direction,
|
private static ArrayList<Coordinate> generateWatchBoxPts(double direction, double halfWidth, Coordinate point1, Coordinate point2) {
|
||||||
double halfWidth, Coordinate point1, Coordinate point2) {
|
|
||||||
|
|
||||||
// get direction from point2 to point 1
|
// get direction from point2 to point 1
|
||||||
double dir1 = direction + 180;
|
double dir1 = direction + 180;
|
||||||
|
@ -1403,8 +1314,7 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
pt = gc.getDestinationGeographicPoint();
|
pt = gc.getDestinationGeographicPoint();
|
||||||
Coordinate pt4 = new Coordinate(pt.getX(), pt.getY());
|
Coordinate pt4 = new Coordinate(pt.getX(), pt.getY());
|
||||||
|
|
||||||
Coordinate pt3 = new Coordinate((pt2.x + pt4.x) / 2,
|
Coordinate pt3 = new Coordinate((pt2.x + pt4.x) / 2, (pt2.y + pt4.y) / 2);
|
||||||
(pt2.y + pt4.y) / 2);
|
|
||||||
|
|
||||||
Coordinate pt5 = new Coordinate(point2.x, point2.y);
|
Coordinate pt5 = new Coordinate(point2.x, point2.y);
|
||||||
|
|
||||||
|
@ -1412,8 +1322,7 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
pt = gc.getDestinationGeographicPoint();
|
pt = gc.getDestinationGeographicPoint();
|
||||||
Coordinate pt6 = new Coordinate(pt.getX(), pt.getY());
|
Coordinate pt6 = new Coordinate(pt.getX(), pt.getY());
|
||||||
|
|
||||||
Coordinate pt7 = new Coordinate((pt6.x + pt8.x) / 2,
|
Coordinate pt7 = new Coordinate((pt6.x + pt8.x) / 2, (pt6.y + pt8.y) / 2);
|
||||||
(pt6.y + pt8.y) / 2);
|
|
||||||
|
|
||||||
watchBoxPts.add(pt1);
|
watchBoxPts.add(pt1);
|
||||||
watchBoxPts.add(pt2);
|
watchBoxPts.add(pt2);
|
||||||
|
@ -1437,8 +1346,7 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
* - new location of the editing point.
|
* - new location of the editing point.
|
||||||
* @return - points of the new watch box
|
* @return - points of the new watch box
|
||||||
*/
|
*/
|
||||||
public ArrayList<Coordinate> createNewWatchBox(int ptIdx, Coordinate loc,
|
public ArrayList<Coordinate> createNewWatchBox(int ptIdx, Coordinate loc, WatchShape ws) {
|
||||||
WatchShape ws) {
|
|
||||||
|
|
||||||
Coordinate newPt0 = new Coordinate();
|
Coordinate newPt0 = new Coordinate();
|
||||||
Coordinate newPt4 = new Coordinate();
|
Coordinate newPt4 = new Coordinate();
|
||||||
|
@ -1464,8 +1372,7 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
* - new location for point 4
|
* - new location for point 4
|
||||||
* @return - half width of the new watch box
|
* @return - half width of the new watch box
|
||||||
*/
|
*/
|
||||||
private double getNewHalfWidth(int ptIdx, Coordinate loc,
|
private double getNewHalfWidth(int ptIdx, Coordinate loc, Coordinate newWbPt0, Coordinate newWbPt4) {
|
||||||
Coordinate newWbPt0, Coordinate newWbPt4) {
|
|
||||||
|
|
||||||
GeodeticCalculator gc = new GeodeticCalculator(DefaultEllipsoid.WGS84);
|
GeodeticCalculator gc = new GeodeticCalculator(DefaultEllipsoid.WGS84);
|
||||||
Coordinate newPt0 = new Coordinate();
|
Coordinate newPt0 = new Coordinate();
|
||||||
|
@ -1513,8 +1420,7 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
if (pt0.x == pt4.x) {
|
if (pt0.x == pt4.x) {
|
||||||
newPt0.y = loc.y;
|
newPt0.y = loc.y;
|
||||||
} else {
|
} else {
|
||||||
newPt0.y = pt4.y + (loc.x - pt4.x) * (pt4.y - pt0.y)
|
newPt0.y = pt4.y + (loc.x - pt4.x) * (pt4.y - pt0.y) / (pt4.x - pt0.x);
|
||||||
/ (pt4.x - pt0.x);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
newPt0.x = loc.x;
|
newPt0.x = loc.x;
|
||||||
|
@ -1523,8 +1429,7 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
if (pt0.y == pt4.y) {
|
if (pt0.y == pt4.y) {
|
||||||
newPt0.x = loc.x;
|
newPt0.x = loc.x;
|
||||||
} else {
|
} else {
|
||||||
newPt0.x = pt4.x + (loc.y - pt4.y) * (pt4.x - pt0.x)
|
newPt0.x = pt4.x + (loc.y - pt4.y) * (pt4.x - pt0.x) / (pt4.y - pt0.y);
|
||||||
/ (pt4.y - pt0.y);
|
|
||||||
}
|
}
|
||||||
newPt0.y = loc.y;
|
newPt0.y = loc.y;
|
||||||
} else if (this.getWatchBoxShape() == WatchBox.WatchShape.ESOL) {
|
} else if (this.getWatchBoxShape() == WatchBox.WatchShape.ESOL) {
|
||||||
|
@ -1547,8 +1452,7 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
if (pt0.x == pt4.x) {
|
if (pt0.x == pt4.x) {
|
||||||
newPt4.y = loc.y;
|
newPt4.y = loc.y;
|
||||||
} else {
|
} else {
|
||||||
newPt4.y = pt0.y + (loc.x - pt0.x) * (pt4.y - pt0.y)
|
newPt4.y = pt0.y + (loc.x - pt0.x) * (pt4.y - pt0.y) / (pt4.x - pt0.x);
|
||||||
/ (pt4.x - pt0.x);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
newPt4.x = loc.x;
|
newPt4.x = loc.x;
|
||||||
|
@ -1557,8 +1461,7 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
if (pt0.y == pt4.y) {
|
if (pt0.y == pt4.y) {
|
||||||
newPt4.x = loc.x;
|
newPt4.x = loc.x;
|
||||||
} else {
|
} else {
|
||||||
newPt4.x = pt0.x + (loc.y - pt0.y) * (pt4.x - pt0.x)
|
newPt4.x = pt0.x + (loc.y - pt0.y) * (pt4.x - pt0.x) / (pt4.y - pt0.y);
|
||||||
/ (pt4.y - pt0.y);
|
|
||||||
}
|
}
|
||||||
newPt4.y = loc.y;
|
newPt4.y = loc.y;
|
||||||
} else if (this.getWatchBoxShape() == WatchBox.WatchShape.ESOL) {
|
} else if (this.getWatchBoxShape() == WatchBox.WatchShape.ESOL) {
|
||||||
|
@ -1583,8 +1486,7 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
if (pt5.x == pt7.x) {
|
if (pt5.x == pt7.x) {
|
||||||
newPtx.y = loc.y;
|
newPtx.y = loc.y;
|
||||||
} else {
|
} else {
|
||||||
newPtx.y = pt5.y + (loc.x - pt5.x) * (pt7.y - pt5.y)
|
newPtx.y = pt5.y + (loc.x - pt5.x) * (pt7.y - pt5.y) / (pt7.x - pt5.x);
|
||||||
/ (pt7.x - pt5.x);
|
|
||||||
}
|
}
|
||||||
newPtx.x = loc.x;
|
newPtx.x = loc.x;
|
||||||
|
|
||||||
|
@ -1592,8 +1494,7 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
if (pt5.y == pt7.y) {
|
if (pt5.y == pt7.y) {
|
||||||
newPtx.x = loc.x;
|
newPtx.x = loc.x;
|
||||||
} else {
|
} else {
|
||||||
newPtx.x = pt5.x + (loc.y - pt5.y) * (pt7.x - pt5.x)
|
newPtx.x = pt5.x + (loc.y - pt5.y) * (pt7.x - pt5.x) / (pt7.y - pt5.y);
|
||||||
/ (pt7.y - pt5.y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
newPtx.y = loc.y;
|
newPtx.y = loc.y;
|
||||||
|
@ -1632,8 +1533,7 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
if (pt1.x == pt3.x) {
|
if (pt1.x == pt3.x) {
|
||||||
newPtx.y = loc.y;
|
newPtx.y = loc.y;
|
||||||
} else {
|
} else {
|
||||||
newPtx.y = pt1.y + (loc.x - pt1.x) * (pt3.y - pt1.y)
|
newPtx.y = pt1.y + (loc.x - pt1.x) * (pt3.y - pt1.y) / (pt3.x - pt1.x);
|
||||||
/ (pt3.x - pt1.x);
|
|
||||||
}
|
}
|
||||||
newPtx.x = loc.x;
|
newPtx.x = loc.x;
|
||||||
|
|
||||||
|
@ -1641,8 +1541,7 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
if (pt1.y == pt3.y) {
|
if (pt1.y == pt3.y) {
|
||||||
newPtx.x = loc.x;
|
newPtx.x = loc.x;
|
||||||
} else {
|
} else {
|
||||||
newPtx.x = pt1.x + (loc.y - pt1.y) * (pt3.x - pt1.x)
|
newPtx.x = pt1.x + (loc.y - pt1.y) * (pt3.x - pt1.x) / (pt3.y - pt1.y);
|
||||||
/ (pt3.y - pt1.y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
newPtx.y = loc.y;
|
newPtx.y = loc.y;
|
||||||
|
@ -1691,8 +1590,7 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
|
|
||||||
List<SPCCounty> counties = new ArrayList<SPCCounty>();
|
List<SPCCounty> counties = new ArrayList<SPCCounty>();
|
||||||
|
|
||||||
counties.addAll(PgenStaticDataProvider.getProvider()
|
counties.addAll(PgenStaticDataProvider.getProvider().getCountiesInGeometry(bUnion));
|
||||||
.getCountiesInGeometry(bUnion));
|
|
||||||
ArrayList<String> nWFOs = new ArrayList<String>();
|
ArrayList<String> nWFOs = new ArrayList<String>();
|
||||||
|
|
||||||
List<String> wfos = this.getWFOs();
|
List<String> wfos = this.getWFOs();
|
||||||
|
@ -1701,8 +1599,7 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
// wfo can be more than one
|
// wfo can be more than one
|
||||||
if (wfo != null) {
|
if (wfo != null) {
|
||||||
for (int ii = 0; ii < wfo.length(); ii += 3) {
|
for (int ii = 0; ii < wfo.length(); ii += 3) {
|
||||||
String wfoStr = wfo.substring(ii,
|
String wfoStr = wfo.substring(ii, wfo.length() > ii + 3 ? ii + 3 : wfo.length());
|
||||||
wfo.length() > ii + 3 ? ii + 3 : wfo.length());
|
|
||||||
if (!wfos.contains(wfoStr) && !nWFOs.contains(wfoStr))
|
if (!wfos.contains(wfoStr) && !nWFOs.contains(wfoStr))
|
||||||
nWFOs.add(wfoStr);
|
nWFOs.add(wfoStr);
|
||||||
}
|
}
|
||||||
|
@ -1747,14 +1644,12 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
int iCnty = 0;
|
int iCnty = 0;
|
||||||
|
|
||||||
for (SPCCounty county : countyList) {
|
for (SPCCounty county : countyList) {
|
||||||
if (county.getState() != null
|
if (county.getState() != null && state.equalsIgnoreCase(county.getState())) {
|
||||||
&& state.equalsIgnoreCase(county.getState())) {
|
|
||||||
if (ugcStr.isEmpty()) {
|
if (ugcStr.isEmpty()) {
|
||||||
ugcStr = county.getUgcId();
|
ugcStr = county.getUgcId();
|
||||||
} else {
|
} else {
|
||||||
if (ugcStr.contains("\n")) {
|
if (ugcStr.contains("\n")) {
|
||||||
oneLine = ugcStr
|
oneLine = ugcStr.substring(ugcStr.lastIndexOf('\n') + 1);
|
||||||
.substring(ugcStr.lastIndexOf('\n') + 1);
|
|
||||||
} else {
|
} else {
|
||||||
oneLine = ugcStr;
|
oneLine = ugcStr;
|
||||||
}
|
}
|
||||||
|
@ -1768,9 +1663,7 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
|
|
||||||
if (ugcStr.charAt(2) == 'Z') {
|
if (ugcStr.charAt(2) == 'Z') {
|
||||||
// for coastal waters
|
// for coastal waters
|
||||||
waters += "\n"
|
waters += "\n" + county.getZoneName().toUpperCase().replaceAll("_", " ") + "\n";
|
||||||
+ county.getZoneName().toUpperCase()
|
|
||||||
.replaceAll("_", " ") + "\n";
|
|
||||||
} else if (Integer.valueOf(county.getFips().substring(2)) > 509) {
|
} else if (Integer.valueOf(county.getFips().substring(2)) > 509) {
|
||||||
if (iCiti == 3) {
|
if (iCiti == 3) {
|
||||||
cities += "\n";
|
cities += "\n";
|
||||||
|
@ -1779,11 +1672,9 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
|
|
||||||
String citi = county.getName().toUpperCase();
|
String citi = county.getName().toUpperCase();
|
||||||
if (iCiti == 0) {
|
if (iCiti == 0) {
|
||||||
cities += String.format("%1$-21s",
|
cities += String.format("%1$-21s", citi.replaceAll("CITY OF ", ""));
|
||||||
citi.replaceAll("CITY OF ", ""));
|
|
||||||
} else {
|
} else {
|
||||||
cities += String.format("%1$-20s",
|
cities += String.format("%1$-20s", citi.replaceAll("CITY OF ", ""));
|
||||||
citi.replaceAll("CITY OF ", ""));
|
|
||||||
}
|
}
|
||||||
iCiti++;
|
iCiti++;
|
||||||
|
|
||||||
|
@ -1823,26 +1714,19 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
|
|
||||||
if (ugcStr.charAt(2) == 'Z') {
|
if (ugcStr.charAt(2) == 'Z') {
|
||||||
// for coastal waters
|
// for coastal waters
|
||||||
cntyStr += "CW" + "\n\n" + ". "
|
cntyStr += "CW" + "\n\n" + ". " + "ADJACENT COASTAL WATERS INCLUDED ARE:\n" + waters;
|
||||||
+ "ADJACENT COASTAL WATERS INCLUDED ARE:\n" + waters;
|
|
||||||
} else {
|
} else {
|
||||||
String stName = stateName.get(state).toUpperCase();
|
String stName = stateName.get(state).toUpperCase();
|
||||||
|
|
||||||
if (stName != null) {
|
if (stName != null) {
|
||||||
if (state.equalsIgnoreCase("LA")) {
|
if (state.equalsIgnoreCase("LA")) {
|
||||||
cntyStr += state + "\n\n" + ". " + stName
|
cntyStr += state + "\n\n" + ". " + stName + " PARISHES INCLUDED ARE:\n\n" + counties.toUpperCase();
|
||||||
+ " PARISHES INCLUDED ARE:\n\n"
|
|
||||||
+ counties.toUpperCase();
|
|
||||||
} else {
|
} else {
|
||||||
cntyStr += state + "\n\n" + ". " + stName
|
cntyStr += state + "\n\n" + ". " + stName + " COUNTIES INCLUDED ARE:\n\n" + counties.toUpperCase();
|
||||||
+ " COUNTIES INCLUDED ARE:\n\n"
|
|
||||||
+ counties.toUpperCase();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cities.isEmpty()) {
|
if (!cities.isEmpty()) {
|
||||||
cntyStr += "\n\n" + stName
|
cntyStr += "\n\n" + stName + " INDEPENDENT CITIES INCLUDED ARE:\n\n" + cities.toUpperCase();
|
||||||
+ " INDEPENDENT CITIES INCLUDED ARE:\n\n"
|
|
||||||
+ cities.toUpperCase();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1859,8 +1743,7 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
*/
|
*/
|
||||||
private Set<String> findCntyInClst(String fips) {
|
private Set<String> findCntyInClst(String fips) {
|
||||||
|
|
||||||
Set<String> rt = PgenStaticDataProvider.getProvider().getClstTbl()
|
Set<String> rt = PgenStaticDataProvider.getProvider().getClstTbl().get(fips);
|
||||||
.get(fips);
|
|
||||||
return (rt == null) ? new HashSet<String>(Arrays.asList(fips)) : rt;
|
return (rt == null) ? new HashSet<String>(Arrays.asList(fips)) : rt;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1871,8 +1754,7 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
* @param county
|
* @param county
|
||||||
*/
|
*/
|
||||||
public void rmClstCnty(SPCCounty county) {
|
public void rmClstCnty(SPCCounty county) {
|
||||||
if (county.getFips().isEmpty()
|
if (county.getFips().isEmpty() || county.getFips().equalsIgnoreCase("00000")) {
|
||||||
|| county.getFips().equalsIgnoreCase("00000")) {
|
|
||||||
removeCounty(county);
|
removeCounty(county);
|
||||||
}
|
}
|
||||||
for (String fips : findCntyInClst(county.getFips())) {
|
for (String fips : findCntyInClst(county.getFips())) {
|
||||||
|
@ -1886,13 +1768,11 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
* @param county
|
* @param county
|
||||||
*/
|
*/
|
||||||
public void addClstCnty(SPCCounty county) {
|
public void addClstCnty(SPCCounty county) {
|
||||||
if (county.getFips().isEmpty()
|
if (county.getFips().isEmpty() || county.getFips().equalsIgnoreCase("00000")) {
|
||||||
|| county.getFips().equalsIgnoreCase("00000")) {
|
|
||||||
addCounty(county);
|
addCounty(county);
|
||||||
} else {
|
} else {
|
||||||
for (String fips : findCntyInClst(county.getFips())) {
|
for (String fips : findCntyInClst(county.getFips())) {
|
||||||
SPCCounty cnty = PgenStaticDataProvider.getProvider()
|
SPCCounty cnty = PgenStaticDataProvider.getProvider().findCounty(fips);
|
||||||
.findCounty(fips);
|
|
||||||
if (cnty != null && !countyList.contains(cnty))
|
if (cnty != null && !countyList.contains(cnty))
|
||||||
addCounty(cnty);
|
addCounty(cnty);
|
||||||
}
|
}
|
||||||
|
@ -1914,8 +1794,7 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
* - forecaster name
|
* - forecaster name
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void addStatus(String fromLine, int dNum, Calendar vTime,
|
public void addStatus(String fromLine, int dNum, Calendar vTime, Calendar eTime, String name) {
|
||||||
Calendar eTime, String name) {
|
|
||||||
if (statusHistory == null) {
|
if (statusHistory == null) {
|
||||||
statusHistory = new ArrayList<WatchStatus>();
|
statusHistory = new ArrayList<WatchStatus>();
|
||||||
}
|
}
|
||||||
|
@ -1954,12 +1833,8 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
if (cntyList != null && !cntyList.isEmpty()) {
|
if (cntyList != null && !cntyList.isEmpty()) {
|
||||||
|
|
||||||
for (SPCCounty cnty : cntyList) {
|
for (SPCCounty cnty : cntyList) {
|
||||||
String cntyName = cnty.getName().replaceAll("City of ", "")
|
String cntyName = cnty.getName().replaceAll("City of ", "").replaceAll(" City", "").replaceAll(" ", "_").replaceAll("'", "").replaceAll("\\.", "");
|
||||||
.replaceAll(" City", "").replaceAll(" ", "_").replaceAll("'", "").replaceAll("\\.", "");
|
cntyInfo += String.format("%1$-7s%2$-5s%3$-17s%4$5.2f%5$8.2f%6$7s %7$-5s", cnty.getUgcId(), cnty.getState(), cntyName, cnty.getCentriod().y, cnty.getCentriod().x,
|
||||||
cntyInfo += String.format(
|
|
||||||
"%1$-7s%2$-5s%3$-17s%4$5.2f%5$8.2f%6$7s %7$-5s",
|
|
||||||
cnty.getUgcId(), cnty.getState(), cntyName,
|
|
||||||
cnty.getCentriod().y, cnty.getCentriod().x,
|
|
||||||
cnty.getFips(), cnty.getWfo());
|
cnty.getFips(), cnty.getWfo());
|
||||||
cntyInfo += "\n";
|
cntyInfo += "\n";
|
||||||
}
|
}
|
||||||
|
@ -1972,16 +1847,16 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SPCCounty> getOriginalCountyList() {
|
public List<SPCCounty> getOriginalCountyList() {
|
||||||
return originalCountyList;
|
return originalCountyList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void makeOriginalCountyList(List<SPCCounty> countyList) {
|
public void makeOriginalCountyList(List<SPCCounty> countyList) {
|
||||||
this.originalCountyList = new ArrayList<SPCCounty>(countyList);
|
this.originalCountyList = new ArrayList<SPCCounty>(countyList);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOriginalCountyList(List<SPCCounty> originalCountyList) {
|
public void setOriginalCountyList(List<SPCCounty> originalCountyList) {
|
||||||
this.originalCountyList = originalCountyList;
|
this.originalCountyList = originalCountyList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to hold watch status information
|
* Class to hold watch status information
|
||||||
|
@ -2001,8 +1876,7 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
|
|
||||||
private String statusForecaster;
|
private String statusForecaster;
|
||||||
|
|
||||||
private WatchStatus(String fromLine, int dNum, Calendar vTime,
|
private WatchStatus(String fromLine, int dNum, Calendar vTime, Calendar eTime, String name) {
|
||||||
Calendar eTime, String name) {
|
|
||||||
this.fromLine = fromLine;
|
this.fromLine = fromLine;
|
||||||
this.discussion = dNum;
|
this.discussion = dNum;
|
||||||
this.statusValidTime = vTime;
|
this.statusValidTime = vTime;
|
||||||
|
@ -2052,6 +1926,25 @@ public class WatchBox extends MultiPointElement implements IWatchBox {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TRAC 1112
|
||||||
|
public void updateActiveCountiesInWatchBox(List<String> ugcList) {
|
||||||
|
List<SPCCounty> allCounties = null;
|
||||||
|
|
||||||
|
countyList.clear();
|
||||||
|
allCounties = PgenStaticDataProvider.getProvider().getSPCCounties();
|
||||||
|
|
||||||
|
//for each UGC retrieved from the database/WCN files
|
||||||
|
for (String ugc : ugcList) {
|
||||||
|
// for each existing county on record
|
||||||
|
for (SPCCounty county : allCounties) {
|
||||||
|
|
||||||
|
if (ugc.equalsIgnoreCase(county.getUgcId())) {
|
||||||
|
countyList.add(county);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,7 @@ import com.raytheon.viz.core.mode.CAVEMode;
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Apr 22, 2013 sgilbert Initial creation
|
* Apr 22, 2013 sgilbert Initial creation
|
||||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||||
|
* Jan 29, 2014 #1105 jwu Create ActivityInfo from Product.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -89,6 +90,20 @@ public class StorageUtils {
|
||||||
ActivityInfo info = new ActivityInfo();
|
ActivityInfo info = new ActivityInfo();
|
||||||
info.setActivityName(prod.getName());
|
info.setActivityName(prod.getName());
|
||||||
info.setActivityType(prod.getType());
|
info.setActivityType(prod.getType());
|
||||||
|
|
||||||
|
String type = prod.getType();
|
||||||
|
info.setActivityType(type);
|
||||||
|
|
||||||
|
if (type != null) {
|
||||||
|
int loc1 = type.indexOf("(");
|
||||||
|
if (loc1 > 0) {
|
||||||
|
info.setActivityType(type.substring(0, loc1));
|
||||||
|
String subtype = type.substring(loc1 + 1).replace(")", "");
|
||||||
|
if (subtype.length() > 0 && !subtype.equalsIgnoreCase("NONE"))
|
||||||
|
info.setActivitySubtype(subtype);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
info.setActivityLabel(prod.getOutputFile());
|
info.setActivityLabel(prod.getOutputFile());
|
||||||
info.setRefTime(prod.getTime().getStartTime());
|
info.setRefTime(prod.getTime().getStartTime());
|
||||||
info.setSite(prod.getCenter());
|
info.setSite(prod.getCenter());
|
||||||
|
@ -141,6 +156,10 @@ public class StorageUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
prod.setCenter(info.getSite());
|
||||||
|
prod.setForecaster(info.getForecaster());
|
||||||
|
prod.getTime().setStartTime(info.getRefTime());
|
||||||
|
|
||||||
String activityXML = serializeProduct(prod);
|
String activityXML = serializeProduct(prod);
|
||||||
|
|
||||||
StoreActivityRequest request = new StoreActivityRequest(info,
|
StoreActivityRequest request = new StoreActivityRequest(info,
|
||||||
|
@ -210,6 +229,7 @@ public class StorageUtils {
|
||||||
record.setStatus(info.getStatus());
|
record.setStatus(info.getStatus());
|
||||||
|
|
||||||
record.setDataTime(new DataTime(info.getRefTime()));
|
record.setDataTime(new DataTime(info.getRefTime()));
|
||||||
|
// record.setPluginName("pgen");
|
||||||
try {
|
try {
|
||||||
record.constructDataURI();
|
record.constructDataURI();
|
||||||
} catch (PluginException e1) {
|
} catch (PluginException e1) {
|
||||||
|
|
|
@ -32,6 +32,7 @@ import com.raytheon.viz.ui.tools.AbstractModalTool;
|
||||||
* resetMouseHandler, and setWorkingComponent
|
* resetMouseHandler, and setWorkingComponent
|
||||||
* 12/13 TTR899 J. Wu Set delObjFlag to false when any Pgen Action
|
* 12/13 TTR899 J. Wu Set delObjFlag to false when any Pgen Action
|
||||||
* button is clicked
|
* button is clicked
|
||||||
|
* 04/2014 TTR900 pswamy R-click cannot return to SELECT from Rotate and DEL_OBJ
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -46,7 +47,7 @@ public abstract class AbstractPgenTool extends AbstractModalTool {
|
||||||
|
|
||||||
private static boolean delObjFlag;
|
private static boolean delObjFlag;
|
||||||
|
|
||||||
private IInputHandler inputHandler = null;
|
protected IInputHandler inputHandler = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A handler to the current drawing layer.
|
* A handler to the current drawing layer.
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,58 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package gov.noaa.nws.ncep.ui.pgen.tools;
|
||||||
|
|
||||||
|
import gov.noaa.nws.ncep.ui.pgen.attrdialog.ContoursAttrDlg;
|
||||||
|
|
||||||
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
|
import org.eclipse.core.commands.ExecutionException;
|
||||||
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
|
||||||
|
//import gov.noaa.nws.ncep.viz.ui.display.NmapUiUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements Hotkeys for PGEN contours drawing tool.
|
||||||
|
*
|
||||||
|
* ARROW_UP - move the contour value up a level. ARROW_DOWN - move the contour
|
||||||
|
* value down a level.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* 03/14 #1117 J. Wu Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author J. Wu
|
||||||
|
*/
|
||||||
|
public class PgenContoursHotkeyHandler extends AbstractHandler {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.
|
||||||
|
* ExecutionEvent)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||||
|
String actionStr = event.getParameter("action");
|
||||||
|
if (actionStr == null || actionStr.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
ContoursAttrDlg cdlg = ContoursAttrDlg.getInstance(PlatformUI
|
||||||
|
.getWorkbench().getActiveWorkbenchWindow().getShell());
|
||||||
|
|
||||||
|
if (cdlg != null && cdlg.getShell() != null
|
||||||
|
&& !cdlg.getShell().isDisposed()) {
|
||||||
|
cdlg.upDownLabelSelection(actionStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -32,8 +32,6 @@ import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import org.eclipse.core.commands.ExecutionEvent;
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
import org.eclipse.jface.dialogs.MessageDialog;
|
|
||||||
import org.eclipse.ui.PlatformUI;
|
|
||||||
|
|
||||||
import com.raytheon.uf.viz.core.rsc.IInputHandler;
|
import com.raytheon.uf.viz.core.rsc.IInputHandler;
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
import com.vividsolutions.jts.geom.Coordinate;
|
||||||
|
@ -57,6 +55,8 @@ import com.vividsolutions.jts.geom.Coordinate;
|
||||||
* the same type.
|
* the same type.
|
||||||
* 03/13 #927 B. Yin Added right mouse click context menu
|
* 03/13 #927 B. Yin Added right mouse click context menu
|
||||||
* 08/13 TTR778 J. Wu Move loading libg2g to GraphToGridParamDialog.
|
* 08/13 TTR778 J. Wu Move loading libg2g to GraphToGridParamDialog.
|
||||||
|
* 04/14 #1117 J. Wu Set focus to label/use line color for label.
|
||||||
|
* 05/14 TTR1008 J. Wu Remove confirmation dialog when adding to an existing contour.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -107,8 +107,7 @@ public class PgenContoursTool extends AbstractPgenDrawingTool implements
|
||||||
protected void activateTool() {
|
protected void activateTool() {
|
||||||
|
|
||||||
super.activateTool();
|
super.activateTool();
|
||||||
// LibraryLoader.load("g2g");
|
// LibraryLoader.load("g2g");
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if the ExecutionEvent's trigger has been set, it should be something
|
* if the ExecutionEvent's trigger has been set, it should be something
|
||||||
|
@ -117,29 +116,35 @@ public class PgenContoursTool extends AbstractPgenDrawingTool implements
|
||||||
*/
|
*/
|
||||||
Object de = event.getTrigger();
|
Object de = event.getTrigger();
|
||||||
|
|
||||||
// The same tool could be activated again (for instance, click on PGEN palette and then click in the editor).
|
// The same tool could be activated again (for instance, click on PGEN
|
||||||
// However the trigger of the event may not be the current contour if the contour is modified.
|
// palette and then click in the editor).
|
||||||
if ( event != lastEvent ) {
|
// However the trigger of the event may not be the current contour if
|
||||||
|
// the contour is modified.
|
||||||
|
if (event != lastEvent) {
|
||||||
if (de instanceof Contours) {
|
if (de instanceof Contours) {
|
||||||
elem = (Contours) de;
|
elem = (Contours) de;
|
||||||
//addContourLine = true;
|
// addContourLine = true;
|
||||||
this.setPgenSelectHandler();
|
this.setPgenSelectHandler();
|
||||||
PgenSession.getInstance().getPgenPalette().setActiveIcon("Select");
|
PgenSession.getInstance().getPgenPalette()
|
||||||
|
.setActiveIcon("Select");
|
||||||
} else {
|
} else {
|
||||||
elem = null;
|
elem = null;
|
||||||
}
|
}
|
||||||
lastEvent = event;
|
lastEvent = event;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attrDlg instanceof ContoursAttrDlg) {
|
if (attrDlg instanceof ContoursAttrDlg) {
|
||||||
// ((ContoursAttrDlg) attrDlg).disableActionButtons();
|
// ((ContoursAttrDlg) attrDlg).disableActionButtons();
|
||||||
((ContoursAttrDlg)attrDlg).setDrawingTool( this );
|
((ContoursAttrDlg) attrDlg).setDrawingTool(this);
|
||||||
if ( de != null ){
|
if (de != null) {
|
||||||
((ContoursAttrDlg)attrDlg).setSelectMode();
|
((ContoursAttrDlg) attrDlg).setSelectMode();
|
||||||
}
|
} else {
|
||||||
else {
|
((ContoursAttrDlg) attrDlg)
|
||||||
((ContoursAttrDlg)attrDlg).setDrawingStatus(ContoursAttrDlg.ContourDrawingStatus.DRAW_LINE);
|
.setDrawingStatus(ContoursAttrDlg.ContourDrawingStatus.DRAW_LINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
((ContoursAttrDlg) attrDlg).setLabelFocus();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -180,7 +185,12 @@ public class PgenContoursTool extends AbstractPgenDrawingTool implements
|
||||||
|
|
||||||
// Check if mouse is in geographic extent
|
// Check if mouse is in geographic extent
|
||||||
Coordinate loc = mapEditor.translateClick(anX, aY);
|
Coordinate loc = mapEditor.translateClick(anX, aY);
|
||||||
if ( loc == null || shiftDown ) return false;
|
if (loc == null || shiftDown)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (attrDlg != null) {
|
||||||
|
((ContoursAttrDlg) attrDlg).setLabelFocus();
|
||||||
|
}
|
||||||
|
|
||||||
// Drawing Min/Max symbol
|
// Drawing Min/Max symbol
|
||||||
if (attrDlg != null && ((ContoursAttrDlg) attrDlg).drawSymbol()) {
|
if (attrDlg != null && ((ContoursAttrDlg) attrDlg).drawSymbol()) {
|
||||||
|
@ -191,7 +201,8 @@ public class PgenContoursTool extends AbstractPgenDrawingTool implements
|
||||||
|
|
||||||
points.clear();
|
points.clear();
|
||||||
if (attrDlg != null) {
|
if (attrDlg != null) {
|
||||||
((ContoursAttrDlg) attrDlg).setDrawingStatus( ContourDrawingStatus.SELECT );
|
((ContoursAttrDlg) attrDlg)
|
||||||
|
.setDrawingStatus(ContourDrawingStatus.SELECT);
|
||||||
}
|
}
|
||||||
drawingLayer.removeGhostLine();
|
drawingLayer.removeGhostLine();
|
||||||
|
|
||||||
|
@ -225,7 +236,8 @@ public class PgenContoursTool extends AbstractPgenDrawingTool implements
|
||||||
|
|
||||||
points.clear();
|
points.clear();
|
||||||
if (attrDlg != null) {
|
if (attrDlg != null) {
|
||||||
((ContoursAttrDlg) attrDlg).setDrawingStatus(ContoursAttrDlg.ContourDrawingStatus.SELECT);
|
((ContoursAttrDlg) attrDlg)
|
||||||
|
.setDrawingStatus(ContoursAttrDlg.ContourDrawingStatus.SELECT);
|
||||||
}
|
}
|
||||||
drawingLayer.removeGhostLine();
|
drawingLayer.removeGhostLine();
|
||||||
|
|
||||||
|
@ -249,11 +261,11 @@ public class PgenContoursTool extends AbstractPgenDrawingTool implements
|
||||||
return true;
|
return true;
|
||||||
} else if (button == 3) {
|
} else if (button == 3) {
|
||||||
if (points.size() == 0) {
|
if (points.size() == 0) {
|
||||||
((ContoursAttrDlg) attrDlg).setDrawingStatus(ContoursAttrDlg.ContourDrawingStatus.SELECT);
|
((ContoursAttrDlg) attrDlg)
|
||||||
}
|
.setDrawingStatus(ContoursAttrDlg.ContourDrawingStatus.SELECT);
|
||||||
else {
|
} else {
|
||||||
setDrawingMode();
|
setDrawingMode();
|
||||||
drawContours();
|
drawContours();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else if (button == 2) {
|
} else if (button == 2) {
|
||||||
|
@ -272,12 +284,19 @@ public class PgenContoursTool extends AbstractPgenDrawingTool implements
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean handleMouseMove(int x, int y) {
|
public boolean handleMouseMove(int x, int y) {
|
||||||
if ( !isResourceEditable() || shiftDown ) return false;
|
if (!isResourceEditable() || shiftDown) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if mouse is in geographic extent
|
// Check if mouse is in geographic extent
|
||||||
Coordinate loc = mapEditor.translateClick(x, y);
|
Coordinate loc = mapEditor.translateClick(x, y);
|
||||||
if (loc == null)
|
if (loc == null) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (attrDlg != null) {
|
||||||
|
((ContoursAttrDlg) attrDlg).setLabelFocus();
|
||||||
|
}
|
||||||
|
|
||||||
// Draw a ghost contour min/max
|
// Draw a ghost contour min/max
|
||||||
if (attrDlg != null && ((ContoursAttrDlg) attrDlg).drawSymbol()) {
|
if (attrDlg != null && ((ContoursAttrDlg) attrDlg).drawSymbol()) {
|
||||||
|
@ -307,6 +326,9 @@ public class PgenContoursTool extends AbstractPgenDrawingTool implements
|
||||||
lbl.setText(oldText);
|
lbl.setText(oldText);
|
||||||
lbl.setHide(hide);
|
lbl.setHide(hide);
|
||||||
lbl.setAuto(auto);
|
lbl.setAuto(auto);
|
||||||
|
if (((ContoursAttrDlg) attrDlg).isUseMainColor()) {
|
||||||
|
lbl.setColors(mmTemp.getColors());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
drawingLayer.setGhostLine(ghost);
|
drawingLayer.setGhostLine(ghost);
|
||||||
|
@ -345,6 +367,9 @@ public class PgenContoursTool extends AbstractPgenDrawingTool implements
|
||||||
lbl.setText(oldText);
|
lbl.setText(oldText);
|
||||||
lbl.setHide(hide);
|
lbl.setHide(hide);
|
||||||
lbl.setAuto(auto);
|
lbl.setAuto(auto);
|
||||||
|
if (((ContoursAttrDlg) attrDlg).isUseMainColor()) {
|
||||||
|
lbl.setColors(circleTemp.getColors());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
drawingLayer.setGhostLine(ghost);
|
drawingLayer.setGhostLine(ghost);
|
||||||
|
@ -394,6 +419,9 @@ public class PgenContoursTool extends AbstractPgenDrawingTool implements
|
||||||
lbl.setText(oldText);
|
lbl.setText(oldText);
|
||||||
lbl.setHide(hide);
|
lbl.setHide(hide);
|
||||||
lbl.setAuto(auto);
|
lbl.setAuto(auto);
|
||||||
|
if (((ContoursAttrDlg) attrDlg).isUseMainColor()) {
|
||||||
|
lbl.setColors(lineTemp.getColors());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,8 +447,11 @@ public class PgenContoursTool extends AbstractPgenDrawingTool implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
|
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
|
||||||
if ( !isResourceEditable() || shiftDown ) return false;
|
if (!isResourceEditable() || shiftDown) {
|
||||||
else return true;
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -464,6 +495,9 @@ public class PgenContoursTool extends AbstractPgenDrawingTool implements
|
||||||
lbl.setText(oldText);
|
lbl.setText(oldText);
|
||||||
lbl.setHide(hide);
|
lbl.setHide(hide);
|
||||||
lbl.setAuto(auto);
|
lbl.setAuto(auto);
|
||||||
|
if (((ContoursAttrDlg) attrDlg).isUseMainColor()) {
|
||||||
|
lbl.setColors(lineTemp.getColors());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -552,6 +586,9 @@ public class PgenContoursTool extends AbstractPgenDrawingTool implements
|
||||||
lbl.setText(oldText);
|
lbl.setText(oldText);
|
||||||
lbl.setHide(hide);
|
lbl.setHide(hide);
|
||||||
lbl.setAuto(auto);
|
lbl.setAuto(auto);
|
||||||
|
if (((ContoursAttrDlg) attrDlg).isUseMainColor()) {
|
||||||
|
lbl.setColors(mmTemp.getColors());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if we need to add to existing contours or create a new
|
// Check if we need to add to existing contours or create a new
|
||||||
|
@ -674,6 +711,9 @@ public class PgenContoursTool extends AbstractPgenDrawingTool implements
|
||||||
lbl.setText(oldText);
|
lbl.setText(oldText);
|
||||||
lbl.setHide(hide);
|
lbl.setHide(hide);
|
||||||
lbl.setAuto(auto);
|
lbl.setAuto(auto);
|
||||||
|
if (((ContoursAttrDlg) attrDlg).isUseMainColor()) {
|
||||||
|
lbl.setColors(circleTemp.getColors());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if we need to add to existing contours or create a new
|
// Check if we need to add to existing contours or create a new
|
||||||
|
@ -732,20 +772,13 @@ public class PgenContoursTool extends AbstractPgenDrawingTool implements
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Loop through current layer and see if there is an same type of
|
* Loop through current layer and see if there is an same type of
|
||||||
|
* Contours. If yes, add to the existing contours. If not, draw a new
|
||||||
* Contours.
|
* Contours.
|
||||||
*
|
|
||||||
* If yes, show a warning message and ask for confirmation either add to
|
|
||||||
* the existing contours or draw a new Cnntours.
|
|
||||||
*/
|
*/
|
||||||
private Contours checkExistingContours() {
|
private Contours checkExistingContours() {
|
||||||
|
|
||||||
Contours existingContours = elem;
|
Contours existingContours = elem;
|
||||||
|
|
||||||
// Loop through current layer and see if there is an same type of
|
|
||||||
// Contours.
|
|
||||||
// If yes, show a warning message and ask for confirmation either
|
|
||||||
// add to the
|
|
||||||
// existing contours or draw a new Contours.
|
|
||||||
if (existingContours == null) {
|
if (existingContours == null) {
|
||||||
|
|
||||||
Iterator<AbstractDrawableComponent> it = drawingLayer
|
Iterator<AbstractDrawableComponent> it = drawingLayer
|
||||||
|
@ -755,33 +788,14 @@ public class PgenContoursTool extends AbstractPgenDrawingTool implements
|
||||||
if (adc instanceof Contours && !(adc instanceof Outlook)) {
|
if (adc instanceof Contours && !(adc instanceof Outlook)) {
|
||||||
Contours thisContour = (Contours) adc;
|
Contours thisContour = (Contours) adc;
|
||||||
ContoursAttrDlg thisDlg = (ContoursAttrDlg) attrDlg;
|
ContoursAttrDlg thisDlg = (ContoursAttrDlg) attrDlg;
|
||||||
if (thisContour.getParm().equals(thisDlg.getParm())
|
|
||||||
&& thisContour.getLevel().equals(
|
if (thisContour.getKey().equals(
|
||||||
thisDlg.getLevel())) {
|
Contours.getKey(thisDlg))) {
|
||||||
existingContours = (Contours) adc;
|
existingContours = (Contours) adc;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (existingContours != null) {
|
|
||||||
MessageDialog msgDlg = new MessageDialog(PlatformUI
|
|
||||||
.getWorkbench().getActiveWorkbenchWindow()
|
|
||||||
.getShell(), "Warning!", null, "There is another ["
|
|
||||||
+ existingContours.getParm() + ","
|
|
||||||
+ existingContours.getLevel()
|
|
||||||
+ "] Contours element in this layer.\n"
|
|
||||||
+ "Do you want to add to it or create a new one?",
|
|
||||||
MessageDialog.INFORMATION,
|
|
||||||
new String[] { "Add to Existing One",
|
|
||||||
"Create a New One" }, 0);
|
|
||||||
msgDlg.open();
|
|
||||||
|
|
||||||
// start a new Contours.
|
|
||||||
if (msgDlg.getReturnCode() != MessageDialog.OK) {
|
|
||||||
existingContours = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return existingContours;
|
return existingContours;
|
||||||
|
@ -812,62 +826,64 @@ public class PgenContoursTool extends AbstractPgenDrawingTool implements
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the current working contour.
|
* Gets the current working contour.
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Contours getCurrentContour(){
|
public Contours getCurrentContour() {
|
||||||
return elem;
|
return elem;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the current working contour
|
* Sets the current working contour
|
||||||
|
*
|
||||||
* @param con
|
* @param con
|
||||||
*/
|
*/
|
||||||
public void setCurrentContour( Contours con){
|
public void setCurrentContour(Contours con) {
|
||||||
attrDlg.setDrawableElement(con);
|
attrDlg.setDrawableElement(con);
|
||||||
elem = con;
|
elem = con;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the selecting handler.
|
* Sets the selecting handler.
|
||||||
*/
|
*/
|
||||||
public void setPgenSelectHandler( ){
|
public void setPgenSelectHandler() {
|
||||||
|
|
||||||
setHandler(new PgenSelectHandler(this, mapEditor, drawingLayer,attrDlg ));
|
setHandler(new PgenSelectHandler(this, mapEditor, drawingLayer, attrDlg));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the contour mouse handler.
|
* Sets the contour mouse handler.
|
||||||
*/
|
*/
|
||||||
public void setPgenContoursHandler( ){
|
public void setPgenContoursHandler() {
|
||||||
|
|
||||||
setHandler(new PgenContoursHandler());
|
setHandler(new PgenContoursHandler());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears selected elements.
|
* Clears selected elements.
|
||||||
*/
|
*/
|
||||||
public void clearSelected(){
|
public void clearSelected() {
|
||||||
drawingLayer.removeSelected();
|
drawingLayer.removeSelected();
|
||||||
mapEditor.refresh();
|
mapEditor.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the default mouse handler.
|
* Gets the default mouse handler.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected IInputHandler getDefaultMouseHandler(){
|
protected IInputHandler getDefaultMouseHandler() {
|
||||||
return new PgenSelectHandler(this, mapEditor, drawingLayer,attrDlg );
|
return new PgenSelectHandler(this, mapEditor, drawingLayer, attrDlg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets current working component
|
* Sets current working component
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void setWorkingComponent( AbstractDrawableComponent adc ){
|
protected void setWorkingComponent(AbstractDrawableComponent adc) {
|
||||||
if ( adc instanceof Contours ){
|
if (adc instanceof Contours) {
|
||||||
setCurrentContour( (Contours) adc );
|
setCurrentContour((Contours) adc);
|
||||||
((ContoursAttrDlg) attrDlg).setCurrentContours(elem);
|
((ContoursAttrDlg) attrDlg).setCurrentContours(elem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ package gov.noaa.nws.ncep.ui.pgen.tools;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.PgenUtil;
|
import gov.noaa.nws.ncep.ui.pgen.PgenUtil;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.attrdialog.AttrDlg;
|
import gov.noaa.nws.ncep.ui.pgen.attrdialog.AttrDlg;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.contours.ContourMinmax;
|
import gov.noaa.nws.ncep.ui.pgen.contours.ContourMinmax;
|
||||||
|
import gov.noaa.nws.ncep.ui.pgen.contours.Contours;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.elements.AbstractDrawableComponent;
|
import gov.noaa.nws.ncep.ui.pgen.elements.AbstractDrawableComponent;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.elements.DECollection;
|
import gov.noaa.nws.ncep.ui.pgen.elements.DECollection;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.elements.Layer;
|
import gov.noaa.nws.ncep.ui.pgen.elements.Layer;
|
||||||
|
@ -18,6 +19,9 @@ import gov.noaa.nws.ncep.ui.pgen.elements.Outlook;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.filter.AcceptFilter;
|
import gov.noaa.nws.ncep.ui.pgen.filter.AcceptFilter;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.rsc.PgenResource;
|
import gov.noaa.nws.ncep.ui.pgen.rsc.PgenResource;
|
||||||
|
|
||||||
|
import org.eclipse.jface.dialogs.MessageDialog;
|
||||||
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
|
||||||
import com.raytheon.viz.ui.editor.AbstractEditor;
|
import com.raytheon.viz.ui.editor.AbstractEditor;
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
import com.vividsolutions.jts.geom.Coordinate;
|
||||||
|
|
||||||
|
@ -29,6 +33,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* 04/13 927 B. Yin Moved from the PgenDeleteElement class
|
* 04/13 927 B. Yin Moved from the PgenDeleteElement class
|
||||||
|
* 04/14 1117 J. Wu Added confirmation for deleting contours
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -37,152 +42,182 @@ import com.vividsolutions.jts.geom.Coordinate;
|
||||||
|
|
||||||
public class PgenDeleteElementHandler extends InputHandlerDefaultImpl {
|
public class PgenDeleteElementHandler extends InputHandlerDefaultImpl {
|
||||||
|
|
||||||
protected AbstractEditor mapEditor;
|
protected AbstractEditor mapEditor;
|
||||||
protected PgenResource pgenrsc;
|
|
||||||
protected AbstractPgenTool tool;
|
|
||||||
protected AttrDlg attrDlg;
|
|
||||||
|
|
||||||
private boolean preempt;
|
protected PgenResource pgenrsc;
|
||||||
|
|
||||||
/**
|
protected AbstractPgenTool tool;
|
||||||
* Constructor
|
|
||||||
* @param tool
|
|
||||||
*/
|
|
||||||
public PgenDeleteElementHandler( AbstractPgenTool tool ) {
|
|
||||||
this.tool = tool;
|
|
||||||
pgenrsc = tool.getDrawingLayer();
|
|
||||||
mapEditor = tool.mapEditor;
|
|
||||||
|
|
||||||
if ( tool instanceof AbstractPgenDrawingTool ) {
|
protected AttrDlg attrDlg;
|
||||||
attrDlg = ((AbstractPgenDrawingTool)tool).getAttrDlg();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
private boolean preempt;
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseDown(int,
|
|
||||||
* int, int)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean handleMouseDown(int anX, int aY, int button) {
|
|
||||||
if ( !tool.isResourceEditable() ) return false;
|
|
||||||
|
|
||||||
preempt = false;
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param tool
|
||||||
|
*/
|
||||||
|
public PgenDeleteElementHandler(AbstractPgenTool tool) {
|
||||||
|
this.tool = tool;
|
||||||
|
pgenrsc = tool.getDrawingLayer();
|
||||||
|
mapEditor = tool.mapEditor;
|
||||||
|
|
||||||
// Check if mouse is in geographic extent
|
if (tool instanceof AbstractPgenDrawingTool) {
|
||||||
Coordinate loc = mapEditor.translateClick(anX, aY);
|
attrDlg = ((AbstractPgenDrawingTool) tool).getAttrDlg();
|
||||||
if ( loc == null ) return false;
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( button == 1 ) {
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseDown(int, int,
|
||||||
|
* int)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean handleMouseDown(int anX, int aY, int button) {
|
||||||
|
if (!tool.isResourceEditable())
|
||||||
|
return false;
|
||||||
|
|
||||||
if ( pgenrsc.getSelectedComp() != null ) {
|
preempt = false;
|
||||||
doDelete();
|
|
||||||
preempt = false;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Get the nearest element and set it as the selected element.
|
|
||||||
AbstractDrawableComponent elSelected = pgenrsc.getNearestComponent( loc, new AcceptFilter(), true );
|
|
||||||
|
|
||||||
//Delete watch status line
|
// Check if mouse is in geographic extent
|
||||||
if ( elSelected instanceof DECollection && elSelected.getName().equalsIgnoreCase("Watch")
|
Coordinate loc = mapEditor.translateClick(anX, aY);
|
||||||
&& pgenrsc.getNearestElement(loc).getPgenType().equalsIgnoreCase("POINTED_ARROW")){
|
if (loc == null)
|
||||||
elSelected =pgenrsc.getNearestElement(loc);
|
return false;
|
||||||
}
|
|
||||||
else if ( elSelected instanceof Outlook && ((Outlook)elSelected).getDEs() > 1){
|
|
||||||
AbstractDrawableComponent adc = pgenrsc.getNearestElement(loc);
|
|
||||||
elSelected = adc.getParent();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (elSelected != null) {
|
if (button == 1) {
|
||||||
pgenrsc.setSelected( elSelected );
|
|
||||||
preempt = true;
|
|
||||||
}
|
|
||||||
mapEditor.refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
return preempt;
|
if (pgenrsc.getSelectedComp() != null) {
|
||||||
|
doDelete();
|
||||||
|
preempt = false;
|
||||||
|
} else {
|
||||||
|
// Get the nearest element and set it as the selected element.
|
||||||
|
AbstractDrawableComponent elSelected = pgenrsc
|
||||||
|
.getNearestComponent(loc, new AcceptFilter(), true);
|
||||||
|
|
||||||
}
|
// Delete watch status line
|
||||||
else if ( button == 2 ){
|
if (elSelected instanceof DECollection
|
||||||
|
&& elSelected.getName().equalsIgnoreCase("Watch")
|
||||||
|
&& pgenrsc.getNearestElement(loc).getPgenType()
|
||||||
|
.equalsIgnoreCase("POINTED_ARROW")) {
|
||||||
|
elSelected = pgenrsc.getNearestElement(loc);
|
||||||
|
} else if (elSelected instanceof Outlook
|
||||||
|
&& ((Outlook) elSelected).getDEs() > 1) {
|
||||||
|
AbstractDrawableComponent adc = pgenrsc
|
||||||
|
.getNearestElement(loc);
|
||||||
|
elSelected = adc.getParent();
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
if (elSelected != null) {
|
||||||
|
pgenrsc.setSelected(elSelected);
|
||||||
|
preempt = true;
|
||||||
|
}
|
||||||
|
mapEditor.refresh();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
return preempt;
|
||||||
else if ( button == 3 ) {
|
|
||||||
|
|
||||||
if ( pgenrsc.getSelectedComp() != null ){
|
} else if (button == 2) {
|
||||||
// de-select element
|
|
||||||
pgenrsc.removeSelected();
|
|
||||||
mapEditor.refresh();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// set selecting mode
|
|
||||||
PgenUtil.setSelectingMode();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
} else if (button == 3) {
|
||||||
else{
|
|
||||||
|
|
||||||
return true;
|
if (pgenrsc.getSelectedComp() != null) {
|
||||||
|
// de-select element
|
||||||
|
pgenrsc.removeSelected();
|
||||||
|
mapEditor.refresh();
|
||||||
|
} else {
|
||||||
|
// set selecting mode
|
||||||
|
PgenUtil.setSelectingMode();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
return true;
|
||||||
|
|
||||||
}
|
} else {
|
||||||
|
|
||||||
@Override
|
return true;
|
||||||
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
|
|
||||||
if ( !tool.isResourceEditable() || shiftDown ) return false;
|
|
||||||
else return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
}
|
||||||
* Deletes the selected element and reset the handler.
|
|
||||||
* For a single element, closes the attributes dialog when the element is deleted.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void preprocess(){
|
|
||||||
|
|
||||||
if ( pgenrsc.getSelectedComp() != null ) {
|
}
|
||||||
if ( attrDlg != null &&
|
|
||||||
( pgenrsc.getSelectedComp().getParent() instanceof Layer
|
|
||||||
|| pgenrsc.getSelectedComp().getParent().getName().equalsIgnoreCase("labeledSymbol"))){
|
|
||||||
attrDlg.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
doDelete();
|
@Override
|
||||||
tool.resetMouseHandler();
|
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
|
||||||
}
|
if (!tool.isResourceEditable() || shiftDown)
|
||||||
}
|
return false;
|
||||||
|
else
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes the selected element or component from the PGEN resource.
|
* Deletes the selected element and reset the handler. For a single element,
|
||||||
*/
|
* closes the attributes dialog when the element is deleted.
|
||||||
private void doDelete(){
|
*/
|
||||||
|
@Override
|
||||||
|
public void preprocess() {
|
||||||
|
|
||||||
AbstractDrawableComponent adc = pgenrsc.getSelectedComp();
|
if (pgenrsc.getSelectedComp() != null) {
|
||||||
|
if (attrDlg != null
|
||||||
|
&& (pgenrsc.getSelectedComp().getParent() instanceof Layer || pgenrsc
|
||||||
|
.getSelectedComp().getParent().getName()
|
||||||
|
.equalsIgnoreCase("labeledSymbol"))) {
|
||||||
|
attrDlg.close();
|
||||||
|
}
|
||||||
|
|
||||||
if ( adc.getParent() instanceof ContourMinmax
|
doDelete();
|
||||||
|| adc.getParent().getName().equalsIgnoreCase("labeledSymbol") ){
|
tool.resetMouseHandler();
|
||||||
pgenrsc.removeElement(adc.getParent());
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
pgenrsc.removeElement(adc);
|
|
||||||
}
|
|
||||||
// de-select element
|
|
||||||
pgenrsc.removeSelected();
|
|
||||||
mapEditor.refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
public AbstractEditor getMapEditor() {
|
/**
|
||||||
return mapEditor;
|
* Deletes the selected element or component from the PGEN resource.
|
||||||
}
|
*/
|
||||||
|
private void doDelete() {
|
||||||
|
|
||||||
public PgenResource getPgenrsc() {
|
AbstractDrawableComponent adc = pgenrsc.getSelectedComp();
|
||||||
return pgenrsc;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Ask for user confirmation before deleting a Contours element.
|
||||||
|
boolean deleteContour = true;
|
||||||
|
if (adc instanceof Contours) {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Confirm request to delete a Contour.
|
||||||
|
*/
|
||||||
|
String msg = "Are you sure you want to delete this Contour completely?";
|
||||||
|
|
||||||
|
MessageDialog confirmDlg = new MessageDialog(PlatformUI
|
||||||
|
.getWorkbench().getActiveWorkbenchWindow().getShell(),
|
||||||
|
"Confirm Delete of a Contour", null, msg,
|
||||||
|
MessageDialog.QUESTION, new String[] { "OK", "Cancel" }, 0);
|
||||||
|
confirmDlg.open();
|
||||||
|
|
||||||
|
if (!(confirmDlg.getReturnCode() == MessageDialog.OK)) {
|
||||||
|
deleteContour = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (deleteContour) {
|
||||||
|
if (adc.getParent() instanceof ContourMinmax
|
||||||
|
|| adc.getParent().getName()
|
||||||
|
.equalsIgnoreCase("labeledSymbol")) {
|
||||||
|
pgenrsc.removeElement(adc.getParent());
|
||||||
|
} else {
|
||||||
|
pgenrsc.removeElement(adc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// de-select element
|
||||||
|
pgenrsc.removeSelected();
|
||||||
|
mapEditor.refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
public AbstractEditor getMapEditor() {
|
||||||
|
return mapEditor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PgenResource getPgenrsc() {
|
||||||
|
return pgenrsc;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
package gov.noaa.nws.ncep.ui.pgen.tools;
|
package gov.noaa.nws.ncep.ui.pgen.tools;
|
||||||
|
|
||||||
|
import gov.noaa.nws.ncep.ui.pgen.PgenUtil;
|
||||||
|
|
||||||
import com.raytheon.uf.viz.core.rsc.IInputHandler;
|
import com.raytheon.uf.viz.core.rsc.IInputHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,24 +20,54 @@ import com.raytheon.uf.viz.core.rsc.IInputHandler;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* 05/09 79 B. Yin Initial Creation.
|
* 05/09 79 B. Yin Initial Creation.
|
||||||
|
* 04/2014 TTR900 pswamy R-click cannot return to SELECT from Rotate and DEL_OBJ
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author B. Yin
|
* @author B. Yin
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class PgenDeleteObj extends AbstractPgenTool {
|
public class PgenDeleteObj extends AbstractPgenTool {
|
||||||
|
|
||||||
public PgenDeleteObj(){
|
public PgenDeleteObj() {
|
||||||
|
|
||||||
super();
|
super();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IInputHandler getMouseHandler() {
|
public IInputHandler getMouseHandler() {
|
||||||
return null; // no interaction
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (inputHandler == null) {
|
||||||
|
inputHandler = new PgenDeleteObjHandler();
|
||||||
|
}
|
||||||
|
return inputHandler;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements input handler for mouse events.
|
||||||
|
*/
|
||||||
|
public class PgenDeleteObjHandler extends InputHandlerDefaultImpl {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseDown(int,
|
||||||
|
* int, int)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean handleMouseDown(int x, int y, int button) {
|
||||||
|
if (!isResourceEditable())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (button == 3) {
|
||||||
|
// set selecting mode
|
||||||
|
PgenUtil.setSelectingMode();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -8,8 +8,9 @@
|
||||||
|
|
||||||
package gov.noaa.nws.ncep.ui.pgen.tools;
|
package gov.noaa.nws.ncep.ui.pgen.tools;
|
||||||
|
|
||||||
import static java.lang.Math.*;
|
import static java.lang.Math.atan2;
|
||||||
|
import static java.lang.Math.toDegrees;
|
||||||
|
import gov.noaa.nws.ncep.ui.pgen.PgenUtil;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.annotation.Operation;
|
import gov.noaa.nws.ncep.ui.pgen.annotation.Operation;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.attrdialog.TrackExtrapPointInfoDlg;
|
import gov.noaa.nws.ncep.ui.pgen.attrdialog.TrackExtrapPointInfoDlg;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.display.ISinglePoint;
|
import gov.noaa.nws.ncep.ui.pgen.display.ISinglePoint;
|
||||||
|
@ -34,6 +35,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* 01/2010 Mikhail L. Initial Creation.
|
* 01/2010 Mikhail L. Initial Creation.
|
||||||
* 06/2010 #280 Moved two methods to PgenToolUtils.
|
* 06/2010 #280 Moved two methods to PgenToolUtils.
|
||||||
|
* 04/2014 TTR900 pswamy R-click cannot return to SELECT from Rotate and DEL_OBJ
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -42,260 +44,283 @@ import com.vividsolutions.jts.geom.Coordinate;
|
||||||
|
|
||||||
public class PgenRotateElement extends AbstractPgenDrawingTool {
|
public class PgenRotateElement extends AbstractPgenDrawingTool {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see com.raytheon.viz.ui.tools.AbstractTool#runTool()
|
* @see com.raytheon.viz.ui.tools.AbstractTool#runTool()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void activateTool() {
|
protected void activateTool() {
|
||||||
|
|
||||||
attrDlg = null;
|
attrDlg = null;
|
||||||
if (buttonName == null){
|
if (buttonName == null) {
|
||||||
buttonName = new String("Select");
|
buttonName = new String("Select");
|
||||||
}
|
}
|
||||||
|
|
||||||
super.activateTool();
|
super.activateTool();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current mouse handler.
|
* Returns the current mouse handler.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public IInputHandler getMouseHandler() {
|
public IInputHandler getMouseHandler() {
|
||||||
if (mouseHandler == null) {
|
if (mouseHandler == null) {
|
||||||
mouseHandler = new PgenSelectRotateHandler();
|
mouseHandler = new PgenSelectRotateHandler();
|
||||||
}
|
}
|
||||||
return mouseHandler;
|
return mouseHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements input handler for mouse events.
|
* Implements input handler for mouse events.
|
||||||
*
|
*
|
||||||
* @author bingfan, Mikhail L.
|
* @author bingfan, Mikhail L.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class PgenSelectRotateHandler extends InputHandlerDefaultImpl {
|
public class PgenSelectRotateHandler extends InputHandlerDefaultImpl {
|
||||||
|
|
||||||
OperationFilter rotateFilter = new OperationFilter( Operation.ROTATE );
|
OperationFilter rotateFilter = new OperationFilter(Operation.ROTATE);
|
||||||
|
|
||||||
/** Attribute dialog for displaying track points info */
|
/** Attribute dialog for displaying track points info */
|
||||||
TrackExtrapPointInfoDlg trackExtrapPointInfoDlg = null;
|
TrackExtrapPointInfoDlg trackExtrapPointInfoDlg = null;
|
||||||
|
|
||||||
/** Flag if any point of the element is selected. */
|
/** Flag if any point of the element is selected. */
|
||||||
protected boolean ptSelected = false;
|
protected boolean ptSelected = false;
|
||||||
|
|
||||||
/** The original direction is needed for undo. */
|
/** The original direction is needed for undo. */
|
||||||
private Double oldDir = null; // using Double instead of double because we need to use null value
|
private Double oldDir = null; // using Double instead of double because
|
||||||
|
// we need to use null value
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseDown(int,
|
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseDown(int,
|
||||||
* int, int)
|
* int, int)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean handleMouseDown(int x, int y, int button) {
|
public boolean handleMouseDown(int x, int y, int button) {
|
||||||
if ( !isResourceEditable() ) return false;
|
if (!isResourceEditable())
|
||||||
|
return false;
|
||||||
|
|
||||||
// Check if mouse is in geographic extent
|
// Check if mouse is in geographic extent
|
||||||
Coordinate loc = mapEditor.translateClick(x, y);
|
Coordinate loc = mapEditor.translateClick(x, y);
|
||||||
if (loc == null || shiftDown ) {
|
if (loc == null || shiftDown) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (button == 1) {
|
if (button == 1) {
|
||||||
|
|
||||||
// Return if an element or a point has been selected
|
// Return if an element or a point has been selected
|
||||||
if (ptSelected || drawingLayer.getSelectedDE() != null) {
|
if (ptSelected || drawingLayer.getSelectedDE() != null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the nearest element and set it as the selected element.
|
// Get the nearest element and set it as the selected element.
|
||||||
DrawableElement elSelected = drawingLayer.getNearestElement(loc, rotateFilter);
|
DrawableElement elSelected = drawingLayer.getNearestElement(
|
||||||
|
loc, rotateFilter);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (elSelected instanceof TCAElement) {
|
* if (elSelected instanceof TCAElement) {
|
||||||
PgenUtil.loadTCATool(elSelected);
|
* PgenUtil.loadTCATool(elSelected); } else if (elSelected
|
||||||
} else if (elSelected instanceof WatchBox) {
|
* instanceof WatchBox) {
|
||||||
PgenUtil.loadWatchBoxModifyTool(elSelected);
|
* PgenUtil.loadWatchBoxModifyTool(elSelected); }
|
||||||
}
|
*/
|
||||||
*/
|
|
||||||
|
|
||||||
if (elSelected != null) drawingLayer.setSelected(elSelected);
|
if (elSelected != null)
|
||||||
|
drawingLayer.setSelected(elSelected);
|
||||||
|
|
||||||
mapEditor.refresh();
|
mapEditor.refresh();
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
} else if (button == 3) {
|
} else if (button == 3) {
|
||||||
|
|
||||||
if (trackExtrapPointInfoDlg != null){
|
if (trackExtrapPointInfoDlg != null) {
|
||||||
trackExtrapPointInfoDlg.close();
|
trackExtrapPointInfoDlg.close();
|
||||||
trackExtrapPointInfoDlg = null;
|
trackExtrapPointInfoDlg = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
drawingLayer.removeGhostLine();
|
if (drawingLayer.getSelectedDE() != null) {
|
||||||
ptSelected = false;
|
drawingLayer.removeGhostLine();
|
||||||
drawingLayer.removeSelected();
|
ptSelected = false;
|
||||||
mapEditor.refresh();
|
drawingLayer.removeSelected();
|
||||||
|
mapEditor.refresh();
|
||||||
|
|
||||||
return false;
|
} else {
|
||||||
}
|
// set selecting mode
|
||||||
|
PgenUtil.setSelectingMode();
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
return false;
|
||||||
* (non-Javadoc)
|
}
|
||||||
*
|
|
||||||
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseDownMove(int,
|
|
||||||
* int, int)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean handleMouseDownMove(int x, int y, int button) {
|
|
||||||
if ( !isResourceEditable() ) return false;
|
|
||||||
|
|
||||||
// Check if mouse is in geographic extent
|
/*
|
||||||
Coordinate loc = mapEditor.translateClick(x, y);
|
* (non-Javadoc)
|
||||||
if (loc == null || shiftDown ) return false;
|
*
|
||||||
|
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseDownMove(int,
|
||||||
|
* int, int)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean handleMouseDownMove(int x, int y, int button) {
|
||||||
|
if (!isResourceEditable())
|
||||||
|
return false;
|
||||||
|
|
||||||
DrawableElement el = drawingLayer.getSelectedDE();
|
// Check if mouse is in geographic extent
|
||||||
|
Coordinate loc = mapEditor.translateClick(x, y);
|
||||||
|
if (loc == null || shiftDown)
|
||||||
|
return false;
|
||||||
|
|
||||||
// The requirements are to rotate Vector and Text elements only
|
DrawableElement el = drawingLayer.getSelectedDE();
|
||||||
// Do not modify other elements
|
|
||||||
if (el != null) {
|
|
||||||
Coordinate origin = ((ISinglePoint)el).getLocation();
|
|
||||||
|
|
||||||
if (el instanceof Vector) {
|
// The requirements are to rotate Vector and Text elements only
|
||||||
if (oldDir == null) {
|
// Do not modify other elements
|
||||||
oldDir = ((Vector) el).getDirection(); // autoboxing to Double
|
if (el != null) {
|
||||||
}
|
Coordinate origin = ((ISinglePoint) el).getLocation();
|
||||||
double[] swtCoordinates = mapEditor.translateInverseClick(origin);
|
|
||||||
Double newDir = PgenToolUtils.calculateAngle(oldDir, swtCoordinates[0], swtCoordinates[1], x, y);
|
|
||||||
if("Hash".equals(((Vector) el).getPgenType())){
|
|
||||||
newDir = PgenToolUtils.transformToRange0To360(180 - newDir);
|
|
||||||
newDir -= southOffsetAngle(origin);
|
|
||||||
} else {
|
|
||||||
// offset for the location point
|
|
||||||
newDir += southOffsetAngle(origin);
|
|
||||||
}
|
|
||||||
((Vector) el).setDirection(newDir);
|
|
||||||
|
|
||||||
} else if (el instanceof Text) {
|
if (el instanceof Vector) {
|
||||||
if (oldDir == null) {
|
if (oldDir == null) {
|
||||||
oldDir = ((Text) el).getRotation(); // autoboxing to Double
|
oldDir = ((Vector) el).getDirection(); // autoboxing to
|
||||||
}
|
// Double
|
||||||
double[] swtCoordinates = mapEditor.translateInverseClick(origin);
|
}
|
||||||
Double newRotation = 180 - PgenToolUtils.calculateAngle(oldDir, swtCoordinates[0], swtCoordinates[1], x, y);
|
double[] swtCoordinates = mapEditor
|
||||||
newRotation = PgenToolUtils.transformToRange0To360(newRotation);
|
.translateInverseClick(origin);
|
||||||
if(((Text) el).getRotationRelativity() == TextRotation.NORTH_RELATIVE){
|
Double newDir = PgenToolUtils.calculateAngle(oldDir,
|
||||||
// offset for the location point
|
swtCoordinates[0], swtCoordinates[1], x, y);
|
||||||
newRotation -= southOffsetAngle(origin);
|
if ("Hash".equals(((Vector) el).getPgenType())) {
|
||||||
}
|
newDir = PgenToolUtils
|
||||||
((Text) el).setRotation(newRotation);
|
.transformToRange0To360(180 - newDir);
|
||||||
}
|
newDir -= southOffsetAngle(origin);
|
||||||
|
} else {
|
||||||
|
// offset for the location point
|
||||||
|
newDir += southOffsetAngle(origin);
|
||||||
|
}
|
||||||
|
((Vector) el).setDirection(newDir);
|
||||||
|
|
||||||
drawingLayer.resetElement(el); // reset display of this element
|
} else if (el instanceof Text) {
|
||||||
mapEditor.refresh();
|
if (oldDir == null) {
|
||||||
}
|
oldDir = ((Text) el).getRotation(); // autoboxing to
|
||||||
|
// Double
|
||||||
|
}
|
||||||
|
double[] swtCoordinates = mapEditor
|
||||||
|
.translateInverseClick(origin);
|
||||||
|
Double newRotation = 180 - PgenToolUtils.calculateAngle(
|
||||||
|
oldDir, swtCoordinates[0], swtCoordinates[1], x, y);
|
||||||
|
newRotation = PgenToolUtils
|
||||||
|
.transformToRange0To360(newRotation);
|
||||||
|
if (((Text) el).getRotationRelativity() == TextRotation.NORTH_RELATIVE) {
|
||||||
|
// offset for the location point
|
||||||
|
newRotation -= southOffsetAngle(origin);
|
||||||
|
}
|
||||||
|
((Text) el).setRotation(newRotation);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
drawingLayer.resetElement(el); // reset display of this element
|
||||||
}
|
mapEditor.refresh();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
return true;
|
||||||
* Calculates the angle difference of "south" relative to the screen's y-axis
|
}
|
||||||
* at a given lat/lon location.
|
|
||||||
* @param loc - The point location in Lat/Lon coordinates
|
|
||||||
* @return The angle difference of "north" versus pixel coordinate's y-axis
|
|
||||||
*/
|
|
||||||
private double southOffsetAngle( Coordinate loc ) {
|
|
||||||
|
|
||||||
double delta = 0.05;
|
/**
|
||||||
/*
|
* Calculates the angle difference of "south" relative to the screen's
|
||||||
* copy/paste from DisplayElementFactory
|
* y-axis at a given lat/lon location.
|
||||||
*
|
*
|
||||||
* Calculate points in pixel coordinates just south and north of
|
* @param loc
|
||||||
* original location.
|
* - The point location in Lat/Lon coordinates
|
||||||
*/
|
* @return The angle difference of "north" versus pixel coordinate's
|
||||||
double[] south = { loc.x, loc.y - delta, 0.0 };
|
* y-axis
|
||||||
double[] pt1 = drawingLayer.getDescriptor().worldToPixel(south);
|
*/
|
||||||
|
private double southOffsetAngle(Coordinate loc) {
|
||||||
|
|
||||||
double[] north = { loc.x, loc.y + delta, 0.0 };
|
double delta = 0.05;
|
||||||
double[] pt2 = drawingLayer.getDescriptor().worldToPixel(north);
|
/*
|
||||||
|
* copy/paste from DisplayElementFactory
|
||||||
|
*
|
||||||
|
* Calculate points in pixel coordinates just south and north of
|
||||||
|
* original location.
|
||||||
|
*/
|
||||||
|
double[] south = { loc.x, loc.y - delta, 0.0 };
|
||||||
|
double[] pt1 = drawingLayer.getDescriptor().worldToPixel(south);
|
||||||
|
|
||||||
return -90 - toDegrees(atan2( (pt2[1]-pt1[1]), (pt2[0]-pt1[0]) ));
|
double[] north = { loc.x, loc.y + delta, 0.0 };
|
||||||
}
|
double[] pt2 = drawingLayer.getDescriptor().worldToPixel(north);
|
||||||
|
|
||||||
|
return -90 - toDegrees(atan2((pt2[1] - pt1[1]), (pt2[0] - pt1[0])));
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseUp(int, int,
|
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseUp(int, int,
|
||||||
* int)
|
* int)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean handleMouseUp(int x, int y, int button) {
|
public boolean handleMouseUp(int x, int y, int button) {
|
||||||
if ( !isResourceEditable() ) return false;
|
if (!isResourceEditable())
|
||||||
|
return false;
|
||||||
|
|
||||||
// Finish the editing
|
// Finish the editing
|
||||||
if (button == 1 && drawingLayer != null) {
|
if (button == 1 && drawingLayer != null) {
|
||||||
|
|
||||||
// Create a copy of the currently selected element
|
// Create a copy of the currently selected element
|
||||||
DrawableElement el = drawingLayer.getSelectedDE();
|
DrawableElement el = drawingLayer.getSelectedDE();
|
||||||
|
|
||||||
if (el != null && oldDir != null) {
|
if (el != null && oldDir != null) {
|
||||||
|
|
||||||
DrawableElement newEl = (DrawableElement) el.copy();
|
DrawableElement newEl = (DrawableElement) el.copy();
|
||||||
|
|
||||||
drawingLayer.resetElement(el);
|
drawingLayer.resetElement(el);
|
||||||
|
|
||||||
if (el instanceof Vector) {
|
if (el instanceof Vector) {
|
||||||
((Vector) el).setDirection(oldDir);
|
((Vector) el).setDirection(oldDir);
|
||||||
oldDir = null;
|
oldDir = null;
|
||||||
} else if (el instanceof Text) {
|
} else if (el instanceof Text) {
|
||||||
((Text) el).setRotation(oldDir);
|
((Text) el).setRotation(oldDir);
|
||||||
oldDir = null;
|
oldDir = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
drawingLayer.replaceElement(el, newEl);
|
drawingLayer.replaceElement(el, newEl);
|
||||||
drawingLayer.setSelected(newEl);
|
drawingLayer.setSelected(newEl);
|
||||||
|
|
||||||
mapEditor.refresh();
|
mapEditor.refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the nearest point of an selected element to the input point
|
* Gets the nearest point of an selected element to the input point
|
||||||
*
|
*
|
||||||
* @param el
|
* @param el
|
||||||
* element
|
* element
|
||||||
* @param pt
|
* @param pt
|
||||||
* input point
|
* input point
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected int getNearestPtIndex(MultiPointElement el, Coordinate pt) {
|
protected int getNearestPtIndex(MultiPointElement el, Coordinate pt) {
|
||||||
|
|
||||||
int ptId = 0;
|
int ptId = 0;
|
||||||
double minDistance = -1;
|
double minDistance = -1;
|
||||||
GeodeticCalculator gc;
|
GeodeticCalculator gc;
|
||||||
gc = new GeodeticCalculator(drawingLayer.getCoordinateReferenceSystem());
|
gc = new GeodeticCalculator(
|
||||||
gc.setStartingGeographicPoint(pt.x, pt.y);
|
drawingLayer.getCoordinateReferenceSystem());
|
||||||
int index = 0;
|
gc.setStartingGeographicPoint(pt.x, pt.y);
|
||||||
for (Coordinate elPoint : el.getPoints()) {
|
int index = 0;
|
||||||
gc.setDestinationGeographicPoint(elPoint.x, elPoint.y);
|
for (Coordinate elPoint : el.getPoints()) {
|
||||||
double dist = gc.getOrthodromicDistance();
|
gc.setDestinationGeographicPoint(elPoint.x, elPoint.y);
|
||||||
if (minDistance < 0 || dist < minDistance) {
|
double dist = gc.getOrthodromicDistance();
|
||||||
minDistance = dist;
|
if (minDistance < 0 || dist < minDistance) {
|
||||||
ptId = index;
|
minDistance = dist;
|
||||||
}
|
ptId = index;
|
||||||
index++;
|
}
|
||||||
}
|
index++;
|
||||||
return ptId;
|
}
|
||||||
}
|
return ptId;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,6 +77,14 @@ import com.vividsolutions.jts.geom.Point;
|
||||||
* 09/13 ? J. Wu Call buildVortext for GFA when mouse is
|
* 09/13 ? J. Wu Call buildVortext for GFA when mouse is
|
||||||
* down since GFA converted from VGF does not
|
* down since GFA converted from VGF does not
|
||||||
* have vorText set.
|
* have vorText set.
|
||||||
|
* 04/14 #1117 J. Wu Set focus to label/update line type for Contours.
|
||||||
|
* 04/2014 TTR867 pswamy Select-tool-on-center-vertex of circle does not
|
||||||
|
* move circle (as in NMAP)
|
||||||
|
* 04/21/2014 TTR992 D. Sushon Contour tool's Label >> Edit option should not close
|
||||||
|
* main Contour tool window on Cancel, changing a
|
||||||
|
* symbol's label should not change the symbol;
|
||||||
|
* Both issues fixed.
|
||||||
|
* 05/14 TTR1008 J. Wu Set "adc" to current contour for PgenContoursTool..
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -171,20 +179,27 @@ public class PgenSelectHandler extends InputHandlerDefaultImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean handleMouseDown(int anX, int aY, int button) {
|
public boolean handleMouseDown(int anX, int aY, int button) {
|
||||||
|
|
||||||
if (!tool.isResourceEditable())
|
if (!tool.isResourceEditable()) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
// Check if mouse is in geographic extent
|
// Check if mouse is in geographic extent
|
||||||
Coordinate loc = mapEditor.translateClick(anX, aY);
|
Coordinate loc = mapEditor.translateClick(anX, aY);
|
||||||
if (loc == null || shiftDown || simulate)
|
if (loc == null || shiftDown || simulate) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
preempt = false;
|
preempt = false;
|
||||||
|
|
||||||
|
if (attrDlg != null && attrDlg instanceof ContoursAttrDlg) {
|
||||||
|
((ContoursAttrDlg) attrDlg).setLabelFocus();
|
||||||
|
}
|
||||||
|
|
||||||
if (button == 1) {
|
if (button == 1) {
|
||||||
|
|
||||||
// reset ptSelected flag in case the dialog is closed without
|
// reset ptSelected flag in case the dialog is closed without
|
||||||
// right-mouse click.
|
// right-mouse click.
|
||||||
if (pgenrsc.getSelectedDE() == null)
|
if (pgenrsc.getSelectedDE() == null) {
|
||||||
ptSelected = false;
|
ptSelected = false;
|
||||||
|
}
|
||||||
|
|
||||||
// Return if an element or a point has been selected
|
// Return if an element or a point has been selected
|
||||||
if (ptSelected || pgenrsc.getSelectedDE() != null) {
|
if (ptSelected || pgenrsc.getSelectedDE() != null) {
|
||||||
|
@ -229,8 +244,9 @@ public class PgenSelectHandler extends InputHandlerDefaultImpl {
|
||||||
// AbstractDrawableComponent adc = drawingLayer.getNearestComponent(
|
// AbstractDrawableComponent adc = drawingLayer.getNearestComponent(
|
||||||
// loc, new AcceptFilter(), true );
|
// loc, new AcceptFilter(), true );
|
||||||
|
|
||||||
if (elSelected == null)
|
if (elSelected == null) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
preempt = true;
|
preempt = true;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -263,6 +279,8 @@ public class PgenSelectHandler extends InputHandlerDefaultImpl {
|
||||||
// of the contour.
|
// of the contour.
|
||||||
ptSelected = false;
|
ptSelected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
adc = dec;
|
||||||
}
|
}
|
||||||
|
|
||||||
pgCategory = "MET";
|
pgCategory = "MET";
|
||||||
|
@ -472,24 +490,34 @@ public class PgenSelectHandler extends InputHandlerDefaultImpl {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean handleMouseDownMove(int x, int y, int button) {
|
public boolean handleMouseDownMove(int x, int y, int button) {
|
||||||
if (!tool.isResourceEditable())
|
if (!tool.isResourceEditable()) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (shiftDown)
|
if (shiftDown) {
|
||||||
return false;
|
return false;
|
||||||
if (dontMove && pgenrsc.getSelectedDE() != null)
|
}
|
||||||
|
if (dontMove && pgenrsc.getSelectedDE() != null) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (attrDlg != null && attrDlg instanceof ContoursAttrDlg) {
|
||||||
|
((ContoursAttrDlg) attrDlg).setLabelFocus();
|
||||||
|
}
|
||||||
|
|
||||||
// Check if mouse is in geographic extent
|
// Check if mouse is in geographic extent
|
||||||
Coordinate loc = mapEditor.translateClick(x, y);
|
Coordinate loc = mapEditor.translateClick(x, y);
|
||||||
// if ( loc == null ) return false;
|
// if ( loc == null ){ return false;}
|
||||||
|
|
||||||
DrawableElement tmpEl = pgenrsc.getSelectedDE();
|
DrawableElement tmpEl = pgenrsc.getSelectedDE();
|
||||||
if (PgenUtil.isUnmovable(tmpEl))
|
if (PgenUtil.isUnmovable(tmpEl)) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
if (loc != null)
|
if (loc != null) {
|
||||||
tempLoc = loc;
|
tempLoc = loc;
|
||||||
|
}
|
||||||
|
|
||||||
if (loc != null && inOut == 1) {
|
if (loc != null && inOut == 1) {
|
||||||
// make sure the click is close enough to the element
|
// make sure the click is close enough to the element
|
||||||
|
@ -510,13 +538,14 @@ public class PgenSelectHandler extends InputHandlerDefaultImpl {
|
||||||
} else if (loc != null && inOut == 0) {
|
} else if (loc != null && inOut == 0) {
|
||||||
inOut = 1;
|
inOut = 1;
|
||||||
} else {
|
} else {
|
||||||
if (inOut != 0)
|
if (inOut != 0) {
|
||||||
inOut = 0;
|
inOut = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (tmpEl == null) // make sure if no DE is selected, no moving the
|
if (tmpEl == null) { // make sure if no DE is selected, no moving
|
||||||
// DE
|
// the DE for pan
|
||||||
return false; // for pan
|
return false;
|
||||||
else {
|
} else {
|
||||||
simulate = true;
|
simulate = true;
|
||||||
PgenUtil.simulateMouseDown(x, y, button, mapEditor);
|
PgenUtil.simulateMouseDown(x, y, button, mapEditor);
|
||||||
simulate = false;
|
simulate = false;
|
||||||
|
@ -579,10 +608,12 @@ public class PgenSelectHandler extends InputHandlerDefaultImpl {
|
||||||
((TextAttrDlg) attrDlg).getString()[0]);
|
((TextAttrDlg) attrDlg).getString()[0]);
|
||||||
|
|
||||||
if (lbl.length() > 0) {
|
if (lbl.length() > 0) {
|
||||||
if (lbl.charAt(0) == '[')
|
if (lbl.charAt(0) == '[') {
|
||||||
lbl.deleteCharAt(0);
|
lbl.deleteCharAt(0);
|
||||||
if (lbl.charAt(lbl.length() - 1) == ']')
|
}
|
||||||
|
if (lbl.charAt(lbl.length() - 1) == ']') {
|
||||||
lbl.deleteCharAt(lbl.length() - 1);
|
lbl.deleteCharAt(lbl.length() - 1);
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
Integer.parseInt(lbl.toString());
|
Integer.parseInt(lbl.toString());
|
||||||
// check if the text is right or left of the
|
// check if the text is right or left of the
|
||||||
|
@ -623,9 +654,32 @@ public class PgenSelectHandler extends InputHandlerDefaultImpl {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (ptSelected) {
|
if (ptSelected) {
|
||||||
// Replace the selected point and repaint.
|
|
||||||
ghostEl.removePoint(ptIndex);
|
if ((ghostEl instanceof Arc) && (ptIndex == 0)) {
|
||||||
ghostEl.addPoint(ptIndex, loc);
|
|
||||||
|
double[] centerOldLoc = mapEditor
|
||||||
|
.translateInverseClick(ghostEl.getPoints().get(
|
||||||
|
0));
|
||||||
|
|
||||||
|
double deltaX = (x - centerOldLoc[0]);
|
||||||
|
double deltaY = (y - centerOldLoc[1]);
|
||||||
|
|
||||||
|
double[] circferOldLoc = mapEditor
|
||||||
|
.translateInverseClick(ghostEl.getPoints().get(
|
||||||
|
1));
|
||||||
|
|
||||||
|
Coordinate newLoc = mapEditor.translateClick(
|
||||||
|
(circferOldLoc[0] + deltaX),
|
||||||
|
(circferOldLoc[1] + deltaY));
|
||||||
|
|
||||||
|
// Replace the selected point and repaint.
|
||||||
|
ghostEl.getPoints().set(ptIndex, loc);
|
||||||
|
ghostEl.getPoints().set(ptIndex + 1, newLoc);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
ghostEl.getPoints().set(ptIndex, loc);
|
||||||
|
}
|
||||||
|
|
||||||
if (ghostEl instanceof Gfa && !((Gfa) ghostEl).isSnapshot()) {
|
if (ghostEl instanceof Gfa && !((Gfa) ghostEl).isSnapshot()) {
|
||||||
((GfaAttrDlg) attrDlg).setEnableStatesButton(true);
|
((GfaAttrDlg) attrDlg).setEnableStatesButton(true);
|
||||||
}
|
}
|
||||||
|
@ -651,7 +705,7 @@ public class PgenSelectHandler extends InputHandlerDefaultImpl {
|
||||||
ghostEl.setPgenType(tmpEl.getPgenType());
|
ghostEl.setPgenType(tmpEl.getPgenType());
|
||||||
|
|
||||||
ptIndex = getNearestPtIndex(ghostEl, loc);
|
ptIndex = getNearestPtIndex(ghostEl, loc);
|
||||||
|
// mapEditor
|
||||||
double[] locScreen = mapEditor
|
double[] locScreen = mapEditor
|
||||||
.translateInverseClick(loc);
|
.translateInverseClick(loc);
|
||||||
double[] pt = mapEditor.translateInverseClick((ghostEl
|
double[] pt = mapEditor.translateInverseClick((ghostEl
|
||||||
|
@ -698,8 +752,13 @@ public class PgenSelectHandler extends InputHandlerDefaultImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean handleMouseUp(int x, int y, int button) {
|
public boolean handleMouseUp(int x, int y, int button) {
|
||||||
firstDown = null;
|
firstDown = null;
|
||||||
if (!tool.isResourceEditable())
|
if (!tool.isResourceEditable()) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (attrDlg != null && attrDlg instanceof ContoursAttrDlg) {
|
||||||
|
((ContoursAttrDlg) attrDlg).setLabelFocus();
|
||||||
|
}
|
||||||
|
|
||||||
// Finish the editing
|
// Finish the editing
|
||||||
if (button == 1 && pgenrsc != null) {
|
if (button == 1 && pgenrsc != null) {
|
||||||
|
@ -837,10 +896,11 @@ public class PgenSelectHandler extends InputHandlerDefaultImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
Coordinate loc = mapEditor.translateClick(x, y);
|
Coordinate loc = mapEditor.translateClick(x, y);
|
||||||
if (loc != null)
|
if (loc != null) {
|
||||||
((SinglePointElement) newEl).setLocation(loc);
|
((SinglePointElement) newEl).setLocation(loc);
|
||||||
else
|
} else {
|
||||||
((SinglePointElement) newEl).setLocation(tempLoc);
|
((SinglePointElement) newEl).setLocation(tempLoc);
|
||||||
|
}
|
||||||
pgenrsc.setSelected(newEl);
|
pgenrsc.setSelected(newEl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -922,8 +982,9 @@ public class PgenSelectHandler extends InputHandlerDefaultImpl {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attrDlg != null)
|
if (attrDlg != null) {
|
||||||
attrDlg.setDrawableElement(newEl);
|
attrDlg.setDrawableElement(newEl);
|
||||||
|
}
|
||||||
|
|
||||||
// Set this new element as the currently selected
|
// Set this new element as the currently selected
|
||||||
// element
|
// element
|
||||||
|
@ -937,8 +998,9 @@ public class PgenSelectHandler extends InputHandlerDefaultImpl {
|
||||||
|
|
||||||
if (newEl instanceof Track) {
|
if (newEl instanceof Track) {
|
||||||
if (isModifiedPointOneOfTheLastTwoInitPoint(newEl,
|
if (isModifiedPointOneOfTheLastTwoInitPoint(newEl,
|
||||||
ptIndex))
|
ptIndex)) {
|
||||||
((Track) newEl).calculateExtrapTrackPoints();
|
((Track) newEl).calculateExtrapTrackPoints();
|
||||||
|
}
|
||||||
displayTrackExtrapPointInfoDlg((TrackAttrDlg) attrDlg,
|
displayTrackExtrapPointInfoDlg((TrackAttrDlg) attrDlg,
|
||||||
(Track) newEl);
|
(Track) newEl);
|
||||||
} else if (newEl instanceof Gfa) {
|
} else if (newEl instanceof Gfa) {
|
||||||
|
@ -979,8 +1041,9 @@ public class PgenSelectHandler extends InputHandlerDefaultImpl {
|
||||||
// PgenUtil.setSelectingMode();
|
// PgenUtil.setSelectingMode();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (trackExtrapPointInfoDlg != null)
|
if (trackExtrapPointInfoDlg != null) {
|
||||||
trackExtrapPointInfoDlg.close();
|
trackExtrapPointInfoDlg.close();
|
||||||
|
}
|
||||||
trackExtrapPointInfoDlg = null;
|
trackExtrapPointInfoDlg = null;
|
||||||
|
|
||||||
pgenrsc.removeGhostLine();
|
pgenrsc.removeGhostLine();
|
||||||
|
@ -1011,23 +1074,27 @@ public class PgenSelectHandler extends InputHandlerDefaultImpl {
|
||||||
/*
|
/*
|
||||||
* If multiPointElement is not a type of Track, do nothing
|
* If multiPointElement is not a type of Track, do nothing
|
||||||
*/
|
*/
|
||||||
if (multiPointElement == null || !(multiPointElement instanceof Track))
|
if (multiPointElement == null || !(multiPointElement instanceof Track)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Track track = (Track) multiPointElement;
|
Track track = (Track) multiPointElement;
|
||||||
int initialTrackPointSize = 0;
|
int initialTrackPointSize = 0;
|
||||||
if (track.getInitialPoints() != null)
|
if (track.getInitialPoints() != null) {
|
||||||
initialTrackPointSize = track.getInitialPoints().length;
|
initialTrackPointSize = track.getInitialPoints().length;
|
||||||
if (isInitialPointSelected(initialTrackPointSize, nearestPointIndex))
|
}
|
||||||
|
if (isInitialPointSelected(initialTrackPointSize, nearestPointIndex)) {
|
||||||
track.setInitialColor(new java.awt.Color(255, 255, 255));
|
track.setInitialColor(new java.awt.Color(255, 255, 255));
|
||||||
else
|
} else {
|
||||||
track.setExtrapColor(new java.awt.Color(255, 255, 255));
|
track.setExtrapColor(new java.awt.Color(255, 255, 255));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isInitialPointSelected(int initialPointSize,
|
private boolean isInitialPointSelected(int initialPointSize,
|
||||||
int nearestPointIndex) {
|
int nearestPointIndex) {
|
||||||
if (nearestPointIndex < initialPointSize)
|
if (nearestPointIndex < initialPointSize) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1037,16 +1104,19 @@ public class PgenSelectHandler extends InputHandlerDefaultImpl {
|
||||||
/*
|
/*
|
||||||
* If multiPointElement is not a type of Track, return false
|
* If multiPointElement is not a type of Track, return false
|
||||||
*/
|
*/
|
||||||
if (drawableElement == null || !(drawableElement instanceof Track))
|
if (drawableElement == null || !(drawableElement instanceof Track)) {
|
||||||
return isOneOfTheLastTwoInitPoint;
|
return isOneOfTheLastTwoInitPoint;
|
||||||
|
}
|
||||||
|
|
||||||
Track track = (Track) drawableElement;
|
Track track = (Track) drawableElement;
|
||||||
int initialTrackPointSize = 0;
|
int initialTrackPointSize = 0;
|
||||||
if (track.getInitialPoints() != null)
|
if (track.getInitialPoints() != null) {
|
||||||
initialTrackPointSize = track.getInitialPoints().length;
|
initialTrackPointSize = track.getInitialPoints().length;
|
||||||
|
}
|
||||||
if (nearestPointIndex == (initialTrackPointSize - 1)
|
if (nearestPointIndex == (initialTrackPointSize - 1)
|
||||||
|| nearestPointIndex == (initialTrackPointSize - 2))
|
|| nearestPointIndex == (initialTrackPointSize - 2)) {
|
||||||
isOneOfTheLastTwoInitPoint = true;
|
isOneOfTheLastTwoInitPoint = true;
|
||||||
|
}
|
||||||
|
|
||||||
return isOneOfTheLastTwoInitPoint;
|
return isOneOfTheLastTwoInitPoint;
|
||||||
}
|
}
|
||||||
|
@ -1091,15 +1161,17 @@ public class PgenSelectHandler extends InputHandlerDefaultImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void closeDlg() {
|
public void closeDlg() {
|
||||||
if (attrDlg != null)
|
if (attrDlg != null) {
|
||||||
attrDlg.close();
|
attrDlg.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayTrackExtrapPointInfoDlg(TrackAttrDlg attrDlgObject,
|
private void displayTrackExtrapPointInfoDlg(TrackAttrDlg attrDlgObject,
|
||||||
Track trackObject) {
|
Track trackObject) {
|
||||||
|
|
||||||
if (attrDlgObject == null)
|
if (attrDlgObject == null) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
TrackExtrapPointInfoDlg extrapPointInfoDlg = attrDlgObject
|
TrackExtrapPointInfoDlg extrapPointInfoDlg = attrDlgObject
|
||||||
.getTrackExtrapPointInfoDlg();
|
.getTrackExtrapPointInfoDlg();
|
||||||
if (extrapPointInfoDlg != null) {
|
if (extrapPointInfoDlg != null) {
|
||||||
|
@ -1130,20 +1202,23 @@ public class PgenSelectHandler extends InputHandlerDefaultImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isTrackElement(DrawableType drawableType) {
|
private boolean isTrackElement(DrawableType drawableType) {
|
||||||
if (drawableType == DrawableType.TRACK)
|
if (drawableType == DrawableType.TRACK) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private DrawableType getDrawableType(String pgenTypeString) {
|
private DrawableType getDrawableType(String pgenTypeString) {
|
||||||
if (Track.TRACK_PGEN_TYPE.equalsIgnoreCase(pgenTypeString))
|
if (Track.TRACK_PGEN_TYPE.equalsIgnoreCase(pgenTypeString)) {
|
||||||
return DrawableType.TRACK;
|
return DrawableType.TRACK;
|
||||||
|
}
|
||||||
return DrawableType.LINE;
|
return DrawableType.LINE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean closeAttrDlg(AttrDlg attrDlgObject, String pgenTypeString) {
|
private boolean closeAttrDlg(AttrDlg attrDlgObject, String pgenTypeString) {
|
||||||
if (attrDlgObject == null)
|
if (attrDlgObject == null) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
if (isTrackElement(getDrawableType(pgenTypeString))) {
|
if (isTrackElement(getDrawableType(pgenTypeString))) {
|
||||||
TrackAttrDlg tempTrackAttrDlg = (TrackAttrDlg) attrDlgObject;
|
TrackAttrDlg tempTrackAttrDlg = (TrackAttrDlg) attrDlgObject;
|
||||||
TrackExtrapPointInfoDlg tempTrackExtrapPointInfoDlg = tempTrackAttrDlg
|
TrackExtrapPointInfoDlg tempTrackExtrapPointInfoDlg = tempTrackAttrDlg
|
||||||
|
@ -1156,8 +1231,9 @@ public class PgenSelectHandler extends InputHandlerDefaultImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void closeTrackExtrapPointInfoDlg(TrackExtrapPointInfoDlg dlgObject) {
|
private void closeTrackExtrapPointInfoDlg(TrackExtrapPointInfoDlg dlgObject) {
|
||||||
if (dlgObject != null)
|
if (dlgObject != null) {
|
||||||
dlgObject.close();
|
dlgObject.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1214,8 +1290,9 @@ public class PgenSelectHandler extends InputHandlerDefaultImpl {
|
||||||
newContours.update(oldContours);
|
newContours.update(oldContours);
|
||||||
pgenrsc.replaceElement(oldContours, newContours);
|
pgenrsc.replaceElement(oldContours, newContours);
|
||||||
pgenrsc.setSelected(selElem);
|
pgenrsc.setSelected(selElem);
|
||||||
if (attrDlg != null)
|
if (attrDlg != null) {
|
||||||
((ContoursAttrDlg) attrDlg).setCurrentContours(newContours);
|
((ContoursAttrDlg) attrDlg).setCurrentContours(newContours);
|
||||||
|
}
|
||||||
((PgenContoursTool) tool).setCurrentContour(newContours);
|
((PgenContoursTool) tool).setCurrentContour(newContours);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1254,7 +1331,8 @@ public class PgenSelectHandler extends InputHandlerDefaultImpl {
|
||||||
|
|
||||||
cdlg.setNumOfLabels(((ContourLine) pele).getNumOfLabels());
|
cdlg.setNumOfLabels(((ContourLine) pele).getNumOfLabels());
|
||||||
cdlg.setClosed(((Line) elSelected).isClosedLine());
|
cdlg.setClosed(((Line) elSelected).isClosedLine());
|
||||||
cdlg.setContourLineType(elSelected.getPgenType());
|
cdlg.setActiveLine(elSelected);
|
||||||
|
// cdlg.setContourLineType(elSelected.getPgenType());
|
||||||
// cdlg.setDrawingLine();
|
// cdlg.setDrawingLine();
|
||||||
} else if (elSelected instanceof Symbol) {
|
} else if (elSelected instanceof Symbol) {
|
||||||
Text lbl = ((ContourMinmax) pele).getLabel();
|
Text lbl = ((ContourMinmax) pele).getLabel();
|
||||||
|
@ -1262,7 +1340,7 @@ public class PgenSelectHandler extends InputHandlerDefaultImpl {
|
||||||
if (lbl != null) {
|
if (lbl != null) {
|
||||||
cdlg.setLabel(lbl.getText()[0]);
|
cdlg.setLabel(lbl.getText()[0]);
|
||||||
cdlg.setNumOfLabels(1);
|
cdlg.setNumOfLabels(1);
|
||||||
// cdlg.setActiveSymbol( elSelected );
|
cdlg.setActiveSymbol(elSelected);
|
||||||
}
|
}
|
||||||
} else if (elSelected instanceof Text) {
|
} else if (elSelected instanceof Text) {
|
||||||
cdlg.setLabel(((Text) elSelected).getText()[0]);
|
cdlg.setLabel(((Text) elSelected).getText()[0]);
|
||||||
|
@ -1272,13 +1350,13 @@ public class PgenSelectHandler extends InputHandlerDefaultImpl {
|
||||||
cdlg.setNumOfLabels(((ContourLine) pele).getNumOfLabels());
|
cdlg.setNumOfLabels(((ContourLine) pele).getNumOfLabels());
|
||||||
cdlg.setClosed(((ContourLine) pele).getLine()
|
cdlg.setClosed(((ContourLine) pele).getLine()
|
||||||
.isClosedLine());
|
.isClosedLine());
|
||||||
cdlg.setContourLineType(((ContourLine) pele).getLine()
|
cdlg.setActiveLine(((ContourLine) pele).getLine());
|
||||||
.getPgenType());
|
// cdlg.setContourLineType(((ContourLine) pele).getLine()
|
||||||
|
// .getPgenType());
|
||||||
} else if (pele instanceof ContourMinmax) {
|
} else if (pele instanceof ContourMinmax) {
|
||||||
// cdlg.setDrawingSymbol();
|
// cdlg.setDrawingSymbol();
|
||||||
cdlg.setNumOfLabels(1);
|
cdlg.setNumOfLabels(1);
|
||||||
// cdlg.setActiveSymbol( ((ContourMinmax)pele).getSymbol()
|
cdlg.setActiveSymbol(((ContourMinmax) pele).getSymbol());
|
||||||
// );
|
|
||||||
} else if (pele instanceof ContourCircle) {
|
} else if (pele instanceof ContourCircle) {
|
||||||
// cdlg.setDrawingCircle();
|
// cdlg.setDrawingCircle();
|
||||||
cdlg.setNumOfLabels(1);
|
cdlg.setNumOfLabels(1);
|
||||||
|
|
Loading…
Add table
Reference in a new issue