From: Jose C. <jos...@us...> - 2009-07-23 09:52:36
|
Update of /cvsroot/gbif/portal-core/src/main/java/org/gbif/portal/util/geospatial In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv1333/src/main/java/org/gbif/portal/util/geospatial Modified Files: CellIdUtils.java Log Message: Fixed centi-cell accuracy when returning occurrence records within a 1 degree area Index: CellIdUtils.java =================================================================== RCS file: /cvsroot/gbif/portal-core/src/main/java/org/gbif/portal/util/geospatial/CellIdUtils.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** CellIdUtils.java 16 Jun 2008 09:31:33 -0000 1.13 --- CellIdUtils.java 23 Jul 2009 09:52:29 -0000 1.14 *************** *** 315,326 **** public static Integer[] getCentiCellIdForBoundingBox(float minLongitude, float minLatitude, float maxLongitude, float maxLatitude) throws UnableToGenerateCellIdException { ! int[] maxMinCellIds = getMinMaxCellIdsForBoundingBox(minLongitude, minLatitude, maxLongitude, maxLatitude); ! if(maxMinCellIds==null || (maxMinCellIds[0]!=maxMinCellIds[1])) ! return null; ! Integer cellid = maxMinCellIds[0]; //ascertain whether bounding box is 0.1 by 0.1 ! if(isBoundingBoxCentiCell(minLongitude, minLatitude, maxLongitude, maxLatitude)){ int minCentiCell = toCentiCellId(minLatitude, minLongitude); --- 315,335 ---- public static Integer[] getCentiCellIdForBoundingBox(float minLongitude, float minLatitude, float maxLongitude, float maxLatitude) throws UnableToGenerateCellIdException { ! //int[] maxMinCellIds = getMinMaxCellIdsForBoundingBox(minLongitude, minLatitude, maxLongitude, maxLatitude); ! //if(maxMinCellIds==null || (maxMinCellIds[0]!=maxMinCellIds[1])) ! // return null; ! //Integer cellid = maxMinCellIds[0]; ! ! //int[] maxMinCellIds = getMinMaxCellIdsForBoundingBox(minLongitude, minLatitude, maxLongitude, maxLatitude); ! ! if(!(isBoundingBoxCentiCell(minLongitude, minLatitude, maxLongitude, maxLatitude))) { ! return null; ! } //ascertain whether bounding box is 0.1 by 0.1 ! //if(isBoundingBoxCentiCell(minLongitude, minLatitude, maxLongitude, maxLatitude)){ ! ! int[] maxMinCellIds = getMinMaxCellIdsForBoundingBox(minLongitude, minLatitude, maxLongitude, maxLatitude); ! Integer cellid = maxMinCellIds[0]; int minCentiCell = toCentiCellId(minLatitude, minLongitude); *************** *** 347,355 **** } ! if(maxCentiCell==minCentiCell){ return new Integer[]{cellid, minCentiCell}; ! } ! } ! return new Integer[]{cellid}; } --- 356,364 ---- } ! //if(maxCentiCell==minCentiCell){ return new Integer[]{cellid, minCentiCell}; ! //} ! //} ! //return new Integer[]{cellid}; } |