Issue #2672 Handle envelopes in data access requests of points and lightning.
Change-Id: Id9a56e9f8027a2f489561c241e2f34dd92dce400 Former-commit-id:dad7e3cbcd
[formerlycd772d8961
] [formerly25ad0e327c
] [formerlydad7e3cbcd
[formerlycd772d8961
] [formerly25ad0e327c
] [formerlyec8514000f
[formerly25ad0e327c
[formerly efe32c8302834b1c53a5f65850aff8f12437d3bb]]]] Former-commit-id:ec8514000f
Former-commit-id:b4cf53d154
[formerlyb28f945bc1
] [formerly 3257bc02c61d603531e293f1b4a6de5a7e06614c [formerly19cb907ac8
]] Former-commit-id: a6410414da895a9defd4419add6f88ee8cbc7464 [formerly32c8f9f149
] Former-commit-id:a242847062
This commit is contained in:
parent
f6e712dac1
commit
db3be83354
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.time.DataTime;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
import com.vividsolutions.jts.geom.Envelope;
|
||||
import com.vividsolutions.jts.geom.GeometryFactory;
|
||||
|
||||
/**
|
||||
* 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>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 21, 2014 2667 bclement Initial creation
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Jan 21, 2014 2667 bclement Initial creation
|
||||
* Feb 06, 2014 2672 bsteffen Add envelope support
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -165,7 +171,7 @@ public class BinLightingAccessFactory extends AbstractDataPluginFactory {
|
|||
for (Entry<String, List<String>> groupEntry : srcDatasets
|
||||
.entrySet()) {
|
||||
addGeometryData(rval, ds, groupEntry.getKey(),
|
||||
groupEntry.getValue());
|
||||
groupEntry.getValue(), request.getEnvelope());
|
||||
}
|
||||
}
|
||||
return rval.toArray(new IGeometryData[rval.size()]);
|
||||
|
@ -183,9 +189,11 @@ public class BinLightingAccessFactory extends AbstractDataPluginFactory {
|
|||
* lightning source value from metadata
|
||||
* @param datasets
|
||||
* requested datasets from datastore
|
||||
* @param envelope
|
||||
* envelope to use for geospatial filtering
|
||||
*/
|
||||
private void addGeometryData(List<IGeometryData> dataList, IDataStore ds,
|
||||
String source, List<String> datasets) {
|
||||
String source, List<String> datasets, Envelope envelope) {
|
||||
// Go fetch data
|
||||
try {
|
||||
IDataRecord[] records = ds.retrieveDatasets(
|
||||
|
@ -219,6 +227,12 @@ public class BinLightingAccessFactory extends AbstractDataPluginFactory {
|
|||
.getFloatData();
|
||||
|
||||
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]));
|
||||
DefaultGeometryData data = new DefaultGeometryData();
|
||||
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.TimeRange;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
import com.vividsolutions.jts.geom.Envelope;
|
||||
import com.vividsolutions.jts.geom.GeometryFactory;
|
||||
|
||||
/**
|
||||
|
@ -66,7 +67,9 @@ import com.vividsolutions.jts.geom.GeometryFactory;
|
|||
* ------------- -------- ----------- --------------------------
|
||||
* Oct 31, 2013 2502 bsteffen Initial creation
|
||||
* 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>
|
||||
*
|
||||
* @author bsteffen
|
||||
|
@ -99,8 +102,12 @@ public class PointDataAccessFactory extends AbstractDataPluginFactory {
|
|||
|
||||
private String locationPointDataKey = PointDataConstants.DATASET_STATIONID;
|
||||
|
||||
private String latitudeDatabaseKey = "location.latitude";
|
||||
|
||||
private String latitudePointDataKey = "latitude";
|
||||
|
||||
private String longitudeDatabaseKey = "location.longitude";
|
||||
|
||||
private String longitudePointDataKey = "longitude";
|
||||
|
||||
private String refTimePointDataKey = PointDataConstants.DATASET_REFTIME;
|
||||
|
@ -157,6 +164,17 @@ public class PointDataAccessFactory extends AbstractDataPluginFactory {
|
|||
.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;
|
||||
}
|
||||
|
||||
|
@ -425,6 +443,24 @@ public class PointDataAccessFactory extends AbstractDataPluginFactory {
|
|||
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
|
||||
* The point data key of the reference time. Default value is
|
||||
|
|
Loading…
Add table
Reference in a new issue