12.4.1-10 baseline
Former-commit-id:7fa9dbd5fb
[formerly4bfbdad17d
] [formerly9f8cb727a5
] [formerly8485b90ff8
[formerly9f8cb727a5
[formerly bf53d06834caa780226121334ac1bcf0534c3f16]]] Former-commit-id:8485b90ff8
Former-commit-id: 73930fb29d0c1e91204e76e6ebfdbe757414f319 [formerlya28d70b5c5
] Former-commit-id:33a67cdd82
This commit is contained in:
parent
937f4b6aa3
commit
40aa780b3d
1414 changed files with 38201 additions and 31702 deletions
0
RadarServer/build.rcm/.project
Executable file → Normal file
0
RadarServer/build.rcm/.project
Executable file → Normal file
0
RadarServer/build.rcm/bits/bin/importAwips1
Executable file → Normal file
0
RadarServer/build.rcm/bits/bin/importAwips1
Executable file → Normal file
0
RadarServer/build.rcm/bits/bin/start
Executable file → Normal file
0
RadarServer/build.rcm/bits/bin/start
Executable file → Normal file
0
RadarServer/build.rcm/bits/bin/stop
Executable file → Normal file
0
RadarServer/build.rcm/bits/bin/stop
Executable file → Normal file
0
RadarServer/build.rcm/build.sh
Executable file → Normal file
0
RadarServer/build.rcm/build.sh
Executable file → Normal file
0
RadarServer/build.rcm/build.xml
Executable file → Normal file
0
RadarServer/build.rcm/build.xml
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/drop-ins/KXXX.clear-air.VCP31
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/drop-ins/KXXX.clear-air.VCP31
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/drop-ins/KXXX.clear-air.VCP32
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/drop-ins/KXXX.clear-air.VCP32
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/drop-ins/KXXX.maint
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/drop-ins/KXXX.maint
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/drop-ins/KXXX.storm.VCP11
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/drop-ins/KXXX.storm.VCP11
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/drop-ins/KXXX.storm.VCP112
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/drop-ins/KXXX.storm.VCP112
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/drop-ins/KXXX.storm.VCP12
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/drop-ins/KXXX.storm.VCP12
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/drop-ins/KXXX.storm.VCP121
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/drop-ins/KXXX.storm.VCP121
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/drop-ins/KXXX.storm.VCP21
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/drop-ins/KXXX.storm.VCP21
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/drop-ins/KXXX.storm.VCP211
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/drop-ins/KXXX.storm.VCP211
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/drop-ins/KXXX.storm.VCP212
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/drop-ins/KXXX.storm.VCP212
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/drop-ins/KXXX.storm.VCP221
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/drop-ins/KXXX.storm.VCP221
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/drop-ins/KXXX.storm.VCP80
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/drop-ins/KXXX.storm.VCP80
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/drop-ins/KXXX.storm.VCP90
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/drop-ins/KXXX.storm.VCP90
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/drop-ins/prodList.txt
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/drop-ins/prodList.txt
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/drop-ins/rps-RPGOP-tcp.clear-air
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/drop-ins/rps-RPGOP-tcp.clear-air
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/drop-ins/rps-RPGOP-tcp.storm
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/drop-ins/rps-RPGOP-tcp.storm
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/drop-ins/rps-SPGOP-tcp.storm
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/drop-ins/rps-SPGOP-tcp.storm
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/drop-ins/tdwrProdList.txt
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/drop-ins/tdwrProdList.txt
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/drop-ins/wmoSiteInfo.txt
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/drop-ins/wmoSiteInfo.txt
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/persist/config.xml
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/persist/config.xml
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/start-config
Executable file → Normal file
0
RadarServer/build.rcm/cfgbits/data/config/start-config
Executable file → Normal file
121
cave/build/static/common/cave/etc/ncep/nsharp/nsharpConfig.xml
Normal file
121
cave/build/static/common/cave/etc/ncep/nsharp/nsharpConfig.xml
Normal file
|
@ -0,0 +1,121 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<NsharpConfigStore xmlns:ns2="group" xmlns:ns3="http://www.example.org/productType">
|
||||
<graphProperty tempOffset="0" windBarbDistance="400" windBarb="true" corfidiV="false" omega="true" smvBunkersL="true" smvBunkersR="true" smv1585="false" smv3075="false" meanWind="true" hodo="true" cloud="false" effLayer="true" moistAdiabat="false" dryAdiabat="true" mixratio="false" wetBulb="true" vTemp="true" parcel="true" dewp="true" temp="true"/>
|
||||
<linePropertyMap>
|
||||
<Line lineName="Compare 6">
|
||||
<lineProperty lineWidth="2" lineStyle="SOLID">
|
||||
<lineColor>RGB {0, 255, 255}</lineColor>
|
||||
</lineProperty>
|
||||
</Line>
|
||||
<Line lineName="Compare 5">
|
||||
<lineProperty lineWidth="2" lineStyle="SOLID">
|
||||
<lineColor>RGB {255, 215, 0}</lineColor>
|
||||
</lineProperty>
|
||||
</Line>
|
||||
<Line lineName="Compare 4">
|
||||
<lineProperty lineWidth="2" lineStyle="SOLID">
|
||||
<lineColor>RGB {30, 144, 255}</lineColor>
|
||||
</lineProperty>
|
||||
</Line>
|
||||
<Line lineName="Icing EPI">
|
||||
<lineProperty lineWidth="2" lineStyle="SOLID">
|
||||
<lineColor>RGB {255, 0, 255}</lineColor>
|
||||
</lineProperty>
|
||||
</Line>
|
||||
<Line lineName="Compare 3">
|
||||
<lineProperty lineWidth="2" lineStyle="SOLID">
|
||||
<lineColor>RGB {155, 0, 220}</lineColor>
|
||||
</lineProperty>
|
||||
</Line>
|
||||
<Line lineName="Wind Barb">
|
||||
<lineProperty lineWidth="1" lineStyle="SOLID">
|
||||
<lineColor>RGB {255, 255, 0}</lineColor>
|
||||
</lineProperty>
|
||||
</Line>
|
||||
<Line lineName="Icing RH">
|
||||
<lineProperty lineWidth="2" lineStyle="SOLID">
|
||||
<lineColor>RGB {0, 255, 0}</lineColor>
|
||||
</lineProperty>
|
||||
</Line>
|
||||
<Line lineName="Compare 9">
|
||||
<lineProperty lineWidth="2" lineStyle="SOLID">
|
||||
<lineColor>RGB {0, 139, 0}</lineColor>
|
||||
</lineProperty>
|
||||
</Line>
|
||||
<Line lineName="Compare 8">
|
||||
<lineProperty lineWidth="2" lineStyle="SOLID">
|
||||
<lineColor>RGB {139, 0, 139}</lineColor>
|
||||
</lineProperty>
|
||||
</Line>
|
||||
<Line lineName="Compare 7">
|
||||
<lineProperty lineWidth="2" lineStyle="SOLID">
|
||||
<lineColor>RGB {139, 71, 38}</lineColor>
|
||||
</lineProperty>
|
||||
</Line>
|
||||
<Line lineName="Compare 10">
|
||||
<lineProperty lineWidth="2" lineStyle="SOLID">
|
||||
<lineColor>RGB {144, 238, 144}</lineColor>
|
||||
</lineProperty>
|
||||
</Line>
|
||||
<Line lineName="Overlay 2">
|
||||
<lineProperty lineWidth="2" lineStyle="SOLID">
|
||||
<lineColor>RGB {0, 255, 0}</lineColor>
|
||||
</lineProperty>
|
||||
</Line>
|
||||
<Line lineName="Temperature">
|
||||
<lineProperty lineWidth="2" lineStyle="SOLID">
|
||||
<lineColor>RGB {255, 0, 0}</lineColor>
|
||||
</lineProperty>
|
||||
</Line>
|
||||
<Line lineName="Overlay 1">
|
||||
<lineProperty lineWidth="2" lineStyle="SOLID">
|
||||
<lineColor>RGB {255, 0, 0}</lineColor>
|
||||
</lineProperty>
|
||||
</Line>
|
||||
<Line lineName="Turbulence WindShear">
|
||||
<lineProperty lineWidth="2" lineStyle="SOLID">
|
||||
<lineColor>RGB {255, 174, 185}</lineColor>
|
||||
</lineProperty>
|
||||
</Line>
|
||||
<Line lineName="Compare 2">
|
||||
<lineProperty lineWidth="2" lineStyle="SOLID">
|
||||
<lineColor>RGB {0, 255, 0}</lineColor>
|
||||
</lineProperty>
|
||||
</Line>
|
||||
<Line lineName="Compare 1">
|
||||
<lineProperty lineWidth="2" lineStyle="SOLID">
|
||||
<lineColor>RGB {255, 0, 0}</lineColor>
|
||||
</lineProperty>
|
||||
</Line>
|
||||
<Line lineName="Icing Temp">
|
||||
<lineProperty lineWidth="2" lineStyle="SOLID">
|
||||
<lineColor>RGB {255, 0, 0}</lineColor>
|
||||
</lineProperty>
|
||||
</Line>
|
||||
<Line lineName="Wetbulb">
|
||||
<lineProperty lineWidth="1" lineStyle="SOLID">
|
||||
<lineColor>RGB {0, 255, 255}</lineColor>
|
||||
</lineProperty>
|
||||
</Line>
|
||||
<Line lineName="Turbulence Ln">
|
||||
<lineProperty lineWidth="2" lineStyle="SOLID">
|
||||
<lineColor>RGB {255, 0, 255}</lineColor>
|
||||
</lineProperty>
|
||||
</Line>
|
||||
<Line lineName="Virtual Temp">
|
||||
<lineProperty lineWidth="2" lineStyle="SHORT_DASHED">
|
||||
<lineColor>RGB {255, 0, 0}</lineColor>
|
||||
</lineProperty>
|
||||
</Line>
|
||||
<Line lineName="Dew Point">
|
||||
<lineProperty lineWidth="2" lineStyle="SOLID">
|
||||
<lineColor>RGB {0, 255, 0}</lineColor>
|
||||
</lineProperty>
|
||||
</Line>
|
||||
<Line lineName="Parcel">
|
||||
<lineProperty lineWidth="1" lineStyle="SHORT_DASHED">
|
||||
<lineColor>RGB {255, 250, 250}</lineColor>
|
||||
</lineProperty>
|
||||
</Line>
|
||||
</linePropertyMap>
|
||||
</NsharpConfigStore>
|
0
cave/build/static/win32.x86/cave/lib/libgcc_s_dw2-1.dll
Executable file → Normal file
0
cave/build/static/win32.x86/cave/lib/libgcc_s_dw2-1.dll
Executable file → Normal file
0
cave/build/static/win32.x86/cave/lib/libgfortran-3.dll
Executable file → Normal file
0
cave/build/static/win32.x86/cave/lib/libgfortran-3.dll
Executable file → Normal file
0
cave/build/static/win32.x86/cave/lib/libquadmath-0.dll
Executable file → Normal file
0
cave/build/static/win32.x86/cave/lib/libquadmath-0.dll
Executable file → Normal file
|
@ -407,6 +407,12 @@ public class CoopPrecipDataCubeAdapter implements IDataCubeAdapter {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String recordKeyGenerator(PluginDataObject pdo) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initInventory() {
|
||||
// TODO Auto-generated method stub
|
||||
|
|
|
@ -87,7 +87,6 @@ public abstract class AbstractDbMapResource<T extends AbstractDbMapResourceData,
|
|||
|
||||
if (font != null) {
|
||||
font.dispose();
|
||||
font = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -540,7 +540,7 @@ public class DbMapResource extends
|
|||
if (shadedShape != null) {
|
||||
shadedShape.dispose();
|
||||
}
|
||||
lastExtent = null;
|
||||
|
||||
super.disposeInternal();
|
||||
}
|
||||
|
||||
|
|
|
@ -27,4 +27,8 @@
|
|||
<framesPerSecondPreference>25</framesPerSecondPreference>
|
||||
<tileBoundaries>false</tileBoundaries>
|
||||
<fontMagnification>1.0</fontMagnification>
|
||||
<qpid>
|
||||
<max_count>1000</max_count>
|
||||
<policy_type>ring</policy_type>
|
||||
</qpid>
|
||||
</configuration>
|
||||
|
|
|
@ -133,4 +133,11 @@ public abstract class AbstractGraphicsFactoryAdapter {
|
|||
public abstract Canvas constrcutCanvas(Composite canvasComp)
|
||||
throws VizException;
|
||||
|
||||
/**
|
||||
* Dispose of the canvas, it can be assumed the canvas is the same type
|
||||
* created from constructCanvas
|
||||
*
|
||||
* @param canvas
|
||||
*/
|
||||
public abstract void disposeCanvas(Canvas canvas);
|
||||
}
|
||||
|
|
|
@ -45,16 +45,11 @@ public class DrawableImage {
|
|||
|
||||
private PixelCoverage coverage;
|
||||
|
||||
private RasterMode mode;
|
||||
private RasterMode mode = RasterMode.SYNCHRONOUS;
|
||||
|
||||
public DrawableImage(IImage image, PixelCoverage coverage) {
|
||||
this(image, coverage, RasterMode.SYNCHRONOUS);
|
||||
}
|
||||
|
||||
public DrawableImage(IImage image, PixelCoverage coverage, RasterMode mode) {
|
||||
this.image = image;
|
||||
this.coverage = coverage;
|
||||
this.mode = mode;
|
||||
}
|
||||
|
||||
public IImage getImage() {
|
||||
|
|
|
@ -39,8 +39,6 @@ import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
|
|||
import com.raytheon.uf.viz.core.drawables.IShadedShape;
|
||||
import com.raytheon.uf.viz.core.drawables.IWireframeShape;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.GraphicsExtension.IGraphicsExtensionInterface;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.IImagingExtension;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.geom.PixelCoordinate;
|
||||
import com.vividsolutions.jts.geom.LinearRing;
|
||||
|
@ -66,7 +64,7 @@ import com.vividsolutions.jts.geom.LinearRing;
|
|||
* @author chammack
|
||||
* @version 1
|
||||
*/
|
||||
public interface IGraphicsTarget extends IImagingExtension {
|
||||
public interface IGraphicsTarget {
|
||||
|
||||
/** Defines alignment characteristics */
|
||||
public static enum HorizontalAlignment {
|
||||
|
@ -191,6 +189,24 @@ public interface IGraphicsTarget extends IImagingExtension {
|
|||
public abstract boolean drawRaster(IImage image, PixelCoverage extent,
|
||||
PaintProperties paintProps) throws VizException;
|
||||
|
||||
/**
|
||||
* Draw a raster to a target, given an extent and an alpha (transparency)
|
||||
* value. Assumes synchronous operation.
|
||||
*
|
||||
* This operation will block on unavailable data.
|
||||
*
|
||||
* @param image
|
||||
* the image reference object to draw
|
||||
* @param extent
|
||||
* the extent of the drawable area
|
||||
* @param paintProps
|
||||
* the paint properties
|
||||
* @return status whether the raster was able to be drawn
|
||||
* @throws VizException
|
||||
*/
|
||||
public abstract boolean drawRasters(PaintProperties paintProps,
|
||||
DrawableImage... images) throws VizException;
|
||||
|
||||
/**
|
||||
* Draw a raster to a target, given an extent and an alpha (transparency)
|
||||
* value
|
||||
|
@ -646,6 +662,15 @@ public interface IGraphicsTarget extends IImagingExtension {
|
|||
*/
|
||||
public abstract boolean isNeedsRefresh();
|
||||
|
||||
/**
|
||||
* Stage an image
|
||||
*
|
||||
* @param image
|
||||
* the image to stage
|
||||
* @throws VizException
|
||||
*/
|
||||
public abstract void stage(final IImage image) throws VizException;
|
||||
|
||||
/**
|
||||
* Sets the background color of the panes.
|
||||
*
|
||||
|
@ -655,10 +680,6 @@ public interface IGraphicsTarget extends IImagingExtension {
|
|||
public abstract void setBackgroundColor(RGB backgroundColor);
|
||||
|
||||
/**
|
||||
* DEPRECATED: This method has no effect. IGraphicsTargets are not
|
||||
* responsible to drawing a colorbar. Use method drawColorRamp to draw a
|
||||
* color ramp
|
||||
*
|
||||
* Sets whether to display a builtin colorbar when displaying colormapped
|
||||
* images (Defaults to true)
|
||||
*
|
||||
|
@ -666,7 +687,6 @@ public interface IGraphicsTarget extends IImagingExtension {
|
|||
* boolean flag indicating whether to display the built in
|
||||
* colorbar
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract void setUseBuiltinColorbar(boolean isColorbarDisplayed);
|
||||
|
||||
/**
|
||||
|
@ -1024,7 +1044,6 @@ public interface IGraphicsTarget extends IImagingExtension {
|
|||
* @param extensionClass
|
||||
* @return
|
||||
*/
|
||||
public abstract <T extends IGraphicsExtensionInterface> T getExtension(
|
||||
Class<T> extensionClass) throws VizException;
|
||||
|
||||
public abstract <T> T getExtension(Class<T> extensionClass)
|
||||
throws VizException;
|
||||
}
|
||||
|
|
|
@ -19,13 +19,14 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.core;
|
||||
|
||||
import org.geotools.coverage.grid.GeneralGridGeometry;
|
||||
import org.geotools.coverage.grid.GridGeometry2D;
|
||||
import org.opengis.referencing.operation.MathTransform;
|
||||
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.drawables.IRenderable;
|
||||
import com.raytheon.uf.viz.core.rsc.hdf5.ImageTile;
|
||||
|
||||
/**
|
||||
* Base for any mesh 2D/3D, Quad/Triangle -- etc. See {@link PixelCoverage} /
|
||||
* {@link DrawableImage}
|
||||
* Base for any mesh 2D/3D, Quad/Triangle -- etc
|
||||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
|
@ -39,7 +40,27 @@ import com.raytheon.uf.viz.core.exception.VizException;
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public interface IMesh {
|
||||
public interface IMesh extends IRenderable {
|
||||
|
||||
/**
|
||||
* Calculate all the mesh vertices and texture coordinates
|
||||
*
|
||||
* @param pc
|
||||
* @param tile
|
||||
* @param toLatLon
|
||||
* translate the tile coordinates to lat/lon coords if the tile
|
||||
* envelope is not already
|
||||
*/
|
||||
public abstract void calculateMesh(PixelCoverage pc, ImageTile tile,
|
||||
MathTransform toLatLon);
|
||||
|
||||
/**
|
||||
* Calculate all the mesh vertices and texture coordinates
|
||||
*
|
||||
* @param pc
|
||||
* @param gg
|
||||
*/
|
||||
public void calculateMesh(PixelCoverage pc, GridGeometry2D gg);
|
||||
|
||||
/**
|
||||
* Dispose of the mesh data
|
||||
|
@ -52,12 +73,4 @@ public interface IMesh {
|
|||
* @param extent
|
||||
*/
|
||||
public boolean intersects(IExtent extent);
|
||||
|
||||
/**
|
||||
* Reprojects the mesh into the new target geometry
|
||||
*
|
||||
* @param targetGeometry
|
||||
*/
|
||||
public void reproject(GeneralGridGeometry targetGeometry)
|
||||
throws VizException;
|
||||
}
|
||||
|
|
|
@ -77,6 +77,8 @@ public class Colormapper {
|
|||
boolean log = parameters.isLogarithmic();
|
||||
double logFactor = parameters.getLogFactor();
|
||||
boolean mirror = parameters.isMirror();
|
||||
double naturalMin = parameters.getDataMin();
|
||||
double naturalMax = parameters.getDataMax();
|
||||
double cmapMin = parameters.getColorMapMin();
|
||||
double cmapMax = parameters.getColorMapMax();
|
||||
int colorMapSz = parameters.getColorMap().getSize();
|
||||
|
|
|
@ -34,6 +34,7 @@ import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
|||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
|
||||
import com.raytheon.uf.common.dataquery.requests.TimeQueryRequest;
|
||||
import com.raytheon.uf.common.dataquery.requests.TimeQueryRequestSet;
|
||||
import com.raytheon.uf.common.datastorage.Request;
|
||||
import com.raytheon.uf.common.datastorage.StorageException;
|
||||
import com.raytheon.uf.common.datastorage.records.IDataRecord;
|
||||
|
@ -41,7 +42,10 @@ import com.raytheon.uf.common.pointdata.PointDataContainer;
|
|||
import com.raytheon.uf.common.time.BinOffset;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.viz.core.catalog.LayerProperty;
|
||||
import com.raytheon.uf.viz.core.catalog.ScriptCreator;
|
||||
import com.raytheon.uf.viz.core.comm.Loader;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||
|
||||
/**
|
||||
* The DataCubeContainer is responsible for handling requests for data times,
|
||||
|
@ -97,7 +101,7 @@ public class DataCubeContainer {
|
|||
if (container.adapter != null) {
|
||||
synchronized (container.adapter) {
|
||||
Boolean initialized = initializedMap.get(container.adapter);
|
||||
if (initialized == null || !initialized) {
|
||||
if (!initialized) {
|
||||
container.adapter.initInventory();
|
||||
initializedMap.put(container.adapter, true);
|
||||
}
|
||||
|
@ -117,9 +121,21 @@ public class DataCubeContainer {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (adapter == null) {
|
||||
// Construct default adapter for plugin if none found
|
||||
adapter = new DefaultDataCubeAdapter(plugin);
|
||||
}
|
||||
|
||||
private IDataRecord[] getDataRecordInternal(PluginDataObject obj)
|
||||
throws VizDataCubeException {
|
||||
if (adapter != null) {
|
||||
return adapter.getRecord(obj);
|
||||
} else {
|
||||
IDataRecord record = null;
|
||||
try {
|
||||
record = CubeUtil.retrieveData(obj, pluginName);
|
||||
} catch (VizException e) {
|
||||
throw new VizDataCubeException(
|
||||
"Error retrieving 2D grid record.", e);
|
||||
}
|
||||
return new IDataRecord[] { record };
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -137,7 +153,23 @@ public class DataCubeContainer {
|
|||
*/
|
||||
public static IDataRecord[] getDataRecord(PluginDataObject obj)
|
||||
throws VizDataCubeException {
|
||||
return getInstance(obj.getPluginName()).adapter.getRecord(obj);
|
||||
return getInstance(obj.getPluginName()).getDataRecordInternal(obj);
|
||||
}
|
||||
|
||||
private IDataRecord[] getDataRecordInternal(PluginDataObject obj,
|
||||
Request req, String dataset) throws VizDataCubeException {
|
||||
if (adapter != null) {
|
||||
return adapter.getRecord(obj, req, dataset);
|
||||
} else {
|
||||
IDataRecord record = null;
|
||||
try {
|
||||
record = CubeUtil.retrieveData(obj, pluginName, req, dataset);
|
||||
} catch (VizException e) {
|
||||
throw new VizDataCubeException(
|
||||
"Error retrieving 2D grid record.", e);
|
||||
}
|
||||
return new IDataRecord[] { record };
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -156,10 +188,29 @@ public class DataCubeContainer {
|
|||
*/
|
||||
public static IDataRecord[] getDataRecord(PluginDataObject obj,
|
||||
Request req, String dataset) throws VizDataCubeException {
|
||||
return getInstance(obj.getPluginName()).adapter.getRecord(obj, req,
|
||||
return getInstance(obj.getPluginName()).getDataRecordInternal(obj, req,
|
||||
dataset);
|
||||
}
|
||||
|
||||
private void getDataRecordsInternal(List<PluginDataObject> objs,
|
||||
Request req, String dataset) throws VizDataCubeException {
|
||||
if (adapter != null) {
|
||||
adapter.getRecords(objs, req, dataset);
|
||||
} else {
|
||||
for (PluginDataObject obj : objs) {
|
||||
IDataRecord record = null;
|
||||
try {
|
||||
record = CubeUtil.retrieveData(obj, pluginName, req,
|
||||
dataset);
|
||||
} catch (VizException e) {
|
||||
throw new VizDataCubeException(
|
||||
"Error retrieving 2D grid record.", e);
|
||||
}
|
||||
obj.setMessageData(record);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* For each PluginDataObject requests the DataRecords specified by Request
|
||||
* and dataSet and stores those DataRecords in the PluginDataObject message
|
||||
|
@ -187,25 +238,41 @@ public class DataCubeContainer {
|
|||
"All PluginDataObjects must be for the same plugin");
|
||||
}
|
||||
}
|
||||
getInstance(pluginName).adapter.getRecords(objs, req, dataset);
|
||||
getInstance(pluginName).getDataRecordsInternal(objs, req, dataset);
|
||||
}
|
||||
|
||||
private PointDataContainer getPointDataInternal(String[] params,
|
||||
Map<String, RequestConstraint> map) throws VizException {
|
||||
if (adapter != null) {
|
||||
return adapter.getPoints(pluginName, params, map);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static PointDataContainer getPointData(String plugin,
|
||||
String[] params, Map<String, RequestConstraint> map)
|
||||
throws VizException {
|
||||
DataCubeContainer container = getInstance(plugin);
|
||||
return container.adapter.getPoints(container.pluginName, params, map);
|
||||
return getInstance(plugin).getPointDataInternal(params, map);
|
||||
}
|
||||
|
||||
private PointDataContainer getPointDataInternal(String[] params,
|
||||
String levelKey, Map<String, RequestConstraint> map)
|
||||
throws VizException {
|
||||
if (levelKey == null) {
|
||||
return getPointData(pluginName, params, map);
|
||||
}
|
||||
if (adapter != null) {
|
||||
return adapter.getPoints(pluginName, params, levelKey, map);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static PointDataContainer getPointData(String plugin,
|
||||
String[] params, String levelKey, Map<String, RequestConstraint> map)
|
||||
throws VizException {
|
||||
DataCubeContainer container = getInstance(plugin);
|
||||
if (levelKey == null) {
|
||||
return getPointData(container.pluginName, params, map);
|
||||
}
|
||||
return container.adapter.getPoints(container.pluginName, params,
|
||||
levelKey, map);
|
||||
return getInstance(plugin).getPointDataInternal(params, levelKey, map);
|
||||
}
|
||||
|
||||
public static DataTime[] performTimeQuery(
|
||||
|
@ -241,6 +308,20 @@ public class DataCubeContainer {
|
|||
new DataTime[0]);
|
||||
}
|
||||
|
||||
public List<List<DataTime>> performTimeQueriesInternal(
|
||||
List<TimeQueryRequest> requests) throws VizException {
|
||||
if (adapter == null) {
|
||||
TimeQueryRequestSet set = new TimeQueryRequestSet();
|
||||
set.setRequests(requests.toArray(new TimeQueryRequest[0]));
|
||||
@SuppressWarnings("unchecked")
|
||||
List<List<DataTime>> result = (List<List<DataTime>>) ThriftClient
|
||||
.sendRequest(set);
|
||||
return result;
|
||||
} else {
|
||||
return adapter.timeQuery(requests);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a bulk time query request when all requests have the same plugin
|
||||
* type.
|
||||
|
@ -253,7 +334,7 @@ public class DataCubeContainer {
|
|||
if (requests.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return getInstance(pluginName).adapter.timeQuery(requests);
|
||||
return getInstance(pluginName).performTimeQueriesInternal(requests);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -265,8 +346,8 @@ public class DataCubeContainer {
|
|||
*/
|
||||
public static List<List<DataTime>> performTimeQueries(String pluginName,
|
||||
TimeQueryRequest... requests) throws VizException {
|
||||
return getInstance(pluginName).adapter.timeQuery(Arrays
|
||||
.asList(requests));
|
||||
return getInstance(pluginName).performTimeQueriesInternal(
|
||||
Arrays.asList(requests));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -322,6 +403,17 @@ public class DataCubeContainer {
|
|||
return result;
|
||||
}
|
||||
|
||||
private synchronized List<Object> getDataInternal(LayerProperty property,
|
||||
int timeOut) throws VizException {
|
||||
if (adapter == null) {
|
||||
String scriptToExecute = ScriptCreator.createScript(property);
|
||||
return Loader
|
||||
.loadScripts(new String[] { scriptToExecute }, timeOut);
|
||||
} else {
|
||||
return adapter.getData(property, timeOut);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of responses for the requested layer property. If a
|
||||
* derived parameter, this will piece together the base parameteters.
|
||||
|
@ -340,11 +432,31 @@ public class DataCubeContainer {
|
|||
.getEntryQueryParameters(false);
|
||||
String pluginName = originalQuery.get("pluginName")
|
||||
.getConstraintValue();
|
||||
return getInstance(pluginName).adapter.getData(property, timeOut);
|
||||
return getInstance(pluginName).getDataInternal(property, timeOut);
|
||||
}
|
||||
|
||||
private Object getInventoryInternal() {
|
||||
if (adapter != null) {
|
||||
return adapter.getInventory();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static Object getInventory(String plugin) {
|
||||
return getInstance(plugin).adapter.getInventory();
|
||||
return getInstance(plugin).getInventoryInternal();
|
||||
}
|
||||
|
||||
private List<Map<String, RequestConstraint>> getBaseUpdateConstraintsInternal(
|
||||
Map<String, RequestConstraint> constraints) {
|
||||
if (adapter != null) {
|
||||
return adapter.getBaseUpdateConstraints(constraints);
|
||||
} else {
|
||||
List<Map<String, RequestConstraint>> result = new ArrayList<Map<String, RequestConstraint>>(
|
||||
1);
|
||||
result.add(constraints);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<Map<String, RequestConstraint>> getBaseUpdateConstraints(
|
||||
|
@ -355,8 +467,8 @@ public class DataCubeContainer {
|
|||
&& pluginRC.getConstraintType() == ConstraintType.EQUALS) {
|
||||
plugin = pluginRC.getConstraintValue();
|
||||
}
|
||||
return getInstance(plugin).adapter
|
||||
.getBaseUpdateConstraints(constraints);
|
||||
return getInstance(plugin)
|
||||
.getBaseUpdateConstraintsInternal(constraints);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,239 +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.core.datastructure;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
||||
import com.raytheon.uf.common.dataquery.requests.TimeQueryRequest;
|
||||
import com.raytheon.uf.common.dataquery.requests.TimeQueryRequestSet;
|
||||
import com.raytheon.uf.common.datastorage.Request;
|
||||
import com.raytheon.uf.common.datastorage.records.IDataRecord;
|
||||
import com.raytheon.uf.common.pointdata.PointDataContainer;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.viz.core.catalog.LayerProperty;
|
||||
import com.raytheon.uf.viz.core.catalog.ScriptCreator;
|
||||
import com.raytheon.uf.viz.core.comm.Loader;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||
|
||||
/**
|
||||
* Default implementation of IDataCubeAdapter, function implementations were
|
||||
* moved from DataCubeContainer into here
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 7, 2011 mschenke Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class DefaultDataCubeAdapter implements IDataCubeAdapter {
|
||||
|
||||
private String pluginName;
|
||||
|
||||
public DefaultDataCubeAdapter(String pluginName) {
|
||||
this.pluginName = pluginName;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#getSupportedPlugins
|
||||
* ()
|
||||
*/
|
||||
@Override
|
||||
public String[] getSupportedPlugins() {
|
||||
return new String[] { pluginName };
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#timeQuery(java
|
||||
* .util.List)
|
||||
*/
|
||||
@Override
|
||||
public List<List<DataTime>> timeQuery(List<TimeQueryRequest> requests)
|
||||
throws VizException {
|
||||
TimeQueryRequestSet set = new TimeQueryRequestSet();
|
||||
set.setRequests(requests.toArray(new TimeQueryRequest[0]));
|
||||
@SuppressWarnings("unchecked")
|
||||
List<List<DataTime>> result = (List<List<DataTime>>) ThriftClient
|
||||
.sendRequest(set);
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#getPoints(java
|
||||
* .lang.String, java.lang.String[], java.util.Map)
|
||||
*/
|
||||
@Override
|
||||
public PointDataContainer getPoints(String plugin, String[] parameters,
|
||||
Map<String, RequestConstraint> queryParams) throws VizException {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#getPoints(java
|
||||
* .lang.String, java.lang.String[], java.lang.String, java.util.Map)
|
||||
*/
|
||||
@Override
|
||||
public PointDataContainer getPoints(String plugin, String[] parameters,
|
||||
String levelKey, Map<String, RequestConstraint> queryParams)
|
||||
throws VizException {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#getRecord(com
|
||||
* .raytheon.uf.common.dataplugin.PluginDataObject)
|
||||
*/
|
||||
@Override
|
||||
public IDataRecord[] getRecord(PluginDataObject obj)
|
||||
throws VizDataCubeException {
|
||||
IDataRecord record = null;
|
||||
try {
|
||||
record = CubeUtil.retrieveData(obj, pluginName);
|
||||
} catch (VizException e) {
|
||||
throw new VizDataCubeException("Error retrieving 2D data record.",
|
||||
e);
|
||||
}
|
||||
return new IDataRecord[] { record };
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#getRecord(com
|
||||
* .raytheon.uf.common.dataplugin.PluginDataObject,
|
||||
* com.raytheon.uf.common.datastorage.Request, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public IDataRecord[] getRecord(PluginDataObject obj, Request req,
|
||||
String dataset) throws VizDataCubeException {
|
||||
IDataRecord record = null;
|
||||
try {
|
||||
record = CubeUtil.retrieveData(obj, pluginName, req, dataset);
|
||||
} catch (VizException e) {
|
||||
throw new VizDataCubeException("Error retrieving 2D data record.",
|
||||
e);
|
||||
}
|
||||
return new IDataRecord[] { record };
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#getRecords(java
|
||||
* .util.List, com.raytheon.uf.common.datastorage.Request, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void getRecords(List<PluginDataObject> objs, Request req,
|
||||
String dataset) throws VizDataCubeException {
|
||||
for (PluginDataObject obj : objs) {
|
||||
IDataRecord record = null;
|
||||
try {
|
||||
record = CubeUtil.retrieveData(obj, pluginName, req, dataset);
|
||||
} catch (VizException e) {
|
||||
throw new VizDataCubeException(
|
||||
"Error retrieving 2D grid record.", e);
|
||||
}
|
||||
obj.setMessageData(record);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#getData(com.raytheon
|
||||
* .uf.viz.core.catalog.LayerProperty, int)
|
||||
*/
|
||||
@Override
|
||||
public List<Object> getData(LayerProperty property, int timeOut)
|
||||
throws VizException {
|
||||
String scriptToExecute = ScriptCreator.createScript(property);
|
||||
return Loader.loadScripts(new String[] { scriptToExecute }, timeOut);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#initInventory()
|
||||
*/
|
||||
@Override
|
||||
public void initInventory() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#getInventory()
|
||||
*/
|
||||
@Override
|
||||
public Object getInventory() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#
|
||||
* getBaseUpdateConstraints(java.util.Map)
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, RequestConstraint>> getBaseUpdateConstraints(
|
||||
Map<String, RequestConstraint> constraints) {
|
||||
List<Map<String, RequestConstraint>> result = new ArrayList<Map<String, RequestConstraint>>(
|
||||
1);
|
||||
result.add(constraints);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
|
@ -145,6 +145,16 @@ public interface IDataCubeAdapter {
|
|||
public List<Object> getData(LayerProperty property, int timeOut)
|
||||
throws VizException;
|
||||
|
||||
/**
|
||||
* A simple method that will create a unique string based on the information
|
||||
* in the PluginDataObject passed in.
|
||||
*
|
||||
* @param pdo
|
||||
* The PDO to generate a unique name from
|
||||
* @return A string unique to that PDO
|
||||
*/
|
||||
public String recordKeyGenerator(PluginDataObject pdo);
|
||||
|
||||
/**
|
||||
* If the inventory for a particular data type is large (for example, Grib),
|
||||
* a call to this method should get a copy of that data type's inventory
|
||||
|
|
|
@ -31,22 +31,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||
|
||||
import org.geotools.coverage.grid.GeneralGridEnvelope;
|
||||
import org.geotools.coverage.grid.GeneralGridGeometry;
|
||||
import org.geotools.coverage.grid.GridGeometry2D;
|
||||
import org.geotools.geometry.GeneralEnvelope;
|
||||
import org.geotools.referencing.CRS;
|
||||
import org.geotools.referencing.operation.DefaultMathTransformFactory;
|
||||
import org.opengis.referencing.FactoryException;
|
||||
import org.opengis.referencing.crs.CoordinateReferenceSystem;
|
||||
import org.opengis.referencing.crs.GeneralDerivedCRS;
|
||||
import org.opengis.referencing.datum.PixelInCell;
|
||||
import org.opengis.referencing.operation.MathTransform;
|
||||
import org.opengis.referencing.operation.TransformException;
|
||||
|
||||
import com.raytheon.uf.common.serialization.adapters.GridGeometryAdapter;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
|
@ -54,7 +39,6 @@ import com.raytheon.uf.common.time.DataTime;
|
|||
import com.raytheon.uf.viz.core.AbstractTimeMatcher;
|
||||
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.VizConstants;
|
||||
import com.raytheon.uf.viz.core.datastructure.LoopProperties;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
@ -127,19 +111,6 @@ public abstract class AbstractDescriptor extends ResourceGroup implements
|
|||
/** The frame coordination object */
|
||||
protected IFrameCoordinator frameCoordinator;
|
||||
|
||||
private MathTransform worldToPixel;
|
||||
|
||||
private MathTransform pixelToWorld;
|
||||
|
||||
/** The spatial grid for the descriptor */
|
||||
private GeneralGridGeometry gridGeometry;
|
||||
|
||||
public AbstractDescriptor(GeneralGridGeometry gridGeometry) {
|
||||
this();
|
||||
this.gridGeometry = gridGeometry;
|
||||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
|
@ -225,8 +196,7 @@ public abstract class AbstractDescriptor extends ResourceGroup implements
|
|||
protected void preAddListener(ResourcePair rp)
|
||||
throws WrongProjectionException {
|
||||
|
||||
AbstractVizResource<?, AbstractDescriptor> resource = (AbstractVizResource<?, AbstractDescriptor>) rp
|
||||
.getResource();
|
||||
AbstractVizResource resource = rp.getResource();
|
||||
|
||||
resource.setDescriptor(this);
|
||||
|
||||
|
@ -684,119 +654,6 @@ public abstract class AbstractDescriptor extends ResourceGroup implements
|
|||
return frameCoordinator;
|
||||
}
|
||||
|
||||
private void init() {
|
||||
GeneralGridGeometry gridGeometry = getGridGeometry();
|
||||
MathTransform worldToCRS = getWorldToCRSTransform(gridGeometry);
|
||||
if (worldToCRS != null) {
|
||||
try {
|
||||
MathTransform crsToPixel = gridGeometry.getGridToCRS(
|
||||
PixelInCell.CELL_CENTER).inverse();
|
||||
worldToPixel = new DefaultMathTransformFactory()
|
||||
.createConcatenatedTransform(worldToCRS, crsToPixel);
|
||||
pixelToWorld = worldToPixel.inverse();
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error setting up Math Transforms,"
|
||||
+ " this descriptor may not work properly", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.drawables.IDescriptor#getCRS()
|
||||
*/
|
||||
@Override
|
||||
public final CoordinateReferenceSystem getCRS() {
|
||||
if (gridGeometry != null && gridGeometry.getEnvelope() != null) {
|
||||
return gridGeometry.getEnvelope().getCoordinateReferenceSystem();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.drawables.IDescriptor#getGridGeometry()
|
||||
*/
|
||||
@Override
|
||||
@XmlElement
|
||||
@XmlJavaTypeAdapter(value = GridGeometryAdapter.class)
|
||||
public final GeneralGridGeometry getGridGeometry() {
|
||||
return gridGeometry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the grid geometry
|
||||
*
|
||||
* @param gridGeometry
|
||||
* the gridGeometry to set
|
||||
* @throws VizException
|
||||
*/
|
||||
public void setGridGeometry(GeneralGridGeometry gridGeometry)
|
||||
throws VizException {
|
||||
this.gridGeometry = gridGeometry;
|
||||
init();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.drawables.IDescriptor#pixelToWorld(double[])
|
||||
*/
|
||||
@Override
|
||||
public final double[] pixelToWorld(double[] pixel) {
|
||||
double[] output = new double[3];
|
||||
double[] wpixel = pixel;
|
||||
|
||||
if (pixel.length == 2) {
|
||||
wpixel = new double[] { pixel[0], pixel[1], 0 };
|
||||
}
|
||||
|
||||
if (pixelToWorld != null) {
|
||||
try {
|
||||
pixelToWorld.transform(wpixel, 0, output, 0, 1);
|
||||
} catch (TransformException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
System.arraycopy(wpixel, 0, output, 0, wpixel.length);
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.drawables.IDescriptor#worldToPixel(double[])
|
||||
*/
|
||||
@Override
|
||||
public final double[] worldToPixel(double[] world) {
|
||||
double[] output = new double[3];
|
||||
double[] input = world;
|
||||
if (world.length == 2) {
|
||||
input = new double[] { world[0], world[1], 0 };
|
||||
}
|
||||
|
||||
if (worldToPixel != null) {
|
||||
try {
|
||||
worldToPixel.transform(input, 0, output, 0, 1);
|
||||
} catch (TransformException e) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
System.arraycopy(input, 0, output, 0, input.length);
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -826,40 +683,4 @@ public abstract class AbstractDescriptor extends ResourceGroup implements
|
|||
getFrameCoordinator().changeFrame(loopProperties);
|
||||
}
|
||||
|
||||
protected static GeneralGridGeometry createGridGeometry(IExtent extent,
|
||||
CoordinateReferenceSystem crs) {
|
||||
GeneralEnvelope envelope = new GeneralEnvelope(2);
|
||||
envelope.setRange(0, extent.getMinX(), extent.getMaxX());
|
||||
envelope.setRange(1, extent.getMinY(), extent.getMaxY());
|
||||
envelope.setCoordinateReferenceSystem(crs);
|
||||
return new GridGeometry2D(
|
||||
new GeneralGridEnvelope(new int[] { 0, 0 }, new int[] {
|
||||
(int) extent.getWidth(), (int) extent.getHeight() },
|
||||
false), envelope);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the world to CRS transform used for {@link #worldToPixel(double[])}
|
||||
* and {@link #pixelToWorld(double[])}
|
||||
*
|
||||
* @param gridGeometry
|
||||
* @return The world to gridGeometry CRS transform or null if there is none
|
||||
*/
|
||||
public static MathTransform getWorldToCRSTransform(
|
||||
GeneralGridGeometry gridGeometry) {
|
||||
CoordinateReferenceSystem crs = gridGeometry.getEnvelope()
|
||||
.getCoordinateReferenceSystem();
|
||||
if (crs instanceof GeneralDerivedCRS) {
|
||||
GeneralDerivedCRS projCRS = (GeneralDerivedCRS) crs;
|
||||
CoordinateReferenceSystem worldCRS = projCRS.getBaseCRS();
|
||||
try {
|
||||
return CRS.findMathTransform(worldCRS, crs);
|
||||
} catch (FactoryException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error setting up Math Transforms,"
|
||||
+ " this descriptor may not work properly", e);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -206,8 +206,8 @@ public class ColorMapLoader {
|
|||
ColorMap cm = (ColorMap) SerializationUtil
|
||||
.jaxbUnmarshalFromXmlFile(colorMapFile.getFile()
|
||||
.getAbsolutePath());
|
||||
|
||||
cm.setName(name);
|
||||
cm.setChanged(false);
|
||||
return cm;
|
||||
} else {
|
||||
return null;
|
||||
|
|
|
@ -22,8 +22,6 @@ package com.raytheon.uf.viz.core.drawables;
|
|||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.measure.converter.UnitConverter;
|
||||
import javax.measure.unit.Unit;
|
||||
|
@ -118,7 +116,7 @@ public class ColorMapParameters implements Cloneable, ISerializableObject {
|
|||
|
||||
}
|
||||
|
||||
protected Set<IColorMapParametersListener> listeners = new HashSet<IColorMapParametersListener>();
|
||||
protected IColorMapParametersListener listener;
|
||||
|
||||
/** Units of the colormap parameters (min/max) */
|
||||
protected Unit<?> displayUnit;
|
||||
|
@ -716,19 +714,13 @@ public class ColorMapParameters implements Cloneable, ISerializableObject {
|
|||
}
|
||||
|
||||
private void notifyListener() {
|
||||
for (IColorMapParametersListener listener : listeners) {
|
||||
if (listener != null) {
|
||||
listener.colorMapChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public void addListener(IColorMapParametersListener listener) {
|
||||
if (listener != null) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeListener(IColorMapParametersListener listener) {
|
||||
listeners.remove(listener);
|
||||
public void setListener(IColorMapParametersListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
public void setAlphaMask(byte[] alphaMask) {
|
||||
|
@ -749,8 +741,8 @@ public class ColorMapParameters implements Cloneable, ISerializableObject {
|
|||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
if (listeners.size() > 0) {
|
||||
return listeners.hashCode();
|
||||
if (listener != null) {
|
||||
return listener.hashCode();
|
||||
} else if (colorMap != null) {
|
||||
return colorMap.hashCode();
|
||||
} else {
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
|
||||
package com.raytheon.uf.viz.core.drawables;
|
||||
|
||||
import com.raytheon.uf.viz.core.drawables.ext.IImagingExtension;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
||||
/**
|
||||
* Describes a generic Image resource. The IImage resource is an interface
|
||||
* handle to an image. The image resource manages the lifecycle of the
|
||||
|
@ -66,11 +63,6 @@ public interface IImage {
|
|||
UNLOADED, STAGED, LOADED, LOADING, FAILED, INVALID
|
||||
};
|
||||
|
||||
/**
|
||||
* Stages any data required for the image to load/draw
|
||||
*/
|
||||
public abstract void stage() throws VizException;
|
||||
|
||||
/**
|
||||
* @return the status
|
||||
*/
|
||||
|
@ -114,10 +106,4 @@ public interface IImage {
|
|||
*/
|
||||
public abstract void setContrast(float contrast);
|
||||
|
||||
/**
|
||||
* Gets the extension class for this image
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public abstract Class<? extends IImagingExtension> getExtensionClass();
|
||||
}
|
|
@ -1,143 +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.core.drawables;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.viz.core.DrawableImage;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget.RasterMode;
|
||||
import com.raytheon.uf.viz.core.drawables.IImage.Status;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.IImagingExtension;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.TextureLoader;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
||||
/**
|
||||
* Support class for rendering images to a target
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 13, 2012 mschenke Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class ImagingSupport {
|
||||
|
||||
protected static final TextureLoader textureLoader = TextureLoader
|
||||
.getInstance();
|
||||
|
||||
/**
|
||||
* Prepares images for painting by staging and/or targeting the image
|
||||
*
|
||||
* @param target
|
||||
* @param images
|
||||
* @throws VizException
|
||||
*/
|
||||
public static void prepareImages(IGraphicsTarget target,
|
||||
DrawableImage... images) throws VizException {
|
||||
for (DrawableImage di : images) {
|
||||
IImage image = di.getImage();
|
||||
RasterMode mode = di.getMode();
|
||||
|
||||
if (image.getStatus() != Status.LOADED
|
||||
&& image.getStatus() != Status.STAGED) {
|
||||
if (mode == RasterMode.ASYNCHRONOUS) {
|
||||
textureLoader.requestLoad(image);
|
||||
target.setNeedsRefresh(true);
|
||||
} else if (mode == RasterMode.SYNCHRONOUS) {
|
||||
image.stage();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Routes the images to be rendered by their proper extensions, expects
|
||||
* images have already been "prepared" (Status=STAGED)
|
||||
*
|
||||
* @param target
|
||||
* @param paintProps
|
||||
* @param images
|
||||
* @return
|
||||
* @throws VizException
|
||||
*/
|
||||
public static boolean routeImages(IGraphicsTarget target,
|
||||
PaintProperties paintProps, DrawableImage[] images)
|
||||
throws VizException {
|
||||
boolean rval = true;
|
||||
boolean skipped = false;
|
||||
List<DrawableImage> bulk = new ArrayList<DrawableImage>();
|
||||
Class<? extends IImagingExtension> lastExt = null;
|
||||
for (DrawableImage di : images) {
|
||||
IImage image = di.getImage();
|
||||
IImage.Status imageSts = image.getStatus();
|
||||
if (imageSts == IImage.Status.LOADED
|
||||
|| imageSts == IImage.Status.STAGED) {
|
||||
Class<? extends IImagingExtension> imageExt = image
|
||||
.getExtensionClass();
|
||||
if (imageExt.equals(lastExt) == false && bulk.size() > 0) {
|
||||
DrawableImage[] extImages = bulk
|
||||
.toArray(new DrawableImage[bulk.size()]);
|
||||
// Render what we have
|
||||
IImagingExtension impl = target.getExtension(lastExt);
|
||||
rval &= impl.drawRasters(paintProps, extImages);
|
||||
bulk.clear();
|
||||
}
|
||||
|
||||
bulk.add(di);
|
||||
lastExt = imageExt;
|
||||
} else {
|
||||
skipped = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (bulk.size() > 0) {
|
||||
// Render what is left
|
||||
IImagingExtension impl = target.getExtension(lastExt);
|
||||
rval &= impl.drawRasters(paintProps,
|
||||
bulk.toArray(new DrawableImage[bulk.size()]));
|
||||
}
|
||||
|
||||
return rval & skipped;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares the images, then routes them for rendering
|
||||
*
|
||||
* @param paintProps
|
||||
* @param images
|
||||
* @return
|
||||
*/
|
||||
public static boolean drawRasters(IGraphicsTarget target,
|
||||
PaintProperties paintProps, DrawableImage[] images)
|
||||
throws VizException {
|
||||
prepareImages(target, images);
|
||||
return routeImages(target, paintProps, images);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
package com.raytheon.uf.viz.core.drawables;
|
||||
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
|
||||
public class SingleColorImage implements IImage {
|
||||
|
||||
private IImage image = null;
|
||||
|
||||
private RGB color = null;
|
||||
|
||||
public IImage getWrappedImage() {
|
||||
return image;
|
||||
}
|
||||
|
||||
public void setWrappedImage(IImage image) {
|
||||
this.image = image;
|
||||
}
|
||||
|
||||
public void setColor(RGB color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public RGB getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public SingleColorImage(IImage image) {
|
||||
this.image = image;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Status getStatus() {
|
||||
return image.getStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInterpolated(boolean isInterpolated) {
|
||||
image.setInterpolated(isInterpolated);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
image.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return image.getWidth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return image.getHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBrightness(float brightness) {
|
||||
image.setBrightness(brightness);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContrast(float contrast) {
|
||||
image.setContrast(contrast);
|
||||
}
|
||||
|
||||
}
|
|
@ -40,22 +40,15 @@ import com.raytheon.uf.viz.core.IGraphicsTarget;
|
|||
*/
|
||||
public abstract class GraphicsExtension<T extends IGraphicsTarget> {
|
||||
|
||||
/**
|
||||
* Interface that other interfaces should extend if they want to be used as
|
||||
* a graphics extension
|
||||
*/
|
||||
public static interface IGraphicsExtensionInterface {
|
||||
public static enum Compatibilty {
|
||||
INCOMPATIBLE(-1), GENERIC(0), TARGET_COMPATIBLE(1000), ENHANCED_TARGET_COMPATIBLE(
|
||||
2000);
|
||||
|
||||
}
|
||||
public int value;
|
||||
|
||||
public static class Compatibilty {
|
||||
public static final int INCOMPATIBLE = -1;
|
||||
|
||||
public static final int GENERIC = 0;
|
||||
|
||||
public static final int TARGET_COMPATIBLE = 1000;
|
||||
|
||||
public static final int ENHANCED_TARGET_COMPATIBLE = 2000;
|
||||
private Compatibilty(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected T target;
|
||||
|
@ -76,19 +69,12 @@ public abstract class GraphicsExtension<T extends IGraphicsTarget> {
|
|||
public final int setTarget(IGraphicsTarget target) {
|
||||
try {
|
||||
this.target = (T) target;
|
||||
return getCompatibilityValue(this.target);
|
||||
} catch (ClassCastException e) {
|
||||
this.target = null;
|
||||
return Compatibilty.INCOMPATIBLE;
|
||||
return Compatibilty.INCOMPATIBLE.value;
|
||||
}
|
||||
return getCompatibilityValue(this.target);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the target compability value.
|
||||
*
|
||||
* @param target
|
||||
* @return
|
||||
*/
|
||||
public abstract int getCompatibilityValue(T target);
|
||||
|
||||
/**
|
||||
|
|
|
@ -15,7 +15,6 @@ 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.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.GraphicsExtension.IGraphicsExtensionInterface;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
||||
public class GraphicsExtensionManager {
|
||||
|
@ -68,8 +67,8 @@ public class GraphicsExtensionManager {
|
|||
* @return
|
||||
* @throws VizException
|
||||
*/
|
||||
public synchronized <T extends IGraphicsExtensionInterface> T getExtension(
|
||||
Class<T> extensionClass) throws VizException {
|
||||
public synchronized <T> T getExtension(Class<T> extensionClass)
|
||||
throws VizException {
|
||||
if (cached.containsKey(extensionClass)) {
|
||||
return extensionClass.cast(cached.get(extensionClass));
|
||||
}
|
||||
|
@ -77,14 +76,10 @@ public class GraphicsExtensionManager {
|
|||
int bestVal = -1;
|
||||
for (Class<?> eClass : extensions) {
|
||||
if (extensionClass.isAssignableFrom(eClass)) {
|
||||
GraphicsExtension<?> graphicsExt;
|
||||
try {
|
||||
GraphicsExtension<?> graphicsExt = GraphicsExtension.class.cast(eClass
|
||||
graphicsExt = GraphicsExtension.class.cast(eClass
|
||||
.newInstance());
|
||||
int val = graphicsExt.setTarget(target);
|
||||
if (val > bestVal) {
|
||||
bestVal = val;
|
||||
bestExt = extensionClass.cast(graphicsExt);
|
||||
}
|
||||
} catch (InstantiationException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
|
@ -94,6 +89,11 @@ public class GraphicsExtensionManager {
|
|||
e.getLocalizedMessage(), e);
|
||||
continue;
|
||||
}
|
||||
int val = graphicsExt.setTarget(target);
|
||||
if (val > bestVal) {
|
||||
bestVal = val;
|
||||
bestExt = extensionClass.cast(graphicsExt);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bestExt != null) {
|
||||
|
|
|
@ -4,11 +4,9 @@ import java.nio.Buffer;
|
|||
|
||||
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
||||
import com.raytheon.uf.viz.core.drawables.IImage;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.GraphicsExtension.IGraphicsExtensionInterface;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
||||
public interface IOffscreenRenderingExtension extends
|
||||
IGraphicsExtensionInterface {
|
||||
public interface IOffscreenRenderingExtension {
|
||||
/**
|
||||
* All drawing between a call to renderOffscreen and the next call to
|
||||
* renderOnscreen will be drawn to offscreenImage rather than to the screen.
|
||||
|
|
|
@ -1,129 +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.core.drawables.ext;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.ui.services.IDisposable;
|
||||
|
||||
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.Activator;
|
||||
import com.raytheon.uf.viz.core.drawables.IImage;
|
||||
import com.raytheon.uf.viz.core.jobs.JobPool;
|
||||
|
||||
/**
|
||||
* Class that loads data for AbstractGLImages asynchronously
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 7/1/06 chammack Initial Creation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author chammack
|
||||
*
|
||||
*/
|
||||
public class TextureLoader {
|
||||
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(TextureLoader.class);
|
||||
|
||||
/** The instance */
|
||||
private static TextureLoader instance;
|
||||
|
||||
private JobPool loaderPool;
|
||||
|
||||
private List<IImage> texturesToLoad;
|
||||
|
||||
/**
|
||||
* Get the currently running instance of the texture loader
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static synchronized TextureLoader getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new TextureLoader();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use getInstance() instead of constructor
|
||||
*
|
||||
*/
|
||||
private TextureLoader() {
|
||||
this.texturesToLoad = new ArrayList<IImage>();
|
||||
this.loaderPool = new JobPool("Texture Loader", Runtime.getRuntime()
|
||||
.availableProcessors(), true);
|
||||
// Make sure we get shutdown properly
|
||||
Activator.getDefault().registerDisposable(new IDisposable() {
|
||||
@Override
|
||||
public void dispose() {
|
||||
shutdown();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Request an image to be loaded
|
||||
*
|
||||
* @param img
|
||||
* the image
|
||||
*/
|
||||
public void requestLoad(final IImage img) {
|
||||
if (!texturesToLoad.contains(img)) {
|
||||
texturesToLoad.add(img);
|
||||
loaderPool.schedule(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
try {
|
||||
img.stage();
|
||||
} catch (Throwable t) {
|
||||
statusHandler.handle(
|
||||
Priority.PROBLEM,
|
||||
"Error staging texture: "
|
||||
+ t.getLocalizedMessage(), t);
|
||||
}
|
||||
} finally {
|
||||
texturesToLoad.remove(img);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Request the job to be shut down
|
||||
*
|
||||
*/
|
||||
public void shutdown() {
|
||||
loaderPool.cancel();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,240 +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.core.drawables.ext.colormap;
|
||||
|
||||
import java.awt.image.RenderedImage;
|
||||
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.data.IColorMapDataRetrievalCallback;
|
||||
import com.raytheon.uf.viz.core.data.IColorMapDataRetrievalCallback.ColorMapData;
|
||||
import com.raytheon.uf.viz.core.data.IRenderedImageCallback;
|
||||
import com.raytheon.uf.viz.core.data.prep.Colormapper;
|
||||
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
||||
import com.raytheon.uf.viz.core.drawables.IColorMapParametersListener;
|
||||
import com.raytheon.uf.viz.core.drawables.IColormappedImage;
|
||||
import com.raytheon.uf.viz.core.drawables.IImage;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.IImagingExtension;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
||||
/**
|
||||
* General colormapped image, regenerates image if parameters change
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 16, 2011 mschenke Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class ColormappedImage implements IColormappedImage,
|
||||
IRenderedImageCallback, IColorMapParametersListener {
|
||||
|
||||
private IImage image;
|
||||
|
||||
private IColorMapDataRetrievalCallback callback;
|
||||
|
||||
private ColorMapParameters parameters;
|
||||
|
||||
public ColormappedImage(IGraphicsTarget target,
|
||||
IColorMapDataRetrievalCallback callback,
|
||||
ColorMapParameters parameters) {
|
||||
this.callback = callback;
|
||||
setColorMapParameters(parameters);
|
||||
image = target.initializeRaster(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the wrapped image for the colormapped image
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public IImage getWrappedImage() {
|
||||
return image;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.drawables.IImage#getStatus()
|
||||
*/
|
||||
@Override
|
||||
public Status getStatus() {
|
||||
return image.getStatus();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.drawables.IImage#setInterpolated(boolean)
|
||||
*/
|
||||
@Override
|
||||
public void setInterpolated(boolean isInterpolated) {
|
||||
image.setInterpolated(isInterpolated);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.drawables.IImage#dispose()
|
||||
*/
|
||||
@Override
|
||||
public void dispose() {
|
||||
if (image != null) {
|
||||
image.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.drawables.IImage#getWidth()
|
||||
*/
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return image.getWidth();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.drawables.IImage#getHeight()
|
||||
*/
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return image.getHeight();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.drawables.IImage#setBrightness(float)
|
||||
*/
|
||||
@Override
|
||||
public void setBrightness(float brightness) {
|
||||
image.setBrightness(brightness);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.drawables.IImage#setContrast(float)
|
||||
*/
|
||||
@Override
|
||||
public void setContrast(float contrast) {
|
||||
image.setContrast(contrast);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.drawables.IImage#getExtensionClass()
|
||||
*/
|
||||
@Override
|
||||
public Class<? extends IImagingExtension> getExtensionClass() {
|
||||
return GeneralColormappedImageExtension.class;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.drawables.IColormappedImage#getColorMapParameters
|
||||
* ()
|
||||
*/
|
||||
@Override
|
||||
public ColorMapParameters getColorMapParameters() {
|
||||
return parameters;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.drawables.IColormappedImage#setColorMapParameters
|
||||
* (com.raytheon.uf.viz.core.drawables.ColorMapParameters)
|
||||
*/
|
||||
@Override
|
||||
public void setColorMapParameters(ColorMapParameters params) {
|
||||
if (params != this.parameters) {
|
||||
if (this.parameters != null) {
|
||||
this.parameters.removeListener(this);
|
||||
}
|
||||
this.parameters = params;
|
||||
if (this.parameters != null) {
|
||||
this.parameters.addListener(this);
|
||||
}
|
||||
dispose();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.drawables.IColormappedImage#getValue(int,
|
||||
* int)
|
||||
*/
|
||||
@Override
|
||||
public double getValue(int x, int y) {
|
||||
return Double.NaN;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.data.IRenderedImageCallback#getImage()
|
||||
*/
|
||||
@Override
|
||||
public RenderedImage getImage() throws VizException {
|
||||
if (parameters == null || parameters.getColorMap() == null) {
|
||||
return null;
|
||||
}
|
||||
ColorMapData colorMapData = callback.getColorMapData();
|
||||
return Colormapper.colorMap(colorMapData, parameters);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.drawables.IColorMapParametersListener#
|
||||
* colorMapChanged()
|
||||
*/
|
||||
@Override
|
||||
public void colorMapChanged() {
|
||||
dispose();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.drawables.IImage#stage()
|
||||
*/
|
||||
@Override
|
||||
public void stage() throws VizException {
|
||||
image.stage();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
/**
|
||||
* 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.core.drawables.ext.colormap;
|
||||
|
||||
import java.awt.image.RenderedImage;
|
||||
|
||||
import com.raytheon.uf.viz.core.data.IColorMapDataRetrievalCallback;
|
||||
import com.raytheon.uf.viz.core.data.IColorMapDataRetrievalCallback.ColorMapData;
|
||||
import com.raytheon.uf.viz.core.data.IRenderedImageCallback;
|
||||
import com.raytheon.uf.viz.core.data.prep.Colormapper;
|
||||
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
||||
/**
|
||||
* General {@link IRenderedImageCallback} that takes a
|
||||
* {@link IColorMapDataRetrievalCallback} and {@link ColorMapParameters} and
|
||||
* will colormap the data returned from the callback into a
|
||||
* {@link RenderedImage}
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 22, 2011 mschenke Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class ColormappedRenderedImageCallback implements IRenderedImageCallback {
|
||||
|
||||
private IColorMapDataRetrievalCallback callback;
|
||||
|
||||
private ColorMapParameters parameters;
|
||||
|
||||
/**
|
||||
* Construct a ColormappedRenderedImageCallback for the colormap data
|
||||
* callback and parameters
|
||||
*
|
||||
* @param dataCallback
|
||||
* @param parameters
|
||||
*/
|
||||
public ColormappedRenderedImageCallback(
|
||||
IColorMapDataRetrievalCallback dataCallback,
|
||||
ColorMapParameters parameters) {
|
||||
this.callback = dataCallback;
|
||||
this.parameters = parameters;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.data.IRenderedImageCallback#getImage()
|
||||
*/
|
||||
@Override
|
||||
public RenderedImage getImage() throws VizException {
|
||||
ColorMapData colorMapData = callback.getColorMapData();
|
||||
return Colormapper.colorMap(colorMapData, parameters);
|
||||
}
|
||||
}
|
|
@ -19,17 +19,11 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.core.drawables.ext.colormap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.viz.core.DrawableImage;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.data.IColorMapDataRetrievalCallback;
|
||||
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
||||
import com.raytheon.uf.viz.core.drawables.IColormappedImage;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
import com.raytheon.uf.viz.core.drawables.IImage;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.GraphicsExtension;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
||||
/**
|
||||
* General colormapped image extension. Uses
|
||||
|
@ -62,10 +56,10 @@ public class GeneralColormappedImageExtension extends
|
|||
* com.raytheon.uf.viz.core.drawables.ColorMapParameters)
|
||||
*/
|
||||
@Override
|
||||
public IColormappedImage initializeRaster(
|
||||
IColorMapDataRetrievalCallback dataCallback,
|
||||
public IImage initializeRaster(IColorMapDataRetrievalCallback dataCallback,
|
||||
ColorMapParameters colorMapParameters) {
|
||||
return new ColormappedImage(target, dataCallback, colorMapParameters);
|
||||
return target.initializeRaster(new ColormappedRenderedImageCallback(
|
||||
dataCallback, colorMapParameters));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -76,29 +70,7 @@ public class GeneralColormappedImageExtension extends
|
|||
*/
|
||||
@Override
|
||||
public int getCompatibilityValue(IGraphicsTarget target) {
|
||||
return Compatibilty.GENERIC;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.drawables.ext.IImagingExtension#drawRasters(
|
||||
* com.raytheon.uf.viz.core.drawables.PaintProperties,
|
||||
* com.raytheon.uf.viz.core.DrawableImage[])
|
||||
*/
|
||||
@Override
|
||||
public boolean drawRasters(PaintProperties paintProps,
|
||||
DrawableImage... images) throws VizException {
|
||||
List<DrawableImage> renderables = new ArrayList<DrawableImage>();
|
||||
for (DrawableImage di : images) {
|
||||
if (di.getImage() instanceof ColormappedImage) {
|
||||
renderables.add(new DrawableImage(((ColormappedImage) di
|
||||
.getImage()).getWrappedImage(), di.getCoverage()));
|
||||
}
|
||||
}
|
||||
return target.drawRasters(paintProps,
|
||||
renderables.toArray(new DrawableImage[renderables.size()]));
|
||||
return Compatibilty.GENERIC.value;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ import org.eclipse.swt.graphics.RGB;
|
|||
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
import com.raytheon.uf.viz.core.drawables.IShadedShape;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.GraphicsExtension.IGraphicsExtensionInterface;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
import com.vividsolutions.jts.geom.LineString;
|
||||
|
@ -54,8 +53,7 @@ import com.vividsolutions.jts.geom.LineString;
|
|||
* @author bsteffen
|
||||
* @version 1.0
|
||||
*/
|
||||
public interface IColormapShadedShapeExtension extends
|
||||
IGraphicsExtensionInterface {
|
||||
public interface IColormapShadedShapeExtension {
|
||||
|
||||
public interface IColormapShadedShape {
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ package com.raytheon.uf.viz.core.drawables.ext.colormap;
|
|||
import com.raytheon.uf.viz.core.data.IColorMapDataRetrievalCallback;
|
||||
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
||||
import com.raytheon.uf.viz.core.drawables.IColormappedImage;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.IImagingExtension;
|
||||
import com.raytheon.uf.viz.core.drawables.IImage;
|
||||
|
||||
/**
|
||||
* Extension for creating {@link IColormappedImage} objects
|
||||
|
@ -41,7 +41,7 @@ import com.raytheon.uf.viz.core.drawables.ext.IImagingExtension;
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public interface IColormappedImageExtension extends IImagingExtension {
|
||||
public interface IColormappedImageExtension {
|
||||
|
||||
/**
|
||||
* Initializes an IColormappedImage given the dataCallback and colormap
|
||||
|
@ -51,7 +51,6 @@ public interface IColormappedImageExtension extends IImagingExtension {
|
|||
* @param colorMapParameters
|
||||
* @return
|
||||
*/
|
||||
public IColormappedImage initializeRaster(
|
||||
IColorMapDataRetrievalCallback dataCallback,
|
||||
public IImage initializeRaster(IColorMapDataRetrievalCallback dataCallback,
|
||||
ColorMapParameters colorMapParameters);
|
||||
}
|
||||
|
|
|
@ -19,12 +19,7 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.core.map;
|
||||
|
||||
import org.geotools.coverage.grid.GeneralGridGeometry;
|
||||
import org.geotools.coverage.grid.GridGeometry2D;
|
||||
|
||||
import com.raytheon.uf.viz.core.IMesh;
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.GraphicsExtension.IGraphicsExtensionInterface;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
||||
/**
|
||||
|
@ -44,31 +39,17 @@ import com.raytheon.uf.viz.core.exception.VizException;
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public interface IMapMeshExtension extends IGraphicsExtensionInterface {
|
||||
public interface IMapMeshExtension {
|
||||
|
||||
/**
|
||||
* Constructs a mesh for mapping the imageGeometry onto the targetGeometry
|
||||
* Create a mesh
|
||||
*
|
||||
* @param descriptor
|
||||
*
|
||||
* @param imageGeometry
|
||||
* @param targetGeometry
|
||||
* @return
|
||||
* @throws VizException
|
||||
*/
|
||||
public abstract IMesh constructMesh(GridGeometry2D imageGeometry,
|
||||
GeneralGridGeometry targetGeometry) throws VizException;
|
||||
|
||||
/**
|
||||
* Convenient method for constructing a mesh for mapping the imageGeometry
|
||||
* onto the targetDescriptor. Same as calling
|
||||
* {@link #constructMesh(GridGeometry2D, GeneralGridGeometry)} passing in
|
||||
* target.getGridGeometry()
|
||||
*
|
||||
* @param imageGeometry
|
||||
* @param targetDescriptor
|
||||
* @return
|
||||
* @throws VizException
|
||||
*/
|
||||
public abstract IMesh constructMesh(GridGeometry2D imageGeometry,
|
||||
IDescriptor targetDescriptor) throws VizException;
|
||||
public abstract IMesh constructMesh(IMapDescriptor descriptor)
|
||||
throws VizException;
|
||||
|
||||
}
|
||||
|
|
|
@ -26,7 +26,9 @@ import java.util.ArrayList;
|
|||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
import org.geotools.coverage.grid.GeneralGridEnvelope;
|
||||
|
@ -34,16 +36,23 @@ import org.geotools.coverage.grid.GeneralGridGeometry;
|
|||
import org.geotools.coverage.grid.GridGeometry2D;
|
||||
import org.geotools.geometry.DirectPosition2D;
|
||||
import org.geotools.geometry.GeneralEnvelope;
|
||||
import org.geotools.referencing.CRS;
|
||||
import org.geotools.referencing.GeodeticCalculator;
|
||||
import org.geotools.referencing.crs.DefaultGeocentricCRS;
|
||||
import org.geotools.referencing.crs.DefaultGeographicCRS;
|
||||
import org.geotools.referencing.operation.DefaultMathTransformFactory;
|
||||
import org.opengis.geometry.DirectPosition;
|
||||
import org.opengis.referencing.FactoryException;
|
||||
import org.opengis.referencing.crs.CoordinateReferenceSystem;
|
||||
import org.opengis.referencing.datum.PixelInCell;
|
||||
import org.opengis.referencing.operation.MathTransform;
|
||||
import org.opengis.referencing.operation.MathTransformFactory;
|
||||
import org.opengis.referencing.operation.TransformException;
|
||||
|
||||
import com.raytheon.uf.common.geospatial.CRSCache;
|
||||
import com.raytheon.uf.common.geospatial.MapUtil;
|
||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||
import com.raytheon.uf.common.serialization.adapters.GridGeometryAdapter;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
|
@ -187,12 +196,24 @@ public class MapDescriptor extends AbstractDescriptor implements
|
|||
return gridGeom;
|
||||
}
|
||||
|
||||
/** The transform from lat/lon to the current CRS */
|
||||
protected MathTransform coordinateTransform;
|
||||
|
||||
/** The transform from the current CRS to lat/lon */
|
||||
protected MathTransform inverseCoordinateTransform;
|
||||
|
||||
/** The mapping from grid to coordinate */
|
||||
protected MathTransform mapToCoordinateTransform;
|
||||
|
||||
/** The mapping from coordinate to grid */
|
||||
protected MathTransform coordinateToMapTransform;
|
||||
|
||||
/** The mapping from wgs84 to grid */
|
||||
protected MathTransform wgsToGridTransform;
|
||||
|
||||
/** The mapping from grid to wgs84 */
|
||||
protected MathTransform gridToWGSTransform;
|
||||
|
||||
/** The time in ms that the last blink state was used */
|
||||
protected long timeLastBlink;
|
||||
|
||||
|
@ -208,6 +229,9 @@ public class MapDescriptor extends AbstractDescriptor implements
|
|||
*/
|
||||
protected int mapWidth;
|
||||
|
||||
/** The geospatial descriptor for the grid */
|
||||
protected GeneralGridGeometry gridGeometry;
|
||||
|
||||
/** elevation exaggeration */
|
||||
protected double elevationExageration = 0;
|
||||
|
||||
|
@ -218,6 +242,8 @@ public class MapDescriptor extends AbstractDescriptor implements
|
|||
LAT_LON_FORMATTER.setMaximumFractionDigits(2);
|
||||
}
|
||||
|
||||
private String cloudSourceName;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
|
@ -248,26 +274,49 @@ public class MapDescriptor extends AbstractDescriptor implements
|
|||
*
|
||||
*/
|
||||
public MapDescriptor(GeneralGridGeometry gridGeometry) throws VizException {
|
||||
super(gridGeometry);
|
||||
super();
|
||||
|
||||
this.gridGeometry = gridGeometry;
|
||||
init();
|
||||
}
|
||||
|
||||
protected void init() throws VizException {
|
||||
MathTransformFactory mtf = new DefaultMathTransformFactory();
|
||||
|
||||
try {
|
||||
GeneralGridGeometry gridGeometry = getGridGeometry();
|
||||
mapToCoordinateTransform = gridGeometry
|
||||
|
||||
mapToCoordinateTransform = this.gridGeometry
|
||||
.getGridToCRS(PixelInCell.CELL_CENTER);
|
||||
coordinateToMapTransform = mapToCoordinateTransform.inverse();
|
||||
CoordinateReferenceSystem descriptorCRS = this.gridGeometry
|
||||
.getCoordinateReferenceSystem();
|
||||
if (descriptorCRS.toWKT().equals(
|
||||
DefaultGeocentricCRS.CARTESIAN.toWKT())) {
|
||||
inverseCoordinateTransform = CRS.findMathTransform(
|
||||
descriptorCRS, DefaultGeographicCRS.WGS84_3D);
|
||||
|
||||
CoordinateReferenceSystem crs = gridGeometry
|
||||
coordinateTransform = inverseCoordinateTransform.inverse();
|
||||
|
||||
} else {
|
||||
inverseCoordinateTransform = CRSCache.getInstance()
|
||||
.getTransformToLatLon(descriptorCRS);
|
||||
coordinateTransform = inverseCoordinateTransform.inverse();
|
||||
}
|
||||
|
||||
wgsToGridTransform = mtf.createConcatenatedTransform(
|
||||
coordinateTransform, coordinateToMapTransform);
|
||||
gridToWGSTransform = mtf.createConcatenatedTransform(
|
||||
mapToCoordinateTransform, inverseCoordinateTransform);
|
||||
|
||||
CoordinateReferenceSystem crs = this.gridGeometry
|
||||
.getCoordinateReferenceSystem();
|
||||
|
||||
DirectPosition s1, d1, s2, d2;
|
||||
if (crs.getCoordinateSystem().getDimension() == 2) {
|
||||
double centerX = (gridGeometry.getGridRange().getLow(0) + gridGeometry
|
||||
double centerX = (this.gridGeometry.getGridRange().getLow(0) + this.gridGeometry
|
||||
.getGridRange().getHigh(0)) / 2;
|
||||
|
||||
double centerY = (gridGeometry.getGridRange().getLow(1) + gridGeometry
|
||||
double centerY = (this.gridGeometry.getGridRange().getLow(1) + this.gridGeometry
|
||||
.getGridRange().getHigh(1)) / 2;
|
||||
|
||||
s1 = new DirectPosition2D(centerX, centerY);
|
||||
|
@ -318,6 +367,43 @@ public class MapDescriptor extends AbstractDescriptor implements
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.drawables.IDescriptor#pixelToWorld(double[])
|
||||
*/
|
||||
@Override
|
||||
public double[] pixelToWorld(final double[] pixel) {
|
||||
// if (pixel[0] < 1.0)
|
||||
// pixel[0] = 1;
|
||||
//
|
||||
// if (pixel[0] > theWorldWidth - 1.0)
|
||||
// pixel[0] = theWorldWidth - 1.0;
|
||||
//
|
||||
// if (pixel[1] < 1.0)
|
||||
// pixel[1] = 1;
|
||||
//
|
||||
// if (pixel[1] > theWorldHeight - 1.0)
|
||||
// pixel[1] = theWorldHeight;
|
||||
|
||||
double[] output = new double[3];
|
||||
double[] wpixel = pixel;
|
||||
|
||||
if (pixel.length == 2) {
|
||||
wpixel = new double[] { pixel[0], pixel[1], 0 };
|
||||
}
|
||||
|
||||
try {
|
||||
gridToWGSTransform.transform(wpixel, 0, output, 0, 1);
|
||||
} catch (TransformException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -331,7 +417,7 @@ public class MapDescriptor extends AbstractDescriptor implements
|
|||
if (crs == MapUtil.LATLON_PROJECTION) {
|
||||
return pixelToWorld(pixel);
|
||||
} else if (!crs.getName().equals(
|
||||
getGridGeometry().getCoordinateReferenceSystem().getName())) {
|
||||
this.gridGeometry.getCoordinateReferenceSystem().getName())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -345,6 +431,33 @@ public class MapDescriptor extends AbstractDescriptor implements
|
|||
return output2;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.drawables.IDescriptor#worldToPixel(double[])
|
||||
*/
|
||||
@Override
|
||||
public double[] worldToPixel(double[] world) {
|
||||
|
||||
double[] output = new double[3];
|
||||
|
||||
double[] input = null;
|
||||
if (world.length == 2) {
|
||||
input = new double[] { world[0], world[1], 0 };
|
||||
} else {
|
||||
input = world;
|
||||
}
|
||||
|
||||
try {
|
||||
wgsToGridTransform.transform(input, 0, output, 0, 1);
|
||||
} catch (TransformException e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -353,10 +466,11 @@ public class MapDescriptor extends AbstractDescriptor implements
|
|||
*/
|
||||
@Override
|
||||
public double[] worldToPixel(double[] pixel, CoordinateReferenceSystem crs) {
|
||||
|
||||
if (crs == MapUtil.LATLON_PROJECTION) {
|
||||
return worldToPixel(pixel);
|
||||
} else if (!crs.getName().equals(
|
||||
getGridGeometry().getCoordinateReferenceSystem().getName())) {
|
||||
this.gridGeometry.getCoordinateReferenceSystem().getName())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -504,6 +618,18 @@ public class MapDescriptor extends AbstractDescriptor implements
|
|||
return pc;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.map.IMapDescriptor#getMapData()
|
||||
*/
|
||||
@Override
|
||||
@XmlElement
|
||||
@XmlJavaTypeAdapter(value = GridGeometryAdapter.class)
|
||||
public GeneralGridGeometry getGridGeometry() {
|
||||
return this.gridGeometry;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -530,10 +656,29 @@ public class MapDescriptor extends AbstractDescriptor implements
|
|||
@Override
|
||||
public void setGridGeometry(GeneralGridGeometry gridGeometry)
|
||||
throws VizException {
|
||||
super.setGridGeometry(gridGeometry);
|
||||
this.gridGeometry = gridGeometry;
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.map.IMapDescriptor#getCRS()
|
||||
*/
|
||||
@Override
|
||||
public CoordinateReferenceSystem getCRS() {
|
||||
if (this.gridGeometry != null) {
|
||||
return this.gridGeometry.getCoordinateReferenceSystem();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public MathTransform getToGridTransform() {
|
||||
return this.wgsToGridTransform;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current display width
|
||||
*
|
||||
|
|
|
@ -17,19 +17,12 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.geospatial.util;
|
||||
package com.raytheon.uf.viz.core.map;
|
||||
|
||||
import org.geotools.coverage.grid.GeneralGridGeometry;
|
||||
import org.geotools.referencing.CRS;
|
||||
import org.geotools.referencing.operation.DefaultMathTransformFactory;
|
||||
import org.geotools.referencing.operation.projection.MapProjection;
|
||||
import org.geotools.referencing.operation.projection.MapProjection.AbstractProvider;
|
||||
import org.opengis.parameter.ParameterValueGroup;
|
||||
import org.opengis.referencing.operation.MathTransform;
|
||||
|
||||
import com.raytheon.uf.common.geospatial.MapUtil;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
|
||||
/**
|
||||
* Given a descriptor of a map, this class will check line segments for wrapping
|
||||
|
@ -57,9 +50,9 @@ public class WorldWrapChecker {
|
|||
|
||||
private boolean checkForWrapping = false;
|
||||
|
||||
public WorldWrapChecker(GeneralGridGeometry worldGeometry) {
|
||||
MapProjection worldProjection = CRS.getMapProjection(worldGeometry
|
||||
.getCoordinateReferenceSystem());
|
||||
public WorldWrapChecker(IMapDescriptor descriptor) {
|
||||
MapProjection worldProjection = CRS.getMapProjection(descriptor
|
||||
.getCRS());
|
||||
double centralMeridian = 0.0;
|
||||
if (worldProjection != null) {
|
||||
ParameterValueGroup group = worldProjection.getParameterValues();
|
||||
|
@ -78,27 +71,12 @@ public class WorldWrapChecker {
|
|||
double r1 = inverseCentralMeridian - 359.9;
|
||||
double r2 = inverseCentralMeridian - 359.8;
|
||||
|
||||
try {
|
||||
MathTransform latLonToGrid = new DefaultMathTransformFactory()
|
||||
.createConcatenatedTransform(MapUtil
|
||||
.getTransformFromLatLon(worldGeometry
|
||||
.getCoordinateReferenceSystem()),
|
||||
worldGeometry.getGridToCRS().inverse());
|
||||
double xl1 = descriptor.worldToPixel(new double[] { l1, 0.0 })[0];
|
||||
double xl2 = descriptor.worldToPixel(new double[] { l2, 0.0 })[0];
|
||||
double xr1 = descriptor.worldToPixel(new double[] { r1, 0.0 })[0];
|
||||
double xr2 = descriptor.worldToPixel(new double[] { r2, 0.0 })[0];
|
||||
|
||||
double[] in = new double[] { l1, 0.0, l2, 0.0, r1, 0.0, r2, 0.0 };
|
||||
double[] out = new double[in.length];
|
||||
latLonToGrid.transform(in, 0, out, 0, 4);
|
||||
|
||||
double xl1 = out[0];
|
||||
double xl2 = out[2];
|
||||
double xr1 = out[4];
|
||||
double xr2 = out[6];
|
||||
|
||||
checkForWrapping = Math.abs(xl1 - xr1) > Math.abs(xl2 - xr2);
|
||||
} catch (Throwable t) {
|
||||
UFStatus.getHandler().handle(Priority.PROBLEM,
|
||||
"Error determing world wrap checking", t);
|
||||
}
|
||||
checkForWrapping = Math.abs(xl1 - xr1) > Math.abs(xl2 - xr2);
|
||||
}
|
||||
|
||||
/**
|
|
@ -17,14 +17,12 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.geospatial.util;
|
||||
package com.raytheon.uf.viz.core.map;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.geotools.coverage.grid.GeneralGridGeometry;
|
||||
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
import com.vividsolutions.jts.geom.GeometryCollection;
|
||||
|
@ -55,12 +53,12 @@ public class WorldWrapCorrector {
|
|||
private WorldWrapChecker checker;
|
||||
|
||||
/**
|
||||
* Constructs of world wrap corrector for the specified world
|
||||
* Constructs of world wrap corrector for the specified descriptor
|
||||
*
|
||||
* @param descriptor
|
||||
*/
|
||||
public WorldWrapCorrector(GeneralGridGeometry worldGeometry) {
|
||||
checker = new WorldWrapChecker(worldGeometry);
|
||||
public WorldWrapCorrector(IMapDescriptor descriptor) {
|
||||
checker = new WorldWrapChecker(descriptor);
|
||||
}
|
||||
|
||||
/**
|
|
@ -54,6 +54,7 @@ import com.raytheon.uf.viz.core.Activator;
|
|||
import com.raytheon.uf.viz.core.comm.JMSConnection;
|
||||
import com.raytheon.uf.viz.core.notification.INotificationObserver;
|
||||
import com.raytheon.uf.viz.core.notification.NotificationMessage;
|
||||
import com.raytheon.uf.viz.core.preferences.JMSPreferences;
|
||||
|
||||
/**
|
||||
* Job to monitor the JMS topic containing notification messages, delegating the
|
||||
|
@ -505,10 +506,11 @@ public class NotificationManagerJob implements ExceptionListener, IDisposable {
|
|||
disconnect();
|
||||
session = manager.connection.createSession(false,
|
||||
Session.AUTO_ACKNOWLEDGE);
|
||||
|
||||
if (session != null) {
|
||||
String topicName = id;
|
||||
Topic t = session.createTopic(topicName);
|
||||
|
||||
Topic t = session.createTopic(JMSPreferences
|
||||
.getPolicyString(topicName));
|
||||
if (queryString != null) {
|
||||
consumer = session.createConsumer(t, queryString);
|
||||
} else {
|
||||
|
|
|
@ -1,340 +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.core.rsc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.opengis.referencing.crs.CoordinateReferenceSystem;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
import com.raytheon.uf.viz.core.drawables.IRenderable;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.AbstractCapability;
|
||||
|
||||
/**
|
||||
* Abstract resource class that manages frames with renderable objects
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 21, 2011 mschenke Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public abstract class AbstractPluginDataObjectResource<T extends AbstractResourceData, D extends IDescriptor>
|
||||
extends AbstractVizResource<T, D> {
|
||||
|
||||
private static class Frame {
|
||||
List<PluginDataObject> records = new ArrayList<PluginDataObject>();
|
||||
|
||||
IRenderable renderable;
|
||||
}
|
||||
|
||||
private Map<DataTime, Frame> frames = new HashMap<DataTime, Frame>();
|
||||
|
||||
private Object lock = new Object();
|
||||
|
||||
/**
|
||||
* @param resourceData
|
||||
* @param loadProperties
|
||||
*/
|
||||
protected AbstractPluginDataObjectResource(T resourceData,
|
||||
LoadProperties loadProperties) {
|
||||
super(resourceData, loadProperties);
|
||||
dataTimes = new ArrayList<DataTime>();
|
||||
resourceData.addChangeListener(new IResourceDataChanged() {
|
||||
@Override
|
||||
public void resourceChanged(ChangeType type, Object object) {
|
||||
if (type == ChangeType.DATA_UPDATE) {
|
||||
if (object instanceof PluginDataObject) {
|
||||
addDataObject((PluginDataObject) object);
|
||||
} else if (object instanceof PluginDataObject[]) {
|
||||
for (PluginDataObject pdo : (PluginDataObject[]) object) {
|
||||
addDataObject((PluginDataObject) pdo);
|
||||
}
|
||||
} else if (object instanceof Object[]) {
|
||||
for (Object obj : (Object[]) object) {
|
||||
if (obj instanceof PluginDataObject) {
|
||||
addDataObject((PluginDataObject) obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (type == ChangeType.CAPABILITY) {
|
||||
if (object instanceof AbstractCapability) {
|
||||
AbstractCapability capability = (AbstractCapability) object;
|
||||
for (Frame frame : frames.values()) {
|
||||
if (frame.renderable != null) {
|
||||
capabilityChanged(frame.renderable, capability);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the pdo to the appropriate time and removes any renderable or data
|
||||
* cached for that time.
|
||||
*
|
||||
* @param pdo
|
||||
*/
|
||||
protected final void addDataObject(PluginDataObject pdo) {
|
||||
synchronized (lock) {
|
||||
if (frames == null) {
|
||||
// Check for null in case we were waiting for lock from
|
||||
// disposeInternal in which case we shouldn't process add
|
||||
return;
|
||||
}
|
||||
DataTime time = getDataObjectTime(pdo);
|
||||
Frame frame = frames.get(time);
|
||||
if (frame == null) {
|
||||
frame = new Frame();
|
||||
frames.put(time, frame);
|
||||
}
|
||||
if (frame.records.contains(pdo)) {
|
||||
frame.records.remove(pdo);
|
||||
}
|
||||
frame.records.add(pdo);
|
||||
if (frame.renderable != null) {
|
||||
if (updateRenderable(frame.renderable, pdo) == false) {
|
||||
dispose(frame.renderable);
|
||||
}
|
||||
}
|
||||
if (!dataTimes.contains(dataTimes)) {
|
||||
dataTimes.add(time);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the DataTime to be associated with this record. Default returns
|
||||
* PluginDataObject.getDataTime()
|
||||
*
|
||||
* @param pdo
|
||||
* @return
|
||||
*/
|
||||
protected DataTime getDataObjectTime(PluginDataObject pdo) {
|
||||
return pdo.getDataTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the records for the given time. Empty list will be returned if no
|
||||
* frame for time
|
||||
*
|
||||
* @param time
|
||||
* @return
|
||||
*/
|
||||
protected List<PluginDataObject> getPluginDataObjects(DataTime time) {
|
||||
Frame frame = frames.get(time);
|
||||
if (frame != null) {
|
||||
return frame.records;
|
||||
}
|
||||
return new ArrayList<PluginDataObject>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current time for the resource, default calls
|
||||
* descriptor.getTimeForResoruce(this)
|
||||
*
|
||||
* @return the current time
|
||||
*/
|
||||
protected DataTime getTimeForResource() {
|
||||
return descriptor.getTimeForResource(this);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.rsc.AbstractVizResource#remove(com.raytheon.
|
||||
* uf.common.time.DataTime)
|
||||
*/
|
||||
@Override
|
||||
public final void remove(DataTime dataTime) {
|
||||
synchronized (lock) {
|
||||
super.remove(dataTime);
|
||||
Frame frame = frames.remove(dataTime);
|
||||
if (frame != null && frame.renderable != null) {
|
||||
IRenderable dispose = frame.renderable;
|
||||
frame.renderable = null;
|
||||
dispose(dispose);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispose of a renderable.
|
||||
*
|
||||
* @param renderable
|
||||
*/
|
||||
private void dispose(final IRenderable renderable) {
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
disposeRenderable(renderable);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void project(CoordinateReferenceSystem crs)
|
||||
throws VizException {
|
||||
Iterator<Frame> iter = frames.values().iterator();
|
||||
while (iter.hasNext()) {
|
||||
Frame frame = iter.next();
|
||||
IRenderable renderable = frame.renderable;
|
||||
if (renderable != null) {
|
||||
if (!projectRenderable(renderable, crs)) {
|
||||
frame.renderable = null;
|
||||
dispose(renderable);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.rsc.AbstractVizResource#paintInternal(com.raytheon
|
||||
* .uf.viz.core.IGraphicsTarget,
|
||||
* com.raytheon.uf.viz.core.drawables.PaintProperties)
|
||||
*/
|
||||
@Override
|
||||
protected final void paintInternal(IGraphicsTarget target,
|
||||
PaintProperties paintProps) throws VizException {
|
||||
DataTime time = paintProps.getDataTime();
|
||||
if (time == null) {
|
||||
time = getTimeForResource();
|
||||
}
|
||||
Frame currFrame = frames.get(time);
|
||||
if (currFrame != null) {
|
||||
IRenderable renderable = currFrame.renderable;
|
||||
if (renderable == null) {
|
||||
currFrame.renderable = renderable = constructRenderable(currFrame.records);
|
||||
}
|
||||
|
||||
if (renderable != null) {
|
||||
renderable.paint(target, paintProps);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.rsc.AbstractVizResource#disposeInternal()
|
||||
*/
|
||||
@Override
|
||||
protected final void disposeInternal() {
|
||||
synchronized (lock) {
|
||||
for (Frame frame : frames.values()) {
|
||||
if (frame.renderable != null) {
|
||||
disposeRenderable(frame.renderable);
|
||||
}
|
||||
}
|
||||
frames.clear();
|
||||
frames = null;
|
||||
}
|
||||
disposeResource();
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispose method for the resource to dispose any data not tied to a
|
||||
* renderable. Called after all renderables have been disposed. Default impl
|
||||
* does nothing
|
||||
*/
|
||||
protected void disposeResource() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Notification that a capability has changed and the renderable should be
|
||||
* updated
|
||||
*
|
||||
* @param renderable
|
||||
* @param capability
|
||||
*/
|
||||
protected abstract void capabilityChanged(IRenderable renderable,
|
||||
AbstractCapability capability);
|
||||
|
||||
/**
|
||||
* Dispose the renderable object
|
||||
*
|
||||
* @param renderable
|
||||
*/
|
||||
protected abstract void disposeRenderable(IRenderable renderable);
|
||||
|
||||
/**
|
||||
* Attempt to reproject the renderable object into this specified
|
||||
* projection. If unable to reproject, return false and renderable will be
|
||||
* recreated next paint
|
||||
*
|
||||
* @param renderable
|
||||
* @param crs
|
||||
* @return
|
||||
*/
|
||||
protected abstract boolean projectRenderable(IRenderable renderable,
|
||||
CoordinateReferenceSystem crs) throws VizException;
|
||||
|
||||
/**
|
||||
* Construct a renderable object for the given records. This method is
|
||||
* called from paintInternal. Null can be returned and this method will be
|
||||
* called next paintInternal. That can be used if requesting data that is
|
||||
* required for the renderable asynchronously.
|
||||
*
|
||||
* NOTE: The size of the pdo list will only grow so it can be used to
|
||||
* determine if new data has arrived since last call
|
||||
*
|
||||
* @param records
|
||||
* @return
|
||||
*/
|
||||
protected abstract IRenderable constructRenderable(
|
||||
List<PluginDataObject> records) throws VizException;
|
||||
|
||||
/**
|
||||
* Update the renderable with the new pdo, if the renderable is updatable,
|
||||
* return true. If the renderable needs to be recreated from scratch, return
|
||||
* false
|
||||
*
|
||||
* @param renderable
|
||||
* @param pdo
|
||||
* @return
|
||||
*/
|
||||
protected abstract boolean updateRenderable(IRenderable renderable,
|
||||
PluginDataObject pdo);
|
||||
}
|
|
@ -21,7 +21,6 @@ package com.raytheon.uf.viz.core.rsc;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
@ -386,6 +385,11 @@ public abstract class AbstractRequestableResourceData extends
|
|||
|
||||
Set<DataTime> currentSet = new HashSet<DataTime>(Arrays.asList(current));
|
||||
|
||||
boolean initialLoad = false;
|
||||
if (currentSet.size() == 0) {
|
||||
initialLoad = true;
|
||||
}
|
||||
|
||||
Set<DataTime> loadSet = new HashSet<DataTime>();
|
||||
for (DataTime t : desiredSet) {
|
||||
boolean found = false;
|
||||
|
@ -405,21 +409,6 @@ public abstract class AbstractRequestableResourceData extends
|
|||
return new PluginDataObject[0];
|
||||
}
|
||||
|
||||
return requestPluginDataObjects(loadSet);
|
||||
}
|
||||
|
||||
/**
|
||||
* Request plugin data objects for the passed in times. This method is
|
||||
* called from getLatestPluginDataObjects(DataTime[],DataTime[]) after time
|
||||
* filter from desired and current has been done. The times passed in is a
|
||||
* collection of new times needed
|
||||
*
|
||||
* @param loadSet
|
||||
* @return
|
||||
* @throws VizException
|
||||
*/
|
||||
protected PluginDataObject[] requestPluginDataObjects(
|
||||
Collection<DataTime> loadSet) throws VizException {
|
||||
LayerProperty property = new LayerProperty();
|
||||
// TODO fix?
|
||||
property.setDesiredProduct(ResourceType.PLAN_VIEW);
|
||||
|
@ -487,7 +476,7 @@ public abstract class AbstractRequestableResourceData extends
|
|||
/**
|
||||
* Comparator for response array.
|
||||
*/
|
||||
protected static Comparator<PluginDataObject> layerComparator = new Comparator<PluginDataObject>() {
|
||||
private static Comparator<PluginDataObject> layerComparator = new Comparator<PluginDataObject>() {
|
||||
|
||||
@Override
|
||||
public int compare(PluginDataObject arg0, PluginDataObject arg1) {
|
||||
|
|
|
@ -20,10 +20,10 @@
|
|||
package com.raytheon.uf.viz.core.rsc;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
|
@ -152,11 +152,11 @@ public abstract class AbstractVizResource<T extends AbstractResourceData, D exte
|
|||
protected AbstractVizResource(T resourceData, LoadProperties loadProperties) {
|
||||
this.resourceData = resourceData;
|
||||
this.loadProperties = loadProperties;
|
||||
refreshListeners = new CopyOnWriteArraySet<IRefreshListener>();
|
||||
initListeners = new CopyOnWriteArraySet<IInitListener>();
|
||||
paintListeners = new CopyOnWriteArraySet<IPaintListener>();
|
||||
paintStatusListeners = new CopyOnWriteArraySet<IPaintStatusChangedListener>();
|
||||
disposeListeners = new CopyOnWriteArraySet<IDisposeListener>();
|
||||
refreshListeners = new HashSet<IRefreshListener>();
|
||||
initListeners = new HashSet<IInitListener>();
|
||||
paintListeners = new HashSet<IPaintListener>();
|
||||
paintStatusListeners = new HashSet<IPaintStatusChangedListener>();
|
||||
disposeListeners = new HashSet<IDisposeListener>();
|
||||
|
||||
if (resourceData != null) {
|
||||
resourceData.addChangeListener(new IResourceDataChanged() {
|
||||
|
@ -717,7 +717,7 @@ public abstract class AbstractVizResource<T extends AbstractResourceData, D exte
|
|||
*/
|
||||
public final void recycle() {
|
||||
if (status == ResourceStatus.INITIALIZED) {
|
||||
disposeInternal();
|
||||
dispose();
|
||||
}
|
||||
status = ResourceStatus.NEW;
|
||||
initJob = null;
|
||||
|
|
|
@ -73,9 +73,6 @@ public class ColorMapCapability extends AbstractCapability implements
|
|||
public void setColorMapParameters(ColorMapParameters colorMapParameters,
|
||||
boolean notify) {
|
||||
if (this.colorMapParameters != colorMapParameters) {
|
||||
if (this.colorMapParameters != null) {
|
||||
this.colorMapParameters.removeListener(this);
|
||||
}
|
||||
this.colorMapParameters = colorMapParameters;
|
||||
if (notify) {
|
||||
capabilityChanged();
|
||||
|
@ -83,7 +80,7 @@ public class ColorMapCapability extends AbstractCapability implements
|
|||
}
|
||||
|
||||
if (this.colorMapParameters != null) {
|
||||
this.colorMapParameters.addListener(this);
|
||||
this.colorMapParameters.setListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,115 +21,23 @@ package com.raytheon.uf.viz.core.rsc.hdf5;
|
|||
|
||||
import java.awt.Rectangle;
|
||||
|
||||
import org.geotools.coverage.grid.GeneralGridEnvelope;
|
||||
import org.geotools.coverage.grid.GridGeometry2D;
|
||||
import org.geotools.geometry.GeneralEnvelope;
|
||||
import org.geotools.geometry.jts.ReferencedEnvelope;
|
||||
import org.opengis.coverage.grid.GridEnvelope;
|
||||
import org.opengis.geometry.Envelope;
|
||||
|
||||
import com.raytheon.uf.viz.core.PixelCoverage;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
|
||||
/**
|
||||
* ImageTile is an object that represents an image (or part of an image)
|
||||
* geospatially, it contains a grid geometry that represents the projection and
|
||||
* size of the image and a PixelCoverage which contains the screen projected
|
||||
* data for the image. Because a single ImageTile can represent multiple images,
|
||||
* this class does not contain the actual image it represents so the tile can be
|
||||
* shared between images
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 13, 2012 mschenke Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
* @version 1.0
|
||||
*/
|
||||
public class ImageTile {
|
||||
|
||||
public GridGeometry2D imageGeometry;
|
||||
public com.vividsolutions.jts.geom.Envelope envelope;
|
||||
|
||||
public double elevation;
|
||||
|
||||
public PixelCoverage coverage;
|
||||
|
||||
/**
|
||||
* Checks to see if the x/y coordinate is contained by the ImageTile's CRS
|
||||
* Envelope
|
||||
*
|
||||
* @param x
|
||||
* @param y
|
||||
* @return
|
||||
*/
|
||||
public boolean contains(double x, double y) {
|
||||
Envelope env = imageGeometry.getEnvelope();
|
||||
return env.getMinimum(0) <= x && env.getMaximum(0) >= x
|
||||
&& env.getMinimum(1) <= y && env.getMaximum(1) >= y;
|
||||
}
|
||||
public Rectangle rect;
|
||||
|
||||
/**
|
||||
* Checks to see if the Coordinate is contained by the ImageTile's CRS
|
||||
* Envelope
|
||||
*
|
||||
* @param c
|
||||
* @return
|
||||
*/
|
||||
public boolean contains(Coordinate c) {
|
||||
return contains(c.x, c.y);
|
||||
}
|
||||
// TODO clean up occlusionQueries move to GLImage?
|
||||
public int query = -1;
|
||||
|
||||
/**
|
||||
* Set the grid geometry of the tile given the image rectangle and the
|
||||
* referenced envelope
|
||||
*
|
||||
* @param rect
|
||||
* @param env
|
||||
*/
|
||||
public void setGridGeometry(Rectangle rect, ReferencedEnvelope env) {
|
||||
GeneralGridEnvelope gge = new GeneralGridEnvelope(rect);
|
||||
GeneralEnvelope ge = new GeneralEnvelope(env);
|
||||
imageGeometry = new GridGeometry2D(gge, ge);
|
||||
}
|
||||
public boolean occlude = false;
|
||||
|
||||
/**
|
||||
* Set the image geometry
|
||||
*
|
||||
* @param imageGeometry
|
||||
*/
|
||||
public void setGridGeometry(GridGeometry2D imageGeometry) {
|
||||
this.imageGeometry = imageGeometry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the image rectangle. This could be a subsection of a larger image so
|
||||
* x and y may not be 0,0
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Rectangle getRectangle() {
|
||||
GridEnvelope env = imageGeometry.getGridRange();
|
||||
return new Rectangle(env.getLow(0), env.getLow(1), env.getSpan(0),
|
||||
env.getSpan(1));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the spatially referenced envelope of the image tile
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ReferencedEnvelope getEnvelope() {
|
||||
return new ReferencedEnvelope(imageGeometry.getEnvelope());
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispose the image tile, disposes of the coverage object associated with
|
||||
* it
|
||||
*/
|
||||
public void dispose() {
|
||||
if (coverage != null) {
|
||||
coverage.dispose();
|
||||
|
|
|
@ -0,0 +1,163 @@
|
|||
/**
|
||||
* 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.core.rsc.hdf5;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.opengis.referencing.operation.MathTransform;
|
||||
|
||||
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.IMesh;
|
||||
import com.raytheon.uf.viz.core.IMeshCallback;
|
||||
import com.raytheon.uf.viz.core.PixelCoverage;
|
||||
import com.raytheon.uf.viz.core.rsc.RenderingOrderFactory;
|
||||
|
||||
/**
|
||||
* Persistent job used to calculate mesh tiles outside of the rendering thread
|
||||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 1, 2007 chammack Initial Creation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author cnh
|
||||
* @version 1
|
||||
*/
|
||||
public class MeshCalculatorJob extends Job {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(MeshCalculatorJob.class);
|
||||
|
||||
private static MeshCalculatorJob instance;
|
||||
|
||||
private ConcurrentLinkedQueue<PixelCoverage> requests;
|
||||
|
||||
private ConcurrentHashMap<PixelCoverage, MeshParameters> map;
|
||||
|
||||
private MeshCalculatorJob() {
|
||||
super("Mesh Calculator");
|
||||
requests = new ConcurrentLinkedQueue<PixelCoverage>();
|
||||
map = new ConcurrentHashMap<PixelCoverage, MeshParameters>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Request to have the mesh be calculated in the mesh thread
|
||||
*
|
||||
* @param mesh
|
||||
* @param tile
|
||||
* @param preTransform
|
||||
*/
|
||||
public synchronized void requestLoad(IMesh mesh, ImageTile tile,
|
||||
MathTransform preTransform) {
|
||||
if (!requests.contains(tile.coverage)) {
|
||||
MeshParameters params = new MeshParameters();
|
||||
params.tile = tile;
|
||||
params.mesh = mesh;
|
||||
params.preTransform = preTransform;
|
||||
|
||||
map.put(tile.coverage, params);
|
||||
requests.add(tile.coverage);
|
||||
}
|
||||
instance.schedule();
|
||||
}
|
||||
|
||||
/**
|
||||
* Request to have the mesh be calculated in the mesh thread, with the
|
||||
* callback being notified after the mesh has been calculated
|
||||
*
|
||||
* @param callback
|
||||
* @param mesh
|
||||
* @param tile
|
||||
* @param preTransform
|
||||
*/
|
||||
public synchronized void requestLoad(IMeshCallback callback, IMesh mesh,
|
||||
ImageTile tile, MathTransform preTransform) {
|
||||
if (!requests.contains(tile.coverage)) {
|
||||
MeshParameters params = new MeshParameters();
|
||||
params.tile = tile;
|
||||
params.mesh = mesh;
|
||||
params.preTransform = preTransform;
|
||||
params.callback = callback;
|
||||
|
||||
map.put(tile.coverage, params);
|
||||
requests.add(tile.coverage);
|
||||
}
|
||||
instance.schedule();
|
||||
}
|
||||
|
||||
public static synchronized MeshCalculatorJob getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new MeshCalculatorJob();
|
||||
instance.setSystem(true);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @seeorg.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.
|
||||
* IProgressMonitor)
|
||||
*/
|
||||
@Override
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
|
||||
while (requests.size() > 0) {
|
||||
PixelCoverage coverage = requests.peek();
|
||||
try {
|
||||
MeshParameters p = map.get(coverage);
|
||||
|
||||
coverage.setMesh(null);
|
||||
p.mesh.calculateMesh(coverage, p.tile, p.preTransform);
|
||||
coverage.setMesh(p.mesh);
|
||||
|
||||
if (p.callback != null) {
|
||||
p.callback.meshCalculated(p.tile);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
statusHandler.handle(Priority.PROBLEM, "An error occured during mesh calculations, some images may not be properly reprojected.", t);
|
||||
}
|
||||
map.remove(coverage);
|
||||
requests.remove();
|
||||
}
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
|
||||
private class MeshParameters {
|
||||
// public MapDescriptor mapDescriptor;
|
||||
|
||||
public IMesh mesh;
|
||||
|
||||
public ImageTile tile;
|
||||
|
||||
public MathTransform preTransform;
|
||||
|
||||
public IMeshCallback callback;
|
||||
}
|
||||
|
||||
}
|
|
@ -61,6 +61,7 @@ import com.raytheon.uf.viz.core.rsc.IResourceDataChanged.ChangeType;
|
|||
import com.raytheon.uf.viz.core.rsc.IResourceGroup;
|
||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||
import com.raytheon.uf.viz.core.rsc.ResourceList;
|
||||
import com.raytheon.uf.viz.core.time.TimeMatchingJob;
|
||||
import com.raytheon.uf.viz.d2d.core.D2DLoadProperties;
|
||||
|
||||
/**
|
||||
|
@ -72,6 +73,7 @@ import com.raytheon.uf.viz.d2d.core.D2DLoadProperties;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 10, 2009 chammack Initial creation
|
||||
* 2012-04-20 DR 14699 D. Friedman Work around race conditions
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -122,6 +124,10 @@ public class D2DTimeMatcher extends AbstractTimeMatcher implements
|
|||
|
||||
private AbstractTimeMatchingConfigurationFactory configFactory;
|
||||
|
||||
// DR 14699 work arounds
|
||||
private boolean needRetry;
|
||||
private int nRetries;
|
||||
|
||||
/**
|
||||
* Default Constructor.
|
||||
*/
|
||||
|
@ -152,6 +158,8 @@ public class D2DTimeMatcher extends AbstractTimeMatcher implements
|
|||
public void redoTimeMatching(IDescriptor descriptor) throws VizException {
|
||||
|
||||
synchronized (this) {
|
||||
needRetry = false;
|
||||
|
||||
if (timeMatchBasis != null) {
|
||||
IDescriptor tmDescriptor = timeMatchBasis.getDescriptor();
|
||||
if (tmDescriptor != null && tmDescriptor != descriptor) {
|
||||
|
@ -175,8 +183,11 @@ public class D2DTimeMatcher extends AbstractTimeMatcher implements
|
|||
Iterator<ResourcePair> pairIterator = descriptor.getResourceList()
|
||||
.listIterator();
|
||||
while (pairIterator.hasNext()) {
|
||||
AbstractVizResource<?, ?> rsc = pairIterator.next()
|
||||
ResourcePair rp = pairIterator.next();
|
||||
AbstractVizResource<?, ?> rsc = rp
|
||||
.getResource();
|
||||
if (rsc == null && rp.getResourceData() instanceof AbstractRequestableResourceData)
|
||||
needRetry = true;
|
||||
recursiveOverlay(descriptor, new FramesInfo(timeSteps, -1,
|
||||
resourceTimeMap), rsc);
|
||||
}
|
||||
|
@ -193,6 +204,14 @@ public class D2DTimeMatcher extends AbstractTimeMatcher implements
|
|||
timeMatchUpdate(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
if (needRetry) {
|
||||
if (nRetries < 200) {
|
||||
++nRetries;
|
||||
TimeMatchingJob.scheduleTimeMatch(descriptor);
|
||||
}
|
||||
} else
|
||||
nRetries = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -303,6 +322,8 @@ public class D2DTimeMatcher extends AbstractTimeMatcher implements
|
|||
if (rsc instanceof IResourceGroup) {
|
||||
for (ResourcePair rp : ((IResourceGroup) rsc).getResourceList()) {
|
||||
AbstractVizResource<?, ?> rsc1 = rp.getResource();
|
||||
if (rsc1 == null && rp.getResourceData() instanceof AbstractRequestableResourceData)
|
||||
needRetry = true;
|
||||
recursiveOverlay(descriptor, framesInfo, rsc1);
|
||||
}
|
||||
}
|
||||
|
@ -311,7 +332,9 @@ public class D2DTimeMatcher extends AbstractTimeMatcher implements
|
|||
TimeMatchingConfiguration config = getConfiguration(rsc
|
||||
.getLoadProperties());
|
||||
DataTime[] timeSteps = getFrameTimes(descriptor, framesInfo);
|
||||
if (Arrays.equals(timeSteps, config.getLastBaseTimes())) {
|
||||
if (Arrays.equals(timeSteps, config.getLastBaseTimes()) &&
|
||||
config.getLastFrameTimes() != null &&
|
||||
config.getLastFrameTimes().length > 0) {
|
||||
framesInfo.getTimeMap().put(rsc, config.getLastFrameTimes());
|
||||
} else {
|
||||
config = config.clone();
|
||||
|
|
|
@ -94,7 +94,7 @@ public class MdlSndNSharpResourceData extends D2DNSharpResourceData {
|
|||
|
||||
@Override
|
||||
protected NcSoundingCube getSoundingCube(NsharpStationInfo stnInfo) {
|
||||
float[][] latLon = { { stnInfo.getLatitude(), stnInfo.getLongitude() } };
|
||||
double[][] latLon = { { stnInfo.getLatitude(), stnInfo.getLongitude() } };
|
||||
return NcSoundingQuery.pfcSoundingQueryByLatLon(stnInfo.getReftime()
|
||||
.getTime(), stnInfo.getRangestarttime().getTime(), latLon,
|
||||
stnInfo.getSndType(), NcSoundingLayer.DataType.ALLDATA, false,
|
||||
|
|
|
@ -7,10 +7,7 @@ Bundle-Activator: com.raytheon.uf.viz.derivparam.Activator
|
|||
Bundle-Vendor: RAYTHEON
|
||||
Require-Bundle: org.eclipse.core.runtime,
|
||||
javax.measure,
|
||||
com.raytheon.uf.common.dataquery,
|
||||
com.raytheon.uf.viz.core;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.datastorage;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.pointdata;bundle-version="1.12.1174"
|
||||
com.raytheon.uf.common.dataquery
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
|
||||
|
@ -20,13 +17,21 @@ Import-Package: com.raytheon.edex.meteoLib,
|
|||
com.raytheon.uf.common.dataplugin,
|
||||
com.raytheon.uf.common.dataplugin.level,
|
||||
com.raytheon.uf.common.dataplugin.persist,
|
||||
com.raytheon.uf.common.datastorage.records,
|
||||
com.raytheon.uf.common.derivparam.tree,
|
||||
com.raytheon.uf.common.localization,
|
||||
com.raytheon.uf.common.message.response,
|
||||
com.raytheon.uf.common.serialization,
|
||||
com.raytheon.uf.common.serialization.adapters,
|
||||
com.raytheon.uf.common.status,
|
||||
com.raytheon.uf.common.time
|
||||
com.raytheon.uf.common.time,
|
||||
com.raytheon.uf.viz.core,
|
||||
com.raytheon.uf.viz.core.catalog,
|
||||
com.raytheon.uf.viz.core.comm,
|
||||
com.raytheon.uf.viz.core.exception,
|
||||
com.raytheon.uf.viz.core.level,
|
||||
com.raytheon.uf.viz.core.localization,
|
||||
com.raytheon.uf.viz.core.status
|
||||
Export-Package: com.raytheon.uf.viz.derivparam,
|
||||
com.raytheon.uf.viz.derivparam.data,
|
||||
com.raytheon.uf.viz.derivparam.inv,
|
||||
|
|
|
@ -1,394 +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.derivparam.data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.dataquery.requests.DbQueryRequest;
|
||||
import com.raytheon.uf.common.dataquery.requests.DbQueryRequestSet;
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
|
||||
import com.raytheon.uf.common.dataquery.requests.TimeQueryRequest;
|
||||
import com.raytheon.uf.common.dataquery.requests.TimeQueryRequestSet;
|
||||
import com.raytheon.uf.common.dataquery.responses.DbQueryResponse;
|
||||
import com.raytheon.uf.common.dataquery.responses.DbQueryResponseSet;
|
||||
import com.raytheon.uf.common.datastorage.Request;
|
||||
import com.raytheon.uf.common.datastorage.records.IDataRecord;
|
||||
import com.raytheon.uf.common.pointdata.PointDataContainer;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.viz.core.catalog.LayerProperty;
|
||||
import com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter;
|
||||
import com.raytheon.uf.viz.core.datastructure.VizDataCubeException;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||
import com.raytheon.uf.viz.derivparam.tree.AbstractRequestableLevelNode;
|
||||
import com.raytheon.uf.viz.derivparam.tree.AbstractRequestableLevelNode.Dependency;
|
||||
|
||||
/**
|
||||
* Abstract data cube adapter for standard data type that uses derived
|
||||
* parameters
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 30, 2012 mschenke Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public abstract class AbstractDataCubeAdapter implements IDataCubeAdapter {
|
||||
|
||||
private String[] supportedPlugins;
|
||||
|
||||
protected AbstractDataCubeAdapter(String[] supportedPlugins) {
|
||||
this.supportedPlugins = supportedPlugins;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#getSupportedPlugins
|
||||
* ()
|
||||
*/
|
||||
@Override
|
||||
public String[] getSupportedPlugins() {
|
||||
return supportedPlugins;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#timeQuery(java
|
||||
* .util.List)
|
||||
*/
|
||||
@Override
|
||||
public List<List<DataTime>> timeQuery(List<TimeQueryRequest> requests)
|
||||
throws VizException {
|
||||
int mapSize = (int) (requests.size() * 1) + 1;
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> cache = new HashMap<AbstractRequestableLevelNode, Set<DataTime>>(
|
||||
mapSize);
|
||||
LinkedHashMap<AbstractRequestableLevelNode, TimeQueryRequest> queries = new LinkedHashMap<AbstractRequestableLevelNode, TimeQueryRequest>(
|
||||
mapSize);
|
||||
|
||||
for (TimeQueryRequest request : requests) {
|
||||
List<AbstractRequestableLevelNode> requestNodes = evaluateRequestConstraints(request
|
||||
.getQueryTerms());
|
||||
// pull out time queries and bulk submit
|
||||
for (AbstractRequestableLevelNode requestNode : requestNodes) {
|
||||
getTimeQuery(request, requestNode, false, queries, cache, null);
|
||||
}
|
||||
}
|
||||
|
||||
// set the results back into the cache's
|
||||
TimeQueryRequestSet reqSet = new TimeQueryRequestSet();
|
||||
reqSet.setRequests(queries.values().toArray(
|
||||
new TimeQueryRequest[queries.size()]));
|
||||
@SuppressWarnings("unchecked")
|
||||
List<List<DataTime>> qResponses = (List<List<DataTime>>) ThriftClient
|
||||
.sendRequest(reqSet);
|
||||
int index = 0;
|
||||
for (AbstractRequestableLevelNode node : queries.keySet()) {
|
||||
// put results into cache
|
||||
node.setTimeQueryResults(false, qResponses.get(index++), cache,
|
||||
null);
|
||||
}
|
||||
List<List<DataTime>> finalResponse = new ArrayList<List<DataTime>>(
|
||||
requests.size());
|
||||
for (TimeQueryRequest request : requests) {
|
||||
List<AbstractRequestableLevelNode> requestNodes = evaluateRequestConstraints(request
|
||||
.getQueryTerms());
|
||||
// pull the actual results from the cache
|
||||
Set<DataTime> results = new HashSet<DataTime>(64);
|
||||
for (AbstractRequestableLevelNode requestNode : requestNodes) {
|
||||
Set<DataTime> times = requestNode.timeQuery(request, false,
|
||||
cache, null);
|
||||
if (times == AbstractRequestableLevelNode.TIME_AGNOSTIC) {
|
||||
// TODO: include time agnostic query in main bulk query as
|
||||
// each pressure level will cause a separate query
|
||||
List<DataTime> temp = timeAgnosticQuery(request
|
||||
.getQueryTerms());
|
||||
if (temp != null) {
|
||||
results.addAll(temp);
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
results.addAll(times);
|
||||
}
|
||||
}
|
||||
if (!request.isMaxQuery() || results.isEmpty()) {
|
||||
finalResponse.add(new ArrayList<DataTime>(results));
|
||||
} else {
|
||||
ArrayList<DataTime> response = new ArrayList<DataTime>(results);
|
||||
Collections.sort(response);
|
||||
finalResponse
|
||||
.add(Arrays.asList(response.get(response.size() - 1)));
|
||||
}
|
||||
}
|
||||
return finalResponse;
|
||||
}
|
||||
|
||||
protected void getTimeQuery(
|
||||
TimeQueryRequest originalRequest,
|
||||
AbstractRequestableLevelNode req,
|
||||
boolean latestOnly,
|
||||
LinkedHashMap<AbstractRequestableLevelNode, TimeQueryRequest> queries,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> cache,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> latestOnlyCache)
|
||||
throws VizException {
|
||||
List<Dependency> depends = req.getDependencies();
|
||||
if (depends.isEmpty()) {
|
||||
// is source node
|
||||
TimeQueryRequest myQ = req.getTimeQuery(originalRequest,
|
||||
latestOnly, cache, latestOnlyCache);
|
||||
if (myQ != null) {
|
||||
// no need to merge timeQueries
|
||||
queries.put(req, myQ);
|
||||
}
|
||||
} else {
|
||||
for (Dependency dep : depends) {
|
||||
// TODO: Optimize dTime/fTime to use bulk query mechanism,
|
||||
// small case that is a not easy to get right with a bulk
|
||||
// query
|
||||
if (dep.timeOffset == 0 || !latestOnly) {
|
||||
getTimeQuery(originalRequest, dep.node, latestOnly,
|
||||
queries, cache, latestOnlyCache);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#getPoints(java
|
||||
* .lang.String, java.lang.String[], java.util.Map)
|
||||
*/
|
||||
@Override
|
||||
public PointDataContainer getPoints(String plugin, String[] parameters,
|
||||
Map<String, RequestConstraint> queryParams) throws VizException {
|
||||
// TODO Someday we should put objective analysis code
|
||||
// into this area
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#getPoints(java
|
||||
* .lang.String, java.lang.String[], java.lang.String, java.util.Map)
|
||||
*/
|
||||
@Override
|
||||
public PointDataContainer getPoints(String plugin, String[] parameters,
|
||||
String levelKey, Map<String, RequestConstraint> queryParams)
|
||||
throws VizException {
|
||||
// TODO Someday we should put objective analysis code
|
||||
// into this area
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#getData(com.raytheon
|
||||
* .uf.viz.core.catalog.LayerProperty, int)
|
||||
*/
|
||||
@Override
|
||||
public List<Object> getData(LayerProperty property, int timeOut)
|
||||
throws VizException {
|
||||
List<AbstractRequestableLevelNode> requests = evaluateRequestConstraints(property
|
||||
.getEntryQueryParameters(false));
|
||||
int mapSize = (int) (requests.size() * 1.25) + 1;
|
||||
Map<AbstractRequestableLevelNode, List<AbstractRequestableData>> cache = new HashMap<AbstractRequestableLevelNode, List<AbstractRequestableData>>(
|
||||
mapSize);
|
||||
LinkedHashMap<AbstractRequestableLevelNode, DbQueryRequest> queries = new LinkedHashMap<AbstractRequestableLevelNode, DbQueryRequest>(
|
||||
mapSize);
|
||||
for (AbstractRequestableLevelNode req : requests) {
|
||||
getDataQuery(req, property, timeOut, queries, cache);
|
||||
}
|
||||
DbQueryRequestSet reqSet = new DbQueryRequestSet();
|
||||
reqSet.setQueries(queries.values().toArray(
|
||||
new DbQueryRequest[queries.size()]));
|
||||
DbQueryResponseSet qSetResponse = (DbQueryResponseSet) ThriftClient
|
||||
.sendRequest(reqSet);
|
||||
DbQueryResponse[] qResponses = qSetResponse.getResults();
|
||||
int index = 0;
|
||||
for (AbstractRequestableLevelNode node : queries.keySet()) {
|
||||
// put results into cache
|
||||
node.setDataQueryResults(qResponses[index++], cache);
|
||||
}
|
||||
|
||||
// pull the actual results from the cache
|
||||
List<AbstractRequestableData> requesters = new ArrayList<AbstractRequestableData>(
|
||||
requests.size());
|
||||
for (AbstractRequestableLevelNode request : requests) {
|
||||
requesters.addAll(request.getData(property, timeOut, cache));
|
||||
}
|
||||
|
||||
return getData(property, requesters);
|
||||
}
|
||||
|
||||
protected void getDataQuery(
|
||||
AbstractRequestableLevelNode req,
|
||||
LayerProperty property,
|
||||
int timeOut,
|
||||
LinkedHashMap<AbstractRequestableLevelNode, DbQueryRequest> queries,
|
||||
Map<AbstractRequestableLevelNode, List<AbstractRequestableData>> cache)
|
||||
throws VizException {
|
||||
List<Dependency> depends = req.getDependencies();
|
||||
if (depends.isEmpty()) {
|
||||
// is source node
|
||||
DbQueryRequest myQ = req.getDataQuery(property, timeOut, cache);
|
||||
if (myQ != null) {
|
||||
addDataQuery(req, myQ, queries);
|
||||
}
|
||||
} else {
|
||||
for (Dependency dep : depends) {
|
||||
// TODO: Optimize dTime/fTime to use bulk query mechanism,
|
||||
// small case that is a not easy to get right with a bulk
|
||||
// query
|
||||
if (dep.timeOffset == 0) {
|
||||
getDataQuery(dep.node, property, timeOut, queries, cache);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addDataQuery(AbstractRequestableLevelNode req,
|
||||
DbQueryRequest query,
|
||||
LinkedHashMap<AbstractRequestableLevelNode, DbQueryRequest> queries) {
|
||||
DbQueryRequest curQuery = queries.get(req);
|
||||
if (curQuery == null) {
|
||||
queries.put(req, query);
|
||||
} else {
|
||||
// merge
|
||||
// assume same DB, fields, etc, should only be different
|
||||
// time constraints since its the same node
|
||||
RequestConstraint curDTs = curQuery.getConstraints()
|
||||
.get("dataTime");
|
||||
RequestConstraint myDTs = query.getConstraints().get("dataTime");
|
||||
if (curDTs != null && myDTs != null) {
|
||||
// only merge if both require dataTimes, otherwise one
|
||||
// would be constrained when it needs everything, also
|
||||
// assuming both to be in lists and needing to be merged
|
||||
curDTs.setConstraintType(ConstraintType.IN);
|
||||
Pattern split = Pattern.compile(",");
|
||||
|
||||
String[] curVals = split.split(curDTs.getConstraintValue());
|
||||
String[] myVals = split.split(myDTs.getConstraintValue());
|
||||
HashSet<String> dups = new HashSet<String>(curVals.length
|
||||
+ myVals.length);
|
||||
dups.addAll(Arrays.asList(curVals));
|
||||
dups.addAll(Arrays.asList(myVals));
|
||||
curDTs.setConstraintValueList(dups.toArray(new String[dups
|
||||
.size()]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#
|
||||
* getBaseUpdateConstraints(java.util.Map)
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, RequestConstraint>> getBaseUpdateConstraints(
|
||||
Map<String, RequestConstraint> constraints) {
|
||||
List<Map<String, RequestConstraint>> result = new ArrayList<Map<String, RequestConstraint>>(
|
||||
1);
|
||||
result.add(constraints);
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#getRecord(com
|
||||
* .raytheon.uf.common.dataplugin.PluginDataObject)
|
||||
*/
|
||||
@Override
|
||||
public IDataRecord[] getRecord(PluginDataObject obj)
|
||||
throws VizDataCubeException {
|
||||
return getRecord(obj, Request.ALL, null);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#getRecord(com
|
||||
* .raytheon.uf.common.dataplugin.PluginDataObject,
|
||||
* com.raytheon.uf.common.datastorage.Request, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public IDataRecord[] getRecord(PluginDataObject obj, Request req,
|
||||
String dataset) throws VizDataCubeException {
|
||||
getRecords(Arrays.asList(obj), req, dataset);
|
||||
IDataRecord[] result = (IDataRecord[]) obj.getMessageData();
|
||||
obj.setMessageData(null);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Scan the inventory for AbstractRequestableLevelNodes that match the
|
||||
* request constraints
|
||||
*
|
||||
* @param constraints
|
||||
* @return
|
||||
*/
|
||||
protected abstract List<AbstractRequestableLevelNode> evaluateRequestConstraints(
|
||||
Map<String, RequestConstraint> constraints);
|
||||
|
||||
/**
|
||||
* @param queryTerms
|
||||
* @return
|
||||
*/
|
||||
protected abstract List<DataTime> timeAgnosticQuery(
|
||||
Map<String, RequestConstraint> queryTerms) throws VizException;
|
||||
|
||||
/**
|
||||
* @param requesters
|
||||
* @return
|
||||
*/
|
||||
protected abstract List<Object> getData(LayerProperty property,
|
||||
List<AbstractRequestableData> requesters) throws VizException;
|
||||
}
|
|
@ -81,6 +81,8 @@ import com.raytheon.uf.viz.derivparam.tree.UnionLevelNode;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 17, 2010 bsteffen Initial creation
|
||||
* Apr 11, 2012 DR14666 porricel Modified resolveField to
|
||||
* use middle of layer for BL
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -579,7 +581,7 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
|
|||
|| levelsToProcess == null || sourcesToProcess.isEmpty()
|
||||
|| paramsToProcess.isEmpty() || levelsToProcess.isEmpty()
|
||||
|| derParLibrary == null) {
|
||||
return Collections.emptyList();
|
||||
return null;
|
||||
}
|
||||
if (clazz != null) {
|
||||
// when clazz == null we need to link the aliases to the source
|
||||
|
@ -1021,17 +1023,24 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
|
|||
if (pStatic != null) {
|
||||
return pStatic;
|
||||
}
|
||||
|
||||
|
||||
// Check to see if we can set the field from the
|
||||
// masterlevel name
|
||||
if (level.getMasterLevel().getName().equals(fieldParamAbbrev)) {
|
||||
|
||||
FloatRequestableData data = new FloatRequestableData(
|
||||
FloatRequestableData data;
|
||||
if (level.isRangeLevel() && fieldParamAbbrev.equals("BL")){
|
||||
// get midpoint of boundary layer
|
||||
data = new FloatRequestableData(
|
||||
(float) ((level.getLevelonevalue() + level.getLeveltwovalue())/2));
|
||||
}
|
||||
else {
|
||||
data = new FloatRequestableData(
|
||||
(float) level.getLevelonevalue());
|
||||
}
|
||||
data.setUnit(level.getMasterLevel().getUnit());
|
||||
return data;
|
||||
}
|
||||
|
||||
String validSource = field.getValidSource();
|
||||
SourceNode fieldSourceNode = sourceNode;
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ import java.util.Set;
|
|||
|
||||
import com.raytheon.uf.common.dataplugin.level.Level;
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
||||
import com.raytheon.uf.common.dataquery.requests.TimeQueryRequest;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.derivparam.library.DerivParamDesc;
|
||||
|
@ -68,13 +67,11 @@ public abstract class AbstractAliasLevelNode extends AbstractDerivedLevelNode {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Set<DataTime> timeQueryInternal(TimeQueryRequest originalRequest,
|
||||
boolean latestOnly,
|
||||
public Set<DataTime> timeQueryInternal(boolean latestOnly,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> cache,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> latestOnlyCache)
|
||||
throws VizException {
|
||||
return sourceNode.timeQuery(originalRequest, latestOnly, cache,
|
||||
latestOnlyCache);
|
||||
return sourceNode.timeQuery(latestOnly, cache, latestOnlyCache);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -31,7 +31,6 @@ import java.util.Set;
|
|||
|
||||
import com.raytheon.uf.common.dataplugin.level.Level;
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
||||
import com.raytheon.uf.common.dataquery.requests.TimeQueryRequest;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.viz.core.catalog.CatalogQuery;
|
||||
import com.raytheon.uf.viz.core.catalog.LayerProperty;
|
||||
|
@ -271,8 +270,7 @@ public abstract class AbstractCubeLevelNode extends AbstractDerivedLevelNode {
|
|||
Map<String, RequestConstraint> requestContraintsToFilter);
|
||||
|
||||
@Override
|
||||
public Set<DataTime> timeQueryInternal(TimeQueryRequest originalRequest,
|
||||
boolean latestOnly,
|
||||
public Set<DataTime> timeQueryInternal(boolean latestOnly,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> cache,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> latestOnlyCache)
|
||||
throws VizException {
|
||||
|
@ -301,8 +299,8 @@ public abstract class AbstractCubeLevelNode extends AbstractDerivedLevelNode {
|
|||
|
||||
results.addAll(mergedTimeQuery(merge(requests), latestOnly));
|
||||
for (AbstractRequestableLevelNode request : requests) {
|
||||
results.addAll(request.timeQuery(originalRequest, latestOnly,
|
||||
cache, latestOnlyCache));
|
||||
results.addAll(request
|
||||
.timeQuery(latestOnly, cache, latestOnlyCache));
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
|
|
@ -243,8 +243,7 @@ public abstract class AbstractDerivedLevelNode extends
|
|||
}
|
||||
|
||||
@Override
|
||||
protected TimeQueryRequest getTimeQueryInternal(
|
||||
TimeQueryRequest originalRequest, boolean latestOnly,
|
||||
protected TimeQueryRequest getTimeQueryInternal(boolean latestOnly,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> cache)
|
||||
throws VizException {
|
||||
throw new UnsupportedOperationException(
|
||||
|
|
|
@ -205,8 +205,7 @@ public abstract class AbstractRequestableLevelNode extends LevelNode {
|
|||
protected abstract List<AbstractRequestableData> processDataQueryResults(
|
||||
DbQueryResponse queryResponse) throws VizException;
|
||||
|
||||
public Set<DataTime> timeQuery(TimeQueryRequest originalRequest,
|
||||
boolean latestOnly,
|
||||
public Set<DataTime> timeQuery(boolean latestOnly,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> cache,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> latestOnlyCache)
|
||||
throws VizException {
|
||||
|
@ -216,16 +215,15 @@ public abstract class AbstractRequestableLevelNode extends LevelNode {
|
|||
return latestOnlyCache.get(this);
|
||||
}
|
||||
|
||||
Set<DataTime> results = timeQueryInternal(originalRequest, latestOnly,
|
||||
cache, latestOnlyCache);
|
||||
Set<DataTime> results = timeQueryInternal(latestOnly, cache,
|
||||
latestOnlyCache);
|
||||
if (cache != null && !latestOnly) {
|
||||
cache.put(this, results);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
public TimeQueryRequest getTimeQuery(TimeQueryRequest originalRequest,
|
||||
boolean latestOnly,
|
||||
public TimeQueryRequest getTimeQuery(boolean latestOnly,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> cache,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> latestOnlyCache)
|
||||
throws VizException {
|
||||
|
@ -235,7 +233,7 @@ public abstract class AbstractRequestableLevelNode extends LevelNode {
|
|||
return null;
|
||||
}
|
||||
|
||||
return getTimeQueryInternal(originalRequest, latestOnly, cache);
|
||||
return getTimeQueryInternal(latestOnly, cache);
|
||||
}
|
||||
|
||||
public void setTimeQueryResults(boolean latestOnly,
|
||||
|
@ -388,14 +386,13 @@ public abstract class AbstractRequestableLevelNode extends LevelNode {
|
|||
return rval;
|
||||
}
|
||||
|
||||
protected abstract Set<DataTime> timeQueryInternal(
|
||||
TimeQueryRequest originalRequest, boolean latestOnly,
|
||||
protected abstract Set<DataTime> timeQueryInternal(boolean latestOnly,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> cache,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> latestOnlyCache)
|
||||
throws VizException;
|
||||
|
||||
protected abstract TimeQueryRequest getTimeQueryInternal(
|
||||
TimeQueryRequest originalRequest, boolean latestOnly,
|
||||
boolean latestOnly,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> cache)
|
||||
throws VizException;
|
||||
|
||||
|
@ -411,9 +408,8 @@ public abstract class AbstractRequestableLevelNode extends LevelNode {
|
|||
Map<AbstractRequestableLevelNode, List<AbstractRequestableData>> cache)
|
||||
throws VizException;
|
||||
|
||||
protected Set<DataTime> timeQuery(TimeQueryRequest originalRequest,
|
||||
boolean latestOnly) throws VizException {
|
||||
return timeQuery(originalRequest, latestOnly,
|
||||
protected Set<DataTime> timeQuery(boolean latestOnly) throws VizException {
|
||||
return timeQuery(latestOnly,
|
||||
new HashMap<AbstractRequestableLevelNode, Set<DataTime>>(),
|
||||
new HashMap<AbstractRequestableLevelNode, Set<DataTime>>());
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.level.Level;
|
||||
import com.raytheon.uf.common.dataquery.requests.TimeQueryRequest;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.viz.core.catalog.LayerProperty;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
@ -103,8 +102,7 @@ public class CompositeAverageLevelNode extends UnionLevelNode {
|
|||
* boolean, java.util.Map)
|
||||
*/
|
||||
@Override
|
||||
public Set<DataTime> timeQueryInternal(TimeQueryRequest originalRequest,
|
||||
boolean latestOnly,
|
||||
public Set<DataTime> timeQueryInternal(boolean latestOnly,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> cache,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> latestOnlyCache)
|
||||
throws VizException {
|
||||
|
@ -116,8 +114,8 @@ public class CompositeAverageLevelNode extends UnionLevelNode {
|
|||
for (AbstractRequestableLevelNode request : requests) {
|
||||
// Do not request just latest only because if two nodes have
|
||||
// different latests than this will return no times
|
||||
Set<DataTime> times = request.timeQuery(originalRequest, false,
|
||||
cache, latestOnlyCache);
|
||||
Set<DataTime> times = request.timeQuery(false, cache,
|
||||
latestOnlyCache);
|
||||
if (times == TIME_AGNOSTIC) {
|
||||
continue;
|
||||
} else if (results == TIME_AGNOSTIC) {
|
||||
|
|
|
@ -32,7 +32,6 @@ import java.util.Map.Entry;
|
|||
import java.util.Set;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.level.Level;
|
||||
import com.raytheon.uf.common.dataquery.requests.TimeQueryRequest;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.common.time.DataTime.FLAG;
|
||||
import com.raytheon.uf.viz.core.catalog.LayerProperty;
|
||||
|
@ -57,6 +56,9 @@ import com.raytheon.uf.viz.derivparam.library.IDerivParamField;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 14, 2009 rjpeter Initial creation
|
||||
* Apr 11, 2012 DR14666 porricel Modified getDataInternal to
|
||||
* use 0-30MB for derived boundary
|
||||
* layer
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -150,8 +152,7 @@ public class DerivedLevelNode extends AbstractDerivedLevelNode {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Set<DataTime> timeQueryInternal(TimeQueryRequest originalRequest,
|
||||
boolean latestOnly,
|
||||
public Set<DataTime> timeQueryInternal(boolean latestOnly,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> cache,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> latestOnlyCache)
|
||||
throws VizException {
|
||||
|
@ -178,8 +179,8 @@ public class DerivedLevelNode extends AbstractDerivedLevelNode {
|
|||
}
|
||||
for (DerivParamField field : fieldsKeys) {
|
||||
AbstractRequestableLevelNode node = fields.get(field);
|
||||
Set<DataTime> queryDataTimes = node.timeQuery(originalRequest,
|
||||
false, cache, latestOnlyCache);
|
||||
Set<DataTime> queryDataTimes = node.timeQuery(false, cache,
|
||||
latestOnlyCache);
|
||||
timeCache.put(field, queryDataTimes);
|
||||
if (queryDataTimes == TIME_AGNOSTIC) {
|
||||
if (availableDataTimes == null) {
|
||||
|
@ -287,7 +288,7 @@ public class DerivedLevelNode extends AbstractDerivedLevelNode {
|
|||
if (this.timeCache == null
|
||||
|| this.lastTimeQuery + TIME_QUERY_CACHE_TIME < System
|
||||
.currentTimeMillis()) {
|
||||
this.timeQuery(null, false);
|
||||
this.timeQuery(false);
|
||||
}
|
||||
|
||||
// keep a reference for scope of method
|
||||
|
@ -396,9 +397,12 @@ public class DerivedLevelNode extends AbstractDerivedLevelNode {
|
|||
if (record.getRequest().getBaseParams().size() == method
|
||||
.getFields().size()) {
|
||||
modifyRequest(record);
|
||||
// Define derived BL as 0-30MB
|
||||
if (record.getLevel().getMasterLevel().getName().equals("BL") && record.getLevel().getLevelOneValueAsString().equals("0.0") &&
|
||||
!record.getLevel().getLevelTwoValueAsString().equals("30.0"))
|
||||
continue;
|
||||
finalResponses.add(record);
|
||||
}
|
||||
|
||||
}
|
||||
return finalResponses;
|
||||
}
|
||||
|
|
|
@ -24,8 +24,8 @@ import java.util.HashMap;
|
|||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.level.Level;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
|
@ -70,7 +70,7 @@ public class ModelRunLevelNode extends AbstractAliasLevelNode {
|
|||
int timeOut,
|
||||
Map<AbstractRequestableLevelNode, List<AbstractRequestableData>> cache)
|
||||
throws VizException {
|
||||
Set<DataTime> allTimes = this.timeQuery(null, false);
|
||||
Set<DataTime> allTimes = this.timeQuery(false);
|
||||
Set<DataTime> neededTimes = null;
|
||||
DataTime[] requestedTimes = property.getSelectedEntryTime();
|
||||
if (requestedTimes == null) {
|
||||
|
|
|
@ -28,7 +28,6 @@ import java.util.Set;
|
|||
|
||||
import com.raytheon.uf.common.dataplugin.level.Level;
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
||||
import com.raytheon.uf.common.dataquery.requests.TimeQueryRequest;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.viz.core.catalog.LayerProperty;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
@ -117,7 +116,7 @@ public class OrLevelNode extends AbstractDerivedLevelNode {
|
|||
Set<DataTime> requestedTimes = null;
|
||||
DataTime[] requestedTimesArr = property.getSelectedEntryTime();
|
||||
if (requestedTimesArr == null) {
|
||||
requestedTimes = this.timeQuery(null, false);
|
||||
requestedTimes = this.timeQuery(false);
|
||||
} else {
|
||||
requestedTimes = new HashSet<DataTime>(
|
||||
Arrays.asList(requestedTimesArr));
|
||||
|
@ -145,15 +144,14 @@ public class OrLevelNode extends AbstractDerivedLevelNode {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Set<DataTime> timeQueryInternal(TimeQueryRequest originalRequest,
|
||||
boolean latestOnly,
|
||||
protected Set<DataTime> timeQueryInternal(boolean latestOnly,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> cache,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> latestOnlyCache)
|
||||
throws VizException {
|
||||
Set<DataTime> results = new HashSet<DataTime>();
|
||||
for (AbstractRequestableLevelNode node : nodes) {
|
||||
Set<DataTime> times = node.timeQuery(originalRequest, latestOnly,
|
||||
cache, latestOnlyCache);
|
||||
Set<DataTime> times = node.timeQuery(latestOnly, cache,
|
||||
latestOnlyCache);
|
||||
if (times == AbstractRequestableLevelNode.TIME_AGNOSTIC) {
|
||||
return times;
|
||||
} else {
|
||||
|
|
|
@ -99,8 +99,7 @@ public class StaticDataLevelNode extends AbstractDerivedLevelNode {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Set<DataTime> timeQueryInternal(TimeQueryRequest originalRequest,
|
||||
boolean latestOnly,
|
||||
public Set<DataTime> timeQueryInternal(boolean latestOnly,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> cache,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> latestOnlyCache)
|
||||
throws VizException {
|
||||
|
@ -108,8 +107,7 @@ public class StaticDataLevelNode extends AbstractDerivedLevelNode {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected TimeQueryRequest getTimeQueryInternal(
|
||||
TimeQueryRequest originalRequest, boolean latestOnly,
|
||||
protected TimeQueryRequest getTimeQueryInternal(boolean latestOnly,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> cache)
|
||||
throws VizException {
|
||||
return null;
|
||||
|
|
|
@ -28,7 +28,6 @@ import java.util.Map.Entry;
|
|||
import java.util.Set;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.level.Level;
|
||||
import com.raytheon.uf.common.dataquery.requests.TimeQueryRequest;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.viz.core.catalog.LayerProperty;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
@ -83,7 +82,7 @@ public class TimeRangeLevelNode extends AbstractAliasLevelNode {
|
|||
int timeOut,
|
||||
Map<AbstractRequestableLevelNode, List<AbstractRequestableData>> cache)
|
||||
throws VizException {
|
||||
Set<DataTime> allTime = sourceNode.timeQuery(null, false);
|
||||
Set<DataTime> allTime = sourceNode.timeQuery(false);
|
||||
Map<DataTime, List<DataTime>> goodTimes = new HashMap<DataTime, List<DataTime>>();
|
||||
Set<DataTime> timesToRequest = new HashSet<DataTime>();
|
||||
for (DataTime time : allTime) {
|
||||
|
@ -127,13 +126,12 @@ public class TimeRangeLevelNode extends AbstractAliasLevelNode {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Set<DataTime> timeQueryInternal(TimeQueryRequest originalRequest,
|
||||
boolean latestOnly,
|
||||
public Set<DataTime> timeQueryInternal(boolean latestOnly,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> cache,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> latestOnlyCache)
|
||||
throws VizException {
|
||||
Set<DataTime> allTime = sourceNode.timeQuery(originalRequest, false,
|
||||
cache, latestOnlyCache);
|
||||
Set<DataTime> allTime = sourceNode.timeQuery(false, cache,
|
||||
latestOnlyCache);
|
||||
Set<DataTime> goodTimes = new HashSet<DataTime>();
|
||||
for (DataTime time : allTime) {
|
||||
if (allTime.containsAll(calculateNeededTimes(time))) {
|
||||
|
|
|
@ -30,7 +30,6 @@ import java.util.Map.Entry;
|
|||
import java.util.Set;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.level.Level;
|
||||
import com.raytheon.uf.common.dataquery.requests.TimeQueryRequest;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.viz.core.catalog.LayerProperty;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
@ -143,8 +142,7 @@ public class UnionLevelNode extends AbstractDerivedLevelNode {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Set<DataTime> timeQueryInternal(TimeQueryRequest originalRequest,
|
||||
boolean latestOnly,
|
||||
public Set<DataTime> timeQueryInternal(boolean latestOnly,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> cache,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> latestOnlyCache)
|
||||
throws VizException {
|
||||
|
@ -155,8 +153,8 @@ public class UnionLevelNode extends AbstractDerivedLevelNode {
|
|||
List<AbstractRequestableLevelNode> requests = new ArrayList<AbstractRequestableLevelNode>(
|
||||
nodes);
|
||||
for (AbstractRequestableLevelNode request : requests) {
|
||||
Set<DataTime> times = request.timeQuery(originalRequest,
|
||||
latestOnly, cache, latestOnlyCache);
|
||||
Set<DataTime> times = request.timeQuery(latestOnly, cache,
|
||||
latestOnlyCache);
|
||||
if (times == TIME_AGNOSTIC) {
|
||||
continue;
|
||||
} else if (results == TIME_AGNOSTIC) {
|
||||
|
|
|
@ -87,7 +87,7 @@ import com.raytheon.uf.viz.monitor.listeners.IMonitorListener;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 04/03/10 4494 D. Hladky Initial release
|
||||
*
|
||||
* 16/04/12 DR 14511 G. Zhang Data retrieval uses Job
|
||||
* </pre>
|
||||
*
|
||||
* @author dhladky
|
||||
|
@ -138,10 +138,10 @@ public class FFMPMonitor extends ResourceMonitor implements
|
|||
public ArrayList<Date> dataTimes = null;
|
||||
|
||||
private FFMPTimeWindow rateWindow = null;
|
||||
|
||||
private FFMPTimeWindow qpfWindow = null;
|
||||
|
||||
private FFMPTimeWindow qpeWindow = null;
|
||||
//DR 14511: Data retrieval uses Job. VizApp.runAsync() uses GUI thread
|
||||
private DataJob dj1=new DataJob(), dj2=new DataJob(), dj3=new DataJob(), dj4=new DataJob();
|
||||
|
||||
/** The infamous templates **/
|
||||
private FFMPTemplates templates = null;
|
||||
|
@ -456,7 +456,7 @@ public class FFMPMonitor extends ResourceMonitor implements
|
|||
final String fsource = source;
|
||||
final String fhuc = huc;
|
||||
|
||||
VizApp.runAsync(new Runnable() {
|
||||
/*VizApp.runAsync*/dj1.request(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
|
@ -507,7 +507,7 @@ public class FFMPMonitor extends ResourceMonitor implements
|
|||
final String fsource = source;
|
||||
final FFMPBasin fbasin = basin;
|
||||
|
||||
VizApp.runAsync(new Runnable() {
|
||||
/*VizApp.runAsync*/dj2.request(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
|
@ -1813,7 +1813,7 @@ public class FFMPMonitor extends ResourceMonitor implements
|
|||
final String fsourceName = sourceName;
|
||||
final String fhuc = phuc;
|
||||
|
||||
VizApp.runAsync(new Runnable() {
|
||||
/*VizApp.runAsync*/dj3.request(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
|
@ -1865,7 +1865,7 @@ public class FFMPMonitor extends ResourceMonitor implements
|
|||
final Date fbarrierTime = barrierTime;
|
||||
final String fhuc = phuc;
|
||||
|
||||
VizApp.runAsync(new Runnable() {
|
||||
/*VizApp.runAsync*/dj4.request(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
|
@ -2591,5 +2591,44 @@ public class FFMPMonitor extends ResourceMonitor implements
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* DR 14511: Using Eclipse Job for data retrieval since
|
||||
* the original VizApp.runAsync() is using the GUI thread.
|
||||
*/
|
||||
private class DataJob extends org.eclipse.core.runtime.jobs.Job {
|
||||
|
||||
private static final int QUEUE_LIMIT = 1;
|
||||
|
||||
private java.util.concurrent.ArrayBlockingQueue<Runnable> requestQueue = new java.util.concurrent.ArrayBlockingQueue<Runnable>(
|
||||
QUEUE_LIMIT);
|
||||
|
||||
public DataJob() { super("Retrieving FFMP Graph Data..."); }
|
||||
|
||||
public void request(Runnable r) {
|
||||
|
||||
if (requestQueue.size() == QUEUE_LIMIT) {
|
||||
requestQueue.poll();
|
||||
}
|
||||
|
||||
requestQueue.add(r);
|
||||
this.schedule();
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
@Override
|
||||
protected org.eclipse.core.runtime.IStatus run(org.eclipse.core.runtime.IProgressMonitor progMonitor) {
|
||||
|
||||
Runnable r = requestQueue.poll();
|
||||
while (r != null) {
|
||||
|
||||
r.run();
|
||||
|
||||
r= requestQueue.poll();
|
||||
}
|
||||
|
||||
return org.eclipse.core.runtime.Status.OK_STATUS;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 30, 2009 lvenable Initial creation
|
||||
*
|
||||
* Apr 16, 2012 DR 14511 gzhang No use GUI thread for Graph data
|
||||
* </pre>
|
||||
*
|
||||
* @author lvenable
|
||||
|
@ -1608,9 +1608,19 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
*/
|
||||
private void fireGraphDataEvent(final String pfaf,
|
||||
final boolean differentPfaf, final Date ffmpDate) {
|
||||
|
||||
if((pfaf==null) || pfaf.isEmpty()){ resetCursor(); return; }
|
||||
shell.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
|
||||
|
||||
//DR 14511: GUI thread should not be used for Graph Data retrieval
|
||||
FFMPGraphData fgd = null;
|
||||
try{
|
||||
fgd = resource.getGraphData(pfaf);
|
||||
}catch (VizException e) {
|
||||
shell.setCursor(null);
|
||||
statusHandler.handle(Priority.PROBLEM,"Graph Data request failed ", e);
|
||||
}
|
||||
final FFMPGraphData fgd2 = fgd;
|
||||
if(fgd2 == null) { resetCursor(); return; }
|
||||
// This needs to be in sync
|
||||
Display.getDefault().asyncExec(new Runnable() {
|
||||
@Override
|
||||
|
@ -1622,9 +1632,9 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
return;
|
||||
}
|
||||
try {
|
||||
setGraphData(resource.getGraphData(pfaf), pfaf,
|
||||
setGraphData(/*resource.getGraphData(pfaf)*/fgd2, pfaf,
|
||||
differentPfaf, ffmpDate);
|
||||
} catch (VizException e) {
|
||||
} catch (/*Viz*/Exception e) {
|
||||
shell.setCursor(null);
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Graph Data request failed in resource", e);
|
||||
|
|
|
@ -134,13 +134,13 @@ import com.vividsolutions.jts.geom.Point;
|
|||
|
||||
/**
|
||||
* Resource to display FFMP data
|
||||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 29 June, 2009 2521 dhladky Initial creation
|
||||
* 11 Apr. 2012 DR 14522 gzhang Fixing invalid thread error.
|
||||
* 16 Apr. 2012 DR 14511 gzhang Handling NullPointer in getGraphData()
|
||||
* </pre>
|
||||
* @author dhladky
|
||||
* @version 1.0
|
||||
|
@ -3147,27 +3147,27 @@ public class FFMPResource extends
|
|||
Long dataId = null;
|
||||
FFMPVirtualGageBasinMetaData fvgbmd = null;
|
||||
FFMPBasin basin = null;
|
||||
|
||||
// System.out.println("*************************************************");
|
||||
|
||||
try {
|
||||
//DR 14511: handle null pointer exceptions
|
||||
try {
|
||||
basinPfaf = Long.parseLong(pfafString);
|
||||
dataId = basinPfaf;
|
||||
} catch (NumberFormatException nfe) {
|
||||
} catch (NumberFormatException nfe) {
|
||||
// can't parse a string for VGB
|
||||
fvgbmd = monitor.getTemplates(getSiteKey())
|
||||
.getVirtualGageBasinMetaData(getSiteKey(), pfafString);
|
||||
fvgbmd = monitor.getTemplates(getSiteKey()).getVirtualGageBasinMetaData(getSiteKey(), pfafString);
|
||||
basinPfaf = fvgbmd.getParentPfaf();
|
||||
dataId = fvgbmd.getLookupId();
|
||||
}
|
||||
|
||||
FFMPBasinMetaData mBasin = monitor.getTemplates(getSiteKey()).getBasin(
|
||||
getSiteKey(), basinPfaf); /*
|
||||
}
|
||||
FFMPBasinMetaData mBasin = null;
|
||||
try{
|
||||
mBasin = monitor.getTemplates(getSiteKey()).getBasin(getSiteKey(), basinPfaf);
|
||||
}catch (Exception e){ return null;}
|
||||
/*getSiteKey(), basinPfaf);*/ /*
|
||||
* TODO: mBasin is never used so it is
|
||||
* not clear if this should be
|
||||
* basinPfaf or dataId
|
||||
*/
|
||||
|
||||
if(mBasin == null) return null;
|
||||
FFMPGraphData fgd = null;
|
||||
// VGB
|
||||
if (fvgbmd != null) {
|
||||
|
|
|
@ -46,6 +46,8 @@ import com.raytheon.uf.viz.core.DrawableImage;
|
|||
import com.raytheon.uf.viz.core.HDF5Util;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget.RasterMode;
|
||||
import com.raytheon.uf.viz.core.IMesh;
|
||||
import com.raytheon.uf.viz.core.PixelCoverage;
|
||||
import com.raytheon.uf.viz.core.drawables.ColorMapLoader;
|
||||
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
||||
import com.raytheon.uf.viz.core.drawables.IImage;
|
||||
|
@ -53,12 +55,15 @@ import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
|||
import com.raytheon.uf.viz.core.drawables.ext.colormap.IColormappedImageExtension;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.map.IMapDescriptor;
|
||||
import com.raytheon.uf.viz.core.map.IMapMeshExtension;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
||||
import com.raytheon.uf.viz.core.rsc.IResourceDataChanged;
|
||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.ImagingCapability;
|
||||
import com.raytheon.uf.viz.core.rsc.hdf5.ImageTile;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
import com.vividsolutions.jts.geom.Envelope;
|
||||
|
||||
/**
|
||||
* NPP VIIRS resource. Responsible for drawing a single color band
|
||||
|
@ -189,8 +194,8 @@ public class VIIRSResource extends
|
|||
data.projectionData = new float[][] { lonFloats, latFloats };
|
||||
|
||||
data.tile = new ImageTile();
|
||||
// data.tile.rect = new Rectangle(0, 0, width, height);
|
||||
// data.tile.envelope = new Envelope(0, width, 0, height);
|
||||
data.tile.rect = new Rectangle(0, 0, width, height);
|
||||
data.tile.envelope = new Envelope(0, width, 0, height);
|
||||
|
||||
calculateMesh(data, target);
|
||||
|
||||
|
@ -379,21 +384,20 @@ public class VIIRSResource extends
|
|||
*/
|
||||
private void calculateMesh(VIIRSData frame, IGraphicsTarget target)
|
||||
throws VizException {
|
||||
// Rectangle tile = frame.tile.rect;
|
||||
// frame.tile.coverage = new PixelCoverage(new
|
||||
// Coordinate(tile.getMinX(),
|
||||
// tile.getMinY()),
|
||||
// new Coordinate(tile.getMaxX(), tile.getMinY()), new Coordinate(
|
||||
// tile.getMaxX(), tile.getMaxY()), new Coordinate(
|
||||
// tile.getMinX(), tile.getMaxY()));
|
||||
// IMesh mesh = target.getExtension(IMapMeshExtension.class)
|
||||
// .constructMesh(descriptor);
|
||||
// mesh.calculateMesh(frame.tile.coverage, frame.tile,
|
||||
// new VIIRSDataMathTransform(frame.projectionData,
|
||||
// frame.tile.rect.width, frame.tile.rect.height));
|
||||
// frame.projectionData = null;
|
||||
// frame.tile.coverage.setMesh(mesh);
|
||||
// frame.projectionData = null;
|
||||
Rectangle tile = frame.tile.rect;
|
||||
frame.tile.coverage = new PixelCoverage(new Coordinate(tile.getMinX(),
|
||||
tile.getMinY()),
|
||||
new Coordinate(tile.getMaxX(), tile.getMinY()), new Coordinate(
|
||||
tile.getMaxX(), tile.getMaxY()), new Coordinate(
|
||||
tile.getMinX(), tile.getMaxY()));
|
||||
IMesh mesh = target.getExtension(IMapMeshExtension.class)
|
||||
.constructMesh(descriptor);
|
||||
mesh.calculateMesh(frame.tile.coverage, frame.tile,
|
||||
new VIIRSDataMathTransform(frame.projectionData,
|
||||
frame.tile.rect.width, frame.tile.rect.height));
|
||||
frame.projectionData = null;
|
||||
frame.tile.coverage.setMesh(mesh);
|
||||
frame.projectionData = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
// this shader program sets values into a mosaic texture
|
||||
// which is the same size as the screen (frame buffer)
|
||||
// Use depth buffer texture
|
||||
|
||||
uniform sampler2D radarData;
|
||||
uniform sampler2D mosaicTexture;
|
||||
uniform sampler2D depthTexture;
|
||||
uniform int height;
|
||||
uniform int width;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
// TODO: Mimic mosaicMax except use depthTexture to look up current
|
||||
// depth buffer info (which will actually store the current distance
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
// this shader program sets values into a mosaic texture
|
||||
// which is the same size as the screen (frame buffer)
|
||||
|
||||
uniform sampler2D radarData;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec4 radarVal = texture2D(radarData,gl_TexCoord[0].st);
|
||||
gl_FragColor = vec4(radarVal.r,0.0,0.0,1.0);
|
||||
}
|
|
@ -1,13 +1,24 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.2"?>
|
||||
<plugin>
|
||||
<extension
|
||||
point="com.raytheon.viz.core.gl.shader">
|
||||
<shader
|
||||
loaderClass="com.raytheon.uf.viz.radar.gl.mosaic.MosaicShaderLoader"
|
||||
programName="mosaicMaxVal">
|
||||
</shader>
|
||||
<shader
|
||||
loaderClass="com.raytheon.uf.viz.radar.gl.mosaic.MosaicShaderLoader"
|
||||
programName="mosaicMinDist">
|
||||
</shader>
|
||||
</extension>
|
||||
<extension
|
||||
point="com.raytheon.uf.viz.core.graphicsExtension">
|
||||
<graphicsExtension
|
||||
class="com.raytheon.uf.viz.radar.gl.GLRadialMeshExtension">
|
||||
</graphicsExtension>
|
||||
<graphicsExtension
|
||||
class="com.raytheon.uf.viz.radar.gl.mosaic.GLRadarMosaicImageExtension">
|
||||
class="com.raytheon.uf.viz.radar.gl.mosaic.GLRadarMosaicRendererFactory">
|
||||
</graphicsExtension>
|
||||
</extension>
|
||||
</plugin>
|
||||
|
|
|
@ -59,7 +59,7 @@ public class GLRadialMeshExtension extends GraphicsExtension<IGLTarget>
|
|||
throws VizException {
|
||||
String format = radarData.getFormat();
|
||||
if ("Radial".equals(format)) {
|
||||
return RadarRadialMesh.getMesh(radarData, descriptor);
|
||||
return RadarRadialMeshCache.getMesh(radarData, descriptor);
|
||||
} else {
|
||||
throw new VizException(
|
||||
"Cannot construct radial meshes for non radial RadarRecords");
|
||||
|
@ -74,6 +74,6 @@ public class GLRadialMeshExtension extends GraphicsExtension<IGLTarget>
|
|||
*/
|
||||
@Override
|
||||
public int getCompatibilityValue(IGLTarget target) {
|
||||
return Compatibilty.TARGET_COMPATIBLE;
|
||||
return Compatibilty.TARGET_COMPATIBLE.value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,559 @@
|
|||
/**
|
||||
* 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.radar.gl;
|
||||
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
import org.geotools.coverage.grid.GeneralGridGeometry;
|
||||
|
||||
import com.raytheon.uf.common.colormap.IColorMap;
|
||||
import com.raytheon.uf.viz.core.DrawableCircle;
|
||||
import com.raytheon.uf.viz.core.DrawableColorMap;
|
||||
import com.raytheon.uf.viz.core.DrawableImage;
|
||||
import com.raytheon.uf.viz.core.DrawableLine;
|
||||
import com.raytheon.uf.viz.core.DrawableString;
|
||||
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.data.IDataPreparer;
|
||||
import com.raytheon.uf.viz.core.data.IRenderedImageCallback;
|
||||
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
import com.raytheon.uf.viz.core.drawables.IFont;
|
||||
import com.raytheon.uf.viz.core.drawables.IFont.Style;
|
||||
import com.raytheon.uf.viz.core.drawables.IImage;
|
||||
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
|
||||
import com.raytheon.uf.viz.core.drawables.IShadedShape;
|
||||
import com.raytheon.uf.viz.core.drawables.IWireframeShape;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.geom.PixelCoordinate;
|
||||
import com.raytheon.viz.core.gl.IGLTarget;
|
||||
import com.vividsolutions.jts.geom.LinearRing;
|
||||
|
||||
/**
|
||||
* IGraphicsTarget for mosaicing radar data, delegates all calls to an IGLTarget
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 22, 2010 mschenke Initial creation
|
||||
* Jul 19, 2010 #5952 bkowal Defined the 'updateExtent' method.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class MosaicGLTarget implements IGraphicsTarget {
|
||||
|
||||
private IGLTarget delegate;
|
||||
|
||||
public MosaicGLTarget(IGLTarget delegateTarget) {
|
||||
this.delegate = delegateTarget;
|
||||
}
|
||||
|
||||
/* Important functions!!! */
|
||||
public boolean drawRaster(IImage image, PixelCoverage extent,
|
||||
PaintProperties paintProps, RasterMode mode) throws VizException {
|
||||
return delegate.drawRaster(image, extent, paintProps, mode,
|
||||
"mosaicMaxVal");
|
||||
}
|
||||
|
||||
public boolean drawRaster(IImage image, PixelCoverage extent,
|
||||
PaintProperties paintProps) throws VizException {
|
||||
return delegate.drawRaster(image, extent, paintProps, "mosaicMaxVal");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.IGraphicsTarget#drawRasters(com.raytheon.uf.
|
||||
* viz.core.drawables.PaintProperties,
|
||||
* com.raytheon.uf.viz.core.DrawableImage[])
|
||||
*/
|
||||
@Override
|
||||
public boolean drawRasters(PaintProperties paintProps,
|
||||
DrawableImage... images) throws VizException {
|
||||
return delegate.drawRasters("mosaicMaxVal", paintProps, images);
|
||||
}
|
||||
|
||||
/* Standard delegate functions */
|
||||
public void beginFrame(IRenderableDisplay display, boolean isClearBackground) {
|
||||
delegate.beginFrame(display, isClearBackground);
|
||||
}
|
||||
|
||||
public IColorMap buildColorMap(String name) throws VizException {
|
||||
return delegate.buildColorMap(name);
|
||||
}
|
||||
|
||||
public void clearClippingPlane() {
|
||||
delegate.clearClippingPlane();
|
||||
}
|
||||
|
||||
public IShadedShape createShadedShape(boolean mutable,
|
||||
IDescriptor descriptor, boolean tesselate) {
|
||||
return delegate.createShadedShape(mutable, descriptor, tesselate);
|
||||
}
|
||||
|
||||
public IWireframeShape createWireframeShape(boolean mutable,
|
||||
GeneralGridGeometry geom, float simplificationLevel,
|
||||
boolean spatialChopFlag, IExtent extent) {
|
||||
return delegate.createWireframeShape(mutable, geom,
|
||||
simplificationLevel, spatialChopFlag, extent);
|
||||
}
|
||||
|
||||
public IWireframeShape createWireframeShape(boolean mutableFlag,
|
||||
GeneralGridGeometry geom) {
|
||||
return delegate.createWireframeShape(mutableFlag, geom);
|
||||
}
|
||||
|
||||
public IWireframeShape createWireframeShape(boolean mutable,
|
||||
IDescriptor descriptor, float simplificationLevel,
|
||||
boolean spatialChopFlag, IExtent extent) {
|
||||
return delegate.createWireframeShape(mutable, descriptor,
|
||||
simplificationLevel, spatialChopFlag, extent);
|
||||
}
|
||||
|
||||
public IWireframeShape createWireframeShape(boolean mutable,
|
||||
IDescriptor descriptor, float simplificationLevel) {
|
||||
return delegate.createWireframeShape(mutable, descriptor,
|
||||
simplificationLevel);
|
||||
}
|
||||
|
||||
public IWireframeShape createWireframeShape(boolean mutable,
|
||||
IDescriptor descriptor) {
|
||||
return delegate.createWireframeShape(mutable, descriptor);
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
delegate.dispose();
|
||||
}
|
||||
|
||||
public void drawArc(double x1, double y1, double z1, double radius,
|
||||
RGB color, float width, int startAzimuth, int arcWidth,
|
||||
LineStyle lineStyle, boolean includeSides) throws VizException {
|
||||
delegate.drawArc(x1, y1, z1, radius, color, width, startAzimuth,
|
||||
arcWidth, lineStyle, includeSides);
|
||||
}
|
||||
|
||||
public void drawCircle(double x1, double y1, double z1, double radius,
|
||||
RGB color, float width) throws VizException {
|
||||
delegate.drawCircle(x1, y1, z1, radius, color, width);
|
||||
}
|
||||
|
||||
public void drawColorRamp(IColorMap colorMap, IExtent pixelExtent,
|
||||
float blendAlpha) throws VizException {
|
||||
delegate.drawColorRamp(colorMap, pixelExtent, blendAlpha);
|
||||
}
|
||||
|
||||
public void drawCylinder(PixelCoordinate coord, RGB color, float alpha,
|
||||
double height, double baseRadius, double topRadius, int sideCount,
|
||||
int sliceCount, double rotation, double lean) {
|
||||
delegate.drawCylinder(coord, color, alpha, height, baseRadius,
|
||||
topRadius, sideCount, sliceCount, rotation, lean);
|
||||
}
|
||||
|
||||
public void drawFilledCircle(double x, double y, double z, double radius,
|
||||
RGB color) throws VizException {
|
||||
delegate.drawFilledCircle(x, y, z, radius, color);
|
||||
}
|
||||
|
||||
public void drawLine(double x1, double y1, double z1, double x2, double y2,
|
||||
double z2, RGB color, float width, LineStyle lineStyle)
|
||||
throws VizException {
|
||||
delegate.drawLine(x1, y1, z1, x2, y2, z2, color, width, lineStyle);
|
||||
}
|
||||
|
||||
public void drawLine(double x1, double y1, double z1, double x2, double y2,
|
||||
double z2, RGB color, float width) throws VizException {
|
||||
delegate.drawLine(x1, y1, z1, x2, y2, z2, color, width);
|
||||
}
|
||||
|
||||
public void drawPoint(double x, double y, double z, RGB color,
|
||||
PointStyle pointStyle) throws VizException {
|
||||
delegate.drawPoint(x, y, z, color, pointStyle);
|
||||
}
|
||||
|
||||
public void drawRect(IExtent pe, RGB color, float lineWidth, double alpha)
|
||||
throws VizException {
|
||||
delegate.drawRect(pe, color, lineWidth, alpha);
|
||||
}
|
||||
|
||||
public void drawShadedPolygon(LinearRing poly, RGB color, double alpha,
|
||||
byte[] pattern) throws VizException {
|
||||
delegate.drawShadedPolygon(poly, color, alpha, pattern);
|
||||
}
|
||||
|
||||
public void drawShadedRect(IExtent pe, RGB color, double alpha,
|
||||
byte[] pattern) throws VizException {
|
||||
delegate.drawShadedRect(pe, color, alpha, pattern);
|
||||
}
|
||||
|
||||
public void drawShadedShape(IShadedShape shape, float alpha)
|
||||
throws VizException {
|
||||
delegate.drawShadedShape(shape, alpha);
|
||||
}
|
||||
|
||||
public void drawString(IFont font, String text, double x, double y,
|
||||
double z, TextStyle textStyle, RGB color,
|
||||
HorizontalAlignment horizontalAlignment, Double rotation)
|
||||
throws VizException {
|
||||
delegate.drawString(font, text, x, y, z, textStyle, color,
|
||||
horizontalAlignment, rotation);
|
||||
}
|
||||
|
||||
public void drawString(IFont font, String text, double x, double y,
|
||||
double z, TextStyle textStyle, RGB color,
|
||||
HorizontalAlignment horizontalAlignment,
|
||||
VerticalAlignment verticalAlignment, Double rotation)
|
||||
throws VizException {
|
||||
delegate.drawString(font, text, x, y, z, textStyle, color,
|
||||
horizontalAlignment, verticalAlignment, rotation);
|
||||
}
|
||||
|
||||
public void drawStrings(IFont font, String[] text, double x, double y,
|
||||
double z, TextStyle textStyle, RGB[] colors,
|
||||
HorizontalAlignment horizontalAlignment,
|
||||
VerticalAlignment verticalAlignment) throws VizException {
|
||||
delegate.drawStrings(font, text, x, y, z, textStyle, colors,
|
||||
horizontalAlignment, verticalAlignment);
|
||||
}
|
||||
|
||||
public void drawString(IFont font, String string, double xPos, double yPos,
|
||||
double zPos, TextStyle textStyle, RGB color,
|
||||
HorizontalAlignment horizontalAlignment,
|
||||
VerticalAlignment verticalAlignment, Double rotation, float alpha,
|
||||
double magnification) throws VizException {
|
||||
// not implemented
|
||||
}
|
||||
|
||||
public void drawWireframeShape(IWireframeShape shape, RGB color,
|
||||
float lineWidth, LineStyle lineStyle, IFont font)
|
||||
throws VizException {
|
||||
delegate.drawWireframeShape(shape, color, lineWidth, lineStyle, font);
|
||||
}
|
||||
|
||||
public void drawWireframeShape(IWireframeShape shape, RGB color,
|
||||
float lineWidth, LineStyle lineStyle, IFont font, float alpha)
|
||||
throws VizException {
|
||||
delegate.drawWireframeShape(shape, color, lineWidth, lineStyle, font,
|
||||
alpha);
|
||||
}
|
||||
|
||||
public void drawWireframeShape(IWireframeShape shape, RGB color,
|
||||
float lineWidth, LineStyle lineStyle) throws VizException {
|
||||
delegate.drawWireframeShape(shape, color, lineWidth, lineStyle);
|
||||
}
|
||||
|
||||
public void drawWireframeShape(IWireframeShape shape, RGB color,
|
||||
float lineWidth, LineStyle lineStyle, float alpha)
|
||||
throws VizException {
|
||||
delegate.drawWireframeShape(shape, color, lineWidth, lineStyle, alpha);
|
||||
}
|
||||
|
||||
public void drawWireframeShape(IWireframeShape shape, RGB color,
|
||||
float lineWidth) throws VizException {
|
||||
delegate.drawWireframeShape(shape, color, lineWidth);
|
||||
}
|
||||
|
||||
public void endFrame() {
|
||||
delegate.endFrame();
|
||||
}
|
||||
|
||||
public IFont getDefaultFont() {
|
||||
return delegate.getDefaultFont();
|
||||
}
|
||||
|
||||
public double[] getPointOnCircle(double x1, double y1, double z1,
|
||||
double radius, double angle) throws VizException {
|
||||
return delegate.getPointOnCircle(x1, y1, z1, radius, angle);
|
||||
}
|
||||
|
||||
public Rectangle2D getStringBounds(IFont font, String text) {
|
||||
return delegate.getStringBounds(font, text);
|
||||
}
|
||||
|
||||
public String getViewType() {
|
||||
return delegate.getViewType();
|
||||
}
|
||||
|
||||
public void init() {
|
||||
delegate.init();
|
||||
}
|
||||
|
||||
public IFont initializeFont(File fontFile, float size, Style[] styles) {
|
||||
return delegate.initializeFont(fontFile, size, styles);
|
||||
}
|
||||
|
||||
public IFont initializeFont(String fontName, float size, Style[] styles) {
|
||||
return delegate.initializeFont(fontName, size, styles);
|
||||
}
|
||||
|
||||
public IFont initializeFont(String font) {
|
||||
return delegate.initializeFont(font);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public IImage initializeRaster(IDataPreparer preparer,
|
||||
ColorMapParameters optionalParams) {
|
||||
return delegate.initializeRaster(preparer, optionalParams);
|
||||
}
|
||||
|
||||
public IImage initializeRaster(IRenderedImageCallback imageCallback) {
|
||||
return delegate.initializeRaster(imageCallback);
|
||||
}
|
||||
|
||||
public boolean isNeedsRefresh() {
|
||||
return delegate.isNeedsRefresh();
|
||||
}
|
||||
|
||||
public void resize() {
|
||||
delegate.resize();
|
||||
}
|
||||
|
||||
public BufferedImage screenshot() {
|
||||
return delegate.screenshot();
|
||||
}
|
||||
|
||||
public void setBackgroundColor(RGB backgroundColor) {
|
||||
delegate.setBackgroundColor(backgroundColor);
|
||||
}
|
||||
|
||||
public void setNeedsRefresh(boolean needsRefresh) {
|
||||
delegate.setNeedsRefresh(needsRefresh);
|
||||
}
|
||||
|
||||
public void setupClippingPlane(IExtent extent) {
|
||||
delegate.setupClippingPlane(extent);
|
||||
}
|
||||
|
||||
public void setUseBuiltinColorbar(boolean isColorbarDisplayed) {
|
||||
delegate.setUseBuiltinColorbar(isColorbarDisplayed);
|
||||
}
|
||||
|
||||
public void stage(IImage image) throws VizException {
|
||||
delegate.stage(image);
|
||||
}
|
||||
|
||||
public void updateExtent(IExtent updatedExtent) {
|
||||
/* Do Nothing */
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.IGraphicsTarget#getStringBounds(com.raytheon
|
||||
* .uf.viz.core.drawables.IFont, java.lang.String[],
|
||||
* com.raytheon.uf.viz.core.IGraphicsTarget.TextStyle)
|
||||
*/
|
||||
@Override
|
||||
public Rectangle2D getStringBounds(IFont font, String[] text,
|
||||
TextStyle style) {
|
||||
return delegate.getStringBounds(font, text, style);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.IGraphicsTarget#drawColorRamp(com.raytheon.uf
|
||||
* .common.colormap.IColorMap, com.raytheon.uf.viz.core.IExtent, float,
|
||||
* float, float)
|
||||
*/
|
||||
@Override
|
||||
public void drawColorRamp(IColorMap colorMap, IExtent pixelExtent,
|
||||
float blendAlpha, float brightness, float contrast)
|
||||
throws VizException {
|
||||
delegate.drawColorRamp(colorMap, pixelExtent, blendAlpha, brightness,
|
||||
contrast);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.IGraphicsTarget#drawShadedShape(com.raytheon
|
||||
* .uf.viz.core.drawables.IShadedShape, float, float)
|
||||
*/
|
||||
@Override
|
||||
public void drawShadedShape(IShadedShape shape, float alpha,
|
||||
float brightness) throws VizException {
|
||||
delegate.drawShadedShape(shape, alpha, brightness);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.IGraphicsTarget#drawColorRamp(com.raytheon.uf
|
||||
* .viz.core.drawables.ColorMapParameters, com.raytheon.uf.viz.core.IExtent,
|
||||
* float)
|
||||
*/
|
||||
@Override
|
||||
public void drawColorRamp(ColorMapParameters colorMapParams,
|
||||
IExtent pixelExtent, float blendAlpha) throws VizException {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.IGraphicsTarget#drawColorRamp(com.raytheon.uf
|
||||
* .viz.core.drawables.ColorMapParameters, com.raytheon.uf.viz.core.IExtent,
|
||||
* float, float, float)
|
||||
*/
|
||||
@Override
|
||||
public void drawColorRamp(ColorMapParameters colorMapParams,
|
||||
IExtent pixelExtent, float blendAlpha, float brightness,
|
||||
float contrast) throws VizException {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.IGraphicsTarget#drawPoint(double, double,
|
||||
* double, org.eclipse.swt.graphics.RGB,
|
||||
* com.raytheon.uf.viz.core.IGraphicsTarget.PointStyle, float)
|
||||
*/
|
||||
@Override
|
||||
public void drawPoint(double x, double y, double z, RGB color,
|
||||
PointStyle pointStyle, float magnification) throws VizException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderOffscreen(IImage offscreenImage) throws VizException {
|
||||
delegate.renderOffscreen(offscreenImage);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderOnscreen() throws VizException {
|
||||
delegate.renderOnscreen();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.IGraphicsTarget#getStringsBounds(com.raytheon
|
||||
* .uf.viz.core.DrawStringsParameters)
|
||||
*/
|
||||
@Override
|
||||
public Rectangle2D getStringsBounds(DrawableString parameters) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.IGraphicsTarget#getStringsBounds(com.raytheon
|
||||
* .uf.viz.core.DrawStringsParameters, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public Rectangle2D getStringsBounds(DrawableString parameters, String string) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.IGraphicsTarget#drawStrings(com.raytheon.uf.
|
||||
* viz.core.DrawStringsParameters)
|
||||
*/
|
||||
@Override
|
||||
public void drawStrings(DrawableString... parameters) throws VizException {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.IGraphicsTarget#drawColorRamp(com.raytheon.uf
|
||||
* .viz.core.DrawableColorMap)
|
||||
*/
|
||||
@Override
|
||||
public void drawColorRamp(DrawableColorMap colorMap) throws VizException {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.IGraphicsTarget#drawCircle(com.raytheon.uf.viz
|
||||
* .core.DrawableCircle)
|
||||
*/
|
||||
@Override
|
||||
public void drawCircle(DrawableCircle... circle) throws VizException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawStrings(Collection<DrawableString> parameters)
|
||||
throws VizException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawPoints(Collection<double[]> locations, RGB color,
|
||||
PointStyle pointStyle, float magnification) throws VizException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawShadedShapes(float alpha, float brightness,
|
||||
IShadedShape... shapes) throws VizException {
|
||||
delegate.drawShadedShapes(alpha, brightness, shapes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getExtension(Class<T> extensionClass) throws VizException {
|
||||
return delegate.getExtension(extensionClass);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.IGraphicsTarget#drawLine(com.raytheon.uf.viz
|
||||
* .core.DrawableLine[])
|
||||
*/
|
||||
@Override
|
||||
public void drawLine(DrawableLine... lines) throws VizException {
|
||||
delegate.drawLine(lines);
|
||||
}
|
||||
|
||||
}
|
|
@ -19,25 +19,20 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.radar.gl;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.media.opengl.GL;
|
||||
|
||||
import org.geotools.coverage.grid.GeneralGridGeometry;
|
||||
import org.geotools.coverage.grid.GridGeometry2D;
|
||||
import org.opengis.referencing.operation.MathTransform;
|
||||
import org.opengis.referencing.operation.TransformException;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.radar.RadarRecord;
|
||||
import com.raytheon.uf.common.dataplugin.radar.util.RadarUtil;
|
||||
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.drawables.IDescriptor;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.map.IMapDescriptor;
|
||||
import com.raytheon.uf.viz.core.rsc.hdf5.ImageTile;
|
||||
import com.raytheon.viz.core.gl.AbstractGLMesh;
|
||||
import com.raytheon.viz.core.gl.GLGeometryObject2D;
|
||||
import com.raytheon.viz.core.gl.GLGeometryObject2D.GLGeometryObjectData;
|
||||
import com.raytheon.viz.core.gl.SharedCoordMap.SharedCoordinateKey;
|
||||
|
||||
/**
|
||||
|
@ -60,133 +55,30 @@ public class RadarRadialMesh extends AbstractGLMesh {
|
|||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(RadarRadialMesh.class);
|
||||
|
||||
private static class CacheKey {
|
||||
private final float latitude;
|
||||
|
||||
private final float longitude;
|
||||
|
||||
private final int hashCode;
|
||||
|
||||
private final int numBins;
|
||||
|
||||
private final int numRadials;
|
||||
|
||||
private final int gateResolution;
|
||||
|
||||
private final float trueElevationAngle;
|
||||
|
||||
private final int jStart;
|
||||
|
||||
private final float[] angleData;
|
||||
|
||||
private final GeneralGridGeometry gridGeometry;
|
||||
|
||||
public CacheKey(float latitude, float longitude, int numBins,
|
||||
int numRadials, int gateResolution, float trueElevationAngle,
|
||||
int jStart, float[] angleData, GeneralGridGeometry gridGeometry) {
|
||||
this.latitude = latitude;
|
||||
this.longitude = longitude;
|
||||
this.numBins = numBins;
|
||||
this.numRadials = numRadials;
|
||||
this.gateResolution = gateResolution;
|
||||
this.trueElevationAngle = trueElevationAngle;
|
||||
this.jStart = jStart;
|
||||
this.angleData = angleData;
|
||||
this.gridGeometry = gridGeometry;
|
||||
final int prime = 31;
|
||||
int hashCode = 1;
|
||||
hashCode = prime * hashCode + Arrays.hashCode(angleData);
|
||||
hashCode = prime * hashCode + gateResolution;
|
||||
hashCode = prime * hashCode + jStart;
|
||||
hashCode = prime * hashCode + Float.floatToIntBits(latitude);
|
||||
hashCode = prime * hashCode + Float.floatToIntBits(longitude);
|
||||
hashCode = prime * hashCode + numBins;
|
||||
hashCode = prime * hashCode + numRadials;
|
||||
hashCode = prime * hashCode
|
||||
+ Float.floatToIntBits(trueElevationAngle);
|
||||
hashCode = prime * hashCode + gridGeometry.hashCode();
|
||||
this.hashCode = hashCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
CacheKey other = (CacheKey) obj;
|
||||
if (hashCode != other.hashCode)
|
||||
return false;
|
||||
if (gateResolution != other.gateResolution)
|
||||
return false;
|
||||
if (jStart != other.jStart)
|
||||
return false;
|
||||
if (latitude != other.latitude)
|
||||
return false;
|
||||
if (longitude != other.longitude)
|
||||
return false;
|
||||
if (numBins != other.numBins)
|
||||
return false;
|
||||
if (numRadials != other.numRadials)
|
||||
return false;
|
||||
if (Float.floatToIntBits(trueElevationAngle) != Float
|
||||
.floatToIntBits(other.trueElevationAngle))
|
||||
return false;
|
||||
if (!Arrays.equals(angleData, other.angleData))
|
||||
return false;
|
||||
if (gridGeometry != null && other.gridGeometry == null) {
|
||||
return false;
|
||||
}
|
||||
if (gridGeometry == null && other.gridGeometry != null) {
|
||||
return false;
|
||||
}
|
||||
if (gridGeometry != null
|
||||
&& !gridGeometry.equals(other.gridGeometry)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private static Map<CacheKey, RadarRadialMesh> cache = new HashMap<CacheKey, RadarRadialMesh>();
|
||||
|
||||
/** The record to build the mesh for */
|
||||
private RadarRecord record;
|
||||
|
||||
private CacheKey cacheKey;
|
||||
private IMapDescriptor descriptor;
|
||||
|
||||
private int refCount;
|
||||
|
||||
public RadarRadialMesh(RadarRecord record,
|
||||
GeneralGridGeometry targetGeometry, CacheKey cacheKey)
|
||||
throws VizException {
|
||||
super(GL.GL_TRIANGLE_STRIP);
|
||||
public RadarRadialMesh(IMapDescriptor descriptor, RadarRecord record) {
|
||||
super(GL.GL_TRIANGLE_STRIP, descriptor);
|
||||
this.record = record;
|
||||
this.cacheKey = cacheKey;
|
||||
initialize(
|
||||
RadarUtil.constructGridGeometry(record.getCRS(),
|
||||
RadarUtil.calculateExtent(record),
|
||||
Math.max(record.getNumBins(), record.getNumRadials())),
|
||||
targetGeometry);
|
||||
refCount = 0;
|
||||
this.descriptor = descriptor;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double[][][] generateWorldCoords(GridGeometry2D imageGeometry,
|
||||
MathTransform mt) throws TransformException {
|
||||
protected double[][][] generateWorldCoords(ImageTile tile, MathTransform mt)
|
||||
throws TransformException {
|
||||
|
||||
int horizontalDivisions = key.horizontalDivisions;
|
||||
int verticalDivisions = key.verticalDivisions + 1;
|
||||
int verticalDivisions = key.verticalDivisions;
|
||||
|
||||
// get dx and dy for texture points
|
||||
float dX = (1.0f / (key.horizontalDivisions));
|
||||
float dX = (1.0f / (horizontalDivisions));
|
||||
|
||||
vertexCoords = new GLGeometryObject2D(new GLGeometryObjectData(
|
||||
GL.GL_TRIANGLE_STRIP, GL.GL_VERTEX_ARRAY));
|
||||
vertexCoords.allocate(2 * verticalDivisions * horizontalDivisions);
|
||||
|
||||
// set up our angle data for the radials
|
||||
float[] angles = record.getAngleData();
|
||||
|
@ -274,10 +166,9 @@ public class RadarRadialMesh extends AbstractGLMesh {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected SharedCoordinateKey generateKey(GridGeometry2D imageGeometry,
|
||||
MathTransform mt) {
|
||||
protected SharedCoordinateKey generateKey(ImageTile tile, MathTransform mt) {
|
||||
try {
|
||||
return new SharedCoordinateKey(record.getNumRadials(),
|
||||
return new SharedCoordinateKey(record.getNumRadials() + 1,
|
||||
getNumVerticalDivisions(mt, record));
|
||||
} catch (Exception e) {
|
||||
statusHandler
|
||||
|
@ -311,7 +202,7 @@ public class RadarRadialMesh extends AbstractGLMesh {
|
|||
in[1] = 0;
|
||||
toLatLon.transform(in, 0, out, 0, 1);
|
||||
|
||||
double[] start = worldToPixel(out);
|
||||
double[] start = descriptor.worldToPixel(out);
|
||||
|
||||
for (int i = 0; i < angles.length; ++i) {
|
||||
// grab end
|
||||
|
@ -324,7 +215,7 @@ public class RadarRadialMesh extends AbstractGLMesh {
|
|||
in[0] = range * sinAz;
|
||||
in[1] = range * cosAz;
|
||||
toLatLon.transform(in, 0, out, 0, 1);
|
||||
out = worldToPixel(out);
|
||||
out = descriptor.worldToPixel(out);
|
||||
|
||||
int[] curPow2 = new int[] { (int) Math.floor(Math.log(numBins)
|
||||
/ Math.log(2)) };
|
||||
|
@ -365,7 +256,7 @@ public class RadarRadialMesh extends AbstractGLMesh {
|
|||
double[] in = new double[] { rangeToTry * sinAz, rangeToTry * cosAz };
|
||||
double[] actual = new double[3];
|
||||
toLatLon.transform(in, 0, actual, 0, 1);
|
||||
actual = worldToPixel(actual);
|
||||
actual = descriptor.worldToPixel(actual);
|
||||
|
||||
// Get linear interpolated point
|
||||
double[] interp = new double[] { (endLoc[0] + startLoc[0]) / 2,
|
||||
|
@ -385,54 +276,4 @@ public class RadarRadialMesh extends AbstractGLMesh {
|
|||
}
|
||||
}
|
||||
|
||||
private void use() {
|
||||
refCount += 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.core.gl.AbstractGLMesh#dispose()
|
||||
*/
|
||||
@Override
|
||||
public synchronized void dispose() {
|
||||
refCount -= 1;
|
||||
synchronized (cache) {
|
||||
if (refCount == 0) {
|
||||
super.dispose();
|
||||
cache.remove(cacheKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static RadarRadialMesh getMesh(RadarRecord radarData,
|
||||
IDescriptor descriptor) throws VizException {
|
||||
float latitude = radarData.getLatitude();
|
||||
float longitude = radarData.getLongitude();
|
||||
int numBins = radarData.getNumBins();
|
||||
int numRadials = radarData.getNumRadials();
|
||||
int gateResolution = radarData.getGateResolution();
|
||||
float trueElevationAngle = radarData.getTrueElevationAngle();
|
||||
Integer jStart = radarData.getJstart();
|
||||
if (jStart == null) {
|
||||
jStart = 0;
|
||||
}
|
||||
float[] angleData = radarData.getAngleData();
|
||||
CacheKey key = new CacheKey(latitude, longitude, numBins, numRadials,
|
||||
gateResolution, trueElevationAngle, jStart, angleData,
|
||||
descriptor.getGridGeometry());
|
||||
synchronized (cache) {
|
||||
RadarRadialMesh mesh = cache.get(key);
|
||||
if (mesh == null) {
|
||||
// System.out.println("Mesh Cache miss");
|
||||
mesh = new RadarRadialMesh(radarData,
|
||||
descriptor.getGridGeometry(), key);
|
||||
cache.put(key, mesh);
|
||||
} else {
|
||||
// System.out.println("Mesh Cache hit");
|
||||
}
|
||||
mesh.use();
|
||||
return mesh;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,252 @@
|
|||
/**
|
||||
* 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.radar.gl;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.geotools.coverage.grid.GeneralGridGeometry;
|
||||
import org.geotools.coverage.grid.GridGeometry2D;
|
||||
import org.opengis.referencing.operation.MathTransform;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.radar.RadarRecord;
|
||||
import com.raytheon.uf.viz.core.IExtent;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.IMesh;
|
||||
import com.raytheon.uf.viz.core.PixelCoverage;
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.map.IMapDescriptor;
|
||||
import com.raytheon.uf.viz.core.rsc.hdf5.ImageTile;
|
||||
|
||||
/**
|
||||
*
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 28, 2011 bsteffen Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bsteffen
|
||||
* @version 1.0
|
||||
*/
|
||||
public class RadarRadialMeshCache {
|
||||
|
||||
private static class CacheKey {
|
||||
|
||||
private final float latitude;
|
||||
|
||||
private final float longitude;
|
||||
|
||||
private final int hashCode;
|
||||
|
||||
private final int numBins;
|
||||
|
||||
private final int numRadials;
|
||||
|
||||
private final int gateResolution;
|
||||
|
||||
private final float trueElevationAngle;
|
||||
|
||||
private final int jStart;
|
||||
|
||||
private final float[] angleData;
|
||||
|
||||
private final GeneralGridGeometry gridGeometry;
|
||||
|
||||
public CacheKey(float latitude, float longitude, int numBins,
|
||||
int numRadials, int gateResolution, float trueElevationAngle,
|
||||
int jStart, float[] angleData, GeneralGridGeometry gridGeometry) {
|
||||
this.latitude = latitude;
|
||||
this.longitude = longitude;
|
||||
this.numBins = numBins;
|
||||
this.numRadials = numRadials;
|
||||
this.gateResolution = gateResolution;
|
||||
this.trueElevationAngle = trueElevationAngle;
|
||||
this.jStart = jStart;
|
||||
this.angleData = angleData;
|
||||
this.gridGeometry = gridGeometry;
|
||||
final int prime = 31;
|
||||
int hashCode = 1;
|
||||
hashCode = prime * hashCode + Arrays.hashCode(angleData);
|
||||
hashCode = prime * hashCode + gateResolution;
|
||||
hashCode = prime * hashCode + jStart;
|
||||
hashCode = prime * hashCode + Float.floatToIntBits(latitude);
|
||||
hashCode = prime * hashCode + Float.floatToIntBits(longitude);
|
||||
hashCode = prime * hashCode + numBins;
|
||||
hashCode = prime * hashCode + numRadials;
|
||||
hashCode = prime * hashCode
|
||||
+ Float.floatToIntBits(trueElevationAngle);
|
||||
hashCode = prime * hashCode + gridGeometry.hashCode();
|
||||
this.hashCode = hashCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
CacheKey other = (CacheKey) obj;
|
||||
if (hashCode != other.hashCode)
|
||||
return false;
|
||||
if (gateResolution != other.gateResolution)
|
||||
return false;
|
||||
if (jStart != other.jStart)
|
||||
return false;
|
||||
if (latitude != other.latitude)
|
||||
return false;
|
||||
if (longitude != other.longitude)
|
||||
return false;
|
||||
if (numBins != other.numBins)
|
||||
return false;
|
||||
if (numRadials != other.numRadials)
|
||||
return false;
|
||||
if (Float.floatToIntBits(trueElevationAngle) != Float
|
||||
.floatToIntBits(other.trueElevationAngle))
|
||||
return false;
|
||||
if (!Arrays.equals(angleData, other.angleData))
|
||||
return false;
|
||||
if (gridGeometry != null && other.gridGeometry == null) {
|
||||
return false;
|
||||
}
|
||||
if (gridGeometry == null && other.gridGeometry != null) {
|
||||
return false;
|
||||
}
|
||||
if (gridGeometry != null
|
||||
&& !gridGeometry.equals(other.gridGeometry)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static class RadarSharedMesh implements IMesh {
|
||||
|
||||
private final CacheKey key;
|
||||
|
||||
private final IMesh mesh;
|
||||
|
||||
private int refCount = 0;
|
||||
|
||||
private boolean calculated = false;
|
||||
|
||||
private RadarSharedMesh(IMesh mesh, CacheKey key) {
|
||||
this.mesh = mesh;
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(IGraphicsTarget target, PaintProperties paintProps)
|
||||
throws VizException {
|
||||
mesh.paint(target, paintProps);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void calculateMesh(PixelCoverage pc,
|
||||
ImageTile tile, MathTransform toLatLon) {
|
||||
if (!calculated) {
|
||||
mesh.calculateMesh(pc, tile, toLatLon);
|
||||
calculated = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void calculateMesh(PixelCoverage pc,
|
||||
GridGeometry2D gg) {
|
||||
if (!calculated) {
|
||||
mesh.calculateMesh(pc, gg);
|
||||
calculated = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
refCount -= 1;
|
||||
synchronized (cache) {
|
||||
if (refCount == 0) {
|
||||
mesh.dispose();
|
||||
cache.remove(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void use() {
|
||||
refCount += 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean intersects(IExtent extent) {
|
||||
return mesh.intersects(extent);
|
||||
}
|
||||
}
|
||||
|
||||
private static Map<CacheKey, RadarSharedMesh> cache = new HashMap<CacheKey, RadarSharedMesh>();
|
||||
|
||||
public static RadarSharedMesh getMesh(RadarRecord radarData,
|
||||
IDescriptor descriptor) throws VizException {
|
||||
float latitude = radarData.getLatitude();
|
||||
float longitude = radarData.getLongitude();
|
||||
int numBins = radarData.getNumBins();
|
||||
int numRadials = radarData.getNumRadials();
|
||||
int gateResolution = radarData.getGateResolution();
|
||||
float trueElevationAngle = radarData.getTrueElevationAngle();
|
||||
Integer jStart = radarData.getJstart();
|
||||
if (jStart == null) {
|
||||
jStart = 0;
|
||||
}
|
||||
float[] angleData = radarData.getAngleData();
|
||||
CacheKey key = new CacheKey(latitude, longitude, numBins, numRadials,
|
||||
gateResolution, trueElevationAngle, jStart, angleData,
|
||||
descriptor.getGridGeometry());
|
||||
synchronized (cache) {
|
||||
RadarSharedMesh mesh = cache.get(key);
|
||||
if (mesh == null) {
|
||||
// System.out.println("Mesh Cache miss");
|
||||
IMesh baseMesh = new RadarRadialMesh(
|
||||
(IMapDescriptor) descriptor, radarData);
|
||||
mesh = new RadarSharedMesh(baseMesh, key);
|
||||
cache.put(key, mesh);
|
||||
} else {
|
||||
// System.out.println("Mesh Cache hit");
|
||||
}
|
||||
mesh.use();
|
||||
return mesh;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -17,23 +17,24 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.core.drawables.ext;
|
||||
package com.raytheon.uf.viz.radar.gl.mosaic;
|
||||
|
||||
import com.raytheon.uf.viz.core.DrawableImage;
|
||||
import com.raytheon.uf.viz.core.drawables.IImage;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.GraphicsExtension.IGraphicsExtensionInterface;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.viz.core.gl.IGLTarget;
|
||||
import com.raytheon.viz.core.gl.glsl.AbstractShaderLoader;
|
||||
import com.raytheon.viz.core.gl.glsl.GLShaderProgram;
|
||||
|
||||
/**
|
||||
* Interface extensions that return IImage objects should implement
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 15, 2011 mschenke Initial creation
|
||||
* Sep 20, 2010 mschenke Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -41,17 +42,22 @@ import com.raytheon.uf.viz.core.exception.VizException;
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public interface IImagingExtension extends IGraphicsExtensionInterface {
|
||||
public class CompReflShaderLoader extends AbstractShaderLoader {
|
||||
|
||||
/**
|
||||
* Draw the images passed in
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @param paintProps
|
||||
* @param images
|
||||
* @return whether all images were drawn or not
|
||||
* @throws VizException
|
||||
* @see
|
||||
* com.raytheon.viz.core.gl.glsl.IShaderLoader#loadData(com.raytheon.viz
|
||||
* .core.gl.IGLTarget, com.raytheon.viz.core.gl.glsl.GLShaderProgram,
|
||||
* com.raytheon.uf.viz.core.drawables.IImage,
|
||||
* com.raytheon.uf.viz.core.drawables.PaintProperties)
|
||||
*/
|
||||
public boolean drawRasters(PaintProperties paintProps,
|
||||
DrawableImage... images) throws VizException;
|
||||
@Override
|
||||
public void loadData(IGLTarget target, GLShaderProgram program,
|
||||
IImage image, PaintProperties paintProps) throws VizException {
|
||||
// load radar data to GL_TEXTURE0 (bound in drawRaster)
|
||||
program.setUniform("radarData", 0);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,107 +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.radar.gl.mosaic;
|
||||
|
||||
import com.raytheon.uf.viz.core.DrawableImage;
|
||||
import com.raytheon.viz.core.gl.images.AbstractGLImage;
|
||||
import com.raytheon.viz.core.gl.images.GLDelegateImage;
|
||||
import com.raytheon.viz.radar.rsc.mosaic.ext.IRadarMosaicImageExtension.IMosaicImage;
|
||||
|
||||
/**
|
||||
* GL implementation of IMosaicImage, wraps an offscreen image and contains
|
||||
* other DrawableImages to mosaic
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 16, 2011 mschenke Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class GLMosaicImage extends GLDelegateImage<AbstractGLImage> implements
|
||||
IMosaicImage {
|
||||
|
||||
private DrawableImage[] images;
|
||||
|
||||
private boolean repaint;
|
||||
|
||||
private int[] bounds;
|
||||
|
||||
/**
|
||||
* @param target
|
||||
* @param image
|
||||
* @param extensionClass
|
||||
*/
|
||||
public GLMosaicImage(AbstractGLImage image, int[] bounds) {
|
||||
super(image, GLRadarMosaicImageExtension.class);
|
||||
this.bounds = bounds;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.core.gl.images.GLDelegateImage#getWidth()
|
||||
*/
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return bounds[0];
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.core.gl.images.GLDelegateImage#getHeight()
|
||||
*/
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return bounds[1];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the repaint
|
||||
*/
|
||||
public boolean isRepaint() {
|
||||
return repaint;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param repaint
|
||||
* @return
|
||||
*/
|
||||
public void setRepaint(boolean repaint) {
|
||||
this.repaint = repaint;
|
||||
}
|
||||
|
||||
public DrawableImage[] getImagesToMosaic() {
|
||||
return images;
|
||||
}
|
||||
|
||||
public void setImagesToMosaic(DrawableImage... images) {
|
||||
this.images = images;
|
||||
repaint = true;
|
||||
}
|
||||
}
|
|
@ -1,164 +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.radar.gl.mosaic;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import javax.media.opengl.GL;
|
||||
|
||||
import com.raytheon.uf.viz.core.DrawableImage;
|
||||
import com.raytheon.uf.viz.core.PixelCoverage;
|
||||
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
||||
import com.raytheon.uf.viz.core.drawables.IImage;
|
||||
import com.raytheon.uf.viz.core.drawables.ImagingSupport;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.IOffscreenRenderingExtension;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.viz.core.gl.ext.GLOffscreenRenderingExtension;
|
||||
import com.raytheon.viz.core.gl.glsl.AbstractGLSLImagingExtension;
|
||||
import com.raytheon.viz.core.gl.glsl.GLShaderProgram;
|
||||
import com.raytheon.viz.core.gl.images.AbstractGLImage;
|
||||
import com.raytheon.viz.radar.rsc.mosaic.ext.IRadarMosaicImageExtension;
|
||||
|
||||
/**
|
||||
* Extension used for rendering radar mosaic images
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 16, 2011 mschenke Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class GLRadarMosaicImageExtension extends AbstractGLSLImagingExtension
|
||||
implements IRadarMosaicImageExtension {
|
||||
|
||||
private AbstractGLImage writeToImage;
|
||||
|
||||
public GLMosaicImage initializeRaster(int[] imageBounds,
|
||||
ColorMapParameters params) throws VizException {
|
||||
return new GLMosaicImage(target.getExtension(
|
||||
GLOffscreenRenderingExtension.class).constructOffscreenImage(
|
||||
ByteBuffer.class, imageBounds, params), imageBounds);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.core.gl.ext.AbstractGLImagingExtension#getShaderProgramName
|
||||
* ()
|
||||
*/
|
||||
@Override
|
||||
public String getShaderProgramName() {
|
||||
return "mosaicMaxVal";
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.core.gl.ext.AbstractGLImagingExtension#preImageRender
|
||||
* (com.raytheon.uf.viz.core.drawables.PaintProperties,
|
||||
* com.raytheon.viz.core.gl.images.AbstractGLImage)
|
||||
*/
|
||||
@Override
|
||||
public synchronized Object preImageRender(PaintProperties paintProps,
|
||||
AbstractGLImage image, PixelCoverage coverage) throws VizException {
|
||||
if (image instanceof GLMosaicImage) {
|
||||
GLMosaicImage mosaicImage = (GLMosaicImage) image;
|
||||
if (mosaicImage.isRepaint()) {
|
||||
writeToImage = mosaicImage.getWrappedImage();
|
||||
IOffscreenRenderingExtension extension = target
|
||||
.getExtension(IOffscreenRenderingExtension.class);
|
||||
try {
|
||||
extension.renderOffscreen(mosaicImage);
|
||||
DrawableImage[] imagesToMosaic = mosaicImage
|
||||
.getImagesToMosaic();
|
||||
// Make sure images are staged before we mosaic them
|
||||
ImagingSupport.prepareImages(target, imagesToMosaic);
|
||||
// Need to set repaint based on if drawing completed
|
||||
mosaicImage.setRepaint(drawRasters(paintProps,
|
||||
imagesToMosaic) == false);
|
||||
} finally {
|
||||
extension.renderOnscreen();
|
||||
}
|
||||
writeToImage = null;
|
||||
}
|
||||
|
||||
target.drawRasters(paintProps,
|
||||
new DrawableImage(mosaicImage.getWrappedImage(), coverage));
|
||||
// Don't actually render this image now since we just did it
|
||||
return null;
|
||||
} else {
|
||||
GL gl = target.getGl();
|
||||
// activate on texture2 as 0 is radar image and 1 is colormap
|
||||
gl.glActiveTexture(GL.GL_TEXTURE2);
|
||||
gl.glBindTexture(writeToImage.getTextureStorageType(),
|
||||
writeToImage.getTextureid());
|
||||
return image;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.core.gl.ext.AbstractGLImagingExtension#postImageRender
|
||||
* (com.raytheon.uf.viz.core.drawables.PaintProperties,
|
||||
* com.raytheon.viz.core.gl.images.AbstractGLImage, java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void postImageRender(PaintProperties paintProps,
|
||||
AbstractGLImage image, Object data) throws VizException {
|
||||
GL gl = target.getGl();
|
||||
// activate on texture2 as 0 is radar image and 1 is colormap
|
||||
gl.glActiveTexture(GL.GL_TEXTURE2);
|
||||
gl.glBindTexture(writeToImage.getTextureStorageType(), 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.core.gl.ext.AbstractGLImagingExtension#loadShaderData
|
||||
* (com.raytheon.viz.core.gl.glsl.GLShaderProgram,
|
||||
* com.raytheon.uf.viz.core.drawables.IImage,
|
||||
* com.raytheon.uf.viz.core.drawables.PaintProperties)
|
||||
*/
|
||||
@Override
|
||||
public void loadShaderData(GLShaderProgram program, IImage image,
|
||||
PaintProperties paintProps) throws VizException {
|
||||
program.setUniform("radarData", 0);
|
||||
program.setUniform("mosaicTexture", 2);
|
||||
|
||||
// pass in width and height
|
||||
program.setUniform("height", (paintProps.getCanvasBounds().height));
|
||||
program.setUniform("width", (paintProps.getCanvasBounds().width));
|
||||
}
|
||||
|
||||
}
|
|
@ -17,15 +17,16 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.viz.core.gl.glsl;
|
||||
package com.raytheon.uf.viz.radar.gl.mosaic;
|
||||
|
||||
import com.raytheon.viz.core.gl.GLCapabilities;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.GraphicsExtension;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.viz.core.gl.IGLTarget;
|
||||
import com.raytheon.viz.core.gl.ext.AbstractGLImagingExtension;
|
||||
import com.raytheon.viz.core.gl.internal.GLTarget;
|
||||
import com.raytheon.viz.radar.rsc.mosaic.MergeRasterRadarMosaicRenderer;
|
||||
import com.raytheon.viz.radar.rsc.mosaic.ext.IRadarMosaicRendererFactoryExtension;
|
||||
|
||||
/**
|
||||
* Abstract GL Extension that requires shader to work properly
|
||||
* Radar mosaic renderer factory for IGLTarget
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -33,7 +34,7 @@ import com.raytheon.viz.core.gl.internal.GLTarget;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 15, 2011 mschenke Initial creation
|
||||
* Nov 22, 2011 mschenke Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -41,8 +42,28 @@ import com.raytheon.viz.core.gl.internal.GLTarget;
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public abstract class AbstractGLSLImagingExtension extends
|
||||
AbstractGLImagingExtension {
|
||||
public class GLRadarMosaicRendererFactory extends GraphicsExtension<IGLTarget>
|
||||
implements IRadarMosaicRendererFactoryExtension {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.radar.rsc.mosaic.ext.IRadarMosaicRendererFactoryExtension
|
||||
* #createNewRenderer()
|
||||
*/
|
||||
@Override
|
||||
public IRadarMosaicRenderer createNewRenderer(MosaicType mosaicType)
|
||||
throws VizException {
|
||||
switch (mosaicType) {
|
||||
case MergeRaster:
|
||||
return new MergeRasterRadarMosaicRenderer();
|
||||
case MaxValue:
|
||||
return new RadarMosaicRenderer();
|
||||
}
|
||||
throw new VizException("Could not find mosaic renderer for type = "
|
||||
+ mosaicType);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
|
@ -52,12 +73,7 @@ public abstract class AbstractGLSLImagingExtension extends
|
|||
*/
|
||||
@Override
|
||||
public int getCompatibilityValue(IGLTarget target) {
|
||||
if (GLCapabilities.getInstance(target.getGl()).cardSupportsShaders
|
||||
&& GLTarget.FORCE_NO_SHADER == false) {
|
||||
return Compatibilty.ENHANCED_TARGET_COMPATIBLE;
|
||||
} else {
|
||||
return Compatibilty.INCOMPATIBLE;
|
||||
}
|
||||
return Compatibilty.TARGET_COMPATIBLE.value;
|
||||
}
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue