Issue #664 Made hydro dam resource work with collaboration
Change-Id: If6d422a937a549c9f68b8c523553179924ac2d7a Former-commit-id:b0f729ceb2
[formerly a3bfc9f4014a417205c27bbd73fc07556df007bc] Former-commit-id:7b95887a24
This commit is contained in:
parent
d4dcc0e12e
commit
9c3805b762
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.viz.ui.personalities.awips;bundle-version="1.12.1174",
|
||||
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
|
||||
Export-Package: com.raytheon.viz.hydro,
|
||||
com.raytheon.viz.hydro.perspective,
|
||||
|
|
|
@ -384,7 +384,7 @@ public class DamDisplayControlDlg extends CaveSWTDialog {
|
|||
PointDataControlManager pdcManager = PointDataControlManager
|
||||
.getInstance();
|
||||
DamLocationResource dlr = pdcManager.getDamLocationResource();
|
||||
dlr.clearData();
|
||||
dlr.unload();
|
||||
pdcManager.setRedraw(true);
|
||||
|
||||
}
|
||||
|
|
|
@ -157,16 +157,16 @@ public class StationDisplay implements MapUpdateListener,
|
|||
String iconColor = appsDefaults.getToken("dam_icon_color");
|
||||
RGB damColor = RGBColors.getRGBColor(iconColor);
|
||||
DamLocationResourceData hydroPointResourceData = new DamLocationResourceData(
|
||||
"Dam Sites", damColor, null, null);
|
||||
"Dam Sites");
|
||||
try {
|
||||
dlr = hydroPointResourceData.construct(new LoadProperties(),
|
||||
EditorUtil.getActiveVizContainer()
|
||||
.getActiveDisplayPane().getDescriptor());
|
||||
dlr.getCapability(ColorableCapability.class).setColor(damColor);
|
||||
} catch (VizException e) {
|
||||
// TODO Auto-generated catch block. Please revise as
|
||||
// appropriate.
|
||||
}
|
||||
dlr.setDisposed(false);
|
||||
}
|
||||
ResourceProperties props = new ResourceProperties();
|
||||
props.setMapLayer(true);
|
||||
|
@ -245,7 +245,7 @@ public class StationDisplay implements MapUpdateListener,
|
|||
* remove and restore the gage resource.
|
||||
*/
|
||||
public void resetGageDisplay() {
|
||||
mpr.resetDataMap();
|
||||
mpr.resetDataMap();
|
||||
|
||||
// force update
|
||||
mpr = getMultiPointResource();
|
||||
|
|
|
@ -19,11 +19,10 @@
|
|||
**/
|
||||
package com.raytheon.viz.hydro.resource;
|
||||
|
||||
import java.awt.image.RenderedImage;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.jface.action.IMenuManager;
|
||||
|
@ -34,27 +33,27 @@ import org.eclipse.swt.widgets.Shell;
|
|||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
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.IDisplayPaneContainer;
|
||||
import com.raytheon.uf.viz.core.IExtent;
|
||||
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.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.IImage;
|
||||
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.rsc.AbstractVizResource;
|
||||
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.ImageSize;
|
||||
import com.raytheon.viz.hydro.pointdatacontrol.PointDataControlManager;
|
||||
import com.raytheon.viz.hydrocommon.HydroDisplayManager;
|
||||
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.IContextMenuContributor;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
|
@ -78,68 +77,72 @@ import com.vividsolutions.jts.index.strtree.STRtree;
|
|||
*/
|
||||
|
||||
public class DamLocationResource extends
|
||||
HydroPointResource<DamLocationResourceData> implements
|
||||
AbstractVizResource<DamLocationResourceData, IDescriptor> implements
|
||||
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 IFont font = null;
|
||||
|
||||
private IGraphicsTarget target;
|
||||
|
||||
private double scaleWidthValue = 0.0;
|
||||
|
||||
private double scaleHeightValue = 0.0;
|
||||
|
||||
private final boolean isName = false;
|
||||
|
||||
private boolean isDisposed = false;
|
||||
|
||||
private final RGB labelColor = RGBColors.getRGBColor("white");
|
||||
|
||||
public DamLocationResource(DamLocationResourceData resourceData,
|
||||
LoadProperties loadProperties) {
|
||||
super(resourceData, loadProperties);
|
||||
this.getCapability(ColorableCapability.class).setColor(
|
||||
resourceData.getColor());
|
||||
public DamLocationResource(DamLocationResourceData resourceData,
|
||||
LoadProperties loadProperties) {
|
||||
super(resourceData, loadProperties);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initInternal(IGraphicsTarget target) throws VizException {
|
||||
populateDamList();
|
||||
}
|
||||
|
||||
private void populateDamList() {
|
||||
PointDataControlManager pdcManager = PointDataControlManager
|
||||
.getInstance();
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.rsc.AbstractVizResource#getName()
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return resourceData.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initInternal(IGraphicsTarget target) throws VizException {
|
||||
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();
|
||||
|
||||
List<DamMaster> damList = displayManager.getDamList();
|
||||
if (damList != null) {
|
||||
pdcManager.setDamLocationResource(this);
|
||||
damMap.clear();
|
||||
for (DamMaster dm : damList) {
|
||||
addPoint(dm);
|
||||
}
|
||||
} else {
|
||||
damList = getResourceData().getDamList();
|
||||
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();
|
||||
List<DamMaster> damList = displayManager.getDamList();
|
||||
if (damList == null) {
|
||||
damList = resourceData.getDamList();
|
||||
}
|
||||
if (damList != null) {
|
||||
displayManager.setDamList(damList);
|
||||
pdcManager.setDamLocationResource(this);
|
||||
for (DamMaster dm : damList) {
|
||||
addPoint(dm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -149,46 +152,16 @@ public class DamLocationResource extends
|
|||
* The DamMaster object
|
||||
*/
|
||||
public void addPoint(DamMaster master) {
|
||||
Coordinate xy = new Coordinate(master.getLongitudeDam(),
|
||||
master.getLatitudeDam());
|
||||
damMap.put(xy, master);
|
||||
|
||||
/* Create a small envelope around the point */
|
||||
Coordinate p1 = new Coordinate(master.getLongitudeDam() + .03,
|
||||
master.getLatitudeDam() + .03);
|
||||
Coordinate p2 = new Coordinate(master.getLongitudeDam() - .03,
|
||||
master.getLatitudeDam() - .03);
|
||||
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();
|
||||
}
|
||||
if (dams.contains(master) == false) {
|
||||
dams.add(master);
|
||||
/* Create a small envelope around the point */
|
||||
Coordinate p1 = new Coordinate(master.getLongitudeDam() + .03,
|
||||
master.getLatitudeDam() + .03);
|
||||
Coordinate p2 = new Coordinate(master.getLongitudeDam() - .03,
|
||||
master.getLatitudeDam() - .03);
|
||||
Envelope env = new Envelope(p1, p2);
|
||||
damStrTree.insert(env, master);
|
||||
}
|
||||
|
||||
return damRenderables;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -205,79 +178,56 @@ public class DamLocationResource extends
|
|||
PaintProperties paintProps) throws VizException {
|
||||
HydroDisplayManager manager = HydroDisplayManager.getInstance();
|
||||
|
||||
int fontSize = manager.getFontSize();
|
||||
if (font != null) {
|
||||
font = target.initializeFont("Dialog", fontSize, null);
|
||||
}
|
||||
// Check the font size
|
||||
font.setMagnification((manager.getFontSize() / (float) fontSize), true);
|
||||
|
||||
this.target = target;
|
||||
populateDamList();
|
||||
|
||||
/* Should we display the dam icons? */
|
||||
if (manager.getDamList() != null) {
|
||||
populateDamList();
|
||||
damRenderables = getDamRenderables();
|
||||
Iterator<Coordinate> iter = damMap.keySet().iterator();
|
||||
List<PointImage> images = new ArrayList<PointImage>(dams.size());
|
||||
List<DrawableString> strings = new ArrayList<DrawableString>(
|
||||
dams.size() * 2);
|
||||
IExtent extent = paintProps.getView().getExtent();
|
||||
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()) {
|
||||
Coordinate c = iter.next();
|
||||
double[] pixel = descriptor.worldToPixel(new double[] { c.x,
|
||||
c.y });
|
||||
/* Draw the icons */
|
||||
if (manager.isDisplayDamIcon()) {
|
||||
PointImage image = new PointImage(damIcon, pixel[0],
|
||||
pixel[1]);
|
||||
image.setSiteId(dam.getDamName());
|
||||
images.add(image);
|
||||
}
|
||||
|
||||
if (pixel != null) {
|
||||
if (paintProps.getView().getExtent().contains(pixel)) {
|
||||
/* Draw the labels */
|
||||
if (manager.isDisplayDamId()) {
|
||||
Coordinate idCoor = new Coordinate(pixel[0]
|
||||
- getScaleWidth(), pixel[1] - getScaleHeight());
|
||||
|
||||
setScaleWidth(paintProps);
|
||||
setScaleHeight(paintProps);
|
||||
DrawableString ds = new DrawableString(dam.getNidid(),
|
||||
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 */
|
||||
if (manager.isDisplayDamIcon()) {
|
||||
target.drawRaster(damRenderables.get(c),
|
||||
getPixelCoverage(c), paintProps);
|
||||
}
|
||||
|
||||
/* Draw the labels */
|
||||
drawPlotInfo(c, damMap.get(c));
|
||||
}
|
||||
DrawableString ds = new DrawableString(dam.getNidid(),
|
||||
LABEL_COLOR);
|
||||
ds.setCoordinates(nameCoor.x, nameCoor.y);
|
||||
ds.font = font;
|
||||
strings.add(ds);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
target.getExtension(IPointImageExtension.class).drawPointImages(
|
||||
paintProps, images);
|
||||
target.drawStrings(strings);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -324,27 +274,6 @@ public class DamLocationResource extends
|
|||
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
|
||||
public void addContextMenuItems(IMenuManager menuManager, int x, int y) {
|
||||
menuManager.add(new DamCatalogLaunchAction());
|
||||
|
@ -384,11 +313,10 @@ public class DamLocationResource extends
|
|||
if (elements.size() > 0) {
|
||||
Iterator<?> iter = elements.iterator();
|
||||
if (iter.hasNext()) {
|
||||
ArrayList<?> data = (ArrayList<?>) iter.next();
|
||||
String nadid = damMap.get(data.get(0)).getNidid();
|
||||
DamMaster dam = (DamMaster) iter.next();
|
||||
try {
|
||||
AppLauncherHandler alh = new AppLauncherHandler();
|
||||
alh.execute(DC_BUNDLE_LOC, nadid);
|
||||
alh.execute(DC_BUNDLE_LOC, dam.getNidid());
|
||||
} catch (ExecutionException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -415,79 +343,26 @@ public class DamLocationResource extends
|
|||
*/
|
||||
@Override
|
||||
protected void disposeInternal() {
|
||||
super.disposeInternal();
|
||||
|
||||
if (damRenderables != null) {
|
||||
Iterator<IImage> iter = damRenderables.values().iterator();
|
||||
while (iter.hasNext()) {
|
||||
iter.next().dispose();
|
||||
}
|
||||
}
|
||||
damMap.clear();
|
||||
setDisposed(true);
|
||||
font.dispose();
|
||||
damIcon.dispose();
|
||||
dams.clear();
|
||||
|
||||
HydroDisplayManager manager = HydroDisplayManager.getInstance();
|
||||
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.
|
||||
*/
|
||||
public void resetDamMap() {
|
||||
damMap.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);
|
||||
dams.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the 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.XmlRootElement;
|
||||
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
|
||||
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;
|
||||
import com.raytheon.viz.hydrocommon.data.DamMaster;
|
||||
import com.raytheon.viz.hydrocommon.resource.HydroPointResourceData;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
|
@ -34,40 +31,103 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
*/
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@XmlRootElement(name = "damLocationResourceData")
|
||||
public class DamLocationResourceData extends
|
||||
HydroPointResourceData<DamLocationResource> {
|
||||
@XmlElement
|
||||
List<DamMaster> damList;
|
||||
public class DamLocationResourceData extends AbstractResourceData {
|
||||
|
||||
public DamLocationResourceData() {
|
||||
super();
|
||||
}
|
||||
@XmlElement
|
||||
private List<DamMaster> damList;
|
||||
|
||||
public DamLocationResourceData(String name, RGB color, Coordinate location,
|
||||
Style style) {
|
||||
super(name, color, location, style);
|
||||
}
|
||||
@XmlElement
|
||||
private String 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);
|
||||
}
|
||||
public DamLocationResourceData() {
|
||||
|
||||
public void setDamList(List<DamMaster> damList) {
|
||||
this.damList = damList;
|
||||
}
|
||||
}
|
||||
|
||||
public List<DamMaster> getDamList() {
|
||||
return this.damList;
|
||||
}
|
||||
public DamLocationResourceData(String name) {
|
||||
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.Priority;
|
||||
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.IDisplayPane;
|
||||
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.HorizontalAlignment;
|
||||
import com.raytheon.uf.viz.core.PixelCoverage;
|
||||
import com.raytheon.uf.viz.core.PixelExtent;
|
||||
import com.raytheon.uf.viz.core.RGBColors;
|
||||
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.HydroViewColors;
|
||||
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.IContextMenuContributor;
|
||||
import com.raytheon.viz.ui.input.InputAdapter;
|
||||
|
@ -212,7 +212,7 @@ public class MultiPointResource extends
|
|||
|
||||
private STRtree strTree = new STRtree();
|
||||
|
||||
private IFont font = null;
|
||||
private IFont font;
|
||||
|
||||
private int fontSize;
|
||||
|
||||
|
@ -388,38 +388,6 @@ public class MultiPointResource extends
|
|||
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
|
||||
*
|
||||
|
@ -824,8 +792,7 @@ public class MultiPointResource extends
|
|||
IExtent extent = paintProps.getView().getExtent();
|
||||
List<GageData> data = pdcManager.getObsReportList();
|
||||
if (data != null) {
|
||||
List<DrawableImage> images = new ArrayList<DrawableImage>(
|
||||
data.size());
|
||||
List<PointImage> images = new ArrayList<PointImage>(data.size());
|
||||
List<DrawableString> strings = new ArrayList<DrawableString>(
|
||||
data.size() * 3);
|
||||
for (GageData gage : data) {
|
||||
|
@ -848,9 +815,10 @@ public class MultiPointResource extends
|
|||
color = RGBColors.getRGBColor(colorSet.get(0)
|
||||
.getColorname().getColorName());
|
||||
}
|
||||
images.add(new DrawableImage(getIcon(target, gage,
|
||||
color), getPixelCoverage(gage,
|
||||
shiftWidthValue, shiftHeightValue)));
|
||||
PointImage image = new PointImage(getIcon(target,
|
||||
gage, color), pixel[0], pixel[1]);
|
||||
image.setSiteId(gage.getLid());
|
||||
images.add(image);
|
||||
}
|
||||
strings.addAll(drawPlotInfo(gage, shiftWidthValue,
|
||||
shiftHeightValue, paintProps, target));
|
||||
|
@ -858,8 +826,8 @@ public class MultiPointResource extends
|
|||
}
|
||||
}
|
||||
if (images.size() > 0) {
|
||||
target.drawRasters(paintProps,
|
||||
images.toArray(new DrawableImage[images.size()]));
|
||||
target.getExtension(IPointImageExtension.class)
|
||||
.drawPointImages(paintProps, images);
|
||||
}
|
||||
if (strings.size() > 0) {
|
||||
target.drawStrings(strings);
|
||||
|
|
Loading…
Add table
Reference in a new issue