
geotrellis.raster.io.geotiff.ByteGeoTiffMultibandTile.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of geotrellis-raster_2.10 Show documentation
Show all versions of geotrellis-raster_2.10 Show documentation
GeoTrellis is an open source geographic data processing engine for high performance applications.
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
}
}