Open GoogleCodeExporter opened 9 years ago
A second patch implementing 'onCameraChange':
Index:
osmdroid-third-party/src/main/java/org/osmdroid/google/wrapper/v2/OsmdroidMapWra
pper.java
===================================================================
---
osmdroid-third-party/src/main/java/org/osmdroid/google/wrapper/v2/OsmdroidMapWra
pper.java (revisión: 1395)
+++
osmdroid-third-party/src/main/java/org/osmdroid/google/wrapper/v2/OsmdroidMapWra
pper.java (copia de trabajo)
@@ -13,6 +13,7 @@
import org.osmdroid.api.OnCameraChangeListener;
import org.osmdroid.api.Polyline;
import org.osmdroid.util.GeoPoint;
+import org.osmdroid.util.Position;
import org.osmdroid.util.ResourceProxyImpl;
import org.osmdroid.views.MapView;
import org.osmdroid.views.overlay.ItemizedIconOverlay;
@@ -226,7 +229,11 @@
private void onCameraChange() {
if (mOnCameraChangeListener != null) {
- mOnCameraChangeListener.onCameraChange(null); // TODO
set the parameter
+ IGeoPoint center = getCenter();
+ Position position = new Position(center.getLatitude(),
center.getLongitude());
+ position.setBearing(getBearing());
+ position.setZoomLevel(getZoomLevel());
+ mOnCameraChangeListener.onCameraChange(position);
}
}
}
Original comment by mes...@sindominio.net
on 8 Jan 2014 at 11:48
The description of the 'clear()' function on IMap says:
"Removes all markers, polylines, polygons, overlays, etc from the map."
But the actual implementation of OsmdroidMapWrapper don't removes the overlays.
Here there is a third patch to fix that:
Index:
osmdroid-third-party/src/main/java/org/osmdroid/google/wrapper/v2/OsmdroidMapWra
pper.java
===================================================================
---
osmdroid-third-party/src/main/java/org/osmdroid/google/wrapper/v2/OsmdroidMapWra
pper.java (revisión: 1395)
+++
osmdroid-third-party/src/main/java/org/osmdroid/google/wrapper/v2/OsmdroidMapWra
pper.java (copia de trabajo)
@@ -205,11 +208,9 @@
mItemizedOverlay.removeAllItems();
}
if (mPolylines != null) {
- for(final PathOverlay polyline : mPolylines.values()) {
-
mMapView.getOverlays().remove(mPolylines.remove(polyline));
- }
mPolylines.clear();
}
+ mMapView.getOverlays().clear();
}
@Override
Original comment by mes...@sindominio.net
on 9 Jan 2014 at 10:37
I don't understand your first point because IMap has a method
addPointsToPolyline, not addPointToPolyline.
Your second point could be done, but I figured it's a lot of overhead when you
may not actually need the position. If the caller needs it then it can also get
it itself in the same way. The parameter is only there for consistency with
Google Maps API v2.
Your third point is not right because IMap doesn't have a way to add overlays
and therefore the implementation doesn't remove them. Polylines are
implemented as overlays which is why they're explicitly removed. If you just
remove all overlays then you will also remove MyLocationOverlay and anything
else that may have been added. Again, the comment is just copied from Google
Maps API v2.
Original comment by neilboyd
on 12 Jan 2014 at 7:30
I see now that addPointsToPolyline is in the svn, it was not in the 4.0 version
(what I'm using). Sorry.
I'm ok with discarding my patches. Maybe the documentation could be improved so
we are not surprise by unexpected behavior, right now you need to read the
actual implementation to know what will be the result of a method.
Original comment by mes...@sindominio.net
on 13 Jan 2014 at 8:54
Original issue reported on code.google.com by
mes...@sindominio.net
on 8 Jan 2014 at 9:08