Issue #189 conversion of vb to use grid correctly.

Former-commit-id: 393f087340 [formerly ee36e85848 [formerly b47ccc0e899e6067f6c827f5637bb250aa186d7c]]
Former-commit-id: ee36e85848
Former-commit-id: a0fd9c1fbf
This commit is contained in:
Ben Steffensmeier 2012-09-25 15:05:46 -05:00
parent a7f4e39a4a
commit 15f284ac89
5 changed files with 130 additions and 130 deletions

View file

@ -11,29 +11,26 @@ Require-Bundle: org.eclipse.ui,
com.raytheon.viz.core,
com.raytheon.viz.ui,
com.raytheon.viz.pointdata,
com.raytheon.viz.core.graphing,
com.raytheon.uf.viz.xy.crosssection,
com.raytheon.uf.viz.xy.timeheight,
com.raytheon.uf.viz.xy.varheight,
com.raytheon.viz.skewt,
com.raytheon.viz.redbook,
com.raytheon.viz.awipstools,
com.raytheon.edex.common,
com.raytheon.viz.grid,
com.raytheon.viz.satellite,
com.raytheon.viz.lightning,
com.raytheon.viz.radar,
com.raytheon.uf.viz.d2d.ui,
org.geotools,
com.raytheon.uf.viz.xy.timeseries,
com.raytheon.uf.viz.xy,
javax.measure,
com.raytheon.uf.viz.objectiveanalysis,
com.raytheon.uf.common.pointdata,
net.sf.swtaddons;bundle-version="1.0.0",
com.raytheon.uf.common.dataplugin.radar;bundle-version="1.0.0",
com.raytheon.uf.viz.points;bundle-version="1.0.0",
com.raytheon.uf.common.dataplugin.grid
com.raytheon.uf.viz.d2d.nsharp;bundle-version="1.0.0",
gov.noaa.nws.ncep.ui.nsharp;bundle-version="1.0.0",
com.raytheon.uf.common.message;bundle-version="1.12.1174"
Bundle-ActivationPolicy: lazy
Export-Package: com.raytheon.viz.volumebrowser,
com.raytheon.viz.volumebrowser.catalog,
@ -41,32 +38,14 @@ Export-Package: com.raytheon.viz.volumebrowser,
com.raytheon.viz.volumebrowser.vbui,
com.raytheon.viz.volumebrowser.xml
Import-Package: com.raytheon.uf.common.comm,
com.raytheon.uf.common.dataplugin.grib,
com.raytheon.uf.common.dataplugin.grid,
com.raytheon.uf.common.dataplugin.grid.dataset,
com.raytheon.uf.common.dataplugin.level,
com.raytheon.uf.common.dataplugin.obs.metar,
com.raytheon.uf.common.derivparam.tree,
com.raytheon.uf.common.gridcoverage,
com.raytheon.uf.common.menus,
com.raytheon.uf.common.menus.xml,
com.raytheon.uf.common.message.response,
com.raytheon.uf.viz.core.maps.display,
com.raytheon.uf.viz.d2d.core,
com.raytheon.uf.viz.d2d.core.map,
com.raytheon.uf.viz.d2d.core.time,
com.raytheon.uf.viz.d2d.nsharp.display,
com.raytheon.uf.viz.d2d.nsharp.rsc,
com.raytheon.uf.viz.d2d.ui,
com.raytheon.uf.viz.derivparam,
com.raytheon.uf.viz.derivparam.inv,
com.raytheon.uf.viz.profiler,
com.raytheon.uf.viz.profiler.ui,
com.raytheon.uf.viz.sounding,
com.raytheon.uf.viz.ui.menus,
com.raytheon.uf.viz.ui.menus.widgets,
com.raytheon.uf.viz.ui.menus.xml,
com.raytheon.uf.viz.xy,
com.raytheon.uf.viz.xy.varheight.hodo,
com.vividsolutions.jts.geom,
gov.noaa.nws.ncep.ui.nsharp.skewt,
gov.noaa.nws.ncep.viz.common.soundingQuery
com.vividsolutions.jts.geom
Bundle-RequiredExecutionEnvironment: JavaSE-1.6

View file

@ -25,6 +25,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.raytheon.uf.common.dataplugin.grid.GridConstants;
import com.raytheon.uf.common.dataplugin.grid.dataset.DatasetInfo;
import com.raytheon.uf.common.dataplugin.grid.dataset.DatasetInfoLookup;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
@ -119,7 +120,7 @@ public class GridAlterBundleContributor implements IAlterBundleContributor {
String selectedString) {
Map<String, RequestConstraint> reqMap = data.getMetadataMap();
if (selectedString != null) {
reqMap.put("modelInfo.modelName", new RequestConstraint(
reqMap.put(GridConstants.DATASET_ID, new RequestConstraint(
selectedString));
DatasetInfoLookup lookup = DatasetInfoLookup.getInstance();
@ -136,7 +137,6 @@ public class GridAlterBundleContributor implements IAlterBundleContributor {
((CrossSectionResourceData) data).setSource(lookup.getInfo(
selectedString).getTitle());
}
}
}

View file

@ -168,7 +168,7 @@ public class DataCatalogManager {
private DataCatalogManager() {
// TODO these should be read from an extension point.
catalogs = new ArrayList<IDataCatalog>();
catalogs.add(new GribDataCatalog());
catalogs.add(new GridDataCatalog());
catalogs.add(new AcarsSoundingDataCatalog());
catalogs.add(new DmdDataCatalog());
catalogs.add(new PointDataCatalog());

View file

@ -70,7 +70,7 @@ import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.LineString;
/**
* Implements the IDataCatalog interface for grid data.
* Implements the IDataCatalog interface for grib data.
*
* <pre>
*
@ -86,9 +86,9 @@ import com.vividsolutions.jts.geom.LineString;
* @author lvenable
* @version 1.0
*/
public class GribDataCatalog extends AbstractInventoryDataCatalog {
public class GridDataCatalog extends AbstractInventoryDataCatalog {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(GribDataCatalog.class);
.getHandler(GridDataCatalog.class);
/**
* Create the product entry in the grid data catalog.
@ -104,7 +104,7 @@ public class GribDataCatalog extends AbstractInventoryDataCatalog {
if (!isValidSelection(selData)) {
return null;
}
GribDataCatalogEntry catalogEntry = new GribDataCatalogEntry(selData);
GridDataCatalogEntry catalogEntry = new GridDataCatalogEntry(selData);
catalogEntry.modelName = selData.getSourcesKey();
catalogEntry.paramAbbreviation = selData.getFieldsKey();
@ -125,7 +125,7 @@ public class GribDataCatalog extends AbstractInventoryDataCatalog {
public void addProductParameters(IDataCatalogEntry entry,
HashMap<String, RequestConstraint> parameters) {
GribDataCatalogEntry catalogEntry = (GribDataCatalogEntry) entry;
GridDataCatalogEntry catalogEntry = (GridDataCatalogEntry) entry;
ViewMenu viewSelection = catalogEntry.getDialogSettings()
.getViewSelection();
@ -228,7 +228,7 @@ public class GribDataCatalog extends AbstractInventoryDataCatalog {
// if we fail to get a unit from the style rules use the parameter unit
if (displayUnit == null) {
GribDataCatalogEntry gribDataCatalogEntry = ((GribDataCatalogEntry) catalogEntry);
GridDataCatalogEntry gribDataCatalogEntry = ((GridDataCatalogEntry) catalogEntry);
return getInventory().getParameterUnit(
gribDataCatalogEntry.modelName,
gribDataCatalogEntry.paramAbbreviation);
@ -247,7 +247,7 @@ public class GribDataCatalog extends AbstractInventoryDataCatalog {
*/
@Override
protected String[] getPlugins(ViewMenu setting) {
return new String[] { "grib" };
return new String[] { GridInventory.PLUGIN_NAME };
}
@Override
@ -406,63 +406,65 @@ public class GribDataCatalog extends AbstractInventoryDataCatalog {
&& lons.isEmpty()) {
return null;
}
List<String> sources = getSupportedSourcesInternal();
Set<String> fileredSources = new HashSet<String>();
for (String source : sources) {
for (String source : getSupportedSourcesInternal()) {
try {
GridCoverage coverage = CoverageUtils.getInstance()
.getCoverage(source);
if (coverage == null) {
Collection<GridCoverage> coverages = CoverageUtils
.getInstance().getCoverages(source);
if (coverages == null) {
fileredSources.add(source);
continue;
}
GridGeometry2D gridGeom = coverage.getGridGeometry();
MathTransform llToCRS = MapUtil.getTransformFromLatLon(gridGeom
.getCoordinateReferenceSystem());
Envelope2D env = gridGeom.getEnvelope2D();
for (String letter : pointLetters) {
for (GridCoverage coverage : coverages) {
GridGeometry2D gridGeom = coverage.getGridGeometry();
MathTransform llToCRS = MapUtil
.getTransformFromLatLon(gridGeom
.getCoordinateReferenceSystem());
Envelope2D env = gridGeom.getEnvelope2D();
for (String letter : pointLetters) {
Coordinate c = PointsDataManager.getInstance().getPoint(
letter);
DirectPosition2D dp = new DirectPosition2D(c.x, c.y);
llToCRS.transform(dp, dp);
if (env.contains(dp.x, dp.y)) {
fileredSources.add(source);
break;
}
}
for (String letter : lineLetters) {
LineString ls = ToolsDataManager.getInstance().getBaseline(
letter);
Envelope2D lineEnv = null;
for (Coordinate c : ls.getCoordinates()) {
letter);
DirectPosition2D dp = new DirectPosition2D(c.x, c.y);
llToCRS.transform(dp, dp);
if (lineEnv == null) {
lineEnv = new Envelope2D(
gridGeom.getCoordinateReferenceSystem(),
dp.x, dp.y, 1, 1);
} else {
lineEnv.add(dp.x, dp.y);
if (env.contains(dp.x, dp.y)) {
fileredSources.add(source);
break;
}
}
if (lineEnv.intersects(env)) {
fileredSources.add(source);
break;
for (String letter : lineLetters) {
LineString ls = ToolsDataManager.getInstance()
.getBaseline(letter);
Envelope2D lineEnv = null;
for (Coordinate c : ls.getCoordinates()) {
DirectPosition2D dp = new DirectPosition2D(c.x, c.y);
llToCRS.transform(dp, dp);
if (lineEnv == null) {
lineEnv = new Envelope2D(
gridGeom.getCoordinateReferenceSystem(),
dp.x, dp.y, 1, 1);
} else {
lineEnv.add(dp.x, dp.y);
}
}
if (lineEnv.intersects(env)) {
fileredSources.add(source);
break;
}
}
}
ReferencedEnvelope rEnv = new ReferencedEnvelope(env,
gridGeom.getCoordinateReferenceSystem());
rEnv = rEnv.transform(MapUtil.getLatLonProjection(), true);
for (Double lat : lats) {
if (rEnv.getMinY() < lat && rEnv.getMaxY() > lat) {
fileredSources.add(source);
break;
ReferencedEnvelope rEnv = new ReferencedEnvelope(env,
gridGeom.getCoordinateReferenceSystem());
rEnv = rEnv.transform(MapUtil.getLatLonProjection(), true);
for (Double lat : lats) {
if (rEnv.getMinY() < lat && rEnv.getMaxY() > lat) {
fileredSources.add(source);
break;
}
}
}
for (Double lon : lons) {
if (rEnv.getMinX() < lon && rEnv.getMaxX() > lon) {
fileredSources.add(source);
break;
for (Double lon : lons) {
if (rEnv.getMinX() < lon && rEnv.getMaxX() > lon) {
fileredSources.add(source);
break;
}
}
}
} catch (Exception e) {
@ -491,64 +493,67 @@ public class GribDataCatalog extends AbstractInventoryDataCatalog {
Set<String> validPlanes = new HashSet<String>(sources.size());
for (String source : sources) {
try {
GridCoverage coverage = CoverageUtils.getInstance()
.getCoverage(source);
if (coverage == null) {
Collection<GridCoverage> coverages = CoverageUtils
.getInstance().getCoverages(source);
if (coverages == null) {
Set<String> results = new HashSet<String>();
results.addAll(MenuItemManager.getInstance()
.getLatLonKeys());
results.addAll(getPointLineKeys());
return results;
}
GridGeometry2D gridGeom = coverage.getGridGeometry();
MathTransform llToCRS = MapUtil.getTransformFromLatLon(gridGeom
.getCoordinateReferenceSystem());
Envelope2D env = gridGeom.getEnvelope2D();
for (GridCoverage coverage : coverages) {
GridGeometry2D gridGeom = coverage.getGridGeometry();
MathTransform llToCRS = MapUtil
.getTransformFromLatLon(gridGeom
.getCoordinateReferenceSystem());
Envelope2D env = gridGeom.getEnvelope2D();
for (String letter : pdm.getPointNames()) {
Coordinate c = pdm.getPoint(letter);
DirectPosition2D dp = new DirectPosition2D(c.x, c.y);
llToCRS.transform(dp, dp);
if (env.contains(dp.x, dp.y)) {
validPlanes.add("Point" + letter);
}
}
for (String letter : tdm.getBaselineNames()) {
LineString ls = tdm.getBaseline(letter);
Envelope2D lineEnv = null;
for (Coordinate c : ls.getCoordinates()) {
DirectPosition2D dp = new DirectPosition2D(c.x, c.y);
llToCRS.transform(dp, dp);
if (lineEnv == null) {
lineEnv = new Envelope2D(
gridGeom.getCoordinateReferenceSystem(),
dp.x, dp.y, 1, 1);
if (env.contains(dp.x, dp.y)) {
validPlanes.add("Point" + letter);
}
}
for (String letter : tdm.getBaselineNames()) {
LineString ls = tdm.getBaseline(letter);
Envelope2D lineEnv = null;
for (Coordinate c : ls.getCoordinates()) {
DirectPosition2D dp = new DirectPosition2D(c.x, c.y);
llToCRS.transform(dp, dp);
if (lineEnv == null) {
lineEnv = new Envelope2D(
gridGeom.getCoordinateReferenceSystem(),
dp.x, dp.y, 1, 1);
} else {
lineEnv.add(dp.x, dp.y);
}
}
if (lineEnv.intersects(env)) {
validPlanes.add("Line" + letter);
}
}
ReferencedEnvelope rEnv = new ReferencedEnvelope(env,
gridGeom.getCoordinateReferenceSystem());
rEnv = rEnv.transform(MapUtil.getLatLonProjection(), true);
for (String llKey : MenuItemManager.getInstance()
.getLatLonKeys()) {
if (llKey.startsWith("Lat")) {
double lat = Double.parseDouble(llKey.replace(
"Lat", ""));
if (rEnv.getMinY() < lat && rEnv.getMaxY() > lat) {
validPlanes.add(llKey);
}
} else if (llKey.startsWith("Lon")) {
double lon = Double.parseDouble(llKey.replace(
"Lon", ""));
if (rEnv.getMinX() < lon && rEnv.getMaxX() > lon) {
validPlanes.add(llKey);
}
} else {
lineEnv.add(dp.x, dp.y);
}
}
if (lineEnv.intersects(env)) {
validPlanes.add("Line" + letter);
}
}
ReferencedEnvelope rEnv = new ReferencedEnvelope(env,
gridGeom.getCoordinateReferenceSystem());
rEnv = rEnv.transform(MapUtil.getLatLonProjection(), true);
for (String llKey : MenuItemManager.getInstance()
.getLatLonKeys()) {
if (llKey.startsWith("Lat")) {
double lat = Double.parseDouble(llKey
.replace("Lat", ""));
if (rEnv.getMinY() < lat && rEnv.getMaxY() > lat) {
validPlanes.add(llKey);
}
} else if (llKey.startsWith("Lon")) {
double lon = Double.parseDouble(llKey
.replace("Lon", ""));
if (rEnv.getMinX() < lon && rEnv.getMaxX() > lon) {
validPlanes.add(llKey);
}
} else {
validPlanes.add(llKey);
}
}
} catch (Exception e) {

View file

@ -25,14 +25,30 @@ import java.util.Map;
import com.raytheon.uf.viz.core.rsc.DisplayType;
import com.raytheon.viz.volumebrowser.vbui.SelectedData;
public class GribDataCatalogEntry extends DataCatalogEntry {
/**
*
* A DataCatologEntry which stores some extra grid specific fields.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 25, 2012 bsteffen Initial javadoc
*
* </pre>
*
* @version 1.0
*/
public class GridDataCatalogEntry extends DataCatalogEntry {
public GribDataCatalogEntry(SelectedData selData) {
public GridDataCatalogEntry(SelectedData selData) {
super(selData);
this.nameMap = new HashMap<DisplayType, String>();
}
public GribDataCatalogEntry(GribDataCatalogEntry entry) {
public GridDataCatalogEntry(GridDataCatalogEntry entry) {
super(entry);
this.nameMap = entry.nameMap;
this.modelName = entry.modelName;