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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2588 - (hide annotations) (download)
Sun Jun 14 15:11:23 2015 UTC (8 years, 11 months ago) by torben
File size: 1664 byte(s)
Remove some unused code
1 torben 2145 package dk.daoas.fulddaekning;
2    
3 torben 2585 import geocode.GeoPoint;
4    
5 torben 2145 public class BoundingBox {
6 torben 2200
7 torben 2145
8     public static class BoundingBoxException extends Exception{
9     public BoundingBoxException(String reason) {
10     super(reason);
11     }
12    
13     private static final long serialVersionUID = 1L;
14     }
15 torben 2331
16 torben 2145 public double latitudeMax;
17 torben 2328 public double latitudeMin = Double.MAX_VALUE;
18 torben 2145
19     public double longitudeMax;
20 torben 2328 public double longitudeMin = Double.MAX_VALUE;
21 torben 2145
22    
23     @Override
24     public String toString() {
25 torben 2146 return "bbox: Latitude=" + latitudeMin +"/" + latitudeMax + " longitude=" + longitudeMin + "/" + longitudeMax;
26 torben 2145 }
27    
28     public void validateBbox() throws BoundingBoxException {
29 torben 2328
30 torben 2239 double latDiff = Math.abs(latitudeMax - latitudeMin);
31 torben 2264 if ( latDiff > 1.1) {
32 torben 2239 throw new BoundingBoxException("For stor latitude forskel / " + latDiff);
33     }
34 torben 2211
35 torben 2239 double lngDiff = Math.abs(longitudeMax - longitudeMin);
36 torben 2264 if ( lngDiff > 1.1) {
37 torben 2239 throw new BoundingBoxException("For stor longitude forskel / " + lngDiff);
38     }
39    
40 torben 2211 GeoPoint min = new GeoPoint(latitudeMin, longitudeMin);
41     GeoPoint max = new GeoPoint(latitudeMax, longitudeMax);
42 torben 2585 double afstand = GeoPointHelper.beregnAfstand(min, max);
43 torben 2211
44 torben 2331 if (afstand >= 125.0) { //hvis cross afstand er over X km - så er postnummeret for stort
45 torben 2211 throw new BoundingBoxException("For stor cross afstand " + afstand);
46     }
47 torben 2145 }
48    
49    
50 torben 2247 @Override
51     public BoundingBox clone() {
52     BoundingBox bb = new BoundingBox();
53     bb.latitudeMax = this.latitudeMax;
54     bb.longitudeMax = this.longitudeMax;
55    
56     bb.latitudeMin = this.latitudeMin;
57     bb.longitudeMin = this.longitudeMin;
58    
59     return bb;
60     }
61    
62 torben 2145
63     }

  ViewVC Help
Powered by ViewVC 1.1.20