Search in sources :

Example 26 with MapPoint

use of org.odk.collect.geo.maps.MapPoint in project collect by opendatakit.

the class OsmDroidMapFragment method addDraggablePoly.

@Override
public int addDraggablePoly(@NonNull Iterable<MapPoint> points, boolean closedPolygon) {
    int featureId = nextFeatureId++;
    features.put(featureId, new PolyFeature(map, points, closedPolygon));
    return featureId;
}
Also used : IGeoPoint(org.osmdroid.api.IGeoPoint) Paint(android.graphics.Paint) MapPoint(org.odk.collect.geo.maps.MapPoint) GeoPoint(org.osmdroid.util.GeoPoint)

Example 27 with MapPoint

use of org.odk.collect.geo.maps.MapPoint in project collect by opendatakit.

the class GoogleMapFragment method addMarker.

@Override
public int addMarker(MapPoint point, boolean draggable, @IconAnchor String iconAnchor) {
    int featureId = nextFeatureId++;
    features.put(featureId, new MarkerFeature(map, point, draggable, iconAnchor));
    return featureId;
}
Also used : MapPoint(org.odk.collect.geo.maps.MapPoint) SuppressLint(android.annotation.SuppressLint)

Example 28 with MapPoint

use of org.odk.collect.geo.maps.MapPoint in project collect by opendatakit.

the class GoogleMapFragment method fromMarker.

@NonNull
private static MapPoint fromMarker(@NonNull Marker marker) {
    LatLng position = marker.getPosition();
    String snippet = marker.getSnippet();
    String[] parts = (snippet != null ? snippet : "").split(";");
    double alt = 0;
    double sd = 0;
    try {
        if (parts.length >= 1) {
            alt = Double.parseDouble(parts[0]);
        }
        if (parts.length >= 2) {
            sd = Double.parseDouble(parts[1]);
        }
    } catch (NumberFormatException e) {
        Timber.w("Marker.getSnippet() did not contain two numbers");
    }
    return new MapPoint(position.latitude, position.longitude, alt, sd);
}
Also used : MapPoint(org.odk.collect.geo.maps.MapPoint) LatLng(com.google.android.gms.maps.model.LatLng) NonNull(androidx.annotation.NonNull)

Aggregations

MapPoint (org.odk.collect.geo.maps.MapPoint)28 Test (org.junit.Test)8 SuppressLint (android.annotation.SuppressLint)7 IGeoPoint (org.osmdroid.api.IGeoPoint)5 GeoPoint (org.osmdroid.util.GeoPoint)5 Paint (android.graphics.Paint)4 Pair (android.util.Pair)4 Date (java.util.Date)4 Instance (org.odk.collect.forms.instances.Instance)4 Intent (android.content.Intent)3 Handler (android.os.Handler)3 ArrayList (java.util.ArrayList)3 ImageButton (android.widget.ImageButton)2 NonNull (androidx.annotation.NonNull)2 LatLng (com.google.android.gms.maps.model.LatLng)1 LatLngBounds (com.google.android.gms.maps.model.LatLngBounds)1 MaterialAlertDialogBuilder (com.google.android.material.dialog.MaterialAlertDialogBuilder)1 LatLngBounds (com.mapbox.mapboxsdk.geometry.LatLngBounds)1 Ignore (org.junit.Ignore)1 Location (org.odk.collect.location.Location)1