Skip to content

Commit

Permalink
(vt) Make many things private to exclude them from Scaladocs
Browse files Browse the repository at this point in the history
  • Loading branch information
fosskers committed Jul 24, 2017
1 parent d6a0a4d commit 981a0ee
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 19 deletions.
Expand Up @@ -49,24 +49,24 @@ import scala.annotation.tailrec
* - Any Polygon in a Polygon feature must have a LineTo with a count of at least 2.
* - ClosePath must always have a parameter count of 1.
*/
sealed trait Command extends Serializable
private[vectortile] sealed trait Command extends Serializable

/** `MoveTo` signals a series of moves from the current cursor (default of `(0,0)`).
* The parameter pairs that follow don't represent a point to move to,
* but instead are deltas from the current cursor.
*/
case class MoveTo(deltas: Array[(Int,Int)]) extends Command
private[vectortile] case class MoveTo(deltas: Array[(Int,Int)]) extends Command

/** `LineTo` indicates that a LineString should be continued from the current
* cursor.
*/
case class LineTo(deltas: Array[(Int,Int)]) extends Command
private[vectortile] case class LineTo(deltas: Array[(Int,Int)]) extends Command

/** Signals the end of a Polygon. Never has parameters, and doesn't move the cursor. */
case object ClosePath extends Command
private[vectortile] case object ClosePath extends Command

/** Contains convenience functions for handling [[Command]]s. */
object Command {
private[vectortile] object Command {
/** Attempt to parse a list of Command/Parameter Integers. */
def commands(cmds: Seq[Int]): ListBuffer[Command] = {
@tailrec def work(cmds: Seq[Int], curr: ListBuffer[Command]): ListBuffer[Command] = cmds match {
Expand Down
Expand Up @@ -40,7 +40,7 @@ import geotrellis.vector.{ Geometry, MultiGeometry, Point }
* implicitly[ProtobufGeom[Point, MultiPoint]].fromCommands(Command.commands(Seq(9,2,2)), topLeft, resolution)
* }}}
*/
trait ProtobufGeom[G1 <: Geometry, G2 <: MultiGeometry] extends Serializable {
private[vectortile] trait ProtobufGeom[G1 <: Geometry, G2 <: MultiGeometry] extends Serializable {
/**
* Decode a sequence of VectorTile [[Command]]s into a GeoTrellis
* Geometry. Due to the reasons stated above, this may be either
Expand Down
Expand Up @@ -35,10 +35,10 @@ package object internal {
/** If an sequence of Commands is given that does not conform to what the
* Point, LineString, and Polygon decoders expect.
*/
case class CommandSequenceError(message: String) extends Exception(message)
private[vectortile] case class CommandSequenceError(message: String) extends Exception(message)

/** If some invalid combination of command id and parameter count are given. */
case class CommandError(id: Int, count: Int) extends Exception(s"ID: ${id}, COUNT: ${count}")
private[vectortile] case class CommandError(id: Int, count: Int) extends Exception(s"ID: ${id}, COUNT: ${count}")

/**
* Expand a collection of diffs from some reference point into that
Expand Down Expand Up @@ -124,7 +124,7 @@ package object internal {
* }}}
*
*/
def toProjection(point: (Int, Int), topLeft: Point, resolution: Double): Point = {
private[vectortile] def toProjection(point: (Int, Int), topLeft: Point, resolution: Double): Point = {
Point(
topLeft.x + (resolution * point._1),
topLeft.y - (resolution * point._2)
Expand All @@ -140,15 +140,15 @@ package object internal {
* @param resolution How much of the CRS's units are covered by a single VT grid coordinate.
* @return Grid coordinates in VectorTile space.
*/
def fromProjection(point: Point, topLeft: Point, resolution: Double): (Int, Int) = {
private[vectortile] def fromProjection(point: Point, topLeft: Point, resolution: Double): (Int, Int) = {
(
((point.x - topLeft.x) / resolution).toInt,
((topLeft.y - point.y) / resolution).toInt
)
}

/** Instance definition of the ProtobufGeom typeclass for Points. */
implicit val protoPoint = new ProtobufGeom[Point, MultiPoint] {
private[vectortile] implicit val protoPoint = new ProtobufGeom[Point, MultiPoint] {
def fromCommands(
cmds: Seq[Command],
topLeft: Point,
Expand All @@ -175,7 +175,7 @@ package object internal {
}

/** Instance definition of the ProtobufGeom typeclass for Lines. */
implicit val protoLine = new ProtobufGeom[Line, MultiLine] {
private[vectortile] implicit val protoLine = new ProtobufGeom[Line, MultiLine] {
def fromCommands(
cmds: Seq[Command],
topLeft: Point,
Expand Down Expand Up @@ -230,7 +230,7 @@ package object internal {
}

/** Instance definition of the ProtobufGeom typeclass for Polygons. */
implicit val protoPolygon = new ProtobufGeom[Polygon, MultiPolygon] {
private[vectortile] implicit val protoPolygon = new ProtobufGeom[Polygon, MultiPolygon] {
def fromCommands(
cmds: Seq[Command],
topLeft: Point,
Expand Down Expand Up @@ -334,7 +334,7 @@ package object internal {
* If the value reported here is negative, then the [[Polygon]] should be
* considered an Interior Ring.
*/
def surveyor(l: ListBuffer[(Int, Int)]): Double = {
private[vectortile] def surveyor(l: ListBuffer[(Int, Int)]): Double = {
val ps: ListBuffer[(Int, Int)] = l.init
val xs = ps.map(_._1)
val yns = (ps :+ ps.head).tail.map(_._2)
Expand All @@ -353,7 +353,7 @@ package object internal {
}

/** Automatically convert mid-level Protobuf Values into a high-level [[Value]]. */
implicit def protoVal(value: vt.Tile.Value): Value = {
private[vectortile] implicit def protoVal(value: vt.Tile.Value): Value = {
if (value.stringValue.isDefined) {
VString(value.stringValue.get)
} else if (value.floatValue.isDefined) {
Expand Down
Expand Up @@ -22,7 +22,7 @@
package geotrellis.vectortile.internal.vector_tile

@SerialVersionUID(0L)
final case class Tile(
private[vectortile] final case class Tile(
layers: _root_.scala.collection.Seq[Tile.Layer] = _root_.scala.collection.Seq.empty
) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[Tile] with com.trueaccord.lenses.Updatable[Tile] {
@transient
Expand Down
Expand Up @@ -21,7 +21,7 @@

package geotrellis.vectortile.internal.vector_tile

object VectorTileProto {
private[vectortile] object VectorTileProto {
private lazy val ProtoBytes: Array[Byte] =
com.trueaccord.scalapb.Encoding.fromBase64(scala.collection.Seq(
"""ChF2ZWN0b3JfdGlsZS5wcm90bxILdmVjdG9yX3RpbGUi4wUKBFRpbGUSLwoGbGF5ZXJzGAMgAygLMhcudmVjdG9yX3RpbGUuV
Expand Down
7 changes: 5 additions & 2 deletions vectortile/src/main/scala/geotrellis/vectortile/package.scala
Expand Up @@ -16,7 +16,10 @@

package geotrellis

/** Invented by [[https://www.mapbox.com/ Mapbox]], VectorTiles are a combination of the
/**
* ''This package is experimental. Expect API flux.''
*
* Invented by [[https://www.mapbox.com/ Mapbox]], VectorTiles are a combination of the
* ideas of finite-sized tiles and vector geometries. Mapbox maintains the
* official implementation spec for VectorTile codecs. The specification is free
* and open source.
Expand Down Expand Up @@ -96,4 +99,4 @@ package geotrellis
* @author cwoodbury@azavea.com
* @version 2.1
*/
package object vectortile
package object vectortile {}

0 comments on commit 981a0ee

Please sign in to comment.