mirror of
https://github.com/TeamVanced/VancedMicroG
synced 2025-02-22 07:21:09 +01:00
parent
1c5da4a07a
commit
9abd7ebac3
@ -44,6 +44,8 @@ public class GmsMapsTypeHelper {
|
||||
double maxLon = MercatorProjection.toLongitude(box.xmax);
|
||||
double minLat = MercatorProjection.toLatitude(box.ymax);
|
||||
double maxLat = MercatorProjection.toLatitude(box.ymin);
|
||||
if (Double.isNaN(minLon) || Double.isNaN(maxLon) || Double.isNaN(minLat) || Double.isNaN(maxLat))
|
||||
minLon = maxLon = minLat = maxLat = 0;
|
||||
return new LatLngBounds(new LatLng(minLat, minLon), new LatLng(maxLat, maxLon));
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,7 @@ import org.oscim.map.Viewport;
|
||||
|
||||
public class ProjectionImpl extends IProjectionDelegate.Stub {
|
||||
private Viewport viewport;
|
||||
private float[] extents = new float[8];
|
||||
|
||||
public ProjectionImpl(Viewport viewport) {
|
||||
this.viewport = viewport;
|
||||
@ -51,6 +52,8 @@ public class ProjectionImpl extends IProjectionDelegate.Stub {
|
||||
|
||||
@Override
|
||||
public VisibleRegion getVisibleRegion() throws RemoteException {
|
||||
viewport.getMapExtents(extents, 0);
|
||||
// TODO: Support non-flat map extents
|
||||
return new VisibleRegion(GmsMapsTypeHelper.toLatLngBounds(viewport.getBBox(null, 0)));
|
||||
}
|
||||
}
|
||||
|
@ -152,6 +152,10 @@ public class PolygonImpl extends IPolygonDelegate.Stub implements DrawableMarkup
|
||||
for (LatLng point : options.getPoints()) {
|
||||
points.add(GmsMapsTypeHelper.fromLatLng(point));
|
||||
}
|
||||
if (points.size() < 3 || (points.size() == 3 && points.get(2).equals(points.get(0)))) {
|
||||
// Need at least 3 distinguished points to draw a polygon
|
||||
return null;
|
||||
}
|
||||
// TODO: holes
|
||||
return new PolygonDrawable(points, Style.builder()
|
||||
.fillAlpha(1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user