/[projects]/dao/FuldDaekningWorker/src/dk/daoas/fulddaekning/BoundingBox.java
ViewVC logotype

Contents of /dao/FuldDaekningWorker/src/dk/daoas/fulddaekning/BoundingBox.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2200 - (show annotations) (download)
Thu Sep 11 08:14:40 2014 UTC (9 years, 8 months ago) by torben
File size: 1272 byte(s)
Generalize solution so it also works with BK - all distributor specific values are moved to Constants system
1 package dk.daoas.fulddaekning;
2
3 public class BoundingBox {
4
5
6 public static class BoundingBoxException extends Exception{
7 public BoundingBoxException(String reason) {
8 super(reason);
9 }
10
11 private static final long serialVersionUID = 1L;
12 }
13
14 //public static final double LATITUDE_MARGIN = 0.02702703;
15 //public static final double LONGUTUDE_MARGIN = 0.046875;
16
17 public double latitudeMax;
18 public double latitudeMin;
19
20 public double longitudeMax;
21 public double longitudeMin;
22
23
24 @Override
25 public String toString() {
26 return "bbox: Latitude=" + latitudeMin +"/" + latitudeMax + " longitude=" + longitudeMin + "/" + longitudeMax;
27 }
28
29 public void validateBbox() throws BoundingBoxException {
30 if ( Math.abs(latitudeMax-latitudeMin)> 1.0)
31 throw new BoundingBoxException("For stor latitude forskel");
32
33 if ( Math.abs(longitudeMax-longitudeMin)> 1.0)
34 throw new BoundingBoxException("For stor longitude forskel");
35 }
36
37 public void adjustToMargin() {
38 Constants consts = Constants.getInstance();
39
40 latitudeMax += consts.getLatitudeMargin();
41 latitudeMin -= consts.getLatitudeMargin();
42
43 longitudeMax += consts.getLongitudeMargin();
44 longitudeMin -= consts.getLongitudeMargin();
45 }
46
47
48 }

  ViewVC Help
Powered by ViewVC 1.1.20