Merge "Issue #875 - Create com.raytheon.uf.viz.points" into development
Former-commit-id:35c8d72efe
[formerly6e18c9d2b3
] [formerly34a3d7b141
] [formerly35c8d72efe
[formerly6e18c9d2b3
] [formerly34a3d7b141
] [formerly73e087494c
[formerly34a3d7b141
[formerly 78f6d94e5be35624e63960196ed3a56bd72306a9]]]] Former-commit-id:73e087494c
Former-commit-id:18776648ac
[formerly2ce79c4fbb
] [formerly 54cc51c8cadb8ca1e009af8ee7a580bde56aaff2 [formerly798ac5882f
]] Former-commit-id: ef613799b5e7f743055529c8f316ec410329c76e [formerly35bb79d4ab
] Former-commit-id:860c3982fc
This commit is contained in:
commit
c15cb7a864
41 changed files with 1409 additions and 869 deletions
|
@ -42,5 +42,10 @@
|
||||||
download-size="0"
|
download-size="0"
|
||||||
install-size="0"
|
install-size="0"
|
||||||
version="0.0.0"/>
|
version="0.0.0"/>
|
||||||
|
<plugin
|
||||||
|
id="com.raytheon.uf.viz.points"
|
||||||
|
download-size="0"
|
||||||
|
install-size="0"
|
||||||
|
version="0.0.0"/>
|
||||||
|
|
||||||
</feature>
|
</feature>
|
||||||
|
|
|
@ -50,13 +50,16 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Jan 4, 2010 mschenke Initial creation
|
* Jan 4, 2010 mschenke Initial creation
|
||||||
|
* Jul 11, 2012 #875 rferrel Return Value now only set
|
||||||
|
* to bundle on Load. Prevents
|
||||||
|
* the window's 'x' close from
|
||||||
|
* trying to perform a load.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author mschenke
|
* @author mschenke
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class AlterBundleDlg extends CaveSWTDialog {
|
public class AlterBundleDlg extends CaveSWTDialog {
|
||||||
|
|
||||||
private static class AlterBundleEntry {
|
private static class AlterBundleEntry {
|
||||||
|
@ -95,11 +98,6 @@ public class AlterBundleDlg extends CaveSWTDialog {
|
||||||
return mainLayout;
|
return mainLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void disposed() {
|
|
||||||
setReturnValue(bundle);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initializeComponents(Shell shell) {
|
protected void initializeComponents(Shell shell) {
|
||||||
Composite mainComposite = new Composite(shell, SWT.NONE);
|
Composite mainComposite = new Composite(shell, SWT.NONE);
|
||||||
|
@ -231,7 +229,7 @@ public class AlterBundleDlg extends CaveSWTDialog {
|
||||||
entry.alterValue);
|
entry.alterValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
setReturnValue(bundle);
|
||||||
shell.close();
|
shell.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
7
cave/com.raytheon.uf.viz.points/.classpath
Normal file
7
cave/com.raytheon.uf.viz.points/.classpath
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
|
<classpathentry kind="src" path="src"/>
|
||||||
|
<classpathentry kind="output" path="bin"/>
|
||||||
|
</classpath>
|
28
cave/com.raytheon.uf.viz.points/.project
Normal file
28
cave/com.raytheon.uf.viz.points/.project
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>com.raytheon.uf.viz.points</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.pde.PluginNature</nature>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
|
@ -0,0 +1,8 @@
|
||||||
|
#Tue Jul 10 10:45:07 CDT 2012
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||||
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.source=1.6
|
19
cave/com.raytheon.uf.viz.points/META-INF/MANIFEST.MF
Normal file
19
cave/com.raytheon.uf.viz.points/META-INF/MANIFEST.MF
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
Manifest-Version: 1.0
|
||||||
|
Bundle-ManifestVersion: 2
|
||||||
|
Bundle-Name: Points
|
||||||
|
Bundle-SymbolicName: com.raytheon.uf.viz.points
|
||||||
|
Bundle-Version: 1.0.0.qualifier
|
||||||
|
Bundle-Activator: com.raytheon.uf.viz.points.Activator
|
||||||
|
Bundle-Vendor: RAYTHEON
|
||||||
|
Require-Bundle: org.eclipse.ui,
|
||||||
|
org.eclipse.core.runtime,
|
||||||
|
javax.measure;bundle-version="1.0.0",
|
||||||
|
org.geotools;bundle-version="2.6.4",
|
||||||
|
com.raytheon.uf.common.localization;bundle-version="1.12.1174",
|
||||||
|
com.raytheon.uf.viz.core;bundle-version="1.12.1174",
|
||||||
|
com.raytheon.uf.common.time;bundle-version="1.12.1174",
|
||||||
|
com.raytheon.viz.core;bundle-version="1.12.1174",
|
||||||
|
com.raytheon.uf.common.awipstools;bundle-version="1.12.1174"
|
||||||
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||||
|
Bundle-ActivationPolicy: lazy
|
||||||
|
Export-Package: com.raytheon.uf.viz.points
|
4
cave/com.raytheon.uf.viz.points/build.properties
Normal file
4
cave/com.raytheon.uf.viz.points/build.properties
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
source.. = src/
|
||||||
|
output.. = bin/
|
||||||
|
bin.includes = META-INF/,\
|
||||||
|
.
|
|
@ -0,0 +1,50 @@
|
||||||
|
package com.raytheon.uf.viz.points;
|
||||||
|
|
||||||
|
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||||
|
import org.osgi.framework.BundleContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The activator class controls the plug-in life cycle
|
||||||
|
*/
|
||||||
|
public class Activator extends AbstractUIPlugin {
|
||||||
|
|
||||||
|
// The plug-in ID
|
||||||
|
public static final String PLUGIN_ID = "com.raytheon.uf.viz.points"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
// The shared instance
|
||||||
|
private static Activator plugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The constructor
|
||||||
|
*/
|
||||||
|
public Activator() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
|
||||||
|
*/
|
||||||
|
public void start(BundleContext context) throws Exception {
|
||||||
|
super.start(context);
|
||||||
|
plugin = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
|
||||||
|
*/
|
||||||
|
public void stop(BundleContext context) throws Exception {
|
||||||
|
plugin = null;
|
||||||
|
super.stop(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the shared instance
|
||||||
|
*
|
||||||
|
* @return the shared instance
|
||||||
|
*/
|
||||||
|
public static Activator getDefault() {
|
||||||
|
return plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
package com.raytheon.uf.viz.points;
|
||||||
|
|
||||||
|
/*****************************************************************************************
|
||||||
|
* COPYRIGHT (c), 2007, RAYTHEON COMPANY
|
||||||
|
* ALL RIGHTS RESERVED, An Unpublished Work
|
||||||
|
*
|
||||||
|
* RAYTHEON PROPRIETARY
|
||||||
|
* If the end user is not the U.S. Government or any agency thereof, use
|
||||||
|
* or disclosure of data contained in this source code file is subject to
|
||||||
|
* the proprietary restrictions set forth in the Master Rights File.
|
||||||
|
*
|
||||||
|
* U.S. GOVERNMENT PURPOSE RIGHTS NOTICE
|
||||||
|
* If the end user is the U.S. Government or any agency thereof, this source
|
||||||
|
* code is provided to the U.S. Government with Government Purpose Rights.
|
||||||
|
* Use or disclosure of data contained in this source code file is subject to
|
||||||
|
* the "Government Purpose Rights" restriction in the Master Rights File.
|
||||||
|
*
|
||||||
|
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||||
|
* Use or disclosure of data contained in this source code file is subject to
|
||||||
|
* the export restrictions set forth in the Master Rights File.
|
||||||
|
******************************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface for listening for tool changes. Register with PointsDataManager
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author mschenke
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface IPointChangedListener {
|
||||||
|
|
||||||
|
public void pointChanged();
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,463 @@
|
||||||
|
/**
|
||||||
|
* This software was developed and / or modified by Raytheon Company,
|
||||||
|
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||||
|
*
|
||||||
|
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||||
|
* This software product contains export-restricted data whose
|
||||||
|
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||||
|
* to non-U.S. persons whether in the United States or abroad requires
|
||||||
|
* an export license or other authorization.
|
||||||
|
*
|
||||||
|
* Contractor Name: Raytheon Company
|
||||||
|
* Contractor Address: 6825 Pine Street, Suite 340
|
||||||
|
* Mail Stop B8
|
||||||
|
* Omaha, NE 68106
|
||||||
|
* 402.291.0100
|
||||||
|
*
|
||||||
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
|
* further licensing information.
|
||||||
|
**/
|
||||||
|
package com.raytheon.uf.viz.points;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.BufferedWriter;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.measure.converter.UnitConverter;
|
||||||
|
import javax.measure.unit.NonSI;
|
||||||
|
import javax.measure.unit.SI;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.ListenerList;
|
||||||
|
import org.eclipse.jface.util.IPropertyChangeListener;
|
||||||
|
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||||
|
import org.geotools.referencing.GeodeticCalculator;
|
||||||
|
import org.geotools.referencing.datum.DefaultEllipsoid;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.awipstools.GetWfoCenterPoint;
|
||||||
|
import com.raytheon.uf.common.localization.FileUpdatedMessage;
|
||||||
|
import com.raytheon.uf.common.localization.ILocalizationFileObserver;
|
||||||
|
import com.raytheon.uf.common.localization.IPathManager;
|
||||||
|
import com.raytheon.uf.common.localization.LocalizationContext;
|
||||||
|
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
||||||
|
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
||||||
|
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||||
|
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||||
|
import com.raytheon.uf.common.localization.exception.LocalizationException;
|
||||||
|
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
|
import com.raytheon.uf.common.status.UFStatus;
|
||||||
|
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
|
import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
||||||
|
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||||
|
import com.raytheon.viz.core.CorePlugin;
|
||||||
|
import com.vividsolutions.jts.geom.Coordinate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This manages maintaining localized files that contain information on points
|
||||||
|
* including the special point home.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* Jul 10, 2012 #875 rferrel Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author rferrel
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class PointsDataManager implements ILocalizationFileObserver,
|
||||||
|
IPropertyChangeListener {
|
||||||
|
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||||
|
.getHandler(PointsDataManager.class);
|
||||||
|
|
||||||
|
private static final GeodeticCalculator GC = new GeodeticCalculator(
|
||||||
|
DefaultEllipsoid.WGS84);
|
||||||
|
|
||||||
|
private static final UnitConverter NM_TO_METERS = NonSI.NAUTICAL_MILE
|
||||||
|
.getConverterTo(SI.METER);
|
||||||
|
|
||||||
|
private static PointsDataManager theManager;
|
||||||
|
|
||||||
|
private static final String MOVABLE_POINT_PREFIX = "movablePoint";
|
||||||
|
|
||||||
|
private static final String MOVABLE_POINT_EXT = ".txt";
|
||||||
|
|
||||||
|
private static final String HOME_LOCATION_FILE = "HomeLocation.dat";
|
||||||
|
|
||||||
|
private Map<String, Coordinate> points;
|
||||||
|
|
||||||
|
private ListenerList pointsListeners = new ListenerList();
|
||||||
|
|
||||||
|
private Coordinate home;
|
||||||
|
|
||||||
|
private ListenerList homeListeners = new ListenerList();
|
||||||
|
|
||||||
|
private Coordinate wfoCenter;
|
||||||
|
|
||||||
|
private String site;
|
||||||
|
|
||||||
|
private LocalizationFile userToolsDir;
|
||||||
|
|
||||||
|
private IPathManager pathMgr;
|
||||||
|
|
||||||
|
public static synchronized PointsDataManager getInstance() {
|
||||||
|
if (theManager == null) {
|
||||||
|
theManager = new PointsDataManager();
|
||||||
|
}
|
||||||
|
return theManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
private PointsDataManager() {
|
||||||
|
site = LocalizationManager.getInstance().getCurrentSite();
|
||||||
|
|
||||||
|
pathMgr = PathManagerFactory.getPathManager();
|
||||||
|
LocalizationContext userCtx = pathMgr.getContext(
|
||||||
|
LocalizationType.CAVE_STATIC, LocalizationLevel.USER);
|
||||||
|
|
||||||
|
userToolsDir = pathMgr.getLocalizationFile(userCtx, "awipsTools"
|
||||||
|
+ File.separator + site);
|
||||||
|
userToolsDir.addFileUpdatedObserver(this);
|
||||||
|
|
||||||
|
CorePlugin.getDefault().getPreferenceStore()
|
||||||
|
.addPropertyChangeListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Collection<String> getPointNames() {
|
||||||
|
return getPoints().keySet();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* @return the point coordinate associated with the given name, null if no
|
||||||
|
* point exists by that name
|
||||||
|
*/
|
||||||
|
public Coordinate getPoint(String name) {
|
||||||
|
if (points == null) {
|
||||||
|
getPoints();
|
||||||
|
}
|
||||||
|
Coordinate pointCoordinate = points.get(name);
|
||||||
|
if (pointCoordinate == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new Coordinate(pointCoordinate);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPoint(String name, Coordinate point) {
|
||||||
|
points.put(name, new Coordinate(point));
|
||||||
|
storePoint(userToolsDir, point, MOVABLE_POINT_PREFIX + name
|
||||||
|
+ MOVABLE_POINT_EXT);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A convince method to get the current WFO's coordinates from the server.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Coordinate getWfoCenter() {
|
||||||
|
if (wfoCenter == null) {
|
||||||
|
loadWfoCenter();
|
||||||
|
}
|
||||||
|
return new Coordinate(wfoCenter);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Coordinate getHome() {
|
||||||
|
if (home == null) {
|
||||||
|
loadHome();
|
||||||
|
}
|
||||||
|
return new Coordinate(home);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHome(Coordinate home) {
|
||||||
|
if (home == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.home = new Coordinate(home);
|
||||||
|
storeHome();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void storeHome() {
|
||||||
|
storePoint(userToolsDir, home, HOME_LOCATION_FILE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void storePoint(LocalizationFile dir, Coordinate point,
|
||||||
|
String fileName) {
|
||||||
|
|
||||||
|
LocalizationFile lf = pathMgr.getLocalizationFile(dir.getContext(),
|
||||||
|
dir.getName() + File.separator + fileName);
|
||||||
|
File file = lf.getFile();
|
||||||
|
|
||||||
|
// create the local directory if necessary
|
||||||
|
if (!file.getParentFile().exists()) {
|
||||||
|
file.getParentFile().mkdirs();
|
||||||
|
}
|
||||||
|
|
||||||
|
BufferedWriter out = null;
|
||||||
|
try {
|
||||||
|
out = new BufferedWriter(new FileWriter(file));
|
||||||
|
out.write(String.format("%f %f\n", point.y, point.x));
|
||||||
|
} catch (IOException e) {
|
||||||
|
statusHandler.handle(Priority.PROBLEM, "Error writing to file: "
|
||||||
|
+ file.getAbsolutePath(), e);
|
||||||
|
} finally {
|
||||||
|
if (out != null) {
|
||||||
|
try {
|
||||||
|
out.close();
|
||||||
|
lf.save();
|
||||||
|
} catch (IOException e) {
|
||||||
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
|
"Error writing to file: " + file.getAbsolutePath(),
|
||||||
|
e);
|
||||||
|
} catch (LocalizationException e) {
|
||||||
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
|
"Error storing locatization file to server: " + lf,
|
||||||
|
e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, Coordinate> getPoints() {
|
||||||
|
if (points == null || points.isEmpty()) {
|
||||||
|
loadPoints();
|
||||||
|
if (points == null || points.isEmpty()) {
|
||||||
|
createDefaultPoints();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return points;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createDefaultPoints() {
|
||||||
|
points = new HashMap<String, Coordinate>();
|
||||||
|
Coordinate center = getHome();
|
||||||
|
int baseRingSize = 120;
|
||||||
|
int startAngle = -90;
|
||||||
|
for (char label = 'A'; label <= 'J'; label++) {
|
||||||
|
Coordinate point = getCoordinateOnCircle(center, baseRingSize,
|
||||||
|
startAngle);
|
||||||
|
setPoint(String.valueOf(label), point);
|
||||||
|
startAngle += 36;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadWfoCenter() {
|
||||||
|
try {
|
||||||
|
// Request WFO center point from server
|
||||||
|
wfoCenter = (Coordinate) ThriftClient
|
||||||
|
.sendLocalizationRequest(new GetWfoCenterPoint(site));
|
||||||
|
} catch (VizException e) {
|
||||||
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
|
"Unable to get WFO center for \"" + site + "\"", e);
|
||||||
|
}
|
||||||
|
if (wfoCenter == null) {
|
||||||
|
wfoCenter = new Coordinate(-96.2, 41.2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Coordinate loadHome() {
|
||||||
|
home = loadPoint(userToolsDir, HOME_LOCATION_FILE);
|
||||||
|
if (home == null) {
|
||||||
|
home = getWfoCenter();
|
||||||
|
storeHome();
|
||||||
|
}
|
||||||
|
return home;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadPoints() {
|
||||||
|
points = new HashMap<String, Coordinate>();
|
||||||
|
|
||||||
|
LocalizationFile[] files = pathMgr.listFiles(userToolsDir.getContext(),
|
||||||
|
userToolsDir.getName(), new String[] { MOVABLE_POINT_EXT },
|
||||||
|
false, true);
|
||||||
|
for (LocalizationFile lf : files) {
|
||||||
|
String fileName = lf.getFile().getName();
|
||||||
|
if (fileName.startsWith(MOVABLE_POINT_PREFIX)) {
|
||||||
|
Coordinate point = loadPoint(userToolsDir, fileName);
|
||||||
|
String name = fileName.substring(MOVABLE_POINT_PREFIX.length())
|
||||||
|
.replace(MOVABLE_POINT_EXT, "");
|
||||||
|
points.put(name, point);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Coordinate getCoordinateOnCircle(Coordinate coor, double radius,
|
||||||
|
int angle) {
|
||||||
|
|
||||||
|
if (angle > 180) {
|
||||||
|
angle = angle - 360;
|
||||||
|
}
|
||||||
|
GC.setStartingGeographicPoint(coor.x, coor.y);
|
||||||
|
GC.setDirection(angle, NM_TO_METERS.convert(radius));
|
||||||
|
|
||||||
|
return new Coordinate(GC.getDestinationGeographicPoint().getX(), GC
|
||||||
|
.getDestinationGeographicPoint().getY());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* com.raytheon.uf.common.localization.ILocalizationFileObserver#fileUpdated
|
||||||
|
* (com.raytheon.uf.common.localization.FileUpdatedMessage)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void fileUpdated(FileUpdatedMessage message) {
|
||||||
|
String fileName = new File(message.getFileName()).getName();
|
||||||
|
|
||||||
|
if (fileName.startsWith(MOVABLE_POINT_PREFIX)) {
|
||||||
|
pointsFileUpdated(fileName);
|
||||||
|
} else if (fileName.startsWith(HOME_LOCATION_FILE)) {
|
||||||
|
homeLocationFileUpdated(fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void pointsFileUpdated(String fileName) {
|
||||||
|
if (points != null) {
|
||||||
|
Coordinate point = loadPoint(userToolsDir, fileName);
|
||||||
|
String name = fileName.substring(MOVABLE_POINT_PREFIX.length())
|
||||||
|
.replace(MOVABLE_POINT_EXT, "");
|
||||||
|
points.put(name, point);
|
||||||
|
|
||||||
|
for (Object listener : pointsListeners.getListeners()) {
|
||||||
|
((IPointChangedListener) listener).pointChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void homeLocationFileUpdated(String fileName) {
|
||||||
|
if (home != null) {
|
||||||
|
loadHome();
|
||||||
|
|
||||||
|
ArrayList<Thread> threads = new ArrayList<Thread>(
|
||||||
|
homeListeners.size());
|
||||||
|
for (final Object listener : homeListeners.getListeners()) {
|
||||||
|
// fire listeners in separate threads to avoid waiting to draw
|
||||||
|
// the updated location while waiting on another listener to
|
||||||
|
// finish
|
||||||
|
Thread t = new Thread(new Runnable() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
((IPointChangedListener) listener).pointChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
threads.add(t);
|
||||||
|
t.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
// join all threads before continuing so we can't fire listeners
|
||||||
|
// again until all have finished
|
||||||
|
for (Thread t : threads) {
|
||||||
|
try {
|
||||||
|
t.join();
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
statusHandler.handle(
|
||||||
|
Priority.SIGNIFICANT,
|
||||||
|
"Unexpected Interruption from: "
|
||||||
|
+ e.getLocalizedMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Coordinate loadPoint(LocalizationFile dir, String fileName) {
|
||||||
|
Coordinate point = null;
|
||||||
|
|
||||||
|
LocalizationFile lf = pathMgr.getLocalizationFile(dir.getContext(),
|
||||||
|
dir.getName() + File.separator + fileName);
|
||||||
|
File file = lf.getFile();
|
||||||
|
BufferedReader in = null;
|
||||||
|
try {
|
||||||
|
in = new BufferedReader(new FileReader(file));
|
||||||
|
String line = in.readLine();
|
||||||
|
line = line.trim();
|
||||||
|
int p = line.indexOf(' ');
|
||||||
|
double lat = Double.parseDouble(line.substring(0, p));
|
||||||
|
double lon = Double.parseDouble(line.substring(p));
|
||||||
|
|
||||||
|
if (lat > 90.0 || lat < -90.0 || lon > 180.0 || lon < -180.0) {
|
||||||
|
statusHandler
|
||||||
|
.handle(Priority.PROBLEM,
|
||||||
|
"Invalid lat/lon in wfo center point file, using default");
|
||||||
|
} else {
|
||||||
|
point = new Coordinate(lon, lat);
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
statusHandler
|
||||||
|
.handle(Priority.PROBLEM,
|
||||||
|
"Invalid number in wfo center point file, using default",
|
||||||
|
e);
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
statusHandler.handle(Priority.EVENTA,
|
||||||
|
"No wfo center point file found, creating default.");
|
||||||
|
} catch (IOException e) {
|
||||||
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
|
"Error reading wfo center point file, using default", e);
|
||||||
|
} finally {
|
||||||
|
if (in != null) {
|
||||||
|
try {
|
||||||
|
in.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
// nothing to do
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return point;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param listener
|
||||||
|
*/
|
||||||
|
public void addPointsChangedListener(IPointChangedListener listener) {
|
||||||
|
pointsListeners.add(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param listener
|
||||||
|
*/
|
||||||
|
public void removePointsChangedListener(IPointChangedListener listener) {
|
||||||
|
pointsListeners.remove(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param listener
|
||||||
|
*/
|
||||||
|
public void addHomeChangedListener(IPointChangedListener listener) {
|
||||||
|
homeListeners.add(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param listener
|
||||||
|
*/
|
||||||
|
public void removeHomeChangedListener(IPointChangedListener listener) {
|
||||||
|
homeListeners.remove(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* org.eclipse.core.runtime.Preferences.IPropertyChangeListener#propertyChange
|
||||||
|
* (org.eclipse.core.runtime.Preferences.PropertyChangeEvent)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void propertyChange(PropertyChangeEvent event) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -17,7 +17,9 @@ Require-Bundle: org.eclipse.ui,
|
||||||
com.raytheon.viz.core;bundle-version="1.11.7",
|
com.raytheon.viz.core;bundle-version="1.11.7",
|
||||||
com.raytheon.uf.common.localization;bundle-version="1.11.7",
|
com.raytheon.uf.common.localization;bundle-version="1.11.7",
|
||||||
javax.jms;bundle-version="1.0.0",
|
javax.jms;bundle-version="1.0.0",
|
||||||
com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1174"
|
com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1174",
|
||||||
|
com.raytheon.viz.ui;bundle-version="1.12.1174",
|
||||||
|
com.raytheon.uf.viz.points;bundle-version="1.0.0"
|
||||||
Export-Package: com.raytheon.uf.viz.radarapps.client,
|
Export-Package: com.raytheon.uf.viz.radarapps.client,
|
||||||
com.raytheon.uf.viz.radarapps.core,
|
com.raytheon.uf.viz.radarapps.core,
|
||||||
com.raytheon.uf.viz.radarapps.products.ui
|
com.raytheon.uf.viz.radarapps.products.ui
|
||||||
|
|
|
@ -75,8 +75,31 @@ import com.raytheon.uf.viz.radarapps.products.ui.PMenu.PMenuItem;
|
||||||
import com.raytheon.uf.viz.radarapps.products.ui.PMenu.PProductItem;
|
import com.raytheon.uf.viz.radarapps.products.ui.PMenu.PProductItem;
|
||||||
import com.raytheon.uf.viz.radarapps.products.ui.PMenu.PSeparator;
|
import com.raytheon.uf.viz.radarapps.products.ui.PMenu.PSeparator;
|
||||||
import com.raytheon.uf.viz.radarapps.products.ui.PMenu.PSubMenu;
|
import com.raytheon.uf.viz.radarapps.products.ui.PMenu.PSubMenu;
|
||||||
|
import com.raytheon.viz.ui.widgets.MenuButton;
|
||||||
|
import com.raytheon.viz.ui.widgets.MinimumSizeComposite;
|
||||||
|
|
||||||
public class BaseRadarProductUI {
|
/**
|
||||||
|
* This abstract class generates a consistent layout for various products.
|
||||||
|
* Example of use is the One Time Request Dialog.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* Initial creation
|
||||||
|
* Jul 11, 2012 #875 rferrel Refactored for changes in MenuButton and
|
||||||
|
* converted to abstract class making the
|
||||||
|
* needed methods abstract.
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author ?
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
public abstract class BaseRadarProductUI {
|
||||||
private Composite productRequestUI;
|
private Composite productRequestUI;
|
||||||
|
|
||||||
private Composite productSelectorUI;
|
private Composite productSelectorUI;
|
||||||
|
@ -324,7 +347,7 @@ public class BaseRadarProductUI {
|
||||||
if (mne != null)
|
if (mne != null)
|
||||||
productMenuButton.setSelectedItem(productMenuItems.get(mne));
|
productMenuButton.setSelectedItem(productMenuItems.get(mne));
|
||||||
else
|
else
|
||||||
productMenuButton.setSelectedItem(null);
|
productMenuButton.setSelectedItem((MenuItem) null);
|
||||||
}
|
}
|
||||||
sel = sel.narrow(new Selector(radarType, null, null, usage));
|
sel = sel.narrow(new Selector(radarType, null, null, usage));
|
||||||
|
|
||||||
|
@ -2382,41 +2405,66 @@ public class BaseRadarProductUI {
|
||||||
requestUIChange();
|
requestUIChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String[] geomList = { "A", "B", "C", "D", "E", };
|
/**
|
||||||
|
* Get an array of baseline names to process.
|
||||||
|
*
|
||||||
|
* @return baselineNames
|
||||||
|
*/
|
||||||
|
abstract protected String[] getBaselineList();
|
||||||
|
|
||||||
protected String[] getBaselineList() {
|
/**
|
||||||
return geomList;
|
* Get an array of point names to process.
|
||||||
}
|
*
|
||||||
|
* @return pointNames
|
||||||
|
*/
|
||||||
|
abstract protected String[] getPointList();
|
||||||
|
|
||||||
protected String[] getPointList() {
|
/**
|
||||||
return geomList;
|
* Get point's azimuth and range from the radar.
|
||||||
}
|
*
|
||||||
|
* @param which
|
||||||
|
* - point name
|
||||||
|
* @return result - [0] azimuth of point, [1] range of point; or null if
|
||||||
|
* unable to determine
|
||||||
|
*/
|
||||||
|
abstract protected int[] getPoint(String which);
|
||||||
|
|
||||||
protected int[] getPoint(String which) {
|
/**
|
||||||
int x = (int) which.charAt(0);
|
* Get the baseline's azimuth and range from the radar for the line's start
|
||||||
int[] result = { x, x };
|
* and end point.
|
||||||
return result;
|
*
|
||||||
}
|
* @param which
|
||||||
|
* - baseline name
|
||||||
|
* @return result - [0] azimuth start point, [1] range start point, [2]
|
||||||
|
* azimuth end point, [3] range end point; or null if unable to
|
||||||
|
* determine
|
||||||
|
*/
|
||||||
|
abstract protected int[] getBaseline(String which);
|
||||||
|
|
||||||
protected int[] getBaseline(String which) {
|
/**
|
||||||
int x = (int) which.charAt(0);
|
* Get the radar's location.
|
||||||
int[] result = { x, x, x + 20, x + 100 };
|
*
|
||||||
return result;
|
* @param radar
|
||||||
}
|
* @return array - [0] latitude, [1] longitude, [3] elevation
|
||||||
|
*/
|
||||||
|
abstract protected float[] getRadarLocation(String radar);
|
||||||
|
|
||||||
protected float[] getRadarLocation(String radar) {
|
/**
|
||||||
float[] result = { 0, 0 };
|
* Get point location
|
||||||
return result;
|
*
|
||||||
}
|
* @param which
|
||||||
|
* - point name
|
||||||
protected float[] getPointLatLon(String which) {
|
* @return array - [0] latitude, [1] longitude
|
||||||
float[] result = { 0, 0 };
|
*/
|
||||||
return result;
|
abstract protected float[] getPointLatLon(String which);
|
||||||
}
|
|
||||||
|
|
||||||
protected float[] getBaselineLatLon(String which) {
|
|
||||||
float[] result = { 0, 0, 0, 0 };
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get location of baseline's start and end points.
|
||||||
|
*
|
||||||
|
* @param which
|
||||||
|
* - baseline name
|
||||||
|
* @return array - [0] start latitude, [1] start longitude, [2] end
|
||||||
|
* latitude, [3] end longitude
|
||||||
|
*/
|
||||||
|
abstract protected float[] getBaselineLatLon(String which);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,176 +0,0 @@
|
||||||
/**
|
|
||||||
* This software was developed and / or modified by Raytheon Company,
|
|
||||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
|
||||||
*
|
|
||||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
|
||||||
* This software product contains export-restricted data whose
|
|
||||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
|
||||||
* to non-U.S. persons whether in the United States or abroad requires
|
|
||||||
* an export license or other authorization.
|
|
||||||
*
|
|
||||||
* Contractor Name: Raytheon Company
|
|
||||||
* Contractor Address: 6825 Pine Street, Suite 340
|
|
||||||
* Mail Stop B8
|
|
||||||
* Omaha, NE 68106
|
|
||||||
* 402.291.0100
|
|
||||||
*
|
|
||||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
|
||||||
* further licensing information.
|
|
||||||
**/
|
|
||||||
package com.raytheon.uf.viz.radarapps.products.ui;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
|
||||||
import org.eclipse.swt.events.DisposeEvent;
|
|
||||||
import org.eclipse.swt.events.DisposeListener;
|
|
||||||
import org.eclipse.swt.events.SelectionAdapter;
|
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
|
||||||
import org.eclipse.swt.events.SelectionListener;
|
|
||||||
import org.eclipse.swt.graphics.Point;
|
|
||||||
import org.eclipse.swt.layout.FillLayout;
|
|
||||||
import org.eclipse.swt.widgets.Button;
|
|
||||||
import org.eclipse.swt.widgets.Composite;
|
|
||||||
import org.eclipse.swt.widgets.Event;
|
|
||||||
import org.eclipse.swt.widgets.Menu;
|
|
||||||
import org.eclipse.swt.widgets.MenuItem;
|
|
||||||
|
|
||||||
public class MenuButton extends MinimumSizeComposite implements SelectionListener, DisposeListener {
|
|
||||||
private Button button;
|
|
||||||
|
|
||||||
public MenuButton(Composite parent) {
|
|
||||||
super(parent, SWT.NONE);
|
|
||||||
setLayout(new FillLayout(SWT.HORIZONTAL));
|
|
||||||
button = new Button(this, SWT.PUSH);
|
|
||||||
/*// This produced annoying behavoir...
|
|
||||||
button.addMouseListener(new MouseAdapter() {
|
|
||||||
@Override
|
|
||||||
public void mouseDown(MouseEvent e) {
|
|
||||||
if (e.button == 1) {
|
|
||||||
doPopup();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
button.addSelectionListener(new SelectionAdapter() {
|
|
||||||
public void widgetSelected(SelectionEvent e) {
|
|
||||||
doPopup();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
addDisposeListener(this);
|
|
||||||
button.setText("Xxxx Xxxxx Xxxx Xxxxxxxxx (XXX)");
|
|
||||||
setMinimumSize(button.computeSize(SWT.DEFAULT, SWT.DEFAULT));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEnabled(boolean enabled) {
|
|
||||||
button.setEnabled(enabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void doPopup() {
|
|
||||||
boolean isEnabled = button.isEnabled();
|
|
||||||
if (! isEnabled)
|
|
||||||
return;
|
|
||||||
/*
|
|
||||||
button.setEnabled(false);
|
|
||||||
button.setEnabled(true);
|
|
||||||
*/
|
|
||||||
Menu menu = getMenu();
|
|
||||||
if (menu == null)
|
|
||||||
return;
|
|
||||||
Point sz = getSize();
|
|
||||||
Point p = toDisplay(0, sz.y);
|
|
||||||
menu.setLocation(p);
|
|
||||||
menu.setVisible(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMenu(Menu menu) {
|
|
||||||
//Menu oldMenu = getMenu();
|
|
||||||
/*
|
|
||||||
if (oldMenu != null)
|
|
||||||
oldMenu.removeMenuListener(this);
|
|
||||||
*/
|
|
||||||
super.setMenu(menu);
|
|
||||||
realizeMenu();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateMenu() {
|
|
||||||
realizeMenu();
|
|
||||||
}
|
|
||||||
|
|
||||||
private ArrayList<MenuItem> menuItems = new ArrayList<MenuItem>();
|
|
||||||
private void realizeMenu() {
|
|
||||||
unrealizeMenu();
|
|
||||||
realizeMenu1(getMenu());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void realizeMenu1(Menu menu) {
|
|
||||||
if (menu != null) {
|
|
||||||
for (MenuItem mi : menu.getItems()) {
|
|
||||||
if ((mi.getStyle() & SWT.CASCADE) == 0)
|
|
||||||
mi.addSelectionListener(this);
|
|
||||||
else
|
|
||||||
realizeMenu1(mi.getMenu());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void widgetDefaultSelected(SelectionEvent e) {
|
|
||||||
widgetSelected(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
private ArrayList<SelectionListener> listeners =
|
|
||||||
new ArrayList<SelectionListener>();
|
|
||||||
private MenuItem selectedItem;
|
|
||||||
@Override
|
|
||||||
public void widgetSelected(SelectionEvent e) {
|
|
||||||
MenuItem mi;
|
|
||||||
try {
|
|
||||||
mi = (MenuItem) e.widget;
|
|
||||||
} catch (ClassCastException exc) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setSelectedItem(mi);
|
|
||||||
|
|
||||||
Event ev = new Event();
|
|
||||||
ev.widget = this;
|
|
||||||
ev.data = mi;
|
|
||||||
|
|
||||||
SelectionListener[] ls = listeners.toArray(new SelectionListener[listeners.size()]);
|
|
||||||
for (SelectionListener l : ls) {
|
|
||||||
l.widgetSelected(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void widgetDisposed(DisposeEvent e) {
|
|
||||||
unrealizeMenu();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void unrealizeMenu() {
|
|
||||||
for (MenuItem mi : menuItems) {
|
|
||||||
mi.removeSelectionListener(this);
|
|
||||||
}
|
|
||||||
menuItems.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addSelectionListener(SelectionListener listener) {
|
|
||||||
if (listener == null)
|
|
||||||
throw new NullPointerException();
|
|
||||||
listeners.add(listener);
|
|
||||||
}
|
|
||||||
|
|
||||||
public MenuItem getSelectedItem() {
|
|
||||||
return selectedItem;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSelectedItem(MenuItem selectedItem) {
|
|
||||||
this.selectedItem = selectedItem;
|
|
||||||
if (selectedItem != null)
|
|
||||||
button.setText(selectedItem.getText());
|
|
||||||
else
|
|
||||||
button.setText("");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,82 +0,0 @@
|
||||||
/**
|
|
||||||
* This software was developed and / or modified by Raytheon Company,
|
|
||||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
|
||||||
*
|
|
||||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
|
||||||
* This software product contains export-restricted data whose
|
|
||||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
|
||||||
* to non-U.S. persons whether in the United States or abroad requires
|
|
||||||
* an export license or other authorization.
|
|
||||||
*
|
|
||||||
* Contractor Name: Raytheon Company
|
|
||||||
* Contractor Address: 6825 Pine Street, Suite 340
|
|
||||||
* Mail Stop B8
|
|
||||||
* Omaha, NE 68106
|
|
||||||
* 402.291.0100
|
|
||||||
*
|
|
||||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
|
||||||
* further licensing information.
|
|
||||||
**/
|
|
||||||
package com.raytheon.uf.viz.radarapps.products.ui;
|
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
|
||||||
import org.eclipse.swt.graphics.Point;
|
|
||||||
import org.eclipse.swt.layout.GridData;
|
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
|
||||||
import org.eclipse.swt.widgets.Composite;
|
|
||||||
import org.eclipse.swt.widgets.Control;
|
|
||||||
|
|
||||||
public class MinimumSizeComposite extends Composite {
|
|
||||||
|
|
||||||
private int minWidth = SWT.DEFAULT;
|
|
||||||
private int minHeight = SWT.DEFAULT;
|
|
||||||
|
|
||||||
public MinimumSizeComposite(Composite parent) {
|
|
||||||
this(parent, SWT.NONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
public MinimumSizeComposite(Composite parent, int style) {
|
|
||||||
super(parent, style);
|
|
||||||
GridLayout gd = new GridLayout(1, false);
|
|
||||||
gd.marginWidth = 0;
|
|
||||||
gd.marginHeight = 0;
|
|
||||||
setLayout(gd);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setControl(Control c) {
|
|
||||||
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
|
|
||||||
if (minWidth != SWT.DEFAULT)
|
|
||||||
gd.minimumWidth = minWidth;
|
|
||||||
if (minHeight != SWT.DEFAULT)
|
|
||||||
gd.minimumHeight = minHeight;
|
|
||||||
c.setLayoutData(gd);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMinimumSizeFromComputedSize() {
|
|
||||||
setMinimumSize(super.computeSize(SWT.DEFAULT, SWT.DEFAULT));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Point computeSize(int wHint, int hHint, boolean changed) {
|
|
||||||
Point sz = super.computeSize(SWT.DEFAULT, SWT.DEFAULT, changed);
|
|
||||||
sz.x = Math.max(minWidth, sz.x);
|
|
||||||
sz.y = Math.max(minHeight, sz.y);
|
|
||||||
return sz;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMinimumSize(Point sz) {
|
|
||||||
minWidth = sz.x;
|
|
||||||
minHeight = sz.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMinimumSize(int width, int height) {
|
|
||||||
minWidth = width;
|
|
||||||
minHeight = height;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void layout(boolean changed, boolean all) {
|
|
||||||
super.layout(changed, all);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -31,6 +31,8 @@ import org.eclipse.ui.commands.ICommandService;
|
||||||
import org.geotools.referencing.GeodeticCalculator;
|
import org.geotools.referencing.GeodeticCalculator;
|
||||||
|
|
||||||
import com.raytheon.uf.viz.core.VizApp;
|
import com.raytheon.uf.viz.core.VizApp;
|
||||||
|
import com.raytheon.uf.viz.points.IPointChangedListener;
|
||||||
|
import com.raytheon.uf.viz.points.PointsDataManager;
|
||||||
import com.raytheon.uf.viz.radarapps.core.RadarApps;
|
import com.raytheon.uf.viz.radarapps.core.RadarApps;
|
||||||
import com.raytheon.viz.awipstools.IToolChangedListener;
|
import com.raytheon.viz.awipstools.IToolChangedListener;
|
||||||
import com.raytheon.viz.awipstools.ToolsDataManager;
|
import com.raytheon.viz.awipstools.ToolsDataManager;
|
||||||
|
@ -40,7 +42,7 @@ public class RadarProductUI extends BaseRadarProductUI {
|
||||||
|
|
||||||
private IToolChangedListener baselineListener;
|
private IToolChangedListener baselineListener;
|
||||||
|
|
||||||
private IToolChangedListener pointListener;
|
private IPointChangedListener pointListener;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String[] getBaselineList() {
|
protected String[] getBaselineList() {
|
||||||
|
@ -52,7 +54,7 @@ public class RadarProductUI extends BaseRadarProductUI {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String[] getPointList() {
|
protected String[] getPointList() {
|
||||||
ArrayList<String> pointNames = new ArrayList<String>(ToolsDataManager
|
ArrayList<String> pointNames = new ArrayList<String>(PointsDataManager
|
||||||
.getInstance().getPointNames());
|
.getInstance().getPointNames());
|
||||||
Collections.sort(pointNames);
|
Collections.sort(pointNames);
|
||||||
return pointNames.toArray(new String[pointNames.size()]);
|
return pointNames.toArray(new String[pointNames.size()]);
|
||||||
|
@ -87,16 +89,16 @@ public class RadarProductUI extends BaseRadarProductUI {
|
||||||
VizApp.runAsync(runnable);
|
VizApp.runAsync(runnable);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
pointListener = new IToolChangedListener() {
|
pointListener = new IPointChangedListener() {
|
||||||
@Override
|
@Override
|
||||||
public void toolChanged() {
|
public void pointChanged() {
|
||||||
VizApp.runAsync(runnable);
|
VizApp.runAsync(runnable);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ToolsDataManager.getInstance().addBaselinesChangedListener(
|
ToolsDataManager.getInstance().addBaselinesChangedListener(
|
||||||
baselineListener);
|
baselineListener);
|
||||||
ToolsDataManager.getInstance().addPointsChangedListener(
|
PointsDataManager.getInstance().addPointsChangedListener(
|
||||||
pointListener);
|
pointListener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,7 +106,7 @@ public class RadarProductUI extends BaseRadarProductUI {
|
||||||
@Override
|
@Override
|
||||||
protected float[] getPointLatLon(String which) {
|
protected float[] getPointLatLon(String which) {
|
||||||
maybeAddPrefListener();
|
maybeAddPrefListener();
|
||||||
Coordinate c = ToolsDataManager.getInstance().getPoint(which);
|
Coordinate c = PointsDataManager.getInstance().getPoint(which);
|
||||||
if (c != null) {
|
if (c != null) {
|
||||||
float[] result = { (float) c.y, (float) c.x };
|
float[] result = { (float) c.y, (float) c.x };
|
||||||
return result;
|
return result;
|
||||||
|
@ -191,7 +193,7 @@ public class RadarProductUI extends BaseRadarProductUI {
|
||||||
ToolsDataManager.getInstance().removeBaselinesChangedListener(
|
ToolsDataManager.getInstance().removeBaselinesChangedListener(
|
||||||
baselineListener);
|
baselineListener);
|
||||||
if (pointListener != null)
|
if (pointListener != null)
|
||||||
ToolsDataManager.getInstance().removePointsChangedListener(
|
PointsDataManager.getInstance().removePointsChangedListener(
|
||||||
pointListener);
|
pointListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,8 @@ import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
import org.eclipse.swt.widgets.Scale;
|
import org.eclipse.swt.widgets.Scale;
|
||||||
|
|
||||||
|
import com.raytheon.viz.ui.widgets.MinimumSizeComposite;
|
||||||
|
|
||||||
// TODO: make label a spinner control for precise control
|
// TODO: make label a spinner control for precise control
|
||||||
public class ScaleWithLabel extends Composite {
|
public class ScaleWithLabel extends Composite {
|
||||||
private MinimumSizeComposite msc;
|
private MinimumSizeComposite msc;
|
||||||
|
|
|
@ -22,7 +22,8 @@ Require-Bundle: org.eclipse.core.runtime,
|
||||||
com.raytheon.uf.viz.d2d.core,
|
com.raytheon.uf.viz.d2d.core,
|
||||||
com.raytheon.uf.common.dataplugin.radar;bundle-version="1.0.0",
|
com.raytheon.uf.common.dataplugin.radar;bundle-version="1.0.0",
|
||||||
com.raytheon.uf.viz.core.maps;bundle-version="1.12.1174",
|
com.raytheon.uf.viz.core.maps;bundle-version="1.12.1174",
|
||||||
com.raytheon.uf.viz.d2d.ui
|
com.raytheon.uf.viz.d2d.ui,
|
||||||
|
com.raytheon.uf.viz.points;bundle-version="1.0.0"
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Export-Package: com.raytheon.viz.awipstools,
|
Export-Package: com.raytheon.viz.awipstools,
|
||||||
com.raytheon.viz.awipstools.capabilities,
|
com.raytheon.viz.awipstools.capabilities,
|
||||||
|
|
|
@ -28,8 +28,7 @@ package com.raytheon.viz.awipstools;
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
*
|
* Initial creation
|
||||||
*
|
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author mschenke
|
* @author mschenke
|
||||||
|
|
|
@ -35,6 +35,7 @@ import com.raytheon.uf.viz.core.rsc.IPointsToolContainer;
|
||||||
import com.raytheon.uf.viz.core.rsc.IResourceGroup;
|
import com.raytheon.uf.viz.core.rsc.IResourceGroup;
|
||||||
import com.raytheon.uf.viz.core.rsc.ResourceList;
|
import com.raytheon.uf.viz.core.rsc.ResourceList;
|
||||||
import com.raytheon.uf.viz.d2d.ui.dialogs.procedures.ProcedureDlg;
|
import com.raytheon.uf.viz.d2d.ui.dialogs.procedures.ProcedureDlg;
|
||||||
|
import com.raytheon.uf.viz.points.PointsDataManager;
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
import com.vividsolutions.jts.geom.Coordinate;
|
||||||
import com.vividsolutions.jts.geom.LineString;
|
import com.vividsolutions.jts.geom.LineString;
|
||||||
|
|
||||||
|
@ -47,6 +48,8 @@ import com.vividsolutions.jts.geom.LineString;
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* Initial creation
|
||||||
|
* Jul 11, 2012 #875 rferrel Bug fix.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
|
@ -76,6 +79,7 @@ public class ToolsAlterBundleContributor implements IAlterBundleContributor {
|
||||||
public Map<String, String[]> getAlterables() {
|
public Map<String, String[]> getAlterables() {
|
||||||
Map<String, String[]> alterables = new HashMap<String, String[]>();
|
Map<String, String[]> alterables = new HashMap<String, String[]>();
|
||||||
ToolsDataManager tdm = ToolsDataManager.getInstance();
|
ToolsDataManager tdm = ToolsDataManager.getInstance();
|
||||||
|
PointsDataManager pdm = PointsDataManager.getInstance();
|
||||||
Collection<String> blNames = tdm.getBaselineNames();
|
Collection<String> blNames = tdm.getBaselineNames();
|
||||||
String[] lines = new String[blNames.size()];
|
String[] lines = new String[blNames.size()];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -85,7 +89,7 @@ public class ToolsAlterBundleContributor implements IAlterBundleContributor {
|
||||||
}
|
}
|
||||||
Arrays.sort(lines);
|
Arrays.sort(lines);
|
||||||
|
|
||||||
Collection<String> pNames = tdm.getPointNames();
|
Collection<String> pNames = pdm.getPointNames();
|
||||||
String[] points = new String[pNames.size()];
|
String[] points = new String[pNames.size()];
|
||||||
i = 0;
|
i = 0;
|
||||||
for (String point : pNames) {
|
for (String point : pNames) {
|
||||||
|
@ -99,7 +103,7 @@ public class ToolsAlterBundleContributor implements IAlterBundleContributor {
|
||||||
pointsValues[1] = ProcedureDlg.CURRENT;
|
pointsValues[1] = ProcedureDlg.CURRENT;
|
||||||
System.arraycopy(points, 0, pointsValues, 2, points.length);
|
System.arraycopy(points, 0, pointsValues, 2, points.length);
|
||||||
|
|
||||||
String[] linesValues = new String[points.length + 2];
|
String[] linesValues = new String[lines.length + 2];
|
||||||
linesValues[0] = ProcedureDlg.ORIGINAL;
|
linesValues[0] = ProcedureDlg.ORIGINAL;
|
||||||
linesValues[1] = ProcedureDlg.CURRENT;
|
linesValues[1] = ProcedureDlg.CURRENT;
|
||||||
System.arraycopy(lines, 0, linesValues, 2, lines.length);
|
System.arraycopy(lines, 0, linesValues, 2, lines.length);
|
||||||
|
@ -196,7 +200,7 @@ public class ToolsAlterBundleContributor implements IAlterBundleContributor {
|
||||||
*/
|
*/
|
||||||
private void alterContainer(IPointsToolContainer container,
|
private void alterContainer(IPointsToolContainer container,
|
||||||
String selectedString) {
|
String selectedString) {
|
||||||
Coordinate point = ToolsDataManager.getInstance().getPoint(
|
Coordinate point = PointsDataManager.getInstance().getPoint(
|
||||||
selectedString);
|
selectedString);
|
||||||
container.setPointCoordinate(point);
|
container.setPointCoordinate(point);
|
||||||
container.setPointLetter(selectedString);
|
container.setPointLetter(selectedString);
|
||||||
|
|
|
@ -22,7 +22,6 @@ package com.raytheon.viz.awipstools;
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.BufferedWriter;
|
import java.io.BufferedWriter;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -36,10 +35,6 @@ import java.util.Map;
|
||||||
import java.util.concurrent.BlockingQueue;
|
import java.util.concurrent.BlockingQueue;
|
||||||
import java.util.concurrent.LinkedBlockingQueue;
|
import java.util.concurrent.LinkedBlockingQueue;
|
||||||
|
|
||||||
import javax.measure.converter.UnitConverter;
|
|
||||||
import javax.measure.unit.NonSI;
|
|
||||||
import javax.measure.unit.SI;
|
|
||||||
|
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.ListenerList;
|
import org.eclipse.core.runtime.ListenerList;
|
||||||
|
@ -48,10 +43,7 @@ import org.eclipse.core.runtime.jobs.Job;
|
||||||
import org.eclipse.jface.preference.IPersistentPreferenceStore;
|
import org.eclipse.jface.preference.IPersistentPreferenceStore;
|
||||||
import org.eclipse.jface.util.IPropertyChangeListener;
|
import org.eclipse.jface.util.IPropertyChangeListener;
|
||||||
import org.eclipse.jface.util.PropertyChangeEvent;
|
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||||
import org.geotools.referencing.GeodeticCalculator;
|
|
||||||
import org.geotools.referencing.datum.DefaultEllipsoid;
|
|
||||||
|
|
||||||
import com.raytheon.uf.common.awipstools.GetWfoCenterPoint;
|
|
||||||
import com.raytheon.uf.common.localization.FileUpdatedMessage;
|
import com.raytheon.uf.common.localization.FileUpdatedMessage;
|
||||||
import com.raytheon.uf.common.localization.ILocalizationFileObserver;
|
import com.raytheon.uf.common.localization.ILocalizationFileObserver;
|
||||||
import com.raytheon.uf.common.localization.IPathManager;
|
import com.raytheon.uf.common.localization.IPathManager;
|
||||||
|
@ -70,7 +62,7 @@ import com.raytheon.uf.viz.core.catalog.DirectDbQuery.QueryLanguage;
|
||||||
import com.raytheon.uf.viz.core.exception.VizException;
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
import com.raytheon.uf.viz.core.localization.HierarchicalPreferenceStore;
|
import com.raytheon.uf.viz.core.localization.HierarchicalPreferenceStore;
|
||||||
import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
||||||
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
import com.raytheon.uf.viz.points.PointsDataManager;
|
||||||
import com.raytheon.viz.awipstools.common.RangeRing;
|
import com.raytheon.viz.awipstools.common.RangeRing;
|
||||||
import com.raytheon.viz.awipstools.common.RangeRing.RangeRingType;
|
import com.raytheon.viz.awipstools.common.RangeRing.RangeRingType;
|
||||||
import com.raytheon.viz.awipstools.common.StormTrackData;
|
import com.raytheon.viz.awipstools.common.StormTrackData;
|
||||||
|
@ -93,6 +85,7 @@ import com.vividsolutions.jts.geom.LineString;
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* 10-21-09 #1711 bsteffen Initial Creation
|
* 10-21-09 #1711 bsteffen Initial Creation
|
||||||
* 04-07-10 #4614 randerso Reworked to use localization files
|
* 04-07-10 #4614 randerso Reworked to use localization files
|
||||||
|
* 07-11-12 #875 rferrel Move points to PointsDataManager.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -104,12 +97,6 @@ public class ToolsDataManager implements ILocalizationFileObserver,
|
||||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||||
.getHandler(ToolsDataManager.class);
|
.getHandler(ToolsDataManager.class);
|
||||||
|
|
||||||
private static final String HOME_LOCATION_FILE = "HomeLocation.dat";
|
|
||||||
|
|
||||||
private static final String MOVABLE_POINT_PREFIX = "movablePoint";
|
|
||||||
|
|
||||||
private static final String MOVABLE_POINT_EXT = ".txt";
|
|
||||||
|
|
||||||
private static final String BASELINE_PREFIX = "baseline_";
|
private static final String BASELINE_PREFIX = "baseline_";
|
||||||
|
|
||||||
private static final String BASELINE_EXT = ".txt";
|
private static final String BASELINE_EXT = ".txt";
|
||||||
|
@ -135,27 +122,13 @@ public class ToolsDataManager implements ILocalizationFileObserver,
|
||||||
|
|
||||||
private static final GeometryFactory GF = new GeometryFactory();
|
private static final GeometryFactory GF = new GeometryFactory();
|
||||||
|
|
||||||
private static final GeodeticCalculator GC = new GeodeticCalculator(
|
|
||||||
DefaultEllipsoid.WGS84);
|
|
||||||
|
|
||||||
private static final UnitConverter NM_TO_METERS = NonSI.NAUTICAL_MILE
|
|
||||||
.getConverterTo(SI.METER);
|
|
||||||
|
|
||||||
private static ToolsDataManager theManager = null;
|
private static ToolsDataManager theManager = null;
|
||||||
|
|
||||||
private Map<String, LineString> baselines;
|
private Map<String, LineString> baselines;
|
||||||
|
|
||||||
private ListenerList baselineListeners = new ListenerList();
|
private ListenerList baselineListeners = new ListenerList();
|
||||||
|
|
||||||
private Map<String, Coordinate> points;
|
private PointsDataManager pointsManager;
|
||||||
|
|
||||||
private ListenerList pointsListeners = new ListenerList();
|
|
||||||
|
|
||||||
private Coordinate home;
|
|
||||||
|
|
||||||
private ListenerList homeListeners = new ListenerList();
|
|
||||||
|
|
||||||
private Coordinate center;
|
|
||||||
|
|
||||||
private Collection<RangeRing> rangeRings;
|
private Collection<RangeRing> rangeRings;
|
||||||
|
|
||||||
|
@ -184,6 +157,7 @@ public class ToolsDataManager implements ILocalizationFileObserver,
|
||||||
site = LocalizationManager.getInstance().getCurrentSite();
|
site = LocalizationManager.getInstance().getCurrentSite();
|
||||||
|
|
||||||
pathMgr = PathManagerFactory.getPathManager();
|
pathMgr = PathManagerFactory.getPathManager();
|
||||||
|
pointsManager = PointsDataManager.getInstance();
|
||||||
LocalizationContext userCtx = pathMgr.getContext(
|
LocalizationContext userCtx = pathMgr.getContext(
|
||||||
LocalizationType.CAVE_STATIC, LocalizationLevel.USER);
|
LocalizationType.CAVE_STATIC, LocalizationLevel.USER);
|
||||||
|
|
||||||
|
@ -195,55 +169,6 @@ public class ToolsDataManager implements ILocalizationFileObserver,
|
||||||
.addPropertyChangeListener(this);
|
.addPropertyChangeListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Coordinate getWfoCenter() {
|
|
||||||
if (center == null) {
|
|
||||||
loadCenter();
|
|
||||||
}
|
|
||||||
return new Coordinate(center);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Coordinate getHome() {
|
|
||||||
if (home == null) {
|
|
||||||
loadHome();
|
|
||||||
}
|
|
||||||
return new Coordinate(home);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHome(Coordinate home) {
|
|
||||||
if (home == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.home = new Coordinate(home);
|
|
||||||
storeHome();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Collection<String> getPointNames() {
|
|
||||||
return getPoints().keySet();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param name
|
|
||||||
* @return the point coordinate associated with the given name, null if no
|
|
||||||
* point exists by that name
|
|
||||||
*/
|
|
||||||
public Coordinate getPoint(String name) {
|
|
||||||
if (points == null) {
|
|
||||||
getPoints();
|
|
||||||
}
|
|
||||||
Coordinate pointCoordinate = points.get(name);
|
|
||||||
if (pointCoordinate == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new Coordinate(pointCoordinate);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPoint(String name, Coordinate point) {
|
|
||||||
points.put(name, new Coordinate(point));
|
|
||||||
storePoint(userToolsDir, point, MOVABLE_POINT_PREFIX + name
|
|
||||||
+ MOVABLE_POINT_EXT);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Collection<String> getBaselineNames() {
|
public Collection<String> getBaselineNames() {
|
||||||
return getBaselines().keySet();
|
return getBaselines().keySet();
|
||||||
}
|
}
|
||||||
|
@ -270,11 +195,11 @@ public class ToolsDataManager implements ILocalizationFileObserver,
|
||||||
|
|
||||||
public Collection<LineSegment> getDistanceBearings() {
|
public Collection<LineSegment> getDistanceBearings() {
|
||||||
Collection<LineSegment> distanceBearings = new ArrayList<LineSegment>();
|
Collection<LineSegment> distanceBearings = new ArrayList<LineSegment>();
|
||||||
Coordinate center = getHome();
|
Coordinate center = pointsManager.getHome();
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
Coordinate start = getCoordinateOnCircle(center,
|
Coordinate start = pointsManager.getCoordinateOnCircle(center,
|
||||||
DEFAULT_LINE_RADIUS[i], DEFAULT_LINE_STARTDIR[i]);
|
DEFAULT_LINE_RADIUS[i], DEFAULT_LINE_STARTDIR[i]);
|
||||||
Coordinate end = getCoordinateOnCircle(center,
|
Coordinate end = pointsManager.getCoordinateOnCircle(center,
|
||||||
DEFAULT_LINE_RADIUS[i], DEFAULT_LINE_ENDDIR[i]);
|
DEFAULT_LINE_RADIUS[i], DEFAULT_LINE_ENDDIR[i]);
|
||||||
LineSegment line = new LineSegment(start, end);
|
LineSegment line = new LineSegment(start, end);
|
||||||
distanceBearings.add(line);
|
distanceBearings.add(line);
|
||||||
|
@ -400,24 +325,14 @@ public class ToolsDataManager implements ILocalizationFileObserver,
|
||||||
return baselines;
|
return baselines;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, Coordinate> getPoints() {
|
|
||||||
if (points == null || points.isEmpty()) {
|
|
||||||
loadPoints();
|
|
||||||
if (points == null || points.isEmpty()) {
|
|
||||||
createDefaultPoints();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return points;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createDefaultBaselines() {
|
private void createDefaultBaselines() {
|
||||||
baselines = new LinkedHashMap<String, LineString>();
|
baselines = new LinkedHashMap<String, LineString>();
|
||||||
Coordinate center = getHome();
|
Coordinate center = pointsManager.getHome();
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
String label = String.valueOf((char) ('A' + i));
|
String label = String.valueOf((char) ('A' + i));
|
||||||
Coordinate start = getCoordinateOnCircle(center,
|
Coordinate start = pointsManager.getCoordinateOnCircle(center,
|
||||||
DEFAULT_LINE_RADIUS[i], DEFAULT_LINE_STARTDIR[i]);
|
DEFAULT_LINE_RADIUS[i], DEFAULT_LINE_STARTDIR[i]);
|
||||||
Coordinate end = getCoordinateOnCircle(center,
|
Coordinate end = pointsManager.getCoordinateOnCircle(center,
|
||||||
DEFAULT_LINE_RADIUS[i], DEFAULT_LINE_ENDDIR[i]);
|
DEFAULT_LINE_RADIUS[i], DEFAULT_LINE_ENDDIR[i]);
|
||||||
LineString baseline = GF.createLineString(new Coordinate[] { start,
|
LineString baseline = GF.createLineString(new Coordinate[] { start,
|
||||||
end });
|
end });
|
||||||
|
@ -426,19 +341,6 @@ public class ToolsDataManager implements ILocalizationFileObserver,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createDefaultPoints() {
|
|
||||||
points = new HashMap<String, Coordinate>();
|
|
||||||
Coordinate center = getHome();
|
|
||||||
int baseRingSize = 120;
|
|
||||||
int startAngle = -90;
|
|
||||||
for (char label = 'A'; label <= 'J'; label++) {
|
|
||||||
Coordinate point = getCoordinateOnCircle(center, baseRingSize,
|
|
||||||
startAngle);
|
|
||||||
setPoint(String.valueOf(label), point);
|
|
||||||
startAngle += 36;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createDefaultRangeRings() {
|
private void createDefaultRangeRings() {
|
||||||
LocalizationManager loc = LocalizationManager.getInstance();
|
LocalizationManager loc = LocalizationManager.getInstance();
|
||||||
|
|
||||||
|
@ -541,47 +443,6 @@ public class ToolsDataManager implements ILocalizationFileObserver,
|
||||||
baselineStoreJob.schedule();
|
baselineStoreJob.schedule();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void storeHome() {
|
|
||||||
storePoint(userToolsDir, home, HOME_LOCATION_FILE);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void storePoint(LocalizationFile dir, Coordinate point,
|
|
||||||
String fileName) {
|
|
||||||
|
|
||||||
LocalizationFile lf = pathMgr.getLocalizationFile(dir.getContext(),
|
|
||||||
dir.getName() + File.separator + fileName);
|
|
||||||
File file = lf.getFile();
|
|
||||||
|
|
||||||
// create the local directory if necessary
|
|
||||||
if (!file.getParentFile().exists()) {
|
|
||||||
file.getParentFile().mkdirs();
|
|
||||||
}
|
|
||||||
|
|
||||||
BufferedWriter out = null;
|
|
||||||
try {
|
|
||||||
out = new BufferedWriter(new FileWriter(file));
|
|
||||||
out.write(String.format("%f %f\n", point.y, point.x));
|
|
||||||
} catch (IOException e) {
|
|
||||||
statusHandler.handle(Priority.PROBLEM, "Error writing to file: "
|
|
||||||
+ file.getAbsolutePath(), e);
|
|
||||||
} finally {
|
|
||||||
if (out != null) {
|
|
||||||
try {
|
|
||||||
out.close();
|
|
||||||
lf.save();
|
|
||||||
} catch (IOException e) {
|
|
||||||
statusHandler.handle(Priority.PROBLEM,
|
|
||||||
"Error writing to file: " + file.getAbsolutePath(),
|
|
||||||
e);
|
|
||||||
} catch (LocalizationException e) {
|
|
||||||
statusHandler.handle(Priority.PROBLEM,
|
|
||||||
"Error storing locatization file to server: " + lf,
|
|
||||||
e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void storeRangeRings() {
|
private void storeRangeRings() {
|
||||||
StringBuilder pref = new StringBuilder();
|
StringBuilder pref = new StringBuilder();
|
||||||
for (RangeRing ring : rangeRings) {
|
for (RangeRing ring : rangeRings) {
|
||||||
|
@ -635,91 +496,6 @@ public class ToolsDataManager implements ILocalizationFileObserver,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadCenter() {
|
|
||||||
try {
|
|
||||||
// Request center point from server
|
|
||||||
center = (Coordinate) ThriftClient
|
|
||||||
.sendLocalizationRequest(new GetWfoCenterPoint(site));
|
|
||||||
} catch (VizException e) {
|
|
||||||
statusHandler.handle(Priority.PROBLEM,
|
|
||||||
"Unable to get WFO center for \"" + site + "\"", e);
|
|
||||||
}
|
|
||||||
if (center == null) {
|
|
||||||
center = new Coordinate(-96.2, 41.2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Coordinate loadHome() {
|
|
||||||
home = loadPoint(userToolsDir, HOME_LOCATION_FILE);
|
|
||||||
if (home == null) {
|
|
||||||
home = getWfoCenter();
|
|
||||||
storeHome();
|
|
||||||
}
|
|
||||||
return home;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void loadPoints() {
|
|
||||||
points = new HashMap<String, Coordinate>();
|
|
||||||
|
|
||||||
LocalizationFile[] files = pathMgr.listFiles(userToolsDir.getContext(),
|
|
||||||
userToolsDir.getName(), new String[] { MOVABLE_POINT_EXT },
|
|
||||||
false, true);
|
|
||||||
for (LocalizationFile lf : files) {
|
|
||||||
String fileName = lf.getFile().getName();
|
|
||||||
if (fileName.startsWith(MOVABLE_POINT_PREFIX)) {
|
|
||||||
Coordinate point = loadPoint(userToolsDir, fileName);
|
|
||||||
String name = fileName.substring(MOVABLE_POINT_PREFIX.length())
|
|
||||||
.replace(MOVABLE_POINT_EXT, "");
|
|
||||||
points.put(name, point);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Coordinate loadPoint(LocalizationFile dir, String fileName) {
|
|
||||||
Coordinate point = null;
|
|
||||||
|
|
||||||
LocalizationFile lf = pathMgr.getLocalizationFile(dir.getContext(),
|
|
||||||
dir.getName() + File.separator + fileName);
|
|
||||||
File file = lf.getFile();
|
|
||||||
BufferedReader in = null;
|
|
||||||
try {
|
|
||||||
in = new BufferedReader(new FileReader(file));
|
|
||||||
String line = in.readLine();
|
|
||||||
line = line.trim();
|
|
||||||
int p = line.indexOf(' ');
|
|
||||||
double lat = Double.parseDouble(line.substring(0, p));
|
|
||||||
double lon = Double.parseDouble(line.substring(p));
|
|
||||||
|
|
||||||
if (lat > 90.0 || lat < -90.0 || lon > 180.0 || lon < -180.0) {
|
|
||||||
statusHandler
|
|
||||||
.handle(Priority.PROBLEM,
|
|
||||||
"Invalid lat/lon in wfo center point file, using default");
|
|
||||||
} else {
|
|
||||||
point = new Coordinate(lon, lat);
|
|
||||||
}
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
statusHandler
|
|
||||||
.handle(Priority.PROBLEM,
|
|
||||||
"Invalid number in wfo center point file, using default",
|
|
||||||
e);
|
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
statusHandler.handle(Priority.EVENTA,
|
|
||||||
"No wfo center point file found, creating default.");
|
|
||||||
} catch (IOException e) {
|
|
||||||
statusHandler.handle(Priority.PROBLEM,
|
|
||||||
"Error reading wfo center point file, using default", e);
|
|
||||||
} finally {
|
|
||||||
if (in != null) {
|
|
||||||
try {
|
|
||||||
in.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
// nothing to do
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return point;
|
|
||||||
}
|
|
||||||
|
|
||||||
private LineString loadBaseline(String fileName) {
|
private LineString loadBaseline(String fileName) {
|
||||||
LineString baseline = null;
|
LineString baseline = null;
|
||||||
|
|
||||||
|
@ -806,20 +582,6 @@ public class ToolsDataManager implements ILocalizationFileObserver,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Coordinate getCoordinateOnCircle(Coordinate coor, double radius,
|
|
||||||
int angle) {
|
|
||||||
|
|
||||||
if (angle > 180) {
|
|
||||||
angle = angle - 360;
|
|
||||||
}
|
|
||||||
GC.setStartingGeographicPoint(coor.x, coor.y);
|
|
||||||
GC.setDirection(angle, NM_TO_METERS.convert(radius));
|
|
||||||
|
|
||||||
return new Coordinate(GC.getDestinationGeographicPoint().getX(), GC
|
|
||||||
.getDestinationGeographicPoint().getY());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
|
@ -830,26 +592,10 @@ public class ToolsDataManager implements ILocalizationFileObserver,
|
||||||
@Override
|
@Override
|
||||||
public void fileUpdated(FileUpdatedMessage message) {
|
public void fileUpdated(FileUpdatedMessage message) {
|
||||||
String fileName = new File(message.getFileName()).getName();
|
String fileName = new File(message.getFileName()).getName();
|
||||||
|
if (fileName.startsWith(BASELINE_PREFIX)) {
|
||||||
if (fileName.startsWith(MOVABLE_POINT_PREFIX)) {
|
|
||||||
pointsFileUpdated(fileName);
|
|
||||||
} else if (fileName.startsWith(BASELINE_PREFIX)) {
|
|
||||||
baselineFileUpdated(fileName);
|
baselineFileUpdated(fileName);
|
||||||
} else if (fileName.startsWith(HOME_LOCATION_FILE)) {
|
} else {
|
||||||
homeLocationFileUpdated(fileName);
|
pointsManager.fileUpdated(message);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void pointsFileUpdated(String fileName) {
|
|
||||||
if (points != null) {
|
|
||||||
Coordinate point = loadPoint(userToolsDir, fileName);
|
|
||||||
String name = fileName.substring(MOVABLE_POINT_PREFIX.length())
|
|
||||||
.replace(MOVABLE_POINT_EXT, "");
|
|
||||||
points.put(name, point);
|
|
||||||
|
|
||||||
for (Object listener : pointsListeners.getListeners()) {
|
|
||||||
((IToolChangedListener) listener).toolChanged();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -866,43 +612,6 @@ public class ToolsDataManager implements ILocalizationFileObserver,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void homeLocationFileUpdated(String fileName) {
|
|
||||||
if (home != null) {
|
|
||||||
loadHome();
|
|
||||||
|
|
||||||
ArrayList<Thread> threads = new ArrayList<Thread>(
|
|
||||||
homeListeners.size());
|
|
||||||
for (final Object listener : homeListeners.getListeners()) {
|
|
||||||
// fire listeners in separate threads to avoid waiting to draw
|
|
||||||
// the updated location while waiting on another listener to
|
|
||||||
// finish
|
|
||||||
Thread t = new Thread(new Runnable() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
((IToolChangedListener) listener).toolChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
threads.add(t);
|
|
||||||
t.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
// join all threads before continuing so we can't fire listeners
|
|
||||||
// again until all have finished
|
|
||||||
for (Thread t : threads) {
|
|
||||||
try {
|
|
||||||
t.join();
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
statusHandler.handle(
|
|
||||||
Priority.SIGNIFICANT,
|
|
||||||
"Unexpected Interruption from: "
|
|
||||||
+ e.getLocalizedMessage(), e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param listener
|
* @param listener
|
||||||
*/
|
*/
|
||||||
|
@ -917,34 +626,6 @@ public class ToolsDataManager implements ILocalizationFileObserver,
|
||||||
baselineListeners.remove(listener);
|
baselineListeners.remove(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param listener
|
|
||||||
*/
|
|
||||||
public void addPointsChangedListener(IToolChangedListener listener) {
|
|
||||||
pointsListeners.add(listener);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param listener
|
|
||||||
*/
|
|
||||||
public void removePointsChangedListener(IToolChangedListener listener) {
|
|
||||||
pointsListeners.remove(listener);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param listener
|
|
||||||
*/
|
|
||||||
public void addHomeChangedListener(IToolChangedListener listener) {
|
|
||||||
homeListeners.add(listener);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param listener
|
|
||||||
*/
|
|
||||||
public void removeHomeChangedListener(IToolChangedListener listener) {
|
|
||||||
homeListeners.remove(listener);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param listener
|
* @param listener
|
||||||
*/
|
*/
|
||||||
|
@ -994,5 +675,4 @@ public class ToolsDataManager implements ILocalizationFileObserver,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,6 +72,7 @@ import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
||||||
import com.raytheon.uf.viz.core.rsc.IResourceDataChanged;
|
import com.raytheon.uf.viz.core.rsc.IResourceDataChanged;
|
||||||
import com.raytheon.uf.viz.core.rsc.ResourceType;
|
import com.raytheon.uf.viz.core.rsc.ResourceType;
|
||||||
|
import com.raytheon.uf.viz.points.PointsDataManager;
|
||||||
import com.raytheon.viz.awipstools.ToolsDataManager;
|
import com.raytheon.viz.awipstools.ToolsDataManager;
|
||||||
import com.raytheon.viz.awipstools.ui.layer.HomeToolLayer;
|
import com.raytheon.viz.awipstools.ui.layer.HomeToolLayer;
|
||||||
import com.raytheon.viz.awipstools.ui.layer.InteractiveBaselinesLayer;
|
import com.raytheon.viz.awipstools.ui.layer.InteractiveBaselinesLayer;
|
||||||
|
@ -193,7 +194,7 @@ public class ChooseByIdDialog extends CaveSWTDialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isPoint() {
|
private boolean isPoint() {
|
||||||
return (!isBaseline && ToolsDataManager.getInstance().getPoint(
|
return (!isBaseline && PointsDataManager.getInstance().getPoint(
|
||||||
idName) != null);
|
idName) != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,7 +308,7 @@ public class ChooseByIdDialog extends CaveSWTDialog {
|
||||||
private void updatePosition(List<Coordinate> stationCoordinates) {
|
private void updatePosition(List<Coordinate> stationCoordinates) {
|
||||||
|
|
||||||
if (isPoint()) {
|
if (isPoint()) {
|
||||||
ToolsDataManager.getInstance().setPoint(idName,
|
PointsDataManager.getInstance().setPoint(idName,
|
||||||
stationCoordinates.get(0));
|
stationCoordinates.get(0));
|
||||||
refreshToolLayer(pointsToolLayer);
|
refreshToolLayer(pointsToolLayer);
|
||||||
|
|
||||||
|
@ -320,7 +321,7 @@ public class ChooseByIdDialog extends CaveSWTDialog {
|
||||||
refreshToolLayer(baselinesToolLayer);
|
refreshToolLayer(baselinesToolLayer);
|
||||||
|
|
||||||
} else if (isHome()) {
|
} else if (isHome()) {
|
||||||
ToolsDataManager.getInstance().setHome(
|
PointsDataManager.getInstance().setHome(
|
||||||
stationCoordinates.get(0));
|
stationCoordinates.get(0));
|
||||||
refreshToolLayer(homeToolLayer);
|
refreshToolLayer(homeToolLayer);
|
||||||
}
|
}
|
||||||
|
@ -512,14 +513,14 @@ public class ChooseByIdDialog extends CaveSWTDialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isHome()) {
|
if (isHome()) {
|
||||||
Coordinate homeCoordinate = ToolsDataManager.getInstance()
|
Coordinate homeCoordinate = PointsDataManager.getInstance()
|
||||||
.getHome();
|
.getHome();
|
||||||
|
|
||||||
stationLocationHasChanged = (!homeCoordinate
|
stationLocationHasChanged = (!homeCoordinate
|
||||||
.equals(stationCoordinates.get(0)));
|
.equals(stationCoordinates.get(0)));
|
||||||
|
|
||||||
} else if (isPoint()) {
|
} else if (isPoint()) {
|
||||||
Coordinate pointCoordinate = ToolsDataManager.getInstance()
|
Coordinate pointCoordinate = PointsDataManager.getInstance()
|
||||||
.getPoint(idName);
|
.getPoint(idName);
|
||||||
|
|
||||||
stationLocationHasChanged = (!pointCoordinate
|
stationLocationHasChanged = (!pointCoordinate
|
||||||
|
@ -635,7 +636,7 @@ public class ChooseByIdDialog extends CaveSWTDialog {
|
||||||
|
|
||||||
private void createIdBoxes() {
|
private void createIdBoxes() {
|
||||||
|
|
||||||
String[] pointNames = ToolsDataManager.getInstance().getPointNames()
|
String[] pointNames = PointsDataManager.getInstance().getPointNames()
|
||||||
.toArray(new String[] {});
|
.toArray(new String[] {});
|
||||||
Arrays.sort(pointNames);
|
Arrays.sort(pointNames);
|
||||||
for (String point : pointNames) {
|
for (String point : pointNames) {
|
||||||
|
|
|
@ -75,7 +75,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
import com.raytheon.uf.viz.core.catalog.DirectDbQuery;
|
import com.raytheon.uf.viz.core.catalog.DirectDbQuery;
|
||||||
import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
|
import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
|
||||||
import com.raytheon.uf.viz.core.rsc.IResourceDataChanged;
|
import com.raytheon.uf.viz.core.rsc.IResourceDataChanged;
|
||||||
import com.raytheon.viz.awipstools.ToolsDataManager;
|
import com.raytheon.uf.viz.points.PointsDataManager;
|
||||||
import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
import com.vividsolutions.jts.geom.Coordinate;
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
import com.vividsolutions.jts.geom.Geometry;
|
||||||
|
@ -164,7 +164,7 @@ public class PutHomeCursorDialog extends CaveJFACEDialog implements
|
||||||
createCityChoice();
|
createCityChoice();
|
||||||
createLatLonChoice();
|
createLatLonChoice();
|
||||||
try {
|
try {
|
||||||
updateStationInfo(ToolsDataManager.getInstance().getHome());
|
updateStationInfo(PointsDataManager.getInstance().getHome());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -305,7 +305,7 @@ public class PutHomeCursorDialog extends CaveJFACEDialog implements
|
||||||
longLabel.setText("Longitude:");
|
longLabel.setText("Longitude:");
|
||||||
lonTextField = new Text(comp, SWT.BORDER);
|
lonTextField = new Text(comp, SWT.BORDER);
|
||||||
lonTextField.setLayoutData(new GridData(80, SWT.DEFAULT));
|
lonTextField.setLayoutData(new GridData(80, SWT.DEFAULT));
|
||||||
Coordinate point = ToolsDataManager.getInstance().getHome();
|
Coordinate point = PointsDataManager.getInstance().getHome();
|
||||||
lonTextField.setText(String.valueOf(point.x));
|
lonTextField.setText(String.valueOf(point.x));
|
||||||
latTextField.setText(String.valueOf(point.y));
|
latTextField.setText(String.valueOf(point.y));
|
||||||
}
|
}
|
||||||
|
@ -366,7 +366,7 @@ public class PutHomeCursorDialog extends CaveJFACEDialog implements
|
||||||
"Could not find that Metar station");
|
"Could not find that Metar station");
|
||||||
stationTextField.setFocus();
|
stationTextField.setFocus();
|
||||||
} else {
|
} else {
|
||||||
ToolsDataManager.getInstance().setHome(c);
|
PointsDataManager.getInstance().setHome(c);
|
||||||
resourceData.fireChangeListeners(ChangeType.DATA_UPDATE,
|
resourceData.fireChangeListeners(ChangeType.DATA_UPDATE,
|
||||||
null);
|
null);
|
||||||
stationTextField.setText(station);
|
stationTextField.setText(station);
|
||||||
|
@ -400,7 +400,7 @@ public class PutHomeCursorDialog extends CaveJFACEDialog implements
|
||||||
"Put Home Cursor Error", "Could not find that city");
|
"Put Home Cursor Error", "Could not find that city");
|
||||||
cityTextField.setFocus();
|
cityTextField.setFocus();
|
||||||
} else {
|
} else {
|
||||||
ToolsDataManager.getInstance().setHome(c);
|
PointsDataManager.getInstance().setHome(c);
|
||||||
resourceData.fireChangeListeners(ChangeType.DATA_UPDATE, null);
|
resourceData.fireChangeListeners(ChangeType.DATA_UPDATE, null);
|
||||||
cityTextField.setText(city);
|
cityTextField.setText(city);
|
||||||
stateTextField.setText(state);
|
stateTextField.setText(state);
|
||||||
|
@ -433,7 +433,7 @@ public class PutHomeCursorDialog extends CaveJFACEDialog implements
|
||||||
latTextField.setFocus();
|
latTextField.setFocus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ToolsDataManager.getInstance().setHome(c);
|
PointsDataManager.getInstance().setHome(c);
|
||||||
resourceData.fireChangeListeners(ChangeType.DATA_UPDATE, null);
|
resourceData.fireChangeListeners(ChangeType.DATA_UPDATE, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -585,7 +585,7 @@ public class PutHomeCursorDialog extends CaveJFACEDialog implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resourceChanged(ChangeType type, Object object) {
|
public void resourceChanged(ChangeType type, Object object) {
|
||||||
Coordinate point = ToolsDataManager.getInstance().getHome();
|
Coordinate point = PointsDataManager.getInstance().getHome();
|
||||||
lonTextField.setText(String.valueOf(point.x));
|
lonTextField.setText(String.valueOf(point.x));
|
||||||
latTextField.setText(String.valueOf(point.y));
|
latTextField.setText(String.valueOf(point.y));
|
||||||
// find the nearest station and update the fields.
|
// find the nearest station and update the fields.
|
||||||
|
|
|
@ -47,6 +47,7 @@ import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
|
import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
|
||||||
import com.raytheon.uf.viz.core.rsc.IResourceDataChanged;
|
import com.raytheon.uf.viz.core.rsc.IResourceDataChanged;
|
||||||
import com.raytheon.uf.viz.core.rsc.capabilities.EditableCapability;
|
import com.raytheon.uf.viz.core.rsc.capabilities.EditableCapability;
|
||||||
|
import com.raytheon.uf.viz.points.PointsDataManager;
|
||||||
import com.raytheon.viz.awipstools.ToolsDataManager;
|
import com.raytheon.viz.awipstools.ToolsDataManager;
|
||||||
import com.raytheon.viz.awipstools.common.RangeRing;
|
import com.raytheon.viz.awipstools.common.RangeRing;
|
||||||
import com.raytheon.viz.awipstools.common.RangeRing.RangeRingType;
|
import com.raytheon.viz.awipstools.common.RangeRing.RangeRingType;
|
||||||
|
@ -54,20 +55,21 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
import com.vividsolutions.jts.geom.Coordinate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO Add Description
|
* Dialog for managing the displaying of points in the D2D's Range Rings view.
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* 10-21-09 #732 bsteffen Fixed Many issues
|
* 10-21-09 #732 bsteffen Fixed Many issues
|
||||||
|
* 07-11-12 #875 rferrel Bug fix for check box on
|
||||||
|
* unapplied points.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author ebabin
|
* @author ebabin
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class RangeRingDialog extends CaveJFACEDialog implements
|
public class RangeRingDialog extends CaveJFACEDialog implements
|
||||||
IResourceDataChanged {
|
IResourceDataChanged {
|
||||||
|
|
||||||
|
@ -132,7 +134,10 @@ public class RangeRingDialog extends CaveJFACEDialog implements
|
||||||
|
|
||||||
private final AbstractResourceData resourceData;
|
private final AbstractResourceData resourceData;
|
||||||
|
|
||||||
private ToolsDataManager dataManager = ToolsDataManager.getInstance();
|
private ToolsDataManager toolsDataManager = ToolsDataManager.getInstance();
|
||||||
|
|
||||||
|
private PointsDataManager pointsDataManager = PointsDataManager
|
||||||
|
.getInstance();
|
||||||
|
|
||||||
private Collection<FixedRingRow> fixedRings = new ArrayList<FixedRingRow>();
|
private Collection<FixedRingRow> fixedRings = new ArrayList<FixedRingRow>();
|
||||||
|
|
||||||
|
@ -234,13 +239,13 @@ public class RangeRingDialog extends CaveJFACEDialog implements
|
||||||
true, true, 1, 1));
|
true, true, 1, 1));
|
||||||
new Label(createComposite, SWT.NONE).setText("New at: ");
|
new Label(createComposite, SWT.NONE).setText("New at: ");
|
||||||
Combo combo = new Combo(createComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
|
Combo combo = new Combo(createComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
|
||||||
Collection<String> points = dataManager.getPointNames();
|
Collection<String> points = pointsDataManager.getPointNames();
|
||||||
ArrayList<String> items = new ArrayList<String>();
|
ArrayList<String> items = new ArrayList<String>();
|
||||||
items.add(LATLON);
|
items.add(LATLON);
|
||||||
for (String point : points) {
|
for (String point : points) {
|
||||||
items.add("Point " + point);
|
items.add("Point " + point);
|
||||||
}
|
}
|
||||||
Collection<RangeRing> rangeRings = dataManager.getRangeRings();
|
Collection<RangeRing> rangeRings = toolsDataManager.getRangeRings();
|
||||||
for (RangeRing ring : rangeRings) {
|
for (RangeRing ring : rangeRings) {
|
||||||
if (ring.getType() == RangeRingType.FIXED) {
|
if (ring.getType() == RangeRingType.FIXED) {
|
||||||
items.add(ring.getId());
|
items.add(ring.getId());
|
||||||
|
@ -293,7 +298,7 @@ public class RangeRingDialog extends CaveJFACEDialog implements
|
||||||
}
|
}
|
||||||
row.id.setText(id);
|
row.id.setText(id);
|
||||||
} else {
|
} else {
|
||||||
Collection<String> points = dataManager.getPointNames();
|
Collection<String> points = pointsDataManager.getPointNames();
|
||||||
String selectedPoint = null;
|
String selectedPoint = null;
|
||||||
for (String point : points) {
|
for (String point : points) {
|
||||||
if (selection.equals("Point " + point)) {
|
if (selection.equals("Point " + point)) {
|
||||||
|
@ -303,7 +308,7 @@ public class RangeRingDialog extends CaveJFACEDialog implements
|
||||||
}
|
}
|
||||||
if (selectedPoint != null) {
|
if (selectedPoint != null) {
|
||||||
row.id.setText(selection);
|
row.id.setText(selection);
|
||||||
Coordinate loc = dataManager.getPoint(selectedPoint);
|
Coordinate loc = pointsDataManager.getPoint(selectedPoint);
|
||||||
row.lon.setText(String.valueOf(loc.x));
|
row.lon.setText(String.valueOf(loc.x));
|
||||||
row.lat.setText(String.valueOf(loc.y));
|
row.lat.setText(String.valueOf(loc.y));
|
||||||
} else {
|
} else {
|
||||||
|
@ -364,7 +369,9 @@ public class RangeRingDialog extends CaveJFACEDialog implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
row.ring.setVisible(row.enabled.getSelection());
|
if (row.ring != null) {
|
||||||
|
row.ring.setVisible(row.enabled.getSelection());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
row.id = new Text(movableRingsComposite, SWT.SINGLE | SWT.BORDER);
|
row.id = new Text(movableRingsComposite, SWT.SINGLE | SWT.BORDER);
|
||||||
|
@ -462,7 +469,7 @@ public class RangeRingDialog extends CaveJFACEDialog implements
|
||||||
}
|
}
|
||||||
fixedRings.clear();
|
fixedRings.clear();
|
||||||
movableRings.clear();
|
movableRings.clear();
|
||||||
Collection<RangeRing> rangeRings = dataManager.getRangeRings();
|
Collection<RangeRing> rangeRings = toolsDataManager.getRangeRings();
|
||||||
for (RangeRing ring : rangeRings) {
|
for (RangeRing ring : rangeRings) {
|
||||||
if (ring.getType() == RangeRingType.FIXED) {
|
if (ring.getType() == RangeRingType.FIXED) {
|
||||||
FixedRingRow row = getNewFixedRow();
|
FixedRingRow row = getNewFixedRow();
|
||||||
|
@ -499,7 +506,7 @@ public class RangeRingDialog extends CaveJFACEDialog implements
|
||||||
String label = row.label.getText();
|
String label = row.label.getText();
|
||||||
rangeRings.add(new RangeRing(id, center, radius, label, enabled));
|
rangeRings.add(new RangeRing(id, center, radius, label, enabled));
|
||||||
}
|
}
|
||||||
dataManager.setRangeRings(rangeRings);
|
toolsDataManager.setRangeRings(rangeRings);
|
||||||
resourceData.fireChangeListeners(ChangeType.DATA_UPDATE, null);
|
resourceData.fireChangeListeners(ChangeType.DATA_UPDATE, null);
|
||||||
load();
|
load();
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ import org.eclipse.swt.widgets.Text;
|
||||||
|
|
||||||
import com.raytheon.uf.common.time.SimulatedTime;
|
import com.raytheon.uf.common.time.SimulatedTime;
|
||||||
import com.raytheon.uf.viz.core.exception.VizException;
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
import com.raytheon.viz.awipstools.ToolsDataManager;
|
import com.raytheon.uf.viz.points.PointsDataManager;
|
||||||
import com.raytheon.viz.awipstools.common.SunriseSunsetCalculator;
|
import com.raytheon.viz.awipstools.common.SunriseSunsetCalculator;
|
||||||
import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
import com.vividsolutions.jts.geom.Coordinate;
|
||||||
|
@ -76,6 +76,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
||||||
* 10-21-09 #1711 bsteffen Modified to use datamanager for home location
|
* 10-21-09 #1711 bsteffen Modified to use datamanager for home location
|
||||||
* 25May2010 5603 bkowal Added additional timezones based on the timezones
|
* 25May2010 5603 bkowal Added additional timezones based on the timezones
|
||||||
* that were present in AWIPSI.
|
* that were present in AWIPSI.
|
||||||
|
* 11Jul2012 875 rferrel Now uses PointsDataManager
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author Eric Babin
|
* @author Eric Babin
|
||||||
|
@ -166,8 +167,6 @@ public class SunriseToolDialog extends CaveJFACEDialog {
|
||||||
private float latitudeValue;
|
private float latitudeValue;
|
||||||
|
|
||||||
private float longitudeValue;
|
private float longitudeValue;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private DecimalFormat decimalFormat = new DecimalFormat("0.00");
|
private DecimalFormat decimalFormat = new DecimalFormat("0.00");
|
||||||
|
|
||||||
|
@ -175,89 +174,45 @@ public class SunriseToolDialog extends CaveJFACEDialog {
|
||||||
// right.
|
// right.
|
||||||
|
|
||||||
/*
|
/*
|
||||||
String zoneStrings[] = {
|
* String zoneStrings[] = {
|
||||||
TimeZone.getTimeZone("Pacific/Guam").getDisplayName(false, TimeZone.SHORT)
|
* TimeZone.getTimeZone("Pacific/Guam").getDisplayName(false,
|
||||||
+ " (+" + TimeZone.getTimeZone("Pacific/Guam").getRawOffset()
|
* TimeZone.SHORT) + " (+" +
|
||||||
/ 3600000 + ")",
|
* TimeZone.getTimeZone("Pacific/Guam").getRawOffset() / 3600000 + ")",
|
||||||
TimeZone.getTimeZone("HST").getDisplayName(false, TimeZone.SHORT)
|
* TimeZone.getTimeZone("HST").getDisplayName(false, TimeZone.SHORT) + " ("
|
||||||
+ " (" + TimeZone.getTimeZone("HST").getRawOffset()
|
* + TimeZone.getTimeZone("HST").getRawOffset() / 3600000 + ")",
|
||||||
/ 3600000 + ")",
|
* TimeZone.getTimeZone("AST").getDisplayName(false, TimeZone.SHORT) + " ("
|
||||||
TimeZone.getTimeZone("AST").getDisplayName(false, TimeZone.SHORT)
|
* + TimeZone.getTimeZone("AST").getRawOffset() / 3600000 + ")",
|
||||||
+ " (" + TimeZone.getTimeZone("AST").getRawOffset()
|
* TimeZone.getTimeZone("AST").getDisplayName(true, TimeZone.SHORT) + " (" +
|
||||||
/ 3600000 + ")",
|
* (TimeZone.getTimeZone("AST").getRawOffset() + 100000) / 3600000 + ")",
|
||||||
TimeZone.getTimeZone("AST").getDisplayName(true, TimeZone.SHORT)
|
* TimeZone.getTimeZone("PST").getDisplayName(false, TimeZone.SHORT) + " ("
|
||||||
+ " ("
|
* + TimeZone.getTimeZone("PST").getRawOffset() / 3600000 + ")",
|
||||||
+ (TimeZone.getTimeZone("AST").getRawOffset() + 100000)
|
* TimeZone.getTimeZone("PST").getDisplayName(true, TimeZone.SHORT) + " (" +
|
||||||
/ 3600000 + ")",
|
* (TimeZone.getTimeZone("PST").getRawOffset() + 100000) / 3600000 + ")",
|
||||||
TimeZone.getTimeZone("PST").getDisplayName(false, TimeZone.SHORT)
|
* TimeZone.getTimeZone("MST").getDisplayName(false, TimeZone.SHORT) + " ("
|
||||||
+ " (" + TimeZone.getTimeZone("PST").getRawOffset()
|
* + TimeZone.getTimeZone("MST").getRawOffset() / 3600000 + ")",
|
||||||
/ 3600000 + ")",
|
* TimeZone.getTimeZone("MST").getDisplayName(true, TimeZone.SHORT) + " (" +
|
||||||
TimeZone.getTimeZone("PST").getDisplayName(true, TimeZone.SHORT)
|
* (TimeZone.getTimeZone("MST").getRawOffset() + 100000) / 3600000 + ")",
|
||||||
+ " ("
|
* TimeZone.getTimeZone("CST").getDisplayName(false, TimeZone.SHORT) + " ("
|
||||||
+ (TimeZone.getTimeZone("PST").getRawOffset() + 100000)
|
* + TimeZone.getTimeZone("CST").getRawOffset() / 3600000 + ")",
|
||||||
/ 3600000 + ")",
|
* TimeZone.getTimeZone("CST").getDisplayName(true, TimeZone.SHORT) + " (" +
|
||||||
TimeZone.getTimeZone("MST").getDisplayName(false, TimeZone.SHORT)
|
* (TimeZone.getTimeZone("CST").getRawOffset() + 100000) / 3600000 + ")",
|
||||||
+ " (" + TimeZone.getTimeZone("MST").getRawOffset()
|
* TimeZone.getTimeZone("EST").getDisplayName(false, TimeZone.SHORT) + " ("
|
||||||
/ 3600000 + ")",
|
* + TimeZone.getTimeZone("EST").getRawOffset() / 3600000 + ")",
|
||||||
TimeZone.getTimeZone("MST").getDisplayName(true, TimeZone.SHORT)
|
* TimeZone.getTimeZone("EST").getDisplayName(true, TimeZone.SHORT) + " (" +
|
||||||
+ " ("
|
* (TimeZone.getTimeZone("EST").getRawOffset() + 100000) / 3600000 + ")",
|
||||||
+ (TimeZone.getTimeZone("MST").getRawOffset() + 100000)
|
* TimeZone.getTimeZone("SystemV/AST4").getDisplayName(false,
|
||||||
/ 3600000 + ")",
|
* TimeZone.SHORT) + " (" +
|
||||||
TimeZone.getTimeZone("CST").getDisplayName(false, TimeZone.SHORT)
|
* TimeZone.getTimeZone("SystemV/AST4").getRawOffset() / 3600000 + ")",
|
||||||
+ " (" + TimeZone.getTimeZone("CST").getRawOffset()
|
* TimeZone.getTimeZone("GMT").getDisplayName(false, TimeZone.SHORT) +
|
||||||
/ 3600000 + ")",
|
* " (0)" };
|
||||||
TimeZone.getTimeZone("CST").getDisplayName(true, TimeZone.SHORT)
|
*/
|
||||||
+ " ("
|
final String timeZoneIDs[] = { "Pacific/Guam", "HST", "AST", "AST", "PST",
|
||||||
+ (TimeZone.getTimeZone("CST").getRawOffset() + 100000)
|
"PST", "MST", "MST", "CST", "CST", "EST", "EST", "SystemV/AST4",
|
||||||
/ 3600000 + ")",
|
"GMT" };
|
||||||
TimeZone.getTimeZone("EST").getDisplayName(false, TimeZone.SHORT)
|
|
||||||
+ " (" + TimeZone.getTimeZone("EST").getRawOffset()
|
final boolean daylightIndicators[] = { false, false, false, true, false,
|
||||||
/ 3600000 + ")",
|
true, false, true, false, true, false, true, false, false };
|
||||||
TimeZone.getTimeZone("EST").getDisplayName(true, TimeZone.SHORT)
|
|
||||||
+ " ("
|
|
||||||
+ (TimeZone.getTimeZone("EST").getRawOffset() + 100000)
|
|
||||||
/ 3600000 + ")",
|
|
||||||
TimeZone.getTimeZone("SystemV/AST4").getDisplayName(false, TimeZone.SHORT)
|
|
||||||
+ " (" + TimeZone.getTimeZone("SystemV/AST4").getRawOffset()
|
|
||||||
/ 3600000 + ")",
|
|
||||||
TimeZone.getTimeZone("GMT").getDisplayName(false, TimeZone.SHORT)
|
|
||||||
+ " (0)" };
|
|
||||||
*/
|
|
||||||
final String timeZoneIDs[] =
|
|
||||||
{
|
|
||||||
"Pacific/Guam",
|
|
||||||
"HST",
|
|
||||||
"AST",
|
|
||||||
"AST",
|
|
||||||
"PST",
|
|
||||||
"PST",
|
|
||||||
"MST",
|
|
||||||
"MST",
|
|
||||||
"CST",
|
|
||||||
"CST",
|
|
||||||
"EST",
|
|
||||||
"EST",
|
|
||||||
"SystemV/AST4",
|
|
||||||
"GMT"
|
|
||||||
};
|
|
||||||
final boolean daylightIndicators[] =
|
|
||||||
{
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
};
|
|
||||||
|
|
||||||
private LinkedHashMap<String, String> timezonesMap;
|
private LinkedHashMap<String, String> timezonesMap;
|
||||||
|
|
||||||
public SunriseToolDialog(Shell parShell, String dialogTitle)
|
public SunriseToolDialog(Shell parShell, String dialogTitle)
|
||||||
|
@ -269,7 +224,7 @@ public class SunriseToolDialog extends CaveJFACEDialog {
|
||||||
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
|
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||||
yyyyMMdd = sdf.format(SimulatedTime.getSystemTime().getTime());
|
yyyyMMdd = sdf.format(SimulatedTime.getSystemTime().getTime());
|
||||||
|
|
||||||
Coordinate center = ToolsDataManager.getInstance().getWfoCenter();
|
Coordinate center = PointsDataManager.getInstance().getWfoCenter();
|
||||||
latitudeValue = (float) center.y;
|
latitudeValue = (float) center.y;
|
||||||
longitudeValue = (float) center.x;
|
longitudeValue = (float) center.x;
|
||||||
|
|
||||||
|
@ -298,36 +253,33 @@ public class SunriseToolDialog extends CaveJFACEDialog {
|
||||||
|
|
||||||
return top;
|
return top;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupTimezones()
|
private void setupTimezones() {
|
||||||
{
|
TimeZone timeZone = null;
|
||||||
TimeZone timeZone = null;
|
String displayName = null;
|
||||||
String displayName = null;
|
String displayText = null;
|
||||||
String displayText = null;
|
boolean dlIndicator = false;
|
||||||
boolean dlIndicator = false;
|
|
||||||
|
int additionalOffset = -1;
|
||||||
int additionalOffset = -1;
|
|
||||||
|
timezonesMap = new LinkedHashMap<String, String>();
|
||||||
timezonesMap = new LinkedHashMap<String, String>();
|
for (int i = 0; i < timeZoneIDs.length; i++) {
|
||||||
for (int i = 0; i < timeZoneIDs.length; i++)
|
dlIndicator = daylightIndicators[i];
|
||||||
{
|
|
||||||
dlIndicator = daylightIndicators[i];
|
timeZone = TimeZone.getTimeZone(timeZoneIDs[i]);
|
||||||
|
|
||||||
timeZone = TimeZone.getTimeZone(timeZoneIDs[i]);
|
additionalOffset = 0;
|
||||||
|
if (dlIndicator) {
|
||||||
additionalOffset = 0;
|
additionalOffset = 1000000;
|
||||||
if (dlIndicator)
|
}
|
||||||
{
|
|
||||||
additionalOffset = 1000000;
|
displayName = timeZone.getDisplayName(dlIndicator, TimeZone.SHORT);
|
||||||
}
|
displayText = displayName + "("
|
||||||
|
+ (timeZone.getRawOffset() + additionalOffset) / 3600000
|
||||||
displayName = timeZone.getDisplayName(
|
+ ")";
|
||||||
dlIndicator, TimeZone.SHORT);
|
|
||||||
displayText = displayName + "(" +
|
timezonesMap.put(displayText, displayName);
|
||||||
(timeZone.getRawOffset() + additionalOffset) / 3600000 + ")";
|
}
|
||||||
|
|
||||||
timezonesMap.put(displayText, displayName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -397,9 +349,9 @@ public class SunriseToolDialog extends CaveJFACEDialog {
|
||||||
* Method for creating the month, day, ect labels and fields.
|
* Method for creating the month, day, ect labels and fields.
|
||||||
*/
|
*/
|
||||||
private void createToolControls() {
|
private void createToolControls() {
|
||||||
String[] zoneStrings = null;
|
String[] zoneStrings = null;
|
||||||
Iterator<String> tzIterator = null;
|
Iterator<String> tzIterator = null;
|
||||||
|
|
||||||
sunriseFieldComposite = new Composite(top, SWT.NONE);
|
sunriseFieldComposite = new Composite(top, SWT.NONE);
|
||||||
sunriseFieldComposite.setLayout(new FormLayout());
|
sunriseFieldComposite.setLayout(new FormLayout());
|
||||||
sunriseFieldComposite.setSize(80, 360);
|
sunriseFieldComposite.setSize(80, 360);
|
||||||
|
@ -478,7 +430,7 @@ public class SunriseToolDialog extends CaveJFACEDialog {
|
||||||
setHomeLocButton.addListener(SWT.MouseUp, new Listener() {
|
setHomeLocButton.addListener(SWT.MouseUp, new Listener() {
|
||||||
|
|
||||||
public void handleEvent(Event event) {
|
public void handleEvent(Event event) {
|
||||||
Coordinate home = ToolsDataManager.getInstance().getHome();
|
Coordinate home = PointsDataManager.getInstance().getHome();
|
||||||
longitudeValue = (float) home.x;
|
longitudeValue = (float) home.x;
|
||||||
latitudeValue = (float) home.y;
|
latitudeValue = (float) home.y;
|
||||||
longitudeText.setText(String.valueOf(longitudeValue));
|
longitudeText.setText(String.valueOf(longitudeValue));
|
||||||
|
@ -571,16 +523,15 @@ public class SunriseToolDialog extends CaveJFACEDialog {
|
||||||
zoneLabel = new Label(sunriseFieldComposite, SWT.NONE);
|
zoneLabel = new Label(sunriseFieldComposite, SWT.NONE);
|
||||||
zoneLabel.setText("Zone:");
|
zoneLabel.setText("Zone:");
|
||||||
zoneLabel.setLayoutData(createFormLayoutLoc(true));
|
zoneLabel.setLayoutData(createFormLayoutLoc(true));
|
||||||
|
|
||||||
zoneStrings = new String[timezonesMap.size()];
|
zoneStrings = new String[timezonesMap.size()];
|
||||||
tzIterator = timezonesMap.keySet().iterator();
|
tzIterator = timezonesMap.keySet().iterator();
|
||||||
String key = null;
|
String key = null;
|
||||||
for (int i = 0; i < zoneStrings.length; i++)
|
for (int i = 0; i < zoneStrings.length; i++) {
|
||||||
{
|
zoneStrings[i] = tzIterator.next();
|
||||||
zoneStrings[i] = tzIterator.next();
|
key = tzIterator.toString();
|
||||||
key = tzIterator.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
zoneCombo = new Combo(sunriseFieldComposite, SWT.DROP_DOWN);
|
zoneCombo = new Combo(sunriseFieldComposite, SWT.DROP_DOWN);
|
||||||
zoneCombo.setItems(zoneStrings);
|
zoneCombo.setItems(zoneStrings);
|
||||||
data = createFormLayoutLoc(false);
|
data = createFormLayoutLoc(false);
|
||||||
|
@ -593,7 +544,7 @@ public class SunriseToolDialog extends CaveJFACEDialog {
|
||||||
|
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
if (zoneCombo.getSelectionIndex() != -1) {
|
if (zoneCombo.getSelectionIndex() != -1) {
|
||||||
zone = timezonesMap.get(zoneCombo.getText());
|
zone = timezonesMap.get(zoneCombo.getText());
|
||||||
} else {
|
} else {
|
||||||
zone = "GMT";
|
zone = "GMT";
|
||||||
}
|
}
|
||||||
|
@ -614,18 +565,15 @@ public class SunriseToolDialog extends CaveJFACEDialog {
|
||||||
* the current.
|
* the current.
|
||||||
*/
|
*/
|
||||||
private void setCurrentTimeZone(String[] zoneStrings) {
|
private void setCurrentTimeZone(String[] zoneStrings) {
|
||||||
String lTimeZoneString = null;
|
String lTimeZoneString = null;
|
||||||
|
|
||||||
lTimeZoneString = localTimeZoneString();
|
lTimeZoneString = localTimeZoneString();
|
||||||
if (timezonesMap.containsValue(lTimeZoneString))
|
if (timezonesMap.containsValue(lTimeZoneString)) {
|
||||||
{
|
for (int i = 0; i < zoneStrings.length; i++) {
|
||||||
for (int i = 0; i < zoneStrings.length; i++)
|
if (zoneStrings[i].contains(lTimeZoneString + "(")) {
|
||||||
{
|
zoneCombo.setText(zoneStrings[i]);
|
||||||
if (zoneStrings[i].contains(lTimeZoneString + "("))
|
}
|
||||||
{
|
}
|
||||||
zoneCombo.setText(zoneStrings[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -713,22 +661,26 @@ public class SunriseToolDialog extends CaveJFACEDialog {
|
||||||
// e.gc.setFont(originalFont);
|
// e.gc.setFont(originalFont);
|
||||||
e.gc.setLineWidth(2);
|
e.gc.setLineWidth(2);
|
||||||
// N-S line.
|
// N-S line.
|
||||||
e.gc.drawString("N", CIRCLE_X + CIRCLE_SIZE / 2
|
e.gc.drawString(
|
||||||
- e.gc.getCharWidth('N') / 2, CIRCLE_Y
|
"N",
|
||||||
- e.gc.getFontMetrics().getHeight());
|
CIRCLE_X + CIRCLE_SIZE / 2 - e.gc.getCharWidth('N') / 2,
|
||||||
|
CIRCLE_Y - e.gc.getFontMetrics().getHeight());
|
||||||
e.gc.drawLine(CIRCLE_X + CIRCLE_SIZE / 2, CIRCLE_Y, CIRCLE_X
|
e.gc.drawLine(CIRCLE_X + CIRCLE_SIZE / 2, CIRCLE_Y, CIRCLE_X
|
||||||
+ CIRCLE_SIZE / 2, CIRCLE_Y + CIRCLE_SIZE);
|
+ CIRCLE_SIZE / 2, CIRCLE_Y + CIRCLE_SIZE);
|
||||||
e.gc.drawString("S", CIRCLE_X + CIRCLE_SIZE / 2
|
e.gc.drawString(
|
||||||
- e.gc.getCharWidth('S') / 2, CIRCLE_Y + CIRCLE_SIZE);
|
"S",
|
||||||
|
CIRCLE_X + CIRCLE_SIZE / 2 - e.gc.getCharWidth('S') / 2,
|
||||||
|
CIRCLE_Y + CIRCLE_SIZE);
|
||||||
// W-E line.
|
// W-E line.
|
||||||
e.gc.drawString("W", CIRCLE_X - e.gc.getCharWidth('W'),
|
e.gc.drawString("W", CIRCLE_X - e.gc.getCharWidth('W'),
|
||||||
CIRCLE_Y + CIRCLE_SIZE / 2
|
CIRCLE_Y + CIRCLE_SIZE / 2
|
||||||
- e.gc.getFontMetrics().getHeight() / 2);
|
- e.gc.getFontMetrics().getHeight() / 2);
|
||||||
e.gc.drawLine(CIRCLE_X, CIRCLE_Y + CIRCLE_SIZE / 2, CIRCLE_X
|
e.gc.drawLine(CIRCLE_X, CIRCLE_Y + CIRCLE_SIZE / 2, CIRCLE_X
|
||||||
+ CIRCLE_SIZE, CIRCLE_Y + CIRCLE_SIZE / 2);
|
+ CIRCLE_SIZE, CIRCLE_Y + CIRCLE_SIZE / 2);
|
||||||
e.gc.drawString("E", CIRCLE_X + CIRCLE_SIZE
|
e.gc.drawString("E",
|
||||||
+ e.gc.getCharWidth('E') / 2, CIRCLE_Y + CIRCLE_SIZE
|
CIRCLE_X + CIRCLE_SIZE + e.gc.getCharWidth('E') / 2,
|
||||||
/ 2 - e.gc.getFontMetrics().getHeight() / 2);
|
CIRCLE_Y + CIRCLE_SIZE / 2
|
||||||
|
- e.gc.getFontMetrics().getHeight() / 2);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return canvas;
|
return canvas;
|
||||||
|
|
|
@ -56,7 +56,7 @@ import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
|
||||||
import com.raytheon.uf.viz.core.rsc.capabilities.EditableCapability;
|
import com.raytheon.uf.viz.core.rsc.capabilities.EditableCapability;
|
||||||
import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability;
|
import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability;
|
||||||
import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability;
|
import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability;
|
||||||
import com.raytheon.viz.awipstools.ToolsDataManager;
|
import com.raytheon.uf.viz.points.PointsDataManager;
|
||||||
import com.raytheon.viz.awipstools.common.stormtrack.StormTrackDisplay;
|
import com.raytheon.viz.awipstools.common.stormtrack.StormTrackDisplay;
|
||||||
import com.raytheon.viz.awipstools.common.stormtrack.StormTrackUIManager;
|
import com.raytheon.viz.awipstools.common.stormtrack.StormTrackUIManager;
|
||||||
import com.raytheon.viz.awipstools.ui.display.AwipsToolsResourceData;
|
import com.raytheon.viz.awipstools.ui.display.AwipsToolsResourceData;
|
||||||
|
@ -192,7 +192,7 @@ public class AzimuthToolLayer extends
|
||||||
super(data, props);
|
super(data, props);
|
||||||
setDescriptor(descriptor);
|
setDescriptor(descriptor);
|
||||||
data.addChangeListener(this);
|
data.addChangeListener(this);
|
||||||
this.currCoordinate = ToolsDataManager.getInstance().getHome();
|
this.currCoordinate = PointsDataManager.getInstance().getHome();
|
||||||
this.centerPixel = descriptor.worldToPixel(new double[] {
|
this.centerPixel = descriptor.worldToPixel(new double[] {
|
||||||
currCoordinate.x, currCoordinate.y });
|
currCoordinate.x, currCoordinate.y });
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,8 +43,8 @@ import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||||
import com.raytheon.uf.viz.core.exception.VizException;
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||||
import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
|
import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
|
||||||
import com.raytheon.viz.awipstools.IToolChangedListener;
|
import com.raytheon.uf.viz.points.IPointChangedListener;
|
||||||
import com.raytheon.viz.awipstools.ToolsDataManager;
|
import com.raytheon.uf.viz.points.PointsDataManager;
|
||||||
import com.raytheon.viz.awipstools.ui.display.AwipsToolsResourceData;
|
import com.raytheon.viz.awipstools.ui.display.AwipsToolsResourceData;
|
||||||
import com.raytheon.viz.ui.cmenu.AbstractRightClickAction;
|
import com.raytheon.viz.ui.cmenu.AbstractRightClickAction;
|
||||||
import com.raytheon.viz.ui.cmenu.IContextMenuContributor;
|
import com.raytheon.viz.ui.cmenu.IContextMenuContributor;
|
||||||
|
@ -73,7 +73,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class HomeToolLayer extends AbstractMovableToolLayer<Coordinate>
|
public class HomeToolLayer extends AbstractMovableToolLayer<Coordinate>
|
||||||
implements IContextMenuContributor, IToolChangedListener {
|
implements IContextMenuContributor, IPointChangedListener {
|
||||||
|
|
||||||
public static final String DEFAULT_NAME = "Home Location";
|
public static final String DEFAULT_NAME = "Home Location";
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ public class HomeToolLayer extends AbstractMovableToolLayer<Coordinate>
|
||||||
|
|
||||||
private final AbstractRightClickAction moveElementAction;
|
private final AbstractRightClickAction moveElementAction;
|
||||||
|
|
||||||
private ToolsDataManager dataManager = ToolsDataManager.getInstance();
|
private PointsDataManager dataManager = PointsDataManager.getInstance();
|
||||||
|
|
||||||
private GeodeticCalculator gc;
|
private GeodeticCalculator gc;
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ public class HomeToolLayer extends AbstractMovableToolLayer<Coordinate>
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resetHome() {
|
private void resetHome() {
|
||||||
Coordinate home = ToolsDataManager.getInstance().getHome();
|
Coordinate home = dataManager.getHome();
|
||||||
Collection<Coordinate> dummy = new ArrayList<Coordinate>();
|
Collection<Coordinate> dummy = new ArrayList<Coordinate>();
|
||||||
dummy.add(home);
|
dummy.add(home);
|
||||||
setObjects(dummy);
|
setObjects(dummy);
|
||||||
|
@ -182,7 +182,7 @@ public class HomeToolLayer extends AbstractMovableToolLayer<Coordinate>
|
||||||
|
|
||||||
double azimuth = 000;
|
double azimuth = 000;
|
||||||
|
|
||||||
Coordinate home = ToolsDataManager.getInstance().getHome();
|
Coordinate home = dataManager.getHome();
|
||||||
|
|
||||||
gc.setStartingGeographicPoint(home.x, home.y);
|
gc.setStartingGeographicPoint(home.x, home.y);
|
||||||
gc.setDestinationGeographicPoint(dest.x, dest.y);
|
gc.setDestinationGeographicPoint(dest.x, dest.y);
|
||||||
|
@ -219,7 +219,7 @@ public class HomeToolLayer extends AbstractMovableToolLayer<Coordinate>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toolChanged() {
|
public void pointChanged() {
|
||||||
resetHome();
|
resetHome();
|
||||||
issueRefresh();
|
issueRefresh();
|
||||||
}
|
}
|
||||||
|
@ -252,7 +252,7 @@ public class HomeToolLayer extends AbstractMovableToolLayer<Coordinate>
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void save(Coordinate oldCoordinate, Coordinate coordinate) {
|
protected void save(Coordinate oldCoordinate, Coordinate coordinate) {
|
||||||
ToolsDataManager.getInstance().setHome(coordinate);
|
dataManager.setHome(coordinate);
|
||||||
resourceData.fireChangeListeners(ChangeType.DATA_UPDATE, null);
|
resourceData.fireChangeListeners(ChangeType.DATA_UPDATE, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,8 +37,8 @@ import com.raytheon.uf.viz.core.rsc.IResourceDataChanged;
|
||||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||||
import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
|
import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
|
||||||
import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability;
|
import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability;
|
||||||
import com.raytheon.viz.awipstools.IToolChangedListener;
|
import com.raytheon.uf.viz.points.IPointChangedListener;
|
||||||
import com.raytheon.viz.awipstools.ToolsDataManager;
|
import com.raytheon.uf.viz.points.PointsDataManager;
|
||||||
import com.raytheon.viz.awipstools.ui.display.AwipsToolsResourceData;
|
import com.raytheon.viz.awipstools.ui.display.AwipsToolsResourceData;
|
||||||
import com.raytheon.viz.ui.cmenu.AbstractRightClickAction;
|
import com.raytheon.viz.ui.cmenu.AbstractRightClickAction;
|
||||||
import com.raytheon.viz.ui.cmenu.IContextMenuContributor;
|
import com.raytheon.viz.ui.cmenu.IContextMenuContributor;
|
||||||
|
@ -77,7 +77,7 @@ import com.vividsolutions.jts.geom.Point;
|
||||||
* @version 1
|
* @version 1
|
||||||
*/
|
*/
|
||||||
public class PointsToolLayer extends AbstractMovableToolLayer<Point> implements
|
public class PointsToolLayer extends AbstractMovableToolLayer<Point> implements
|
||||||
IContextMenuContributor, IToolChangedListener, IResourceDataChanged {
|
IContextMenuContributor, IPointChangedListener, IResourceDataChanged {
|
||||||
|
|
||||||
public static final String DEFAULT_NAME = "Interactive Points";
|
public static final String DEFAULT_NAME = "Interactive Points";
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ public class PointsToolLayer extends AbstractMovableToolLayer<Point> implements
|
||||||
|
|
||||||
private AbstractRightClickAction moveElementAction;
|
private AbstractRightClickAction moveElementAction;
|
||||||
|
|
||||||
private ToolsDataManager dataManager = ToolsDataManager.getInstance();
|
private PointsDataManager dataManager = PointsDataManager.getInstance();
|
||||||
|
|
||||||
private static GeometryFactory gf = new GeometryFactory();
|
private static GeometryFactory gf = new GeometryFactory();
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ public class PointsToolLayer extends AbstractMovableToolLayer<Point> implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toolChanged() {
|
public void pointChanged() {
|
||||||
resetPoints();
|
resetPoints();
|
||||||
issueRefresh();
|
issueRefresh();
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ import com.raytheon.uf.viz.core.rsc.IInputHandler;
|
||||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||||
import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
|
import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
|
||||||
import com.raytheon.uf.viz.core.rsc.capabilities.EditableCapability;
|
import com.raytheon.uf.viz.core.rsc.capabilities.EditableCapability;
|
||||||
import com.raytheon.viz.awipstools.ToolsDataManager;
|
import com.raytheon.uf.viz.points.PointsDataManager;
|
||||||
import com.raytheon.viz.awipstools.ui.display.AwipsToolsResourceData;
|
import com.raytheon.viz.awipstools.ui.display.AwipsToolsResourceData;
|
||||||
import com.raytheon.viz.ui.input.EditableManager;
|
import com.raytheon.viz.ui.input.EditableManager;
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
import com.vividsolutions.jts.geom.Coordinate;
|
||||||
|
@ -276,7 +276,7 @@ public class ShearLayer extends
|
||||||
|
|
||||||
public LineString createDefaultBaseline() {
|
public LineString createDefaultBaseline() {
|
||||||
|
|
||||||
Coordinate center = ToolsDataManager.getInstance().getHome();
|
Coordinate center = PointsDataManager.getInstance().getHome();
|
||||||
|
|
||||||
gc.setStartingGeographicPoint(center.x, center.y);
|
gc.setStartingGeographicPoint(center.x, center.y);
|
||||||
double meters = nmToMeter.convert(27);
|
double meters = nmToMeter.convert(27);
|
||||||
|
|
|
@ -21,7 +21,8 @@ Require-Bundle: org.eclipse.ui,
|
||||||
com.raytheon.viz.radar,
|
com.raytheon.viz.radar,
|
||||||
com.raytheon.uf.common.serialization.comm,
|
com.raytheon.uf.common.serialization.comm,
|
||||||
com.raytheon.uf.viz.productbrowser;bundle-version="1.11.31",
|
com.raytheon.uf.viz.productbrowser;bundle-version="1.11.31",
|
||||||
com.raytheon.uf.common.dataplugin.radar;bundle-version="1.0.0"
|
com.raytheon.uf.common.dataplugin.radar;bundle-version="1.0.0",
|
||||||
|
com.raytheon.uf.viz.points;bundle-version="1.0.0"
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Export-Package: com.raytheon.viz.grid,
|
Export-Package: com.raytheon.viz.grid,
|
||||||
com.raytheon.viz.grid.gridcache,
|
com.raytheon.viz.grid.gridcache,
|
||||||
|
|
|
@ -68,8 +68,8 @@ import com.raytheon.uf.viz.derivparam.tree.AbstractRequestableLevelNode;
|
||||||
import com.raytheon.uf.viz.derivparam.tree.AbstractRequestableLevelNode.Dependency;
|
import com.raytheon.uf.viz.derivparam.tree.AbstractRequestableLevelNode.Dependency;
|
||||||
import com.raytheon.uf.viz.derivparam.tree.CubeLevel;
|
import com.raytheon.uf.viz.derivparam.tree.CubeLevel;
|
||||||
import com.raytheon.uf.viz.derivparam.tree.StaticDataLevelNode;
|
import com.raytheon.uf.viz.derivparam.tree.StaticDataLevelNode;
|
||||||
import com.raytheon.viz.awipstools.IToolChangedListener;
|
import com.raytheon.uf.viz.points.IPointChangedListener;
|
||||||
import com.raytheon.viz.awipstools.ToolsDataManager;
|
import com.raytheon.uf.viz.points.PointsDataManager;
|
||||||
import com.raytheon.viz.grid.data.ImportRequestableData;
|
import com.raytheon.viz.grid.data.ImportRequestableData;
|
||||||
import com.raytheon.viz.grid.data.StaticGridRequestableData;
|
import com.raytheon.viz.grid.data.StaticGridRequestableData;
|
||||||
import com.raytheon.viz.grid.data.TiltRequestableData;
|
import com.raytheon.viz.grid.data.TiltRequestableData;
|
||||||
|
@ -94,7 +94,7 @@ import com.raytheon.viz.grid.util.RadarAdapter;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class GridInventory extends AbstractInventory implements
|
public class GridInventory extends AbstractInventory implements
|
||||||
IToolChangedListener {
|
IPointChangedListener {
|
||||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||||
.getHandler(GridInventory.class);
|
.getHandler(GridInventory.class);
|
||||||
|
|
||||||
|
@ -137,7 +137,10 @@ public class GridInventory extends AbstractInventory implements
|
||||||
if (updater == null) {
|
if (updater == null) {
|
||||||
updater = new GridUpdater(this);
|
updater = new GridUpdater(this);
|
||||||
updater.startObserving();
|
updater.startObserving();
|
||||||
ToolsDataManager.getInstance().addHomeChangedListener(this);
|
// Currently only one instance of GridInventory is created by
|
||||||
|
// the GribDataCubeAdapter and lasts for the life of
|
||||||
|
// CAVE. Thus no need for removal of this listener.
|
||||||
|
PointsDataManager.getInstance().addHomeChangedListener(this);
|
||||||
} else {
|
} else {
|
||||||
updater.refreshNodes();
|
updater.refreshNodes();
|
||||||
}
|
}
|
||||||
|
@ -745,7 +748,7 @@ public class GridInventory extends AbstractInventory implements
|
||||||
* com.raytheon.viz.awipstools.IHomeChangedListener#homeLocationChanged()
|
* com.raytheon.viz.awipstools.IHomeChangedListener#homeLocationChanged()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void toolChanged() {
|
public void pointChanged() {
|
||||||
reinitTree();
|
reinitTree();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,8 @@ Require-Bundle: org.apache.batik;bundle-version="1.6.0",
|
||||||
com.raytheon.uf.common.serialization.comm;bundle-version="1.11.22",
|
com.raytheon.uf.common.serialization.comm;bundle-version="1.11.22",
|
||||||
com.raytheon.uf.viz.productbrowser;bundle-version="1.11.31",
|
com.raytheon.uf.viz.productbrowser;bundle-version="1.11.31",
|
||||||
com.raytheon.uf.viz.d2d.core;bundle-version="1.12.1130",
|
com.raytheon.uf.viz.d2d.core;bundle-version="1.12.1130",
|
||||||
com.raytheon.uf.common.dataplugin.radar;bundle-version="1.0.0"
|
com.raytheon.uf.common.dataplugin.radar;bundle-version="1.0.0",
|
||||||
|
com.raytheon.uf.viz.points;bundle-version="1.0.0"
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Import-Package: com.raytheon.edex.meteoLib,
|
Import-Package: com.raytheon.edex.meteoLib,
|
||||||
com.raytheon.uf.common.colormap,
|
com.raytheon.uf.common.colormap,
|
||||||
|
|
|
@ -49,8 +49,8 @@ import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
|
||||||
import com.raytheon.uf.viz.core.rsc.capabilities.ImagingCapability;
|
import com.raytheon.uf.viz.core.rsc.capabilities.ImagingCapability;
|
||||||
import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability;
|
import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability;
|
||||||
import com.raytheon.uf.viz.core.rsc.capabilities.TimeMatchBasisCapability;
|
import com.raytheon.uf.viz.core.rsc.capabilities.TimeMatchBasisCapability;
|
||||||
|
import com.raytheon.uf.viz.points.PointsDataManager;
|
||||||
import com.raytheon.uf.viz.xy.map.rsc.IInsetMapResource;
|
import com.raytheon.uf.viz.xy.map.rsc.IInsetMapResource;
|
||||||
import com.raytheon.viz.awipstools.ToolsDataManager;
|
|
||||||
import com.raytheon.viz.awipstools.capabilities.RangeRingsOverlayCapability;
|
import com.raytheon.viz.awipstools.capabilities.RangeRingsOverlayCapability;
|
||||||
import com.raytheon.viz.core.graphing.GraphProperties;
|
import com.raytheon.viz.core.graphing.GraphProperties;
|
||||||
import com.raytheon.viz.core.graphing.xy.XYData;
|
import com.raytheon.viz.core.graphing.xy.XYData;
|
||||||
|
@ -428,7 +428,7 @@ public class RadarGraphResource extends
|
||||||
private CellTrendDataPacket getNearestCell(String point,
|
private CellTrendDataPacket getNearestCell(String point,
|
||||||
Map<RadarDataKey, RadarDataPoint> symbologyData) {
|
Map<RadarDataKey, RadarDataPoint> symbologyData) {
|
||||||
|
|
||||||
Coordinate pointCoord = ToolsDataManager.getInstance().getPoint(point);
|
Coordinate pointCoord = PointsDataManager.getInstance().getPoint(point);
|
||||||
|
|
||||||
CellTrendDataPacket nearestCell = null;
|
CellTrendDataPacket nearestCell = null;
|
||||||
CellTrendDataPacket currCell = null;
|
CellTrendDataPacket currCell = null;
|
||||||
|
|
|
@ -24,10 +24,9 @@ import com.raytheon.uf.common.dataplugin.radar.request.GetRadarSpatialRequest;
|
||||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
import com.raytheon.uf.common.status.UFStatus;
|
import com.raytheon.uf.common.status.UFStatus;
|
||||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
|
||||||
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||||
import com.raytheon.viz.awipstools.IToolChangedListener;
|
import com.raytheon.uf.viz.points.IPointChangedListener;
|
||||||
import com.raytheon.viz.awipstools.ToolsDataManager;
|
import com.raytheon.uf.viz.points.PointsDataManager;
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
import com.vividsolutions.jts.geom.Coordinate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,7 +44,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
||||||
* @author rjpeter
|
* @author rjpeter
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
public class StationUtils implements IToolChangedListener {
|
public class StationUtils implements IPointChangedListener {
|
||||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||||
.getHandler(StationUtils.class);
|
.getHandler(StationUtils.class);
|
||||||
|
|
||||||
|
@ -62,17 +61,12 @@ public class StationUtils implements IToolChangedListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private StationUtils() {
|
private StationUtils() {
|
||||||
ToolsDataManager.getInstance().addHomeChangedListener(this);
|
PointsDataManager.getInstance().addHomeChangedListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized RadarStation getHomeRadarStation() {
|
public synchronized RadarStation getHomeRadarStation() {
|
||||||
if (station == null) {
|
if (station == null) {
|
||||||
LocalizationManager lm = LocalizationManager.getInstance();
|
Coordinate home = PointsDataManager.getInstance().getHome();
|
||||||
// IPreferenceStore store = CorePlugin.getDefault()
|
|
||||||
// .getPreferenceStore();
|
|
||||||
// String site = lm.getCurrentSite();
|
|
||||||
|
|
||||||
Coordinate home = ToolsDataManager.getInstance().getHome();
|
|
||||||
return getClosestRadarStation(home.x, home.y);
|
return getClosestRadarStation(home.x, home.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +97,7 @@ public class StationUtils implements IToolChangedListener {
|
||||||
* com.raytheon.viz.awipstools.IHomeChangedListener#homeLocationChanged()
|
* com.raytheon.viz.awipstools.IHomeChangedListener#homeLocationChanged()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void toolChanged() {
|
public void pointChanged() {
|
||||||
station = null;
|
station = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,337 @@
|
||||||
|
/**
|
||||||
|
* This software was developed and / or modified by Raytheon Company,
|
||||||
|
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||||
|
*
|
||||||
|
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||||
|
* This software product contains export-restricted data whose
|
||||||
|
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||||
|
* to non-U.S. persons whether in the United States or abroad requires
|
||||||
|
* an export license or other authorization.
|
||||||
|
*
|
||||||
|
* Contractor Name: Raytheon Company
|
||||||
|
* Contractor Address: 6825 Pine Street, Suite 340
|
||||||
|
* Mail Stop B8
|
||||||
|
* Omaha, NE 68106
|
||||||
|
* 402.291.0100
|
||||||
|
*
|
||||||
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
|
* further licensing information.
|
||||||
|
**/
|
||||||
|
package com.raytheon.viz.ui.widgets;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.events.DisposeEvent;
|
||||||
|
import org.eclipse.swt.events.DisposeListener;
|
||||||
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
|
import org.eclipse.swt.events.SelectionListener;
|
||||||
|
import org.eclipse.swt.graphics.Point;
|
||||||
|
import org.eclipse.swt.layout.FillLayout;
|
||||||
|
import org.eclipse.swt.widgets.Button;
|
||||||
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.swt.widgets.Event;
|
||||||
|
import org.eclipse.swt.widgets.Menu;
|
||||||
|
import org.eclipse.swt.widgets.MenuItem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This creates a composite that displays a button which is associated with a
|
||||||
|
* menu. This class will take responsibility for disposing any menus assigned to
|
||||||
|
* it via the setMenu method. When a non-cascading menu item is selected the
|
||||||
|
* button's text is updated to reflect the selection.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* Initial creation
|
||||||
|
* Jul 6, 2012 #875 rferrel Move to common package and made more robust.
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author rferrel
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
public class MenuButton extends MinimumSizeComposite implements
|
||||||
|
SelectionListener, DisposeListener {
|
||||||
|
private Button button;
|
||||||
|
|
||||||
|
private int defaultMinWidth = SWT.DEFAULT;
|
||||||
|
|
||||||
|
private int defaultMinHeight = SWT.DEFAULT;
|
||||||
|
|
||||||
|
private final ArrayList<SelectionListener> listeners = new ArrayList<SelectionListener>();
|
||||||
|
|
||||||
|
private MenuItem selectedItem;
|
||||||
|
|
||||||
|
public MenuButton(Composite parent) {
|
||||||
|
super(parent, SWT.NONE);
|
||||||
|
setLayout(new FillLayout(SWT.HORIZONTAL));
|
||||||
|
button = new Button(this, SWT.PUSH);
|
||||||
|
/*
|
||||||
|
* // This produced annoying behavoir... button.addMouseListener(new
|
||||||
|
* MouseAdapter() {
|
||||||
|
*
|
||||||
|
* @Override public void mouseDown(MouseEvent e) { if (e.button == 1) {
|
||||||
|
* doPopup(); } }
|
||||||
|
*
|
||||||
|
* });
|
||||||
|
*/
|
||||||
|
button.addSelectionListener(new SelectionAdapter() {
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
doPopup();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
addDisposeListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnabled(boolean enabled) {
|
||||||
|
button.setEnabled(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void doPopup() {
|
||||||
|
boolean isEnabled = button.isEnabled();
|
||||||
|
if (!isEnabled)
|
||||||
|
return;
|
||||||
|
/*
|
||||||
|
* button.setEnabled(false); button.setEnabled(true);
|
||||||
|
*/
|
||||||
|
Menu menu = getMenu();
|
||||||
|
if (menu == null)
|
||||||
|
return;
|
||||||
|
Point sz = getSize();
|
||||||
|
Point p = toDisplay(0, sz.y);
|
||||||
|
menu.setLocation(p);
|
||||||
|
menu.setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* org.eclipse.swt.widgets.Control#setMenu(org.eclipse.swt.widgets.Menu)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void setMenu(Menu menu) {
|
||||||
|
// Dispose of previous menu
|
||||||
|
unrealizeMenu();
|
||||||
|
super.setMenu(menu);
|
||||||
|
realizeMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateMenu() {
|
||||||
|
realizeMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void realizeMenu() {
|
||||||
|
String text = button.getText();
|
||||||
|
realizeMenu1(getMenu());
|
||||||
|
// Minimize button's default size in so it will not interfere if
|
||||||
|
// setSize is invoked.
|
||||||
|
button.setText("");
|
||||||
|
button.computeSize(SWT.DEFAULT, SWT.DEFAULT);
|
||||||
|
button.setText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recursive call to set listeners on non-CASCADE menu items.
|
||||||
|
*
|
||||||
|
* @param menu
|
||||||
|
*/
|
||||||
|
private void realizeMenu1(Menu menu) {
|
||||||
|
if (menu != null) {
|
||||||
|
for (MenuItem mi : menu.getItems()) {
|
||||||
|
if ((mi.getStyle() & SWT.CASCADE) == 0) {
|
||||||
|
mi.addSelectionListener(this);
|
||||||
|
// Adjust size so largest item's text will fit in the button
|
||||||
|
button.setText(mi.getText());
|
||||||
|
Point pt = button.computeSize(SWT.DEFAULT, SWT.DEFAULT);
|
||||||
|
if (minWidth < pt.x) {
|
||||||
|
minWidth = pt.x;
|
||||||
|
}
|
||||||
|
if (minHeight < pt.y) {
|
||||||
|
minHeight = pt.y;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
realizeMenu1(mi.getMenu());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse
|
||||||
|
* .swt.events.SelectionEvent)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void widgetDefaultSelected(SelectionEvent e) {
|
||||||
|
widgetSelected(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt
|
||||||
|
* .events.SelectionEvent)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
MenuItem mi;
|
||||||
|
try {
|
||||||
|
mi = (MenuItem) e.widget;
|
||||||
|
} catch (ClassCastException exc) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setSelectedItem(mi);
|
||||||
|
|
||||||
|
Event ev = new Event();
|
||||||
|
ev.widget = this;
|
||||||
|
ev.data = mi;
|
||||||
|
|
||||||
|
SelectionEvent selEvent = new SelectionEvent(ev);
|
||||||
|
|
||||||
|
SelectionListener[] ls = listeners
|
||||||
|
.toArray(new SelectionListener[listeners.size()]);
|
||||||
|
for (SelectionListener l : ls) {
|
||||||
|
l.widgetSelected(selEvent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void widgetDisposed(DisposeEvent e) {
|
||||||
|
unrealizeMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void unrealizeMenu() {
|
||||||
|
unrealizeMenu1(getMenu());
|
||||||
|
super.setMinimumSize(defaultMinWidth, defaultMinHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recursive call to remove listeners from menu items and dispose of menus.
|
||||||
|
*
|
||||||
|
* @param menu
|
||||||
|
*/
|
||||||
|
private void unrealizeMenu1(Menu menu) {
|
||||||
|
if (menu != null) {
|
||||||
|
for (MenuItem mi : menu.getItems()) {
|
||||||
|
if (mi != null) {
|
||||||
|
if ((mi.getStyle() & SWT.CASCADE) == 0) {
|
||||||
|
mi.removeSelectionListener(this);
|
||||||
|
} else {
|
||||||
|
unrealizeMenu1(mi.getMenu());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
menu.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The selection event sent to the listener will have its data object set to
|
||||||
|
* the menu item that was selected.
|
||||||
|
*
|
||||||
|
* @param listener
|
||||||
|
*/
|
||||||
|
public void addSelectionListener(SelectionListener listener) {
|
||||||
|
if (listener == null)
|
||||||
|
throw new NullPointerException();
|
||||||
|
listeners.add(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MenuItem getSelectedItem() {
|
||||||
|
return selectedItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This becomes the selected item and changes the button's text to the
|
||||||
|
* item's text.
|
||||||
|
*
|
||||||
|
* @param selectedItem
|
||||||
|
*/
|
||||||
|
public void setSelectedItem(MenuItem selectedItem) {
|
||||||
|
this.selectedItem = selectedItem;
|
||||||
|
if (selectedItem != null)
|
||||||
|
button.setText(selectedItem.getText());
|
||||||
|
else
|
||||||
|
button.setText("");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This changes the button's text to the selected text and the non-cascade
|
||||||
|
* item whose text matches the selected text becomes the selected item. The
|
||||||
|
* selected item is set to null when a match is not found.
|
||||||
|
*
|
||||||
|
* @param selectedText
|
||||||
|
*/
|
||||||
|
public void setSelectedItem(String selectedText) {
|
||||||
|
if (selectedText == null) {
|
||||||
|
button.setText("");
|
||||||
|
this.selectedItem = null;
|
||||||
|
button.setText(selectedText);
|
||||||
|
} else {
|
||||||
|
button.setText(selectedText);
|
||||||
|
this.selectedItem = findItem(getMenu(), selectedText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search menu and its sub-menus for a non-cascade menu item with the
|
||||||
|
* desired text value.
|
||||||
|
*
|
||||||
|
* @param menu
|
||||||
|
* @param text
|
||||||
|
* @return item - null if no match is found
|
||||||
|
*/
|
||||||
|
private MenuItem findItem(Menu menu, String text) {
|
||||||
|
if (menu != null) {
|
||||||
|
for (MenuItem item : menu.getItems()) {
|
||||||
|
if (item != null) {
|
||||||
|
if ((item.getStyle() & SWT.CASCADE) != 0) {
|
||||||
|
MenuItem foundItem = findItem(item.getMenu(), text);
|
||||||
|
if (foundItem != null) {
|
||||||
|
return foundItem;
|
||||||
|
}
|
||||||
|
} else if (text.equals(item.getText())) {
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* com.raytheon.viz.ui.widgets.MinimumSizeComposite#setMinimumSize(org.eclipse
|
||||||
|
* .swt.graphics.Point)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void setMinimumSize(Point sz) {
|
||||||
|
defaultMinWidth = sz.x;
|
||||||
|
defaultMinHeight = sz.y;
|
||||||
|
super.setMinimumSize(sz);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see com.raytheon.viz.ui.widgets.MinimumSizeComposite#setMinimumSize(int,
|
||||||
|
* int)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void setMinimumSize(int width, int height) {
|
||||||
|
defaultMinWidth = width;
|
||||||
|
defaultMinHeight = height;
|
||||||
|
super.setMinimumSize(width, height);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,103 @@
|
||||||
|
/**
|
||||||
|
* This software was developed and / or modified by Raytheon Company,
|
||||||
|
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||||
|
*
|
||||||
|
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||||
|
* This software product contains export-restricted data whose
|
||||||
|
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||||
|
* to non-U.S. persons whether in the United States or abroad requires
|
||||||
|
* an export license or other authorization.
|
||||||
|
*
|
||||||
|
* Contractor Name: Raytheon Company
|
||||||
|
* Contractor Address: 6825 Pine Street, Suite 340
|
||||||
|
* Mail Stop B8
|
||||||
|
* Omaha, NE 68106
|
||||||
|
* 402.291.0100
|
||||||
|
*
|
||||||
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
|
* further licensing information.
|
||||||
|
**/
|
||||||
|
package com.raytheon.viz.ui.widgets;
|
||||||
|
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.graphics.Point;
|
||||||
|
import org.eclipse.swt.layout.GridData;
|
||||||
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.swt.widgets.Control;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class extends Composite and prevents its computed size from being less
|
||||||
|
* then the set minimum.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* Initial creation
|
||||||
|
* Jul 11, 2012 #875 rferrel Move to common package and
|
||||||
|
* made minWidth and minHeight
|
||||||
|
* accessible to subclasses.
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author rferrel
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
public class MinimumSizeComposite extends Composite {
|
||||||
|
|
||||||
|
protected int minWidth = SWT.DEFAULT;
|
||||||
|
|
||||||
|
protected int minHeight = SWT.DEFAULT;
|
||||||
|
|
||||||
|
public MinimumSizeComposite(Composite parent) {
|
||||||
|
this(parent, SWT.NONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MinimumSizeComposite(Composite parent, int style) {
|
||||||
|
super(parent, style);
|
||||||
|
GridLayout gd = new GridLayout(1, false);
|
||||||
|
gd.marginWidth = 0;
|
||||||
|
gd.marginHeight = 0;
|
||||||
|
setLayout(gd);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setControl(Control c) {
|
||||||
|
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||||
|
if (minWidth != SWT.DEFAULT)
|
||||||
|
gd.minimumWidth = minWidth;
|
||||||
|
if (minHeight != SWT.DEFAULT)
|
||||||
|
gd.minimumHeight = minHeight;
|
||||||
|
c.setLayoutData(gd);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMinimumSizeFromComputedSize() {
|
||||||
|
setMinimumSize(super.computeSize(SWT.DEFAULT, SWT.DEFAULT));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Point computeSize(int wHint, int hHint, boolean changed) {
|
||||||
|
Point sz = super.computeSize(wHint, hHint, changed);
|
||||||
|
sz.x = Math.max(minWidth, sz.x);
|
||||||
|
sz.y = Math.max(minHeight, sz.y);
|
||||||
|
return sz;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMinimumSize(Point sz) {
|
||||||
|
minWidth = sz.x;
|
||||||
|
minHeight = sz.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMinimumSize(int width, int height) {
|
||||||
|
minWidth = width;
|
||||||
|
minHeight = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void layout(boolean changed, boolean all) {
|
||||||
|
super.layout(changed, all);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -31,7 +31,8 @@ Require-Bundle: org.eclipse.ui,
|
||||||
com.raytheon.uf.viz.objectiveanalysis,
|
com.raytheon.uf.viz.objectiveanalysis,
|
||||||
com.raytheon.uf.common.pointdata,
|
com.raytheon.uf.common.pointdata,
|
||||||
net.sf.swtaddons;bundle-version="1.0.0",
|
net.sf.swtaddons;bundle-version="1.0.0",
|
||||||
com.raytheon.uf.common.dataplugin.radar;bundle-version="1.0.0"
|
com.raytheon.uf.common.dataplugin.radar;bundle-version="1.0.0",
|
||||||
|
com.raytheon.uf.viz.points;bundle-version="1.0.0"
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Export-Package: com.raytheon.viz.volumebrowser,
|
Export-Package: com.raytheon.viz.volumebrowser,
|
||||||
com.raytheon.viz.volumebrowser.catalog,
|
com.raytheon.viz.volumebrowser.catalog,
|
||||||
|
|
|
@ -47,6 +47,7 @@ import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria;
|
||||||
import com.raytheon.uf.viz.core.style.StyleManager;
|
import com.raytheon.uf.viz.core.style.StyleManager;
|
||||||
import com.raytheon.uf.viz.core.style.StyleRule;
|
import com.raytheon.uf.viz.core.style.StyleRule;
|
||||||
import com.raytheon.uf.viz.core.style.VizStyleException;
|
import com.raytheon.uf.viz.core.style.VizStyleException;
|
||||||
|
import com.raytheon.uf.viz.points.PointsDataManager;
|
||||||
import com.raytheon.uf.viz.xy.crosssection.rsc.CrossSectionResourceData;
|
import com.raytheon.uf.viz.xy.crosssection.rsc.CrossSectionResourceData;
|
||||||
import com.raytheon.uf.viz.xy.timeheight.rsc.TimeHeightResourceData;
|
import com.raytheon.uf.viz.xy.timeheight.rsc.TimeHeightResourceData;
|
||||||
import com.raytheon.uf.viz.xy.timeseries.rsc.TimeSeriesResourceData;
|
import com.raytheon.uf.viz.xy.timeseries.rsc.TimeSeriesResourceData;
|
||||||
|
@ -256,9 +257,9 @@ public abstract class AbstractDataCatalog implements IDataCatalog {
|
||||||
|
|
||||||
String pointLetter = getPointLetter(catalogEntry);
|
String pointLetter = getPointLetter(catalogEntry);
|
||||||
|
|
||||||
Coordinate c = ToolsDataManager.getInstance().getPoint(pointLetter);
|
Coordinate c = PointsDataManager.getInstance().getPoint(pointLetter);
|
||||||
if (c == null) {
|
if (c == null) {
|
||||||
c = ToolsDataManager.getInstance().getPoint("A");
|
c = PointsDataManager.getInstance().getPoint("A");
|
||||||
}
|
}
|
||||||
return c;
|
return c;
|
||||||
|
|
||||||
|
@ -465,7 +466,7 @@ public abstract class AbstractDataCatalog implements IDataCatalog {
|
||||||
|
|
||||||
public static Set<String> getPointLineKeys() {
|
public static Set<String> getPointLineKeys() {
|
||||||
Set<String> keySet = new HashSet<String>();
|
Set<String> keySet = new HashSet<String>();
|
||||||
for (String letter : ToolsDataManager.getInstance().getPointNames()) {
|
for (String letter : PointsDataManager.getInstance().getPointNames()) {
|
||||||
keySet.add("Point" + letter);
|
keySet.add("Point" + letter);
|
||||||
}
|
}
|
||||||
for (String letter : ToolsDataManager.getInstance().getBaselineNames()) {
|
for (String letter : ToolsDataManager.getInstance().getBaselineNames()) {
|
||||||
|
|
|
@ -54,6 +54,7 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||||
import com.raytheon.uf.viz.core.rsc.ResourceType;
|
import com.raytheon.uf.viz.core.rsc.ResourceType;
|
||||||
import com.raytheon.uf.viz.d2d.nsharp.rsc.D2DNSharpResourceData;
|
import com.raytheon.uf.viz.d2d.nsharp.rsc.D2DNSharpResourceData;
|
||||||
import com.raytheon.uf.viz.d2d.nsharp.rsc.GribNSharpResourceData;
|
import com.raytheon.uf.viz.d2d.nsharp.rsc.GribNSharpResourceData;
|
||||||
|
import com.raytheon.uf.viz.points.PointsDataManager;
|
||||||
import com.raytheon.viz.awipstools.ToolsDataManager;
|
import com.raytheon.viz.awipstools.ToolsDataManager;
|
||||||
import com.raytheon.viz.grid.inv.GridInventory;
|
import com.raytheon.viz.grid.inv.GridInventory;
|
||||||
import com.raytheon.viz.grid.rsc.GribSkewTLoadProperties;
|
import com.raytheon.viz.grid.rsc.GribSkewTLoadProperties;
|
||||||
|
@ -453,7 +454,7 @@ public class GribDataCatalog extends AbstractInventoryDataCatalog {
|
||||||
.getCoordinateReferenceSystem());
|
.getCoordinateReferenceSystem());
|
||||||
Envelope2D env = gridGeom.getEnvelope2D();
|
Envelope2D env = gridGeom.getEnvelope2D();
|
||||||
for (String letter : pointLetters) {
|
for (String letter : pointLetters) {
|
||||||
Coordinate c = ToolsDataManager.getInstance().getPoint(
|
Coordinate c = PointsDataManager.getInstance().getPoint(
|
||||||
letter);
|
letter);
|
||||||
DirectPosition2D dp = new DirectPosition2D(c.x, c.y);
|
DirectPosition2D dp = new DirectPosition2D(c.x, c.y);
|
||||||
llToCRS.transform(dp, dp);
|
llToCRS.transform(dp, dp);
|
||||||
|
@ -519,6 +520,7 @@ public class GribDataCatalog extends AbstractInventoryDataCatalog {
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
ToolsDataManager tdm = ToolsDataManager.getInstance();
|
ToolsDataManager tdm = ToolsDataManager.getInstance();
|
||||||
|
PointsDataManager pdm = PointsDataManager.getInstance();
|
||||||
Map<String, GridCoverage> coverages = new HashMap<String, GridCoverage>();
|
Map<String, GridCoverage> coverages = new HashMap<String, GridCoverage>();
|
||||||
try {
|
try {
|
||||||
coverages = CoverageUtils.getInstance().getCoverages(sources);
|
coverages = CoverageUtils.getInstance().getCoverages(sources);
|
||||||
|
@ -543,8 +545,8 @@ public class GribDataCatalog extends AbstractInventoryDataCatalog {
|
||||||
MathTransform llToCRS = MapUtil.getTransformFromLatLon(gridGeom
|
MathTransform llToCRS = MapUtil.getTransformFromLatLon(gridGeom
|
||||||
.getCoordinateReferenceSystem());
|
.getCoordinateReferenceSystem());
|
||||||
Envelope2D env = gridGeom.getEnvelope2D();
|
Envelope2D env = gridGeom.getEnvelope2D();
|
||||||
for (String letter : tdm.getPointNames()) {
|
for (String letter : pdm.getPointNames()) {
|
||||||
Coordinate c = tdm.getPoint(letter);
|
Coordinate c = pdm.getPoint(letter);
|
||||||
DirectPosition2D dp = new DirectPosition2D(c.x, c.y);
|
DirectPosition2D dp = new DirectPosition2D(c.x, c.y);
|
||||||
llToCRS.transform(dp, dp);
|
llToCRS.transform(dp, dp);
|
||||||
if (env.contains(dp.x, dp.y)) {
|
if (env.contains(dp.x, dp.y)) {
|
||||||
|
|
|
@ -49,6 +49,7 @@ import com.raytheon.uf.viz.core.rsc.ResourceType;
|
||||||
import com.raytheon.uf.viz.d2d.nsharp.rsc.BufruaNSharpResourceData;
|
import com.raytheon.uf.viz.d2d.nsharp.rsc.BufruaNSharpResourceData;
|
||||||
import com.raytheon.uf.viz.d2d.nsharp.rsc.MdlSndNSharpResourceData;
|
import com.raytheon.uf.viz.d2d.nsharp.rsc.MdlSndNSharpResourceData;
|
||||||
import com.raytheon.uf.viz.objectiveanalysis.rsc.OAResourceData;
|
import com.raytheon.uf.viz.objectiveanalysis.rsc.OAResourceData;
|
||||||
|
import com.raytheon.uf.viz.points.PointsDataManager;
|
||||||
import com.raytheon.uf.viz.xy.crosssection.rsc.CrossSectionResourceData;
|
import com.raytheon.uf.viz.xy.crosssection.rsc.CrossSectionResourceData;
|
||||||
import com.raytheon.uf.viz.xy.timeheight.rsc.TimeHeightResourceData;
|
import com.raytheon.uf.viz.xy.timeheight.rsc.TimeHeightResourceData;
|
||||||
import com.raytheon.viz.awipstools.ToolsDataManager;
|
import com.raytheon.viz.awipstools.ToolsDataManager;
|
||||||
|
@ -450,7 +451,7 @@ public class PointDataCatalog extends AbstractInventoryDataCatalog {
|
||||||
.setPointCoordinate(closestCoord);
|
.setPointCoordinate(closestCoord);
|
||||||
|
|
||||||
String pointLetter = getPointLetter(catalogEntry);
|
String pointLetter = getPointLetter(catalogEntry);
|
||||||
ToolsDataManager.getInstance().setPoint(pointLetter, closestCoord);
|
PointsDataManager.getInstance().setPoint(pointLetter, closestCoord);
|
||||||
return resourceData;
|
return resourceData;
|
||||||
case CROSS_SECTION:
|
case CROSS_SECTION:
|
||||||
resourceData = super.getResourceData(catalogEntry, resourceType);
|
resourceData = super.getResourceData(catalogEntry, resourceType);
|
||||||
|
@ -569,7 +570,7 @@ public class PointDataCatalog extends AbstractInventoryDataCatalog {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (String letter : pointLetters) {
|
for (String letter : pointLetters) {
|
||||||
Coordinate c = ToolsDataManager.getInstance().getPoint(letter);
|
Coordinate c = PointsDataManager.getInstance().getPoint(letter);
|
||||||
if (getClosestStation(c, source) != null) {
|
if (getClosestStation(c, source) != null) {
|
||||||
fileredSources.add(source);
|
fileredSources.add(source);
|
||||||
break;
|
break;
|
||||||
|
@ -605,17 +606,17 @@ public class PointDataCatalog extends AbstractInventoryDataCatalog {
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
ToolsDataManager tdm = ToolsDataManager.getInstance();
|
ToolsDataManager tdm = ToolsDataManager.getInstance();
|
||||||
|
PointsDataManager pdm = PointsDataManager.getInstance();
|
||||||
Set<String> validPlanes = new HashSet<String>(sources.size());
|
Set<String> validPlanes = new HashSet<String>(sources.size());
|
||||||
for (String source : sources) {
|
for (String source : sources) {
|
||||||
for (String letter : tdm.getPointNames()) {
|
for (String letter : pdm.getPointNames()) {
|
||||||
Coordinate c = ToolsDataManager.getInstance().getPoint(letter);
|
Coordinate c = pdm.getPoint(letter);
|
||||||
if (getClosestStation(c, source) != null) {
|
if (getClosestStation(c, source) != null) {
|
||||||
validPlanes.add("Point" + letter);
|
validPlanes.add("Point" + letter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (String letter : tdm.getBaselineNames()) {
|
for (String letter : tdm.getBaselineNames()) {
|
||||||
LineString ls = ToolsDataManager.getInstance().getBaseline(
|
LineString ls = tdm.getBaseline(letter);
|
||||||
letter);
|
|
||||||
boolean failed = false;
|
boolean failed = false;
|
||||||
for (Coordinate c : ls.getCoordinates()) {
|
for (Coordinate c : ls.getCoordinates()) {
|
||||||
if (getClosestStation(c, source) == null) {
|
if (getClosestStation(c, source) == null) {
|
||||||
|
|
|
@ -56,6 +56,8 @@ import com.raytheon.uf.common.status.UFStatus;
|
||||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
import com.raytheon.uf.viz.core.VizApp;
|
import com.raytheon.uf.viz.core.VizApp;
|
||||||
import com.raytheon.uf.viz.core.exception.VizException;
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
|
import com.raytheon.uf.viz.points.IPointChangedListener;
|
||||||
|
import com.raytheon.uf.viz.points.PointsDataManager;
|
||||||
import com.raytheon.viz.awipstools.IToolChangedListener;
|
import com.raytheon.viz.awipstools.IToolChangedListener;
|
||||||
import com.raytheon.viz.awipstools.ToolsDataManager;
|
import com.raytheon.viz.awipstools.ToolsDataManager;
|
||||||
import com.raytheon.viz.volumebrowser.datacatalog.DataCatalogManager;
|
import com.raytheon.viz.volumebrowser.datacatalog.DataCatalogManager;
|
||||||
|
@ -442,10 +444,10 @@ public class DataListsProdTableComp extends Composite implements
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ToolsDataManager.getInstance().addPointsChangedListener(
|
PointsDataManager.getInstance().addPointsChangedListener(
|
||||||
new IToolChangedListener() {
|
new IPointChangedListener() {
|
||||||
@Override
|
@Override
|
||||||
public void toolChanged() {
|
public void pointChanged() {
|
||||||
VizApp.runAsync(new Runnable() {
|
VizApp.runAsync(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
updateMenuInventory();
|
updateMenuInventory();
|
||||||
|
@ -826,7 +828,7 @@ public class DataListsProdTableComp extends Composite implements
|
||||||
tbContrib.xml.toolItemText = "Points";
|
tbContrib.xml.toolItemText = "Points";
|
||||||
tbContrib.xml.id = "SoundingPointsButton";
|
tbContrib.xml.id = "SoundingPointsButton";
|
||||||
List<IContributionItem> items = new ArrayList<IContributionItem>();
|
List<IContributionItem> items = new ArrayList<IContributionItem>();
|
||||||
List<String> points = new ArrayList<String>(ToolsDataManager
|
List<String> points = new ArrayList<String>(PointsDataManager
|
||||||
.getInstance().getPointNames());
|
.getInstance().getPointNames());
|
||||||
Collections.sort(points);
|
Collections.sort(points);
|
||||||
for (String point : points) {
|
for (String point : points) {
|
||||||
|
|
28
cots/org.apache.tomcat.nativ/.project
Normal file
28
cots/org.apache.tomcat.nativ/.project
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>org.apache.tomcat.nativ</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.pde.PluginNature</nature>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
Loading…
Add table
Reference in a new issue