use of net.osmand.core.jni.PointI in project Osmand by osmandapp.
the class MapContextMenuFragment method setFragmentVisibility.
public void setFragmentVisibility(boolean visible) {
if (visible) {
view.setVisibility(View.VISIBLE);
if (mapCenter != null) {
PointI targetI = Utilities.convertLatLonTo31(new net.osmand.core.jni.LatLon(mapCenter.getLatitude(), mapCenter.getLongitude()));
getMainActivity().setTarget(targetI);
}
adjustMapPosition(getPosY(), true, false);
} else {
view.setVisibility(View.GONE);
}
}
use of net.osmand.core.jni.PointI in project Osmand by osmandapp.
the class MainActivity method showOnMap.
public void showOnMap(double latitude, double longitude, int zoom) {
PointI target = Utilities.convertLatLonTo31(new net.osmand.core.jni.LatLon(latitude, longitude));
setTarget(target);
setZoom(zoom);
}
use of net.osmand.core.jni.PointI in project Osmand by osmandapp.
the class MainActivity method updateLocation.
@Override
public void updateLocation(Location location) {
final SampleApplication app = getMyApplication();
final Location lastKnownLocation = app.getLocationProvider().getLastKnownLocation();
if (lastKnownLocation == null || mapView == null) {
app.runInUIThread(new Runnable() {
@Override
public void run() {
if (!myLocationMarker.isHidden()) {
mapView.suspendSymbolsUpdate();
myLocationMarker.setIsHidden(true);
mapView.resumeSymbolsUpdate();
}
}
});
return;
}
final PointI target31 = Utilities.convertLatLonTo31(new net.osmand.core.jni.LatLon(location.getLatitude(), location.getLongitude()));
app.runInUIThread(new Runnable() {
@Override
public void run() {
mapView.suspendSymbolsUpdate();
myLocationMarker.setIsHidden(false);
myLocationMarker.setPosition(target31);
myLocationMarker.setIsAccuracyCircleVisible(true);
myLocationMarker.setAccuracyCircleRadius(lastKnownLocation.getAccuracy());
mapView.resumeSymbolsUpdate();
}
});
if (menu != null) {
menu.updateMyLocation(location);
}
}
use of net.osmand.core.jni.PointI in project Osmand by osmandapp.
the class MainActivity method getScreenCenter31.
public PointI getScreenCenter31() {
PointI point = new PointI();
mapView.getLocationFromScreenPoint(new PointI(mapView.getWidth() / 2, mapView.getHeight() / 2), point);
return point;
}
use of net.osmand.core.jni.PointI in project Osmand by osmandapp.
the class MainActivity method getScreenCenter.
public LatLon getScreenCenter() {
PointI point = new PointI();
mapView.getLocationFromScreenPoint(new PointI(mapView.getWidth() / 2, mapView.getHeight() / 2), point);
net.osmand.core.jni.LatLon jniLatLon = Utilities.convert31ToLatLon(point);
return new LatLon(jniLatLon.getLatitude(), jniLatLon.getLongitude());
}
Aggregations