Skip to content

Commit 535434f

Browse files
committed
fixed zoom bug
1 parent cf69487 commit 535434f

File tree

1 file changed

+12
-1
lines changed
  • com.opendoorlogistics.core/src/com/opendoorlogistics/core/gis/map

1 file changed

+12
-1
lines changed

com.opendoorlogistics.core/src/com/opendoorlogistics/core/gis/map/MapUtils.java

+12-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
import java.util.List;
1111
import java.util.Random;
1212

13+
14+
1315
import com.opendoorlogistics.api.geometry.LatLong;
1416
import com.opendoorlogistics.api.tables.ODLDatastore;
1517
import com.opendoorlogistics.api.tables.ODLDatastoreAlterable;
@@ -29,6 +31,7 @@
2931
import com.opendoorlogistics.core.utils.Colours;
3032
import com.opendoorlogistics.core.utils.Pair;
3133
import com.opendoorlogistics.core.utils.strings.Strings;
34+
import com.vividsolutions.jts.geom.Envelope;
3235

3336
final public class MapUtils {
3437

@@ -70,7 +73,15 @@ public static LatLongBoundingBox getLatLongBoundingBox(Iterable<? extends Drawab
7073
if(Strings.isEmpty(legendKeyFilter) || Strings.equalsStd(pnt.getLegendKey(), legendKeyFilter)){
7174
if(pnt.getGeometry()==null){
7275
ret.add(pnt);
73-
}else if(pnt.getGeometry().getWGSCentroid()!=null){
76+
}
77+
else if(pnt.getGeometry().getWGSBounds()!=null){
78+
Envelope env = pnt.getGeometry().getWGSBounds();
79+
ret.add(env.getMinY(), env.getMinX());
80+
ret.add(env.getMinY(), env.getMaxX());
81+
ret.add(env.getMaxY(), env.getMinX());
82+
ret.add(env.getMaxY(), env.getMaxX());
83+
}
84+
else if(pnt.getGeometry().getWGSCentroid()!=null){
7485
ret.add(pnt.getGeometry().getWGSCentroid());
7586
}
7687
}

0 commit comments

Comments
 (0)