@@ -3,26 +3,56 @@ package geotrellis.server.ogc
3
3
import geotrellis .raster ._
4
4
import geotrellis .raster .render ._
5
5
import geotrellis .raster .render .png ._
6
- import geotrellis .raster .histogram ._
7
6
import geotrellis .raster .render .png ._
7
+ import geotrellis .raster .render ._
8
+ import geotrellis .raster .histogram ._
8
9
9
10
import scala .collection .mutable
10
11
import scala .util .Try
11
12
12
13
object Render {
13
- def apply (mbtile : MultibandTile , maybeStyle : Option [OgcStyle ], format : OutputFormat , hists : List [Histogram [Double ]]): Array [Byte ] =
14
+ def rgb (mbtile : MultibandTile , maybeStyle : Option [OgcStyle ], format : OutputFormat , hists : List [Histogram [Double ]]): Array [Byte ] =
14
15
maybeStyle match {
15
16
case Some (style) =>
16
17
style.renderImage(mbtile, format, hists)
17
18
case None =>
18
19
format match {
19
20
case format : OutputFormat .Png =>
20
- format.render(mbtile.band(bandIndex = 0 ))
21
+ OutputFormat .Png (Some (RgbPngEncoding )).render(mbtile.color())
22
+ case OutputFormat .Jpg =>
23
+ mbtile.color().renderJpg.bytes
24
+ case format =>
25
+ throw new IllegalArgumentException (s " $format is not a valid output format " )
26
+ }
27
+ }
21
28
29
+ def rgba (mbtile : MultibandTile , maybeStyle : Option [OgcStyle ], format : OutputFormat , hists : List [Histogram [Double ]]): Array [Byte ] =
30
+ maybeStyle match {
31
+ case Some (style) =>
32
+ style.renderImage(mbtile, format, hists)
33
+ case None =>
34
+ format match {
35
+ case format : OutputFormat .Png =>
36
+ OutputFormat .Png (Some (RgbaPngEncoding )).render(mbtile.color())
22
37
case OutputFormat .Jpg =>
23
- mbtile.band(bandIndex = 0 ).renderJpg.bytes
38
+ mbtile.color().renderJpg.bytes
39
+ case format =>
40
+ throw new IllegalArgumentException (s " $format is not a valid output format " )
41
+ }
42
+ }
24
43
25
- case OutputFormat .GeoTiff => ??? // Implementation necessary
44
+ def singleband (mbtile : MultibandTile , maybeStyle : Option [OgcStyle ], format : OutputFormat , hists : List [Histogram [Double ]]): Array [Byte ] =
45
+ maybeStyle match {
46
+ case Some (style) =>
47
+ style.renderImage(mbtile, format, hists)
48
+ case None =>
49
+ format match {
50
+ case format : OutputFormat .Png =>
51
+ format.render(mbtile.band(bandIndex = 0 ))
52
+ case OutputFormat .Jpg =>
53
+ mbtile.band(bandIndex = 0 ).renderJpg.bytes
54
+ case format =>
55
+ throw new IllegalArgumentException (s " $format is not a valid output format " )
26
56
}
27
57
}
28
58
0 commit comments