Java Code Examples for ucar.unidata.geoloc.LatLonRect#contains()

The following examples show how to use ucar.unidata.geoloc.LatLonRect#contains() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RecordDatasetHelper.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public List getData(ArrayList records, LatLonRect boundingBox, CancelTask cancel) throws IOException {
  if (debugBB)
    System.out.println("Want bb= " + boundingBox);
  ArrayList result = new ArrayList();
  for (int i = 0; i < records.size(); i++) {
    RecordDatasetHelper.RecordPointObs r = (RecordDatasetHelper.RecordPointObs) records.get(i);
    if (boundingBox.contains(r.getLatLon())) {
      if (debugBB)
        System.out.println(" ok latlon= " + r.getLatLon());
      result.add(r);
    }
    if ((cancel != null) && cancel.isCancel())
      return null;
  }
  return result;
}
 
Example 2
Source File: RecordDatasetHelper.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public List getData(ArrayList records, LatLonRect boundingBox, double startTime, double endTime, CancelTask cancel)
    throws IOException {
  if (debugBB)
    System.out.println("Want bb= " + boundingBox);
  ArrayList result = new ArrayList();
  for (int i = 0; i < records.size(); i++) {
    RecordDatasetHelper.RecordPointObs r = (RecordDatasetHelper.RecordPointObs) records.get(i);
    if (boundingBox.contains(r.getLatLon())) {
      if (debugBB)
        System.out.println(" ok latlon= " + r.getLatLon());
      double timeValue = r.getObservationTime();
      if ((timeValue >= startTime) && (timeValue <= endTime))
        result.add(r);
    }
    if ((cancel != null) && cancel.isCancel())
      return null;
  }
  return result;
}
 
Example 3
Source File: StationDatasetHelper.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public List<ucar.unidata.geoloc.Station> getStations(LatLonRect boundingBox, CancelTask cancel) throws IOException {
  LatLonPointImpl latlonPt = new LatLonPointImpl();
  List<ucar.unidata.geoloc.Station> result = new ArrayList<ucar.unidata.geoloc.Station>();
  List<ucar.unidata.geoloc.Station> stations = obsDataset.getStations();
  for (ucar.unidata.geoloc.Station s : stations) {
    latlonPt.set(s.getLatitude(), s.getLongitude());
    if (boundingBox.contains(latlonPt))
      result.add(s);
    if ((cancel != null) && cancel.isCancel())
      return null;
  }
  return result;
}
 
Example 4
Source File: CompositeStationCollection.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
@Nullable
public PointFeatureCollection subset(LatLonRect boundingBox, CalendarDateRange dateRange) {
  if (boundingBox != null) {
    if (!boundingBox.contains(s.getLatLon()))
      return null;
    if (dateRange == null)
      return this;
  }
  return subset(dateRange);
}
 
Example 5
Source File: StationHelper.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public List<Station> getStations(LatLonRect boundingBox) {
  if (boundingBox == null)
    return getStations();

  List<Station> result = new ArrayList<>();
  for (StationFeature s : stations) {
    LatLonPoint latlonPt = LatLonPoint.create(s.getLatitude(), s.getLongitude());
    if (boundingBox.contains(latlonPt))
      result.add(s);
  }
  return result;
}
 
Example 6
Source File: StationHelper.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public List<StationFeature> getStationFeatures(LatLonRect boundingBox) {
  if (boundingBox == null)
    return stations;

  List<StationFeature> result = new ArrayList<>();
  for (StationFeature s : stations) {
    LatLonPoint latlonPt = LatLonPoint.create(s.getLatitude(), s.getLongitude());
    if (boundingBox.contains(latlonPt))
      result.add(s);
  }
  return result;
}
 
Example 7
Source File: StationCollectionStream.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
@Nullable
public PointFeatureCollection subset(LatLonRect boundingBox, CalendarDateRange dateRange) {
  if (boundingBox != null) {
    if (!boundingBox.contains(s.getLatLon()))
      return null;
    if (dateRange == null)
      return this;
  }
  return subset(dateRange);
}