use of org.neo4j.values.storable.PointValue in project neo4j by neo4j.
the class LiteralJavaccParserTest method shouldInterpretPoint.
@Test
void shouldInterpretPoint() throws ParseException {
PointValue point = PointValue.parse("{ x:3, y:0 }");
assertEquals(point, parseLiteral("point({ x:3, y:0 })"));
PointValue point3d = PointValue.parse("{ x:0, y:4, z:1 }");
assertEquals(point3d, parseLiteral("point({ x:0, y:4, z:1 })"));
PointValue pointWGS84 = PointValue.parse("{ longitude: 56.7, latitude: 12.78 }");
assertEquals(pointWGS84, parseLiteral("point({ longitude: 56.7, latitude: 12.78 })"));
assertEquals(pointWGS84.getCoordinateReferenceSystem().getName(), "wgs-84");
assertThrows(IllegalArgumentException.class, () -> parseLiteral("point(2020)"));
assertNull(parseLiteral("point(null)"));
}
use of org.neo4j.values.storable.PointValue in project neo4j by neo4j.
the class AppendOnlyValuesContainer method readPointArray.
private static PointArray readPointArray(ByteBuffer bb, int offset) {
final int len = bb.getInt(offset);
offset += Integer.BYTES;
final PointValue[] array = new PointValue[len];
for (int i = 0; i < len; i++) {
final PointValue point = readPoint(bb, offset);
array[i] = point;
offset += Integer.BYTES + point.getCoordinateReferenceSystem().getDimension() * Double.BYTES;
}
return pointArray(array);
}
Aggregations