use of com.mapbox.mapboxsdk.geometry.LatLng in project osm-contributor by jawg.
the class OsmAnimatorUpdateListener method onAnimationUpdate.
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
float animatedValue = (Float) valueAnimator.getAnimatedValue();
Double lat = originPos.getLatitude() + latStep * animatedValue;
Double lng = originPos.getLongitude() + lngStep * animatedValue;
LatLng newPosition = new LatLng(lat, lng);
mapboxMap.setCameraPosition(new CameraPosition.Builder().target(newPosition).build());
}
use of com.mapbox.mapboxsdk.geometry.LatLng in project osm-contributor by jawg.
the class LatLngBoundsUtils method enlarge.
public static LatLngBounds enlarge(LatLngBounds viewLatLngBounds, double factor) {
double n = viewLatLngBounds.getLatNorth();
double e = viewLatLngBounds.getLonEast();
double s = viewLatLngBounds.getLatSouth();
double w = viewLatLngBounds.getLonWest();
double f = (factor - 1) / 2;
return new LatLngBounds.Builder().include(new LatLng(n + f * (n - s), e + f * (e - w))).include(new LatLng(s - f * (n - s), w - f * (e - w))).build();
}
use of com.mapbox.mapboxsdk.geometry.LatLng in project osm-contributor by jawg.
the class Box method enlarge.
/**
* Enlarge the Box.
*
* @param viewLatLngBounds The box to enlarge.
* @param factor The factor to enlarge the box.
* @return Box the Box enlarged.
*/
public static LatLngBounds enlarge(LatLngBounds viewLatLngBounds, double factor) {
double n = viewLatLngBounds.getLatNorth();
double e = viewLatLngBounds.getLonEast();
double s = viewLatLngBounds.getLatSouth();
double w = viewLatLngBounds.getLonWest();
double f = (factor - 1) / 2;
return new LatLngBounds.Builder().include(new LatLng(n + f * (n - s), e + f * (e - w))).include(new LatLng(s - f * (n - s), w - f * (e - w))).build();
}
use of com.mapbox.mapboxsdk.geometry.LatLng in project osm-contributor by jawg.
the class EditPoiManager method onPleaseCreateNoTagPoiEvent.
@Subscribe(threadMode = ThreadMode.ASYNC)
public void onPleaseCreateNoTagPoiEvent(PleaseCreateNoTagPoiEvent event) {
Poi poi = new Poi();
LatLng latLng = event.getLatLng();
poi.setLatitude(latLng.getLatitude());
poi.setLongitude(latLng.getLongitude());
poi.setType(event.getPoiType());
List<PoiTag> defaultTags = new ArrayList<>();
for (PoiTypeTag poiTypeTag : poi.getType().getTags()) {
if (poiTypeTag.getValue() != null) {
// default tags should be set in the corresponding POI
PoiTag poiTag = new PoiTag();
poiTag.setKey(poiTypeTag.getKey());
poiTag.setValue(poiTypeTag.getValue());
defaultTags.add(poiTag);
}
}
poi.setTags(defaultTags);
poi.setUpdated(true);
poiManager.savePoi(poi);
poiManager.updatePoiTypeLastUse(event.getPoiType().getId());
eventBus.post(new PoiNoTypeCreated());
}
use of com.mapbox.mapboxsdk.geometry.LatLng in project osm-contributor by jawg.
the class EditPoiManager method onPleaseApplyNodeRefPositionChange.
@Subscribe(threadMode = ThreadMode.ASYNC)
public void onPleaseApplyNodeRefPositionChange(PleaseApplyNodeRefPositionChange event) {
Timber.d("Please apply noderef position change");
LatLng newLatLng = event.getPoiPosition();
// apply changes on the noderef
PoiNodeRef poiNodeRef = poiNodeRefDao.queryForId(event.getPoiId());
poiNodeRef.setOldPoiId(saveOldVersionOfPoiNodeRef(poiNodeRef));
poiNodeRef.setLongitude(newLatLng.getLongitude());
poiNodeRef.setLatitude(newLatLng.getLatitude());
poiNodeRef.setUpdated(true);
poiNodeRefDao.createOrUpdate(poiNodeRef);
}
Aggregations