Skip to content

Commit a1cab28

Browse files
authored
Add more Scala syntax (#32)
1 parent 4e2463a commit a1cab28

File tree

3 files changed

+30
-4
lines changed

3 files changed

+30
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [2.1.4] - 2020-03-03
10+
### Added
11+
- Add more Scala syntax extensions [#32](https://github.com/PDAL/java/pull/32)
12+
913
## [2.1.3] - 2020-03-03
1014
### Fixed
1115
- Fix Scala DSL hierarchy [#31](https://github.com/PDAL/java/issues/31)

core-scala/src/main/scala/io/pdal/pipeline/Implicits.scala

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,35 @@
1616

1717
package io.pdal.pipeline
1818

19-
import io.pdal.PointCloud
19+
import io.pdal._
2020
import org.locationtech.jts.geom.Coordinate
2121

22+
import java.util
23+
import java.nio.ByteBuffer
24+
2225
object Implicits extends Implicits with Serializable
2326

2427
trait Implicits {
25-
implicit class withPointCloudMethods(pointCloud: PointCloud) {
26-
def getCoordinate(i: Int) = new Coordinate(pointCloud.getX(i), pointCloud.getY(i), pointCloud.getZ(i))
28+
implicit class withPointCloudMethods(self: PointCloud) {
29+
def getCoordinate(i: Int) = new Coordinate(self.getX(i), self.getY(i), self.getZ(i))
30+
31+
def get(idx: Int, dims: SizedDimType*)(implicit d0: DummyImplicit): ByteBuffer =
32+
self.get(idx, dims.toArray)
33+
def get(idx: Int, dims: DimType*)(implicit d0: DummyImplicit, d1: DummyImplicit): ByteBuffer =
34+
self.get(idx, dims.toArray)
35+
def get(idx: Int, dims: String*)(implicit d0: DummyImplicit, d1: DummyImplicit, d2: DummyImplicit): ByteBuffer =
36+
self.get(idx, dims.toArray)
37+
}
38+
39+
implicit class withPointViewMethods(self: PointView) {
40+
def getPointCloud(dims: DimType*): PointCloud = self.getPointCloud(dims.toArray)
41+
def get(idx: Int, packedPoints: Array[Byte], dims: DimType*): Array[Byte] = self.get(idx, packedPoints, dims.toArray)
42+
def getPackedPoint(idx: Long, dims: DimType*): Array[Byte] = self.getPackedPoint(idx, dims.toArray)
43+
def getPackedPoints(dims: DimType*): Array[Byte] = self.getPackedPoints(dims.toArray)
44+
}
45+
46+
implicit class withPointLayoutMethods(self: PointLayout) {
47+
def toSizedDimTypes(dimTypes: DimType*): util.Map[String, SizedDimType] =
48+
self.toSizedDimTypes(dimTypes.toArray)
2749
}
2850
}

examples/pdal-jni/build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ resolvers ++= Seq(
2121

2222
fork := true
2323

24-
val pdalVersion = "2.1.3"
24+
val pdalVersion = "2.1.4"
2525

2626
libraryDependencies ++= Seq(
2727
"io.pdal" %% "pdal" % pdalVersion,

0 commit comments

Comments
 (0)