geotrellis.raster.io.geotiff.ByteGeoTiffMultibandTile.scala Maven / Gradle / Ivy
package geotrellis.raster.io.geotiff
import geotrellis.raster._
import geotrellis.raster.io.geotiff.compression._
import spire.syntax.cfor._
class ByteGeoTiffMultibandTile(
compressedBytes: Array[Array[Byte]],
decompressor: Decompressor,
segmentLayout: GeoTiffSegmentLayout,
compression: Compression,
bandCount: Int,
hasPixelInterleave: Boolean,
val cellType: ByteCells with NoDataHandling
) extends GeoTiffMultibandTile(compressedBytes, decompressor, segmentLayout, compression, bandCount, hasPixelInterleave)
with ByteGeoTiffSegmentCollection {
val noDataValue: Option[Byte] = cellType match {
case ByteCellType => None
case ByteConstantNoDataCellType => Some(Byte.MinValue)
case ByteUserDefinedNoDataCellType(nd) => Some(nd)
}
protected def createSegmentCombiner(targetSize: Int): SegmentCombiner =
new SegmentCombiner(bandCount) {
private val arr = Array.ofDim[Byte](targetSize)
def set(targetIndex: Int, v: Int): Unit = {
arr(targetIndex) = i2b(v)
}
def setDouble(targetIndex: Int, v: Double): Unit = {
arr(targetIndex) = d2b(v)
}
def getBytes(): Array[Byte] = arr
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy