geotrellis.raster.io.geotiff.util.package.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.11 Show documentation
Show all versions of geotrellis-raster_2.11 Show documentation
GeoTrellis is an open source geographic data processing engine for high performance applications.
The newest version!
package geotrellis.raster.io.geotiff
import geotrellis.raster._
import java.nio.ByteBuffer
package object util extends ArrayExtensions
with ByteBufferExtensions
with ByteInverter
with GDALNoDataParser {
implicit class ShortArrayToByte(val arr: Array[Short]) extends AnyVal {
def toArrayByte(): Array[Byte] = {
val result = new Array[Byte](arr.size * ShortConstantNoDataCellType.bytes)
val bytebuff = ByteBuffer.wrap(result)
bytebuff.asShortBuffer.put(arr)
result
}
}
implicit class IntArrayToByte(val arr: Array[Int]) extends AnyVal {
def toArrayByte(): Array[Byte] = {
val result = new Array[Byte](arr.size * IntConstantNoDataCellType.bytes)
val bytebuff = ByteBuffer.wrap(result)
bytebuff.asIntBuffer.put(arr)
result
}
}
implicit class FloatArrayToByte(val arr: Array[Float]) extends AnyVal {
def toArrayByte(): Array[Byte] = {
val result = new Array[Byte](arr.size * FloatConstantNoDataCellType.bytes)
val bytebuff = ByteBuffer.wrap(result)
bytebuff.asFloatBuffer.put(arr)
result
}
}
implicit class DoubleArrayToByte(val arr: Array[Double]) extends AnyVal {
def toArrayByte(): Array[Byte] = {
val result = new Array[Byte](arr.size * DoubleConstantNoDataCellType.bytes)
val bytebuff = ByteBuffer.wrap(result)
bytebuff.asDoubleBuffer.put(arr)
result
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy