}
}
}
private Filter addAOIFilter(Filter filter, CoordinateReferenceSystem dataCRS){
IAOIService aOIService = PlatformGIS.getAOIService();
Geometry geometry = aOIService.getGeometry();
if(aOIService.getExtent() == null)
return filter;
if(geometry == null){
// note we could make a BBOX query here and go faster
geometry = JTS.toGeometry( aOIService.getExtent());
if(geometry == null){
return filter; // no change!
}
}
CoordinateReferenceSystem aoiCRS = aOIService.getCrs();
if( aoiCRS != null && !CRS.equalsIgnoreMetadata(aoiCRS, dataCRS )){
try {
MathTransform transform = CRS.findMathTransform( aoiCRS, dataCRS);
geometry = JTS.transform(geometry, transform);
}