Commit c40f004d authored by Matija Obreza's avatar Matija Obreza

MapInfo returns number of georeferenced accessions

- Declared DEFAULT_GEOBOUNDS
parent 007f6641
......@@ -306,16 +306,21 @@ public class AccessionController {
filterCode = shortFilterService.getCode(filter);
}
// Force only georeferenced accessions
AccessionFilter georefFilter = filter.copy(AccessionFilter.class);
georefFilter.geo().referenced = true;
AccessionMapInfo mapInfo = new AccessionMapInfo();
mapInfo.filterCode = filterCode;
mapInfo.filter = filter;
if (StringUtils.isBlank(filterCode)) {
// Entire map
mapInfo.bounds = new Number[][] { { -170, 80 }, { 170, -80 } };
mapInfo.bounds = AccessionService.DEFAULT_GEOBOUNDS;
} else {
mapInfo.bounds = accessionService.getGeoBounds(filter);
mapInfo.bounds = accessionService.getGeoBounds(georefFilter);
}
mapInfo.accessionCount = accessionService.countAccessions(filter);
mapInfo.accessionCount = accessionService.countAccessions(georefFilter);
mapInfo.tileServers = cdnServers;
mapInfo.suggestions= accessionService.getSuggestions(filter);
......
......@@ -44,6 +44,8 @@ public interface AccessionService {
public static final Pattern ACCESSION_IMAGE_PATTERN = Pattern.compile(InstituteFilesService.REPOSITORY_INSTITUTE_PREFIX + "([A-Z]{3,4}\\d+)"
+ InstituteFilesService.REPOSITORY_INSTITUTE_ACCESSIONFILES + "/(.+)");
public static final Number[][] DEFAULT_GEOBOUNDS = new Number[][] { { -180, 90 }, { 180, -90 } };
/**
* Count accessions. Uses Elasticsearch, but counts from database when number is
* small enough.
......
......@@ -453,7 +453,8 @@ public class AccessionServiceImpl implements AccessionService {
query.where(filter.buildPredicate());
Object[] results = query.fetchOne().toArray();
return new Number[][] { new Number[] { (Number)results[0], (Number)results[1] }, new Number[] { (Number)results[2], (Number)results[3] } };
return new Number[][] { new Number[] { (Number) results[0], (Number) results[1] }, new Number[] { (Number) results[2], (Number) results[3] } };
}
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment