Skip to content

Commit

Permalink
Merge pull request #61 from moradology/feature/bump-gtc-0.5.0
Browse files Browse the repository at this point in the history
Remove typeclass requirements and required typeclasses where possible
  • Loading branch information
moradology authored Dec 6, 2018
2 parents f7e3a96 + c064f66 commit 6f16ab4
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 26 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ lazy val commonSettings = Seq(
cancelable in Global := true,
scalaVersion := scalaVer,
crossScalaVersions := crossScalaVer,
version := "0.0.11",
version := "0.0.12",
scalacOptions := Seq(
"-deprecation",
"-unchecked",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ import simulacrum._

@typeclass trait HasRasterExtents[A] {
@op("rasterExtents") def rasterExtents(self: A)(implicit contextShift: ContextShift[IO]): IO[NEL[RasterExtent]]
@op("crs") def crs(self: A)(implicit contextShift: ContextShift[IO]): IO[CRS]
}

8 changes: 2 additions & 6 deletions core/src/main/scala/geotrellis/server/LayerExtent.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,13 @@ object LayerExtent extends LazyLogging {
interpreter: BufferingInterpreter
)(
implicit reify: ExtentReification[Param],
enc: Encoder[Param],
contextShift: ContextShift[IO]
): (Extent, CellSize) => IO[Interpreted[MultibandTile]] = (extent: Extent, cs: CellSize) => {
for {
expr <- getExpression
_ <- IO.pure(logger.info(s"Retrieved MAML AST for extent ($extent) and cellsize ($cs): ${expr.asJson.noSpaces}"))
_ <- IO.pure(logger.info(s"Retrieved MAML AST for extent ($extent) and cellsize ($cs): ${expr.toString}"))
paramMap <- getParams
_ <- IO.pure(logger.info(s"Retrieved parameters for extent ($extent) and cellsize ($cs): ${paramMap.asJson.noSpaces}"))
_ <- IO.pure(logger.info(s"Retrieved parameters for extent ($extent) and cellsize ($cs): ${paramMap.toString}"))
vars <- IO.pure { Vars.varsWithBuffer(expr) }
params <- vars.toList.parTraverse { case (varName, (_, buffer)) =>
val thingify = paramMap(varName).extentReification
Expand All @@ -50,7 +49,6 @@ object LayerExtent extends LazyLogging {
interpreter: BufferingInterpreter
)(
implicit reify: ExtentReification[Param],
enc: Encoder[Param],
contextShift: ContextShift[IO]
) = apply[Param](getParams.map(mkExpr(_)), getParams, interpreter)

Expand All @@ -61,7 +59,6 @@ object LayerExtent extends LazyLogging {
interpreter: BufferingInterpreter
)(
implicit reify: ExtentReification[Param],
enc: Encoder[Param],
contextShift: ContextShift[IO]
): (Map[String, Param], Extent, CellSize) => IO[Interpreted[MultibandTile]] =
(paramMap: Map[String, Param], extent: Extent, cellsize: CellSize) => {
Expand All @@ -75,7 +72,6 @@ object LayerExtent extends LazyLogging {
param: Param
)(
implicit reify: ExtentReification[Param],
enc: Encoder[Param],
contextShift: ContextShift[IO]
): (Extent, CellSize) => IO[Interpreted[MultibandTile]] =
(extent: Extent, cellsize: CellSize) => {
Expand Down
5 changes: 0 additions & 5 deletions core/src/main/scala/geotrellis/server/LayerHistogram.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import geotrellis.vector.Extent
import geotrellis.raster._
import geotrellis.raster.histogram._

import _root_.io.circe._
import cats.data.{NonEmptyList => NEL}
import cats.effect._
import cats.implicits._
Expand Down Expand Up @@ -72,7 +71,6 @@ object LayerHistogram extends LazyLogging {
)(
implicit reify: ExtentReification[Param],
extended: HasRasterExtents[Param],
enc: Encoder[Param],
contextShift: ContextShift[IO]
): IO[Interpreted[List[Histogram[Double]]]] =
for {
Expand Down Expand Up @@ -105,7 +103,6 @@ object LayerHistogram extends LazyLogging {
)(
implicit reify: ExtentReification[Param],
extended: HasRasterExtents[Param],
enc: Encoder[Param],
contextShift: ContextShift[IO]
) = apply[Param](getParams.map(mkExpr(_)), getParams, interpreter, maxCells)

Expand All @@ -118,7 +115,6 @@ object LayerHistogram extends LazyLogging {
)(
implicit reify: ExtentReification[Param],
extended: HasRasterExtents[Param],
enc: Encoder[Param],
contextShift: ContextShift[IO]
): (Map[String, Param]) => IO[Interpreted[List[Histogram[Double]]]] =
(paramMap: Map[String, Param]) => {
Expand All @@ -133,7 +129,6 @@ object LayerHistogram extends LazyLogging {
)(
implicit reify: ExtentReification[Param],
extended: HasRasterExtents[Param],
enc: Encoder[Param],
contextShift: ContextShift[IO]
) = {
val eval = curried(RasterVar("identity"), BufferingInterpreter.DEFAULT, maxCells)
Expand Down
10 changes: 2 additions & 8 deletions core/src/main/scala/geotrellis/server/LayerTms.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import com.azavea.maml.ast._
import com.azavea.maml.ast.codec.tree._
import com.azavea.maml.eval._
import com.typesafe.scalalogging.LazyLogging
import io.circe._
import io.circe.syntax._
import cats.effect._
import cats.implicits._
import geotrellis.raster._
Expand All @@ -35,14 +33,13 @@ object LayerTms extends LazyLogging {
interpreter: BufferingInterpreter
)(
implicit reify: TmsReification[Param],
enc: Encoder[Param],
contextShift: ContextShift[IO]
): (Int, Int, Int) => IO[Interpreted[MultibandTile]] = (z: Int, x: Int, y: Int) => {
for {
expr <- getExpression
_ <- IO.pure(logger.info(s"Retrieved MAML AST at TMS ($z, $x, $y): ${expr.asJson.noSpaces}"))
_ <- IO.pure(logger.info(s"Retrieved MAML AST at TMS ($z, $x, $y): ${expr.toString}"))
paramMap <- getParams
_ <- IO.pure(logger.info(s"Retrieved parameters for TMS ($z, $x, $y): ${paramMap.asJson.noSpaces}"))
_ <- IO.pure(logger.info(s"Retrieved parameters for TMS ($z, $x, $y): ${paramMap.toString}"))
vars <- IO.pure { Vars.varsWithBuffer(expr) }
params <- vars.toList.parTraverse { case (varName, (_, buffer)) =>
val eval = paramMap(varName).tmsReification(buffer)
Expand All @@ -62,7 +59,6 @@ object LayerTms extends LazyLogging {
interpreter: BufferingInterpreter
)(
implicit reify: TmsReification[Param],
enc: Encoder[Param],
contextShift: ContextShift[IO]
) = apply[Param](getParams.map(mkExpr(_)), getParams, interpreter)

Expand All @@ -73,7 +69,6 @@ object LayerTms extends LazyLogging {
interpreter: BufferingInterpreter
)(
implicit reify: TmsReification[Param],
enc: Encoder[Param],
contextShift: ContextShift[IO]
): (Map[String, Param], Int, Int, Int) => IO[Interpreted[MultibandTile]] =
(paramMap: Map[String, Param], z: Int, x: Int, y: Int) => {
Expand All @@ -87,7 +82,6 @@ object LayerTms extends LazyLogging {
param: Param
)(
implicit reify: TmsReification[Param],
enc: Encoder[Param],
contextShift: ContextShift[IO]
) = (z: Int, x: Int, y: Int) => {
val eval = curried(RasterVar("identity"), BufferingInterpreter.DEFAULT)
Expand Down
2 changes: 0 additions & 2 deletions core/src/main/scala/geotrellis/server/vlm/gdal/GDALNode.scala
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ object GDALNode extends RasterSourceUtils {
implicit val gdalNodeRasterExtents: HasRasterExtents[GDALNode] = new HasRasterExtents[GDALNode] {
def rasterExtents(self: GDALNode)(implicit contextShift: ContextShift[IO]): IO[NEL[RasterExtent]] =
getRasterExtents(self.uri.toString)
def crs(self: GDALNode)(implicit contextShift: ContextShift[IO]): IO[CRS] =
getCRS(self.uri.toString)
}

implicit val gdalNodeTmsReification: TmsReification[GDALNode] = new TmsReification[GDALNode] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ object GeoTiffNode extends RasterSourceUtils {
implicit val cogNodeRasterExtents: HasRasterExtents[GeoTiffNode] = new HasRasterExtents[GeoTiffNode] {
def rasterExtents(self: GeoTiffNode)(implicit contextShift: ContextShift[IO]): IO[NEL[RasterExtent]] =
getRasterExtents(self.uri.toString)
def crs(self: GeoTiffNode)(implicit contextShift: ContextShift[IO]): IO[CRS] =
getCRS(self.uri.toString)
}

implicit val cogNodeTmsReification: TmsReification[GeoTiffNode] = new TmsReification[GeoTiffNode] {
Expand Down
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ object Dependencies {

val circeVer = "0.10.0"
val gtVer = "3.0.0-SNAPSHOT"
val gtcVer = "0.4.0"
val gtcVer = "0.5.0"
val http4sVer = "0.19.0"
val scalaVer = "2.11.12"
val crossScalaVer = Seq(scalaVer, "2.12.7")
Expand Down

0 comments on commit 6f16ab4

Please sign in to comment.