Issue #664 Made hydro dam resource work with collaboration
Change-Id: If6d422a937a549c9f68b8c523553179924ac2d7a Former-commit-id:b5d8d071de
[formerlyb0f729ceb2
] [formerlyb5d8d071de
[formerlyb0f729ceb2
] [formerly7b95887a24
[formerly a3bfc9f4014a417205c27bbd73fc07556df007bc]]] Former-commit-id:7b95887a24
Former-commit-id:cc74f57e1b
[formerly9c3805b762
] Former-commit-id:1e45b28479
This commit is contained in:
parent
648b22f31b
commit
f6960e1738
6 changed files with 227 additions and 323 deletions
|
@ -29,7 +29,8 @@ Require-Bundle: org.eclipse.ui,
|
||||||
com.raytheon.uf.viz.core.rsc;bundle-version="1.0.0",
|
com.raytheon.uf.viz.core.rsc;bundle-version="1.0.0",
|
||||||
com.raytheon.viz.ui.personalities.awips;bundle-version="1.12.1174",
|
com.raytheon.viz.ui.personalities.awips;bundle-version="1.12.1174",
|
||||||
com.raytheon.uf.viz.application;bundle-version="1.0.0",
|
com.raytheon.uf.viz.application;bundle-version="1.0.0",
|
||||||
com.raytheon.uf.common.dataplugin.shef;bundle-version="1.12.1174"
|
com.raytheon.uf.common.dataplugin.shef;bundle-version="1.12.1174",
|
||||||
|
com.raytheon.viz.pointdata;bundle-version="1.12.1174"
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Export-Package: com.raytheon.viz.hydro,
|
Export-Package: com.raytheon.viz.hydro,
|
||||||
com.raytheon.viz.hydro.perspective,
|
com.raytheon.viz.hydro.perspective,
|
||||||
|
|
|
@ -384,7 +384,7 @@ public class DamDisplayControlDlg extends CaveSWTDialog {
|
||||||
PointDataControlManager pdcManager = PointDataControlManager
|
PointDataControlManager pdcManager = PointDataControlManager
|
||||||
.getInstance();
|
.getInstance();
|
||||||
DamLocationResource dlr = pdcManager.getDamLocationResource();
|
DamLocationResource dlr = pdcManager.getDamLocationResource();
|
||||||
dlr.clearData();
|
dlr.unload();
|
||||||
pdcManager.setRedraw(true);
|
pdcManager.setRedraw(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,16 +157,16 @@ public class StationDisplay implements MapUpdateListener,
|
||||||
String iconColor = appsDefaults.getToken("dam_icon_color");
|
String iconColor = appsDefaults.getToken("dam_icon_color");
|
||||||
RGB damColor = RGBColors.getRGBColor(iconColor);
|
RGB damColor = RGBColors.getRGBColor(iconColor);
|
||||||
DamLocationResourceData hydroPointResourceData = new DamLocationResourceData(
|
DamLocationResourceData hydroPointResourceData = new DamLocationResourceData(
|
||||||
"Dam Sites", damColor, null, null);
|
"Dam Sites");
|
||||||
try {
|
try {
|
||||||
dlr = hydroPointResourceData.construct(new LoadProperties(),
|
dlr = hydroPointResourceData.construct(new LoadProperties(),
|
||||||
EditorUtil.getActiveVizContainer()
|
EditorUtil.getActiveVizContainer()
|
||||||
.getActiveDisplayPane().getDescriptor());
|
.getActiveDisplayPane().getDescriptor());
|
||||||
|
dlr.getCapability(ColorableCapability.class).setColor(damColor);
|
||||||
} catch (VizException e) {
|
} catch (VizException e) {
|
||||||
// TODO Auto-generated catch block. Please revise as
|
// TODO Auto-generated catch block. Please revise as
|
||||||
// appropriate.
|
// appropriate.
|
||||||
}
|
}
|
||||||
dlr.setDisposed(false);
|
|
||||||
}
|
}
|
||||||
ResourceProperties props = new ResourceProperties();
|
ResourceProperties props = new ResourceProperties();
|
||||||
props.setMapLayer(true);
|
props.setMapLayer(true);
|
||||||
|
@ -245,7 +245,7 @@ public class StationDisplay implements MapUpdateListener,
|
||||||
* remove and restore the gage resource.
|
* remove and restore the gage resource.
|
||||||
*/
|
*/
|
||||||
public void resetGageDisplay() {
|
public void resetGageDisplay() {
|
||||||
mpr.resetDataMap();
|
mpr.resetDataMap();
|
||||||
|
|
||||||
// force update
|
// force update
|
||||||
mpr = getMultiPointResource();
|
mpr = getMultiPointResource();
|
||||||
|
|
|
@ -19,11 +19,10 @@
|
||||||
**/
|
**/
|
||||||
package com.raytheon.viz.hydro.resource;
|
package com.raytheon.viz.hydro.resource;
|
||||||
|
|
||||||
|
import java.awt.image.RenderedImage;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.eclipse.core.commands.ExecutionException;
|
import org.eclipse.core.commands.ExecutionException;
|
||||||
import org.eclipse.jface.action.IMenuManager;
|
import org.eclipse.jface.action.IMenuManager;
|
||||||
|
@ -34,27 +33,27 @@ import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.ui.PlatformUI;
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
|
||||||
import com.raytheon.uf.viz.app.launcher.handlers.AppLauncherHandler;
|
import com.raytheon.uf.viz.app.launcher.handlers.AppLauncherHandler;
|
||||||
|
import com.raytheon.uf.viz.core.DrawableString;
|
||||||
import com.raytheon.uf.viz.core.IDisplayPane;
|
import com.raytheon.uf.viz.core.IDisplayPane;
|
||||||
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
||||||
|
import com.raytheon.uf.viz.core.IExtent;
|
||||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||||
import com.raytheon.uf.viz.core.PixelCoverage;
|
|
||||||
import com.raytheon.uf.viz.core.RGBColors;
|
import com.raytheon.uf.viz.core.RGBColors;
|
||||||
import com.raytheon.uf.viz.core.data.prep.IODataPreparer;
|
import com.raytheon.uf.viz.core.data.IRenderedImageCallback;
|
||||||
|
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||||
import com.raytheon.uf.viz.core.drawables.IFont;
|
import com.raytheon.uf.viz.core.drawables.IFont;
|
||||||
import com.raytheon.uf.viz.core.drawables.IImage;
|
import com.raytheon.uf.viz.core.drawables.IImage;
|
||||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
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.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.LoadProperties;
|
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||||
import com.raytheon.uf.viz.core.rsc.ResourceList;
|
|
||||||
import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
|
|
||||||
import com.raytheon.viz.hydro.gagedisplay.HydroImageMaker;
|
import com.raytheon.viz.hydro.gagedisplay.HydroImageMaker;
|
||||||
import com.raytheon.viz.hydro.gagedisplay.HydroImageMaker.ImageSize;
|
import com.raytheon.viz.hydro.gagedisplay.HydroImageMaker.ImageSize;
|
||||||
import com.raytheon.viz.hydro.pointdatacontrol.PointDataControlManager;
|
import com.raytheon.viz.hydro.pointdatacontrol.PointDataControlManager;
|
||||||
import com.raytheon.viz.hydrocommon.HydroDisplayManager;
|
import com.raytheon.viz.hydrocommon.HydroDisplayManager;
|
||||||
import com.raytheon.viz.hydrocommon.data.DamMaster;
|
import com.raytheon.viz.hydrocommon.data.DamMaster;
|
||||||
import com.raytheon.viz.hydrocommon.resource.HydroPointResource;
|
import com.raytheon.viz.pointdata.drawables.IPointImageExtension;
|
||||||
|
import com.raytheon.viz.pointdata.drawables.IPointImageExtension.PointImage;
|
||||||
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;
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
import com.vividsolutions.jts.geom.Coordinate;
|
||||||
|
@ -78,68 +77,72 @@ import com.vividsolutions.jts.index.strtree.STRtree;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class DamLocationResource extends
|
public class DamLocationResource extends
|
||||||
HydroPointResource<DamLocationResourceData> implements
|
AbstractVizResource<DamLocationResourceData, IDescriptor> implements
|
||||||
IContextMenuContributor {
|
IContextMenuContributor {
|
||||||
private final Map<Coordinate, DamMaster> damMap = new HashMap<Coordinate, DamMaster>();
|
|
||||||
|
|
||||||
private HashMap<Coordinate, IImage> damRenderables = new HashMap<Coordinate, IImage>();
|
private static final RGB LABEL_COLOR = RGBColors.getRGBColor("white");
|
||||||
|
|
||||||
|
private PointDataControlManager pdcManager = PointDataControlManager
|
||||||
|
.getInstance();
|
||||||
|
|
||||||
|
private List<DamMaster> dams = new ArrayList<DamMaster>();
|
||||||
|
|
||||||
|
private IImage damIcon;
|
||||||
|
|
||||||
|
private IFont font;
|
||||||
|
|
||||||
|
private int fontSize;
|
||||||
|
|
||||||
private STRtree damStrTree = new STRtree();
|
private STRtree damStrTree = new STRtree();
|
||||||
|
|
||||||
private IFont font = null;
|
|
||||||
|
|
||||||
private IGraphicsTarget target;
|
|
||||||
|
|
||||||
private double scaleWidthValue = 0.0;
|
private double scaleWidthValue = 0.0;
|
||||||
|
|
||||||
private double scaleHeightValue = 0.0;
|
private double scaleHeightValue = 0.0;
|
||||||
|
|
||||||
private final boolean isName = false;
|
public DamLocationResource(DamLocationResourceData resourceData,
|
||||||
|
LoadProperties loadProperties) {
|
||||||
private boolean isDisposed = false;
|
super(resourceData, loadProperties);
|
||||||
|
|
||||||
private final RGB labelColor = RGBColors.getRGBColor("white");
|
|
||||||
|
|
||||||
public DamLocationResource(DamLocationResourceData resourceData,
|
|
||||||
LoadProperties loadProperties) {
|
|
||||||
super(resourceData, loadProperties);
|
|
||||||
this.getCapability(ColorableCapability.class).setColor(
|
|
||||||
resourceData.getColor());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/*
|
||||||
protected void initInternal(IGraphicsTarget target) throws VizException {
|
* (non-Javadoc)
|
||||||
populateDamList();
|
*
|
||||||
}
|
* @see com.raytheon.uf.viz.core.rsc.AbstractVizResource#getName()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return resourceData.getName();
|
||||||
|
}
|
||||||
|
|
||||||
private void populateDamList() {
|
@Override
|
||||||
PointDataControlManager pdcManager = PointDataControlManager
|
protected void initInternal(IGraphicsTarget target) throws VizException {
|
||||||
.getInstance();
|
damIcon = target.initializeRaster(new IRenderedImageCallback() {
|
||||||
|
@Override
|
||||||
|
public RenderedImage getImage() throws VizException {
|
||||||
|
return HydroImageMaker.getDamIcon();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
fontSize = 10;
|
||||||
|
font = target.initializeFont("Dialog", fontSize, null);
|
||||||
|
font.setSmoothing(false);
|
||||||
|
|
||||||
|
populateDamList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void populateDamList() {
|
||||||
HydroDisplayManager displayManager = HydroDisplayManager.getInstance();
|
HydroDisplayManager displayManager = HydroDisplayManager.getInstance();
|
||||||
|
|
||||||
List<DamMaster> damList = displayManager.getDamList();
|
List<DamMaster> damList = displayManager.getDamList();
|
||||||
if (damList != null) {
|
if (damList == null) {
|
||||||
pdcManager.setDamLocationResource(this);
|
damList = resourceData.getDamList();
|
||||||
damMap.clear();
|
}
|
||||||
for (DamMaster dm : damList) {
|
if (damList != null) {
|
||||||
addPoint(dm);
|
displayManager.setDamList(damList);
|
||||||
}
|
pdcManager.setDamLocationResource(this);
|
||||||
} else {
|
for (DamMaster dm : damList) {
|
||||||
damList = getResourceData().getDamList();
|
addPoint(dm);
|
||||||
if (damList != null) {
|
}
|
||||||
displayManager.setDamList(damList);
|
}
|
||||||
pdcManager.setDamLocationResource(this);
|
|
||||||
damMap.clear();
|
|
||||||
for (DamMaster dm : damList) {
|
|
||||||
addPoint(dm);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void resetStrTree() {
|
|
||||||
damStrTree = null;
|
|
||||||
damStrTree = new STRtree();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -149,46 +152,16 @@ public class DamLocationResource extends
|
||||||
* The DamMaster object
|
* The DamMaster object
|
||||||
*/
|
*/
|
||||||
public void addPoint(DamMaster master) {
|
public void addPoint(DamMaster master) {
|
||||||
Coordinate xy = new Coordinate(master.getLongitudeDam(),
|
if (dams.contains(master) == false) {
|
||||||
master.getLatitudeDam());
|
dams.add(master);
|
||||||
damMap.put(xy, master);
|
/* Create a small envelope around the point */
|
||||||
|
Coordinate p1 = new Coordinate(master.getLongitudeDam() + .03,
|
||||||
/* Create a small envelope around the point */
|
master.getLatitudeDam() + .03);
|
||||||
Coordinate p1 = new Coordinate(master.getLongitudeDam() + .03,
|
Coordinate p2 = new Coordinate(master.getLongitudeDam() - .03,
|
||||||
master.getLatitudeDam() + .03);
|
master.getLatitudeDam() - .03);
|
||||||
Coordinate p2 = new Coordinate(master.getLongitudeDam() - .03,
|
Envelope env = new Envelope(p1, p2);
|
||||||
master.getLatitudeDam() - .03);
|
damStrTree.insert(env, master);
|
||||||
Envelope env = new Envelope(p1, p2);
|
|
||||||
ArrayList<Object> data = new ArrayList<Object>();
|
|
||||||
data.add(xy);
|
|
||||||
data.add("DAM: " + master.getDamName());
|
|
||||||
damStrTree.insert(env, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create the dam icons.
|
|
||||||
*
|
|
||||||
* @return HashMap of Coordinate to Image objects
|
|
||||||
*/
|
|
||||||
private HashMap<Coordinate, IImage> getDamRenderables() {
|
|
||||||
Iterator<Coordinate> iter = damMap.keySet().iterator();
|
|
||||||
damRenderables.clear();
|
|
||||||
|
|
||||||
while (iter.hasNext()) {
|
|
||||||
Coordinate c = iter.next();
|
|
||||||
DamMaster master = damMap.get(c);
|
|
||||||
|
|
||||||
try {
|
|
||||||
IImage image = target.initializeRaster(
|
|
||||||
new IODataPreparer(HydroImageMaker.getDamIcon(),
|
|
||||||
master.getNidid(), 0), null);
|
|
||||||
damRenderables.put(c, image);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return damRenderables;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -205,79 +178,56 @@ public class DamLocationResource extends
|
||||||
PaintProperties paintProps) throws VizException {
|
PaintProperties paintProps) throws VizException {
|
||||||
HydroDisplayManager manager = HydroDisplayManager.getInstance();
|
HydroDisplayManager manager = HydroDisplayManager.getInstance();
|
||||||
|
|
||||||
int fontSize = manager.getFontSize();
|
// Check the font size
|
||||||
if (font != null) {
|
font.setMagnification((manager.getFontSize() / (float) fontSize), true);
|
||||||
font = target.initializeFont("Dialog", fontSize, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.target = target;
|
populateDamList();
|
||||||
|
|
||||||
/* Should we display the dam icons? */
|
List<PointImage> images = new ArrayList<PointImage>(dams.size());
|
||||||
if (manager.getDamList() != null) {
|
List<DrawableString> strings = new ArrayList<DrawableString>(
|
||||||
populateDamList();
|
dams.size() * 2);
|
||||||
damRenderables = getDamRenderables();
|
IExtent extent = paintProps.getView().getExtent();
|
||||||
Iterator<Coordinate> iter = damMap.keySet().iterator();
|
for (DamMaster dam : dams) {
|
||||||
|
double[] pixel = descriptor.worldToPixel(new double[] {
|
||||||
|
dam.getLongitudeDam(), dam.getLatitudeDam() });
|
||||||
|
if (pixel != null && extent.contains(pixel)) {
|
||||||
|
setScaleWidth(paintProps);
|
||||||
|
setScaleHeight(paintProps);
|
||||||
|
|
||||||
while (iter.hasNext()) {
|
/* Draw the icons */
|
||||||
Coordinate c = iter.next();
|
if (manager.isDisplayDamIcon()) {
|
||||||
double[] pixel = descriptor.worldToPixel(new double[] { c.x,
|
PointImage image = new PointImage(damIcon, pixel[0],
|
||||||
c.y });
|
pixel[1]);
|
||||||
|
image.setSiteId(dam.getDamName());
|
||||||
|
images.add(image);
|
||||||
|
}
|
||||||
|
|
||||||
if (pixel != null) {
|
/* Draw the labels */
|
||||||
if (paintProps.getView().getExtent().contains(pixel)) {
|
if (manager.isDisplayDamId()) {
|
||||||
|
Coordinate idCoor = new Coordinate(pixel[0]
|
||||||
|
- getScaleWidth(), pixel[1] - getScaleHeight());
|
||||||
|
|
||||||
setScaleWidth(paintProps);
|
DrawableString ds = new DrawableString(dam.getNidid(),
|
||||||
setScaleHeight(paintProps);
|
LABEL_COLOR);
|
||||||
|
ds.setCoordinates(idCoor.x, idCoor.y);
|
||||||
|
ds.font = font;
|
||||||
|
strings.add(ds);
|
||||||
|
}
|
||||||
|
if (manager.isDisplayDamName()) {
|
||||||
|
Coordinate nameCoor = new Coordinate(pixel[0]
|
||||||
|
- getScaleWidth(), pixel[1] + getScaleHeight());
|
||||||
|
|
||||||
/* Draw the icons */
|
DrawableString ds = new DrawableString(dam.getNidid(),
|
||||||
if (manager.isDisplayDamIcon()) {
|
LABEL_COLOR);
|
||||||
target.drawRaster(damRenderables.get(c),
|
ds.setCoordinates(nameCoor.x, nameCoor.y);
|
||||||
getPixelCoverage(c), paintProps);
|
ds.font = font;
|
||||||
}
|
strings.add(ds);
|
||||||
|
|
||||||
/* Draw the labels */
|
|
||||||
drawPlotInfo(c, damMap.get(c));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
target.getExtension(IPointImageExtension.class).drawPointImages(
|
||||||
|
paintProps, images);
|
||||||
/**
|
target.drawStrings(strings);
|
||||||
* Draw the text labels.
|
|
||||||
*
|
|
||||||
* @param c
|
|
||||||
* coordinate value
|
|
||||||
* @param data
|
|
||||||
* Dam Data
|
|
||||||
* @throws VizException
|
|
||||||
*/
|
|
||||||
private void drawPlotInfo(Coordinate c, DamMaster data) throws VizException {
|
|
||||||
HydroDisplayManager displayManager = HydroDisplayManager.getInstance();
|
|
||||||
boolean displayId = displayManager.isDisplayDamId();
|
|
||||||
boolean displayName = displayManager.isDisplayDamName();
|
|
||||||
|
|
||||||
if (displayId) {
|
|
||||||
double[] centerpixels = descriptor.worldToPixel(new double[] { c.x,
|
|
||||||
c.y });
|
|
||||||
Coordinate idCoor = new Coordinate(centerpixels[0]
|
|
||||||
- getScaleWidth(), centerpixels[1] - getScaleHeight());
|
|
||||||
|
|
||||||
target.drawString(font, data.getNidid(), idCoor.x, idCoor.y, 0.0,
|
|
||||||
IGraphicsTarget.TextStyle.NORMAL, labelColor,
|
|
||||||
IGraphicsTarget.HorizontalAlignment.LEFT, 0.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (displayName) {
|
|
||||||
double[] centerpixels = descriptor.worldToPixel(new double[] { c.x,
|
|
||||||
c.y });
|
|
||||||
Coordinate nameCoor = new Coordinate(centerpixels[0]
|
|
||||||
- getScaleWidth(), centerpixels[1] + getScaleHeight());
|
|
||||||
|
|
||||||
target.drawString(font, data.getDamName(), nameCoor.x, nameCoor.y,
|
|
||||||
0.0, IGraphicsTarget.TextStyle.NORMAL, labelColor,
|
|
||||||
IGraphicsTarget.HorizontalAlignment.LEFT, 0.0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -324,27 +274,6 @@ public class DamLocationResource extends
|
||||||
return scaleHeightValue;
|
return scaleHeightValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* gets the pixel coverage for this image
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private PixelCoverage getPixelCoverage(Coordinate c) {
|
|
||||||
|
|
||||||
double[] centerpixels = descriptor
|
|
||||||
.worldToPixel(new double[] { c.x, c.y });
|
|
||||||
Coordinate ul = new Coordinate(centerpixels[0] - getScaleWidth(),
|
|
||||||
centerpixels[1] - getScaleHeight());
|
|
||||||
Coordinate ur = new Coordinate(centerpixels[0] + getScaleWidth(),
|
|
||||||
centerpixels[1] - getScaleHeight());
|
|
||||||
Coordinate lr = new Coordinate(centerpixels[0] + getScaleWidth(),
|
|
||||||
centerpixels[1] + getScaleHeight());
|
|
||||||
Coordinate ll = new Coordinate(centerpixels[0] - getScaleWidth(),
|
|
||||||
centerpixels[1] + getScaleHeight());
|
|
||||||
|
|
||||||
return new PixelCoverage(ul, ur, lr, ll);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addContextMenuItems(IMenuManager menuManager, int x, int y) {
|
public void addContextMenuItems(IMenuManager menuManager, int x, int y) {
|
||||||
menuManager.add(new DamCatalogLaunchAction());
|
menuManager.add(new DamCatalogLaunchAction());
|
||||||
|
@ -384,11 +313,10 @@ public class DamLocationResource extends
|
||||||
if (elements.size() > 0) {
|
if (elements.size() > 0) {
|
||||||
Iterator<?> iter = elements.iterator();
|
Iterator<?> iter = elements.iterator();
|
||||||
if (iter.hasNext()) {
|
if (iter.hasNext()) {
|
||||||
ArrayList<?> data = (ArrayList<?>) iter.next();
|
DamMaster dam = (DamMaster) iter.next();
|
||||||
String nadid = damMap.get(data.get(0)).getNidid();
|
|
||||||
try {
|
try {
|
||||||
AppLauncherHandler alh = new AppLauncherHandler();
|
AppLauncherHandler alh = new AppLauncherHandler();
|
||||||
alh.execute(DC_BUNDLE_LOC, nadid);
|
alh.execute(DC_BUNDLE_LOC, dam.getNidid());
|
||||||
} catch (ExecutionException e) {
|
} catch (ExecutionException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -415,79 +343,26 @@ public class DamLocationResource extends
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void disposeInternal() {
|
protected void disposeInternal() {
|
||||||
super.disposeInternal();
|
font.dispose();
|
||||||
|
damIcon.dispose();
|
||||||
if (damRenderables != null) {
|
dams.clear();
|
||||||
Iterator<IImage> iter = damRenderables.values().iterator();
|
|
||||||
while (iter.hasNext()) {
|
|
||||||
iter.next().dispose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
damMap.clear();
|
|
||||||
setDisposed(true);
|
|
||||||
|
|
||||||
HydroDisplayManager manager = HydroDisplayManager.getInstance();
|
HydroDisplayManager manager = HydroDisplayManager.getInstance();
|
||||||
manager.setDamList(null);
|
manager.setDamList(null);
|
||||||
|
|
||||||
if (font != null) {
|
|
||||||
font.dispose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clear the data.
|
|
||||||
*/
|
|
||||||
public void clearData() {
|
|
||||||
ResourceList rl = descriptor.getResourceList();
|
|
||||||
|
|
||||||
for (ResourcePair pair : rl) {
|
|
||||||
AbstractVizResource<?, ?> rsc = pair.getResource();
|
|
||||||
if (rsc instanceof DamLocationResource) {
|
|
||||||
rl.removeRsc(rsc);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear the dam map.
|
* Clear the dam map.
|
||||||
*/
|
*/
|
||||||
public void resetDamMap() {
|
public void resetDamMap() {
|
||||||
damMap.clear();
|
dams.clear();
|
||||||
}
|
|
||||||
|
|
||||||
public Map<Coordinate, DamMaster> getDamMap() {
|
|
||||||
return damMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the isName
|
|
||||||
*/
|
|
||||||
public boolean isName() {
|
|
||||||
return isName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param name
|
|
||||||
* the name to set
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void setName(String name) {
|
|
||||||
this.resourceData.setName(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the isDisposed
|
* @return the isDisposed
|
||||||
*/
|
*/
|
||||||
public boolean isDisposed() {
|
public boolean isDisposed() {
|
||||||
return isDisposed;
|
return getStatus() == ResourceStatus.DISPOSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param isDisposed
|
|
||||||
* the isDisposed to set
|
|
||||||
*/
|
|
||||||
public void setDisposed(boolean isDisposed) {
|
|
||||||
this.isDisposed = isDisposed;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,14 +7,11 @@ import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
import org.eclipse.swt.graphics.RGB;
|
|
||||||
|
|
||||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||||
import com.raytheon.uf.viz.core.exception.VizException;
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
|
import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
|
||||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||||
import com.raytheon.viz.hydrocommon.data.DamMaster;
|
import com.raytheon.viz.hydrocommon.data.DamMaster;
|
||||||
import com.raytheon.viz.hydrocommon.resource.HydroPointResourceData;
|
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO Add Description
|
* TODO Add Description
|
||||||
|
@ -34,40 +31,103 @@ import com.vividsolutions.jts.geom.Coordinate;
|
||||||
*/
|
*/
|
||||||
@XmlAccessorType(XmlAccessType.NONE)
|
@XmlAccessorType(XmlAccessType.NONE)
|
||||||
@XmlRootElement(name = "damLocationResourceData")
|
@XmlRootElement(name = "damLocationResourceData")
|
||||||
public class DamLocationResourceData extends
|
public class DamLocationResourceData extends AbstractResourceData {
|
||||||
HydroPointResourceData<DamLocationResource> {
|
|
||||||
@XmlElement
|
|
||||||
List<DamMaster> damList;
|
|
||||||
|
|
||||||
public DamLocationResourceData() {
|
@XmlElement
|
||||||
super();
|
private List<DamMaster> damList;
|
||||||
}
|
|
||||||
|
|
||||||
public DamLocationResourceData(String name, RGB color, Coordinate location,
|
@XmlElement
|
||||||
Style style) {
|
private String name;
|
||||||
super(name, color, location, style);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
public DamLocationResourceData() {
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* com.raytheon.uf.viz.core.rsc.AbstractResourceData#construct(com.raytheon
|
|
||||||
* .uf.viz.core.rsc.LoadProperties,
|
|
||||||
* com.raytheon.uf.viz.core.drawables.IDescriptor)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public DamLocationResource construct(LoadProperties loadProperties,
|
|
||||||
IDescriptor descriptor) throws VizException {
|
|
||||||
return new DamLocationResource(this, loadProperties);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDamList(List<DamMaster> damList) {
|
}
|
||||||
this.damList = damList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<DamMaster> getDamList() {
|
public DamLocationResourceData(String name) {
|
||||||
return this.damList;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the damList
|
||||||
|
*/
|
||||||
|
public List<DamMaster> getDamList() {
|
||||||
|
return damList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param damList
|
||||||
|
* the damList to set
|
||||||
|
*/
|
||||||
|
public void setDamList(List<DamMaster> damList) {
|
||||||
|
this.damList = damList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the name
|
||||||
|
*/
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param name
|
||||||
|
* the name to set
|
||||||
|
*/
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* com.raytheon.uf.viz.core.rsc.AbstractResourceData#construct(com.raytheon
|
||||||
|
* .uf.viz.core.rsc.LoadProperties,
|
||||||
|
* com.raytheon.uf.viz.core.drawables.IDescriptor)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public DamLocationResource construct(LoadProperties loadProperties,
|
||||||
|
IDescriptor descriptor) throws VizException {
|
||||||
|
return new DamLocationResource(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
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see java.lang.Object#equals(java.lang.Object)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (obj == null)
|
||||||
|
return false;
|
||||||
|
if (getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
DamLocationResourceData other = (DamLocationResourceData) obj;
|
||||||
|
if (damList == null) {
|
||||||
|
if (other.damList != null)
|
||||||
|
return false;
|
||||||
|
} else if (!damList.equals(other.damList))
|
||||||
|
return false;
|
||||||
|
if (name == null) {
|
||||||
|
if (other.name != null)
|
||||||
|
return false;
|
||||||
|
} else if (!name.equals(other.name))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,14 +50,12 @@ 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.app.launcher.handlers.AppLauncherHandler;
|
import com.raytheon.uf.viz.app.launcher.handlers.AppLauncherHandler;
|
||||||
import com.raytheon.uf.viz.core.DrawableImage;
|
|
||||||
import com.raytheon.uf.viz.core.DrawableString;
|
import com.raytheon.uf.viz.core.DrawableString;
|
||||||
import com.raytheon.uf.viz.core.IDisplayPane;
|
import com.raytheon.uf.viz.core.IDisplayPane;
|
||||||
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
||||||
import com.raytheon.uf.viz.core.IExtent;
|
import com.raytheon.uf.viz.core.IExtent;
|
||||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||||
import com.raytheon.uf.viz.core.IGraphicsTarget.HorizontalAlignment;
|
import com.raytheon.uf.viz.core.IGraphicsTarget.HorizontalAlignment;
|
||||||
import com.raytheon.uf.viz.core.PixelCoverage;
|
|
||||||
import com.raytheon.uf.viz.core.PixelExtent;
|
import com.raytheon.uf.viz.core.PixelExtent;
|
||||||
import com.raytheon.uf.viz.core.RGBColors;
|
import com.raytheon.uf.viz.core.RGBColors;
|
||||||
import com.raytheon.uf.viz.core.data.IRenderedImageCallback;
|
import com.raytheon.uf.viz.core.data.IRenderedImageCallback;
|
||||||
|
@ -96,6 +94,8 @@ import com.raytheon.viz.hydrocommon.whfslib.colorthreshold.ColorThresholdArray;
|
||||||
import com.raytheon.viz.hydrocommon.whfslib.colorthreshold.GetColorValues;
|
import com.raytheon.viz.hydrocommon.whfslib.colorthreshold.GetColorValues;
|
||||||
import com.raytheon.viz.hydrocommon.whfslib.colorthreshold.HydroViewColors;
|
import com.raytheon.viz.hydrocommon.whfslib.colorthreshold.HydroViewColors;
|
||||||
import com.raytheon.viz.hydrocommon.whfslib.colorthreshold.NamedColorUseSet;
|
import com.raytheon.viz.hydrocommon.whfslib.colorthreshold.NamedColorUseSet;
|
||||||
|
import com.raytheon.viz.pointdata.drawables.IPointImageExtension;
|
||||||
|
import com.raytheon.viz.pointdata.drawables.IPointImageExtension.PointImage;
|
||||||
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;
|
||||||
import com.raytheon.viz.ui.input.InputAdapter;
|
import com.raytheon.viz.ui.input.InputAdapter;
|
||||||
|
@ -212,7 +212,7 @@ public class MultiPointResource extends
|
||||||
|
|
||||||
private STRtree strTree = new STRtree();
|
private STRtree strTree = new STRtree();
|
||||||
|
|
||||||
private IFont font = null;
|
private IFont font;
|
||||||
|
|
||||||
private int fontSize;
|
private int fontSize;
|
||||||
|
|
||||||
|
@ -388,38 +388,6 @@ public class MultiPointResource extends
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* gets the pixel coverage for this image
|
|
||||||
*
|
|
||||||
* @param gageData
|
|
||||||
* the gage data
|
|
||||||
* @param shiftWidth
|
|
||||||
* the shift width coordinate
|
|
||||||
* @param shiftHeight
|
|
||||||
* the shift height coordinate
|
|
||||||
* @return PixelCoverage
|
|
||||||
*/
|
|
||||||
private PixelCoverage getPixelCoverage(GageData gageData,
|
|
||||||
double shiftWidth, double shiftHeight) {
|
|
||||||
Coordinate c = gageData.getCoordinate();
|
|
||||||
double[] centerpixels = descriptor
|
|
||||||
.worldToPixel(new double[] { c.x, c.y });
|
|
||||||
Coordinate ul = new Coordinate((centerpixels[0] + shiftWidth)
|
|
||||||
- getScaleWidth(), (centerpixels[1] + shiftHeight)
|
|
||||||
- getScaleHeight());
|
|
||||||
Coordinate ur = new Coordinate((centerpixels[0] + shiftWidth)
|
|
||||||
+ getScaleWidth(), (centerpixels[1] + shiftHeight)
|
|
||||||
- getScaleHeight());
|
|
||||||
Coordinate lr = new Coordinate((centerpixels[0] + shiftWidth)
|
|
||||||
+ getScaleWidth(), (centerpixels[1] + shiftHeight)
|
|
||||||
+ getScaleHeight());
|
|
||||||
Coordinate ll = new Coordinate((centerpixels[0] + shiftWidth)
|
|
||||||
- getScaleWidth(), (centerpixels[1] + shiftHeight)
|
|
||||||
+ getScaleHeight());
|
|
||||||
|
|
||||||
return new PixelCoverage(ul, ur, lr, ll);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the pixel extent of the rectangle
|
* Gets the pixel extent of the rectangle
|
||||||
*
|
*
|
||||||
|
@ -824,8 +792,7 @@ public class MultiPointResource extends
|
||||||
IExtent extent = paintProps.getView().getExtent();
|
IExtent extent = paintProps.getView().getExtent();
|
||||||
List<GageData> data = pdcManager.getObsReportList();
|
List<GageData> data = pdcManager.getObsReportList();
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
List<DrawableImage> images = new ArrayList<DrawableImage>(
|
List<PointImage> images = new ArrayList<PointImage>(data.size());
|
||||||
data.size());
|
|
||||||
List<DrawableString> strings = new ArrayList<DrawableString>(
|
List<DrawableString> strings = new ArrayList<DrawableString>(
|
||||||
data.size() * 3);
|
data.size() * 3);
|
||||||
for (GageData gage : data) {
|
for (GageData gage : data) {
|
||||||
|
@ -848,9 +815,10 @@ public class MultiPointResource extends
|
||||||
color = RGBColors.getRGBColor(colorSet.get(0)
|
color = RGBColors.getRGBColor(colorSet.get(0)
|
||||||
.getColorname().getColorName());
|
.getColorname().getColorName());
|
||||||
}
|
}
|
||||||
images.add(new DrawableImage(getIcon(target, gage,
|
PointImage image = new PointImage(getIcon(target,
|
||||||
color), getPixelCoverage(gage,
|
gage, color), pixel[0], pixel[1]);
|
||||||
shiftWidthValue, shiftHeightValue)));
|
image.setSiteId(gage.getLid());
|
||||||
|
images.add(image);
|
||||||
}
|
}
|
||||||
strings.addAll(drawPlotInfo(gage, shiftWidthValue,
|
strings.addAll(drawPlotInfo(gage, shiftWidthValue,
|
||||||
shiftHeightValue, paintProps, target));
|
shiftHeightValue, paintProps, target));
|
||||||
|
@ -858,8 +826,8 @@ public class MultiPointResource extends
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (images.size() > 0) {
|
if (images.size() > 0) {
|
||||||
target.drawRasters(paintProps,
|
target.getExtension(IPointImageExtension.class)
|
||||||
images.toArray(new DrawableImage[images.size()]));
|
.drawPointImages(paintProps, images);
|
||||||
}
|
}
|
||||||
if (strings.size() > 0) {
|
if (strings.size() > 0) {
|
||||||
target.drawStrings(strings);
|
target.drawStrings(strings);
|
||||||
|
|
Loading…
Add table
Reference in a new issue