
vectorpipe.relations.utils.package.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vectorpipe_2.11 Show documentation
Show all versions of vectorpipe_2.11 Show documentation
Import OSM data and output to VectorTiles with GeoTrellis.
The newest version!
package vectorpipe.relations
import org.locationtech.jts.geom.CoordinateSequence
package object utils {
/**
* Tests whether two {@link CoordinateSequence}s are equal.
* To be equal, the sequences must be the same length.
* They do not need to be of the same dimension,
* but the ordinate values for the smallest dimension of the two
* must be equal.
* Two NaN
ordinates values are considered to be equal.
*
* Ported to Scala from JTS 1.15.0
*
* @param cs1 a CoordinateSequence
* @param cs2 a CoordinateSequence
* @return true if the sequences are equal in the common dimensions
*/
def isEqual(cs1: CoordinateSequence, cs2: CoordinateSequence): Boolean = {
if (cs1.size != cs2.size) {
false
} else {
val dim = Math.min(cs1.getDimension, cs2.getDimension)
(0 until cs1.size).forall(i => {
(0 until dim).forall(d => {
val v1 = cs1.getOrdinate(i, d)
val v2 = cs2.getOrdinate(i, d)
v1 == v2 || (v1 == Double.NaN && v2 == Double.NaN)
})
})
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy