Search in sources :

Example 6 with PointI

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);
    }
}
Also used : PointI(net.osmand.core.jni.PointI)

Example 7 with PointI

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);
}
Also used : PointI(net.osmand.core.jni.PointI)

Example 8 with PointI

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);
    }
}
Also used : PointI(net.osmand.core.jni.PointI) Location(net.osmand.Location)

Example 9 with PointI

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;
}
Also used : PointI(net.osmand.core.jni.PointI)

Example 10 with PointI

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());
}
Also used : LatLon(net.osmand.data.LatLon) PointI(net.osmand.core.jni.PointI)

Aggregations

PointI (net.osmand.core.jni.PointI)11 LatLon (net.osmand.data.LatLon)4 RotatedTileBox (net.osmand.data.RotatedTileBox)2 Location (net.osmand.Location)1 MapRendererView (net.osmand.core.android.MapRendererView)1 TileSourceProxyProvider (net.osmand.core.android.TileSourceProxyProvider)1 AreaI (net.osmand.core.jni.AreaI)1 MapLayerConfiguration (net.osmand.core.jni.MapLayerConfiguration)1 QuadPoint (net.osmand.data.QuadPoint)1 ITileSource (net.osmand.map.ITileSource)1 OsmandSettings (net.osmand.plus.OsmandSettings)1