Search in sources :

Example 1 with IALatLng

use of com.indooratlas.android.sdk.resources.IALatLng in project android-sdk-examples by IndoorAtlas.

the class MapsOverlayActivity method setupGroundOverlay.

/**
 * Sets bitmap of floor plan as ground overlay on Google Maps
 */
private void setupGroundOverlay(IAFloorPlan floorPlan, Bitmap bitmap) {
    if (mGroundOverlay != null) {
        mGroundOverlay.remove();
    }
    if (mMap != null) {
        BitmapDescriptor bitmapDescriptor = BitmapDescriptorFactory.fromBitmap(bitmap);
        IALatLng iaLatLng = floorPlan.getCenter();
        LatLng center = new LatLng(iaLatLng.latitude, iaLatLng.longitude);
        GroundOverlayOptions fpOverlay = new GroundOverlayOptions().image(bitmapDescriptor).zIndex(0.0f).position(center, floorPlan.getWidthMeters(), floorPlan.getHeightMeters()).bearing(floorPlan.getBearing());
        mGroundOverlay = mMap.addGroundOverlay(fpOverlay);
    }
}
Also used : GroundOverlayOptions(com.google.android.gms.maps.model.GroundOverlayOptions) BitmapDescriptor(com.google.android.gms.maps.model.BitmapDescriptor) IALatLng(com.indooratlas.android.sdk.resources.IALatLng) IALatLng(com.indooratlas.android.sdk.resources.IALatLng) LatLng(com.google.android.gms.maps.model.LatLng)

Example 2 with IALatLng

use of com.indooratlas.android.sdk.resources.IALatLng in project android-sdk-examples by IndoorAtlas.

the class WayfindingOverlayActivity method setupGroundOverlay.

/**
 * Sets bitmap of floor plan as ground overlay on Google Maps
 */
private void setupGroundOverlay(IAFloorPlan floorPlan, Bitmap bitmap) {
    if (mGroundOverlay != null) {
        mGroundOverlay.remove();
    }
    if (mMap != null) {
        BitmapDescriptor bitmapDescriptor = BitmapDescriptorFactory.fromBitmap(bitmap);
        IALatLng iaLatLng = floorPlan.getCenter();
        LatLng center = new LatLng(iaLatLng.latitude, iaLatLng.longitude);
        GroundOverlayOptions fpOverlay = new GroundOverlayOptions().image(bitmapDescriptor).zIndex(0.0f).position(center, floorPlan.getWidthMeters(), floorPlan.getHeightMeters()).bearing(floorPlan.getBearing());
        mGroundOverlay = mMap.addGroundOverlay(fpOverlay);
    }
}
Also used : GroundOverlayOptions(com.google.android.gms.maps.model.GroundOverlayOptions) BitmapDescriptor(com.google.android.gms.maps.model.BitmapDescriptor) IALatLng(com.indooratlas.android.sdk.resources.IALatLng) LatLng(com.google.android.gms.maps.model.LatLng) IALatLng(com.indooratlas.android.sdk.resources.IALatLng)

Example 3 with IALatLng

use of com.indooratlas.android.sdk.resources.IALatLng in project android-sdk-examples by IndoorAtlas.

the class MultiLocationMapView method updateLocationInternal.

private void updateLocationInternal(LocationEvent event) {
    final String identity = event.source.id;
    final IALocation location = event.location;
    IALatLng latLng = new IALatLng(location.getLatitude(), location.getLongitude());
    PointF point = mFloorPlan.coordinateToPoint(latLng);
    float accuracy = location.getAccuracy() * mFloorPlan.getMetersToPixels();
    Log.d(TAG, "converted location (" + event.location.getLatitude() + "," + event.location.getLongitude() + ") to point: " + point + " with floorplan: " + mFloorPlan.getId() + ", name: " + mFloorPlan.getName());
    mKnownLocations.put(identity, new LocationEntry(event.source, point, accuracy));
}
Also used : IALocation(com.indooratlas.android.sdk.IALocation) PointF(android.graphics.PointF) IALatLng(com.indooratlas.android.sdk.resources.IALatLng)

Example 4 with IALatLng

use of com.indooratlas.android.sdk.resources.IALatLng in project android-sdk-examples by IndoorAtlas.

the class OpenStreetMapOverlay method setupGroundOverlay.

/**
 * Sets bitmap of floor plan as ground overlay on Open Street Map
 */
private void setupGroundOverlay(IAFloorPlan floorPlan, Bitmap bitmap) {
    if (mGroundOverlay != null) {
        mOsmv.getOverlays().remove(mGroundOverlay);
    }
    if (mOsmv != null) {
        IALatLng iaLatLng = floorPlan.getCenter();
        GroundOverlay overlay = new GroundOverlay();
        overlay.setImage(new BitmapDrawable(getResources(), bitmap));
        overlay.setPosition(new GeoPoint(iaLatLng.latitude, iaLatLng.longitude));
        overlay.setDimensions(floorPlan.getWidthMeters(), floorPlan.getHeightMeters());
        overlay.setBearing(floorPlan.getBearing());
        mGroundOverlay = overlay;
        mOsmv.getOverlays().add(mGroundOverlay);
    }
}
Also used : GeoPoint(org.osmdroid.util.GeoPoint) IALatLng(com.indooratlas.android.sdk.resources.IALatLng) BitmapDrawable(android.graphics.drawable.BitmapDrawable) GroundOverlay(org.osmdroid.bonuspack.overlays.GroundOverlay)

Aggregations

IALatLng (com.indooratlas.android.sdk.resources.IALatLng)4 BitmapDescriptor (com.google.android.gms.maps.model.BitmapDescriptor)2 GroundOverlayOptions (com.google.android.gms.maps.model.GroundOverlayOptions)2 LatLng (com.google.android.gms.maps.model.LatLng)2 PointF (android.graphics.PointF)1 BitmapDrawable (android.graphics.drawable.BitmapDrawable)1 IALocation (com.indooratlas.android.sdk.IALocation)1 GroundOverlay (org.osmdroid.bonuspack.overlays.GroundOverlay)1 GeoPoint (org.osmdroid.util.GeoPoint)1