@Override public boolean accept(Product sourceProduct) { final ProductData.UTC productStartTime = sourceProduct.getStartTime(); final ProductData.UTC productEndTime = sourceProduct.getEndTime(); final boolean hasStartTime = productStartTime != null; final boolean hasEndTime = productEndTime != null; final GeoCoding geoCoding = sourceProduct.getGeoCoding(); if (geoCoding == null || !geoCoding.canGetGeoPos()) { return false; } else if (startTime != null && hasStartTime && productStartTime.getAsDate().after(startTime.getAsDate()) && endTime != null && hasEndTime && productEndTime.getAsDate().before(endTime.getAsDate())) { return true; } else if (!hasStartTime && !hasEndTime) { return true; } else if (startTime != null && hasStartTime && productStartTime.getAsDate().after(startTime.getAsDate()) && !hasEndTime) { return true; } else if (!hasStartTime && endTime != null && productEndTime.getAsDate().before(endTime.getAsDate())) { return true; } else { return false; } }
@Override public boolean getGeoLocation(double x, double y, Point2D g) { if (geoCoding.canGetGeoPos()) { pp.setLocation(x, y); geoCoding.getGeoPos(pp, gp); if (gp.isValid()) { g.setLocation(gp.getLon(), gp.getLat()); return true; } } return false; }
private boolean canUseGeoCoordinates(Product product) { final GeoCoding geoCoding = product.getGeoCoding(); return geoCoding != null && geoCoding.canGetPixelPos() && geoCoding.canGetGeoPos(); }