Skip to content

Commit

Permalink
Update BNG constants (#18)
Browse files Browse the repository at this point in the history
* Use an exact copy of ADMSConstants in AERIUS-II

# Conflicts:
#	search-service-geo/src/main/java/nl/aerius/search/tasks/BNGConstants.java

* Make things private and remove obsolete fields
  • Loading branch information
JornC authored Nov 15, 2022
1 parent 42f3f88 commit fe1d45e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,31 @@
*/
package nl.aerius.search.tasks;

import java.util.ArrayList;

import nl.overheid.aerius.geo.shared.BBox;
import nl.overheid.aerius.shared.domain.geo.HexagonZoomLevel;
import nl.overheid.aerius.shared.domain.geo.ReceptorGridSettings;
import nl.overheid.aerius.shared.geo.EPSG;

public final class BNGConstants {
// NOTE Both of the below values are not yet guaranteed to be as constant as the
// RDNew counterparts
public static final int MIN_ZL_SURFACE_AREA = 250_000;
public static final int HEX_HOR = 721;
public static final BBox BOUNDS = new BBox(1393.0196, 671196.3657, 13494.9764, 1234954.16);
private static final EPSG EPSG = nl.overheid.aerius.shared.geo.EPSG.BNG;

private static final int HEX_HOR = 1785;

private static final double MIN_X = -4_000.0;
private static final double MAX_X = 660_000.0;
private static final double MIN_Y = 4_000.0;
private static final double MAX_Y = 1_222_000.0;

private static final HexagonZoomLevel ZOOM_LEVEL_1 = new HexagonZoomLevel(1, 40_000);

private BNGConstants() {}

public static ReceptorGridSettings create() {
return ReceptorUtils.createReceptorUtil(EPSG.BNG, BNGConstants.MIN_ZL_SURFACE_AREA, BNGConstants.HEX_HOR, BNGConstants.BOUNDS);
public static ReceptorGridSettings getReceptorUtil() {
final ArrayList<HexagonZoomLevel> hexagonZoomLevels = new ArrayList<>();
hexagonZoomLevels.add(ZOOM_LEVEL_1);
final BBox boundingBox = new BBox(MIN_X, MIN_Y, MAX_X, MAX_Y);
return new ReceptorGridSettings(boundingBox, EPSG, HEX_HOR, hexagonZoomLevels);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
@ImplementsCapability(value = SearchCapability.COORDINATE, region = SearchRegion.UK)
public class BNGCoordinateSearchService extends AbstractCoordinateSearchService {
public BNGCoordinateSearchService() {
super(BNGConstants.create());
super(BNGConstants.getReceptorUtil());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
@ImplementsCapability(value = SearchCapability.RECEPTOR, region = SearchRegion.UK)
public class BNGReceptorSearchService extends AbstractReceptorSearchService {
public BNGReceptorSearchService() {
super(BNGConstants.create());
super(BNGConstants.getReceptorUtil());
}
}

0 comments on commit fe1d45e

Please sign in to comment.