org.osmdroid.views.overlay.ItemizedOverlay Java Examples

The following examples show how to use org.osmdroid.views.overlay.ItemizedOverlay. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FragmentiGapMap.java    From iGap-Android with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * ****************************** callbacks ******************************
 */

@Override
public void onLocationChanged(Location location) {
    this.location = location;

    if (firstEnter) {
        lastLatitude = location.getLatitude();
        lastLongitude = location.getLongitude();
        firstEnter = false;
        currentLocation(location, true);
        getCoordinateLoop(0, false);
        getDistanceLoop(0, false);
    }
    mapBounding(location);
    GeoPoint geoPoint = new GeoPoint(location.getLatitude(), location.getLongitude());
    OverlayItem overlayItem = new OverlayItem("title", "City", geoPoint);

    //Drawable drawable = context.getResources().getDrawable(R.drawable.location_current);
    overlayItem.setMarker(avatarMark(G.userId, MarkerColor.GRAY)); // marker color is not important in this line because for mineAvatar will be unused.

    ArrayList<OverlayItem> overlayItemArrayList = new ArrayList<>();
    overlayItemArrayList.add(overlayItem);
    ItemizedOverlay<OverlayItem> locationOverlay = new ItemizedIconOverlay<>(context, overlayItemArrayList, null);

    if (latestLocation != null) {
        map.getOverlays().remove(latestLocation);
    }

    latestLocation = locationOverlay;
    map.getOverlays().add(locationOverlay);

    //if (BuildConfig.DEBUG) {
    //    G.handler.post(new Runnable() {
    //        @Override
    //        public void run() {
    //            Toast.makeText(context, "Update Position", Toast.LENGTH_SHORT).show();
    //        }
    //    });
    //}
}
 
Example #2
Source File: SampleItemizedOverlay.java    From osmdroid with Apache License 2.0 4 votes vote down vote up
@Override
public void onFocusChanged(ItemizedOverlay<?> overlay, OverlayItem newFocus) {
	mFocusChanged = true;
}