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 = Double.MAX_VALUE; |
19 |
|
|
20 |
public double longitudeMax; |
public double longitudeMax; |
21 |
public double longitudeMin; |
public double longitudeMin = Double.MAX_VALUE; |
22 |
|
|
23 |
|
|
24 |
@Override |
@Override |
27 |
} |
} |
28 |
|
|
29 |
public void validateBbox() throws BoundingBoxException { |
public void validateBbox() throws BoundingBoxException { |
30 |
|
|
31 |
double latDiff = Math.abs(latitudeMax - latitudeMin); |
double latDiff = Math.abs(latitudeMax - latitudeMin); |
32 |
if ( latDiff > 1.0) { |
if ( latDiff > 1.1) { |
33 |
throw new BoundingBoxException("For stor latitude forskel / " + latDiff); |
throw new BoundingBoxException("For stor latitude forskel / " + latDiff); |
34 |
} |
} |
35 |
|
|
36 |
double lngDiff = Math.abs(longitudeMax - longitudeMin); |
double lngDiff = Math.abs(longitudeMax - longitudeMin); |
37 |
if ( lngDiff > 1.0) { |
if ( lngDiff > 1.1) { |
38 |
throw new BoundingBoxException("For stor longitude forskel / " + lngDiff); |
throw new BoundingBoxException("For stor longitude forskel / " + lngDiff); |
39 |
} |
} |
40 |
|
|
47 |
} |
} |
48 |
} |
} |
49 |
|
|
50 |
public void adjustToMargin() { |
public void adjustToMargin(double kmMargin) { |
51 |
Constants consts = Constants.getInstance(); |
double latMargin = GeoPoint.kmToLatitude(kmMargin); |
52 |
|
double lngMargin = GeoPoint.kmToLongitude(kmMargin); |
53 |
|
|
54 |
|
latitudeMax += latMargin; |
55 |
|
latitudeMin -= latMargin; |
56 |
|
|
57 |
|
longitudeMax += lngMargin; |
58 |
|
longitudeMin -= lngMargin; |
59 |
|
} |
60 |
|
|
61 |
|
@Override |
62 |
|
public BoundingBox clone() { |
63 |
|
BoundingBox bb = new BoundingBox(); |
64 |
|
bb.latitudeMax = this.latitudeMax; |
65 |
|
bb.longitudeMax = this.longitudeMax; |
66 |
|
|
67 |
latitudeMax += consts.getLatitudeMargin(); |
bb.latitudeMin = this.latitudeMin; |
68 |
latitudeMin -= consts.getLatitudeMargin(); |
bb.longitudeMin = this.longitudeMin; |
69 |
|
|
70 |
longitudeMax += consts.getLongitudeMargin(); |
return bb; |
|
longitudeMin -= consts.getLongitudeMargin(); |
|
71 |
} |
} |
72 |
|
|
73 |
|
|