Skip to content

Commit c39ee2c

Browse files
author
Matt
committed
fixing issue with toBBoxString method. improving documentation.
1 parent 5239fd8 commit c39ee2c

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/main/java/io/github/makbn/jlmap/model/JLBounds.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
import lombok.Builder;
44
import lombok.Getter;
55
import lombok.Setter;
6-
import lombok.ToString;
76

87
import java.util.Objects;
98

109
/**
1110
* Represents a rectangular geographical area on a map.
11+
*
1212
* @author Mehdi Akbarian Rastaghi (@makbn)
1313
*/
1414
@Getter
@@ -86,12 +86,12 @@ public JLLatLng getCenter() {
8686
*/
8787
public String toBBoxString() {
8888
return String.format("%f,%f,%f,%f", southWest.getLng(), southWest.getLat(),
89-
northEast.getLat(), northEast.getLat());
89+
northEast.getLng(), northEast.getLat());
9090
}
9191

9292
/**
9393
* @param bounds given bounds
94-
* @return {{@link Boolean#TRUE}} if the rectangle contains the given bounds.
94+
* @return {@code true} if the rectangle contains the given bounds.
9595
*/
9696
public boolean contains(JLBounds bounds) {
9797
return (bounds.getSouthWest().getLat() >= southWest.getLat())
@@ -102,7 +102,7 @@ public boolean contains(JLBounds bounds) {
102102

103103
/**
104104
* @param point given point
105-
* @return {{@link Boolean#TRUE}} if the rectangle contains the given point.
105+
* @return {@code true} if the rectangle contains the given point.
106106
*/
107107
public boolean contains(JLLatLng point) {
108108
return (point.getLat() >= southWest.getLat())
@@ -125,20 +125,20 @@ public boolean isValid() {
125125
* Negative values will retract the bounds.
126126
*/
127127
public JLBounds pad(double bufferRatio) {
128-
double heightBuffer = Math.abs(southWest.getLat() - northEast.getLat()) * bufferRatio;
129-
double widthBuffer = Math.abs(southWest.getLng() - northEast.getLng()) * bufferRatio;
128+
double latBuffer = Math.abs(southWest.getLat() - northEast.getLat()) * bufferRatio;
129+
double lngBuffer = Math.abs(southWest.getLng() - northEast.getLng()) * bufferRatio;
130130

131131
return new JLBounds(
132-
new JLLatLng(southWest.getLat() - heightBuffer, southWest.getLng() - widthBuffer),
133-
new JLLatLng(northEast.getLat() + heightBuffer, northEast.getLng() + widthBuffer));
132+
new JLLatLng(southWest.getLat() - latBuffer, southWest.getLng() - lngBuffer),
133+
new JLLatLng(northEast.getLat() + latBuffer, northEast.getLng() + lngBuffer));
134134
}
135135

136136
/**
137137
* @param bounds the given bounds
138138
* @param maxMargin The margin of error
139-
* @return {{@link Boolean#TRUE}} if the rectangle is equivalent (within a small margin of error) to the given bounds.
139+
* @return true if the rectangle is equivalent (within a small margin of error) to the given bounds.
140140
*/
141-
public boolean equals(JLBounds bounds, int maxMargin) {
141+
public boolean equals(JLBounds bounds, float maxMargin) {
142142
if (bounds == null) {
143143
return false;
144144
}

0 commit comments

Comments
 (0)