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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2146 by torben, Wed Apr 30 09:02:39 2014 UTC revision 2211 by torben, Thu Sep 11 20:44:20 2014 UTC
# Line 1  Line 1 
1  package dk.daoas.fulddaekning;  package dk.daoas.fulddaekning;
2    
3  public class BoundingBox {  public class BoundingBox {
4                    
5                    
6          public static class BoundingBoxException extends Exception{          public static class BoundingBoxException extends Exception{
7                  public BoundingBoxException(String reason) {                  public BoundingBoxException(String reason) {
# Line 10  public class BoundingBox { Line 11  public class BoundingBox {
11                  private static final long serialVersionUID = 1L;                                  private static final long serialVersionUID = 1L;                
12          }          }
13                    
14          public static final double LATITUDE_MARGIN = 0.02702703;          //public static final double LATITUDE_MARGIN = 0.02702703;
15          public static final double LONGUTUDE_MARGIN = 0.046875;          //public static final double LONGUTUDE_MARGIN = 0.046875;
16                    
17          public double latitudeMax;          public double latitudeMax;
18          public double latitudeMin;          public double latitudeMin;
# Line 26  public class BoundingBox { Line 27  public class BoundingBox {
27          }          }
28                    
29          public void validateBbox() throws BoundingBoxException {          public void validateBbox() throws BoundingBoxException {
30                                    
31                  if ( Math.abs(latitudeMax-latitudeMin)> 1.0)                  if ( Math.abs(latitudeMax-latitudeMin)> 1.0)
32                          throw new BoundingBoxException("For stor latitude forskel");                          throw new BoundingBoxException("For stor latitude forskel");
33                                    
34                  if ( Math.abs(longitudeMax-longitudeMin)> 1.0)                  if ( Math.abs(longitudeMax-longitudeMin)> 1.0)
35                          throw new BoundingBoxException("For stor longitude forskel");                                            throw new BoundingBoxException("For stor longitude forskel");
36                    
37                    GeoPoint min = new GeoPoint(latitudeMin, longitudeMin);
38                    GeoPoint max = new GeoPoint(latitudeMax, longitudeMax);
39                    double afstand = GeoPoint.beregnAfstand(min, max);
40                    
41                    if (afstand >= 90.0) { //hvis cross størrelsen er over 90 km - sÃ¥ er postnummeret for stort
42                            throw new BoundingBoxException("For stor cross afstand " + afstand);
43                    }
44          }          }
45                    
46          public void adjustToMargin() {          public void adjustToMargin() {
47                  latitudeMax += LATITUDE_MARGIN;                  Constants consts = Constants.getInstance();
48                  latitudeMin -= LATITUDE_MARGIN;                  
49                    latitudeMax += consts.getLatitudeMargin();
50                    latitudeMin -= consts.getLatitudeMargin();
51                                    
52                  longitudeMax += LONGUTUDE_MARGIN;                  longitudeMax += consts.getLongitudeMargin();
53                  longitudeMin -= LONGUTUDE_MARGIN;                  longitudeMin -= consts.getLongitudeMargin();
54          }          }
55                    
56    

Legend:
Removed from v.2146  
changed lines
  Added in v.2211

  ViewVC Help
Powered by ViewVC 1.1.20