diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/GoogleMap.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/GoogleMap.kt index ca565a05..fb0b4f83 100644 --- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/GoogleMap.kt +++ b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/GoogleMap.kt @@ -112,6 +112,9 @@ class GoogleMapImpl(private val context: Context, var options: GoogleMapOptions) val markers = mutableMapOf() var markerId = 0L + var groundId = 0L + var tileId = 0L + var storedMapType: Int = options.mapType val waitingCameraUpdates = mutableListOf() @@ -287,12 +290,12 @@ class GoogleMapImpl(private val context: Context, var options: GoogleMapOptions) override fun addGroundOverlay(options: GroundOverlayOptions): IGroundOverlayDelegate? { Log.d(TAG, "unimplemented Method: addGroundOverlay") - return null + return GroundOverlayImpl(this, "g${groundId++}", options) } override fun addTileOverlay(options: TileOverlayOptions): ITileOverlayDelegate? { Log.d(TAG, "unimplemented Method: addTileOverlay") - return null + return TileOverlayImpl(this, "t${tileId++}", options) } override fun addCircle(options: CircleOptions): ICircleDelegate? { diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/GroundOverlay.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/GroundOverlay.kt new file mode 100644 index 00000000..1dbab951 --- /dev/null +++ b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/GroundOverlay.kt @@ -0,0 +1,126 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.microg.gms.maps.mapbox.model + +import android.os.Parcel +import android.util.Log +import com.google.android.gms.dynamic.IObjectWrapper +import com.google.android.gms.maps.model.GroundOverlayOptions +import com.google.android.gms.maps.model.LatLng +import com.google.android.gms.maps.model.LatLngBounds +import com.google.android.gms.maps.model.internal.IGroundOverlayDelegate +import org.microg.gms.maps.mapbox.GoogleMapImpl + +class GroundOverlayImpl(private val map: GoogleMapImpl, private val id: String, options: GroundOverlayOptions) : IGroundOverlayDelegate.Stub() { + private var location: LatLng? = options.location + private var width: Float = options.width + private var height: Float = options.height + private var bounds: LatLngBounds? = options.bounds + private var bearing: Float = options.bearing + private var zIndex: Float = options.zIndex + private var visible: Boolean = options.isVisible + private var transparency: Float = options.transparency + + override fun getId(): String { + return id + } + + override fun getPosition(): LatLng? { + return location + } + + override fun setPosition(pos: LatLng?) { + this.location = pos + } + + override fun getWidth(): Float { + return width + } + + override fun getHeight(): Float { + return height + } + + override fun setDimensions(width: Float, height: Float) { + this.width = width + this.height = height + } + + override fun getBounds(): LatLngBounds? { + return bounds + } + + override fun getBearing(): Float { + return bearing + } + + override fun setBearing(bearing: Float) { + this.bearing = bearing + } + + override fun setZIndex(zIndex: Float) { + this.zIndex = zIndex + } + + override fun getZIndex(): Float { + return zIndex + } + + override fun isVisible(): Boolean { + return visible + } + + override fun setVisible(visible: Boolean) { + this.visible = visible + } + + override fun getTransparency(): Float { + return transparency + } + + override fun setTransparency(transparency: Float) { + this.transparency = transparency + } + + override fun setDimension(dimension: Float) { + Log.w(TAG, "unimplemented Method: setDimension") + } + + override fun setPositionFromBounds(bounds: LatLngBounds?) { + this.bounds = bounds + } + + override fun equalsRemote(other: IGroundOverlayDelegate?): Boolean { + return this.equals(other) + } + + override fun hashCode(): Int { + return id.hashCode() + } + + override fun hashCodeRemote(): Int { + return hashCode() + } + + override fun remove() { + Log.w(TAG, "unimplemented Method: remove") + } + + override fun todo(obj: IObjectWrapper?) { + Log.w(TAG, "unimplemented Method: todo") + } + + override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean = + if (super.onTransact(code, data, reply, flags)) { + true + } else { + Log.d(TAG, "onTransact [unknown]: $code, $data, $flags"); false + } + + companion object { + private val TAG = "GmsMapMarker" + } +} diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/TileOverlay.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/TileOverlay.kt new file mode 100644 index 00000000..dfa4cb49 --- /dev/null +++ b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/TileOverlay.kt @@ -0,0 +1,14 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.microg.gms.maps.mapbox.model + +import com.google.android.gms.maps.model.TileOverlayOptions +import com.google.android.gms.maps.model.internal.ITileOverlayDelegate +import org.microg.gms.maps.mapbox.GoogleMapImpl + +class TileOverlayImpl(private val map: GoogleMapImpl, private val id: String, options: TileOverlayOptions) : ITileOverlayDelegate.Stub() { + +}