profilerMapResource
This commit is contained in:
parent
db02e4039f
commit
3cc20bca1b
14 changed files with 712 additions and 27 deletions
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
|
@ -4,7 +4,7 @@ Bundle-Name: Profiler Plug-in
|
|||
Bundle-SymbolicName: com.raytheon.uf.viz.profiler;singleton:=true
|
||||
Bundle-Version: 1.15.1.qualifier
|
||||
Bundle-Vendor: RAYTHEON
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Require-Bundle: com.raytheon.uf.viz.core;bundle-version="1.15.0",
|
||||
com.raytheon.uf.common.pointdata;bundle-version="1.15.0",
|
||||
|
@ -20,7 +20,9 @@ Require-Bundle: com.raytheon.uf.viz.core;bundle-version="1.15.0",
|
|||
com.raytheon.uf.viz.d2d.ui;bundle-version="1.14.0",
|
||||
com.raytheon.uf.viz.d2d.core;bundle-version="1.14.0",
|
||||
com.raytheon.uf.viz.xy;bundle-version="1.15.0",
|
||||
com.raytheon.uf.common.sounding;bundle-version="1.14.0"
|
||||
com.raytheon.uf.common.sounding;bundle-version="1.14.0",
|
||||
com.raytheon.viz.ui
|
||||
Export-Package: com.raytheon.uf.viz.profiler,
|
||||
com.raytheon.uf.viz.profiler.ui
|
||||
Bundle-ClassPath: com.raytheon.uf.viz.profiler.jar
|
||||
Import-Package: com.raytheon.viz.pointdata
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 829 B After Width: | Height: | Size: 15 KiB |
|
@ -38,7 +38,7 @@
|
|||
<resourceData xsi:type="profilerResourceData">
|
||||
<metadataMap>
|
||||
<mapping key="dataURI">
|
||||
<constraint constraintValue="${productURI}" constraintType="LIKE" />
|
||||
<constraint constraintValue="/profiler/%/3000/${wmoid}/%" constraintType="LIKE" />
|
||||
</mapping>
|
||||
<mapping key="pluginName">
|
||||
<constraint constraintValue="profiler" constraintType="EQUALS" />
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
|
||||
<bundle xmlns:ns2="group" xmlns:ns3="http://www.example.org/productType">
|
||||
<displayList>
|
||||
<displays xsi:type="d2DMapRenderableDisplay"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<descriptor xsi:type="mapDescriptor">
|
||||
<resource>
|
||||
<loadProperties />
|
||||
<resourceData xsi:type="profilerMapResourceData" />
|
||||
</resource>
|
||||
<resource>
|
||||
<loadProperties loadWithoutData="false">
|
||||
<resourceType>PLAN_VIEW</resourceType>
|
||||
<capabilities>
|
||||
<capability xsi:type="colorableCapability" colorAsString="white"/>
|
||||
<capability xsi:type="densityCapability" density="999"/>
|
||||
<capability xsi:type="labelableCapability" labelField="Label" xOffset="0" yOffset="0"/>
|
||||
<capability xsi:type="magnificationCapability" magnification="1.5"/>
|
||||
<capability xsi:type="pointCapability" pointStyle="CROSS"/>
|
||||
<capability xsi:type="outlineCapability" outlineWidth="1" outlineOn="true" lineStyle="SOLID"/>
|
||||
</capabilities>
|
||||
</loadProperties>
|
||||
<properties isVisible="true" isHoverOn="false" isMapLayer="false" isBlinking="false"
|
||||
isSystemResource="false" renderingOrderId="MAP_OUTLINE">
|
||||
<pdProps minDisplayWidth="0" maxDisplayWidth="100000000"/>
|
||||
</properties>
|
||||
<resourceData xsi:type="spiResourceData">
|
||||
<filename>basemaps/profiler.spi</filename>
|
||||
<mapName>Profiler Stations</mapName>
|
||||
</resourceData>
|
||||
</resource>
|
||||
</descriptor>
|
||||
</displays>
|
||||
</displayList>
|
||||
</bundle>
|
||||
|
|
@ -1,24 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<menuContributionFile>
|
||||
<include installTo="menu:upperAir?after=PROFILER"
|
||||
fileName="menus/profiler/profilerLocations.xml">
|
||||
</include>
|
||||
<include subMenu="East NPN time-height" installTo="menu:upperAir?after=PROFILER"
|
||||
fileName="menus/upperair/baseEastNPN.xml" />
|
||||
<include subMenu="West NPN time-height" installTo="menu:upperAir?after=PROFILER"
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<contribute xsi:type="bundleItem" file="bundles/profilerAvailability.xml"
|
||||
menuText="Profiler Display" id="ProfilerDisplay">
|
||||
</contribute>
|
||||
</menuTemplate>
|
|
@ -27,7 +27,7 @@
|
|||
default="true"
|
||||
icon="icons/profiler.png"
|
||||
id="com.raytheon.uf.viz.profiler.ui.ProfilerEditor"
|
||||
name="Profiler Plot">
|
||||
name="Profiler">
|
||||
</editor>
|
||||
</extension>
|
||||
<extension
|
||||
|
|
|
@ -88,8 +88,7 @@ public class ProfilerResourceData extends AbstractRequestableResourceData {
|
|||
for (DataTime time : loadSet) {
|
||||
dataTimes.add(time.toString());
|
||||
}
|
||||
Map<String, RequestConstraint> constraints = new HashMap<String, RequestConstraint>(
|
||||
getMetadataMap());
|
||||
Map<String, RequestConstraint> constraints = new HashMap<String, RequestConstraint>(getMetadataMap());
|
||||
constraints.put(PluginDataObject.DATATIME_ID, new RequestConstraint(
|
||||
dataTimes));
|
||||
PointDataContainer pdc;
|
||||
|
|
|
@ -0,0 +1,227 @@
|
|||
package com.raytheon.uf.viz.profiler.ui.map;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Cursor;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
import org.geotools.referencing.GeodeticCalculator;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.profiler.ProfilerSite;
|
||||
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.map.IMapDescriptor;
|
||||
import com.raytheon.viz.ui.VizWorkbenchManager;
|
||||
import com.raytheon.viz.ui.actions.LoadBundleHandler;
|
||||
import com.raytheon.viz.ui.editor.AbstractEditor;
|
||||
import com.raytheon.viz.ui.input.InputAdapter;
|
||||
import com.raytheon.viz.ui.perspectives.AbstractVizPerspectiveManager;
|
||||
import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
|
||||
|
||||
public class ProfilerMapMouseHandler extends InputAdapter {
|
||||
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(ProfilerMapMouseHandler.class);
|
||||
|
||||
public ProfilerMapMouseHandler() {
|
||||
instance = this;
|
||||
}
|
||||
|
||||
private static final double MinDistance = 45000;
|
||||
|
||||
private static ProfilerMapMouseHandler instance;
|
||||
|
||||
private double lat, lon;
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public static ProfilerMapMouseHandler getAccess() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseDown(int, int,
|
||||
* int)
|
||||
*/
|
||||
@Override
|
||||
public boolean handleMouseDown(int x, int y, int button) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseDownMove(int,
|
||||
* int, int) handle left button, so user be able to shift map while it is
|
||||
* down
|
||||
*/
|
||||
@Override
|
||||
public boolean handleMouseDownMove(int x, int y, int button) {
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleMouseMove(Event e) {
|
||||
int x = e.x;
|
||||
int y = e.y;
|
||||
AbstractEditor mapEditor = ProfilerMapResource.getMapEditor();
|
||||
|
||||
if (mapEditor != null) {
|
||||
|
||||
Coordinate loc = mapEditor.translateClick(x, y);
|
||||
if (loc == null)
|
||||
return false;
|
||||
|
||||
List<ProfilerSite> pts = ProfilerMapResource
|
||||
.getOrCreateProfilerMapResource().getPoints();
|
||||
|
||||
ProfilerSite pt = getPtWithinMinDist(pts, loc);
|
||||
|
||||
Shell shell = ((Control) e.widget).getShell();
|
||||
Cursor cursor = null;
|
||||
|
||||
if (pt != null) {
|
||||
cursor = new Cursor(Display.getCurrent(), SWT.CURSOR_HAND);
|
||||
} else {
|
||||
cursor = new Cursor(Display.getCurrent(), SWT.CURSOR_ARROW);
|
||||
}
|
||||
|
||||
shell.setCursor(cursor);
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseUp(int, int, int)
|
||||
* handle right button, so user be able to pick stn and print text report
|
||||
*/
|
||||
@Override
|
||||
public boolean handleMouseUp(int x, int y, int button) {
|
||||
|
||||
boolean returnStatus = false;
|
||||
|
||||
if (!ProfilerMapResource.getMapRsc().isEditable())
|
||||
return false;
|
||||
|
||||
// left mouse button
|
||||
if (button == 1) {
|
||||
AbstractEditor mapEditor = ProfilerMapResource.getMapEditor();
|
||||
if (mapEditor != null) {
|
||||
|
||||
Coordinate loc = mapEditor.translateClick(x, y);
|
||||
if (loc == null)
|
||||
return false;
|
||||
|
||||
List<ProfilerSite> pts = ProfilerMapResource
|
||||
.getOrCreateProfilerMapResource().getPoints();
|
||||
ProfilerSite pt = getPtWithinMinDist(pts, loc);
|
||||
|
||||
if (pt != null) {
|
||||
|
||||
try {
|
||||
|
||||
IWorkbenchWindow window = VizWorkbenchManager.getInstance()
|
||||
.getCurrentWindow();
|
||||
AbstractVizPerspectiveManager mgr = VizPerspectiveListener.getInstance(
|
||||
window).getActivePerspectiveManager();
|
||||
|
||||
if (mgr != null) {
|
||||
|
||||
Map<String, String> variableSubstitutions = new HashMap<>();
|
||||
variableSubstitutions.put("wmoid", pt.getProfilerId());
|
||||
new LoadBundleHandler("bundles/UpperAirProfiler.xml",
|
||||
variableSubstitutions,
|
||||
null,
|
||||
true).execute(null);
|
||||
|
||||
returnStatus = true;
|
||||
|
||||
}
|
||||
|
||||
} catch (ExecutionException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return returnStatus;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the nearest point of an selected element to the input point
|
||||
*
|
||||
* @param el
|
||||
* element
|
||||
* @param pt
|
||||
* input point
|
||||
* @return
|
||||
*/
|
||||
private ProfilerSite getPtWithinMinDist(
|
||||
List<ProfilerSite> points, Coordinate pt) {
|
||||
|
||||
ProfilerSite thePoint = null;
|
||||
double minDistance = MinDistance;
|
||||
|
||||
GeodeticCalculator gc;
|
||||
// can't assume this is a map Editor/MapDescriptor
|
||||
AbstractEditor mapEditor = ProfilerMapResource.getMapEditor();
|
||||
if (mapEditor != null && ! Double.isNaN(pt.x) && ! Double.isNaN(pt.y) ) {
|
||||
IMapDescriptor desc = (IMapDescriptor) mapEditor
|
||||
.getActiveDisplayPane().getRenderableDisplay()
|
||||
.getDescriptor();
|
||||
|
||||
for (ProfilerSite selectPoint : points) {
|
||||
|
||||
double dist;
|
||||
try {
|
||||
gc = new GeodeticCalculator(desc.getCRS());
|
||||
gc.setStartingGeographicPoint(pt.x, pt.y);
|
||||
gc.setDestinationGeographicPoint(selectPoint.getLongitude(),
|
||||
selectPoint.getLatitude());
|
||||
dist = gc.getOrthodromicDistance();
|
||||
if (dist < minDistance) {
|
||||
minDistance = dist;
|
||||
thePoint = selectPoint;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(
|
||||
Priority.WARN,"getOrthodromicDistance exception.",e);
|
||||
}
|
||||
}
|
||||
|
||||
ProfilerMapResource.getOrCreateProfilerMapResource()
|
||||
.setPickedPoint(thePoint);
|
||||
}
|
||||
return thePoint;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,346 @@
|
|||
package com.raytheon.uf.viz.profiler.ui.map;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Cursor;
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.opengis.referencing.crs.CoordinateReferenceSystem;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.profiler.ProfilerSite;
|
||||
import com.raytheon.uf.viz.core.DrawableCircle;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.PixelExtent;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.map.IMapDescriptor;
|
||||
import com.raytheon.uf.viz.core.map.MapDescriptor;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
||||
import com.raytheon.uf.viz.core.rsc.IInputHandler;
|
||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||
import com.raytheon.uf.viz.core.rsc.ResourceList.RemoveListener;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.EditableCapability;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability;
|
||||
import com.raytheon.viz.pointdata.StaticPlotInfoPV;
|
||||
import com.raytheon.viz.pointdata.StaticPlotInfoPV.SPIEntry;
|
||||
import com.raytheon.viz.ui.EditorUtil;
|
||||
import com.raytheon.viz.ui.editor.AbstractEditor;
|
||||
import com.raytheon.viz.ui.input.EditableManager;
|
||||
|
||||
public class ProfilerMapResource extends
|
||||
AbstractVizResource<ProfilerMapResourceData, MapDescriptor> implements
|
||||
RemoveListener {
|
||||
private static ProfilerMapResource mapRsc = null;
|
||||
|
||||
private static ProfilerMapResourceData mapRscData = null;
|
||||
|
||||
private static AbstractEditor mapEditor = null;
|
||||
|
||||
private static ProfilerMapMouseHandler mouseHandler;
|
||||
|
||||
private static Cursor waitCursor = null;
|
||||
|
||||
private static Control cursorControl;
|
||||
|
||||
private static boolean mouseHandlerRegistered = false;
|
||||
|
||||
public static void bringMapEditorToTop() {
|
||||
try {
|
||||
if (mapEditor != null
|
||||
&& PlatformUI.getWorkbench() != null
|
||||
&& PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null
|
||||
&& PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getActivePage() != null) {
|
||||
PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getActivePage().bringToTop((IWorkbenchPart) mapEditor);
|
||||
mapEditor.refresh();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
public static AbstractEditor getMapEditor() {
|
||||
return mapEditor;
|
||||
}
|
||||
|
||||
public static ProfilerMapResource getMapRsc() {
|
||||
return mapRsc;
|
||||
}
|
||||
|
||||
private ProfilerMapResourceData profilerMapResourceData;
|
||||
|
||||
/** The set of symbols */
|
||||
List<DrawableCircle> circles = null;
|
||||
|
||||
private static List<ProfilerSite> points = new ArrayList<ProfilerSite>();
|
||||
|
||||
private ProfilerSite pickedPoint = new ProfilerSite();
|
||||
|
||||
public void setPickedPoint(ProfilerSite point) {
|
||||
this.pickedPoint = null;
|
||||
this.pickedPoint = point;
|
||||
}
|
||||
|
||||
public List<ProfilerSite> getPoints() {
|
||||
return points;
|
||||
}
|
||||
|
||||
public void setPoints(List<ProfilerSite> points) {
|
||||
if (points == null) {
|
||||
this.pickedPoint = null;
|
||||
this.points.clear();
|
||||
} else {
|
||||
this.points = points;
|
||||
}
|
||||
}
|
||||
|
||||
public void addPoint(ProfilerSite point) {
|
||||
points.add(point);
|
||||
}
|
||||
|
||||
protected ProfilerMapResource(ProfilerMapResourceData profilerMapResourceData,
|
||||
LoadProperties loadProperties) {
|
||||
super(profilerMapResourceData, loadProperties);
|
||||
|
||||
getCapability(EditableCapability.class).setEditable(true);
|
||||
|
||||
this.profilerMapResourceData = profilerMapResourceData;
|
||||
}
|
||||
|
||||
public static void startWaitCursor() {
|
||||
waitCursor = new Cursor(Display.getCurrent(), SWT.CURSOR_WAIT);
|
||||
cursorControl = Display.getCurrent().getCursorControl();
|
||||
if (cursorControl != null && waitCursor != null)
|
||||
cursorControl.setCursor(waitCursor);
|
||||
}
|
||||
|
||||
public static void stopWaitCursor() {
|
||||
if (cursorControl != null && waitCursor != null) {
|
||||
cursorControl.setCursor(null);
|
||||
}
|
||||
if (waitCursor != null) {
|
||||
waitCursor.dispose();
|
||||
waitCursor = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static void createMapEditor() {
|
||||
deleteProfilerMapResource();
|
||||
try {
|
||||
mapEditor = (AbstractEditor) EditorUtil.getActiveEditor();
|
||||
} catch (Exception ve) {
|
||||
System.out
|
||||
.println("ProfilerMapResource Could not load initial editor: "
|
||||
+ ve.getMessage());
|
||||
ve.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void registerMouseHandler() {
|
||||
if (mouseHandlerRegistered)
|
||||
return;
|
||||
|
||||
mouseHandler = getMouseHandler();
|
||||
if (mapEditor != null && mouseHandler != null) {
|
||||
mapEditor.registerMouseHandler((IInputHandler) mouseHandler);
|
||||
mouseHandlerRegistered = true;
|
||||
}
|
||||
}
|
||||
|
||||
public static void unregisterMouseHandler() {
|
||||
if (!mouseHandlerRegistered)
|
||||
return;
|
||||
mouseHandler = getMouseHandler();
|
||||
if (mapEditor != null && mouseHandler != null) {
|
||||
mapEditor.unregisterMouseHandler((IInputHandler) mouseHandler);
|
||||
mouseHandlerRegistered = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new MapResource and add it to the current editor.
|
||||
*
|
||||
* @return the MapResource
|
||||
*/
|
||||
public static ProfilerMapResource getOrCreateProfilerMapResource() {
|
||||
|
||||
if (mapRsc == null) {
|
||||
if (mapEditor == null) {
|
||||
createMapEditor();
|
||||
}
|
||||
if (mapEditor != null) {
|
||||
IMapDescriptor desc = (IMapDescriptor) mapEditor
|
||||
.getActiveDisplayPane().getRenderableDisplay()
|
||||
.getDescriptor();
|
||||
try {
|
||||
if (mapRscData == null)
|
||||
mapRscData = new ProfilerMapResourceData();
|
||||
mapRsc = mapRscData.construct(new LoadProperties(), desc);
|
||||
|
||||
createProfilerMapMarkers();
|
||||
|
||||
desc.getResourceList().add(mapRsc);
|
||||
mapRsc.init(mapEditor.getActiveDisplayPane().getTarget());
|
||||
mouseHandler = getMouseHandler();
|
||||
mapEditor
|
||||
.registerMouseHandler((IInputHandler) mouseHandler);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return mapRsc;
|
||||
}
|
||||
|
||||
private static void createProfilerMapMarkers() {
|
||||
StaticPlotInfoPV spipv = StaticPlotInfoPV
|
||||
.readStaticPlotInfoPV("basemaps/profiler.spi");
|
||||
|
||||
List<ProfilerSite> locs = new ArrayList<ProfilerSite>();
|
||||
for (Entry<String, SPIEntry> entry : spipv.getSpiList().entrySet()) {
|
||||
ProfilerSite loc = new ProfilerSite();
|
||||
loc.setStationId(entry.getKey());
|
||||
Integer blockNumber = entry.getValue().blockNumber;
|
||||
loc.setProfilerId(blockNumber.toString());
|
||||
loc.setLatitude((double) entry.getValue().latlon.y);
|
||||
loc.setLongitude((double) entry.getValue().latlon.x);
|
||||
locs.add(loc);
|
||||
}
|
||||
|
||||
mapRsc.setPoints(locs);
|
||||
}
|
||||
|
||||
public static void deleteProfilerMapResource() {
|
||||
System.out.println("ProfilerMapResource:deleteProfilerMapResource ");
|
||||
if (mapRsc != null) {
|
||||
mapRsc.dispose();
|
||||
mapRsc = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when resource is disposed
|
||||
*
|
||||
* @see com.raytheon.viz.core.rsc.IVizResource#dispose()
|
||||
*/
|
||||
@Override
|
||||
public void disposeInternal() {
|
||||
if (mapEditor != null) {
|
||||
mapEditor.unregisterMouseHandler(mouseHandler);
|
||||
mouseHandler = null;
|
||||
mapEditor = null;
|
||||
}
|
||||
pickedPoint = null;
|
||||
mapRsc = null;
|
||||
mapRscData = null;
|
||||
if (waitCursor != null)
|
||||
waitCursor.dispose();
|
||||
waitCursor = null;
|
||||
mouseHandlerRegistered = false;
|
||||
}
|
||||
|
||||
public CoordinateReferenceSystem getCoordinateReferenceSystem() {
|
||||
if (descriptor == null)
|
||||
return null;
|
||||
return descriptor.getCRS();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Profiler Display";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initInternal(IGraphicsTarget target) throws VizException {
|
||||
// make the map resource editable
|
||||
EditableManager.makeEditable(this,
|
||||
getCapability(EditableCapability.class).isEditable());
|
||||
}
|
||||
|
||||
public boolean isApplicable(PixelExtent extent) {
|
||||
return true;
|
||||
}
|
||||
|
||||
private void generateSymbolForDrawing() {
|
||||
|
||||
circles = new ArrayList<DrawableCircle>(mapRsc.getPoints().size());
|
||||
|
||||
if (points.isEmpty() == true) {
|
||||
circles = null;
|
||||
} else {
|
||||
RGB color = new RGB (200,200,200);
|
||||
for (ProfilerSite p : points) {
|
||||
double lon, lat;
|
||||
lon = p.getLongitude();
|
||||
lat = p.getLatitude();
|
||||
double[] pixel = descriptor.worldToPixel(new double[] { lon, lat });
|
||||
DrawableCircle circle = new DrawableCircle();
|
||||
circle.setCoordinates(pixel[0], pixel[1]);
|
||||
circle.lineWidth = 1;
|
||||
circle.screenRadius = getRadius()*1.4;
|
||||
circle.numberOfPoints = (int) (circle.screenRadius * 4);
|
||||
circle.basics.color = color;
|
||||
circle.filled = false;
|
||||
circles.add(circle);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected double getRadius() {
|
||||
return 5 * getCapability(MagnificationCapability.class)
|
||||
.getMagnification();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintInternal(IGraphicsTarget target, PaintProperties paintProps)
|
||||
throws VizException {
|
||||
|
||||
getOrCreateProfilerMapResource();
|
||||
|
||||
generateSymbolForDrawing();
|
||||
target.drawCircle(circles.toArray(new DrawableCircle[0]));
|
||||
|
||||
}
|
||||
|
||||
public boolean isProjectable(CoordinateReferenceSystem mapData) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void project(CoordinateReferenceSystem mapData) throws VizException {
|
||||
// System.out.println("ProfilerMapResource: project ");
|
||||
}
|
||||
|
||||
private static ProfilerMapMouseHandler getMouseHandler() {
|
||||
if (mouseHandler == null) {
|
||||
mouseHandler = new ProfilerMapMouseHandler();
|
||||
}
|
||||
return mouseHandler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyRemove(ResourcePair rp) throws VizException {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
public boolean isEditable() {
|
||||
return getCapability(EditableCapability.class).isEditable();
|
||||
}
|
||||
|
||||
public void setEditable(boolean enable) {
|
||||
getCapability(EditableCapability.class).setEditable(enable);
|
||||
EditableManager.makeEditable(this,
|
||||
getCapability(EditableCapability.class).isEditable());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
package com.raytheon.uf.viz.profiler.ui.map;
|
||||
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
|
||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||
|
||||
public class ProfilerMapResourceData extends AbstractResourceData {
|
||||
|
||||
private Float markerSize = 1.5f;
|
||||
|
||||
private Integer markerWidth = 2;
|
||||
|
||||
private String mapName = "Profiler";
|
||||
|
||||
public ProfilerMapResourceData() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProfilerMapResource construct(LoadProperties loadProperties,
|
||||
IDescriptor descriptor) throws VizException {
|
||||
// TODO Auto-generated method stub
|
||||
return new ProfilerMapResource(this, loadProperties);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.rsc.AbstractResourceData#update(java.lang.Object
|
||||
* )
|
||||
*/
|
||||
@Override
|
||||
public void update(Object updateData) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null || !(obj instanceof ProfilerMapResourceData))
|
||||
return false;
|
||||
ProfilerMapResourceData rdata = (ProfilerMapResourceData) obj;
|
||||
if (this.markerSize.equals(rdata.getMarkerSize())
|
||||
&& this.markerWidth.equals(rdata.getMarkerWidth()))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public Float getMarkerSize() {
|
||||
return markerSize;
|
||||
}
|
||||
|
||||
public void setMarkerSize(Float markerSize) {
|
||||
this.markerSize = markerSize;
|
||||
}
|
||||
|
||||
public Integer getMarkerWidth() {
|
||||
return markerWidth;
|
||||
}
|
||||
|
||||
public void setMarkerWidth(Integer markerWidth) {
|
||||
this.markerWidth = markerWidth;
|
||||
}
|
||||
|
||||
public String getMapName() {
|
||||
return mapName;
|
||||
}
|
||||
|
||||
public void setMapName(String mapName) {
|
||||
this.mapName = mapName;
|
||||
}
|
||||
}
|
|
@ -74,6 +74,7 @@ import com.vividsolutions.jts.geom.Geometry;
|
|||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
* Dec 03, 2013 2537 bsteffen Remove IDecoderGettable
|
||||
* Jul 27, 2015 4360 rferrel Named unique constraint. Made reportType non-nullable.
|
||||
* Feb 09, 2018 mjames@ucar Added stationId as request constraint.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -82,7 +83,9 @@ import com.vividsolutions.jts.geom.Geometry;
|
|||
*/
|
||||
@Entity
|
||||
@SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "profilerseq")
|
||||
@Table(name = ProfilerObs.PLUGIN_NAME, uniqueConstraints = { @UniqueConstraint(name = "uk_profiler_datauri_fields", columnNames = { "dataURI" }) })
|
||||
@Table(name = ProfilerObs.PLUGIN_NAME, uniqueConstraints = { @UniqueConstraint(name = "uk_profiler_datauri_fields", columnNames = {
|
||||
"dataURI", "stationId"
|
||||
}) })
|
||||
/*
|
||||
* Both refTime and forecastTime are included in the refTimeIndex since
|
||||
* forecastTime is unlikely to be used.
|
||||
|
|
Loading…
Add table
Reference in a new issue