Issue #2672 Handle envelopes in data access requests of points and lightning.
Change-Id: Id9a56e9f8027a2f489561c241e2f34dd92dce400 Former-commit-id:ec8514000f
[formerly25ad0e327c
[formerly efe32c8302834b1c53a5f65850aff8f12437d3bb]] Former-commit-id:25ad0e327c
Former-commit-id:cd772d8961
This commit is contained in:
parent
abb8ce22a7
commit
dad7e3cbcd
2 changed files with 56 additions and 6 deletions
|
@ -52,18 +52,24 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
import com.raytheon.uf.common.status.UFStatus;
|
import com.raytheon.uf.common.status.UFStatus;
|
||||||
import com.raytheon.uf.common.time.DataTime;
|
import com.raytheon.uf.common.time.DataTime;
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
import com.vividsolutions.jts.geom.Coordinate;
|
||||||
|
import com.vividsolutions.jts.geom.Envelope;
|
||||||
import com.vividsolutions.jts.geom.GeometryFactory;
|
import com.vividsolutions.jts.geom.GeometryFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Data access framework factory for bin lightning
|
* Data access framework factory for bin lightning
|
||||||
*
|
*
|
||||||
|
* Envelopes requests cannot be handled efficiently using metadata so all data
|
||||||
|
* is retrieved and filtered within the factory. For very large requests this
|
||||||
|
* may result in suboptimal performance.
|
||||||
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------- -------- ----------- --------------------------
|
||||||
* Jan 21, 2014 2667 bclement Initial creation
|
* Jan 21, 2014 2667 bclement Initial creation
|
||||||
|
* Feb 06, 2014 2672 bsteffen Add envelope support
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -165,7 +171,7 @@ public class BinLightingAccessFactory extends AbstractDataPluginFactory {
|
||||||
for (Entry<String, List<String>> groupEntry : srcDatasets
|
for (Entry<String, List<String>> groupEntry : srcDatasets
|
||||||
.entrySet()) {
|
.entrySet()) {
|
||||||
addGeometryData(rval, ds, groupEntry.getKey(),
|
addGeometryData(rval, ds, groupEntry.getKey(),
|
||||||
groupEntry.getValue());
|
groupEntry.getValue(), request.getEnvelope());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rval.toArray(new IGeometryData[rval.size()]);
|
return rval.toArray(new IGeometryData[rval.size()]);
|
||||||
|
@ -183,9 +189,11 @@ public class BinLightingAccessFactory extends AbstractDataPluginFactory {
|
||||||
* lightning source value from metadata
|
* lightning source value from metadata
|
||||||
* @param datasets
|
* @param datasets
|
||||||
* requested datasets from datastore
|
* requested datasets from datastore
|
||||||
|
* @param envelope
|
||||||
|
* envelope to use for geospatial filtering
|
||||||
*/
|
*/
|
||||||
private void addGeometryData(List<IGeometryData> dataList, IDataStore ds,
|
private void addGeometryData(List<IGeometryData> dataList, IDataStore ds,
|
||||||
String source, List<String> datasets) {
|
String source, List<String> datasets, Envelope envelope) {
|
||||||
// Go fetch data
|
// Go fetch data
|
||||||
try {
|
try {
|
||||||
IDataRecord[] records = ds.retrieveDatasets(
|
IDataRecord[] records = ds.retrieveDatasets(
|
||||||
|
@ -219,6 +227,12 @@ public class BinLightingAccessFactory extends AbstractDataPluginFactory {
|
||||||
.getFloatData();
|
.getFloatData();
|
||||||
|
|
||||||
for (int i = 0; i < timeData.length; i++) {
|
for (int i = 0; i < timeData.length; i++) {
|
||||||
|
if (envelope != null
|
||||||
|
&& !envelope.contains(longitudeData[i],
|
||||||
|
latitudeData[i])) {
|
||||||
|
/* Skip any data the user doesn't want */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
DataTime dt = new DataTime(new Date(timeData[i]));
|
DataTime dt = new DataTime(new Date(timeData[i]));
|
||||||
DefaultGeometryData data = new DefaultGeometryData();
|
DefaultGeometryData data = new DefaultGeometryData();
|
||||||
data.setDataTime(dt);
|
data.setDataTime(dt);
|
||||||
|
|
|
@ -53,6 +53,7 @@ import com.raytheon.uf.common.serialization.comm.RequestRouter;
|
||||||
import com.raytheon.uf.common.time.DataTime;
|
import com.raytheon.uf.common.time.DataTime;
|
||||||
import com.raytheon.uf.common.time.TimeRange;
|
import com.raytheon.uf.common.time.TimeRange;
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
import com.vividsolutions.jts.geom.Coordinate;
|
||||||
|
import com.vividsolutions.jts.geom.Envelope;
|
||||||
import com.vividsolutions.jts.geom.GeometryFactory;
|
import com.vividsolutions.jts.geom.GeometryFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -66,7 +67,9 @@ import com.vividsolutions.jts.geom.GeometryFactory;
|
||||||
* ------------- -------- ----------- --------------------------
|
* ------------- -------- ----------- --------------------------
|
||||||
* Oct 31, 2013 2502 bsteffen Initial creation
|
* Oct 31, 2013 2502 bsteffen Initial creation
|
||||||
* Nov 26, 2013 2537 bsteffen Minor code cleanup.
|
* Nov 26, 2013 2537 bsteffen Minor code cleanup.
|
||||||
* Jan,14, 2014 2667 mnash Remove getGridData method
|
* Jan,14, 2014 2667 mnash Remove getGridData method
|
||||||
|
* Feb 06, 2014 2672 bsteffen Add envelope support
|
||||||
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author bsteffen
|
* @author bsteffen
|
||||||
|
@ -99,8 +102,12 @@ public class PointDataAccessFactory extends AbstractDataPluginFactory {
|
||||||
|
|
||||||
private String locationPointDataKey = PointDataConstants.DATASET_STATIONID;
|
private String locationPointDataKey = PointDataConstants.DATASET_STATIONID;
|
||||||
|
|
||||||
|
private String latitudeDatabaseKey = "location.latitude";
|
||||||
|
|
||||||
private String latitudePointDataKey = "latitude";
|
private String latitudePointDataKey = "latitude";
|
||||||
|
|
||||||
|
private String longitudeDatabaseKey = "location.longitude";
|
||||||
|
|
||||||
private String longitudePointDataKey = "longitude";
|
private String longitudePointDataKey = "longitude";
|
||||||
|
|
||||||
private String refTimePointDataKey = PointDataConstants.DATASET_REFTIME;
|
private String refTimePointDataKey = PointDataConstants.DATASET_REFTIME;
|
||||||
|
@ -157,6 +164,17 @@ public class PointDataAccessFactory extends AbstractDataPluginFactory {
|
||||||
.getValue().toString()));
|
.getValue().toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Envelope envelope = request.getEnvelope();
|
||||||
|
if (envelope != null) {
|
||||||
|
String minLon = Double.toString(envelope.getMinX());
|
||||||
|
String maxLon = Double.toString(envelope.getMaxX());
|
||||||
|
rcMap.put(longitudeDatabaseKey, new RequestConstraint(minLon,
|
||||||
|
maxLon));
|
||||||
|
String minLat = Double.toString(envelope.getMinY());
|
||||||
|
String maxLat = Double.toString(envelope.getMaxY());
|
||||||
|
rcMap.put(latitudeDatabaseKey,
|
||||||
|
new RequestConstraint(minLat, maxLat));
|
||||||
|
}
|
||||||
return rcMap;
|
return rcMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -425,6 +443,24 @@ public class PointDataAccessFactory extends AbstractDataPluginFactory {
|
||||||
this.longitudePointDataKey = longitudePointDataKey;
|
this.longitudePointDataKey = longitudePointDataKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param latitudeDatabaseKey
|
||||||
|
* The hibernate field name of the field that is used to identify
|
||||||
|
* latitude. Default values is "location.latitude"
|
||||||
|
*/
|
||||||
|
public void setLatitudeDatabaseKey(String latitudeDatabaseKey) {
|
||||||
|
this.latitudeDatabaseKey = latitudeDatabaseKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param longitudeDatabaseKey
|
||||||
|
* The hibernate field name of the field that is used to identify
|
||||||
|
* longitude. Default values is "location.longitude"
|
||||||
|
*/
|
||||||
|
public void setLongitudeDatabaseKey(String longitudeDatabaseKey) {
|
||||||
|
this.longitudeDatabaseKey = longitudeDatabaseKey;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param refTimePointDataKey
|
* @param refTimePointDataKey
|
||||||
* The point data key of the reference time. Default value is
|
* The point data key of the reference time. Default value is
|
||||||
|
|
Loading…
Add table
Reference in a new issue