Skip to content

Commit

Permalink
fix(android): implement setTileSize for RasterDemSource (#3334)
Browse files Browse the repository at this point in the history
  • Loading branch information
mfazekas authored Jan 20, 2024
1 parent f34246e commit 8c2e7ce
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ import com.rnmapbox.rnmbx.v11compat.feature.*
// import com.rnmapbox.rnmbx.utils.DownloadMapImageTask;
class RNMBXRasterDemSource(context: Context?, private val mManager: RNMBXRasterDemSourceManager) :
RNMBXTileSource<RasterDemSource?>(context) {

private var tileSize: Long? = null

override fun onPress(event: OnPressEvent?) {
mManager.handleEvent(FeatureClickEvent.makeVectorSourceEvent(this, event))
}
Expand All @@ -35,15 +38,18 @@ class RNMBXRasterDemSource(context: Context?, private val mManager: RNMBXRasterD
return mMap!!.getStyle()!!.getSource(DEFAULT_ID) as RasterDemSource
}
val configurationUrl = uRL
return if (configurationUrl != null) {
RasterDemSource(
RasterDemSource.Builder(id)
.url(configurationUrl)
)
} else RasterDemSource(

val builder = if (configurationUrl != null) {
RasterDemSource.Builder(id)
.url(configurationUrl)
} else {
RasterDemSource.Builder(id)
.tileSet(buildTileset())
)
}

tileSize?.let { builder.tileSize(it) }

return RasterDemSource(builder)
}

fun querySourceFeatures(
Expand Down Expand Up @@ -81,4 +87,8 @@ class RNMBXRasterDemSource(context: Context?, private val mManager: RNMBXRasterD
override fun hasNoDataSoRefersToExisting(): Boolean {
return uRL == null && tileUrlTemplates.isEmpty()
}

fun setTileSize(tileSize: Int) {
this.tileSize = tileSize.toLong()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ class RNMBXRasterDemSourceManager(private val mContext: ReactApplicationContext)

@ReactProp(name = "tileSize")
override fun setTileSize(view: RNMBXRasterDemSource, value: Dynamic) {
Logger.e("RNMBXRasterDemSourceManager", "tileSize not implemented")
view.setTileSize(value.asInt())
}
}

0 comments on commit 8c2e7ce

Please sign in to comment.